@bjj/nuxt-layer-shadcn-ui 0.15.17 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/app/assets/styles/controlSize.stories.ts +121 -0
  2. package/app/assets/styles/tailwind-utilities.css +94 -0
  3. package/app/components/ui/AsyncDataTable/index.vue +3 -3
  4. package/app/components/ui/Button/index.stories.ts +18 -10
  5. package/app/components/ui/Button/index.vue +36 -6
  6. package/app/components/ui/Button/types.ts +7 -1
  7. package/app/components/ui/Card/index.stories.ts +2 -2
  8. package/app/components/ui/CopyButton/index.stories.ts +1 -1
  9. package/app/components/ui/DatePicker/index.stories.ts +33 -0
  10. package/app/components/ui/DatePicker/index.vue +2 -0
  11. package/app/components/ui/DatePicker/types.ts +4 -0
  12. package/app/components/ui/DateRangePicker/index.stories.ts +31 -0
  13. package/app/components/ui/DateRangePicker/index.vue +3 -0
  14. package/app/components/ui/DateRangePicker/types.ts +3 -0
  15. package/app/components/ui/Dropdown/index.stories.ts +2 -2
  16. package/app/components/ui/InfiniteDataTable/index.vue +3 -3
  17. package/app/components/ui/Input/index.stories.ts +33 -0
  18. package/app/components/ui/Input/index.vue +39 -3
  19. package/app/components/ui/Input/types.ts +4 -0
  20. package/app/components/ui/InputCurrency/index.stories.ts +31 -0
  21. package/app/components/ui/InputCurrency/types.ts +1 -1
  22. package/app/components/ui/InputNumber/index.stories.ts +63 -0
  23. package/app/components/ui/InputNumber/index.vue +24 -11
  24. package/app/components/ui/InputNumber/types.ts +4 -0
  25. package/app/components/ui/InputOtp/index.stories.ts +31 -0
  26. package/app/components/ui/InputOtp/index.vue +6 -1
  27. package/app/components/ui/InputOtp/types.ts +4 -0
  28. package/app/components/ui/InputPercent/index.stories.ts +31 -0
  29. package/app/components/ui/InputPercent/types.ts +1 -1
  30. package/app/components/ui/InputRange/index.stories.ts +31 -0
  31. package/app/components/ui/PageCard/index.stories.ts +4 -4
  32. package/app/components/ui/Pagination/index.vue +7 -5
  33. package/app/components/ui/Popover/index.stories.ts +2 -2
  34. package/app/components/ui/SearchSelect/index.stories.ts +33 -0
  35. package/app/components/ui/SearchSelect/index.vue +2 -0
  36. package/app/components/ui/SearchSelect/types.ts +3 -0
  37. package/app/components/ui/Select/index.stories.ts +33 -0
  38. package/app/components/ui/Select/index.vue +20 -7
  39. package/app/components/ui/Select/types.ts +4 -0
  40. package/app/components/ui/StaticDataTable/index.vue +2 -2
  41. package/app/components/ui/Textarea/index.stories.ts +31 -0
  42. package/app/components/ui/Textarea/index.vue +11 -2
  43. package/app/components/ui/Textarea/types.ts +4 -0
  44. package/app/types/control.ts +5 -0
  45. package/package.json +2 -2
@@ -0,0 +1,121 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import Button from '../../components/ui/Button/index.vue'
3
+ import DatePicker from '../../components/ui/DatePicker/index.vue'
4
+ import Icon from '../../components/ui/Icon/index.vue'
5
+ import Input from '../../components/ui/Input/index.vue'
6
+ import InputNumber from '../../components/ui/InputNumber/index.vue'
7
+ import Select from '../../components/ui/Select/index.vue'
8
+ import Textarea from '../../components/ui/Textarea/index.vue'
9
+
10
+ const sizes = [ 'xs', 'sm', 'md', 'default', 'lg' ] as const
11
+
12
+ const options = [
13
+ { label: 'Nuxt', value: 'nuxt' },
14
+ { label: 'Vue', value: 'vue' },
15
+ { label: 'Vite', value: 'vite' },
16
+ ]
17
+
18
+ const meta = {
19
+ title: 'Theme/Control Size',
20
+ parameters: {
21
+ docs: {
22
+ description: {
23
+ component: 'Size tiers shared by form controls (inputs, selects, pickers, buttons). Each tier sets height, font size, padding, icon and inner button size through `data-control-size`; a control without its own `size` follows the nearest ancestor.',
24
+ },
25
+ },
26
+ },
27
+ } satisfies Meta
28
+
29
+ export default meta
30
+ type Story = StoryObj<typeof meta>
31
+
32
+ export const Tiers: Story = {
33
+ parameters: {
34
+ docs: {
35
+ source: {
36
+ code: `
37
+ <template>
38
+ <Input v-model="text" size="sm" />
39
+ <InputNumber v-model="count" size="sm" />
40
+ <Select v-model="framework" :options="options" size="sm" />
41
+ <Button size="sm" icon="search">Search</Button>
42
+ <Button size="icon-sm" variant="outline" icon="settings" />
43
+ </template>
44
+ `.trim(),
45
+ },
46
+ },
47
+ },
48
+ render: () => ({
49
+ components: { Button, DatePicker, Icon, Input, InputNumber, Select },
50
+ setup: () => ({
51
+ sizes,
52
+ iconSize: (s: typeof sizes[number]) => s === 'default' ? 'icon' : `icon-${s}`,
53
+ options,
54
+ text: ref('Hello'),
55
+ count: ref(10),
56
+ framework: ref('nuxt'),
57
+ date: ref(new Date(2026, 10, 20)),
58
+ }),
59
+ template: `
60
+ <div class="space-y-3">
61
+ <div v-for="s in sizes" :key="s" class="flex flex-wrap items-center gap-3">
62
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
63
+ <Input v-model="text" :size="s" class="w-44">
64
+ <template #prefix><Icon name="search" /></template>
65
+ </Input>
66
+ <InputNumber v-model="count" :size="s" class="w-36" />
67
+ <div class="w-40">
68
+ <Select v-model="framework" :options="options" :size="s" />
69
+ </div>
70
+ <div class="w-44">
71
+ <DatePicker v-model="date" :size="s" />
72
+ </div>
73
+ <Button :size="s" icon="search">Search</Button>
74
+ <Button :size="iconSize(s)" variant="outline" icon="settings" />
75
+ </div>
76
+ </div>
77
+ `,
78
+ }),
79
+ }
80
+
81
+ export const InheritedFromAncestor: Story = {
82
+ parameters: {
83
+ docs: {
84
+ source: {
85
+ code: `
86
+ <template>
87
+ <form data-control-size="sm">
88
+ <Input v-model="name" />
89
+ <InputNumber v-model="count" />
90
+ <Select v-model="framework" :options="options" />
91
+ <Textarea v-model="note" />
92
+ <Button icon="check">Save</Button>
93
+ </form>
94
+ </template>
95
+ `.trim(),
96
+ },
97
+ },
98
+ },
99
+ render: () => ({
100
+ components: { Button, Input, InputNumber, Select, Textarea },
101
+ setup: () => ({
102
+ options,
103
+ name: ref('Lot A'),
104
+ count: ref(10),
105
+ framework: ref('vue'),
106
+ note: ref('Every control inside follows the form tier.'),
107
+ }),
108
+ template: `
109
+ <div data-control-size="sm" class="grid max-w-sm gap-2">
110
+ <Input v-model="name" />
111
+ <InputNumber v-model="count" />
112
+ <Select v-model="framework" :options="options" />
113
+ <Textarea v-model="note" />
114
+ <div class="flex justify-end gap-2">
115
+ <Button variant="outline">Cancel</Button>
116
+ <Button icon="check">Save</Button>
117
+ </div>
118
+ </div>
119
+ `,
120
+ }),
121
+ }
@@ -21,3 +21,97 @@
21
21
  to { height: 0; }
22
22
  }
23
23
  }
24
+
25
+ /*
26
+ * Form control size scale, shared by every form control (inputs, selects,
27
+ * pickers, buttons …).
28
+ *
29
+ * A control opts in by reading these variables (`h-(--control-height)`,
30
+ * `px-(--control-px)` …) and sets a tier with `data-control-size`. The attribute
31
+ * cascades: a control without its own `size` follows the nearest ancestor that
32
+ * sets one, so a whole form can switch tiers at once. `default` is the
33
+ * pre-existing look and applies when no ancestor sets a tier.
34
+ *
35
+ * tier height font edge px gap icon stepper px addon button button px button+icon px
36
+ * xs 24 12 6 4 12 4 16 8 6
37
+ * sm 28 12 8 4 14 4 20 10 8
38
+ * md 32 14 10 6 16 6 24 12 10
39
+ * default 36 14 12 8 16 12 24 16 12
40
+ * lg 40 14 16 8 16 14 28 24 16
41
+ *
42
+ * --control-px inline padding at an input's outer edges
43
+ * --control-gap tighter padding where the value meets an addon; gap between button content
44
+ * --control-stepper-px inline padding of InputNumber's −/+ steppers
45
+ * --control-addon-button-size square icon buttons inside an input (clear …)
46
+ * --control-button-px inline padding of a text Button
47
+ * --control-button-icon-px the same when an icon is the button's direct child
48
+ *
49
+ * Icon-only buttons are squares of `--control-height`.
50
+ *
51
+ * Components whose default font is `text-base md:text-sm` (Input, Select,
52
+ * Textarea …) keep 16px below `md` to avoid iOS focus zoom and apply
53
+ * `--control-font-size` from `md` up.
54
+ */
55
+ @layer base {
56
+ :root,
57
+ [data-control-size='default'] {
58
+ --control-height: --spacing(9);
59
+ --control-font-size: --theme(--text-sm);
60
+ --control-line-height: --theme(--text-sm--line-height);
61
+ --control-px: --spacing(3);
62
+ --control-gap: --spacing(2);
63
+ --control-icon: --spacing(4);
64
+ --control-stepper-px: --spacing(3);
65
+ --control-addon-button-size: --spacing(6);
66
+ --control-button-px: --spacing(4);
67
+ --control-button-icon-px: --spacing(3);
68
+ }
69
+ [data-control-size='xs'] {
70
+ --control-height: --spacing(6);
71
+ --control-font-size: --theme(--text-xs);
72
+ --control-line-height: --theme(--text-xs--line-height);
73
+ --control-px: --spacing(1.5);
74
+ --control-gap: --spacing(1);
75
+ --control-icon: --spacing(3);
76
+ --control-stepper-px: --spacing(1);
77
+ --control-addon-button-size: --spacing(4);
78
+ --control-button-px: --spacing(2);
79
+ --control-button-icon-px: --spacing(1.5);
80
+ }
81
+ [data-control-size='sm'] {
82
+ --control-height: --spacing(7);
83
+ --control-font-size: --theme(--text-xs);
84
+ --control-line-height: --theme(--text-xs--line-height);
85
+ --control-px: --spacing(2);
86
+ --control-gap: --spacing(1);
87
+ --control-icon: --spacing(3.5);
88
+ --control-stepper-px: --spacing(1);
89
+ --control-addon-button-size: --spacing(5);
90
+ --control-button-px: --spacing(2.5);
91
+ --control-button-icon-px: --spacing(2);
92
+ }
93
+ [data-control-size='md'] {
94
+ --control-height: --spacing(8);
95
+ --control-font-size: --theme(--text-sm);
96
+ --control-line-height: --theme(--text-sm--line-height);
97
+ --control-px: --spacing(2.5);
98
+ --control-gap: --spacing(1.5);
99
+ --control-icon: --spacing(4);
100
+ --control-stepper-px: --spacing(1.5);
101
+ --control-addon-button-size: --spacing(6);
102
+ --control-button-px: --spacing(3);
103
+ --control-button-icon-px: --spacing(2.5);
104
+ }
105
+ [data-control-size='lg'] {
106
+ --control-height: --spacing(10);
107
+ --control-font-size: --theme(--text-sm);
108
+ --control-line-height: --theme(--text-sm--line-height);
109
+ --control-px: --spacing(4);
110
+ --control-gap: --spacing(2);
111
+ --control-icon: --spacing(4);
112
+ --control-stepper-px: --spacing(3.5);
113
+ --control-addon-button-size: --spacing(7);
114
+ --control-button-px: --spacing(6);
115
+ --control-button-icon-px: --spacing(4);
116
+ }
117
+ }
@@ -304,7 +304,7 @@ onMounted(() => {
304
304
  >
305
305
  <Button
306
306
  :variant="batchActionsDisabled ? 'outline' : 'default'"
307
- :size="isMobile ? 'sm' : 'default'"
307
+ :size="isMobile ? 'md' : 'default'"
308
308
  :disabled="batchActionsDisabled"
309
309
  >
310
310
  {{ T('actions') }} ({{ selectedCount }})
@@ -372,7 +372,7 @@ onMounted(() => {
372
372
  </span>
373
373
  <Button
374
374
  variant="outline"
375
- size="sm"
375
+ size="md"
376
376
  @click="() => fetchData(undefined, true)"
377
377
  >
378
378
  {{ t('common.actions.retry') }}
@@ -400,7 +400,7 @@ onMounted(() => {
400
400
  >
401
401
  <Button
402
402
  :variant="batchActionsDisabled ? 'outline' : 'default'"
403
- :size="isMobile ? 'sm' : 'default'"
403
+ :size="isMobile ? 'md' : 'default'"
404
404
  :disabled="batchActionsDisabled"
405
405
  >
406
406
  {{ T('actions') }} ({{ selectedCount }})
@@ -15,10 +15,14 @@ const variants = [
15
15
  ] as const satisfies readonly ButtonVariant[]
16
16
 
17
17
  const sizes = [
18
+ 'xs',
18
19
  'sm',
20
+ 'md',
19
21
  'default',
20
22
  'lg',
23
+ 'icon-xs',
21
24
  'icon-sm',
25
+ 'icon-md',
22
26
  'icon',
23
27
  'icon-lg',
24
28
  ] as const satisfies readonly ButtonSize[]
@@ -110,12 +114,16 @@ export const Sizes: Story = {
110
114
  source: {
111
115
  code: `
112
116
  <template>
117
+ <Button size="xs">xs</Button>
113
118
  <Button size="sm">sm</Button>
119
+ <Button size="md">md</Button>
114
120
  <Button size="default">default</Button>
115
121
  <Button size="lg">lg</Button>
116
- <Button size="icon-sm"><Icon name="plus" /></Button>
117
- <Button size="icon"><Icon name="plus" /></Button>
118
- <Button size="icon-lg"><Icon name="plus" /></Button>
122
+ <Button size="icon-xs" icon="plus" />
123
+ <Button size="icon-sm" icon="plus" />
124
+ <Button size="icon-md" icon="plus" />
125
+ <Button size="icon" icon="plus" />
126
+ <Button size="icon-lg" icon="plus" />
119
127
  </template>
120
128
  `.trim(),
121
129
  },
@@ -126,10 +134,10 @@ export const Sizes: Story = {
126
134
  setup: () => ({ sizes }),
127
135
  template: `
128
136
  <div class="flex flex-wrap items-center gap-3">
129
- <Button v-for="s in sizes" :key="s" :size="s">
130
- <Icon v-if="s.startsWith('icon')" name="plus" />
131
- <template v-else>{{ s }}</template>
132
- </Button>
137
+ <template v-for="s in sizes" :key="s">
138
+ <Button v-if="s.startsWith('icon')" :size="s" icon="plus" />
139
+ <Button v-else :size="s">{{ s }}</Button>
140
+ </template>
133
141
  </div>
134
142
  `,
135
143
  }),
@@ -309,9 +317,9 @@ export const InheritedHoverColor: Story = {
309
317
  class="p-3 flex items-center gap-2"
310
318
  >
311
319
  <span class="mr-auto text-sm font-medium capitalize">{{ c }}</span>
312
- <Button variant="outline" size="sm">Outline</Button>
313
- <Button variant="ghost" size="sm">Ghost</Button>
314
- <Button variant="link" size="sm">Link</Button>
320
+ <Button variant="outline" size="md">Outline</Button>
321
+ <Button variant="ghost" size="md">Ghost</Button>
322
+ <Button variant="link" size="md">Link</Button>
315
323
  </Surface>
316
324
  </div>
317
325
  `,
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { Button as ShadcnButton } from '../../shadcn/button'
3
3
  import WebLink from '@bjj/nuxt-layer-shadcn-ui/app/components/ui/WebLink/index.vue'
4
+ import type { ControlSize } from '../../../types/control'
4
5
  import type { ButtonProps } from './types'
5
6
 
6
7
  const props = defineProps<ButtonProps>()
@@ -23,8 +24,31 @@ const variantClasses: Partial<Record<NonNullable<ButtonVariant>, string>> = {
23
24
  link: 'text-current',
24
25
  }
25
26
 
27
+ const isIconOnly = computed(() => props.size?.startsWith('icon') ?? false)
28
+
29
+ // `icon` is the default tier; `icon-sm` → `sm` …
30
+ const tier = computed<ControlSize | undefined>(() => {
31
+ if (!props.size) return undefined
32
+ if (props.size === 'icon') return 'default'
33
+ return props.size.replace('icon-', '') as ControlSize
34
+ })
35
+
36
+ // Dimensions come from the shared control scale (see `data-control-size`) so a
37
+ // button lines up with the inputs of the same tier.
38
+ const sizeClass = computed(() => isIconOnly.value
39
+ ? 'size-(--control-height) p-0 has-[>svg]:p-0'
40
+ : `
41
+ h-(--control-height) gap-(--control-gap) px-(--control-button-px)
42
+ has-[>svg]:px-(--control-button-icon-px)
43
+ `,
44
+ )
45
+
26
46
  const mergedClass = computed(() => cn(
27
- 'cursor-pointer',
47
+ `
48
+ cursor-pointer text-(length:--control-font-size)
49
+ leading-(--control-line-height)
50
+ `,
51
+ sizeClass.value,
28
52
  props.variant && variantClasses[props.variant],
29
53
  props.rounded && 'rounded-full',
30
54
  props.class,
@@ -42,7 +66,7 @@ const slots = defineSlots<{
42
66
  <template>
43
67
  <ShadcnButton
44
68
  :variant="variant"
45
- :size="size"
69
+ :data-control-size="tier"
46
70
  :class="mergedClass"
47
71
  :asChild="isLink"
48
72
  :type="isLink ? undefined : 'button'"
@@ -58,13 +82,16 @@ const slots = defineSlots<{
58
82
  <Icon
59
83
  v-if="loading"
60
84
  name="loader-circle"
61
- class="animate-spin"
85
+ class="animate-spin size-(--control-icon)"
62
86
  />
63
87
  <slot
64
88
  v-else-if="hasIcon"
65
89
  name="icon"
66
90
  >
67
- <Icon :name="icon!" />
91
+ <Icon
92
+ :name="icon!"
93
+ class="size-(--control-icon)"
94
+ />
68
95
  </slot>
69
96
  </template>
70
97
  <slot />
@@ -73,13 +100,16 @@ const slots = defineSlots<{
73
100
  <Icon
74
101
  v-if="loading"
75
102
  name="loader-circle"
76
- class="animate-spin"
103
+ class="animate-spin size-(--control-icon)"
77
104
  />
78
105
  <slot
79
106
  v-else-if="hasIcon"
80
107
  name="icon"
81
108
  >
82
- <Icon :name="icon!" />
109
+ <Icon
110
+ :name="icon!"
111
+ class="size-(--control-icon)"
112
+ />
83
113
  </slot>
84
114
  </template>
85
115
  </component>
@@ -1,12 +1,18 @@
1
1
  import type { ButtonVariants } from '../../shadcn/button'
2
+ import type { ControlSize } from '../../../types/control'
2
3
  import type { Component } from 'vue'
3
4
  import type { RouteLocationRaw } from 'vue-router'
4
5
 
5
6
  export type ButtonVariant = ButtonVariants['variant']
6
- export type ButtonSize = ButtonVariants['size']
7
+ /**
8
+ * A control size tier for text buttons, or `icon-<tier>` for a square icon-only
9
+ * button (`icon` is the `default` tier). Heights match the inputs of the same tier.
10
+ */
11
+ export type ButtonSize = ControlSize | 'icon-xs' | 'icon-sm' | 'icon-md' | 'icon' | 'icon-lg'
7
12
 
8
13
  export interface ButtonProps {
9
14
  variant?: ButtonVariant
15
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
10
16
  size?: ButtonSize
11
17
  loading?: boolean
12
18
  disabled?: boolean
@@ -40,7 +40,7 @@ export const CustomHeader: Story = {
40
40
  <template #header>
41
41
  <div class="flex items-center justify-between">
42
42
  <span class="text-lg font-semibold">Custom Header</span>
43
- <Button variant="ghost" size="sm">Action</Button>
43
+ <Button variant="ghost" size="md">Action</Button>
44
44
  </div>
45
45
  </template>
46
46
  <p>This card uses the header slot for a custom layout.</p>
@@ -57,7 +57,7 @@ export const CustomHeader: Story = {
57
57
  <template #header>
58
58
  <div class="flex items-center justify-between">
59
59
  <span class="text-lg font-semibold">Custom Header</span>
60
- <Button variant="ghost" size="sm">Action</Button>
60
+ <Button variant="ghost" size="md">Action</Button>
61
61
  </div>
62
62
  </template>
63
63
  <p>This card uses the header slot for a custom layout.</p>
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import CopyButton from './index.vue'
3
3
 
4
4
  const variants = [ 'default', 'destructive', 'outline', 'secondary', 'ghost', 'link' ] as const
5
- const sizes = [ 'sm', 'default', 'lg', 'icon-sm', 'icon', 'icon-lg' ] as const
5
+ const sizes = [ 'xs', 'sm', 'md', 'default', 'lg', 'icon-xs', 'icon-sm', 'icon-md', 'icon', 'icon-lg' ] as const
6
6
 
7
7
  const meta = {
8
8
  title: 'UI/CopyButton',
@@ -5,6 +5,8 @@ import Button from '../Button/index.vue'
5
5
  import Modal from '../Modal/index.vue'
6
6
  import DatePicker from './index.vue'
7
7
 
8
+ const sizes = [ 'xs', 'sm', 'md', 'default', 'lg' ] as const
9
+
8
10
  const types: DatePickerType[] = [ 'date', 'month', 'year' ]
9
11
 
10
12
  const meta = {
@@ -14,6 +16,7 @@ const meta = {
14
16
  modelValue: { control: 'date' },
15
17
  type: { control: 'select', options: types },
16
18
  showTime: { control: 'boolean' },
19
+ size: { control: 'select', options: sizes },
17
20
  disabled: { control: 'boolean' },
18
21
  readonly: { control: 'boolean' },
19
22
  invalid: { control: 'boolean' },
@@ -28,6 +31,7 @@ const meta = {
28
31
  modelValue: null,
29
32
  type: 'date',
30
33
  showTime: false,
34
+ size: 'default',
31
35
  disabled: false,
32
36
  readonly: false,
33
37
  invalid: false,
@@ -180,6 +184,35 @@ export const ValueFormat: Story = {
180
184
  }),
181
185
  }
182
186
 
187
+ export const Sizes: Story = {
188
+ parameters: {
189
+ ...noControls,
190
+ docs: {
191
+ source: {
192
+ code: `
193
+ <template>
194
+ <DatePicker v-model="value" size="sm" />
195
+ </template>
196
+ `.trim(),
197
+ },
198
+ },
199
+ },
200
+ render: () => ({
201
+ components: { DatePicker },
202
+ setup: () => ({ sizes, value: ref(new Date(2026, 10, 20)) }),
203
+ template: `
204
+ <div class="space-y-3">
205
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
206
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
207
+ <div class="w-64">
208
+ <DatePicker v-model="value" :size="s" />
209
+ </div>
210
+ </div>
211
+ </div>
212
+ `,
213
+ }),
214
+ }
215
+
183
216
  export const Disabled: Story = {
184
217
  parameters: {
185
218
  ...noControls,
@@ -22,6 +22,7 @@ const props = withDefaults(defineProps<DatePickerProps>(), {
22
22
  readonly: false,
23
23
  invalid: false,
24
24
  placeholder: undefined,
25
+ size: undefined,
25
26
  minDate: undefined,
26
27
  maxDate: undefined,
27
28
  valueFormat: undefined,
@@ -90,6 +91,7 @@ const timeConfig = computed(() => {
90
91
  <Input
91
92
  :modelValue="value"
92
93
  :placeholder="placeholder || T('placeholder')"
94
+ :size="size"
93
95
  :disabled="disabled"
94
96
  :readonly="readonly"
95
97
  @update:modelValue="(v: string | undefined) => onInput(v ?? '')"
@@ -1,3 +1,5 @@
1
+ import type { ControlSize } from '../../../types/control'
2
+
1
3
  export interface DatePickerTimeConfig {
2
4
  enableSeconds?: boolean
3
5
  enableMinutes?: boolean
@@ -31,6 +33,8 @@ export interface DatePickerProps {
31
33
  invalid?: boolean
32
34
  /** Placeholder text */
33
35
  placeholder?: string
36
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
37
+ size?: ControlSize
34
38
  /** Minimum selectable date */
35
39
  minDate?: Date | string
36
40
  /** Maximum selectable date */
@@ -2,6 +2,8 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import { useArgsModel } from '#storybook/argsModel'
3
3
  import DateRangePicker from './index.vue'
4
4
 
5
+ const sizes = [ 'xs', 'sm', 'md', 'default', 'lg' ] as const
6
+
5
7
  const meta = {
6
8
  title: 'UI/DateRangePicker',
7
9
  component: DateRangePicker,
@@ -11,6 +13,7 @@ const meta = {
11
13
  minDate: { control: 'date' },
12
14
  maxDate: { control: 'date' },
13
15
  showTime: { control: 'boolean' },
16
+ size: { control: 'select', options: sizes },
14
17
  disabled: { control: 'boolean' },
15
18
  readonly: { control: 'boolean' },
16
19
  invalid: { control: 'boolean' },
@@ -27,6 +30,7 @@ const meta = {
27
30
  minDate: undefined,
28
31
  maxDate: undefined,
29
32
  showTime: false,
33
+ size: 'default',
30
34
  disabled: false,
31
35
  readonly: false,
32
36
  invalid: false,
@@ -151,6 +155,33 @@ export const Preselected: Story = {
151
155
  }),
152
156
  }
153
157
 
158
+ export const Sizes: Story = {
159
+ parameters: {
160
+ ...noControls,
161
+ docs: {
162
+ source: {
163
+ code: `
164
+ <template>
165
+ <DateRangePicker v-model:start="start" v-model:end="end" size="sm" />
166
+ </template>
167
+ `.trim(),
168
+ },
169
+ },
170
+ },
171
+ render: () => ({
172
+ components: { DateRangePicker },
173
+ setup: () => ({ sizes, start: ref(new Date(2026, 10, 1)), end: ref(new Date(2026, 10, 20)) }),
174
+ template: `
175
+ <div class="space-y-3">
176
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
177
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
178
+ <DateRangePicker v-model:start="start" v-model:end="end" :size="s" class="w-120" />
179
+ </div>
180
+ </div>
181
+ `,
182
+ }),
183
+ }
184
+
154
185
  export const Disabled: Story = {
155
186
  parameters: {
156
187
  ...noControls,
@@ -16,6 +16,7 @@ const props = withDefaults(defineProps<DateRangePickerProps>(), {
16
16
  minDate: undefined,
17
17
  maxDate: undefined,
18
18
  maxSpanDays: undefined,
19
+ size: undefined,
19
20
  valueFormat: undefined,
20
21
  autoApply: true,
21
22
  class: undefined,
@@ -135,6 +136,7 @@ const endMaxDate = computed(() => {
135
136
  <DatePicker
136
137
  v-model="start"
137
138
  :showTime="showTime"
139
+ :size="size"
138
140
  :disabled="disabled"
139
141
  :readonly="readonly"
140
142
  :placeholder="startPlaceholder || T('startPlaceholder')"
@@ -150,6 +152,7 @@ const endMaxDate = computed(() => {
150
152
  <DatePicker
151
153
  v-model="end"
152
154
  :showTime="showTime"
155
+ :size="size"
153
156
  :disabled="disabled"
154
157
  :readonly="readonly"
155
158
  :placeholder="endPlaceholder || T('endPlaceholder')"
@@ -1,3 +1,4 @@
1
+ import type { ControlSize } from '../../../types/control'
1
2
  import type { DatePickerTimeConfig } from '../DatePicker/types'
2
3
 
3
4
  export interface DateRangePickerProps {
@@ -27,6 +28,8 @@ export interface DateRangePickerProps {
27
28
  startPlaceholder?: string
28
29
  /** Placeholder for end date input */
29
30
  endPlaceholder?: string
31
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
32
+ size?: ControlSize
30
33
  /** Maximum span in days between start and end date */
31
34
  maxSpanDays?: number
32
35
  /**
@@ -280,7 +280,7 @@ export const PopupSlot: Story = {
280
280
  <p class="text-sm text-muted-foreground">
281
281
  Use the <code>popup</code> slot to render arbitrary content inside the menu.
282
282
  </p>
283
- <Button size="sm" @click="hide">Close</Button>
283
+ <Button size="md" @click="hide">Close</Button>
284
284
  </div>
285
285
  </template>
286
286
  </Dropdown>
@@ -300,7 +300,7 @@ export const PopupSlot: Story = {
300
300
  <p class="text-sm text-muted-foreground">
301
301
  Use the <code>popup</code> slot to render arbitrary content inside the menu.
302
302
  </p>
303
- <Button size="sm" @click="hide">Close</Button>
303
+ <Button size="md" @click="hide">Close</Button>
304
304
  </div>
305
305
  </template>
306
306
  </Dropdown>