-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add info icon with tooltip to form fields #729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wkillerud
wants to merge
15
commits into
next
Choose a base branch
from
WARP-1396-form-info-tooltips
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
56aa4f4
fix(textfield): use aria-labelledby for the tooltip association
wkillerud c2860fe
fix(textfield): export the tooltip CSS parts
wkillerud dd045ee
test(textfield): look for the presence of w-tooltip
wkillerud c851a91
docs: add stories for all the forms that should have tooltip
wkillerud 682011b
feat(textarea): add tooltip property
wkillerud f4df835
feat(slider): add the tooltip property
wkillerud 230531f
feat(select): add the tooltip property
wkillerud 484f936
fix: use aria-describedby since we are inside a label element
wkillerud c12a9c0
feat(radio): add tooltip property
wkillerud 5ff0916
feat(datepicker): add tooltip, optional, required props
wkillerud 35c6fef
feat(tooltip): forward the tooltip property to w-textfield
wkillerud ebe8b8c
feat(checkbox): add the tooltip prop
wkillerud 949ad8c
feat(checkbox): add the tooltip prop
wkillerud 5d9b35d
chore: lint
wkillerud c4484a4
test: datepicker form validation tests and bugfixes
wkillerud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import { css } from "lit"; | ||
|
|
||
| /** | ||
| * Shared styles for input components (textfield, textarea, select) | ||
| * using the internal token pattern with a public styling API. | ||
| * | ||
| * Public API tokens (customizable): | ||
| * - Label: --w-c-input-label-* | ||
| * - Help text: --w-c-input-help-text-* | ||
| * - Optional indicator: --w-c-input-optional-* | ||
| */ | ||
|
|
||
| export const inputLabelStyles = css` | ||
| /* Label component tokens with semantic fallbacks */ | ||
| label { | ||
| /* Internal tokens - not part of public API */ | ||
| --_color: var(--w-c-input-label-color, var(--w-s-color-text)); | ||
| --_font-size: var(--w-c-input-label-font-size, var(--w-font-size-s)); | ||
| --_line-height: var(--w-c-input-label-line-height, var(--w-line-height-s)); | ||
| --_font-weight: var(--w-c-input-label-font-weight, 700); | ||
| --_padding-bottom: var(--w-c-input-label-padding-bottom, 0.4rem); | ||
| --_cursor: var(--w-c-input-label-cursor, pointer); | ||
| --_display: var(--w-c-input-label-display, block); | ||
|
|
||
| /* Apply styles */ | ||
| display: var(--_display); | ||
| position: relative; | ||
| font-size: var(--_font-size); | ||
| line-height: var(--_line-height); | ||
| font-weight: var(--_font-weight); | ||
| padding-bottom: var(--_padding-bottom); | ||
| cursor: var(--_cursor); | ||
| color: var(--_color); | ||
| -webkit-font-smoothing: antialiased; | ||
| -moz-osx-font-smoothing: grayscale; | ||
| } | ||
|
|
||
| /* Optional text styling */ | ||
| label span { | ||
| --_padding-left: var(--w-c-input-optional-padding-left, 0.8rem); | ||
| --_font-weight: var(--w-c-input-optional-font-weight, 400); | ||
| --_font-size: var(--w-c-input-optional-font-size, var(--w-font-size-s)); | ||
| --_line-height: var( | ||
| --w-c-input-optional-line-height, | ||
| var(--w-line-height-s) | ||
| ); | ||
| --_color: var(--w-c-input-optional-color, var(--w-s-color-text-subtle)); | ||
|
|
||
| padding-left: var(--_padding-left); | ||
| font-weight: var(--_font-weight); | ||
| font-size: var(--_font-size); | ||
| line-height: var(--_line-height); | ||
| color: var(--_color); | ||
| } | ||
|
|
||
| [part="tooltip-target"] { | ||
| appearance: none; | ||
| background: transparent; | ||
| height: 16px; | ||
| margin: 0 0 0 4px; | ||
| padding: 0; | ||
| vertical-align: text-top; | ||
| } | ||
|
|
||
| w-tooltip { | ||
| display: inline-block; | ||
| } | ||
| `; | ||
|
|
||
| export const inputHelpTextStyles = css` | ||
| /* Help text component tokens with semantic fallbacks */ | ||
| :host { | ||
| --_help-text-color: var( | ||
| --w-c-input-help-text-color, | ||
| var(--w-s-color-text-subtle) | ||
| ); | ||
| --_help-text-font-size: var( | ||
| --w-c-input-help-text-font-size, | ||
| var(--w-font-size-xs) | ||
| ); | ||
| --_help-text-line-height: var( | ||
| --w-c-input-help-text-line-height, | ||
| var(--w-line-height-xs) | ||
| ); | ||
| --_help-text-margin-top: var(--w-c-input-help-text-margin-top, 0.4rem); | ||
| --_help-text-display: var(--w-c-input-help-text-display, block); | ||
| } | ||
|
|
||
| /* Invalid state overrides color */ | ||
| :host([invalid]) { | ||
| --_help-text-color: var( | ||
| --w-c-input-help-text-color-invalid, | ||
| var(--w-s-color-text-negative) | ||
| ); | ||
| } | ||
|
|
||
| .help-text { | ||
| font-size: var(--_help-text-font-size); | ||
| line-height: var(--_help-text-line-height); | ||
| margin-top: var(--_help-text-margin-top); | ||
| display: var(--_help-text-display); | ||
| color: var(--_help-text-color); | ||
| } | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this
inline-blockwe get some weird additional height compared to labels without the tooltip.