-
Notifications
You must be signed in to change notification settings - Fork 923
feat(InputTime): new component #5302
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
hywax
wants to merge
25
commits into
nuxt:v4
Choose a base branch
from
hywax:input-time
base: v4
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.
+1,452
β1
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e4c1e45
feat(InputTime): add component
hywax dce8077
feat(InputTime): enhance component with Time support and add InputTimβ¦
hywax 74bd137
test(InputTime): expand test cases for InputTime component with varioβ¦
hywax 00c5343
Merge branch 'v4' into input-time
hywax 10ad31f
fix(InputTime): improve key handling and trim segment values in TimeFβ¦
hywax a573428
docs(InputTime): update documentation to reflect hourCycle prop and rβ¦
hywax fa460eb
refactor(InputTime): remove console.log statement from TimeFieldInput
hywax 5bba77c
docs(InputTime): add defaultValue prop to InputTime documentation
hywax 89d8249
test(InputTime): update snapshots to reflect changes in InputTime comβ¦
hywax 1b0346a
Apply suggestion from @vercel[bot]
hywax 0a3272d
Merge branch 'v4' into input-time
benjamincanac 30af604
clean
benjamincanac 4799f21
Merge branch 'v4' into pr/5302
benjamincanac 68929ae
docs: add images
benjamincanac bc4a79d
fix(InputTime): update snapshot tests to reflect changes in componentβ¦
hywax efca0ed
improve component theme
benjamincanac 1278d32
docs: fix dir name
benjamincanac f5d532b
Merge branch 'v4' into pr/5302
benjamincanac f36ff83
fix: ignore `asChild`
benjamincanac 6727838
test: update
benjamincanac 6a79e77
fix: clean forward omit
benjamincanac d175ce3
docs: clean
benjamincanac 6c9dd93
Update src/runtime/components/InputTime.vue
hywax 4acf34a
feat(InputTime): add UIcon and UAvatar imports for enhanced functionaβ¦
hywax 1666d70
fix: use `text-muted` on literal segment
benjamincanac 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
11 changes: 11 additions & 0 deletions
11
docs/app/components/content/examples/input-time/InputTimeFormFieldExample.vue
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,11 @@ | ||
| <script setup lang="ts"> | ||
| import { Time } from '@internationalized/date' | ||
|
|
||
| const time = shallowRef(new Time(12, 30, 0)) | ||
| </script> | ||
|
|
||
| <template> | ||
| <UFormField label="Time" help="Specify the time" required> | ||
| <UInputTime v-model="time" /> | ||
| </UFormField> | ||
| </template> | ||
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,181 @@ | ||
| --- | ||
| title: InputTime | ||
| description: 'An input for selecting a time.' | ||
| category: form | ||
| links: | ||
| - label: TimeField | ||
| icon: i-custom-reka-ui | ||
| to: https://reka-ui.com/docs/components/time-field | ||
| - label: GitHub | ||
| icon: i-simple-icons-github | ||
| to: https://github.com/nuxt/ui/blob/v4/src/runtime/components/InputTime.vue | ||
| navigation.badge: Soon | ||
| --- | ||
|
|
||
| ## Usage | ||
|
|
||
| Use the `v-model` directive to control the selected date. | ||
|
|
||
| ::component-code | ||
| --- | ||
| cast: | ||
| modelValue: TimeValue | ||
| ignore: | ||
| - modelValue | ||
| external: | ||
| - modelValue | ||
| props: | ||
| modelValue: [12, 30, 0] | ||
| --- | ||
| :: | ||
|
|
||
| Use the `default-value` prop to set the initial value when you do not need to control its state. | ||
|
|
||
| ::component-code | ||
| --- | ||
| cast: | ||
| defaultValue: TimeValue | ||
| ignore: | ||
| - defaultValue | ||
| external: | ||
| - defaultValue | ||
| props: | ||
| defaultValue: [12, 30, 0] | ||
| --- | ||
| :: | ||
|
|
||
| ::note | ||
| This component relies on the [`@internationalized/date`](https://react-spectrum.adobe.com/internationalized/date/index.html) package which provides objects and functions for representing and manipulating dates and times in a locale-aware manner. | ||
| :: | ||
|
|
||
| ### Hour Cycle | ||
|
|
||
| Use the `hour-cycle` prop to change the hour cycle of the InputTime. Defaults to `12`. | ||
|
|
||
| ::component-code | ||
| --- | ||
| cast: | ||
| defaultValue: TimeValue | ||
| ignore: | ||
| - hourCycle | ||
| - defaultValue | ||
| external: | ||
| - defaultValue | ||
| props: | ||
| hourCycle: 24 | ||
| defaultValue: [16, 30, 0] | ||
| --- | ||
| :: | ||
|
|
||
| ### Color | ||
|
|
||
| Use the `color` prop to change the color of the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| props: | ||
| color: neutral | ||
| highlight: true | ||
| --- | ||
| :: | ||
|
|
||
| ::note | ||
| The `highlight` prop is used here to show the focus state. It's used internally when a validation error occurs. | ||
| :: | ||
|
|
||
| ### Variant | ||
|
|
||
| Use the `variant` prop to change the variant of the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| props: | ||
| variant: subtle | ||
| --- | ||
| :: | ||
|
|
||
| ### Size | ||
|
|
||
| Use the `size` prop to change the size of the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| props: | ||
| size: xl | ||
| --- | ||
| :: | ||
|
|
||
| ### Icon | ||
|
|
||
| Use the `icon` prop to show an [Icon](/docs/components/icon) inside the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| props: | ||
| icon: 'i-lucide-clock' | ||
| --- | ||
| :: | ||
|
|
||
| ::note | ||
| Use the `leading` and `trailing` props to set the icon position or the `leading-icon` and `trailing-icon` props to set a different icon for each position. | ||
| :: | ||
|
|
||
| ### Avatar | ||
|
|
||
| Use the `avatar` prop to show an [Avatar](/docs/components/avatar) inside the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| prettier: true | ||
| props: | ||
| avatar: | ||
| src: 'https://github.com/vuejs.png' | ||
| size: md | ||
| variant: outline | ||
| --- | ||
| :: | ||
|
|
||
| ### Disabled | ||
|
|
||
| Use the `disabled` prop to disable the InputTime. | ||
|
|
||
| ::component-code | ||
| --- | ||
| props: | ||
| disabled: true | ||
| --- | ||
| :: | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Within a FormField | ||
|
|
||
| You can use the InputTime within a [FormField](/docs/components/form-field) component to display a label, help text, required indicator, etc. | ||
|
|
||
| ::component-example | ||
| --- | ||
| name: 'input-time-form-field-example' | ||
| --- | ||
| :: | ||
|
|
||
| ## API | ||
|
|
||
| ### Props | ||
|
|
||
| :component-props | ||
|
|
||
| ### Slots | ||
|
|
||
| :component-slots | ||
|
|
||
| ### Emits | ||
|
|
||
| :component-emits | ||
|
|
||
| ## Theme | ||
|
|
||
| :component-theme | ||
|
|
||
| ## Changelog | ||
|
|
||
| :component-changelog |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,38 @@ | ||
| <script setup lang="ts"> | ||
| import { Time } from '@internationalized/date' | ||
| import theme from '#build/ui/input-time' | ||
|
|
||
| const colors = Object.keys(theme.variants.color) | ||
| const sizes = Object.keys(theme.variants.size) | ||
| const variants = Object.keys(theme.variants.variant) | ||
|
|
||
| const attrs = reactive({ | ||
| color: [theme.defaultVariants.color], | ||
| size: [theme.defaultVariants.size], | ||
| variant: [theme.defaultVariants.variant] | ||
| }) | ||
|
|
||
| const value = shallowRef(new Time(12, 30)) | ||
| </script> | ||
|
|
||
| <template> | ||
| <Navbar> | ||
| <USelect v-model="attrs.color" :items="colors" multiple /> | ||
| <USelect v-model="attrs.variant" :items="variants" multiple /> | ||
| <USelect v-model="attrs.size" :items="sizes" multiple /> | ||
| </Navbar> | ||
|
|
||
| <Matrix v-slot="props" :attrs="attrs"> | ||
| <UInputTime v-model="value" autofocus v-bind="props" /> | ||
| <UInputTime :default-value="new Time(12, 30)" v-bind="props" /> | ||
| <UInputTime highlight v-bind="props" /> | ||
| <UInputTime disabled v-bind="props" /> | ||
| <UInputTime required v-bind="props" /> | ||
| <UInputTime icon="i-lucide-clock" v-bind="props" /> | ||
| <UInputTime icon="i-lucide-clock" trailing v-bind="props" /> | ||
| <UInputTime :avatar="{ src: 'https://github.com/benjamincanac.png' }" icon="i-lucide-clock" trailing v-bind="props" /> | ||
| <UInputTime loading v-bind="props" /> | ||
| <UInputTime loading trailing v-bind="props" /> | ||
| <UInputTime loading icon="i-lucide-clock" trailing-icon="i-lucide-chevron-down" v-bind="props" /> | ||
| </Matrix> | ||
| </template> |
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.
Uh oh!
There was an error while loading. Please reload this page.