@bitrix24/b24ui-nuxt 0.5.10 → 0.5.11

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 (190) hide show
  1. package/dist/meta.cjs +72112 -0
  2. package/dist/meta.d.cts +72110 -0
  3. package/dist/meta.d.mts +5060 -5060
  4. package/dist/meta.d.ts +72110 -0
  5. package/dist/meta.mjs +5060 -5060
  6. package/dist/module.cjs +63 -0
  7. package/dist/module.d.cts +15 -0
  8. package/dist/module.d.ts +15 -0
  9. package/dist/module.json +3 -3
  10. package/dist/module.mjs +1 -1
  11. package/dist/runtime/components/Advice.vue +54 -47
  12. package/dist/runtime/components/Alert.vue +96 -71
  13. package/dist/runtime/components/App.vue +34 -37
  14. package/dist/runtime/components/Avatar.vue +81 -69
  15. package/dist/runtime/components/AvatarGroup.vue +76 -53
  16. package/dist/runtime/components/Badge.vue +83 -83
  17. package/dist/runtime/components/Button.vue +157 -220
  18. package/dist/runtime/components/ButtonGroup.vue +51 -35
  19. package/dist/runtime/components/Calendar.vue +152 -186
  20. package/dist/runtime/components/Checkbox.vue +73 -84
  21. package/dist/runtime/components/Chip.vue +74 -59
  22. package/dist/runtime/components/Collapsible.vue +41 -44
  23. package/dist/runtime/components/Container.vue +27 -18
  24. package/dist/runtime/components/Countdown.vue +378 -198
  25. package/dist/runtime/components/DescriptionList.vue +149 -102
  26. package/dist/runtime/components/DropdownMenu.vue +139 -83
  27. package/dist/runtime/components/DropdownMenuContent.vue +84 -137
  28. package/dist/runtime/components/Form.vue +216 -162
  29. package/dist/runtime/components/FormField.vue +80 -76
  30. package/dist/runtime/components/Input.vue +179 -160
  31. package/dist/runtime/components/InputMenu.vue +380 -300
  32. package/dist/runtime/components/InputNumber.vue +175 -178
  33. package/dist/runtime/components/Kbd.vue +45 -33
  34. package/dist/runtime/components/Link.vue +173 -179
  35. package/dist/runtime/components/LinkBase.vue +42 -64
  36. package/dist/runtime/components/Modal.vue +127 -105
  37. package/dist/runtime/components/ModalDialogClose.vue +8 -4
  38. package/dist/runtime/components/Navbar.vue +33 -24
  39. package/dist/runtime/components/NavbarDivider.vue +33 -24
  40. package/dist/runtime/components/NavbarSection.vue +33 -24
  41. package/dist/runtime/components/NavbarSpacer.vue +33 -24
  42. package/dist/runtime/components/NavigationMenu.vue +210 -144
  43. package/dist/runtime/components/OverlayProvider.vue +17 -13
  44. package/dist/runtime/components/Popover.vue +81 -81
  45. package/dist/runtime/components/Progress.vue +136 -109
  46. package/dist/runtime/components/RadioGroup.vue +134 -120
  47. package/dist/runtime/components/Range.vue +85 -94
  48. package/dist/runtime/components/Select.vue +260 -212
  49. package/dist/runtime/components/SelectMenu.vue +365 -272
  50. package/dist/runtime/components/Separator.vue +71 -61
  51. package/dist/runtime/components/Sidebar.vue +33 -24
  52. package/dist/runtime/components/SidebarBody.vue +38 -30
  53. package/dist/runtime/components/SidebarFooter.vue +33 -24
  54. package/dist/runtime/components/SidebarHeader.vue +33 -24
  55. package/dist/runtime/components/SidebarHeading.vue +33 -24
  56. package/dist/runtime/components/SidebarLayout.vue +70 -40
  57. package/dist/runtime/components/SidebarSection.vue +33 -24
  58. package/dist/runtime/components/SidebarSpacer.vue +33 -24
  59. package/dist/runtime/components/Skeleton.vue +22 -17
  60. package/dist/runtime/components/Slideover.vue +131 -108
  61. package/dist/runtime/components/StackedLayout.vue +73 -40
  62. package/dist/runtime/components/Switch.vue +95 -100
  63. package/dist/runtime/components/Tabs.vue +107 -81
  64. package/dist/runtime/components/Textarea.vue +201 -177
  65. package/dist/runtime/components/Toast.vue +105 -94
  66. package/dist/runtime/components/Toaster.vue +116 -94
  67. package/dist/runtime/components/Tooltip.vue +64 -78
  68. package/dist/runtime/components/content/TableWrapper.vue +70 -58
  69. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  70. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  71. package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
  72. package/dist/runtime/composables/useFormField.d.ts +1 -1
  73. package/dist/runtime/prose/A.vue +23 -18
  74. package/dist/runtime/prose/Blockquote.vue +23 -18
  75. package/dist/runtime/prose/Code.vue +31 -23
  76. package/dist/runtime/prose/Em.vue +23 -18
  77. package/dist/runtime/prose/H1.vue +23 -18
  78. package/dist/runtime/prose/H2.vue +23 -18
  79. package/dist/runtime/prose/H3.vue +23 -18
  80. package/dist/runtime/prose/H4.vue +23 -18
  81. package/dist/runtime/prose/H5.vue +23 -18
  82. package/dist/runtime/prose/H6.vue +23 -18
  83. package/dist/runtime/prose/Hr.vue +19 -18
  84. package/dist/runtime/prose/Img.vue +23 -18
  85. package/dist/runtime/prose/Li.vue +23 -18
  86. package/dist/runtime/prose/Ol.vue +23 -18
  87. package/dist/runtime/prose/P.vue +23 -18
  88. package/dist/runtime/prose/Pre.vue +33 -28
  89. package/dist/runtime/prose/Strong.vue +23 -18
  90. package/dist/runtime/prose/Table.vue +54 -44
  91. package/dist/runtime/prose/Tbody.vue +23 -18
  92. package/dist/runtime/prose/Td.vue +23 -18
  93. package/dist/runtime/prose/Th.vue +23 -18
  94. package/dist/runtime/prose/Thead.vue +23 -18
  95. package/dist/runtime/prose/Tr.vue +23 -18
  96. package/dist/runtime/prose/Ul.vue +23 -18
  97. package/dist/runtime/vue/components/Link.vue +202 -201
  98. package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +7721 -0
  99. package/dist/types.d.mts +5 -3
  100. package/dist/types.d.ts +7 -0
  101. package/dist/unplugin.cjs +236 -0
  102. package/dist/unplugin.d.cts +33 -0
  103. package/dist/unplugin.d.ts +33 -0
  104. package/dist/vite.cjs +21 -0
  105. package/dist/vite.d.cts +14 -0
  106. package/dist/vite.d.ts +14 -0
  107. package/package.json +25 -13
  108. package/dist/runtime/components/Advice.vue.d.ts +0 -170
  109. package/dist/runtime/components/Alert.vue.d.ts +0 -464
  110. package/dist/runtime/components/App.vue.d.ts +0 -23
  111. package/dist/runtime/components/Avatar.vue.d.ts +0 -281
  112. package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -204
  113. package/dist/runtime/components/Badge.vue.d.ts +0 -517
  114. package/dist/runtime/components/Button.vue.d.ts +0 -640
  115. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -116
  116. package/dist/runtime/components/Calendar.vue.d.ts +0 -437
  117. package/dist/runtime/components/Checkbox.vue.d.ts +0 -354
  118. package/dist/runtime/components/Chip.vue.d.ts +0 -271
  119. package/dist/runtime/components/Collapsible.vue.d.ts +0 -118
  120. package/dist/runtime/components/Container.vue.d.ts +0 -27
  121. package/dist/runtime/components/Countdown.vue.d.ts +0 -356
  122. package/dist/runtime/components/DescriptionList.vue.d.ts +0 -379
  123. package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -533
  124. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -228
  125. package/dist/runtime/components/Form.vue.d.ts +0 -55
  126. package/dist/runtime/components/FormField.vue.d.ts +0 -282
  127. package/dist/runtime/components/Input.vue.d.ts +0 -755
  128. package/dist/runtime/components/InputMenu.vue.d.ts +0 -1504
  129. package/dist/runtime/components/InputNumber.vue.d.ts +0 -658
  130. package/dist/runtime/components/Kbd.vue.d.ts +0 -109
  131. package/dist/runtime/components/Link.vue.d.ts +0 -129
  132. package/dist/runtime/components/LinkBase.vue.d.ts +0 -48
  133. package/dist/runtime/components/Modal.vue.d.ts +0 -327
  134. package/dist/runtime/components/ModalDialogClose.vue.d.ts +0 -10
  135. package/dist/runtime/components/Navbar.vue.d.ts +0 -101
  136. package/dist/runtime/components/NavbarDivider.vue.d.ts +0 -101
  137. package/dist/runtime/components/NavbarSection.vue.d.ts +0 -101
  138. package/dist/runtime/components/NavbarSpacer.vue.d.ts +0 -101
  139. package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -824
  140. package/dist/runtime/components/OverlayProvider.vue.d.ts +0 -2
  141. package/dist/runtime/components/Popover.vue.d.ts +0 -147
  142. package/dist/runtime/components/Progress.vue.d.ts +0 -592
  143. package/dist/runtime/components/RadioGroup.vue.d.ts +0 -723
  144. package/dist/runtime/components/Range.vue.d.ts +0 -417
  145. package/dist/runtime/components/Select.vue.d.ts +0 -1200
  146. package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1298
  147. package/dist/runtime/components/Separator.vue.d.ts +0 -400
  148. package/dist/runtime/components/Sidebar.vue.d.ts +0 -101
  149. package/dist/runtime/components/SidebarBody.vue.d.ts +0 -90
  150. package/dist/runtime/components/SidebarFooter.vue.d.ts +0 -101
  151. package/dist/runtime/components/SidebarHeader.vue.d.ts +0 -101
  152. package/dist/runtime/components/SidebarHeading.vue.d.ts +0 -101
  153. package/dist/runtime/components/SidebarLayout.vue.d.ts +0 -222
  154. package/dist/runtime/components/SidebarSection.vue.d.ts +0 -101
  155. package/dist/runtime/components/SidebarSpacer.vue.d.ts +0 -101
  156. package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
  157. package/dist/runtime/components/Slideover.vue.d.ts +0 -360
  158. package/dist/runtime/components/StackedLayout.vue.d.ts +0 -192
  159. package/dist/runtime/components/Switch.vue.d.ts +0 -587
  160. package/dist/runtime/components/Tabs.vue.d.ts +0 -453
  161. package/dist/runtime/components/Textarea.vue.d.ts +0 -601
  162. package/dist/runtime/components/Toast.vue.d.ts +0 -438
  163. package/dist/runtime/components/Toaster.vue.d.ts +0 -219
  164. package/dist/runtime/components/Tooltip.vue.d.ts +0 -186
  165. package/dist/runtime/components/content/TableWrapper.vue.d.ts +0 -237
  166. package/dist/runtime/prose/A.vue.d.ts +0 -84
  167. package/dist/runtime/prose/Blockquote.vue.d.ts +0 -84
  168. package/dist/runtime/prose/Code.vue.d.ts +0 -97
  169. package/dist/runtime/prose/Em.vue.d.ts +0 -84
  170. package/dist/runtime/prose/H1.vue.d.ts +0 -97
  171. package/dist/runtime/prose/H2.vue.d.ts +0 -123
  172. package/dist/runtime/prose/H3.vue.d.ts +0 -123
  173. package/dist/runtime/prose/H4.vue.d.ts +0 -123
  174. package/dist/runtime/prose/H5.vue.d.ts +0 -123
  175. package/dist/runtime/prose/H6.vue.d.ts +0 -123
  176. package/dist/runtime/prose/Hr.vue.d.ts +0 -74
  177. package/dist/runtime/prose/Img.vue.d.ts +0 -77
  178. package/dist/runtime/prose/Li.vue.d.ts +0 -84
  179. package/dist/runtime/prose/Ol.vue.d.ts +0 -84
  180. package/dist/runtime/prose/P.vue.d.ts +0 -84
  181. package/dist/runtime/prose/Pre.vue.d.ts +0 -117
  182. package/dist/runtime/prose/Strong.vue.d.ts +0 -84
  183. package/dist/runtime/prose/Table.vue.d.ts +0 -144
  184. package/dist/runtime/prose/Tbody.vue.d.ts +0 -84
  185. package/dist/runtime/prose/Td.vue.d.ts +0 -84
  186. package/dist/runtime/prose/Th.vue.d.ts +0 -84
  187. package/dist/runtime/prose/Thead.vue.d.ts +0 -84
  188. package/dist/runtime/prose/Tr.vue.d.ts +0 -84
  189. package/dist/runtime/prose/Ul.vue.d.ts +0 -84
  190. package/dist/runtime/vue/components/Link.vue.d.ts +0 -129
@@ -1,223 +1,160 @@
1
- <script>
2
- import _appConfig from "#build/app.config";
3
- import theme from "#build/b24ui/button";
4
- import { tv } from "../utils/tv";
5
- const appConfigButton = _appConfig;
6
- const button = tv({ extend: tv(theme), ...appConfigButton.b24ui?.button || {} });
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/b24ui/button'
6
+ import type { LinkProps } from './Link.vue'
7
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
8
+ import { tv } from '../utils/tv'
9
+ import type { AvatarProps } from '../types'
10
+ import type { PartialString } from '../types/utils'
11
+
12
+ const appConfigButton = _appConfig as AppConfig & { b24ui: { button: Partial<typeof theme> } }
13
+
14
+ const button = tv({ extend: tv(theme), ...(appConfigButton.b24ui?.button || {}) })
15
+
16
+ type ButtonVariants = VariantProps<typeof button>
17
+
18
+ export interface ButtonProps extends Omit<UseComponentIconsProps, 'trailing' | 'trailingIcon'>, Omit<LinkProps, 'raw' | 'custom'> {
19
+ label?: string
20
+ /**
21
+ * @defaultValue 'default'
22
+ */
23
+ color?: ButtonVariants['color']
24
+ activeColor?: ButtonVariants['color']
25
+ /**
26
+ * @defaultValue 'normal'
27
+ */
28
+ depth?: ButtonVariants['depth']
29
+ activeDepth?: ButtonVariants['depth']
30
+ /**
31
+ * @defaultValue 'md'
32
+ */
33
+ size?: ButtonVariants['size']
34
+ /**
35
+ * Rounds the corners of the button
36
+ * @defaultValue false
37
+ */
38
+ rounded?: boolean
39
+ /**
40
+ * Render the button full width
41
+ * @defaultValue false
42
+ */
43
+ block?: boolean
44
+ /**
45
+ * Set loading state automatically based on the `@click` promise state
46
+ * @defaultValue false
47
+ */
48
+ loadingAuto?: boolean
49
+ /**
50
+ * Disable uppercase label
51
+ * @defaultValue false
52
+ */
53
+ normalCase?: boolean
54
+ /**
55
+ * Shows LoaderWaitIcon in loading mode
56
+ * @defaultValue false
57
+ */
58
+ useWait?: boolean
59
+ /**
60
+ * Shows LoaderClockIcon icon in loading mode
61
+ * @defaultValue false
62
+ */
63
+ useClock?: boolean
64
+ /**
65
+ * Shows icons.chevronDown on the right side
66
+ * @defaultValue false
67
+ */
68
+ useDropdown?: boolean
69
+ onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>
70
+ class?: any
71
+ /**
72
+ * The class to apply when the link is active
73
+ * @defaultValue ''
74
+ */
75
+ activeClass?: string
76
+ /**
77
+ * The class to apply when the link is inactive
78
+ * @defaultValue ''
79
+ */
80
+ inactiveClass?: string
81
+ b24ui?: PartialString<typeof button.slots>
82
+ }
83
+
84
+ export interface ButtonSlots {
85
+ leading(props?: {}): any
86
+ default(props?: {}): any
87
+ trailing(props?: {}): any
88
+ }
7
89
  </script>
8
90
 
9
- <script setup>
10
- import { computed, ref, inject } from "vue";
11
- import { useForwardProps } from "reka-ui";
12
- import { useComponentIcons } from "../composables/useComponentIcons";
13
- import { useButtonGroup } from "../composables/useButtonGroup";
14
- import { formLoadingInjectionKey } from "../composables/useFormField";
15
- import { pickLinkProps } from "../utils/link";
16
- const props = defineProps({
17
- label: {
18
- type: String,
19
- required: false
20
- },
21
- color: {
22
- type: null,
23
- required: false
24
- },
25
- activeColor: {
26
- type: null,
27
- required: false
28
- },
29
- depth: {
30
- type: null,
31
- required: false
32
- },
33
- activeDepth: {
34
- type: null,
35
- required: false
36
- },
37
- size: {
38
- type: null,
39
- required: false
40
- },
41
- rounded: {
42
- type: Boolean,
43
- required: false
44
- },
45
- block: {
46
- type: Boolean,
47
- required: false
48
- },
49
- loadingAuto: {
50
- type: Boolean,
51
- required: false
52
- },
53
- normalCase: {
54
- type: Boolean,
55
- required: false
56
- },
57
- useWait: {
58
- type: Boolean,
59
- required: false
60
- },
61
- useClock: {
62
- type: Boolean,
63
- required: false
64
- },
65
- useDropdown: {
66
- type: Boolean,
67
- required: false
68
- },
69
- onClick: {
70
- type: [Function, Array],
71
- required: false
72
- },
73
- class: {
74
- type: null,
75
- required: false
76
- },
77
- activeClass: {
78
- type: String,
79
- required: false,
80
- default: ""
81
- },
82
- inactiveClass: {
83
- type: String,
84
- required: false,
85
- default: ""
86
- },
87
- b24ui: {
88
- type: null,
89
- required: false
90
- },
91
- icon: {
92
- type: [Function, Object],
93
- required: false
94
- },
95
- avatar: {
96
- type: Object,
97
- required: false
98
- },
99
- loading: {
100
- type: Boolean,
101
- required: false
102
- },
103
- as: {
104
- type: null,
105
- required: false
106
- },
107
- type: {
108
- type: null,
109
- required: false,
110
- default: "button"
111
- },
112
- disabled: {
113
- type: Boolean,
114
- required: false
115
- },
116
- active: {
117
- type: Boolean,
118
- required: false,
119
- default: void 0
120
- },
121
- exact: {
122
- type: Boolean,
123
- required: false
124
- },
125
- exactQuery: {
126
- type: [Boolean, String],
127
- required: false
128
- },
129
- exactHash: {
130
- type: Boolean,
131
- required: false
132
- },
133
- isAction: {
134
- type: Boolean,
135
- required: false
136
- },
137
- to: {
138
- type: null,
139
- required: false
140
- },
141
- href: {
142
- type: null,
143
- required: false
144
- },
145
- external: {
146
- type: Boolean,
147
- required: false
148
- },
149
- target: {
150
- type: [String, Object, null],
151
- required: false
152
- },
153
- rel: {
154
- type: [String, Object, null],
155
- required: false
156
- },
157
- noRel: {
158
- type: Boolean,
159
- required: false
160
- },
161
- prefetchedClass: {
162
- type: String,
163
- required: false
164
- },
165
- prefetch: {
166
- type: Boolean,
167
- required: false
168
- },
169
- prefetchOn: {
170
- type: [String, Object],
171
- required: false
172
- },
173
- noPrefetch: {
174
- type: Boolean,
175
- required: false
176
- },
177
- exactActiveClass: {
178
- type: String,
179
- required: false
180
- },
181
- ariaCurrentValue: {
182
- type: String,
183
- required: false
184
- },
185
- viewTransition: {
186
- type: Boolean,
187
- required: false
188
- },
189
- replace: {
190
- type: Boolean,
191
- required: false
192
- }
193
- });
194
- const slots = defineSlots();
195
- const linkProps = useForwardProps(pickLinkProps(props));
196
- const { orientation, size: buttonSize, noSplit } = useButtonGroup(props);
197
- const loadingAutoState = ref(false);
198
- const formLoading = inject(formLoadingInjectionKey, void 0);
199
- async function onClickWrapper(event) {
200
- loadingAutoState.value = true;
201
- const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick];
91
+ <script setup lang="ts">
92
+ import { type Ref, computed, ref, inject } from 'vue'
93
+ import { useForwardProps } from 'reka-ui'
94
+ import { useComponentIcons } from '../composables/useComponentIcons'
95
+ import { useButtonGroup } from '../composables/useButtonGroup'
96
+ import { formLoadingInjectionKey } from '../composables/useFormField'
97
+ import { omit } from '../utils'
98
+ import { pickLinkProps } from '../utils/link'
99
+ import B24Avatar from './Avatar.vue'
100
+ import B24Link from './Link.vue'
101
+ import B24LinkBase from './LinkBase.vue'
102
+ import ChevronDownIcon from '@bitrix24/b24icons-vue/actions/ChevronDownIcon'
103
+ import LoaderWaitIcon from '@bitrix24/b24icons-vue/animated/LoaderWaitIcon'
104
+ import LoaderClockIcon from '@bitrix24/b24icons-vue/animated/LoaderClockIcon'
105
+ import SpinnerIcon from '@bitrix24/b24icons-vue/specialized/SpinnerIcon'
106
+
107
+ const props = withDefaults(defineProps<ButtonProps>(), {
108
+ type: 'button',
109
+ active: undefined,
110
+ activeClass: '',
111
+ inactiveClass: ''
112
+ })
113
+
114
+ const slots = defineSlots<ButtonSlots>()
115
+
116
+ const linkProps = useForwardProps(pickLinkProps(props))
117
+
118
+ /**
119
+ * @memo Problem use at Docs (vue): omit not exports
120
+ */
121
+ const proxyLinkProps = computed(() => {
122
+ return omit(linkProps.value, ['type', 'disabled', 'onClick'])
123
+ })
124
+
125
+ const { orientation, size: buttonSize, noSplit } = useButtonGroup<ButtonProps>(props)
126
+
127
+ const loadingAutoState = ref(false)
128
+ const formLoading = inject<Ref<boolean> | undefined>(formLoadingInjectionKey, undefined)
129
+
130
+ async function onClickWrapper(event: MouseEvent) {
131
+ loadingAutoState.value = true
132
+ const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
202
133
  try {
203
- await Promise.all(callbacks.map((fn) => fn?.(event)));
134
+ await Promise.all(callbacks.map(fn => fn?.(event)))
204
135
  } finally {
205
- loadingAutoState.value = false;
136
+ loadingAutoState.value = false
206
137
  }
207
138
  }
139
+
208
140
  const isLoading = computed(() => {
209
- return props.loading || props.loadingAuto && (loadingAutoState.value || formLoading?.value && props.type === "submit");
210
- });
141
+ return props.loading || (props.loadingAuto && (loadingAutoState.value || (formLoading?.value && props.type === 'submit')))
142
+ })
143
+
211
144
  const { isLeading, leadingIconName } = useComponentIcons(
212
145
  computed(() => ({ ...props, loading: false }))
213
- );
146
+ )
147
+
214
148
  const isLabel = computed(() => {
215
- let isUseSlot = false;
149
+ let isUseSlot = false
150
+
216
151
  if (slots && !!slots.default) {
217
- isUseSlot = true;
152
+ isUseSlot = true
218
153
  }
219
- return (props?.label || "").length > 0 || isUseSlot;
220
- });
154
+
155
+ return (props?.label || '').length > 0 || isUseSlot
156
+ })
157
+
221
158
  const b24ui = computed(() => tv({
222
159
  extend: button,
223
160
  variants: {
@@ -245,7 +182,7 @@ const b24ui = computed(() => tv({
245
182
  useClock: Boolean(props.useClock),
246
183
  leading: Boolean(isLeading.value),
247
184
  buttonGroup: orientation.value
248
- }));
185
+ }))
249
186
  </script>
250
187
 
251
188
  <template>
@@ -254,17 +191,17 @@ const b24ui = computed(() => tv({
254
191
  :type="type"
255
192
  :disabled="disabled || isLoading"
256
193
  :class="b24ui.base({ class: [props.class, props.b24ui?.base] })"
257
- v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
194
+ v-bind="proxyLinkProps"
258
195
  custom
259
196
  >
260
197
  <B24LinkBase
261
198
  v-bind="slotProps"
262
199
  :class="b24ui.base({
263
- class: [props.class, props.b24ui?.base],
264
- active,
265
- ...active && activeDepth ? { depth: activeDepth } : {},
266
- ...active && activeColor ? { color: activeColor } : {}
267
- })"
200
+ class: [props.class, props.b24ui?.base],
201
+ active,
202
+ ...(active && activeDepth ? { depth: activeDepth } : {}),
203
+ ...(active && activeColor ? { color: activeColor } : {})
204
+ })"
268
205
  @click="onClickWrapper"
269
206
  >
270
207
  <div
@@ -277,19 +214,19 @@ const b24ui = computed(() => tv({
277
214
  </div>
278
215
  <div
279
216
  :class="[
280
- b24ui.baseLine({ class: [props.b24ui?.baseLine] }),
281
- isLoading ? 'invisible' : ''
282
- ]"
217
+ b24ui.baseLine({ class: [props.b24ui?.baseLine] }),
218
+ isLoading ? 'invisible' : ''
219
+ ]"
283
220
  >
284
221
  <slot name="leading">
285
222
  <Component
286
223
  :is="leadingIconName"
287
- v-if="isLeading && typeof leadingIconName !== 'undefined'"
224
+ v-if="isLeading && (typeof leadingIconName !== 'undefined')"
288
225
  :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
289
226
  />
290
227
  <B24Avatar
291
228
  v-else-if="!!avatar"
292
- :size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()"
229
+ :size="((props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()) as AvatarProps['size'])"
293
230
  v-bind="avatar"
294
231
  :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
295
232
  />
@@ -1,44 +1,60 @@
1
- <script>
2
- import _appConfig from "#build/app.config";
3
- import theme from "#build/b24ui/button-group";
4
- import { tv } from "../utils/tv";
5
- const appConfigButtonGroup = _appConfig;
6
- const buttonGroup = tv({ extend: tv(theme), ...appConfigButtonGroup.b24ui?.buttonGroup });
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/b24ui/button-group'
6
+ import { tv } from '../utils/tv'
7
+
8
+ const appConfigButtonGroup = _appConfig as AppConfig & { b24ui: { buttonGroup: Partial<typeof theme> } }
9
+
10
+ const buttonGroup = tv({ extend: tv(theme), ...(appConfigButtonGroup.b24ui?.buttonGroup) })
11
+
12
+ type ButtonGroupVariants = VariantProps<typeof buttonGroup>
13
+
14
+ export interface ButtonGroupProps {
15
+ /**
16
+ * The element or component this component should render as.
17
+ * @defaultValue 'div'
18
+ */
19
+ as?: any
20
+ /**
21
+ * @defaultValue 'md'
22
+ */
23
+ size?: ButtonGroupVariants['size']
24
+ /**
25
+ * The orientation the buttons are laid out.
26
+ * @defaultValue 'horizontal'
27
+ */
28
+ orientation?: ButtonGroupVariants['orientation']
29
+ /**
30
+ * Disable show split
31
+ * @defaultValue false
32
+ */
33
+ noSplit?: boolean
34
+ class?: any
35
+ }
36
+
37
+ export interface ButtonGroupSlots {
38
+ default(props?: {}): any
39
+ }
7
40
  </script>
8
41
 
9
- <script setup>
10
- import { provide, computed } from "vue";
11
- import { buttonGroupInjectionKey } from "../composables/useButtonGroup";
12
- const props = defineProps({
13
- as: {
14
- type: null,
15
- required: false
16
- },
17
- size: {
18
- type: null,
19
- required: false
20
- },
21
- orientation: {
22
- type: null,
23
- required: false,
24
- default: "horizontal"
25
- },
26
- noSplit: {
27
- type: Boolean,
28
- required: false,
29
- default: false
30
- },
31
- class: {
32
- type: null,
33
- required: false
34
- }
35
- });
36
- defineSlots();
42
+ <script setup lang="ts">
43
+ import { provide, computed } from 'vue'
44
+ import { Primitive } from 'reka-ui'
45
+ import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
46
+
47
+ const props = withDefaults(defineProps<ButtonGroupProps>(), {
48
+ orientation: 'horizontal',
49
+ noSplit: false
50
+ })
51
+ defineSlots<ButtonGroupSlots>()
52
+
37
53
  provide(buttonGroupInjectionKey, computed(() => ({
38
54
  orientation: props.orientation,
39
55
  noSplit: Boolean(props.noSplit),
40
56
  size: props.size
41
- })));
57
+ })))
42
58
  </script>
43
59
 
44
60
  <template>