@bitrix24/b24ui-nuxt 0.5.11 → 0.6.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 (252) hide show
  1. package/.nuxt/b24ui/advice.ts +10 -2
  2. package/.nuxt/b24ui/alert.ts +10 -2
  3. package/.nuxt/b24ui/avatar-group.ts +10 -2
  4. package/.nuxt/b24ui/avatar.ts +10 -2
  5. package/.nuxt/b24ui/badge.ts +10 -2
  6. package/.nuxt/b24ui/button-group.ts +10 -2
  7. package/.nuxt/b24ui/button.ts +16 -6
  8. package/.nuxt/b24ui/calendar.ts +10 -2
  9. package/.nuxt/b24ui/checkbox.ts +10 -2
  10. package/.nuxt/b24ui/chip.ts +10 -2
  11. package/.nuxt/b24ui/collapsible.ts +10 -2
  12. package/.nuxt/b24ui/container.ts +10 -2
  13. package/.nuxt/b24ui/countdown.ts +10 -2
  14. package/.nuxt/b24ui/description-list.ts +10 -2
  15. package/.nuxt/b24ui/dropdown-menu.ts +10 -2
  16. package/.nuxt/b24ui/form-field.ts +10 -2
  17. package/.nuxt/b24ui/form.ts +10 -2
  18. package/.nuxt/b24ui/input-menu.ts +12 -4
  19. package/.nuxt/b24ui/input-number.ts +10 -2
  20. package/.nuxt/b24ui/input.ts +10 -2
  21. package/.nuxt/b24ui/kbd.ts +10 -2
  22. package/.nuxt/b24ui/link.ts +10 -2
  23. package/.nuxt/b24ui/modal.ts +10 -2
  24. package/.nuxt/b24ui/navbar-divider.ts +10 -2
  25. package/.nuxt/b24ui/navbar-section.ts +10 -2
  26. package/.nuxt/b24ui/navbar-spacer.ts +10 -2
  27. package/.nuxt/b24ui/navbar.ts +10 -2
  28. package/.nuxt/b24ui/navigation-menu.ts +10 -2
  29. package/.nuxt/b24ui/popover.ts +10 -2
  30. package/.nuxt/b24ui/progress.ts +10 -2
  31. package/.nuxt/b24ui/radio-group.ts +10 -2
  32. package/.nuxt/b24ui/range.ts +10 -2
  33. package/.nuxt/b24ui/select-menu.ts +14 -6
  34. package/.nuxt/b24ui/select.ts +12 -4
  35. package/.nuxt/b24ui/separator.ts +10 -2
  36. package/.nuxt/b24ui/sidebar-body.ts +10 -2
  37. package/.nuxt/b24ui/sidebar-footer.ts +10 -2
  38. package/.nuxt/b24ui/sidebar-header.ts +10 -2
  39. package/.nuxt/b24ui/sidebar-heading.ts +10 -2
  40. package/.nuxt/b24ui/sidebar-layout.ts +10 -2
  41. package/.nuxt/b24ui/sidebar-section.ts +10 -2
  42. package/.nuxt/b24ui/sidebar-spacer.ts +10 -2
  43. package/.nuxt/b24ui/sidebar.ts +10 -2
  44. package/.nuxt/b24ui/skeleton.ts +10 -2
  45. package/.nuxt/b24ui/slideover.ts +10 -2
  46. package/.nuxt/b24ui/stacked-layout.ts +10 -2
  47. package/.nuxt/b24ui/switch.ts +10 -2
  48. package/.nuxt/b24ui/tabs.ts +10 -2
  49. package/.nuxt/b24ui/textarea.ts +10 -2
  50. package/.nuxt/b24ui/toast.ts +10 -2
  51. package/.nuxt/b24ui/toaster.ts +10 -2
  52. package/.nuxt/b24ui/tooltip.ts +10 -2
  53. package/cli/templates.mjs +19 -15
  54. package/dist/meta.d.mts +5675 -7513
  55. package/dist/meta.mjs +5675 -7513
  56. package/dist/module.json +3 -3
  57. package/dist/module.mjs +2 -2
  58. package/dist/runtime/components/Advice.vue +27 -55
  59. package/dist/runtime/components/Advice.vue.d.ts +56 -0
  60. package/dist/runtime/components/Alert.vue +35 -97
  61. package/dist/runtime/components/Alert.vue.d.ts +97 -0
  62. package/dist/runtime/components/App.vue +24 -34
  63. package/dist/runtime/components/App.vue.d.ts +23 -0
  64. package/dist/runtime/components/Avatar.vue +43 -82
  65. package/dist/runtime/components/Avatar.vue.d.ts +62 -0
  66. package/dist/runtime/components/AvatarGroup.vue +40 -77
  67. package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
  68. package/dist/runtime/components/Badge.vue +40 -84
  69. package/dist/runtime/components/Badge.vue.d.ts +78 -0
  70. package/dist/runtime/components/Button.vue +107 -164
  71. package/dist/runtime/components/Button.vue.d.ts +115 -0
  72. package/dist/runtime/components/ButtonGroup.vue +25 -52
  73. package/dist/runtime/components/ButtonGroup.vue.d.ts +63 -0
  74. package/dist/runtime/components/Calendar.vue +73 -153
  75. package/dist/runtime/components/Calendar.vue.d.ts +107 -0
  76. package/dist/runtime/components/Checkbox.vue +42 -74
  77. package/dist/runtime/components/Checkbox.vue.d.ts +55 -0
  78. package/dist/runtime/components/Chip.vue +26 -75
  79. package/dist/runtime/components/Chip.vue.d.ts +77 -0
  80. package/dist/runtime/components/Collapsible.vue +22 -41
  81. package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
  82. package/dist/runtime/components/Container.vue +15 -28
  83. package/dist/runtime/components/Container.vue.d.ts +27 -0
  84. package/dist/runtime/components/Countdown.vue +153 -379
  85. package/dist/runtime/components/Countdown.vue.d.ts +122 -0
  86. package/dist/runtime/components/DescriptionList.vue +78 -150
  87. package/dist/runtime/components/DescriptionList.vue.d.ts +109 -0
  88. package/dist/runtime/components/DropdownMenu.vue +38 -140
  89. package/dist/runtime/components/DropdownMenu.vue.d.ts +133 -0
  90. package/dist/runtime/components/DropdownMenuContent.vue +65 -79
  91. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
  92. package/dist/runtime/components/Form.vue +132 -218
  93. package/dist/runtime/components/Form.vue.d.ts +55 -0
  94. package/dist/runtime/components/FormField.vue +36 -81
  95. package/dist/runtime/components/FormField.vue.d.ts +73 -0
  96. package/dist/runtime/components/Input.vue +79 -180
  97. package/dist/runtime/components/Input.vue.d.ts +135 -0
  98. package/dist/runtime/components/InputMenu.vue +185 -382
  99. package/dist/runtime/components/InputMenu.vue.d.ts +357 -0
  100. package/dist/runtime/components/InputNumber.vue +77 -176
  101. package/dist/runtime/components/InputNumber.vue.d.ts +238 -0
  102. package/dist/runtime/components/Kbd.vue +20 -46
  103. package/dist/runtime/components/Kbd.vue.d.ts +55 -0
  104. package/dist/runtime/components/Link.vue +99 -179
  105. package/dist/runtime/components/Link.vue.d.ts +129 -0
  106. package/dist/runtime/components/LinkBase.vue +33 -42
  107. package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
  108. package/dist/runtime/components/Modal.vue +48 -128
  109. package/dist/runtime/components/Modal.vue.d.ts +124 -0
  110. package/dist/runtime/components/ModalDialogClose.vue +5 -8
  111. package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
  112. package/dist/runtime/components/Navbar.vue +15 -33
  113. package/dist/runtime/components/Navbar.vue.d.ts +46 -0
  114. package/dist/runtime/components/NavbarDivider.vue +15 -33
  115. package/dist/runtime/components/NavbarDivider.vue.d.ts +46 -0
  116. package/dist/runtime/components/NavbarSection.vue +15 -33
  117. package/dist/runtime/components/NavbarSection.vue.d.ts +46 -0
  118. package/dist/runtime/components/NavbarSpacer.vue +15 -33
  119. package/dist/runtime/components/NavbarSpacer.vue.d.ts +46 -0
  120. package/dist/runtime/components/NavigationMenu.vue +74 -209
  121. package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
  122. package/dist/runtime/components/OverlayProvider.vue +14 -18
  123. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  124. package/dist/runtime/components/Popover.vue +40 -82
  125. package/dist/runtime/components/Popover.vue.d.ts +79 -0
  126. package/dist/runtime/components/Progress.vue +70 -137
  127. package/dist/runtime/components/Progress.vue.d.ts +103 -0
  128. package/dist/runtime/components/RadioGroup.vue +59 -135
  129. package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
  130. package/dist/runtime/components/Range.vue +46 -86
  131. package/dist/runtime/components/Range.vue.d.ts +73 -0
  132. package/dist/runtime/components/Select.vue +110 -261
  133. package/dist/runtime/components/Select.vue.d.ts +170 -0
  134. package/dist/runtime/components/SelectMenu.vue +161 -348
  135. package/dist/runtime/components/SelectMenu.vue.d.ts +217 -0
  136. package/dist/runtime/components/Separator.vue +28 -72
  137. package/dist/runtime/components/Separator.vue.d.ts +77 -0
  138. package/dist/runtime/components/Sidebar.vue +15 -33
  139. package/dist/runtime/components/Sidebar.vue.d.ts +46 -0
  140. package/dist/runtime/components/SidebarBody.vue +17 -39
  141. package/dist/runtime/components/SidebarBody.vue.d.ts +53 -0
  142. package/dist/runtime/components/SidebarFooter.vue +15 -33
  143. package/dist/runtime/components/SidebarFooter.vue.d.ts +46 -0
  144. package/dist/runtime/components/SidebarHeader.vue +15 -33
  145. package/dist/runtime/components/SidebarHeader.vue.d.ts +46 -0
  146. package/dist/runtime/components/SidebarHeading.vue +15 -33
  147. package/dist/runtime/components/SidebarHeading.vue.d.ts +46 -0
  148. package/dist/runtime/components/SidebarLayout.vue +34 -71
  149. package/dist/runtime/components/SidebarLayout.vue.d.ts +65 -0
  150. package/dist/runtime/components/SidebarSection.vue +15 -33
  151. package/dist/runtime/components/SidebarSection.vue.d.ts +46 -0
  152. package/dist/runtime/components/SidebarSpacer.vue +15 -33
  153. package/dist/runtime/components/SidebarSpacer.vue.d.ts +46 -0
  154. package/dist/runtime/components/Skeleton.vue +14 -23
  155. package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
  156. package/dist/runtime/components/Slideover.vue +50 -132
  157. package/dist/runtime/components/Slideover.vue.d.ts +127 -0
  158. package/dist/runtime/components/StackedLayout.vue +34 -74
  159. package/dist/runtime/components/StackedLayout.vue.d.ts +65 -0
  160. package/dist/runtime/components/Switch.vue +46 -96
  161. package/dist/runtime/components/Switch.vue.d.ts +77 -0
  162. package/dist/runtime/components/Tabs.vue +41 -106
  163. package/dist/runtime/components/Tabs.vue.d.ts +104 -0
  164. package/dist/runtime/components/Textarea.vue +92 -202
  165. package/dist/runtime/components/Textarea.vue.d.ts +141 -0
  166. package/dist/runtime/components/Toast.vue +47 -106
  167. package/dist/runtime/components/Toast.vue.d.ts +95 -0
  168. package/dist/runtime/components/Toaster.vue +70 -116
  169. package/dist/runtime/components/Toaster.vue.d.ts +70 -0
  170. package/dist/runtime/components/Tooltip.vue +36 -65
  171. package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
  172. package/dist/runtime/components/content/TableWrapper.vue +24 -71
  173. package/dist/runtime/components/content/TableWrapper.vue.d.ts +83 -0
  174. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  175. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  176. package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
  177. package/dist/runtime/composables/useFormField.d.ts +2 -2
  178. package/dist/runtime/composables/useOverlay.d.ts +14 -7
  179. package/dist/runtime/composables/useOverlay.js +14 -6
  180. package/dist/runtime/prose/A.vue +16 -26
  181. package/dist/runtime/prose/A.vue.d.ts +27 -0
  182. package/dist/runtime/prose/Blockquote.vue +14 -26
  183. package/dist/runtime/prose/Blockquote.vue.d.ts +27 -0
  184. package/dist/runtime/prose/Code.vue +15 -32
  185. package/dist/runtime/prose/Code.vue.d.ts +31 -0
  186. package/dist/runtime/prose/Em.vue +16 -26
  187. package/dist/runtime/prose/Em.vue.d.ts +27 -0
  188. package/dist/runtime/prose/H1.vue +14 -26
  189. package/dist/runtime/prose/H1.vue.d.ts +27 -0
  190. package/dist/runtime/prose/H2.vue +14 -26
  191. package/dist/runtime/prose/H2.vue.d.ts +27 -0
  192. package/dist/runtime/prose/H3.vue +14 -26
  193. package/dist/runtime/prose/H3.vue.d.ts +27 -0
  194. package/dist/runtime/prose/H4.vue +14 -26
  195. package/dist/runtime/prose/H4.vue.d.ts +27 -0
  196. package/dist/runtime/prose/H5.vue +14 -26
  197. package/dist/runtime/prose/H5.vue.d.ts +27 -0
  198. package/dist/runtime/prose/H6.vue +14 -26
  199. package/dist/runtime/prose/H6.vue.d.ts +27 -0
  200. package/dist/runtime/prose/Hr.vue +13 -22
  201. package/dist/runtime/prose/Hr.vue.d.ts +19 -0
  202. package/dist/runtime/prose/Img.vue +13 -26
  203. package/dist/runtime/prose/Img.vue.d.ts +19 -0
  204. package/dist/runtime/prose/Li.vue +14 -26
  205. package/dist/runtime/prose/Li.vue.d.ts +27 -0
  206. package/dist/runtime/prose/Ol.vue +14 -26
  207. package/dist/runtime/prose/Ol.vue.d.ts +27 -0
  208. package/dist/runtime/prose/P.vue +14 -26
  209. package/dist/runtime/prose/P.vue.d.ts +27 -0
  210. package/dist/runtime/prose/Pre.vue +17 -33
  211. package/dist/runtime/prose/Pre.vue.d.ts +47 -0
  212. package/dist/runtime/prose/Strong.vue +14 -26
  213. package/dist/runtime/prose/Strong.vue.d.ts +27 -0
  214. package/dist/runtime/prose/Table.vue +21 -57
  215. package/dist/runtime/prose/Table.vue.d.ts +74 -0
  216. package/dist/runtime/prose/Tbody.vue +14 -26
  217. package/dist/runtime/prose/Tbody.vue.d.ts +27 -0
  218. package/dist/runtime/prose/Td.vue +14 -26
  219. package/dist/runtime/prose/Td.vue.d.ts +27 -0
  220. package/dist/runtime/prose/Th.vue +14 -26
  221. package/dist/runtime/prose/Th.vue.d.ts +27 -0
  222. package/dist/runtime/prose/Thead.vue +14 -26
  223. package/dist/runtime/prose/Thead.vue.d.ts +27 -0
  224. package/dist/runtime/prose/Tr.vue +14 -26
  225. package/dist/runtime/prose/Tr.vue.d.ts +27 -0
  226. package/dist/runtime/prose/Ul.vue +14 -26
  227. package/dist/runtime/prose/Ul.vue.d.ts +27 -0
  228. package/dist/runtime/types/form.d.ts +1 -0
  229. package/dist/runtime/types/utils.d.ts +42 -3
  230. package/dist/runtime/utils/link.d.ts +3 -3
  231. package/dist/runtime/utils/tv.js +2 -2
  232. package/dist/runtime/vue/components/Link.vue +122 -208
  233. package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
  234. package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.wBs9vEU5.mjs} +33 -8
  235. package/dist/types.d.mts +3 -5
  236. package/dist/unplugin.mjs +1 -1
  237. package/dist/vite.mjs +1 -1
  238. package/package.json +19 -27
  239. package/dist/meta.cjs +0 -72112
  240. package/dist/meta.d.cts +0 -72110
  241. package/dist/meta.d.ts +0 -72110
  242. package/dist/module.cjs +0 -63
  243. package/dist/module.d.cts +0 -15
  244. package/dist/module.d.ts +0 -15
  245. package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +0 -7721
  246. package/dist/types.d.ts +0 -7
  247. package/dist/unplugin.cjs +0 -236
  248. package/dist/unplugin.d.cts +0 -33
  249. package/dist/unplugin.d.ts +0 -33
  250. package/dist/vite.cjs +0 -21
  251. package/dist/vite.d.cts +0 -14
  252. package/dist/vite.d.ts +0 -14
@@ -1,105 +1,55 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { SwitchRootProps } from 'reka-ui'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import _appConfig from '#build/app.config'
6
- import theme from '#build/b24ui/switch'
7
- import { tv } from '../utils/tv'
8
- import type { IconComponent } from '../types'
9
- import type { PartialString } from '../types/utils'
10
-
11
- const appConfigSwitch = _appConfig as AppConfig & { b24ui: { switch: Partial<typeof theme> } }
12
-
13
- const switchTv = tv({ extend: tv(theme), ...(appConfigSwitch.b24ui?.switch || {}) })
14
-
15
- type SwitchVariants = VariantProps<typeof switchTv>
16
-
17
- export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
18
- /**
19
- * The element or component this component should render as.
20
- * @defaultValue 'div'
21
- */
22
- as?: any
23
- /**
24
- * @defaultValue 'primary'
25
- */
26
- color?: SwitchVariants['color']
27
- /**
28
- * @defaultValue 'md'
29
- */
30
- size?: SwitchVariants['size']
31
- /**
32
- * When `true`, the loading icon will be displayed
33
- * @defaultValue false
34
- */
35
- loading?: boolean
36
- /**
37
- * The icon when the `loading` prop is `true`.
38
- * @defaultValue icons.refresh
39
- * @IconComponent
40
- */
41
- loadingIcon?: IconComponent
42
- /**
43
- * Display an icon when the switch is checked.
44
- * @IconComponent
45
- */
46
- checkedIcon?: IconComponent
47
- /**
48
- * Display an icon when the switch is unchecked.
49
- * @IconComponent
50
- */
51
- uncheckedIcon?: IconComponent
52
- label?: string
53
- description?: string
54
- class?: any
55
- b24ui?: PartialString<typeof switchTv.slots>
56
- }
57
-
58
- export type SwitchEmits = {
59
- change: [payload: Event]
60
- }
61
-
62
- export interface SwitchSlots {
63
- label(props: { label?: string }): any
64
- description(props: { description?: string }): any
65
- }
1
+ <script>
2
+ import theme from "#build/b24ui/switch";
66
3
  </script>
67
4
 
68
- <script setup lang="ts">
69
- import { computed, useId } from 'vue'
70
- import { Primitive, SwitchRoot, SwitchThumb, useForwardProps, Label } from 'reka-ui'
71
- import { reactivePick } from '@vueuse/core'
72
- import { useFormField } from '../composables/useFormField'
73
- import { omit } from '../utils'
74
- import icons from '../dictionary/icons'
75
-
76
- defineOptions({ inheritAttrs: false })
77
-
78
- const props = defineProps<SwitchProps>()
79
- const slots = defineSlots<SwitchSlots>()
80
- const emits = defineEmits<SwitchEmits>()
81
-
82
- const modelValue = defineModel<boolean>({ default: undefined })
83
-
84
- const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
85
-
86
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<SwitchProps>(props)
87
- const id = _id.value ?? useId()
88
-
89
- const b24ui = computed(() => switchTv({
5
+ <script setup>
6
+ import { computed, useId } from "vue";
7
+ import { Primitive, SwitchRoot, SwitchThumb, useForwardProps, Label } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { tv } from "../utils/tv";
12
+ import { omit } from "../utils";
13
+ import icons from "../dictionary/icons";
14
+ defineOptions({ inheritAttrs: false });
15
+ const props = defineProps({
16
+ as: { type: null, required: false },
17
+ color: { type: null, required: false },
18
+ size: { type: null, required: false },
19
+ loading: { type: Boolean, required: false },
20
+ loadingIcon: { type: [Function, Object], required: false },
21
+ checkedIcon: { type: [Function, Object], required: false },
22
+ uncheckedIcon: { type: [Function, Object], required: false },
23
+ label: { type: String, required: false },
24
+ description: { type: String, required: false },
25
+ class: { type: null, required: false },
26
+ b24ui: { type: null, required: false },
27
+ disabled: { type: Boolean, required: false },
28
+ id: { type: String, required: false },
29
+ name: { type: String, required: false },
30
+ required: { type: Boolean, required: false },
31
+ value: { type: String, required: false },
32
+ defaultValue: { type: Boolean, required: false }
33
+ });
34
+ const slots = defineSlots();
35
+ const emits = defineEmits(["change"]);
36
+ const modelValue = defineModel({ type: Boolean, ...{ default: void 0 } });
37
+ const appConfig = useAppConfig();
38
+ const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
39
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
40
+ const id = _id.value ?? useId();
41
+ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.switch || {} })({
90
42
  size: size.value,
91
43
  color: color.value,
92
44
  required: props.required,
93
45
  loading: props.loading,
94
46
  disabled: disabled.value || props.loading
95
- }))
96
-
97
- function onUpdate(value: any) {
98
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
99
- const event = new Event('change', { target: { value } })
100
- emits('change', event)
101
- emitFormChange()
102
- emitFormInput()
47
+ }));
48
+ function onUpdate(value) {
49
+ const event = new Event("change", { target: { value } });
50
+ emits("change", event);
51
+ emitFormChange();
52
+ emitFormInput();
103
53
  }
104
54
  </script>
105
55
 
@@ -136,7 +86,7 @@ function onUpdate(value: any) {
136
86
  </SwitchThumb>
137
87
  </SwitchRoot>
138
88
  </div>
139
- <div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
89
+ <div v-if="label || !!slots.label || (description || !!slots.description)" :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
140
90
  <Label v-if="label || !!slots.label" :for="id" :class="b24ui.label({ class: props.b24ui?.label })">
141
91
  <slot name="label" :label="label">
142
92
  {{ label }}
@@ -0,0 +1,77 @@
1
+ import type { SwitchRootProps } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/b24ui/switch';
4
+ import type { IconComponent } from '../types';
5
+ import type { ComponentConfig } from '../types/utils';
6
+ type Switch = ComponentConfig<typeof theme, AppConfig, 'switch'>;
7
+ export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @defaultValue 'div'
11
+ */
12
+ as?: any;
13
+ /**
14
+ * @defaultValue 'primary'
15
+ */
16
+ color?: Switch['variants']['color'];
17
+ /**
18
+ * @defaultValue 'md'
19
+ */
20
+ size?: Switch['variants']['size'];
21
+ /**
22
+ * When `true`, the loading icon will be displayed
23
+ * @defaultValue false
24
+ */
25
+ loading?: boolean;
26
+ /**
27
+ * The icon when the `loading` prop is `true`.
28
+ * @defaultValue icons.refresh
29
+ * @IconComponent
30
+ */
31
+ loadingIcon?: IconComponent;
32
+ /**
33
+ * Display an icon when the switch is checked.
34
+ * @IconComponent
35
+ */
36
+ checkedIcon?: IconComponent;
37
+ /**
38
+ * Display an icon when the switch is unchecked.
39
+ * @IconComponent
40
+ */
41
+ uncheckedIcon?: IconComponent;
42
+ label?: string;
43
+ description?: string;
44
+ class?: any;
45
+ b24ui?: Switch['slots'];
46
+ }
47
+ export type SwitchEmits = {
48
+ change: [payload: Event];
49
+ };
50
+ export interface SwitchSlots {
51
+ label(props: {
52
+ label?: string;
53
+ }): any;
54
+ description(props: {
55
+ description?: string;
56
+ }): any;
57
+ }
58
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
59
+ modelValue?: boolean;
60
+ } & SwitchProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
61
+ modelValue?: boolean;
62
+ } & SwitchProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<SwitchSlots> & SwitchSlots>;
63
+ export default _default;
64
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
65
+ type __VLS_TypePropsToOption<T> = {
66
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
67
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
68
+ } : {
69
+ type: import('vue').PropType<T[K]>;
70
+ required: true;
71
+ };
72
+ };
73
+ type __VLS_WithTemplateSlots<T, S> = T & {
74
+ new (): {
75
+ $slots: S;
76
+ };
77
+ };
@@ -1,113 +1,44 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { TabsRootProps, TabsRootEmits } from 'reka-ui'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import _appConfig from '#build/app.config'
6
- import theme from '#build/b24ui/tabs'
7
- import { tv } from '../utils/tv'
8
- import type { AvatarProps, IconComponent } from '../types'
9
- import type { DynamicSlots, PartialString } from '../types/utils'
10
-
11
- const appConfigTabs = _appConfig as AppConfig & { b24ui: { tabs: Partial<typeof theme> } }
12
-
13
- const tabs = tv({ extend: tv(theme), ...(appConfigTabs.b24ui?.tabs || {}) })
14
-
15
- export interface TabsItem {
16
- label?: string
17
- /**
18
- * @IconComponent
19
- */
20
- icon?: IconComponent
21
- avatar?: AvatarProps
22
- slot?: string
23
- content?: string
24
- /** A unique value for the tab item. Defaults to the index. */
25
- value?: string | number
26
- disabled?: boolean
27
- [key: string]: any
28
- }
29
-
30
- type TabsVariants = VariantProps<typeof tabs>
31
-
32
- export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
33
- /**
34
- * The element or component this component should render as.
35
- * @defaultValue 'div'
36
- */
37
- as?: any
38
- items?: T[]
39
- /**
40
- * @defaultValue 'default'
41
- */
42
- color?: TabsVariants['color']
43
- /**
44
- * @defaultValue 'link'
45
- */
46
- variant?: TabsVariants['variant']
47
- /**
48
- * @defaultValue 'md'
49
- */
50
- size?: TabsVariants['size']
51
- /**
52
- * The orientation of the tabs.
53
- * @defaultValue 'horizontal'
54
- */
55
- orientation?: TabsRootProps['orientation']
56
- /**
57
- * The content of the tabs, can be disabled to prevent rendering the content.
58
- * @defaultValue true
59
- */
60
- content?: boolean
61
- /**
62
- * The key used to get the label from the item.
63
- * @defaultValue 'label'
64
- */
65
- labelKey?: string
66
- class?: any
67
- b24ui?: PartialString<typeof tabs.slots>
68
- }
69
-
70
- export interface TabsEmits extends TabsRootEmits<string | number> {}
71
-
72
- type SlotProps<T extends TabsItem> = (props: { item: T, index: number }) => any
73
-
74
- export type TabsSlots<T extends TabsItem = TabsItem> = {
75
- leading: SlotProps<T>
76
- default: SlotProps<T>
77
- trailing: SlotProps<T>
78
- content: SlotProps<T>
79
- } & DynamicSlots<T, undefined, { index: number }>
1
+ <script>
2
+ import theme from "#build/b24ui/tabs";
80
3
  </script>
81
4
 
82
- <script setup lang="ts" generic="T extends TabsItem">
83
- import { computed } from 'vue'
84
- import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from 'reka-ui'
85
- import { reactivePick } from '@vueuse/core'
86
- import { get } from '../utils'
87
- import B24Avatar from './Avatar.vue'
88
-
89
- const props = withDefaults(defineProps<TabsProps<T>>(), {
90
- content: true,
91
- defaultValue: '0',
92
- orientation: 'horizontal',
93
- unmountOnHide: true,
94
- labelKey: 'label'
95
- })
96
- const emits = defineEmits<TabsEmits>()
97
- const slots = defineSlots<TabsSlots<T>>()
98
-
99
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'activationMode', 'unmountOnHide'), emits)
100
-
101
- const getLabel = (item: TabsItem) => {
102
- return get(item, props.labelKey as string)
103
- }
104
-
105
- const b24ui = computed(() => tabs({
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { get } from "../utils";
11
+ import { tv } from "../utils/tv";
12
+ import B24Avatar from "./Avatar.vue";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ items: { type: Array, required: false },
16
+ color: { type: null, required: false },
17
+ variant: { type: null, required: false },
18
+ size: { type: null, required: false },
19
+ orientation: { type: null, required: false, default: "horizontal" },
20
+ content: { type: Boolean, required: false, default: true },
21
+ labelKey: { type: String, required: false, default: "label" },
22
+ class: { type: null, required: false },
23
+ b24ui: { type: null, required: false },
24
+ defaultValue: { type: null, required: false, default: "0" },
25
+ modelValue: { type: null, required: false },
26
+ activationMode: { type: String, required: false },
27
+ unmountOnHide: { type: Boolean, required: false, default: true }
28
+ });
29
+ const emits = defineEmits(["update:modelValue"]);
30
+ const slots = defineSlots();
31
+ const appConfig = useAppConfig();
32
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "orientation", "activationMode", "unmountOnHide"), emits);
33
+ const getLabel = (item) => {
34
+ return get(item, props.labelKey);
35
+ };
36
+ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.tabs || {} })({
106
37
  color: props.color,
107
38
  variant: props.variant,
108
39
  size: props.size,
109
40
  orientation: props.orientation
110
- }))
41
+ }));
111
42
  </script>
112
43
 
113
44
  <template>
@@ -115,6 +46,8 @@ const b24ui = computed(() => tabs({
115
46
  <TabsList :class="b24ui.list({ class: props.b24ui?.list })">
116
47
  <TabsIndicator :class="b24ui.indicator({ class: props.b24ui?.indicator })" />
117
48
 
49
+ <slot name="list-leading" />
50
+
118
51
  <TabsTrigger v-for="(item, index) in items" :key="index" :value="item.value || String(index)" :disabled="item.disabled" :class="b24ui.trigger({ class: props.b24ui?.trigger })">
119
52
  <slot name="leading" :item="item" :index="index">
120
53
  <Component
@@ -122,7 +55,7 @@ const b24ui = computed(() => tabs({
122
55
  v-if="item.icon"
123
56
  :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
124
57
  />
125
- <B24Avatar v-else-if="item.avatar" :size="((props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })" />
58
+ <B24Avatar v-else-if="item.avatar" :size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()" v-bind="item.avatar" :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })" />
126
59
  </slot>
127
60
 
128
61
  <span v-if="getLabel(item) || !!slots.default" :class="b24ui.label({ class: props.b24ui?.label })">
@@ -131,11 +64,13 @@ const b24ui = computed(() => tabs({
131
64
 
132
65
  <slot name="trailing" :item="item" :index="index" />
133
66
  </TabsTrigger>
67
+
68
+ <slot name="list-trailing" />
134
69
  </TabsList>
135
70
 
136
71
  <template v-if="!!content">
137
72
  <TabsContent v-for="(item, index) in items" :key="index" :value="item.value || String(index)" :class="b24ui.content({ class: props.b24ui?.content })">
138
- <slot :name="((item.slot || 'content') as keyof TabsSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :index="index">
73
+ <slot :name="item.slot || 'content'" :item="item" :index="index">
139
74
  {{ item.content }}
140
75
  </slot>
141
76
  </TabsContent>
@@ -0,0 +1,104 @@
1
+ import type { TabsRootProps, TabsRootEmits } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/b24ui/tabs';
4
+ import type { AvatarProps, IconComponent } from '../types';
5
+ import type { DynamicSlots, ComponentConfig } from '../types/utils';
6
+ type Tabs = ComponentConfig<typeof theme, AppConfig, 'tabs'>;
7
+ export interface TabsItem {
8
+ label?: string;
9
+ /**
10
+ * @IconComponent
11
+ */
12
+ icon?: IconComponent;
13
+ avatar?: AvatarProps;
14
+ slot?: string;
15
+ content?: string;
16
+ /** A unique value for the tab item. Defaults to the index. */
17
+ value?: string | number;
18
+ disabled?: boolean;
19
+ [key: string]: any;
20
+ }
21
+ export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
22
+ /**
23
+ * The element or component this component should render as.
24
+ * @defaultValue 'div'
25
+ */
26
+ as?: any;
27
+ items?: T[];
28
+ /**
29
+ * @defaultValue 'default'
30
+ */
31
+ color?: Tabs['variants']['color'];
32
+ /**
33
+ * @defaultValue 'link'
34
+ */
35
+ variant?: Tabs['variants']['variant'];
36
+ /**
37
+ * @defaultValue 'md'
38
+ */
39
+ size?: Tabs['variants']['size'];
40
+ /**
41
+ * The orientation of the tabs.
42
+ * @defaultValue 'horizontal'
43
+ */
44
+ orientation?: TabsRootProps['orientation'];
45
+ /**
46
+ * The content of the tabs, can be disabled to prevent rendering the content.
47
+ * @defaultValue true
48
+ */
49
+ content?: boolean;
50
+ /**
51
+ * The key used to get the label from the item.
52
+ * @defaultValue 'label'
53
+ */
54
+ labelKey?: string;
55
+ class?: any;
56
+ b24ui?: Tabs['slots'];
57
+ }
58
+ export interface TabsEmits extends TabsRootEmits<string | number> {
59
+ }
60
+ type SlotProps<T extends TabsItem> = (props: {
61
+ item: T;
62
+ index: number;
63
+ }) => any;
64
+ export type TabsSlots<T extends TabsItem = TabsItem> = {
65
+ 'leading': SlotProps<T>;
66
+ 'default': SlotProps<T>;
67
+ 'trailing': SlotProps<T>;
68
+ 'content': SlotProps<T>;
69
+ 'list-leading': (props?: {}) => any;
70
+ 'list-trailing': (props?: {}) => any;
71
+ } & DynamicSlots<T, undefined, {
72
+ index: number;
73
+ }>;
74
+ declare const _default: <T extends TabsItem>(__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<{
75
+ props: __VLS_PrettifyLocal<any & TabsProps<T> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
76
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
77
+ attrs: any;
78
+ slots: Readonly<{
79
+ leading: SlotProps<T>;
80
+ default: SlotProps<T>;
81
+ trailing: SlotProps<T>;
82
+ content: SlotProps<T>;
83
+ 'list-leading': (props?: {}) => any;
84
+ 'list-trailing': (props?: {}) => any;
85
+ } & DynamicSlots<T, undefined, {
86
+ index: number;
87
+ }>> & {
88
+ leading: SlotProps<T>;
89
+ default: SlotProps<T>;
90
+ trailing: SlotProps<T>;
91
+ content: SlotProps<T>;
92
+ 'list-leading': (props?: {}) => any;
93
+ 'list-trailing': (props?: {}) => any;
94
+ } & DynamicSlots<T, undefined, {
95
+ index: number;
96
+ }>;
97
+ emit: (evt: "update:modelValue", payload: string | number) => void;
98
+ }>) => import("vue").VNode & {
99
+ __ctx?: Awaited<typeof __VLS_setup>;
100
+ };
101
+ export default _default;
102
+ type __VLS_PrettifyLocal<T> = {
103
+ [K in keyof T]: T[K];
104
+ } & {};