-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: introduce NumberInput #4475
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
Merged
Merged
Changes from all commits
Commits
Show all changes
150 commits
Select commit
Hold shift + click to select a range
0764168
feat(number-field): init structure
wingkwong 2101db4
Merge branch 'canary' into feat/eng-363
wingkwong 0bfd74d
feat(deps): add `@nextui-org/button` & `@react-types/button`
wingkwong 914783f
feat(theme): export number-field
wingkwong 18d7139
feat(number-field): storybook init structure
wingkwong 4dff6f1
feat(number-field): add NumberFieldHorizontalStepper
wingkwong d3ba207
feat(number-field): add NumberFieldHorizontalStepper
wingkwong e9b3049
feat(theme): init number field theme
wingkwong a8a7a77
feat(number-field): number-field draft
wingkwong 9a9cb46
refactor(number-field): revise stepper icons
wingkwong 5b55991
feat(shared-icons): add ChevronLeftIcon
wingkwong 52d3673
feat(theme): stepperButton styles
wingkwong b67320d
feat(theme): number-field styles
wingkwong 37b06be
fix(number-field): label layout
wingkwong 31b971c
Merge branch 'canary' into feat/eng-363
wingkwong 3adda56
feat(number-field): vertical stepper wrapper
wingkwong 734af76
feat(number-field): use-number-field (wip)
wingkwong 7f49f00
feat(number-field): add data-direction
wingkwong f3f8057
feat(theme): center the text if it is horizontal stepper
wingkwong 0ddddd6
feat(number-field): add HorizontalStepper
wingkwong 2cc8470
feat(number-field): add HideStepper
wingkwong 79d2cbc
chore(number-field): revise minValue & defaultValue
wingkwong c82faa6
feat(docs): init number field structure
wingkwong 823bc99
fix(theme): outside-left styles
wingkwong 14e284b
Merge branch 'canary' into feat/eng-363
wingkwong 8d54dab
refactor(theme): remove labelPlacement styles
wingkwong 5998dea
refactor(number-field): remove labelContent logic
wingkwong 7d17aef
refactor(number-field): remove labelPlacement args
wingkwong 3f5d8f0
Merge branch 'canary' into feat/eng-363
wingkwong 0ad45c8
feat(number-field): helper text
wingkwong 6f42342
feat(number-field): revise number field stories
wingkwong 68fd5be
feat(number-field): description
wingkwong 8fca2bc
refactor(number-field): revise number field stories
wingkwong 9897a56
feat(theme): numberFieldLabelClasses
wingkwong d085088
fix(number-field): incorrect button props
wingkwong 61c991e
fix(number-field): typing issue on stepper buttons
wingkwong ad56507
Merge branch 'canary' into feat/eng-363
wingkwong 2f78e9c
chore(number-field): add aria-label
wingkwong 04e6bc9
refactor(number-field): merge props
wingkwong 29c32bf
fix(number-field): pass originalProps instead
wingkwong 2da4d9c
chore(number-field): revise Required story args
wingkwong 1c3d416
feat(number-field): add WithStepValue & WithWheelDisabled & revise st…
wingkwong 9af3f4b
chore(number-field): add label to Required
wingkwong 1c3858a
feat(docs): number-field doc page
wingkwong 5448878
fix(number-field): typing issue
wingkwong b7028a6
fix(number-field): test cases
wingkwong ed783f3
fix(number-field): user.keyboard & defaultValue
wingkwong 02ff389
fix(number-field): should work with defaultValues
wingkwong c628b0c
chore(number-field): add type: number
wingkwong fb82263
chore(number-field): remove hidden related code
wingkwong 59433b0
fix(number-field): numeric value
wingkwong 498e02d
chore(changeset): add changeset
wingkwong 439eee5
feat(deps): add "@nextui-org/number-field" to docs
wingkwong 5b26972
feat(react): export `@nextui-org/number-field`
wingkwong cf7e2e3
feat(changeset): add @nextui-org/react
wingkwong 7cf4fd4
feat(docs): number-field examples
wingkwong 10f80f4
chore(number-field): use text instead
wingkwong eb9ba4c
refactor(number-field): remove unnecessary filled-within
wingkwong 6ba9b27
fix(number-field): test case
wingkwong 4c71835
Merge branch 'canary' into feat/eng-363
wingkwong 500a161
chore(number-field): remove aria-label for stepper buttons
wingkwong 5be13df
feat(docs): add incrementAriaLabel & decrementAriaLabel to NumberField
wingkwong 9d7ba10
chore(number-field): reorder WithFormatOptions
wingkwong c165bef
fix(deps): update number-field's peerDependencies & dependencies
wingkwong 231bc83
feat(number-field): hidden input for holding numeric vaule
wingkwong 5d2cd06
fix(docs): number field title
wingkwong 939eda8
feat(docs): add format options to number field
wingkwong db3a825
chore(docs): revise number field content
wingkwong 85ce591
chore(number-field): add type to useDOMRef
wingkwong b39f664
fix(number-field): clear button
wingkwong a00a316
fix(theme): clear button styles
wingkwong f7cb758
refactor(theme): stepper button styles
wingkwong 843849b
chore(number-field): accept stepperButton class
wingkwong ac0c559
fix(theme): helper wrapper padding
wingkwong 25ad5cb
feat(deps): add `@react-aria/i18n`
wingkwong b8de20c
fix(number-field): use locale from `@react-aria/i18n`
wingkwong c097167
Merge branch 'canary' into feat/eng-363
wingkwong 01bcd26
fix(deps): dependency order
wingkwong 9510a41
Merge branch 'canary' into feat/eng-363
wingkwong 51a88d1
fix(docs): incorrect command
wingkwong cd00b74
chore(docs): remove type=number
wingkwong 8bf0ee1
chore(theme): add padding to stepper wrapper
wingkwong 3cda10a
Merge branch 'canary' into feat/eng-363
wingkwong 26dd43c
fix(number-field): avoid resetting value
wingkwong db74c64
fix(number-field): storybook
wingkwong 64813cc
chore(docs): remove custom impl
wingkwong 4ee3dfe
chore(docs): update docs code & content
wingkwong 2a9c413
Merge branch 'canary' into feat/eng-363
wingkwong 8d5f350
chore(number-field): migrate to heroui
wingkwong 5b02110
Merge branch 'canary' into feat/eng-363
wingkwong 757c33b
chore(number-field): migrate to heroui
wingkwong 0e0bb87
chore(number-field): migrate to heroui
wingkwong 4d02f08
chore: rename to number input
wingkwong 18d4cb1
fix(number-input): incorrect import
wingkwong bfcafcc
chore(docs): rename to number input
wingkwong 569e224
chore: change to number input
wingkwong 950b340
refactor(number-input): change label to amount
wingkwong 27db56f
fix(docs): use heroui commands
wingkwong 60fae38
chore(changeset): update package name
wingkwong d9835c0
Merge branch 'canary' into feat/eng-363
wingkwong d777642
Merge branch 'canary' into feat/eng-363
wingkwong 10c2d63
refactor(number-input): remove steps
wingkwong a6a80a2
refactor: remove helper text
wingkwong 05273f4
feat(number-input): label placement
wingkwong 1f5a6f8
refactor(number-input): rename stepper
wingkwong 65f65c0
fix(theme): isClearable
wingkwong 0a92df1
feat(docs): add label placements
wingkwong 5fc9aa0
refactor(docs): update number-input content
wingkwong 278e9fb
Merge branch 'canary' into feat/eng-363
wingkwong d69ba34
fix(docs): incorrect file
wingkwong 3370a70
feat(docs): add lablePlacement
wingkwong 520a0ab
refactor(docs): remove labelPlacement & startContent
wingkwong 106e4c4
refactor(docs): remove helperText
wingkwong d079509
refactor(docs): remove helperText
wingkwong ab5766e
refactor(docs): revise description
wingkwong 4866e09
feat(number-input): add data-slot for stepper-wrapper
wingkwong 87483c0
fix(number-input): test cases
wingkwong 34c6a60
fix(docs): unexpected change
wingkwong 53032f2
refactor(number-input): update outdated info
wingkwong 73e0af4
fix(docs): coderabbitai comments
wingkwong 9198bde
refactor: remove validationState
wingkwong 4db884b
fix(docs): typo
wingkwong 0858fd8
chore(deps): remove unnecessary dep
wingkwong 700318b
Merge branch 'canary' into feat/eng-363
wingkwong a9df502
chore(deps): bump RA versions
wingkwong fb635e5
chore(number-input): apply latest labelPlacement change
wingkwong f09ed32
refactor(number-input): update author
wingkwong 9c4e3e2
Merge branch 'canary' into feat/eng-363
wingkwong 40ca83b
refactor(number-input): revise stepper wrapper alignment
wingkwong cc3231f
refactor(number-input): stepper button styles
wingkwong 13df8b5
chore(number-input): add disableRipple
wingkwong 84a45db
fix(theme): increase stepper button click area
wingkwong f6ff930
fix(number-input): sync latest validationBehavior changes
wingkwong 1decf88
fix(number-input): pass validationBehavior to useAriaNumberInput
wingkwong 0173a36
chore(docs): add import react
wingkwong 3f6eda7
Merge branch 'canary' into feat/eng-363
wingkwong 7f04255
chore(number-input): remove HorizontalStepper story
wingkwong 2021ce6
chore(number-input): enable ripple
wingkwong aebd00a
fix(number-input): remove number type
wingkwong aaf5fed
refactor(theme): follow input clear button styles
wingkwong a7d93b7
feat(theme): add color for stepperButton
wingkwong 9edef40
fix(theme): revise stepperButton size for outside & outside-left cases
wingkwong 7cb3d67
fix(number-input): typo
wingkwong b840ed3
chore(docs): update description for wheel
wingkwong ddf4013
Merge branch 'canary' into feat/eng-363
wingkwong ccd1c80
chore(theme): change opacity when pressed
wingkwong 4405265
chore(number-input): add disableRipple
wingkwong a11f28e
Update .changeset/witty-flies-reflect.md
jrgarciadev b78a5d5
Merge branch 'canary' into feat/eng-363
wingkwong 7e94eeb
fix(theme): add hover opacity effect
wingkwong 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@heroui/number-input": patch | ||
| "@heroui/shared-icons": patch | ||
| "@heroui/theme": patch | ||
| "@heroui/react": patch | ||
| --- | ||
|
|
||
| introduce NumberInput |
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
16 changes: 16 additions & 0 deletions
16
apps/docs/content/components/number-input/clear-button.raw.jsx
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,16 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <NumberInput | ||
| isClearable | ||
| className="max-w-xs" | ||
| defaultValue={1024} | ||
| label="Amount" | ||
| placeholder="Enter the amount" | ||
| variant="bordered" | ||
| // eslint-disable-next-line no-console | ||
| onClear={() => console.log("number input cleared")} | ||
| /> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./clear-button.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
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,20 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| const colors = ["default", "primary", "secondary", "success", "warning", "danger"]; | ||
|
|
||
| return ( | ||
| <div className="w-full flex flex-row flex-wrap gap-4"> | ||
| {colors.map((color) => ( | ||
| <NumberInput | ||
| key={color} | ||
| className="max-w-[220px]" | ||
| color={color} | ||
| defaultValue={1024} | ||
| label="Amount" | ||
| placeholder="Enter the amount" | ||
| /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./colors.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
18 changes: 18 additions & 0 deletions
18
apps/docs/content/components/number-input/controlled.raw.jsx
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,18 @@ | ||
| import React from "react"; | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| const [value, setValue] = React.useState(); | ||
|
|
||
| return ( | ||
| <div className="w-full flex flex-col gap-2 max-w-[240px]"> | ||
| <NumberInput | ||
| label="Amount" | ||
| placeholder="Enter the amount" | ||
| value={value} | ||
| onValueChange={setValue} | ||
| /> | ||
| <p className="text-default-500 text-small">NumberInput value: {value}</p> | ||
| </div> | ||
| ); | ||
| } | ||
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,9 @@ | ||
| import App from "./controlled.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
39 changes: 39 additions & 0 deletions
39
apps/docs/content/components/number-input/custom-styles.raw.jsx
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,39 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div className="w-[340px] h-[240px] px-8 rounded-2xl flex justify-center items-center bg-gradient-to-tr from-pink-500 to-yellow-500 text-white shadow-lg"> | ||
| <NumberInput | ||
| isClearable | ||
| classNames={{ | ||
| label: "text-black/50 dark:text-white/90", | ||
| input: [ | ||
| "bg-transparent", | ||
| "text-black/90 dark:text-white/90", | ||
| "placeholder:text-default-700/50 dark:placeholder:text-white/60", | ||
| ], | ||
| innerWrapper: "bg-transparent", | ||
| inputWrapper: [ | ||
| "shadow-xl", | ||
| "bg-default-200/50", | ||
| "dark:bg-default/60", | ||
| "backdrop-blur-xl", | ||
| "backdrop-saturate-200", | ||
| "hover:bg-default-200/70", | ||
| "dark:hover:bg-default/70", | ||
| "group-data-[focus=true]:bg-default-200/50", | ||
| "dark:group-data-[focus=true]:bg-default/60", | ||
| "!cursor-text", | ||
| ], | ||
| helperText: "text-black/50 dark:text-white/90", | ||
| }} | ||
| description="The number of apples that Marcus bought" | ||
| helperText="Must be equal or greater than 1" | ||
| label="Number of apples" | ||
| minValue={1} | ||
| placeholder="Enter a number..." | ||
| radius="lg" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./custom-styles.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
43 changes: 43 additions & 0 deletions
43
apps/docs/content/components/number-input/custom-validation.raw.jsx
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,43 @@ | ||
| import React from "react"; | ||
| import {Button, Form, NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| const [submitted, setSubmitted] = React.useState(null); | ||
|
wingkwong marked this conversation as resolved.
|
||
|
|
||
| const onSubmit = (e) => { | ||
| e.preventDefault(); | ||
| const data = Object.fromEntries(new FormData(e.currentTarget)); | ||
|
|
||
| setSubmitted(data); | ||
| }; | ||
|
wingkwong marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <Form className="w-full max-w-xs" onSubmit={onSubmit}> | ||
| <NumberInput | ||
| isRequired | ||
| label="Amount" | ||
| name="amount" | ||
| placeholder="Enter a number" | ||
| validate={(value) => { | ||
| if (value < 100) { | ||
| return "Number must be greater than 100"; | ||
| } | ||
|
|
||
| if (value > 1000) { | ||
| return "Number must be less than 1000"; | ||
| } | ||
|
|
||
| return value === 777 ? "Nice try!" : null; | ||
| }} | ||
| /> | ||
| <Button color="primary" type="submit"> | ||
| Submit | ||
| </Button> | ||
|
wingkwong marked this conversation as resolved.
|
||
| {submitted && ( | ||
| <div className="text-small text-default-500"> | ||
| You submitted: <code>{JSON.stringify(submitted)}</code> | ||
| </div> | ||
| )} | ||
| </Form> | ||
| ); | ||
| } | ||
9 changes: 9 additions & 0 deletions
9
apps/docs/content/components/number-input/custom-validation.ts
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,9 @@ | ||
| import App from "./custom-validation.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
12 changes: 12 additions & 0 deletions
12
apps/docs/content/components/number-input/description.raw.jsx
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,12 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={1024} | ||
| description="Enter the amount" | ||
| label="Amount" | ||
| /> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./description.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
13 changes: 13 additions & 0 deletions
13
apps/docs/content/components/number-input/disabled.raw.jsx
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,13 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <NumberInput | ||
| isDisabled | ||
| aria-label="Amount" | ||
| className="max-w-xs" | ||
| defaultValue={1024} | ||
| placeholder="Enter the amount" | ||
| /> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./disabled.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
15 changes: 15 additions & 0 deletions
15
apps/docs/content/components/number-input/error-message.raw.jsx
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,15 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={1024} | ||
| errorMessage="Please enter a valid number" | ||
| isInvalid={true} | ||
| label="Amount" | ||
| placeholder="Enter the amount" | ||
| variant="bordered" | ||
| /> | ||
|
wingkwong marked this conversation as resolved.
|
||
| ); | ||
| } | ||
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,9 @@ | ||
| import App from "./error-message.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
60 changes: 60 additions & 0 deletions
60
apps/docs/content/components/number-input/format-options.raw.jsx
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,60 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div className="flex flex-col gap-4"> | ||
| <div className="flex w-full flex-wrap md:flex-nowrap mb-6 md:mb-0 gap-4"> | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={6} | ||
| formatOptions={{ | ||
| style: "currency", | ||
| currency: "USD", | ||
| }} | ||
| label="With Currency" | ||
| /> | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={6} | ||
| formatOptions={{ | ||
| signDisplay: "exceptZero", | ||
| minimumFractionDigits: 1, | ||
| maximumFractionDigits: 2, | ||
| }} | ||
| label="With Sign" | ||
| /> | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={6} | ||
| formatOptions={{ | ||
| style: "percent", | ||
| }} | ||
| label="With Percent" | ||
| /> | ||
| </div> | ||
| <div className="flex w-full flex-wrap md:flex-nowrap mb-6 md:mb-0 gap-4"> | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={6} | ||
| formatOptions={{ | ||
| style: "currency", | ||
| currency: "EUR", | ||
| currencyDisplay: "code", | ||
| currencySign: "accounting", | ||
| }} | ||
| label="With Currency Vaule" | ||
| /> | ||
| <NumberInput | ||
| className="max-w-xs" | ||
| defaultValue={6} | ||
| formatOptions={{ | ||
| style: "unit", | ||
| unit: "inch", | ||
| unitDisplay: "long", | ||
| }} | ||
| label="With Unit" | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./format-options.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
13 changes: 13 additions & 0 deletions
13
apps/docs/content/components/number-input/hide-stepper.raw.jsx
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,13 @@ | ||
| import {NumberInput} from "@heroui/react"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <NumberInput | ||
| hideStepper | ||
| className="max-w-xs" | ||
| defaultValue={1024} | ||
| label="Amount" | ||
| placeholder="Enter the amount" | ||
| /> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./hide-stepper.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
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.
Uh oh!
There was an error while loading. Please reload this page.