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

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 (36) hide show
  1. package/app/assets/styles/controlSize.stories.ts +121 -0
  2. package/app/assets/styles/tailwind-utilities.css +81 -0
  3. package/app/components/ui/Button/index.stories.ts +11 -7
  4. package/app/components/ui/Button/index.vue +36 -6
  5. package/app/components/ui/Button/types.ts +7 -1
  6. package/app/components/ui/DatePicker/index.stories.ts +33 -0
  7. package/app/components/ui/DatePicker/index.vue +2 -0
  8. package/app/components/ui/DatePicker/types.ts +4 -0
  9. package/app/components/ui/DateRangePicker/index.stories.ts +31 -0
  10. package/app/components/ui/DateRangePicker/index.vue +3 -0
  11. package/app/components/ui/DateRangePicker/types.ts +3 -0
  12. package/app/components/ui/Input/index.stories.ts +33 -0
  13. package/app/components/ui/Input/index.vue +39 -3
  14. package/app/components/ui/Input/types.ts +4 -0
  15. package/app/components/ui/InputCurrency/index.stories.ts +31 -0
  16. package/app/components/ui/InputCurrency/types.ts +1 -1
  17. package/app/components/ui/InputNumber/index.stories.ts +63 -0
  18. package/app/components/ui/InputNumber/index.vue +24 -11
  19. package/app/components/ui/InputNumber/types.ts +4 -0
  20. package/app/components/ui/InputOtp/index.stories.ts +31 -0
  21. package/app/components/ui/InputOtp/index.vue +6 -1
  22. package/app/components/ui/InputOtp/types.ts +4 -0
  23. package/app/components/ui/InputPercent/index.stories.ts +31 -0
  24. package/app/components/ui/InputPercent/types.ts +1 -1
  25. package/app/components/ui/InputRange/index.stories.ts +31 -0
  26. package/app/components/ui/SearchSelect/index.stories.ts +33 -0
  27. package/app/components/ui/SearchSelect/index.vue +2 -0
  28. package/app/components/ui/SearchSelect/types.ts +3 -0
  29. package/app/components/ui/Select/index.stories.ts +33 -0
  30. package/app/components/ui/Select/index.vue +20 -7
  31. package/app/components/ui/Select/types.ts +4 -0
  32. package/app/components/ui/Textarea/index.stories.ts +31 -0
  33. package/app/components/ui/Textarea/index.vue +11 -2
  34. package/app/components/ui/Textarea/types.ts +4 -0
  35. package/app/types/control.ts +5 -0
  36. package/package.json +2 -2
@@ -32,6 +32,26 @@ watch(() => props.modelValue, value => {
32
32
  internalValue.value = value
33
33
  })
34
34
 
35
+ // Size classes read the shared control scale (see `data-control-size`).
36
+ const groupClass = computed(() => cn(
37
+ `
38
+ h-(--control-height)
39
+ has-[>[data-align=inline-end]]:[&>input]:pr-(--control-gap)
40
+ has-[>[data-align=inline-start]]:[&>input]:pl-(--control-gap)
41
+ `,
42
+ props.class,
43
+ ))
44
+ // The inner input fills the group so a compact tier doesn't leave it overflowing.
45
+ const inputClass = `
46
+ h-full px-(--control-px)
47
+ md:text-(length:--control-font-size) md:leading-(--control-line-height)
48
+ `
49
+ const addonClass = `
50
+ text-(length:--control-font-size) leading-(--control-line-height)
51
+ data-[align=inline-start]:pl-(--control-px) data-[align=inline-end]:pr-(--control-px)
52
+ [&>svg]:size-(--control-icon)
53
+ `
54
+
35
55
  const showClearButton = computed(() => !!internalValue.value && !props.readonly && !props.disabled)
36
56
 
37
57
  const countText = computed(() => {
@@ -59,17 +79,20 @@ function clearInput () {
59
79
 
60
80
  <template>
61
81
  <InputGroup
62
- :class="props.class"
82
+ :class="groupClass"
63
83
  :data-disabled="disabled || undefined"
84
+ :data-control-size="size"
64
85
  >
65
86
  <InputGroupAddon
66
87
  v-if="slots.prefix"
67
88
  align="inline-start"
89
+ :class="addonClass"
68
90
  >
69
91
  <slot name="prefix" />
70
92
  </InputGroupAddon>
71
93
  <InputGroupInput
72
94
  :modelValue="internalValue"
95
+ :class="inputClass"
73
96
  v-bind="$attrs"
74
97
  :readonly="readonly"
75
98
  :disabled="disabled"
@@ -83,24 +106,37 @@ function clearInput () {
83
106
  <InputGroupAddon
84
107
  v-if="showClearButton"
85
108
  align="inline-end"
109
+ :class="addonClass"
86
110
  >
87
111
  <InputGroupButton
88
112
  type="button"
89
113
  size="icon-xs"
114
+ class="size-(--control-addon-button-size)"
90
115
  @click="clearInput"
91
116
  >
92
- <Icon name="x" />
117
+ <Icon
118
+ name="x"
119
+ class="size-(--control-icon)"
120
+ />
93
121
  </InputGroupButton>
94
122
  </InputGroupAddon>
95
123
  <InputGroupAddon
96
124
  v-if="showCount"
97
125
  align="inline-end"
126
+ :class="addonClass"
98
127
  >
99
- <InputGroupText>{{ countText }}</InputGroupText>
128
+ <InputGroupText
129
+ class="
130
+ text-(length:--control-font-size) leading-(--control-line-height)
131
+ "
132
+ >
133
+ {{ countText }}
134
+ </InputGroupText>
100
135
  </InputGroupAddon>
101
136
  <InputGroupAddon
102
137
  v-if="slots.suffix"
103
138
  align="inline-end"
139
+ :class="addonClass"
104
140
  >
105
141
  <slot name="suffix" />
106
142
  </InputGroupAddon>
@@ -1,3 +1,5 @@
1
+ import type { ControlSize } from '../../../types/control'
2
+
1
3
  export interface InputProps {
2
4
  modelValue?: string
3
5
  /** Set to enable browser/password-manager autofill (e.g. 'email', 'current-password'). Defaults to 'off'. */
@@ -6,6 +8,8 @@ export interface InputProps {
6
8
  maxlength?: number
7
9
  /** Show character count (rendered as `count / maxlength` when maxlength is set) */
8
10
  showCount?: boolean
11
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
12
+ size?: ControlSize
9
13
  readonly?: boolean
10
14
  disabled?: boolean
11
15
  invalid?: boolean
@@ -2,6 +2,8 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import { useArgsModel } from '#storybook/argsModel'
3
3
  import InputCurrency from './index.vue'
4
4
 
5
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
6
+
5
7
  const currencyDisplays = [ 'symbol', 'narrowSymbol', 'code', 'name' ] as const
6
8
 
7
9
  const meta = {
@@ -11,6 +13,7 @@ const meta = {
11
13
  modelValue: { control: 'number' },
12
14
  currency: { control: 'text' },
13
15
  currencyDisplay: { control: 'select', options: currencyDisplays },
16
+ size: { control: 'select', options: sizes },
14
17
  readonly: { control: 'boolean' },
15
18
  disabled: { control: 'boolean' },
16
19
  invalid: { control: 'boolean' },
@@ -19,6 +22,7 @@ const meta = {
19
22
  modelValue: 1000,
20
23
  currency: 'JPY',
21
24
  currencyDisplay: 'symbol',
25
+ size: 'default',
22
26
  readonly: false,
23
27
  disabled: false,
24
28
  invalid: false,
@@ -85,6 +89,33 @@ export const JpyNameDisplay: Story = {
85
89
  },
86
90
  }
87
91
 
92
+ export const Sizes: Story = {
93
+ parameters: {
94
+ ...noControls,
95
+ docs: {
96
+ source: {
97
+ code: `
98
+ <template>
99
+ <InputCurrency v-model="value" currency="JPY" size="sm" />
100
+ </template>
101
+ `.trim(),
102
+ },
103
+ },
104
+ },
105
+ render: () => ({
106
+ components: { InputCurrency },
107
+ setup: () => ({ sizes, value: ref(1000) }),
108
+ template: `
109
+ <div class="space-y-3">
110
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
111
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
112
+ <InputCurrency v-model="value" currency="JPY" :size="s" class="w-48" />
113
+ </div>
114
+ </div>
115
+ `,
116
+ }),
117
+ }
118
+
88
119
  export const Invalid: Story = {
89
120
  parameters: noControls,
90
121
  args: {
@@ -1,6 +1,6 @@
1
1
  import type { InputNumberProps } from '../InputNumber/types'
2
2
 
3
- export interface InputCurrencyProps extends /* @vue-ignore */ Pick<InputNumberProps, 'readonly' | 'disabled' | 'invalid' | 'align' | 'class'> {
3
+ export interface InputCurrencyProps extends /* @vue-ignore */ Pick<InputNumberProps, 'readonly' | 'disabled' | 'invalid' | 'align' | 'size' | 'class'> {
4
4
  currency?: string
5
5
  currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name'
6
6
  }
@@ -4,6 +4,7 @@ import { useArgsModel } from '#storybook/argsModel'
4
4
  import InputNumber from './index.vue'
5
5
 
6
6
  const aligns = [ 'left', 'center', 'right' ] as const
7
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
7
8
 
8
9
  const meta = {
9
10
  title: 'UI/InputNumber',
@@ -16,6 +17,7 @@ const meta = {
16
17
  placeholder: { control: 'text' },
17
18
  showButtons: { control: 'boolean' },
18
19
  align: { control: 'select', options: aligns },
20
+ size: { control: 'select', options: sizes },
19
21
  readonly: { control: 'boolean' },
20
22
  disabled: { control: 'boolean' },
21
23
  invalid: { control: 'boolean' },
@@ -29,6 +31,7 @@ const meta = {
29
31
  placeholder: '',
30
32
  showButtons: true,
31
33
  align: 'center',
34
+ size: 'default',
32
35
  readonly: false,
33
36
  disabled: false,
34
37
  invalid: false,
@@ -113,6 +116,66 @@ export const Alignments: Story = {
113
116
  }),
114
117
  }
115
118
 
119
+ export const Sizes: Story = {
120
+ parameters: {
121
+ ...noControls,
122
+ docs: {
123
+ source: {
124
+ code: `
125
+ <template>
126
+ <InputNumber v-model="value" size="xs" class="w-26" />
127
+ </template>
128
+ `.trim(),
129
+ },
130
+ },
131
+ },
132
+ render: () => ({
133
+ components: { InputNumber },
134
+ setup: () => ({ sizes, value: ref(10) }),
135
+ template: `
136
+ <div class="space-y-3">
137
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
138
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
139
+ <InputNumber v-model="value" :size="s" class="w-48" />
140
+ <InputNumber v-model="value" :size="s" align="left" class="w-40">
141
+ <template #prefix>¥</template>
142
+ </InputNumber>
143
+ </div>
144
+ </div>
145
+ `,
146
+ }),
147
+ }
148
+
149
+ export const InheritedSize: Story = {
150
+ parameters: {
151
+ ...noControls,
152
+ docs: {
153
+ source: {
154
+ code: `
155
+ <template>
156
+ <!-- Controls without their own size follow the nearest data-control-size -->
157
+ <div data-control-size="sm">
158
+ <InputNumber v-model="width" />
159
+ <InputNumber v-model="height" />
160
+ </div>
161
+ </template>
162
+ `.trim(),
163
+ },
164
+ },
165
+ },
166
+ render: () => ({
167
+ components: { InputNumber },
168
+ setup: () => ({ width: ref(1280), height: ref(720) }),
169
+ template: `
170
+ <div data-control-size="sm" class="flex max-w-sm items-center gap-2">
171
+ <InputNumber v-model="width" class="flex-1" />
172
+ <span class="text-muted-foreground">×</span>
173
+ <InputNumber v-model="height" class="flex-1" />
174
+ </div>
175
+ `,
176
+ }),
177
+ }
178
+
116
179
  export const WithPrefix: Story = {
117
180
  parameters: {
118
181
  ...noControls,
@@ -18,6 +18,7 @@ const props = withDefaults(defineProps<InputNumberProps>(), {
18
18
  showButtons: true,
19
19
  placeholder: undefined,
20
20
  align: 'center',
21
+ size: undefined,
21
22
  invalid: false,
22
23
  class: undefined,
23
24
  })
@@ -41,9 +42,10 @@ const isInvalid = useFormItemInvalid(() => props.invalid)
41
42
  const contentClass = computed(() =>
42
43
  cn(
43
44
  `
44
- h-9 rounded-md border-input shadow-xs
45
+ rounded-md border-input shadow-xs
45
46
  dark:bg-input/30
46
- flex items-center border transition-[color,box-shadow]
47
+ flex h-(--control-height) items-center border
48
+ transition-[color,box-shadow]
47
49
  `,
48
50
  `
49
51
  has-[[data-slot=input]:focus-visible]:border-ring
@@ -60,7 +62,11 @@ const contentClass = computed(() =>
60
62
  ),
61
63
  )
62
64
 
63
- const buttonClass = 'static translate-y-0 shrink-0 cursor-pointer'
65
+ // Steppers fill the control's height; their width comes from the icon plus the tier's padding.
66
+ const buttonClass = `
67
+ static translate-y-0 shrink-0 cursor-pointer self-stretch py-0 px-(--control-stepper-px)
68
+ [&>svg]:size-(--control-icon)
69
+ `
64
70
 
65
71
  const alignClass = {
66
72
  left: 'text-left',
@@ -71,21 +77,25 @@ const alignClass = {
71
77
  const inputClass = computed(() =>
72
78
  cn(
73
79
  `
74
- min-w-0 px-3 flex-1 rounded-none border-0 shadow-none
80
+ min-w-0 h-full flex-1 rounded-none border-0 px-(--control-px)
81
+ text-(length:--control-font-size) leading-(--control-line-height)
82
+ shadow-none
75
83
  focus-visible:ring-0
76
84
  `,
77
85
  alignClass[props.align],
78
86
  // An addon already separates the value from that edge, so tighten the gap next to it.
79
- slots.prefix && 'pl-2',
80
- slots.suffix && 'pr-2',
87
+ slots.prefix && 'pl-(--control-gap)',
88
+ slots.suffix && 'pr-(--control-gap)',
81
89
  ),
82
90
  )
83
91
 
84
92
  const addonClass = computed(() =>
85
93
  cn(
86
94
  `
87
- text-muted-foreground gap-1 text-sm font-medium flex shrink-0 cursor-text
88
- items-center select-none
95
+ text-muted-foreground gap-1 font-medium flex shrink-0 cursor-text
96
+ items-center text-(length:--control-font-size)
97
+ leading-(--control-line-height) select-none
98
+ [&>svg]:size-(--control-icon)
89
99
  `,
90
100
  props.disabled && 'opacity-50',
91
101
  ),
@@ -93,10 +103,10 @@ const addonClass = computed(() =>
93
103
 
94
104
  // The stepper buttons pad the content edges themselves; without them the addon does it.
95
105
  const prefixClass = computed(() =>
96
- cn(addonClass.value, !props.showButtons && 'pl-3'),
106
+ cn(addonClass.value, !props.showButtons && 'pl-(--control-px)'),
97
107
  )
98
108
  const suffixClass = computed(() =>
99
- cn(addonClass.value, !props.showButtons && 'pr-3'),
109
+ cn(addonClass.value, !props.showButtons && 'pr-(--control-px)'),
100
110
  )
101
111
 
102
112
  // Clicking an addon should feel like clicking the field itself.
@@ -116,7 +126,10 @@ function focusInput (event: MouseEvent) {
116
126
  :readonly="readonly"
117
127
  :disabled="disabled"
118
128
  >
119
- <NumberFieldContent :class="contentClass">
129
+ <NumberFieldContent
130
+ :class="contentClass"
131
+ :data-control-size="size"
132
+ >
120
133
  <NumberFieldDecrement
121
134
  v-if="showButtons"
122
135
  :class="buttonClass"
@@ -1,3 +1,5 @@
1
+ import type { ControlSize } from '../../../types/control'
2
+
1
3
  export type InputNumberAlign = 'left' | 'center' | 'right'
2
4
 
3
5
  export interface InputNumberProps {
@@ -11,6 +13,8 @@ export interface InputNumberProps {
11
13
  placeholder?: string
12
14
  /** Horizontal alignment of the value inside the input */
13
15
  align?: InputNumberAlign
16
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
17
+ size?: ControlSize
14
18
  invalid?: boolean
15
19
  class?: ClassValue
16
20
  }
@@ -3,12 +3,15 @@ import EventLog from '#storybook/EventLog.vue'
3
3
  import { useArgsModel } from '#storybook/argsModel'
4
4
  import InputOtp from './index.vue'
5
5
 
6
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
7
+
6
8
  const meta = {
7
9
  title: 'UI/InputOtp',
8
10
  component: InputOtp,
9
11
  argTypes: {
10
12
  modelValue: { control: 'text' },
11
13
  length: { control: 'number' },
14
+ size: { control: 'select', options: sizes },
12
15
  readonly: { control: 'boolean' },
13
16
  disabled: { control: 'boolean' },
14
17
  invalid: { control: 'boolean' },
@@ -16,6 +19,7 @@ const meta = {
16
19
  args: {
17
20
  modelValue: '',
18
21
  length: 6,
22
+ size: 'default',
19
23
  readonly: false,
20
24
  disabled: false,
21
25
  invalid: false,
@@ -49,6 +53,33 @@ export const CustomLength: Story = {
49
53
  },
50
54
  }
51
55
 
56
+ export const Sizes: Story = {
57
+ parameters: {
58
+ ...noControls,
59
+ docs: {
60
+ source: {
61
+ code: `
62
+ <template>
63
+ <InputOtp v-model="value" size="sm" />
64
+ </template>
65
+ `.trim(),
66
+ },
67
+ },
68
+ },
69
+ render: () => ({
70
+ components: { InputOtp },
71
+ setup: () => ({ sizes, value: ref('123') }),
72
+ template: `
73
+ <div class="space-y-3">
74
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
75
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
76
+ <InputOtp v-model="value" :size="s" />
77
+ </div>
78
+ </div>
79
+ `,
80
+ }),
81
+ }
82
+
52
83
  export const Disabled: Story = {
53
84
  parameters: noControls,
54
85
  args: {
@@ -9,6 +9,7 @@ import type { InputOtpProps } from './types'
9
9
  const props = withDefaults(defineProps<InputOtpProps>(), {
10
10
  modelValue: '',
11
11
  length: 6,
12
+ size: undefined,
12
13
  readonly: false,
13
14
  disabled: false,
14
15
  invalid: false,
@@ -48,13 +49,17 @@ function handleUpdate (value: string[]) {
48
49
  @complete="handleComplete"
49
50
  @keydown.capture="handleKeydownCapture"
50
51
  >
51
- <PinInputGroup>
52
+ <PinInputGroup :data-control-size="size">
52
53
  <PinInputSlot
53
54
  v-for="(_, index) in length"
54
55
  :key="index"
55
56
  :index="index"
56
57
  :readonly="readonly || undefined"
57
58
  :aria-invalid="isInvalid || undefined"
59
+ class="
60
+ size-(--control-height) text-(length:--control-font-size)
61
+ leading-(--control-line-height)
62
+ "
58
63
  />
59
64
  </PinInputGroup>
60
65
  </PinInput>
@@ -1,6 +1,10 @@
1
+ import type { ControlSize } from '../../../types/control'
2
+
1
3
  export interface InputOtpProps {
2
4
  modelValue?: string
3
5
  length?: number
6
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
7
+ size?: ControlSize
4
8
  readonly?: boolean
5
9
  disabled?: boolean
6
10
  invalid?: boolean
@@ -2,17 +2,21 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import { useArgsModel } from '#storybook/argsModel'
3
3
  import InputPercent from './index.vue'
4
4
 
5
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
6
+
5
7
  const meta = {
6
8
  title: 'UI/InputPercent',
7
9
  component: InputPercent as any,
8
10
  argTypes: {
9
11
  modelValue: { control: 'number' },
12
+ size: { control: 'select', options: sizes },
10
13
  readonly: { control: 'boolean' },
11
14
  disabled: { control: 'boolean' },
12
15
  invalid: { control: 'boolean' },
13
16
  },
14
17
  args: {
15
18
  modelValue: 0.5,
19
+ size: 'default',
16
20
  readonly: false,
17
21
  disabled: false,
18
22
  invalid: false,
@@ -39,6 +43,33 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
39
43
 
40
44
  export const Default: Story = {}
41
45
 
46
+ export const Sizes: Story = {
47
+ parameters: {
48
+ ...noControls,
49
+ docs: {
50
+ source: {
51
+ code: `
52
+ <template>
53
+ <InputPercent v-model="value" size="sm" />
54
+ </template>
55
+ `.trim(),
56
+ },
57
+ },
58
+ },
59
+ render: () => ({
60
+ components: { InputPercent },
61
+ setup: () => ({ sizes, value: ref(0.5) }),
62
+ template: `
63
+ <div class="space-y-3">
64
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
65
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
66
+ <InputPercent v-model="value" :size="s" class="w-48" />
67
+ </div>
68
+ </div>
69
+ `,
70
+ }),
71
+ }
72
+
42
73
  export const Invalid: Story = {
43
74
  parameters: noControls,
44
75
  args: {
@@ -1,3 +1,3 @@
1
1
  import type { InputNumberProps } from '../InputNumber/types'
2
2
 
3
- export interface InputPercentProps extends /* @vue-ignore */ Pick<InputNumberProps, 'readonly' | 'disabled' | 'invalid' | 'align' | 'class'> {}
3
+ export interface InputPercentProps extends /* @vue-ignore */ Pick<InputNumberProps, 'readonly' | 'disabled' | 'invalid' | 'align' | 'size' | 'class'> {}
@@ -4,6 +4,8 @@ import { useArgsModel } from '#storybook/argsModel'
4
4
  import InputCurrency from '../InputCurrency/index.vue'
5
5
  import InputRange from './index.vue'
6
6
 
7
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
8
+
7
9
  const meta = {
8
10
  title: 'UI/InputRange',
9
11
  component: InputRange,
@@ -14,6 +16,7 @@ const meta = {
14
16
  max: { control: 'number' },
15
17
  startPlaceholder: { control: 'text' },
16
18
  endPlaceholder: { control: 'text' },
19
+ size: { control: 'select', options: sizes },
17
20
  readonly: { control: 'boolean' },
18
21
  disabled: { control: 'boolean' },
19
22
  invalid: { control: 'boolean' },
@@ -26,6 +29,7 @@ const meta = {
26
29
  max: 100,
27
30
  startPlaceholder: '',
28
31
  endPlaceholder: '',
32
+ size: 'default',
29
33
  readonly: false,
30
34
  disabled: false,
31
35
  invalid: false,
@@ -68,6 +72,33 @@ export const CustomBounds: Story = {
68
72
  },
69
73
  }
70
74
 
75
+ export const Sizes: Story = {
76
+ parameters: {
77
+ ...noControls,
78
+ docs: {
79
+ source: {
80
+ code: `
81
+ <template>
82
+ <InputRange v-model:start="start" v-model:end="end" size="sm" />
83
+ </template>
84
+ `.trim(),
85
+ },
86
+ },
87
+ },
88
+ render: () => ({
89
+ components: { InputRange },
90
+ setup: () => ({ sizes, start: ref(10), end: ref(90) }),
91
+ template: `
92
+ <div class="space-y-3">
93
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
94
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
95
+ <InputRange v-model:start="start" v-model:end="end" :size="s" class="w-96" />
96
+ </div>
97
+ </div>
98
+ `,
99
+ }),
100
+ }
101
+
71
102
  export const Disabled: Story = {
72
103
  parameters: noControls,
73
104
  args: {
@@ -4,6 +4,8 @@ import { useArgsModel } from '#storybook/argsModel'
4
4
  import type { SearchSelectLoadMethodParams, SearchSelectLoadMethodResult } from './types'
5
5
  import SearchSelect from './index.vue'
6
6
 
7
+ const sizes = [ 'xs', 'sm', 'default', 'lg' ] as const
8
+
7
9
  // Mock data: 100 items for simulating server-side search
8
10
  const allItems = Array.from({ length: 100 }, (_, i) => ({
9
11
  label: `Item ${i + 1}`,
@@ -51,6 +53,7 @@ const meta = {
51
53
  createNewText: { control: 'text' },
52
54
  loadLimit: { control: 'number' },
53
55
  autoLoad: { control: 'boolean' },
56
+ size: { control: 'select', options: sizes },
54
57
  readonly: { control: 'boolean' },
55
58
  disabled: { control: 'boolean' },
56
59
  invalid: { control: 'boolean' },
@@ -65,6 +68,7 @@ const meta = {
65
68
  createNewText: '',
66
69
  loadLimit: 20,
67
70
  autoLoad: false,
71
+ size: 'default',
68
72
  readonly: false,
69
73
  disabled: false,
70
74
  invalid: false,
@@ -179,6 +183,35 @@ export const WithCreateNew: Story = {
179
183
  },
180
184
  }
181
185
 
186
+ export const Sizes: Story = {
187
+ parameters: {
188
+ ...noControls,
189
+ docs: {
190
+ source: {
191
+ code: `
192
+ <template>
193
+ <SearchSelect v-model="value" :loadMethod="loadMethod" size="sm" />
194
+ </template>
195
+ `.trim(),
196
+ },
197
+ },
198
+ },
199
+ render: () => ({
200
+ components: { SearchSelect },
201
+ setup: () => ({ sizes, mockLoadMethod, value: ref<string>() }),
202
+ template: `
203
+ <div class="space-y-3">
204
+ <div v-for="s in sizes" :key="s" class="flex items-center gap-3">
205
+ <span class="w-14 text-sm text-muted-foreground">{{ s }}</span>
206
+ <div class="w-64">
207
+ <SearchSelect v-model="value" :loadMethod="mockLoadMethod" :size="s" />
208
+ </div>
209
+ </div>
210
+ </div>
211
+ `,
212
+ }),
213
+ }
214
+
182
215
  export const Disabled: Story = {
183
216
  parameters: noControls,
184
217
  args: {
@@ -15,6 +15,7 @@ const props = withDefaults(defineProps<SearchSelectProps<TValue, TMeta>>(), {
15
15
  loadValueOptionMethod: undefined,
16
16
  loadLimit: 20,
17
17
  placeholder: undefined,
18
+ size: undefined,
18
19
  readonly: false,
19
20
  disabled: false,
20
21
  invalid: false,
@@ -196,6 +197,7 @@ defineExpose({ refresh: resetAndLoad })
196
197
  :options="displayedOptions"
197
198
  :filter="filterFunction"
198
199
  :placeholder="placeholder"
200
+ :size="size"
199
201
  :searchPlaceholder="searchPlaceholder"
200
202
  :emptyText="computedEmptyText"
201
203
  :readonly="readonly"
@@ -1,3 +1,4 @@
1
+ import type { ControlSize } from '../../../types/control'
1
2
  import type { SelectOption } from '../Select/types'
2
3
 
3
4
  /** Result returned by loadMethod */
@@ -26,6 +27,8 @@ export interface SearchSelectProps<V extends string | number = string, M = unkno
26
27
  /** Items per request (default: 20) */
27
28
  loadLimit?: number
28
29
  placeholder?: string
30
+ /** Size tier. Unset follows the nearest ancestor's `data-control-size`, else `default`. */
31
+ size?: ControlSize
29
32
  /** Keep the value visible and focusable but prevent changing it */
30
33
  readonly?: boolean
31
34
  disabled?: boolean