@expcat/tigercat-core 0.4.0 → 0.4.3
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 +196 -7
- package/dist/index.d.cts +240 -3
- package/dist/index.d.ts +240 -3
- package/dist/index.js +170 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -487,6 +487,7 @@ var icon16ViewBox = "0 0 16 16";
|
|
|
487
487
|
var sortAscIcon16PathD = "M8 3l4 4H4l4-4z";
|
|
488
488
|
var sortDescIcon16PathD = "M8 13l-4-4h8l-4 4z";
|
|
489
489
|
var sortBothIcon16PathD = "M8 3l4 4H4l4-4zM8 13l-4-4h8l-4 4z";
|
|
490
|
+
var expandChevronIcon16PathD = "M6 3l5 5-5 5V3z";
|
|
490
491
|
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";
|
|
491
492
|
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";
|
|
492
493
|
var CalendarIconPath = calendarSolidIcon20PathD;
|
|
@@ -1110,6 +1111,106 @@ function parseInputValue(target, type) {
|
|
|
1110
1111
|
return target.value;
|
|
1111
1112
|
}
|
|
1112
1113
|
|
|
1114
|
+
// src/utils/input-number-utils.ts
|
|
1115
|
+
function getInputNumberWrapperClasses(disabled) {
|
|
1116
|
+
return classNames(
|
|
1117
|
+
"inline-flex items-center relative w-full",
|
|
1118
|
+
"border rounded-md shadow-sm",
|
|
1119
|
+
"bg-[var(--tiger-surface,#ffffff)]",
|
|
1120
|
+
"transition-colors",
|
|
1121
|
+
disabled ? "bg-[var(--tiger-surface-muted,#f3f4f6)] cursor-not-allowed opacity-60" : "hover:border-[var(--tiger-primary,#2563eb)]"
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
var WRAPPER_STATUS_CLASSES = {
|
|
1125
|
+
default: "border-[var(--tiger-border,#e5e7eb)]",
|
|
1126
|
+
error: "border-red-500",
|
|
1127
|
+
success: "border-green-500",
|
|
1128
|
+
warning: "border-yellow-500"
|
|
1129
|
+
};
|
|
1130
|
+
var WRAPPER_FOCUS_STATUS_CLASSES = {
|
|
1131
|
+
default: "ring-[var(--tiger-primary,#2563eb)]",
|
|
1132
|
+
error: "ring-red-500",
|
|
1133
|
+
success: "ring-green-500",
|
|
1134
|
+
warning: "ring-yellow-500"
|
|
1135
|
+
};
|
|
1136
|
+
function getInputNumberStatusClasses(status = "default") {
|
|
1137
|
+
return WRAPPER_STATUS_CLASSES[status];
|
|
1138
|
+
}
|
|
1139
|
+
function getInputNumberFocusRingColor(status = "default") {
|
|
1140
|
+
return WRAPPER_FOCUS_STATUS_CLASSES[status];
|
|
1141
|
+
}
|
|
1142
|
+
var WRAPPER_SIZE_CLASSES = {
|
|
1143
|
+
sm: "h-8",
|
|
1144
|
+
md: "h-10",
|
|
1145
|
+
lg: "h-12"
|
|
1146
|
+
};
|
|
1147
|
+
function getInputNumberSizeClasses(size = "md") {
|
|
1148
|
+
return WRAPPER_SIZE_CLASSES[size];
|
|
1149
|
+
}
|
|
1150
|
+
var INPUT_SIZE_CLASSES2 = {
|
|
1151
|
+
sm: "text-sm px-2",
|
|
1152
|
+
md: "text-base px-3",
|
|
1153
|
+
lg: "text-lg px-4"
|
|
1154
|
+
};
|
|
1155
|
+
function getInputNumberInputClasses(size = "md", hasControlsRight, hasControlsBoth) {
|
|
1156
|
+
return classNames(
|
|
1157
|
+
"w-full h-full bg-transparent border-0 outline-none",
|
|
1158
|
+
"text-[var(--tiger-text,#111827)]",
|
|
1159
|
+
"placeholder:text-[var(--tiger-text-muted,#6b7280)]",
|
|
1160
|
+
"disabled:text-[var(--tiger-text-muted,#6b7280)] disabled:cursor-not-allowed",
|
|
1161
|
+
"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
1162
|
+
INPUT_SIZE_CLASSES2[size],
|
|
1163
|
+
hasControlsRight && "pr-8",
|
|
1164
|
+
hasControlsBoth && "px-8 text-center"
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
function getInputNumberStepButtonClasses(position, disabled) {
|
|
1168
|
+
return classNames(
|
|
1169
|
+
"flex items-center justify-center",
|
|
1170
|
+
"w-7 h-1/2",
|
|
1171
|
+
"border-l border-[var(--tiger-border,#e5e7eb)]",
|
|
1172
|
+
"text-[var(--tiger-text-muted,#6b7280)]",
|
|
1173
|
+
"transition-colors cursor-pointer select-none",
|
|
1174
|
+
position === "up" ? "border-b border-b-[var(--tiger-border,#e5e7eb)]" : "",
|
|
1175
|
+
disabled ? "opacity-40 cursor-not-allowed" : "hover:text-[var(--tiger-primary,#2563eb)] hover:bg-[var(--tiger-surface-muted,#f9fafb)]"
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
function getInputNumberSideButtonClasses(position, disabled) {
|
|
1179
|
+
return classNames(
|
|
1180
|
+
"flex items-center justify-center",
|
|
1181
|
+
"w-8 h-full",
|
|
1182
|
+
"text-[var(--tiger-text-muted,#6b7280)]",
|
|
1183
|
+
"transition-colors cursor-pointer select-none",
|
|
1184
|
+
position === "left" ? "border-r border-r-[var(--tiger-border,#e5e7eb)] rounded-l-md" : "border-l border-l-[var(--tiger-border,#e5e7eb)] rounded-r-md",
|
|
1185
|
+
disabled ? "opacity-40 cursor-not-allowed" : "hover:text-[var(--tiger-primary,#2563eb)] hover:bg-[var(--tiger-surface-muted,#f9fafb)]"
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
var inputNumberControlsRightClasses = "absolute right-0 top-0 h-full flex flex-col";
|
|
1189
|
+
var inputNumberUpIconPathD = "M7 10l5-5 5 5H7z";
|
|
1190
|
+
var inputNumberDownIconPathD = "M7 7l5 5 5-5H7z";
|
|
1191
|
+
var inputNumberMinusIconPathD = "M5 12h14";
|
|
1192
|
+
var inputNumberPlusIconPathD = "M12 5v14M5 12h14";
|
|
1193
|
+
function clampValue(value, min = -Infinity, max = Infinity) {
|
|
1194
|
+
return Math.min(Math.max(value, min), max);
|
|
1195
|
+
}
|
|
1196
|
+
function stepValue(current, step, direction, min = -Infinity, max = Infinity, precision) {
|
|
1197
|
+
const base = current ?? 0;
|
|
1198
|
+
const raw = direction === "up" ? base + step : base - step;
|
|
1199
|
+
const clamped = clampValue(raw, min, max);
|
|
1200
|
+
return precision !== void 0 ? formatPrecision(clamped, precision) : clamped;
|
|
1201
|
+
}
|
|
1202
|
+
function formatPrecision(value, precision) {
|
|
1203
|
+
return Number(value.toFixed(precision));
|
|
1204
|
+
}
|
|
1205
|
+
function isAtMin(value, min = -Infinity) {
|
|
1206
|
+
if (value === null || value === void 0) return false;
|
|
1207
|
+
return value <= min;
|
|
1208
|
+
}
|
|
1209
|
+
function isAtMax(value, max = Infinity) {
|
|
1210
|
+
if (value === null || value === void 0) return false;
|
|
1211
|
+
return value >= max;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1113
1214
|
// src/utils/form-item-styles.ts
|
|
1114
1215
|
var FORM_ITEM_SPACING = {
|
|
1115
1216
|
sm: "mb-3 last:mb-0",
|
|
@@ -1885,7 +1986,7 @@ function isValidTimeValue(value, min, max) {
|
|
|
1885
1986
|
function validateStep(step) {
|
|
1886
1987
|
return Math.max(1, Math.floor(step));
|
|
1887
1988
|
}
|
|
1888
|
-
function
|
|
1989
|
+
function clampValue2(value, min, max) {
|
|
1889
1990
|
return Math.max(min, Math.min(max, value));
|
|
1890
1991
|
}
|
|
1891
1992
|
function parseTime(timeString) {
|
|
@@ -1901,9 +2002,9 @@ function parseTime(timeString) {
|
|
|
1901
2002
|
return { hours, minutes, seconds };
|
|
1902
2003
|
}
|
|
1903
2004
|
function formatTime(hours, minutes, seconds = 0, showSeconds = false) {
|
|
1904
|
-
const h =
|
|
1905
|
-
const m =
|
|
1906
|
-
const s =
|
|
2005
|
+
const h = clampValue2(hours, 0, 23).toString().padStart(2, "0");
|
|
2006
|
+
const m = clampValue2(minutes, 0, 59).toString().padStart(2, "0");
|
|
2007
|
+
const s = clampValue2(seconds, 0, 59).toString().padStart(2, "0");
|
|
1907
2008
|
return showSeconds ? `${h}:${m}:${s}` : `${h}:${m}`;
|
|
1908
2009
|
}
|
|
1909
2010
|
function to12HourFormat(hours) {
|
|
@@ -1948,8 +2049,8 @@ function formatTimeDisplayWithLocale(hours, minutes, seconds = 0, format = "24",
|
|
|
1948
2049
|
}
|
|
1949
2050
|
const { hours: hours12, period } = to12HourFormat(hours);
|
|
1950
2051
|
const h = hours12.toString().padStart(2, "0");
|
|
1951
|
-
const m =
|
|
1952
|
-
const s =
|
|
2052
|
+
const m = clampValue2(minutes, 0, 59).toString().padStart(2, "0");
|
|
2053
|
+
const s = clampValue2(seconds, 0, 59).toString().padStart(2, "0");
|
|
1953
2054
|
const timeStr = showSeconds ? `${h}:${m}:${s}` : `${h}:${m}`;
|
|
1954
2055
|
const labels = getTimePeriodLabels(locale);
|
|
1955
2056
|
const suffix = period === "AM" ? labels.am : labels.pm;
|
|
@@ -2443,6 +2544,11 @@ function getDividerStyle(orientation, color, thickness) {
|
|
|
2443
2544
|
var layoutRootClasses = "tiger-layout flex flex-col min-h-screen";
|
|
2444
2545
|
var layoutHeaderClasses = "tiger-header bg-[var(--tiger-surface,#ffffff)] border-b border-[var(--tiger-border,#e5e7eb)]";
|
|
2445
2546
|
var layoutSidebarClasses = "tiger-sidebar bg-[var(--tiger-surface,#ffffff)] border-r border-[var(--tiger-border,#e5e7eb)] overflow-hidden transition-all duration-300";
|
|
2547
|
+
var layoutSidebarCollapsedClasses = "tiger-sidebar-collapsed";
|
|
2548
|
+
function getSidebarStyle(collapsed, width = "256px", collapsedWidth = "64px") {
|
|
2549
|
+
const w = collapsed ? collapsedWidth : width;
|
|
2550
|
+
return { width: w, minWidth: w };
|
|
2551
|
+
}
|
|
2446
2552
|
var layoutContentClasses = "tiger-content flex-1 bg-[var(--tiger-layout-content-bg,#f9fafb)] p-6";
|
|
2447
2553
|
var layoutFooterClasses = "tiger-footer bg-[var(--tiger-surface,#ffffff)] border-t border-[var(--tiger-border,#e5e7eb)] p-4";
|
|
2448
2554
|
|
|
@@ -2673,6 +2779,29 @@ function calculatePagination(total, current, pageSize) {
|
|
|
2673
2779
|
hasPrev: current > 1
|
|
2674
2780
|
};
|
|
2675
2781
|
}
|
|
2782
|
+
function getExpandIconCellClasses(size) {
|
|
2783
|
+
return getCheckboxCellClasses(size);
|
|
2784
|
+
}
|
|
2785
|
+
function getExpandIconClasses(expanded) {
|
|
2786
|
+
return classNames(
|
|
2787
|
+
"inline-block transition-transform duration-200 cursor-pointer text-[var(--tiger-text-muted,#6b7280)]",
|
|
2788
|
+
expanded && "rotate-90"
|
|
2789
|
+
);
|
|
2790
|
+
}
|
|
2791
|
+
function getExpandedRowClasses() {
|
|
2792
|
+
return classNames(
|
|
2793
|
+
"border-b border-[var(--tiger-border,#e5e7eb)] last:border-b-0",
|
|
2794
|
+
"bg-[var(--tiger-surface-muted,#f9fafb)]/30"
|
|
2795
|
+
);
|
|
2796
|
+
}
|
|
2797
|
+
function getExpandedRowContentClasses(size) {
|
|
2798
|
+
const paddingClasses = {
|
|
2799
|
+
sm: "px-3 py-2",
|
|
2800
|
+
md: "px-4 py-3",
|
|
2801
|
+
lg: "px-6 py-4"
|
|
2802
|
+
};
|
|
2803
|
+
return classNames("text-sm text-[var(--tiger-text,#111827)]", paddingClasses[size]);
|
|
2804
|
+
}
|
|
2676
2805
|
function getRowKey(record, rowKey, index) {
|
|
2677
2806
|
if (typeof rowKey === "function") {
|
|
2678
2807
|
return rowKey(record);
|
|
@@ -3530,12 +3659,16 @@ var submenuTitleClasses = "flex w-full items-center justify-between px-4 py-2 te
|
|
|
3530
3659
|
var submenuExpandIconClasses = "ml-2 transition-transform duration-200";
|
|
3531
3660
|
var submenuExpandIconExpandedClasses = "transform rotate-180";
|
|
3532
3661
|
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";
|
|
3662
|
+
var submenuContentHorizontalNestedClasses = "absolute left-full top-0 ml-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";
|
|
3533
3663
|
var submenuContentPopupClasses = "absolute left-full top-0 ml-1 min-w-[180px] bg-[var(--tiger-surface,#ffffff)] text-[var(--tiger-text,#111827)] border border-[var(--tiger-border,#e5e7eb)] rounded shadow-lg z-50";
|
|
3534
3664
|
var submenuContentVerticalClasses = "overflow-hidden pl-2";
|
|
3535
3665
|
var submenuContentInlineClasses = "overflow-hidden";
|
|
3536
3666
|
var menuItemGroupTitleClasses = "px-4 py-2 text-xs font-semibold text-[var(--tiger-text-muted,#6b7280)] uppercase tracking-wider";
|
|
3537
3667
|
var menuCollapsedClasses = "min-w-[64px]";
|
|
3538
3668
|
var menuCollapsedItemClasses = "justify-center px-2";
|
|
3669
|
+
function getSubmenuPopupZIndex(level) {
|
|
3670
|
+
return { zIndex: 50 + level * 10 };
|
|
3671
|
+
}
|
|
3539
3672
|
function getMenuClasses(mode, theme, collapsed) {
|
|
3540
3673
|
const classes = [menuBaseClasses, menuModeClasses[mode]];
|
|
3541
3674
|
if (theme === "dark") {
|
|
@@ -3607,7 +3740,11 @@ function replaceKeys(key, keys) {
|
|
|
3607
3740
|
function getMenuButtons(container) {
|
|
3608
3741
|
return Array.from(
|
|
3609
3742
|
container.querySelectorAll('button[data-tiger-menuitem="true"]')
|
|
3610
|
-
).filter((el) =>
|
|
3743
|
+
).filter((el) => {
|
|
3744
|
+
if (el.disabled || el.closest('[data-tiger-menu-hidden="true"]')) return false;
|
|
3745
|
+
const nearest = el.closest('ul[role="menu"]');
|
|
3746
|
+
return nearest === container;
|
|
3747
|
+
});
|
|
3611
3748
|
}
|
|
3612
3749
|
function moveFocusInMenu(current, delta) {
|
|
3613
3750
|
const menuEl = current.closest('ul[role="menu"]');
|
|
@@ -6983,6 +7120,7 @@ export {
|
|
|
6983
7120
|
clampPercentage,
|
|
6984
7121
|
clampScale,
|
|
6985
7122
|
clampSlideIndex,
|
|
7123
|
+
clampValue,
|
|
6986
7124
|
classNames,
|
|
6987
7125
|
clearFieldErrors,
|
|
6988
7126
|
clipCommentTreeDepth,
|
|
@@ -7085,6 +7223,7 @@ export {
|
|
|
7085
7223
|
dotsVariantConfig,
|
|
7086
7224
|
ensureBarMinHeight,
|
|
7087
7225
|
errorCircleSolidIcon20PathD,
|
|
7226
|
+
expandChevronIcon16PathD,
|
|
7088
7227
|
fileToUploadFile,
|
|
7089
7228
|
filterData,
|
|
7090
7229
|
filterOptions,
|
|
@@ -7108,6 +7247,7 @@ export {
|
|
|
7108
7247
|
formatMonthYear,
|
|
7109
7248
|
formatPageAriaLabel,
|
|
7110
7249
|
formatPaginationTotal,
|
|
7250
|
+
formatPrecision,
|
|
7111
7251
|
formatProgressText,
|
|
7112
7252
|
formatTime,
|
|
7113
7253
|
formatTimeDisplay,
|
|
@@ -7202,6 +7342,10 @@ export {
|
|
|
7202
7342
|
getDropdownTriggerClasses,
|
|
7203
7343
|
getElementOffsetTop,
|
|
7204
7344
|
getErrorFields,
|
|
7345
|
+
getExpandIconCellClasses,
|
|
7346
|
+
getExpandIconClasses,
|
|
7347
|
+
getExpandedRowClasses,
|
|
7348
|
+
getExpandedRowContentClasses,
|
|
7205
7349
|
getFieldError,
|
|
7206
7350
|
getFileListItemClasses,
|
|
7207
7351
|
getFirstDayOfMonth,
|
|
@@ -7224,6 +7368,13 @@ export {
|
|
|
7224
7368
|
getInputAffixClasses,
|
|
7225
7369
|
getInputClasses,
|
|
7226
7370
|
getInputErrorClasses,
|
|
7371
|
+
getInputNumberFocusRingColor,
|
|
7372
|
+
getInputNumberInputClasses,
|
|
7373
|
+
getInputNumberSideButtonClasses,
|
|
7374
|
+
getInputNumberSizeClasses,
|
|
7375
|
+
getInputNumberStatusClasses,
|
|
7376
|
+
getInputNumberStepButtonClasses,
|
|
7377
|
+
getInputNumberWrapperClasses,
|
|
7227
7378
|
getInputWrapperClasses,
|
|
7228
7379
|
getJustifyClasses,
|
|
7229
7380
|
getLeafKeys,
|
|
@@ -7317,6 +7468,7 @@ export {
|
|
|
7317
7468
|
getSeparatorContent,
|
|
7318
7469
|
getShortDayNames,
|
|
7319
7470
|
getShortMonthNames,
|
|
7471
|
+
getSidebarStyle,
|
|
7320
7472
|
getSimplePaginationButtonClasses,
|
|
7321
7473
|
getSimplePaginationButtonsWrapperClasses,
|
|
7322
7474
|
getSimplePaginationContainerClasses,
|
|
@@ -7345,6 +7497,7 @@ export {
|
|
|
7345
7497
|
getStepsContainerClasses,
|
|
7346
7498
|
getSubMenuExpandIconClasses,
|
|
7347
7499
|
getSubMenuTitleClasses,
|
|
7500
|
+
getSubmenuPopupZIndex,
|
|
7348
7501
|
getSvgDefaultAttrs,
|
|
7349
7502
|
getSwitchClasses,
|
|
7350
7503
|
getSwitchThumbClasses,
|
|
@@ -7430,9 +7583,16 @@ export {
|
|
|
7430
7583
|
injectShakeStyle,
|
|
7431
7584
|
injectSvgAnimationStyles,
|
|
7432
7585
|
inputFocusClasses,
|
|
7586
|
+
inputNumberControlsRightClasses,
|
|
7587
|
+
inputNumberDownIconPathD,
|
|
7588
|
+
inputNumberMinusIconPathD,
|
|
7589
|
+
inputNumberPlusIconPathD,
|
|
7590
|
+
inputNumberUpIconPathD,
|
|
7433
7591
|
interactiveClasses,
|
|
7434
7592
|
interpolateUploadLabel,
|
|
7435
7593
|
isActivationKey,
|
|
7594
|
+
isAtMax,
|
|
7595
|
+
isAtMin,
|
|
7436
7596
|
isBrowser,
|
|
7437
7597
|
isDateInRange,
|
|
7438
7598
|
isEnterKey,
|
|
@@ -7457,6 +7617,7 @@ export {
|
|
|
7457
7617
|
layoutHeaderClasses,
|
|
7458
7618
|
layoutRootClasses,
|
|
7459
7619
|
layoutSidebarClasses,
|
|
7620
|
+
layoutSidebarCollapsedClasses,
|
|
7460
7621
|
linePointTransitionClasses,
|
|
7461
7622
|
linkBaseClasses,
|
|
7462
7623
|
linkDisabledClasses,
|
|
@@ -7645,7 +7806,9 @@ export {
|
|
|
7645
7806
|
statusSuccessIconPath,
|
|
7646
7807
|
statusWarningIconPath,
|
|
7647
7808
|
stepFinishChar,
|
|
7809
|
+
stepValue,
|
|
7648
7810
|
submenuContentHorizontalClasses,
|
|
7811
|
+
submenuContentHorizontalNestedClasses,
|
|
7649
7812
|
submenuContentInlineClasses,
|
|
7650
7813
|
submenuContentPopupClasses,
|
|
7651
7814
|
submenuContentVerticalClasses,
|