@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,198 +1,164 @@
1
- <script>
2
- import _appConfig from "#build/app.config";
3
- import theme from "#build/b24ui/calendar";
4
- import { tv } from "../utils/tv";
5
- const appConfigCalendar = _appConfig;
6
- const calendar = tv({ extend: tv(theme), ...appConfigCalendar.b24ui?.calendar || {} });
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootProps, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
4
+ import type { DateValue } from '@internationalized/date'
5
+ import type { AppConfig } from '@nuxt/schema'
6
+ import type { IconComponent, ButtonProps } from '../types'
7
+ import _appConfig from '#build/app.config'
8
+ import theme from '#build/b24ui/calendar'
9
+ import { tv } from '../utils/tv'
10
+ import type { PartialString } from '../types/utils'
11
+
12
+ const appConfigCalendar = _appConfig as AppConfig & { b24ui: { calendar: Partial<typeof theme> } }
13
+
14
+ const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.b24ui?.calendar || {}) })
15
+
16
+ type CalendarVariants = VariantProps<typeof calendar>
17
+
18
+ type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true
19
+ ? DateRange
20
+ : M extends true
21
+ ? DateValue[]
22
+ : DateValue
23
+ type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
24
+ ? (DateRange | null)
25
+ : M extends true
26
+ ? (DateValue[] | undefined)
27
+ : (DateValue | undefined)
28
+
29
+ type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
30
+ type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
31
+
32
+ export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends _RangeCalendarRootProps, _CalendarRootProps {
33
+ /**
34
+ * The element or component this component should render as.
35
+ * @defaultValue 'div'
36
+ */
37
+ as?: any
38
+ /**
39
+ * The icon to use for the next year control.
40
+ * @defaultValue icons.chevronDoubleRight
41
+ * @IconComponent
42
+ */
43
+ nextYearIcon?: IconComponent
44
+ /**
45
+ * Configure the next year button.
46
+ * `{ color: 'link' }`{lang="ts"}
47
+ */
48
+ nextYear?: ButtonProps
49
+ /**
50
+ * The icon to use for the next month control.
51
+ * @defaultValue icons.chevronRight
52
+ * @IconComponent
53
+ */
54
+ nextMonthIcon?: IconComponent
55
+ /**
56
+ * Configure the next month button.
57
+ * `{ color: 'link' }`{lang="ts"}
58
+ */
59
+ nextMonth?: ButtonProps
60
+ /**
61
+ * The icon to use for the previous year control.
62
+ * @defaultValue icons.chevronDoubleLeft
63
+ * @IconComponent
64
+ */
65
+ prevYearIcon?: IconComponent
66
+ /**
67
+ * Configure the prev year button.
68
+ * `{ color: 'link' }`{lang="ts"}
69
+ */
70
+ prevYear?: ButtonProps
71
+ /**
72
+ * The icon to use for the previous month control.
73
+ * @defaultValue icons.chevronLeft
74
+ * @IconComponent
75
+ */
76
+ prevMonthIcon?: IconComponent
77
+ /**
78
+ * Configure the prev month button.
79
+ * `{ color: 'link' }`{lang="ts"}
80
+ */
81
+ prevMonth?: ButtonProps
82
+ /**
83
+ * @defaultValue 'primary'
84
+ */
85
+ color?: CalendarVariants['color']
86
+ /**
87
+ * @defaultValue 'md'
88
+ */
89
+ size?: CalendarVariants['size']
90
+ /** Whether a range of dates can be selected */
91
+ range?: R & boolean
92
+ /** Whether multiple dates can be selected */
93
+ multiple?: M & boolean
94
+ /** Show month controls */
95
+ monthControls?: boolean
96
+ /** Show year controls */
97
+ yearControls?: boolean
98
+ defaultValue?: CalendarDefaultValue<R, M>
99
+ modelValue?: CalendarModelValue<R, M>
100
+ class?: any
101
+ b24ui?: PartialString<typeof calendar.slots>
102
+ }
103
+
104
+ export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
105
+ 'update:modelValue': [date: CalendarModelValue<R, M>]
106
+ }
107
+
108
+ export interface CalendarSlots {
109
+ 'heading': (props: { value: string }) => any
110
+ 'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
111
+ 'week-day': (props: { day: string }) => any
112
+ }
7
113
  </script>
8
114
 
9
- <script setup>
10
- import { computed } from "vue";
11
- import { useForwardPropsEmits } from "reka-ui";
12
- import { Calendar as SingleCalendar, RangeCalendar } from "reka-ui/namespaced";
13
- import { reactiveOmit } from "@vueuse/core";
14
- import { useLocale } from "../composables/useLocale";
15
- import icons from "../dictionary/icons";
16
- const props = defineProps({
17
- as: {
18
- type: null,
19
- required: false
20
- },
21
- nextYearIcon: {
22
- type: [Function, Object],
23
- required: false
24
- },
25
- nextYear: {
26
- type: Object,
27
- required: false
28
- },
29
- nextMonthIcon: {
30
- type: [Function, Object],
31
- required: false
32
- },
33
- nextMonth: {
34
- type: Object,
35
- required: false
36
- },
37
- prevYearIcon: {
38
- type: [Function, Object],
39
- required: false
40
- },
41
- prevYear: {
42
- type: Object,
43
- required: false
44
- },
45
- prevMonthIcon: {
46
- type: [Function, Object],
47
- required: false
48
- },
49
- prevMonth: {
50
- type: Object,
51
- required: false
52
- },
53
- color: {
54
- type: null,
55
- required: false
56
- },
57
- size: {
58
- type: null,
59
- required: false
60
- },
61
- range: {
62
- type: Boolean,
63
- required: false
64
- },
65
- multiple: {
66
- type: Boolean,
67
- required: false
68
- },
69
- monthControls: {
70
- type: Boolean,
71
- required: false,
72
- default: true
73
- },
74
- yearControls: {
75
- type: Boolean,
76
- required: false,
77
- default: true
78
- },
79
- defaultValue: {
80
- type: null,
81
- required: false
82
- },
83
- modelValue: {
84
- type: null,
85
- required: false
86
- },
87
- class: {
88
- type: null,
89
- required: false
90
- },
91
- b24ui: {
92
- type: null,
93
- required: false
94
- },
95
- defaultPlaceholder: {
96
- type: null,
97
- required: false
98
- },
99
- placeholder: {
100
- type: null,
101
- required: false
102
- },
103
- allowNonContiguousRanges: {
104
- type: Boolean,
105
- required: false
106
- },
107
- pagedNavigation: {
108
- type: Boolean,
109
- required: false
110
- },
111
- preventDeselect: {
112
- type: Boolean,
113
- required: false
114
- },
115
- weekStartsOn: {
116
- type: Number,
117
- required: false
118
- },
119
- weekdayFormat: {
120
- type: String,
121
- required: false
122
- },
123
- fixedWeeks: {
124
- type: Boolean,
125
- required: false,
126
- default: true
127
- },
128
- maxValue: {
129
- type: null,
130
- required: false
131
- },
132
- minValue: {
133
- type: null,
134
- required: false
135
- },
136
- numberOfMonths: {
137
- type: Number,
138
- required: false
139
- },
140
- disabled: {
141
- type: Boolean,
142
- required: false
143
- },
144
- readonly: {
145
- type: Boolean,
146
- required: false
147
- },
148
- initialFocus: {
149
- type: Boolean,
150
- required: false
151
- },
152
- isDateDisabled: {
153
- type: Function,
154
- required: false
155
- },
156
- isDateUnavailable: {
157
- type: Function,
158
- required: false
159
- },
160
- nextPage: {
161
- type: Function,
162
- required: false
163
- },
164
- prevPage: {
165
- type: Function,
166
- required: false
167
- }
168
- });
169
- const emits = defineEmits(["update:modelValue", "update:placeholder", "update:startValue"]);
170
- defineSlots();
171
- const { code: locale, dir, t } = useLocale();
172
- const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "color", "size", "monthControls", "yearControls", "class", "b24ui"), emits);
173
- const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? icons.chevronDoubleLeft : icons.chevronDoubleRight));
174
- const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? icons.chevronLeft : icons.chevronRight));
175
- const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? icons.chevronDoubleRight : icons.chevronDoubleLeft));
176
- const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? icons.chevronRight : icons.chevronLeft));
115
+ <script setup lang="ts" generic="R extends boolean, M extends boolean">
116
+ import { computed } from 'vue'
117
+ import { useForwardPropsEmits } from 'reka-ui'
118
+ import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
119
+ import { reactiveOmit } from '@vueuse/core'
120
+ import { useLocale } from '../composables/useLocale'
121
+ import icons from '../dictionary/icons'
122
+ import B24Button from './Button.vue'
123
+
124
+ const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
125
+ fixedWeeks: true,
126
+ monthControls: true,
127
+ yearControls: true
128
+ })
129
+ const emits = defineEmits<CalendarEmits<R, M>>()
130
+ defineSlots<CalendarSlots>()
131
+
132
+ const { code: locale, dir, t } = useLocale()
133
+
134
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'b24ui'), emits)
135
+
136
+ const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? icons.chevronDoubleLeft : icons.chevronDoubleRight))
137
+ const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? icons.chevronLeft : icons.chevronRight))
138
+ const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? icons.chevronDoubleRight : icons.chevronDoubleLeft))
139
+ const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? icons.chevronRight : icons.chevronLeft))
140
+
177
141
  const b24ui = computed(() => calendar({
178
142
  color: props.color,
179
143
  size: props.size
180
- }));
181
- function paginateYear(date, sign) {
144
+ }))
145
+
146
+ function paginateYear(date: DateValue, sign: -1 | 1) {
182
147
  if (sign === -1) {
183
- return date.subtract({ years: 1 });
148
+ return date.subtract({ years: 1 })
184
149
  }
185
- return date.add({ years: 1 });
150
+
151
+ return date.add({ years: 1 })
186
152
  }
187
- const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar);
153
+
154
+ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
155
+
188
156
  const btnSize = computed(() => {
189
157
  switch (props.size) {
190
- case "lg":
191
- return "sm";
192
- default:
193
- return "xs";
158
+ case 'lg': return 'sm'
159
+ default: return 'xs'
194
160
  }
195
- });
161
+ })
196
162
  </script>
197
163
 
198
164
  <template>
@@ -206,7 +172,7 @@ const btnSize = computed(() => {
206
172
  :class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
207
173
  >
208
174
  <Calendar.Header :class="b24ui.header({ class: props.b24ui?.header })">
209
- <Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
175
+ <Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
210
176
  <B24Button :icon="prevYearIcon" :size="btnSize" color="link" v-bind="props.prevYear" />
211
177
  </Calendar.Prev>
212
178
  <Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
@@ -220,7 +186,7 @@ const btnSize = computed(() => {
220
186
  <Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
221
187
  <B24Button :icon="nextMonthIcon" :size="btnSize" color="link" v-bind="props.nextMonth" />
222
188
  </Calendar.Next>
223
- <Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
189
+ <Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
224
190
  <B24Button :icon="nextYearIcon" :size="btnSize" color="link" v-bind="props.nextYear" />
225
191
  </Calendar.Next>
226
192
  </Calendar.Header>
@@ -1,97 +1,86 @@
1
- <script>
2
- import _appConfig from "#build/app.config";
3
- import theme from "#build/b24ui/checkbox";
4
- import { tv } from "../utils/tv";
5
- const appConfigCheckbox = _appConfig;
6
- const checkbox = tv({ extend: tv(theme), ...appConfigCheckbox.b24ui?.checkbox || {} });
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { CheckboxRootProps } from 'reka-ui'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/b24ui/checkbox'
7
+ import { tv } from '../utils/tv'
8
+
9
+ const appConfigCheckbox = _appConfig as AppConfig & { b24ui: { checkbox: Partial<typeof theme> } }
10
+
11
+ const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.b24ui?.checkbox || {}) })
12
+
13
+ type CheckboxVariants = VariantProps<typeof checkbox>
14
+
15
+ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue 'div'
19
+ */
20
+ as?: any
21
+ label?: string
22
+ description?: string
23
+ /**
24
+ * @defaultValue 'primary'
25
+ */
26
+ color?: CheckboxVariants['color']
27
+ /**
28
+ * @defaultValue 'md'
29
+ */
30
+ size?: CheckboxVariants['size']
31
+ class?: any
32
+ b24ui?: Partial<typeof checkbox.slots>
33
+ }
34
+
35
+ export type CheckboxEmits = {
36
+ change: [payload: Event]
37
+ }
38
+
39
+ export interface CheckboxSlots {
40
+ label(props: { label?: string }): any
41
+ description(props: { description?: string }): any
42
+ }
7
43
  </script>
8
44
 
9
- <script setup>
10
- import { computed, useId } from "vue";
11
- import { useForwardProps } from "reka-ui";
12
- import { reactivePick } from "@vueuse/core";
13
- import { useFormField } from "../composables/useFormField";
14
- defineOptions({ inheritAttrs: false });
15
- const props = defineProps({
16
- as: {
17
- type: null,
18
- required: false
19
- },
20
- label: {
21
- type: String,
22
- required: false
23
- },
24
- description: {
25
- type: String,
26
- required: false
27
- },
28
- color: {
29
- type: null,
30
- required: false
31
- },
32
- size: {
33
- type: null,
34
- required: false
35
- },
36
- class: {
37
- type: null,
38
- required: false
39
- },
40
- b24ui: {
41
- type: Object,
42
- required: false
43
- },
44
- disabled: {
45
- type: Boolean,
46
- required: false
47
- },
48
- required: {
49
- type: Boolean,
50
- required: false
51
- },
52
- name: {
53
- type: String,
54
- required: false
55
- },
56
- value: {
57
- type: [String, Number, Object, null],
58
- required: false
59
- },
60
- id: {
61
- type: String,
62
- required: false
63
- },
64
- defaultValue: {
65
- type: [Boolean, String],
66
- required: false
67
- }
68
- });
69
- const slots = defineSlots();
70
- const emits = defineEmits(["change"]);
71
- const modelValue = defineModel({
72
- "type": [Boolean, String],
73
- ...{
74
- default: void 0
75
- }
76
- });
77
- const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
78
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
79
- const id = _id.value ?? useId();
45
+ <script setup lang="ts">
46
+ import { computed, useId } from 'vue'
47
+ import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'reka-ui'
48
+ import { reactivePick } from '@vueuse/core'
49
+ import { useFormField } from '../composables/useFormField'
50
+ import Minus20Icon from '@bitrix24/b24icons-vue/actions/Minus20Icon'
51
+ import CheckIcon from '@bitrix24/b24icons-vue/main/CheckIcon'
52
+
53
+ defineOptions({ inheritAttrs: false })
54
+
55
+ const props = defineProps<CheckboxProps>()
56
+ const slots = defineSlots<CheckboxSlots>()
57
+ const emits = defineEmits<CheckboxEmits>()
58
+
59
+ const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
60
+
61
+ const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
62
+
63
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<CheckboxProps>(props)
64
+ const id = _id.value ?? useId()
65
+
80
66
  const b24ui = computed(() => checkbox({
81
67
  size: size.value,
82
68
  color: color.value,
83
69
  required: props.required,
84
70
  disabled: disabled.value,
85
71
  checked: Boolean(modelValue.value ?? props.defaultValue)
86
- }));
87
- function onUpdate(value) {
88
- const event = new Event("change", { target: { value } });
89
- emits("change", event);
90
- emitFormChange();
91
- emitFormInput();
72
+ }))
73
+
74
+ function onUpdate(value: any) {
75
+ // @ts-expect-error - 'target' does not exist in type 'EventInit'
76
+ const event = new Event('change', { target: { value } })
77
+ emits('change', event)
78
+ emitFormChange()
79
+ emitFormInput()
92
80
  }
93
81
  </script>
94
82
 
83
+ <!-- eslint-disable vue/no-template-shadow -->
95
84
  <template>
96
85
  <Primitive :as="as" :class="b24ui.root({ class: [props.class, props.b24ui?.root] })">
97
86
  <div :class="b24ui.container({ class: props.b24ui?.container })">
@@ -113,7 +102,7 @@ function onUpdate(value) {
113
102
  </CheckboxRoot>
114
103
  </div>
115
104
 
116
- <div v-if="label || !!slots.label || (description || !!slots.description)" :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
105
+ <div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
117
106
  <Label v-if="label || !!slots.label" :for="id" :class="b24ui.label({ class: props.b24ui?.label })">
118
107
  <slot name="label" :label="label">
119
108
  {{ label }}
@@ -1,70 +1,85 @@
1
- <script>
2
- import _appConfig from "#build/app.config";
3
- import theme from "#build/b24ui/chip";
4
- import { tv } from "../utils/tv";
5
- const appConfigChip = _appConfig;
6
- const chip = tv({ extend: tv(theme), ...appConfigChip.b24ui?.chip || {} });
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/chip'
6
+ import { tv } from '../utils/tv'
7
+
8
+ const appConfigChip = _appConfig as AppConfig & { b24ui: { chip: Partial<typeof theme> } }
9
+
10
+ const chip = tv({ extend: tv(theme), ...(appConfigChip.b24ui?.chip || {}) })
11
+
12
+ type ChipVariants = VariantProps<typeof chip>
13
+
14
+ export interface ChipProps {
15
+ /**
16
+ * The element or component this component should render as.
17
+ * @defaultValue 'div'
18
+ */
19
+ as?: any
20
+ /** Display some text inside the chip. */
21
+ text?: string | number
22
+ /**
23
+ * @defaultValue 'danger'
24
+ */
25
+ color?: ChipVariants['color']
26
+ /**
27
+ * @defaultValue 'sm'
28
+ */
29
+ size?: ChipVariants['size']
30
+ /**
31
+ * The position of the chip.
32
+ * @defaultValue 'top-right'
33
+ */
34
+ position?: ChipVariants['position']
35
+ /**
36
+ * When `true`, keep the chip inside the component for rounded elements
37
+ * @defaultValue false
38
+ */
39
+ inset?: boolean
40
+ /**
41
+ * When `true`, render the chip relatively to the parent.
42
+ * @defaultValue false
43
+ */
44
+ standalone?: boolean
45
+ class?: any
46
+ b24ui?: Partial<typeof chip.slots>
47
+ }
48
+
49
+ export interface ChipEmits {
50
+ (e: 'update:show', payload: boolean): void
51
+ }
52
+
53
+ export interface ChipSlots {
54
+ default(props?: {}): any
55
+ content(props?: {}): any
56
+ }
7
57
  </script>
8
58
 
9
- <script setup>
10
- import { computed } from "vue";
11
- import { useAvatarGroup } from "../composables/useAvatarGroup";
12
- defineOptions({ inheritAttrs: false });
13
- const props = defineProps({
14
- as: {
15
- type: null,
16
- required: false
17
- },
18
- text: {
19
- type: [String, Number],
20
- required: false
21
- },
22
- color: {
23
- type: null,
24
- required: false
25
- },
26
- size: {
27
- type: null,
28
- required: false
29
- },
30
- position: {
31
- type: null,
32
- required: false
33
- },
34
- inset: {
35
- type: Boolean,
36
- required: false,
37
- default: false
38
- },
39
- standalone: {
40
- type: Boolean,
41
- required: false,
42
- default: false
43
- },
44
- class: {
45
- type: null,
46
- required: false
47
- },
48
- b24ui: {
49
- type: Object,
50
- required: false
51
- }
52
- });
53
- defineSlots();
54
- const show = defineModel("show", {
55
- "type": Boolean,
56
- ...{
57
- default: true
58
- }
59
- });
60
- const { size } = useAvatarGroup(props);
59
+ <script setup lang="ts">
60
+ import { computed } from 'vue'
61
+ import { Primitive, Slot } from 'reka-ui'
62
+ import { useAvatarGroup } from '../composables/useAvatarGroup'
63
+
64
+ defineOptions({ inheritAttrs: false })
65
+
66
+ const props = withDefaults(defineProps<ChipProps>(), {
67
+ inset: false,
68
+ standalone: false
69
+ })
70
+ defineSlots<ChipSlots>()
71
+
72
+ const show = defineModel<boolean>('show', { default: true })
73
+
74
+ const { size } = useAvatarGroup(props)
75
+
61
76
  const b24ui = computed(() => chip({
62
77
  color: props.color,
63
78
  size: size.value,
64
79
  position: props.position,
65
80
  inset: Boolean(props.inset),
66
81
  standalone: Boolean(props.standalone)
67
- }));
82
+ }))
68
83
  </script>
69
84
 
70
85
  <template>