Skip to content

Commit 3b5b7f1

Browse files
Flodigcornut
authored andcommitted
fix(text-field): Display buttons for type number, documentation for number use case
1 parent 3ab9d54 commit 3b5b7f1

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
### Changed
2121

2222
- `Tooltip`: increment z-index making them appear above popovers.
23+
- `TextField`: display browser native buttons when used with type="number", add "number" use case documentation.
2324

2425
## [3.9.1][] - 2024-09-17
2526

packages/lumx-core/src/scss/components/date-picker/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
&__year {
1818
input[type="number"] {
19-
width: 4ch;
19+
width: 6ch;
2020
}
2121
}
2222

packages/lumx-core/src/scss/components/text-field/_mixins.scss

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@
8989
border: none;
9090
outline: none;
9191

92-
&[type="number"] {
93-
appearance: textfield;
94-
}
92+
// Always show the up/down arrow, not just on hover or focus
93+
&[type=number]::-webkit-inner-spin-button,
94+
&[type=number]::-webkit-outer-spin-button {
95+
opacity: 1;
9596

96-
&[type="number"]::-webkit-inner-spin-button,
97-
&[type="number"]::-webkit-outer-spin-button {
98-
appearance: none;
9997
}
10098

10199
@if $theme == lumx-base-const("theme", "LIGHT") {

packages/lumx-react/src/stories/generated/TextField/Demos.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export { App as Disabled } from './disabled';
1010
export { App as Helper } from './helper';
1111
export { App as Icon } from './icon';
1212
export { App as Invalid } from './invalid';
13+
export { App as Number } from './number';
1314
export { App as Placeholder } from './placeholder';
1415
export { App as Required } from './required';
1516
export { App as TextAreaInvalid } from './text-area-invalid';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../site-demo/content/product/components/text-field/react/number.tsx

packages/site-demo/content/product/components/text-field/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ Use Text areas when users are expected to enter more than one line of text.
8686

8787
<DemoBlock demo="text-area-invalid" withThemeSwitcher />
8888

89+
## Number
90+
91+
Use number input when users are expected to enter numeric values.
92+
93+
<DemoBlock demo="number" withThemeSwitcher />
94+
8995
### Properties
9096

9197
<PropTable component="TextField" />
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { TextField } from '@lumx/react';
2+
import React, { useState } from 'react';
3+
4+
export const App = ({ theme }: any) => {
5+
const [value, setValue] = useState('');
6+
7+
return <TextField label="Number" value={value} type="number" onChange={setValue} theme={theme} />;
8+
};

0 commit comments

Comments
 (0)