@expcat/tigercat-core 0.1.6 → 0.2.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/dist/index.cjs +1917 -839
- package/dist/index.d.cts +6535 -4553
- package/dist/index.d.ts +6535 -4553
- package/dist/index.js +1827 -839
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -130,6 +130,345 @@ function isBrowser() {
|
|
|
130
130
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// src/utils/style-values.ts
|
|
134
|
+
var isRecord2 = (val) => typeof val === "object" && val !== null;
|
|
135
|
+
var isStyleObject = (val) => {
|
|
136
|
+
if (!isRecord2(val)) return false;
|
|
137
|
+
for (const key of Object.keys(val)) {
|
|
138
|
+
const v = val[key];
|
|
139
|
+
if (v === void 0) continue;
|
|
140
|
+
if (typeof v !== "string" && typeof v !== "number") return false;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
};
|
|
144
|
+
function coerceStyleValue(input) {
|
|
145
|
+
if (!input) return void 0;
|
|
146
|
+
if (typeof input === "string") return input;
|
|
147
|
+
if (Array.isArray(input)) {
|
|
148
|
+
const parts = [];
|
|
149
|
+
for (const item of input) {
|
|
150
|
+
const coerced = coerceStyleValue(item);
|
|
151
|
+
if (!coerced) continue;
|
|
152
|
+
if (Array.isArray(coerced)) {
|
|
153
|
+
parts.push(...coerced);
|
|
154
|
+
} else {
|
|
155
|
+
parts.push(coerced);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (parts.length === 0) return void 0;
|
|
159
|
+
return parts;
|
|
160
|
+
}
|
|
161
|
+
if (isStyleObject(input)) return input;
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
function mergeStyleValues(...inputs) {
|
|
165
|
+
const parts = [];
|
|
166
|
+
for (const input of inputs) {
|
|
167
|
+
const coerced = coerceStyleValue(input);
|
|
168
|
+
if (!coerced) continue;
|
|
169
|
+
if (Array.isArray(coerced)) {
|
|
170
|
+
parts.push(...coerced);
|
|
171
|
+
} else {
|
|
172
|
+
parts.push(coerced);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (parts.length === 0) return void 0;
|
|
176
|
+
if (parts.length === 1) return parts[0];
|
|
177
|
+
return parts;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/utils/copy-text.ts
|
|
181
|
+
var copyTextToClipboard = async (text) => {
|
|
182
|
+
if (typeof text !== "string") return false;
|
|
183
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
184
|
+
try {
|
|
185
|
+
await navigator.clipboard.writeText(text);
|
|
186
|
+
return true;
|
|
187
|
+
} catch {
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (typeof document === "undefined") return false;
|
|
191
|
+
try {
|
|
192
|
+
const textarea = document.createElement("textarea");
|
|
193
|
+
textarea.value = text;
|
|
194
|
+
textarea.setAttribute("readonly", "");
|
|
195
|
+
textarea.style.position = "fixed";
|
|
196
|
+
textarea.style.left = "-9999px";
|
|
197
|
+
textarea.style.top = "0";
|
|
198
|
+
document.body.appendChild(textarea);
|
|
199
|
+
textarea.select();
|
|
200
|
+
textarea.setSelectionRange(0, textarea.value.length);
|
|
201
|
+
const ok = document.execCommand("copy");
|
|
202
|
+
document.body.removeChild(textarea);
|
|
203
|
+
return ok;
|
|
204
|
+
} catch {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// src/utils/animation.ts
|
|
210
|
+
var ANIMATION_DURATION_MS = 300;
|
|
211
|
+
var ANIMATION_DURATION_FAST_MS = 150;
|
|
212
|
+
var ANIMATION_DURATION_SLOW_MS = 500;
|
|
213
|
+
var DURATION_CLASS = "duration-300";
|
|
214
|
+
var DURATION_FAST_CLASS = "duration-150";
|
|
215
|
+
var DURATION_SLOW_CLASS = "duration-500";
|
|
216
|
+
var EASING_DEFAULT = "ease-in-out";
|
|
217
|
+
var EASING_ENTER = "ease-out";
|
|
218
|
+
var EASING_LEAVE = "ease-in";
|
|
219
|
+
var TRANSITION_BASE = `transition-all ${DURATION_CLASS} ${EASING_DEFAULT}`;
|
|
220
|
+
var TRANSITION_OPACITY = `transition-opacity ${DURATION_CLASS} ${EASING_DEFAULT}`;
|
|
221
|
+
var TRANSITION_TRANSFORM = `transition-transform ${DURATION_CLASS} ${EASING_DEFAULT}`;
|
|
222
|
+
var SHAKE_ANIMATION_CSS = `
|
|
223
|
+
@keyframes tiger-shake {
|
|
224
|
+
0%, 100% { transform: translateX(0); }
|
|
225
|
+
20% { transform: translateX(-4px); }
|
|
226
|
+
40% { transform: translateX(4px); }
|
|
227
|
+
60% { transform: translateX(-2px); }
|
|
228
|
+
80% { transform: translateX(2px); }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.tiger-animate-shake {
|
|
232
|
+
animation: tiger-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
var isStyleInjected = false;
|
|
236
|
+
function injectShakeStyle() {
|
|
237
|
+
if (typeof document === "undefined" || isStyleInjected) return;
|
|
238
|
+
const styleId = "tiger-ui-animation-styles";
|
|
239
|
+
if (document.getElementById(styleId)) {
|
|
240
|
+
isStyleInjected = true;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const style = document.createElement("style");
|
|
244
|
+
style.id = styleId;
|
|
245
|
+
style.textContent = SHAKE_ANIMATION_CSS;
|
|
246
|
+
document.head.appendChild(style);
|
|
247
|
+
isStyleInjected = true;
|
|
248
|
+
}
|
|
249
|
+
var SHAKE_CLASS = "tiger-animate-shake";
|
|
250
|
+
function getPathLength(pathElement) {
|
|
251
|
+
return pathElement.getTotalLength();
|
|
252
|
+
}
|
|
253
|
+
function getPathDrawStyles(length, progress) {
|
|
254
|
+
return {
|
|
255
|
+
strokeDasharray: `${length}`,
|
|
256
|
+
strokeDashoffset: `${length * (1 - progress)}`
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
var SVG_PATH_ANIMATION_CSS = `
|
|
260
|
+
@keyframes tiger-path-draw {
|
|
261
|
+
from {
|
|
262
|
+
stroke-dashoffset: var(--tiger-path-length);
|
|
263
|
+
}
|
|
264
|
+
to {
|
|
265
|
+
stroke-dashoffset: 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.tiger-animate-path-draw {
|
|
270
|
+
animation: tiger-path-draw var(--tiger-path-duration, 1s) ease-out forwards;
|
|
271
|
+
stroke-dasharray: var(--tiger-path-length);
|
|
272
|
+
stroke-dashoffset: var(--tiger-path-length);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@keyframes tiger-fade-in {
|
|
276
|
+
from { opacity: 0; }
|
|
277
|
+
to { opacity: 1; }
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.tiger-animate-fade-in {
|
|
281
|
+
animation: tiger-fade-in var(--tiger-fade-duration, 0.5s) ease-out forwards;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@keyframes tiger-scale-in {
|
|
285
|
+
from { transform: scale(0); opacity: 0; }
|
|
286
|
+
to { transform: scale(1); opacity: 1; }
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.tiger-animate-scale-in {
|
|
290
|
+
animation: tiger-scale-in var(--tiger-scale-duration, 0.3s) ease-out forwards;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@keyframes tiger-bar-grow {
|
|
294
|
+
from { transform: scaleY(0); }
|
|
295
|
+
to { transform: scaleY(1); }
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.tiger-animate-bar-grow {
|
|
299
|
+
transform-origin: bottom;
|
|
300
|
+
animation: tiger-bar-grow var(--tiger-bar-duration, 0.5s) ease-out forwards;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@keyframes tiger-pie-draw {
|
|
304
|
+
from {
|
|
305
|
+
stroke-dashoffset: var(--tiger-circumference);
|
|
306
|
+
}
|
|
307
|
+
to {
|
|
308
|
+
stroke-dashoffset: var(--tiger-target-offset);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.tiger-animate-pie-draw {
|
|
313
|
+
animation: tiger-pie-draw var(--tiger-pie-duration, 0.8s) ease-out forwards;
|
|
314
|
+
}
|
|
315
|
+
`;
|
|
316
|
+
var isSvgStyleInjected = false;
|
|
317
|
+
function injectSvgAnimationStyles() {
|
|
318
|
+
if (typeof document === "undefined" || isSvgStyleInjected) return;
|
|
319
|
+
const styleId = "tiger-ui-svg-animation-styles";
|
|
320
|
+
if (document.getElementById(styleId)) {
|
|
321
|
+
isSvgStyleInjected = true;
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const style = document.createElement("style");
|
|
325
|
+
style.id = styleId;
|
|
326
|
+
style.textContent = SVG_PATH_ANIMATION_CSS;
|
|
327
|
+
document.head.appendChild(style);
|
|
328
|
+
isSvgStyleInjected = true;
|
|
329
|
+
}
|
|
330
|
+
var SVG_ANIMATION_CLASSES = {
|
|
331
|
+
pathDraw: "tiger-animate-path-draw",
|
|
332
|
+
fadeIn: "tiger-animate-fade-in",
|
|
333
|
+
scaleIn: "tiger-animate-scale-in",
|
|
334
|
+
barGrow: "tiger-animate-bar-grow",
|
|
335
|
+
pieDraw: "tiger-animate-pie-draw"
|
|
336
|
+
};
|
|
337
|
+
var SVG_ANIMATION_VARS = {
|
|
338
|
+
pathLength: "--tiger-path-length",
|
|
339
|
+
pathDuration: "--tiger-path-duration",
|
|
340
|
+
fadeDuration: "--tiger-fade-duration",
|
|
341
|
+
scaleDuration: "--tiger-scale-duration",
|
|
342
|
+
barDuration: "--tiger-bar-duration",
|
|
343
|
+
pieDuration: "--tiger-pie-duration",
|
|
344
|
+
circumference: "--tiger-circumference",
|
|
345
|
+
targetOffset: "--tiger-target-offset"
|
|
346
|
+
};
|
|
347
|
+
function getPathDrawAnimationStyle(pathLength, durationMs = 1e3) {
|
|
348
|
+
return {
|
|
349
|
+
[SVG_ANIMATION_VARS.pathLength]: `${pathLength}`,
|
|
350
|
+
[SVG_ANIMATION_VARS.pathDuration]: `${durationMs}ms`
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function getBarGrowAnimationStyle(index, durationMs = 500, staggerMs = 50) {
|
|
354
|
+
return {
|
|
355
|
+
[SVG_ANIMATION_VARS.barDuration]: `${durationMs}ms`,
|
|
356
|
+
animationDelay: `${index * staggerMs}ms`
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function getPieDrawAnimationStyle(circumference, targetOffset, durationMs = 800) {
|
|
360
|
+
return {
|
|
361
|
+
[SVG_ANIMATION_VARS.circumference]: `${circumference}`,
|
|
362
|
+
[SVG_ANIMATION_VARS.targetOffset]: `${targetOffset}`,
|
|
363
|
+
[SVG_ANIMATION_VARS.pieDuration]: `${durationMs}ms`
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/utils/helpers/slider-utils.ts
|
|
368
|
+
function sliderNormalizeValue(value, min, max, step = 1) {
|
|
369
|
+
const clamped = Math.min(Math.max(value, min), max);
|
|
370
|
+
const stepped = Math.round((clamped - min) / step) * step + min;
|
|
371
|
+
return Math.min(stepped, max);
|
|
372
|
+
}
|
|
373
|
+
function sliderGetPercentage(value, min, max) {
|
|
374
|
+
if (max === min) return 0;
|
|
375
|
+
return (value - min) / (max - min) * 100;
|
|
376
|
+
}
|
|
377
|
+
function sliderGetValueFromPosition(position, trackWidth, min, max, step = 1) {
|
|
378
|
+
if (trackWidth === 0) return min;
|
|
379
|
+
const ratio = position / trackWidth;
|
|
380
|
+
const rawValue = ratio * (max - min) + min;
|
|
381
|
+
return sliderNormalizeValue(rawValue, min, max, step);
|
|
382
|
+
}
|
|
383
|
+
function sliderGetKeyboardValue(key, currentValue, min, max, step = 1, largeStep) {
|
|
384
|
+
const bigStep = largeStep ?? step * 10;
|
|
385
|
+
switch (key) {
|
|
386
|
+
case "ArrowRight":
|
|
387
|
+
case "ArrowUp":
|
|
388
|
+
return sliderNormalizeValue(currentValue + step, min, max, step);
|
|
389
|
+
case "ArrowLeft":
|
|
390
|
+
case "ArrowDown":
|
|
391
|
+
return sliderNormalizeValue(currentValue - step, min, max, step);
|
|
392
|
+
case "PageUp":
|
|
393
|
+
return sliderNormalizeValue(currentValue + bigStep, min, max, step);
|
|
394
|
+
case "PageDown":
|
|
395
|
+
return sliderNormalizeValue(currentValue - bigStep, min, max, step);
|
|
396
|
+
case "Home":
|
|
397
|
+
return min;
|
|
398
|
+
case "End":
|
|
399
|
+
return max;
|
|
400
|
+
default:
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/utils/common-icons.ts
|
|
406
|
+
var closeIconViewBox = "0 0 24 24";
|
|
407
|
+
var closeIconPathD = "M6 18L18 6M6 6l12 12";
|
|
408
|
+
var closeIconPathStrokeLinecap = "round";
|
|
409
|
+
var closeIconPathStrokeLinejoin = "round";
|
|
410
|
+
var closeIconPathStrokeWidth = 2;
|
|
411
|
+
var icon24ViewBox = "0 0 24 24";
|
|
412
|
+
var icon24PathStrokeLinecap = "round";
|
|
413
|
+
var icon24PathStrokeLinejoin = "round";
|
|
414
|
+
var icon24StrokeWidth = 2;
|
|
415
|
+
var icon20ViewBox = "0 0 20 20";
|
|
416
|
+
var closeSolidIcon20PathD = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z";
|
|
417
|
+
var calendarSolidIcon20PathD = "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z";
|
|
418
|
+
var clockSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z";
|
|
419
|
+
var chevronLeftSolidIcon20PathD = "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z";
|
|
420
|
+
var chevronRightSolidIcon20PathD = "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z";
|
|
421
|
+
var chevronDownSolidIcon20PathD = "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z";
|
|
422
|
+
var checkSolidIcon20PathD = "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z";
|
|
423
|
+
var successCircleSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z";
|
|
424
|
+
var errorCircleSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z";
|
|
425
|
+
var statusSuccessIconPath = "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
426
|
+
var statusWarningIconPath = "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z";
|
|
427
|
+
var statusErrorIconPath = "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
428
|
+
var statusInfoIconPath = "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
429
|
+
var statusIconPaths = {
|
|
430
|
+
success: statusSuccessIconPath,
|
|
431
|
+
warning: statusWarningIconPath,
|
|
432
|
+
error: statusErrorIconPath,
|
|
433
|
+
info: statusInfoIconPath
|
|
434
|
+
};
|
|
435
|
+
var icon16ViewBox = "0 0 16 16";
|
|
436
|
+
var sortAscIcon16PathD = "M8 3l4 4H4l4-4z";
|
|
437
|
+
var sortDescIcon16PathD = "M8 13l-4-4h8l-4 4z";
|
|
438
|
+
var sortBothIcon16PathD = "M8 3l4 4H4l4-4zM8 13l-4-4h8l-4 4z";
|
|
439
|
+
var lockClosedIcon24PathD = "M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm-7-2a2 2 0 114 0v2h-4V6z";
|
|
440
|
+
var lockOpenIcon24PathD = "M17 8h-1V6a4 4 0 00-7.75-1.41 1 1 0 101.9.62A2 2 0 0114 6v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm0 12H7V10h10v10z";
|
|
441
|
+
var CalendarIconPath = calendarSolidIcon20PathD;
|
|
442
|
+
var CloseIconPath = closeSolidIcon20PathD;
|
|
443
|
+
var ChevronLeftIconPath = chevronLeftSolidIcon20PathD;
|
|
444
|
+
var ChevronRightIconPath = chevronRightSolidIcon20PathD;
|
|
445
|
+
var ClockIconPath = clockSolidIcon20PathD;
|
|
446
|
+
var TimePickerCloseIconPath = closeSolidIcon20PathD;
|
|
447
|
+
|
|
448
|
+
// src/utils/svg-attrs.ts
|
|
449
|
+
var SVG_DEFAULT_XMLNS = "http://www.w3.org/2000/svg";
|
|
450
|
+
var SVG_DEFAULT_VIEWBOX_24 = "0 0 24 24";
|
|
451
|
+
var SVG_DEFAULT_VIEWBOX_20 = "0 0 20 20";
|
|
452
|
+
var SVG_DEFAULT_FILL = "none";
|
|
453
|
+
var SVG_DEFAULT_STROKE = "currentColor";
|
|
454
|
+
function getSvgDefaultAttrs(size = 24) {
|
|
455
|
+
return {
|
|
456
|
+
xmlns: SVG_DEFAULT_XMLNS,
|
|
457
|
+
viewBox: size === 20 ? SVG_DEFAULT_VIEWBOX_20 : SVG_DEFAULT_VIEWBOX_24,
|
|
458
|
+
fill: SVG_DEFAULT_FILL
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function normalizeSvgAttrs(svgAttrs) {
|
|
462
|
+
if ("className" in svgAttrs && !("class" in svgAttrs)) {
|
|
463
|
+
const { className, ...rest } = svgAttrs;
|
|
464
|
+
return {
|
|
465
|
+
...rest,
|
|
466
|
+
class: className
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
return svgAttrs;
|
|
470
|
+
}
|
|
471
|
+
|
|
133
472
|
// src/utils/a11y-utils.ts
|
|
134
473
|
function isEnterKey(event) {
|
|
135
474
|
if (event.key === "Enter" || event.code === "Enter") return true;
|
|
@@ -162,6 +501,42 @@ function createAriaId(options = {}) {
|
|
|
162
501
|
return `${prefix}${separator}${ariaIdCounter}`;
|
|
163
502
|
}
|
|
164
503
|
|
|
504
|
+
// src/utils/focus-utils.ts
|
|
505
|
+
function isHTMLElement(value) {
|
|
506
|
+
if (typeof HTMLElement === "undefined") return false;
|
|
507
|
+
return value instanceof HTMLElement;
|
|
508
|
+
}
|
|
509
|
+
function getActiveElement(doc) {
|
|
510
|
+
const active = doc?.activeElement;
|
|
511
|
+
return isHTMLElement(active) ? active : null;
|
|
512
|
+
}
|
|
513
|
+
function captureActiveElement(doc = document) {
|
|
514
|
+
return getActiveElement(doc);
|
|
515
|
+
}
|
|
516
|
+
function focusElement(element, options) {
|
|
517
|
+
if (!element) return false;
|
|
518
|
+
if (typeof element.focus !== "function") return false;
|
|
519
|
+
try {
|
|
520
|
+
if (options) {
|
|
521
|
+
element.focus(options);
|
|
522
|
+
} else {
|
|
523
|
+
element.focus();
|
|
524
|
+
}
|
|
525
|
+
return true;
|
|
526
|
+
} catch {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function focusFirst(candidates, options) {
|
|
531
|
+
for (const el of candidates) {
|
|
532
|
+
if (focusElement(el, options)) return el ?? null;
|
|
533
|
+
}
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
function restoreFocus(previous, options) {
|
|
537
|
+
return focusElement(previous, options);
|
|
538
|
+
}
|
|
539
|
+
|
|
165
540
|
// src/utils/overlay-utils.ts
|
|
166
541
|
function getComposedPath(event) {
|
|
167
542
|
const eventWithPath = event;
|
|
@@ -230,110 +605,347 @@ function getFocusTrapNavigation(event, focusables, activeElement) {
|
|
|
230
605
|
return { shouldHandle: false };
|
|
231
606
|
}
|
|
232
607
|
|
|
233
|
-
// src/utils/
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
608
|
+
// src/utils/locale-utils.ts
|
|
609
|
+
function resolveLocaleText(fallback, ...candidates) {
|
|
610
|
+
for (const candidate of candidates) {
|
|
611
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
612
|
+
return candidate;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return fallback;
|
|
237
616
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
240
|
-
return
|
|
617
|
+
function mergeTigerLocale(base, override) {
|
|
618
|
+
if (!base && !override) return void 0;
|
|
619
|
+
return {
|
|
620
|
+
common: { ...base?.common, ...override?.common },
|
|
621
|
+
modal: { ...base?.modal, ...override?.modal },
|
|
622
|
+
drawer: { ...base?.drawer, ...override?.drawer },
|
|
623
|
+
upload: { ...base?.upload, ...override?.upload },
|
|
624
|
+
pagination: { ...base?.pagination, ...override?.pagination }
|
|
625
|
+
};
|
|
241
626
|
}
|
|
242
|
-
|
|
243
|
-
|
|
627
|
+
var DEFAULT_PAGINATION_LABELS = {
|
|
628
|
+
totalText: "Total {total} items",
|
|
629
|
+
itemsPerPageText: "/ page",
|
|
630
|
+
jumpToText: "Go to",
|
|
631
|
+
pageText: "page",
|
|
632
|
+
prevPageAriaLabel: "Previous page",
|
|
633
|
+
nextPageAriaLabel: "Next page",
|
|
634
|
+
pageAriaLabel: "Page {page}"
|
|
635
|
+
};
|
|
636
|
+
var ZH_CN_PAGINATION_LABELS = {
|
|
637
|
+
totalText: "\u5171 {total} \u6761",
|
|
638
|
+
itemsPerPageText: "\u6761/\u9875",
|
|
639
|
+
jumpToText: "\u8DF3\u81F3",
|
|
640
|
+
pageText: "\u9875",
|
|
641
|
+
prevPageAriaLabel: "\u4E0A\u4E00\u9875",
|
|
642
|
+
nextPageAriaLabel: "\u4E0B\u4E00\u9875",
|
|
643
|
+
pageAriaLabel: "\u7B2C {page} \u9875"
|
|
644
|
+
};
|
|
645
|
+
function getPaginationLabels(locale) {
|
|
646
|
+
return {
|
|
647
|
+
totalText: locale?.pagination?.totalText ?? DEFAULT_PAGINATION_LABELS.totalText,
|
|
648
|
+
itemsPerPageText: locale?.pagination?.itemsPerPageText ?? DEFAULT_PAGINATION_LABELS.itemsPerPageText,
|
|
649
|
+
jumpToText: locale?.pagination?.jumpToText ?? DEFAULT_PAGINATION_LABELS.jumpToText,
|
|
650
|
+
pageText: locale?.pagination?.pageText ?? DEFAULT_PAGINATION_LABELS.pageText,
|
|
651
|
+
prevPageAriaLabel: locale?.pagination?.prevPageAriaLabel ?? DEFAULT_PAGINATION_LABELS.prevPageAriaLabel,
|
|
652
|
+
nextPageAriaLabel: locale?.pagination?.nextPageAriaLabel ?? DEFAULT_PAGINATION_LABELS.nextPageAriaLabel,
|
|
653
|
+
pageAriaLabel: locale?.pagination?.pageAriaLabel ?? DEFAULT_PAGINATION_LABELS.pageAriaLabel
|
|
654
|
+
};
|
|
244
655
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
if (typeof element.focus !== "function") return false;
|
|
248
|
-
try {
|
|
249
|
-
if (options) {
|
|
250
|
-
element.focus(options);
|
|
251
|
-
} else {
|
|
252
|
-
element.focus();
|
|
253
|
-
}
|
|
254
|
-
return true;
|
|
255
|
-
} catch {
|
|
256
|
-
return false;
|
|
257
|
-
}
|
|
656
|
+
function formatPaginationTotal(template, total, range) {
|
|
657
|
+
return template.replace("{total}", String(total)).replace("{start}", String(range[0])).replace("{end}", String(range[1]));
|
|
258
658
|
}
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
if (focusElement(el, options)) return el ?? null;
|
|
262
|
-
}
|
|
263
|
-
return null;
|
|
659
|
+
function formatPageAriaLabel(template, page) {
|
|
660
|
+
return template.replace("{page}", String(page));
|
|
264
661
|
}
|
|
265
|
-
|
|
266
|
-
|
|
662
|
+
|
|
663
|
+
// src/utils/datepicker-i18n.ts
|
|
664
|
+
function getDatePickerLabels(locale, overrides) {
|
|
665
|
+
const lc = (locale ?? "").toLowerCase();
|
|
666
|
+
const base = lc.startsWith("zh") ? {
|
|
667
|
+
today: "\u4ECA\u5929",
|
|
668
|
+
ok: "\u786E\u5B9A",
|
|
669
|
+
calendar: "\u65E5\u5386",
|
|
670
|
+
toggleCalendar: "\u6253\u5F00\u65E5\u5386",
|
|
671
|
+
clearDate: "\u6E05\u9664\u65E5\u671F",
|
|
672
|
+
previousMonth: "\u4E0A\u4E2A\u6708",
|
|
673
|
+
nextMonth: "\u4E0B\u4E2A\u6708"
|
|
674
|
+
} : {
|
|
675
|
+
today: "Today",
|
|
676
|
+
ok: "OK",
|
|
677
|
+
calendar: "Calendar",
|
|
678
|
+
toggleCalendar: "Toggle calendar",
|
|
679
|
+
clearDate: "Clear date",
|
|
680
|
+
previousMonth: "Previous month",
|
|
681
|
+
nextMonth: "Next month"
|
|
682
|
+
};
|
|
683
|
+
return { ...base, ...overrides ?? {} };
|
|
267
684
|
}
|
|
268
685
|
|
|
269
|
-
// src/utils/
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
686
|
+
// src/utils/timepicker-utils.ts
|
|
687
|
+
var ZH_LABELS = {
|
|
688
|
+
hour: "\u65F6",
|
|
689
|
+
minute: "\u5206",
|
|
690
|
+
second: "\u79D2",
|
|
691
|
+
now: "\u73B0\u5728",
|
|
692
|
+
ok: "\u786E\u5B9A",
|
|
693
|
+
start: "\u5F00\u59CB",
|
|
694
|
+
end: "\u7ED3\u675F",
|
|
695
|
+
clear: "\u6E05\u9664\u65F6\u95F4",
|
|
696
|
+
toggle: "\u6253\u5F00\u65F6\u95F4\u9009\u62E9\u5668",
|
|
697
|
+
dialog: "\u65F6\u95F4\u9009\u62E9\u5668",
|
|
698
|
+
selectTime: "\u8BF7\u9009\u62E9\u65F6\u95F4",
|
|
699
|
+
selectTimeRange: "\u8BF7\u9009\u62E9\u65F6\u95F4\u8303\u56F4"
|
|
700
|
+
};
|
|
701
|
+
var EN_LABELS = {
|
|
702
|
+
hour: "Hour",
|
|
703
|
+
minute: "Min",
|
|
704
|
+
second: "Sec",
|
|
705
|
+
now: "Now",
|
|
706
|
+
ok: "OK",
|
|
707
|
+
start: "Start",
|
|
708
|
+
end: "End",
|
|
709
|
+
clear: "Clear time",
|
|
710
|
+
toggle: "Toggle time picker",
|
|
711
|
+
dialog: "Time picker",
|
|
712
|
+
selectTime: "Select time",
|
|
713
|
+
selectTimeRange: "Select time range"
|
|
714
|
+
};
|
|
715
|
+
function isZhLocale(locale) {
|
|
716
|
+
return (locale ?? "").toLowerCase().startsWith("zh");
|
|
717
|
+
}
|
|
718
|
+
function getTimePickerLabels(locale, overrides) {
|
|
719
|
+
const base = isZhLocale(locale) ? ZH_LABELS : EN_LABELS;
|
|
720
|
+
return { ...base, ...overrides ?? {} };
|
|
721
|
+
}
|
|
722
|
+
function pluralizeEn(value, singular) {
|
|
723
|
+
return value === 1 ? singular : `${singular}s`;
|
|
724
|
+
}
|
|
725
|
+
function getTimePickerOptionAriaLabel(value, unit, locale, labelOverrides) {
|
|
726
|
+
const labels = getTimePickerLabels(locale, labelOverrides);
|
|
727
|
+
if (isZhLocale(locale)) {
|
|
728
|
+
const suffix = unit === "hour" ? labels.hour : unit === "minute" ? labels.minute : labels.second;
|
|
729
|
+
return `${value}${suffix}`;
|
|
275
730
|
}
|
|
276
|
-
|
|
731
|
+
const lc = (locale ?? "").toLowerCase();
|
|
732
|
+
const useEnglishPlural = lc.length === 0 ? labelOverrides == null : lc.startsWith("en");
|
|
733
|
+
if (useEnglishPlural) {
|
|
734
|
+
if (unit === "hour") return `${value} ${pluralizeEn(value, "hour")}`;
|
|
735
|
+
if (unit === "minute") return `${value} ${pluralizeEn(value, "minute")}`;
|
|
736
|
+
return `${value} ${pluralizeEn(value, "second")}`;
|
|
737
|
+
}
|
|
738
|
+
const unitLabel = unit === "hour" ? labels.hour : unit === "minute" ? labels.minute : labels.second;
|
|
739
|
+
return `${value} ${unitLabel}`;
|
|
277
740
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
741
|
+
var timePickerBaseClasses = "relative inline-block w-full max-w-xs";
|
|
742
|
+
var timePickerInputWrapperClasses = "relative flex items-center";
|
|
743
|
+
function getTimePickerInputClasses(size, disabled) {
|
|
744
|
+
const baseClasses = [
|
|
745
|
+
"w-full rounded-md border border-gray-300",
|
|
746
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:border-transparent",
|
|
747
|
+
"transition-colors duration-200",
|
|
748
|
+
"pr-16"
|
|
749
|
+
// Space for clear + clock buttons
|
|
750
|
+
];
|
|
751
|
+
const sizeClasses = {
|
|
752
|
+
sm: "px-2 py-1 text-sm",
|
|
753
|
+
md: "px-3 py-2 text-base",
|
|
754
|
+
lg: "px-4 py-3 text-lg"
|
|
285
755
|
};
|
|
756
|
+
const stateClasses = disabled ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-white text-gray-900 cursor-pointer hover:border-gray-400";
|
|
757
|
+
return [...baseClasses, sizeClasses[size], stateClasses].join(" ");
|
|
286
758
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
759
|
+
function getTimePickerIconButtonClasses(size) {
|
|
760
|
+
const baseClasses = [
|
|
761
|
+
"absolute right-1 flex items-center justify-center",
|
|
762
|
+
"text-gray-400 hover:text-gray-600",
|
|
763
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
764
|
+
"rounded transition-colors duration-200",
|
|
765
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
766
|
+
];
|
|
767
|
+
const sizeClasses = {
|
|
768
|
+
sm: "w-6 h-6",
|
|
769
|
+
md: "w-8 h-8",
|
|
770
|
+
lg: "w-10 h-10"
|
|
771
|
+
};
|
|
772
|
+
return [...baseClasses, sizeClasses[size]].join(" ");
|
|
773
|
+
}
|
|
774
|
+
var timePickerClearButtonClasses = [
|
|
775
|
+
"absolute right-10 flex items-center justify-center",
|
|
776
|
+
"w-6 h-6 text-gray-400 hover:text-gray-600",
|
|
777
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
778
|
+
"rounded transition-colors duration-200"
|
|
779
|
+
].join(" ");
|
|
780
|
+
var timePickerPanelClasses = [
|
|
781
|
+
"absolute z-10 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg",
|
|
782
|
+
"w-max"
|
|
783
|
+
].join(" ");
|
|
784
|
+
var timePickerPanelContentClasses = "flex divide-x divide-gray-200";
|
|
785
|
+
var timePickerRangeHeaderClasses = [
|
|
786
|
+
"px-3 py-2 border-b border-gray-200 bg-gray-50",
|
|
787
|
+
"flex items-center gap-2"
|
|
788
|
+
].join(" ");
|
|
789
|
+
function getTimePickerRangeTabButtonClasses(isActive) {
|
|
790
|
+
const baseClasses = [
|
|
791
|
+
"px-3 py-1 text-xs font-medium rounded",
|
|
792
|
+
"border border-gray-300",
|
|
793
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
794
|
+
"transition-colors duration-150"
|
|
795
|
+
];
|
|
796
|
+
if (isActive) {
|
|
797
|
+
return [...baseClasses, "bg-[var(--tiger-primary,#2563eb)] text-white border-transparent"].join(
|
|
798
|
+
" "
|
|
799
|
+
);
|
|
296
800
|
}
|
|
297
|
-
return
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
801
|
+
return [...baseClasses, "bg-white hover:bg-gray-50 text-gray-700"].join(" ");
|
|
802
|
+
}
|
|
803
|
+
var timePickerColumnClasses = "flex flex-col overflow-hidden shrink-0 w-16";
|
|
804
|
+
var timePickerColumnHeaderClasses = [
|
|
805
|
+
"px-2 py-1 text-xs font-semibold text-gray-500 text-center",
|
|
806
|
+
"bg-gray-50 border-b border-gray-200"
|
|
807
|
+
].join(" ");
|
|
808
|
+
var timePickerColumnListClasses = [
|
|
809
|
+
"overflow-y-auto max-h-48 scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100"
|
|
810
|
+
].join(" ");
|
|
811
|
+
function getTimePickerItemClasses(isSelected, isDisabled) {
|
|
812
|
+
const baseClasses = [
|
|
813
|
+
"w-full px-3 py-1.5 text-sm text-center",
|
|
814
|
+
"hover:bg-gray-100 focus:outline-none focus:bg-gray-100",
|
|
815
|
+
"transition-colors duration-150",
|
|
816
|
+
"cursor-pointer"
|
|
817
|
+
];
|
|
818
|
+
if (isDisabled) {
|
|
819
|
+
return [...baseClasses, "text-gray-300 cursor-not-allowed hover:bg-transparent"].join(" ");
|
|
315
820
|
}
|
|
316
|
-
if (
|
|
317
|
-
|
|
821
|
+
if (isSelected) {
|
|
822
|
+
return [
|
|
823
|
+
...baseClasses,
|
|
824
|
+
"bg-[var(--tiger-primary,#2563eb)] text-white",
|
|
825
|
+
"hover:bg-[var(--tiger-primary-hover,#1d4ed8)]",
|
|
826
|
+
"font-medium"
|
|
827
|
+
].join(" ");
|
|
828
|
+
}
|
|
829
|
+
return [...baseClasses, "text-gray-700"].join(" ");
|
|
318
830
|
}
|
|
319
|
-
function
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
831
|
+
function getTimePickerPeriodButtonClasses(isSelected) {
|
|
832
|
+
const baseClasses = [
|
|
833
|
+
"w-full px-3 py-2 text-sm font-medium text-center",
|
|
834
|
+
"hover:bg-gray-100 focus:outline-none focus:bg-gray-100",
|
|
835
|
+
"transition-colors duration-150",
|
|
836
|
+
"cursor-pointer"
|
|
837
|
+
];
|
|
838
|
+
if (isSelected) {
|
|
839
|
+
return [
|
|
840
|
+
...baseClasses,
|
|
841
|
+
"bg-[var(--tiger-primary,#2563eb)] text-white",
|
|
842
|
+
"hover:bg-[var(--tiger-primary-hover,#1d4ed8)]"
|
|
843
|
+
].join(" ");
|
|
329
844
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
845
|
+
return [...baseClasses, "text-gray-700"].join(" ");
|
|
846
|
+
}
|
|
847
|
+
var timePickerFooterClasses = [
|
|
848
|
+
"px-3 py-2 border-t border-gray-200",
|
|
849
|
+
"flex items-center justify-between gap-2"
|
|
850
|
+
].join(" ");
|
|
851
|
+
var timePickerFooterButtonClasses = [
|
|
852
|
+
"px-3 py-1 text-xs font-medium rounded",
|
|
853
|
+
"border border-gray-300 hover:border-gray-400",
|
|
854
|
+
"bg-white hover:bg-gray-50",
|
|
855
|
+
"text-gray-700",
|
|
856
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
857
|
+
"transition-colors duration-150"
|
|
858
|
+
].join(" ");
|
|
859
|
+
|
|
860
|
+
// src/utils/upload-labels.ts
|
|
861
|
+
function interpolateUploadLabel(template, params) {
|
|
862
|
+
return template.replace(/\{(\w+)\}/g, (_match, key) => {
|
|
863
|
+
const value = params[key];
|
|
864
|
+
return typeof value === "string" ? value : "";
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function getUploadLabels(locale, overrides) {
|
|
868
|
+
return {
|
|
869
|
+
dragAreaAriaLabel: resolveLocaleText(
|
|
870
|
+
"Upload file by clicking or dragging",
|
|
871
|
+
overrides?.dragAreaAriaLabel,
|
|
872
|
+
locale?.upload?.dragAreaAriaLabel
|
|
873
|
+
),
|
|
874
|
+
buttonAriaLabel: resolveLocaleText(
|
|
875
|
+
"Upload file",
|
|
876
|
+
overrides?.buttonAriaLabel,
|
|
877
|
+
locale?.upload?.buttonAriaLabel
|
|
878
|
+
),
|
|
879
|
+
clickToUploadText: resolveLocaleText(
|
|
880
|
+
"Click to upload",
|
|
881
|
+
overrides?.clickToUploadText,
|
|
882
|
+
locale?.upload?.clickToUploadText
|
|
883
|
+
),
|
|
884
|
+
dragAndDropText: resolveLocaleText(
|
|
885
|
+
"or drag and drop",
|
|
886
|
+
overrides?.dragAndDropText,
|
|
887
|
+
locale?.upload?.dragAndDropText
|
|
888
|
+
),
|
|
889
|
+
acceptInfoText: resolveLocaleText(
|
|
890
|
+
"Accepted: {accept}",
|
|
891
|
+
overrides?.acceptInfoText,
|
|
892
|
+
locale?.upload?.acceptInfoText
|
|
893
|
+
),
|
|
894
|
+
maxSizeInfoText: resolveLocaleText(
|
|
895
|
+
"Max size: {maxSize}",
|
|
896
|
+
overrides?.maxSizeInfoText,
|
|
897
|
+
locale?.upload?.maxSizeInfoText
|
|
898
|
+
),
|
|
899
|
+
selectFileText: resolveLocaleText(
|
|
900
|
+
"Select File",
|
|
901
|
+
overrides?.selectFileText,
|
|
902
|
+
locale?.upload?.selectFileText
|
|
903
|
+
),
|
|
904
|
+
uploadedFilesAriaLabel: resolveLocaleText(
|
|
905
|
+
"Uploaded files",
|
|
906
|
+
overrides?.uploadedFilesAriaLabel,
|
|
907
|
+
locale?.upload?.uploadedFilesAriaLabel
|
|
908
|
+
),
|
|
909
|
+
successAriaLabel: resolveLocaleText(
|
|
910
|
+
"Success",
|
|
911
|
+
overrides?.successAriaLabel,
|
|
912
|
+
locale?.upload?.successAriaLabel
|
|
913
|
+
),
|
|
914
|
+
errorAriaLabel: resolveLocaleText(
|
|
915
|
+
"Error",
|
|
916
|
+
overrides?.errorAriaLabel,
|
|
917
|
+
locale?.upload?.errorAriaLabel
|
|
918
|
+
),
|
|
919
|
+
uploadingAriaLabel: resolveLocaleText(
|
|
920
|
+
"Uploading",
|
|
921
|
+
overrides?.uploadingAriaLabel,
|
|
922
|
+
locale?.upload?.uploadingAriaLabel
|
|
923
|
+
),
|
|
924
|
+
removeFileAriaLabel: resolveLocaleText(
|
|
925
|
+
"Remove {fileName}",
|
|
926
|
+
overrides?.removeFileAriaLabel,
|
|
927
|
+
locale?.upload?.removeFileAriaLabel
|
|
928
|
+
),
|
|
929
|
+
previewFileAriaLabel: resolveLocaleText(
|
|
930
|
+
"Preview {fileName}",
|
|
931
|
+
overrides?.previewFileAriaLabel,
|
|
932
|
+
locale?.upload?.previewFileAriaLabel
|
|
933
|
+
)
|
|
934
|
+
};
|
|
333
935
|
}
|
|
334
936
|
|
|
937
|
+
// src/utils/interaction-styles.ts
|
|
938
|
+
var focusRingClasses = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--tiger-surface,#ffffff)]";
|
|
939
|
+
var focusRingInsetClasses = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-inset";
|
|
940
|
+
var activePressClasses = "active:scale-[0.98] active:transition-transform";
|
|
941
|
+
var activeOpacityClasses = "active:opacity-90";
|
|
942
|
+
var interactiveClasses = `transition-all duration-150 ${focusRingClasses} ${activePressClasses}`;
|
|
943
|
+
var inputFocusClasses = "focus:outline-none focus:ring-2 focus:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus:border-transparent";
|
|
944
|
+
var tabFocusClasses = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-offset-2";
|
|
945
|
+
var menuItemFocusClasses = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-inset";
|
|
946
|
+
|
|
335
947
|
// src/utils/button-utils.ts
|
|
336
|
-
var buttonBaseClasses = "inline-flex items-center justify-center font-medium rounded-md transition-
|
|
948
|
+
var buttonBaseClasses = "inline-flex items-center justify-center font-medium rounded-md transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] active:scale-[0.98]";
|
|
337
949
|
var buttonSizeClasses = {
|
|
338
950
|
sm: "px-3 py-1.5 text-sm",
|
|
339
951
|
md: "px-4 py-2 text-base",
|
|
@@ -341,94 +953,6 @@ var buttonSizeClasses = {
|
|
|
341
953
|
};
|
|
342
954
|
var buttonDisabledClasses = "cursor-not-allowed opacity-60";
|
|
343
955
|
|
|
344
|
-
// src/utils/select-utils.ts
|
|
345
|
-
var selectBaseClasses = "relative inline-block w-full";
|
|
346
|
-
var SELECT_TRIGGER_BASE_CLASSES = [
|
|
347
|
-
"w-full",
|
|
348
|
-
"flex",
|
|
349
|
-
"items-center",
|
|
350
|
-
"justify-between",
|
|
351
|
-
"gap-2",
|
|
352
|
-
"px-3",
|
|
353
|
-
"py-2",
|
|
354
|
-
"bg-[var(--tiger-select-trigger-bg,var(--tiger-surface,#ffffff))]",
|
|
355
|
-
"border",
|
|
356
|
-
"border-[var(--tiger-select-trigger-border,var(--tiger-border,#d1d5db))]",
|
|
357
|
-
"text-[var(--tiger-select-trigger-text,var(--tiger-text,#111827))]",
|
|
358
|
-
"rounded-md",
|
|
359
|
-
"shadow-sm",
|
|
360
|
-
"cursor-pointer",
|
|
361
|
-
"transition-colors",
|
|
362
|
-
"focus:outline-none",
|
|
363
|
-
"focus:ring-2",
|
|
364
|
-
"focus:ring-[var(--tiger-select-ring,var(--tiger-primary,#2563eb))]",
|
|
365
|
-
"focus:border-[var(--tiger-select-trigger-border-focus,var(--tiger-primary,#2563eb))]"
|
|
366
|
-
];
|
|
367
|
-
var SELECT_TRIGGER_DISABLED_CLASSES_STRING = [
|
|
368
|
-
"disabled:bg-[var(--tiger-select-trigger-bg-disabled,var(--tiger-surface-muted,#f3f4f6))]",
|
|
369
|
-
"disabled:text-[var(--tiger-select-trigger-text-disabled,var(--tiger-text-muted,#6b7280))]",
|
|
370
|
-
"disabled:cursor-not-allowed",
|
|
371
|
-
"disabled:border-[var(--tiger-select-trigger-border-disabled,var(--tiger-border,#e5e7eb))]"
|
|
372
|
-
].join(" ");
|
|
373
|
-
var selectDropdownBaseClasses = "absolute z-50 w-full mt-1 bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))] border border-[var(--tiger-select-dropdown-border,var(--tiger-border,#e5e7eb))] rounded-md shadow-lg max-h-60 overflow-auto";
|
|
374
|
-
var selectOptionBaseClasses = "w-full px-3 py-2 text-left cursor-pointer transition-colors text-[var(--tiger-select-option-text,var(--tiger-text,#111827))] hover:bg-[var(--tiger-select-option-bg-hover,var(--tiger-outline-bg-hover,#eff6ff))]";
|
|
375
|
-
var selectOptionSelectedClasses = "bg-[var(--tiger-select-option-bg-selected,var(--tiger-outline-bg-hover,#eff6ff))] text-[var(--tiger-select-option-text-selected,var(--tiger-primary,#2563eb))] font-medium";
|
|
376
|
-
var selectOptionDisabledClasses = "opacity-50 cursor-not-allowed hover:bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))]";
|
|
377
|
-
var selectGroupLabelClasses = "px-3 py-2 text-xs font-semibold text-[var(--tiger-select-group-label-text,var(--tiger-text-muted,#6b7280))] uppercase bg-[var(--tiger-select-group-label-bg,var(--tiger-surface-muted,#f9fafb))]";
|
|
378
|
-
var selectSearchInputClasses = "w-full px-3 py-2 bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))] text-[var(--tiger-select-search-text,var(--tiger-text,#111827))] placeholder:text-[var(--tiger-select-search-placeholder,var(--tiger-text-muted,#9ca3af))] border-b border-[var(--tiger-select-dropdown-border,var(--tiger-border,#e5e7eb))] focus:outline-none focus:ring-0";
|
|
379
|
-
var selectEmptyStateClasses = "px-3 py-8 text-center text-[var(--tiger-select-empty-text,var(--tiger-text-muted,#6b7280))] text-sm";
|
|
380
|
-
var SELECT_SIZE_CLASSES = {
|
|
381
|
-
sm: "text-sm py-1.5",
|
|
382
|
-
md: "text-base py-2",
|
|
383
|
-
lg: "text-lg py-2.5"
|
|
384
|
-
};
|
|
385
|
-
function getSelectSizeClasses(size) {
|
|
386
|
-
return SELECT_SIZE_CLASSES[size];
|
|
387
|
-
}
|
|
388
|
-
function getSelectTriggerClasses(size, disabled, isOpen) {
|
|
389
|
-
return classNames(
|
|
390
|
-
...SELECT_TRIGGER_BASE_CLASSES,
|
|
391
|
-
getSelectSizeClasses(size),
|
|
392
|
-
disabled && SELECT_TRIGGER_DISABLED_CLASSES_STRING,
|
|
393
|
-
isOpen && "ring-2 ring-[var(--tiger-select-ring,var(--tiger-primary,#2563eb))] border-[var(--tiger-select-trigger-border-focus,var(--tiger-primary,#2563eb))]"
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
function getSelectOptionClasses(isSelected, isDisabled, size) {
|
|
397
|
-
return classNames(
|
|
398
|
-
selectOptionBaseClasses,
|
|
399
|
-
getSelectSizeClasses(size),
|
|
400
|
-
isSelected && selectOptionSelectedClasses,
|
|
401
|
-
isDisabled && selectOptionDisabledClasses
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
function isOptionGroup(option) {
|
|
405
|
-
return !!option && typeof option === "object" && "options" in option && Array.isArray(option.options);
|
|
406
|
-
}
|
|
407
|
-
function filterOptions(options, query) {
|
|
408
|
-
if (!query) {
|
|
409
|
-
return options;
|
|
410
|
-
}
|
|
411
|
-
const searchLower = query.toLowerCase();
|
|
412
|
-
return options.reduce((filtered, option) => {
|
|
413
|
-
if (isOptionGroup(option)) {
|
|
414
|
-
const filteredGroupOptions = option.options.filter(
|
|
415
|
-
(opt) => opt.label.toLowerCase().includes(searchLower)
|
|
416
|
-
);
|
|
417
|
-
if (filteredGroupOptions.length > 0) {
|
|
418
|
-
filtered.push({
|
|
419
|
-
...option,
|
|
420
|
-
options: filteredGroupOptions
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
} else {
|
|
424
|
-
if (option.label.toLowerCase().includes(searchLower)) {
|
|
425
|
-
filtered.push(option);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return filtered;
|
|
429
|
-
}, []);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
956
|
// src/utils/input-styles.ts
|
|
433
957
|
var BASE_INPUT_CLASSES = [
|
|
434
958
|
"w-full",
|
|
@@ -513,35 +1037,95 @@ function getInputErrorClasses(size = "md") {
|
|
|
513
1037
|
);
|
|
514
1038
|
}
|
|
515
1039
|
|
|
516
|
-
// src/utils/
|
|
517
|
-
var
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
1040
|
+
// src/utils/select-utils.ts
|
|
1041
|
+
var selectBaseClasses = "relative inline-block w-full";
|
|
1042
|
+
var SELECT_TRIGGER_BASE_CLASSES = [
|
|
1043
|
+
"w-full",
|
|
1044
|
+
"flex",
|
|
1045
|
+
"items-center",
|
|
1046
|
+
"justify-between",
|
|
1047
|
+
"gap-2",
|
|
1048
|
+
"px-3",
|
|
1049
|
+
"py-2",
|
|
1050
|
+
"bg-[var(--tiger-select-trigger-bg,var(--tiger-surface,#ffffff))]",
|
|
1051
|
+
"border",
|
|
1052
|
+
"border-[var(--tiger-select-trigger-border,var(--tiger-border,#d1d5db))]",
|
|
1053
|
+
"text-[var(--tiger-select-trigger-text,var(--tiger-text,#111827))]",
|
|
1054
|
+
"rounded-md",
|
|
1055
|
+
"shadow-sm",
|
|
1056
|
+
"cursor-pointer",
|
|
1057
|
+
"transition-all",
|
|
1058
|
+
"duration-150",
|
|
1059
|
+
"focus:outline-none",
|
|
1060
|
+
"focus-visible:ring-2",
|
|
1061
|
+
"focus-visible:ring-[var(--tiger-select-ring,var(--tiger-primary,#2563eb))]",
|
|
1062
|
+
"focus-visible:border-[var(--tiger-select-trigger-border-focus,var(--tiger-primary,#2563eb))]",
|
|
1063
|
+
"active:scale-[0.99]"
|
|
1064
|
+
];
|
|
1065
|
+
var SELECT_TRIGGER_DISABLED_CLASSES_STRING = [
|
|
1066
|
+
"disabled:bg-[var(--tiger-select-trigger-bg-disabled,var(--tiger-surface-muted,#f3f4f6))]",
|
|
1067
|
+
"disabled:text-[var(--tiger-select-trigger-text-disabled,var(--tiger-text-muted,#6b7280))]",
|
|
1068
|
+
"disabled:cursor-not-allowed",
|
|
1069
|
+
"disabled:border-[var(--tiger-select-trigger-border-disabled,var(--tiger-border,#e5e7eb))]"
|
|
1070
|
+
].join(" ");
|
|
1071
|
+
var selectDropdownBaseClasses = "absolute z-50 w-full mt-1 bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))] border border-[var(--tiger-select-dropdown-border,var(--tiger-border,#e5e7eb))] rounded-md shadow-lg max-h-60 overflow-auto";
|
|
1072
|
+
var selectOptionBaseClasses = "w-full px-3 py-2 text-left cursor-pointer transition-colors text-[var(--tiger-select-option-text,var(--tiger-text,#111827))] hover:bg-[var(--tiger-select-option-bg-hover,var(--tiger-outline-bg-hover,#eff6ff))]";
|
|
1073
|
+
var selectOptionSelectedClasses = "bg-[var(--tiger-select-option-bg-selected,var(--tiger-outline-bg-hover,#eff6ff))] text-[var(--tiger-select-option-text-selected,var(--tiger-primary,#2563eb))] font-medium";
|
|
1074
|
+
var selectOptionDisabledClasses = "opacity-50 cursor-not-allowed hover:bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))]";
|
|
1075
|
+
var selectGroupLabelClasses = "px-3 py-2 text-xs font-semibold text-[var(--tiger-select-group-label-text,var(--tiger-text-muted,#6b7280))] uppercase bg-[var(--tiger-select-group-label-bg,var(--tiger-surface-muted,#f9fafb))]";
|
|
1076
|
+
var selectSearchInputClasses = "w-full px-3 py-2 bg-[var(--tiger-select-dropdown-bg,var(--tiger-surface,#ffffff))] text-[var(--tiger-select-search-text,var(--tiger-text,#111827))] placeholder:text-[var(--tiger-select-search-placeholder,var(--tiger-text-muted,#9ca3af))] border-b border-[var(--tiger-select-dropdown-border,var(--tiger-border,#e5e7eb))] focus:outline-none focus:ring-0";
|
|
1077
|
+
var selectEmptyStateClasses = "px-3 py-8 text-center text-[var(--tiger-select-empty-text,var(--tiger-text-muted,#6b7280))] text-sm";
|
|
1078
|
+
var SELECT_SIZE_CLASSES = {
|
|
1079
|
+
sm: "text-sm py-1.5",
|
|
1080
|
+
md: "text-base py-2",
|
|
1081
|
+
lg: "text-lg py-2.5"
|
|
1082
|
+
};
|
|
1083
|
+
function getSelectSizeClasses(size) {
|
|
1084
|
+
return SELECT_SIZE_CLASSES[size];
|
|
524
1085
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1086
|
+
function getSelectTriggerClasses(size, disabled, isOpen) {
|
|
1087
|
+
return classNames(
|
|
1088
|
+
...SELECT_TRIGGER_BASE_CLASSES,
|
|
1089
|
+
getSelectSizeClasses(size),
|
|
1090
|
+
disabled && SELECT_TRIGGER_DISABLED_CLASSES_STRING,
|
|
1091
|
+
isOpen && "ring-2 ring-[var(--tiger-select-ring,var(--tiger-primary,#2563eb))] border-[var(--tiger-select-trigger-border-focus,var(--tiger-primary,#2563eb))]"
|
|
1092
|
+
);
|
|
528
1093
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
1094
|
+
function getSelectOptionClasses(isSelected, isDisabled, size) {
|
|
1095
|
+
return classNames(
|
|
1096
|
+
selectOptionBaseClasses,
|
|
1097
|
+
getSelectSizeClasses(size),
|
|
1098
|
+
isSelected && selectOptionSelectedClasses,
|
|
1099
|
+
isDisabled && selectOptionDisabledClasses
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
function isOptionGroup(option) {
|
|
1103
|
+
return !!option && typeof option === "object" && "options" in option && Array.isArray(option.options);
|
|
1104
|
+
}
|
|
1105
|
+
function filterOptions(options, query) {
|
|
1106
|
+
if (!query) {
|
|
1107
|
+
return options;
|
|
537
1108
|
}
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
1109
|
+
const searchLower = query.toLowerCase();
|
|
1110
|
+
return options.reduce((filtered, option) => {
|
|
1111
|
+
if (isOptionGroup(option)) {
|
|
1112
|
+
const filteredGroupOptions = option.options.filter(
|
|
1113
|
+
(opt) => opt.label.toLowerCase().includes(searchLower)
|
|
1114
|
+
);
|
|
1115
|
+
if (filteredGroupOptions.length > 0) {
|
|
1116
|
+
filtered.push({
|
|
1117
|
+
...option,
|
|
1118
|
+
options: filteredGroupOptions
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
} else {
|
|
1122
|
+
if (option.label.toLowerCase().includes(searchLower)) {
|
|
1123
|
+
filtered.push(option);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
return filtered;
|
|
1127
|
+
}, []);
|
|
543
1128
|
}
|
|
544
|
-
var SHAKE_CLASS = "tiger-animate-shake";
|
|
545
1129
|
|
|
546
1130
|
// src/utils/textarea-auto-resize.ts
|
|
547
1131
|
function autoResizeTextarea(textarea, { minRows, maxRows } = {}) {
|
|
@@ -754,206 +1338,69 @@ function getErrorFields(errors) {
|
|
|
754
1338
|
return errors.map((error) => error.field);
|
|
755
1339
|
}
|
|
756
1340
|
|
|
757
|
-
// src/utils/
|
|
758
|
-
var
|
|
759
|
-
var
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
function toPercentage(value) {
|
|
781
|
-
return (value / 24 * 100).toFixed(6).replace(/\.?0+$/, "");
|
|
782
|
-
}
|
|
783
|
-
var colSpanClasses = "w-[var(--tiger-col-span)] sm:w-[var(--tiger-col-span-sm,var(--tiger-col-span))] md:w-[var(--tiger-col-span-md,var(--tiger-col-span))] lg:w-[var(--tiger-col-span-lg,var(--tiger-col-span))] xl:w-[var(--tiger-col-span-xl,var(--tiger-col-span))] 2xl:w-[var(--tiger-col-span-2xl,var(--tiger-col-span))]";
|
|
784
|
-
var colOffsetClasses = "ml-[var(--tiger-col-offset)] sm:ml-[var(--tiger-col-offset-sm,var(--tiger-col-offset))] md:ml-[var(--tiger-col-offset-md,var(--tiger-col-offset))] lg:ml-[var(--tiger-col-offset-lg,var(--tiger-col-offset))] xl:ml-[var(--tiger-col-offset-xl,var(--tiger-col-offset))] 2xl:ml-[var(--tiger-col-offset-2xl,var(--tiger-col-offset))]";
|
|
785
|
-
var colFlexClasses = "flex-[var(--tiger-col-flex)]";
|
|
786
|
-
var colOrderClasses = "order-[var(--tiger-col-order)] sm:order-[var(--tiger-col-order-sm,var(--tiger-col-order))] md:order-[var(--tiger-col-order-md,var(--tiger-col-order))] lg:order-[var(--tiger-col-order-lg,var(--tiger-col-order))] xl:order-[var(--tiger-col-order-xl,var(--tiger-col-order))] 2xl:order-[var(--tiger-col-order-2xl,var(--tiger-col-order))]";
|
|
787
|
-
function hasNonZeroOffset(offset) {
|
|
788
|
-
if (typeof offset === "number") return offset !== 0;
|
|
789
|
-
return BREAKPOINT_ORDER.some((bp) => (offset[bp] ?? 0) !== 0);
|
|
790
|
-
}
|
|
791
|
-
function setSpanVars(vars, span) {
|
|
792
|
-
if (typeof span === "number") {
|
|
793
|
-
if (validateGridValue(span, "span")) vars["--tiger-col-span"] = `${toPercentage(span)}%`;
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
vars["--tiger-col-span"] = "100%";
|
|
797
|
-
BREAKPOINT_ORDER.forEach((bp) => {
|
|
798
|
-
const value = span[bp];
|
|
799
|
-
if (value === void 0) return;
|
|
800
|
-
if (!validateGridValue(value, `span.${bp}`)) return;
|
|
801
|
-
const percentage = `${toPercentage(value)}%`;
|
|
802
|
-
if (bp === "xs") {
|
|
803
|
-
vars["--tiger-col-span"] = percentage;
|
|
804
|
-
return;
|
|
805
|
-
}
|
|
806
|
-
vars[`--tiger-col-span-${bp}`] = percentage;
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
|
-
function setOffsetVars(vars, offset) {
|
|
810
|
-
if (typeof offset === "number") {
|
|
811
|
-
if (offset === 0) return;
|
|
812
|
-
if (validateGridValue(offset, "offset")) vars["--tiger-col-offset"] = `${toPercentage(offset)}%`;
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
vars["--tiger-col-offset"] = "0%";
|
|
816
|
-
BREAKPOINT_ORDER.forEach((bp) => {
|
|
817
|
-
const value = offset[bp];
|
|
818
|
-
if (value === void 0) return;
|
|
819
|
-
if (value === 0) return;
|
|
820
|
-
if (!validateGridValue(value, `offset.${bp}`)) return;
|
|
821
|
-
const percentage = `${toPercentage(value)}%`;
|
|
822
|
-
if (bp === "xs") {
|
|
823
|
-
vars["--tiger-col-offset"] = percentage;
|
|
824
|
-
return;
|
|
825
|
-
}
|
|
826
|
-
vars[`--tiger-col-offset-${bp}`] = percentage;
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
function getColStyleVars(span, offset) {
|
|
830
|
-
const vars = {};
|
|
831
|
-
if (span !== void 0 && span !== null) setSpanVars(vars, span);
|
|
832
|
-
if (offset !== void 0 && offset !== null) setOffsetVars(vars, offset);
|
|
833
|
-
return vars;
|
|
834
|
-
}
|
|
835
|
-
function setOrderVars(vars, order) {
|
|
836
|
-
if (typeof order === "number") {
|
|
837
|
-
vars["--tiger-col-order"] = String(order);
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
vars["--tiger-col-order"] = "0";
|
|
841
|
-
BREAKPOINT_ORDER.forEach((bp) => {
|
|
842
|
-
const value = order[bp];
|
|
843
|
-
if (value === void 0) return;
|
|
844
|
-
if (bp === "xs") {
|
|
845
|
-
vars["--tiger-col-order"] = String(value);
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
vars[`--tiger-col-order-${bp}`] = String(value);
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
function getColOrderStyleVars(order) {
|
|
852
|
-
if (order === void 0 || order === null) return {};
|
|
853
|
-
const vars = {};
|
|
854
|
-
setOrderVars(vars, order);
|
|
855
|
-
return vars;
|
|
856
|
-
}
|
|
857
|
-
function getAlignClasses(align) {
|
|
858
|
-
return ALIGN_MAP[align] || "items-start";
|
|
859
|
-
}
|
|
860
|
-
function getJustifyClasses(justify) {
|
|
861
|
-
return JUSTIFY_MAP[justify] || "justify-start";
|
|
862
|
-
}
|
|
863
|
-
function getGutterStyles(gutter) {
|
|
864
|
-
if (gutter === void 0 || gutter === null || gutter === 0) return {};
|
|
865
|
-
const [horizontal, vertical] = Array.isArray(gutter) ? gutter : [gutter, gutter];
|
|
866
|
-
const rowStyle = {};
|
|
867
|
-
const colStyle = {};
|
|
868
|
-
if (horizontal > 0) {
|
|
869
|
-
rowStyle.marginLeft = `-${horizontal / 2}px`;
|
|
870
|
-
rowStyle.marginRight = `-${horizontal / 2}px`;
|
|
871
|
-
colStyle.paddingLeft = `${horizontal / 2}px`;
|
|
872
|
-
colStyle.paddingRight = `${horizontal / 2}px`;
|
|
873
|
-
}
|
|
874
|
-
if (vertical > 0) {
|
|
875
|
-
rowStyle.marginTop = `-${vertical / 2}px`;
|
|
876
|
-
rowStyle.marginBottom = `-${vertical / 2}px`;
|
|
877
|
-
colStyle.paddingTop = `${vertical / 2}px`;
|
|
878
|
-
colStyle.paddingBottom = `${vertical / 2}px`;
|
|
1341
|
+
// src/utils/radio-utils.ts
|
|
1342
|
+
var radioRootBaseClasses = "inline-flex items-center";
|
|
1343
|
+
var radioVisualBaseClasses = "relative inline-flex items-center justify-center rounded-full border-2 cursor-pointer transition-all";
|
|
1344
|
+
var radioFocusVisibleClasses = "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-[var(--tiger-primary,#2563eb)] peer-focus-visible:ring-offset-[var(--tiger-surface,#ffffff)]";
|
|
1345
|
+
var radioDotBaseClasses = "rounded-full transition-all";
|
|
1346
|
+
var radioLabelBaseClasses = "ml-2 cursor-pointer select-none";
|
|
1347
|
+
var radioDisabledCursorClasses = "cursor-not-allowed";
|
|
1348
|
+
var radioHoverBorderClasses = "hover:border-[var(--tiger-primary,#2563eb)]";
|
|
1349
|
+
var radioSizeClasses = {
|
|
1350
|
+
sm: {
|
|
1351
|
+
radio: "w-4 h-4",
|
|
1352
|
+
dot: "w-1.5 h-1.5",
|
|
1353
|
+
label: "text-sm"
|
|
1354
|
+
},
|
|
1355
|
+
md: {
|
|
1356
|
+
radio: "w-5 h-5",
|
|
1357
|
+
dot: "w-2 h-2",
|
|
1358
|
+
label: "text-base"
|
|
1359
|
+
},
|
|
1360
|
+
lg: {
|
|
1361
|
+
radio: "w-6 h-6",
|
|
1362
|
+
dot: "w-2.5 h-2.5",
|
|
1363
|
+
label: "text-lg"
|
|
879
1364
|
}
|
|
880
|
-
return { rowStyle, colStyle };
|
|
881
|
-
}
|
|
882
|
-
function getSpanClasses(span) {
|
|
883
|
-
if (span === void 0 || span === null) return "w-full";
|
|
884
|
-
return colSpanClasses;
|
|
885
|
-
}
|
|
886
|
-
function getOffsetClasses(offset) {
|
|
887
|
-
if (offset === void 0 || offset === null) return "";
|
|
888
|
-
if (!hasNonZeroOffset(offset)) return "";
|
|
889
|
-
return colOffsetClasses;
|
|
890
|
-
}
|
|
891
|
-
function getOrderClasses(order) {
|
|
892
|
-
if (order === void 0) return "";
|
|
893
|
-
return colOrderClasses;
|
|
894
|
-
}
|
|
895
|
-
function getFlexClasses(flex) {
|
|
896
|
-
if (flex === void 0) return "";
|
|
897
|
-
return colFlexClasses;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
// src/utils/divider.ts
|
|
901
|
-
var SPACING_MAP = {
|
|
902
|
-
none: { horizontal: "", vertical: "" },
|
|
903
|
-
xs: { horizontal: "my-1", vertical: "mx-1" },
|
|
904
|
-
sm: { horizontal: "my-2", vertical: "mx-2" },
|
|
905
|
-
md: { horizontal: "my-4", vertical: "mx-4" },
|
|
906
|
-
lg: { horizontal: "my-6", vertical: "mx-6" },
|
|
907
|
-
xl: { horizontal: "my-8", vertical: "mx-8" }
|
|
908
|
-
};
|
|
909
|
-
var LINE_STYLE_MAP = {
|
|
910
|
-
solid: "border-solid",
|
|
911
|
-
dashed: "border-dashed",
|
|
912
|
-
dotted: "border-dotted"
|
|
913
|
-
};
|
|
914
|
-
var DEFAULT_BORDER_COLOR_CLASS = "border-[var(--tiger-border,#e5e7eb)]";
|
|
915
|
-
function getDividerSpacingClasses(spacing, orientation) {
|
|
916
|
-
return SPACING_MAP[spacing][orientation];
|
|
917
|
-
}
|
|
918
|
-
function getDividerLineStyleClasses(lineStyle) {
|
|
919
|
-
return LINE_STYLE_MAP[lineStyle];
|
|
920
|
-
}
|
|
921
|
-
function getDividerOrientationClasses(orientation) {
|
|
922
|
-
return orientation === "horizontal" ? `w-full border-t ${DEFAULT_BORDER_COLOR_CLASS}` : `h-full border-l ${DEFAULT_BORDER_COLOR_CLASS}`;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
// src/utils/layout-utils.ts
|
|
926
|
-
var layoutRootClasses = "tiger-layout flex flex-col min-h-screen";
|
|
927
|
-
var layoutHeaderClasses = "tiger-header bg-[var(--tiger-surface,#ffffff)] border-b border-[var(--tiger-border,#e5e7eb)]";
|
|
928
|
-
var layoutSidebarClasses = "tiger-sidebar bg-[var(--tiger-surface,#ffffff)] border-r border-[var(--tiger-border,#e5e7eb)] transition-all duration-300";
|
|
929
|
-
var layoutContentClasses = "tiger-content flex-1 bg-[var(--tiger-layout-content-bg,#f9fafb)] p-6";
|
|
930
|
-
var layoutFooterClasses = "tiger-footer bg-[var(--tiger-surface,#ffffff)] border-t border-[var(--tiger-border,#e5e7eb)] p-4";
|
|
931
|
-
|
|
932
|
-
// src/utils/container-utils.ts
|
|
933
|
-
var containerBaseClasses = "w-full";
|
|
934
|
-
var containerCenteredClasses = "mx-auto";
|
|
935
|
-
var containerPaddingClasses = "px-4 sm:px-6 lg:px-8";
|
|
936
|
-
var containerMaxWidthClasses = {
|
|
937
|
-
sm: "max-w-screen-sm",
|
|
938
|
-
md: "max-w-screen-md",
|
|
939
|
-
lg: "max-w-screen-lg",
|
|
940
|
-
xl: "max-w-screen-xl",
|
|
941
|
-
"2xl": "max-w-screen-2xl",
|
|
942
|
-
full: "w-full"
|
|
943
1365
|
};
|
|
944
|
-
var
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1366
|
+
var getRadioVisualClasses = ({
|
|
1367
|
+
size,
|
|
1368
|
+
checked,
|
|
1369
|
+
disabled,
|
|
1370
|
+
colors
|
|
1371
|
+
}) => classNames(
|
|
1372
|
+
radioVisualBaseClasses,
|
|
1373
|
+
radioFocusVisibleClasses,
|
|
1374
|
+
radioSizeClasses[size].radio,
|
|
1375
|
+
checked ? colors.borderChecked : colors.border,
|
|
1376
|
+
checked ? colors.bgChecked : colors.bg,
|
|
1377
|
+
disabled && colors.disabled,
|
|
1378
|
+
disabled && radioDisabledCursorClasses,
|
|
1379
|
+
!disabled && radioHoverBorderClasses
|
|
1380
|
+
);
|
|
1381
|
+
var getRadioDotClasses = ({ size, checked, colors }) => classNames(
|
|
1382
|
+
radioDotBaseClasses,
|
|
1383
|
+
radioSizeClasses[size].dot,
|
|
1384
|
+
colors.innerDot,
|
|
1385
|
+
checked ? "scale-100" : "scale-0"
|
|
1386
|
+
);
|
|
1387
|
+
var getRadioLabelClasses = ({ size, disabled, colors }) => classNames(
|
|
1388
|
+
radioLabelBaseClasses,
|
|
1389
|
+
radioSizeClasses[size].label,
|
|
1390
|
+
disabled ? colors.textDisabled : "text-[var(--tiger-text,#111827)]",
|
|
1391
|
+
disabled && radioDisabledCursorClasses
|
|
955
1392
|
);
|
|
956
1393
|
|
|
1394
|
+
// src/utils/radio-group-utils.ts
|
|
1395
|
+
var radioGroupDefaultClasses = "space-y-2";
|
|
1396
|
+
var getRadioGroupClasses = ({
|
|
1397
|
+
className,
|
|
1398
|
+
hasCustomClass
|
|
1399
|
+
} = {}) => {
|
|
1400
|
+
const effectiveHasCustomClass = hasCustomClass ?? !!className;
|
|
1401
|
+
return classNames(className, !effectiveHasCustomClass && radioGroupDefaultClasses);
|
|
1402
|
+
};
|
|
1403
|
+
|
|
957
1404
|
// src/utils/date-utils.ts
|
|
958
1405
|
function isValidDate(value) {
|
|
959
1406
|
if (!value) return false;
|
|
@@ -1282,64 +1729,6 @@ var datePickerFooterButtonClasses = classNames(
|
|
|
1282
1729
|
"duration-150"
|
|
1283
1730
|
);
|
|
1284
1731
|
|
|
1285
|
-
// src/utils/common-icons.ts
|
|
1286
|
-
var closeIconViewBox = "0 0 24 24";
|
|
1287
|
-
var closeIconPathD = "M6 18L18 6M6 6l12 12";
|
|
1288
|
-
var closeIconPathStrokeLinecap = "round";
|
|
1289
|
-
var closeIconPathStrokeLinejoin = "round";
|
|
1290
|
-
var closeIconPathStrokeWidth = 2;
|
|
1291
|
-
var icon24ViewBox = "0 0 24 24";
|
|
1292
|
-
var icon24PathStrokeLinecap = "round";
|
|
1293
|
-
var icon24PathStrokeLinejoin = "round";
|
|
1294
|
-
var icon24StrokeWidth = 2;
|
|
1295
|
-
var icon20ViewBox = "0 0 20 20";
|
|
1296
|
-
var closeSolidIcon20PathD = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z";
|
|
1297
|
-
var calendarSolidIcon20PathD = "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z";
|
|
1298
|
-
var clockSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z";
|
|
1299
|
-
var chevronLeftSolidIcon20PathD = "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z";
|
|
1300
|
-
var chevronRightSolidIcon20PathD = "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z";
|
|
1301
|
-
var successCircleSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z";
|
|
1302
|
-
var errorCircleSolidIcon20PathD = "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z";
|
|
1303
|
-
var statusSuccessIconPath = "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
1304
|
-
var statusWarningIconPath = "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z";
|
|
1305
|
-
var statusErrorIconPath = "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
1306
|
-
var statusInfoIconPath = "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
1307
|
-
var statusIconPaths = {
|
|
1308
|
-
success: statusSuccessIconPath,
|
|
1309
|
-
warning: statusWarningIconPath,
|
|
1310
|
-
error: statusErrorIconPath,
|
|
1311
|
-
info: statusInfoIconPath
|
|
1312
|
-
};
|
|
1313
|
-
|
|
1314
|
-
// src/utils/datepicker-icons.ts
|
|
1315
|
-
var CalendarIconPath = calendarSolidIcon20PathD;
|
|
1316
|
-
var CloseIconPath = closeSolidIcon20PathD;
|
|
1317
|
-
var ChevronLeftIconPath = chevronLeftSolidIcon20PathD;
|
|
1318
|
-
var ChevronRightIconPath = chevronRightSolidIcon20PathD;
|
|
1319
|
-
|
|
1320
|
-
// src/utils/datepicker-i18n.ts
|
|
1321
|
-
function getDatePickerLabels(locale, overrides) {
|
|
1322
|
-
const lc = (locale ?? "").toLowerCase();
|
|
1323
|
-
const base = lc.startsWith("zh") ? {
|
|
1324
|
-
today: "\u4ECA\u5929",
|
|
1325
|
-
ok: "\u786E\u5B9A",
|
|
1326
|
-
calendar: "\u65E5\u5386",
|
|
1327
|
-
toggleCalendar: "\u6253\u5F00\u65E5\u5386",
|
|
1328
|
-
clearDate: "\u6E05\u9664\u65E5\u671F",
|
|
1329
|
-
previousMonth: "\u4E0A\u4E2A\u6708",
|
|
1330
|
-
nextMonth: "\u4E0B\u4E2A\u6708"
|
|
1331
|
-
} : {
|
|
1332
|
-
today: "Today",
|
|
1333
|
-
ok: "OK",
|
|
1334
|
-
calendar: "Calendar",
|
|
1335
|
-
toggleCalendar: "Toggle calendar",
|
|
1336
|
-
clearDate: "Clear date",
|
|
1337
|
-
previousMonth: "Previous month",
|
|
1338
|
-
nextMonth: "Next month"
|
|
1339
|
-
};
|
|
1340
|
-
return { ...base, ...overrides ?? {} };
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
1732
|
// src/utils/time-utils.ts
|
|
1344
1733
|
function isValidTimeValue(value, min, max) {
|
|
1345
1734
|
return !isNaN(value) && value >= min && value <= max;
|
|
@@ -1467,191 +1856,11 @@ function generateSeconds(step = 1) {
|
|
|
1467
1856
|
for (let i = 0; i < 60; i += validStep) {
|
|
1468
1857
|
seconds.push(i);
|
|
1469
1858
|
}
|
|
1470
|
-
return seconds;
|
|
1471
|
-
}
|
|
1472
|
-
function getCurrentTime(showSeconds = false) {
|
|
1473
|
-
const now = /* @__PURE__ */ new Date();
|
|
1474
|
-
return formatTime(now.getHours(), now.getMinutes(), now.getSeconds(), showSeconds);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
// src/utils/timepicker-styles.ts
|
|
1478
|
-
var timePickerBaseClasses = "relative inline-block w-full max-w-xs";
|
|
1479
|
-
var timePickerInputWrapperClasses = "relative flex items-center";
|
|
1480
|
-
function getTimePickerInputClasses(size, disabled) {
|
|
1481
|
-
const baseClasses = [
|
|
1482
|
-
"w-full rounded-md border border-gray-300",
|
|
1483
|
-
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:border-transparent",
|
|
1484
|
-
"transition-colors duration-200",
|
|
1485
|
-
"pr-16"
|
|
1486
|
-
// Space for clear + clock buttons
|
|
1487
|
-
];
|
|
1488
|
-
const sizeClasses = {
|
|
1489
|
-
sm: "px-2 py-1 text-sm",
|
|
1490
|
-
md: "px-3 py-2 text-base",
|
|
1491
|
-
lg: "px-4 py-3 text-lg"
|
|
1492
|
-
};
|
|
1493
|
-
const stateClasses = disabled ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-white text-gray-900 cursor-pointer hover:border-gray-400";
|
|
1494
|
-
return [...baseClasses, sizeClasses[size], stateClasses].join(" ");
|
|
1495
|
-
}
|
|
1496
|
-
function getTimePickerIconButtonClasses(size) {
|
|
1497
|
-
const baseClasses = [
|
|
1498
|
-
"absolute right-1 flex items-center justify-center",
|
|
1499
|
-
"text-gray-400 hover:text-gray-600",
|
|
1500
|
-
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
1501
|
-
"rounded transition-colors duration-200",
|
|
1502
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
1503
|
-
];
|
|
1504
|
-
const sizeClasses = {
|
|
1505
|
-
sm: "w-6 h-6",
|
|
1506
|
-
md: "w-8 h-8",
|
|
1507
|
-
lg: "w-10 h-10"
|
|
1508
|
-
};
|
|
1509
|
-
return [...baseClasses, sizeClasses[size]].join(" ");
|
|
1510
|
-
}
|
|
1511
|
-
var timePickerClearButtonClasses = [
|
|
1512
|
-
"absolute right-10 flex items-center justify-center",
|
|
1513
|
-
"w-6 h-6 text-gray-400 hover:text-gray-600",
|
|
1514
|
-
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
1515
|
-
"rounded transition-colors duration-200"
|
|
1516
|
-
].join(" ");
|
|
1517
|
-
var timePickerPanelClasses = [
|
|
1518
|
-
"absolute z-10 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg",
|
|
1519
|
-
"w-max"
|
|
1520
|
-
].join(" ");
|
|
1521
|
-
var timePickerPanelContentClasses = "flex divide-x divide-gray-200";
|
|
1522
|
-
var timePickerRangeHeaderClasses = [
|
|
1523
|
-
"px-3 py-2 border-b border-gray-200 bg-gray-50",
|
|
1524
|
-
"flex items-center gap-2"
|
|
1525
|
-
].join(" ");
|
|
1526
|
-
function getTimePickerRangeTabButtonClasses(isActive) {
|
|
1527
|
-
const baseClasses = [
|
|
1528
|
-
"px-3 py-1 text-xs font-medium rounded",
|
|
1529
|
-
"border border-gray-300",
|
|
1530
|
-
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
1531
|
-
"transition-colors duration-150"
|
|
1532
|
-
];
|
|
1533
|
-
if (isActive) {
|
|
1534
|
-
return [...baseClasses, "bg-[var(--tiger-primary,#2563eb)] text-white border-transparent"].join(
|
|
1535
|
-
" "
|
|
1536
|
-
);
|
|
1537
|
-
}
|
|
1538
|
-
return [...baseClasses, "bg-white hover:bg-gray-50 text-gray-700"].join(" ");
|
|
1539
|
-
}
|
|
1540
|
-
var timePickerColumnClasses = "flex flex-col overflow-hidden shrink-0 w-16";
|
|
1541
|
-
var timePickerColumnHeaderClasses = [
|
|
1542
|
-
"px-2 py-1 text-xs font-semibold text-gray-500 text-center",
|
|
1543
|
-
"bg-gray-50 border-b border-gray-200"
|
|
1544
|
-
].join(" ");
|
|
1545
|
-
var timePickerColumnListClasses = [
|
|
1546
|
-
"overflow-y-auto max-h-48 scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100"
|
|
1547
|
-
].join(" ");
|
|
1548
|
-
function getTimePickerItemClasses(isSelected, isDisabled) {
|
|
1549
|
-
const baseClasses = [
|
|
1550
|
-
"w-full px-3 py-1.5 text-sm text-center",
|
|
1551
|
-
"hover:bg-gray-100 focus:outline-none focus:bg-gray-100",
|
|
1552
|
-
"transition-colors duration-150",
|
|
1553
|
-
"cursor-pointer"
|
|
1554
|
-
];
|
|
1555
|
-
if (isDisabled) {
|
|
1556
|
-
return [...baseClasses, "text-gray-300 cursor-not-allowed hover:bg-transparent"].join(" ");
|
|
1557
|
-
}
|
|
1558
|
-
if (isSelected) {
|
|
1559
|
-
return [
|
|
1560
|
-
...baseClasses,
|
|
1561
|
-
"bg-[var(--tiger-primary,#2563eb)] text-white",
|
|
1562
|
-
"hover:bg-[var(--tiger-primary-hover,#1d4ed8)]",
|
|
1563
|
-
"font-medium"
|
|
1564
|
-
].join(" ");
|
|
1565
|
-
}
|
|
1566
|
-
return [...baseClasses, "text-gray-700"].join(" ");
|
|
1567
|
-
}
|
|
1568
|
-
function getTimePickerPeriodButtonClasses(isSelected) {
|
|
1569
|
-
const baseClasses = [
|
|
1570
|
-
"w-full px-3 py-2 text-sm font-medium text-center",
|
|
1571
|
-
"hover:bg-gray-100 focus:outline-none focus:bg-gray-100",
|
|
1572
|
-
"transition-colors duration-150",
|
|
1573
|
-
"cursor-pointer"
|
|
1574
|
-
];
|
|
1575
|
-
if (isSelected) {
|
|
1576
|
-
return [
|
|
1577
|
-
...baseClasses,
|
|
1578
|
-
"bg-[var(--tiger-primary,#2563eb)] text-white",
|
|
1579
|
-
"hover:bg-[var(--tiger-primary-hover,#1d4ed8)]"
|
|
1580
|
-
].join(" ");
|
|
1581
|
-
}
|
|
1582
|
-
return [...baseClasses, "text-gray-700"].join(" ");
|
|
1583
|
-
}
|
|
1584
|
-
var timePickerFooterClasses = [
|
|
1585
|
-
"px-3 py-2 border-t border-gray-200",
|
|
1586
|
-
"flex items-center justify-between gap-2"
|
|
1587
|
-
].join(" ");
|
|
1588
|
-
var timePickerFooterButtonClasses = [
|
|
1589
|
-
"px-3 py-1 text-xs font-medium rounded",
|
|
1590
|
-
"border border-gray-300 hover:border-gray-400",
|
|
1591
|
-
"bg-white hover:bg-gray-50",
|
|
1592
|
-
"text-gray-700",
|
|
1593
|
-
"focus:outline-none focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)] focus:ring-offset-1",
|
|
1594
|
-
"transition-colors duration-150"
|
|
1595
|
-
].join(" ");
|
|
1596
|
-
|
|
1597
|
-
// src/utils/timepicker-icons.ts
|
|
1598
|
-
var ClockIconPath = clockSolidIcon20PathD;
|
|
1599
|
-
var TimePickerCloseIconPath = closeSolidIcon20PathD;
|
|
1600
|
-
|
|
1601
|
-
// src/utils/timepicker-labels.ts
|
|
1602
|
-
var ZH_LABELS = {
|
|
1603
|
-
hour: "\u65F6",
|
|
1604
|
-
minute: "\u5206",
|
|
1605
|
-
second: "\u79D2",
|
|
1606
|
-
now: "\u73B0\u5728",
|
|
1607
|
-
ok: "\u786E\u5B9A",
|
|
1608
|
-
start: "\u5F00\u59CB",
|
|
1609
|
-
end: "\u7ED3\u675F",
|
|
1610
|
-
clear: "\u6E05\u9664\u65F6\u95F4",
|
|
1611
|
-
toggle: "\u6253\u5F00\u65F6\u95F4\u9009\u62E9\u5668",
|
|
1612
|
-
dialog: "\u65F6\u95F4\u9009\u62E9\u5668",
|
|
1613
|
-
selectTime: "\u8BF7\u9009\u62E9\u65F6\u95F4",
|
|
1614
|
-
selectTimeRange: "\u8BF7\u9009\u62E9\u65F6\u95F4\u8303\u56F4"
|
|
1615
|
-
};
|
|
1616
|
-
var EN_LABELS = {
|
|
1617
|
-
hour: "Hour",
|
|
1618
|
-
minute: "Min",
|
|
1619
|
-
second: "Sec",
|
|
1620
|
-
now: "Now",
|
|
1621
|
-
ok: "OK",
|
|
1622
|
-
start: "Start",
|
|
1623
|
-
end: "End",
|
|
1624
|
-
clear: "Clear time",
|
|
1625
|
-
toggle: "Toggle time picker",
|
|
1626
|
-
dialog: "Time picker",
|
|
1627
|
-
selectTime: "Select time",
|
|
1628
|
-
selectTimeRange: "Select time range"
|
|
1629
|
-
};
|
|
1630
|
-
function isZhLocale(locale) {
|
|
1631
|
-
return (locale ?? "").toLowerCase().startsWith("zh");
|
|
1632
|
-
}
|
|
1633
|
-
function getTimePickerLabels(locale, overrides) {
|
|
1634
|
-
const base = isZhLocale(locale) ? ZH_LABELS : EN_LABELS;
|
|
1635
|
-
return { ...base, ...overrides ?? {} };
|
|
1636
|
-
}
|
|
1637
|
-
function pluralizeEn(value, singular) {
|
|
1638
|
-
return value === 1 ? singular : `${singular}s`;
|
|
1639
|
-
}
|
|
1640
|
-
function getTimePickerOptionAriaLabel(value, unit, locale, labelOverrides) {
|
|
1641
|
-
const labels = getTimePickerLabels(locale, labelOverrides);
|
|
1642
|
-
if (isZhLocale(locale)) {
|
|
1643
|
-
const suffix = unit === "hour" ? labels.hour : unit === "minute" ? labels.minute : labels.second;
|
|
1644
|
-
return `${value}${suffix}`;
|
|
1645
|
-
}
|
|
1646
|
-
const lc = (locale ?? "").toLowerCase();
|
|
1647
|
-
const useEnglishPlural = lc.length === 0 ? labelOverrides == null : lc.startsWith("en");
|
|
1648
|
-
if (useEnglishPlural) {
|
|
1649
|
-
if (unit === "hour") return `${value} ${pluralizeEn(value, "hour")}`;
|
|
1650
|
-
if (unit === "minute") return `${value} ${pluralizeEn(value, "minute")}`;
|
|
1651
|
-
return `${value} ${pluralizeEn(value, "second")}`;
|
|
1652
|
-
}
|
|
1653
|
-
const unitLabel = unit === "hour" ? labels.hour : unit === "minute" ? labels.minute : labels.second;
|
|
1654
|
-
return `${value} ${unitLabel}`;
|
|
1859
|
+
return seconds;
|
|
1860
|
+
}
|
|
1861
|
+
function getCurrentTime(showSeconds = false) {
|
|
1862
|
+
const now = /* @__PURE__ */ new Date();
|
|
1863
|
+
return formatTime(now.getHours(), now.getMinutes(), now.getSeconds(), showSeconds);
|
|
1655
1864
|
}
|
|
1656
1865
|
|
|
1657
1866
|
// src/utils/upload-utils.ts
|
|
@@ -1901,84 +2110,208 @@ function getPictureCardClasses(status) {
|
|
|
1901
2110
|
return classNames(...baseClasses, ...stateClasses);
|
|
1902
2111
|
}
|
|
1903
2112
|
|
|
1904
|
-
// src/utils/
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
2113
|
+
// src/utils/grid.ts
|
|
2114
|
+
var BREAKPOINT_ORDER = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
2115
|
+
var ALIGN_MAP = {
|
|
2116
|
+
top: "items-start",
|
|
2117
|
+
middle: "items-center",
|
|
2118
|
+
bottom: "items-end",
|
|
2119
|
+
stretch: "items-stretch"
|
|
2120
|
+
};
|
|
2121
|
+
var JUSTIFY_MAP = {
|
|
2122
|
+
start: "justify-start",
|
|
2123
|
+
end: "justify-end",
|
|
2124
|
+
center: "justify-center",
|
|
2125
|
+
"space-around": "justify-around",
|
|
2126
|
+
"space-between": "justify-between",
|
|
2127
|
+
"space-evenly": "justify-evenly"
|
|
2128
|
+
};
|
|
2129
|
+
function validateGridValue(value, fieldName) {
|
|
2130
|
+
if (value < 0 || value > 24) {
|
|
2131
|
+
console.warn(`Invalid ${fieldName} value: ${value}. ${fieldName} should be between 0 and 24.`);
|
|
2132
|
+
return false;
|
|
2133
|
+
}
|
|
2134
|
+
return true;
|
|
2135
|
+
}
|
|
2136
|
+
function toPercentage(value) {
|
|
2137
|
+
return (value / 24 * 100).toFixed(6).replace(/\.?0+$/, "");
|
|
2138
|
+
}
|
|
2139
|
+
var colSpanClasses = "w-[var(--tiger-col-span)] sm:w-[var(--tiger-col-span-sm,var(--tiger-col-span))] md:w-[var(--tiger-col-span-md,var(--tiger-col-span))] lg:w-[var(--tiger-col-span-lg,var(--tiger-col-span))] xl:w-[var(--tiger-col-span-xl,var(--tiger-col-span))] 2xl:w-[var(--tiger-col-span-2xl,var(--tiger-col-span))]";
|
|
2140
|
+
var colOffsetClasses = "ml-[var(--tiger-col-offset)] sm:ml-[var(--tiger-col-offset-sm,var(--tiger-col-offset))] md:ml-[var(--tiger-col-offset-md,var(--tiger-col-offset))] lg:ml-[var(--tiger-col-offset-lg,var(--tiger-col-offset))] xl:ml-[var(--tiger-col-offset-xl,var(--tiger-col-offset))] 2xl:ml-[var(--tiger-col-offset-2xl,var(--tiger-col-offset))]";
|
|
2141
|
+
var colFlexClasses = "flex-[var(--tiger-col-flex)]";
|
|
2142
|
+
var colOrderClasses = "order-[var(--tiger-col-order)] sm:order-[var(--tiger-col-order-sm,var(--tiger-col-order))] md:order-[var(--tiger-col-order-md,var(--tiger-col-order))] lg:order-[var(--tiger-col-order-lg,var(--tiger-col-order))] xl:order-[var(--tiger-col-order-xl,var(--tiger-col-order))] 2xl:order-[var(--tiger-col-order-2xl,var(--tiger-col-order))]";
|
|
2143
|
+
function hasNonZeroOffset(offset2) {
|
|
2144
|
+
if (typeof offset2 === "number") return offset2 !== 0;
|
|
2145
|
+
return BREAKPOINT_ORDER.some((bp) => (offset2[bp] ?? 0) !== 0);
|
|
2146
|
+
}
|
|
2147
|
+
function setSpanVars(vars, span) {
|
|
2148
|
+
if (typeof span === "number") {
|
|
2149
|
+
if (validateGridValue(span, "span")) vars["--tiger-col-span"] = `${toPercentage(span)}%`;
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
vars["--tiger-col-span"] = "100%";
|
|
2153
|
+
BREAKPOINT_ORDER.forEach((bp) => {
|
|
2154
|
+
const value = span[bp];
|
|
2155
|
+
if (value === void 0) return;
|
|
2156
|
+
if (!validateGridValue(value, `span.${bp}`)) return;
|
|
2157
|
+
const percentage = `${toPercentage(value)}%`;
|
|
2158
|
+
if (bp === "xs") {
|
|
2159
|
+
vars["--tiger-col-span"] = percentage;
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
vars[`--tiger-col-span-${bp}`] = percentage;
|
|
1909
2163
|
});
|
|
1910
2164
|
}
|
|
1911
|
-
function
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
)
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2165
|
+
function setOffsetVars(vars, offset2) {
|
|
2166
|
+
if (typeof offset2 === "number") {
|
|
2167
|
+
if (offset2 === 0) return;
|
|
2168
|
+
if (validateGridValue(offset2, "offset")) vars["--tiger-col-offset"] = `${toPercentage(offset2)}%`;
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
vars["--tiger-col-offset"] = "0%";
|
|
2172
|
+
BREAKPOINT_ORDER.forEach((bp) => {
|
|
2173
|
+
const value = offset2[bp];
|
|
2174
|
+
if (value === void 0) return;
|
|
2175
|
+
if (value === 0) return;
|
|
2176
|
+
if (!validateGridValue(value, `offset.${bp}`)) return;
|
|
2177
|
+
const percentage = `${toPercentage(value)}%`;
|
|
2178
|
+
if (bp === "xs") {
|
|
2179
|
+
vars["--tiger-col-offset"] = percentage;
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
vars[`--tiger-col-offset-${bp}`] = percentage;
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
function getColStyleVars(span, offset2) {
|
|
2186
|
+
const vars = {};
|
|
2187
|
+
if (span !== void 0 && span !== null) setSpanVars(vars, span);
|
|
2188
|
+
if (offset2 !== void 0 && offset2 !== null) setOffsetVars(vars, offset2);
|
|
2189
|
+
return vars;
|
|
2190
|
+
}
|
|
2191
|
+
function setOrderVars(vars, order) {
|
|
2192
|
+
if (typeof order === "number") {
|
|
2193
|
+
vars["--tiger-col-order"] = String(order);
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
vars["--tiger-col-order"] = "0";
|
|
2197
|
+
BREAKPOINT_ORDER.forEach((bp) => {
|
|
2198
|
+
const value = order[bp];
|
|
2199
|
+
if (value === void 0) return;
|
|
2200
|
+
if (bp === "xs") {
|
|
2201
|
+
vars["--tiger-col-order"] = String(value);
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
vars[`--tiger-col-order-${bp}`] = String(value);
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
function getColOrderStyleVars(order) {
|
|
2208
|
+
if (order === void 0 || order === null) return {};
|
|
2209
|
+
const vars = {};
|
|
2210
|
+
setOrderVars(vars, order);
|
|
2211
|
+
return vars;
|
|
2212
|
+
}
|
|
2213
|
+
function getAlignClasses(align) {
|
|
2214
|
+
return ALIGN_MAP[align] || "items-start";
|
|
2215
|
+
}
|
|
2216
|
+
function getJustifyClasses(justify) {
|
|
2217
|
+
return JUSTIFY_MAP[justify] || "justify-start";
|
|
2218
|
+
}
|
|
2219
|
+
function getGutterStyles(gutter) {
|
|
2220
|
+
if (gutter === void 0 || gutter === null || gutter === 0) return {};
|
|
2221
|
+
const [horizontal, vertical] = Array.isArray(gutter) ? gutter : [gutter, gutter];
|
|
2222
|
+
const rowStyle = {};
|
|
2223
|
+
const colStyle = {};
|
|
2224
|
+
if (horizontal > 0) {
|
|
2225
|
+
rowStyle.marginLeft = `-${horizontal / 2}px`;
|
|
2226
|
+
rowStyle.marginRight = `-${horizontal / 2}px`;
|
|
2227
|
+
colStyle.paddingLeft = `${horizontal / 2}px`;
|
|
2228
|
+
colStyle.paddingRight = `${horizontal / 2}px`;
|
|
2229
|
+
}
|
|
2230
|
+
if (vertical > 0) {
|
|
2231
|
+
rowStyle.marginTop = `-${vertical / 2}px`;
|
|
2232
|
+
rowStyle.marginBottom = `-${vertical / 2}px`;
|
|
2233
|
+
colStyle.paddingTop = `${vertical / 2}px`;
|
|
2234
|
+
colStyle.paddingBottom = `${vertical / 2}px`;
|
|
2235
|
+
}
|
|
2236
|
+
return { rowStyle, colStyle };
|
|
2237
|
+
}
|
|
2238
|
+
function getSpanClasses(span) {
|
|
2239
|
+
if (span === void 0 || span === null) return "w-full";
|
|
2240
|
+
return colSpanClasses;
|
|
2241
|
+
}
|
|
2242
|
+
function getOffsetClasses(offset2) {
|
|
2243
|
+
if (offset2 === void 0 || offset2 === null) return "";
|
|
2244
|
+
if (!hasNonZeroOffset(offset2)) return "";
|
|
2245
|
+
return colOffsetClasses;
|
|
2246
|
+
}
|
|
2247
|
+
function getOrderClasses(order) {
|
|
2248
|
+
if (order === void 0) return "";
|
|
2249
|
+
return colOrderClasses;
|
|
2250
|
+
}
|
|
2251
|
+
function getFlexClasses(flex) {
|
|
2252
|
+
if (flex === void 0) return "";
|
|
2253
|
+
return colFlexClasses;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
// src/utils/divider.ts
|
|
2257
|
+
var SPACING_MAP = {
|
|
2258
|
+
none: { horizontal: "", vertical: "" },
|
|
2259
|
+
xs: { horizontal: "my-1", vertical: "mx-1" },
|
|
2260
|
+
sm: { horizontal: "my-2", vertical: "mx-2" },
|
|
2261
|
+
md: { horizontal: "my-4", vertical: "mx-4" },
|
|
2262
|
+
lg: { horizontal: "my-6", vertical: "mx-6" },
|
|
2263
|
+
xl: { horizontal: "my-8", vertical: "mx-8" }
|
|
2264
|
+
};
|
|
2265
|
+
var LINE_STYLE_MAP = {
|
|
2266
|
+
solid: "border-solid",
|
|
2267
|
+
dashed: "border-dashed",
|
|
2268
|
+
dotted: "border-dotted"
|
|
2269
|
+
};
|
|
2270
|
+
var DEFAULT_BORDER_COLOR_CLASS = "border-[var(--tiger-border,#e5e7eb)]";
|
|
2271
|
+
function getDividerSpacingClasses(spacing, orientation) {
|
|
2272
|
+
return SPACING_MAP[spacing][orientation];
|
|
2273
|
+
}
|
|
2274
|
+
function getDividerLineStyleClasses(lineStyle) {
|
|
2275
|
+
return LINE_STYLE_MAP[lineStyle];
|
|
2276
|
+
}
|
|
2277
|
+
function getDividerOrientationClasses(orientation) {
|
|
2278
|
+
return orientation === "horizontal" ? `w-full border-t ${DEFAULT_BORDER_COLOR_CLASS}` : `h-full border-l ${DEFAULT_BORDER_COLOR_CLASS}`;
|
|
1979
2279
|
}
|
|
1980
2280
|
|
|
2281
|
+
// src/utils/layout-utils.ts
|
|
2282
|
+
var layoutRootClasses = "tiger-layout flex flex-col min-h-screen";
|
|
2283
|
+
var layoutHeaderClasses = "tiger-header bg-[var(--tiger-surface,#ffffff)] border-b border-[var(--tiger-border,#e5e7eb)]";
|
|
2284
|
+
var layoutSidebarClasses = "tiger-sidebar bg-[var(--tiger-surface,#ffffff)] border-r border-[var(--tiger-border,#e5e7eb)] transition-all duration-300";
|
|
2285
|
+
var layoutContentClasses = "tiger-content flex-1 bg-[var(--tiger-layout-content-bg,#f9fafb)] p-6";
|
|
2286
|
+
var layoutFooterClasses = "tiger-footer bg-[var(--tiger-surface,#ffffff)] border-t border-[var(--tiger-border,#e5e7eb)] p-4";
|
|
2287
|
+
|
|
2288
|
+
// src/utils/container-utils.ts
|
|
2289
|
+
var containerBaseClasses = "w-full";
|
|
2290
|
+
var containerCenteredClasses = "mx-auto";
|
|
2291
|
+
var containerPaddingClasses = "px-4 sm:px-6 lg:px-8";
|
|
2292
|
+
var containerMaxWidthClasses = {
|
|
2293
|
+
sm: "max-w-screen-sm",
|
|
2294
|
+
md: "max-w-screen-md",
|
|
2295
|
+
lg: "max-w-screen-lg",
|
|
2296
|
+
xl: "max-w-screen-xl",
|
|
2297
|
+
"2xl": "max-w-screen-2xl",
|
|
2298
|
+
full: "w-full"
|
|
2299
|
+
};
|
|
2300
|
+
var getContainerClasses = ({
|
|
2301
|
+
maxWidth = false,
|
|
2302
|
+
center = true,
|
|
2303
|
+
padding = true,
|
|
2304
|
+
className
|
|
2305
|
+
} = {}) => classNames(
|
|
2306
|
+
containerBaseClasses,
|
|
2307
|
+
maxWidth !== false && containerMaxWidthClasses[maxWidth],
|
|
2308
|
+
center && containerCenteredClasses,
|
|
2309
|
+
padding && containerPaddingClasses,
|
|
2310
|
+
className
|
|
2311
|
+
);
|
|
2312
|
+
|
|
1981
2313
|
// src/utils/space.ts
|
|
2314
|
+
var SPACE_BASE_CLASS = "inline-flex";
|
|
1982
2315
|
function getSpaceGapSize(size = "md") {
|
|
1983
2316
|
if (typeof size === "number") {
|
|
1984
2317
|
return { style: `${size}px` };
|
|
@@ -2275,19 +2608,6 @@ function getCardClasses(variant, hoverable) {
|
|
|
2275
2608
|
return classes.join(" ");
|
|
2276
2609
|
}
|
|
2277
2610
|
|
|
2278
|
-
// src/utils/link-utils.ts
|
|
2279
|
-
var linkBaseClasses = "inline-flex items-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer no-underline";
|
|
2280
|
-
var linkSizeClasses = {
|
|
2281
|
-
sm: "text-sm",
|
|
2282
|
-
md: "text-base",
|
|
2283
|
-
lg: "text-lg"
|
|
2284
|
-
};
|
|
2285
|
-
var linkDisabledClasses = "cursor-not-allowed opacity-60 pointer-events-none";
|
|
2286
|
-
function getSecureRel(target, rel) {
|
|
2287
|
-
if (target === "_blank" && !rel) return "noopener noreferrer";
|
|
2288
|
-
return rel;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
2611
|
// src/utils/avatar-utils.ts
|
|
2292
2612
|
var avatarBaseClasses = "inline-flex items-center justify-center overflow-hidden shrink-0 select-none";
|
|
2293
2613
|
var avatarSizeClasses = {
|
|
@@ -2310,7 +2630,7 @@ function getInitials(name) {
|
|
|
2310
2630
|
if (words.length === 0) return "";
|
|
2311
2631
|
if (words.length === 1) {
|
|
2312
2632
|
const firstWord = words[0];
|
|
2313
|
-
const hasNonASCII = /[^\
|
|
2633
|
+
const hasNonASCII = /[^\x20-\x7E]/.test(firstWord);
|
|
2314
2634
|
return hasNonASCII ? firstWord.slice(0, 2).toUpperCase() : firstWord.charAt(0).toUpperCase();
|
|
2315
2635
|
}
|
|
2316
2636
|
return (words[0].charAt(0) + words[1].charAt(0)).toUpperCase();
|
|
@@ -2340,16 +2660,6 @@ function generateAvatarColor(str) {
|
|
|
2340
2660
|
return colors[index];
|
|
2341
2661
|
}
|
|
2342
2662
|
|
|
2343
|
-
// src/utils/icon-utils.ts
|
|
2344
|
-
var iconWrapperClasses = "inline-flex align-middle";
|
|
2345
|
-
var iconSvgBaseClasses = "inline-block";
|
|
2346
|
-
var iconSizeClasses = {
|
|
2347
|
-
sm: "w-4 h-4",
|
|
2348
|
-
md: "w-5 h-5",
|
|
2349
|
-
lg: "w-6 h-6",
|
|
2350
|
-
xl: "w-8 h-8"
|
|
2351
|
-
};
|
|
2352
|
-
|
|
2353
2663
|
// src/utils/list-utils.ts
|
|
2354
2664
|
var listBaseClasses = "bg-[var(--tiger-surface,#ffffff)] rounded-lg overflow-hidden";
|
|
2355
2665
|
var listWrapperClasses = "w-full";
|
|
@@ -3022,11 +3332,11 @@ function clampPercentage(percentage) {
|
|
|
3022
3332
|
}
|
|
3023
3333
|
function calculateCirclePath(radius, strokeWidth, percentage) {
|
|
3024
3334
|
const circumference = 2 * Math.PI * radius;
|
|
3025
|
-
const
|
|
3335
|
+
const offset2 = circumference - percentage / 100 * circumference;
|
|
3026
3336
|
return {
|
|
3027
3337
|
circumference,
|
|
3028
3338
|
strokeDasharray: `${circumference}`,
|
|
3029
|
-
strokeDashoffset:
|
|
3339
|
+
strokeDashoffset: offset2
|
|
3030
3340
|
};
|
|
3031
3341
|
}
|
|
3032
3342
|
function getCircleSize(size, strokeWidth) {
|
|
@@ -3050,14 +3360,14 @@ var menuModeClasses = {
|
|
|
3050
3360
|
};
|
|
3051
3361
|
var menuLightThemeClasses = "[--tiger-surface:#ffffff] [--tiger-text:#111827] [--tiger-text-muted:#6b7280] [--tiger-border:#e5e7eb] [--tiger-surface-muted:#f9fafb]";
|
|
3052
3362
|
var menuDarkThemeClasses = "[--tiger-surface:#111827] [--tiger-text:#f9fafb] [--tiger-text-muted:#9ca3af] [--tiger-border:#374151] [--tiger-surface-muted:#1f2937] [--tiger-outline-bg-hover:#2563eb1a] [--tiger-ghost-bg-hover:#2563eb1a]";
|
|
3053
|
-
var menuItemBaseClasses = "flex w-full items-center px-4 py-2 text-left bg-transparent border-0 cursor-pointer transition-colors duration-200 select-none appearance-none";
|
|
3363
|
+
var menuItemBaseClasses = "flex w-full items-center px-4 py-2 text-left bg-transparent border-0 cursor-pointer transition-colors duration-200 select-none appearance-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-inset active:opacity-90";
|
|
3054
3364
|
var menuItemHoverLightClasses = "hover:bg-[var(--tiger-surface-muted,#f9fafb)]";
|
|
3055
3365
|
var menuItemHoverDarkClasses = "hover:bg-[var(--tiger-surface-muted,#1f2937)]";
|
|
3056
3366
|
var menuItemSelectedLightClasses = "bg-[var(--tiger-outline-bg-hover,#eff6ff)] text-[var(--tiger-primary,#2563eb)] font-medium";
|
|
3057
3367
|
var menuItemSelectedDarkClasses = "bg-[var(--tiger-outline-bg-hover,#2563eb1a)] text-[var(--tiger-primary,#60a5fa)] font-medium";
|
|
3058
3368
|
var menuItemDisabledClasses = "opacity-50 cursor-not-allowed pointer-events-none";
|
|
3059
3369
|
var menuItemIconClasses = "mr-2 flex-shrink-0";
|
|
3060
|
-
var submenuTitleClasses = "flex w-full items-center justify-between px-4 py-2 text-left bg-transparent border-0 cursor-pointer transition-colors duration-200 select-none appearance-none";
|
|
3370
|
+
var submenuTitleClasses = "flex w-full items-center justify-between px-4 py-2 text-left bg-transparent border-0 cursor-pointer transition-colors duration-200 select-none appearance-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-inset active:opacity-90";
|
|
3061
3371
|
var submenuExpandIconClasses = "ml-2 transition-transform duration-200";
|
|
3062
3372
|
var submenuExpandIconExpandedClasses = "transform rotate-180";
|
|
3063
3373
|
var submenuContentHorizontalClasses = "absolute left-0 top-full mt-0 min-w-[160px] bg-[var(--tiger-surface,#ffffff)] text-[var(--tiger-text,#111827)] border border-[var(--tiger-border,#e5e7eb)] rounded shadow-lg z-50";
|
|
@@ -3153,7 +3463,7 @@ var tabNavListPositionClasses = {
|
|
|
3153
3463
|
right: "flex-col"
|
|
3154
3464
|
};
|
|
3155
3465
|
var tabNavListCenteredClasses = "justify-center";
|
|
3156
|
-
var tabItemBaseClasses = "relative px-4 py-2 cursor-pointer transition-all duration-200 select-none flex items-center gap-2";
|
|
3466
|
+
var tabItemBaseClasses = "relative px-4 py-2 cursor-pointer transition-all duration-200 select-none flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] focus-visible:ring-offset-2 active:opacity-90";
|
|
3157
3467
|
var tabItemSizeClasses = {
|
|
3158
3468
|
small: "text-sm px-3 py-1.5",
|
|
3159
3469
|
medium: "text-base px-4 py-2",
|
|
@@ -3501,6 +3811,43 @@ function getTotalTextClasses(size = "medium") {
|
|
|
3501
3811
|
};
|
|
3502
3812
|
return classNames("text-[var(--tiger-text-muted,#6b7280)]", "mr-2", sizeClasses[size]);
|
|
3503
3813
|
}
|
|
3814
|
+
function getSimplePaginationContainerClasses() {
|
|
3815
|
+
return classNames(
|
|
3816
|
+
"flex items-center justify-between",
|
|
3817
|
+
"px-4 py-3",
|
|
3818
|
+
"border-t border-[var(--tiger-border,#e5e7eb)]"
|
|
3819
|
+
);
|
|
3820
|
+
}
|
|
3821
|
+
function getSimplePaginationTotalClasses() {
|
|
3822
|
+
return "text-sm text-[var(--tiger-text,#111827)]";
|
|
3823
|
+
}
|
|
3824
|
+
function getSimplePaginationControlsClasses() {
|
|
3825
|
+
return "flex items-center gap-2";
|
|
3826
|
+
}
|
|
3827
|
+
function getSimplePaginationSelectClasses() {
|
|
3828
|
+
return classNames(
|
|
3829
|
+
"px-3 py-1",
|
|
3830
|
+
"border border-[var(--tiger-border,#e5e7eb)] rounded",
|
|
3831
|
+
"text-sm",
|
|
3832
|
+
"bg-[var(--tiger-surface,#ffffff)]",
|
|
3833
|
+
"text-[var(--tiger-text,#111827)]"
|
|
3834
|
+
);
|
|
3835
|
+
}
|
|
3836
|
+
function getSimplePaginationButtonClasses(disabled) {
|
|
3837
|
+
return classNames(
|
|
3838
|
+
"px-3 py-1",
|
|
3839
|
+
"border border-[var(--tiger-border,#e5e7eb)] rounded",
|
|
3840
|
+
"text-sm",
|
|
3841
|
+
"bg-[var(--tiger-surface,#ffffff)]",
|
|
3842
|
+
disabled ? "text-[var(--tiger-text-muted,#6b7280)] cursor-not-allowed" : "hover:bg-[var(--tiger-surface-muted,#f9fafb)] text-[var(--tiger-text,#111827)]"
|
|
3843
|
+
);
|
|
3844
|
+
}
|
|
3845
|
+
function getSimplePaginationPageIndicatorClasses() {
|
|
3846
|
+
return "px-3 py-1 text-sm text-[var(--tiger-text,#111827)]";
|
|
3847
|
+
}
|
|
3848
|
+
function getSimplePaginationButtonsWrapperClasses() {
|
|
3849
|
+
return "flex gap-1";
|
|
3850
|
+
}
|
|
3504
3851
|
|
|
3505
3852
|
// src/utils/dropdown-utils.ts
|
|
3506
3853
|
function getDropdownContainerClasses() {
|
|
@@ -4078,18 +4425,6 @@ function injectLoadingAnimationStyles() {
|
|
|
4078
4425
|
}
|
|
4079
4426
|
}
|
|
4080
4427
|
|
|
4081
|
-
// src/utils/svg-attrs.ts
|
|
4082
|
-
function normalizeSvgAttrs(svgAttrs) {
|
|
4083
|
-
if ("className" in svgAttrs && !("class" in svgAttrs)) {
|
|
4084
|
-
const { className, ...rest } = svgAttrs;
|
|
4085
|
-
return {
|
|
4086
|
-
...rest,
|
|
4087
|
-
class: className
|
|
4088
|
-
};
|
|
4089
|
-
}
|
|
4090
|
-
return svgAttrs;
|
|
4091
|
-
}
|
|
4092
|
-
|
|
4093
4428
|
// src/utils/popconfirm-utils.ts
|
|
4094
4429
|
function getPopconfirmContainerClasses() {
|
|
4095
4430
|
return classNames("tiger-popconfirm", "relative", "inline-block", "w-fit", "justify-self-start");
|
|
@@ -4319,67 +4654,27 @@ function getTooltipContentClasses() {
|
|
|
4319
4654
|
);
|
|
4320
4655
|
}
|
|
4321
4656
|
|
|
4322
|
-
// src/utils/
|
|
4323
|
-
var
|
|
4324
|
-
var
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
var radioDisabledCursorClasses = "cursor-not-allowed";
|
|
4329
|
-
var radioHoverBorderClasses = "hover:border-[var(--tiger-primary,#2563eb)]";
|
|
4330
|
-
var radioSizeClasses = {
|
|
4331
|
-
sm: {
|
|
4332
|
-
radio: "w-4 h-4",
|
|
4333
|
-
dot: "w-1.5 h-1.5",
|
|
4334
|
-
label: "text-sm"
|
|
4335
|
-
},
|
|
4336
|
-
md: {
|
|
4337
|
-
radio: "w-5 h-5",
|
|
4338
|
-
dot: "w-2 h-2",
|
|
4339
|
-
label: "text-base"
|
|
4340
|
-
},
|
|
4341
|
-
lg: {
|
|
4342
|
-
radio: "w-6 h-6",
|
|
4343
|
-
dot: "w-2.5 h-2.5",
|
|
4344
|
-
label: "text-lg"
|
|
4345
|
-
}
|
|
4657
|
+
// src/utils/link-utils.ts
|
|
4658
|
+
var linkBaseClasses = "inline-flex items-center transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] cursor-pointer no-underline active:opacity-80";
|
|
4659
|
+
var linkSizeClasses = {
|
|
4660
|
+
sm: "text-sm",
|
|
4661
|
+
md: "text-base",
|
|
4662
|
+
lg: "text-lg"
|
|
4346
4663
|
};
|
|
4347
|
-
var
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
}) => classNames(
|
|
4353
|
-
radioVisualBaseClasses,
|
|
4354
|
-
radioFocusVisibleClasses,
|
|
4355
|
-
radioSizeClasses[size].radio,
|
|
4356
|
-
checked ? colors.borderChecked : colors.border,
|
|
4357
|
-
checked ? colors.bgChecked : colors.bg,
|
|
4358
|
-
disabled && colors.disabled,
|
|
4359
|
-
disabled && radioDisabledCursorClasses,
|
|
4360
|
-
!disabled && radioHoverBorderClasses
|
|
4361
|
-
);
|
|
4362
|
-
var getRadioDotClasses = ({ size, checked, colors }) => classNames(
|
|
4363
|
-
radioDotBaseClasses,
|
|
4364
|
-
radioSizeClasses[size].dot,
|
|
4365
|
-
colors.innerDot,
|
|
4366
|
-
checked ? "scale-100" : "scale-0"
|
|
4367
|
-
);
|
|
4368
|
-
var getRadioLabelClasses = ({ size, disabled, colors }) => classNames(
|
|
4369
|
-
radioLabelBaseClasses,
|
|
4370
|
-
radioSizeClasses[size].label,
|
|
4371
|
-
disabled ? colors.textDisabled : "text-[var(--tiger-text,#111827)]",
|
|
4372
|
-
disabled && radioDisabledCursorClasses
|
|
4373
|
-
);
|
|
4664
|
+
var linkDisabledClasses = "cursor-not-allowed opacity-60 pointer-events-none";
|
|
4665
|
+
function getSecureRel(target, rel) {
|
|
4666
|
+
if (target === "_blank" && !rel) return "noopener noreferrer";
|
|
4667
|
+
return rel;
|
|
4668
|
+
}
|
|
4374
4669
|
|
|
4375
|
-
// src/utils/
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4670
|
+
// src/utils/icon-utils.ts
|
|
4671
|
+
var iconWrapperClasses = "inline-flex align-middle";
|
|
4672
|
+
var iconSvgBaseClasses = "inline-block";
|
|
4673
|
+
var iconSizeClasses = {
|
|
4674
|
+
sm: "w-4 h-4",
|
|
4675
|
+
md: "w-5 h-5",
|
|
4676
|
+
lg: "w-6 h-6",
|
|
4677
|
+
xl: "w-8 h-8"
|
|
4383
4678
|
};
|
|
4384
4679
|
|
|
4385
4680
|
// src/utils/code-utils.ts
|
|
@@ -4388,34 +4683,622 @@ var codeBlockPreClasses = "m-0 overflow-auto p-4 text-sm leading-relaxed font-mo
|
|
|
4388
4683
|
var codeBlockCopyButtonBaseClasses = "absolute right-3 top-0 -translate-y-1/2 inline-flex items-center rounded-md border border-gray-200 bg-white/90 px-1.5 py-0.5 text-[10px] text-gray-600 shadow-sm transition-colors hover:bg-white hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900/90 dark:text-gray-200 dark:hover:bg-gray-800";
|
|
4389
4684
|
var codeBlockCopyButtonCopiedClasses = "border-[var(--tiger-primary,#2563eb)] text-[var(--tiger-primary,#2563eb)]";
|
|
4390
4685
|
|
|
4391
|
-
// src/utils/
|
|
4392
|
-
var
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4686
|
+
// src/utils/chart-utils.ts
|
|
4687
|
+
var chartCanvasBaseClasses = "block";
|
|
4688
|
+
var chartAxisLineClasses = "stroke-[color:var(--tiger-border,#e5e7eb)]";
|
|
4689
|
+
var chartAxisTickLineClasses = "stroke-[color:var(--tiger-border,#e5e7eb)]";
|
|
4690
|
+
var chartAxisTickTextClasses = "fill-[color:var(--tiger-text-secondary,#6b7280)] text-xs";
|
|
4691
|
+
var chartAxisLabelClasses = "fill-[color:var(--tiger-text,#374151)] text-xs font-medium";
|
|
4692
|
+
var chartGridLineClasses = "stroke-[color:var(--tiger-border,#e5e7eb)]";
|
|
4693
|
+
var DEFAULT_CHART_COLORS = [
|
|
4694
|
+
"var(--tiger-chart-1,#2563eb)",
|
|
4695
|
+
"var(--tiger-chart-2,#22c55e)",
|
|
4696
|
+
"var(--tiger-chart-3,#f97316)",
|
|
4697
|
+
"var(--tiger-chart-4,#a855f7)",
|
|
4698
|
+
"var(--tiger-chart-5,#0ea5e9)",
|
|
4699
|
+
"var(--tiger-chart-6,#ef4444)"
|
|
4700
|
+
];
|
|
4701
|
+
var clampNumber = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
4702
|
+
function normalizeChartPadding(padding) {
|
|
4703
|
+
if (typeof padding === "number") {
|
|
4704
|
+
return {
|
|
4705
|
+
top: padding,
|
|
4706
|
+
right: padding,
|
|
4707
|
+
bottom: padding,
|
|
4708
|
+
left: padding
|
|
4709
|
+
};
|
|
4710
|
+
}
|
|
4711
|
+
return {
|
|
4712
|
+
top: padding?.top ?? 0,
|
|
4713
|
+
right: padding?.right ?? 0,
|
|
4714
|
+
bottom: padding?.bottom ?? 0,
|
|
4715
|
+
left: padding?.left ?? 0
|
|
4716
|
+
};
|
|
4717
|
+
}
|
|
4718
|
+
function getChartInnerRect(width, height, padding) {
|
|
4719
|
+
const resolvedPadding = normalizeChartPadding(padding);
|
|
4720
|
+
const innerWidth = Math.max(0, width - resolvedPadding.left - resolvedPadding.right);
|
|
4721
|
+
const innerHeight = Math.max(0, height - resolvedPadding.top - resolvedPadding.bottom);
|
|
4722
|
+
return {
|
|
4723
|
+
x: resolvedPadding.left,
|
|
4724
|
+
y: resolvedPadding.top,
|
|
4725
|
+
width: innerWidth,
|
|
4726
|
+
height: innerHeight
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
function createLinearScale(domain, range) {
|
|
4730
|
+
const [d0, d1] = domain;
|
|
4731
|
+
const [r0, r1] = range;
|
|
4732
|
+
const span = d1 - d0;
|
|
4733
|
+
return {
|
|
4734
|
+
type: "linear",
|
|
4735
|
+
domain: [d0, d1],
|
|
4736
|
+
range: [r0, r1],
|
|
4737
|
+
map: (value) => {
|
|
4738
|
+
const numeric = typeof value === "number" ? value : Number(value);
|
|
4739
|
+
if (span === 0) return (r0 + r1) / 2;
|
|
4740
|
+
return r0 + (numeric - d0) / span * (r1 - r0);
|
|
4741
|
+
}
|
|
4742
|
+
};
|
|
4743
|
+
}
|
|
4744
|
+
function createPointScale(domain, range, options = {}) {
|
|
4745
|
+
const padding = clampNumber(options.padding ?? 0.5, 0, 1);
|
|
4746
|
+
const [rangeStart, rangeEnd] = range;
|
|
4747
|
+
const span = rangeEnd - rangeStart;
|
|
4748
|
+
const length = Math.abs(span);
|
|
4749
|
+
const direction = span >= 0 ? 1 : -1;
|
|
4750
|
+
const n = domain.length;
|
|
4751
|
+
const step = n > 1 ? length / Math.max(1, n - 1 + padding * 2) : 0;
|
|
4752
|
+
const offset2 = n <= 1 ? length / 2 : step * padding;
|
|
4753
|
+
const indexMap = new Map(domain.map((value, index) => [value, index]));
|
|
4754
|
+
return {
|
|
4755
|
+
type: "point",
|
|
4756
|
+
domain,
|
|
4757
|
+
range: [rangeStart, rangeEnd],
|
|
4758
|
+
step,
|
|
4759
|
+
map: (value) => {
|
|
4760
|
+
const key = String(value);
|
|
4761
|
+
const index = indexMap.get(key) ?? 0;
|
|
4762
|
+
return rangeStart + direction * (offset2 + step * index);
|
|
4763
|
+
}
|
|
4764
|
+
};
|
|
4765
|
+
}
|
|
4766
|
+
function createBandScale(domain, range, options = {}) {
|
|
4767
|
+
const paddingInner = clampNumber(options.paddingInner ?? 0.1, 0, 1);
|
|
4768
|
+
const paddingOuter = clampNumber(options.paddingOuter ?? 0.1, 0, 1);
|
|
4769
|
+
const align = clampNumber(options.align ?? 0.5, 0, 1);
|
|
4770
|
+
const [rangeStart, rangeEnd] = range;
|
|
4771
|
+
const span = rangeEnd - rangeStart;
|
|
4772
|
+
const length = Math.abs(span);
|
|
4773
|
+
const direction = span >= 0 ? 1 : -1;
|
|
4774
|
+
const n = domain.length;
|
|
4775
|
+
const step = n > 0 ? length / Math.max(1, n - paddingInner + paddingOuter * 2) : 0;
|
|
4776
|
+
const bandwidth = step * (1 - paddingInner);
|
|
4777
|
+
const offset2 = (length - step * (n - paddingInner)) * align;
|
|
4778
|
+
const indexMap = new Map(domain.map((value, index) => [value, index]));
|
|
4779
|
+
return {
|
|
4780
|
+
type: "band",
|
|
4781
|
+
domain,
|
|
4782
|
+
range: [rangeStart, rangeEnd],
|
|
4783
|
+
step,
|
|
4784
|
+
bandwidth,
|
|
4785
|
+
map: (value) => {
|
|
4786
|
+
const key = String(value);
|
|
4787
|
+
const index = indexMap.get(key) ?? 0;
|
|
4788
|
+
return rangeStart + direction * (offset2 + step * index);
|
|
4399
4789
|
}
|
|
4790
|
+
};
|
|
4791
|
+
}
|
|
4792
|
+
function getChartAxisTicks(scale, options = {}) {
|
|
4793
|
+
const { tickCount = 5, tickValues, tickFormat } = options;
|
|
4794
|
+
const format = tickFormat ?? ((value) => `${value}`);
|
|
4795
|
+
const resolvedTickValues = tickValues ?? (scale.type === "linear" ? getLinearTicks(scale.domain, tickCount) : scale.domain);
|
|
4796
|
+
return resolvedTickValues.map((value) => {
|
|
4797
|
+
const basePosition = scale.map(value);
|
|
4798
|
+
const position = scale.type === "band" && typeof scale.bandwidth === "number" ? basePosition + scale.bandwidth / 2 : basePosition;
|
|
4799
|
+
return {
|
|
4800
|
+
value,
|
|
4801
|
+
position,
|
|
4802
|
+
label: format(value)
|
|
4803
|
+
};
|
|
4804
|
+
});
|
|
4805
|
+
}
|
|
4806
|
+
function getLinearTicks(domain, count) {
|
|
4807
|
+
const min = Math.min(domain[0], domain[1]);
|
|
4808
|
+
const max = Math.max(domain[0], domain[1]);
|
|
4809
|
+
if (min === max || !Number.isFinite(min) || !Number.isFinite(max)) {
|
|
4810
|
+
return [min];
|
|
4811
|
+
}
|
|
4812
|
+
const step = getNiceStep((max - min) / Math.max(1, count));
|
|
4813
|
+
const start = Math.ceil(min / step) * step;
|
|
4814
|
+
const end = Math.floor(max / step) * step;
|
|
4815
|
+
const ticks = [];
|
|
4816
|
+
for (let value = start; value <= end + step / 2; value += step) {
|
|
4817
|
+
ticks.push(roundTick(value, step));
|
|
4818
|
+
}
|
|
4819
|
+
return ticks;
|
|
4820
|
+
}
|
|
4821
|
+
function getNiceStep(step) {
|
|
4822
|
+
if (!Number.isFinite(step) || step <= 0) return 1;
|
|
4823
|
+
const exponent = Math.floor(Math.log10(step));
|
|
4824
|
+
const fraction = step / Math.pow(10, exponent);
|
|
4825
|
+
const niceFraction = fraction >= 5 ? 5 : fraction >= 2 ? 2 : fraction >= 1 ? 1 : 0.5;
|
|
4826
|
+
return niceFraction * Math.pow(10, exponent);
|
|
4827
|
+
}
|
|
4828
|
+
function roundTick(value, step) {
|
|
4829
|
+
const precision = Math.max(0, -Math.floor(Math.log10(step)) + 1);
|
|
4830
|
+
return Number(value.toFixed(precision));
|
|
4831
|
+
}
|
|
4832
|
+
function getChartGridLineDasharray(lineStyle) {
|
|
4833
|
+
if (lineStyle === "dashed") return "4 4";
|
|
4834
|
+
if (lineStyle === "dotted") return "1 4";
|
|
4835
|
+
return void 0;
|
|
4836
|
+
}
|
|
4837
|
+
function getNumberExtent(values, options = {}) {
|
|
4838
|
+
const fallback = options.fallback ?? [0, 1];
|
|
4839
|
+
if (values.length === 0) return fallback;
|
|
4840
|
+
let min = Math.min(...values);
|
|
4841
|
+
let max = Math.max(...values);
|
|
4842
|
+
if (options.includeZero) {
|
|
4843
|
+
min = Math.min(min, 0);
|
|
4844
|
+
max = Math.max(max, 0);
|
|
4845
|
+
}
|
|
4846
|
+
if (min === max) {
|
|
4847
|
+
const pad = Math.abs(min) * 0.1 || 1;
|
|
4848
|
+
return [min - pad, max + pad];
|
|
4849
|
+
}
|
|
4850
|
+
const padding = options.padding ?? 0;
|
|
4851
|
+
if (padding > 0) {
|
|
4852
|
+
const span = max - min;
|
|
4853
|
+
min -= span * padding;
|
|
4854
|
+
max += span * padding;
|
|
4855
|
+
}
|
|
4856
|
+
return [min, max];
|
|
4857
|
+
}
|
|
4858
|
+
function getPieArcs(data, options = {}) {
|
|
4859
|
+
const startAngle = options.startAngle ?? 0;
|
|
4860
|
+
const endAngle = options.endAngle ?? Math.PI * 2;
|
|
4861
|
+
const padAngle = Math.max(0, options.padAngle ?? 0);
|
|
4862
|
+
const values = data.map((item) => Math.max(0, item.value));
|
|
4863
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
4864
|
+
if (total <= 0) return [];
|
|
4865
|
+
const totalAngle = endAngle - startAngle;
|
|
4866
|
+
const totalPadding = padAngle * data.length;
|
|
4867
|
+
const availableAngle = Math.max(0, totalAngle - totalPadding);
|
|
4868
|
+
let current = startAngle;
|
|
4869
|
+
return data.map((item, index) => {
|
|
4870
|
+
const value = values[index];
|
|
4871
|
+
const sliceAngle = availableAngle * (value / total);
|
|
4872
|
+
const sliceStart = current;
|
|
4873
|
+
const sliceEnd = sliceStart + sliceAngle;
|
|
4874
|
+
current = sliceEnd + padAngle;
|
|
4875
|
+
return {
|
|
4876
|
+
data: item,
|
|
4877
|
+
value,
|
|
4878
|
+
startAngle: sliceStart,
|
|
4879
|
+
endAngle: sliceEnd,
|
|
4880
|
+
padAngle,
|
|
4881
|
+
index
|
|
4882
|
+
};
|
|
4883
|
+
});
|
|
4884
|
+
}
|
|
4885
|
+
function polarToCartesian(cx, cy, radius, angle) {
|
|
4886
|
+
return {
|
|
4887
|
+
x: cx + radius * Math.cos(angle),
|
|
4888
|
+
y: cy + radius * Math.sin(angle)
|
|
4889
|
+
};
|
|
4890
|
+
}
|
|
4891
|
+
function createPieArcPath(options) {
|
|
4892
|
+
const { cx, cy, outerRadius } = options;
|
|
4893
|
+
const innerRadius = Math.max(0, options.innerRadius ?? 0);
|
|
4894
|
+
let startAngle = options.startAngle;
|
|
4895
|
+
let endAngle = options.endAngle;
|
|
4896
|
+
const fullCircle = Math.PI * 2;
|
|
4897
|
+
if (endAngle - startAngle >= fullCircle) {
|
|
4898
|
+
endAngle = startAngle + fullCircle - 1e-4;
|
|
4899
|
+
}
|
|
4900
|
+
if (endAngle <= startAngle) return "";
|
|
4901
|
+
const startOuter = polarToCartesian(cx, cy, outerRadius, startAngle);
|
|
4902
|
+
const endOuter = polarToCartesian(cx, cy, outerRadius, endAngle);
|
|
4903
|
+
const largeArcFlag = endAngle - startAngle > Math.PI ? 1 : 0;
|
|
4904
|
+
if (innerRadius <= 0) {
|
|
4905
|
+
return [
|
|
4906
|
+
`M ${cx} ${cy}`,
|
|
4907
|
+
`L ${startOuter.x} ${startOuter.y}`,
|
|
4908
|
+
`A ${outerRadius} ${outerRadius} 0 ${largeArcFlag} 1 ${endOuter.x} ${endOuter.y}`,
|
|
4909
|
+
"Z"
|
|
4910
|
+
].join(" ");
|
|
4400
4911
|
}
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4912
|
+
const startInner = polarToCartesian(cx, cy, innerRadius, startAngle);
|
|
4913
|
+
const endInner = polarToCartesian(cx, cy, innerRadius, endAngle);
|
|
4914
|
+
return [
|
|
4915
|
+
`M ${startOuter.x} ${startOuter.y}`,
|
|
4916
|
+
`A ${outerRadius} ${outerRadius} 0 ${largeArcFlag} 1 ${endOuter.x} ${endOuter.y}`,
|
|
4917
|
+
`L ${endInner.x} ${endInner.y}`,
|
|
4918
|
+
`A ${innerRadius} ${innerRadius} 0 ${largeArcFlag} 0 ${startInner.x} ${startInner.y}`,
|
|
4919
|
+
"Z"
|
|
4920
|
+
].join(" ");
|
|
4921
|
+
}
|
|
4922
|
+
function getRadarAngles(count, startAngle = -Math.PI / 2) {
|
|
4923
|
+
if (count <= 0) return [];
|
|
4924
|
+
const step = Math.PI * 2 / count;
|
|
4925
|
+
return Array.from({ length: count }, (_, index) => startAngle + step * index);
|
|
4926
|
+
}
|
|
4927
|
+
function getRadarPoints(data, options) {
|
|
4928
|
+
if (data.length === 0) return [];
|
|
4929
|
+
const startAngle = options.startAngle ?? -Math.PI / 2;
|
|
4930
|
+
const maxValue = Math.max(0, options.maxValue ?? Math.max(...data.map((datum) => datum.value)));
|
|
4931
|
+
const resolvedMax = maxValue > 0 ? maxValue : 1;
|
|
4932
|
+
const step = Math.PI * 2 / data.length;
|
|
4933
|
+
return data.map((datum, index) => {
|
|
4934
|
+
const value = Math.max(0, datum.value);
|
|
4935
|
+
const ratio = value / resolvedMax;
|
|
4936
|
+
const radius = options.radius * ratio;
|
|
4937
|
+
const angle = startAngle + step * index;
|
|
4938
|
+
const point = polarToCartesian(options.cx, options.cy, radius, angle);
|
|
4939
|
+
return {
|
|
4940
|
+
data: datum,
|
|
4941
|
+
value,
|
|
4942
|
+
angle,
|
|
4943
|
+
radius,
|
|
4944
|
+
x: point.x,
|
|
4945
|
+
y: point.y,
|
|
4946
|
+
index
|
|
4947
|
+
};
|
|
4948
|
+
});
|
|
4949
|
+
}
|
|
4950
|
+
function createPolygonPath(points) {
|
|
4951
|
+
if (points.length === 0) return "";
|
|
4952
|
+
const [first, ...rest] = points;
|
|
4953
|
+
return [`M ${first.x} ${first.y}`, ...rest.map((point) => `L ${point.x} ${point.y}`), "Z"].join(
|
|
4954
|
+
" "
|
|
4955
|
+
);
|
|
4956
|
+
}
|
|
4957
|
+
function createLinePath(points, curve = "linear") {
|
|
4958
|
+
if (points.length === 0) return "";
|
|
4959
|
+
if (points.length === 1) return `M ${points[0].x} ${points[0].y}`;
|
|
4960
|
+
switch (curve) {
|
|
4961
|
+
case "step":
|
|
4962
|
+
return createStepPath(points, 0.5);
|
|
4963
|
+
case "stepBefore":
|
|
4964
|
+
return createStepPath(points, 0);
|
|
4965
|
+
case "stepAfter":
|
|
4966
|
+
return createStepPath(points, 1);
|
|
4967
|
+
case "monotone":
|
|
4968
|
+
return createMonotonePath(points);
|
|
4969
|
+
case "natural":
|
|
4970
|
+
return createNaturalPath(points);
|
|
4971
|
+
case "linear":
|
|
4972
|
+
default:
|
|
4973
|
+
return createLinearPath(points);
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
function createAreaPath(points, baseline, curve = "linear") {
|
|
4977
|
+
if (points.length === 0) return "";
|
|
4978
|
+
const linePath = createLinePath(points, curve);
|
|
4979
|
+
if (!linePath) return "";
|
|
4980
|
+
const lastPoint = points[points.length - 1];
|
|
4981
|
+
const firstPoint = points[0];
|
|
4982
|
+
return `${linePath} L ${lastPoint.x} ${baseline} L ${firstPoint.x} ${baseline} Z`;
|
|
4983
|
+
}
|
|
4984
|
+
function createLinearPath(points) {
|
|
4985
|
+
const [first, ...rest] = points;
|
|
4986
|
+
return [`M ${first.x} ${first.y}`, ...rest.map((p) => `L ${p.x} ${p.y}`)].join(" ");
|
|
4987
|
+
}
|
|
4988
|
+
function createStepPath(points, t) {
|
|
4989
|
+
const [first, ...rest] = points;
|
|
4990
|
+
const commands = [`M ${first.x} ${first.y}`];
|
|
4991
|
+
let prev = first;
|
|
4992
|
+
for (const point of rest) {
|
|
4993
|
+
if (t === 0) {
|
|
4994
|
+
commands.push(`V ${point.y}`, `H ${point.x}`);
|
|
4995
|
+
} else if (t === 1) {
|
|
4996
|
+
commands.push(`H ${point.x}`, `V ${point.y}`);
|
|
4997
|
+
} else {
|
|
4998
|
+
const midX = prev.x + (point.x - prev.x) * t;
|
|
4999
|
+
commands.push(`H ${midX}`, `V ${point.y}`, `H ${point.x}`);
|
|
5000
|
+
}
|
|
5001
|
+
prev = point;
|
|
5002
|
+
}
|
|
5003
|
+
return commands.join(" ");
|
|
5004
|
+
}
|
|
5005
|
+
function createMonotonePath(points) {
|
|
5006
|
+
if (points.length < 2) return createLinearPath(points);
|
|
5007
|
+
const n = points.length;
|
|
5008
|
+
const tangents = [];
|
|
5009
|
+
for (let i = 0; i < n; i++) {
|
|
5010
|
+
if (i === 0) {
|
|
5011
|
+
tangents.push((points[1].y - points[0].y) / (points[1].x - points[0].x));
|
|
5012
|
+
} else if (i === n - 1) {
|
|
5013
|
+
tangents.push((points[n - 1].y - points[n - 2].y) / (points[n - 1].x - points[n - 2].x));
|
|
5014
|
+
} else {
|
|
5015
|
+
const d0 = (points[i].y - points[i - 1].y) / (points[i].x - points[i - 1].x);
|
|
5016
|
+
const d1 = (points[i + 1].y - points[i].y) / (points[i + 1].x - points[i].x);
|
|
5017
|
+
if (d0 * d1 <= 0) {
|
|
5018
|
+
tangents.push(0);
|
|
5019
|
+
} else {
|
|
5020
|
+
tangents.push(3 * (d0 + d1) / (2 / d0 + 2 / d1 + 2 / ((d0 + d1) / 2)));
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
for (let i = 0; i < n - 1; i++) {
|
|
5025
|
+
const d = (points[i + 1].y - points[i].y) / (points[i + 1].x - points[i].x);
|
|
5026
|
+
if (Math.abs(d) < 1e-10) {
|
|
5027
|
+
tangents[i] = 0;
|
|
5028
|
+
tangents[i + 1] = 0;
|
|
5029
|
+
} else {
|
|
5030
|
+
const alpha = tangents[i] / d;
|
|
5031
|
+
const beta = tangents[i + 1] / d;
|
|
5032
|
+
const s = alpha * alpha + beta * beta;
|
|
5033
|
+
if (s > 9) {
|
|
5034
|
+
const t = 3 / Math.sqrt(s);
|
|
5035
|
+
tangents[i] = t * alpha * d;
|
|
5036
|
+
tangents[i + 1] = t * beta * d;
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
const commands = [`M ${points[0].x} ${points[0].y}`];
|
|
5041
|
+
for (let i = 0; i < n - 1; i++) {
|
|
5042
|
+
const p0 = points[i];
|
|
5043
|
+
const p1 = points[i + 1];
|
|
5044
|
+
const dx = p1.x - p0.x;
|
|
5045
|
+
const cp1x = p0.x + dx / 3;
|
|
5046
|
+
const cp1y = p0.y + tangents[i] * dx / 3;
|
|
5047
|
+
const cp2x = p1.x - dx / 3;
|
|
5048
|
+
const cp2y = p1.y - tangents[i + 1] * dx / 3;
|
|
5049
|
+
commands.push(`C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p1.x} ${p1.y}`);
|
|
5050
|
+
}
|
|
5051
|
+
return commands.join(" ");
|
|
5052
|
+
}
|
|
5053
|
+
function createNaturalPath(points) {
|
|
5054
|
+
if (points.length < 2) return createLinearPath(points);
|
|
5055
|
+
if (points.length === 2) return createLinearPath(points);
|
|
5056
|
+
const n = points.length - 1;
|
|
5057
|
+
const a = new Array(n + 1).fill(0);
|
|
5058
|
+
const b = new Array(n + 1).fill(0);
|
|
5059
|
+
const c = new Array(n + 1).fill(0);
|
|
5060
|
+
const d = new Array(n + 1).fill(0);
|
|
5061
|
+
b[0] = 1;
|
|
5062
|
+
b[n] = 1;
|
|
5063
|
+
for (let i = 1; i < n; i++) {
|
|
5064
|
+
const h0 = points[i].x - points[i - 1].x;
|
|
5065
|
+
const h1 = points[i + 1].x - points[i].x;
|
|
5066
|
+
a[i] = h0;
|
|
5067
|
+
b[i] = 2 * (h0 + h1);
|
|
5068
|
+
c[i] = h1;
|
|
5069
|
+
d[i] = 3 * (points[i + 1].y - points[i].y) / h1 - 3 * (points[i].y - points[i - 1].y) / h0;
|
|
5070
|
+
}
|
|
5071
|
+
const m = new Array(n + 1).fill(0);
|
|
5072
|
+
const z = new Array(n + 1).fill(0);
|
|
5073
|
+
for (let i = 1; i <= n; i++) {
|
|
5074
|
+
const l = b[i] - a[i] * m[i - 1];
|
|
5075
|
+
m[i] = c[i] / l;
|
|
5076
|
+
z[i] = (d[i] - a[i] * z[i - 1]) / l;
|
|
5077
|
+
}
|
|
5078
|
+
const M = new Array(n + 1).fill(0);
|
|
5079
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
5080
|
+
M[i] = z[i] - m[i] * M[i + 1];
|
|
5081
|
+
}
|
|
5082
|
+
const commands = [`M ${points[0].x} ${points[0].y}`];
|
|
5083
|
+
for (let i = 0; i < n; i++) {
|
|
5084
|
+
const h = points[i + 1].x - points[i].x;
|
|
5085
|
+
const p0 = points[i];
|
|
5086
|
+
const p1 = points[i + 1];
|
|
5087
|
+
const cp1x = p0.x + h / 3;
|
|
5088
|
+
const cp1y = p0.y + h / 3 * ((p1.y - p0.y) / h - h * (M[i + 1] + 2 * M[i]) / 6);
|
|
5089
|
+
const cp2x = p1.x - h / 3;
|
|
5090
|
+
const cp2y = p1.y - h / 3 * ((p1.y - p0.y) / h + h * (2 * M[i + 1] + M[i]) / 6);
|
|
5091
|
+
commands.push(`C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p1.x} ${p1.y}`);
|
|
5092
|
+
}
|
|
5093
|
+
return commands.join(" ");
|
|
5094
|
+
}
|
|
5095
|
+
function stackSeriesData(seriesData) {
|
|
5096
|
+
if (seriesData.length === 0) return [];
|
|
5097
|
+
const result = [];
|
|
5098
|
+
const stackedValues = /* @__PURE__ */ new Map();
|
|
5099
|
+
for (const series of seriesData) {
|
|
5100
|
+
const stackedSeries = [];
|
|
5101
|
+
for (const datum of series) {
|
|
5102
|
+
const prevY = stackedValues.get(datum.x) ?? 0;
|
|
5103
|
+
const y0 = prevY;
|
|
5104
|
+
const y1 = prevY + datum.y;
|
|
5105
|
+
stackedSeries.push({ original: datum, y0, y1 });
|
|
5106
|
+
stackedValues.set(datum.x, y1);
|
|
5107
|
+
}
|
|
5108
|
+
result.push(stackedSeries);
|
|
5109
|
+
}
|
|
5110
|
+
return result;
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5113
|
+
// src/utils/chart-interaction.ts
|
|
5114
|
+
function createChartInteractionHandlers(data, state, options) {
|
|
5115
|
+
const { hoverable, selectable, onHoverChange, onSelectChange, onItemClick } = options;
|
|
5116
|
+
const handleMouseEnter = (index, datum) => {
|
|
5117
|
+
if (!hoverable) return;
|
|
5118
|
+
if (options.hoveredIndex !== void 0) {
|
|
5119
|
+
onHoverChange?.(index, datum);
|
|
5120
|
+
} else {
|
|
5121
|
+
state.hoveredIndex = index;
|
|
5122
|
+
}
|
|
5123
|
+
};
|
|
5124
|
+
const handleMouseLeave = () => {
|
|
5125
|
+
if (!hoverable) return;
|
|
5126
|
+
if (options.hoveredIndex !== void 0) {
|
|
5127
|
+
onHoverChange?.(null, null);
|
|
5128
|
+
} else {
|
|
5129
|
+
state.hoveredIndex = null;
|
|
5130
|
+
}
|
|
5131
|
+
};
|
|
5132
|
+
const handleClick = (index, datum) => {
|
|
5133
|
+
onItemClick?.(index, datum);
|
|
5134
|
+
if (!selectable) return;
|
|
5135
|
+
const nextIndex = state.selectedIndex === index ? null : index;
|
|
5136
|
+
const nextDatum = nextIndex !== null ? data[nextIndex] : null;
|
|
5137
|
+
if (options.selectedIndex !== void 0) {
|
|
5138
|
+
onSelectChange?.(nextIndex, nextDatum);
|
|
5139
|
+
} else {
|
|
5140
|
+
state.selectedIndex = nextIndex;
|
|
5141
|
+
onSelectChange?.(nextIndex, nextDatum);
|
|
5142
|
+
}
|
|
5143
|
+
};
|
|
5144
|
+
const handleKeyDown = (event, index, datum) => {
|
|
5145
|
+
if (!selectable) return;
|
|
5146
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
5147
|
+
event.preventDefault();
|
|
5148
|
+
handleClick(index, datum);
|
|
5149
|
+
};
|
|
5150
|
+
return {
|
|
5151
|
+
onMouseEnter: handleMouseEnter,
|
|
5152
|
+
onMouseLeave: handleMouseLeave,
|
|
5153
|
+
onClick: handleClick,
|
|
5154
|
+
onKeyDown: handleKeyDown
|
|
5155
|
+
};
|
|
5156
|
+
}
|
|
5157
|
+
function getActiveIndex(hoveredIndex, selectedIndex, controlledHovered, controlledSelected) {
|
|
5158
|
+
if (controlledSelected !== void 0 && controlledSelected !== null) {
|
|
5159
|
+
return controlledSelected;
|
|
4417
5160
|
}
|
|
5161
|
+
if (selectedIndex !== null) {
|
|
5162
|
+
return selectedIndex;
|
|
5163
|
+
}
|
|
5164
|
+
if (controlledHovered !== void 0 && controlledHovered !== null) {
|
|
5165
|
+
return controlledHovered;
|
|
5166
|
+
}
|
|
5167
|
+
return hoveredIndex;
|
|
5168
|
+
}
|
|
5169
|
+
function getChartElementOpacity(index, activeIndex, options = {}) {
|
|
5170
|
+
const { activeOpacity = 1, inactiveOpacity = 0.25, defaultOpacity } = options;
|
|
5171
|
+
if (activeIndex === null) {
|
|
5172
|
+
return defaultOpacity;
|
|
5173
|
+
}
|
|
5174
|
+
return index === activeIndex ? activeOpacity : inactiveOpacity;
|
|
5175
|
+
}
|
|
5176
|
+
function defaultTooltipFormatter(label, value, seriesName, index) {
|
|
5177
|
+
const displayLabel = label ?? (index !== void 0 ? `#${index + 1}` : "");
|
|
5178
|
+
const prefix = seriesName ? `${seriesName} \xB7 ` : "";
|
|
5179
|
+
return `${prefix}${displayLabel}: ${value}`;
|
|
5180
|
+
}
|
|
5181
|
+
var chartInteractiveClasses = {
|
|
5182
|
+
hoverable: "cursor-pointer transition-opacity duration-150",
|
|
5183
|
+
selectable: "cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
5184
|
+
active: "ring-2 ring-[color:var(--tiger-primary,#2563eb)] ring-offset-1"
|
|
4418
5185
|
};
|
|
5186
|
+
function getChartAnimationStyle(config, index = 0) {
|
|
5187
|
+
if (!config.animated) return "";
|
|
5188
|
+
const duration = config.duration ?? 300;
|
|
5189
|
+
const easing = config.easing ?? "ease-out";
|
|
5190
|
+
const stagger = config.stagger ?? 50;
|
|
5191
|
+
const delay = index * stagger;
|
|
5192
|
+
return `transition: all ${duration}ms ${easing} ${delay}ms`;
|
|
5193
|
+
}
|
|
5194
|
+
function getChartEntranceTransform(type, progress, options = {}) {
|
|
5195
|
+
const { originX = 0, originY = 0 } = options;
|
|
5196
|
+
switch (type) {
|
|
5197
|
+
case "scale":
|
|
5198
|
+
return `translate(${originX * (1 - progress)}, ${originY * (1 - progress)}) scale(${progress})`;
|
|
5199
|
+
case "slide-up":
|
|
5200
|
+
return `translate(0, ${20 * (1 - progress)})`;
|
|
5201
|
+
case "slide-left":
|
|
5202
|
+
return `translate(${20 * (1 - progress)}, 0)`;
|
|
5203
|
+
case "fade":
|
|
5204
|
+
default:
|
|
5205
|
+
return "";
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
|
|
5209
|
+
// src/utils/floating.ts
|
|
5210
|
+
import {
|
|
5211
|
+
computePosition,
|
|
5212
|
+
flip,
|
|
5213
|
+
shift,
|
|
5214
|
+
offset,
|
|
5215
|
+
arrow,
|
|
5216
|
+
autoUpdate
|
|
5217
|
+
} from "@floating-ui/dom";
|
|
5218
|
+
async function computeFloatingPosition(reference, floating, options = {}) {
|
|
5219
|
+
const {
|
|
5220
|
+
placement = "bottom",
|
|
5221
|
+
offset: offsetDistance = 8,
|
|
5222
|
+
flip: enableFlip = true,
|
|
5223
|
+
shift: enableShift = true,
|
|
5224
|
+
shiftPadding = 8,
|
|
5225
|
+
arrowElement = null,
|
|
5226
|
+
arrowPadding = 8
|
|
5227
|
+
} = options;
|
|
5228
|
+
const middleware = [offset(offsetDistance)];
|
|
5229
|
+
if (enableFlip) {
|
|
5230
|
+
middleware.push(flip({ padding: shiftPadding }));
|
|
5231
|
+
}
|
|
5232
|
+
if (enableShift) {
|
|
5233
|
+
middleware.push(shift({ padding: shiftPadding }));
|
|
5234
|
+
}
|
|
5235
|
+
if (arrowElement) {
|
|
5236
|
+
middleware.push(arrow({ element: arrowElement, padding: arrowPadding }));
|
|
5237
|
+
}
|
|
5238
|
+
const result = await computePosition(reference, floating, {
|
|
5239
|
+
placement,
|
|
5240
|
+
middleware
|
|
5241
|
+
});
|
|
5242
|
+
return {
|
|
5243
|
+
x: result.x,
|
|
5244
|
+
y: result.y,
|
|
5245
|
+
placement: result.placement,
|
|
5246
|
+
arrow: result.middlewareData.arrow,
|
|
5247
|
+
middlewareData: result.middlewareData
|
|
5248
|
+
};
|
|
5249
|
+
}
|
|
5250
|
+
function autoUpdateFloating(reference, floating, update) {
|
|
5251
|
+
return autoUpdate(reference, floating, update, {
|
|
5252
|
+
ancestorScroll: true,
|
|
5253
|
+
ancestorResize: true,
|
|
5254
|
+
elementResize: true,
|
|
5255
|
+
layoutShift: true
|
|
5256
|
+
});
|
|
5257
|
+
}
|
|
5258
|
+
function getTransformOrigin(placement) {
|
|
5259
|
+
const origins = {
|
|
5260
|
+
top: "bottom center",
|
|
5261
|
+
"top-start": "bottom left",
|
|
5262
|
+
"top-end": "bottom right",
|
|
5263
|
+
bottom: "top center",
|
|
5264
|
+
"bottom-start": "top left",
|
|
5265
|
+
"bottom-end": "top right",
|
|
5266
|
+
left: "right center",
|
|
5267
|
+
"left-start": "right top",
|
|
5268
|
+
"left-end": "right bottom",
|
|
5269
|
+
right: "left center",
|
|
5270
|
+
"right-start": "left top",
|
|
5271
|
+
"right-end": "left bottom"
|
|
5272
|
+
};
|
|
5273
|
+
return origins[placement] || "center center";
|
|
5274
|
+
}
|
|
5275
|
+
function getPlacementSide(placement) {
|
|
5276
|
+
return placement.split("-")[0];
|
|
5277
|
+
}
|
|
5278
|
+
function getArrowStyles(placement, arrowData) {
|
|
5279
|
+
const side = getPlacementSide(placement);
|
|
5280
|
+
const staticSide = {
|
|
5281
|
+
top: "bottom",
|
|
5282
|
+
bottom: "top",
|
|
5283
|
+
left: "right",
|
|
5284
|
+
right: "left"
|
|
5285
|
+
};
|
|
5286
|
+
const styles = {
|
|
5287
|
+
position: "absolute",
|
|
5288
|
+
[staticSide[side]]: "-4px"
|
|
5289
|
+
};
|
|
5290
|
+
if (arrowData?.x != null) {
|
|
5291
|
+
styles.left = `${arrowData.x}px`;
|
|
5292
|
+
}
|
|
5293
|
+
if (arrowData?.y != null) {
|
|
5294
|
+
styles.top = `${arrowData.y}px`;
|
|
5295
|
+
}
|
|
5296
|
+
return styles;
|
|
5297
|
+
}
|
|
5298
|
+
function applyFloatingStyles(element, result) {
|
|
5299
|
+
element.style.left = `${result.x}px`;
|
|
5300
|
+
element.style.top = `${result.y}px`;
|
|
5301
|
+
}
|
|
4419
5302
|
|
|
4420
5303
|
// src/theme/colors.ts
|
|
4421
5304
|
var defaultThemeColors = {
|
|
@@ -4728,7 +5611,7 @@ var checkboxLabelSizeClasses = {
|
|
|
4728
5611
|
lg: "text-lg"
|
|
4729
5612
|
};
|
|
4730
5613
|
function getCheckboxClasses(size = "md", disabled = false) {
|
|
4731
|
-
const baseClasses = "rounded border-2 transition-
|
|
5614
|
+
const baseClasses = "rounded border-2 transition-all duration-150 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] active:scale-95";
|
|
4732
5615
|
const sizeClass = checkboxSizeClasses[size];
|
|
4733
5616
|
const colorClasses = [
|
|
4734
5617
|
"border-[var(--tiger-primary,#2563eb)]",
|
|
@@ -4751,7 +5634,7 @@ function getCheckboxLabelClasses(size = "md", disabled = false) {
|
|
|
4751
5634
|
}
|
|
4752
5635
|
|
|
4753
5636
|
// src/theme/switch.ts
|
|
4754
|
-
var switchBaseClasses = "relative inline-flex items-center rounded-full transition-
|
|
5637
|
+
var switchBaseClasses = "relative inline-flex items-center rounded-full transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--tiger-focus-ring,var(--tiger-primary,#2563eb))] active:scale-[0.98]";
|
|
4755
5638
|
var switchSizeClasses = {
|
|
4756
5639
|
sm: "h-5 w-9",
|
|
4757
5640
|
md: "h-6 w-11",
|
|
@@ -4825,14 +5708,22 @@ function getSliderTooltipClasses(size = "md") {
|
|
|
4825
5708
|
|
|
4826
5709
|
// src/theme/index.ts
|
|
4827
5710
|
var THEME_CSS_VARS = {
|
|
5711
|
+
// Primary colors
|
|
4828
5712
|
primary: "--tiger-primary",
|
|
4829
5713
|
primaryHover: "--tiger-primary-hover",
|
|
5714
|
+
primaryActive: "--tiger-primary-active",
|
|
4830
5715
|
primaryDisabled: "--tiger-primary-disabled",
|
|
5716
|
+
// Secondary colors
|
|
4831
5717
|
secondary: "--tiger-secondary",
|
|
4832
5718
|
secondaryHover: "--tiger-secondary-hover",
|
|
5719
|
+
secondaryActive: "--tiger-secondary-active",
|
|
4833
5720
|
secondaryDisabled: "--tiger-secondary-disabled",
|
|
5721
|
+
// Background hover states
|
|
4834
5722
|
outlineBgHover: "--tiger-outline-bg-hover",
|
|
4835
|
-
ghostBgHover: "--tiger-ghost-bg-hover"
|
|
5723
|
+
ghostBgHover: "--tiger-ghost-bg-hover",
|
|
5724
|
+
// Interaction states (0.2.0+)
|
|
5725
|
+
focusRing: "--tiger-focus-ring",
|
|
5726
|
+
surface: "--tiger-surface"
|
|
4836
5727
|
};
|
|
4837
5728
|
function setThemeColors(colors, element) {
|
|
4838
5729
|
const target = element || (typeof document !== "undefined" ? document.documentElement : null);
|
|
@@ -4892,16 +5783,42 @@ var tigercatPlugin = (0, import_plugin.default)(function({ addBase }) {
|
|
|
4892
5783
|
});
|
|
4893
5784
|
|
|
4894
5785
|
// src/index.ts
|
|
4895
|
-
var version = "0.0
|
|
5786
|
+
var version = "0.2.0";
|
|
4896
5787
|
export {
|
|
5788
|
+
ANIMATION_DURATION_FAST_MS,
|
|
5789
|
+
ANIMATION_DURATION_MS,
|
|
5790
|
+
ANIMATION_DURATION_SLOW_MS,
|
|
4897
5791
|
CalendarIconPath,
|
|
4898
5792
|
ChevronLeftIconPath,
|
|
4899
5793
|
ChevronRightIconPath,
|
|
4900
5794
|
ClockIconPath,
|
|
4901
5795
|
CloseIconPath,
|
|
5796
|
+
DEFAULT_CHART_COLORS,
|
|
5797
|
+
DEFAULT_PAGINATION_LABELS,
|
|
5798
|
+
DURATION_CLASS,
|
|
5799
|
+
DURATION_FAST_CLASS,
|
|
5800
|
+
DURATION_SLOW_CLASS,
|
|
5801
|
+
EASING_DEFAULT,
|
|
5802
|
+
EASING_ENTER,
|
|
5803
|
+
EASING_LEAVE,
|
|
4902
5804
|
SHAKE_CLASS,
|
|
5805
|
+
SPACE_BASE_CLASS,
|
|
5806
|
+
SVG_ANIMATION_CLASSES,
|
|
5807
|
+
SVG_ANIMATION_VARS,
|
|
5808
|
+
SVG_DEFAULT_FILL,
|
|
5809
|
+
SVG_DEFAULT_STROKE,
|
|
5810
|
+
SVG_DEFAULT_VIEWBOX_20,
|
|
5811
|
+
SVG_DEFAULT_VIEWBOX_24,
|
|
5812
|
+
SVG_DEFAULT_XMLNS,
|
|
5813
|
+
SVG_PATH_ANIMATION_CSS,
|
|
4903
5814
|
THEME_CSS_VARS,
|
|
5815
|
+
TRANSITION_BASE,
|
|
5816
|
+
TRANSITION_OPACITY,
|
|
5817
|
+
TRANSITION_TRANSFORM,
|
|
4904
5818
|
TimePickerCloseIconPath,
|
|
5819
|
+
ZH_CN_PAGINATION_LABELS,
|
|
5820
|
+
activeOpacityClasses,
|
|
5821
|
+
activePressClasses,
|
|
4905
5822
|
alertBaseClasses,
|
|
4906
5823
|
alertCloseButtonBaseClasses,
|
|
4907
5824
|
alertCloseIconPath,
|
|
@@ -4917,7 +5834,9 @@ export {
|
|
|
4917
5834
|
alertWarningIconPath,
|
|
4918
5835
|
animationDelayClasses,
|
|
4919
5836
|
animationDelayStyles,
|
|
5837
|
+
applyFloatingStyles,
|
|
4920
5838
|
autoResizeTextarea,
|
|
5839
|
+
autoUpdateFloating,
|
|
4921
5840
|
avatarBaseClasses,
|
|
4922
5841
|
avatarDefaultBgColor,
|
|
4923
5842
|
avatarDefaultTextColor,
|
|
@@ -4954,8 +5873,17 @@ export {
|
|
|
4954
5873
|
cardHoverClasses,
|
|
4955
5874
|
cardSizeClasses,
|
|
4956
5875
|
cardVariantClasses,
|
|
5876
|
+
chartAxisLabelClasses,
|
|
5877
|
+
chartAxisLineClasses,
|
|
5878
|
+
chartAxisTickLineClasses,
|
|
5879
|
+
chartAxisTickTextClasses,
|
|
5880
|
+
chartCanvasBaseClasses,
|
|
5881
|
+
chartGridLineClasses,
|
|
5882
|
+
chartInteractiveClasses,
|
|
5883
|
+
checkSolidIcon20PathD,
|
|
4957
5884
|
checkboxLabelSizeClasses,
|
|
4958
5885
|
checkboxSizeClasses,
|
|
5886
|
+
chevronDownSolidIcon20PathD,
|
|
4959
5887
|
chevronLeftSolidIcon20PathD,
|
|
4960
5888
|
chevronRightSolidIcon20PathD,
|
|
4961
5889
|
clampPercentage,
|
|
@@ -4974,12 +5902,21 @@ export {
|
|
|
4974
5902
|
codeBlockPreClasses,
|
|
4975
5903
|
coerceClassValue,
|
|
4976
5904
|
coerceStyleValue,
|
|
5905
|
+
computeFloatingPosition,
|
|
4977
5906
|
containerBaseClasses,
|
|
4978
5907
|
containerCenteredClasses,
|
|
4979
5908
|
containerMaxWidthClasses,
|
|
4980
5909
|
containerPaddingClasses,
|
|
4981
5910
|
copyTextToClipboard,
|
|
5911
|
+
createAreaPath,
|
|
4982
5912
|
createAriaId,
|
|
5913
|
+
createBandScale,
|
|
5914
|
+
createChartInteractionHandlers,
|
|
5915
|
+
createLinePath,
|
|
5916
|
+
createLinearScale,
|
|
5917
|
+
createPieArcPath,
|
|
5918
|
+
createPointScale,
|
|
5919
|
+
createPolygonPath,
|
|
4983
5920
|
datePickerBaseClasses,
|
|
4984
5921
|
datePickerCalendarClasses,
|
|
4985
5922
|
datePickerCalendarGridClasses,
|
|
@@ -5003,6 +5940,7 @@ export {
|
|
|
5003
5940
|
defaultSortFn,
|
|
5004
5941
|
defaultTagThemeColors,
|
|
5005
5942
|
defaultThemeColors,
|
|
5943
|
+
defaultTooltipFormatter,
|
|
5006
5944
|
defaultTotalText,
|
|
5007
5945
|
descriptionsBaseClasses,
|
|
5008
5946
|
descriptionsCellSizeClasses,
|
|
@@ -5033,10 +5971,14 @@ export {
|
|
|
5033
5971
|
flattenTree,
|
|
5034
5972
|
focusElement,
|
|
5035
5973
|
focusFirst,
|
|
5974
|
+
focusRingClasses,
|
|
5975
|
+
focusRingInsetClasses,
|
|
5036
5976
|
formatBadgeContent,
|
|
5037
5977
|
formatDate,
|
|
5038
5978
|
formatFileSize,
|
|
5039
5979
|
formatMonthYear,
|
|
5980
|
+
formatPageAriaLabel,
|
|
5981
|
+
formatPaginationTotal,
|
|
5040
5982
|
formatProgressText,
|
|
5041
5983
|
formatTime,
|
|
5042
5984
|
formatTimeDisplay,
|
|
@@ -5047,18 +5989,27 @@ export {
|
|
|
5047
5989
|
generateMinutes,
|
|
5048
5990
|
generateSeconds,
|
|
5049
5991
|
getActiveElement,
|
|
5992
|
+
getActiveIndex,
|
|
5050
5993
|
getAlertIconPath,
|
|
5051
5994
|
getAlertTypeClasses,
|
|
5052
5995
|
getAlignClasses,
|
|
5053
5996
|
getAllKeys,
|
|
5997
|
+
getArrowStyles,
|
|
5054
5998
|
getAutoExpandKeys,
|
|
5055
5999
|
getBadgeVariantClasses,
|
|
6000
|
+
getBarGrowAnimationStyle,
|
|
5056
6001
|
getBreadcrumbItemClasses,
|
|
5057
6002
|
getBreadcrumbLinkClasses,
|
|
5058
6003
|
getBreadcrumbSeparatorClasses,
|
|
5059
6004
|
getButtonVariantClasses,
|
|
5060
6005
|
getCalendarDays,
|
|
5061
6006
|
getCardClasses,
|
|
6007
|
+
getChartAnimationStyle,
|
|
6008
|
+
getChartAxisTicks,
|
|
6009
|
+
getChartElementOpacity,
|
|
6010
|
+
getChartEntranceTransform,
|
|
6011
|
+
getChartGridLineDasharray,
|
|
6012
|
+
getChartInnerRect,
|
|
5062
6013
|
getCheckboxCellClasses,
|
|
5063
6014
|
getCheckboxClasses,
|
|
5064
6015
|
getCheckboxLabelClasses,
|
|
@@ -5136,6 +6087,7 @@ export {
|
|
|
5136
6087
|
getNextActiveKey,
|
|
5137
6088
|
getNotificationIconPath,
|
|
5138
6089
|
getNotificationTypeClasses,
|
|
6090
|
+
getNumberExtent,
|
|
5139
6091
|
getOffsetClasses,
|
|
5140
6092
|
getOrderClasses,
|
|
5141
6093
|
getPageNumbers,
|
|
@@ -5145,10 +6097,17 @@ export {
|
|
|
5145
6097
|
getPaginationButtonBaseClasses,
|
|
5146
6098
|
getPaginationContainerClasses,
|
|
5147
6099
|
getPaginationEllipsisClasses,
|
|
6100
|
+
getPaginationLabels,
|
|
5148
6101
|
getParagraphRowWidth,
|
|
5149
6102
|
getParentKeys,
|
|
6103
|
+
getPathDrawAnimationStyle,
|
|
6104
|
+
getPathDrawStyles,
|
|
6105
|
+
getPathLength,
|
|
5150
6106
|
getPendingDotClasses,
|
|
5151
6107
|
getPictureCardClasses,
|
|
6108
|
+
getPieArcs,
|
|
6109
|
+
getPieDrawAnimationStyle,
|
|
6110
|
+
getPlacementSide,
|
|
5152
6111
|
getPopconfirmArrowClasses,
|
|
5153
6112
|
getPopconfirmButtonBaseClasses,
|
|
5154
6113
|
getPopconfirmButtonsClasses,
|
|
@@ -5169,6 +6128,8 @@ export {
|
|
|
5169
6128
|
getProgressTextColorClasses,
|
|
5170
6129
|
getProgressVariantClasses,
|
|
5171
6130
|
getQuickJumperInputClasses,
|
|
6131
|
+
getRadarAngles,
|
|
6132
|
+
getRadarPoints,
|
|
5172
6133
|
getRadioColorClasses,
|
|
5173
6134
|
getRadioDotClasses,
|
|
5174
6135
|
getRadioGroupClasses,
|
|
@@ -5182,6 +6143,13 @@ export {
|
|
|
5182
6143
|
getSeparatorContent,
|
|
5183
6144
|
getShortDayNames,
|
|
5184
6145
|
getShortMonthNames,
|
|
6146
|
+
getSimplePaginationButtonClasses,
|
|
6147
|
+
getSimplePaginationButtonsWrapperClasses,
|
|
6148
|
+
getSimplePaginationContainerClasses,
|
|
6149
|
+
getSimplePaginationControlsClasses,
|
|
6150
|
+
getSimplePaginationPageIndicatorClasses,
|
|
6151
|
+
getSimplePaginationSelectClasses,
|
|
6152
|
+
getSimplePaginationTotalClasses,
|
|
5185
6153
|
getSkeletonClasses,
|
|
5186
6154
|
getSkeletonDimensions,
|
|
5187
6155
|
getSliderThumbClasses,
|
|
@@ -5203,6 +6171,7 @@ export {
|
|
|
5203
6171
|
getStepsContainerClasses,
|
|
5204
6172
|
getSubMenuExpandIconClasses,
|
|
5205
6173
|
getSubMenuTitleClasses,
|
|
6174
|
+
getSvgDefaultAttrs,
|
|
5206
6175
|
getSwitchClasses,
|
|
5207
6176
|
getSwitchThumbClasses,
|
|
5208
6177
|
getTabItemClasses,
|
|
@@ -5236,6 +6205,7 @@ export {
|
|
|
5236
6205
|
getTooltipTriggerClasses,
|
|
5237
6206
|
getTotalPages,
|
|
5238
6207
|
getTotalTextClasses,
|
|
6208
|
+
getTransformOrigin,
|
|
5239
6209
|
getTreeNodeClasses,
|
|
5240
6210
|
getTreeNodeExpandIconClasses,
|
|
5241
6211
|
getUploadButtonClasses,
|
|
@@ -5246,6 +6216,7 @@ export {
|
|
|
5246
6216
|
groupItemsIntoRows,
|
|
5247
6217
|
handleNodeCheck,
|
|
5248
6218
|
hasErrors,
|
|
6219
|
+
icon16ViewBox,
|
|
5249
6220
|
icon20ViewBox,
|
|
5250
6221
|
icon24PathStrokeLinecap,
|
|
5251
6222
|
icon24PathStrokeLinejoin,
|
|
@@ -5256,6 +6227,9 @@ export {
|
|
|
5256
6227
|
iconWrapperClasses,
|
|
5257
6228
|
injectLoadingAnimationStyles,
|
|
5258
6229
|
injectShakeStyle,
|
|
6230
|
+
injectSvgAnimationStyles,
|
|
6231
|
+
inputFocusClasses,
|
|
6232
|
+
interactiveClasses,
|
|
5259
6233
|
interpolateUploadLabel,
|
|
5260
6234
|
isActivationKey,
|
|
5261
6235
|
isBrowser,
|
|
@@ -5313,12 +6287,15 @@ export {
|
|
|
5313
6287
|
loadingSizeClasses,
|
|
5314
6288
|
loadingSpinnerBaseClasses,
|
|
5315
6289
|
loadingTextSizeClasses,
|
|
6290
|
+
lockClosedIcon24PathD,
|
|
6291
|
+
lockOpenIcon24PathD,
|
|
5316
6292
|
menuBaseClasses,
|
|
5317
6293
|
menuCollapsedClasses,
|
|
5318
6294
|
menuCollapsedItemClasses,
|
|
5319
6295
|
menuDarkThemeClasses,
|
|
5320
6296
|
menuItemBaseClasses,
|
|
5321
6297
|
menuItemDisabledClasses,
|
|
6298
|
+
menuItemFocusClasses,
|
|
5322
6299
|
menuItemGroupTitleClasses,
|
|
5323
6300
|
menuItemHoverDarkClasses,
|
|
5324
6301
|
menuItemHoverLightClasses,
|
|
@@ -5351,6 +6328,7 @@ export {
|
|
|
5351
6328
|
modalSizeClasses,
|
|
5352
6329
|
modalTitleClasses,
|
|
5353
6330
|
modalWrapperClasses,
|
|
6331
|
+
normalizeChartPadding,
|
|
5354
6332
|
normalizeDate,
|
|
5355
6333
|
normalizeSvgAttrs,
|
|
5356
6334
|
notificationBaseClasses,
|
|
@@ -5368,6 +6346,7 @@ export {
|
|
|
5368
6346
|
parseDate,
|
|
5369
6347
|
parseTime,
|
|
5370
6348
|
parseWidthToPx,
|
|
6349
|
+
polarToCartesian,
|
|
5371
6350
|
popconfirmErrorIconPath,
|
|
5372
6351
|
popconfirmIconPathStrokeLinecap,
|
|
5373
6352
|
popconfirmIconPathStrokeLinejoin,
|
|
@@ -5418,12 +6397,20 @@ export {
|
|
|
5418
6397
|
skeletonVariantDefaults,
|
|
5419
6398
|
sliderBaseClasses,
|
|
5420
6399
|
sliderDisabledClasses,
|
|
6400
|
+
sliderGetKeyboardValue,
|
|
6401
|
+
sliderGetPercentage,
|
|
6402
|
+
sliderGetValueFromPosition,
|
|
6403
|
+
sliderNormalizeValue,
|
|
5421
6404
|
sliderRangeClasses,
|
|
5422
6405
|
sliderSizeClasses,
|
|
5423
6406
|
sliderThumbClasses,
|
|
5424
6407
|
sliderTooltipClasses,
|
|
5425
6408
|
sliderTrackClasses,
|
|
6409
|
+
sortAscIcon16PathD,
|
|
6410
|
+
sortBothIcon16PathD,
|
|
5426
6411
|
sortData,
|
|
6412
|
+
sortDescIcon16PathD,
|
|
6413
|
+
stackSeriesData,
|
|
5427
6414
|
statusErrorIconPath,
|
|
5428
6415
|
statusIconPaths,
|
|
5429
6416
|
statusInfoIconPath,
|
|
@@ -5450,6 +6437,7 @@ export {
|
|
|
5450
6437
|
tabAddButtonClasses,
|
|
5451
6438
|
tabCloseButtonClasses,
|
|
5452
6439
|
tabContentBaseClasses,
|
|
6440
|
+
tabFocusClasses,
|
|
5453
6441
|
tabItemBaseClasses,
|
|
5454
6442
|
tabItemCardActiveClasses,
|
|
5455
6443
|
tabItemCardClasses,
|