@expcat/tigercat-vue 2.0.19 → 2.1.0
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/README.md +20 -10
- package/dist/chunk-26QCTL2E.mjs +180 -0
- package/dist/{chunk-GS4SV2HK.mjs → chunk-32X54QKW.mjs} +1 -1
- package/dist/chunk-3ONCXHE5.mjs +184 -0
- package/dist/{chunk-KOG3HKOF.mjs → chunk-6AMWX5K4.mjs} +1 -4
- package/dist/chunk-6GR3XC5V.mjs +281 -0
- package/dist/chunk-6GR5U4UB.mjs +225 -0
- package/dist/chunk-7DWWNFRP.mjs +302 -0
- package/dist/chunk-AECXFT7D.mjs +121 -0
- package/dist/chunk-AOLRZG4E.mjs +347 -0
- package/dist/chunk-AY7CGLMO.mjs +368 -0
- package/dist/chunk-BBNCP55O.mjs +156 -0
- package/dist/chunk-F3ZVVVYD.mjs +257 -0
- package/dist/{chunk-OTGGPXDT.mjs → chunk-IEAEB4TX.mjs} +255 -44
- package/dist/chunk-P6FMU4AT.mjs +54 -0
- package/dist/chunk-PFIV5MXD.mjs +48 -0
- package/dist/chunk-TBOXTAIA.mjs +94 -0
- package/dist/{chunk-EDBMWZKH.mjs → chunk-TPESRDUG.mjs} +5 -1
- package/dist/{chunk-2XCXK3NQ.mjs → chunk-U4B5QT72.mjs} +1 -1
- package/dist/chunk-UUWPSRNV.mjs +337 -0
- package/dist/chunk-UXJRH72H.mjs +834 -0
- package/dist/chunk-VFS5XAZ3.mjs +602 -0
- package/dist/{chunk-WC5MKASU.mjs → chunk-VN2TWPRC.mjs} +169 -55
- package/dist/components/ActivityFeed.d.mts +3 -3
- package/dist/components/ActivityFeed.mjs +1 -1
- package/dist/components/Affix.d.mts +4 -4
- package/dist/components/Alert.d.mts +4 -4
- package/dist/components/Anchor.d.mts +3 -3
- package/dist/components/AreaChart.mjs +2 -2
- package/dist/components/AspectRatio.d.mts +44 -0
- package/dist/components/AspectRatio.mjs +8 -0
- package/dist/components/AutoComplete.d.mts +2 -2
- package/dist/components/Avatar.d.mts +1 -1
- package/dist/components/AvatarGroup.d.mts +1 -1
- package/dist/components/BackTop.d.mts +1 -1
- package/dist/components/Badge.d.mts +2 -2
- package/dist/components/BarChart.mjs +2 -2
- package/dist/components/Breadcrumb.d.mts +2 -2
- package/dist/components/Button.d.mts +2 -2
- package/dist/components/ButtonGroup.d.mts +1 -1
- package/dist/components/Calendar.d.mts +1 -1
- package/dist/components/Card.d.mts +2 -2
- package/dist/components/Carousel.d.mts +3 -3
- package/dist/components/Cascader.d.mts +34 -0
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartLegend.d.mts +1 -1
- package/dist/components/ChartTooltip.d.mts +1 -1
- package/dist/components/ChatWindow.d.mts +1 -1
- package/dist/components/ChatWindow.mjs +1 -1
- package/dist/components/CodeEditor.d.mts +3 -3
- package/dist/components/CodeEditor.mjs +1 -1
- package/dist/components/CollapsePanel.d.mts +1 -1
- package/dist/components/ColorSwatch.d.mts +1 -1
- package/dist/components/CommentThread.d.mts +1 -1
- package/dist/components/ContextMenu.d.mts +234 -0
- package/dist/components/ContextMenu.mjs +17 -0
- package/dist/components/Countdown.d.mts +3 -3
- package/dist/components/CropUpload.d.mts +1 -1
- package/dist/components/DataExport.d.mts +1 -1
- package/dist/components/DataTableWithToolbar.d.mts +4 -4
- package/dist/components/DataTableWithToolbar.mjs +2 -2
- package/dist/components/DatePicker.d.mts +3 -3
- package/dist/components/Descriptions.d.mts +1 -1
- package/dist/components/DonutChart.mjs +3 -3
- package/dist/components/Drawer.d.mts +5 -5
- package/dist/components/Dropdown.d.mts +1 -1
- package/dist/components/Empty.d.mts +1 -1
- package/dist/components/FileManager.d.mts +1 -1
- package/dist/components/FloatButton.d.mts +4 -4
- package/dist/components/FormWizard.d.mts +2 -2
- package/dist/components/FunnelChart.d.mts +2 -2
- package/dist/components/FunnelChart.mjs +2 -2
- package/dist/components/Gantt.d.mts +1 -1
- package/dist/components/GaugeChart.d.mts +2 -2
- package/dist/components/Header.d.mts +1 -1
- package/dist/components/HeatmapChart.d.mts +1 -1
- package/dist/components/Highlight.d.mts +146 -0
- package/dist/components/Highlight.mjs +8 -0
- package/dist/components/Icon.d.mts +1 -1
- package/dist/components/ImageAnnotation.d.mts +3 -3
- package/dist/components/ImageCompare.d.mts +284 -0
- package/dist/components/ImageCompare.mjs +8 -0
- package/dist/components/ImageCropper.d.mts +1 -1
- package/dist/components/ImagePreview.d.mts +1 -1
- package/dist/components/ImageViewer.d.mts +1 -1
- package/dist/components/InfiniteScroll.d.mts +1 -1
- package/dist/components/Input.d.mts +4 -4
- package/dist/components/InputGroup.d.mts +1 -1
- package/dist/components/InputNumber.d.mts +3 -3
- package/dist/components/InputOTP.d.mts +261 -0
- package/dist/components/InputOTP.mjs +11 -0
- package/dist/components/Kanban.d.mts +1 -1
- package/dist/components/Kbd.d.mts +118 -0
- package/dist/components/Kbd.mjs +8 -0
- package/dist/components/LineChart.mjs +2 -2
- package/dist/components/List.d.mts +3 -3
- package/dist/components/List.mjs +1 -1
- package/dist/components/Loading.d.mts +2 -2
- package/dist/components/LoadingBar.d.mts +8 -0
- package/dist/components/LoadingBar.mjs +114 -0
- package/dist/components/LoadingBarContainer.d.mts +78 -0
- package/dist/components/LoadingBarContainer.mjs +8 -0
- package/dist/components/LoadingBarRoot.d.mts +6 -0
- package/dist/components/LoadingBarRoot.mjs +6 -0
- package/dist/components/MarkdownEditor.d.mts +5 -5
- package/dist/components/Marquee.d.mts +158 -0
- package/dist/components/Marquee.mjs +8 -0
- package/dist/components/MaskInput.d.mts +201 -0
- package/dist/components/MaskInput.mjs +11 -0
- package/dist/components/Masonry.d.mts +66 -0
- package/dist/components/Masonry.mjs +8 -0
- package/dist/components/Mentions.d.mts +2 -2
- package/dist/components/Menu.d.mts +5 -5
- package/dist/components/Modal.d.mts +7 -7
- package/dist/components/NavigationMenu.d.mts +411 -0
- package/dist/components/NavigationMenu.mjs +25 -0
- package/dist/components/NotificationCenter.d.mts +3 -3
- package/dist/components/NotificationCenter.mjs +2 -2
- package/dist/components/NumberKeyboard.d.mts +3 -3
- package/dist/components/OrgChart.d.mts +2 -2
- package/dist/components/PageHeader.d.mts +140 -0
- package/dist/components/PageHeader.mjs +11 -0
- package/dist/components/Pagination.d.mts +2 -2
- package/dist/components/PieChart.mjs +2 -2
- package/dist/components/Popconfirm.d.mts +5 -5
- package/dist/components/Popover.d.mts +5 -5
- package/dist/components/Progress.d.mts +6 -6
- package/dist/components/QRCode.d.mts +1 -1
- package/dist/components/RadarChart.mjs +2 -2
- package/dist/components/Result.d.mts +1 -1
- package/dist/components/RichTextEditor.d.mts +4 -4
- package/dist/components/ScatterChart.d.mts +2 -2
- package/dist/components/ScatterChart.mjs +2 -2
- package/dist/components/ScrollArea.d.mts +136 -0
- package/dist/components/ScrollArea.mjs +8 -0
- package/dist/components/ScrollSpy.d.mts +3 -3
- package/dist/components/Segmented.d.mts +2 -2
- package/dist/components/Signature.d.mts +5 -5
- package/dist/components/Skeleton.d.mts +1 -1
- package/dist/components/Slider.d.mts +1 -1
- package/dist/components/SplitButton.d.mts +286 -0
- package/dist/components/SplitButton.mjs +12 -0
- package/dist/components/Splitter.d.mts +1 -1
- package/dist/components/Spotlight.d.mts +5 -5
- package/dist/components/Statistic.d.mts +1 -1
- package/dist/components/Steps.d.mts +3 -3
- package/dist/components/SunburstChart.mjs +2 -2
- package/dist/components/Tabs.d.mts +3 -3
- package/dist/components/Tag.d.mts +2 -2
- package/dist/components/TagsInput.d.mts +214 -0
- package/dist/components/TagsInput.mjs +12 -0
- package/dist/components/TaskBoard.d.mts +2 -2
- package/dist/components/Textarea.d.mts +1 -1
- package/dist/components/TimePicker.d.mts +3 -3
- package/dist/components/Timeline.d.mts +4 -4
- package/dist/components/Tooltip.d.mts +2 -2
- package/dist/components/Tour.d.mts +4 -4
- package/dist/components/Tree.d.mts +3 -3
- package/dist/components/TreeMapChart.d.mts +1 -1
- package/dist/components/TreeMapChart.mjs +2 -2
- package/dist/components/TreeSelect.d.mts +51 -0
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.d.mts +5 -5
- package/dist/components/VirtualTable.d.mts +3 -3
- package/dist/components/Watermark.d.mts +5 -5
- package/dist/index.d.mts +17 -1
- package/dist/index.mjs +355 -0
- package/package.json +117 -2
- package/dist/{chunk-MAKOSWR6.mjs → chunk-37W7XTA6.mjs} +3 -3
- package/dist/{chunk-WUQMFKQ6.mjs → chunk-66OS5A4D.mjs} +3 -3
- package/dist/{chunk-NNC75I7F.mjs → chunk-CHEXI7MO.mjs} +3 -3
- package/dist/{chunk-KFJIZED5.mjs → chunk-EHGFW5GX.mjs} +3 -3
- package/dist/{chunk-ZGA66PSG.mjs → chunk-EZYOCPMM.mjs} +3 -3
- package/dist/{chunk-XGXZF27U.mjs → chunk-JHMT5Q6P.mjs} +3 -3
- package/dist/{chunk-NGAA73CV.mjs → chunk-VLW3UBIR.mjs} +3 -3
- package/dist/{chunk-OTHJIFDV.mjs → chunk-W5XFWVNV.mjs} +3 -3
- package/dist/{chunk-3KITFMBJ.mjs → chunk-ZOYHZF4N.mjs} +3 -3
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dropdown,
|
|
3
|
+
DropdownItem,
|
|
4
|
+
DropdownMenu
|
|
5
|
+
} from "./chunk-KROVW4AW.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Button
|
|
8
|
+
} from "./chunk-YZBQ6IR7.mjs";
|
|
9
|
+
import {
|
|
10
|
+
ButtonGroup
|
|
11
|
+
} from "./chunk-Z2ZECCGD.mjs";
|
|
12
|
+
|
|
13
|
+
// src/components/SplitButton.ts
|
|
14
|
+
import { Comment, Fragment, defineComponent, h } from "vue";
|
|
15
|
+
import {
|
|
16
|
+
DROPDOWN_CHEVRON_PATH,
|
|
17
|
+
composeComponentClasses,
|
|
18
|
+
getDropdownChevronClasses,
|
|
19
|
+
getSplitButtonPrimaryClasses,
|
|
20
|
+
getSplitButtonRootClasses,
|
|
21
|
+
getSplitButtonTriggerClasses,
|
|
22
|
+
mergeStyleValues,
|
|
23
|
+
resolveSplitButtonSize,
|
|
24
|
+
resolveSplitButtonTriggerAriaLabel,
|
|
25
|
+
resolveSplitButtonVariant
|
|
26
|
+
} from "@expcat/tigercat-core";
|
|
27
|
+
function flattenVNodes(nodes) {
|
|
28
|
+
const out = [];
|
|
29
|
+
for (const node of nodes ?? []) {
|
|
30
|
+
if (!node || node.type === Comment) continue;
|
|
31
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
32
|
+
out.push(...flattenVNodes(node.children));
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
out.push(node);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
function wrapMenu(nodes) {
|
|
40
|
+
const flattened = flattenVNodes(nodes);
|
|
41
|
+
if (flattened.length === 0) return null;
|
|
42
|
+
const existing = flattened.find((node) => node.type === DropdownMenu);
|
|
43
|
+
if (existing) return existing;
|
|
44
|
+
return h(DropdownMenu, null, { default: () => flattened });
|
|
45
|
+
}
|
|
46
|
+
function partitionDefaultSlot(nodes) {
|
|
47
|
+
const primary = [];
|
|
48
|
+
const menuItems = [];
|
|
49
|
+
let menu = null;
|
|
50
|
+
for (const node of flattenVNodes(nodes)) {
|
|
51
|
+
if (node.type === DropdownMenu) {
|
|
52
|
+
menu = node;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (node.type === DropdownItem) {
|
|
56
|
+
menuItems.push(node);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
primary.push(node);
|
|
60
|
+
}
|
|
61
|
+
if (!menu && menuItems.length > 0) {
|
|
62
|
+
menu = h(DropdownMenu, null, { default: () => menuItems });
|
|
63
|
+
}
|
|
64
|
+
return { primary, menu };
|
|
65
|
+
}
|
|
66
|
+
function createChevron(open) {
|
|
67
|
+
return h(
|
|
68
|
+
"svg",
|
|
69
|
+
{
|
|
70
|
+
class: getDropdownChevronClasses(open),
|
|
71
|
+
viewBox: "0 0 24 24",
|
|
72
|
+
fill: "none",
|
|
73
|
+
stroke: "currentColor",
|
|
74
|
+
"stroke-width": "2",
|
|
75
|
+
"stroke-linecap": "round",
|
|
76
|
+
"stroke-linejoin": "round",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
focusable: "false"
|
|
79
|
+
},
|
|
80
|
+
[h("path", { d: DROPDOWN_CHEVRON_PATH })]
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
var SplitButton = defineComponent({
|
|
84
|
+
name: "TigerSplitButton",
|
|
85
|
+
inheritAttrs: false,
|
|
86
|
+
props: {
|
|
87
|
+
/**
|
|
88
|
+
* Visual variant applied to the primary action and the menu trigger
|
|
89
|
+
* @default 'primary'
|
|
90
|
+
*/
|
|
91
|
+
variant: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: "primary"
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Size applied to the primary action and the menu trigger
|
|
97
|
+
* @default 'md'
|
|
98
|
+
*/
|
|
99
|
+
size: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: "md"
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Whether both the primary action and the menu trigger are disabled
|
|
105
|
+
*/
|
|
106
|
+
disabled: Boolean,
|
|
107
|
+
/**
|
|
108
|
+
* Whether the primary action is in a loading state. Also disables the menu trigger.
|
|
109
|
+
*/
|
|
110
|
+
loading: Boolean,
|
|
111
|
+
/**
|
|
112
|
+
* Whether to apply danger/destructive styling to both buttons
|
|
113
|
+
*/
|
|
114
|
+
danger: Boolean,
|
|
115
|
+
/**
|
|
116
|
+
* Whether the split control should take the full width of its parent
|
|
117
|
+
*/
|
|
118
|
+
block: Boolean,
|
|
119
|
+
/**
|
|
120
|
+
* HTML button type for the primary action
|
|
121
|
+
* @default 'button'
|
|
122
|
+
*/
|
|
123
|
+
htmlType: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "button"
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Position of the icon relative to the primary action text
|
|
129
|
+
* @default 'left'
|
|
130
|
+
*/
|
|
131
|
+
iconPosition: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "left"
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Whether the menu is open (controlled mode)
|
|
137
|
+
*/
|
|
138
|
+
open: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: void 0
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Default open state (uncontrolled mode)
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
146
|
+
defaultOpen: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Whether to close the menu when a menu item is clicked
|
|
152
|
+
* @default true
|
|
153
|
+
*/
|
|
154
|
+
closeOnClick: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
default: true
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Render the menu into document.body (Teleport)
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
portal: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: true
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Accessible name for the chevron menu trigger
|
|
168
|
+
* @default 'More options'
|
|
169
|
+
*/
|
|
170
|
+
triggerAriaLabel: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: void 0
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Dropdown placement relative to the chevron trigger
|
|
176
|
+
* @default 'bottom-end'
|
|
177
|
+
*/
|
|
178
|
+
placement: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: "bottom-end"
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Offset distance from the chevron trigger
|
|
184
|
+
* @default 4
|
|
185
|
+
*/
|
|
186
|
+
offset: {
|
|
187
|
+
type: Number,
|
|
188
|
+
default: 4
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* Additional CSS classes
|
|
192
|
+
*/
|
|
193
|
+
className: {
|
|
194
|
+
type: String,
|
|
195
|
+
default: void 0
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Inline styles
|
|
199
|
+
*/
|
|
200
|
+
style: {
|
|
201
|
+
type: Object,
|
|
202
|
+
default: void 0
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
emits: ["click", "update:open", "open-change"],
|
|
206
|
+
setup(props, { slots, emit, attrs }) {
|
|
207
|
+
return () => {
|
|
208
|
+
const attrsRecord = attrs;
|
|
209
|
+
const {
|
|
210
|
+
class: _class,
|
|
211
|
+
style: _style,
|
|
212
|
+
...restAttrs
|
|
213
|
+
} = attrsRecord;
|
|
214
|
+
const variant = resolveSplitButtonVariant(props.variant);
|
|
215
|
+
const size = resolveSplitButtonSize(props.size);
|
|
216
|
+
const isDisabled = props.disabled || props.loading;
|
|
217
|
+
const triggerLabel = resolveSplitButtonTriggerAriaLabel(props.triggerAriaLabel);
|
|
218
|
+
const partitioned = partitionDefaultSlot(slots.default?.());
|
|
219
|
+
const menuNode = wrapMenu(slots.menu?.()) ?? partitioned.menu;
|
|
220
|
+
const primaryButton = h(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
variant,
|
|
224
|
+
size,
|
|
225
|
+
disabled: props.disabled,
|
|
226
|
+
loading: props.loading,
|
|
227
|
+
danger: props.danger,
|
|
228
|
+
htmlType: props.htmlType,
|
|
229
|
+
iconPosition: props.iconPosition,
|
|
230
|
+
className: getSplitButtonPrimaryClasses({ block: props.block }),
|
|
231
|
+
"data-split-button-primary": "",
|
|
232
|
+
onClick: (event) => emit("click", event)
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
default: () => partitioned.primary,
|
|
236
|
+
icon: slots.icon,
|
|
237
|
+
"loading-icon": slots["loading-icon"]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
const dropdown = h(
|
|
241
|
+
Dropdown,
|
|
242
|
+
{
|
|
243
|
+
trigger: "click",
|
|
244
|
+
showArrow: false,
|
|
245
|
+
disabled: isDisabled,
|
|
246
|
+
open: props.open,
|
|
247
|
+
defaultOpen: props.defaultOpen,
|
|
248
|
+
closeOnClick: props.closeOnClick,
|
|
249
|
+
portal: props.portal,
|
|
250
|
+
placement: props.placement,
|
|
251
|
+
offset: props.offset,
|
|
252
|
+
"onUpdate:open": (visible) => emit("update:open", visible),
|
|
253
|
+
onOpenChange: (visible) => emit("open-change", visible)
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
trigger: ({ open }) => h(
|
|
257
|
+
Button,
|
|
258
|
+
{
|
|
259
|
+
variant,
|
|
260
|
+
size,
|
|
261
|
+
disabled: isDisabled,
|
|
262
|
+
danger: props.danger,
|
|
263
|
+
htmlType: "button",
|
|
264
|
+
className: getSplitButtonTriggerClasses({ size }),
|
|
265
|
+
"aria-label": triggerLabel,
|
|
266
|
+
"aria-haspopup": "menu",
|
|
267
|
+
"aria-expanded": open,
|
|
268
|
+
"data-split-button-trigger": ""
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
default: () => slots.trigger?.({ open }) ?? createChevron(open)
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
default: () => menuNode
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
return h(
|
|
278
|
+
ButtonGroup,
|
|
279
|
+
{
|
|
280
|
+
...restAttrs,
|
|
281
|
+
size,
|
|
282
|
+
className: composeComponentClasses(
|
|
283
|
+
getSplitButtonRootClasses({
|
|
284
|
+
block: props.block,
|
|
285
|
+
className: props.className
|
|
286
|
+
}),
|
|
287
|
+
attrsRecord.class
|
|
288
|
+
),
|
|
289
|
+
style: mergeStyleValues(attrsRecord.style, props.style),
|
|
290
|
+
"data-split-button": ""
|
|
291
|
+
},
|
|
292
|
+
{ default: () => [primaryButton, dropdown] }
|
|
293
|
+
);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
var SplitButton_default = SplitButton;
|
|
298
|
+
|
|
299
|
+
export {
|
|
300
|
+
SplitButton,
|
|
301
|
+
SplitButton_default
|
|
302
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// src/components/Kbd.ts
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
composeComponentClasses,
|
|
5
|
+
formatKbdSeparatorText,
|
|
6
|
+
getKbdParts,
|
|
7
|
+
getKbdRootClasses,
|
|
8
|
+
kbdKeyClasses,
|
|
9
|
+
kbdSeparatorClasses,
|
|
10
|
+
mergeStyleValues
|
|
11
|
+
} from "@expcat/tigercat-core";
|
|
12
|
+
function hasSlotContent(nodes) {
|
|
13
|
+
return Array.isArray(nodes) && nodes.length > 0;
|
|
14
|
+
}
|
|
15
|
+
var Kbd = defineComponent({
|
|
16
|
+
name: "TigerKbd",
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* One key or a combo list. A string is a single key; an array is joined
|
|
21
|
+
* with `separator`. Combine with the default slot to append a final key.
|
|
22
|
+
*/
|
|
23
|
+
keys: {
|
|
24
|
+
type: [String, Array],
|
|
25
|
+
default: void 0
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Separator between combo keys
|
|
29
|
+
* @default '+'
|
|
30
|
+
*/
|
|
31
|
+
separator: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Visual size
|
|
37
|
+
* @default 'md'
|
|
38
|
+
*/
|
|
39
|
+
size: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "md"
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Visual variant. `default` reuses Tag default chrome; `subtle` is quieter.
|
|
45
|
+
* @default 'default'
|
|
46
|
+
*/
|
|
47
|
+
variant: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "default"
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Additional CSS classes
|
|
53
|
+
*/
|
|
54
|
+
className: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: void 0
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Inline styles
|
|
60
|
+
*/
|
|
61
|
+
style: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: void 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
setup(props, { slots, attrs }) {
|
|
67
|
+
return () => {
|
|
68
|
+
const attrsRecord = attrs;
|
|
69
|
+
const parts = getKbdParts(props.keys, props.separator);
|
|
70
|
+
const slotNodes = slots.default?.();
|
|
71
|
+
const hasSlot = hasSlotContent(slotNodes);
|
|
72
|
+
const children = [];
|
|
73
|
+
for (const part of parts) {
|
|
74
|
+
if (part.type === "separator") {
|
|
75
|
+
children.push(
|
|
76
|
+
h("span", { class: kbdSeparatorClasses, "data-kbd-separator": "" }, ` ${part.value} `)
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
children.push(h("kbd", { class: kbdKeyClasses, "data-kbd-key": "" }, part.value));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (hasSlot && slotNodes) {
|
|
83
|
+
if (parts.length > 0) {
|
|
84
|
+
children.push(
|
|
85
|
+
h(
|
|
86
|
+
"span",
|
|
87
|
+
{ class: kbdSeparatorClasses, "data-kbd-separator": "" },
|
|
88
|
+
formatKbdSeparatorText(props.separator)
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
children.push(...slotNodes);
|
|
93
|
+
}
|
|
94
|
+
return h(
|
|
95
|
+
"kbd",
|
|
96
|
+
{
|
|
97
|
+
...attrs,
|
|
98
|
+
class: composeComponentClasses(
|
|
99
|
+
getKbdRootClasses({
|
|
100
|
+
size: props.size,
|
|
101
|
+
variant: props.variant,
|
|
102
|
+
className: props.className
|
|
103
|
+
}),
|
|
104
|
+
attrsRecord.class
|
|
105
|
+
),
|
|
106
|
+
style: mergeStyleValues(attrsRecord.style, props.style),
|
|
107
|
+
"data-kbd": "",
|
|
108
|
+
"data-kbd-size": props.size,
|
|
109
|
+
"data-kbd-variant": props.variant
|
|
110
|
+
},
|
|
111
|
+
children
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var Kbd_default = Kbd;
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
Kbd,
|
|
120
|
+
Kbd_default
|
|
121
|
+
};
|