@axzydev/axzy_ui_system 1.7.3 → 1.8.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 +1845 -721
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +386 -15
- package/dist/index.d.ts +386 -15
- package/dist/index.js +1532 -418
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +4 -2
- package/src/App.tsx +6 -8
- package/src/components/atoms/button/button.tsx +7 -0
- package/src/components/atoms/flex/flex.props.ts +3 -1
- package/src/components/atoms/flex/flex.tsx +11 -3
- package/src/components/atoms/input/input.tsx +5 -0
- package/src/components/atoms/segmented-control/segmented-control.tsx +22 -5
- package/src/components/atoms/textarea/textarea.props.ts +4 -0
- package/src/components/atoms/textarea/textarea.tsx +13 -3
- package/src/components/molecules/card/card.props.ts +14 -0
- package/src/components/molecules/card/card.tsx +66 -23
- package/src/components/molecules/chip-input/chip-input.tsx +2 -0
- package/src/components/molecules/line-bar-chart/line-bar-chart.props.ts +4 -0
- package/src/components/molecules/line-bar-chart/line-bar-chart.tsx +57 -41
- package/src/components/molecules/multi-select/multi-select.tsx +2 -0
- package/src/components/molecules/tabs/tabs.tsx +22 -8
- package/src/components/organisms/dropfile/dropfile.props.ts +8 -2
- package/src/components/organisms/dropfile/dropfile.tsx +17 -0
- package/src/components/organisms/page-header/page-header.tsx +22 -6
- package/src/components/organisms/sidebar/sidebar.tsx +8 -5
- package/src/components/organisms/topbar/topbar.props.ts +2 -0
- package/src/components/organisms/topbar/topbar.tsx +56 -34
- package/src/components/templates/layout/layout.tsx +3 -2
- package/src/components/theme-provider/themeProvider.props.ts +1 -1
- package/src/components/theme-provider/themeProvider.tsx +54 -1
- package/src/i18n/locales/en.ts +7 -0
- package/src/i18n/locales/es.ts +7 -0
- package/src/index.ts +35 -7
- package/src/json-renderer/actions/effects.test.tsx +115 -0
- package/src/json-renderer/actions/effects.ts +291 -0
- package/src/json-renderer/actions/effectsChain.test.ts +117 -0
- package/src/json-renderer/binding/binding.test.tsx +168 -0
- package/src/json-renderer/binding/resolveValue.ts +193 -0
- package/src/json-renderer/catalog/axzyCatalog.ts +5 -0
- package/src/json-renderer/estado-acciones.test.tsx +166 -0
- package/src/json-renderer/form/FormNode.tsx +92 -0
- package/src/json-renderer/form/form.test.tsx +148 -0
- package/src/json-renderer/form/formLength.test.tsx +99 -0
- package/src/json-renderer/form/rules.ts +162 -0
- package/src/json-renderer/index.ts +21 -0
- package/src/json-renderer/kernel/SchemaRenderer.tsx +83 -7
- package/src/json-renderer/kernel/capabilities.ts +30 -0
- package/src/json-renderer/kernel/renderNode.tsx +256 -3
- package/src/json-renderer/kernel/schemaRenderer.props.ts +29 -3
- package/src/json-renderer/kernel/slots.test.tsx +104 -0
- package/src/json-renderer/kernel/slots.ts +34 -0
- package/src/json-renderer/kernel/types.ts +4 -0
- package/src/json-renderer/routing/match.ts +82 -0
- package/src/json-renderer/routing/navigation.ts +71 -0
- package/src/json-renderer/routing/routes.ts +179 -0
- package/src/json-renderer/routing/routing.test.ts +147 -0
- package/src/json-renderer/seguridad.test.tsx +299 -0
- package/src/json-renderer/shared/errors.ts +1 -0
- package/src/json-renderer/stream/tolerantParse.ts +5 -0
- package/src/json-renderer/stream/useSchemaStream.test.tsx +143 -0
- package/src/json-renderer/stream/useSchemaStream.ts +227 -0
- package/src/json-renderer/validation/jsonSchema.test.ts +105 -0
- package/src/json-renderer/validation/jsonSchema.ts +317 -0
- package/src/json-renderer/validation/validate.ts +17 -0
- package/src/sandbox/axzyConfig.test.ts +4 -0
- package/src/sandbox/axzyConfig.ts +1 -1
- package/src/sandbox/i18n.ts +44 -0
- package/src/sandbox/useHashRoute.ts +2 -1
- package/src/showcases/DemoJsonDashboard.tsx +218 -103
- package/src/showcases/DemoJsonDocs.tsx +11 -11
- package/src/showcases/FeedbackShowcases.tsx +2 -1
- package/src/showcases/JsonScreenShowcase.tsx +43 -53
- package/src/showcases/StructureShowcases.tsx +17 -2
- package/src/showcases/demoApp/demoJson.test.tsx +241 -0
- package/src/showcases/demoApp/routes.test.ts +63 -0
- package/src/showcases/demoApp/schemas.test.ts +6 -17
- package/src/theme/theme-context.ts +10 -2
- package/src/theme/theme.ts +1 -1
- package/src/theme/theme.types.ts +2 -1
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
ITDropfile: () => dropfile_default,
|
|
60
60
|
ITEmptyState: () => ITEmptyState,
|
|
61
61
|
ITField: () => ITField,
|
|
62
|
-
ITFlex: () =>
|
|
62
|
+
ITFlex: () => flex_default,
|
|
63
63
|
ITFormBuilder: () => ITFormBuilder,
|
|
64
64
|
ITFormHeader: () => ITFormHeader,
|
|
65
65
|
ITGrid: () => ITGrid,
|
|
@@ -96,7 +96,7 @@ __export(index_exports, {
|
|
|
96
96
|
ITTable: () => ITTable,
|
|
97
97
|
ITTabs: () => tabs_default,
|
|
98
98
|
ITText: () => ITText,
|
|
99
|
-
ITTextarea: () =>
|
|
99
|
+
ITTextarea: () => textarea_default,
|
|
100
100
|
ITThemeProvider: () => ITThemeProvider,
|
|
101
101
|
ITTimePicker: () => ITTimePicker,
|
|
102
102
|
ITToast: () => ITToast,
|
|
@@ -108,13 +108,16 @@ __export(index_exports, {
|
|
|
108
108
|
auditTree: () => auditTree,
|
|
109
109
|
axzyCatalog: () => axzyCatalog,
|
|
110
110
|
axzyCatalogTypes: () => axzyCatalogTypes,
|
|
111
|
+
buildNavigationTree: () => buildNavigationTree,
|
|
111
112
|
buildVocabularyContract: () => buildVocabularyContract,
|
|
112
113
|
countPendingNodes: () => countPendingNodes,
|
|
114
|
+
createBindingResolver: () => createBindingResolver,
|
|
113
115
|
createCatalog: () => createCatalog,
|
|
114
116
|
createLimitTracker: () => createLimitTracker,
|
|
115
117
|
createValidationSchema: () => createValidationSchema,
|
|
116
118
|
enMessages: () => en_default,
|
|
117
119
|
esMessages: () => es_default,
|
|
120
|
+
flattenRoutes: () => flattenRoutes,
|
|
118
121
|
formatPath: () => formatPath,
|
|
119
122
|
formatVocabularyForPrompt: () => formatVocabularyForPrompt,
|
|
120
123
|
getCatalogEntry: () => getCatalogEntry,
|
|
@@ -125,7 +128,10 @@ __export(index_exports, {
|
|
|
125
128
|
isLightColor: () => isLightColor,
|
|
126
129
|
isNodePending: () => isNodePending,
|
|
127
130
|
issue: () => issue,
|
|
131
|
+
joinRoutePath: () => joinRoutePath,
|
|
132
|
+
matchRoute: () => matchRoute,
|
|
128
133
|
migrateSchema: () => migrateSchema,
|
|
134
|
+
navContainsRoute: () => navContainsRoute,
|
|
129
135
|
parsePartialSchema: () => parsePartialSchema,
|
|
130
136
|
parsePath: () => parsePath,
|
|
131
137
|
propPath: () => propPath,
|
|
@@ -135,16 +141,20 @@ __export(index_exports, {
|
|
|
135
141
|
resolveCssColor: () => resolveCssColor,
|
|
136
142
|
resolveLimits: () => resolveLimits,
|
|
137
143
|
resolveNode: () => resolveNode,
|
|
144
|
+
routeHref: () => routeHref,
|
|
138
145
|
useClickOutside: () => useClickOutside_default,
|
|
139
146
|
useDebouncedSearch: () => useDebouncedSearch,
|
|
140
147
|
useEditableRow: () => useEditableRow,
|
|
141
148
|
useFloatingPanel: () => useFloatingPanel,
|
|
149
|
+
useITAppearance: () => useITAppearance,
|
|
142
150
|
useITFlatAppearance: () => useITFlatAppearance,
|
|
143
151
|
useITTheme: () => useITTheme,
|
|
144
152
|
useITThemeSafe: () => useITThemeSafe,
|
|
145
153
|
useITTranslation: () => useITTranslation,
|
|
146
154
|
useJsonRender: () => useJsonRender_default,
|
|
155
|
+
useSchemaStream: () => useSchemaStream,
|
|
147
156
|
useTableState: () => useTableState,
|
|
157
|
+
validateRoutes: () => validateRoutes,
|
|
148
158
|
validateSchema: () => validateSchema
|
|
149
159
|
});
|
|
150
160
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -476,10 +486,10 @@ function useTableState({
|
|
|
476
486
|
}
|
|
477
487
|
|
|
478
488
|
// src/hooks/useJsonRender.tsx
|
|
479
|
-
var
|
|
489
|
+
var import_react15 = require("react");
|
|
480
490
|
|
|
481
491
|
// src/components/molecules/json-renderer/json-renderer.tsx
|
|
482
|
-
var
|
|
492
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
483
493
|
|
|
484
494
|
// src/types/button.types.ts
|
|
485
495
|
var buttonVariants = {
|
|
@@ -511,7 +521,7 @@ var buttonIconPadding = {
|
|
|
511
521
|
|
|
512
522
|
// src/components/atoms/button/button.tsx
|
|
513
523
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
514
|
-
var
|
|
524
|
+
var import_react7 = require("react");
|
|
515
525
|
|
|
516
526
|
// src/theme/theme.ts
|
|
517
527
|
var inputSizeTokens = {
|
|
@@ -850,7 +860,7 @@ var components = {
|
|
|
850
860
|
input: {
|
|
851
861
|
backgroundColor: "var(--it-input-bg, #ffffff)",
|
|
852
862
|
borderColor: `var(--it-input-border, ${semanticColors.gray[300]})`,
|
|
853
|
-
borderRadius: "var(--radius-md)",
|
|
863
|
+
borderRadius: "var(--it-input-radius, var(--radius-md))",
|
|
854
864
|
focus: {
|
|
855
865
|
borderColor: `var(--it-input-focus-border, ${semanticColors.primary[500]})`,
|
|
856
866
|
ring: `var(--it-input-focus-ring, 0 0 0 3px ${semanticColors.primary[100]})`
|
|
@@ -1019,6 +1029,26 @@ function ITText({
|
|
|
1019
1029
|
);
|
|
1020
1030
|
}
|
|
1021
1031
|
|
|
1032
|
+
// src/theme/theme-context.ts
|
|
1033
|
+
var import_react6 = require("react");
|
|
1034
|
+
var ITThemeContext = (0, import_react6.createContext)(void 0);
|
|
1035
|
+
var useITTheme = () => {
|
|
1036
|
+
const context = (0, import_react6.useContext)(ITThemeContext);
|
|
1037
|
+
if (!context) {
|
|
1038
|
+
throw new Error("useITTheme must be used within an ITThemeProvider");
|
|
1039
|
+
}
|
|
1040
|
+
return context;
|
|
1041
|
+
};
|
|
1042
|
+
var useITThemeSafe = () => {
|
|
1043
|
+
return (0, import_react6.useContext)(ITThemeContext);
|
|
1044
|
+
};
|
|
1045
|
+
var useITAppearance = () => {
|
|
1046
|
+
return (0, import_react6.useContext)(ITThemeContext)?.appearance ?? "soft";
|
|
1047
|
+
};
|
|
1048
|
+
var useITFlatAppearance = () => {
|
|
1049
|
+
return useITAppearance() === "flat";
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1022
1052
|
// src/components/atoms/button/button.tsx
|
|
1023
1053
|
var import_jsx_runtime2 = (
|
|
1024
1054
|
// Icono solo: sin wrapper con `gap` ni `ITText` vacío, que lo desplazaban a la izquierda.
|
|
@@ -1038,8 +1068,9 @@ function ITButton({
|
|
|
1038
1068
|
ariaLabel,
|
|
1039
1069
|
title
|
|
1040
1070
|
}) {
|
|
1041
|
-
const [isHovered, setIsHovered] = (0,
|
|
1042
|
-
const [isFocused, setIsFocused] = (0,
|
|
1071
|
+
const [isHovered, setIsHovered] = (0, import_react7.useState)(false);
|
|
1072
|
+
const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
|
|
1073
|
+
const bento = useITAppearance() === "bento";
|
|
1043
1074
|
const isIconOnly = variant === "icon-only";
|
|
1044
1075
|
const isIconOnlyContent = isIconOnly && Boolean(icon) && !children;
|
|
1045
1076
|
const themeBtn = theme.button;
|
|
@@ -1059,6 +1090,9 @@ function ITButton({
|
|
|
1059
1090
|
// Default from theme
|
|
1060
1091
|
transition: themeConfig.transition || "all 0.2s"
|
|
1061
1092
|
};
|
|
1093
|
+
if (bento) {
|
|
1094
|
+
style.borderRadius = `var(--it-bento-pill-radius, ${themeConfig.borderRadius})`;
|
|
1095
|
+
}
|
|
1062
1096
|
if (variant === "rounded") {
|
|
1063
1097
|
style.borderRadius = "9999px";
|
|
1064
1098
|
}
|
|
@@ -1124,23 +1158,6 @@ function ITButton({
|
|
|
1124
1158
|
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
1125
1159
|
var import_react11 = require("react");
|
|
1126
1160
|
|
|
1127
|
-
// src/theme/theme-context.ts
|
|
1128
|
-
var import_react7 = require("react");
|
|
1129
|
-
var ITThemeContext = (0, import_react7.createContext)(void 0);
|
|
1130
|
-
var useITTheme = () => {
|
|
1131
|
-
const context = (0, import_react7.useContext)(ITThemeContext);
|
|
1132
|
-
if (!context) {
|
|
1133
|
-
throw new Error("useITTheme must be used within an ITThemeProvider");
|
|
1134
|
-
}
|
|
1135
|
-
return context;
|
|
1136
|
-
};
|
|
1137
|
-
var useITThemeSafe = () => {
|
|
1138
|
-
return (0, import_react7.useContext)(ITThemeContext);
|
|
1139
|
-
};
|
|
1140
|
-
var useITFlatAppearance = () => {
|
|
1141
|
-
return (0, import_react7.useContext)(ITThemeContext)?.appearance === "flat";
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
1161
|
// src/i18n/provider.tsx
|
|
1145
1162
|
var import_react9 = require("react");
|
|
1146
1163
|
|
|
@@ -1352,7 +1369,13 @@ var es = {
|
|
|
1352
1369
|
"jsonEditor.kindString": "texto",
|
|
1353
1370
|
"jsonEditor.kindNumber": "n\xFAmero",
|
|
1354
1371
|
"jsonEditor.kindBoolean": "booleano",
|
|
1355
|
-
"jsonEditor.kindNull": "nulo"
|
|
1372
|
+
"jsonEditor.kindNull": "nulo",
|
|
1373
|
+
// ---------------------------------------------------------------- jsonRenderer
|
|
1374
|
+
"jsonRenderer.form.required": "Campo obligatorio.",
|
|
1375
|
+
"jsonRenderer.form.email": "Escribe un correo v\xE1lido.",
|
|
1376
|
+
"jsonRenderer.form.minLength": "Escribe al menos {min} caracteres.",
|
|
1377
|
+
"jsonRenderer.form.maxLength": "Escribe como m\xE1ximo {max} caracteres.",
|
|
1378
|
+
"jsonRenderer.form.submit": "Enviar"
|
|
1356
1379
|
};
|
|
1357
1380
|
var es_default = es;
|
|
1358
1381
|
|
|
@@ -1558,7 +1581,13 @@ var en = {
|
|
|
1558
1581
|
"jsonEditor.kindString": "string",
|
|
1559
1582
|
"jsonEditor.kindNumber": "number",
|
|
1560
1583
|
"jsonEditor.kindBoolean": "boolean",
|
|
1561
|
-
"jsonEditor.kindNull": "null"
|
|
1584
|
+
"jsonEditor.kindNull": "null",
|
|
1585
|
+
// ---------------------------------------------------------------- jsonRenderer
|
|
1586
|
+
"jsonRenderer.form.required": "Required field.",
|
|
1587
|
+
"jsonRenderer.form.email": "Enter a valid email address.",
|
|
1588
|
+
"jsonRenderer.form.minLength": "Enter at least {min} characters.",
|
|
1589
|
+
"jsonRenderer.form.maxLength": "Enter at most {max} characters.",
|
|
1590
|
+
"jsonRenderer.form.submit": "Submit"
|
|
1562
1591
|
};
|
|
1563
1592
|
var en_default = en;
|
|
1564
1593
|
|
|
@@ -1635,6 +1664,8 @@ function useITTranslation() {
|
|
|
1635
1664
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1636
1665
|
function ITCard({
|
|
1637
1666
|
title,
|
|
1667
|
+
tone,
|
|
1668
|
+
headerActions,
|
|
1638
1669
|
image,
|
|
1639
1670
|
alt,
|
|
1640
1671
|
children,
|
|
@@ -1648,26 +1679,35 @@ function ITCard({
|
|
|
1648
1679
|
}) {
|
|
1649
1680
|
const { t } = useITTranslation();
|
|
1650
1681
|
const [isHovered, setIsHovered] = (0, import_react11.useState)(false);
|
|
1651
|
-
const
|
|
1682
|
+
const appearance = useITAppearance();
|
|
1683
|
+
const bento = appearance === "bento";
|
|
1684
|
+
const flat = appearance === "flat";
|
|
1652
1685
|
const resolvedAlt = alt ?? t("card.imageAlt");
|
|
1653
1686
|
const containerStyle = {
|
|
1654
1687
|
backgroundColor: "var(--it-card-bg, #ffffff)",
|
|
1655
|
-
borderColor: flat ? "var(--it-card-flat-border, var(--color-secondary-200))" : "var(--it-card-border, rgba(15, 23, 42, 0.06))",
|
|
1656
|
-
borderWidth: "1px",
|
|
1688
|
+
borderColor: bento ? "transparent" : flat ? "var(--it-card-flat-border, var(--color-secondary-200))" : "var(--it-card-border, rgba(15, 23, 42, 0.06))",
|
|
1689
|
+
borderWidth: bento ? "0px" : "1px",
|
|
1657
1690
|
borderStyle: "solid",
|
|
1658
|
-
borderRadius: flat ? "var(--it-card-radius, var(--radius-lg))" : "var(--it-card-radius, var(--radius-2xl))",
|
|
1691
|
+
borderRadius: bento ? "var(--it-card-radius, var(--it-bento-card-radius, var(--radius-2xl)))" : flat ? "var(--it-card-radius, var(--radius-lg))" : "var(--it-card-radius, var(--radius-2xl))",
|
|
1659
1692
|
// Soft depth: every card floats a little at rest; interactive cards
|
|
1660
1693
|
// gain visual weight on hover instead of appearing flat until clicked.
|
|
1661
1694
|
// Flat appearance: the hairline border carries the surface, so a card
|
|
1662
1695
|
// only gets a shadow as hover feedback when it is clickable.
|
|
1663
|
-
|
|
1696
|
+
// Bento: borderless, a diffuse shadow at rest and a stronger one on hover.
|
|
1697
|
+
boxShadow: bento ? onClick && isHovered ? "var(--it-bento-card-shadow-hover, var(--shadow-lg))" : "var(--it-bento-card-shadow, var(--shadow-sm))" : flat ? onClick && isHovered ? "var(--shadow-sm)" : "none" : onClick ? isHovered ? "var(--shadow-lg)" : "var(--shadow-sm)" : "var(--shadow-sm)",
|
|
1664
1698
|
transition: onClick ? "box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out" : "none",
|
|
1665
|
-
transform: onClick && isHovered && !flat ? "translateY(-2px)" : "translateY(0)",
|
|
1699
|
+
transform: onClick && isHovered && !flat && !bento ? "translateY(-2px)" : "translateY(0)",
|
|
1666
1700
|
cursor: onClick ? "pointer" : "default"
|
|
1667
1701
|
};
|
|
1702
|
+
if (tone) {
|
|
1703
|
+
const soft = `var(--color-${tone}-soft)`;
|
|
1704
|
+
containerStyle.backgroundImage = `linear-gradient(${soft}, ${soft})`;
|
|
1705
|
+
if (!bento) containerStyle.borderColor = `var(--color-${tone}-soft-border)`;
|
|
1706
|
+
}
|
|
1668
1707
|
const bodyStyle = {
|
|
1669
|
-
padding: "1.25rem"
|
|
1708
|
+
padding: bento ? "var(--it-bento-card-padding, 1.5rem)" : "1.25rem"
|
|
1670
1709
|
};
|
|
1710
|
+
const titleTypography = bento ? "text-lg font-bold" : flat ? "text-base font-semibold" : "text-xl font-semibold";
|
|
1671
1711
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1672
1712
|
"div",
|
|
1673
1713
|
{
|
|
@@ -1694,14 +1734,24 @@ function ITCard({
|
|
|
1694
1734
|
}
|
|
1695
1735
|
),
|
|
1696
1736
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)(contentClassName), style: bodyStyle, children: [
|
|
1697
|
-
|
|
1737
|
+
headerActions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-3", children: [
|
|
1738
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1739
|
+
ITText,
|
|
1740
|
+
{
|
|
1741
|
+
as: "h3",
|
|
1742
|
+
className: (0, import_clsx2.default)(titleTypography, titleClassName),
|
|
1743
|
+
children: title
|
|
1744
|
+
}
|
|
1745
|
+
),
|
|
1746
|
+
headerActions
|
|
1747
|
+
] }) : title ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1698
1748
|
ITText,
|
|
1699
1749
|
{
|
|
1700
1750
|
as: "h3",
|
|
1701
|
-
className: (0, import_clsx2.default)(flat ? "
|
|
1751
|
+
className: (0, import_clsx2.default)(titleTypography, flat ? "mb-3" : bento ? "mb-4" : "mb-2", titleClassName),
|
|
1702
1752
|
children: title
|
|
1703
1753
|
}
|
|
1704
|
-
),
|
|
1754
|
+
) : null,
|
|
1705
1755
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ITText, { as: "div", className: "text-secondary-600", children })
|
|
1706
1756
|
] }),
|
|
1707
1757
|
actions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1721,6 +1771,7 @@ function ITCard({
|
|
|
1721
1771
|
|
|
1722
1772
|
// src/components/atoms/flex/flex.tsx
|
|
1723
1773
|
var import_clsx3 = __toESM(require("clsx"), 1);
|
|
1774
|
+
var import_react12 = require("react");
|
|
1724
1775
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1725
1776
|
var directionMap = {
|
|
1726
1777
|
row: "flex-row",
|
|
@@ -1748,7 +1799,7 @@ var wrapMap = {
|
|
|
1748
1799
|
wrap: "flex-wrap",
|
|
1749
1800
|
"wrap-reverse": "flex-wrap-reverse"
|
|
1750
1801
|
};
|
|
1751
|
-
|
|
1802
|
+
var ITFlex = (0, import_react12.forwardRef)(function ITFlex2({
|
|
1752
1803
|
children,
|
|
1753
1804
|
direction = "row",
|
|
1754
1805
|
align,
|
|
@@ -1761,8 +1812,9 @@ function ITFlex({
|
|
|
1761
1812
|
className,
|
|
1762
1813
|
style,
|
|
1763
1814
|
as: Component = "div",
|
|
1764
|
-
onClick
|
|
1765
|
-
|
|
1815
|
+
onClick,
|
|
1816
|
+
onScroll
|
|
1817
|
+
}, ref) {
|
|
1766
1818
|
const resolvedStyle = {
|
|
1767
1819
|
gap: gap > 0 ? `${gap * 0.25}rem` : void 0,
|
|
1768
1820
|
flexGrow: typeof grow === "boolean" ? grow ? 1 : 0 : grow,
|
|
@@ -1773,6 +1825,7 @@ function ITFlex({
|
|
|
1773
1825
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1774
1826
|
Component,
|
|
1775
1827
|
{
|
|
1828
|
+
ref,
|
|
1776
1829
|
className: (0, import_clsx3.default)(
|
|
1777
1830
|
"flex",
|
|
1778
1831
|
directionMap[direction],
|
|
@@ -1783,14 +1836,17 @@ function ITFlex({
|
|
|
1783
1836
|
),
|
|
1784
1837
|
style: resolvedStyle,
|
|
1785
1838
|
onClick,
|
|
1839
|
+
onScroll,
|
|
1786
1840
|
children
|
|
1787
1841
|
}
|
|
1788
1842
|
);
|
|
1789
|
-
}
|
|
1843
|
+
});
|
|
1844
|
+
ITFlex.displayName = "ITFlex";
|
|
1845
|
+
var flex_default = ITFlex;
|
|
1790
1846
|
|
|
1791
1847
|
// src/components/atoms/stack/stack.tsx
|
|
1792
1848
|
var import_clsx4 = __toESM(require("clsx"), 1);
|
|
1793
|
-
var
|
|
1849
|
+
var import_react13 = require("react");
|
|
1794
1850
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1795
1851
|
var directionMap2 = {
|
|
1796
1852
|
row: "flex-row",
|
|
@@ -1831,7 +1887,7 @@ function ITStack({
|
|
|
1831
1887
|
as: Component = "div"
|
|
1832
1888
|
}) {
|
|
1833
1889
|
const hasDivider = divider !== void 0;
|
|
1834
|
-
const items =
|
|
1890
|
+
const items = import_react13.Children.toArray(children);
|
|
1835
1891
|
const resolvedStyle = {
|
|
1836
1892
|
gap: spacing > 0 ? `${spacing * 0.25}rem` : void 0,
|
|
1837
1893
|
...style
|
|
@@ -1848,9 +1904,9 @@ function ITStack({
|
|
|
1848
1904
|
className
|
|
1849
1905
|
),
|
|
1850
1906
|
style: resolvedStyle,
|
|
1851
|
-
children: hasDivider ? items.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1907
|
+
children: hasDivider ? items.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react13.Fragment, { children: [
|
|
1852
1908
|
child,
|
|
1853
|
-
index < items.length - 1 && (0,
|
|
1909
|
+
index < items.length - 1 && (0, import_react13.isValidElement)(divider) ? (0, import_react13.cloneElement)(divider, { key: `divider-${index}` }) : null
|
|
1854
1910
|
] }, index)) : children
|
|
1855
1911
|
}
|
|
1856
1912
|
);
|
|
@@ -1985,11 +2041,11 @@ function ITJsonRenderer({
|
|
|
1985
2041
|
if (typeof node === "string" || typeof node === "number") {
|
|
1986
2042
|
return node;
|
|
1987
2043
|
}
|
|
1988
|
-
if (
|
|
2044
|
+
if (import_react14.default.isValidElement(node)) {
|
|
1989
2045
|
return node;
|
|
1990
2046
|
}
|
|
1991
2047
|
if (Array.isArray(node)) {
|
|
1992
|
-
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2048
|
+
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderNode2(child) }, idx));
|
|
1993
2049
|
}
|
|
1994
2050
|
const { type, props = {}, children, text } = node;
|
|
1995
2051
|
const childContent = children !== void 0 ? renderNode2(children) : text;
|
|
@@ -2001,7 +2057,7 @@ function ITJsonRenderer({
|
|
|
2001
2057
|
case "card":
|
|
2002
2058
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ITCard, { ...props, children: childContent });
|
|
2003
2059
|
case "flex":
|
|
2004
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(flex_default, { ...props, children: childContent });
|
|
2005
2061
|
case "stack":
|
|
2006
2062
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ITStack, { ...props, children: childContent });
|
|
2007
2063
|
case "grid":
|
|
@@ -2014,7 +2070,7 @@ function ITJsonRenderer({
|
|
|
2014
2070
|
}
|
|
2015
2071
|
};
|
|
2016
2072
|
if (Array.isArray(json)) {
|
|
2017
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children: json.map((n, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children: json.map((n, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderNode2(n) }, idx)) });
|
|
2018
2074
|
}
|
|
2019
2075
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children: renderNode2(json) });
|
|
2020
2076
|
}
|
|
@@ -2022,13 +2078,13 @@ function ITJsonRenderer({
|
|
|
2022
2078
|
// src/hooks/useJsonRender.tsx
|
|
2023
2079
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2024
2080
|
function useJsonRender(json) {
|
|
2025
|
-
return (0,
|
|
2081
|
+
return (0, import_react15.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ITJsonRenderer, { json }), [json]);
|
|
2026
2082
|
}
|
|
2027
2083
|
var useJsonRender_default = useJsonRender;
|
|
2028
2084
|
|
|
2029
2085
|
// src/components/molecules/accordion/accordion.tsx
|
|
2030
2086
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
2031
|
-
var
|
|
2087
|
+
var import_react16 = require("react");
|
|
2032
2088
|
var import_fa2 = require("react-icons/fa");
|
|
2033
2089
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2034
2090
|
function ITAccordion({
|
|
@@ -2041,7 +2097,7 @@ function ITAccordion({
|
|
|
2041
2097
|
className,
|
|
2042
2098
|
itemClassName
|
|
2043
2099
|
}) {
|
|
2044
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
2100
|
+
const [internalOpen, setInternalOpen] = (0, import_react16.useState)(defaultOpenIds);
|
|
2045
2101
|
const isControlled = openIds !== void 0;
|
|
2046
2102
|
const currentOpen = isControlled ? openIds : internalOpen;
|
|
2047
2103
|
const toggle = (id) => {
|
|
@@ -2264,7 +2320,7 @@ function ITBreadcrumbs({
|
|
|
2264
2320
|
}
|
|
2265
2321
|
|
|
2266
2322
|
// src/components/molecules/calendar/calendar.tsx
|
|
2267
|
-
var
|
|
2323
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
2268
2324
|
var import_date_fns = require("date-fns");
|
|
2269
2325
|
var import_clsx12 = require("clsx");
|
|
2270
2326
|
var import_tailwind_merge = require("tailwind-merge");
|
|
@@ -2296,8 +2352,8 @@ var ITCalendar = ({
|
|
|
2296
2352
|
}) => {
|
|
2297
2353
|
const { t, dateLocale } = useITTranslation();
|
|
2298
2354
|
const mode = modeProp || (onChange ? "month" : "week");
|
|
2299
|
-
const [currentDate, setCurrentDate] = (0,
|
|
2300
|
-
const [view, setView] = (0,
|
|
2355
|
+
const [currentDate, setCurrentDate] = (0, import_react17.useState)(value || /* @__PURE__ */ new Date());
|
|
2356
|
+
const [view, setView] = (0, import_react17.useState)("calendar");
|
|
2301
2357
|
const getVariantStyles = () => {
|
|
2302
2358
|
const v = variant || "primary";
|
|
2303
2359
|
return {
|
|
@@ -2307,7 +2363,7 @@ var ITCalendar = ({
|
|
|
2307
2363
|
"--calendar-today-text": `var(--color-${v})`
|
|
2308
2364
|
};
|
|
2309
2365
|
};
|
|
2310
|
-
(0,
|
|
2366
|
+
(0, import_react17.useEffect)(() => {
|
|
2311
2367
|
if (value) setCurrentDate(value);
|
|
2312
2368
|
}, [value]);
|
|
2313
2369
|
const shiftYear = (yearDelta) => {
|
|
@@ -2363,7 +2419,7 @@ var ITCalendar = ({
|
|
|
2363
2419
|
setCurrentDate(/* @__PURE__ */ new Date());
|
|
2364
2420
|
setView("calendar");
|
|
2365
2421
|
};
|
|
2366
|
-
const viewDays = (0,
|
|
2422
|
+
const viewDays = (0, import_react17.useMemo)(() => {
|
|
2367
2423
|
if (mode === "day") {
|
|
2368
2424
|
return [currentDate];
|
|
2369
2425
|
}
|
|
@@ -2382,13 +2438,13 @@ var ITCalendar = ({
|
|
|
2382
2438
|
height: `${duration / 60 * 80}px`
|
|
2383
2439
|
};
|
|
2384
2440
|
};
|
|
2385
|
-
const weekEvents = (0,
|
|
2441
|
+
const weekEvents = (0, import_react17.useMemo)(() => {
|
|
2386
2442
|
return events.filter((event) => {
|
|
2387
2443
|
const eventStart = typeof event.start === "string" ? (0, import_date_fns.parseISO)(event.start) : event.start;
|
|
2388
2444
|
return viewDays.some((day) => (0, import_date_fns.isSameDay)(day, eventStart));
|
|
2389
2445
|
});
|
|
2390
2446
|
}, [events, viewDays]);
|
|
2391
|
-
const monthDays = (0,
|
|
2447
|
+
const monthDays = (0, import_react17.useMemo)(() => {
|
|
2392
2448
|
const start = (0, import_date_fns.startOfWeek)((0, import_date_fns.startOfMonth)(currentDate), { weekStartsOn: 1 });
|
|
2393
2449
|
const end = (0, import_date_fns.endOfWeek)((0, import_date_fns.endOfMonth)(currentDate), { weekStartsOn: 1 });
|
|
2394
2450
|
return (0, import_date_fns.eachDayOfInterval)({ start, end });
|
|
@@ -2398,9 +2454,9 @@ var ITCalendar = ({
|
|
|
2398
2454
|
if (maxDate && (0, import_date_fns.isAfter)(date, (0, import_date_fns.startOfDay)(maxDate))) return true;
|
|
2399
2455
|
return false;
|
|
2400
2456
|
};
|
|
2401
|
-
const [dragStart, setDragStart] = (0,
|
|
2402
|
-
const [dragCurrent, setDragCurrent] = (0,
|
|
2403
|
-
const isDraggingRef =
|
|
2457
|
+
const [dragStart, setDragStart] = (0, import_react17.useState)(null);
|
|
2458
|
+
const [dragCurrent, setDragCurrent] = (0, import_react17.useState)(null);
|
|
2459
|
+
const isDraggingRef = import_react17.default.useRef(false);
|
|
2404
2460
|
const handleMouseDown = (date, e) => {
|
|
2405
2461
|
if (!onSelectRange) return;
|
|
2406
2462
|
e.stopPropagation();
|
|
@@ -2984,7 +3040,7 @@ function ITChip({
|
|
|
2984
3040
|
|
|
2985
3041
|
// src/components/molecules/chip-input/chip-input.tsx
|
|
2986
3042
|
var import_clsx16 = __toESM(require("clsx"), 1);
|
|
2987
|
-
var
|
|
3043
|
+
var import_react18 = require("react");
|
|
2988
3044
|
|
|
2989
3045
|
// src/utils/styles.ts
|
|
2990
3046
|
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
@@ -3117,11 +3173,11 @@ function ITChipInput({
|
|
|
3117
3173
|
className
|
|
3118
3174
|
}) {
|
|
3119
3175
|
const { t } = useITTranslation();
|
|
3120
|
-
const [inputValue, setInputValue] = (0,
|
|
3121
|
-
const [localTouched, setLocalTouched] = (0,
|
|
3122
|
-
const [localError, setLocalError] = (0,
|
|
3123
|
-
const [isFocused, setIsFocused] = (0,
|
|
3124
|
-
const inputRef = (0,
|
|
3176
|
+
const [inputValue, setInputValue] = (0, import_react18.useState)("");
|
|
3177
|
+
const [localTouched, setLocalTouched] = (0, import_react18.useState)(false);
|
|
3178
|
+
const [localError, setLocalError] = (0, import_react18.useState)(void 0);
|
|
3179
|
+
const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
|
|
3180
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3125
3181
|
const inputTheme = theme.input || {};
|
|
3126
3182
|
const isTouched = touched !== void 0 ? touched : localTouched;
|
|
3127
3183
|
const externalError = error !== void 0 && error !== false ? error === true ? t("field.required") : error : required && value.length === 0 ? t("field.required") : void 0;
|
|
@@ -3134,6 +3190,7 @@ function ITChipInput({
|
|
|
3134
3190
|
style.alignItems = "center";
|
|
3135
3191
|
style.gap = "0.375rem";
|
|
3136
3192
|
style.minHeight = "2.5rem";
|
|
3193
|
+
style.borderRadius = "var(--it-bento-field-radius, var(--radius-md))";
|
|
3137
3194
|
if (disabled) {
|
|
3138
3195
|
style.backgroundColor = inputTheme.disabled?.backgroundColor || style.backgroundColor;
|
|
3139
3196
|
style.borderColor = inputTheme.disabled?.borderColor || style.borderColor;
|
|
@@ -3262,7 +3319,7 @@ function ITChipInput({
|
|
|
3262
3319
|
|
|
3263
3320
|
// src/components/molecules/dropdown-menu/dropdown-menu.tsx
|
|
3264
3321
|
var import_clsx17 = __toESM(require("clsx"), 1);
|
|
3265
|
-
var
|
|
3322
|
+
var import_react19 = require("react");
|
|
3266
3323
|
var import_react_dom = require("react-dom");
|
|
3267
3324
|
var import_fa6 = require("react-icons/fa");
|
|
3268
3325
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -3278,20 +3335,20 @@ function ITDropdownMenu({
|
|
|
3278
3335
|
}) {
|
|
3279
3336
|
const { t } = useITTranslation();
|
|
3280
3337
|
const resolvedTriggerLabel = triggerLabel ?? t("dropdownMenu.open");
|
|
3281
|
-
const [isOpen, setIsOpen] = (0,
|
|
3282
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3283
|
-
const triggerRef = (0,
|
|
3284
|
-
const itemRefs = (0,
|
|
3338
|
+
const [isOpen, setIsOpen] = (0, import_react19.useState)(false);
|
|
3339
|
+
const [activeIndex, setActiveIndex] = (0, import_react19.useState)(-1);
|
|
3340
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
3341
|
+
const itemRefs = (0, import_react19.useRef)([]);
|
|
3285
3342
|
const { panelRef, style: panelStyle } = useFloatingPanel(triggerRef, isOpen, {
|
|
3286
3343
|
estimatedHeight: Math.max(items.length * 40, 120),
|
|
3287
3344
|
matchWidth: false,
|
|
3288
3345
|
align: placement.endsWith("end") ? "end" : "start"
|
|
3289
3346
|
});
|
|
3290
|
-
const enabledIndexes = (0,
|
|
3347
|
+
const enabledIndexes = (0, import_react19.useMemo)(
|
|
3291
3348
|
() => items.map((item, i) => item.disabled ? -1 : i).filter((i) => i >= 0),
|
|
3292
3349
|
[items]
|
|
3293
3350
|
);
|
|
3294
|
-
(0,
|
|
3351
|
+
(0, import_react19.useEffect)(() => {
|
|
3295
3352
|
if (!isOpen) return;
|
|
3296
3353
|
function handleClickOutside(event) {
|
|
3297
3354
|
const target = event.target;
|
|
@@ -3302,7 +3359,7 @@ function ITDropdownMenu({
|
|
|
3302
3359
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3303
3360
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3304
3361
|
}, [isOpen, panelRef]);
|
|
3305
|
-
(0,
|
|
3362
|
+
(0, import_react19.useEffect)(() => {
|
|
3306
3363
|
if (isOpen) {
|
|
3307
3364
|
setActiveIndex(enabledIndexes[0] ?? -1);
|
|
3308
3365
|
requestAnimationFrame(() => {
|
|
@@ -3475,12 +3532,12 @@ function ITField({
|
|
|
3475
3532
|
}
|
|
3476
3533
|
|
|
3477
3534
|
// src/components/molecules/masked-input/masked-input.tsx
|
|
3478
|
-
var
|
|
3535
|
+
var import_react21 = require("react");
|
|
3479
3536
|
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
3480
3537
|
|
|
3481
3538
|
// src/components/atoms/input/input.tsx
|
|
3482
3539
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
3483
|
-
var
|
|
3540
|
+
var import_react20 = require("react");
|
|
3484
3541
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3485
3542
|
function ITInput({
|
|
3486
3543
|
name,
|
|
@@ -3521,15 +3578,18 @@ function ITInput({
|
|
|
3521
3578
|
const isNumberType = type === "number";
|
|
3522
3579
|
const isTextArea = type === "textarea";
|
|
3523
3580
|
const decimalPlaces = decimals ?? (currencyFormat ? 2 : 0);
|
|
3524
|
-
const [displayValue, setDisplayValue] = (0,
|
|
3525
|
-
const [isFocused, setIsFocused] = (0,
|
|
3526
|
-
const [hasSelectedAll, setHasSelectedAll] = (0,
|
|
3527
|
-
const [showPassword, setShowPassword] = (0,
|
|
3528
|
-
const [localTouched, setLocalTouched] = (0,
|
|
3529
|
-
const inputRef = (0,
|
|
3581
|
+
const [displayValue, setDisplayValue] = (0, import_react20.useState)("");
|
|
3582
|
+
const [isFocused, setIsFocused] = (0, import_react20.useState)(false);
|
|
3583
|
+
const [hasSelectedAll, setHasSelectedAll] = (0, import_react20.useState)(false);
|
|
3584
|
+
const [showPassword, setShowPassword] = (0, import_react20.useState)(false);
|
|
3585
|
+
const [localTouched, setLocalTouched] = (0, import_react20.useState)(false);
|
|
3586
|
+
const inputRef = (0, import_react20.useRef)(null);
|
|
3530
3587
|
const inputTheme = theme.input || {};
|
|
3531
3588
|
const getStyle = () => {
|
|
3532
3589
|
const style = inputFieldStyle(inputTheme, size);
|
|
3590
|
+
if (isTextArea) {
|
|
3591
|
+
style.borderRadius = "var(--it-bento-field-radius, var(--radius-md))";
|
|
3592
|
+
}
|
|
3533
3593
|
if (disabled) {
|
|
3534
3594
|
style.backgroundColor = inputTheme.disabled?.backgroundColor || style.backgroundColor;
|
|
3535
3595
|
style.borderColor = inputTheme.disabled?.borderColor || style.borderColor;
|
|
@@ -3565,7 +3625,7 @@ function ITInput({
|
|
|
3565
3625
|
setHasSelectedAll(true);
|
|
3566
3626
|
}
|
|
3567
3627
|
};
|
|
3568
|
-
const formatValue = (0,
|
|
3628
|
+
const formatValue = (0, import_react20.useCallback)(
|
|
3569
3629
|
(val) => {
|
|
3570
3630
|
const num = typeof val === "string" ? parseFloat(val.replace(/,/g, "")) : val;
|
|
3571
3631
|
if (num == null || isNaN(num)) {
|
|
@@ -3584,14 +3644,14 @@ function ITInput({
|
|
|
3584
3644
|
},
|
|
3585
3645
|
[currencyFormat, decimalPlaces, formatNumberLocale]
|
|
3586
3646
|
);
|
|
3587
|
-
const unformatValue = (0,
|
|
3647
|
+
const unformatValue = (0, import_react20.useCallback)(
|
|
3588
3648
|
(val) => {
|
|
3589
3649
|
if (val == null) return "";
|
|
3590
3650
|
return String(val).replace(/,/g, "");
|
|
3591
3651
|
},
|
|
3592
3652
|
[]
|
|
3593
3653
|
);
|
|
3594
|
-
(0,
|
|
3654
|
+
(0, import_react20.useEffect)(() => {
|
|
3595
3655
|
if (!isFocused) {
|
|
3596
3656
|
if (isNumberType) {
|
|
3597
3657
|
if (formatNumber) {
|
|
@@ -4061,15 +4121,15 @@ function ITMaskedInput({
|
|
|
4061
4121
|
autoFocus = false
|
|
4062
4122
|
}) {
|
|
4063
4123
|
const { t } = useITTranslation();
|
|
4064
|
-
const containerRef = (0,
|
|
4065
|
-
const rawRef = (0,
|
|
4124
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
4125
|
+
const rawRef = (0, import_react21.useRef)(value ?? "");
|
|
4066
4126
|
const isControlled = value !== void 0;
|
|
4067
|
-
const [internalRaw, setInternalRaw] = (0,
|
|
4068
|
-
const [invalidPattern, setInvalidPattern] = (0,
|
|
4069
|
-
const rules = (0,
|
|
4070
|
-
const tokenCount = (0,
|
|
4127
|
+
const [internalRaw, setInternalRaw] = (0, import_react21.useState)(value ?? "");
|
|
4128
|
+
const [invalidPattern, setInvalidPattern] = (0, import_react21.useState)(false);
|
|
4129
|
+
const rules = (0, import_react21.useMemo)(() => parseMask(mask), [mask]);
|
|
4130
|
+
const tokenCount = (0, import_react21.useMemo)(() => rules.filter((r) => r.type === "token").length, [rules]);
|
|
4071
4131
|
const raw = isControlled ? value ?? "" : internalRaw;
|
|
4072
|
-
const display = (0,
|
|
4132
|
+
const display = (0, import_react21.useMemo)(() => format2(raw, rules, placeholderChar), [raw, rules, placeholderChar]);
|
|
4073
4133
|
const scheduleCaret = (caret) => {
|
|
4074
4134
|
const inputEl = containerRef.current?.querySelector("input");
|
|
4075
4135
|
if (!inputEl) return;
|
|
@@ -4133,7 +4193,7 @@ function ITMaskedInput({
|
|
|
4133
4193
|
|
|
4134
4194
|
// src/components/molecules/multi-select/multi-select.tsx
|
|
4135
4195
|
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4136
|
-
var
|
|
4196
|
+
var import_react22 = require("react");
|
|
4137
4197
|
var import_react_dom2 = require("react-dom");
|
|
4138
4198
|
var import_fa7 = require("react-icons/fa");
|
|
4139
4199
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -4163,32 +4223,32 @@ function ITMultiSelect({
|
|
|
4163
4223
|
className
|
|
4164
4224
|
}) {
|
|
4165
4225
|
const { t } = useITTranslation();
|
|
4166
|
-
const [isOpen, setIsOpen] = (0,
|
|
4167
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4168
|
-
const [isFocused, setIsFocused] = (0,
|
|
4169
|
-
const [localTouched, setLocalTouched] = (0,
|
|
4170
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
4171
|
-
const containerRef = (0,
|
|
4172
|
-
const controlRef = (0,
|
|
4173
|
-
const inputRef = (0,
|
|
4174
|
-
const optionRefs = (0,
|
|
4175
|
-
const timeoutRef = (0,
|
|
4226
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
4227
|
+
const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
|
|
4228
|
+
const [isFocused, setIsFocused] = (0, import_react22.useState)(false);
|
|
4229
|
+
const [localTouched, setLocalTouched] = (0, import_react22.useState)(false);
|
|
4230
|
+
const [activeIndex, setActiveIndex] = (0, import_react22.useState)(-1);
|
|
4231
|
+
const containerRef = (0, import_react22.useRef)(null);
|
|
4232
|
+
const controlRef = (0, import_react22.useRef)(null);
|
|
4233
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
4234
|
+
const optionRefs = (0, import_react22.useRef)([]);
|
|
4235
|
+
const timeoutRef = (0, import_react22.useRef)(null);
|
|
4176
4236
|
const { panelRef, style: panelStyle } = useFloatingPanel(controlRef, isOpen, {
|
|
4177
4237
|
estimatedHeight: 260,
|
|
4178
4238
|
matchWidth: true
|
|
4179
4239
|
});
|
|
4180
|
-
const selectedOptions = (0,
|
|
4240
|
+
const selectedOptions = (0, import_react22.useMemo)(
|
|
4181
4241
|
() => options.filter((opt) => value.includes(opt[valueField])),
|
|
4182
4242
|
[options, value, valueField]
|
|
4183
4243
|
);
|
|
4184
|
-
const filteredOptions = (0,
|
|
4244
|
+
const filteredOptions = (0, import_react22.useMemo)(() => {
|
|
4185
4245
|
if (onSearch) return options;
|
|
4186
4246
|
if (!searchTerm) return options;
|
|
4187
4247
|
return options.filter(
|
|
4188
4248
|
(opt) => String(opt[labelField]).toLowerCase().includes(searchTerm.toLowerCase())
|
|
4189
4249
|
);
|
|
4190
4250
|
}, [options, searchTerm, onSearch, labelField]);
|
|
4191
|
-
(0,
|
|
4251
|
+
(0, import_react22.useEffect)(() => {
|
|
4192
4252
|
function handleClickOutside(event) {
|
|
4193
4253
|
const target = event.target;
|
|
4194
4254
|
if (!containerRef.current?.contains(target) && !panelRef.current?.contains(target)) {
|
|
@@ -4212,6 +4272,7 @@ function ITMultiSelect({
|
|
|
4212
4272
|
style.alignItems = "center";
|
|
4213
4273
|
style.gap = "0.375rem";
|
|
4214
4274
|
style.minHeight = "2.5rem";
|
|
4275
|
+
style.borderRadius = "var(--it-bento-field-radius, var(--radius-md))";
|
|
4215
4276
|
if (disabled) {
|
|
4216
4277
|
style.backgroundColor = inputTheme.disabled?.backgroundColor || style.backgroundColor;
|
|
4217
4278
|
style.borderColor = inputTheme.disabled?.borderColor || style.borderColor;
|
|
@@ -4492,11 +4553,11 @@ function ITConfirmDialog({
|
|
|
4492
4553
|
}
|
|
4493
4554
|
|
|
4494
4555
|
// src/hooks/useElementSize.ts
|
|
4495
|
-
var
|
|
4556
|
+
var import_react23 = require("react");
|
|
4496
4557
|
function useElementSize() {
|
|
4497
|
-
const ref = (0,
|
|
4498
|
-
const [size, setSize] = (0,
|
|
4499
|
-
(0,
|
|
4558
|
+
const ref = (0, import_react23.useRef)(null);
|
|
4559
|
+
const [size, setSize] = (0, import_react23.useState)({ width: 0, height: 0 });
|
|
4560
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
4500
4561
|
const element = ref.current;
|
|
4501
4562
|
if (!element) return;
|
|
4502
4563
|
const update = () => {
|
|
@@ -4512,7 +4573,7 @@ function useElementSize() {
|
|
|
4512
4573
|
}
|
|
4513
4574
|
|
|
4514
4575
|
// src/hooks/useVirtualRows.ts
|
|
4515
|
-
var
|
|
4576
|
+
var import_react24 = require("react");
|
|
4516
4577
|
function useVirtualRows({
|
|
4517
4578
|
count,
|
|
4518
4579
|
rowHeight,
|
|
@@ -4520,15 +4581,15 @@ function useVirtualRows({
|
|
|
4520
4581
|
enabled = true,
|
|
4521
4582
|
resetKey
|
|
4522
4583
|
}) {
|
|
4523
|
-
const scrollRef = (0,
|
|
4524
|
-
const [scrollTop, setScrollTop] = (0,
|
|
4525
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
4526
|
-
const scrollToTop = (0,
|
|
4584
|
+
const scrollRef = (0, import_react24.useRef)(null);
|
|
4585
|
+
const [scrollTop, setScrollTop] = (0, import_react24.useState)(0);
|
|
4586
|
+
const [viewportHeight, setViewportHeight] = (0, import_react24.useState)(0);
|
|
4587
|
+
const scrollToTop = (0, import_react24.useCallback)(() => {
|
|
4527
4588
|
setScrollTop(0);
|
|
4528
4589
|
const element = scrollRef.current;
|
|
4529
4590
|
if (element) element.scrollTop = 0;
|
|
4530
4591
|
}, []);
|
|
4531
|
-
(0,
|
|
4592
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
4532
4593
|
if (!enabled) return;
|
|
4533
4594
|
const element = scrollRef.current;
|
|
4534
4595
|
if (!element) return;
|
|
@@ -4544,7 +4605,7 @@ function useVirtualRows({
|
|
|
4544
4605
|
observer.disconnect();
|
|
4545
4606
|
};
|
|
4546
4607
|
}, [enabled]);
|
|
4547
|
-
(0,
|
|
4608
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
4548
4609
|
if (!enabled) return;
|
|
4549
4610
|
const element = scrollRef.current;
|
|
4550
4611
|
if (element) element.scrollTop = 0;
|
|
@@ -4572,18 +4633,18 @@ function useVirtualRows({
|
|
|
4572
4633
|
|
|
4573
4634
|
// src/components/organisms/data-table/dataTable.tsx
|
|
4574
4635
|
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
4575
|
-
var
|
|
4636
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
4576
4637
|
var import_fa13 = require("react-icons/fa");
|
|
4577
4638
|
var import_md = require("react-icons/md");
|
|
4578
4639
|
|
|
4579
4640
|
// src/components/molecules/pagination/pagination.tsx
|
|
4580
|
-
var
|
|
4641
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
4581
4642
|
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
4582
4643
|
var import_fa10 = require("react-icons/fa");
|
|
4583
4644
|
|
|
4584
4645
|
// src/components/molecules/select/select.tsx
|
|
4585
4646
|
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
4586
|
-
var
|
|
4647
|
+
var import_react25 = require("react");
|
|
4587
4648
|
var import_fa9 = require("react-icons/fa");
|
|
4588
4649
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4589
4650
|
function ITSelect({
|
|
@@ -4605,8 +4666,8 @@ function ITSelect({
|
|
|
4605
4666
|
size = "md"
|
|
4606
4667
|
}) {
|
|
4607
4668
|
const { t } = useITTranslation();
|
|
4608
|
-
const [isFocused, setIsFocused] = (0,
|
|
4609
|
-
const [localTouched, setLocalTouched] = (0,
|
|
4669
|
+
const [isFocused, setIsFocused] = (0, import_react25.useState)(false);
|
|
4670
|
+
const [localTouched, setLocalTouched] = (0, import_react25.useState)(false);
|
|
4610
4671
|
const inputTheme = theme.input || {};
|
|
4611
4672
|
const isTouched = touched !== void 0 ? touched : localTouched;
|
|
4612
4673
|
const isEmpty = value === void 0 || value === null || String(value).trim() === "";
|
|
@@ -4700,7 +4761,7 @@ var usePagination = ({
|
|
|
4700
4761
|
currentPage,
|
|
4701
4762
|
siblingCount = 1
|
|
4702
4763
|
}) => {
|
|
4703
|
-
return
|
|
4764
|
+
return import_react26.default.useMemo(() => {
|
|
4704
4765
|
const totalPageNumbers = siblingCount + 5;
|
|
4705
4766
|
if (totalPageNumbers >= totalPages) {
|
|
4706
4767
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
@@ -4877,7 +4938,7 @@ function ITPagination({
|
|
|
4877
4938
|
}
|
|
4878
4939
|
|
|
4879
4940
|
// src/components/molecules/search-select/search-select.tsx
|
|
4880
|
-
var
|
|
4941
|
+
var import_react27 = require("react");
|
|
4881
4942
|
var import_react_dom3 = require("react-dom");
|
|
4882
4943
|
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
4883
4944
|
var import_fa11 = require("react-icons/fa");
|
|
@@ -4907,26 +4968,26 @@ function ITSearchSelect({
|
|
|
4907
4968
|
onClear
|
|
4908
4969
|
}) {
|
|
4909
4970
|
const { t } = useITTranslation();
|
|
4910
|
-
const [isOpen, setIsOpen] = (0,
|
|
4911
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4912
|
-
const [isFocused, setIsFocused] = (0,
|
|
4913
|
-
const [localTouched, setLocalTouched] = (0,
|
|
4914
|
-
const containerRef = (0,
|
|
4915
|
-
const inputWrapperRef = (0,
|
|
4916
|
-
const timeoutRef = (0,
|
|
4971
|
+
const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
|
|
4972
|
+
const [searchTerm, setSearchTerm] = (0, import_react27.useState)("");
|
|
4973
|
+
const [isFocused, setIsFocused] = (0, import_react27.useState)(false);
|
|
4974
|
+
const [localTouched, setLocalTouched] = (0, import_react27.useState)(false);
|
|
4975
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
4976
|
+
const inputWrapperRef = (0, import_react27.useRef)(null);
|
|
4977
|
+
const timeoutRef = (0, import_react27.useRef)(null);
|
|
4917
4978
|
const { panelRef, style: panelStyle } = useFloatingPanel(inputWrapperRef, isOpen, {
|
|
4918
4979
|
estimatedHeight: 260,
|
|
4919
4980
|
matchWidth: true
|
|
4920
4981
|
});
|
|
4921
|
-
const selectedOption = (0,
|
|
4982
|
+
const selectedOption = (0, import_react27.useMemo)(() => {
|
|
4922
4983
|
return options.find((opt) => opt[valueField] === value);
|
|
4923
4984
|
}, [options, value, valueField]);
|
|
4924
|
-
(0,
|
|
4985
|
+
(0, import_react27.useEffect)(() => {
|
|
4925
4986
|
if (!isFocused) {
|
|
4926
4987
|
setSearchTerm(selectedOption ? String(selectedOption[labelField]) : "");
|
|
4927
4988
|
}
|
|
4928
4989
|
}, [selectedOption, isFocused, labelField]);
|
|
4929
|
-
(0,
|
|
4990
|
+
(0, import_react27.useEffect)(() => {
|
|
4930
4991
|
function handleClickOutside(event) {
|
|
4931
4992
|
const target = event.target;
|
|
4932
4993
|
const inContainer = containerRef.current?.contains(target);
|
|
@@ -4939,7 +5000,7 @@ function ITSearchSelect({
|
|
|
4939
5000
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
4940
5001
|
}, []);
|
|
4941
5002
|
const selectedLabel = selectedOption ? String(selectedOption[labelField]) : "";
|
|
4942
|
-
const filteredOptions = (0,
|
|
5003
|
+
const filteredOptions = (0, import_react27.useMemo)(() => {
|
|
4943
5004
|
if (onSearch) return options;
|
|
4944
5005
|
if (!searchTerm || !isFocused || searchTerm === selectedLabel) return options;
|
|
4945
5006
|
return options.filter(
|
|
@@ -5110,7 +5171,7 @@ function ITSearchSelect({
|
|
|
5110
5171
|
|
|
5111
5172
|
// src/components/molecules/date-picker/datePicker.tsx
|
|
5112
5173
|
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
5113
|
-
var
|
|
5174
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
5114
5175
|
var import_react_dom4 = require("react-dom");
|
|
5115
5176
|
var import_fa12 = require("react-icons/fa");
|
|
5116
5177
|
var import_date_fns2 = require("date-fns");
|
|
@@ -5135,16 +5196,16 @@ function ITDatePicker({
|
|
|
5135
5196
|
range = false
|
|
5136
5197
|
}) {
|
|
5137
5198
|
const { t, formatDate: formatDateLocale } = useITTranslation();
|
|
5138
|
-
const [isOpen, setIsOpen] = (0,
|
|
5139
|
-
const [inputValue, setInputValue] = (0,
|
|
5140
|
-
const [isValidDate, setIsValidDate] = (0,
|
|
5141
|
-
const [internalRange, setInternalRange] = (0,
|
|
5142
|
-
const wrapperRef = (0,
|
|
5199
|
+
const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
|
|
5200
|
+
const [inputValue, setInputValue] = (0, import_react28.useState)("");
|
|
5201
|
+
const [isValidDate, setIsValidDate] = (0, import_react28.useState)(true);
|
|
5202
|
+
const [internalRange, setInternalRange] = (0, import_react28.useState)([null, null]);
|
|
5203
|
+
const wrapperRef = (0, import_react28.useRef)(null);
|
|
5143
5204
|
const { panelRef, style: panelStyle } = useFloatingPanel(wrapperRef, isOpen, {
|
|
5144
5205
|
estimatedHeight: 360,
|
|
5145
5206
|
matchWidth: false
|
|
5146
5207
|
});
|
|
5147
|
-
const dateRange =
|
|
5208
|
+
const dateRange = import_react28.default.useMemo(() => {
|
|
5148
5209
|
if (range) {
|
|
5149
5210
|
if (Array.isArray(value)) return value;
|
|
5150
5211
|
return internalRange;
|
|
@@ -5152,7 +5213,7 @@ function ITDatePicker({
|
|
|
5152
5213
|
return [value instanceof Date ? value : null, null];
|
|
5153
5214
|
}, [value, range, internalRange]);
|
|
5154
5215
|
const [startDate, endDate] = dateRange;
|
|
5155
|
-
(0,
|
|
5216
|
+
(0, import_react28.useEffect)(() => {
|
|
5156
5217
|
if (range) {
|
|
5157
5218
|
if (startDate && endDate) {
|
|
5158
5219
|
setInputValue(`${formatDate(startDate)} - ${formatDate(endDate)}`);
|
|
@@ -5169,7 +5230,7 @@ function ITDatePicker({
|
|
|
5169
5230
|
}
|
|
5170
5231
|
}
|
|
5171
5232
|
}, [startDate, endDate, range]);
|
|
5172
|
-
(0,
|
|
5233
|
+
(0, import_react28.useEffect)(() => {
|
|
5173
5234
|
const handleClickOutside = (event) => {
|
|
5174
5235
|
const target = event.target;
|
|
5175
5236
|
const inWrapper = wrapperRef.current?.contains(target);
|
|
@@ -5464,11 +5525,11 @@ function ITDataTable({
|
|
|
5464
5525
|
footerStyle
|
|
5465
5526
|
}) {
|
|
5466
5527
|
const { t, locale } = useITTranslation();
|
|
5467
|
-
const [viewMode, setViewMode] = (0,
|
|
5528
|
+
const [viewMode, setViewMode] = (0, import_react29.useState)(defaultView || "table");
|
|
5468
5529
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
5469
|
-
const [data, setData] = (0,
|
|
5470
|
-
const [totalItems, setTotalItems] = (0,
|
|
5471
|
-
const [isLoading, setIsLoading] = (0,
|
|
5530
|
+
const [data, setData] = (0, import_react29.useState)([]);
|
|
5531
|
+
const [totalItems, setTotalItems] = (0, import_react29.useState)(0);
|
|
5532
|
+
const [isLoading, setIsLoading] = (0, import_react29.useState)(fetchOnMount);
|
|
5472
5533
|
const colorVars = {
|
|
5473
5534
|
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
5474
5535
|
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
@@ -5489,7 +5550,7 @@ function ITDataTable({
|
|
|
5489
5550
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
5490
5551
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
5491
5552
|
const columnCount = columns.length;
|
|
5492
|
-
const pinnedMeta =
|
|
5553
|
+
const pinnedMeta = import_react29.default.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
5493
5554
|
const scrollOuterClass = isTableVirtual ? "relative min-h-[200px]" : "overflow-x-auto relative min-h-[200px]";
|
|
5494
5555
|
const {
|
|
5495
5556
|
currentPage,
|
|
@@ -5515,15 +5576,15 @@ function ITDataTable({
|
|
|
5515
5576
|
resetKey: `${currentPage}-${itemsPerPage}`
|
|
5516
5577
|
});
|
|
5517
5578
|
const windowData = isTableVirtual ? data.slice(startIndex, endIndex + 1) : data;
|
|
5518
|
-
const debounceTimerRef = (0,
|
|
5519
|
-
const hasFetchedRef = (0,
|
|
5520
|
-
const fetchDataRef = (0,
|
|
5579
|
+
const debounceTimerRef = (0, import_react29.useRef)(null);
|
|
5580
|
+
const hasFetchedRef = (0, import_react29.useRef)(false);
|
|
5581
|
+
const fetchDataRef = (0, import_react29.useRef)(fetchData);
|
|
5521
5582
|
fetchDataRef.current = fetchData;
|
|
5522
|
-
const externalFiltersRef = (0,
|
|
5583
|
+
const externalFiltersRef = (0, import_react29.useRef)(externalFilters);
|
|
5523
5584
|
externalFiltersRef.current = externalFilters;
|
|
5524
5585
|
const externalKey = JSON.stringify(externalFilters);
|
|
5525
5586
|
const computedTotalPages = Math.ceil(totalItems / itemsPerPage) || 1;
|
|
5526
|
-
const performFetch = (0,
|
|
5587
|
+
const performFetch = (0, import_react29.useCallback)(async () => {
|
|
5527
5588
|
setIsLoading(true);
|
|
5528
5589
|
try {
|
|
5529
5590
|
const response = await fetchDataRef.current({
|
|
@@ -5544,9 +5605,9 @@ function ITDataTable({
|
|
|
5544
5605
|
setIsLoading(false);
|
|
5545
5606
|
}
|
|
5546
5607
|
}, [currentPage, itemsPerPage, filters, sortConfig]);
|
|
5547
|
-
const performFetchRef = (0,
|
|
5608
|
+
const performFetchRef = (0, import_react29.useRef)(performFetch);
|
|
5548
5609
|
performFetchRef.current = performFetch;
|
|
5549
|
-
(0,
|
|
5610
|
+
(0, import_react29.useEffect)(() => {
|
|
5550
5611
|
if (!fetchOnMount && !hasFetchedRef.current) return;
|
|
5551
5612
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
5552
5613
|
debounceTimerRef.current = setTimeout(() => {
|
|
@@ -5985,7 +6046,7 @@ function ITDataTable({
|
|
|
5985
6046
|
|
|
5986
6047
|
// src/components/organisms/dialog/dialog.tsx
|
|
5987
6048
|
var import_react_dom5 = require("react-dom");
|
|
5988
|
-
var
|
|
6049
|
+
var import_react30 = require("react");
|
|
5989
6050
|
var import_fa15 = require("react-icons/fa");
|
|
5990
6051
|
|
|
5991
6052
|
// src/components/molecules/form-header/form-header.tsx
|
|
@@ -6111,9 +6172,9 @@ function ITDialog({
|
|
|
6111
6172
|
padded = true
|
|
6112
6173
|
}) {
|
|
6113
6174
|
const { t } = useITTranslation();
|
|
6114
|
-
const modalRef = (0,
|
|
6175
|
+
const modalRef = (0, import_react30.useRef)(null);
|
|
6115
6176
|
useClickOutside_default(modalRef, onClose);
|
|
6116
|
-
(0,
|
|
6177
|
+
(0, import_react30.useEffect)(() => {
|
|
6117
6178
|
const handleEscape = (event) => {
|
|
6118
6179
|
if (event.key === "Escape") {
|
|
6119
6180
|
onClose();
|
|
@@ -6195,7 +6256,7 @@ function ITDivider({
|
|
|
6195
6256
|
// src/components/organisms/drawer/drawer.tsx
|
|
6196
6257
|
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
6197
6258
|
var import_fa16 = require("react-icons/fa");
|
|
6198
|
-
var
|
|
6259
|
+
var import_react31 = require("react");
|
|
6199
6260
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6200
6261
|
function ITDrawer({
|
|
6201
6262
|
isOpen,
|
|
@@ -6208,7 +6269,7 @@ function ITDrawer({
|
|
|
6208
6269
|
style
|
|
6209
6270
|
}) {
|
|
6210
6271
|
const { t } = useITTranslation();
|
|
6211
|
-
const panelRef = (0,
|
|
6272
|
+
const panelRef = (0, import_react31.useRef)(null);
|
|
6212
6273
|
useClickOutside_default(panelRef, onClose);
|
|
6213
6274
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "fixed inset-0 z-[50] flex", children: [
|
|
6214
6275
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm transition-opacity" }),
|
|
@@ -6263,36 +6324,36 @@ function ITEmptyState({
|
|
|
6263
6324
|
}
|
|
6264
6325
|
|
|
6265
6326
|
// src/components/organisms/form-builder/formBuilder.tsx
|
|
6266
|
-
var
|
|
6327
|
+
var import_react36 = require("react");
|
|
6267
6328
|
|
|
6268
6329
|
// src/components/organisms/form-builder/formBuilder.context.tsx
|
|
6269
|
-
var
|
|
6330
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
6270
6331
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6271
|
-
var ITFormBuilderContext = (0,
|
|
6332
|
+
var ITFormBuilderContext = (0, import_react32.createContext)(void 0);
|
|
6272
6333
|
var ITFormBuilderProvider = ({
|
|
6273
6334
|
children,
|
|
6274
6335
|
value
|
|
6275
6336
|
}) => {
|
|
6276
|
-
const [fieldRegistry, setFieldRegistry] = (0,
|
|
6277
|
-
const registerField =
|
|
6337
|
+
const [fieldRegistry, setFieldRegistry] = (0, import_react32.useState)({});
|
|
6338
|
+
const registerField = import_react32.default.useCallback((name, config2) => {
|
|
6278
6339
|
setFieldRegistry((prev) => ({ ...prev, [name]: config2 }));
|
|
6279
6340
|
}, []);
|
|
6280
|
-
const unregisterField =
|
|
6341
|
+
const unregisterField = import_react32.default.useCallback((name) => {
|
|
6281
6342
|
setFieldRegistry((prev) => {
|
|
6282
6343
|
const next = { ...prev };
|
|
6283
6344
|
delete next[name];
|
|
6284
6345
|
return next;
|
|
6285
6346
|
});
|
|
6286
6347
|
}, []);
|
|
6287
|
-
const getFieldConfig =
|
|
6348
|
+
const getFieldConfig = import_react32.default.useCallback(
|
|
6288
6349
|
(name) => fieldRegistry[name],
|
|
6289
6350
|
[fieldRegistry]
|
|
6290
6351
|
);
|
|
6291
|
-
const getAllFieldConfigs =
|
|
6352
|
+
const getAllFieldConfigs = import_react32.default.useCallback(
|
|
6292
6353
|
() => Object.values(fieldRegistry),
|
|
6293
6354
|
[fieldRegistry]
|
|
6294
6355
|
);
|
|
6295
|
-
const contextValue =
|
|
6356
|
+
const contextValue = import_react32.default.useMemo(
|
|
6296
6357
|
() => ({
|
|
6297
6358
|
...value,
|
|
6298
6359
|
registerField,
|
|
@@ -6305,7 +6366,7 @@ var ITFormBuilderProvider = ({
|
|
|
6305
6366
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ITFormBuilderContext.Provider, { value: contextValue, children });
|
|
6306
6367
|
};
|
|
6307
6368
|
var useITFormBuilderContext = () => {
|
|
6308
|
-
const context = (0,
|
|
6369
|
+
const context = (0, import_react32.useContext)(ITFormBuilderContext);
|
|
6309
6370
|
if (!context) {
|
|
6310
6371
|
throw new Error("useITFormBuilderContext must be used within an ITFormBuilderProvider");
|
|
6311
6372
|
}
|
|
@@ -6313,12 +6374,12 @@ var useITFormBuilderContext = () => {
|
|
|
6313
6374
|
};
|
|
6314
6375
|
|
|
6315
6376
|
// src/components/organisms/form-builder/fieldRenderer.tsx
|
|
6316
|
-
var
|
|
6377
|
+
var import_react35 = require("react");
|
|
6317
6378
|
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
6318
6379
|
|
|
6319
6380
|
// src/components/molecules/time-picker/timePicker.tsx
|
|
6320
6381
|
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
6321
|
-
var
|
|
6382
|
+
var import_react33 = require("react");
|
|
6322
6383
|
var import_react_dom6 = require("react-dom");
|
|
6323
6384
|
var import_fa18 = require("react-icons/fa");
|
|
6324
6385
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -6339,12 +6400,12 @@ function ITTimePicker({
|
|
|
6339
6400
|
color = "primary"
|
|
6340
6401
|
}) {
|
|
6341
6402
|
const { t } = useITTranslation();
|
|
6342
|
-
const [isOpen, setIsOpen] = (0,
|
|
6343
|
-
const [inputValue, setInputValue] = (0,
|
|
6344
|
-
const [isValidTime, setIsValidTime] = (0,
|
|
6345
|
-
const wrapperRef = (0,
|
|
6346
|
-
const hoursRef = (0,
|
|
6347
|
-
const minutesRef = (0,
|
|
6403
|
+
const [isOpen, setIsOpen] = (0, import_react33.useState)(false);
|
|
6404
|
+
const [inputValue, setInputValue] = (0, import_react33.useState)(value || "");
|
|
6405
|
+
const [isValidTime, setIsValidTime] = (0, import_react33.useState)(true);
|
|
6406
|
+
const wrapperRef = (0, import_react33.useRef)(null);
|
|
6407
|
+
const hoursRef = (0, import_react33.useRef)(null);
|
|
6408
|
+
const minutesRef = (0, import_react33.useRef)(null);
|
|
6348
6409
|
const { panelRef: dropdownRef, style: panelStyle } = useFloatingPanel(
|
|
6349
6410
|
wrapperRef,
|
|
6350
6411
|
isOpen && !disabled,
|
|
@@ -6358,7 +6419,7 @@ function ITTimePicker({
|
|
|
6358
6419
|
const isThemeColor = color in theme.colors;
|
|
6359
6420
|
const highlightColor = isThemeColor ? theme.colors[color][50] : "#f3f4f6";
|
|
6360
6421
|
const activeColor = isThemeColor ? theme.colors[color][100] : "#e5e7eb";
|
|
6361
|
-
(0,
|
|
6422
|
+
(0, import_react33.useEffect)(() => {
|
|
6362
6423
|
setInputValue(value || "");
|
|
6363
6424
|
}, [value]);
|
|
6364
6425
|
const validateTime = (timeString) => {
|
|
@@ -6367,7 +6428,7 @@ function ITTimePicker({
|
|
|
6367
6428
|
};
|
|
6368
6429
|
const currentHour = validateTime(inputValue) ? inputValue.split(":")[0] : null;
|
|
6369
6430
|
const currentMinute = validateTime(inputValue) ? inputValue.split(":")[1] : null;
|
|
6370
|
-
(0,
|
|
6431
|
+
(0, import_react33.useEffect)(() => {
|
|
6371
6432
|
if (isOpen) {
|
|
6372
6433
|
setTimeout(() => {
|
|
6373
6434
|
if (hoursRef.current && currentHour) {
|
|
@@ -6574,26 +6635,26 @@ function ITTimePicker({
|
|
|
6574
6635
|
}
|
|
6575
6636
|
|
|
6576
6637
|
// src/components/organisms/form-builder/useFormBuilder.ts
|
|
6577
|
-
var
|
|
6638
|
+
var import_react34 = require("react");
|
|
6578
6639
|
var useFieldRules = (config2, dependentValues) => {
|
|
6579
6640
|
const { getFieldConfig } = useITFormBuilderContext();
|
|
6580
6641
|
const fieldConfig = getFieldConfig(config2.name) || config2;
|
|
6581
|
-
const isVisible = (0,
|
|
6642
|
+
const isVisible = (0, import_react34.useMemo)(() => {
|
|
6582
6643
|
if (!fieldConfig.renderWhen) return true;
|
|
6583
6644
|
return fieldConfig.renderWhen(dependentValues);
|
|
6584
6645
|
}, [fieldConfig, dependentValues]);
|
|
6585
|
-
const dynamicProps = (0,
|
|
6646
|
+
const dynamicProps = (0, import_react34.useMemo)(() => {
|
|
6586
6647
|
if (!fieldConfig.dynamicProps) return {};
|
|
6587
6648
|
return fieldConfig.dynamicProps(dependentValues);
|
|
6588
6649
|
}, [fieldConfig, dependentValues]);
|
|
6589
|
-
const isRequired = (0,
|
|
6650
|
+
const isRequired = (0, import_react34.useMemo)(() => {
|
|
6590
6651
|
if (typeof dynamicProps.required !== "undefined") return dynamicProps.required;
|
|
6591
6652
|
if (typeof fieldConfig.required === "function") {
|
|
6592
6653
|
return fieldConfig.required(dependentValues);
|
|
6593
6654
|
}
|
|
6594
6655
|
return !!fieldConfig.required;
|
|
6595
6656
|
}, [fieldConfig, dynamicProps.required, dependentValues]);
|
|
6596
|
-
const isDisabled = (0,
|
|
6657
|
+
const isDisabled = (0, import_react34.useMemo)(() => {
|
|
6597
6658
|
if (typeof dynamicProps.disabled !== "undefined") return dynamicProps.disabled;
|
|
6598
6659
|
if (typeof fieldConfig.disabled === "function") {
|
|
6599
6660
|
return fieldConfig.disabled(dependentValues);
|
|
@@ -6607,11 +6668,11 @@ var useFieldRules = (config2, dependentValues) => {
|
|
|
6607
6668
|
var import_fa19 = require("react-icons/fa");
|
|
6608
6669
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6609
6670
|
function useAsyncOptions(options, deps) {
|
|
6610
|
-
const [resolved, setResolved] = (0,
|
|
6611
|
-
const [loading, setLoading] = (0,
|
|
6612
|
-
const optionsRef = (0,
|
|
6671
|
+
const [resolved, setResolved] = (0, import_react35.useState)([]);
|
|
6672
|
+
const [loading, setLoading] = (0, import_react35.useState)(false);
|
|
6673
|
+
const optionsRef = (0, import_react35.useRef)(options);
|
|
6613
6674
|
optionsRef.current = options;
|
|
6614
|
-
(0,
|
|
6675
|
+
(0, import_react35.useEffect)(() => {
|
|
6615
6676
|
const opts = optionsRef.current;
|
|
6616
6677
|
let cancelled = false;
|
|
6617
6678
|
if (typeof opts === "function") {
|
|
@@ -6655,13 +6716,13 @@ var ITFieldRenderer = ({
|
|
|
6655
6716
|
config2,
|
|
6656
6717
|
dependentValues
|
|
6657
6718
|
);
|
|
6658
|
-
(0,
|
|
6719
|
+
(0, import_react35.useEffect)(() => {
|
|
6659
6720
|
context.registerField(config2.name, config2);
|
|
6660
6721
|
return () => {
|
|
6661
6722
|
context.unregisterField(config2.name);
|
|
6662
6723
|
};
|
|
6663
6724
|
}, [config2.name]);
|
|
6664
|
-
const activeConfig = (0,
|
|
6725
|
+
const activeConfig = (0, import_react35.useMemo)(
|
|
6665
6726
|
() => ({
|
|
6666
6727
|
...config2,
|
|
6667
6728
|
...dynamicProps,
|
|
@@ -6687,7 +6748,7 @@ var ITFieldRenderer = ({
|
|
|
6687
6748
|
options,
|
|
6688
6749
|
[options, dependentValues]
|
|
6689
6750
|
);
|
|
6690
|
-
const handleChangeWrapper = (0,
|
|
6751
|
+
const handleChangeWrapper = (0, import_react35.useCallback)(
|
|
6691
6752
|
async (val) => {
|
|
6692
6753
|
const finalValue = val && typeof val === "object" && "target" in val ? val.target.value : val;
|
|
6693
6754
|
await context.setFieldValue(name, finalValue);
|
|
@@ -6898,7 +6959,7 @@ var ITFieldRenderer = ({
|
|
|
6898
6959
|
}
|
|
6899
6960
|
);
|
|
6900
6961
|
};
|
|
6901
|
-
var fieldRenderer_default = (0,
|
|
6962
|
+
var fieldRenderer_default = (0, import_react35.memo)(ITFieldRenderer);
|
|
6902
6963
|
|
|
6903
6964
|
// src/components/organisms/form-builder/formBuilder.tsx
|
|
6904
6965
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -6929,7 +6990,7 @@ function ITFormBuilder({
|
|
|
6929
6990
|
isSubmitting = false,
|
|
6930
6991
|
children
|
|
6931
6992
|
}) {
|
|
6932
|
-
const providerValue = (0,
|
|
6993
|
+
const providerValue = (0, import_react36.useMemo)(
|
|
6933
6994
|
() => ({
|
|
6934
6995
|
config: config2 || [],
|
|
6935
6996
|
values: values || {},
|
|
@@ -7081,7 +7142,7 @@ function ITFormBuilder({
|
|
|
7081
7142
|
}
|
|
7082
7143
|
|
|
7083
7144
|
// src/components/atoms/image/image.tsx
|
|
7084
|
-
var
|
|
7145
|
+
var import_react37 = require("react");
|
|
7085
7146
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7086
7147
|
var ITImage = ({
|
|
7087
7148
|
src,
|
|
@@ -7090,7 +7151,7 @@ var ITImage = ({
|
|
|
7090
7151
|
fallback = "",
|
|
7091
7152
|
fit = "cover"
|
|
7092
7153
|
}) => {
|
|
7093
|
-
const [imageError, setImageError] = (0,
|
|
7154
|
+
const [imageError, setImageError] = (0, import_react37.useState)(false);
|
|
7094
7155
|
const { t } = useITTranslation();
|
|
7095
7156
|
const handleImageError = () => {
|
|
7096
7157
|
setImageError(true);
|
|
@@ -7165,7 +7226,7 @@ function ITInputNumber({
|
|
|
7165
7226
|
}
|
|
7166
7227
|
|
|
7167
7228
|
// src/components/organisms/navbar/navbar.tsx
|
|
7168
|
-
var
|
|
7229
|
+
var import_react38 = require("react");
|
|
7169
7230
|
var import_fa20 = require("react-icons/fa");
|
|
7170
7231
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7171
7232
|
function ITNavbar({
|
|
@@ -7181,9 +7242,9 @@ function ITNavbar({
|
|
|
7181
7242
|
sidebarItems
|
|
7182
7243
|
}) {
|
|
7183
7244
|
const { t } = useITTranslation();
|
|
7184
|
-
const [isUserMenuOpen, setIsUserMenuOpen] = (0,
|
|
7185
|
-
const [expandedItems, setExpandedItems] = (0,
|
|
7186
|
-
const userMenuRef = (0,
|
|
7245
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = (0, import_react38.useState)(false);
|
|
7246
|
+
const [expandedItems, setExpandedItems] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
|
|
7247
|
+
const userMenuRef = (0, import_react38.useRef)(null);
|
|
7187
7248
|
useClickOutside_default(userMenuRef, () => setIsUserMenuOpen(false));
|
|
7188
7249
|
const toggleUserMenu = () => {
|
|
7189
7250
|
setIsUserMenuOpen(!isUserMenuOpen);
|
|
@@ -7433,7 +7494,9 @@ function ITPageHeader({
|
|
|
7433
7494
|
}) {
|
|
7434
7495
|
const { t } = useITTranslation();
|
|
7435
7496
|
const showTopRow = breadcrumbs?.length || backAction;
|
|
7436
|
-
const
|
|
7497
|
+
const appearance = useITAppearance();
|
|
7498
|
+
const bento = appearance === "bento";
|
|
7499
|
+
const flat = appearance === "flat";
|
|
7437
7500
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `${className} space-y-3`, children: [
|
|
7438
7501
|
showTopRow && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
7439
7502
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
@@ -7441,7 +7504,8 @@ function ITPageHeader({
|
|
|
7441
7504
|
"button",
|
|
7442
7505
|
{
|
|
7443
7506
|
onClick: backAction,
|
|
7444
|
-
className: "flex items-center justify-center w-9 h-9 rounded-full border border-slate-200 dark:border-slate-700 text-slate-400 hover:text-slate-700 dark:hover:text-slate-200 hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50 dark:hover:bg-slate-800/60 transition-all duration-200 flex-shrink-0",
|
|
7507
|
+
className: bento ? "flex items-center justify-center w-10 h-10 rounded-full hover:opacity-80 transition-opacity duration-200 flex-shrink-0" : "flex items-center justify-center w-9 h-9 rounded-full border border-slate-200 dark:border-slate-700 text-slate-400 hover:text-slate-700 dark:hover:text-slate-200 hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50 dark:hover:bg-slate-800/60 transition-all duration-200 flex-shrink-0",
|
|
7508
|
+
style: bento ? { backgroundColor: "var(--it-bento-control-bg, #f1f5f9)", color: "var(--it-bento-control-text, #475569)" } : void 0,
|
|
7445
7509
|
"aria-label": t("pageHeader.back"),
|
|
7446
7510
|
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_fa21.FaChevronLeft, { size: 14 })
|
|
7447
7511
|
}
|
|
@@ -7452,7 +7516,7 @@ function ITPageHeader({
|
|
|
7452
7516
|
] }),
|
|
7453
7517
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-start justify-between gap-6", children: [
|
|
7454
7518
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-start gap-4 min-w-0", children: [
|
|
7455
|
-
icon && !flat && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7519
|
+
icon && !flat && !bento && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7456
7520
|
"div",
|
|
7457
7521
|
{
|
|
7458
7522
|
className: "flex items-center justify-center w-12 h-12 rounded-full border border-slate-200 dark:border-slate-700 bg-slate-50/50 dark:bg-slate-800/50 text-slate-600 dark:text-slate-300 flex-shrink-0 transition-all duration-200 hover:border-slate-300 dark:hover:border-slate-500 hover:shadow-sm",
|
|
@@ -7465,7 +7529,7 @@ function ITPageHeader({
|
|
|
7465
7529
|
ITText,
|
|
7466
7530
|
{
|
|
7467
7531
|
as: "h1",
|
|
7468
|
-
className: flat ? "text-[1.625rem] font-bold text-slate-900 dark:text-white tracking-tight leading-tight" : "text-3xl font-bold text-slate-800 dark:text-white tracking-tight leading-tight",
|
|
7532
|
+
className: bento ? "text-3xl font-bold text-slate-900 dark:text-white tracking-tighter leading-tight" : flat ? "text-[1.625rem] font-bold text-slate-900 dark:text-white tracking-tight leading-tight" : "text-3xl font-bold text-slate-800 dark:text-white tracking-tight leading-tight",
|
|
7469
7533
|
children: title
|
|
7470
7534
|
}
|
|
7471
7535
|
),
|
|
@@ -7473,7 +7537,7 @@ function ITPageHeader({
|
|
|
7473
7537
|
ITText,
|
|
7474
7538
|
{
|
|
7475
7539
|
as: "p",
|
|
7476
|
-
className: flat ? "text-sm font-normal text-slate-500 dark:text-slate-400 mt-0.5 leading-relaxed" : "text-sm font-light text-slate-500 dark:text-slate-400 mt-1 leading-relaxed",
|
|
7540
|
+
className: bento ? "text-sm font-normal text-slate-500 dark:text-slate-400 mt-1.5 leading-relaxed" : flat ? "text-sm font-normal text-slate-500 dark:text-slate-400 mt-0.5 leading-relaxed" : "text-sm font-light text-slate-500 dark:text-slate-400 mt-1 leading-relaxed",
|
|
7477
7541
|
children: description
|
|
7478
7542
|
}
|
|
7479
7543
|
)
|
|
@@ -7618,7 +7682,7 @@ function ITPage(props) {
|
|
|
7618
7682
|
}
|
|
7619
7683
|
|
|
7620
7684
|
// src/components/atoms/popover/popover.tsx
|
|
7621
|
-
var
|
|
7685
|
+
var import_react39 = require("react");
|
|
7622
7686
|
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
7623
7687
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7624
7688
|
var positionClasses = {
|
|
@@ -7635,10 +7699,10 @@ function ITPopover({
|
|
|
7635
7699
|
onClose,
|
|
7636
7700
|
className
|
|
7637
7701
|
}) {
|
|
7638
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
7702
|
+
const [internalOpen, setInternalOpen] = (0, import_react39.useState)(false);
|
|
7639
7703
|
const isControlled = controlledOpen !== void 0;
|
|
7640
7704
|
const open = isControlled ? controlledOpen : internalOpen;
|
|
7641
|
-
const ref = (0,
|
|
7705
|
+
const ref = (0, import_react39.useRef)(null);
|
|
7642
7706
|
useClickOutside_default(ref, () => {
|
|
7643
7707
|
if (isControlled) onClose?.();
|
|
7644
7708
|
else setInternalOpen(false);
|
|
@@ -7766,7 +7830,7 @@ function ITRadioGroup({
|
|
|
7766
7830
|
|
|
7767
7831
|
// src/components/organisms/searchTable/searchTable.tsx
|
|
7768
7832
|
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
7769
|
-
var
|
|
7833
|
+
var import_react40 = require("react");
|
|
7770
7834
|
|
|
7771
7835
|
// src/components/organisms/searchTable/components/SearchInput.tsx
|
|
7772
7836
|
var import_fa22 = require("react-icons/fa");
|
|
@@ -8257,7 +8321,7 @@ function ITSearchTable({
|
|
|
8257
8321
|
onCancel
|
|
8258
8322
|
}) {
|
|
8259
8323
|
const { t } = useITTranslation();
|
|
8260
|
-
const [itemsPerPage, setItemsPerPage] = (0,
|
|
8324
|
+
const [itemsPerPage, setItemsPerPage] = (0, import_react40.useState)(defaultItemsPerPage);
|
|
8261
8325
|
const { searchTerm, handleSearchChange, handleClearSearch } = useDebouncedSearch({
|
|
8262
8326
|
initialValue: searchTermInitial,
|
|
8263
8327
|
onSearch: (value) => {
|
|
@@ -8385,16 +8449,19 @@ function ITSegmentedControl({
|
|
|
8385
8449
|
disabled = false
|
|
8386
8450
|
}) {
|
|
8387
8451
|
const { button, container } = sizeMap3[size];
|
|
8452
|
+
const bento = useITAppearance() === "bento";
|
|
8388
8453
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8389
8454
|
"div",
|
|
8390
8455
|
{
|
|
8391
8456
|
role: "group",
|
|
8392
8457
|
className: (0, import_clsx40.default)(
|
|
8393
|
-
"inline-flex
|
|
8458
|
+
"inline-flex",
|
|
8459
|
+
bento ? "rounded-full" : "rounded-xl bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700",
|
|
8394
8460
|
container,
|
|
8395
8461
|
disabled && "opacity-50 cursor-not-allowed",
|
|
8396
8462
|
className
|
|
8397
8463
|
),
|
|
8464
|
+
style: bento ? { backgroundColor: "var(--it-bento-control-bg, #f1f5f9)" } : void 0,
|
|
8398
8465
|
children: options.map((opt) => {
|
|
8399
8466
|
const isActive = opt.value === value;
|
|
8400
8467
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
@@ -8406,10 +8473,14 @@ function ITSegmentedControl({
|
|
|
8406
8473
|
disabled,
|
|
8407
8474
|
className: (0, import_clsx40.default)(
|
|
8408
8475
|
button,
|
|
8409
|
-
"
|
|
8410
|
-
isActive ? "bg-white dark:bg-slate-700 text-slate-800 dark:text-white shadow-sm border border-slate-200 dark:border-slate-600" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 border border-transparent",
|
|
8476
|
+
"font-semibold transition-all flex items-center gap-1.5",
|
|
8477
|
+
bento ? "rounded-full border border-transparent" : isActive ? "rounded-lg bg-white dark:bg-slate-700 text-slate-800 dark:text-white shadow-sm border border-slate-200 dark:border-slate-600" : "rounded-lg text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 border border-transparent",
|
|
8411
8478
|
disabled && "pointer-events-none"
|
|
8412
8479
|
),
|
|
8480
|
+
style: bento ? {
|
|
8481
|
+
backgroundColor: isActive ? "var(--it-bento-ink-bg, #0f172a)" : "transparent",
|
|
8482
|
+
color: isActive ? "var(--it-bento-ink-text, #ffffff)" : "var(--it-bento-control-text, #475569)"
|
|
8483
|
+
} : void 0,
|
|
8413
8484
|
children: [
|
|
8414
8485
|
opt.icon && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: opt.icon }),
|
|
8415
8486
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ITText, { as: "span", children: opt.label })
|
|
@@ -8423,7 +8494,7 @@ function ITSegmentedControl({
|
|
|
8423
8494
|
}
|
|
8424
8495
|
|
|
8425
8496
|
// src/components/organisms/sidebar/sidebar.tsx
|
|
8426
|
-
var
|
|
8497
|
+
var import_react41 = require("react");
|
|
8427
8498
|
var import_clsx41 = __toESM(require("clsx"), 1);
|
|
8428
8499
|
var import_fa26 = require("react-icons/fa");
|
|
8429
8500
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
@@ -8462,14 +8533,16 @@ function ITSidebar({
|
|
|
8462
8533
|
onToggleCollapse,
|
|
8463
8534
|
expandOnHover = true
|
|
8464
8535
|
}) {
|
|
8465
|
-
const
|
|
8536
|
+
const appearance = useITAppearance();
|
|
8537
|
+
const bento = appearance === "bento";
|
|
8538
|
+
const flat = appearance === "flat" || bento;
|
|
8466
8539
|
const { t } = useITTranslation();
|
|
8467
|
-
const [expandedItems, setExpandedItems] = (0,
|
|
8468
|
-
const [isHovering, setIsHovering] = (0,
|
|
8469
|
-
const sidebarRef = (0,
|
|
8470
|
-
const hoverTimeoutRef = (0,
|
|
8471
|
-
const leaveTimeoutRef = (0,
|
|
8472
|
-
(0,
|
|
8540
|
+
const [expandedItems, setExpandedItems] = (0, import_react41.useState)(/* @__PURE__ */ new Set());
|
|
8541
|
+
const [isHovering, setIsHovering] = (0, import_react41.useState)(false);
|
|
8542
|
+
const sidebarRef = (0, import_react41.useRef)(null);
|
|
8543
|
+
const hoverTimeoutRef = (0, import_react41.useRef)(null);
|
|
8544
|
+
const leaveTimeoutRef = (0, import_react41.useRef)(null);
|
|
8545
|
+
(0, import_react41.useEffect)(() => {
|
|
8473
8546
|
const hoverTimer = hoverTimeoutRef.current;
|
|
8474
8547
|
const leaveTimer = leaveTimeoutRef.current;
|
|
8475
8548
|
const handleMouseEnter = () => {
|
|
@@ -8496,7 +8569,7 @@ function ITSidebar({
|
|
|
8496
8569
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
8497
8570
|
};
|
|
8498
8571
|
}, [isCollapsed]);
|
|
8499
|
-
(0,
|
|
8572
|
+
(0, import_react41.useEffect)(() => {
|
|
8500
8573
|
const activeParents = /* @__PURE__ */ new Set();
|
|
8501
8574
|
navigationItems.forEach((item) => {
|
|
8502
8575
|
if (item.subitems && flattenSubItems(item.subitems).some((sub) => sub.isActive)) {
|
|
@@ -8554,7 +8627,7 @@ function ITSidebar({
|
|
|
8554
8627
|
color: subitem.isActive ? "var(--it-sidebar-active-color, var(--color-secondary-900))" : "var(--it-sidebar-label-color, var(--color-secondary-600))",
|
|
8555
8628
|
backgroundColor: subitem.isActive ? "var(--it-sidebar-active-bg, var(--color-secondary-50))" : "transparent",
|
|
8556
8629
|
fontSize: flat ? "0.84rem" : "0.78rem",
|
|
8557
|
-
fontWeight: subitem.isActive ? 600 : 500,
|
|
8630
|
+
fontWeight: subitem.isActive ? bento ? 700 : 600 : 500,
|
|
8558
8631
|
letterSpacing: "0.01em",
|
|
8559
8632
|
marginLeft: subitemConnector === "|" ? "-1px" : "0"
|
|
8560
8633
|
},
|
|
@@ -8711,7 +8784,7 @@ function ITSidebar({
|
|
|
8711
8784
|
style: {
|
|
8712
8785
|
zIndex: 50,
|
|
8713
8786
|
backgroundColor: "var(--it-sidebar-bg, rgba(255, 255, 255, 0.90))",
|
|
8714
|
-
borderRight: "1px solid var(--it-sidebar-border, var(--color-secondary-200))",
|
|
8787
|
+
borderRight: bento ? "none" : "1px solid var(--it-sidebar-border, var(--color-secondary-200))",
|
|
8715
8788
|
...flat ? {} : { WebkitBackdropFilter: "blur(12px)", backdropFilter: "blur(12px)" }
|
|
8716
8789
|
},
|
|
8717
8790
|
children: [
|
|
@@ -8805,7 +8878,7 @@ function ITSidebar({
|
|
|
8805
8878
|
style: {
|
|
8806
8879
|
color: active ? "var(--it-sidebar-active-color, #ffffff)" : "var(--it-sidebar-label-color, var(--color-secondary-300))",
|
|
8807
8880
|
fontSize: flat ? "0.875rem" : "0.8rem",
|
|
8808
|
-
fontWeight: active ? "600" : "500"
|
|
8881
|
+
fontWeight: active ? bento ? "700" : "600" : "500"
|
|
8809
8882
|
},
|
|
8810
8883
|
children: item.label
|
|
8811
8884
|
}
|
|
@@ -8911,7 +8984,7 @@ function ITSidebar({
|
|
|
8911
8984
|
}
|
|
8912
8985
|
|
|
8913
8986
|
// src/components/atoms/slide/slide.tsx
|
|
8914
|
-
var
|
|
8987
|
+
var import_react42 = require("react");
|
|
8915
8988
|
var import_clsx42 = __toESM(require("clsx"), 1);
|
|
8916
8989
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8917
8990
|
function ITSlideToggle({
|
|
@@ -8928,8 +9001,8 @@ function ITSlideToggle({
|
|
|
8928
9001
|
className = ""
|
|
8929
9002
|
}) {
|
|
8930
9003
|
const isControlled = controlledIsOn !== void 0;
|
|
8931
|
-
const [internalIsOn, setInternalIsOn] = (0,
|
|
8932
|
-
(0,
|
|
9004
|
+
const [internalIsOn, setInternalIsOn] = (0, import_react42.useState)(initialState);
|
|
9005
|
+
(0, import_react42.useEffect)(() => {
|
|
8933
9006
|
if (isControlled) {
|
|
8934
9007
|
setInternalIsOn(controlledIsOn);
|
|
8935
9008
|
}
|
|
@@ -9113,7 +9186,7 @@ function ITStatCard({
|
|
|
9113
9186
|
}
|
|
9114
9187
|
|
|
9115
9188
|
// src/components/molecules/line-bar-chart/line-bar-chart.tsx
|
|
9116
|
-
var
|
|
9189
|
+
var import_react43 = require("react");
|
|
9117
9190
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
9118
9191
|
function ITLineBarChart({
|
|
9119
9192
|
data,
|
|
@@ -9122,6 +9195,8 @@ function ITLineBarChart({
|
|
|
9122
9195
|
barLabel,
|
|
9123
9196
|
lineColor = "#10b981",
|
|
9124
9197
|
barColor = "#3b82f6",
|
|
9198
|
+
showLine = true,
|
|
9199
|
+
showBars = true,
|
|
9125
9200
|
height = 240,
|
|
9126
9201
|
formatValue,
|
|
9127
9202
|
formatAxis,
|
|
@@ -9132,15 +9207,18 @@ function ITLineBarChart({
|
|
|
9132
9207
|
const resolvedBarLabel = barLabel ?? t("lineBarChart.barLabel");
|
|
9133
9208
|
const resolvedFormatAxis = formatAxis ?? ((value) => formatNumber(value, { notation: "compact", maximumFractionDigits: 1 }));
|
|
9134
9209
|
const resolvedFormatValue = formatValue ?? ((value) => formatNumber(value));
|
|
9135
|
-
const gradientId = (0,
|
|
9136
|
-
const [hover, setHover] = (0,
|
|
9210
|
+
const gradientId = (0, import_react43.useId)().replace(/[:]/g, "");
|
|
9211
|
+
const [hover, setHover] = (0, import_react43.useState)(null);
|
|
9137
9212
|
const width = 720;
|
|
9138
9213
|
const padding = { top: 16, right: 16, bottom: 28, left: 52 };
|
|
9139
9214
|
const plotWidth = width - padding.left - padding.right;
|
|
9140
9215
|
const plotHeight = height - padding.top - padding.bottom;
|
|
9141
|
-
const max = (0,
|
|
9142
|
-
() => Math.max(
|
|
9143
|
-
|
|
9216
|
+
const max = (0, import_react43.useMemo)(
|
|
9217
|
+
() => Math.max(
|
|
9218
|
+
...data.flatMap((d) => [showLine ? d.line : 0, showBars ? d.bar : 0]),
|
|
9219
|
+
1
|
|
9220
|
+
),
|
|
9221
|
+
[data, showLine, showBars]
|
|
9144
9222
|
);
|
|
9145
9223
|
const gridValues = [0, 0.25, 0.5, 0.75, 1].map((f) => max * f);
|
|
9146
9224
|
const step = data.length > 0 ? plotWidth / data.length : plotWidth;
|
|
@@ -9184,7 +9262,7 @@ function ITLineBarChart({
|
|
|
9184
9262
|
),
|
|
9185
9263
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("text", { x: padding.left - 8, y: y(value) + 3, textAnchor: "end", fontSize: 10, fill: "#94a3b8", children: resolvedFormatAxis(Math.round(value)) })
|
|
9186
9264
|
] }, i)),
|
|
9187
|
-
data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9265
|
+
showBars && data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9188
9266
|
"rect",
|
|
9189
9267
|
{
|
|
9190
9268
|
x: x(i) - barWidth / 2,
|
|
@@ -9197,8 +9275,8 @@ function ITLineBarChart({
|
|
|
9197
9275
|
},
|
|
9198
9276
|
`bar-${d.label}`
|
|
9199
9277
|
)),
|
|
9200
|
-
areaPath && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: areaPath, fill: `url(#area-${gradientId})` }),
|
|
9201
|
-
data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9278
|
+
showLine && areaPath && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: areaPath, fill: `url(#area-${gradientId})` }),
|
|
9279
|
+
showLine && data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9202
9280
|
"polyline",
|
|
9203
9281
|
{
|
|
9204
9282
|
points: linePoints,
|
|
@@ -9209,7 +9287,7 @@ function ITLineBarChart({
|
|
|
9209
9287
|
strokeLinejoin: "round"
|
|
9210
9288
|
}
|
|
9211
9289
|
),
|
|
9212
|
-
data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9290
|
+
showLine && data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9213
9291
|
"circle",
|
|
9214
9292
|
{
|
|
9215
9293
|
cx: x(i),
|
|
@@ -9236,12 +9314,12 @@ function ITLineBarChart({
|
|
|
9236
9314
|
role: "status",
|
|
9237
9315
|
children: [
|
|
9238
9316
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-[10px] font-semibold", style: { color: "#e2e8f0" }, children: active.label }),
|
|
9239
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
9317
|
+
showLine && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
9240
9318
|
resolvedLineLabel,
|
|
9241
9319
|
": ",
|
|
9242
9320
|
resolvedFormatValue(active.line)
|
|
9243
9321
|
] }),
|
|
9244
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
9322
|
+
showBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
9245
9323
|
resolvedBarLabel,
|
|
9246
9324
|
": ",
|
|
9247
9325
|
resolvedFormatValue(active.bar)
|
|
@@ -9250,11 +9328,11 @@ function ITLineBarChart({
|
|
|
9250
9328
|
}
|
|
9251
9329
|
),
|
|
9252
9330
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("ul", { className: "flex flex-wrap items-center gap-4 text-[11px]", style: { color: "#475569" }, children: [
|
|
9253
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9331
|
+
showLine && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9254
9332
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "h-2.5 w-2.5 rounded-sm", style: { background: lineColor }, "aria-hidden": true }),
|
|
9255
9333
|
resolvedLineLabel
|
|
9256
9334
|
] }),
|
|
9257
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9335
|
+
showBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9258
9336
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "h-2.5 w-2.5 rounded-sm", style: { background: barColor }, "aria-hidden": true }),
|
|
9259
9337
|
resolvedBarLabel
|
|
9260
9338
|
] })
|
|
@@ -9265,7 +9343,7 @@ var line_bar_chart_default = ITLineBarChart;
|
|
|
9265
9343
|
|
|
9266
9344
|
// src/components/molecules/table/table.tsx
|
|
9267
9345
|
var import_clsx45 = __toESM(require("clsx"), 1);
|
|
9268
|
-
var
|
|
9346
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
9269
9347
|
var import_fa27 = require("react-icons/fa");
|
|
9270
9348
|
var import_md2 = require("react-icons/md");
|
|
9271
9349
|
var import_date_fns3 = require("date-fns");
|
|
@@ -9314,7 +9392,7 @@ function ITTable({
|
|
|
9314
9392
|
footerStyle
|
|
9315
9393
|
}) {
|
|
9316
9394
|
const { t, locale } = useITTranslation();
|
|
9317
|
-
const [viewMode, setViewMode] = (0,
|
|
9395
|
+
const [viewMode, setViewMode] = (0, import_react44.useState)(defaultView);
|
|
9318
9396
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
9319
9397
|
const colorVars = {
|
|
9320
9398
|
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
@@ -9342,7 +9420,7 @@ function ITTable({
|
|
|
9342
9420
|
handleSort,
|
|
9343
9421
|
handleItemsPerPageChange
|
|
9344
9422
|
} = useTableState({ defaultItemsPerPage });
|
|
9345
|
-
const sortedData =
|
|
9423
|
+
const sortedData = import_react44.default.useMemo(() => {
|
|
9346
9424
|
const safeData = Array.isArray(data) ? data : [];
|
|
9347
9425
|
if (!sortConfig) return safeData;
|
|
9348
9426
|
return [...safeData].sort((a, b) => {
|
|
@@ -9432,7 +9510,7 @@ function ITTable({
|
|
|
9432
9510
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
9433
9511
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
9434
9512
|
const columnCount = columns.length;
|
|
9435
|
-
const pinnedMeta =
|
|
9513
|
+
const pinnedMeta = import_react44.default.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
9436
9514
|
const {
|
|
9437
9515
|
scrollRef,
|
|
9438
9516
|
startIndex,
|
|
@@ -9897,6 +9975,7 @@ function ITTable({
|
|
|
9897
9975
|
|
|
9898
9976
|
// src/components/atoms/textarea/textarea.tsx
|
|
9899
9977
|
var import_clsx46 = __toESM(require("clsx"), 1);
|
|
9978
|
+
var import_react45 = require("react");
|
|
9900
9979
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
9901
9980
|
var resizeMap = {
|
|
9902
9981
|
none: "resize-none",
|
|
@@ -9904,7 +9983,7 @@ var resizeMap = {
|
|
|
9904
9983
|
horizontal: "resize-x",
|
|
9905
9984
|
both: "resize"
|
|
9906
9985
|
};
|
|
9907
|
-
|
|
9986
|
+
var ITTextarea = (0, import_react45.forwardRef)(function ITTextarea2({
|
|
9908
9987
|
value,
|
|
9909
9988
|
onChange,
|
|
9910
9989
|
label,
|
|
@@ -9915,13 +9994,16 @@ function ITTextarea({
|
|
|
9915
9994
|
className,
|
|
9916
9995
|
name,
|
|
9917
9996
|
maxLength,
|
|
9918
|
-
resize = "vertical"
|
|
9919
|
-
|
|
9997
|
+
resize = "vertical",
|
|
9998
|
+
onKeyDown,
|
|
9999
|
+
autoFocus = false
|
|
10000
|
+
}, ref) {
|
|
9920
10001
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: (0, import_clsx46.default)("flex flex-col gap-1.5", className), children: [
|
|
9921
10002
|
label && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ITText, { as: "label", className: inputLabel(!!error), htmlFor: name, children: label }),
|
|
9922
10003
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
9923
10004
|
"textarea",
|
|
9924
10005
|
{
|
|
10006
|
+
ref,
|
|
9925
10007
|
id: name,
|
|
9926
10008
|
name,
|
|
9927
10009
|
value,
|
|
@@ -9930,6 +10012,8 @@ function ITTextarea({
|
|
|
9930
10012
|
rows,
|
|
9931
10013
|
disabled,
|
|
9932
10014
|
maxLength,
|
|
10015
|
+
onKeyDown,
|
|
10016
|
+
autoFocus,
|
|
9933
10017
|
className: (0, import_clsx46.default)(
|
|
9934
10018
|
"w-full border border-solid transition-all duration-200 rounded-lg px-3 py-2 text-sm outline-none",
|
|
9935
10019
|
"focus:ring-2",
|
|
@@ -9941,10 +10025,12 @@ function ITTextarea({
|
|
|
9941
10025
|
),
|
|
9942
10026
|
error && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ITText, { as: "span", className: inputError, children: error })
|
|
9943
10027
|
] });
|
|
9944
|
-
}
|
|
10028
|
+
});
|
|
10029
|
+
ITTextarea.displayName = "ITTextarea";
|
|
10030
|
+
var textarea_default = ITTextarea;
|
|
9945
10031
|
|
|
9946
10032
|
// src/components/molecules/tabs/tabs.tsx
|
|
9947
|
-
var
|
|
10033
|
+
var import_react46 = require("react");
|
|
9948
10034
|
var import_clsx47 = require("clsx");
|
|
9949
10035
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9950
10036
|
var ITTabs = ({
|
|
@@ -9955,7 +10041,8 @@ var ITTabs = ({
|
|
|
9955
10041
|
className = "",
|
|
9956
10042
|
containerClassName = ""
|
|
9957
10043
|
}) => {
|
|
9958
|
-
const
|
|
10044
|
+
const bento = useITAppearance() === "bento" && variant === "pill";
|
|
10045
|
+
const [activeId, setActiveId] = (0, import_react46.useState)(defaultActiveId || items[0]?.id);
|
|
9959
10046
|
const handleTabClick = (id, disabled) => {
|
|
9960
10047
|
if (disabled) return;
|
|
9961
10048
|
setActiveId(id);
|
|
@@ -9963,39 +10050,50 @@ var ITTabs = ({
|
|
|
9963
10050
|
};
|
|
9964
10051
|
const activeContent = items.find((item) => item.id === activeId)?.content;
|
|
9965
10052
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: (0, import_clsx47.clsx)("w-full", containerClassName), children: [
|
|
9966
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9967
|
-
"
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
{
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
"
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
10053
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10054
|
+
"div",
|
|
10055
|
+
{
|
|
10056
|
+
className: (0, import_clsx47.clsx)(
|
|
10057
|
+
"flex border-secondary-200 mb-4",
|
|
10058
|
+
variant === "line" ? "border-b" : bento ? "gap-2 p-1 rounded-full w-fit" : "gap-2 p-1 bg-secondary-100 rounded-lg w-fit",
|
|
10059
|
+
className
|
|
10060
|
+
),
|
|
10061
|
+
style: bento ? { backgroundColor: "var(--it-bento-control-bg, #f1f5f9)", borderColor: "transparent" } : void 0,
|
|
10062
|
+
children: items.map((item) => {
|
|
10063
|
+
const isActive = item.id === activeId;
|
|
10064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
10065
|
+
"button",
|
|
10066
|
+
{
|
|
10067
|
+
onClick: () => handleTabClick(item.id, item.disabled),
|
|
10068
|
+
disabled: item.disabled,
|
|
10069
|
+
className: (0, import_clsx47.clsx)(
|
|
10070
|
+
"flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all duration-200 outline-none",
|
|
10071
|
+
// LINE VARIANT
|
|
10072
|
+
variant === "line" && [
|
|
10073
|
+
"border-b-2 -mb-[2px]",
|
|
10074
|
+
isActive ? "border-primary-500 text-primary-600" : "border-transparent text-secondary-500 hover:text-secondary-700 hover:border-secondary-300"
|
|
10075
|
+
],
|
|
10076
|
+
// PILL VARIANT
|
|
10077
|
+
variant === "pill" && (bento ? "rounded-full" : [
|
|
10078
|
+
"rounded-md",
|
|
10079
|
+
isActive ? "bg-white text-primary-600 shadow-sm" : "text-secondary-500 hover:text-secondary-700"
|
|
10080
|
+
]),
|
|
10081
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
10082
|
+
),
|
|
10083
|
+
style: bento ? {
|
|
10084
|
+
backgroundColor: isActive ? "var(--it-bento-ink-bg, #0f172a)" : "transparent",
|
|
10085
|
+
color: isActive ? "var(--it-bento-ink-text, #ffffff)" : "var(--it-bento-control-text, #475569)"
|
|
10086
|
+
} : void 0,
|
|
10087
|
+
children: [
|
|
10088
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "w-4 h-4", children: item.icon }),
|
|
10089
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ITText, { as: "span", children: item.label })
|
|
10090
|
+
]
|
|
10091
|
+
},
|
|
10092
|
+
item.id
|
|
10093
|
+
);
|
|
10094
|
+
})
|
|
10095
|
+
}
|
|
10096
|
+
),
|
|
9999
10097
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "tab-content animate-fadeIn", children: activeContent })
|
|
10000
10098
|
] });
|
|
10001
10099
|
};
|
|
@@ -10055,7 +10153,7 @@ var positionStyles = {
|
|
|
10055
10153
|
|
|
10056
10154
|
// src/components/organisms/toast/toast.tsx
|
|
10057
10155
|
var import_clsx49 = __toESM(require("clsx"), 1);
|
|
10058
|
-
var
|
|
10156
|
+
var import_react47 = require("react");
|
|
10059
10157
|
var import_fa28 = require("react-icons/fa");
|
|
10060
10158
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10061
10159
|
function ITToast({
|
|
@@ -10066,8 +10164,8 @@ function ITToast({
|
|
|
10066
10164
|
onClose
|
|
10067
10165
|
}) {
|
|
10068
10166
|
const { t } = useITTranslation();
|
|
10069
|
-
const [isVisible, setIsVisible] = (0,
|
|
10070
|
-
(0,
|
|
10167
|
+
const [isVisible, setIsVisible] = (0, import_react47.useState)(true);
|
|
10168
|
+
(0, import_react47.useEffect)(() => {
|
|
10071
10169
|
const timer = setTimeout(() => {
|
|
10072
10170
|
setIsVisible(false);
|
|
10073
10171
|
setTimeout(() => {
|
|
@@ -10133,7 +10231,7 @@ function ITToast({
|
|
|
10133
10231
|
}
|
|
10134
10232
|
|
|
10135
10233
|
// src/components/molecules/wysiwyg/wysiwyg.tsx
|
|
10136
|
-
var
|
|
10234
|
+
var import_react49 = require("react");
|
|
10137
10235
|
var import_clsx51 = __toESM(require("clsx"), 1);
|
|
10138
10236
|
var import_fa29 = require("react-icons/fa");
|
|
10139
10237
|
|
|
@@ -10149,7 +10247,7 @@ var toolbarActions = [
|
|
|
10149
10247
|
];
|
|
10150
10248
|
|
|
10151
10249
|
// src/components/atoms/tooltip/tooltip.tsx
|
|
10152
|
-
var
|
|
10250
|
+
var import_react48 = require("react");
|
|
10153
10251
|
var import_clsx50 = __toESM(require("clsx"), 1);
|
|
10154
10252
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10155
10253
|
var positionClasses2 = {
|
|
@@ -10171,7 +10269,7 @@ function ITTooltip({
|
|
|
10171
10269
|
delay = 200,
|
|
10172
10270
|
className
|
|
10173
10271
|
}) {
|
|
10174
|
-
const [visible, setVisible] = (0,
|
|
10272
|
+
const [visible, setVisible] = (0, import_react48.useState)(false);
|
|
10175
10273
|
let timeout;
|
|
10176
10274
|
const handleMouseEnter = () => {
|
|
10177
10275
|
timeout = setTimeout(() => setVisible(true), delay);
|
|
@@ -10234,12 +10332,12 @@ function ITWysiwyg({
|
|
|
10234
10332
|
className
|
|
10235
10333
|
}) {
|
|
10236
10334
|
const { t } = useITTranslation();
|
|
10237
|
-
const editorRef = (0,
|
|
10238
|
-
const focusedRef = (0,
|
|
10239
|
-
const [active, setActive] = (0,
|
|
10335
|
+
const editorRef = (0, import_react49.useRef)(null);
|
|
10336
|
+
const focusedRef = (0, import_react49.useRef)(false);
|
|
10337
|
+
const [active, setActive] = (0, import_react49.useState)({});
|
|
10240
10338
|
const isLocked = disabled || readOnly;
|
|
10241
10339
|
const sizeConfig = inputSizeTokens[size] ?? inputSizeTokens.md;
|
|
10242
|
-
const findAncestor = (0,
|
|
10340
|
+
const findAncestor = (0, import_react49.useCallback)(
|
|
10243
10341
|
(node, predicate) => {
|
|
10244
10342
|
const editor = editorRef.current;
|
|
10245
10343
|
if (!editor) return null;
|
|
@@ -10252,7 +10350,7 @@ function ITWysiwyg({
|
|
|
10252
10350
|
},
|
|
10253
10351
|
[]
|
|
10254
10352
|
);
|
|
10255
|
-
const isInlineTag = (0,
|
|
10353
|
+
const isInlineTag = (0, import_react49.useCallback)((el, tag) => {
|
|
10256
10354
|
if (tag === "STRONG" || tag === "B") {
|
|
10257
10355
|
return el.tagName === "STRONG" || el.tagName === "B";
|
|
10258
10356
|
}
|
|
@@ -10261,7 +10359,7 @@ function ITWysiwyg({
|
|
|
10261
10359
|
}
|
|
10262
10360
|
return el.tagName === tag;
|
|
10263
10361
|
}, []);
|
|
10264
|
-
const getTextNodesInRange = (0,
|
|
10362
|
+
const getTextNodesInRange = (0, import_react49.useCallback)((range) => {
|
|
10265
10363
|
const editor = editorRef.current;
|
|
10266
10364
|
if (!editor) return [];
|
|
10267
10365
|
const out = [];
|
|
@@ -10272,7 +10370,7 @@ function ITWysiwyg({
|
|
|
10272
10370
|
}
|
|
10273
10371
|
return out;
|
|
10274
10372
|
}, []);
|
|
10275
|
-
const placeCaretAtEnd = (0,
|
|
10373
|
+
const placeCaretAtEnd = (0, import_react49.useCallback)((target) => {
|
|
10276
10374
|
const editor = editorRef.current;
|
|
10277
10375
|
const sel = window.getSelection();
|
|
10278
10376
|
if (!editor || !sel) return;
|
|
@@ -10283,11 +10381,11 @@ function ITWysiwyg({
|
|
|
10283
10381
|
sel.addRange(range);
|
|
10284
10382
|
if (document.activeElement !== editor) editor.focus();
|
|
10285
10383
|
}, []);
|
|
10286
|
-
const emitChange = (0,
|
|
10384
|
+
const emitChange = (0, import_react49.useCallback)(() => {
|
|
10287
10385
|
const editor = editorRef.current;
|
|
10288
10386
|
if (editor) onChange?.(editor.innerHTML);
|
|
10289
10387
|
}, [onChange]);
|
|
10290
|
-
const updateActive = (0,
|
|
10388
|
+
const updateActive = (0, import_react49.useCallback)(() => {
|
|
10291
10389
|
const editor = editorRef.current;
|
|
10292
10390
|
const sel = window.getSelection();
|
|
10293
10391
|
const node = sel?.anchorNode ?? null;
|
|
@@ -10306,13 +10404,13 @@ function ITWysiwyg({
|
|
|
10306
10404
|
(prev) => JSON.stringify(prev) === JSON.stringify(next) ? prev : next
|
|
10307
10405
|
);
|
|
10308
10406
|
}, [findAncestor, isInlineTag]);
|
|
10309
|
-
const unwrapElement = (0,
|
|
10407
|
+
const unwrapElement = (0, import_react49.useCallback)((el) => {
|
|
10310
10408
|
const parent = el.parentNode;
|
|
10311
10409
|
if (!parent) return;
|
|
10312
10410
|
while (el.firstChild) parent.insertBefore(el.firstChild, el);
|
|
10313
10411
|
el.remove();
|
|
10314
10412
|
}, []);
|
|
10315
|
-
const applyInline = (0,
|
|
10413
|
+
const applyInline = (0, import_react49.useCallback)(
|
|
10316
10414
|
(tag, prepare) => {
|
|
10317
10415
|
const editor = editorRef.current;
|
|
10318
10416
|
const sel = window.getSelection();
|
|
@@ -10394,7 +10492,7 @@ function ITWysiwyg({
|
|
|
10394
10492
|
updateActive
|
|
10395
10493
|
]
|
|
10396
10494
|
);
|
|
10397
|
-
const normalizeBlocks = (0,
|
|
10495
|
+
const normalizeBlocks = (0, import_react49.useCallback)(() => {
|
|
10398
10496
|
const editor = editorRef.current;
|
|
10399
10497
|
if (!editor) return;
|
|
10400
10498
|
const children = Array.from(editor.childNodes);
|
|
@@ -10416,7 +10514,7 @@ function ITWysiwyg({
|
|
|
10416
10514
|
}
|
|
10417
10515
|
flush();
|
|
10418
10516
|
}, []);
|
|
10419
|
-
const convertLiToDiv = (0,
|
|
10517
|
+
const convertLiToDiv = (0, import_react49.useCallback)((li) => {
|
|
10420
10518
|
const list = li.parentElement;
|
|
10421
10519
|
if (!list || !list.parentNode) return;
|
|
10422
10520
|
const div = document.createElement("div");
|
|
@@ -10424,20 +10522,20 @@ function ITWysiwyg({
|
|
|
10424
10522
|
list.parentNode.insertBefore(div, list);
|
|
10425
10523
|
li.remove();
|
|
10426
10524
|
}, []);
|
|
10427
|
-
const cleanupEmptyLists = (0,
|
|
10525
|
+
const cleanupEmptyLists = (0, import_react49.useCallback)(() => {
|
|
10428
10526
|
const editor = editorRef.current;
|
|
10429
10527
|
if (!editor) return;
|
|
10430
10528
|
editor.querySelectorAll("ul, ol").forEach((list) => {
|
|
10431
10529
|
if (!list.querySelector("li")) list.remove();
|
|
10432
10530
|
});
|
|
10433
10531
|
}, []);
|
|
10434
|
-
const retagList = (0,
|
|
10532
|
+
const retagList = (0, import_react49.useCallback)((list, type) => {
|
|
10435
10533
|
if (!list.parentNode) return;
|
|
10436
10534
|
const nl = document.createElement(type);
|
|
10437
10535
|
while (list.firstChild) nl.appendChild(list.firstChild);
|
|
10438
10536
|
list.parentNode.replaceChild(nl, list);
|
|
10439
10537
|
}, []);
|
|
10440
|
-
const toggleList = (0,
|
|
10538
|
+
const toggleList = (0, import_react49.useCallback)(
|
|
10441
10539
|
(type) => {
|
|
10442
10540
|
const editor = editorRef.current;
|
|
10443
10541
|
const sel = window.getSelection();
|
|
@@ -10535,7 +10633,7 @@ function ITWysiwyg({
|
|
|
10535
10633
|
updateActive
|
|
10536
10634
|
]
|
|
10537
10635
|
);
|
|
10538
|
-
const clearFormatting = (0,
|
|
10636
|
+
const clearFormatting = (0, import_react49.useCallback)(() => {
|
|
10539
10637
|
const editor = editorRef.current;
|
|
10540
10638
|
const sel = window.getSelection();
|
|
10541
10639
|
if (!editor || !sel || sel.rangeCount === 0) return;
|
|
@@ -10569,7 +10667,7 @@ function ITWysiwyg({
|
|
|
10569
10667
|
emitChange,
|
|
10570
10668
|
updateActive
|
|
10571
10669
|
]);
|
|
10572
|
-
(0,
|
|
10670
|
+
(0, import_react49.useEffect)(() => {
|
|
10573
10671
|
const editor = editorRef.current;
|
|
10574
10672
|
if (!editor) return;
|
|
10575
10673
|
if (!focusedRef.current) {
|
|
@@ -10577,7 +10675,7 @@ function ITWysiwyg({
|
|
|
10577
10675
|
if (editor.innerHTML !== next) editor.innerHTML = next;
|
|
10578
10676
|
}
|
|
10579
10677
|
}, [value]);
|
|
10580
|
-
(0,
|
|
10678
|
+
(0, import_react49.useEffect)(() => {
|
|
10581
10679
|
const onSelectionChange = () => {
|
|
10582
10680
|
const editor = editorRef.current;
|
|
10583
10681
|
const sel = window.getSelection();
|
|
@@ -10716,12 +10814,12 @@ function ITWysiwyg({
|
|
|
10716
10814
|
}
|
|
10717
10815
|
|
|
10718
10816
|
// src/components/molecules/json-editor/json-editor.tsx
|
|
10719
|
-
var
|
|
10817
|
+
var import_react52 = require("react");
|
|
10720
10818
|
var import_clsx53 = __toESM(require("clsx"), 1);
|
|
10721
10819
|
var import_fa31 = require("react-icons/fa");
|
|
10722
10820
|
|
|
10723
10821
|
// src/components/molecules/json-editor/json-editor-tree.tsx
|
|
10724
|
-
var
|
|
10822
|
+
var import_react50 = require("react");
|
|
10725
10823
|
var import_clsx52 = __toESM(require("clsx"), 1);
|
|
10726
10824
|
var import_fa30 = require("react-icons/fa");
|
|
10727
10825
|
|
|
@@ -11206,9 +11304,9 @@ function ITCodeTreeView({
|
|
|
11206
11304
|
className
|
|
11207
11305
|
}) {
|
|
11208
11306
|
const { t } = useITTranslation();
|
|
11209
|
-
const root = (0,
|
|
11210
|
-
const [collapsed, setCollapsed] = (0,
|
|
11211
|
-
const rows = (0,
|
|
11307
|
+
const root = (0, import_react50.useMemo)(() => buildTree(value, "", [], 0), [value]);
|
|
11308
|
+
const [collapsed, setCollapsed] = (0, import_react50.useState)({});
|
|
11309
|
+
const rows = (0, import_react50.useMemo)(() => {
|
|
11212
11310
|
const result = [];
|
|
11213
11311
|
const isOpen = (node) => {
|
|
11214
11312
|
const explicit = collapsed[node.key];
|
|
@@ -11316,7 +11414,7 @@ function kindLabel(kind, t) {
|
|
|
11316
11414
|
}
|
|
11317
11415
|
|
|
11318
11416
|
// src/components/molecules/json-editor/useJsonEditorKeyboard.ts
|
|
11319
|
-
var
|
|
11417
|
+
var import_react51 = require("react");
|
|
11320
11418
|
var PAIRS = { "{": "}", "[": "]", '"': '"' };
|
|
11321
11419
|
var CLOSERS2 = /* @__PURE__ */ new Set(["}", "]", '"']);
|
|
11322
11420
|
function useJsonEditorKeyboard({
|
|
@@ -11325,7 +11423,7 @@ function useJsonEditorKeyboard({
|
|
|
11325
11423
|
readOnly = false,
|
|
11326
11424
|
applyEdit
|
|
11327
11425
|
}) {
|
|
11328
|
-
return (0,
|
|
11426
|
+
return (0, import_react51.useCallback)(
|
|
11329
11427
|
(event) => {
|
|
11330
11428
|
const textarea = textareaRef.current;
|
|
11331
11429
|
if (!textarea || readOnly) return;
|
|
@@ -11570,34 +11668,34 @@ function ITJSONEditor({
|
|
|
11570
11668
|
errorLine
|
|
11571
11669
|
}) {
|
|
11572
11670
|
const { t, formatNumber } = useITTranslation();
|
|
11573
|
-
const [viewMode, setViewMode] = (0,
|
|
11574
|
-
const [wrapLines, setWrapLines] = (0,
|
|
11575
|
-
const [indentSize, setIndentSize] = (0,
|
|
11576
|
-
const [withNumbers, setWithNumbers] = (0,
|
|
11577
|
-
const [withFolds, setWithFolds] = (0,
|
|
11578
|
-
const [copied, setCopied] = (0,
|
|
11579
|
-
const [foldedStarts, setFoldedStarts] = (0,
|
|
11580
|
-
const [caretLine, setCaretLine] = (0,
|
|
11581
|
-
const [lineHeight, setLineHeight] = (0,
|
|
11582
|
-
const [notice, setNotice] = (0,
|
|
11583
|
-
const canvasRef = (0,
|
|
11584
|
-
const textareaRef = (0,
|
|
11585
|
-
const highlightRef = (0,
|
|
11586
|
-
const fileInputRef = (0,
|
|
11587
|
-
const pendingSelection = (0,
|
|
11588
|
-
const editorId = (0,
|
|
11589
|
-
(0,
|
|
11671
|
+
const [viewMode, setViewMode] = (0, import_react52.useState)(mode ?? "text");
|
|
11672
|
+
const [wrapLines, setWrapLines] = (0, import_react52.useState)(wrapLinesProp);
|
|
11673
|
+
const [indentSize, setIndentSize] = (0, import_react52.useState)(Math.min(8, Math.max(0, indentSizeProp)));
|
|
11674
|
+
const [withNumbers, setWithNumbers] = (0, import_react52.useState)(showLineNumbers);
|
|
11675
|
+
const [withFolds, setWithFolds] = (0, import_react52.useState)(showFoldGutter);
|
|
11676
|
+
const [copied, setCopied] = (0, import_react52.useState)(false);
|
|
11677
|
+
const [foldedStarts, setFoldedStarts] = (0, import_react52.useState)([]);
|
|
11678
|
+
const [caretLine, setCaretLine] = (0, import_react52.useState)(1);
|
|
11679
|
+
const [lineHeight, setLineHeight] = (0, import_react52.useState)(21);
|
|
11680
|
+
const [notice, setNotice] = (0, import_react52.useState)(null);
|
|
11681
|
+
const canvasRef = (0, import_react52.useRef)(null);
|
|
11682
|
+
const textareaRef = (0, import_react52.useRef)(null);
|
|
11683
|
+
const highlightRef = (0, import_react52.useRef)(null);
|
|
11684
|
+
const fileInputRef = (0, import_react52.useRef)(null);
|
|
11685
|
+
const pendingSelection = (0, import_react52.useRef)(null);
|
|
11686
|
+
const editorId = (0, import_react52.useId)();
|
|
11687
|
+
(0, import_react52.useEffect)(() => {
|
|
11590
11688
|
if (mode !== void 0) setViewMode(mode);
|
|
11591
11689
|
}, [mode]);
|
|
11592
|
-
(0,
|
|
11690
|
+
(0, import_react52.useEffect)(() => {
|
|
11593
11691
|
setWrapLines(wrapLinesProp);
|
|
11594
11692
|
}, [wrapLinesProp]);
|
|
11595
|
-
(0,
|
|
11693
|
+
(0, import_react52.useEffect)(() => {
|
|
11596
11694
|
setIndentSize(Math.min(8, Math.max(0, indentSizeProp)));
|
|
11597
11695
|
}, [indentSizeProp]);
|
|
11598
|
-
const analysis = (0,
|
|
11599
|
-
const folds = (0,
|
|
11600
|
-
const validation = (0,
|
|
11696
|
+
const analysis = (0, import_react52.useMemo)(() => analyzeCode(value), [value]);
|
|
11697
|
+
const folds = (0, import_react52.useMemo)(() => findFoldRegions(value), [value]);
|
|
11698
|
+
const validation = (0, import_react52.useMemo)(() => {
|
|
11601
11699
|
if (!value.trim()) {
|
|
11602
11700
|
return {
|
|
11603
11701
|
isValid: true,
|
|
@@ -11615,37 +11713,37 @@ function ITJSONEditor({
|
|
|
11615
11713
|
};
|
|
11616
11714
|
}
|
|
11617
11715
|
}, [value, analysis.lineStarts]);
|
|
11618
|
-
(0,
|
|
11716
|
+
(0, import_react52.useEffect)(() => {
|
|
11619
11717
|
onParse?.(validation.parsed, validation.isValid, validation.error?.message);
|
|
11620
11718
|
}, [validation, onParse]);
|
|
11621
|
-
const foldedRegions = (0,
|
|
11719
|
+
const foldedRegions = (0, import_react52.useMemo)(() => {
|
|
11622
11720
|
if (!foldedStarts.length || !folds.length) return [];
|
|
11623
11721
|
return folds.filter((region) => foldedStarts.includes(region.startLine));
|
|
11624
11722
|
}, [folds, foldedStarts]);
|
|
11625
|
-
const hiddenLines = (0,
|
|
11723
|
+
const hiddenLines = (0, import_react52.useMemo)(() => {
|
|
11626
11724
|
const hidden = /* @__PURE__ */ new Set();
|
|
11627
11725
|
for (const region of foldedRegions) {
|
|
11628
11726
|
for (let line = region.startLine + 1; line <= region.endLine; line++) hidden.add(line);
|
|
11629
11727
|
}
|
|
11630
11728
|
return hidden;
|
|
11631
11729
|
}, [foldedRegions]);
|
|
11632
|
-
const closedByStart = (0,
|
|
11730
|
+
const closedByStart = (0, import_react52.useMemo)(() => {
|
|
11633
11731
|
const map = /* @__PURE__ */ new Map();
|
|
11634
11732
|
for (const region of foldedRegions) map.set(region.startLine, region.endLine);
|
|
11635
11733
|
return map;
|
|
11636
11734
|
}, [foldedRegions]);
|
|
11637
|
-
const visibleLines = (0,
|
|
11735
|
+
const visibleLines = (0, import_react52.useMemo)(
|
|
11638
11736
|
() => analysis.lines.filter((line) => !hiddenLines.has(line.number)),
|
|
11639
11737
|
[analysis.lines, hiddenLines]
|
|
11640
11738
|
);
|
|
11641
11739
|
const lineStarts = analysis.lineStarts;
|
|
11642
|
-
const nodeCount = (0,
|
|
11643
|
-
const maxDepth = (0,
|
|
11740
|
+
const nodeCount = (0, import_react52.useMemo)(() => countNodes(validation.parsed), [validation.parsed]);
|
|
11741
|
+
const maxDepth = (0, import_react52.useMemo)(
|
|
11644
11742
|
() => analysis.lines.reduce((deepest, line) => Math.max(deepest, line.depth), 0),
|
|
11645
11743
|
[analysis.lines]
|
|
11646
11744
|
);
|
|
11647
|
-
const byteSize = (0,
|
|
11648
|
-
(0,
|
|
11745
|
+
const byteSize = (0, import_react52.useMemo)(() => new Blob([value]).size, [value]);
|
|
11746
|
+
(0, import_react52.useEffect)(() => {
|
|
11649
11747
|
const measure = () => {
|
|
11650
11748
|
const textarea = textareaRef.current;
|
|
11651
11749
|
if (!textarea) return;
|
|
@@ -11667,14 +11765,14 @@ function ITJSONEditor({
|
|
|
11667
11765
|
const contentHeight = visibleLines.length * lineHeight;
|
|
11668
11766
|
const activeLine = validation.isValid ? caretLine : validation.error?.line ?? errorLine ?? caretLine;
|
|
11669
11767
|
const treeValue = validation.isValid ? validation.parsed : void 0;
|
|
11670
|
-
const restoreSelection = (0,
|
|
11768
|
+
const restoreSelection = (0, import_react52.useCallback)(() => {
|
|
11671
11769
|
const textarea = textareaRef.current;
|
|
11672
11770
|
const pending = pendingSelection.current;
|
|
11673
11771
|
if (!textarea || !pending) return;
|
|
11674
11772
|
const max = textarea.value.length;
|
|
11675
11773
|
textarea.setSelectionRange(Math.min(pending[0], max), Math.min(pending[1], max));
|
|
11676
11774
|
}, []);
|
|
11677
|
-
const consumePendingSelection = (0,
|
|
11775
|
+
const consumePendingSelection = (0, import_react52.useCallback)(() => {
|
|
11678
11776
|
if (!pendingSelection.current) return;
|
|
11679
11777
|
const pending = pendingSelection.current;
|
|
11680
11778
|
pendingSelection.current = null;
|
|
@@ -11686,10 +11784,10 @@ function ITJSONEditor({
|
|
|
11686
11784
|
textarea.setSelectionRange(Math.min(pending[0], max), Math.min(pending[1], max));
|
|
11687
11785
|
});
|
|
11688
11786
|
}, [restoreSelection]);
|
|
11689
|
-
(0,
|
|
11787
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
11690
11788
|
consumePendingSelection();
|
|
11691
11789
|
});
|
|
11692
|
-
const applyEdit = (0,
|
|
11790
|
+
const applyEdit = (0, import_react52.useCallback)(
|
|
11693
11791
|
(result) => {
|
|
11694
11792
|
pendingSelection.current = [result.selectionStart, result.selectionEnd];
|
|
11695
11793
|
onChange?.(result.value);
|
|
@@ -11712,19 +11810,19 @@ function ITJSONEditor({
|
|
|
11712
11810
|
readOnly,
|
|
11713
11811
|
applyEdit
|
|
11714
11812
|
});
|
|
11715
|
-
const handleKeyDown = (0,
|
|
11813
|
+
const handleKeyDown = (0, import_react52.useCallback)(
|
|
11716
11814
|
(event) => {
|
|
11717
11815
|
pendingSelection.current = null;
|
|
11718
11816
|
handleKeyDownRaw(event);
|
|
11719
11817
|
},
|
|
11720
11818
|
[handleKeyDownRaw]
|
|
11721
11819
|
);
|
|
11722
|
-
const syncCaret = (0,
|
|
11820
|
+
const syncCaret = (0, import_react52.useCallback)(() => {
|
|
11723
11821
|
const textarea = textareaRef.current;
|
|
11724
11822
|
if (!textarea) return;
|
|
11725
11823
|
setCaretLine(caretPosition(value, textarea.selectionStart, lineStarts).line);
|
|
11726
11824
|
}, [value, lineStarts]);
|
|
11727
|
-
const scrollCaretIntoView = (0,
|
|
11825
|
+
const scrollCaretIntoView = (0, import_react52.useCallback)(() => {
|
|
11728
11826
|
const textarea = textareaRef.current;
|
|
11729
11827
|
if (!textarea || wrapLines) return;
|
|
11730
11828
|
const { line } = caretPosition(value, textarea.selectionStart, lineStarts);
|
|
@@ -11736,11 +11834,11 @@ function ITJSONEditor({
|
|
|
11736
11834
|
if (highlightRef.current) highlightRef.current.scrollTop = textarea.scrollTop;
|
|
11737
11835
|
}
|
|
11738
11836
|
}, [value, lineStarts, lineHeight, wrapLines]);
|
|
11739
|
-
const flash = (0,
|
|
11837
|
+
const flash = (0, import_react52.useCallback)((message) => {
|
|
11740
11838
|
setNotice(message);
|
|
11741
11839
|
window.setTimeout(() => setNotice(null), 1800);
|
|
11742
11840
|
}, []);
|
|
11743
|
-
const applyTransform = (0,
|
|
11841
|
+
const applyTransform = (0, import_react52.useCallback)(
|
|
11744
11842
|
(transform) => {
|
|
11745
11843
|
if (!validation.isValid || validation.parsed === void 0) return;
|
|
11746
11844
|
try {
|
|
@@ -11755,7 +11853,7 @@ function ITJSONEditor({
|
|
|
11755
11853
|
},
|
|
11756
11854
|
[validation, indentSize, value, onChange, flash, t]
|
|
11757
11855
|
);
|
|
11758
|
-
const handleTransformHotkeys = (0,
|
|
11856
|
+
const handleTransformHotkeys = (0, import_react52.useCallback)(
|
|
11759
11857
|
(event) => {
|
|
11760
11858
|
if (!(event.altKey && event.shiftKey)) return;
|
|
11761
11859
|
const key = event.key.toLowerCase();
|
|
@@ -11794,7 +11892,7 @@ function ITJSONEditor({
|
|
|
11794
11892
|
reader.onerror = () => flash(t("jsonEditor.fileError"));
|
|
11795
11893
|
reader.readAsText(file);
|
|
11796
11894
|
};
|
|
11797
|
-
const jumpToLine = (0,
|
|
11895
|
+
const jumpToLine = (0, import_react52.useCallback)(
|
|
11798
11896
|
(line) => {
|
|
11799
11897
|
const textarea = textareaRef.current;
|
|
11800
11898
|
if (!textarea) return;
|
|
@@ -12279,7 +12377,7 @@ function EditorToggle({
|
|
|
12279
12377
|
}
|
|
12280
12378
|
|
|
12281
12379
|
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
12282
|
-
var
|
|
12380
|
+
var import_react56 = require("react");
|
|
12283
12381
|
|
|
12284
12382
|
// src/types/loader.types.ts
|
|
12285
12383
|
var sizeClasses = {
|
|
@@ -12460,6 +12558,11 @@ var AXZY_CATALOG_ENTRIES = [
|
|
|
12460
12558
|
summary: "Tarjeta con t\xEDtulo, imagen y contenido.",
|
|
12461
12559
|
props: {
|
|
12462
12560
|
title: { kind: "string" },
|
|
12561
|
+
tone: {
|
|
12562
|
+
kind: "enum",
|
|
12563
|
+
values: ["primary", "secondary", "ternary", "success", "info", "warning", "danger"],
|
|
12564
|
+
doc: "Tinte pastel de la tarjeta (token --color-<tone>-soft)."
|
|
12565
|
+
},
|
|
12463
12566
|
image: { kind: "string", doc: "URL de la imagen de cabecera." },
|
|
12464
12567
|
alt: { kind: "string" },
|
|
12465
12568
|
onClick: { kind: "action" },
|
|
@@ -12590,7 +12693,7 @@ var AXZY_CATALOG_ENTRIES = [
|
|
|
12590
12693
|
},
|
|
12591
12694
|
{
|
|
12592
12695
|
type: "ITFlex",
|
|
12593
|
-
component:
|
|
12696
|
+
component: flex_default,
|
|
12594
12697
|
children: true,
|
|
12595
12698
|
summary: "Contenedor flex completo.",
|
|
12596
12699
|
props: {
|
|
@@ -12723,52 +12826,6 @@ var AXZY_EXCLUDED_TYPES = {
|
|
|
12723
12826
|
var axzyCatalog = createCatalog(AXZY_CATALOG_ENTRIES, AXZY_EXCLUDED_TYPES);
|
|
12724
12827
|
var axzyCatalogTypes = Object.keys(axzyCatalog.entries);
|
|
12725
12828
|
|
|
12726
|
-
// src/json-renderer/shared/limits.ts
|
|
12727
|
-
var DEFAULT_LIMITS = {
|
|
12728
|
-
maxNodes: 5e3,
|
|
12729
|
-
maxDepth: 40,
|
|
12730
|
-
maxMsPerChunk: 8,
|
|
12731
|
-
actionTimeoutMs: 15e3,
|
|
12732
|
-
maxEffectChain: 5
|
|
12733
|
-
};
|
|
12734
|
-
function resolveLimits(overrides = {}) {
|
|
12735
|
-
const merged = { ...DEFAULT_LIMITS, ...overrides };
|
|
12736
|
-
for (const [key, value] of Object.entries(merged)) {
|
|
12737
|
-
if (!Number.isFinite(value) || value < 0) {
|
|
12738
|
-
throw new RangeError(`L\xEDmite inv\xE1lido: ${key} = ${String(value)}`);
|
|
12739
|
-
}
|
|
12740
|
-
}
|
|
12741
|
-
return merged;
|
|
12742
|
-
}
|
|
12743
|
-
function createLimitTracker(limits = DEFAULT_LIMITS) {
|
|
12744
|
-
let nodes = 0;
|
|
12745
|
-
let deepest = 0;
|
|
12746
|
-
let exceeded = false;
|
|
12747
|
-
return {
|
|
12748
|
-
visit(depth) {
|
|
12749
|
-
if (depth > deepest) deepest = depth;
|
|
12750
|
-
if (nodes >= limits.maxNodes || depth > limits.maxDepth) {
|
|
12751
|
-
exceeded = true;
|
|
12752
|
-
return false;
|
|
12753
|
-
}
|
|
12754
|
-
nodes += 1;
|
|
12755
|
-
return true;
|
|
12756
|
-
},
|
|
12757
|
-
get nodes() {
|
|
12758
|
-
return nodes;
|
|
12759
|
-
},
|
|
12760
|
-
get deepest() {
|
|
12761
|
-
return deepest;
|
|
12762
|
-
},
|
|
12763
|
-
get exceeded() {
|
|
12764
|
-
return exceeded;
|
|
12765
|
-
}
|
|
12766
|
-
};
|
|
12767
|
-
}
|
|
12768
|
-
|
|
12769
|
-
// src/json-renderer/kernel/NodeBoundary.tsx
|
|
12770
|
-
var import_react51 = __toESM(require("react"), 1);
|
|
12771
|
-
|
|
12772
12829
|
// src/json-renderer/shared/errors.ts
|
|
12773
12830
|
var JsonEngineError = class extends Error {
|
|
12774
12831
|
constructor(code, message, path, hint) {
|
|
@@ -12805,32 +12862,243 @@ function issue(code, message, path = "", options = {}) {
|
|
|
12805
12862
|
};
|
|
12806
12863
|
}
|
|
12807
12864
|
|
|
12808
|
-
// src/json-renderer/
|
|
12809
|
-
|
|
12810
|
-
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
componentDidCatch(error) {
|
|
12818
|
-
this.props.onError?.(error, this.props.path);
|
|
12865
|
+
// src/json-renderer/shared/paths.ts
|
|
12866
|
+
function pushPath(path, segment) {
|
|
12867
|
+
return [...path, segment];
|
|
12868
|
+
}
|
|
12869
|
+
function formatPath(path) {
|
|
12870
|
+
let out = "";
|
|
12871
|
+
for (const segment of path) {
|
|
12872
|
+
if (typeof segment === "number") out += `[${segment}]`;
|
|
12873
|
+
else out += out ? `.${segment}` : segment;
|
|
12819
12874
|
}
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12875
|
+
return out;
|
|
12876
|
+
}
|
|
12877
|
+
function parsePath(rendered) {
|
|
12878
|
+
if (!rendered) return [];
|
|
12879
|
+
return rendered.split(/\.(?![^[]*])/).flatMap((part) => {
|
|
12880
|
+
const match = part.match(/^([^[\]]*)((?:\[\d+\])*)$/);
|
|
12881
|
+
if (!match) return [part];
|
|
12882
|
+
const [, key, indexes] = match;
|
|
12883
|
+
const segments = key ? [key] : [];
|
|
12884
|
+
for (const index of indexes.match(/\d+/g) ?? []) segments.push(Number(index));
|
|
12885
|
+
return segments;
|
|
12886
|
+
});
|
|
12887
|
+
}
|
|
12888
|
+
function readPath(source, path) {
|
|
12889
|
+
let cursor = source;
|
|
12890
|
+
for (const segment of path) {
|
|
12891
|
+
if (cursor === null || typeof cursor !== "object") return void 0;
|
|
12892
|
+
cursor = cursor[segment];
|
|
12823
12893
|
}
|
|
12824
|
-
|
|
12894
|
+
return cursor;
|
|
12895
|
+
}
|
|
12896
|
+
function hasPath(source, path) {
|
|
12897
|
+
if (path.length === 0) return true;
|
|
12898
|
+
const parent = readPath(source, path.slice(0, -1));
|
|
12899
|
+
if (parent === null || typeof parent !== "object") return false;
|
|
12900
|
+
return Object.prototype.hasOwnProperty.call(parent, path[path.length - 1]);
|
|
12901
|
+
}
|
|
12902
|
+
function propPath(nodePath, prop) {
|
|
12903
|
+
return pushPath(pushPath(nodePath, "props"), prop);
|
|
12904
|
+
}
|
|
12825
12905
|
|
|
12826
|
-
// src/json-renderer/
|
|
12827
|
-
|
|
12828
|
-
|
|
12906
|
+
// src/json-renderer/binding/resolveValue.ts
|
|
12907
|
+
var CLAVES_DE_RED = ["url", "endpoint", "href", "src"];
|
|
12908
|
+
var SUPPORTED_REFERENCES = ["$source", "$state", "$param"];
|
|
12909
|
+
function own(record, key) {
|
|
12910
|
+
return record !== void 0 && Object.prototype.hasOwnProperty.call(record, key);
|
|
12829
12911
|
}
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12912
|
+
function isDollarReference(value) {
|
|
12913
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
12914
|
+
return Object.keys(value).some((key) => key.startsWith("$"));
|
|
12915
|
+
}
|
|
12916
|
+
function referenceIssue(message, path, hint) {
|
|
12917
|
+
return issue("JR032", message, formatPath(path), { severity: "warning", hint });
|
|
12918
|
+
}
|
|
12919
|
+
function createBindingResolver(scope) {
|
|
12920
|
+
const readValue = (table, kind, key, path) => {
|
|
12921
|
+
if (own(table, key)) return table[key];
|
|
12922
|
+
scope.report(
|
|
12923
|
+
referenceIssue(
|
|
12924
|
+
`La referencia \`${kind}: "${key}"\` no tiene valor.`,
|
|
12925
|
+
path,
|
|
12926
|
+
kind === "$state" ? "Declara el valor en `state` del esquema." : "El host debe pasar el par\xE1metro en `params`."
|
|
12927
|
+
)
|
|
12928
|
+
);
|
|
12929
|
+
return void 0;
|
|
12930
|
+
};
|
|
12931
|
+
const resolveParams = (declared, path) => {
|
|
12932
|
+
const resolved = {};
|
|
12933
|
+
for (const [name, raw] of Object.entries(declared ?? {})) {
|
|
12934
|
+
if (!isDollarReference(raw)) {
|
|
12935
|
+
resolved[name] = raw;
|
|
12936
|
+
continue;
|
|
12937
|
+
}
|
|
12938
|
+
const [key] = Object.keys(raw).filter((candidate) => candidate.startsWith("$"));
|
|
12939
|
+
if (key === "$state" && typeof raw[key] === "string") {
|
|
12940
|
+
const value = readValue(scope.state, "$state", raw[key], path);
|
|
12941
|
+
if (value !== void 0) resolved[name] = value;
|
|
12942
|
+
} else if (key === "$param" && typeof raw[key] === "string") {
|
|
12943
|
+
const value = readValue(scope.params, "$param", raw[key], path);
|
|
12944
|
+
if (value !== void 0) resolved[name] = value;
|
|
12945
|
+
} else {
|
|
12946
|
+
scope.report(
|
|
12947
|
+
referenceIssue(
|
|
12948
|
+
"Un par\xE1metro de fuente solo admite valores, `$state` o `$param`.",
|
|
12949
|
+
path,
|
|
12950
|
+
"Las fuentes no se encadenan: declara la fuente sin referencias a otras fuentes."
|
|
12951
|
+
)
|
|
12952
|
+
);
|
|
12953
|
+
}
|
|
12954
|
+
}
|
|
12955
|
+
return resolved;
|
|
12956
|
+
};
|
|
12957
|
+
const failingLoader = (message, path, hint) => {
|
|
12958
|
+
scope.report(issue("JR030", message, formatPath(path), { severity: "error", hint }));
|
|
12959
|
+
return () => Promise.reject(new Error(message));
|
|
12960
|
+
};
|
|
12961
|
+
const sourceLoader = (name, path) => {
|
|
12962
|
+
if (!own(scope.data, name)) {
|
|
12963
|
+
return failingLoader(
|
|
12964
|
+
`La fuente \`${name}\` no est\xE1 declarada en \`data\`.`,
|
|
12965
|
+
path,
|
|
12966
|
+
"Decl\xE1rala en `data` del esquema con el `handler` que registra el host."
|
|
12967
|
+
);
|
|
12968
|
+
}
|
|
12969
|
+
const declared = scope.data[name];
|
|
12970
|
+
const claveDeRed = Object.keys(declared).find((clave) => CLAVES_DE_RED.includes(clave));
|
|
12971
|
+
if (claveDeRed) {
|
|
12972
|
+
scope.report(
|
|
12973
|
+
issue("JR031", `El esquema declara \`${claveDeRed}\` en la fuente "${name}": las fuentes no pueden pedir red.`, formatPath(path), {
|
|
12974
|
+
severity: "error",
|
|
12975
|
+
hint: "Una fuente solo nombra un `handler` que registra el host."
|
|
12976
|
+
})
|
|
12977
|
+
);
|
|
12978
|
+
return () => Promise.reject(new Error(`La fuente "${name}" no puede pedir red.`));
|
|
12979
|
+
}
|
|
12980
|
+
const handler = own(scope.handlers, declared.handler) ? scope.handlers[declared.handler] : void 0;
|
|
12981
|
+
if (typeof handler !== "function") {
|
|
12982
|
+
return failingLoader(
|
|
12983
|
+
`El handler \`${declared.handler}\` no est\xE1 registrado por el host.`,
|
|
12984
|
+
path,
|
|
12985
|
+
"El host debe registrarlo en `dataHandlers` del renderizador."
|
|
12986
|
+
);
|
|
12987
|
+
}
|
|
12988
|
+
const params = resolveParams(declared.params, path);
|
|
12989
|
+
return (query) => new Promise((resolve) => resolve(handler(query, params)));
|
|
12990
|
+
};
|
|
12991
|
+
const resolveReference = (ref, path) => {
|
|
12992
|
+
const keys = Object.keys(ref).filter((key2) => key2.startsWith("$"));
|
|
12993
|
+
const [key] = keys;
|
|
12994
|
+
if (keys.length !== 1 || !SUPPORTED_REFERENCES.includes(key) || typeof ref[key] !== "string") {
|
|
12995
|
+
scope.report(
|
|
12996
|
+
referenceIssue(
|
|
12997
|
+
`Referencia no soportada: ${keys.join(", ") || "sin operador"}.`,
|
|
12998
|
+
path,
|
|
12999
|
+
"Soportadas: `$source`, `$state` y `$param`. Los dem\xE1s operadores llegan con las acciones y las tablas."
|
|
13000
|
+
)
|
|
13001
|
+
);
|
|
13002
|
+
return void 0;
|
|
13003
|
+
}
|
|
13004
|
+
const name = ref[key];
|
|
13005
|
+
if (key === "$source") return sourceLoader(name, path);
|
|
13006
|
+
if (key === "$state") return readValue(scope.state, "$state", name, path);
|
|
13007
|
+
return readValue(scope.params, "$param", name, path);
|
|
13008
|
+
};
|
|
13009
|
+
return (value, path) => {
|
|
13010
|
+
if (isDollarReference(value)) return resolveReference(value, path);
|
|
13011
|
+
return scope.host ? scope.host(value, path) : value;
|
|
13012
|
+
};
|
|
13013
|
+
}
|
|
13014
|
+
|
|
13015
|
+
// src/json-renderer/shared/limits.ts
|
|
13016
|
+
var DEFAULT_LIMITS = {
|
|
13017
|
+
maxNodes: 5e3,
|
|
13018
|
+
maxDepth: 40,
|
|
13019
|
+
maxMsPerChunk: 8,
|
|
13020
|
+
actionTimeoutMs: 15e3,
|
|
13021
|
+
maxEffectChain: 5
|
|
13022
|
+
};
|
|
13023
|
+
function resolveLimits(overrides = {}) {
|
|
13024
|
+
const merged = { ...DEFAULT_LIMITS, ...overrides };
|
|
13025
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
13026
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
13027
|
+
throw new RangeError(`L\xEDmite inv\xE1lido: ${key} = ${String(value)}`);
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
return merged;
|
|
13031
|
+
}
|
|
13032
|
+
function createLimitTracker(limits = DEFAULT_LIMITS) {
|
|
13033
|
+
let nodes = 0;
|
|
13034
|
+
let deepest = 0;
|
|
13035
|
+
let exceeded = false;
|
|
13036
|
+
return {
|
|
13037
|
+
visit(depth) {
|
|
13038
|
+
if (depth > deepest) deepest = depth;
|
|
13039
|
+
if (nodes >= limits.maxNodes || depth > limits.maxDepth) {
|
|
13040
|
+
exceeded = true;
|
|
13041
|
+
return false;
|
|
13042
|
+
}
|
|
13043
|
+
nodes += 1;
|
|
13044
|
+
return true;
|
|
13045
|
+
},
|
|
13046
|
+
get nodes() {
|
|
13047
|
+
return nodes;
|
|
13048
|
+
},
|
|
13049
|
+
get deepest() {
|
|
13050
|
+
return deepest;
|
|
13051
|
+
},
|
|
13052
|
+
get exceeded() {
|
|
13053
|
+
return exceeded;
|
|
13054
|
+
}
|
|
13055
|
+
};
|
|
13056
|
+
}
|
|
13057
|
+
|
|
13058
|
+
// src/json-renderer/kernel/capabilities.ts
|
|
13059
|
+
function capacidadesRequeridas(requires) {
|
|
13060
|
+
if (requires === void 0 || requires === null) return [];
|
|
13061
|
+
if (typeof requires === "string") return requires === "" ? null : [requires];
|
|
13062
|
+
if (Array.isArray(requires) && requires.every((item) => typeof item === "string" && item !== "")) {
|
|
13063
|
+
return requires;
|
|
13064
|
+
}
|
|
13065
|
+
return null;
|
|
13066
|
+
}
|
|
13067
|
+
function faltanCapacidades(requires, concedidas) {
|
|
13068
|
+
const requeridas = capacidadesRequeridas(requires);
|
|
13069
|
+
if (requeridas === null) return ["(requires no v\xE1lido)"];
|
|
13070
|
+
if (requeridas.length === 0) return [];
|
|
13071
|
+
const conjunto = new Set(concedidas ?? []);
|
|
13072
|
+
return requeridas.filter((capacidad) => !conjunto.has(capacidad));
|
|
13073
|
+
}
|
|
13074
|
+
|
|
13075
|
+
// src/json-renderer/kernel/NodeBoundary.tsx
|
|
13076
|
+
var import_react53 = __toESM(require("react"), 1);
|
|
13077
|
+
var NodeBoundary = class extends import_react53.default.Component {
|
|
13078
|
+
constructor() {
|
|
13079
|
+
super(...arguments);
|
|
13080
|
+
__publicField(this, "state", { failed: false });
|
|
13081
|
+
}
|
|
13082
|
+
static getDerivedStateFromError() {
|
|
13083
|
+
return { failed: true };
|
|
13084
|
+
}
|
|
13085
|
+
componentDidCatch(error) {
|
|
13086
|
+
this.props.onError?.(error, this.props.path);
|
|
13087
|
+
}
|
|
13088
|
+
render() {
|
|
13089
|
+
if (this.state.failed) return this.props.fallback ?? null;
|
|
13090
|
+
return this.props.children;
|
|
13091
|
+
}
|
|
13092
|
+
};
|
|
13093
|
+
|
|
13094
|
+
// src/json-renderer/stream/tolerantParse.ts
|
|
13095
|
+
function isPending(value) {
|
|
13096
|
+
return typeof value === "object" && value !== null && value.$pending === true;
|
|
13097
|
+
}
|
|
13098
|
+
var TRUNCATED_CONTAINERS = /* @__PURE__ */ new WeakSet();
|
|
13099
|
+
function finalize(value, counter) {
|
|
13100
|
+
if (Array.isArray(value)) {
|
|
13101
|
+
return value.map((item) => finalize(item, counter)).filter((item) => item !== void 0);
|
|
12834
13102
|
}
|
|
12835
13103
|
if (value && typeof value === "object") {
|
|
12836
13104
|
if (isPending(value)) {
|
|
@@ -13153,48 +13421,7 @@ function isNodePending(node) {
|
|
|
13153
13421
|
}
|
|
13154
13422
|
|
|
13155
13423
|
// src/json-renderer/kernel/renderNode.tsx
|
|
13156
|
-
var
|
|
13157
|
-
|
|
13158
|
-
// src/json-renderer/shared/paths.ts
|
|
13159
|
-
function pushPath(path, segment) {
|
|
13160
|
-
return [...path, segment];
|
|
13161
|
-
}
|
|
13162
|
-
function formatPath(path) {
|
|
13163
|
-
let out = "";
|
|
13164
|
-
for (const segment of path) {
|
|
13165
|
-
if (typeof segment === "number") out += `[${segment}]`;
|
|
13166
|
-
else out += out ? `.${segment}` : segment;
|
|
13167
|
-
}
|
|
13168
|
-
return out;
|
|
13169
|
-
}
|
|
13170
|
-
function parsePath(rendered) {
|
|
13171
|
-
if (!rendered) return [];
|
|
13172
|
-
return rendered.split(/\.(?![^[]*])/).flatMap((part) => {
|
|
13173
|
-
const match = part.match(/^([^[\]]*)((?:\[\d+\])*)$/);
|
|
13174
|
-
if (!match) return [part];
|
|
13175
|
-
const [, key, indexes] = match;
|
|
13176
|
-
const segments = key ? [key] : [];
|
|
13177
|
-
for (const index of indexes.match(/\d+/g) ?? []) segments.push(Number(index));
|
|
13178
|
-
return segments;
|
|
13179
|
-
});
|
|
13180
|
-
}
|
|
13181
|
-
function readPath(source, path) {
|
|
13182
|
-
let cursor = source;
|
|
13183
|
-
for (const segment of path) {
|
|
13184
|
-
if (cursor === null || typeof cursor !== "object") return void 0;
|
|
13185
|
-
cursor = cursor[segment];
|
|
13186
|
-
}
|
|
13187
|
-
return cursor;
|
|
13188
|
-
}
|
|
13189
|
-
function hasPath(source, path) {
|
|
13190
|
-
if (path.length === 0) return true;
|
|
13191
|
-
const parent = readPath(source, path.slice(0, -1));
|
|
13192
|
-
if (parent === null || typeof parent !== "object") return false;
|
|
13193
|
-
return Object.prototype.hasOwnProperty.call(parent, path[path.length - 1]);
|
|
13194
|
-
}
|
|
13195
|
-
function propPath(nodePath, prop) {
|
|
13196
|
-
return pushPath(pushPath(nodePath, "props"), prop);
|
|
13197
|
-
}
|
|
13424
|
+
var import_react55 = __toESM(require("react"), 1);
|
|
13198
13425
|
|
|
13199
13426
|
// src/json-renderer/catalog/resolve.ts
|
|
13200
13427
|
function isSchemaReference(value) {
|
|
@@ -13335,11 +13562,457 @@ function resolveNode(node, catalog, path) {
|
|
|
13335
13562
|
return { ok: true, entry, props, actions, issues };
|
|
13336
13563
|
}
|
|
13337
13564
|
|
|
13565
|
+
// src/json-renderer/kernel/slots.ts
|
|
13566
|
+
var SLOT_TYPE = "slot";
|
|
13567
|
+
function isSlotNode(node) {
|
|
13568
|
+
return node.type === SLOT_TYPE;
|
|
13569
|
+
}
|
|
13570
|
+
function slotName(node) {
|
|
13571
|
+
const name = node.props?.name;
|
|
13572
|
+
return typeof name === "string" && name !== "" ? name : void 0;
|
|
13573
|
+
}
|
|
13574
|
+
|
|
13575
|
+
// src/json-renderer/form/FormNode.tsx
|
|
13576
|
+
var import_react54 = require("react");
|
|
13577
|
+
|
|
13578
|
+
// src/json-renderer/form/rules.ts
|
|
13579
|
+
var FORM_FIELD_KINDS = ["text", "email"];
|
|
13580
|
+
var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
13581
|
+
function longitudDeclarada(value) {
|
|
13582
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
13583
|
+
}
|
|
13584
|
+
function readFormFields(declared, fieldsPath) {
|
|
13585
|
+
const issues = [];
|
|
13586
|
+
const fields = [];
|
|
13587
|
+
if (!Array.isArray(declared)) {
|
|
13588
|
+
issues.push(issue("JR021", "El formulario necesita `props.fields` como lista.", formatPath(fieldsPath), { severity: "error" }));
|
|
13589
|
+
return { fields, issues };
|
|
13590
|
+
}
|
|
13591
|
+
const nombres = /* @__PURE__ */ new Set();
|
|
13592
|
+
declared.forEach((raw, index) => {
|
|
13593
|
+
const fieldPath = [...fieldsPath, index];
|
|
13594
|
+
const campo = raw;
|
|
13595
|
+
if (!campo || typeof campo !== "object" || typeof campo.name !== "string" || campo.name === "") {
|
|
13596
|
+
issues.push(issue("JR021", "Un campo del formulario no declara `name`.", formatPath(fieldPath), { severity: "error" }));
|
|
13597
|
+
return;
|
|
13598
|
+
}
|
|
13599
|
+
if (nombres.has(campo.name)) {
|
|
13600
|
+
issues.push(issue("JR021", `El campo "${campo.name}" se repite.`, formatPath(fieldPath), { severity: "error" }));
|
|
13601
|
+
return;
|
|
13602
|
+
}
|
|
13603
|
+
let kind = "text";
|
|
13604
|
+
if (campo.kind !== void 0) {
|
|
13605
|
+
if (typeof campo.kind === "string" && FORM_FIELD_KINDS.includes(campo.kind)) {
|
|
13606
|
+
kind = campo.kind;
|
|
13607
|
+
} else {
|
|
13608
|
+
issues.push(
|
|
13609
|
+
issue("JR011", `Tipo de campo "${String(campo.kind)}" no admitido.`, formatPath(fieldPath), {
|
|
13610
|
+
severity: "warning",
|
|
13611
|
+
hint: `Admitidos: ${FORM_FIELD_KINDS.join(", ")}. Se usa "text".`
|
|
13612
|
+
})
|
|
13613
|
+
);
|
|
13614
|
+
}
|
|
13615
|
+
}
|
|
13616
|
+
const minLength = longitudDeclarada(campo.minLength);
|
|
13617
|
+
const maxLength = longitudDeclarada(campo.maxLength);
|
|
13618
|
+
for (const [clave, valor, declarada] of [["minLength", campo.minLength, minLength], ["maxLength", campo.maxLength, maxLength]]) {
|
|
13619
|
+
if (valor !== void 0 && declarada === void 0) {
|
|
13620
|
+
issues.push(issue("JR011", `\`${clave}\` debe ser un entero no negativo.`, formatPath(fieldPath), { severity: "warning", hint: "Se ignora." }));
|
|
13621
|
+
}
|
|
13622
|
+
}
|
|
13623
|
+
if (minLength !== void 0 && maxLength !== void 0 && minLength > maxLength) {
|
|
13624
|
+
issues.push(issue("JR021", `El campo "${campo.name}" tiene minLength mayor que maxLength.`, formatPath(fieldPath), { severity: "error" }));
|
|
13625
|
+
return;
|
|
13626
|
+
}
|
|
13627
|
+
nombres.add(campo.name);
|
|
13628
|
+
fields.push({ name: campo.name, kind, required: campo.required === true, minLength, maxLength, label: campo.label });
|
|
13629
|
+
});
|
|
13630
|
+
return { fields, issues };
|
|
13631
|
+
}
|
|
13632
|
+
function validateField(field, value) {
|
|
13633
|
+
const texto = value.trim();
|
|
13634
|
+
if (texto === "") return field.required ? "required" : void 0;
|
|
13635
|
+
if (field.minLength !== void 0 && texto.length < field.minLength) return "minLength";
|
|
13636
|
+
if (field.maxLength !== void 0 && texto.length > field.maxLength) return "maxLength";
|
|
13637
|
+
if (field.kind === "email" && !EMAIL.test(texto)) return "email";
|
|
13638
|
+
return void 0;
|
|
13639
|
+
}
|
|
13640
|
+
function validateForm(fields, values) {
|
|
13641
|
+
const errores = {};
|
|
13642
|
+
for (const field of fields) {
|
|
13643
|
+
const code = validateField(field, values[field.name] ?? "");
|
|
13644
|
+
if (code) errores[field.name] = code;
|
|
13645
|
+
}
|
|
13646
|
+
return errores;
|
|
13647
|
+
}
|
|
13648
|
+
|
|
13649
|
+
// src/json-renderer/form/FormNode.tsx
|
|
13650
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13651
|
+
function valorDe(evento) {
|
|
13652
|
+
if (typeof evento === "string") return evento;
|
|
13653
|
+
return evento?.target?.value?.toString() ?? "";
|
|
13654
|
+
}
|
|
13655
|
+
function FormNode({ id, fields, submitLabel, onSubmit }) {
|
|
13656
|
+
const { t } = useITTranslation();
|
|
13657
|
+
const [values, setValues] = (0, import_react54.useState)({});
|
|
13658
|
+
const [errors, setErrors] = (0, import_react54.useState)({});
|
|
13659
|
+
const [intentado, setIntentado] = (0, import_react54.useState)(false);
|
|
13660
|
+
const mensaje = (code, campo) => t(`jsonRenderer.form.${code}`, { min: String(campo.minLength ?? 0), max: String(campo.maxLength ?? 0) });
|
|
13661
|
+
const enviar = () => {
|
|
13662
|
+
const encontrados = validateForm(fields, values);
|
|
13663
|
+
setIntentado(true);
|
|
13664
|
+
setErrors(encontrados);
|
|
13665
|
+
if (Object.keys(encontrados).length === 0) onSubmit?.(values);
|
|
13666
|
+
};
|
|
13667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(ITStack, { direction: "column", spacing: 3, alignItems: "stretch", children: [
|
|
13668
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13669
|
+
ITInput,
|
|
13670
|
+
{
|
|
13671
|
+
name: field.name,
|
|
13672
|
+
label: field.label,
|
|
13673
|
+
type: field.kind === "email" ? "email" : "text",
|
|
13674
|
+
value: values[field.name] ?? "",
|
|
13675
|
+
touched: intentado,
|
|
13676
|
+
error: errors[field.name] ? mensaje(errors[field.name], field) : void 0,
|
|
13677
|
+
onChange: (evento) => {
|
|
13678
|
+
const valor = valorDe(evento);
|
|
13679
|
+
setValues((previo) => ({ ...previo, [field.name]: valor }));
|
|
13680
|
+
setErrors((previo) => {
|
|
13681
|
+
if (!previo[field.name]) return previo;
|
|
13682
|
+
const resto = { ...previo };
|
|
13683
|
+
delete resto[field.name];
|
|
13684
|
+
return resto;
|
|
13685
|
+
});
|
|
13686
|
+
}
|
|
13687
|
+
},
|
|
13688
|
+
field.name
|
|
13689
|
+
)),
|
|
13690
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(flex_default, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ITButton, { label: submitLabel ?? t("jsonRenderer.form.submit"), size: "sm", onClick: enviar }) })
|
|
13691
|
+
] }) });
|
|
13692
|
+
}
|
|
13693
|
+
|
|
13694
|
+
// src/json-renderer/actions/effects.ts
|
|
13695
|
+
var MAX_EFFECT_DEPTH = 5;
|
|
13696
|
+
var EFFECT_KEYS = ["toast", "navigate", "refresh", "openOverlay", "closeOverlay", "set"];
|
|
13697
|
+
var EFFECT_KEYS_DEL_HOST = ["toast", "navigate", "refresh", "openOverlay", "closeOverlay"];
|
|
13698
|
+
function leerResultado(ruta, resultado) {
|
|
13699
|
+
return ruta.split(".").reduce(
|
|
13700
|
+
(actual, clave) => actual && typeof actual === "object" ? actual[clave] : void 0,
|
|
13701
|
+
resultado
|
|
13702
|
+
);
|
|
13703
|
+
}
|
|
13704
|
+
function resolverResultado(valor, resultado) {
|
|
13705
|
+
if (!valor || typeof valor !== "object" || Array.isArray(valor)) return valor;
|
|
13706
|
+
const objeto = valor;
|
|
13707
|
+
if (typeof objeto.$result === "string") return leerResultado(objeto.$result, resultado) ?? "";
|
|
13708
|
+
if (objeto.params && typeof objeto.params === "object") {
|
|
13709
|
+
const params = Object.fromEntries(
|
|
13710
|
+
Object.entries(objeto.params).map(([clave, valorParam]) => [
|
|
13711
|
+
clave,
|
|
13712
|
+
resolverResultado(valorParam, resultado)
|
|
13713
|
+
])
|
|
13714
|
+
);
|
|
13715
|
+
return { ...objeto, params };
|
|
13716
|
+
}
|
|
13717
|
+
return valor;
|
|
13718
|
+
}
|
|
13719
|
+
function plantilla(texto, resultado) {
|
|
13720
|
+
return texto.replace(/\{([\w.]+)\}/g, (_, ruta) => {
|
|
13721
|
+
const valor = leerResultado(ruta, resultado);
|
|
13722
|
+
return valor === void 0 ? "" : String(valor);
|
|
13723
|
+
});
|
|
13724
|
+
}
|
|
13725
|
+
function efectosSueltos(declarada) {
|
|
13726
|
+
const sueltos = {};
|
|
13727
|
+
for (const clave of EFFECT_KEYS) {
|
|
13728
|
+
if (declarada[clave] !== void 0) sueltos[clave] = declarada[clave];
|
|
13729
|
+
}
|
|
13730
|
+
return Object.keys(sueltos).length > 0 ? sueltos : null;
|
|
13731
|
+
}
|
|
13732
|
+
function comprobarRegistro(efecto, context) {
|
|
13733
|
+
for (const clave of EFFECT_KEYS_DEL_HOST) {
|
|
13734
|
+
if (efecto[clave] === void 0) continue;
|
|
13735
|
+
if (typeof context.effects?.[clave] !== "function") {
|
|
13736
|
+
context.report(
|
|
13737
|
+
issue("JR040", `El host no implementa el efecto \`${clave}\`.`, formatPath(context.path), {
|
|
13738
|
+
severity: "warning",
|
|
13739
|
+
hint: "Reg\xEDstralo en `effects` del renderizador o quita el efecto del esquema."
|
|
13740
|
+
})
|
|
13741
|
+
);
|
|
13742
|
+
}
|
|
13743
|
+
}
|
|
13744
|
+
}
|
|
13745
|
+
function cumplirEfecto(efecto, context, resultado) {
|
|
13746
|
+
if (efecto.set && context.setState) {
|
|
13747
|
+
const cambios = {};
|
|
13748
|
+
for (const [clave, valor] of Object.entries(efecto.set)) {
|
|
13749
|
+
const conResultado = resolverResultado(valor, resultado);
|
|
13750
|
+
cambios[clave] = context.resolveRaw ? context.resolveRaw(conResultado, context.path) : conResultado;
|
|
13751
|
+
}
|
|
13752
|
+
context.setState(cambios);
|
|
13753
|
+
}
|
|
13754
|
+
const registro = context.effects;
|
|
13755
|
+
if (!registro) return;
|
|
13756
|
+
if (efecto.toast && registro.toast) {
|
|
13757
|
+
registro.toast({
|
|
13758
|
+
variant: efecto.toast.variant ?? "info",
|
|
13759
|
+
message: context.resolveText(resolverResultado(efecto.toast.message, resultado), context.path)
|
|
13760
|
+
});
|
|
13761
|
+
}
|
|
13762
|
+
if (typeof efecto.navigate === "string" && registro.navigate) {
|
|
13763
|
+
registro.navigate(plantilla(efecto.navigate, resultado));
|
|
13764
|
+
}
|
|
13765
|
+
if (typeof efecto.refresh === "string" && registro.refresh) registro.refresh(efecto.refresh);
|
|
13766
|
+
if (typeof efecto.openOverlay === "string" && registro.openOverlay) registro.openOverlay(efecto.openOverlay);
|
|
13767
|
+
if (efecto.closeOverlay !== void 0 && registro.closeOverlay) {
|
|
13768
|
+
registro.closeOverlay(typeof efecto.closeOverlay === "string" ? efecto.closeOverlay : void 0);
|
|
13769
|
+
}
|
|
13770
|
+
}
|
|
13771
|
+
function pasosDe(efectos, context) {
|
|
13772
|
+
const profundidad = context.depth ?? 0;
|
|
13773
|
+
return efectos.map((efecto) => {
|
|
13774
|
+
if (typeof efecto.action !== "string") {
|
|
13775
|
+
comprobarRegistro(efecto, context);
|
|
13776
|
+
return (resultado) => cumplirEfecto(efecto, context, resultado);
|
|
13777
|
+
}
|
|
13778
|
+
if (profundidad + 1 > MAX_EFFECT_DEPTH) {
|
|
13779
|
+
context.report(
|
|
13780
|
+
issue("JR042", `El encadenado de acciones supera ${MAX_EFFECT_DEPTH} niveles.`, formatPath(context.path), {
|
|
13781
|
+
severity: "error",
|
|
13782
|
+
hint: "Reduce los `then` anidados."
|
|
13783
|
+
})
|
|
13784
|
+
);
|
|
13785
|
+
return () => void 0;
|
|
13786
|
+
}
|
|
13787
|
+
const handler = context.resolveChained?.(efecto.action);
|
|
13788
|
+
if (!handler) {
|
|
13789
|
+
context.report(
|
|
13790
|
+
issue("JR040", `La acci\xF3n encadenada \`${efecto.action}\` no est\xE1 registrada por el host.`, formatPath(context.path), {
|
|
13791
|
+
severity: "error",
|
|
13792
|
+
hint: "Reg\xEDstrala en las acciones del renderizador o cambia el nombre en el esquema."
|
|
13793
|
+
})
|
|
13794
|
+
);
|
|
13795
|
+
return () => void 0;
|
|
13796
|
+
}
|
|
13797
|
+
const encadenada = wrapAction(handler, efecto, { ...context, depth: profundidad + 1 });
|
|
13798
|
+
return () => encadenada(efecto.args);
|
|
13799
|
+
});
|
|
13800
|
+
}
|
|
13801
|
+
function wrapAction(handler, action, context) {
|
|
13802
|
+
if (!action || typeof action !== "object") return handler;
|
|
13803
|
+
const declarada = action;
|
|
13804
|
+
const sueltos = efectosSueltos(declarada);
|
|
13805
|
+
const alTerminar = [...sueltos ? [sueltos] : [], ...Array.isArray(declarada.then) ? declarada.then : []];
|
|
13806
|
+
const alFallar = declarada.onError;
|
|
13807
|
+
if (alTerminar.length === 0 && !alFallar) return handler;
|
|
13808
|
+
const pasosOk = pasosDe(alTerminar, context);
|
|
13809
|
+
const pasoError = alFallar ? pasosDe([alFallar], context)[0] : void 0;
|
|
13810
|
+
const aplicar = (resultado) => pasosOk.forEach((paso) => paso(resultado));
|
|
13811
|
+
return (...args) => {
|
|
13812
|
+
let resultado;
|
|
13813
|
+
try {
|
|
13814
|
+
resultado = handler(...args);
|
|
13815
|
+
} catch {
|
|
13816
|
+
pasoError?.(void 0);
|
|
13817
|
+
return void 0;
|
|
13818
|
+
}
|
|
13819
|
+
if (resultado && typeof resultado.then === "function") {
|
|
13820
|
+
let resuelta = false;
|
|
13821
|
+
const limite = context.timeoutMs;
|
|
13822
|
+
const temporizador = limite !== void 0 && Number.isFinite(limite) ? setTimeout(() => {
|
|
13823
|
+
if (resuelta) return;
|
|
13824
|
+
resuelta = true;
|
|
13825
|
+
context.reportRuntime?.(
|
|
13826
|
+
issue("JR041", `La acci\xF3n excedi\xF3 ${limite} ms y se considera fallida.`, formatPath(context.path), {
|
|
13827
|
+
severity: "error",
|
|
13828
|
+
hint: "El host debe responder o rechazar la acci\xF3n a tiempo."
|
|
13829
|
+
})
|
|
13830
|
+
);
|
|
13831
|
+
pasoError?.(void 0);
|
|
13832
|
+
}, limite) : void 0;
|
|
13833
|
+
resultado.then(
|
|
13834
|
+
(valor) => {
|
|
13835
|
+
if (resuelta) return;
|
|
13836
|
+
resuelta = true;
|
|
13837
|
+
clearTimeout(temporizador);
|
|
13838
|
+
aplicar(valor);
|
|
13839
|
+
},
|
|
13840
|
+
() => {
|
|
13841
|
+
if (resuelta) return;
|
|
13842
|
+
resuelta = true;
|
|
13843
|
+
clearTimeout(temporizador);
|
|
13844
|
+
pasoError?.(void 0);
|
|
13845
|
+
}
|
|
13846
|
+
);
|
|
13847
|
+
return resultado;
|
|
13848
|
+
}
|
|
13849
|
+
aplicar(resultado);
|
|
13850
|
+
return resultado;
|
|
13851
|
+
};
|
|
13852
|
+
}
|
|
13853
|
+
|
|
13338
13854
|
// src/json-renderer/kernel/renderNode.tsx
|
|
13855
|
+
function effectContext(options, path, node) {
|
|
13856
|
+
return {
|
|
13857
|
+
effects: options.effects,
|
|
13858
|
+
path,
|
|
13859
|
+
resolveText: (value, valuePath) => textoDe(options.resolveValue ? options.resolveValue(value, valuePath) : value),
|
|
13860
|
+
report: (aviso) => options.issues.push(aviso),
|
|
13861
|
+
// Una acción encadenada desde un efecto se resuelve con el mismo `resolveAction` del host.
|
|
13862
|
+
resolveChained: (name) => options.resolveAction?.(node, "chain", { action: name }, path),
|
|
13863
|
+
timeoutMs: options.actionTimeoutMs,
|
|
13864
|
+
reportRuntime: options.onIssue,
|
|
13865
|
+
setState: options.setState,
|
|
13866
|
+
resolveRaw: (value, valuePath) => options.resolveValue ? options.resolveValue(value, valuePath) : value
|
|
13867
|
+
};
|
|
13868
|
+
}
|
|
13869
|
+
function nombreDeAccion(action) {
|
|
13870
|
+
const nombre = action?.action;
|
|
13871
|
+
return typeof nombre === "string" ? nombre : "(sin nombre)";
|
|
13872
|
+
}
|
|
13873
|
+
function isFormNode(node) {
|
|
13874
|
+
return node.type === "form";
|
|
13875
|
+
}
|
|
13876
|
+
function textoDe(value) {
|
|
13877
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : "";
|
|
13878
|
+
}
|
|
13339
13879
|
function childList(node) {
|
|
13340
13880
|
if (!node || node.children === void 0 || node.children === null) return [];
|
|
13341
13881
|
return Array.isArray(node.children) ? node.children : [node.children];
|
|
13342
13882
|
}
|
|
13883
|
+
function renderSlot(node, options) {
|
|
13884
|
+
const { path, issues, slots, resolveValue } = options;
|
|
13885
|
+
const name = slotName(node);
|
|
13886
|
+
if (!name) {
|
|
13887
|
+
issues.push(
|
|
13888
|
+
issue("JR011", "El slot no declara `props.name`.", formatPath(propPath(path, "name")), {
|
|
13889
|
+
severity: "error",
|
|
13890
|
+
hint: 'Declara el nombre que el host registr\xF3, por ejemplo { "type": "slot", "props": { "name": "resumen" } }.'
|
|
13891
|
+
})
|
|
13892
|
+
);
|
|
13893
|
+
return null;
|
|
13894
|
+
}
|
|
13895
|
+
const Component = slots && Object.prototype.hasOwnProperty.call(slots, name) ? slots[name] : void 0;
|
|
13896
|
+
if (!Component) {
|
|
13897
|
+
issues.push(
|
|
13898
|
+
issue("JR010", `El slot \`${name}\` no est\xE1 registrado por el host.`, formatPath(path), {
|
|
13899
|
+
severity: "error",
|
|
13900
|
+
hint: "El host debe registrarlo en `slots` del renderizador."
|
|
13901
|
+
})
|
|
13902
|
+
);
|
|
13903
|
+
return null;
|
|
13904
|
+
}
|
|
13905
|
+
const props = {};
|
|
13906
|
+
for (const [key, raw] of Object.entries(node.props ?? {})) {
|
|
13907
|
+
if (key === "name") continue;
|
|
13908
|
+
props[key] = resolveValue ? resolveValue(raw, path) : raw;
|
|
13909
|
+
}
|
|
13910
|
+
return import_react55.default.createElement(Component, { key: node.id ?? path.join("-"), ...props });
|
|
13911
|
+
}
|
|
13912
|
+
function renderForm(node, options) {
|
|
13913
|
+
const { path, issues, resolveValue, resolveAction } = options;
|
|
13914
|
+
const { fields: declarados, issues: avisos } = readFormFields(node.props?.fields, [...path, "props", "fields"]);
|
|
13915
|
+
issues.push(...avisos);
|
|
13916
|
+
const campos = declarados.map((campo, index) => {
|
|
13917
|
+
const etiqueta = resolveValue ? resolveValue(campo.label, [...path, "props", "fields", index]) : campo.label;
|
|
13918
|
+
return {
|
|
13919
|
+
name: campo.name,
|
|
13920
|
+
kind: campo.kind,
|
|
13921
|
+
required: campo.required,
|
|
13922
|
+
minLength: campo.minLength,
|
|
13923
|
+
maxLength: campo.maxLength,
|
|
13924
|
+
label: textoDe(etiqueta) || campo.name
|
|
13925
|
+
};
|
|
13926
|
+
});
|
|
13927
|
+
const textoEnvio = node.props?.submitLabel;
|
|
13928
|
+
const submitLabel = textoDe(resolveValue ? resolveValue(textoEnvio, path) : textoEnvio) || void 0;
|
|
13929
|
+
const accion = resolveAction?.(node, "onSubmit", node.props?.onSubmit, path);
|
|
13930
|
+
if (node.props?.onSubmit !== void 0 && typeof accion !== "function") {
|
|
13931
|
+
issues.push(
|
|
13932
|
+
issue("JR040", `La acci\xF3n "${nombreDeAccion(node.props.onSubmit)}" no est\xE1 registrada por el host.`, formatPath(propPath(path, "onSubmit")), {
|
|
13933
|
+
severity: "warning",
|
|
13934
|
+
hint: "Reg\xEDstrala en `resolveAction` del host. Sin ella, enviar el formulario no hace nada."
|
|
13935
|
+
})
|
|
13936
|
+
);
|
|
13937
|
+
}
|
|
13938
|
+
const conEfectos = accion ? wrapAction(accion, node.props?.onSubmit, effectContext(options, path, node)) : void 0;
|
|
13939
|
+
return import_react55.default.createElement(FormNode, {
|
|
13940
|
+
key: node.id ?? path.join("-"),
|
|
13941
|
+
id: node.id,
|
|
13942
|
+
fields: campos,
|
|
13943
|
+
submitLabel,
|
|
13944
|
+
onSubmit: conEfectos ? (valores) => conEfectos(valores) : void 0
|
|
13945
|
+
});
|
|
13946
|
+
}
|
|
13947
|
+
function prepararColumnas(columnas, node, options, path) {
|
|
13948
|
+
if (!Array.isArray(columnas)) return columnas;
|
|
13949
|
+
return columnas.map((columna, indice) => {
|
|
13950
|
+
if (!columna || typeof columna !== "object") return columna;
|
|
13951
|
+
const declarada = columna;
|
|
13952
|
+
if (declarada.type !== "actions" || !Array.isArray(declarada.rowActions)) return columna;
|
|
13953
|
+
const colPath = [...path, "props", "columns", indice];
|
|
13954
|
+
const botones = declarada.rowActions.flatMap((raw, indiceAccion) => {
|
|
13955
|
+
const accion = raw;
|
|
13956
|
+
const rutaAccion = [...colPath, "rowActions", indiceAccion];
|
|
13957
|
+
if (!accion || typeof accion.action !== "string" || accion.action === "") {
|
|
13958
|
+
options.issues.push(issue("JR021", "Un bot\xF3n de fila no declara `action`.", formatPath(rutaAccion), { severity: "error" }));
|
|
13959
|
+
return [];
|
|
13960
|
+
}
|
|
13961
|
+
const faltan = faltanCapacidades(accion.requires, options.capabilities);
|
|
13962
|
+
if (faltan.length > 0) {
|
|
13963
|
+
options.issues.push(
|
|
13964
|
+
issue("JR061", `El bot\xF3n de fila "${accion.action}" exige ${faltan.join(", ")}, que no est\xE1 concedido.`, formatPath(rutaAccion), {
|
|
13965
|
+
severity: "warning",
|
|
13966
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador."
|
|
13967
|
+
})
|
|
13968
|
+
);
|
|
13969
|
+
return [];
|
|
13970
|
+
}
|
|
13971
|
+
const handler = options.resolveAction?.(node, `fila:${accion.action}`, accion, rutaAccion);
|
|
13972
|
+
if (typeof handler !== "function") {
|
|
13973
|
+
options.issues.push(
|
|
13974
|
+
issue("JR040", `La acci\xF3n de fila "${accion.action}" no est\xE1 registrada por el host.`, formatPath(rutaAccion), {
|
|
13975
|
+
severity: "warning",
|
|
13976
|
+
hint: "Reg\xEDstrala en `resolveAction` del host, o quita el bot\xF3n del esquema."
|
|
13977
|
+
})
|
|
13978
|
+
);
|
|
13979
|
+
return [];
|
|
13980
|
+
}
|
|
13981
|
+
const etiqueta = textoDe(options.resolveValue ? options.resolveValue(accion.label, rutaAccion) : accion.label);
|
|
13982
|
+
return [
|
|
13983
|
+
{
|
|
13984
|
+
clave: String(indiceAccion),
|
|
13985
|
+
etiqueta: etiqueta || accion.action,
|
|
13986
|
+
color: typeof accion.color === "string" ? accion.color : "secondary",
|
|
13987
|
+
variante: typeof accion.variant === "string" ? accion.variant : "outlined",
|
|
13988
|
+
ejecutar: wrapAction(handler, accion, effectContext(options, rutaAccion, node))
|
|
13989
|
+
}
|
|
13990
|
+
];
|
|
13991
|
+
});
|
|
13992
|
+
const copia = { ...declarada };
|
|
13993
|
+
delete copia.rowActions;
|
|
13994
|
+
const etiquetaColumna = textoDe(options.resolveValue ? options.resolveValue(copia.label, colPath) : copia.label);
|
|
13995
|
+
const Boton = ITButton;
|
|
13996
|
+
return {
|
|
13997
|
+
...copia,
|
|
13998
|
+
label: etiquetaColumna || String(copia.key ?? ""),
|
|
13999
|
+
actions: (fila) => import_react55.default.createElement(
|
|
14000
|
+
import_react55.default.Fragment,
|
|
14001
|
+
null,
|
|
14002
|
+
botones.map(
|
|
14003
|
+
(boton) => import_react55.default.createElement(Boton, {
|
|
14004
|
+
key: boton.clave,
|
|
14005
|
+
label: boton.etiqueta,
|
|
14006
|
+
size: "sm",
|
|
14007
|
+
variant: boton.variante,
|
|
14008
|
+
color: boton.color,
|
|
14009
|
+
onClick: () => boton.ejecutar(fila)
|
|
14010
|
+
})
|
|
14011
|
+
)
|
|
14012
|
+
)
|
|
14013
|
+
};
|
|
14014
|
+
});
|
|
14015
|
+
}
|
|
13343
14016
|
function renderNode(node, options) {
|
|
13344
14017
|
const { catalog, path, issues, renderChildren } = options;
|
|
13345
14018
|
if (!node || typeof node !== "object") {
|
|
@@ -13348,6 +14021,12 @@ function renderNode(node, options) {
|
|
|
13348
14021
|
if (isNodePending(node)) {
|
|
13349
14022
|
return options.pendingFallback ?? null;
|
|
13350
14023
|
}
|
|
14024
|
+
if (isSlotNode(node)) {
|
|
14025
|
+
return renderSlot(node, options);
|
|
14026
|
+
}
|
|
14027
|
+
if (isFormNode(node)) {
|
|
14028
|
+
return renderForm(node, options);
|
|
14029
|
+
}
|
|
13351
14030
|
const resolved = resolveNode(node, catalog, path);
|
|
13352
14031
|
issues.push(...resolved.issues);
|
|
13353
14032
|
if (!resolved.ok) {
|
|
@@ -13358,15 +14037,37 @@ function renderNode(node, options) {
|
|
|
13358
14037
|
for (const [name, value] of Object.entries(props)) {
|
|
13359
14038
|
finalProps[name] = options.resolveValue ? options.resolveValue(value, path) : value;
|
|
13360
14039
|
}
|
|
14040
|
+
if (node.type === "ITDataTable" && finalProps.columns !== void 0) {
|
|
14041
|
+
finalProps.columns = prepararColumnas(finalProps.columns, node, options, path);
|
|
14042
|
+
}
|
|
13361
14043
|
for (const [name, action] of Object.entries(actions)) {
|
|
14044
|
+
const faltan = faltanCapacidades(action?.requires, options.capabilities);
|
|
14045
|
+
if (faltan.length > 0) {
|
|
14046
|
+
issues.push(
|
|
14047
|
+
issue("JR061", `La acci\xF3n "${nombreDeAccion(action)}" exige ${faltan.join(", ")}, que no est\xE1 concedido.`, formatPath(propPath(path, name)), {
|
|
14048
|
+
severity: "warning",
|
|
14049
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador. Sin ella, la acci\xF3n no se ejecuta."
|
|
14050
|
+
})
|
|
14051
|
+
);
|
|
14052
|
+
continue;
|
|
14053
|
+
}
|
|
13362
14054
|
const handler = options.resolveAction?.(node, name, action, path);
|
|
13363
|
-
if (typeof handler === "function")
|
|
14055
|
+
if (typeof handler === "function") {
|
|
14056
|
+
finalProps[name] = wrapAction(handler, action, effectContext(options, path, node));
|
|
14057
|
+
} else {
|
|
14058
|
+
issues.push(
|
|
14059
|
+
issue("JR040", `La acci\xF3n "${nombreDeAccion(action)}" no est\xE1 registrada por el host.`, formatPath(propPath(path, name)), {
|
|
14060
|
+
severity: "warning",
|
|
14061
|
+
hint: "Reg\xEDstrala en `resolveAction` del host, o quita la prop del esquema."
|
|
14062
|
+
})
|
|
14063
|
+
);
|
|
14064
|
+
}
|
|
13364
14065
|
}
|
|
13365
14066
|
const content = renderChildren ? renderChildren(node, path) : null;
|
|
13366
14067
|
const rawText = entry.text && node.text !== void 0 ? node.text : void 0;
|
|
13367
14068
|
const text = rawText === void 0 ? void 0 : options.resolveValue ? options.resolveValue(rawText, path) : rawText;
|
|
13368
14069
|
const children = content ?? text;
|
|
13369
|
-
const element =
|
|
14070
|
+
const element = import_react55.default.createElement(
|
|
13370
14071
|
entry.component,
|
|
13371
14072
|
{ ...finalProps, key: node.id ?? path.join("-"), id: node.id },
|
|
13372
14073
|
children
|
|
@@ -13422,7 +14123,7 @@ function countPendingNodes(schema) {
|
|
|
13422
14123
|
}
|
|
13423
14124
|
|
|
13424
14125
|
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
13425
|
-
var
|
|
14126
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13426
14127
|
function renderTree(node, path, context, level) {
|
|
13427
14128
|
if (!node || typeof node !== "object") return null;
|
|
13428
14129
|
if (level > context.limits.maxDepth) return null;
|
|
@@ -13432,6 +14133,16 @@ function renderTree(node, path, context, level) {
|
|
|
13432
14133
|
issues.push(issue2);
|
|
13433
14134
|
context.onIssue?.(issue2);
|
|
13434
14135
|
};
|
|
14136
|
+
const faltan = faltanCapacidades(node.requires, context.capabilities);
|
|
14137
|
+
if (faltan.length > 0) {
|
|
14138
|
+
reportIssue(
|
|
14139
|
+
issue("JR060", `Falta la capacidad ${faltan.join(", ")} para pintar \`${node.type}\`.`, formatPath(path), {
|
|
14140
|
+
severity: "warning",
|
|
14141
|
+
hint: "El host debe conceder la capacidad con la prop `capabilities`, o el nodo debe declarar un `fallback`."
|
|
14142
|
+
})
|
|
14143
|
+
);
|
|
14144
|
+
return node.fallback ? renderTree(node.fallback, [...path, "fallback"], context, level + 1) : null;
|
|
14145
|
+
}
|
|
13435
14146
|
const issuesBefore = issues.length;
|
|
13436
14147
|
const element = renderNode(node, {
|
|
13437
14148
|
catalog: context.catalog,
|
|
@@ -13440,6 +14151,12 @@ function renderTree(node, path, context, level) {
|
|
|
13440
14151
|
resolveValue: context.resolveValue,
|
|
13441
14152
|
resolveAction: context.resolveAction,
|
|
13442
14153
|
pendingFallback: context.pendingFallback,
|
|
14154
|
+
slots: context.slots,
|
|
14155
|
+
effects: context.effects,
|
|
14156
|
+
actionTimeoutMs: context.limits.actionTimeoutMs,
|
|
14157
|
+
onIssue: context.onIssue,
|
|
14158
|
+
setState: context.setState,
|
|
14159
|
+
capabilities: context.capabilities,
|
|
13443
14160
|
renderChildren: (current, currentPath) => {
|
|
13444
14161
|
const children = childList(current);
|
|
13445
14162
|
if (children.length === 0) return void 0;
|
|
@@ -13452,7 +14169,7 @@ function renderTree(node, path, context, level) {
|
|
|
13452
14169
|
context.onIssue?.(issues[index]);
|
|
13453
14170
|
}
|
|
13454
14171
|
const fallback = node.fallback ? renderTree(node.fallback, [...path, "fallback"], context, level + 1) : context.pendingFallback ?? null;
|
|
13455
|
-
const wrapped = /* @__PURE__ */ (0,
|
|
14172
|
+
const wrapped = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13456
14173
|
NodeBoundary,
|
|
13457
14174
|
{
|
|
13458
14175
|
path: path.join("."),
|
|
@@ -13474,43 +14191,84 @@ function ITSchemaRenderer({
|
|
|
13474
14191
|
schema,
|
|
13475
14192
|
catalog = axzyCatalog,
|
|
13476
14193
|
limits,
|
|
14194
|
+
params,
|
|
14195
|
+
dataHandlers,
|
|
14196
|
+
slots,
|
|
14197
|
+
effects,
|
|
14198
|
+
capabilities,
|
|
13477
14199
|
resolveValue,
|
|
13478
14200
|
resolveAction,
|
|
13479
14201
|
pendingFallback,
|
|
13480
14202
|
onIssue,
|
|
13481
14203
|
className
|
|
13482
14204
|
}) {
|
|
13483
|
-
const resolvedLimits = (0,
|
|
14205
|
+
const resolvedLimits = (0, import_react56.useMemo)(() => resolveLimits(limits), [limits]);
|
|
14206
|
+
const [escrito, setEscrito] = (0, import_react56.useState)({
|
|
14207
|
+
origen: schema,
|
|
14208
|
+
valores: {}
|
|
14209
|
+
});
|
|
14210
|
+
const valoresPantalla = (0, import_react56.useMemo)(
|
|
14211
|
+
() => ({ ...schema?.state ?? {}, ...escrito.origen === schema ? escrito.valores : {} }),
|
|
14212
|
+
[schema, escrito]
|
|
14213
|
+
);
|
|
14214
|
+
const escribirEstado = (0, import_react56.useCallback)(
|
|
14215
|
+
(cambios) => setEscrito((previo) => ({
|
|
14216
|
+
origen: schema,
|
|
14217
|
+
valores: { ...previo.origen === schema ? previo.valores : {}, ...cambios }
|
|
14218
|
+
})),
|
|
14219
|
+
[schema]
|
|
14220
|
+
);
|
|
13484
14221
|
const issues = [];
|
|
13485
14222
|
const nodeIds = /* @__PURE__ */ new Set();
|
|
13486
|
-
const audit = (0,
|
|
14223
|
+
const audit = (0, import_react56.useMemo)(
|
|
13487
14224
|
() => schema ? auditTree(schema, resolvedLimits) : null,
|
|
13488
14225
|
[schema, resolvedLimits]
|
|
13489
14226
|
);
|
|
13490
|
-
const context = (0,
|
|
14227
|
+
const context = (0, import_react56.useMemo)(
|
|
13491
14228
|
() => ({
|
|
13492
14229
|
catalog,
|
|
13493
14230
|
nodeIds,
|
|
13494
14231
|
limits: resolvedLimits,
|
|
13495
14232
|
issues,
|
|
13496
14233
|
onIssue,
|
|
13497
|
-
|
|
14234
|
+
// El binding escribe sus avisos (JR030, JR032) en el mismo array que el resto del render.
|
|
14235
|
+
resolveValue: createBindingResolver({
|
|
14236
|
+
data: schema?.data,
|
|
14237
|
+
state: valoresPantalla,
|
|
14238
|
+
params,
|
|
14239
|
+
handlers: dataHandlers,
|
|
14240
|
+
report: (aviso) => issues.push(aviso),
|
|
14241
|
+
host: resolveValue
|
|
14242
|
+
}),
|
|
13498
14243
|
resolveAction,
|
|
13499
|
-
pendingFallback
|
|
14244
|
+
pendingFallback,
|
|
14245
|
+
slots,
|
|
14246
|
+
effects,
|
|
14247
|
+
capabilities,
|
|
14248
|
+
setState: escribirEstado
|
|
13500
14249
|
}),
|
|
13501
14250
|
// `issues` es un array nuevo en cada render a propósito: acumular avisos
|
|
13502
14251
|
// entre renders duplicaría los avisos de esquemas que no han cambiado.
|
|
13503
14252
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13504
|
-
[catalog, resolvedLimits, onIssue, resolveValue, resolveAction, pendingFallback]
|
|
14253
|
+
[schema, params, valoresPantalla, escribirEstado, dataHandlers, slots, effects, capabilities, catalog, resolvedLimits, onIssue, resolveValue, resolveAction, pendingFallback]
|
|
13505
14254
|
);
|
|
13506
|
-
const
|
|
14255
|
+
const faltanRaiz = schema ? faltanCapacidades(schema.requires, capabilities) : [];
|
|
14256
|
+
if (faltanRaiz.length > 0) {
|
|
14257
|
+
issues.push(
|
|
14258
|
+
issue("JR060", `Falta la capacidad ${faltanRaiz.join(", ")} para esta pantalla.`, "requires", {
|
|
14259
|
+
severity: "error",
|
|
14260
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador."
|
|
14261
|
+
})
|
|
14262
|
+
);
|
|
14263
|
+
}
|
|
14264
|
+
const content = schema && faltanRaiz.length === 0 ? (Array.isArray(schema.content) ? schema.content : [schema.content]).filter(
|
|
13507
14265
|
(node) => Boolean(node) && typeof node === "object"
|
|
13508
14266
|
) : [];
|
|
13509
14267
|
const children = content.slice(0, resolvedLimits.maxNodes).map((node, index) => renderTree(node, ["content", index], context, 0)).filter(Boolean);
|
|
13510
14268
|
const collected = [...audit?.issues ?? [], ...issues];
|
|
13511
14269
|
const signature = collected.map((issue2) => `${issue2.code}:${issue2.path}`).join("|");
|
|
13512
|
-
const reported = (0,
|
|
13513
|
-
(0,
|
|
14270
|
+
const reported = (0, import_react56.useRef)("");
|
|
14271
|
+
(0, import_react56.useEffect)(() => {
|
|
13514
14272
|
const all = [...collected];
|
|
13515
14273
|
for (const id of nodeIds) {
|
|
13516
14274
|
if (!document.getElementById(id)) {
|
|
@@ -13529,7 +14287,159 @@ function ITSchemaRenderer({
|
|
|
13529
14287
|
for (const issue2 of all) onIssue(issue2);
|
|
13530
14288
|
}, [signature, onIssue]);
|
|
13531
14289
|
if (!schema || children.length === 0) return null;
|
|
13532
|
-
return className ? /* @__PURE__ */ (0,
|
|
14290
|
+
return className ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className, children }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children });
|
|
14291
|
+
}
|
|
14292
|
+
|
|
14293
|
+
// src/json-renderer/routing/routes.ts
|
|
14294
|
+
function joinRoutePath(parent, own2) {
|
|
14295
|
+
return [parent, typeof own2 === "string" ? own2 : ""].flatMap((part) => part.split("/")).filter((segment) => segment !== "").join("/");
|
|
14296
|
+
}
|
|
14297
|
+
var SEGMENT = /^(:[A-Za-z][A-Za-z0-9_]*|[A-Za-z0-9_.-]+)$/;
|
|
14298
|
+
function validateRoutes(input) {
|
|
14299
|
+
const errors = [];
|
|
14300
|
+
const document2 = input;
|
|
14301
|
+
if (!document2 || typeof document2 !== "object" || Array.isArray(document2)) {
|
|
14302
|
+
return [issue("JR020", "El documento de rutas debe ser un objeto.", "", { severity: "error" })];
|
|
14303
|
+
}
|
|
14304
|
+
if (typeof document2.version !== "number") {
|
|
14305
|
+
errors.push(issue("JR020", "El documento de rutas no declara `version`.", "version", { severity: "error" }));
|
|
14306
|
+
}
|
|
14307
|
+
if (!Array.isArray(document2.routes)) {
|
|
14308
|
+
errors.push(issue("JR020", "`routes` debe ser una lista.", "routes", { severity: "error" }));
|
|
14309
|
+
return errors;
|
|
14310
|
+
}
|
|
14311
|
+
const seen = /* @__PURE__ */ new Map();
|
|
14312
|
+
const visit = (route, path, parentPath, isRoot) => {
|
|
14313
|
+
if (!route || typeof route !== "object") {
|
|
14314
|
+
errors.push(issue("JR021", "La ruta no es un objeto.", path, { severity: "error" }));
|
|
14315
|
+
return;
|
|
14316
|
+
}
|
|
14317
|
+
if (typeof route.id !== "string" || route.id === "") {
|
|
14318
|
+
errors.push(issue("JR021", "La ruta no declara `id`.", path, { severity: "error" }));
|
|
14319
|
+
}
|
|
14320
|
+
if (route.path !== void 0 && route.path !== "") {
|
|
14321
|
+
const parts = typeof route.path === "string" ? route.path.split("/").filter(Boolean) : [];
|
|
14322
|
+
if (typeof route.path !== "string" || parts.some((segment) => !SEGMENT.test(segment))) {
|
|
14323
|
+
errors.push(issue("JR021", `El path "${String(route.path)}" no es v\xE1lido.`, `${path}.path`, { severity: "error", hint: "Usa segmentos con letras, d\xEDgitos, guiones o `:param`." }));
|
|
14324
|
+
}
|
|
14325
|
+
}
|
|
14326
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14327
|
+
if (isRoot && full === "") {
|
|
14328
|
+
errors.push(issue("JR021", "Una ruta ra\xEDz necesita `path`.", `${path}.path`, { severity: "error" }));
|
|
14329
|
+
}
|
|
14330
|
+
if (route.children !== void 0) {
|
|
14331
|
+
if (route.page !== void 0) {
|
|
14332
|
+
errors.push(issue("JR020", "Un grupo no lleva `page`: la pantalla va en sus hijos.", path, { severity: "error" }));
|
|
14333
|
+
}
|
|
14334
|
+
if (!Array.isArray(route.children)) {
|
|
14335
|
+
errors.push(issue("JR020", "`children` debe ser una lista.", `${path}.children`, { severity: "error" }));
|
|
14336
|
+
} else {
|
|
14337
|
+
route.children.forEach((child, index) => visit(child, `${path}.children[${index}]`, full, false));
|
|
14338
|
+
}
|
|
14339
|
+
} else {
|
|
14340
|
+
if (typeof route.page !== "string" || route.page === "") {
|
|
14341
|
+
errors.push(issue("JR020", "La ruta no declara `page`.", path, { severity: "error" }));
|
|
14342
|
+
}
|
|
14343
|
+
const key = `${full}?${JSON.stringify(Object.entries(route.query ?? {}).sort())}`;
|
|
14344
|
+
if (seen.has(key)) {
|
|
14345
|
+
errors.push(issue("JR020", `La ruta "${full || "/"}" se repite con la misma query (ya est\xE1 en ${seen.get(key)}).`, path, { severity: "error" }));
|
|
14346
|
+
} else {
|
|
14347
|
+
seen.set(key, path);
|
|
14348
|
+
}
|
|
14349
|
+
}
|
|
14350
|
+
const nav = route.nav;
|
|
14351
|
+
if (nav !== void 0 && (typeof nav !== "object" || nav === null || nav.label === void 0 || nav.label === null)) {
|
|
14352
|
+
errors.push(issue("JR021", "La entrada de men\xFA no declara `label`.", `${path}.nav`, { severity: "error" }));
|
|
14353
|
+
}
|
|
14354
|
+
};
|
|
14355
|
+
document2.routes.forEach((route, index) => visit(route, `routes[${index}]`, "", true));
|
|
14356
|
+
return errors;
|
|
14357
|
+
}
|
|
14358
|
+
function flattenRoutes(routes) {
|
|
14359
|
+
const flat = [];
|
|
14360
|
+
const visit = (route, parentPath, groups) => {
|
|
14361
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14362
|
+
if (route.children) {
|
|
14363
|
+
route.children.forEach((child) => visit(child, full, [...groups, route.id]));
|
|
14364
|
+
return;
|
|
14365
|
+
}
|
|
14366
|
+
if (typeof route.page !== "string") return;
|
|
14367
|
+
flat.push({
|
|
14368
|
+
id: route.id,
|
|
14369
|
+
segments: full === "" ? [] : full.split("/"),
|
|
14370
|
+
page: route.page,
|
|
14371
|
+
query: route.query ?? {},
|
|
14372
|
+
nav: route.nav,
|
|
14373
|
+
groups
|
|
14374
|
+
});
|
|
14375
|
+
};
|
|
14376
|
+
routes.forEach((route) => visit(route, "", []));
|
|
14377
|
+
return flat;
|
|
14378
|
+
}
|
|
14379
|
+
|
|
14380
|
+
// src/json-renderer/routing/match.ts
|
|
14381
|
+
function matchRoute(routes, segments, query = {}) {
|
|
14382
|
+
let best = null;
|
|
14383
|
+
let bestStatics = -1;
|
|
14384
|
+
let bestConstraints = -1;
|
|
14385
|
+
for (const route of routes) {
|
|
14386
|
+
if (route.segments.length !== segments.length) continue;
|
|
14387
|
+
const params = {};
|
|
14388
|
+
let statics = 0;
|
|
14389
|
+
let samePath = true;
|
|
14390
|
+
route.segments.forEach((expected, index) => {
|
|
14391
|
+
if (!samePath) return;
|
|
14392
|
+
if (expected.startsWith(":")) {
|
|
14393
|
+
params[expected.slice(1)] = segments[index];
|
|
14394
|
+
return;
|
|
14395
|
+
}
|
|
14396
|
+
statics += 1;
|
|
14397
|
+
samePath = expected === segments[index];
|
|
14398
|
+
});
|
|
14399
|
+
if (!samePath) continue;
|
|
14400
|
+
const constraints = Object.entries(route.query);
|
|
14401
|
+
if (!constraints.every(([key, value]) => query[key] === value)) continue;
|
|
14402
|
+
if (statics > bestStatics || statics === bestStatics && constraints.length > bestConstraints) {
|
|
14403
|
+
best = { route, params };
|
|
14404
|
+
bestStatics = statics;
|
|
14405
|
+
bestConstraints = constraints.length;
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
return best;
|
|
14409
|
+
}
|
|
14410
|
+
function routeHref(route, params = {}) {
|
|
14411
|
+
const path = route.segments.map((segment) => segment.startsWith(":") ? params[segment.slice(1)] ?? segment : segment).join("/");
|
|
14412
|
+
const queryString = Object.entries(route.query).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
|
|
14413
|
+
return `/${path}${queryString ? `?${queryString}` : ""}`;
|
|
14414
|
+
}
|
|
14415
|
+
|
|
14416
|
+
// src/json-renderer/routing/navigation.ts
|
|
14417
|
+
function buildNavigationTree(routes) {
|
|
14418
|
+
const hrefs = new Map(flattenRoutes(routes).map((route) => [route.id, routeHref(route)]));
|
|
14419
|
+
const visit = (route, parentPath) => {
|
|
14420
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14421
|
+
if (route.children) {
|
|
14422
|
+
const children = route.children.flatMap((child) => visit(child, full));
|
|
14423
|
+
if (!route.nav) return children;
|
|
14424
|
+
return [toNode(route.id, route.nav, children, children.find((child) => child.href)?.href)];
|
|
14425
|
+
}
|
|
14426
|
+
if (!route.nav) return [];
|
|
14427
|
+
return [toNode(route.id, route.nav, void 0, hrefs.get(route.id))];
|
|
14428
|
+
};
|
|
14429
|
+
return routes.flatMap((route) => visit(route, ""));
|
|
14430
|
+
}
|
|
14431
|
+
function toNode(id, nav, children, href) {
|
|
14432
|
+
return {
|
|
14433
|
+
id,
|
|
14434
|
+
label: nav.label,
|
|
14435
|
+
icon: nav.icon,
|
|
14436
|
+
badge: nav.badge,
|
|
14437
|
+
href,
|
|
14438
|
+
...children ? { children } : {}
|
|
14439
|
+
};
|
|
14440
|
+
}
|
|
14441
|
+
function navContainsRoute(entry, routeId) {
|
|
14442
|
+
return entry.id === routeId || (entry.children?.some((child) => navContainsRoute(child, routeId)) ?? false);
|
|
13533
14443
|
}
|
|
13534
14444
|
|
|
13535
14445
|
// src/json-renderer/validation/validate.ts
|
|
@@ -13540,6 +14450,17 @@ function validateNodes(node, path, catalog, errors, warnings) {
|
|
|
13540
14450
|
return 0;
|
|
13541
14451
|
}
|
|
13542
14452
|
if (isNodePending(node)) return 1;
|
|
14453
|
+
if (node.type === "form") {
|
|
14454
|
+
const { issues: avisos } = readFormFields(node.props?.fields, [...path, "props", "fields"]);
|
|
14455
|
+
for (const item of avisos) (item.severity === "error" ? errors : warnings).push(item);
|
|
14456
|
+
return 0;
|
|
14457
|
+
}
|
|
14458
|
+
if (isSlotNode(node)) {
|
|
14459
|
+
if (!slotName(node)) {
|
|
14460
|
+
errors.push(issue("JR011", "El slot no declara `props.name`.", formatPath([...path, "props", "name"]), { severity: "error" }));
|
|
14461
|
+
}
|
|
14462
|
+
return 0;
|
|
14463
|
+
}
|
|
13543
14464
|
const resolved = resolveNode(node, catalog, path);
|
|
13544
14465
|
for (const item of resolved.issues) {
|
|
13545
14466
|
(item.severity === "error" ? errors : warnings).push(item);
|
|
@@ -13722,8 +14643,143 @@ function formatVocabularyForPrompt(contract) {
|
|
|
13722
14643
|
return lines.join("\n");
|
|
13723
14644
|
}
|
|
13724
14645
|
|
|
14646
|
+
// src/json-renderer/stream/useSchemaStream.ts
|
|
14647
|
+
var import_react57 = require("react");
|
|
14648
|
+
var VACIO = {
|
|
14649
|
+
tree: null,
|
|
14650
|
+
status: "complete",
|
|
14651
|
+
broken: false,
|
|
14652
|
+
pendingNodes: 0,
|
|
14653
|
+
streaming: false,
|
|
14654
|
+
text: "",
|
|
14655
|
+
issues: []
|
|
14656
|
+
};
|
|
14657
|
+
var grabaciones = /* @__PURE__ */ new WeakMap();
|
|
14658
|
+
function esAsyncIterable(value) {
|
|
14659
|
+
return value !== null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
14660
|
+
}
|
|
14661
|
+
async function* desdeReadable(readable) {
|
|
14662
|
+
const reader = readable.getReader();
|
|
14663
|
+
try {
|
|
14664
|
+
for (; ; ) {
|
|
14665
|
+
const { done, value } = await reader.read();
|
|
14666
|
+
if (done) return;
|
|
14667
|
+
yield value;
|
|
14668
|
+
}
|
|
14669
|
+
} finally {
|
|
14670
|
+
await reader.cancel().catch(() => void 0);
|
|
14671
|
+
}
|
|
14672
|
+
}
|
|
14673
|
+
function mensajeDe(error) {
|
|
14674
|
+
return error instanceof Error ? error.message : String(error);
|
|
14675
|
+
}
|
|
14676
|
+
function crearGrabacion(source) {
|
|
14677
|
+
const iterador = typeof source === "string" ? null : esAsyncIterable(source) ? source[Symbol.asyncIterator]() : desdeReadable(source)[Symbol.asyncIterator]();
|
|
14678
|
+
return {
|
|
14679
|
+
texto: typeof source === "string" ? source : "",
|
|
14680
|
+
iterador,
|
|
14681
|
+
terminado: typeof source === "string",
|
|
14682
|
+
error: null,
|
|
14683
|
+
avisos: [],
|
|
14684
|
+
activos: 0,
|
|
14685
|
+
ultimoValido: null,
|
|
14686
|
+
cerrada: false,
|
|
14687
|
+
cancelada: false
|
|
14688
|
+
};
|
|
14689
|
+
}
|
|
14690
|
+
function estadoDe(grab, streaming) {
|
|
14691
|
+
const parcial = parsePartialSchema(grab.texto);
|
|
14692
|
+
if (!parcial.broken && parcial.tree) grab.ultimoValido = parcial.tree;
|
|
14693
|
+
return {
|
|
14694
|
+
tree: parcial.broken ? grab.ultimoValido : parcial.tree,
|
|
14695
|
+
status: parcial.status,
|
|
14696
|
+
broken: parcial.broken,
|
|
14697
|
+
pendingNodes: parcial.pendingNodes,
|
|
14698
|
+
streaming,
|
|
14699
|
+
text: grab.texto,
|
|
14700
|
+
issues: [...grab.avisos]
|
|
14701
|
+
};
|
|
14702
|
+
}
|
|
14703
|
+
function cerrarGrabacion(grab) {
|
|
14704
|
+
if (grab.cerrada || grab.cancelada) return;
|
|
14705
|
+
grab.cerrada = true;
|
|
14706
|
+
if (grab.error !== null) {
|
|
14707
|
+
grab.avisos.push(issue("JR080", `El stream fall\xF3: ${grab.error}. Se conserva el \xFAltimo \xE1rbol v\xE1lido.`, "", { severity: "error" }));
|
|
14708
|
+
return;
|
|
14709
|
+
}
|
|
14710
|
+
const parcial = parsePartialSchema(grab.texto);
|
|
14711
|
+
if (parcial.broken || parcial.status !== "complete") {
|
|
14712
|
+
grab.avisos.push(
|
|
14713
|
+
issue("JR080", "El stream termin\xF3 con el JSON sin cerrar. Se conserva el \xFAltimo \xE1rbol v\xE1lido.", "", {
|
|
14714
|
+
severity: "warning",
|
|
14715
|
+
hint: "Revisa que el emisor cierre todas las llaves y corchetes."
|
|
14716
|
+
})
|
|
14717
|
+
);
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
async function consumir(grab, cancelado, onTrozo) {
|
|
14721
|
+
while (!grab.terminado && grab.iterador) {
|
|
14722
|
+
let paso;
|
|
14723
|
+
try {
|
|
14724
|
+
paso = await grab.iterador.next();
|
|
14725
|
+
} catch (error) {
|
|
14726
|
+
grab.error = mensajeDe(error);
|
|
14727
|
+
grab.terminado = true;
|
|
14728
|
+
break;
|
|
14729
|
+
}
|
|
14730
|
+
if (paso.done) {
|
|
14731
|
+
grab.terminado = true;
|
|
14732
|
+
break;
|
|
14733
|
+
}
|
|
14734
|
+
grab.texto += String(paso.value);
|
|
14735
|
+
if (!cancelado()) onTrozo();
|
|
14736
|
+
if (cancelado()) return;
|
|
14737
|
+
}
|
|
14738
|
+
if (grab.terminado) cerrarGrabacion(grab);
|
|
14739
|
+
}
|
|
14740
|
+
function useSchemaStream(source) {
|
|
14741
|
+
const [estado, setEstado] = (0, import_react57.useState)(VACIO);
|
|
14742
|
+
(0, import_react57.useEffect)(() => {
|
|
14743
|
+
if (source === null || source === void 0) {
|
|
14744
|
+
setEstado(VACIO);
|
|
14745
|
+
return;
|
|
14746
|
+
}
|
|
14747
|
+
let registro;
|
|
14748
|
+
if (typeof source === "string") {
|
|
14749
|
+
registro = crearGrabacion(source);
|
|
14750
|
+
} else {
|
|
14751
|
+
const existente = grabaciones.get(source);
|
|
14752
|
+
registro = existente ?? crearGrabacion(source);
|
|
14753
|
+
if (!existente) grabaciones.set(source, registro);
|
|
14754
|
+
}
|
|
14755
|
+
registro.activos += 1;
|
|
14756
|
+
let cancelado = false;
|
|
14757
|
+
const proceso = consumir(
|
|
14758
|
+
registro,
|
|
14759
|
+
() => cancelado,
|
|
14760
|
+
() => setEstado(estadoDe(registro, true))
|
|
14761
|
+
);
|
|
14762
|
+
setEstado(estadoDe(registro, !registro.terminado));
|
|
14763
|
+
void proceso.then(() => {
|
|
14764
|
+
if (!cancelado) setEstado(estadoDe(registro, false));
|
|
14765
|
+
});
|
|
14766
|
+
return () => {
|
|
14767
|
+
cancelado = true;
|
|
14768
|
+
registro.activos -= 1;
|
|
14769
|
+
setTimeout(() => {
|
|
14770
|
+
if (registro.activos === 0 && !registro.terminado && registro.iterador) {
|
|
14771
|
+
registro.terminado = true;
|
|
14772
|
+
registro.cancelada = true;
|
|
14773
|
+
void registro.iterador.return?.(void 0);
|
|
14774
|
+
}
|
|
14775
|
+
}, 0);
|
|
14776
|
+
};
|
|
14777
|
+
}, [source]);
|
|
14778
|
+
return estado;
|
|
14779
|
+
}
|
|
14780
|
+
|
|
13725
14781
|
// src/components/organisms/dropfile/dropfile.tsx
|
|
13726
|
-
var
|
|
14782
|
+
var import_react58 = require("react");
|
|
13727
14783
|
var import_react_dropzone = require("react-dropzone");
|
|
13728
14784
|
var import_clsx54 = __toESM(require("clsx"), 1);
|
|
13729
14785
|
|
|
@@ -13753,11 +14809,12 @@ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
|
13753
14809
|
})(UploadStatus || {});
|
|
13754
14810
|
|
|
13755
14811
|
// src/components/organisms/dropfile/dropfile.tsx
|
|
13756
|
-
var
|
|
14812
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
13757
14813
|
var ITDropfile = ({
|
|
13758
14814
|
onFileSelect,
|
|
13759
14815
|
onCancel,
|
|
13760
14816
|
onSubmit,
|
|
14817
|
+
autoUpload = false,
|
|
13761
14818
|
contentClassName,
|
|
13762
14819
|
containerClassName,
|
|
13763
14820
|
acceptedFileTypes = ["application/pdf" /* PDF */, "application/vnd.ms-excel" /* XLS */, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */, "image/jpg" /* JPG */, "image/png" /* PNG */, "image/jpeg" /* JPEG */],
|
|
@@ -13770,15 +14827,15 @@ var ITDropfile = ({
|
|
|
13770
14827
|
modalTitle
|
|
13771
14828
|
}) => {
|
|
13772
14829
|
const { t } = useITTranslation();
|
|
13773
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
13774
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
13775
|
-
const [fileType, setFileType] = (0,
|
|
13776
|
-
const [imagePreview, setImagePreview] = (0,
|
|
13777
|
-
const [isConfirmed, setIsConfirmed] = (0,
|
|
13778
|
-
const [internalUploadStatus, setInternalUploadStatus] = (0,
|
|
14830
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react58.useState)(false);
|
|
14831
|
+
const [selectedFile, setSelectedFile] = (0, import_react58.useState)(null);
|
|
14832
|
+
const [fileType, setFileType] = (0, import_react58.useState)(null);
|
|
14833
|
+
const [imagePreview, setImagePreview] = (0, import_react58.useState)(initialPreviewUrl || null);
|
|
14834
|
+
const [isConfirmed, setIsConfirmed] = (0, import_react58.useState)(false);
|
|
14835
|
+
const [internalUploadStatus, setInternalUploadStatus] = (0, import_react58.useState)(
|
|
13779
14836
|
initialPreviewUrl ? "subido" /* UPLOADED */ : "pendiente" /* PENDING */
|
|
13780
14837
|
);
|
|
13781
|
-
(0,
|
|
14838
|
+
(0, import_react58.useEffect)(() => {
|
|
13782
14839
|
if (initialPreviewUrl && !selectedFile) {
|
|
13783
14840
|
setImagePreview(initialPreviewUrl);
|
|
13784
14841
|
if (externalStatus === void 0) setInternalUploadStatus("subido" /* UPLOADED */);
|
|
@@ -13893,11 +14950,23 @@ var ITDropfile = ({
|
|
|
13893
14950
|
}
|
|
13894
14951
|
};
|
|
13895
14952
|
const { label, color, dotColor } = config2[status];
|
|
13896
|
-
return /* @__PURE__ */ (0,
|
|
13897
|
-
/* @__PURE__ */ (0,
|
|
13898
|
-
/* @__PURE__ */ (0,
|
|
14953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: `inline-flex items-center gap-2 px-2.5 py-1 rounded-full border ${color}`, children: [
|
|
14954
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `w-2 h-2 rounded-full ${dotColor}` }),
|
|
14955
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "text-xs font-medium flex items-center gap-1.5", children: label })
|
|
13899
14956
|
] });
|
|
13900
14957
|
};
|
|
14958
|
+
const runAutoUpload = async (file) => {
|
|
14959
|
+
setIsConfirmed(true);
|
|
14960
|
+
setUploadStatus("subiendo" /* UPLOADING */);
|
|
14961
|
+
try {
|
|
14962
|
+
onFileSelect(file);
|
|
14963
|
+
await onSubmit?.(file);
|
|
14964
|
+
setUploadStatus("subido" /* UPLOADED */);
|
|
14965
|
+
} catch (error) {
|
|
14966
|
+
setUploadStatus("error" /* ERROR */);
|
|
14967
|
+
console.error("Error al subir archivo:", error);
|
|
14968
|
+
}
|
|
14969
|
+
};
|
|
13901
14970
|
const onDrop = (acceptedFiles) => {
|
|
13902
14971
|
const file = acceptedFiles[0];
|
|
13903
14972
|
if (file) {
|
|
@@ -13913,6 +14982,7 @@ var ITDropfile = ({
|
|
|
13913
14982
|
const previewUrl = URL.createObjectURL(file);
|
|
13914
14983
|
setImagePreview(previewUrl);
|
|
13915
14984
|
}
|
|
14985
|
+
if (autoUpload) void runAutoUpload(file);
|
|
13916
14986
|
} else {
|
|
13917
14987
|
alert(t("dropfile.fileTypeNotAllowed"));
|
|
13918
14988
|
setSelectedFile(null);
|
|
@@ -13927,12 +14997,12 @@ var ITDropfile = ({
|
|
|
13927
14997
|
accept: getAcceptedFileTypes(),
|
|
13928
14998
|
maxFiles: 1
|
|
13929
14999
|
});
|
|
13930
|
-
(0,
|
|
15000
|
+
(0, import_react58.useEffect)(() => {
|
|
13931
15001
|
const renderPDF = async () => {
|
|
13932
15002
|
};
|
|
13933
15003
|
renderPDF();
|
|
13934
15004
|
}, [selectedFile, fileType]);
|
|
13935
|
-
(0,
|
|
15005
|
+
(0, import_react58.useEffect)(() => {
|
|
13936
15006
|
return () => {
|
|
13937
15007
|
if (imagePreview) {
|
|
13938
15008
|
URL.revokeObjectURL(imagePreview);
|
|
@@ -13969,7 +15039,7 @@ var ITDropfile = ({
|
|
|
13969
15039
|
const handleDelete = () => {
|
|
13970
15040
|
handleCancel();
|
|
13971
15041
|
};
|
|
13972
|
-
(0,
|
|
15042
|
+
(0, import_react58.useEffect)(() => {
|
|
13973
15043
|
if (view === "button" && isConfirmed && uploadStatus === "subido" /* UPLOADED */) {
|
|
13974
15044
|
const timeout = setTimeout(() => {
|
|
13975
15045
|
setIsModalOpen(false);
|
|
@@ -13986,21 +15056,21 @@ var ITDropfile = ({
|
|
|
13986
15056
|
return () => clearTimeout(timeout);
|
|
13987
15057
|
}
|
|
13988
15058
|
}, [view, isConfirmed, uploadStatus, externalStatus, onStatusChange]);
|
|
13989
|
-
const headerRow = /* @__PURE__ */ (0,
|
|
13990
|
-
/* @__PURE__ */ (0,
|
|
13991
|
-
/* @__PURE__ */ (0,
|
|
15059
|
+
const headerRow = /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
|
|
15060
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("label", { className: "block text-sm font-semibold text-secondary-700", children: [
|
|
15061
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ITText, { as: "span", children: [
|
|
13992
15062
|
t("dropfile.upload"),
|
|
13993
15063
|
" "
|
|
13994
15064
|
] }),
|
|
13995
|
-
/* @__PURE__ */ (0,
|
|
15065
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ITText, { as: "span", className: "text-secondary-400 font-normal text-xs", children: [
|
|
13996
15066
|
"(",
|
|
13997
15067
|
getFileExtensions(),
|
|
13998
15068
|
")"
|
|
13999
15069
|
] })
|
|
14000
15070
|
] }),
|
|
14001
|
-
showStatusBadge && selectedFile && /* @__PURE__ */ (0,
|
|
15071
|
+
showStatusBadge && selectedFile && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(StatusBadge, { status: uploadStatus })
|
|
14002
15072
|
] });
|
|
14003
|
-
const dropZoneOrPreview = /* @__PURE__ */ (0,
|
|
15073
|
+
const dropZoneOrPreview = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: !selectedFile && !imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14004
15074
|
"div",
|
|
14005
15075
|
{
|
|
14006
15076
|
...getRootProps(),
|
|
@@ -14010,41 +15080,41 @@ var ITDropfile = ({
|
|
|
14010
15080
|
${isDragActive ? "border-primary-500 bg-primary-50 scale-[1.01]" : "border-secondary-300 bg-white hover:border-primary-400 hover:bg-secondary-50"}
|
|
14011
15081
|
`,
|
|
14012
15082
|
children: [
|
|
14013
|
-
/* @__PURE__ */ (0,
|
|
14014
|
-
/* @__PURE__ */ (0,
|
|
15083
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("input", { ...getInputProps() }),
|
|
15084
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `mb-3 p-3 rounded-full transition-colors duration-300 ${isDragActive ? "bg-primary-100" : "bg-secondary-100 group-hover:bg-primary-50"}`, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14015
15085
|
"svg",
|
|
14016
15086
|
{
|
|
14017
15087
|
className: `w-6 h-6 transition-colors duration-300 ${isDragActive ? "text-primary-600" : "text-secondary-400 group-hover:text-primary-500"}`,
|
|
14018
15088
|
fill: "none",
|
|
14019
15089
|
viewBox: "0 0 24 24",
|
|
14020
15090
|
stroke: "currentColor",
|
|
14021
|
-
children: /* @__PURE__ */ (0,
|
|
15091
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" })
|
|
14022
15092
|
}
|
|
14023
15093
|
) }),
|
|
14024
|
-
/* @__PURE__ */ (0,
|
|
15094
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-center space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "p", className: `text-sm font-medium transition-colors duration-300 ${isDragActive ? "text-primary-700" : "text-secondary-700"}`, children: isDragActive ? t("dropfile.dropHere") : t("dropfile.clickOrDrag") }) })
|
|
14025
15095
|
]
|
|
14026
15096
|
}
|
|
14027
|
-
) : /* @__PURE__ */ (0,
|
|
14028
|
-
/* @__PURE__ */ (0,
|
|
14029
|
-
/* @__PURE__ */ (0,
|
|
14030
|
-
/* @__PURE__ */ (0,
|
|
14031
|
-
/* @__PURE__ */ (0,
|
|
14032
|
-
/* @__PURE__ */ (0,
|
|
15097
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "w-full bg-white border border-secondary-200 rounded-xl shadow-sm overflow-hidden animate-fade-in", children: [
|
|
15098
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex items-center justify-between p-3 bg-secondary-50 border-b border-secondary-100", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
15099
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-primary-100 flex items-center justify-center text-primary-600", children: selectedFile && fileType?.startsWith("image/") || !selectedFile && imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }),
|
|
15100
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "min-w-0", children: [
|
|
15101
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "p", className: "text-xs font-medium text-secondary-900 truncate", title: selectedFile?.name || t("dropfile.imageLoaded"), children: selectedFile?.name || t("dropfile.imageLoaded") }),
|
|
15102
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "p", className: "text-[10px] text-secondary-500", children: selectedFile ? (selectedFile.size / 1024 / 1024).toFixed(2) + " MB" : "" })
|
|
14033
15103
|
] })
|
|
14034
15104
|
] }) }),
|
|
14035
|
-
/* @__PURE__ */ (0,
|
|
15105
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: (0, import_clsx54.default)("relative bg-secondary-100 flex items-center justify-center", !contentClassName ? "max-h-[200px] min-h-[100px] overflow-auto" : contentClassName), children: selectedFile && fileType?.startsWith("image/") || !selectedFile && imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14036
15106
|
"img",
|
|
14037
15107
|
{
|
|
14038
15108
|
src: imagePreview,
|
|
14039
15109
|
alt: t("dropfile.previewAlt"),
|
|
14040
15110
|
className: "w-full h-full object-contain max-h-[200px]"
|
|
14041
15111
|
}
|
|
14042
|
-
) : /* @__PURE__ */ (0,
|
|
14043
|
-
/* @__PURE__ */ (0,
|
|
14044
|
-
/* @__PURE__ */ (0,
|
|
15112
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "py-8 flex flex-col items-center text-secondary-400", children: [
|
|
15113
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-10 h-10 mb-2 opacity-50", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }),
|
|
15114
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "text-xs", children: t("dropfile.noPreview") })
|
|
14045
15115
|
] }) }),
|
|
14046
|
-
/* @__PURE__ */ (0,
|
|
14047
|
-
/* @__PURE__ */ (0,
|
|
15116
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "px-3 py-2 bg-white border-t border-secondary-100 flex justify-end gap-2", children: !isConfirmed ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
15117
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14048
15118
|
ITButton,
|
|
14049
15119
|
{
|
|
14050
15120
|
type: "button",
|
|
@@ -14052,10 +15122,10 @@ var ITDropfile = ({
|
|
|
14052
15122
|
color: "secondary",
|
|
14053
15123
|
size: "sm",
|
|
14054
15124
|
onClick: handleCancel,
|
|
14055
|
-
children: /* @__PURE__ */ (0,
|
|
15125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.cancel") })
|
|
14056
15126
|
}
|
|
14057
15127
|
),
|
|
14058
|
-
/* @__PURE__ */ (0,
|
|
15128
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14059
15129
|
ITButton,
|
|
14060
15130
|
{
|
|
14061
15131
|
type: "button",
|
|
@@ -14063,13 +15133,13 @@ var ITDropfile = ({
|
|
|
14063
15133
|
color: "primary",
|
|
14064
15134
|
size: "sm",
|
|
14065
15135
|
onClick: handleConfirm,
|
|
14066
|
-
children: /* @__PURE__ */ (0,
|
|
14067
|
-
/* @__PURE__ */ (0,
|
|
14068
|
-
/* @__PURE__ */ (0,
|
|
15136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15137
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.confirm") }),
|
|
15138
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-3 h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
14069
15139
|
] })
|
|
14070
15140
|
}
|
|
14071
15141
|
)
|
|
14072
|
-
] }) : /* @__PURE__ */ (0,
|
|
15142
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14073
15143
|
ITButton,
|
|
14074
15144
|
{
|
|
14075
15145
|
type: "button",
|
|
@@ -14078,12 +15148,12 @@ var ITDropfile = ({
|
|
|
14078
15148
|
size: "sm",
|
|
14079
15149
|
onClick: handleDelete,
|
|
14080
15150
|
children: [
|
|
14081
|
-
/* @__PURE__ */ (0,
|
|
14082
|
-
/* @__PURE__ */ (0,
|
|
15151
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-3 h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }),
|
|
15152
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.delete") })
|
|
14083
15153
|
]
|
|
14084
15154
|
}
|
|
14085
15155
|
) }),
|
|
14086
|
-
uploadStatus === "subiendo" /* UPLOADING */ && /* @__PURE__ */ (0,
|
|
15156
|
+
uploadStatus === "subiendo" /* UPLOADING */ && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "px-4 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-full bg-secondary-200 rounded-full h-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14087
15157
|
"div",
|
|
14088
15158
|
{
|
|
14089
15159
|
className: "bg-primary-600 h-1.5 rounded-full transition-all duration-1000 ease-out",
|
|
@@ -14096,8 +15166,8 @@ var ITDropfile = ({
|
|
|
14096
15166
|
] }) });
|
|
14097
15167
|
if (view === "button") {
|
|
14098
15168
|
const hasFile = Boolean(selectedFile || imagePreview);
|
|
14099
|
-
return /* @__PURE__ */ (0,
|
|
14100
|
-
/* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_clsx54.default)("inline-block", containerClassName), children: [
|
|
15170
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14101
15171
|
ITButton,
|
|
14102
15172
|
{
|
|
14103
15173
|
type: "button",
|
|
@@ -14105,20 +15175,20 @@ var ITDropfile = ({
|
|
|
14105
15175
|
color: hasFile ? "primary" : "secondary",
|
|
14106
15176
|
size: "sm",
|
|
14107
15177
|
onClick: () => setIsModalOpen(true),
|
|
14108
|
-
children: /* @__PURE__ */ (0,
|
|
14109
|
-
/* @__PURE__ */ (0,
|
|
14110
|
-
/* @__PURE__ */ (0,
|
|
14111
|
-
showStatusBadge && hasFile && /* @__PURE__ */ (0,
|
|
15178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2 max-w-[220px]", children: [
|
|
15179
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" }) }),
|
|
15180
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { className: "truncate", children: selectedFile?.name || (hasFile ? t("dropfile.fileLoaded") : buttonLabel ?? t("dropfile.upload")) }),
|
|
15181
|
+
showStatusBadge && hasFile && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(StatusBadge, { status: uploadStatus })
|
|
14112
15182
|
] })
|
|
14113
15183
|
}
|
|
14114
15184
|
),
|
|
14115
|
-
/* @__PURE__ */ (0,
|
|
15185
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITDialog, { isOpen: isModalOpen, onClose: () => setIsModalOpen(false), title: modalTitle ?? buttonLabel ?? t("dropfile.upload"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "w-full transition-all duration-300", children: [
|
|
14116
15186
|
headerRow,
|
|
14117
15187
|
dropZoneOrPreview
|
|
14118
15188
|
] }) })
|
|
14119
15189
|
] });
|
|
14120
15190
|
}
|
|
14121
|
-
return /* @__PURE__ */ (0,
|
|
15191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_clsx54.default)("w-full transition-all duration-300", containerClassName), children: [
|
|
14122
15192
|
headerRow,
|
|
14123
15193
|
dropZoneOrPreview
|
|
14124
15194
|
] });
|
|
@@ -14126,13 +15196,13 @@ var ITDropfile = ({
|
|
|
14126
15196
|
var dropfile_default = ITDropfile;
|
|
14127
15197
|
|
|
14128
15198
|
// src/components/templates/layout/layout.tsx
|
|
14129
|
-
var
|
|
15199
|
+
var import_react60 = require("react");
|
|
14130
15200
|
var import_clsx55 = __toESM(require("clsx"), 1);
|
|
14131
15201
|
|
|
14132
15202
|
// src/components/organisms/topbar/topbar.tsx
|
|
14133
15203
|
var import_fa32 = require("react-icons/fa");
|
|
14134
|
-
var
|
|
14135
|
-
var
|
|
15204
|
+
var import_react59 = require("react");
|
|
15205
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14136
15206
|
function ITTopBar({
|
|
14137
15207
|
logo,
|
|
14138
15208
|
logoText,
|
|
@@ -14146,41 +15216,46 @@ function ITTopBar({
|
|
|
14146
15216
|
hideBrandOnDesktop = false,
|
|
14147
15217
|
showDesktopMenuButton = false
|
|
14148
15218
|
}) {
|
|
14149
|
-
const
|
|
15219
|
+
const appearance = useITAppearance();
|
|
15220
|
+
const bento = appearance === "bento";
|
|
15221
|
+
const flat = appearance === "flat" || bento;
|
|
14150
15222
|
const { t } = useITTranslation();
|
|
14151
15223
|
const initials = (userMenu?.userName ?? "").trim().split(/\s+/).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
|
|
14152
|
-
const
|
|
14153
|
-
const
|
|
15224
|
+
const userRestBg = bento ? "var(--it-bento-control-bg, #f1f5f9)" : "transparent";
|
|
15225
|
+
const userHoverBg = bento ? "var(--it-bento-control-bg-hover, #e2e8f0)" : "var(--it-topbar-user-hover, #f1f5f9)";
|
|
15226
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = (0, import_react59.useState)(false);
|
|
15227
|
+
const userMenuRef = (0, import_react59.useRef)(null);
|
|
14154
15228
|
useClickOutside_default(userMenuRef, () => setIsUserMenuOpen(false));
|
|
14155
|
-
return /* @__PURE__ */ (0,
|
|
15229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14156
15230
|
"header",
|
|
14157
15231
|
{
|
|
14158
15232
|
className: `sticky top-0 z-40 transition-all duration-300 ${flat ? "" : "backdrop-blur-md"}`,
|
|
14159
15233
|
style: {
|
|
14160
|
-
backgroundColor: "var(--it-topbar-bg, rgba(255, 255, 255, 0.9))",
|
|
14161
|
-
borderBottom: "1px solid var(--it-topbar-border, rgba(15, 23, 42, 0.06))",
|
|
15234
|
+
backgroundColor: bento ? "var(--it-layout-bg, #f4f4f6)" : "var(--it-topbar-bg, rgba(255, 255, 255, 0.9))",
|
|
15235
|
+
borderBottom: bento ? "none" : "1px solid var(--it-topbar-border, rgba(15, 23, 42, 0.06))",
|
|
14162
15236
|
boxShadow: flat ? "none" : "var(--shadow-xs)"
|
|
14163
15237
|
},
|
|
14164
|
-
children: /* @__PURE__ */ (0,
|
|
14165
|
-
/* @__PURE__ */ (0,
|
|
14166
|
-
showMobileMenuButton && /* @__PURE__ */ (0,
|
|
15238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `flex items-center justify-between px-6 lg:px-8 ${flat ? "h-[64px]" : "h-[72px]"}`, children: [
|
|
15239
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
15240
|
+
showMobileMenuButton && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14167
15241
|
"button",
|
|
14168
15242
|
{
|
|
14169
15243
|
type: "button",
|
|
14170
15244
|
"aria-label": t("common.menu"),
|
|
14171
|
-
className: `${showDesktopMenuButton ? "" : "lg:hidden"} p-2.5 -ml-2.5 rounded-xl transition-colors duration-200`,
|
|
15245
|
+
className: `${showDesktopMenuButton ? "" : "lg:hidden"} ${bento ? "w-10 h-10 flex items-center justify-center rounded-full" : "p-2.5 -ml-2.5 rounded-xl"} transition-colors duration-200`,
|
|
14172
15246
|
style: {
|
|
14173
|
-
color: "var(--it-topbar-icon, #64748b)"
|
|
15247
|
+
color: bento ? "var(--it-bento-control-text, #475569)" : "var(--it-topbar-icon, #64748b)",
|
|
15248
|
+
backgroundColor: bento ? "var(--it-bento-control-bg, #f1f5f9)" : void 0
|
|
14174
15249
|
},
|
|
14175
|
-
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "var(--it-topbar-user-hover, #f1f5f9)",
|
|
14176
|
-
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "transparent",
|
|
15250
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = bento ? "var(--it-bento-control-bg-hover, #e2e8f0)" : "var(--it-topbar-user-hover, #f1f5f9)",
|
|
15251
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = bento ? "var(--it-bento-control-bg, #f1f5f9)" : "transparent",
|
|
14177
15252
|
onClick: onToggleMobileMenu,
|
|
14178
|
-
children: /* @__PURE__ */ (0,
|
|
15253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_fa32.FaBars, { className: "w-[1.125rem] h-[1.125rem]" })
|
|
14179
15254
|
}
|
|
14180
15255
|
),
|
|
14181
|
-
/* @__PURE__ */ (0,
|
|
14182
|
-
logo && /* @__PURE__ */ (0,
|
|
14183
|
-
logoText && /* @__PURE__ */ (0,
|
|
15256
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `items-center gap-3 ${hideBrandOnDesktop ? "flex lg:hidden" : "flex"}`, children: [
|
|
15257
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex-shrink-0 drop-shadow-sm", children: logo }),
|
|
15258
|
+
logoText && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14184
15259
|
ITText,
|
|
14185
15260
|
{
|
|
14186
15261
|
as: "span",
|
|
@@ -14190,57 +15265,70 @@ function ITTopBar({
|
|
|
14190
15265
|
}
|
|
14191
15266
|
)
|
|
14192
15267
|
] }),
|
|
14193
|
-
navItems && navItems.length > 0 && /* @__PURE__ */ (0,
|
|
14194
|
-
"
|
|
15268
|
+
navItems && navItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15269
|
+
"nav",
|
|
14195
15270
|
{
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
15271
|
+
className: bento ? "hidden md:flex ml-4 gap-2" : "hidden md:flex ml-8 space-x-1 border-l pl-8",
|
|
15272
|
+
style: bento ? void 0 : { borderColor: "var(--it-topbar-border, rgba(15, 23, 42, 0.06))" },
|
|
15273
|
+
children: navItems.map((item) => {
|
|
15274
|
+
const restBg = bento ? item.isActive ? "var(--it-bento-ink-bg, #0f172a)" : "var(--it-bento-control-bg, #f1f5f9)" : item.isActive ? "var(--it-topbar-user-hover, #f1f5f9)" : "transparent";
|
|
15275
|
+
const restColor = bento ? item.isActive ? "var(--it-bento-ink-text, #ffffff)" : "var(--it-bento-control-text, #475569)" : "var(--it-topbar-text, #475569)";
|
|
15276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15277
|
+
"button",
|
|
15278
|
+
{
|
|
15279
|
+
onClick: () => onNavItemClick?.(item.id),
|
|
15280
|
+
"aria-current": item.isActive ? "page" : void 0,
|
|
15281
|
+
className: `px-4 py-2 ${bento ? "rounded-full" : "rounded-lg"} font-medium text-[0.9rem] transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)]`,
|
|
15282
|
+
style: { color: restColor, backgroundColor: restBg },
|
|
15283
|
+
onMouseEnter: (e) => {
|
|
15284
|
+
if (bento && item.isActive) return;
|
|
15285
|
+
e.currentTarget.style.color = bento ? "var(--it-bento-control-text, #0f172a)" : "var(--it-topbar-text, #0f172a)";
|
|
15286
|
+
e.currentTarget.style.backgroundColor = bento ? "var(--it-bento-control-bg-hover, #e2e8f0)" : "var(--it-topbar-user-hover, #f1f5f9)";
|
|
15287
|
+
},
|
|
15288
|
+
onMouseLeave: (e) => {
|
|
15289
|
+
e.currentTarget.style.color = restColor;
|
|
15290
|
+
e.currentTarget.style.backgroundColor = restBg;
|
|
15291
|
+
},
|
|
15292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15293
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "opacity-70", children: item.icon }),
|
|
15294
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", children: item.label })
|
|
15295
|
+
] })
|
|
15296
|
+
},
|
|
15297
|
+
item.id
|
|
15298
|
+
);
|
|
15299
|
+
})
|
|
15300
|
+
}
|
|
15301
|
+
)
|
|
14214
15302
|
] }),
|
|
14215
|
-
centerContent && /* @__PURE__ */ (0,
|
|
14216
|
-
(children || userMenu) && /* @__PURE__ */ (0,
|
|
15303
|
+
centerContent && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: `hidden lg:flex flex-1 min-w-0 items-center ${hideBrandOnDesktop ? "justify-start pr-4" : "justify-center px-4"}`, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-full max-w-[420px]", children: centerContent }) }),
|
|
15304
|
+
(children || userMenu) && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14217
15305
|
children,
|
|
14218
|
-
userMenu && /* @__PURE__ */ (0,
|
|
14219
|
-
/* @__PURE__ */ (0,
|
|
15306
|
+
userMenu && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "relative", children: [
|
|
15307
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
14220
15308
|
"button",
|
|
14221
15309
|
{
|
|
14222
15310
|
type: "button",
|
|
14223
|
-
className: `flex items-center gap-3 rounded-full py-1.5 transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)] border border-transparent hover:border-secondary-200 ${flat ? "flex-row-reverse pl-4 pr-2" : "pl-2 pr-4"}`,
|
|
15311
|
+
className: `flex items-center gap-3 rounded-full py-1.5 transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)] border border-transparent ${bento ? "" : "hover:border-secondary-200"} ${flat ? "flex-row-reverse pl-4 pr-2" : "pl-2 pr-4"}`,
|
|
14224
15312
|
style: {
|
|
14225
|
-
backgroundColor: isUserMenuOpen ?
|
|
15313
|
+
backgroundColor: isUserMenuOpen ? userHoverBg : userRestBg
|
|
14226
15314
|
},
|
|
14227
15315
|
onMouseEnter: (e) => {
|
|
14228
|
-
if (!isUserMenuOpen) e.currentTarget.style.backgroundColor =
|
|
15316
|
+
if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = userHoverBg;
|
|
14229
15317
|
},
|
|
14230
15318
|
onMouseLeave: (e) => {
|
|
14231
|
-
if (!isUserMenuOpen) e.currentTarget.style.backgroundColor =
|
|
15319
|
+
if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = userRestBg;
|
|
14232
15320
|
},
|
|
14233
15321
|
onClick: () => setIsUserMenuOpen(!isUserMenuOpen),
|
|
14234
15322
|
children: [
|
|
14235
|
-
/* @__PURE__ */ (0,
|
|
14236
|
-
userMenu.userImage ? /* @__PURE__ */ (0,
|
|
15323
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "relative", children: [
|
|
15324
|
+
userMenu.userImage ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14237
15325
|
"img",
|
|
14238
15326
|
{
|
|
14239
15327
|
className: "w-9 h-9 rounded-full object-cover ring-2 ring-white shadow-sm",
|
|
14240
15328
|
src: userMenu.userImage,
|
|
14241
15329
|
alt: t("common.userAvatar")
|
|
14242
15330
|
}
|
|
14243
|
-
) : flat && initials ? /* @__PURE__ */ (0,
|
|
15331
|
+
) : flat && initials ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14244
15332
|
"div",
|
|
14245
15333
|
{
|
|
14246
15334
|
"aria-hidden": "true",
|
|
@@ -14251,11 +15339,11 @@ function ITTopBar({
|
|
|
14251
15339
|
},
|
|
14252
15340
|
children: initials
|
|
14253
15341
|
}
|
|
14254
|
-
) : /* @__PURE__ */ (0,
|
|
14255
|
-
!flat && /* @__PURE__ */ (0,
|
|
15342
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-9 h-9 rounded-full bg-slate-100 flex items-center justify-center ring-2 ring-white shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_fa32.FaUserCircle, { className: "w-6 h-6", style: { color: "var(--it-topbar-icon, #94a3b8)" } }) }),
|
|
15343
|
+
!flat && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "absolute bottom-0 right-0 w-2.5 h-2.5 bg-green-500 border-2 border-white rounded-full" })
|
|
14256
15344
|
] }),
|
|
14257
|
-
/* @__PURE__ */ (0,
|
|
14258
|
-
/* @__PURE__ */ (0,
|
|
15345
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `hidden sm:flex flex-col py-0.5 ${flat ? "text-right" : "text-left"}`, children: [
|
|
15346
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14259
15347
|
ITText,
|
|
14260
15348
|
{
|
|
14261
15349
|
as: "span",
|
|
@@ -14264,7 +15352,7 @@ function ITTopBar({
|
|
|
14264
15352
|
children: userMenu.userName
|
|
14265
15353
|
}
|
|
14266
15354
|
),
|
|
14267
|
-
/* @__PURE__ */ (0,
|
|
15355
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14268
15356
|
ITText,
|
|
14269
15357
|
{
|
|
14270
15358
|
as: "span",
|
|
@@ -14277,7 +15365,7 @@ function ITTopBar({
|
|
|
14277
15365
|
]
|
|
14278
15366
|
}
|
|
14279
15367
|
),
|
|
14280
|
-
/* @__PURE__ */ (0,
|
|
15368
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
14281
15369
|
"div",
|
|
14282
15370
|
{
|
|
14283
15371
|
ref: userMenuRef,
|
|
@@ -14290,15 +15378,15 @@ function ITTopBar({
|
|
|
14290
15378
|
border: "1px solid var(--it-topbar-user-dropdown-border, #f1f5f9)"
|
|
14291
15379
|
},
|
|
14292
15380
|
children: [
|
|
14293
|
-
/* @__PURE__ */ (0,
|
|
14294
|
-
/* @__PURE__ */ (0,
|
|
14295
|
-
/* @__PURE__ */ (0,
|
|
15381
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "px-5 py-4 border-b", style: { borderColor: "var(--it-topbar-user-dropdown-border, #f1f5f9)", backgroundColor: "var(--it-topbar-user-bg, #f8fafc)" }, children: [
|
|
15382
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", className: "block font-bold text-[0.9rem]", style: { color: "var(--it-topbar-user-text, #0f172a)" }, children: userMenu.userName }),
|
|
15383
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", className: "block text-xs font-medium truncate mt-0.5", style: { color: "var(--it-topbar-user-subtitle, #64748b)" }, children: userMenu.userEmail })
|
|
14296
15384
|
] }),
|
|
14297
|
-
/* @__PURE__ */ (0,
|
|
15385
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("ul", { className: "py-2", children: userMenu.menuItems.map((m, i) => {
|
|
14298
15386
|
const isDestructive = m.label.toLowerCase().includes("salir") || m.label.toLowerCase().includes("cerrar") || m.label.toLowerCase().includes("logout");
|
|
14299
|
-
return /* @__PURE__ */ (0,
|
|
14300
|
-
i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && /* @__PURE__ */ (0,
|
|
14301
|
-
/* @__PURE__ */ (0,
|
|
15387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("li", { className: "px-2", children: [
|
|
15388
|
+
i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "h-px bg-slate-100 my-1 mx-2" }),
|
|
15389
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14302
15390
|
"button",
|
|
14303
15391
|
{
|
|
14304
15392
|
onClick: () => {
|
|
@@ -14313,7 +15401,7 @@ function ITTopBar({
|
|
|
14313
15401
|
onMouseLeave: (e) => {
|
|
14314
15402
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
14315
15403
|
},
|
|
14316
|
-
children: /* @__PURE__ */ (0,
|
|
15404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", children: m.label })
|
|
14317
15405
|
}
|
|
14318
15406
|
)
|
|
14319
15407
|
] }, i);
|
|
@@ -14329,7 +15417,7 @@ function ITTopBar({
|
|
|
14329
15417
|
}
|
|
14330
15418
|
|
|
14331
15419
|
// src/components/templates/layout/layout.tsx
|
|
14332
|
-
var
|
|
15420
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14333
15421
|
function ITLayout({
|
|
14334
15422
|
topBar,
|
|
14335
15423
|
sidebar,
|
|
@@ -14338,9 +15426,9 @@ function ITLayout({
|
|
|
14338
15426
|
contentClassName = "",
|
|
14339
15427
|
sidebarFullHeight = false
|
|
14340
15428
|
}) {
|
|
14341
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
14342
|
-
const [mobileSidebarOpen, setMobileSidebarOpen] = (0,
|
|
14343
|
-
const flat =
|
|
15429
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react60.useState)(true);
|
|
15430
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react60.useState)(false);
|
|
15431
|
+
const flat = useITAppearance() !== "soft";
|
|
14344
15432
|
const isControlled = sidebar.isCollapsed !== void 0;
|
|
14345
15433
|
const desktopCollapsed = isControlled ? sidebar.isCollapsed : internalCollapsed;
|
|
14346
15434
|
const handleToggleCollapse = isControlled ? sidebar.onToggleCollapse ?? (() => {
|
|
@@ -14353,7 +15441,7 @@ function ITLayout({
|
|
|
14353
15441
|
else setMobileSidebarOpen((v) => !v);
|
|
14354
15442
|
};
|
|
14355
15443
|
const brand = sidebarFullHeight ? sidebar.brand ?? { logo: topBar.logo, text: topBar.logoText } : sidebar.brand;
|
|
14356
|
-
const topBarNode = /* @__PURE__ */ (0,
|
|
15444
|
+
const topBarNode = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14357
15445
|
ITTopBar,
|
|
14358
15446
|
{
|
|
14359
15447
|
...topBar,
|
|
@@ -14366,9 +15454,9 @@ function ITLayout({
|
|
|
14366
15454
|
const desktopSidebar = (
|
|
14367
15455
|
// Full-height: the sidebar sits beside the top bar, so it needs to win the
|
|
14368
15456
|
// stacking order when the collapsed rail expands over the content on hover.
|
|
14369
|
-
/* @__PURE__ */ (0,
|
|
14370
|
-
/* @__PURE__ */ (0,
|
|
14371
|
-
/* @__PURE__ */ (0,
|
|
15457
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `hidden lg:block relative h-full ${sidebarFullHeight ? "z-50" : "z-40"}`, children: [
|
|
15458
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `${reservedWidth} h-full flex-shrink-0` }),
|
|
15459
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "absolute top-0 left-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14372
15460
|
ITSidebar,
|
|
14373
15461
|
{
|
|
14374
15462
|
...sidebar,
|
|
@@ -14381,17 +15469,17 @@ function ITLayout({
|
|
|
14381
15469
|
) })
|
|
14382
15470
|
] })
|
|
14383
15471
|
);
|
|
14384
|
-
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0,
|
|
15472
|
+
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14385
15473
|
"div",
|
|
14386
15474
|
{
|
|
14387
15475
|
className: "lg:hidden fixed inset-0 z-[40] transition-opacity duration-300 backdrop-blur-sm bg-black/40",
|
|
14388
15476
|
onClick: () => setMobileSidebarOpen(false),
|
|
14389
|
-
children: /* @__PURE__ */ (0,
|
|
15477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14390
15478
|
"div",
|
|
14391
15479
|
{
|
|
14392
15480
|
className: "h-full w-fit flex transform transition-transform duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
14393
15481
|
onClick: (e) => e.stopPropagation(),
|
|
14394
|
-
children: /* @__PURE__ */ (0,
|
|
15482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14395
15483
|
ITSidebar,
|
|
14396
15484
|
{
|
|
14397
15485
|
...sidebar,
|
|
@@ -14408,16 +15496,16 @@ function ITLayout({
|
|
|
14408
15496
|
)
|
|
14409
15497
|
}
|
|
14410
15498
|
);
|
|
14411
|
-
const main = /* @__PURE__ */ (0,
|
|
15499
|
+
const main = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("main", { className: "flex-1 overflow-y-auto w-full custom-scrollbar relative z-0", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: (0, import_clsx55.default)("mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-6 h-full", contentClassName), children }) });
|
|
14412
15500
|
if (sidebarFullHeight) {
|
|
14413
|
-
return /* @__PURE__ */ (0,
|
|
15501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14414
15502
|
"div",
|
|
14415
15503
|
{
|
|
14416
15504
|
className: `flex h-screen overflow-hidden w-full relative ${className}`,
|
|
14417
15505
|
style: { backgroundColor: layoutTokens.backgroundColor },
|
|
14418
15506
|
children: [
|
|
14419
15507
|
desktopSidebar,
|
|
14420
|
-
/* @__PURE__ */ (0,
|
|
15508
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 overflow-hidden", children: [
|
|
14421
15509
|
topBarNode,
|
|
14422
15510
|
main
|
|
14423
15511
|
] }),
|
|
@@ -14426,9 +15514,9 @@ function ITLayout({
|
|
|
14426
15514
|
}
|
|
14427
15515
|
);
|
|
14428
15516
|
}
|
|
14429
|
-
return /* @__PURE__ */ (0,
|
|
15517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `flex flex-col h-screen overflow-hidden w-full ${className}`, children: [
|
|
14430
15518
|
topBarNode,
|
|
14431
|
-
/* @__PURE__ */ (0,
|
|
15519
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14432
15520
|
"div",
|
|
14433
15521
|
{
|
|
14434
15522
|
className: "flex flex-1 overflow-hidden relative",
|
|
@@ -14445,9 +15533,9 @@ function ITLayout({
|
|
|
14445
15533
|
|
|
14446
15534
|
// src/components/molecules/stepper/stepper.tsx
|
|
14447
15535
|
var import_clsx56 = __toESM(require("clsx"), 1);
|
|
14448
|
-
var
|
|
15536
|
+
var import_react61 = require("react");
|
|
14449
15537
|
var import_fa33 = require("react-icons/fa");
|
|
14450
|
-
var
|
|
15538
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14451
15539
|
function ITStepper({
|
|
14452
15540
|
steps,
|
|
14453
15541
|
currentStep,
|
|
@@ -14463,15 +15551,15 @@ function ITStepper({
|
|
|
14463
15551
|
color = "primary"
|
|
14464
15552
|
}) {
|
|
14465
15553
|
const { t } = useITTranslation();
|
|
14466
|
-
const [direction, setDirection] = (0,
|
|
14467
|
-
const contentRef = (0,
|
|
14468
|
-
const progressRef = (0,
|
|
15554
|
+
const [direction, setDirection] = (0, import_react61.useState)("next");
|
|
15555
|
+
const contentRef = (0, import_react61.useRef)(null);
|
|
15556
|
+
const progressRef = (0, import_react61.useRef)(null);
|
|
14469
15557
|
const isThemeColor = color in theme.colors;
|
|
14470
15558
|
const resolvedColor = isThemeColor ? theme.colors[color][500] : color;
|
|
14471
|
-
(0,
|
|
15559
|
+
(0, import_react61.useEffect)(() => {
|
|
14472
15560
|
onStepChange?.(currentStep);
|
|
14473
15561
|
}, [currentStep, onStepChange]);
|
|
14474
|
-
(0,
|
|
15562
|
+
(0, import_react61.useEffect)(() => {
|
|
14475
15563
|
const pct = currentStep / Math.max(1, steps.length - 1) * 100;
|
|
14476
15564
|
if (progressRef.current) {
|
|
14477
15565
|
progressRef.current.style.width = `${pct}%`;
|
|
@@ -14515,23 +15603,23 @@ function ITStepper({
|
|
|
14515
15603
|
const renderStepContent = (index, isCompleted) => {
|
|
14516
15604
|
const step = steps[index];
|
|
14517
15605
|
if (isCompleted) {
|
|
14518
|
-
return /* @__PURE__ */ (0,
|
|
15606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaCheck, { className: "w-4 h-4" });
|
|
14519
15607
|
}
|
|
14520
15608
|
if (step.icon && useIcons) {
|
|
14521
|
-
return /* @__PURE__ */ (0,
|
|
15609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-center justify-center w-5 h-5", children: step.icon });
|
|
14522
15610
|
}
|
|
14523
|
-
return /* @__PURE__ */ (0,
|
|
15611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", className: "text-sm font-semibold", children: index + 1 });
|
|
14524
15612
|
};
|
|
14525
|
-
return /* @__PURE__ */ (0,
|
|
14526
|
-
/* @__PURE__ */ (0,
|
|
14527
|
-
/* @__PURE__ */ (0,
|
|
15613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: (0, import_clsx56.default)("w-full max-w-5xl mx-auto px-4", containerClassName), children: [
|
|
15614
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "relative mb-8", children: [
|
|
15615
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14528
15616
|
"div",
|
|
14529
15617
|
{
|
|
14530
15618
|
className: "absolute left-6 right-6 top-5 h-1 bg-secondary-200 rounded-full z-0",
|
|
14531
15619
|
"aria-hidden": true
|
|
14532
15620
|
}
|
|
14533
15621
|
),
|
|
14534
|
-
/* @__PURE__ */ (0,
|
|
15622
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14535
15623
|
"div",
|
|
14536
15624
|
{
|
|
14537
15625
|
ref: progressRef,
|
|
@@ -14539,11 +15627,11 @@ function ITStepper({
|
|
|
14539
15627
|
"aria-hidden": true
|
|
14540
15628
|
}
|
|
14541
15629
|
),
|
|
14542
|
-
/* @__PURE__ */ (0,
|
|
15630
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-start justify-between space-x-2 relative z-20", children: steps.map((step, idx) => {
|
|
14543
15631
|
const isActive = idx === currentStep;
|
|
14544
15632
|
const isCompleted = idx < currentStep;
|
|
14545
15633
|
const hasIcon = step.icon && useIcons;
|
|
14546
|
-
return /* @__PURE__ */ (0,
|
|
15634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14547
15635
|
"button",
|
|
14548
15636
|
{
|
|
14549
15637
|
type: "button",
|
|
@@ -14553,8 +15641,8 @@ function ITStepper({
|
|
|
14553
15641
|
"aria-label": t("stepper.stepAria", { n: idx + 1, label: step.label }),
|
|
14554
15642
|
className: "flex-1 group",
|
|
14555
15643
|
title: step.label,
|
|
14556
|
-
children: /* @__PURE__ */ (0,
|
|
14557
|
-
/* @__PURE__ */ (0,
|
|
15644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
15645
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14558
15646
|
"div",
|
|
14559
15647
|
{
|
|
14560
15648
|
className: (0, import_clsx56.default)(
|
|
@@ -14568,7 +15656,7 @@ function ITStepper({
|
|
|
14568
15656
|
children: renderStepContent(idx, isCompleted)
|
|
14569
15657
|
}
|
|
14570
15658
|
),
|
|
14571
|
-
/* @__PURE__ */ (0,
|
|
15659
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14572
15660
|
ITText,
|
|
14573
15661
|
{
|
|
14574
15662
|
as: "span",
|
|
@@ -14586,7 +15674,7 @@ function ITStepper({
|
|
|
14586
15674
|
);
|
|
14587
15675
|
}) })
|
|
14588
15676
|
] }),
|
|
14589
|
-
/* @__PURE__ */ (0,
|
|
15677
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14590
15678
|
"div",
|
|
14591
15679
|
{
|
|
14592
15680
|
ref: contentRef,
|
|
@@ -14602,32 +15690,32 @@ function ITStepper({
|
|
|
14602
15690
|
children: steps[currentStep].content
|
|
14603
15691
|
}
|
|
14604
15692
|
),
|
|
14605
|
-
/* @__PURE__ */ (0,
|
|
14606
|
-
/* @__PURE__ */ (0,
|
|
15693
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
15694
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14607
15695
|
ITButton,
|
|
14608
15696
|
{
|
|
14609
15697
|
variant: "outlined",
|
|
14610
15698
|
color: "secondary",
|
|
14611
15699
|
disabled: currentStep === 0,
|
|
14612
15700
|
onClick: prevStep,
|
|
14613
|
-
children: /* @__PURE__ */ (0,
|
|
14614
|
-
/* @__PURE__ */ (0,
|
|
14615
|
-
/* @__PURE__ */ (0,
|
|
15701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15702
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaChevronLeft, {}),
|
|
15703
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", children: t("common.back") })
|
|
14616
15704
|
] })
|
|
14617
15705
|
}
|
|
14618
15706
|
),
|
|
14619
|
-
/* @__PURE__ */ (0,
|
|
14620
|
-
/* @__PURE__ */ (0,
|
|
14621
|
-
/* @__PURE__ */ (0,
|
|
15707
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
15708
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "div", className: "text-sm text-secondary-500 mr-2 hidden sm:block", children: t("stepper.stepOf", { current: currentStep + 1, total: steps.length }) }),
|
|
15709
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14622
15710
|
ITButton,
|
|
14623
15711
|
{
|
|
14624
15712
|
variant: "solid",
|
|
14625
15713
|
color,
|
|
14626
15714
|
disabled: disableNext,
|
|
14627
15715
|
onClick: nextStep,
|
|
14628
|
-
children: /* @__PURE__ */ (0,
|
|
14629
|
-
/* @__PURE__ */ (0,
|
|
14630
|
-
currentStep === steps.length - 1 ? /* @__PURE__ */ (0,
|
|
15716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15717
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", children: currentStep === steps.length - 1 ? t("common.finish") : t("common.next") }),
|
|
15718
|
+
currentStep === steps.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaChevronRight, {})
|
|
14631
15719
|
] })
|
|
14632
15720
|
}
|
|
14633
15721
|
)
|
|
@@ -14637,7 +15725,7 @@ function ITStepper({
|
|
|
14637
15725
|
}
|
|
14638
15726
|
|
|
14639
15727
|
// src/components/theme-provider/themeProvider.tsx
|
|
14640
|
-
var
|
|
15728
|
+
var import_react62 = require("react");
|
|
14641
15729
|
var import_md3 = require("react-icons/md");
|
|
14642
15730
|
|
|
14643
15731
|
// src/components/theme-provider/themePresets.ts
|
|
@@ -14815,7 +15903,7 @@ var PRESETS = [
|
|
|
14815
15903
|
];
|
|
14816
15904
|
|
|
14817
15905
|
// src/components/theme-provider/themeProvider.tsx
|
|
14818
|
-
var
|
|
15906
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14819
15907
|
var STORAGE_KEY = "it-theme-palette";
|
|
14820
15908
|
var SHADOW_LEVELS = {
|
|
14821
15909
|
0: {
|
|
@@ -14918,7 +16006,7 @@ function ITThemeProvider({
|
|
|
14918
16006
|
appearance = "soft"
|
|
14919
16007
|
}) {
|
|
14920
16008
|
const { t } = useITTranslation();
|
|
14921
|
-
const [palette2, setPaletteState] = (0,
|
|
16009
|
+
const [palette2, setPaletteState] = (0, import_react62.useState)(() => {
|
|
14922
16010
|
const basePalette = {
|
|
14923
16011
|
...DEFAULT_PALETTE,
|
|
14924
16012
|
...theme2,
|
|
@@ -14944,8 +16032,8 @@ function ITThemeProvider({
|
|
|
14944
16032
|
}
|
|
14945
16033
|
return basePalette;
|
|
14946
16034
|
});
|
|
14947
|
-
const [isOpen, setIsOpen] = (0,
|
|
14948
|
-
const [customPresets, setCustomPresets] = (0,
|
|
16035
|
+
const [isOpen, setIsOpen] = (0, import_react62.useState)(false);
|
|
16036
|
+
const [customPresets, setCustomPresets] = (0, import_react62.useState)(() => {
|
|
14949
16037
|
try {
|
|
14950
16038
|
const saved = localStorage.getItem("it-theme-custom-presets");
|
|
14951
16039
|
return saved ? JSON.parse(saved) : [];
|
|
@@ -14954,8 +16042,8 @@ function ITThemeProvider({
|
|
|
14954
16042
|
return [];
|
|
14955
16043
|
}
|
|
14956
16044
|
});
|
|
14957
|
-
const [newPresetName, setNewPresetName] = (0,
|
|
14958
|
-
const [isSavingPreset, setIsSavingPreset] = (0,
|
|
16045
|
+
const [newPresetName, setNewPresetName] = (0, import_react62.useState)("");
|
|
16046
|
+
const [isSavingPreset, setIsSavingPreset] = (0, import_react62.useState)(false);
|
|
14959
16047
|
const handleSavePreset = () => {
|
|
14960
16048
|
if (!newPresetName.trim()) return;
|
|
14961
16049
|
const newPreset = {
|
|
@@ -14974,8 +16062,8 @@ function ITThemeProvider({
|
|
|
14974
16062
|
setCustomPresets(updated);
|
|
14975
16063
|
localStorage.setItem("it-theme-custom-presets", JSON.stringify(updated));
|
|
14976
16064
|
};
|
|
14977
|
-
const [resolvedTheme, setResolvedTheme] = (0,
|
|
14978
|
-
const [darkModeMode, setDarkModeMode] = (0,
|
|
16065
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react62.useState)("light");
|
|
16066
|
+
const [darkModeMode, setDarkModeMode] = (0, import_react62.useState)(
|
|
14979
16067
|
() => {
|
|
14980
16068
|
const saved = localStorage.getItem("it-theme-dark-mode");
|
|
14981
16069
|
if (saved === "light" || saved === "dark" || saved === "system") {
|
|
@@ -14984,7 +16072,7 @@ function ITThemeProvider({
|
|
|
14984
16072
|
return "system";
|
|
14985
16073
|
}
|
|
14986
16074
|
);
|
|
14987
|
-
(0,
|
|
16075
|
+
(0, import_react62.useEffect)(() => {
|
|
14988
16076
|
localStorage.setItem("it-theme-dark-mode", darkModeMode);
|
|
14989
16077
|
const applyDarkMode = (isDark) => {
|
|
14990
16078
|
if (isDark) {
|
|
@@ -15009,7 +16097,7 @@ function ITThemeProvider({
|
|
|
15009
16097
|
applyDarkMode(darkModeMode === "dark");
|
|
15010
16098
|
}
|
|
15011
16099
|
}, [darkModeMode]);
|
|
15012
|
-
(0,
|
|
16100
|
+
(0, import_react62.useEffect)(() => {
|
|
15013
16101
|
if (!showFab) {
|
|
15014
16102
|
setPaletteState({
|
|
15015
16103
|
...DEFAULT_PALETTE,
|
|
@@ -15019,7 +16107,7 @@ function ITThemeProvider({
|
|
|
15019
16107
|
});
|
|
15020
16108
|
}
|
|
15021
16109
|
}, [theme2, showFab]);
|
|
15022
|
-
(0,
|
|
16110
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15023
16111
|
const root = document.documentElement;
|
|
15024
16112
|
const scale = typeof density === "number" && isFinite(density) ? Math.min(Math.max(density, 0.5), 1.5) : 1;
|
|
15025
16113
|
root.style.setProperty("--it-density", String(scale));
|
|
@@ -15029,12 +16117,12 @@ function ITThemeProvider({
|
|
|
15029
16117
|
root.style.fontSize = "";
|
|
15030
16118
|
};
|
|
15031
16119
|
}, [density]);
|
|
15032
|
-
(0,
|
|
16120
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15033
16121
|
const root = document.documentElement;
|
|
15034
16122
|
root.setAttribute("data-it-appearance", appearance);
|
|
15035
16123
|
return () => root.removeAttribute("data-it-appearance");
|
|
15036
16124
|
}, [appearance]);
|
|
15037
|
-
(0,
|
|
16125
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15038
16126
|
const root = document.documentElement;
|
|
15039
16127
|
const radiusTokens = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
15040
16128
|
if (typeof radius === "number" && isFinite(radius)) {
|
|
@@ -15066,7 +16154,33 @@ function ITThemeProvider({
|
|
|
15066
16154
|
surfaceStyle?.remove();
|
|
15067
16155
|
};
|
|
15068
16156
|
}, [radius, shadow]);
|
|
15069
|
-
(0,
|
|
16157
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
16158
|
+
const STYLE_ID = "it-theme-bento-tokens";
|
|
16159
|
+
let tag = document.getElementById(STYLE_ID);
|
|
16160
|
+
if (appearance !== "bento") {
|
|
16161
|
+
tag?.remove();
|
|
16162
|
+
return;
|
|
16163
|
+
}
|
|
16164
|
+
if (!tag) {
|
|
16165
|
+
tag = document.createElement("style");
|
|
16166
|
+
tag.id = STYLE_ID;
|
|
16167
|
+
document.head.appendChild(tag);
|
|
16168
|
+
}
|
|
16169
|
+
const hasRadius = typeof radius === "number" && isFinite(radius);
|
|
16170
|
+
const hasShadow = shadowLevel(shadow) !== null;
|
|
16171
|
+
const shapeLight = hasRadius ? "" : "--it-bento-card-radius:24px;--it-bento-pill-radius:9999px;--it-bento-field-radius:1rem;--it-input-radius:var(--it-bento-pill-radius);";
|
|
16172
|
+
const shadowLight = hasShadow ? "" : "--it-bento-card-shadow:0 1px 2px rgba(16,24,40,.04),0 12px 32px -16px rgba(16,24,40,.10);--it-bento-card-shadow-hover:0 1px 2px rgba(16,24,40,.06),0 18px 40px -16px rgba(16,24,40,.18);";
|
|
16173
|
+
const shadowDark = hasShadow ? "" : "--it-bento-card-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 32px -16px rgba(0,0,0,.55);--it-bento-card-shadow-hover:0 1px 2px rgba(0,0,0,.5),0 18px 40px -16px rgba(0,0,0,.7);";
|
|
16174
|
+
const navTokens = "--it-sidebar-active-bg:var(--it-bento-nav-active-bg);--it-sidebar-active-color:var(--it-bento-nav-active-text);--it-sidebar-active-icon:var(--it-bento-nav-active-text);";
|
|
16175
|
+
const light = "--it-layout-bg:#f4f4f6;--it-card-bg:#ffffff;--it-bento-card-padding:1.5rem;--it-input-bg:#f1f5f9;--it-input-border:transparent;--it-input-focus-ring:0 0 0 2px color-mix(in srgb,var(--color-primary) 50%,transparent);--it-bento-control-bg:#f1f5f9;--it-bento-control-bg-hover:#e2e8f0;--it-bento-control-text:#475569;--it-bento-ink-bg:#0f172a;--it-bento-ink-text:#ffffff;--it-bento-nav-active-bg:#f1f5f9;--it-bento-nav-active-text:#0f172a;" + navTokens;
|
|
16176
|
+
const dark = "--it-layout-bg:#020617;--it-card-bg:#0f172a;--it-input-bg:#1e293b;--it-input-border:transparent;--it-bento-control-bg:#1e293b;--it-bento-control-bg-hover:#334155;--it-bento-control-text:#cbd5e1;--it-bento-ink-bg:#ffffff;--it-bento-ink-text:#0f172a;--it-bento-nav-active-bg:#1e293b;--it-bento-nav-active-text:#ffffff;" + navTokens;
|
|
16177
|
+
const A = '[data-it-appearance="bento"]';
|
|
16178
|
+
tag.textContent = `:root${A}{${light}${shapeLight}${shadowLight}}:root${A}.dark,:root${A} .dark,:root${A} [data-theme="dark"]{${dark}${shadowDark}}:root${A} [data-theme="light"]{${light}${shadowLight}}`;
|
|
16179
|
+
return () => {
|
|
16180
|
+
tag?.remove();
|
|
16181
|
+
};
|
|
16182
|
+
}, [appearance, radius, shadow]);
|
|
16183
|
+
(0, import_react62.useEffect)(() => {
|
|
15070
16184
|
const injectStyles = (obj, prefix = "") => {
|
|
15071
16185
|
Object.entries(obj).forEach(([key, val]) => {
|
|
15072
16186
|
if (typeof val === "object" && val !== null) {
|
|
@@ -16220,14 +17334,14 @@ function ITThemeProvider({
|
|
|
16220
17334
|
const isNested = colorKey.includes(".");
|
|
16221
17335
|
const label = isNested ? colorKey.split(".")[1] : colorKey;
|
|
16222
17336
|
const value = getNestedValue3(palette2, colorKey);
|
|
16223
|
-
return /* @__PURE__ */ (0,
|
|
17337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16224
17338
|
"div",
|
|
16225
17339
|
{
|
|
16226
17340
|
className: "flex items-center justify-between p-3 rounded-xl border border-slate-100 dark:border-slate-800 bg-white dark:bg-slate-900/50 gap-3 hover:border-slate-200 dark:hover:border-slate-700 transition-colors",
|
|
16227
17341
|
children: [
|
|
16228
|
-
/* @__PURE__ */ (0,
|
|
16229
|
-
/* @__PURE__ */ (0,
|
|
16230
|
-
/* @__PURE__ */ (0,
|
|
17342
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
|
|
17343
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "relative w-10 h-10 rounded-xl border-2 border-slate-200 dark:border-slate-700 overflow-hidden cursor-pointer flex-shrink-0 shadow-sm hover:scale-105 transition-transform", children: [
|
|
17344
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16231
17345
|
"input",
|
|
16232
17346
|
{
|
|
16233
17347
|
type: "color",
|
|
@@ -16236,23 +17350,23 @@ function ITThemeProvider({
|
|
|
16236
17350
|
className: "absolute inset-0 opacity-0 cursor-pointer w-full h-full"
|
|
16237
17351
|
}
|
|
16238
17352
|
),
|
|
16239
|
-
/* @__PURE__ */ (0,
|
|
17353
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "w-full h-full", style: { backgroundColor: value } })
|
|
16240
17354
|
] }),
|
|
16241
|
-
/* @__PURE__ */ (0,
|
|
16242
|
-
/* @__PURE__ */ (0,
|
|
16243
|
-
/* @__PURE__ */ (0,
|
|
16244
|
-
/* @__PURE__ */ (0,
|
|
17355
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
17356
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "text-xs font-bold text-slate-700 dark:text-slate-300 truncate capitalize", children: label.replace(/([A-Z])/g, " $1").trim() }),
|
|
17357
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center gap-2 mt-0.5", children: [
|
|
17358
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16245
17359
|
"span",
|
|
16246
17360
|
{
|
|
16247
17361
|
className: "w-3 h-3 rounded-full border border-slate-200 dark:border-slate-600",
|
|
16248
17362
|
style: { backgroundColor: value }
|
|
16249
17363
|
}
|
|
16250
17364
|
),
|
|
16251
|
-
/* @__PURE__ */ (0,
|
|
17365
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "font-mono text-[11px] text-slate-400", children: value })
|
|
16252
17366
|
] })
|
|
16253
17367
|
] })
|
|
16254
17368
|
] }),
|
|
16255
|
-
/* @__PURE__ */ (0,
|
|
17369
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16256
17370
|
"input",
|
|
16257
17371
|
{
|
|
16258
17372
|
type: "text",
|
|
@@ -16271,14 +17385,14 @@ function ITThemeProvider({
|
|
|
16271
17385
|
isCustom
|
|
16272
17386
|
}) => {
|
|
16273
17387
|
const isSelected = JSON.stringify(preset.colors) === JSON.stringify(palette2);
|
|
16274
|
-
return /* @__PURE__ */ (0,
|
|
17388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16275
17389
|
"button",
|
|
16276
17390
|
{
|
|
16277
17391
|
type: "button",
|
|
16278
17392
|
onClick: () => applyPreset(preset.colors),
|
|
16279
17393
|
className: `relative flex flex-col items-start p-2.5 rounded-xl border text-left transition-all group ${isSelected ? "border-primary-500 bg-primary-500/5 shadow-sm ring-1 ring-primary-500/20" : "border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900/50 hover:border-slate-300 dark:hover:border-slate-600"}`,
|
|
16280
17394
|
children: [
|
|
16281
|
-
isCustom && /* @__PURE__ */ (0,
|
|
17395
|
+
isCustom && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16282
17396
|
"span",
|
|
16283
17397
|
{
|
|
16284
17398
|
onClick: (e) => {
|
|
@@ -16287,11 +17401,11 @@ function ITThemeProvider({
|
|
|
16287
17401
|
},
|
|
16288
17402
|
className: "absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 p-0.5 rounded-md hover:bg-danger-500/10 hover:text-danger-500 text-slate-400 dark:text-slate-500 cursor-pointer transition-all z-10",
|
|
16289
17403
|
title: t("themeProvider.designer.deletePreset"),
|
|
16290
|
-
children: /* @__PURE__ */ (0,
|
|
17404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdClose, { size: 12 })
|
|
16291
17405
|
}
|
|
16292
17406
|
),
|
|
16293
|
-
/* @__PURE__ */ (0,
|
|
16294
|
-
/* @__PURE__ */ (0,
|
|
17407
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "text-xs font-semibold truncate w-full mb-1.5 pr-4 text-slate-700 dark:text-slate-300", children: PRESET_I18N_KEY[preset.name] ? t(PRESET_I18N_KEY[preset.name]) : preset.name }),
|
|
17408
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "flex gap-1", children: ["primary", "secondary", "ternary", "success"].map((c) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16295
17409
|
"span",
|
|
16296
17410
|
{
|
|
16297
17411
|
className: "w-3 h-3 rounded-full border border-black/10",
|
|
@@ -16303,7 +17417,7 @@ function ITThemeProvider({
|
|
|
16303
17417
|
}
|
|
16304
17418
|
);
|
|
16305
17419
|
};
|
|
16306
|
-
return /* @__PURE__ */ (0,
|
|
17420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16307
17421
|
ITThemeContext.Provider,
|
|
16308
17422
|
{
|
|
16309
17423
|
value: {
|
|
@@ -16320,28 +17434,28 @@ function ITThemeProvider({
|
|
|
16320
17434
|
},
|
|
16321
17435
|
children: [
|
|
16322
17436
|
children,
|
|
16323
|
-
showFab && /* @__PURE__ */ (0,
|
|
17437
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16324
17438
|
"button",
|
|
16325
17439
|
{
|
|
16326
17440
|
onClick: () => setIsOpen((prev) => !prev),
|
|
16327
17441
|
className: "it-theme-fab it-theme-bounce",
|
|
16328
17442
|
style: { backgroundColor: "var(--color-primary)" },
|
|
16329
17443
|
"aria-label": t("themeProvider.fab.ariaLabel"),
|
|
16330
|
-
children: /* @__PURE__ */ (0,
|
|
17444
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdPalette, { size: 28 })
|
|
16331
17445
|
}
|
|
16332
17446
|
),
|
|
16333
|
-
showFab && /* @__PURE__ */ (0,
|
|
17447
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16334
17448
|
ITDialog,
|
|
16335
17449
|
{
|
|
16336
17450
|
isOpen,
|
|
16337
17451
|
onClose: () => setIsOpen(false),
|
|
16338
17452
|
title: t("themeProvider.designer.title"),
|
|
16339
17453
|
useFormHeader: true,
|
|
16340
|
-
children: /* @__PURE__ */ (0,
|
|
16341
|
-
/* @__PURE__ */ (0,
|
|
16342
|
-
/* @__PURE__ */ (0,
|
|
16343
|
-
/* @__PURE__ */ (0,
|
|
16344
|
-
/* @__PURE__ */ (0,
|
|
17454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex gap-6 h-[580px]", children: [
|
|
17455
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "w-64 flex-shrink-0 flex flex-col gap-5 overflow-y-auto pr-1", children: [
|
|
17456
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17457
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500 mb-2.5 block", children: t("themeProvider.designer.appearance") }),
|
|
17458
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16345
17459
|
ITSegmentedControl,
|
|
16346
17460
|
{
|
|
16347
17461
|
options: [
|
|
@@ -16355,16 +17469,16 @@ function ITThemeProvider({
|
|
|
16355
17469
|
}
|
|
16356
17470
|
)
|
|
16357
17471
|
] }),
|
|
16358
|
-
/* @__PURE__ */ (0,
|
|
16359
|
-
/* @__PURE__ */ (0,
|
|
16360
|
-
/* @__PURE__ */ (0,
|
|
17472
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17473
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "flex items-center justify-between mb-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: t("themeProvider.designer.presets") }) }),
|
|
17474
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "grid grid-cols-2 gap-2", children: PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PresetCard, { preset }, preset.name)) })
|
|
16361
17475
|
] }),
|
|
16362
|
-
customPresets.length > 0 && /* @__PURE__ */ (0,
|
|
16363
|
-
/* @__PURE__ */ (0,
|
|
16364
|
-
/* @__PURE__ */ (0,
|
|
17476
|
+
customPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17477
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500 mb-2.5 block", children: t("themeProvider.designer.myThemes") }),
|
|
17478
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "flex flex-col gap-1.5", children: customPresets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PresetCard, { preset, isCustom: true }, preset.name)) })
|
|
16365
17479
|
] }),
|
|
16366
|
-
isSavingPreset && /* @__PURE__ */ (0,
|
|
16367
|
-
/* @__PURE__ */ (0,
|
|
17480
|
+
isSavingPreset && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900/50", children: [
|
|
17481
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16368
17482
|
ITInput,
|
|
16369
17483
|
{
|
|
16370
17484
|
name: "presetName",
|
|
@@ -16382,8 +17496,8 @@ function ITThemeProvider({
|
|
|
16382
17496
|
}
|
|
16383
17497
|
}
|
|
16384
17498
|
),
|
|
16385
|
-
/* @__PURE__ */ (0,
|
|
16386
|
-
/* @__PURE__ */ (0,
|
|
17499
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex gap-2", children: [
|
|
17500
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16387
17501
|
ITButton,
|
|
16388
17502
|
{
|
|
16389
17503
|
label: t("themeProvider.designer.save"),
|
|
@@ -16394,7 +17508,7 @@ function ITThemeProvider({
|
|
|
16394
17508
|
className: "flex-1"
|
|
16395
17509
|
}
|
|
16396
17510
|
),
|
|
16397
|
-
/* @__PURE__ */ (0,
|
|
17511
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16398
17512
|
ITButton,
|
|
16399
17513
|
{
|
|
16400
17514
|
label: t("themeProvider.designer.cancelSave"),
|
|
@@ -16408,31 +17522,31 @@ function ITThemeProvider({
|
|
|
16408
17522
|
)
|
|
16409
17523
|
] })
|
|
16410
17524
|
] }),
|
|
16411
|
-
!isSavingPreset && /* @__PURE__ */ (0,
|
|
17525
|
+
!isSavingPreset && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16412
17526
|
ITButton,
|
|
16413
17527
|
{
|
|
16414
17528
|
variant: "outlined",
|
|
16415
|
-
icon: /* @__PURE__ */ (0,
|
|
17529
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdPalette, { size: 14 }),
|
|
16416
17530
|
label: t("themeProvider.designer.saveCurrent"),
|
|
16417
17531
|
onClick: () => setIsSavingPreset(true),
|
|
16418
17532
|
size: "sm"
|
|
16419
17533
|
}
|
|
16420
17534
|
),
|
|
16421
|
-
/* @__PURE__ */ (0,
|
|
17535
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16422
17536
|
ITButton,
|
|
16423
17537
|
{
|
|
16424
17538
|
variant: "outlined",
|
|
16425
17539
|
color: "danger",
|
|
16426
|
-
icon: /* @__PURE__ */ (0,
|
|
17540
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdRefresh, { size: 14 }),
|
|
16427
17541
|
label: t("themeProvider.designer.reset"),
|
|
16428
17542
|
onClick: resetTheme,
|
|
16429
17543
|
size: "sm"
|
|
16430
17544
|
}
|
|
16431
17545
|
)
|
|
16432
17546
|
] }),
|
|
16433
|
-
/* @__PURE__ */ (0,
|
|
16434
|
-
/* @__PURE__ */ (0,
|
|
16435
|
-
/* @__PURE__ */ (0,
|
|
17547
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITDivider, { orientation: "vertical" }),
|
|
17548
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
17549
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16436
17550
|
tabs_default,
|
|
16437
17551
|
{
|
|
16438
17552
|
variant: "pill",
|
|
@@ -16440,7 +17554,7 @@ function ITThemeProvider({
|
|
|
16440
17554
|
{
|
|
16441
17555
|
id: "brand",
|
|
16442
17556
|
label: t("themeProvider.tabs.brand"),
|
|
16443
|
-
content: /* @__PURE__ */ (0,
|
|
17557
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
16444
17558
|
"primary",
|
|
16445
17559
|
"secondary",
|
|
16446
17560
|
"ternary",
|
|
@@ -16449,35 +17563,35 @@ function ITThemeProvider({
|
|
|
16449
17563
|
"info",
|
|
16450
17564
|
"alert",
|
|
16451
17565
|
"warning"
|
|
16452
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17566
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16453
17567
|
},
|
|
16454
17568
|
{
|
|
16455
17569
|
id: "layout",
|
|
16456
17570
|
label: t("themeProvider.tabs.layout"),
|
|
16457
|
-
content: /* @__PURE__ */ (0,
|
|
17571
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
16458
17572
|
"layout.sidebarBg",
|
|
16459
17573
|
"layout.sidebarText",
|
|
16460
17574
|
"layout.navbarBg",
|
|
16461
17575
|
"layout.navbarText"
|
|
16462
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17576
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16463
17577
|
},
|
|
16464
17578
|
{
|
|
16465
17579
|
id: "tables",
|
|
16466
17580
|
label: t("themeProvider.tabs.tables"),
|
|
16467
|
-
content: /* @__PURE__ */ (0,
|
|
17581
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
16468
17582
|
"table.headerBg",
|
|
16469
17583
|
"table.headerText",
|
|
16470
17584
|
"table.rowBg",
|
|
16471
17585
|
"table.rowText",
|
|
16472
17586
|
"table.rowHover"
|
|
16473
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17587
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16474
17588
|
}
|
|
16475
17589
|
]
|
|
16476
17590
|
}
|
|
16477
17591
|
),
|
|
16478
|
-
/* @__PURE__ */ (0,
|
|
16479
|
-
/* @__PURE__ */ (0,
|
|
16480
|
-
/* @__PURE__ */ (0,
|
|
17592
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center justify-end gap-3 mt-auto pt-4 border-t border-slate-100 dark:border-slate-800", children: [
|
|
17593
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "p", className: "text-[11px] text-slate-400 mr-auto", children: t("themeProvider.designer.autosave") }),
|
|
17594
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16481
17595
|
ITButton,
|
|
16482
17596
|
{
|
|
16483
17597
|
label: t("themeProvider.designer.close"),
|
|
@@ -16585,13 +17699,16 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16585
17699
|
auditTree,
|
|
16586
17700
|
axzyCatalog,
|
|
16587
17701
|
axzyCatalogTypes,
|
|
17702
|
+
buildNavigationTree,
|
|
16588
17703
|
buildVocabularyContract,
|
|
16589
17704
|
countPendingNodes,
|
|
17705
|
+
createBindingResolver,
|
|
16590
17706
|
createCatalog,
|
|
16591
17707
|
createLimitTracker,
|
|
16592
17708
|
createValidationSchema,
|
|
16593
17709
|
enMessages,
|
|
16594
17710
|
esMessages,
|
|
17711
|
+
flattenRoutes,
|
|
16595
17712
|
formatPath,
|
|
16596
17713
|
formatVocabularyForPrompt,
|
|
16597
17714
|
getCatalogEntry,
|
|
@@ -16602,7 +17719,10 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16602
17719
|
isLightColor,
|
|
16603
17720
|
isNodePending,
|
|
16604
17721
|
issue,
|
|
17722
|
+
joinRoutePath,
|
|
17723
|
+
matchRoute,
|
|
16605
17724
|
migrateSchema,
|
|
17725
|
+
navContainsRoute,
|
|
16606
17726
|
parsePartialSchema,
|
|
16607
17727
|
parsePath,
|
|
16608
17728
|
propPath,
|
|
@@ -16612,16 +17732,20 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16612
17732
|
resolveCssColor,
|
|
16613
17733
|
resolveLimits,
|
|
16614
17734
|
resolveNode,
|
|
17735
|
+
routeHref,
|
|
16615
17736
|
useClickOutside,
|
|
16616
17737
|
useDebouncedSearch,
|
|
16617
17738
|
useEditableRow,
|
|
16618
17739
|
useFloatingPanel,
|
|
17740
|
+
useITAppearance,
|
|
16619
17741
|
useITFlatAppearance,
|
|
16620
17742
|
useITTheme,
|
|
16621
17743
|
useITThemeSafe,
|
|
16622
17744
|
useITTranslation,
|
|
16623
17745
|
useJsonRender,
|
|
17746
|
+
useSchemaStream,
|
|
16624
17747
|
useTableState,
|
|
17748
|
+
validateRoutes,
|
|
16625
17749
|
validateSchema
|
|
16626
17750
|
});
|
|
16627
17751
|
//# sourceMappingURL=index.cjs.map
|