-
Notifications
You must be signed in to change notification settings - Fork 107
feat(ui-number-input): rewrite NumberInput to the new theming system #2271
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
base: v12
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ const calcFocusOutlineStyles = ( | |
| transition: 'outline-color 0.2s, outline-offset 0.25s' | ||
| }), | ||
| outlineOffset: '-0.8rem', | ||
| outlineStyle: 'solid', | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a small fix for the focus outline not showing because CSS styles were reset by |
||
| outlineColor: alpha(outlineStyle.outlineColor, 0), | ||
| '&:focus': { | ||
| ...outlineStyle, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,6 +146,7 @@ export function wrapLucideIcon(Icon: LucideIcon): LucideIcon { | |
| return ( | ||
| <span css={styles?.lucideIcon} className={className} style={style}> | ||
| <Icon | ||
| name={Icon.displayName} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some unit tests target these by the display name |
||
| ref={handleElementRef} | ||
| size={numericSize} | ||
| color={customColor} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,7 @@ Note that this field **does not work | |
| uncontrolled** - you must pass event handlers if you want it to respond to | ||
| user input. | ||
|
|
||
| This example handles arrow buttons, up/down arrow keys, and typing into | ||
| the input. It also includes an `onBlur` handler that displays an error message | ||
| if the input is invalid or missing. | ||
| This example handles arrow buttons, up/down arrow keys, and typing into the input. It also includes an `onBlur` handler that displays an error message if the input is invalid or missing. | ||
|
|
||
| ```js | ||
| --- | ||
|
|
@@ -150,16 +148,43 @@ render(<Example />) | |
|
|
||
| > Note: `NumberInput` accepts a string or number as its `value`. However, the value returned by the `onChange` callback is always a string and should be converted to a number before attempting to augment it. | ||
|
|
||
| NumberInput comes in 2 sizes. The default size is "medium". | ||
| You can see here most of the visual states of the component. | ||
|
|
||
| ```js | ||
| --- | ||
| type: example | ||
| type: example | ||
| --- | ||
| <div> | ||
| <NumberInput renderLabel="Default-size input" /><br/> | ||
| <NumberInput size="large" renderLabel="Large-size input" /> | ||
| </div> | ||
| <Flex gap='medium' direction='column'> | ||
| <NumberInput | ||
| renderLabel='normal' | ||
| placeholder="placeholder" | ||
| /> | ||
| <NumberInput | ||
| interaction='disabled' | ||
| renderLabel='disabled' | ||
| placeholder="placeholder" | ||
| /> | ||
| <NumberInput | ||
| interaction='readonly' | ||
| renderLabel='readonly' | ||
| placeholder="placeholder" | ||
| /> | ||
| <NumberInput | ||
| renderLabel='with error message' | ||
| placeholder="placeholder" | ||
| messages={[{ text: 'This is an error.', type: 'error' }]} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m not sure about this, but as far as I know, this error message is the legacy format that users shouldn’t use. If that’s true, then we should show the newError message here instead.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is part of FormField and not this component, we will fix it there. (and AFAIK |
||
| /> | ||
| <NumberInput | ||
| renderLabel='with success message' | ||
| placeholder="placeholder" | ||
| messages={[{ text: 'Great success!', type: 'success' }]} | ||
| /> | ||
| <NumberInput | ||
| renderLabel='large size (default is "medium")' | ||
| placeholder="placeholder" | ||
| size='large' | ||
| /> | ||
| </Flex> | ||
| ``` | ||
|
|
||
| ### Guidelines | ||
|
|
||
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.
this fix recompiles + reloads docs when one changes something in this package