@polymarbot/nuxt-layer-shadcn-ui 0.6.2 → 0.6.4

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.
@@ -201,9 +201,9 @@ export const Disabled: Story = {
201
201
  code: `
202
202
  <template>
203
203
  <Button variant="default" disabled>default</Button>
204
+ <Button variant="secondary" disabled>secondary</Button>
204
205
  <Button variant="destructive" disabled>destructive</Button>
205
206
  <Button variant="outline" disabled>outline</Button>
206
- <Button variant="secondary" disabled>secondary</Button>
207
207
  <Button variant="ghost" disabled>ghost</Button>
208
208
  <Button variant="link" disabled>link</Button>
209
209
  </template>
@@ -230,10 +230,10 @@ export const Rounded: Story = {
230
230
  code: `
231
231
  <template>
232
232
  <Button rounded>Rounded</Button>
233
- <Button rounded variant="outline">Outline</Button>
234
233
  <Button rounded variant="secondary">Secondary</Button>
235
- <Button rounded size="icon" variant="outline" icon="plus" />
234
+ <Button rounded variant="outline">Outline</Button>
236
235
  <Button rounded size="icon" variant="secondary" icon="sun" />
236
+ <Button rounded size="icon" variant="outline" icon="plus" />
237
237
  </template>
238
238
  `.trim(),
239
239
  },
@@ -244,10 +244,10 @@ export const Rounded: Story = {
244
244
  template: `
245
245
  <div class="flex flex-wrap items-center gap-3">
246
246
  <Button rounded>Rounded</Button>
247
- <Button rounded variant="outline">Outline</Button>
248
247
  <Button rounded variant="secondary">Secondary</Button>
249
- <Button rounded size="icon" variant="outline" icon="plus" />
248
+ <Button rounded variant="outline">Outline</Button>
250
249
  <Button rounded size="icon" variant="secondary" icon="sun" />
250
+ <Button rounded size="icon" variant="outline" icon="plus" />
251
251
  </div>
252
252
  `,
253
253
  }),
@@ -28,7 +28,7 @@ const meta = {
28
28
  showTime: false,
29
29
  disabled: false,
30
30
  readonly: false,
31
- placeholder: undefined,
31
+ placeholder: '',
32
32
  minDate: undefined,
33
33
  maxDate: undefined,
34
34
  valueFormat: undefined,
@@ -38,13 +38,12 @@ const meta = {
38
38
  render: args => ({
39
39
  components: { DatePicker },
40
40
  setup () {
41
- const value = ref<Date | string | null>(null)
42
- return { args, value }
41
+ return { args }
43
42
  },
44
43
  template: `
45
44
  <div class="max-w-xs">
46
- <DatePicker v-bind="args" v-model="value" />
47
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
45
+ <DatePicker v-bind="args" @update:modelValue="v => args.modelValue = v" />
46
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ args.modelValue }}</div>
48
47
  </div>
49
48
  `,
50
49
  }),
@@ -86,7 +86,7 @@ const timeConfig = computed(() => {
86
86
  <div @click.stop>
87
87
  <Input
88
88
  :modelValue="value"
89
- :placeholder="placeholder ?? T('placeholder')"
89
+ :placeholder="placeholder || T('placeholder')"
90
90
  :disabled="disabled"
91
91
  :readonly="readonly"
92
92
  @update:modelValue="(v: string | undefined) => onInput(v ?? '')"
@@ -27,8 +27,8 @@ const meta = {
27
27
  showTime: false,
28
28
  disabled: false,
29
29
  readonly: false,
30
- startPlaceholder: undefined,
31
- endPlaceholder: undefined,
30
+ startPlaceholder: '',
31
+ endPlaceholder: '',
32
32
  maxSpanDays: undefined,
33
33
  valueFormat: undefined,
34
34
  autoApply: true,
@@ -37,16 +37,18 @@ const meta = {
37
37
  render: args => ({
38
38
  components: { DateRangePicker },
39
39
  setup () {
40
- const start = ref<Date | string | null>(args.start ?? null)
41
- const end = ref<Date | string | null>(args.end ?? null)
42
- return { args, start, end }
40
+ return { args }
43
41
  },
44
42
  template: `
45
43
  <div class="max-w-lg">
46
- <DateRangePicker v-bind="args" v-model:start="start" v-model:end="end" />
44
+ <DateRangePicker
45
+ v-bind="args"
46
+ @update:start="v => args.start = v"
47
+ @update:end="v => args.end = v"
48
+ />
47
49
  <div class="mt-2 text-sm text-muted-foreground">
48
- <div>Start: {{ start }}</div>
49
- <div>End: {{ end }}</div>
50
+ <div>Start: {{ args.start }}</div>
51
+ <div>End: {{ args.end }}</div>
50
52
  </div>
51
53
  </div>
52
54
  `,
@@ -97,7 +97,7 @@ const endMaxDate = computed(() => {
97
97
  :showTime="showTime"
98
98
  :disabled="disabled"
99
99
  :readonly="readonly"
100
- :placeholder="startPlaceholder ?? T('startPlaceholder')"
100
+ :placeholder="startPlaceholder || T('startPlaceholder')"
101
101
  :minDate="startMinDate"
102
102
  :maxDate="startMaxDate"
103
103
  :valueFormat="valueFormat"
@@ -112,7 +112,7 @@ const endMaxDate = computed(() => {
112
112
  :showTime="showTime"
113
113
  :disabled="disabled"
114
114
  :readonly="readonly"
115
- :placeholder="endPlaceholder ?? T('endPlaceholder')"
115
+ :placeholder="endPlaceholder || T('endPlaceholder')"
116
116
  :minDate="endMinDate"
117
117
  :maxDate="endMaxDate"
118
118
  :valueFormat="valueFormat"
@@ -18,13 +18,12 @@ const meta = {
18
18
  render: args => ({
19
19
  components: { InputOtp },
20
20
  setup () {
21
- const otp = ref('')
22
- return { args, otp }
21
+ return { args }
23
22
  },
24
23
  template: `
25
24
  <div class="space-y-4">
26
- <InputOtp v-bind="args" v-model="otp" />
27
- <div class="text-sm text-muted-foreground">Value: {{ otp }}</div>
25
+ <InputOtp v-bind="args" @update:modelValue="v => args.modelValue = v" />
26
+ <div class="text-sm text-muted-foreground">Value: {{ args.modelValue }}</div>
28
27
  </div>
29
28
  `,
30
29
  }),
@@ -19,21 +19,23 @@ const meta = {
19
19
  end: undefined,
20
20
  min: 0,
21
21
  max: 100,
22
- startPlaceholder: undefined,
23
- endPlaceholder: undefined,
22
+ startPlaceholder: '',
23
+ endPlaceholder: '',
24
24
  disabled: false,
25
25
  },
26
26
  render: args => ({
27
27
  components: { InputRange },
28
28
  setup () {
29
- const start = ref<number | undefined>(args.start)
30
- const end = ref<number | undefined>(args.end)
31
- return { args, start, end }
29
+ return { args }
32
30
  },
33
31
  template: `
34
32
  <div class="max-w-md">
35
- <InputRange v-bind="args" v-model:start="start" v-model:end="end" />
36
- <div class="mt-2 text-sm text-muted-foreground">Start: {{ start }}, End: {{ end }}</div>
33
+ <InputRange
34
+ v-bind="args"
35
+ @update:start="v => args.start = v"
36
+ @update:end="v => args.end = v"
37
+ />
38
+ <div class="mt-2 text-sm text-muted-foreground">Start: {{ args.start }}, End: {{ args.end }}</div>
37
39
  </div>
38
40
  `,
39
41
  }),
@@ -38,7 +38,7 @@ const end = computed({
38
38
  v-bind="$attrs"
39
39
  :min="min"
40
40
  :max="end ?? max"
41
- :placeholder="startPlaceholder ?? T('startPlaceholder')"
41
+ :placeholder="startPlaceholder || T('startPlaceholder')"
42
42
  fluid
43
43
  />
44
44
  <span class="leading-0 text-muted-foreground">
@@ -49,7 +49,7 @@ const end = computed({
49
49
  v-bind="$attrs"
50
50
  :min="start ?? min"
51
51
  :max="max"
52
- :placeholder="endPlaceholder ?? T('endPlaceholder')"
52
+ :placeholder="endPlaceholder || T('endPlaceholder')"
53
53
  fluid
54
54
  />
55
55
  </div>
@@ -51,13 +51,12 @@ const meta = {
51
51
  render: args => ({
52
52
  components: { RadioCardGroup },
53
53
  setup () {
54
- const selected = ref(args.modelValue ?? '')
55
- return { args, selected }
54
+ return { args }
56
55
  },
57
56
  template: `
58
57
  <div class="max-w-md space-y-4">
59
- <RadioCardGroup v-bind="args" v-model="selected" />
60
- <div class="text-sm text-muted-foreground">Selected: {{ selected }}</div>
58
+ <RadioCardGroup v-bind="args" @update:modelValue="v => args.modelValue = v" />
59
+ <div class="text-sm text-muted-foreground">Selected: {{ args.modelValue }}</div>
61
60
  </div>
62
61
  `,
63
62
  }),
@@ -135,8 +135,8 @@ function handleSearch (value: string) {
135
135
  // -- Empty text --
136
136
 
137
137
  const computedEmptyText = computed(() => {
138
- if (keyword.value) return props.searchEmptyText ?? T('noSearchItems')
139
- return props.emptyText ?? T('noItems')
138
+ if (keyword.value) return props.searchEmptyText || T('noSearchItems')
139
+ return props.emptyText || T('noItems')
140
140
  })
141
141
 
142
142
  // -- Popover open/close --
@@ -188,9 +188,10 @@ defineExpose({ refresh: resetAndLoad })
188
188
  :options="displayedOptions"
189
189
  :filter="filterFunction"
190
190
  :placeholder="placeholder"
191
- :disabled="disabled"
192
191
  :searchPlaceholder="searchPlaceholder"
193
192
  :emptyText="computedEmptyText"
193
+ :disabled="disabled"
194
+ :loading="isLoading"
194
195
  @search="handleSearch"
195
196
  @open="handleOpen"
196
197
  @close="handleClose"
@@ -220,7 +221,6 @@ defineExpose({ refresh: resetAndLoad })
220
221
  <EffectIntersectionChecker
221
222
  v-if="hasMore"
222
223
  :disabled="isLoading"
223
- bao
224
224
  class="py-2 flex items-center justify-center"
225
225
  @show="loadMore"
226
226
  >
@@ -36,6 +36,7 @@ const meta = {
36
36
  argTypes: {
37
37
  placeholder: { control: 'text' },
38
38
  disabled: { control: 'boolean' },
39
+ loading: { control: 'boolean' },
39
40
  filter: { control: 'boolean' },
40
41
  multiple: { control: 'boolean' },
41
42
  searchPlaceholder: { control: 'text' },
@@ -44,6 +45,7 @@ const meta = {
44
45
  args: {
45
46
  placeholder: 'Select an option',
46
47
  disabled: false,
48
+ loading: false,
47
49
  filter: false,
48
50
  multiple: false,
49
51
  searchPlaceholder: '',
@@ -277,6 +279,14 @@ export const Disabled: Story = {
277
279
  }),
278
280
  }
279
281
 
282
+ export const Loading: Story = {
283
+ parameters: noControls,
284
+ args: {
285
+ loading: true,
286
+ placeholder: 'Loading options',
287
+ },
288
+ }
289
+
280
290
  export const EventHandling: Story = {
281
291
  parameters: noControls,
282
292
  render: () => ({
@@ -29,6 +29,7 @@ const props = withDefaults(defineProps<SelectProps<TValue, TMeta>>(), {
29
29
  modelValue: undefined,
30
30
  placeholder: undefined,
31
31
  disabled: false,
32
+ loading: false,
32
33
  filter: false,
33
34
  searchPlaceholder: undefined,
34
35
  emptyText: undefined,
@@ -188,7 +189,7 @@ function handleClear (event: MouseEvent) {
188
189
  v-else
189
190
  class="text-muted-foreground"
190
191
  >
191
- {{ placeholder ?? T('placeholder') }}
192
+ {{ placeholder || T('placeholder') }}
192
193
  </span>
193
194
  </span>
194
195
  <InputGroupAddon
@@ -205,6 +206,12 @@ function handleClear (event: MouseEvent) {
205
206
  </InputGroupAddon>
206
207
  <InputGroupAddon align="inline-end">
207
208
  <Icon
209
+ v-if="loading"
210
+ name="loader-circle"
211
+ class="size-4 animate-spin opacity-50"
212
+ />
213
+ <Icon
214
+ v-else
208
215
  name="chevron-down"
209
216
  class="size-4 opacity-50"
210
217
  />
@@ -221,11 +228,11 @@ function handleClear (event: MouseEvent) {
221
228
  >
222
229
  <CommandInput
223
230
  v-if="!!filter"
224
- :placeholder="searchPlaceholder ?? T('searchPlaceholder')"
231
+ :placeholder="searchPlaceholder || T('searchPlaceholder')"
225
232
  />
226
233
  <CommandList>
227
234
  <CommandEmpty>
228
- {{ emptyText ?? T('noItems') }}
235
+ {{ emptyText || T('noItems') }}
229
236
  </CommandEmpty>
230
237
 
231
238
  <template
@@ -13,6 +13,8 @@ export type SelectBaseProps<V extends string | number = string, M = unknown> = {
13
13
  options?: SelectOption<V, M>[]
14
14
  placeholder?: string
15
15
  disabled?: boolean
16
+ /** Show a spinner in place of the chevron */
17
+ loading?: boolean
16
18
  /** true: enable client-side label filter; function: custom filter (disables internal filter) */
17
19
  filter?: boolean | SelectFilterFunction
18
20
  /** Search input placeholder */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymarbot/nuxt-layer-shadcn-ui",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "fa45348c0fd5ef56ec2c3e57b835dbd9774d6c8c"
45
+ "gitHead": "e42537ea3be4edff97c84d3dd26529538b280472"
46
46
  }