@bitrix24/b24ui-nuxt 0.6.8 → 0.7.1

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 (201) hide show
  1. package/.nuxt/b24ui/accordion.ts +20 -0
  2. package/.nuxt/b24ui/advice.ts +2 -10
  3. package/.nuxt/b24ui/alert.ts +2 -15
  4. package/.nuxt/b24ui/avatar-group.ts +2 -10
  5. package/.nuxt/b24ui/avatar.ts +3 -11
  6. package/.nuxt/b24ui/badge.ts +48 -13
  7. package/.nuxt/b24ui/button-group.ts +2 -22
  8. package/.nuxt/b24ui/button.ts +4 -17
  9. package/.nuxt/b24ui/calendar.ts +3 -11
  10. package/.nuxt/b24ui/checkbox.ts +75 -11
  11. package/.nuxt/b24ui/chip.ts +2 -10
  12. package/.nuxt/b24ui/collapsible.ts +2 -10
  13. package/.nuxt/b24ui/container.ts +2 -10
  14. package/.nuxt/b24ui/countdown.ts +2 -10
  15. package/.nuxt/b24ui/description-list.ts +2 -15
  16. package/.nuxt/b24ui/dropdown-menu.ts +4 -11
  17. package/.nuxt/b24ui/form-field.ts +3 -10
  18. package/.nuxt/b24ui/form.ts +2 -10
  19. package/.nuxt/b24ui/index.ts +1 -0
  20. package/.nuxt/b24ui/input-menu.ts +6 -30
  21. package/.nuxt/b24ui/input-number.ts +15 -10
  22. package/.nuxt/b24ui/input.ts +4 -17
  23. package/.nuxt/b24ui/kbd.ts +2 -10
  24. package/.nuxt/b24ui/link.ts +11 -17
  25. package/.nuxt/b24ui/modal.ts +3 -11
  26. package/.nuxt/b24ui/navbar-divider.ts +2 -10
  27. package/.nuxt/b24ui/navbar-section.ts +2 -10
  28. package/.nuxt/b24ui/navbar-spacer.ts +2 -10
  29. package/.nuxt/b24ui/navbar.ts +2 -10
  30. package/.nuxt/b24ui/navigation-menu.ts +69 -60
  31. package/.nuxt/b24ui/popover.ts +2 -10
  32. package/.nuxt/b24ui/progress.ts +2 -10
  33. package/.nuxt/b24ui/radio-group.ts +3 -11
  34. package/.nuxt/b24ui/range.ts +2 -10
  35. package/.nuxt/b24ui/select-menu.ts +10 -40
  36. package/.nuxt/b24ui/select.ts +10 -40
  37. package/.nuxt/b24ui/separator.ts +2 -10
  38. package/.nuxt/b24ui/sidebar-body.ts +2 -10
  39. package/.nuxt/b24ui/sidebar-footer.ts +2 -10
  40. package/.nuxt/b24ui/sidebar-header.ts +2 -10
  41. package/.nuxt/b24ui/sidebar-heading.ts +2 -10
  42. package/.nuxt/b24ui/sidebar-layout.ts +3 -11
  43. package/.nuxt/b24ui/sidebar-section.ts +2 -10
  44. package/.nuxt/b24ui/sidebar-spacer.ts +2 -10
  45. package/.nuxt/b24ui/sidebar.ts +2 -10
  46. package/.nuxt/b24ui/skeleton.ts +2 -10
  47. package/.nuxt/b24ui/slideover.ts +2 -10
  48. package/.nuxt/b24ui/stacked-layout.ts +2 -10
  49. package/.nuxt/b24ui/switch.ts +2 -10
  50. package/.nuxt/b24ui/tabs.ts +6 -13
  51. package/.nuxt/b24ui/textarea.ts +4 -17
  52. package/.nuxt/b24ui/toast.ts +2 -15
  53. package/.nuxt/b24ui/toaster.ts +3 -11
  54. package/.nuxt/b24ui/tooltip.ts +3 -11
  55. package/.nuxt/b24ui.css +1 -1
  56. package/cli/templates.mjs +2 -2
  57. package/dist/meta.d.mts +35333 -15836
  58. package/dist/meta.mjs +35333 -15836
  59. package/dist/module.json +1 -1
  60. package/dist/module.mjs +11 -3
  61. package/dist/runtime/air-design-tokens.css +1 -0
  62. package/dist/runtime/components/Accordion.vue +96 -0
  63. package/dist/runtime/components/Accordion.vue.d.ts +78 -0
  64. package/dist/runtime/components/Advice.vue +1 -1
  65. package/dist/runtime/components/Alert.vue +1 -1
  66. package/dist/runtime/components/App.vue +1 -1
  67. package/dist/runtime/components/Avatar.vue +11 -3
  68. package/dist/runtime/components/Avatar.vue.d.ts +2 -1
  69. package/dist/runtime/components/AvatarGroup.vue +1 -1
  70. package/dist/runtime/components/Badge.vue +5 -3
  71. package/dist/runtime/components/Badge.vue.d.ts +2 -0
  72. package/dist/runtime/components/Button.vue +2 -3
  73. package/dist/runtime/components/Button.vue.d.ts +1 -1
  74. package/dist/runtime/components/Calendar.vue +1 -1
  75. package/dist/runtime/components/Checkbox.vue +13 -4
  76. package/dist/runtime/components/Checkbox.vue.d.ts +9 -0
  77. package/dist/runtime/components/Chip.vue +1 -1
  78. package/dist/runtime/components/Collapsible.vue +1 -1
  79. package/dist/runtime/components/Countdown.vue +1 -1
  80. package/dist/runtime/components/Countdown.vue.d.ts +2 -2
  81. package/dist/runtime/components/DescriptionList.vue +3 -2
  82. package/dist/runtime/components/DescriptionList.vue.d.ts +1 -1
  83. package/dist/runtime/components/DropdownMenu.vue +1 -1
  84. package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
  85. package/dist/runtime/components/DropdownMenuContent.vue +74 -72
  86. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
  87. package/dist/runtime/components/Form.vue +6 -6
  88. package/dist/runtime/components/Form.vue.d.ts +12 -11
  89. package/dist/runtime/components/FormField.vue +4 -4
  90. package/dist/runtime/components/Input.vue +12 -8
  91. package/dist/runtime/components/Input.vue.d.ts +31 -30
  92. package/dist/runtime/components/InputMenu.vue +23 -20
  93. package/dist/runtime/components/InputMenu.vue.d.ts +6 -4
  94. package/dist/runtime/components/InputNumber.vue +17 -10
  95. package/dist/runtime/components/InputNumber.vue.d.ts +6 -3
  96. package/dist/runtime/components/Link.vue +5 -13
  97. package/dist/runtime/components/Modal.vue +22 -14
  98. package/dist/runtime/components/Modal.vue.d.ts +18 -5
  99. package/dist/runtime/components/Navbar.vue +1 -1
  100. package/dist/runtime/components/NavbarDivider.vue +1 -1
  101. package/dist/runtime/components/NavbarSection.vue +1 -1
  102. package/dist/runtime/components/NavbarSpacer.vue +1 -1
  103. package/dist/runtime/components/NavigationMenu.vue +186 -44
  104. package/dist/runtime/components/NavigationMenu.vue.d.ts +39 -8
  105. package/dist/runtime/components/OverlayProvider.vue +2 -2
  106. package/dist/runtime/components/Popover.vue +4 -0
  107. package/dist/runtime/components/Popover.vue.d.ts +2 -1
  108. package/dist/runtime/components/Progress.vue +3 -2
  109. package/dist/runtime/components/Progress.vue.d.ts +2 -2
  110. package/dist/runtime/components/RadioGroup.vue +24 -8
  111. package/dist/runtime/components/RadioGroup.vue.d.ts +3 -1
  112. package/dist/runtime/components/Range.vue +2 -2
  113. package/dist/runtime/components/Range.vue.d.ts +19 -20
  114. package/dist/runtime/components/Select.vue +57 -31
  115. package/dist/runtime/components/Select.vue.d.ts +110 -2
  116. package/dist/runtime/components/SelectMenu.vue +77 -23
  117. package/dist/runtime/components/SelectMenu.vue.d.ts +111 -5
  118. package/dist/runtime/components/Separator.vue +3 -3
  119. package/dist/runtime/components/Sidebar.vue +1 -1
  120. package/dist/runtime/components/SidebarBody.vue +1 -1
  121. package/dist/runtime/components/SidebarFooter.vue +1 -1
  122. package/dist/runtime/components/SidebarHeader.vue +1 -1
  123. package/dist/runtime/components/SidebarHeading.vue +1 -1
  124. package/dist/runtime/components/SidebarLayout.vue +1 -1
  125. package/dist/runtime/components/SidebarSection.vue +1 -1
  126. package/dist/runtime/components/SidebarSpacer.vue +1 -1
  127. package/dist/runtime/components/Slideover.vue +23 -15
  128. package/dist/runtime/components/Slideover.vue.d.ts +18 -5
  129. package/dist/runtime/components/StackedLayout.vue +1 -1
  130. package/dist/runtime/components/Switch.vue +1 -1
  131. package/dist/runtime/components/Tabs.vue +28 -7
  132. package/dist/runtime/components/Tabs.vue.d.ts +6 -1
  133. package/dist/runtime/components/Textarea.vue +13 -9
  134. package/dist/runtime/components/Textarea.vue.d.ts +31 -30
  135. package/dist/runtime/components/Toast.vue +7 -6
  136. package/dist/runtime/components/Toast.vue.d.ts +6 -0
  137. package/dist/runtime/components/Toaster.vue +4 -4
  138. package/dist/runtime/components/Toaster.vue.d.ts +6 -0
  139. package/dist/runtime/components/Tooltip.vue +9 -2
  140. package/dist/runtime/components/Tooltip.vue.d.ts +2 -1
  141. package/dist/runtime/components/content/TableWrapper.vue +1 -1
  142. package/dist/runtime/composables/defineLocale.d.ts +2 -0
  143. package/dist/runtime/composables/defineLocale.js +4 -0
  144. package/dist/runtime/composables/defineShortcuts.js +8 -2
  145. package/dist/runtime/composables/useFormField.d.ts +1 -1
  146. package/dist/runtime/composables/useFormField.js +2 -1
  147. package/dist/runtime/composables/useKbd.d.ts +1 -0
  148. package/dist/runtime/composables/useKbd.js +4 -3
  149. package/dist/runtime/composables/useOverlay.d.ts +11 -11
  150. package/dist/runtime/composables/useOverlay.js +17 -11
  151. package/dist/runtime/index.css +1 -1
  152. package/dist/runtime/inertia/components/Link.vue +45 -60
  153. package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
  154. package/dist/runtime/inertia/components/LinkBase.vue +68 -0
  155. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
  156. package/dist/runtime/inertia/stubs.d.ts +1 -1
  157. package/dist/runtime/inertia/stubs.js +1 -1
  158. package/dist/runtime/prose/A.vue +1 -1
  159. package/dist/runtime/prose/Blockquote.vue +1 -1
  160. package/dist/runtime/prose/Code.vue +1 -1
  161. package/dist/runtime/prose/Em.vue +1 -1
  162. package/dist/runtime/prose/H1.vue +1 -1
  163. package/dist/runtime/prose/H2.vue +1 -1
  164. package/dist/runtime/prose/H3.vue +1 -1
  165. package/dist/runtime/prose/H4.vue +1 -1
  166. package/dist/runtime/prose/H5.vue +1 -1
  167. package/dist/runtime/prose/H6.vue +1 -1
  168. package/dist/runtime/prose/Hr.vue +1 -1
  169. package/dist/runtime/prose/Img.vue +1 -1
  170. package/dist/runtime/prose/Li.vue +1 -1
  171. package/dist/runtime/prose/Ol.vue +1 -1
  172. package/dist/runtime/prose/P.vue +1 -1
  173. package/dist/runtime/prose/Pre.vue +1 -1
  174. package/dist/runtime/prose/Strong.vue +1 -1
  175. package/dist/runtime/prose/Table.vue +1 -1
  176. package/dist/runtime/prose/Tbody.vue +1 -1
  177. package/dist/runtime/prose/Td.vue +1 -1
  178. package/dist/runtime/prose/Th.vue +1 -1
  179. package/dist/runtime/prose/Thead.vue +1 -1
  180. package/dist/runtime/prose/Tr.vue +1 -1
  181. package/dist/runtime/prose/Ul.vue +1 -1
  182. package/dist/runtime/types/form.d.ts +11 -10
  183. package/dist/runtime/types/index.d.ts +1 -0
  184. package/dist/runtime/types/index.js +1 -0
  185. package/dist/runtime/types/locale.d.ts +1 -0
  186. package/dist/runtime/types/tv.d.ts +53 -0
  187. package/dist/runtime/types/tv.js +0 -0
  188. package/dist/runtime/types/utils.d.ts +4 -51
  189. package/dist/runtime/types/utils.js +1 -0
  190. package/dist/runtime/utils/link.d.ts +1 -0
  191. package/dist/runtime/utils/link.js +12 -0
  192. package/dist/runtime/vue/components/Link.vue +26 -40
  193. package/dist/runtime/vue/composables/useAppConfig.js +3 -1
  194. package/dist/runtime/vue/stubs.d.ts +1 -1
  195. package/dist/runtime/vue/stubs.js +1 -1
  196. package/dist/shared/{b24ui-nuxt.jU270f-Q.mjs → b24ui-nuxt.CxsFEY3M.mjs} +268 -122
  197. package/dist/unplugin.d.mts +2 -2
  198. package/dist/unplugin.mjs +6 -3
  199. package/dist/vite.d.mts +1 -1
  200. package/dist/vite.mjs +2 -2
  201. package/package.json +30 -29
@@ -21,13 +21,14 @@ const props = defineProps({
21
21
  class: { type: null, required: false },
22
22
  b24ui: { type: null, required: false },
23
23
  getValueLabel: { type: Function, required: false },
24
+ getValueText: { type: Function, required: false },
24
25
  modelValue: { type: [Number, null], required: false, default: null }
25
26
  });
26
27
  const emits = defineEmits(["update:modelValue", "update:max"]);
27
28
  const slots = defineSlots();
28
29
  const { dir } = useLocale();
29
30
  const appConfig = useAppConfig();
30
- const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "modelValue"), emits);
31
+ const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "getValueText", "modelValue"), emits);
31
32
  const isIndeterminate = computed(() => rootProps.value.modelValue === null);
32
33
  const hasSteps = computed(() => Array.isArray(props.max));
33
34
  const realMax = computed(() => {
@@ -109,7 +110,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.progres
109
110
  </script>
110
111
 
111
112
  <template>
112
- <Primitive :as="as" :class="b24ui.root({ class: [props.class, props.b24ui?.root] })">
113
+ <Primitive :as="as" :class="b24ui.root({ class: [props.b24ui?.root, props.class] })">
113
114
  <div v-if="!isIndeterminate && (status || !!slots.status)" :class="b24ui.status({ class: props.b24ui?.status })" :style="statusStyle">
114
115
  <slot name="status" :percent="percent">
115
116
  {{ percent }}%
@@ -3,7 +3,7 @@ import type { AppConfig } from '@nuxt/schema';
3
3
  import theme from '#build/b24ui/progress';
4
4
  import type { ComponentConfig } from '../types/utils';
5
5
  type Progress = ComponentConfig<typeof theme, AppConfig, 'progress'>;
6
- export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
6
+ export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'getValueText' | 'modelValue'> {
7
7
  /**
8
8
  * The element or component this component should render as.
9
9
  * @defaultValue 'div'
@@ -61,8 +61,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ProgressPr
61
61
  "onUpdate:max"?: ((value: number) => any) | undefined;
62
62
  }>, {
63
63
  orientation: Progress["variants"]["orientation"];
64
- inverted: boolean;
65
64
  modelValue: number | null;
65
+ inverted: boolean;
66
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ProgressSlots>;
67
67
  export default _default;
68
68
  type __VLS_WithSlots<T, S> = T & {
@@ -93,7 +93,7 @@ function onUpdate(value) {
93
93
  v-bind="rootProps"
94
94
  :name="name"
95
95
  :disabled="disabled"
96
- :class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
96
+ :class="b24ui.root({ class: [props.b24ui?.root, props.class] })"
97
97
  @update:model-value="onUpdate"
98
98
  >
99
99
  <fieldset :class="b24ui.fieldset({ class: props.b24ui?.fieldset })" v-bind="ariaAttrs">
@@ -102,25 +102,41 @@ function onUpdate(value) {
102
102
  {{ legend }}
103
103
  </slot>
104
104
  </legend>
105
- <component :is="variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" :class="b24ui.item({ class: props.b24ui?.item })">
106
- <div :class="b24ui.container({ class: props.b24ui?.container })">
105
+ <component
106
+ :is="!variant || variant === 'list' ? 'div' : Label"
107
+ v-for="item in normalizedItems"
108
+ :key="item.value"
109
+ :class="b24ui.item({ class: [props.b24ui?.item, item.b24ui?.item, item.class] })"
110
+ >
111
+ <div :class="b24ui.container({ class: [props.b24ui?.container, item.b24ui?.container] })">
107
112
  <RadioGroupItem
108
113
  :id="item.id"
109
114
  :value="item.value"
110
115
  :disabled="item.disabled"
111
- :class="b24ui.base({ class: props.b24ui?.base, disabled: item.disabled })"
116
+ :class="b24ui.base({ class: [props.b24ui?.base, item.b24ui?.base], disabled: item.disabled })"
112
117
  >
113
- <RadioGroupIndicator :class="b24ui.indicator({ class: props.b24ui?.indicator })" />
118
+ <RadioGroupIndicator :class="b24ui.indicator({ class: [props.b24ui?.indicator, item.b24ui?.indicator] })" />
114
119
  </RadioGroupItem>
115
120
  </div>
116
121
 
117
- <div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
118
- <component :is="variant === 'list' ? Label : 'p'" :class="b24ui.label({ class: props.b24ui?.label })" :for="item.id">
122
+ <div
123
+ v-if="item.label || !!slots.label || (item.description || !!slots.description)"
124
+ :class="b24ui.wrapper({ class: [props.b24ui?.wrapper, item.b24ui?.wrapper] })"
125
+ >
126
+ <component
127
+ :is="!variant || variant === 'list' ? Label : 'p'"
128
+ v-if="item.label || !!slots.label"
129
+ :for="item.id"
130
+ :class="b24ui.label({ class: [props.b24ui?.label, item.b24ui?.label] })"
131
+ >
119
132
  <slot name="label" :item="item" :model-value="modelValue">
120
133
  {{ item.label }}
121
134
  </slot>
122
135
  </component>
123
- <p v-if="item.description || !!slots.description" :class="b24ui.description({ class: props.b24ui?.description })">
136
+ <p
137
+ v-if="item.description || !!slots.description"
138
+ :class="b24ui.description({ class: [props.b24ui?.description, item.b24ui?.description] })"
139
+ >
124
140
  <slot name="description" :item="item" :model-value="modelValue">
125
141
  {{ item.description }}
126
142
  </slot>
@@ -8,7 +8,9 @@ export type RadioGroupItem = {
8
8
  label?: string;
9
9
  description?: string;
10
10
  disabled?: boolean;
11
- value?: string;
11
+ value?: RadioGroupValue;
12
+ class?: any;
13
+ b24ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'description'>;
12
14
  [key: string]: any;
13
15
  } | RadioGroupValue;
14
16
  export interface RadioGroupProps<T extends RadioGroupItem = RadioGroupItem> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
@@ -26,7 +26,7 @@ const props = defineProps({
26
26
  minStepsBetweenThumbs: { type: Number, required: false }
27
27
  });
28
28
  const emits = defineEmits(["update:modelValue", "change"]);
29
- const modelValue = defineModel({ type: [Number, Array] });
29
+ const modelValue = defineModel({ type: null });
30
30
  const appConfig = useAppConfig();
31
31
  const rootProps = useForwardPropsEmits(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted"), emits);
32
32
  const { id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
@@ -68,7 +68,7 @@ function onChange(value) {
68
68
  v-model="rangeValue"
69
69
  :name="name"
70
70
  :disabled="disabled"
71
- :class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
71
+ :class="b24ui.root({ class: [props.b24ui?.root, props.class] })"
72
72
  :default-value="defaultRangeValue"
73
73
  @update:model-value="emitFormInput()"
74
74
  @value-commit="onChange"
@@ -29,26 +29,25 @@ export interface RangeProps extends Pick<SliderRootProps, 'name' | 'disabled' |
29
29
  class?: any;
30
30
  b24ui?: Range['slots'];
31
31
  }
32
- export interface RangeEmits {
33
- (e: 'update:modelValue', payload: number | number[]): void;
32
+ export interface RangeEmits<T extends number | number[] = number | number[]> {
33
+ (e: 'update:modelValue', payload: T): void;
34
34
  (e: 'change', payload: Event): void;
35
35
  }
36
- declare const _default: import("vue").DefineComponent<RangeProps & {
37
- modelValue?: number | number[];
38
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
- "update:modelValue": (value: number | number[] | undefined) => any;
40
- } & {
41
- change: (payload: Event) => any;
42
- "update:modelValue": (payload: number | number[]) => any;
43
- }, string, import("vue").PublicProps, Readonly<RangeProps & {
44
- modelValue?: number | number[];
45
- }> & Readonly<{
46
- onChange?: ((payload: Event) => any) | undefined;
47
- "onUpdate:modelValue"?: ((payload: number | number[]) => any) | undefined;
48
- }>, {
49
- orientation: "horizontal" | "vertical";
50
- step: number;
51
- max: number;
52
- min: number;
53
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: <T extends number | number[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
37
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
38
+ readonly onChange?: ((payload: Event) => any) | undefined;
39
+ readonly "onUpdate:modelValue"?: ((payload: T) => any) | undefined;
40
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue"> & (RangeProps & {
41
+ modelValue?: T;
42
+ }) & Partial<{}>> & import("vue").PublicProps;
43
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
44
+ attrs: any;
45
+ slots: {};
46
+ emit: RangeEmits<T> & ((evt: "update:modelValue", value: T | undefined) => void);
47
+ }>) => import("vue").VNode & {
48
+ __ctx?: Awaited<typeof __VLS_setup>;
49
+ };
54
50
  export default _default;
51
+ type __VLS_PrettifyLocal<T> = {
52
+ [K in keyof T]: T[K];
53
+ } & {};
@@ -3,8 +3,8 @@ import theme from "#build/b24ui/select";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { computed, toRef } from "vue";
7
- import { Primitive, SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
6
+ import { ref, computed, onMounted, toRef } from "vue";
7
+ import { Primitive, SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
8
8
  import { defu } from "defu";
9
9
  import { reactivePick } from "@vueuse/core";
10
10
  import { useAppConfig } from "#imports";
@@ -41,6 +41,8 @@ const props = defineProps({
41
41
  modelValue: { type: null, required: false },
42
42
  multiple: { type: Boolean, required: false },
43
43
  highlight: { type: Boolean, required: false },
44
+ autofocus: { type: Boolean, required: false },
45
+ autofocusDelay: { type: Number, required: false, default: 0 },
44
46
  class: { type: null, required: false },
45
47
  b24ui: { type: null, required: false },
46
48
  open: { type: Boolean, required: false },
@@ -91,11 +93,25 @@ const groups = computed(
91
93
  const items = computed(() => groups.value.flatMap((group) => group));
92
94
  function displayValue(value) {
93
95
  if (props.multiple && Array.isArray(value)) {
94
- return value.map((v) => displayValue(v)).filter(Boolean).join(", ");
96
+ const values = value.map((v) => displayValue(v)).filter(Boolean);
97
+ return values?.length ? values.join(", ") : void 0;
95
98
  }
96
99
  const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
97
100
  return item && (typeof item === "object" ? get(item, props.labelKey) : item);
98
101
  }
102
+ const triggerRef = ref(null);
103
+ function autoFocus() {
104
+ if (props.autofocus) {
105
+ triggerRef.value?.$el?.focus({
106
+ focusVisible: true
107
+ });
108
+ }
109
+ }
110
+ onMounted(() => {
111
+ setTimeout(() => {
112
+ autoFocus();
113
+ }, props.autofocusDelay);
114
+ });
99
115
  function onUpdate(value) {
100
116
  const event = new Event("change", { target: { value } });
101
117
  emits("change", event);
@@ -116,6 +132,9 @@ function onUpdateOpen(value) {
116
132
  function isSelectItem(item) {
117
133
  return typeof item === "object" && item !== null;
118
134
  }
135
+ defineExpose({
136
+ triggerRef
137
+ });
119
138
  </script>
120
139
 
121
140
  <template>
@@ -131,7 +150,12 @@ function isSelectItem(item) {
131
150
  @update:model-value="onUpdate"
132
151
  @update:open="onUpdateOpen"
133
152
  >
134
- <SelectTrigger :id="id" :class="b24ui.base({ class: [props.class, props.b24ui?.base] })" v-bind="{ ...$attrs, ...ariaAttrs }">
153
+ <SelectTrigger
154
+ :id="id"
155
+ ref="triggerRef"
156
+ :class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
157
+ v-bind="{ ...$attrs, ...ariaAttrs }"
158
+ >
135
159
  <div v-if="isTag" :class="b24ui.tag({ class: props.b24ui?.tag })">
136
160
  {{ props.tag }}
137
161
  </div>
@@ -149,11 +173,17 @@ function isSelectItem(item) {
149
173
 
150
174
  <slot :model-value="modelValue" :open="open">
151
175
  <template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
152
- <span v-if="displayedModelValue" :class="b24ui.value({ class: props.b24ui?.value })">
176
+ <span
177
+ v-if="displayedModelValue !== void 0 && displayedModelValue !== null"
178
+ :class="b24ui.value({ class: props.b24ui?.value })"
179
+ >
153
180
  {{ displayedModelValue }}
154
181
  </span>
155
- <span v-else :class="b24ui.placeholder({ class: props.b24ui?.placeholder })">
156
- {{ placeholder ?? '\xA0' }}
182
+ <span
183
+ v-else
184
+ :class="b24ui.placeholder({ class: props.b24ui?.placeholder })"
185
+ >
186
+ {{ placeholder ?? "\xA0" }}
157
187
  </span>
158
188
  </template>
159
189
  </slot>
@@ -173,24 +203,21 @@ function isSelectItem(item) {
173
203
  <SelectContent :class="b24ui.content({ class: props.b24ui?.content })" v-bind="contentProps">
174
204
  <slot name="content-top" />
175
205
 
176
- <SelectScrollUpButton :class="b24ui.scrollUpDownButton({ class: props.b24ui?.scrollUpDownButton })">
177
- <Component
178
- :is="icons.chevronUp"
179
- :class="b24ui.scrollUpDownButtonIcon({ class: props.b24ui?.scrollUpDownButtonIcon })"
180
- />
181
- </SelectScrollUpButton>
182
- <SelectViewport :class="b24ui.viewport({ class: props.b24ui?.viewport })">
206
+ <div
207
+ role="presentation"
208
+ :class="b24ui.viewport({ class: props.b24ui?.viewport })"
209
+ >
183
210
  <SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
184
211
  <template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
185
- <SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
212
+ <SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: [props.b24ui?.label, item.b24ui?.label, item.class] })">
186
213
  {{ get(item, props.labelKey) }}
187
214
  </SelectLabel>
188
215
 
189
- <SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
216
+ <SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: [props.b24ui?.separator, item.b24ui?.separator, item.class] })" />
190
217
 
191
218
  <SelectItem
192
219
  v-else
193
- :class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color : void 0 })"
220
+ :class="b24ui.item({ class: [props.b24ui?.item, isSelectItem(item) && item.b24ui?.item, isSelectItem(item) && item.class], colorItem: isSelectItem(item) && item?.color || void 0 })"
194
221
  :disabled="isSelectItem(item) && item.disabled"
195
222
  :value="isSelectItem(item) ? get(item, props.valueKey) : item"
196
223
  @select="isSelectItem(item) && item.onSelect?.($event)"
@@ -200,32 +227,37 @@ function isSelectItem(item) {
200
227
  <Component
201
228
  :is="item.icon"
202
229
  v-if="isSelectItem(item) && item.icon"
203
- :class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
230
+ :class="b24ui.itemLeadingIcon({ class: [props.b24ui?.itemLeadingIcon, item.b24ui?.itemLeadingIcon], colorItem: item?.color })"
231
+ />
232
+ <B24Avatar
233
+ v-else-if="isSelectItem(item) && item.avatar"
234
+ :size="item.b24ui?.itemLeadingAvatarSize || props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()"
235
+ v-bind="item.avatar"
236
+ :class="b24ui.itemLeadingAvatar({ class: [props.b24ui?.itemLeadingAvatar, item.b24ui?.itemLeadingAvatar], colorItem: item?.color })"
204
237
  />
205
- <B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
206
238
  <B24Chip
207
239
  v-else-if="isSelectItem(item) && item.chip"
208
- :size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
240
+ :size="item.b24ui?.itemLeadingChipSize || props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
209
241
  inset
210
242
  standalone
211
243
  v-bind="item.chip"
212
- :class="b24ui.itemLeadingChip({ class: props.b24ui?.itemLeadingChip, colorItem: item?.color })"
244
+ :class="b24ui.itemLeadingChip({ class: [props.b24ui?.itemLeadingChip, item.b24ui?.itemLeadingChip], colorItem: item?.color })"
213
245
  />
214
246
  </slot>
215
247
 
216
- <SelectItemText :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
248
+ <SelectItemText :class="b24ui.itemLabel({ class: [props.b24ui?.itemLabel, isSelectItem(item) && item.b24ui?.itemLabel] })">
217
249
  <slot name="item-label" :item="item" :index="index">
218
250
  {{ isSelectItem(item) ? get(item, props.labelKey) : item }}
219
251
  </slot>
220
252
  </SelectItemText>
221
253
 
222
- <span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color : void 0 })">
254
+ <span :class="b24ui.itemTrailing({ class: [props.b24ui?.itemTrailing, isSelectItem(item) && item.b24ui?.itemTrailing], colorItem: isSelectItem(item) && item?.color || void 0 })">
223
255
  <slot name="item-trailing" :item="item" :index="index" />
224
256
 
225
257
  <SelectItemIndicator as-child>
226
258
  <Component
227
259
  :is="selectedIcon || icons.check"
228
- :class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color : void 0 })"
260
+ :class="b24ui.itemTrailingIcon({ class: [props.b24ui?.itemTrailingIcon, isSelectItem(item) && item.b24ui?.itemTrailingIcon], colorItem: isSelectItem(item) && item?.color || void 0 })"
229
261
  />
230
262
  </SelectItemIndicator>
231
263
  </span>
@@ -233,13 +265,7 @@ function isSelectItem(item) {
233
265
  </SelectItem>
234
266
  </template>
235
267
  </SelectGroup>
236
- </SelectViewport>
237
- <SelectScrollDownButton :class="b24ui.scrollUpDownButton({ class: props.b24ui?.scrollUpDownButton })">
238
- <Component
239
- :is="icons.chevronDown"
240
- :class="b24ui.scrollUpDownButtonIcon({ class: props.b24ui?.scrollUpDownButtonIcon })"
241
- />
242
- </SelectScrollDownButton>
268
+ </div>
243
269
 
244
270
  <slot name="content-bottom" />
245
271
 
@@ -20,9 +20,11 @@ interface SelectItemBase {
20
20
  * @defaultValue 'item'
21
21
  */
22
22
  type?: 'label' | 'separator' | 'item';
23
- value?: string | number;
23
+ value?: AcceptableValue | boolean;
24
24
  disabled?: boolean;
25
25
  onSelect?(e?: Event): void;
26
+ class?: any;
27
+ b24ui?: Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemTrailing' | 'itemTrailingIcon'>;
26
28
  [key: string]: any;
27
29
  }
28
30
  export type SelectItem = SelectItemBase | AcceptableValue | boolean;
@@ -119,6 +121,8 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
119
121
  * @defaultValue false
120
122
  */
121
123
  highlight?: boolean;
124
+ autofocus?: boolean;
125
+ autofocusDelay?: number;
122
126
  class?: any;
123
127
  b24ui?: Select['slots'];
124
128
  }
@@ -165,7 +169,111 @@ declare const _default: <T extends ArrayOrNested<SelectItem>, VK extends GetItem
165
169
  readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
166
170
  readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
167
171
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue"> & SelectProps<T, VK, M> & Partial<{}>> & import("vue").PublicProps;
168
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
172
+ expose(exposed: import("vue").ShallowUnwrapRef<{
173
+ triggerRef: import("vue").Ref<({
174
+ $: import("vue").ComponentInternalInstance;
175
+ $data: {};
176
+ $props: {
177
+ readonly disabled?: boolean | undefined;
178
+ readonly reference?: import("reka-ui").ReferenceElement | undefined;
179
+ readonly asChild?: boolean | undefined;
180
+ readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
181
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
182
+ $attrs: {
183
+ [x: string]: unknown;
184
+ };
185
+ $refs: {
186
+ [x: string]: unknown;
187
+ };
188
+ $slots: Readonly<{
189
+ [name: string]: import("vue").Slot<any> | undefined;
190
+ }>;
191
+ $root: import("vue").ComponentPublicInstance | null;
192
+ $parent: import("vue").ComponentPublicInstance | null;
193
+ $host: Element | null;
194
+ $emit: (event: string, ...args: any[]) => void;
195
+ $el: any;
196
+ $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
197
+ as: import("reka-ui").AsTag | import("vue").Component;
198
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
199
+ beforeCreate?: (() => void) | (() => void)[];
200
+ created?: (() => void) | (() => void)[];
201
+ beforeMount?: (() => void) | (() => void)[];
202
+ mounted?: (() => void) | (() => void)[];
203
+ beforeUpdate?: (() => void) | (() => void)[];
204
+ updated?: (() => void) | (() => void)[];
205
+ activated?: (() => void) | (() => void)[];
206
+ deactivated?: (() => void) | (() => void)[];
207
+ beforeDestroy?: (() => void) | (() => void)[];
208
+ beforeUnmount?: (() => void) | (() => void)[];
209
+ destroyed?: (() => void) | (() => void)[];
210
+ unmounted?: (() => void) | (() => void)[];
211
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
212
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
213
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
214
+ };
215
+ $forceUpdate: () => void;
216
+ $nextTick: typeof import("vue").nextTick;
217
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
218
+ } & Readonly<{
219
+ as: import("reka-ui").AsTag | import("vue").Component;
220
+ }> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
221
+ $slots: {
222
+ default?(_: {}): any;
223
+ };
224
+ }) | null, ({
225
+ $: import("vue").ComponentInternalInstance;
226
+ $data: {};
227
+ $props: {
228
+ readonly disabled?: boolean | undefined;
229
+ readonly reference?: import("reka-ui").ReferenceElement | undefined;
230
+ readonly asChild?: boolean | undefined;
231
+ readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
232
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
233
+ $attrs: {
234
+ [x: string]: unknown;
235
+ };
236
+ $refs: {
237
+ [x: string]: unknown;
238
+ };
239
+ $slots: Readonly<{
240
+ [name: string]: import("vue").Slot<any> | undefined;
241
+ }>;
242
+ $root: import("vue").ComponentPublicInstance | null;
243
+ $parent: import("vue").ComponentPublicInstance | null;
244
+ $host: Element | null;
245
+ $emit: (event: string, ...args: any[]) => void;
246
+ $el: any;
247
+ $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
248
+ as: import("reka-ui").AsTag | import("vue").Component;
249
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
250
+ beforeCreate?: (() => void) | (() => void)[];
251
+ created?: (() => void) | (() => void)[];
252
+ beforeMount?: (() => void) | (() => void)[];
253
+ mounted?: (() => void) | (() => void)[];
254
+ beforeUpdate?: (() => void) | (() => void)[];
255
+ updated?: (() => void) | (() => void)[];
256
+ activated?: (() => void) | (() => void)[];
257
+ deactivated?: (() => void) | (() => void)[];
258
+ beforeDestroy?: (() => void) | (() => void)[];
259
+ beforeUnmount?: (() => void) | (() => void)[];
260
+ destroyed?: (() => void) | (() => void)[];
261
+ unmounted?: (() => void) | (() => void)[];
262
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
263
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
264
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
265
+ };
266
+ $forceUpdate: () => void;
267
+ $nextTick: typeof import("vue").nextTick;
268
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
269
+ } & Readonly<{
270
+ as: import("reka-ui").AsTag | import("vue").Component;
271
+ }> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
272
+ $slots: {
273
+ default?(_: {}): any;
274
+ };
275
+ }) | null>;
276
+ }>): void;
169
277
  attrs: any;
170
278
  slots: SelectSlots<T, VK, M, NestedItem<T>>;
171
279
  emit: ((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void);