@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.
- package/.nuxt/b24ui/advice.ts +10 -2
- package/.nuxt/b24ui/alert.ts +10 -2
- package/.nuxt/b24ui/avatar-group.ts +10 -2
- package/.nuxt/b24ui/avatar.ts +10 -2
- package/.nuxt/b24ui/badge.ts +10 -2
- package/.nuxt/b24ui/button-group.ts +10 -2
- package/.nuxt/b24ui/button.ts +16 -6
- package/.nuxt/b24ui/calendar.ts +10 -2
- package/.nuxt/b24ui/checkbox.ts +10 -2
- package/.nuxt/b24ui/chip.ts +10 -2
- package/.nuxt/b24ui/collapsible.ts +10 -2
- package/.nuxt/b24ui/container.ts +10 -2
- package/.nuxt/b24ui/countdown.ts +10 -2
- package/.nuxt/b24ui/description-list.ts +10 -2
- package/.nuxt/b24ui/dropdown-menu.ts +10 -2
- package/.nuxt/b24ui/form-field.ts +10 -2
- package/.nuxt/b24ui/form.ts +10 -2
- package/.nuxt/b24ui/input-menu.ts +12 -4
- package/.nuxt/b24ui/input-number.ts +10 -2
- package/.nuxt/b24ui/input.ts +10 -2
- package/.nuxt/b24ui/kbd.ts +10 -2
- package/.nuxt/b24ui/link.ts +10 -2
- package/.nuxt/b24ui/modal.ts +10 -2
- package/.nuxt/b24ui/navbar-divider.ts +10 -2
- package/.nuxt/b24ui/navbar-section.ts +10 -2
- package/.nuxt/b24ui/navbar-spacer.ts +10 -2
- package/.nuxt/b24ui/navbar.ts +10 -2
- package/.nuxt/b24ui/navigation-menu.ts +10 -2
- package/.nuxt/b24ui/popover.ts +10 -2
- package/.nuxt/b24ui/progress.ts +10 -2
- package/.nuxt/b24ui/radio-group.ts +10 -2
- package/.nuxt/b24ui/range.ts +10 -2
- package/.nuxt/b24ui/select-menu.ts +14 -6
- package/.nuxt/b24ui/select.ts +12 -4
- package/.nuxt/b24ui/separator.ts +10 -2
- package/.nuxt/b24ui/sidebar-body.ts +10 -2
- package/.nuxt/b24ui/sidebar-footer.ts +10 -2
- package/.nuxt/b24ui/sidebar-header.ts +10 -2
- package/.nuxt/b24ui/sidebar-heading.ts +10 -2
- package/.nuxt/b24ui/sidebar-layout.ts +10 -2
- package/.nuxt/b24ui/sidebar-section.ts +10 -2
- package/.nuxt/b24ui/sidebar-spacer.ts +10 -2
- package/.nuxt/b24ui/sidebar.ts +10 -2
- package/.nuxt/b24ui/skeleton.ts +10 -2
- package/.nuxt/b24ui/slideover.ts +10 -2
- package/.nuxt/b24ui/stacked-layout.ts +10 -2
- package/.nuxt/b24ui/switch.ts +10 -2
- package/.nuxt/b24ui/tabs.ts +10 -2
- package/.nuxt/b24ui/textarea.ts +10 -2
- package/.nuxt/b24ui/toast.ts +10 -2
- package/.nuxt/b24ui/toaster.ts +10 -2
- package/.nuxt/b24ui/tooltip.ts +10 -2
- package/cli/templates.mjs +19 -15
- package/dist/meta.d.mts +5675 -7513
- package/dist/meta.mjs +5675 -7513
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Advice.vue +27 -55
- package/dist/runtime/components/Advice.vue.d.ts +56 -0
- package/dist/runtime/components/Alert.vue +35 -97
- package/dist/runtime/components/Alert.vue.d.ts +97 -0
- package/dist/runtime/components/App.vue +24 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +43 -82
- package/dist/runtime/components/Avatar.vue.d.ts +62 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +40 -84
- package/dist/runtime/components/Badge.vue.d.ts +78 -0
- package/dist/runtime/components/Button.vue +107 -164
- package/dist/runtime/components/Button.vue.d.ts +115 -0
- package/dist/runtime/components/ButtonGroup.vue +25 -52
- package/dist/runtime/components/ButtonGroup.vue.d.ts +63 -0
- package/dist/runtime/components/Calendar.vue +73 -153
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Checkbox.vue +42 -74
- package/dist/runtime/components/Checkbox.vue.d.ts +55 -0
- package/dist/runtime/components/Chip.vue +26 -75
- package/dist/runtime/components/Chip.vue.d.ts +77 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +153 -379
- package/dist/runtime/components/Countdown.vue.d.ts +122 -0
- package/dist/runtime/components/DescriptionList.vue +78 -150
- package/dist/runtime/components/DescriptionList.vue.d.ts +109 -0
- package/dist/runtime/components/DropdownMenu.vue +38 -140
- package/dist/runtime/components/DropdownMenu.vue.d.ts +133 -0
- package/dist/runtime/components/DropdownMenuContent.vue +65 -79
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/Form.vue +132 -218
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +36 -81
- package/dist/runtime/components/FormField.vue.d.ts +73 -0
- package/dist/runtime/components/Input.vue +79 -180
- package/dist/runtime/components/Input.vue.d.ts +135 -0
- package/dist/runtime/components/InputMenu.vue +185 -382
- package/dist/runtime/components/InputMenu.vue.d.ts +357 -0
- package/dist/runtime/components/InputNumber.vue +77 -176
- package/dist/runtime/components/InputNumber.vue.d.ts +238 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +99 -179
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +48 -128
- package/dist/runtime/components/Modal.vue.d.ts +124 -0
- package/dist/runtime/components/ModalDialogClose.vue +5 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +15 -33
- package/dist/runtime/components/Navbar.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarDivider.vue +15 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSection.vue +15 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSpacer.vue +15 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/NavigationMenu.vue +74 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +40 -82
- package/dist/runtime/components/Popover.vue.d.ts +79 -0
- package/dist/runtime/components/Progress.vue +70 -137
- package/dist/runtime/components/Progress.vue.d.ts +103 -0
- package/dist/runtime/components/RadioGroup.vue +59 -135
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Range.vue +46 -86
- package/dist/runtime/components/Range.vue.d.ts +73 -0
- package/dist/runtime/components/Select.vue +110 -261
- package/dist/runtime/components/Select.vue.d.ts +170 -0
- package/dist/runtime/components/SelectMenu.vue +161 -348
- package/dist/runtime/components/SelectMenu.vue.d.ts +217 -0
- package/dist/runtime/components/Separator.vue +28 -72
- package/dist/runtime/components/Separator.vue.d.ts +77 -0
- package/dist/runtime/components/Sidebar.vue +15 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarBody.vue +17 -39
- package/dist/runtime/components/SidebarBody.vue.d.ts +53 -0
- package/dist/runtime/components/SidebarFooter.vue +15 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeader.vue +15 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeading.vue +15 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarLayout.vue +34 -71
- package/dist/runtime/components/SidebarLayout.vue.d.ts +65 -0
- package/dist/runtime/components/SidebarSection.vue +15 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarSpacer.vue +15 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/Skeleton.vue +14 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +50 -132
- package/dist/runtime/components/Slideover.vue.d.ts +127 -0
- package/dist/runtime/components/StackedLayout.vue +34 -74
- package/dist/runtime/components/StackedLayout.vue.d.ts +65 -0
- package/dist/runtime/components/Switch.vue +46 -96
- package/dist/runtime/components/Switch.vue.d.ts +77 -0
- package/dist/runtime/components/Tabs.vue +41 -106
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +92 -202
- package/dist/runtime/components/Textarea.vue.d.ts +141 -0
- package/dist/runtime/components/Toast.vue +47 -106
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -116
- package/dist/runtime/components/Toaster.vue.d.ts +70 -0
- package/dist/runtime/components/Tooltip.vue +36 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/content/TableWrapper.vue +24 -71
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +83 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/prose/A.vue +16 -26
- package/dist/runtime/prose/A.vue.d.ts +27 -0
- package/dist/runtime/prose/Blockquote.vue +14 -26
- package/dist/runtime/prose/Blockquote.vue.d.ts +27 -0
- package/dist/runtime/prose/Code.vue +15 -32
- package/dist/runtime/prose/Code.vue.d.ts +31 -0
- package/dist/runtime/prose/Em.vue +16 -26
- package/dist/runtime/prose/Em.vue.d.ts +27 -0
- package/dist/runtime/prose/H1.vue +14 -26
- package/dist/runtime/prose/H1.vue.d.ts +27 -0
- package/dist/runtime/prose/H2.vue +14 -26
- package/dist/runtime/prose/H2.vue.d.ts +27 -0
- package/dist/runtime/prose/H3.vue +14 -26
- package/dist/runtime/prose/H3.vue.d.ts +27 -0
- package/dist/runtime/prose/H4.vue +14 -26
- package/dist/runtime/prose/H4.vue.d.ts +27 -0
- package/dist/runtime/prose/H5.vue +14 -26
- package/dist/runtime/prose/H5.vue.d.ts +27 -0
- package/dist/runtime/prose/H6.vue +14 -26
- package/dist/runtime/prose/H6.vue.d.ts +27 -0
- package/dist/runtime/prose/Hr.vue +13 -22
- package/dist/runtime/prose/Hr.vue.d.ts +19 -0
- package/dist/runtime/prose/Img.vue +13 -26
- package/dist/runtime/prose/Img.vue.d.ts +19 -0
- package/dist/runtime/prose/Li.vue +14 -26
- package/dist/runtime/prose/Li.vue.d.ts +27 -0
- package/dist/runtime/prose/Ol.vue +14 -26
- package/dist/runtime/prose/Ol.vue.d.ts +27 -0
- package/dist/runtime/prose/P.vue +14 -26
- package/dist/runtime/prose/P.vue.d.ts +27 -0
- package/dist/runtime/prose/Pre.vue +17 -33
- package/dist/runtime/prose/Pre.vue.d.ts +47 -0
- package/dist/runtime/prose/Strong.vue +14 -26
- package/dist/runtime/prose/Strong.vue.d.ts +27 -0
- package/dist/runtime/prose/Table.vue +21 -57
- package/dist/runtime/prose/Table.vue.d.ts +74 -0
- package/dist/runtime/prose/Tbody.vue +14 -26
- package/dist/runtime/prose/Tbody.vue.d.ts +27 -0
- package/dist/runtime/prose/Td.vue +14 -26
- package/dist/runtime/prose/Td.vue.d.ts +27 -0
- package/dist/runtime/prose/Th.vue +14 -26
- package/dist/runtime/prose/Th.vue.d.ts +27 -0
- package/dist/runtime/prose/Thead.vue +14 -26
- package/dist/runtime/prose/Thead.vue.d.ts +27 -0
- package/dist/runtime/prose/Tr.vue +14 -26
- package/dist/runtime/prose/Tr.vue.d.ts +27 -0
- package/dist/runtime/prose/Ul.vue +14 -26
- package/dist/runtime/prose/Ul.vue.d.ts +27 -0
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +42 -3
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Link.vue +122 -208
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.wBs9vEU5.mjs} +33 -8
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +19 -27
- package/dist/meta.cjs +0 -72112
- package/dist/meta.d.cts +0 -72110
- package/dist/meta.d.ts +0 -72110
- package/dist/module.cjs +0 -63
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +0 -7721
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -236
- package/dist/unplugin.d.cts +0 -33
- package/dist/unplugin.d.ts +0 -33
- package/dist/vite.cjs +0 -21
- package/dist/vite.d.cts +0 -14
- package/dist/vite.d.ts +0 -14
|
@@ -1,164 +1,84 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
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
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/calendar";
|
|
113
3
|
</script>
|
|
114
4
|
|
|
115
|
-
<script setup
|
|
116
|
-
import { computed } from
|
|
117
|
-
import { useForwardPropsEmits } from
|
|
118
|
-
import { Calendar as SingleCalendar, RangeCalendar } from
|
|
119
|
-
import { reactiveOmit } from
|
|
120
|
-
import {
|
|
121
|
-
import
|
|
122
|
-
import
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { Calendar as SingleCalendar, RangeCalendar } from "reka-ui/namespaced";
|
|
9
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
10
|
+
import { useAppConfig } from "#imports";
|
|
11
|
+
import { useLocale } from "../composables/useLocale";
|
|
12
|
+
import { tv } from "../utils/tv";
|
|
13
|
+
import icons from "../dictionary/icons";
|
|
14
|
+
import B24Button from "./Button.vue";
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
as: { type: null, required: false },
|
|
17
|
+
nextYearIcon: { type: [Function, Object], required: false },
|
|
18
|
+
nextYear: { type: Object, required: false },
|
|
19
|
+
nextMonthIcon: { type: [Function, Object], required: false },
|
|
20
|
+
nextMonth: { type: Object, required: false },
|
|
21
|
+
prevYearIcon: { type: [Function, Object], required: false },
|
|
22
|
+
prevYear: { type: Object, required: false },
|
|
23
|
+
prevMonthIcon: { type: [Function, Object], required: false },
|
|
24
|
+
prevMonth: { type: Object, required: false },
|
|
25
|
+
color: { type: null, required: false },
|
|
26
|
+
size: { type: null, required: false },
|
|
27
|
+
range: { type: Boolean, required: false },
|
|
28
|
+
multiple: { type: Boolean, required: false },
|
|
29
|
+
monthControls: { type: Boolean, required: false, default: true },
|
|
30
|
+
yearControls: { type: Boolean, required: false, default: true },
|
|
31
|
+
defaultValue: { type: null, required: false },
|
|
32
|
+
modelValue: { type: null, required: false },
|
|
33
|
+
class: { type: null, required: false },
|
|
34
|
+
b24ui: { type: null, required: false },
|
|
35
|
+
defaultPlaceholder: { type: null, required: false },
|
|
36
|
+
placeholder: { type: null, required: false },
|
|
37
|
+
allowNonContiguousRanges: { type: Boolean, required: false },
|
|
38
|
+
pagedNavigation: { type: Boolean, required: false },
|
|
39
|
+
preventDeselect: { type: Boolean, required: false },
|
|
40
|
+
weekStartsOn: { type: Number, required: false },
|
|
41
|
+
weekdayFormat: { type: String, required: false },
|
|
42
|
+
fixedWeeks: { type: Boolean, required: false, default: true },
|
|
43
|
+
maxValue: { type: null, required: false },
|
|
44
|
+
minValue: { type: null, required: false },
|
|
45
|
+
numberOfMonths: { type: Number, required: false },
|
|
46
|
+
disabled: { type: Boolean, required: false },
|
|
47
|
+
readonly: { type: Boolean, required: false },
|
|
48
|
+
initialFocus: { type: Boolean, required: false },
|
|
49
|
+
isDateDisabled: { type: Function, required: false },
|
|
50
|
+
isDateUnavailable: { type: Function, required: false },
|
|
51
|
+
nextPage: { type: Function, required: false },
|
|
52
|
+
prevPage: { type: Function, required: false }
|
|
53
|
+
});
|
|
54
|
+
const emits = defineEmits(["update:modelValue", "update:placeholder", "update:startValue"]);
|
|
55
|
+
defineSlots();
|
|
56
|
+
const { code: locale, dir, t } = useLocale();
|
|
57
|
+
const appConfig = useAppConfig();
|
|
58
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "color", "size", "monthControls", "yearControls", "class", "b24ui"), emits);
|
|
59
|
+
const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? icons.chevronDoubleLeft : icons.chevronDoubleRight));
|
|
60
|
+
const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? icons.chevronLeft : icons.chevronRight));
|
|
61
|
+
const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? icons.chevronDoubleRight : icons.chevronDoubleLeft));
|
|
62
|
+
const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? icons.chevronRight : icons.chevronLeft));
|
|
63
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.calendar || {} })({
|
|
142
64
|
color: props.color,
|
|
143
65
|
size: props.size
|
|
144
|
-
}))
|
|
145
|
-
|
|
146
|
-
function paginateYear(date: DateValue, sign: -1 | 1) {
|
|
66
|
+
}));
|
|
67
|
+
function paginateYear(date, sign) {
|
|
147
68
|
if (sign === -1) {
|
|
148
|
-
return date.subtract({ years: 1 })
|
|
69
|
+
return date.subtract({ years: 1 });
|
|
149
70
|
}
|
|
150
|
-
|
|
151
|
-
return date.add({ years: 1 })
|
|
71
|
+
return date.add({ years: 1 });
|
|
152
72
|
}
|
|
153
|
-
|
|
154
|
-
const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
|
|
155
|
-
|
|
73
|
+
const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar);
|
|
156
74
|
const btnSize = computed(() => {
|
|
157
75
|
switch (props.size) {
|
|
158
|
-
case
|
|
159
|
-
|
|
76
|
+
case "lg":
|
|
77
|
+
return "sm";
|
|
78
|
+
default:
|
|
79
|
+
return "xs";
|
|
160
80
|
}
|
|
161
|
-
})
|
|
81
|
+
});
|
|
162
82
|
</script>
|
|
163
83
|
|
|
164
84
|
<template>
|
|
@@ -172,7 +92,7 @@ const btnSize = computed(() => {
|
|
|
172
92
|
:class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
|
|
173
93
|
>
|
|
174
94
|
<Calendar.Header :class="b24ui.header({ class: props.b24ui?.header })">
|
|
175
|
-
<Calendar.Prev v-if="props.yearControls" :prev-page="(date
|
|
95
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
176
96
|
<B24Button :icon="prevYearIcon" :size="btnSize" color="link" v-bind="props.prevYear" />
|
|
177
97
|
</Calendar.Prev>
|
|
178
98
|
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
@@ -186,7 +106,7 @@ const btnSize = computed(() => {
|
|
|
186
106
|
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
187
107
|
<B24Button :icon="nextMonthIcon" :size="btnSize" color="link" v-bind="props.nextMonth" />
|
|
188
108
|
</Calendar.Next>
|
|
189
|
-
<Calendar.Next v-if="props.yearControls" :next-page="(date
|
|
109
|
+
<Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
190
110
|
<B24Button :icon="nextYearIcon" :size="btnSize" color="link" v-bind="props.nextYear" />
|
|
191
111
|
</Calendar.Next>
|
|
192
112
|
</Calendar.Header>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootProps, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui';
|
|
2
|
+
import type { DateValue } from '@internationalized/date';
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
4
|
+
import theme from '#build/b24ui/calendar';
|
|
5
|
+
import type { IconComponent, ButtonProps } from '../types';
|
|
6
|
+
import type { ComponentConfig } from '../types/utils';
|
|
7
|
+
type Calendar = ComponentConfig<typeof theme, AppConfig, 'calendar'>;
|
|
8
|
+
type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true ? DateRange : M extends true ? DateValue[] : DateValue;
|
|
9
|
+
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true ? (DateRange | null) : M extends true ? (DateValue[] | undefined) : (DateValue | undefined);
|
|
10
|
+
type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
|
|
11
|
+
type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
|
|
12
|
+
export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends _RangeCalendarRootProps, _CalendarRootProps {
|
|
13
|
+
/**
|
|
14
|
+
* The element or component this component should render as.
|
|
15
|
+
* @defaultValue 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: any;
|
|
18
|
+
/**
|
|
19
|
+
* The icon to use for the next year control.
|
|
20
|
+
* @defaultValue icons.chevronDoubleRight
|
|
21
|
+
* @IconComponent
|
|
22
|
+
*/
|
|
23
|
+
nextYearIcon?: IconComponent;
|
|
24
|
+
/**
|
|
25
|
+
* Configure the next year button.
|
|
26
|
+
* `{ color: 'link' }`{lang="ts"}
|
|
27
|
+
*/
|
|
28
|
+
nextYear?: ButtonProps;
|
|
29
|
+
/**
|
|
30
|
+
* The icon to use for the next month control.
|
|
31
|
+
* @defaultValue icons.chevronRight
|
|
32
|
+
* @IconComponent
|
|
33
|
+
*/
|
|
34
|
+
nextMonthIcon?: IconComponent;
|
|
35
|
+
/**
|
|
36
|
+
* Configure the next month button.
|
|
37
|
+
* `{ color: 'link' }`{lang="ts"}
|
|
38
|
+
*/
|
|
39
|
+
nextMonth?: ButtonProps;
|
|
40
|
+
/**
|
|
41
|
+
* The icon to use for the previous year control.
|
|
42
|
+
* @defaultValue icons.chevronDoubleLeft
|
|
43
|
+
* @IconComponent
|
|
44
|
+
*/
|
|
45
|
+
prevYearIcon?: IconComponent;
|
|
46
|
+
/**
|
|
47
|
+
* Configure the prev year button.
|
|
48
|
+
* `{ color: 'link' }`{lang="ts"}
|
|
49
|
+
*/
|
|
50
|
+
prevYear?: ButtonProps;
|
|
51
|
+
/**
|
|
52
|
+
* The icon to use for the previous month control.
|
|
53
|
+
* @defaultValue icons.chevronLeft
|
|
54
|
+
* @IconComponent
|
|
55
|
+
*/
|
|
56
|
+
prevMonthIcon?: IconComponent;
|
|
57
|
+
/**
|
|
58
|
+
* Configure the prev month button.
|
|
59
|
+
* `{ color: 'link' }`{lang="ts"}
|
|
60
|
+
*/
|
|
61
|
+
prevMonth?: ButtonProps;
|
|
62
|
+
/**
|
|
63
|
+
* @defaultValue 'primary'
|
|
64
|
+
*/
|
|
65
|
+
color?: Calendar['variants']['color'];
|
|
66
|
+
/**
|
|
67
|
+
* @defaultValue 'md'
|
|
68
|
+
*/
|
|
69
|
+
size?: Calendar['variants']['size'];
|
|
70
|
+
/** Whether a range of dates can be selected */
|
|
71
|
+
range?: R & boolean;
|
|
72
|
+
/** Whether multiple dates can be selected */
|
|
73
|
+
multiple?: M & boolean;
|
|
74
|
+
/** Show month controls */
|
|
75
|
+
monthControls?: boolean;
|
|
76
|
+
/** Show year controls */
|
|
77
|
+
yearControls?: boolean;
|
|
78
|
+
defaultValue?: CalendarDefaultValue<R, M>;
|
|
79
|
+
modelValue?: CalendarModelValue<R, M>;
|
|
80
|
+
class?: any;
|
|
81
|
+
b24ui?: Calendar['slots'];
|
|
82
|
+
}
|
|
83
|
+
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
84
|
+
'update:modelValue': [date: CalendarModelValue<R, M>];
|
|
85
|
+
}
|
|
86
|
+
export interface CalendarSlots {
|
|
87
|
+
'heading': (props: {
|
|
88
|
+
value: string;
|
|
89
|
+
}) => any;
|
|
90
|
+
'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any;
|
|
91
|
+
'week-day': (props: {
|
|
92
|
+
day: string;
|
|
93
|
+
}) => any;
|
|
94
|
+
}
|
|
95
|
+
declare const _default: <R extends boolean, M extends boolean>(__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<{
|
|
96
|
+
props: __VLS_PrettifyLocal<any & CalendarProps<R, M> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
97
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
98
|
+
attrs: any;
|
|
99
|
+
slots: Readonly<CalendarSlots> & CalendarSlots;
|
|
100
|
+
emit: ((evt: "update:modelValue", date: CalendarModelValue<R, M>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void);
|
|
101
|
+
}>) => import("vue").VNode & {
|
|
102
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
103
|
+
};
|
|
104
|
+
export default _default;
|
|
105
|
+
type __VLS_PrettifyLocal<T> = {
|
|
106
|
+
[K in keyof T]: T[K];
|
|
107
|
+
} & {};
|
|
@@ -1,86 +1,54 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
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
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/checkbox";
|
|
43
3
|
</script>
|
|
44
4
|
|
|
45
|
-
<script setup
|
|
46
|
-
import { computed, useId } from
|
|
47
|
-
import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from
|
|
48
|
-
import { reactivePick } from
|
|
49
|
-
import {
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const props = defineProps
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, useId } from "vue";
|
|
7
|
+
import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } 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 Minus20Icon from "@bitrix24/b24icons-vue/actions/Minus20Icon";
|
|
13
|
+
import CheckIcon from "@bitrix24/b24icons-vue/main/CheckIcon";
|
|
14
|
+
defineOptions({ inheritAttrs: false });
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
as: { type: null, required: false },
|
|
17
|
+
label: { type: String, required: false },
|
|
18
|
+
description: { type: String, required: false },
|
|
19
|
+
color: { type: null, required: false },
|
|
20
|
+
size: { type: null, required: false },
|
|
21
|
+
class: { type: null, required: false },
|
|
22
|
+
b24ui: { type: null, required: false },
|
|
23
|
+
disabled: { type: Boolean, required: false },
|
|
24
|
+
required: { type: Boolean, required: false },
|
|
25
|
+
name: { type: String, required: false },
|
|
26
|
+
value: { type: [String, Number, Object, null], required: false },
|
|
27
|
+
id: { type: String, required: false },
|
|
28
|
+
defaultValue: { type: [Boolean, String], required: false }
|
|
29
|
+
});
|
|
30
|
+
const slots = defineSlots();
|
|
31
|
+
const emits = defineEmits(["change"]);
|
|
32
|
+
const modelValue = defineModel({ type: [Boolean, String], ...{ default: void 0 } });
|
|
33
|
+
const appConfig = useAppConfig();
|
|
34
|
+
const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
|
|
35
|
+
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
|
|
36
|
+
const id = _id.value ?? useId();
|
|
37
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.checkbox || {} })({
|
|
67
38
|
size: size.value,
|
|
68
39
|
color: color.value,
|
|
69
40
|
required: props.required,
|
|
70
41
|
disabled: disabled.value,
|
|
71
42
|
checked: Boolean(modelValue.value ?? props.defaultValue)
|
|
72
|
-
}))
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
emitFormChange()
|
|
79
|
-
emitFormInput()
|
|
43
|
+
}));
|
|
44
|
+
function onUpdate(value) {
|
|
45
|
+
const event = new Event("change", { target: { value } });
|
|
46
|
+
emits("change", event);
|
|
47
|
+
emitFormChange();
|
|
48
|
+
emitFormInput();
|
|
80
49
|
}
|
|
81
50
|
</script>
|
|
82
51
|
|
|
83
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
84
52
|
<template>
|
|
85
53
|
<Primitive :as="as" :class="b24ui.root({ class: [props.class, props.b24ui?.root] })">
|
|
86
54
|
<div :class="b24ui.container({ class: props.b24ui?.container })">
|
|
@@ -102,7 +70,7 @@ function onUpdate(value: any) {
|
|
|
102
70
|
</CheckboxRoot>
|
|
103
71
|
</div>
|
|
104
72
|
|
|
105
|
-
<div v-if="
|
|
73
|
+
<div v-if="label || !!slots.label || (description || !!slots.description)" :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
106
74
|
<Label v-if="label || !!slots.label" :for="id" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
107
75
|
<slot name="label" :label="label">
|
|
108
76
|
{{ label }}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CheckboxRootProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/b24ui/checkbox';
|
|
4
|
+
import type { ComponentConfig } from '../types/utils';
|
|
5
|
+
type Checkbox = ComponentConfig<typeof theme, AppConfig, 'checkbox'>;
|
|
6
|
+
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
|
|
7
|
+
/**
|
|
8
|
+
* The element or component this component should render as.
|
|
9
|
+
* @defaultValue 'div'
|
|
10
|
+
*/
|
|
11
|
+
as?: any;
|
|
12
|
+
label?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @defaultValue 'primary'
|
|
16
|
+
*/
|
|
17
|
+
color?: Checkbox['variants']['color'];
|
|
18
|
+
/**
|
|
19
|
+
* @defaultValue 'md'
|
|
20
|
+
*/
|
|
21
|
+
size?: Checkbox['variants']['size'];
|
|
22
|
+
class?: any;
|
|
23
|
+
b24ui?: Checkbox['slots'];
|
|
24
|
+
}
|
|
25
|
+
export type CheckboxEmits = {
|
|
26
|
+
change: [payload: Event];
|
|
27
|
+
};
|
|
28
|
+
export interface CheckboxSlots {
|
|
29
|
+
label(props: {
|
|
30
|
+
label?: string;
|
|
31
|
+
}): any;
|
|
32
|
+
description(props: {
|
|
33
|
+
description?: string;
|
|
34
|
+
}): any;
|
|
35
|
+
}
|
|
36
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
37
|
+
modelValue?: boolean | "indeterminate";
|
|
38
|
+
} & CheckboxProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
39
|
+
modelValue?: boolean | "indeterminate";
|
|
40
|
+
} & CheckboxProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<CheckboxSlots> & CheckboxSlots>;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
43
|
+
type __VLS_TypePropsToOption<T> = {
|
|
44
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
45
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
46
|
+
} : {
|
|
47
|
+
type: import('vue').PropType<T[K]>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -1,85 +1,36 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
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
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/chip";
|
|
57
3
|
</script>
|
|
58
4
|
|
|
59
|
-
<script setup
|
|
60
|
-
import { computed } from
|
|
61
|
-
import { Primitive, Slot } from
|
|
62
|
-
import {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const props =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { Primitive, Slot } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import { useAvatarGroup } from "../composables/useAvatarGroup";
|
|
10
|
+
import { tv } from "../utils/tv";
|
|
11
|
+
defineOptions({ inheritAttrs: false });
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
text: { type: [String, Number], required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
size: { type: null, required: false },
|
|
17
|
+
position: { type: null, required: false },
|
|
18
|
+
inset: { type: Boolean, required: false, default: false },
|
|
19
|
+
standalone: { type: Boolean, required: false, default: false },
|
|
20
|
+
class: { type: null, required: false },
|
|
21
|
+
b24ui: { type: null, required: false }
|
|
22
|
+
});
|
|
23
|
+
defineSlots();
|
|
24
|
+
const show = defineModel("show", { type: Boolean, ...{ default: true } });
|
|
25
|
+
const { size } = useAvatarGroup(props);
|
|
26
|
+
const appConfig = useAppConfig();
|
|
27
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.chip || {} })({
|
|
77
28
|
color: props.color,
|
|
78
29
|
size: size.value,
|
|
79
30
|
position: props.position,
|
|
80
31
|
inset: Boolean(props.inset),
|
|
81
32
|
standalone: Boolean(props.standalone)
|
|
82
|
-
}))
|
|
33
|
+
}));
|
|
83
34
|
</script>
|
|
84
35
|
|
|
85
36
|
<template>
|