@expcat/tigercat-vue 2.0.4 → 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.
Files changed (114) hide show
  1. package/README.md +20 -10
  2. package/dist/chunk-26QCTL2E.mjs +180 -0
  3. package/dist/{chunk-GS4SV2HK.mjs → chunk-32X54QKW.mjs} +1 -1
  4. package/dist/chunk-3ONCXHE5.mjs +184 -0
  5. package/dist/{chunk-KOG3HKOF.mjs → chunk-6AMWX5K4.mjs} +1 -4
  6. package/dist/chunk-6GR3XC5V.mjs +281 -0
  7. package/dist/chunk-6GR5U4UB.mjs +225 -0
  8. package/dist/chunk-7DWWNFRP.mjs +302 -0
  9. package/dist/chunk-AECXFT7D.mjs +121 -0
  10. package/dist/chunk-AOLRZG4E.mjs +347 -0
  11. package/dist/chunk-AY7CGLMO.mjs +368 -0
  12. package/dist/chunk-BBNCP55O.mjs +156 -0
  13. package/dist/chunk-F3ZVVVYD.mjs +257 -0
  14. package/dist/{chunk-OTGGPXDT.mjs → chunk-IEAEB4TX.mjs} +255 -44
  15. package/dist/chunk-P6FMU4AT.mjs +54 -0
  16. package/dist/chunk-PFIV5MXD.mjs +48 -0
  17. package/dist/chunk-TBOXTAIA.mjs +94 -0
  18. package/dist/{chunk-H6FZBFRT.mjs → chunk-TPESRDUG.mjs} +6 -1
  19. package/dist/{chunk-2XCXK3NQ.mjs → chunk-U4B5QT72.mjs} +1 -1
  20. package/dist/chunk-UUWPSRNV.mjs +337 -0
  21. package/dist/chunk-UXJRH72H.mjs +834 -0
  22. package/dist/chunk-VFS5XAZ3.mjs +602 -0
  23. package/dist/{chunk-WC5MKASU.mjs → chunk-VN2TWPRC.mjs} +169 -55
  24. package/dist/components/ActivityFeed.d.mts +1 -1
  25. package/dist/components/ActivityFeed.mjs +1 -1
  26. package/dist/components/Alert.d.mts +2 -2
  27. package/dist/components/AreaChart.mjs +2 -2
  28. package/dist/components/AspectRatio.d.mts +44 -0
  29. package/dist/components/AspectRatio.mjs +8 -0
  30. package/dist/components/BarChart.mjs +2 -2
  31. package/dist/components/Carousel.d.mts +1 -1
  32. package/dist/components/Cascader.d.mts +34 -0
  33. package/dist/components/Cascader.mjs +1 -1
  34. package/dist/components/ChartLegend.d.mts +1 -1
  35. package/dist/components/ChatWindow.mjs +1 -1
  36. package/dist/components/CodeEditor.mjs +1 -1
  37. package/dist/components/ColorSwatch.d.mts +1 -1
  38. package/dist/components/ContextMenu.d.mts +234 -0
  39. package/dist/components/ContextMenu.mjs +17 -0
  40. package/dist/components/DataTableWithToolbar.d.mts +1 -1
  41. package/dist/components/DataTableWithToolbar.mjs +2 -2
  42. package/dist/components/DonutChart.mjs +3 -3
  43. package/dist/components/Dropdown.d.mts +1 -1
  44. package/dist/components/FloatButton.d.mts +2 -2
  45. package/dist/components/FunnelChart.d.mts +1 -1
  46. package/dist/components/FunnelChart.mjs +2 -2
  47. package/dist/components/Highlight.d.mts +146 -0
  48. package/dist/components/Highlight.mjs +8 -0
  49. package/dist/components/ImageCompare.d.mts +284 -0
  50. package/dist/components/ImageCompare.mjs +8 -0
  51. package/dist/components/Input.d.mts +1 -1
  52. package/dist/components/InputOTP.d.mts +261 -0
  53. package/dist/components/InputOTP.mjs +11 -0
  54. package/dist/components/Kbd.d.mts +118 -0
  55. package/dist/components/Kbd.mjs +8 -0
  56. package/dist/components/LineChart.mjs +2 -2
  57. package/dist/components/List.d.mts +1 -1
  58. package/dist/components/List.mjs +1 -1
  59. package/dist/components/LoadingBar.d.mts +8 -0
  60. package/dist/components/LoadingBar.mjs +114 -0
  61. package/dist/components/LoadingBarContainer.d.mts +78 -0
  62. package/dist/components/LoadingBarContainer.mjs +8 -0
  63. package/dist/components/LoadingBarRoot.d.mts +6 -0
  64. package/dist/components/LoadingBarRoot.mjs +6 -0
  65. package/dist/components/Marquee.d.mts +158 -0
  66. package/dist/components/Marquee.mjs +8 -0
  67. package/dist/components/MaskInput.d.mts +201 -0
  68. package/dist/components/MaskInput.mjs +11 -0
  69. package/dist/components/Masonry.d.mts +66 -0
  70. package/dist/components/Masonry.mjs +8 -0
  71. package/dist/components/Menu.d.mts +2 -2
  72. package/dist/components/Modal.d.mts +1 -1
  73. package/dist/components/NavigationMenu.d.mts +411 -0
  74. package/dist/components/NavigationMenu.mjs +25 -0
  75. package/dist/components/NotificationCenter.d.mts +1 -1
  76. package/dist/components/NotificationCenter.mjs +2 -2
  77. package/dist/components/PageHeader.d.mts +140 -0
  78. package/dist/components/PageHeader.mjs +11 -0
  79. package/dist/components/PieChart.mjs +2 -2
  80. package/dist/components/Popconfirm.d.mts +3 -3
  81. package/dist/components/Popover.d.mts +2 -2
  82. package/dist/components/RadarChart.mjs +2 -2
  83. package/dist/components/ScatterChart.mjs +2 -2
  84. package/dist/components/ScrollArea.d.mts +136 -0
  85. package/dist/components/ScrollArea.mjs +8 -0
  86. package/dist/components/SplitButton.d.mts +286 -0
  87. package/dist/components/SplitButton.mjs +12 -0
  88. package/dist/components/Spotlight.d.mts +1 -1
  89. package/dist/components/SunburstChart.mjs +2 -2
  90. package/dist/components/TagsInput.d.mts +214 -0
  91. package/dist/components/TagsInput.mjs +12 -0
  92. package/dist/components/Timeline.d.mts +1 -1
  93. package/dist/components/Tooltip.d.mts +2 -2
  94. package/dist/components/Tour.d.mts +3 -3
  95. package/dist/components/Tree.d.mts +1 -1
  96. package/dist/components/TreeMapChart.d.mts +1 -1
  97. package/dist/components/TreeMapChart.mjs +2 -2
  98. package/dist/components/TreeSelect.d.mts +51 -0
  99. package/dist/components/TreeSelect.mjs +2 -1
  100. package/dist/components/Upload.d.mts +1 -1
  101. package/dist/components/VirtualTable.d.mts +1 -1
  102. package/dist/components/Watermark.d.mts +1 -1
  103. package/dist/index.d.mts +17 -1
  104. package/dist/index.mjs +356 -0
  105. package/package.json +117 -2
  106. package/dist/{chunk-MAKOSWR6.mjs → chunk-37W7XTA6.mjs} +3 -3
  107. package/dist/{chunk-WUQMFKQ6.mjs → chunk-66OS5A4D.mjs} +3 -3
  108. package/dist/{chunk-NNC75I7F.mjs → chunk-CHEXI7MO.mjs} +3 -3
  109. package/dist/{chunk-KFJIZED5.mjs → chunk-EHGFW5GX.mjs} +3 -3
  110. package/dist/{chunk-ZGA66PSG.mjs → chunk-EZYOCPMM.mjs} +3 -3
  111. package/dist/{chunk-XGXZF27U.mjs → chunk-JHMT5Q6P.mjs} +3 -3
  112. package/dist/{chunk-NGAA73CV.mjs → chunk-VLW3UBIR.mjs} +3 -3
  113. package/dist/{chunk-OTHJIFDV.mjs → chunk-W5XFWVNV.mjs} +3 -3
  114. package/dist/{chunk-3KITFMBJ.mjs → chunk-ZOYHZF4N.mjs} +3 -3
@@ -0,0 +1,156 @@
1
+ // src/components/Highlight.ts
2
+ import { Comment, defineComponent, h } from "vue";
3
+ import {
4
+ composeComponentClasses,
5
+ getHighlightMarkClasses,
6
+ getHighlightRootClasses,
7
+ getHighlightSegments,
8
+ mergeStyleValues,
9
+ resolveHighlightText
10
+ } from "@expcat/tigercat-core";
11
+ function flattenVueText(input) {
12
+ if (input == null || typeof input === "boolean") return "";
13
+ if (typeof input === "string" || typeof input === "number") return String(input);
14
+ if (typeof input === "function") {
15
+ return flattenVueText(input());
16
+ }
17
+ if (Array.isArray(input)) {
18
+ let out = "";
19
+ for (const item of input) out += flattenVueText(item);
20
+ return out;
21
+ }
22
+ if (typeof input !== "object") return "";
23
+ const node = input;
24
+ if (node.type === Comment) return "";
25
+ if (typeof node.children === "string" || typeof node.children === "number") {
26
+ return String(node.children);
27
+ }
28
+ if (typeof node.children === "function") {
29
+ return flattenVueText(node.children());
30
+ }
31
+ if (Array.isArray(node.children)) {
32
+ return flattenVueText(node.children);
33
+ }
34
+ if (node.children && typeof node.children === "object") {
35
+ const slots = node.children;
36
+ if (typeof slots.default === "function") {
37
+ return flattenVueText(slots.default());
38
+ }
39
+ }
40
+ return "";
41
+ }
42
+ var Highlight = defineComponent({
43
+ name: "TigerHighlight",
44
+ inheritAttrs: false,
45
+ props: {
46
+ /**
47
+ * Source text to search. When omitted, the default slot is flattened to a string.
48
+ */
49
+ text: {
50
+ type: String,
51
+ default: void 0
52
+ },
53
+ /**
54
+ * Keyword string(s) and/or regular expression(s) to highlight.
55
+ */
56
+ keywords: {
57
+ type: [String, Array, RegExp],
58
+ default: void 0
59
+ },
60
+ /**
61
+ * Match case for string keywords. Regular expressions keep their own `i` flag.
62
+ * @default false
63
+ */
64
+ caseSensitive: {
65
+ type: Boolean,
66
+ default: false
67
+ },
68
+ /**
69
+ * Highlight every occurrence. When false, only the first match of each keyword.
70
+ * @default true
71
+ */
72
+ global: {
73
+ type: Boolean,
74
+ default: true
75
+ },
76
+ /**
77
+ * Additional CSS classes on highlighted `mark` elements
78
+ */
79
+ highlightClassName: {
80
+ type: String,
81
+ default: void 0
82
+ },
83
+ /**
84
+ * Inline styles on highlighted `mark` elements
85
+ */
86
+ highlightStyle: {
87
+ type: Object,
88
+ default: void 0
89
+ },
90
+ /**
91
+ * Additional CSS classes
92
+ */
93
+ className: {
94
+ type: String,
95
+ default: void 0
96
+ },
97
+ /**
98
+ * Inline styles
99
+ */
100
+ style: {
101
+ type: Object,
102
+ default: void 0
103
+ }
104
+ },
105
+ setup(props, { slots, attrs }) {
106
+ return () => {
107
+ const attrsRecord = attrs;
108
+ const source = resolveHighlightText(props.text, flattenVueText(slots.default?.()));
109
+ const segments = getHighlightSegments(source, props.keywords, {
110
+ caseSensitive: props.caseSensitive,
111
+ global: props.global
112
+ });
113
+ const markClasses = getHighlightMarkClasses(props.highlightClassName);
114
+ const markStyle = mergeStyleValues(props.highlightStyle);
115
+ const children = [];
116
+ for (const segment of segments) {
117
+ if (segment.highlighted) {
118
+ children.push(
119
+ h(
120
+ "mark",
121
+ {
122
+ class: markClasses,
123
+ style: markStyle,
124
+ "data-highlight-mark": ""
125
+ },
126
+ segment.text
127
+ )
128
+ );
129
+ } else {
130
+ children.push(segment.text);
131
+ }
132
+ }
133
+ return h(
134
+ "span",
135
+ {
136
+ ...attrs,
137
+ class: composeComponentClasses(
138
+ getHighlightRootClasses(props.className),
139
+ attrsRecord.class
140
+ ),
141
+ style: mergeStyleValues(attrsRecord.style, props.style),
142
+ "data-highlight": "",
143
+ "data-highlight-case-sensitive": props.caseSensitive ? "true" : "false",
144
+ "data-highlight-global": props.global ? "true" : "false"
145
+ },
146
+ children
147
+ );
148
+ };
149
+ }
150
+ });
151
+ var Highlight_default = Highlight;
152
+
153
+ export {
154
+ Highlight,
155
+ Highlight_default
156
+ };
@@ -0,0 +1,257 @@
1
+ import {
2
+ FORM_ITEM_CONTROL_INJECTION_KEY
3
+ } from "./chunk-P2LZ2MR5.mjs";
4
+ import {
5
+ useTigerConfig
6
+ } from "./chunk-UOJOJBEU.mjs";
7
+
8
+ // src/components/MaskInput.ts
9
+ import { computed, defineComponent, h, inject, nextTick, ref, watch } from "vue";
10
+ import {
11
+ applyMaskInput,
12
+ classNames,
13
+ coerceClassValue,
14
+ formatMaskValue,
15
+ getInputClasses,
16
+ getInputClearButtonClasses,
17
+ getInputErrorClasses,
18
+ getInputWrapperClasses,
19
+ injectShakeStyle,
20
+ mergeStyleValues,
21
+ parseMask,
22
+ SHAKE_CLASS
23
+ } from "@expcat/tigercat-core";
24
+ var maskInputIdCounter = 0;
25
+ var MaskInput = defineComponent({
26
+ name: "TigerMaskInput",
27
+ inheritAttrs: false,
28
+ props: {
29
+ /**
30
+ * Raw (unmasked) value for v-model
31
+ */
32
+ modelValue: { type: String, default: void 0 },
33
+ /**
34
+ * Default raw value (for uncontrolled mode)
35
+ */
36
+ defaultValue: { type: String, default: "" },
37
+ /**
38
+ * Mask template. Built-in tokens: `#` digit, `a` letter, `*` alphanumeric,
39
+ * `!` escapes the next character to a literal
40
+ */
41
+ mask: { type: String, required: true },
42
+ /**
43
+ * Custom tokens merged over the built-ins
44
+ */
45
+ tokens: { type: Object, default: void 0 },
46
+ /**
47
+ * Input size
48
+ * @default 'md'
49
+ */
50
+ size: { type: String, default: "md" },
51
+ /**
52
+ * Validation status
53
+ * @default 'default'
54
+ */
55
+ status: { type: String, default: "default" },
56
+ /** Error message to display */
57
+ errorMessage: String,
58
+ /** Placeholder text */
59
+ placeholder: { type: String, default: "" },
60
+ /** Whether the input is disabled */
61
+ disabled: Boolean,
62
+ /** Whether the input is readonly */
63
+ readonly: Boolean,
64
+ /** Whether to show a clear button when the input has value */
65
+ clearable: Boolean,
66
+ /** Input name attribute */
67
+ name: String,
68
+ /** Input id attribute */
69
+ id: String,
70
+ /** Autocomplete attribute */
71
+ autoComplete: String,
72
+ /** Whether to autofocus on mount */
73
+ autoFocus: Boolean,
74
+ /**
75
+ * Internal shake trigger counter (used by FormItem)
76
+ * @internal
77
+ */
78
+ _shakeTrigger: { type: Number, default: void 0 },
79
+ /** Additional CSS classes */
80
+ className: String,
81
+ /** Inline styles */
82
+ style: { type: Object, default: void 0 }
83
+ },
84
+ emits: {
85
+ "update:modelValue": null,
86
+ change: null,
87
+ complete: null,
88
+ focus: null,
89
+ blur: null,
90
+ clear: null
91
+ },
92
+ setup(props, { emit, attrs }) {
93
+ injectShakeStyle();
94
+ const formItemControl = inject(
95
+ FORM_ITEM_CONTROL_INJECTION_KEY,
96
+ null
97
+ );
98
+ useTigerConfig();
99
+ const effectiveStatus = computed(
100
+ () => props.status !== "default" ? props.status : formItemControl?.status.value ?? props.status
101
+ );
102
+ const effectiveErrorMessage = computed(
103
+ () => props.errorMessage ?? formItemControl?.errorMessage.value
104
+ );
105
+ const effectiveShakeTrigger = computed(
106
+ () => props._shakeTrigger ?? formItemControl?.shakeTrigger.value
107
+ );
108
+ const instanceId = ++maskInputIdCounter;
109
+ const errorMsgId = `tiger-mask-input-error-${instanceId}`;
110
+ const wrapperRef = ref(null);
111
+ const inputRef = ref(null);
112
+ const isComposing = ref(false);
113
+ const spec = computed(() => parseMask(props.mask, props.tokens));
114
+ const isControlled = computed(() => props.modelValue !== void 0);
115
+ const innerRaw = ref(props.defaultValue ?? "");
116
+ const rawValue = computed(
117
+ () => isControlled.value ? props.modelValue ?? "" : innerRaw.value
118
+ );
119
+ const formatted = computed(() => formatMaskValue(rawValue.value, spec.value));
120
+ const maskedValue = computed(() => formatted.value.maskedValue);
121
+ watch([effectiveStatus, effectiveShakeTrigger], ([newStatus]) => {
122
+ if (newStatus === "error" && wrapperRef.value) {
123
+ const el = wrapperRef.value;
124
+ el.classList.remove(SHAKE_CLASS);
125
+ void el.offsetWidth;
126
+ el.classList.add(SHAKE_CLASS);
127
+ }
128
+ });
129
+ const commit = (raw, detail, previousMasked) => {
130
+ if (!isControlled.value) innerRaw.value = raw;
131
+ emit("update:modelValue", raw);
132
+ emit("change", raw, detail);
133
+ if (detail.completed && !formatMaskValue(previousMasked, spec.value).completed) {
134
+ emit("complete", raw, detail.maskedValue);
135
+ }
136
+ };
137
+ const applyValue = (inputValue, caret) => {
138
+ const previousMasked = maskedValue.value;
139
+ const result = applyMaskInput(inputValue, caret, spec.value, previousMasked);
140
+ if (inputRef.value) inputRef.value.value = result.maskedValue;
141
+ commit(
142
+ result.rawValue,
143
+ { maskedValue: result.maskedValue, completed: result.completed },
144
+ previousMasked
145
+ );
146
+ nextTick(() => {
147
+ if (inputRef.value) inputRef.value.setSelectionRange(result.caret, result.caret);
148
+ });
149
+ };
150
+ const processInput = (target) => {
151
+ applyValue(target.value, target.selectionStart ?? target.value.length);
152
+ };
153
+ const handleInput = (event) => {
154
+ if (isComposing.value) return;
155
+ processInput(event.target);
156
+ };
157
+ const handlePaste = (event) => {
158
+ if (props.disabled || props.readonly) return;
159
+ event.preventDefault();
160
+ const input = event.target;
161
+ const text = event.clipboardData?.getData("text") ?? "";
162
+ const start = input.selectionStart ?? input.value.length;
163
+ const end = input.selectionEnd ?? input.value.length;
164
+ applyValue(input.value.slice(0, start) + text + input.value.slice(end), start + text.length);
165
+ };
166
+ const handleCompositionStart = () => {
167
+ isComposing.value = true;
168
+ };
169
+ const handleCompositionEnd = (event) => {
170
+ isComposing.value = false;
171
+ processInput(event.target);
172
+ };
173
+ const handleClear = () => {
174
+ if (!isControlled.value) innerRaw.value = "";
175
+ emit("update:modelValue", "");
176
+ emit("change", "", { maskedValue: "", completed: false });
177
+ emit("clear");
178
+ inputRef.value?.focus();
179
+ };
180
+ const handleFocus = (event) => emit("focus", event);
181
+ const handleBlur = (event) => emit("blur", event);
182
+ return () => {
183
+ const { class: attrClass, style: attrStyle, ...restAttrs } = attrs;
184
+ const activeError = effectiveStatus.value === "error" && !!effectiveErrorMessage.value;
185
+ const hasSuffix = props.clearable;
186
+ const showClear = props.clearable && !props.disabled && !props.readonly && rawValue.value.length > 0;
187
+ const inputClasses = getInputClasses({
188
+ size: props.size,
189
+ status: effectiveStatus.value,
190
+ hasPrefix: false,
191
+ hasSuffix
192
+ });
193
+ const children = [
194
+ h("input", {
195
+ ...restAttrs,
196
+ ref: inputRef,
197
+ class: inputClasses,
198
+ type: "text",
199
+ value: maskedValue.value,
200
+ placeholder: props.placeholder,
201
+ disabled: props.disabled,
202
+ readonly: props.readonly,
203
+ name: props.name,
204
+ id: props.id,
205
+ autocomplete: props.autoComplete,
206
+ autofocus: props.autoFocus,
207
+ ...effectiveStatus.value === "error" ? { "aria-invalid": true } : {},
208
+ ...activeError ? { "aria-describedby": errorMsgId } : {},
209
+ onInput: handleInput,
210
+ onPaste: handlePaste,
211
+ onCompositionstart: handleCompositionStart,
212
+ onCompositionend: handleCompositionEnd,
213
+ onFocus: handleFocus,
214
+ onBlur: handleBlur
215
+ })
216
+ ];
217
+ if (activeError) {
218
+ children.push(
219
+ h(
220
+ "div",
221
+ { id: errorMsgId, class: getInputErrorClasses(props.size) },
222
+ effectiveErrorMessage.value
223
+ )
224
+ );
225
+ } else if (showClear) {
226
+ children.push(
227
+ h(
228
+ "button",
229
+ {
230
+ type: "button",
231
+ class: getInputClearButtonClasses(props.size),
232
+ onClick: handleClear,
233
+ "aria-label": "Clear input",
234
+ tabindex: -1
235
+ },
236
+ "\u2715"
237
+ )
238
+ );
239
+ }
240
+ return h(
241
+ "div",
242
+ {
243
+ ref: wrapperRef,
244
+ class: classNames(getInputWrapperClasses(), props.className, coerceClassValue(attrClass)),
245
+ style: mergeStyleValues(props.style, attrStyle)
246
+ },
247
+ children
248
+ );
249
+ };
250
+ }
251
+ });
252
+ var MaskInput_default = MaskInput;
253
+
254
+ export {
255
+ MaskInput,
256
+ MaskInput_default
257
+ };