@axzydev/axzy_ui_system 1.7.2 → 1.7.4
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 +1630 -589
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +373 -13
- package/dist/index.d.ts +373 -13
- package/dist/index.js +1346 -314
- 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/flex/flex.props.ts +3 -1
- package/src/components/atoms/flex/flex.tsx +11 -3
- 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 +2 -0
- package/src/components/molecules/card/card.tsx +15 -2
- 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/stat-card/stat-card.props.ts +7 -0
- package/src/components/molecules/stat-card/stat-card.tsx +18 -0
- package/src/components/organisms/dropfile/dropfile.props.ts +8 -2
- package/src/components/organisms/dropfile/dropfile.tsx +17 -0
- package/src/i18n/locales/en.ts +7 -0
- package/src/i18n/locales/es.ts +7 -0
- package/src/index.ts +31 -3
- 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/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/i18n.ts +38 -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/JsonScreenShowcase.tsx +43 -53
- 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/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,6 +141,7 @@ __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,
|
|
@@ -144,7 +151,9 @@ __export(index_exports, {
|
|
|
144
151
|
useITThemeSafe: () => useITThemeSafe,
|
|
145
152
|
useITTranslation: () => useITTranslation,
|
|
146
153
|
useJsonRender: () => useJsonRender_default,
|
|
154
|
+
useSchemaStream: () => useSchemaStream,
|
|
147
155
|
useTableState: () => useTableState,
|
|
156
|
+
validateRoutes: () => validateRoutes,
|
|
148
157
|
validateSchema: () => validateSchema
|
|
149
158
|
});
|
|
150
159
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -476,10 +485,10 @@ function useTableState({
|
|
|
476
485
|
}
|
|
477
486
|
|
|
478
487
|
// src/hooks/useJsonRender.tsx
|
|
479
|
-
var
|
|
488
|
+
var import_react15 = require("react");
|
|
480
489
|
|
|
481
490
|
// src/components/molecules/json-renderer/json-renderer.tsx
|
|
482
|
-
var
|
|
491
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
483
492
|
|
|
484
493
|
// src/types/button.types.ts
|
|
485
494
|
var buttonVariants = {
|
|
@@ -1352,7 +1361,13 @@ var es = {
|
|
|
1352
1361
|
"jsonEditor.kindString": "texto",
|
|
1353
1362
|
"jsonEditor.kindNumber": "n\xFAmero",
|
|
1354
1363
|
"jsonEditor.kindBoolean": "booleano",
|
|
1355
|
-
"jsonEditor.kindNull": "nulo"
|
|
1364
|
+
"jsonEditor.kindNull": "nulo",
|
|
1365
|
+
// ---------------------------------------------------------------- jsonRenderer
|
|
1366
|
+
"jsonRenderer.form.required": "Campo obligatorio.",
|
|
1367
|
+
"jsonRenderer.form.email": "Escribe un correo v\xE1lido.",
|
|
1368
|
+
"jsonRenderer.form.minLength": "Escribe al menos {min} caracteres.",
|
|
1369
|
+
"jsonRenderer.form.maxLength": "Escribe como m\xE1ximo {max} caracteres.",
|
|
1370
|
+
"jsonRenderer.form.submit": "Enviar"
|
|
1356
1371
|
};
|
|
1357
1372
|
var es_default = es;
|
|
1358
1373
|
|
|
@@ -1558,7 +1573,13 @@ var en = {
|
|
|
1558
1573
|
"jsonEditor.kindString": "string",
|
|
1559
1574
|
"jsonEditor.kindNumber": "number",
|
|
1560
1575
|
"jsonEditor.kindBoolean": "boolean",
|
|
1561
|
-
"jsonEditor.kindNull": "null"
|
|
1576
|
+
"jsonEditor.kindNull": "null",
|
|
1577
|
+
// ---------------------------------------------------------------- jsonRenderer
|
|
1578
|
+
"jsonRenderer.form.required": "Required field.",
|
|
1579
|
+
"jsonRenderer.form.email": "Enter a valid email address.",
|
|
1580
|
+
"jsonRenderer.form.minLength": "Enter at least {min} characters.",
|
|
1581
|
+
"jsonRenderer.form.maxLength": "Enter at most {max} characters.",
|
|
1582
|
+
"jsonRenderer.form.submit": "Submit"
|
|
1562
1583
|
};
|
|
1563
1584
|
var en_default = en;
|
|
1564
1585
|
|
|
@@ -1635,6 +1656,7 @@ function useITTranslation() {
|
|
|
1635
1656
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1636
1657
|
function ITCard({
|
|
1637
1658
|
title,
|
|
1659
|
+
headerActions,
|
|
1638
1660
|
image,
|
|
1639
1661
|
alt,
|
|
1640
1662
|
children,
|
|
@@ -1694,14 +1716,24 @@ function ITCard({
|
|
|
1694
1716
|
}
|
|
1695
1717
|
),
|
|
1696
1718
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)(contentClassName), style: bodyStyle, children: [
|
|
1697
|
-
|
|
1719
|
+
headerActions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-3", children: [
|
|
1720
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1721
|
+
ITText,
|
|
1722
|
+
{
|
|
1723
|
+
as: "h3",
|
|
1724
|
+
className: (0, import_clsx2.default)(flat ? "text-base font-semibold" : "text-xl font-semibold", titleClassName),
|
|
1725
|
+
children: title
|
|
1726
|
+
}
|
|
1727
|
+
),
|
|
1728
|
+
headerActions
|
|
1729
|
+
] }) : title ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1698
1730
|
ITText,
|
|
1699
1731
|
{
|
|
1700
1732
|
as: "h3",
|
|
1701
1733
|
className: (0, import_clsx2.default)(flat ? "text-base font-semibold mb-3" : "text-xl font-semibold mb-2", titleClassName),
|
|
1702
1734
|
children: title
|
|
1703
1735
|
}
|
|
1704
|
-
),
|
|
1736
|
+
) : null,
|
|
1705
1737
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ITText, { as: "div", className: "text-secondary-600", children })
|
|
1706
1738
|
] }),
|
|
1707
1739
|
actions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1721,6 +1753,7 @@ function ITCard({
|
|
|
1721
1753
|
|
|
1722
1754
|
// src/components/atoms/flex/flex.tsx
|
|
1723
1755
|
var import_clsx3 = __toESM(require("clsx"), 1);
|
|
1756
|
+
var import_react12 = require("react");
|
|
1724
1757
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1725
1758
|
var directionMap = {
|
|
1726
1759
|
row: "flex-row",
|
|
@@ -1748,7 +1781,7 @@ var wrapMap = {
|
|
|
1748
1781
|
wrap: "flex-wrap",
|
|
1749
1782
|
"wrap-reverse": "flex-wrap-reverse"
|
|
1750
1783
|
};
|
|
1751
|
-
|
|
1784
|
+
var ITFlex = (0, import_react12.forwardRef)(function ITFlex2({
|
|
1752
1785
|
children,
|
|
1753
1786
|
direction = "row",
|
|
1754
1787
|
align,
|
|
@@ -1761,8 +1794,9 @@ function ITFlex({
|
|
|
1761
1794
|
className,
|
|
1762
1795
|
style,
|
|
1763
1796
|
as: Component = "div",
|
|
1764
|
-
onClick
|
|
1765
|
-
|
|
1797
|
+
onClick,
|
|
1798
|
+
onScroll
|
|
1799
|
+
}, ref) {
|
|
1766
1800
|
const resolvedStyle = {
|
|
1767
1801
|
gap: gap > 0 ? `${gap * 0.25}rem` : void 0,
|
|
1768
1802
|
flexGrow: typeof grow === "boolean" ? grow ? 1 : 0 : grow,
|
|
@@ -1773,6 +1807,7 @@ function ITFlex({
|
|
|
1773
1807
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1774
1808
|
Component,
|
|
1775
1809
|
{
|
|
1810
|
+
ref,
|
|
1776
1811
|
className: (0, import_clsx3.default)(
|
|
1777
1812
|
"flex",
|
|
1778
1813
|
directionMap[direction],
|
|
@@ -1783,14 +1818,17 @@ function ITFlex({
|
|
|
1783
1818
|
),
|
|
1784
1819
|
style: resolvedStyle,
|
|
1785
1820
|
onClick,
|
|
1821
|
+
onScroll,
|
|
1786
1822
|
children
|
|
1787
1823
|
}
|
|
1788
1824
|
);
|
|
1789
|
-
}
|
|
1825
|
+
});
|
|
1826
|
+
ITFlex.displayName = "ITFlex";
|
|
1827
|
+
var flex_default = ITFlex;
|
|
1790
1828
|
|
|
1791
1829
|
// src/components/atoms/stack/stack.tsx
|
|
1792
1830
|
var import_clsx4 = __toESM(require("clsx"), 1);
|
|
1793
|
-
var
|
|
1831
|
+
var import_react13 = require("react");
|
|
1794
1832
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1795
1833
|
var directionMap2 = {
|
|
1796
1834
|
row: "flex-row",
|
|
@@ -1831,7 +1869,7 @@ function ITStack({
|
|
|
1831
1869
|
as: Component = "div"
|
|
1832
1870
|
}) {
|
|
1833
1871
|
const hasDivider = divider !== void 0;
|
|
1834
|
-
const items =
|
|
1872
|
+
const items = import_react13.Children.toArray(children);
|
|
1835
1873
|
const resolvedStyle = {
|
|
1836
1874
|
gap: spacing > 0 ? `${spacing * 0.25}rem` : void 0,
|
|
1837
1875
|
...style
|
|
@@ -1848,9 +1886,9 @@ function ITStack({
|
|
|
1848
1886
|
className
|
|
1849
1887
|
),
|
|
1850
1888
|
style: resolvedStyle,
|
|
1851
|
-
children: hasDivider ? items.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1889
|
+
children: hasDivider ? items.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react13.Fragment, { children: [
|
|
1852
1890
|
child,
|
|
1853
|
-
index < items.length - 1 && (0,
|
|
1891
|
+
index < items.length - 1 && (0, import_react13.isValidElement)(divider) ? (0, import_react13.cloneElement)(divider, { key: `divider-${index}` }) : null
|
|
1854
1892
|
] }, index)) : children
|
|
1855
1893
|
}
|
|
1856
1894
|
);
|
|
@@ -1985,11 +2023,11 @@ function ITJsonRenderer({
|
|
|
1985
2023
|
if (typeof node === "string" || typeof node === "number") {
|
|
1986
2024
|
return node;
|
|
1987
2025
|
}
|
|
1988
|
-
if (
|
|
2026
|
+
if (import_react14.default.isValidElement(node)) {
|
|
1989
2027
|
return node;
|
|
1990
2028
|
}
|
|
1991
2029
|
if (Array.isArray(node)) {
|
|
1992
|
-
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2030
|
+
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderNode2(child) }, idx));
|
|
1993
2031
|
}
|
|
1994
2032
|
const { type, props = {}, children, text } = node;
|
|
1995
2033
|
const childContent = children !== void 0 ? renderNode2(children) : text;
|
|
@@ -2001,7 +2039,7 @@ function ITJsonRenderer({
|
|
|
2001
2039
|
case "card":
|
|
2002
2040
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ITCard, { ...props, children: childContent });
|
|
2003
2041
|
case "flex":
|
|
2004
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(flex_default, { ...props, children: childContent });
|
|
2005
2043
|
case "stack":
|
|
2006
2044
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ITStack, { ...props, children: childContent });
|
|
2007
2045
|
case "grid":
|
|
@@ -2014,7 +2052,7 @@ function ITJsonRenderer({
|
|
|
2014
2052
|
}
|
|
2015
2053
|
};
|
|
2016
2054
|
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)(
|
|
2055
|
+
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
2056
|
}
|
|
2019
2057
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children: renderNode2(json) });
|
|
2020
2058
|
}
|
|
@@ -2022,13 +2060,13 @@ function ITJsonRenderer({
|
|
|
2022
2060
|
// src/hooks/useJsonRender.tsx
|
|
2023
2061
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2024
2062
|
function useJsonRender(json) {
|
|
2025
|
-
return (0,
|
|
2063
|
+
return (0, import_react15.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ITJsonRenderer, { json }), [json]);
|
|
2026
2064
|
}
|
|
2027
2065
|
var useJsonRender_default = useJsonRender;
|
|
2028
2066
|
|
|
2029
2067
|
// src/components/molecules/accordion/accordion.tsx
|
|
2030
2068
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
2031
|
-
var
|
|
2069
|
+
var import_react16 = require("react");
|
|
2032
2070
|
var import_fa2 = require("react-icons/fa");
|
|
2033
2071
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2034
2072
|
function ITAccordion({
|
|
@@ -2041,7 +2079,7 @@ function ITAccordion({
|
|
|
2041
2079
|
className,
|
|
2042
2080
|
itemClassName
|
|
2043
2081
|
}) {
|
|
2044
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
2082
|
+
const [internalOpen, setInternalOpen] = (0, import_react16.useState)(defaultOpenIds);
|
|
2045
2083
|
const isControlled = openIds !== void 0;
|
|
2046
2084
|
const currentOpen = isControlled ? openIds : internalOpen;
|
|
2047
2085
|
const toggle = (id) => {
|
|
@@ -2264,7 +2302,7 @@ function ITBreadcrumbs({
|
|
|
2264
2302
|
}
|
|
2265
2303
|
|
|
2266
2304
|
// src/components/molecules/calendar/calendar.tsx
|
|
2267
|
-
var
|
|
2305
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
2268
2306
|
var import_date_fns = require("date-fns");
|
|
2269
2307
|
var import_clsx12 = require("clsx");
|
|
2270
2308
|
var import_tailwind_merge = require("tailwind-merge");
|
|
@@ -2296,8 +2334,8 @@ var ITCalendar = ({
|
|
|
2296
2334
|
}) => {
|
|
2297
2335
|
const { t, dateLocale } = useITTranslation();
|
|
2298
2336
|
const mode = modeProp || (onChange ? "month" : "week");
|
|
2299
|
-
const [currentDate, setCurrentDate] = (0,
|
|
2300
|
-
const [view, setView] = (0,
|
|
2337
|
+
const [currentDate, setCurrentDate] = (0, import_react17.useState)(value || /* @__PURE__ */ new Date());
|
|
2338
|
+
const [view, setView] = (0, import_react17.useState)("calendar");
|
|
2301
2339
|
const getVariantStyles = () => {
|
|
2302
2340
|
const v = variant || "primary";
|
|
2303
2341
|
return {
|
|
@@ -2307,7 +2345,7 @@ var ITCalendar = ({
|
|
|
2307
2345
|
"--calendar-today-text": `var(--color-${v})`
|
|
2308
2346
|
};
|
|
2309
2347
|
};
|
|
2310
|
-
(0,
|
|
2348
|
+
(0, import_react17.useEffect)(() => {
|
|
2311
2349
|
if (value) setCurrentDate(value);
|
|
2312
2350
|
}, [value]);
|
|
2313
2351
|
const shiftYear = (yearDelta) => {
|
|
@@ -2363,7 +2401,7 @@ var ITCalendar = ({
|
|
|
2363
2401
|
setCurrentDate(/* @__PURE__ */ new Date());
|
|
2364
2402
|
setView("calendar");
|
|
2365
2403
|
};
|
|
2366
|
-
const viewDays = (0,
|
|
2404
|
+
const viewDays = (0, import_react17.useMemo)(() => {
|
|
2367
2405
|
if (mode === "day") {
|
|
2368
2406
|
return [currentDate];
|
|
2369
2407
|
}
|
|
@@ -2382,13 +2420,13 @@ var ITCalendar = ({
|
|
|
2382
2420
|
height: `${duration / 60 * 80}px`
|
|
2383
2421
|
};
|
|
2384
2422
|
};
|
|
2385
|
-
const weekEvents = (0,
|
|
2423
|
+
const weekEvents = (0, import_react17.useMemo)(() => {
|
|
2386
2424
|
return events.filter((event) => {
|
|
2387
2425
|
const eventStart = typeof event.start === "string" ? (0, import_date_fns.parseISO)(event.start) : event.start;
|
|
2388
2426
|
return viewDays.some((day) => (0, import_date_fns.isSameDay)(day, eventStart));
|
|
2389
2427
|
});
|
|
2390
2428
|
}, [events, viewDays]);
|
|
2391
|
-
const monthDays = (0,
|
|
2429
|
+
const monthDays = (0, import_react17.useMemo)(() => {
|
|
2392
2430
|
const start = (0, import_date_fns.startOfWeek)((0, import_date_fns.startOfMonth)(currentDate), { weekStartsOn: 1 });
|
|
2393
2431
|
const end = (0, import_date_fns.endOfWeek)((0, import_date_fns.endOfMonth)(currentDate), { weekStartsOn: 1 });
|
|
2394
2432
|
return (0, import_date_fns.eachDayOfInterval)({ start, end });
|
|
@@ -2398,9 +2436,9 @@ var ITCalendar = ({
|
|
|
2398
2436
|
if (maxDate && (0, import_date_fns.isAfter)(date, (0, import_date_fns.startOfDay)(maxDate))) return true;
|
|
2399
2437
|
return false;
|
|
2400
2438
|
};
|
|
2401
|
-
const [dragStart, setDragStart] = (0,
|
|
2402
|
-
const [dragCurrent, setDragCurrent] = (0,
|
|
2403
|
-
const isDraggingRef =
|
|
2439
|
+
const [dragStart, setDragStart] = (0, import_react17.useState)(null);
|
|
2440
|
+
const [dragCurrent, setDragCurrent] = (0, import_react17.useState)(null);
|
|
2441
|
+
const isDraggingRef = import_react17.default.useRef(false);
|
|
2404
2442
|
const handleMouseDown = (date, e) => {
|
|
2405
2443
|
if (!onSelectRange) return;
|
|
2406
2444
|
e.stopPropagation();
|
|
@@ -2984,7 +3022,7 @@ function ITChip({
|
|
|
2984
3022
|
|
|
2985
3023
|
// src/components/molecules/chip-input/chip-input.tsx
|
|
2986
3024
|
var import_clsx16 = __toESM(require("clsx"), 1);
|
|
2987
|
-
var
|
|
3025
|
+
var import_react18 = require("react");
|
|
2988
3026
|
|
|
2989
3027
|
// src/utils/styles.ts
|
|
2990
3028
|
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
@@ -3117,11 +3155,11 @@ function ITChipInput({
|
|
|
3117
3155
|
className
|
|
3118
3156
|
}) {
|
|
3119
3157
|
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,
|
|
3158
|
+
const [inputValue, setInputValue] = (0, import_react18.useState)("");
|
|
3159
|
+
const [localTouched, setLocalTouched] = (0, import_react18.useState)(false);
|
|
3160
|
+
const [localError, setLocalError] = (0, import_react18.useState)(void 0);
|
|
3161
|
+
const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
|
|
3162
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3125
3163
|
const inputTheme = theme.input || {};
|
|
3126
3164
|
const isTouched = touched !== void 0 ? touched : localTouched;
|
|
3127
3165
|
const externalError = error !== void 0 && error !== false ? error === true ? t("field.required") : error : required && value.length === 0 ? t("field.required") : void 0;
|
|
@@ -3262,7 +3300,7 @@ function ITChipInput({
|
|
|
3262
3300
|
|
|
3263
3301
|
// src/components/molecules/dropdown-menu/dropdown-menu.tsx
|
|
3264
3302
|
var import_clsx17 = __toESM(require("clsx"), 1);
|
|
3265
|
-
var
|
|
3303
|
+
var import_react19 = require("react");
|
|
3266
3304
|
var import_react_dom = require("react-dom");
|
|
3267
3305
|
var import_fa6 = require("react-icons/fa");
|
|
3268
3306
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -3278,20 +3316,20 @@ function ITDropdownMenu({
|
|
|
3278
3316
|
}) {
|
|
3279
3317
|
const { t } = useITTranslation();
|
|
3280
3318
|
const resolvedTriggerLabel = triggerLabel ?? t("dropdownMenu.open");
|
|
3281
|
-
const [isOpen, setIsOpen] = (0,
|
|
3282
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3283
|
-
const triggerRef = (0,
|
|
3284
|
-
const itemRefs = (0,
|
|
3319
|
+
const [isOpen, setIsOpen] = (0, import_react19.useState)(false);
|
|
3320
|
+
const [activeIndex, setActiveIndex] = (0, import_react19.useState)(-1);
|
|
3321
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
3322
|
+
const itemRefs = (0, import_react19.useRef)([]);
|
|
3285
3323
|
const { panelRef, style: panelStyle } = useFloatingPanel(triggerRef, isOpen, {
|
|
3286
3324
|
estimatedHeight: Math.max(items.length * 40, 120),
|
|
3287
3325
|
matchWidth: false,
|
|
3288
3326
|
align: placement.endsWith("end") ? "end" : "start"
|
|
3289
3327
|
});
|
|
3290
|
-
const enabledIndexes = (0,
|
|
3328
|
+
const enabledIndexes = (0, import_react19.useMemo)(
|
|
3291
3329
|
() => items.map((item, i) => item.disabled ? -1 : i).filter((i) => i >= 0),
|
|
3292
3330
|
[items]
|
|
3293
3331
|
);
|
|
3294
|
-
(0,
|
|
3332
|
+
(0, import_react19.useEffect)(() => {
|
|
3295
3333
|
if (!isOpen) return;
|
|
3296
3334
|
function handleClickOutside(event) {
|
|
3297
3335
|
const target = event.target;
|
|
@@ -3302,7 +3340,7 @@ function ITDropdownMenu({
|
|
|
3302
3340
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3303
3341
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3304
3342
|
}, [isOpen, panelRef]);
|
|
3305
|
-
(0,
|
|
3343
|
+
(0, import_react19.useEffect)(() => {
|
|
3306
3344
|
if (isOpen) {
|
|
3307
3345
|
setActiveIndex(enabledIndexes[0] ?? -1);
|
|
3308
3346
|
requestAnimationFrame(() => {
|
|
@@ -3475,12 +3513,12 @@ function ITField({
|
|
|
3475
3513
|
}
|
|
3476
3514
|
|
|
3477
3515
|
// src/components/molecules/masked-input/masked-input.tsx
|
|
3478
|
-
var
|
|
3516
|
+
var import_react21 = require("react");
|
|
3479
3517
|
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
3480
3518
|
|
|
3481
3519
|
// src/components/atoms/input/input.tsx
|
|
3482
3520
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
3483
|
-
var
|
|
3521
|
+
var import_react20 = require("react");
|
|
3484
3522
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3485
3523
|
function ITInput({
|
|
3486
3524
|
name,
|
|
@@ -3521,12 +3559,12 @@ function ITInput({
|
|
|
3521
3559
|
const isNumberType = type === "number";
|
|
3522
3560
|
const isTextArea = type === "textarea";
|
|
3523
3561
|
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,
|
|
3562
|
+
const [displayValue, setDisplayValue] = (0, import_react20.useState)("");
|
|
3563
|
+
const [isFocused, setIsFocused] = (0, import_react20.useState)(false);
|
|
3564
|
+
const [hasSelectedAll, setHasSelectedAll] = (0, import_react20.useState)(false);
|
|
3565
|
+
const [showPassword, setShowPassword] = (0, import_react20.useState)(false);
|
|
3566
|
+
const [localTouched, setLocalTouched] = (0, import_react20.useState)(false);
|
|
3567
|
+
const inputRef = (0, import_react20.useRef)(null);
|
|
3530
3568
|
const inputTheme = theme.input || {};
|
|
3531
3569
|
const getStyle = () => {
|
|
3532
3570
|
const style = inputFieldStyle(inputTheme, size);
|
|
@@ -3565,7 +3603,7 @@ function ITInput({
|
|
|
3565
3603
|
setHasSelectedAll(true);
|
|
3566
3604
|
}
|
|
3567
3605
|
};
|
|
3568
|
-
const formatValue = (0,
|
|
3606
|
+
const formatValue = (0, import_react20.useCallback)(
|
|
3569
3607
|
(val) => {
|
|
3570
3608
|
const num = typeof val === "string" ? parseFloat(val.replace(/,/g, "")) : val;
|
|
3571
3609
|
if (num == null || isNaN(num)) {
|
|
@@ -3584,14 +3622,14 @@ function ITInput({
|
|
|
3584
3622
|
},
|
|
3585
3623
|
[currencyFormat, decimalPlaces, formatNumberLocale]
|
|
3586
3624
|
);
|
|
3587
|
-
const unformatValue = (0,
|
|
3625
|
+
const unformatValue = (0, import_react20.useCallback)(
|
|
3588
3626
|
(val) => {
|
|
3589
3627
|
if (val == null) return "";
|
|
3590
3628
|
return String(val).replace(/,/g, "");
|
|
3591
3629
|
},
|
|
3592
3630
|
[]
|
|
3593
3631
|
);
|
|
3594
|
-
(0,
|
|
3632
|
+
(0, import_react20.useEffect)(() => {
|
|
3595
3633
|
if (!isFocused) {
|
|
3596
3634
|
if (isNumberType) {
|
|
3597
3635
|
if (formatNumber) {
|
|
@@ -4061,15 +4099,15 @@ function ITMaskedInput({
|
|
|
4061
4099
|
autoFocus = false
|
|
4062
4100
|
}) {
|
|
4063
4101
|
const { t } = useITTranslation();
|
|
4064
|
-
const containerRef = (0,
|
|
4065
|
-
const rawRef = (0,
|
|
4102
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
4103
|
+
const rawRef = (0, import_react21.useRef)(value ?? "");
|
|
4066
4104
|
const isControlled = value !== void 0;
|
|
4067
|
-
const [internalRaw, setInternalRaw] = (0,
|
|
4068
|
-
const [invalidPattern, setInvalidPattern] = (0,
|
|
4069
|
-
const rules = (0,
|
|
4070
|
-
const tokenCount = (0,
|
|
4105
|
+
const [internalRaw, setInternalRaw] = (0, import_react21.useState)(value ?? "");
|
|
4106
|
+
const [invalidPattern, setInvalidPattern] = (0, import_react21.useState)(false);
|
|
4107
|
+
const rules = (0, import_react21.useMemo)(() => parseMask(mask), [mask]);
|
|
4108
|
+
const tokenCount = (0, import_react21.useMemo)(() => rules.filter((r) => r.type === "token").length, [rules]);
|
|
4071
4109
|
const raw = isControlled ? value ?? "" : internalRaw;
|
|
4072
|
-
const display = (0,
|
|
4110
|
+
const display = (0, import_react21.useMemo)(() => format2(raw, rules, placeholderChar), [raw, rules, placeholderChar]);
|
|
4073
4111
|
const scheduleCaret = (caret) => {
|
|
4074
4112
|
const inputEl = containerRef.current?.querySelector("input");
|
|
4075
4113
|
if (!inputEl) return;
|
|
@@ -4133,7 +4171,7 @@ function ITMaskedInput({
|
|
|
4133
4171
|
|
|
4134
4172
|
// src/components/molecules/multi-select/multi-select.tsx
|
|
4135
4173
|
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4136
|
-
var
|
|
4174
|
+
var import_react22 = require("react");
|
|
4137
4175
|
var import_react_dom2 = require("react-dom");
|
|
4138
4176
|
var import_fa7 = require("react-icons/fa");
|
|
4139
4177
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -4163,32 +4201,32 @@ function ITMultiSelect({
|
|
|
4163
4201
|
className
|
|
4164
4202
|
}) {
|
|
4165
4203
|
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,
|
|
4204
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
4205
|
+
const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
|
|
4206
|
+
const [isFocused, setIsFocused] = (0, import_react22.useState)(false);
|
|
4207
|
+
const [localTouched, setLocalTouched] = (0, import_react22.useState)(false);
|
|
4208
|
+
const [activeIndex, setActiveIndex] = (0, import_react22.useState)(-1);
|
|
4209
|
+
const containerRef = (0, import_react22.useRef)(null);
|
|
4210
|
+
const controlRef = (0, import_react22.useRef)(null);
|
|
4211
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
4212
|
+
const optionRefs = (0, import_react22.useRef)([]);
|
|
4213
|
+
const timeoutRef = (0, import_react22.useRef)(null);
|
|
4176
4214
|
const { panelRef, style: panelStyle } = useFloatingPanel(controlRef, isOpen, {
|
|
4177
4215
|
estimatedHeight: 260,
|
|
4178
4216
|
matchWidth: true
|
|
4179
4217
|
});
|
|
4180
|
-
const selectedOptions = (0,
|
|
4218
|
+
const selectedOptions = (0, import_react22.useMemo)(
|
|
4181
4219
|
() => options.filter((opt) => value.includes(opt[valueField])),
|
|
4182
4220
|
[options, value, valueField]
|
|
4183
4221
|
);
|
|
4184
|
-
const filteredOptions = (0,
|
|
4222
|
+
const filteredOptions = (0, import_react22.useMemo)(() => {
|
|
4185
4223
|
if (onSearch) return options;
|
|
4186
4224
|
if (!searchTerm) return options;
|
|
4187
4225
|
return options.filter(
|
|
4188
4226
|
(opt) => String(opt[labelField]).toLowerCase().includes(searchTerm.toLowerCase())
|
|
4189
4227
|
);
|
|
4190
4228
|
}, [options, searchTerm, onSearch, labelField]);
|
|
4191
|
-
(0,
|
|
4229
|
+
(0, import_react22.useEffect)(() => {
|
|
4192
4230
|
function handleClickOutside(event) {
|
|
4193
4231
|
const target = event.target;
|
|
4194
4232
|
if (!containerRef.current?.contains(target) && !panelRef.current?.contains(target)) {
|
|
@@ -4492,11 +4530,11 @@ function ITConfirmDialog({
|
|
|
4492
4530
|
}
|
|
4493
4531
|
|
|
4494
4532
|
// src/hooks/useElementSize.ts
|
|
4495
|
-
var
|
|
4533
|
+
var import_react23 = require("react");
|
|
4496
4534
|
function useElementSize() {
|
|
4497
|
-
const ref = (0,
|
|
4498
|
-
const [size, setSize] = (0,
|
|
4499
|
-
(0,
|
|
4535
|
+
const ref = (0, import_react23.useRef)(null);
|
|
4536
|
+
const [size, setSize] = (0, import_react23.useState)({ width: 0, height: 0 });
|
|
4537
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
4500
4538
|
const element = ref.current;
|
|
4501
4539
|
if (!element) return;
|
|
4502
4540
|
const update = () => {
|
|
@@ -4512,7 +4550,7 @@ function useElementSize() {
|
|
|
4512
4550
|
}
|
|
4513
4551
|
|
|
4514
4552
|
// src/hooks/useVirtualRows.ts
|
|
4515
|
-
var
|
|
4553
|
+
var import_react24 = require("react");
|
|
4516
4554
|
function useVirtualRows({
|
|
4517
4555
|
count,
|
|
4518
4556
|
rowHeight,
|
|
@@ -4520,15 +4558,15 @@ function useVirtualRows({
|
|
|
4520
4558
|
enabled = true,
|
|
4521
4559
|
resetKey
|
|
4522
4560
|
}) {
|
|
4523
|
-
const scrollRef = (0,
|
|
4524
|
-
const [scrollTop, setScrollTop] = (0,
|
|
4525
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
4526
|
-
const scrollToTop = (0,
|
|
4561
|
+
const scrollRef = (0, import_react24.useRef)(null);
|
|
4562
|
+
const [scrollTop, setScrollTop] = (0, import_react24.useState)(0);
|
|
4563
|
+
const [viewportHeight, setViewportHeight] = (0, import_react24.useState)(0);
|
|
4564
|
+
const scrollToTop = (0, import_react24.useCallback)(() => {
|
|
4527
4565
|
setScrollTop(0);
|
|
4528
4566
|
const element = scrollRef.current;
|
|
4529
4567
|
if (element) element.scrollTop = 0;
|
|
4530
4568
|
}, []);
|
|
4531
|
-
(0,
|
|
4569
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
4532
4570
|
if (!enabled) return;
|
|
4533
4571
|
const element = scrollRef.current;
|
|
4534
4572
|
if (!element) return;
|
|
@@ -4544,7 +4582,7 @@ function useVirtualRows({
|
|
|
4544
4582
|
observer.disconnect();
|
|
4545
4583
|
};
|
|
4546
4584
|
}, [enabled]);
|
|
4547
|
-
(0,
|
|
4585
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
4548
4586
|
if (!enabled) return;
|
|
4549
4587
|
const element = scrollRef.current;
|
|
4550
4588
|
if (element) element.scrollTop = 0;
|
|
@@ -4572,18 +4610,18 @@ function useVirtualRows({
|
|
|
4572
4610
|
|
|
4573
4611
|
// src/components/organisms/data-table/dataTable.tsx
|
|
4574
4612
|
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
4575
|
-
var
|
|
4613
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
4576
4614
|
var import_fa13 = require("react-icons/fa");
|
|
4577
4615
|
var import_md = require("react-icons/md");
|
|
4578
4616
|
|
|
4579
4617
|
// src/components/molecules/pagination/pagination.tsx
|
|
4580
|
-
var
|
|
4618
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
4581
4619
|
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
4582
4620
|
var import_fa10 = require("react-icons/fa");
|
|
4583
4621
|
|
|
4584
4622
|
// src/components/molecules/select/select.tsx
|
|
4585
4623
|
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
4586
|
-
var
|
|
4624
|
+
var import_react25 = require("react");
|
|
4587
4625
|
var import_fa9 = require("react-icons/fa");
|
|
4588
4626
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4589
4627
|
function ITSelect({
|
|
@@ -4605,8 +4643,8 @@ function ITSelect({
|
|
|
4605
4643
|
size = "md"
|
|
4606
4644
|
}) {
|
|
4607
4645
|
const { t } = useITTranslation();
|
|
4608
|
-
const [isFocused, setIsFocused] = (0,
|
|
4609
|
-
const [localTouched, setLocalTouched] = (0,
|
|
4646
|
+
const [isFocused, setIsFocused] = (0, import_react25.useState)(false);
|
|
4647
|
+
const [localTouched, setLocalTouched] = (0, import_react25.useState)(false);
|
|
4610
4648
|
const inputTheme = theme.input || {};
|
|
4611
4649
|
const isTouched = touched !== void 0 ? touched : localTouched;
|
|
4612
4650
|
const isEmpty = value === void 0 || value === null || String(value).trim() === "";
|
|
@@ -4700,7 +4738,7 @@ var usePagination = ({
|
|
|
4700
4738
|
currentPage,
|
|
4701
4739
|
siblingCount = 1
|
|
4702
4740
|
}) => {
|
|
4703
|
-
return
|
|
4741
|
+
return import_react26.default.useMemo(() => {
|
|
4704
4742
|
const totalPageNumbers = siblingCount + 5;
|
|
4705
4743
|
if (totalPageNumbers >= totalPages) {
|
|
4706
4744
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
@@ -4877,7 +4915,7 @@ function ITPagination({
|
|
|
4877
4915
|
}
|
|
4878
4916
|
|
|
4879
4917
|
// src/components/molecules/search-select/search-select.tsx
|
|
4880
|
-
var
|
|
4918
|
+
var import_react27 = require("react");
|
|
4881
4919
|
var import_react_dom3 = require("react-dom");
|
|
4882
4920
|
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
4883
4921
|
var import_fa11 = require("react-icons/fa");
|
|
@@ -4907,26 +4945,26 @@ function ITSearchSelect({
|
|
|
4907
4945
|
onClear
|
|
4908
4946
|
}) {
|
|
4909
4947
|
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,
|
|
4948
|
+
const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
|
|
4949
|
+
const [searchTerm, setSearchTerm] = (0, import_react27.useState)("");
|
|
4950
|
+
const [isFocused, setIsFocused] = (0, import_react27.useState)(false);
|
|
4951
|
+
const [localTouched, setLocalTouched] = (0, import_react27.useState)(false);
|
|
4952
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
4953
|
+
const inputWrapperRef = (0, import_react27.useRef)(null);
|
|
4954
|
+
const timeoutRef = (0, import_react27.useRef)(null);
|
|
4917
4955
|
const { panelRef, style: panelStyle } = useFloatingPanel(inputWrapperRef, isOpen, {
|
|
4918
4956
|
estimatedHeight: 260,
|
|
4919
4957
|
matchWidth: true
|
|
4920
4958
|
});
|
|
4921
|
-
const selectedOption = (0,
|
|
4959
|
+
const selectedOption = (0, import_react27.useMemo)(() => {
|
|
4922
4960
|
return options.find((opt) => opt[valueField] === value);
|
|
4923
4961
|
}, [options, value, valueField]);
|
|
4924
|
-
(0,
|
|
4962
|
+
(0, import_react27.useEffect)(() => {
|
|
4925
4963
|
if (!isFocused) {
|
|
4926
4964
|
setSearchTerm(selectedOption ? String(selectedOption[labelField]) : "");
|
|
4927
4965
|
}
|
|
4928
4966
|
}, [selectedOption, isFocused, labelField]);
|
|
4929
|
-
(0,
|
|
4967
|
+
(0, import_react27.useEffect)(() => {
|
|
4930
4968
|
function handleClickOutside(event) {
|
|
4931
4969
|
const target = event.target;
|
|
4932
4970
|
const inContainer = containerRef.current?.contains(target);
|
|
@@ -4939,7 +4977,7 @@ function ITSearchSelect({
|
|
|
4939
4977
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
4940
4978
|
}, []);
|
|
4941
4979
|
const selectedLabel = selectedOption ? String(selectedOption[labelField]) : "";
|
|
4942
|
-
const filteredOptions = (0,
|
|
4980
|
+
const filteredOptions = (0, import_react27.useMemo)(() => {
|
|
4943
4981
|
if (onSearch) return options;
|
|
4944
4982
|
if (!searchTerm || !isFocused || searchTerm === selectedLabel) return options;
|
|
4945
4983
|
return options.filter(
|
|
@@ -5110,7 +5148,7 @@ function ITSearchSelect({
|
|
|
5110
5148
|
|
|
5111
5149
|
// src/components/molecules/date-picker/datePicker.tsx
|
|
5112
5150
|
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
5113
|
-
var
|
|
5151
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
5114
5152
|
var import_react_dom4 = require("react-dom");
|
|
5115
5153
|
var import_fa12 = require("react-icons/fa");
|
|
5116
5154
|
var import_date_fns2 = require("date-fns");
|
|
@@ -5135,16 +5173,16 @@ function ITDatePicker({
|
|
|
5135
5173
|
range = false
|
|
5136
5174
|
}) {
|
|
5137
5175
|
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,
|
|
5176
|
+
const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
|
|
5177
|
+
const [inputValue, setInputValue] = (0, import_react28.useState)("");
|
|
5178
|
+
const [isValidDate, setIsValidDate] = (0, import_react28.useState)(true);
|
|
5179
|
+
const [internalRange, setInternalRange] = (0, import_react28.useState)([null, null]);
|
|
5180
|
+
const wrapperRef = (0, import_react28.useRef)(null);
|
|
5143
5181
|
const { panelRef, style: panelStyle } = useFloatingPanel(wrapperRef, isOpen, {
|
|
5144
5182
|
estimatedHeight: 360,
|
|
5145
5183
|
matchWidth: false
|
|
5146
5184
|
});
|
|
5147
|
-
const dateRange =
|
|
5185
|
+
const dateRange = import_react28.default.useMemo(() => {
|
|
5148
5186
|
if (range) {
|
|
5149
5187
|
if (Array.isArray(value)) return value;
|
|
5150
5188
|
return internalRange;
|
|
@@ -5152,7 +5190,7 @@ function ITDatePicker({
|
|
|
5152
5190
|
return [value instanceof Date ? value : null, null];
|
|
5153
5191
|
}, [value, range, internalRange]);
|
|
5154
5192
|
const [startDate, endDate] = dateRange;
|
|
5155
|
-
(0,
|
|
5193
|
+
(0, import_react28.useEffect)(() => {
|
|
5156
5194
|
if (range) {
|
|
5157
5195
|
if (startDate && endDate) {
|
|
5158
5196
|
setInputValue(`${formatDate(startDate)} - ${formatDate(endDate)}`);
|
|
@@ -5169,7 +5207,7 @@ function ITDatePicker({
|
|
|
5169
5207
|
}
|
|
5170
5208
|
}
|
|
5171
5209
|
}, [startDate, endDate, range]);
|
|
5172
|
-
(0,
|
|
5210
|
+
(0, import_react28.useEffect)(() => {
|
|
5173
5211
|
const handleClickOutside = (event) => {
|
|
5174
5212
|
const target = event.target;
|
|
5175
5213
|
const inWrapper = wrapperRef.current?.contains(target);
|
|
@@ -5464,11 +5502,11 @@ function ITDataTable({
|
|
|
5464
5502
|
footerStyle
|
|
5465
5503
|
}) {
|
|
5466
5504
|
const { t, locale } = useITTranslation();
|
|
5467
|
-
const [viewMode, setViewMode] = (0,
|
|
5505
|
+
const [viewMode, setViewMode] = (0, import_react29.useState)(defaultView || "table");
|
|
5468
5506
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
5469
|
-
const [data, setData] = (0,
|
|
5470
|
-
const [totalItems, setTotalItems] = (0,
|
|
5471
|
-
const [isLoading, setIsLoading] = (0,
|
|
5507
|
+
const [data, setData] = (0, import_react29.useState)([]);
|
|
5508
|
+
const [totalItems, setTotalItems] = (0, import_react29.useState)(0);
|
|
5509
|
+
const [isLoading, setIsLoading] = (0, import_react29.useState)(fetchOnMount);
|
|
5472
5510
|
const colorVars = {
|
|
5473
5511
|
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
5474
5512
|
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
@@ -5489,7 +5527,7 @@ function ITDataTable({
|
|
|
5489
5527
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
5490
5528
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
5491
5529
|
const columnCount = columns.length;
|
|
5492
|
-
const pinnedMeta =
|
|
5530
|
+
const pinnedMeta = import_react29.default.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
5493
5531
|
const scrollOuterClass = isTableVirtual ? "relative min-h-[200px]" : "overflow-x-auto relative min-h-[200px]";
|
|
5494
5532
|
const {
|
|
5495
5533
|
currentPage,
|
|
@@ -5515,15 +5553,15 @@ function ITDataTable({
|
|
|
5515
5553
|
resetKey: `${currentPage}-${itemsPerPage}`
|
|
5516
5554
|
});
|
|
5517
5555
|
const windowData = isTableVirtual ? data.slice(startIndex, endIndex + 1) : data;
|
|
5518
|
-
const debounceTimerRef = (0,
|
|
5519
|
-
const hasFetchedRef = (0,
|
|
5520
|
-
const fetchDataRef = (0,
|
|
5556
|
+
const debounceTimerRef = (0, import_react29.useRef)(null);
|
|
5557
|
+
const hasFetchedRef = (0, import_react29.useRef)(false);
|
|
5558
|
+
const fetchDataRef = (0, import_react29.useRef)(fetchData);
|
|
5521
5559
|
fetchDataRef.current = fetchData;
|
|
5522
|
-
const externalFiltersRef = (0,
|
|
5560
|
+
const externalFiltersRef = (0, import_react29.useRef)(externalFilters);
|
|
5523
5561
|
externalFiltersRef.current = externalFilters;
|
|
5524
5562
|
const externalKey = JSON.stringify(externalFilters);
|
|
5525
5563
|
const computedTotalPages = Math.ceil(totalItems / itemsPerPage) || 1;
|
|
5526
|
-
const performFetch = (0,
|
|
5564
|
+
const performFetch = (0, import_react29.useCallback)(async () => {
|
|
5527
5565
|
setIsLoading(true);
|
|
5528
5566
|
try {
|
|
5529
5567
|
const response = await fetchDataRef.current({
|
|
@@ -5544,9 +5582,9 @@ function ITDataTable({
|
|
|
5544
5582
|
setIsLoading(false);
|
|
5545
5583
|
}
|
|
5546
5584
|
}, [currentPage, itemsPerPage, filters, sortConfig]);
|
|
5547
|
-
const performFetchRef = (0,
|
|
5585
|
+
const performFetchRef = (0, import_react29.useRef)(performFetch);
|
|
5548
5586
|
performFetchRef.current = performFetch;
|
|
5549
|
-
(0,
|
|
5587
|
+
(0, import_react29.useEffect)(() => {
|
|
5550
5588
|
if (!fetchOnMount && !hasFetchedRef.current) return;
|
|
5551
5589
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
5552
5590
|
debounceTimerRef.current = setTimeout(() => {
|
|
@@ -5985,7 +6023,7 @@ function ITDataTable({
|
|
|
5985
6023
|
|
|
5986
6024
|
// src/components/organisms/dialog/dialog.tsx
|
|
5987
6025
|
var import_react_dom5 = require("react-dom");
|
|
5988
|
-
var
|
|
6026
|
+
var import_react30 = require("react");
|
|
5989
6027
|
var import_fa15 = require("react-icons/fa");
|
|
5990
6028
|
|
|
5991
6029
|
// src/components/molecules/form-header/form-header.tsx
|
|
@@ -6111,9 +6149,9 @@ function ITDialog({
|
|
|
6111
6149
|
padded = true
|
|
6112
6150
|
}) {
|
|
6113
6151
|
const { t } = useITTranslation();
|
|
6114
|
-
const modalRef = (0,
|
|
6152
|
+
const modalRef = (0, import_react30.useRef)(null);
|
|
6115
6153
|
useClickOutside_default(modalRef, onClose);
|
|
6116
|
-
(0,
|
|
6154
|
+
(0, import_react30.useEffect)(() => {
|
|
6117
6155
|
const handleEscape = (event) => {
|
|
6118
6156
|
if (event.key === "Escape") {
|
|
6119
6157
|
onClose();
|
|
@@ -6195,7 +6233,7 @@ function ITDivider({
|
|
|
6195
6233
|
// src/components/organisms/drawer/drawer.tsx
|
|
6196
6234
|
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
6197
6235
|
var import_fa16 = require("react-icons/fa");
|
|
6198
|
-
var
|
|
6236
|
+
var import_react31 = require("react");
|
|
6199
6237
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6200
6238
|
function ITDrawer({
|
|
6201
6239
|
isOpen,
|
|
@@ -6208,7 +6246,7 @@ function ITDrawer({
|
|
|
6208
6246
|
style
|
|
6209
6247
|
}) {
|
|
6210
6248
|
const { t } = useITTranslation();
|
|
6211
|
-
const panelRef = (0,
|
|
6249
|
+
const panelRef = (0, import_react31.useRef)(null);
|
|
6212
6250
|
useClickOutside_default(panelRef, onClose);
|
|
6213
6251
|
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
6252
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm transition-opacity" }),
|
|
@@ -6263,36 +6301,36 @@ function ITEmptyState({
|
|
|
6263
6301
|
}
|
|
6264
6302
|
|
|
6265
6303
|
// src/components/organisms/form-builder/formBuilder.tsx
|
|
6266
|
-
var
|
|
6304
|
+
var import_react36 = require("react");
|
|
6267
6305
|
|
|
6268
6306
|
// src/components/organisms/form-builder/formBuilder.context.tsx
|
|
6269
|
-
var
|
|
6307
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
6270
6308
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6271
|
-
var ITFormBuilderContext = (0,
|
|
6309
|
+
var ITFormBuilderContext = (0, import_react32.createContext)(void 0);
|
|
6272
6310
|
var ITFormBuilderProvider = ({
|
|
6273
6311
|
children,
|
|
6274
6312
|
value
|
|
6275
6313
|
}) => {
|
|
6276
|
-
const [fieldRegistry, setFieldRegistry] = (0,
|
|
6277
|
-
const registerField =
|
|
6314
|
+
const [fieldRegistry, setFieldRegistry] = (0, import_react32.useState)({});
|
|
6315
|
+
const registerField = import_react32.default.useCallback((name, config2) => {
|
|
6278
6316
|
setFieldRegistry((prev) => ({ ...prev, [name]: config2 }));
|
|
6279
6317
|
}, []);
|
|
6280
|
-
const unregisterField =
|
|
6318
|
+
const unregisterField = import_react32.default.useCallback((name) => {
|
|
6281
6319
|
setFieldRegistry((prev) => {
|
|
6282
6320
|
const next = { ...prev };
|
|
6283
6321
|
delete next[name];
|
|
6284
6322
|
return next;
|
|
6285
6323
|
});
|
|
6286
6324
|
}, []);
|
|
6287
|
-
const getFieldConfig =
|
|
6325
|
+
const getFieldConfig = import_react32.default.useCallback(
|
|
6288
6326
|
(name) => fieldRegistry[name],
|
|
6289
6327
|
[fieldRegistry]
|
|
6290
6328
|
);
|
|
6291
|
-
const getAllFieldConfigs =
|
|
6329
|
+
const getAllFieldConfigs = import_react32.default.useCallback(
|
|
6292
6330
|
() => Object.values(fieldRegistry),
|
|
6293
6331
|
[fieldRegistry]
|
|
6294
6332
|
);
|
|
6295
|
-
const contextValue =
|
|
6333
|
+
const contextValue = import_react32.default.useMemo(
|
|
6296
6334
|
() => ({
|
|
6297
6335
|
...value,
|
|
6298
6336
|
registerField,
|
|
@@ -6305,7 +6343,7 @@ var ITFormBuilderProvider = ({
|
|
|
6305
6343
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ITFormBuilderContext.Provider, { value: contextValue, children });
|
|
6306
6344
|
};
|
|
6307
6345
|
var useITFormBuilderContext = () => {
|
|
6308
|
-
const context = (0,
|
|
6346
|
+
const context = (0, import_react32.useContext)(ITFormBuilderContext);
|
|
6309
6347
|
if (!context) {
|
|
6310
6348
|
throw new Error("useITFormBuilderContext must be used within an ITFormBuilderProvider");
|
|
6311
6349
|
}
|
|
@@ -6313,12 +6351,12 @@ var useITFormBuilderContext = () => {
|
|
|
6313
6351
|
};
|
|
6314
6352
|
|
|
6315
6353
|
// src/components/organisms/form-builder/fieldRenderer.tsx
|
|
6316
|
-
var
|
|
6354
|
+
var import_react35 = require("react");
|
|
6317
6355
|
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
6318
6356
|
|
|
6319
6357
|
// src/components/molecules/time-picker/timePicker.tsx
|
|
6320
6358
|
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
6321
|
-
var
|
|
6359
|
+
var import_react33 = require("react");
|
|
6322
6360
|
var import_react_dom6 = require("react-dom");
|
|
6323
6361
|
var import_fa18 = require("react-icons/fa");
|
|
6324
6362
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -6339,12 +6377,12 @@ function ITTimePicker({
|
|
|
6339
6377
|
color = "primary"
|
|
6340
6378
|
}) {
|
|
6341
6379
|
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,
|
|
6380
|
+
const [isOpen, setIsOpen] = (0, import_react33.useState)(false);
|
|
6381
|
+
const [inputValue, setInputValue] = (0, import_react33.useState)(value || "");
|
|
6382
|
+
const [isValidTime, setIsValidTime] = (0, import_react33.useState)(true);
|
|
6383
|
+
const wrapperRef = (0, import_react33.useRef)(null);
|
|
6384
|
+
const hoursRef = (0, import_react33.useRef)(null);
|
|
6385
|
+
const minutesRef = (0, import_react33.useRef)(null);
|
|
6348
6386
|
const { panelRef: dropdownRef, style: panelStyle } = useFloatingPanel(
|
|
6349
6387
|
wrapperRef,
|
|
6350
6388
|
isOpen && !disabled,
|
|
@@ -6358,7 +6396,7 @@ function ITTimePicker({
|
|
|
6358
6396
|
const isThemeColor = color in theme.colors;
|
|
6359
6397
|
const highlightColor = isThemeColor ? theme.colors[color][50] : "#f3f4f6";
|
|
6360
6398
|
const activeColor = isThemeColor ? theme.colors[color][100] : "#e5e7eb";
|
|
6361
|
-
(0,
|
|
6399
|
+
(0, import_react33.useEffect)(() => {
|
|
6362
6400
|
setInputValue(value || "");
|
|
6363
6401
|
}, [value]);
|
|
6364
6402
|
const validateTime = (timeString) => {
|
|
@@ -6367,7 +6405,7 @@ function ITTimePicker({
|
|
|
6367
6405
|
};
|
|
6368
6406
|
const currentHour = validateTime(inputValue) ? inputValue.split(":")[0] : null;
|
|
6369
6407
|
const currentMinute = validateTime(inputValue) ? inputValue.split(":")[1] : null;
|
|
6370
|
-
(0,
|
|
6408
|
+
(0, import_react33.useEffect)(() => {
|
|
6371
6409
|
if (isOpen) {
|
|
6372
6410
|
setTimeout(() => {
|
|
6373
6411
|
if (hoursRef.current && currentHour) {
|
|
@@ -6574,26 +6612,26 @@ function ITTimePicker({
|
|
|
6574
6612
|
}
|
|
6575
6613
|
|
|
6576
6614
|
// src/components/organisms/form-builder/useFormBuilder.ts
|
|
6577
|
-
var
|
|
6615
|
+
var import_react34 = require("react");
|
|
6578
6616
|
var useFieldRules = (config2, dependentValues) => {
|
|
6579
6617
|
const { getFieldConfig } = useITFormBuilderContext();
|
|
6580
6618
|
const fieldConfig = getFieldConfig(config2.name) || config2;
|
|
6581
|
-
const isVisible = (0,
|
|
6619
|
+
const isVisible = (0, import_react34.useMemo)(() => {
|
|
6582
6620
|
if (!fieldConfig.renderWhen) return true;
|
|
6583
6621
|
return fieldConfig.renderWhen(dependentValues);
|
|
6584
6622
|
}, [fieldConfig, dependentValues]);
|
|
6585
|
-
const dynamicProps = (0,
|
|
6623
|
+
const dynamicProps = (0, import_react34.useMemo)(() => {
|
|
6586
6624
|
if (!fieldConfig.dynamicProps) return {};
|
|
6587
6625
|
return fieldConfig.dynamicProps(dependentValues);
|
|
6588
6626
|
}, [fieldConfig, dependentValues]);
|
|
6589
|
-
const isRequired = (0,
|
|
6627
|
+
const isRequired = (0, import_react34.useMemo)(() => {
|
|
6590
6628
|
if (typeof dynamicProps.required !== "undefined") return dynamicProps.required;
|
|
6591
6629
|
if (typeof fieldConfig.required === "function") {
|
|
6592
6630
|
return fieldConfig.required(dependentValues);
|
|
6593
6631
|
}
|
|
6594
6632
|
return !!fieldConfig.required;
|
|
6595
6633
|
}, [fieldConfig, dynamicProps.required, dependentValues]);
|
|
6596
|
-
const isDisabled = (0,
|
|
6634
|
+
const isDisabled = (0, import_react34.useMemo)(() => {
|
|
6597
6635
|
if (typeof dynamicProps.disabled !== "undefined") return dynamicProps.disabled;
|
|
6598
6636
|
if (typeof fieldConfig.disabled === "function") {
|
|
6599
6637
|
return fieldConfig.disabled(dependentValues);
|
|
@@ -6607,11 +6645,11 @@ var useFieldRules = (config2, dependentValues) => {
|
|
|
6607
6645
|
var import_fa19 = require("react-icons/fa");
|
|
6608
6646
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6609
6647
|
function useAsyncOptions(options, deps) {
|
|
6610
|
-
const [resolved, setResolved] = (0,
|
|
6611
|
-
const [loading, setLoading] = (0,
|
|
6612
|
-
const optionsRef = (0,
|
|
6648
|
+
const [resolved, setResolved] = (0, import_react35.useState)([]);
|
|
6649
|
+
const [loading, setLoading] = (0, import_react35.useState)(false);
|
|
6650
|
+
const optionsRef = (0, import_react35.useRef)(options);
|
|
6613
6651
|
optionsRef.current = options;
|
|
6614
|
-
(0,
|
|
6652
|
+
(0, import_react35.useEffect)(() => {
|
|
6615
6653
|
const opts = optionsRef.current;
|
|
6616
6654
|
let cancelled = false;
|
|
6617
6655
|
if (typeof opts === "function") {
|
|
@@ -6655,13 +6693,13 @@ var ITFieldRenderer = ({
|
|
|
6655
6693
|
config2,
|
|
6656
6694
|
dependentValues
|
|
6657
6695
|
);
|
|
6658
|
-
(0,
|
|
6696
|
+
(0, import_react35.useEffect)(() => {
|
|
6659
6697
|
context.registerField(config2.name, config2);
|
|
6660
6698
|
return () => {
|
|
6661
6699
|
context.unregisterField(config2.name);
|
|
6662
6700
|
};
|
|
6663
6701
|
}, [config2.name]);
|
|
6664
|
-
const activeConfig = (0,
|
|
6702
|
+
const activeConfig = (0, import_react35.useMemo)(
|
|
6665
6703
|
() => ({
|
|
6666
6704
|
...config2,
|
|
6667
6705
|
...dynamicProps,
|
|
@@ -6687,7 +6725,7 @@ var ITFieldRenderer = ({
|
|
|
6687
6725
|
options,
|
|
6688
6726
|
[options, dependentValues]
|
|
6689
6727
|
);
|
|
6690
|
-
const handleChangeWrapper = (0,
|
|
6728
|
+
const handleChangeWrapper = (0, import_react35.useCallback)(
|
|
6691
6729
|
async (val) => {
|
|
6692
6730
|
const finalValue = val && typeof val === "object" && "target" in val ? val.target.value : val;
|
|
6693
6731
|
await context.setFieldValue(name, finalValue);
|
|
@@ -6898,7 +6936,7 @@ var ITFieldRenderer = ({
|
|
|
6898
6936
|
}
|
|
6899
6937
|
);
|
|
6900
6938
|
};
|
|
6901
|
-
var fieldRenderer_default = (0,
|
|
6939
|
+
var fieldRenderer_default = (0, import_react35.memo)(ITFieldRenderer);
|
|
6902
6940
|
|
|
6903
6941
|
// src/components/organisms/form-builder/formBuilder.tsx
|
|
6904
6942
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -6929,7 +6967,7 @@ function ITFormBuilder({
|
|
|
6929
6967
|
isSubmitting = false,
|
|
6930
6968
|
children
|
|
6931
6969
|
}) {
|
|
6932
|
-
const providerValue = (0,
|
|
6970
|
+
const providerValue = (0, import_react36.useMemo)(
|
|
6933
6971
|
() => ({
|
|
6934
6972
|
config: config2 || [],
|
|
6935
6973
|
values: values || {},
|
|
@@ -7081,7 +7119,7 @@ function ITFormBuilder({
|
|
|
7081
7119
|
}
|
|
7082
7120
|
|
|
7083
7121
|
// src/components/atoms/image/image.tsx
|
|
7084
|
-
var
|
|
7122
|
+
var import_react37 = require("react");
|
|
7085
7123
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7086
7124
|
var ITImage = ({
|
|
7087
7125
|
src,
|
|
@@ -7090,7 +7128,7 @@ var ITImage = ({
|
|
|
7090
7128
|
fallback = "",
|
|
7091
7129
|
fit = "cover"
|
|
7092
7130
|
}) => {
|
|
7093
|
-
const [imageError, setImageError] = (0,
|
|
7131
|
+
const [imageError, setImageError] = (0, import_react37.useState)(false);
|
|
7094
7132
|
const { t } = useITTranslation();
|
|
7095
7133
|
const handleImageError = () => {
|
|
7096
7134
|
setImageError(true);
|
|
@@ -7165,7 +7203,7 @@ function ITInputNumber({
|
|
|
7165
7203
|
}
|
|
7166
7204
|
|
|
7167
7205
|
// src/components/organisms/navbar/navbar.tsx
|
|
7168
|
-
var
|
|
7206
|
+
var import_react38 = require("react");
|
|
7169
7207
|
var import_fa20 = require("react-icons/fa");
|
|
7170
7208
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7171
7209
|
function ITNavbar({
|
|
@@ -7181,9 +7219,9 @@ function ITNavbar({
|
|
|
7181
7219
|
sidebarItems
|
|
7182
7220
|
}) {
|
|
7183
7221
|
const { t } = useITTranslation();
|
|
7184
|
-
const [isUserMenuOpen, setIsUserMenuOpen] = (0,
|
|
7185
|
-
const [expandedItems, setExpandedItems] = (0,
|
|
7186
|
-
const userMenuRef = (0,
|
|
7222
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = (0, import_react38.useState)(false);
|
|
7223
|
+
const [expandedItems, setExpandedItems] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
|
|
7224
|
+
const userMenuRef = (0, import_react38.useRef)(null);
|
|
7187
7225
|
useClickOutside_default(userMenuRef, () => setIsUserMenuOpen(false));
|
|
7188
7226
|
const toggleUserMenu = () => {
|
|
7189
7227
|
setIsUserMenuOpen(!isUserMenuOpen);
|
|
@@ -7618,7 +7656,7 @@ function ITPage(props) {
|
|
|
7618
7656
|
}
|
|
7619
7657
|
|
|
7620
7658
|
// src/components/atoms/popover/popover.tsx
|
|
7621
|
-
var
|
|
7659
|
+
var import_react39 = require("react");
|
|
7622
7660
|
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
7623
7661
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7624
7662
|
var positionClasses = {
|
|
@@ -7635,10 +7673,10 @@ function ITPopover({
|
|
|
7635
7673
|
onClose,
|
|
7636
7674
|
className
|
|
7637
7675
|
}) {
|
|
7638
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
7676
|
+
const [internalOpen, setInternalOpen] = (0, import_react39.useState)(false);
|
|
7639
7677
|
const isControlled = controlledOpen !== void 0;
|
|
7640
7678
|
const open = isControlled ? controlledOpen : internalOpen;
|
|
7641
|
-
const ref = (0,
|
|
7679
|
+
const ref = (0, import_react39.useRef)(null);
|
|
7642
7680
|
useClickOutside_default(ref, () => {
|
|
7643
7681
|
if (isControlled) onClose?.();
|
|
7644
7682
|
else setInternalOpen(false);
|
|
@@ -7766,7 +7804,7 @@ function ITRadioGroup({
|
|
|
7766
7804
|
|
|
7767
7805
|
// src/components/organisms/searchTable/searchTable.tsx
|
|
7768
7806
|
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
7769
|
-
var
|
|
7807
|
+
var import_react40 = require("react");
|
|
7770
7808
|
|
|
7771
7809
|
// src/components/organisms/searchTable/components/SearchInput.tsx
|
|
7772
7810
|
var import_fa22 = require("react-icons/fa");
|
|
@@ -8257,7 +8295,7 @@ function ITSearchTable({
|
|
|
8257
8295
|
onCancel
|
|
8258
8296
|
}) {
|
|
8259
8297
|
const { t } = useITTranslation();
|
|
8260
|
-
const [itemsPerPage, setItemsPerPage] = (0,
|
|
8298
|
+
const [itemsPerPage, setItemsPerPage] = (0, import_react40.useState)(defaultItemsPerPage);
|
|
8261
8299
|
const { searchTerm, handleSearchChange, handleClearSearch } = useDebouncedSearch({
|
|
8262
8300
|
initialValue: searchTermInitial,
|
|
8263
8301
|
onSearch: (value) => {
|
|
@@ -8423,7 +8461,7 @@ function ITSegmentedControl({
|
|
|
8423
8461
|
}
|
|
8424
8462
|
|
|
8425
8463
|
// src/components/organisms/sidebar/sidebar.tsx
|
|
8426
|
-
var
|
|
8464
|
+
var import_react41 = require("react");
|
|
8427
8465
|
var import_clsx41 = __toESM(require("clsx"), 1);
|
|
8428
8466
|
var import_fa26 = require("react-icons/fa");
|
|
8429
8467
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
@@ -8464,12 +8502,12 @@ function ITSidebar({
|
|
|
8464
8502
|
}) {
|
|
8465
8503
|
const flat = useITFlatAppearance();
|
|
8466
8504
|
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,
|
|
8505
|
+
const [expandedItems, setExpandedItems] = (0, import_react41.useState)(/* @__PURE__ */ new Set());
|
|
8506
|
+
const [isHovering, setIsHovering] = (0, import_react41.useState)(false);
|
|
8507
|
+
const sidebarRef = (0, import_react41.useRef)(null);
|
|
8508
|
+
const hoverTimeoutRef = (0, import_react41.useRef)(null);
|
|
8509
|
+
const leaveTimeoutRef = (0, import_react41.useRef)(null);
|
|
8510
|
+
(0, import_react41.useEffect)(() => {
|
|
8473
8511
|
const hoverTimer = hoverTimeoutRef.current;
|
|
8474
8512
|
const leaveTimer = leaveTimeoutRef.current;
|
|
8475
8513
|
const handleMouseEnter = () => {
|
|
@@ -8496,7 +8534,7 @@ function ITSidebar({
|
|
|
8496
8534
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
8497
8535
|
};
|
|
8498
8536
|
}, [isCollapsed]);
|
|
8499
|
-
(0,
|
|
8537
|
+
(0, import_react41.useEffect)(() => {
|
|
8500
8538
|
const activeParents = /* @__PURE__ */ new Set();
|
|
8501
8539
|
navigationItems.forEach((item) => {
|
|
8502
8540
|
if (item.subitems && flattenSubItems(item.subitems).some((sub) => sub.isActive)) {
|
|
@@ -8911,7 +8949,7 @@ function ITSidebar({
|
|
|
8911
8949
|
}
|
|
8912
8950
|
|
|
8913
8951
|
// src/components/atoms/slide/slide.tsx
|
|
8914
|
-
var
|
|
8952
|
+
var import_react42 = require("react");
|
|
8915
8953
|
var import_clsx42 = __toESM(require("clsx"), 1);
|
|
8916
8954
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8917
8955
|
function ITSlideToggle({
|
|
@@ -8928,8 +8966,8 @@ function ITSlideToggle({
|
|
|
8928
8966
|
className = ""
|
|
8929
8967
|
}) {
|
|
8930
8968
|
const isControlled = controlledIsOn !== void 0;
|
|
8931
|
-
const [internalIsOn, setInternalIsOn] = (0,
|
|
8932
|
-
(0,
|
|
8969
|
+
const [internalIsOn, setInternalIsOn] = (0, import_react42.useState)(initialState);
|
|
8970
|
+
(0, import_react42.useEffect)(() => {
|
|
8933
8971
|
if (isControlled) {
|
|
8934
8972
|
setInternalIsOn(controlledIsOn);
|
|
8935
8973
|
}
|
|
@@ -9064,6 +9102,9 @@ function ITStatCard({
|
|
|
9064
9102
|
value,
|
|
9065
9103
|
trend,
|
|
9066
9104
|
trendDirection = trend && trend.startsWith("-") ? "down" : "neutral",
|
|
9105
|
+
hint,
|
|
9106
|
+
progress,
|
|
9107
|
+
progressColor = "primary",
|
|
9067
9108
|
icon,
|
|
9068
9109
|
color = "bg-primary-50 dark:bg-primary-950/20",
|
|
9069
9110
|
className,
|
|
@@ -9092,14 +9133,25 @@ function ITStatCard({
|
|
|
9092
9133
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-baseline gap-2", children: [
|
|
9093
9134
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ITText, { as: "span", className: "text-2xl font-bold text-slate-800 dark:text-white", children: value }),
|
|
9094
9135
|
trend && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ITText, { as: "span", className: (0, import_clsx44.default)("text-[11px] font-semibold px-1.5 py-0.5 rounded-md", trendColors[trendDirection]), children: trend })
|
|
9095
|
-
] })
|
|
9136
|
+
] }),
|
|
9137
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ITText, { as: "p", className: "mt-1 text-[11px] leading-snug text-slate-500 dark:text-slate-400", children: hint }),
|
|
9138
|
+
progress !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9139
|
+
ITProgress,
|
|
9140
|
+
{
|
|
9141
|
+
value: progress,
|
|
9142
|
+
max: 100,
|
|
9143
|
+
color: progressColor,
|
|
9144
|
+
size: "sm",
|
|
9145
|
+
className: "mt-2"
|
|
9146
|
+
}
|
|
9147
|
+
)
|
|
9096
9148
|
]
|
|
9097
9149
|
}
|
|
9098
9150
|
);
|
|
9099
9151
|
}
|
|
9100
9152
|
|
|
9101
9153
|
// src/components/molecules/line-bar-chart/line-bar-chart.tsx
|
|
9102
|
-
var
|
|
9154
|
+
var import_react43 = require("react");
|
|
9103
9155
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
9104
9156
|
function ITLineBarChart({
|
|
9105
9157
|
data,
|
|
@@ -9108,6 +9160,8 @@ function ITLineBarChart({
|
|
|
9108
9160
|
barLabel,
|
|
9109
9161
|
lineColor = "#10b981",
|
|
9110
9162
|
barColor = "#3b82f6",
|
|
9163
|
+
showLine = true,
|
|
9164
|
+
showBars = true,
|
|
9111
9165
|
height = 240,
|
|
9112
9166
|
formatValue,
|
|
9113
9167
|
formatAxis,
|
|
@@ -9118,15 +9172,18 @@ function ITLineBarChart({
|
|
|
9118
9172
|
const resolvedBarLabel = barLabel ?? t("lineBarChart.barLabel");
|
|
9119
9173
|
const resolvedFormatAxis = formatAxis ?? ((value) => formatNumber(value, { notation: "compact", maximumFractionDigits: 1 }));
|
|
9120
9174
|
const resolvedFormatValue = formatValue ?? ((value) => formatNumber(value));
|
|
9121
|
-
const gradientId = (0,
|
|
9122
|
-
const [hover, setHover] = (0,
|
|
9175
|
+
const gradientId = (0, import_react43.useId)().replace(/[:]/g, "");
|
|
9176
|
+
const [hover, setHover] = (0, import_react43.useState)(null);
|
|
9123
9177
|
const width = 720;
|
|
9124
9178
|
const padding = { top: 16, right: 16, bottom: 28, left: 52 };
|
|
9125
9179
|
const plotWidth = width - padding.left - padding.right;
|
|
9126
9180
|
const plotHeight = height - padding.top - padding.bottom;
|
|
9127
|
-
const max = (0,
|
|
9128
|
-
() => Math.max(
|
|
9129
|
-
|
|
9181
|
+
const max = (0, import_react43.useMemo)(
|
|
9182
|
+
() => Math.max(
|
|
9183
|
+
...data.flatMap((d) => [showLine ? d.line : 0, showBars ? d.bar : 0]),
|
|
9184
|
+
1
|
|
9185
|
+
),
|
|
9186
|
+
[data, showLine, showBars]
|
|
9130
9187
|
);
|
|
9131
9188
|
const gridValues = [0, 0.25, 0.5, 0.75, 1].map((f) => max * f);
|
|
9132
9189
|
const step = data.length > 0 ? plotWidth / data.length : plotWidth;
|
|
@@ -9170,7 +9227,7 @@ function ITLineBarChart({
|
|
|
9170
9227
|
),
|
|
9171
9228
|
/* @__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)) })
|
|
9172
9229
|
] }, i)),
|
|
9173
|
-
data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9230
|
+
showBars && data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9174
9231
|
"rect",
|
|
9175
9232
|
{
|
|
9176
9233
|
x: x(i) - barWidth / 2,
|
|
@@ -9183,8 +9240,8 @@ function ITLineBarChart({
|
|
|
9183
9240
|
},
|
|
9184
9241
|
`bar-${d.label}`
|
|
9185
9242
|
)),
|
|
9186
|
-
areaPath && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: areaPath, fill: `url(#area-${gradientId})` }),
|
|
9187
|
-
data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9243
|
+
showLine && areaPath && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: areaPath, fill: `url(#area-${gradientId})` }),
|
|
9244
|
+
showLine && data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9188
9245
|
"polyline",
|
|
9189
9246
|
{
|
|
9190
9247
|
points: linePoints,
|
|
@@ -9195,7 +9252,7 @@ function ITLineBarChart({
|
|
|
9195
9252
|
strokeLinejoin: "round"
|
|
9196
9253
|
}
|
|
9197
9254
|
),
|
|
9198
|
-
data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9255
|
+
showLine && data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9199
9256
|
"circle",
|
|
9200
9257
|
{
|
|
9201
9258
|
cx: x(i),
|
|
@@ -9222,12 +9279,12 @@ function ITLineBarChart({
|
|
|
9222
9279
|
role: "status",
|
|
9223
9280
|
children: [
|
|
9224
9281
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-[10px] font-semibold", style: { color: "#e2e8f0" }, children: active.label }),
|
|
9225
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
9282
|
+
showLine && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
9226
9283
|
resolvedLineLabel,
|
|
9227
9284
|
": ",
|
|
9228
9285
|
resolvedFormatValue(active.line)
|
|
9229
9286
|
] }),
|
|
9230
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
9287
|
+
showBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
9231
9288
|
resolvedBarLabel,
|
|
9232
9289
|
": ",
|
|
9233
9290
|
resolvedFormatValue(active.bar)
|
|
@@ -9236,11 +9293,11 @@ function ITLineBarChart({
|
|
|
9236
9293
|
}
|
|
9237
9294
|
),
|
|
9238
9295
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("ul", { className: "flex flex-wrap items-center gap-4 text-[11px]", style: { color: "#475569" }, children: [
|
|
9239
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9296
|
+
showLine && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9240
9297
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "h-2.5 w-2.5 rounded-sm", style: { background: lineColor }, "aria-hidden": true }),
|
|
9241
9298
|
resolvedLineLabel
|
|
9242
9299
|
] }),
|
|
9243
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9300
|
+
showBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { children: [
|
|
9244
9301
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "h-2.5 w-2.5 rounded-sm", style: { background: barColor }, "aria-hidden": true }),
|
|
9245
9302
|
resolvedBarLabel
|
|
9246
9303
|
] })
|
|
@@ -9251,7 +9308,7 @@ var line_bar_chart_default = ITLineBarChart;
|
|
|
9251
9308
|
|
|
9252
9309
|
// src/components/molecules/table/table.tsx
|
|
9253
9310
|
var import_clsx45 = __toESM(require("clsx"), 1);
|
|
9254
|
-
var
|
|
9311
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
9255
9312
|
var import_fa27 = require("react-icons/fa");
|
|
9256
9313
|
var import_md2 = require("react-icons/md");
|
|
9257
9314
|
var import_date_fns3 = require("date-fns");
|
|
@@ -9300,7 +9357,7 @@ function ITTable({
|
|
|
9300
9357
|
footerStyle
|
|
9301
9358
|
}) {
|
|
9302
9359
|
const { t, locale } = useITTranslation();
|
|
9303
|
-
const [viewMode, setViewMode] = (0,
|
|
9360
|
+
const [viewMode, setViewMode] = (0, import_react44.useState)(defaultView);
|
|
9304
9361
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
9305
9362
|
const colorVars = {
|
|
9306
9363
|
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
@@ -9328,7 +9385,7 @@ function ITTable({
|
|
|
9328
9385
|
handleSort,
|
|
9329
9386
|
handleItemsPerPageChange
|
|
9330
9387
|
} = useTableState({ defaultItemsPerPage });
|
|
9331
|
-
const sortedData =
|
|
9388
|
+
const sortedData = import_react44.default.useMemo(() => {
|
|
9332
9389
|
const safeData = Array.isArray(data) ? data : [];
|
|
9333
9390
|
if (!sortConfig) return safeData;
|
|
9334
9391
|
return [...safeData].sort((a, b) => {
|
|
@@ -9418,7 +9475,7 @@ function ITTable({
|
|
|
9418
9475
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
9419
9476
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
9420
9477
|
const columnCount = columns.length;
|
|
9421
|
-
const pinnedMeta =
|
|
9478
|
+
const pinnedMeta = import_react44.default.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
9422
9479
|
const {
|
|
9423
9480
|
scrollRef,
|
|
9424
9481
|
startIndex,
|
|
@@ -9883,6 +9940,7 @@ function ITTable({
|
|
|
9883
9940
|
|
|
9884
9941
|
// src/components/atoms/textarea/textarea.tsx
|
|
9885
9942
|
var import_clsx46 = __toESM(require("clsx"), 1);
|
|
9943
|
+
var import_react45 = require("react");
|
|
9886
9944
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
9887
9945
|
var resizeMap = {
|
|
9888
9946
|
none: "resize-none",
|
|
@@ -9890,7 +9948,7 @@ var resizeMap = {
|
|
|
9890
9948
|
horizontal: "resize-x",
|
|
9891
9949
|
both: "resize"
|
|
9892
9950
|
};
|
|
9893
|
-
|
|
9951
|
+
var ITTextarea = (0, import_react45.forwardRef)(function ITTextarea2({
|
|
9894
9952
|
value,
|
|
9895
9953
|
onChange,
|
|
9896
9954
|
label,
|
|
@@ -9901,13 +9959,16 @@ function ITTextarea({
|
|
|
9901
9959
|
className,
|
|
9902
9960
|
name,
|
|
9903
9961
|
maxLength,
|
|
9904
|
-
resize = "vertical"
|
|
9905
|
-
|
|
9962
|
+
resize = "vertical",
|
|
9963
|
+
onKeyDown,
|
|
9964
|
+
autoFocus = false
|
|
9965
|
+
}, ref) {
|
|
9906
9966
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: (0, import_clsx46.default)("flex flex-col gap-1.5", className), children: [
|
|
9907
9967
|
label && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ITText, { as: "label", className: inputLabel(!!error), htmlFor: name, children: label }),
|
|
9908
9968
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
9909
9969
|
"textarea",
|
|
9910
9970
|
{
|
|
9971
|
+
ref,
|
|
9911
9972
|
id: name,
|
|
9912
9973
|
name,
|
|
9913
9974
|
value,
|
|
@@ -9916,6 +9977,8 @@ function ITTextarea({
|
|
|
9916
9977
|
rows,
|
|
9917
9978
|
disabled,
|
|
9918
9979
|
maxLength,
|
|
9980
|
+
onKeyDown,
|
|
9981
|
+
autoFocus,
|
|
9919
9982
|
className: (0, import_clsx46.default)(
|
|
9920
9983
|
"w-full border border-solid transition-all duration-200 rounded-lg px-3 py-2 text-sm outline-none",
|
|
9921
9984
|
"focus:ring-2",
|
|
@@ -9927,10 +9990,12 @@ function ITTextarea({
|
|
|
9927
9990
|
),
|
|
9928
9991
|
error && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ITText, { as: "span", className: inputError, children: error })
|
|
9929
9992
|
] });
|
|
9930
|
-
}
|
|
9993
|
+
});
|
|
9994
|
+
ITTextarea.displayName = "ITTextarea";
|
|
9995
|
+
var textarea_default = ITTextarea;
|
|
9931
9996
|
|
|
9932
9997
|
// src/components/molecules/tabs/tabs.tsx
|
|
9933
|
-
var
|
|
9998
|
+
var import_react46 = require("react");
|
|
9934
9999
|
var import_clsx47 = require("clsx");
|
|
9935
10000
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9936
10001
|
var ITTabs = ({
|
|
@@ -9941,7 +10006,7 @@ var ITTabs = ({
|
|
|
9941
10006
|
className = "",
|
|
9942
10007
|
containerClassName = ""
|
|
9943
10008
|
}) => {
|
|
9944
|
-
const [activeId, setActiveId] = (0,
|
|
10009
|
+
const [activeId, setActiveId] = (0, import_react46.useState)(defaultActiveId || items[0]?.id);
|
|
9945
10010
|
const handleTabClick = (id, disabled) => {
|
|
9946
10011
|
if (disabled) return;
|
|
9947
10012
|
setActiveId(id);
|
|
@@ -10041,7 +10106,7 @@ var positionStyles = {
|
|
|
10041
10106
|
|
|
10042
10107
|
// src/components/organisms/toast/toast.tsx
|
|
10043
10108
|
var import_clsx49 = __toESM(require("clsx"), 1);
|
|
10044
|
-
var
|
|
10109
|
+
var import_react47 = require("react");
|
|
10045
10110
|
var import_fa28 = require("react-icons/fa");
|
|
10046
10111
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10047
10112
|
function ITToast({
|
|
@@ -10052,8 +10117,8 @@ function ITToast({
|
|
|
10052
10117
|
onClose
|
|
10053
10118
|
}) {
|
|
10054
10119
|
const { t } = useITTranslation();
|
|
10055
|
-
const [isVisible, setIsVisible] = (0,
|
|
10056
|
-
(0,
|
|
10120
|
+
const [isVisible, setIsVisible] = (0, import_react47.useState)(true);
|
|
10121
|
+
(0, import_react47.useEffect)(() => {
|
|
10057
10122
|
const timer = setTimeout(() => {
|
|
10058
10123
|
setIsVisible(false);
|
|
10059
10124
|
setTimeout(() => {
|
|
@@ -10119,7 +10184,7 @@ function ITToast({
|
|
|
10119
10184
|
}
|
|
10120
10185
|
|
|
10121
10186
|
// src/components/molecules/wysiwyg/wysiwyg.tsx
|
|
10122
|
-
var
|
|
10187
|
+
var import_react49 = require("react");
|
|
10123
10188
|
var import_clsx51 = __toESM(require("clsx"), 1);
|
|
10124
10189
|
var import_fa29 = require("react-icons/fa");
|
|
10125
10190
|
|
|
@@ -10135,7 +10200,7 @@ var toolbarActions = [
|
|
|
10135
10200
|
];
|
|
10136
10201
|
|
|
10137
10202
|
// src/components/atoms/tooltip/tooltip.tsx
|
|
10138
|
-
var
|
|
10203
|
+
var import_react48 = require("react");
|
|
10139
10204
|
var import_clsx50 = __toESM(require("clsx"), 1);
|
|
10140
10205
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10141
10206
|
var positionClasses2 = {
|
|
@@ -10157,7 +10222,7 @@ function ITTooltip({
|
|
|
10157
10222
|
delay = 200,
|
|
10158
10223
|
className
|
|
10159
10224
|
}) {
|
|
10160
|
-
const [visible, setVisible] = (0,
|
|
10225
|
+
const [visible, setVisible] = (0, import_react48.useState)(false);
|
|
10161
10226
|
let timeout;
|
|
10162
10227
|
const handleMouseEnter = () => {
|
|
10163
10228
|
timeout = setTimeout(() => setVisible(true), delay);
|
|
@@ -10220,12 +10285,12 @@ function ITWysiwyg({
|
|
|
10220
10285
|
className
|
|
10221
10286
|
}) {
|
|
10222
10287
|
const { t } = useITTranslation();
|
|
10223
|
-
const editorRef = (0,
|
|
10224
|
-
const focusedRef = (0,
|
|
10225
|
-
const [active, setActive] = (0,
|
|
10288
|
+
const editorRef = (0, import_react49.useRef)(null);
|
|
10289
|
+
const focusedRef = (0, import_react49.useRef)(false);
|
|
10290
|
+
const [active, setActive] = (0, import_react49.useState)({});
|
|
10226
10291
|
const isLocked = disabled || readOnly;
|
|
10227
10292
|
const sizeConfig = inputSizeTokens[size] ?? inputSizeTokens.md;
|
|
10228
|
-
const findAncestor = (0,
|
|
10293
|
+
const findAncestor = (0, import_react49.useCallback)(
|
|
10229
10294
|
(node, predicate) => {
|
|
10230
10295
|
const editor = editorRef.current;
|
|
10231
10296
|
if (!editor) return null;
|
|
@@ -10238,7 +10303,7 @@ function ITWysiwyg({
|
|
|
10238
10303
|
},
|
|
10239
10304
|
[]
|
|
10240
10305
|
);
|
|
10241
|
-
const isInlineTag = (0,
|
|
10306
|
+
const isInlineTag = (0, import_react49.useCallback)((el, tag) => {
|
|
10242
10307
|
if (tag === "STRONG" || tag === "B") {
|
|
10243
10308
|
return el.tagName === "STRONG" || el.tagName === "B";
|
|
10244
10309
|
}
|
|
@@ -10247,7 +10312,7 @@ function ITWysiwyg({
|
|
|
10247
10312
|
}
|
|
10248
10313
|
return el.tagName === tag;
|
|
10249
10314
|
}, []);
|
|
10250
|
-
const getTextNodesInRange = (0,
|
|
10315
|
+
const getTextNodesInRange = (0, import_react49.useCallback)((range) => {
|
|
10251
10316
|
const editor = editorRef.current;
|
|
10252
10317
|
if (!editor) return [];
|
|
10253
10318
|
const out = [];
|
|
@@ -10258,7 +10323,7 @@ function ITWysiwyg({
|
|
|
10258
10323
|
}
|
|
10259
10324
|
return out;
|
|
10260
10325
|
}, []);
|
|
10261
|
-
const placeCaretAtEnd = (0,
|
|
10326
|
+
const placeCaretAtEnd = (0, import_react49.useCallback)((target) => {
|
|
10262
10327
|
const editor = editorRef.current;
|
|
10263
10328
|
const sel = window.getSelection();
|
|
10264
10329
|
if (!editor || !sel) return;
|
|
@@ -10269,11 +10334,11 @@ function ITWysiwyg({
|
|
|
10269
10334
|
sel.addRange(range);
|
|
10270
10335
|
if (document.activeElement !== editor) editor.focus();
|
|
10271
10336
|
}, []);
|
|
10272
|
-
const emitChange = (0,
|
|
10337
|
+
const emitChange = (0, import_react49.useCallback)(() => {
|
|
10273
10338
|
const editor = editorRef.current;
|
|
10274
10339
|
if (editor) onChange?.(editor.innerHTML);
|
|
10275
10340
|
}, [onChange]);
|
|
10276
|
-
const updateActive = (0,
|
|
10341
|
+
const updateActive = (0, import_react49.useCallback)(() => {
|
|
10277
10342
|
const editor = editorRef.current;
|
|
10278
10343
|
const sel = window.getSelection();
|
|
10279
10344
|
const node = sel?.anchorNode ?? null;
|
|
@@ -10292,13 +10357,13 @@ function ITWysiwyg({
|
|
|
10292
10357
|
(prev) => JSON.stringify(prev) === JSON.stringify(next) ? prev : next
|
|
10293
10358
|
);
|
|
10294
10359
|
}, [findAncestor, isInlineTag]);
|
|
10295
|
-
const unwrapElement = (0,
|
|
10360
|
+
const unwrapElement = (0, import_react49.useCallback)((el) => {
|
|
10296
10361
|
const parent = el.parentNode;
|
|
10297
10362
|
if (!parent) return;
|
|
10298
10363
|
while (el.firstChild) parent.insertBefore(el.firstChild, el);
|
|
10299
10364
|
el.remove();
|
|
10300
10365
|
}, []);
|
|
10301
|
-
const applyInline = (0,
|
|
10366
|
+
const applyInline = (0, import_react49.useCallback)(
|
|
10302
10367
|
(tag, prepare) => {
|
|
10303
10368
|
const editor = editorRef.current;
|
|
10304
10369
|
const sel = window.getSelection();
|
|
@@ -10380,7 +10445,7 @@ function ITWysiwyg({
|
|
|
10380
10445
|
updateActive
|
|
10381
10446
|
]
|
|
10382
10447
|
);
|
|
10383
|
-
const normalizeBlocks = (0,
|
|
10448
|
+
const normalizeBlocks = (0, import_react49.useCallback)(() => {
|
|
10384
10449
|
const editor = editorRef.current;
|
|
10385
10450
|
if (!editor) return;
|
|
10386
10451
|
const children = Array.from(editor.childNodes);
|
|
@@ -10402,7 +10467,7 @@ function ITWysiwyg({
|
|
|
10402
10467
|
}
|
|
10403
10468
|
flush();
|
|
10404
10469
|
}, []);
|
|
10405
|
-
const convertLiToDiv = (0,
|
|
10470
|
+
const convertLiToDiv = (0, import_react49.useCallback)((li) => {
|
|
10406
10471
|
const list = li.parentElement;
|
|
10407
10472
|
if (!list || !list.parentNode) return;
|
|
10408
10473
|
const div = document.createElement("div");
|
|
@@ -10410,20 +10475,20 @@ function ITWysiwyg({
|
|
|
10410
10475
|
list.parentNode.insertBefore(div, list);
|
|
10411
10476
|
li.remove();
|
|
10412
10477
|
}, []);
|
|
10413
|
-
const cleanupEmptyLists = (0,
|
|
10478
|
+
const cleanupEmptyLists = (0, import_react49.useCallback)(() => {
|
|
10414
10479
|
const editor = editorRef.current;
|
|
10415
10480
|
if (!editor) return;
|
|
10416
10481
|
editor.querySelectorAll("ul, ol").forEach((list) => {
|
|
10417
10482
|
if (!list.querySelector("li")) list.remove();
|
|
10418
10483
|
});
|
|
10419
10484
|
}, []);
|
|
10420
|
-
const retagList = (0,
|
|
10485
|
+
const retagList = (0, import_react49.useCallback)((list, type) => {
|
|
10421
10486
|
if (!list.parentNode) return;
|
|
10422
10487
|
const nl = document.createElement(type);
|
|
10423
10488
|
while (list.firstChild) nl.appendChild(list.firstChild);
|
|
10424
10489
|
list.parentNode.replaceChild(nl, list);
|
|
10425
10490
|
}, []);
|
|
10426
|
-
const toggleList = (0,
|
|
10491
|
+
const toggleList = (0, import_react49.useCallback)(
|
|
10427
10492
|
(type) => {
|
|
10428
10493
|
const editor = editorRef.current;
|
|
10429
10494
|
const sel = window.getSelection();
|
|
@@ -10521,7 +10586,7 @@ function ITWysiwyg({
|
|
|
10521
10586
|
updateActive
|
|
10522
10587
|
]
|
|
10523
10588
|
);
|
|
10524
|
-
const clearFormatting = (0,
|
|
10589
|
+
const clearFormatting = (0, import_react49.useCallback)(() => {
|
|
10525
10590
|
const editor = editorRef.current;
|
|
10526
10591
|
const sel = window.getSelection();
|
|
10527
10592
|
if (!editor || !sel || sel.rangeCount === 0) return;
|
|
@@ -10555,7 +10620,7 @@ function ITWysiwyg({
|
|
|
10555
10620
|
emitChange,
|
|
10556
10621
|
updateActive
|
|
10557
10622
|
]);
|
|
10558
|
-
(0,
|
|
10623
|
+
(0, import_react49.useEffect)(() => {
|
|
10559
10624
|
const editor = editorRef.current;
|
|
10560
10625
|
if (!editor) return;
|
|
10561
10626
|
if (!focusedRef.current) {
|
|
@@ -10563,7 +10628,7 @@ function ITWysiwyg({
|
|
|
10563
10628
|
if (editor.innerHTML !== next) editor.innerHTML = next;
|
|
10564
10629
|
}
|
|
10565
10630
|
}, [value]);
|
|
10566
|
-
(0,
|
|
10631
|
+
(0, import_react49.useEffect)(() => {
|
|
10567
10632
|
const onSelectionChange = () => {
|
|
10568
10633
|
const editor = editorRef.current;
|
|
10569
10634
|
const sel = window.getSelection();
|
|
@@ -10702,12 +10767,12 @@ function ITWysiwyg({
|
|
|
10702
10767
|
}
|
|
10703
10768
|
|
|
10704
10769
|
// src/components/molecules/json-editor/json-editor.tsx
|
|
10705
|
-
var
|
|
10770
|
+
var import_react52 = require("react");
|
|
10706
10771
|
var import_clsx53 = __toESM(require("clsx"), 1);
|
|
10707
10772
|
var import_fa31 = require("react-icons/fa");
|
|
10708
10773
|
|
|
10709
10774
|
// src/components/molecules/json-editor/json-editor-tree.tsx
|
|
10710
|
-
var
|
|
10775
|
+
var import_react50 = require("react");
|
|
10711
10776
|
var import_clsx52 = __toESM(require("clsx"), 1);
|
|
10712
10777
|
var import_fa30 = require("react-icons/fa");
|
|
10713
10778
|
|
|
@@ -11192,9 +11257,9 @@ function ITCodeTreeView({
|
|
|
11192
11257
|
className
|
|
11193
11258
|
}) {
|
|
11194
11259
|
const { t } = useITTranslation();
|
|
11195
|
-
const root = (0,
|
|
11196
|
-
const [collapsed, setCollapsed] = (0,
|
|
11197
|
-
const rows = (0,
|
|
11260
|
+
const root = (0, import_react50.useMemo)(() => buildTree(value, "", [], 0), [value]);
|
|
11261
|
+
const [collapsed, setCollapsed] = (0, import_react50.useState)({});
|
|
11262
|
+
const rows = (0, import_react50.useMemo)(() => {
|
|
11198
11263
|
const result = [];
|
|
11199
11264
|
const isOpen = (node) => {
|
|
11200
11265
|
const explicit = collapsed[node.key];
|
|
@@ -11302,7 +11367,7 @@ function kindLabel(kind, t) {
|
|
|
11302
11367
|
}
|
|
11303
11368
|
|
|
11304
11369
|
// src/components/molecules/json-editor/useJsonEditorKeyboard.ts
|
|
11305
|
-
var
|
|
11370
|
+
var import_react51 = require("react");
|
|
11306
11371
|
var PAIRS = { "{": "}", "[": "]", '"': '"' };
|
|
11307
11372
|
var CLOSERS2 = /* @__PURE__ */ new Set(["}", "]", '"']);
|
|
11308
11373
|
function useJsonEditorKeyboard({
|
|
@@ -11311,7 +11376,7 @@ function useJsonEditorKeyboard({
|
|
|
11311
11376
|
readOnly = false,
|
|
11312
11377
|
applyEdit
|
|
11313
11378
|
}) {
|
|
11314
|
-
return (0,
|
|
11379
|
+
return (0, import_react51.useCallback)(
|
|
11315
11380
|
(event) => {
|
|
11316
11381
|
const textarea = textareaRef.current;
|
|
11317
11382
|
if (!textarea || readOnly) return;
|
|
@@ -11556,34 +11621,34 @@ function ITJSONEditor({
|
|
|
11556
11621
|
errorLine
|
|
11557
11622
|
}) {
|
|
11558
11623
|
const { t, formatNumber } = useITTranslation();
|
|
11559
|
-
const [viewMode, setViewMode] = (0,
|
|
11560
|
-
const [wrapLines, setWrapLines] = (0,
|
|
11561
|
-
const [indentSize, setIndentSize] = (0,
|
|
11562
|
-
const [withNumbers, setWithNumbers] = (0,
|
|
11563
|
-
const [withFolds, setWithFolds] = (0,
|
|
11564
|
-
const [copied, setCopied] = (0,
|
|
11565
|
-
const [foldedStarts, setFoldedStarts] = (0,
|
|
11566
|
-
const [caretLine, setCaretLine] = (0,
|
|
11567
|
-
const [lineHeight, setLineHeight] = (0,
|
|
11568
|
-
const [notice, setNotice] = (0,
|
|
11569
|
-
const canvasRef = (0,
|
|
11570
|
-
const textareaRef = (0,
|
|
11571
|
-
const highlightRef = (0,
|
|
11572
|
-
const fileInputRef = (0,
|
|
11573
|
-
const pendingSelection = (0,
|
|
11574
|
-
const editorId = (0,
|
|
11575
|
-
(0,
|
|
11624
|
+
const [viewMode, setViewMode] = (0, import_react52.useState)(mode ?? "text");
|
|
11625
|
+
const [wrapLines, setWrapLines] = (0, import_react52.useState)(wrapLinesProp);
|
|
11626
|
+
const [indentSize, setIndentSize] = (0, import_react52.useState)(Math.min(8, Math.max(0, indentSizeProp)));
|
|
11627
|
+
const [withNumbers, setWithNumbers] = (0, import_react52.useState)(showLineNumbers);
|
|
11628
|
+
const [withFolds, setWithFolds] = (0, import_react52.useState)(showFoldGutter);
|
|
11629
|
+
const [copied, setCopied] = (0, import_react52.useState)(false);
|
|
11630
|
+
const [foldedStarts, setFoldedStarts] = (0, import_react52.useState)([]);
|
|
11631
|
+
const [caretLine, setCaretLine] = (0, import_react52.useState)(1);
|
|
11632
|
+
const [lineHeight, setLineHeight] = (0, import_react52.useState)(21);
|
|
11633
|
+
const [notice, setNotice] = (0, import_react52.useState)(null);
|
|
11634
|
+
const canvasRef = (0, import_react52.useRef)(null);
|
|
11635
|
+
const textareaRef = (0, import_react52.useRef)(null);
|
|
11636
|
+
const highlightRef = (0, import_react52.useRef)(null);
|
|
11637
|
+
const fileInputRef = (0, import_react52.useRef)(null);
|
|
11638
|
+
const pendingSelection = (0, import_react52.useRef)(null);
|
|
11639
|
+
const editorId = (0, import_react52.useId)();
|
|
11640
|
+
(0, import_react52.useEffect)(() => {
|
|
11576
11641
|
if (mode !== void 0) setViewMode(mode);
|
|
11577
11642
|
}, [mode]);
|
|
11578
|
-
(0,
|
|
11643
|
+
(0, import_react52.useEffect)(() => {
|
|
11579
11644
|
setWrapLines(wrapLinesProp);
|
|
11580
11645
|
}, [wrapLinesProp]);
|
|
11581
|
-
(0,
|
|
11646
|
+
(0, import_react52.useEffect)(() => {
|
|
11582
11647
|
setIndentSize(Math.min(8, Math.max(0, indentSizeProp)));
|
|
11583
11648
|
}, [indentSizeProp]);
|
|
11584
|
-
const analysis = (0,
|
|
11585
|
-
const folds = (0,
|
|
11586
|
-
const validation = (0,
|
|
11649
|
+
const analysis = (0, import_react52.useMemo)(() => analyzeCode(value), [value]);
|
|
11650
|
+
const folds = (0, import_react52.useMemo)(() => findFoldRegions(value), [value]);
|
|
11651
|
+
const validation = (0, import_react52.useMemo)(() => {
|
|
11587
11652
|
if (!value.trim()) {
|
|
11588
11653
|
return {
|
|
11589
11654
|
isValid: true,
|
|
@@ -11601,37 +11666,37 @@ function ITJSONEditor({
|
|
|
11601
11666
|
};
|
|
11602
11667
|
}
|
|
11603
11668
|
}, [value, analysis.lineStarts]);
|
|
11604
|
-
(0,
|
|
11669
|
+
(0, import_react52.useEffect)(() => {
|
|
11605
11670
|
onParse?.(validation.parsed, validation.isValid, validation.error?.message);
|
|
11606
11671
|
}, [validation, onParse]);
|
|
11607
|
-
const foldedRegions = (0,
|
|
11672
|
+
const foldedRegions = (0, import_react52.useMemo)(() => {
|
|
11608
11673
|
if (!foldedStarts.length || !folds.length) return [];
|
|
11609
11674
|
return folds.filter((region) => foldedStarts.includes(region.startLine));
|
|
11610
11675
|
}, [folds, foldedStarts]);
|
|
11611
|
-
const hiddenLines = (0,
|
|
11676
|
+
const hiddenLines = (0, import_react52.useMemo)(() => {
|
|
11612
11677
|
const hidden = /* @__PURE__ */ new Set();
|
|
11613
11678
|
for (const region of foldedRegions) {
|
|
11614
11679
|
for (let line = region.startLine + 1; line <= region.endLine; line++) hidden.add(line);
|
|
11615
11680
|
}
|
|
11616
11681
|
return hidden;
|
|
11617
11682
|
}, [foldedRegions]);
|
|
11618
|
-
const closedByStart = (0,
|
|
11683
|
+
const closedByStart = (0, import_react52.useMemo)(() => {
|
|
11619
11684
|
const map = /* @__PURE__ */ new Map();
|
|
11620
11685
|
for (const region of foldedRegions) map.set(region.startLine, region.endLine);
|
|
11621
11686
|
return map;
|
|
11622
11687
|
}, [foldedRegions]);
|
|
11623
|
-
const visibleLines = (0,
|
|
11688
|
+
const visibleLines = (0, import_react52.useMemo)(
|
|
11624
11689
|
() => analysis.lines.filter((line) => !hiddenLines.has(line.number)),
|
|
11625
11690
|
[analysis.lines, hiddenLines]
|
|
11626
11691
|
);
|
|
11627
11692
|
const lineStarts = analysis.lineStarts;
|
|
11628
|
-
const nodeCount = (0,
|
|
11629
|
-
const maxDepth = (0,
|
|
11693
|
+
const nodeCount = (0, import_react52.useMemo)(() => countNodes(validation.parsed), [validation.parsed]);
|
|
11694
|
+
const maxDepth = (0, import_react52.useMemo)(
|
|
11630
11695
|
() => analysis.lines.reduce((deepest, line) => Math.max(deepest, line.depth), 0),
|
|
11631
11696
|
[analysis.lines]
|
|
11632
11697
|
);
|
|
11633
|
-
const byteSize = (0,
|
|
11634
|
-
(0,
|
|
11698
|
+
const byteSize = (0, import_react52.useMemo)(() => new Blob([value]).size, [value]);
|
|
11699
|
+
(0, import_react52.useEffect)(() => {
|
|
11635
11700
|
const measure = () => {
|
|
11636
11701
|
const textarea = textareaRef.current;
|
|
11637
11702
|
if (!textarea) return;
|
|
@@ -11653,14 +11718,14 @@ function ITJSONEditor({
|
|
|
11653
11718
|
const contentHeight = visibleLines.length * lineHeight;
|
|
11654
11719
|
const activeLine = validation.isValid ? caretLine : validation.error?.line ?? errorLine ?? caretLine;
|
|
11655
11720
|
const treeValue = validation.isValid ? validation.parsed : void 0;
|
|
11656
|
-
const restoreSelection = (0,
|
|
11721
|
+
const restoreSelection = (0, import_react52.useCallback)(() => {
|
|
11657
11722
|
const textarea = textareaRef.current;
|
|
11658
11723
|
const pending = pendingSelection.current;
|
|
11659
11724
|
if (!textarea || !pending) return;
|
|
11660
11725
|
const max = textarea.value.length;
|
|
11661
11726
|
textarea.setSelectionRange(Math.min(pending[0], max), Math.min(pending[1], max));
|
|
11662
11727
|
}, []);
|
|
11663
|
-
const consumePendingSelection = (0,
|
|
11728
|
+
const consumePendingSelection = (0, import_react52.useCallback)(() => {
|
|
11664
11729
|
if (!pendingSelection.current) return;
|
|
11665
11730
|
const pending = pendingSelection.current;
|
|
11666
11731
|
pendingSelection.current = null;
|
|
@@ -11672,10 +11737,10 @@ function ITJSONEditor({
|
|
|
11672
11737
|
textarea.setSelectionRange(Math.min(pending[0], max), Math.min(pending[1], max));
|
|
11673
11738
|
});
|
|
11674
11739
|
}, [restoreSelection]);
|
|
11675
|
-
(0,
|
|
11740
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
11676
11741
|
consumePendingSelection();
|
|
11677
11742
|
});
|
|
11678
|
-
const applyEdit = (0,
|
|
11743
|
+
const applyEdit = (0, import_react52.useCallback)(
|
|
11679
11744
|
(result) => {
|
|
11680
11745
|
pendingSelection.current = [result.selectionStart, result.selectionEnd];
|
|
11681
11746
|
onChange?.(result.value);
|
|
@@ -11698,19 +11763,19 @@ function ITJSONEditor({
|
|
|
11698
11763
|
readOnly,
|
|
11699
11764
|
applyEdit
|
|
11700
11765
|
});
|
|
11701
|
-
const handleKeyDown = (0,
|
|
11766
|
+
const handleKeyDown = (0, import_react52.useCallback)(
|
|
11702
11767
|
(event) => {
|
|
11703
11768
|
pendingSelection.current = null;
|
|
11704
11769
|
handleKeyDownRaw(event);
|
|
11705
11770
|
},
|
|
11706
11771
|
[handleKeyDownRaw]
|
|
11707
11772
|
);
|
|
11708
|
-
const syncCaret = (0,
|
|
11773
|
+
const syncCaret = (0, import_react52.useCallback)(() => {
|
|
11709
11774
|
const textarea = textareaRef.current;
|
|
11710
11775
|
if (!textarea) return;
|
|
11711
11776
|
setCaretLine(caretPosition(value, textarea.selectionStart, lineStarts).line);
|
|
11712
11777
|
}, [value, lineStarts]);
|
|
11713
|
-
const scrollCaretIntoView = (0,
|
|
11778
|
+
const scrollCaretIntoView = (0, import_react52.useCallback)(() => {
|
|
11714
11779
|
const textarea = textareaRef.current;
|
|
11715
11780
|
if (!textarea || wrapLines) return;
|
|
11716
11781
|
const { line } = caretPosition(value, textarea.selectionStart, lineStarts);
|
|
@@ -11722,11 +11787,11 @@ function ITJSONEditor({
|
|
|
11722
11787
|
if (highlightRef.current) highlightRef.current.scrollTop = textarea.scrollTop;
|
|
11723
11788
|
}
|
|
11724
11789
|
}, [value, lineStarts, lineHeight, wrapLines]);
|
|
11725
|
-
const flash = (0,
|
|
11790
|
+
const flash = (0, import_react52.useCallback)((message) => {
|
|
11726
11791
|
setNotice(message);
|
|
11727
11792
|
window.setTimeout(() => setNotice(null), 1800);
|
|
11728
11793
|
}, []);
|
|
11729
|
-
const applyTransform = (0,
|
|
11794
|
+
const applyTransform = (0, import_react52.useCallback)(
|
|
11730
11795
|
(transform) => {
|
|
11731
11796
|
if (!validation.isValid || validation.parsed === void 0) return;
|
|
11732
11797
|
try {
|
|
@@ -11741,7 +11806,7 @@ function ITJSONEditor({
|
|
|
11741
11806
|
},
|
|
11742
11807
|
[validation, indentSize, value, onChange, flash, t]
|
|
11743
11808
|
);
|
|
11744
|
-
const handleTransformHotkeys = (0,
|
|
11809
|
+
const handleTransformHotkeys = (0, import_react52.useCallback)(
|
|
11745
11810
|
(event) => {
|
|
11746
11811
|
if (!(event.altKey && event.shiftKey)) return;
|
|
11747
11812
|
const key = event.key.toLowerCase();
|
|
@@ -11780,7 +11845,7 @@ function ITJSONEditor({
|
|
|
11780
11845
|
reader.onerror = () => flash(t("jsonEditor.fileError"));
|
|
11781
11846
|
reader.readAsText(file);
|
|
11782
11847
|
};
|
|
11783
|
-
const jumpToLine = (0,
|
|
11848
|
+
const jumpToLine = (0, import_react52.useCallback)(
|
|
11784
11849
|
(line) => {
|
|
11785
11850
|
const textarea = textareaRef.current;
|
|
11786
11851
|
if (!textarea) return;
|
|
@@ -12265,7 +12330,7 @@ function EditorToggle({
|
|
|
12265
12330
|
}
|
|
12266
12331
|
|
|
12267
12332
|
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
12268
|
-
var
|
|
12333
|
+
var import_react56 = require("react");
|
|
12269
12334
|
|
|
12270
12335
|
// src/types/loader.types.ts
|
|
12271
12336
|
var sizeClasses = {
|
|
@@ -12576,7 +12641,7 @@ var AXZY_CATALOG_ENTRIES = [
|
|
|
12576
12641
|
},
|
|
12577
12642
|
{
|
|
12578
12643
|
type: "ITFlex",
|
|
12579
|
-
component:
|
|
12644
|
+
component: flex_default,
|
|
12580
12645
|
children: true,
|
|
12581
12646
|
summary: "Contenedor flex completo.",
|
|
12582
12647
|
props: {
|
|
@@ -12709,6 +12774,192 @@ var AXZY_EXCLUDED_TYPES = {
|
|
|
12709
12774
|
var axzyCatalog = createCatalog(AXZY_CATALOG_ENTRIES, AXZY_EXCLUDED_TYPES);
|
|
12710
12775
|
var axzyCatalogTypes = Object.keys(axzyCatalog.entries);
|
|
12711
12776
|
|
|
12777
|
+
// src/json-renderer/shared/errors.ts
|
|
12778
|
+
var JsonEngineError = class extends Error {
|
|
12779
|
+
constructor(code, message, path, hint) {
|
|
12780
|
+
super(`${code} ${path ? `en ${path}: ` : ""}${message}`);
|
|
12781
|
+
/** Código estable del catálogo de avisos. */
|
|
12782
|
+
__publicField(this, "code");
|
|
12783
|
+
/** Ruta del esquema donde se produjo. */
|
|
12784
|
+
__publicField(this, "path");
|
|
12785
|
+
/** Sugerencia accionable. */
|
|
12786
|
+
__publicField(this, "hint");
|
|
12787
|
+
this.name = "JsonEngineError";
|
|
12788
|
+
this.code = code;
|
|
12789
|
+
this.path = path;
|
|
12790
|
+
this.hint = hint;
|
|
12791
|
+
}
|
|
12792
|
+
/** Convierte el error en el aviso que consume la interfaz y el informe. */
|
|
12793
|
+
toIssue(severity = "error") {
|
|
12794
|
+
return {
|
|
12795
|
+
code: this.code,
|
|
12796
|
+
severity,
|
|
12797
|
+
message: this.message.replace(/^JR\d{3}\s?(en .*?: )?/, ""),
|
|
12798
|
+
path: this.path,
|
|
12799
|
+
hint: this.hint
|
|
12800
|
+
};
|
|
12801
|
+
}
|
|
12802
|
+
};
|
|
12803
|
+
function issue(code, message, path = "", options = {}) {
|
|
12804
|
+
return {
|
|
12805
|
+
code,
|
|
12806
|
+
severity: options.severity ?? "error",
|
|
12807
|
+
message,
|
|
12808
|
+
path,
|
|
12809
|
+
hint: options.hint
|
|
12810
|
+
};
|
|
12811
|
+
}
|
|
12812
|
+
|
|
12813
|
+
// src/json-renderer/shared/paths.ts
|
|
12814
|
+
function pushPath(path, segment) {
|
|
12815
|
+
return [...path, segment];
|
|
12816
|
+
}
|
|
12817
|
+
function formatPath(path) {
|
|
12818
|
+
let out = "";
|
|
12819
|
+
for (const segment of path) {
|
|
12820
|
+
if (typeof segment === "number") out += `[${segment}]`;
|
|
12821
|
+
else out += out ? `.${segment}` : segment;
|
|
12822
|
+
}
|
|
12823
|
+
return out;
|
|
12824
|
+
}
|
|
12825
|
+
function parsePath(rendered) {
|
|
12826
|
+
if (!rendered) return [];
|
|
12827
|
+
return rendered.split(/\.(?![^[]*])/).flatMap((part) => {
|
|
12828
|
+
const match = part.match(/^([^[\]]*)((?:\[\d+\])*)$/);
|
|
12829
|
+
if (!match) return [part];
|
|
12830
|
+
const [, key, indexes] = match;
|
|
12831
|
+
const segments = key ? [key] : [];
|
|
12832
|
+
for (const index of indexes.match(/\d+/g) ?? []) segments.push(Number(index));
|
|
12833
|
+
return segments;
|
|
12834
|
+
});
|
|
12835
|
+
}
|
|
12836
|
+
function readPath(source, path) {
|
|
12837
|
+
let cursor = source;
|
|
12838
|
+
for (const segment of path) {
|
|
12839
|
+
if (cursor === null || typeof cursor !== "object") return void 0;
|
|
12840
|
+
cursor = cursor[segment];
|
|
12841
|
+
}
|
|
12842
|
+
return cursor;
|
|
12843
|
+
}
|
|
12844
|
+
function hasPath(source, path) {
|
|
12845
|
+
if (path.length === 0) return true;
|
|
12846
|
+
const parent = readPath(source, path.slice(0, -1));
|
|
12847
|
+
if (parent === null || typeof parent !== "object") return false;
|
|
12848
|
+
return Object.prototype.hasOwnProperty.call(parent, path[path.length - 1]);
|
|
12849
|
+
}
|
|
12850
|
+
function propPath(nodePath, prop) {
|
|
12851
|
+
return pushPath(pushPath(nodePath, "props"), prop);
|
|
12852
|
+
}
|
|
12853
|
+
|
|
12854
|
+
// src/json-renderer/binding/resolveValue.ts
|
|
12855
|
+
var CLAVES_DE_RED = ["url", "endpoint", "href", "src"];
|
|
12856
|
+
var SUPPORTED_REFERENCES = ["$source", "$state", "$param"];
|
|
12857
|
+
function own(record, key) {
|
|
12858
|
+
return record !== void 0 && Object.prototype.hasOwnProperty.call(record, key);
|
|
12859
|
+
}
|
|
12860
|
+
function isDollarReference(value) {
|
|
12861
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
12862
|
+
return Object.keys(value).some((key) => key.startsWith("$"));
|
|
12863
|
+
}
|
|
12864
|
+
function referenceIssue(message, path, hint) {
|
|
12865
|
+
return issue("JR032", message, formatPath(path), { severity: "warning", hint });
|
|
12866
|
+
}
|
|
12867
|
+
function createBindingResolver(scope) {
|
|
12868
|
+
const readValue = (table, kind, key, path) => {
|
|
12869
|
+
if (own(table, key)) return table[key];
|
|
12870
|
+
scope.report(
|
|
12871
|
+
referenceIssue(
|
|
12872
|
+
`La referencia \`${kind}: "${key}"\` no tiene valor.`,
|
|
12873
|
+
path,
|
|
12874
|
+
kind === "$state" ? "Declara el valor en `state` del esquema." : "El host debe pasar el par\xE1metro en `params`."
|
|
12875
|
+
)
|
|
12876
|
+
);
|
|
12877
|
+
return void 0;
|
|
12878
|
+
};
|
|
12879
|
+
const resolveParams = (declared, path) => {
|
|
12880
|
+
const resolved = {};
|
|
12881
|
+
for (const [name, raw] of Object.entries(declared ?? {})) {
|
|
12882
|
+
if (!isDollarReference(raw)) {
|
|
12883
|
+
resolved[name] = raw;
|
|
12884
|
+
continue;
|
|
12885
|
+
}
|
|
12886
|
+
const [key] = Object.keys(raw).filter((candidate) => candidate.startsWith("$"));
|
|
12887
|
+
if (key === "$state" && typeof raw[key] === "string") {
|
|
12888
|
+
const value = readValue(scope.state, "$state", raw[key], path);
|
|
12889
|
+
if (value !== void 0) resolved[name] = value;
|
|
12890
|
+
} else if (key === "$param" && typeof raw[key] === "string") {
|
|
12891
|
+
const value = readValue(scope.params, "$param", raw[key], path);
|
|
12892
|
+
if (value !== void 0) resolved[name] = value;
|
|
12893
|
+
} else {
|
|
12894
|
+
scope.report(
|
|
12895
|
+
referenceIssue(
|
|
12896
|
+
"Un par\xE1metro de fuente solo admite valores, `$state` o `$param`.",
|
|
12897
|
+
path,
|
|
12898
|
+
"Las fuentes no se encadenan: declara la fuente sin referencias a otras fuentes."
|
|
12899
|
+
)
|
|
12900
|
+
);
|
|
12901
|
+
}
|
|
12902
|
+
}
|
|
12903
|
+
return resolved;
|
|
12904
|
+
};
|
|
12905
|
+
const failingLoader = (message, path, hint) => {
|
|
12906
|
+
scope.report(issue("JR030", message, formatPath(path), { severity: "error", hint }));
|
|
12907
|
+
return () => Promise.reject(new Error(message));
|
|
12908
|
+
};
|
|
12909
|
+
const sourceLoader = (name, path) => {
|
|
12910
|
+
if (!own(scope.data, name)) {
|
|
12911
|
+
return failingLoader(
|
|
12912
|
+
`La fuente \`${name}\` no est\xE1 declarada en \`data\`.`,
|
|
12913
|
+
path,
|
|
12914
|
+
"Decl\xE1rala en `data` del esquema con el `handler` que registra el host."
|
|
12915
|
+
);
|
|
12916
|
+
}
|
|
12917
|
+
const declared = scope.data[name];
|
|
12918
|
+
const claveDeRed = Object.keys(declared).find((clave) => CLAVES_DE_RED.includes(clave));
|
|
12919
|
+
if (claveDeRed) {
|
|
12920
|
+
scope.report(
|
|
12921
|
+
issue("JR031", `El esquema declara \`${claveDeRed}\` en la fuente "${name}": las fuentes no pueden pedir red.`, formatPath(path), {
|
|
12922
|
+
severity: "error",
|
|
12923
|
+
hint: "Una fuente solo nombra un `handler` que registra el host."
|
|
12924
|
+
})
|
|
12925
|
+
);
|
|
12926
|
+
return () => Promise.reject(new Error(`La fuente "${name}" no puede pedir red.`));
|
|
12927
|
+
}
|
|
12928
|
+
const handler = own(scope.handlers, declared.handler) ? scope.handlers[declared.handler] : void 0;
|
|
12929
|
+
if (typeof handler !== "function") {
|
|
12930
|
+
return failingLoader(
|
|
12931
|
+
`El handler \`${declared.handler}\` no est\xE1 registrado por el host.`,
|
|
12932
|
+
path,
|
|
12933
|
+
"El host debe registrarlo en `dataHandlers` del renderizador."
|
|
12934
|
+
);
|
|
12935
|
+
}
|
|
12936
|
+
const params = resolveParams(declared.params, path);
|
|
12937
|
+
return (query) => new Promise((resolve) => resolve(handler(query, params)));
|
|
12938
|
+
};
|
|
12939
|
+
const resolveReference = (ref, path) => {
|
|
12940
|
+
const keys = Object.keys(ref).filter((key2) => key2.startsWith("$"));
|
|
12941
|
+
const [key] = keys;
|
|
12942
|
+
if (keys.length !== 1 || !SUPPORTED_REFERENCES.includes(key) || typeof ref[key] !== "string") {
|
|
12943
|
+
scope.report(
|
|
12944
|
+
referenceIssue(
|
|
12945
|
+
`Referencia no soportada: ${keys.join(", ") || "sin operador"}.`,
|
|
12946
|
+
path,
|
|
12947
|
+
"Soportadas: `$source`, `$state` y `$param`. Los dem\xE1s operadores llegan con las acciones y las tablas."
|
|
12948
|
+
)
|
|
12949
|
+
);
|
|
12950
|
+
return void 0;
|
|
12951
|
+
}
|
|
12952
|
+
const name = ref[key];
|
|
12953
|
+
if (key === "$source") return sourceLoader(name, path);
|
|
12954
|
+
if (key === "$state") return readValue(scope.state, "$state", name, path);
|
|
12955
|
+
return readValue(scope.params, "$param", name, path);
|
|
12956
|
+
};
|
|
12957
|
+
return (value, path) => {
|
|
12958
|
+
if (isDollarReference(value)) return resolveReference(value, path);
|
|
12959
|
+
return scope.host ? scope.host(value, path) : value;
|
|
12960
|
+
};
|
|
12961
|
+
}
|
|
12962
|
+
|
|
12712
12963
|
// src/json-renderer/shared/limits.ts
|
|
12713
12964
|
var DEFAULT_LIMITS = {
|
|
12714
12965
|
maxNodes: 5e3,
|
|
@@ -12752,47 +13003,26 @@ function createLimitTracker(limits = DEFAULT_LIMITS) {
|
|
|
12752
13003
|
};
|
|
12753
13004
|
}
|
|
12754
13005
|
|
|
12755
|
-
// src/json-renderer/kernel/
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
super(`${code} ${path ? `en ${path}: ` : ""}${message}`);
|
|
12762
|
-
/** Código estable del catálogo de avisos. */
|
|
12763
|
-
__publicField(this, "code");
|
|
12764
|
-
/** Ruta del esquema donde se produjo. */
|
|
12765
|
-
__publicField(this, "path");
|
|
12766
|
-
/** Sugerencia accionable. */
|
|
12767
|
-
__publicField(this, "hint");
|
|
12768
|
-
this.name = "JsonEngineError";
|
|
12769
|
-
this.code = code;
|
|
12770
|
-
this.path = path;
|
|
12771
|
-
this.hint = hint;
|
|
12772
|
-
}
|
|
12773
|
-
/** Convierte el error en el aviso que consume la interfaz y el informe. */
|
|
12774
|
-
toIssue(severity = "error") {
|
|
12775
|
-
return {
|
|
12776
|
-
code: this.code,
|
|
12777
|
-
severity,
|
|
12778
|
-
message: this.message.replace(/^JR\d{3}\s?(en .*?: )?/, ""),
|
|
12779
|
-
path: this.path,
|
|
12780
|
-
hint: this.hint
|
|
12781
|
-
};
|
|
13006
|
+
// src/json-renderer/kernel/capabilities.ts
|
|
13007
|
+
function capacidadesRequeridas(requires) {
|
|
13008
|
+
if (requires === void 0 || requires === null) return [];
|
|
13009
|
+
if (typeof requires === "string") return requires === "" ? null : [requires];
|
|
13010
|
+
if (Array.isArray(requires) && requires.every((item) => typeof item === "string" && item !== "")) {
|
|
13011
|
+
return requires;
|
|
12782
13012
|
}
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
};
|
|
13013
|
+
return null;
|
|
13014
|
+
}
|
|
13015
|
+
function faltanCapacidades(requires, concedidas) {
|
|
13016
|
+
const requeridas = capacidadesRequeridas(requires);
|
|
13017
|
+
if (requeridas === null) return ["(requires no v\xE1lido)"];
|
|
13018
|
+
if (requeridas.length === 0) return [];
|
|
13019
|
+
const conjunto = new Set(concedidas ?? []);
|
|
13020
|
+
return requeridas.filter((capacidad) => !conjunto.has(capacidad));
|
|
12792
13021
|
}
|
|
12793
13022
|
|
|
12794
13023
|
// src/json-renderer/kernel/NodeBoundary.tsx
|
|
12795
|
-
var
|
|
13024
|
+
var import_react53 = __toESM(require("react"), 1);
|
|
13025
|
+
var NodeBoundary = class extends import_react53.default.Component {
|
|
12796
13026
|
constructor() {
|
|
12797
13027
|
super(...arguments);
|
|
12798
13028
|
__publicField(this, "state", { failed: false });
|
|
@@ -13139,48 +13369,7 @@ function isNodePending(node) {
|
|
|
13139
13369
|
}
|
|
13140
13370
|
|
|
13141
13371
|
// src/json-renderer/kernel/renderNode.tsx
|
|
13142
|
-
var
|
|
13143
|
-
|
|
13144
|
-
// src/json-renderer/shared/paths.ts
|
|
13145
|
-
function pushPath(path, segment) {
|
|
13146
|
-
return [...path, segment];
|
|
13147
|
-
}
|
|
13148
|
-
function formatPath(path) {
|
|
13149
|
-
let out = "";
|
|
13150
|
-
for (const segment of path) {
|
|
13151
|
-
if (typeof segment === "number") out += `[${segment}]`;
|
|
13152
|
-
else out += out ? `.${segment}` : segment;
|
|
13153
|
-
}
|
|
13154
|
-
return out;
|
|
13155
|
-
}
|
|
13156
|
-
function parsePath(rendered) {
|
|
13157
|
-
if (!rendered) return [];
|
|
13158
|
-
return rendered.split(/\.(?![^[]*])/).flatMap((part) => {
|
|
13159
|
-
const match = part.match(/^([^[\]]*)((?:\[\d+\])*)$/);
|
|
13160
|
-
if (!match) return [part];
|
|
13161
|
-
const [, key, indexes] = match;
|
|
13162
|
-
const segments = key ? [key] : [];
|
|
13163
|
-
for (const index of indexes.match(/\d+/g) ?? []) segments.push(Number(index));
|
|
13164
|
-
return segments;
|
|
13165
|
-
});
|
|
13166
|
-
}
|
|
13167
|
-
function readPath(source, path) {
|
|
13168
|
-
let cursor = source;
|
|
13169
|
-
for (const segment of path) {
|
|
13170
|
-
if (cursor === null || typeof cursor !== "object") return void 0;
|
|
13171
|
-
cursor = cursor[segment];
|
|
13172
|
-
}
|
|
13173
|
-
return cursor;
|
|
13174
|
-
}
|
|
13175
|
-
function hasPath(source, path) {
|
|
13176
|
-
if (path.length === 0) return true;
|
|
13177
|
-
const parent = readPath(source, path.slice(0, -1));
|
|
13178
|
-
if (parent === null || typeof parent !== "object") return false;
|
|
13179
|
-
return Object.prototype.hasOwnProperty.call(parent, path[path.length - 1]);
|
|
13180
|
-
}
|
|
13181
|
-
function propPath(nodePath, prop) {
|
|
13182
|
-
return pushPath(pushPath(nodePath, "props"), prop);
|
|
13183
|
-
}
|
|
13372
|
+
var import_react55 = __toESM(require("react"), 1);
|
|
13184
13373
|
|
|
13185
13374
|
// src/json-renderer/catalog/resolve.ts
|
|
13186
13375
|
function isSchemaReference(value) {
|
|
@@ -13321,11 +13510,457 @@ function resolveNode(node, catalog, path) {
|
|
|
13321
13510
|
return { ok: true, entry, props, actions, issues };
|
|
13322
13511
|
}
|
|
13323
13512
|
|
|
13513
|
+
// src/json-renderer/kernel/slots.ts
|
|
13514
|
+
var SLOT_TYPE = "slot";
|
|
13515
|
+
function isSlotNode(node) {
|
|
13516
|
+
return node.type === SLOT_TYPE;
|
|
13517
|
+
}
|
|
13518
|
+
function slotName(node) {
|
|
13519
|
+
const name = node.props?.name;
|
|
13520
|
+
return typeof name === "string" && name !== "" ? name : void 0;
|
|
13521
|
+
}
|
|
13522
|
+
|
|
13523
|
+
// src/json-renderer/form/FormNode.tsx
|
|
13524
|
+
var import_react54 = require("react");
|
|
13525
|
+
|
|
13526
|
+
// src/json-renderer/form/rules.ts
|
|
13527
|
+
var FORM_FIELD_KINDS = ["text", "email"];
|
|
13528
|
+
var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
13529
|
+
function longitudDeclarada(value) {
|
|
13530
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
13531
|
+
}
|
|
13532
|
+
function readFormFields(declared, fieldsPath) {
|
|
13533
|
+
const issues = [];
|
|
13534
|
+
const fields = [];
|
|
13535
|
+
if (!Array.isArray(declared)) {
|
|
13536
|
+
issues.push(issue("JR021", "El formulario necesita `props.fields` como lista.", formatPath(fieldsPath), { severity: "error" }));
|
|
13537
|
+
return { fields, issues };
|
|
13538
|
+
}
|
|
13539
|
+
const nombres = /* @__PURE__ */ new Set();
|
|
13540
|
+
declared.forEach((raw, index) => {
|
|
13541
|
+
const fieldPath = [...fieldsPath, index];
|
|
13542
|
+
const campo = raw;
|
|
13543
|
+
if (!campo || typeof campo !== "object" || typeof campo.name !== "string" || campo.name === "") {
|
|
13544
|
+
issues.push(issue("JR021", "Un campo del formulario no declara `name`.", formatPath(fieldPath), { severity: "error" }));
|
|
13545
|
+
return;
|
|
13546
|
+
}
|
|
13547
|
+
if (nombres.has(campo.name)) {
|
|
13548
|
+
issues.push(issue("JR021", `El campo "${campo.name}" se repite.`, formatPath(fieldPath), { severity: "error" }));
|
|
13549
|
+
return;
|
|
13550
|
+
}
|
|
13551
|
+
let kind = "text";
|
|
13552
|
+
if (campo.kind !== void 0) {
|
|
13553
|
+
if (typeof campo.kind === "string" && FORM_FIELD_KINDS.includes(campo.kind)) {
|
|
13554
|
+
kind = campo.kind;
|
|
13555
|
+
} else {
|
|
13556
|
+
issues.push(
|
|
13557
|
+
issue("JR011", `Tipo de campo "${String(campo.kind)}" no admitido.`, formatPath(fieldPath), {
|
|
13558
|
+
severity: "warning",
|
|
13559
|
+
hint: `Admitidos: ${FORM_FIELD_KINDS.join(", ")}. Se usa "text".`
|
|
13560
|
+
})
|
|
13561
|
+
);
|
|
13562
|
+
}
|
|
13563
|
+
}
|
|
13564
|
+
const minLength = longitudDeclarada(campo.minLength);
|
|
13565
|
+
const maxLength = longitudDeclarada(campo.maxLength);
|
|
13566
|
+
for (const [clave, valor, declarada] of [["minLength", campo.minLength, minLength], ["maxLength", campo.maxLength, maxLength]]) {
|
|
13567
|
+
if (valor !== void 0 && declarada === void 0) {
|
|
13568
|
+
issues.push(issue("JR011", `\`${clave}\` debe ser un entero no negativo.`, formatPath(fieldPath), { severity: "warning", hint: "Se ignora." }));
|
|
13569
|
+
}
|
|
13570
|
+
}
|
|
13571
|
+
if (minLength !== void 0 && maxLength !== void 0 && minLength > maxLength) {
|
|
13572
|
+
issues.push(issue("JR021", `El campo "${campo.name}" tiene minLength mayor que maxLength.`, formatPath(fieldPath), { severity: "error" }));
|
|
13573
|
+
return;
|
|
13574
|
+
}
|
|
13575
|
+
nombres.add(campo.name);
|
|
13576
|
+
fields.push({ name: campo.name, kind, required: campo.required === true, minLength, maxLength, label: campo.label });
|
|
13577
|
+
});
|
|
13578
|
+
return { fields, issues };
|
|
13579
|
+
}
|
|
13580
|
+
function validateField(field, value) {
|
|
13581
|
+
const texto = value.trim();
|
|
13582
|
+
if (texto === "") return field.required ? "required" : void 0;
|
|
13583
|
+
if (field.minLength !== void 0 && texto.length < field.minLength) return "minLength";
|
|
13584
|
+
if (field.maxLength !== void 0 && texto.length > field.maxLength) return "maxLength";
|
|
13585
|
+
if (field.kind === "email" && !EMAIL.test(texto)) return "email";
|
|
13586
|
+
return void 0;
|
|
13587
|
+
}
|
|
13588
|
+
function validateForm(fields, values) {
|
|
13589
|
+
const errores = {};
|
|
13590
|
+
for (const field of fields) {
|
|
13591
|
+
const code = validateField(field, values[field.name] ?? "");
|
|
13592
|
+
if (code) errores[field.name] = code;
|
|
13593
|
+
}
|
|
13594
|
+
return errores;
|
|
13595
|
+
}
|
|
13596
|
+
|
|
13597
|
+
// src/json-renderer/form/FormNode.tsx
|
|
13598
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13599
|
+
function valorDe(evento) {
|
|
13600
|
+
if (typeof evento === "string") return evento;
|
|
13601
|
+
return evento?.target?.value?.toString() ?? "";
|
|
13602
|
+
}
|
|
13603
|
+
function FormNode({ id, fields, submitLabel, onSubmit }) {
|
|
13604
|
+
const { t } = useITTranslation();
|
|
13605
|
+
const [values, setValues] = (0, import_react54.useState)({});
|
|
13606
|
+
const [errors, setErrors] = (0, import_react54.useState)({});
|
|
13607
|
+
const [intentado, setIntentado] = (0, import_react54.useState)(false);
|
|
13608
|
+
const mensaje = (code, campo) => t(`jsonRenderer.form.${code}`, { min: String(campo.minLength ?? 0), max: String(campo.maxLength ?? 0) });
|
|
13609
|
+
const enviar = () => {
|
|
13610
|
+
const encontrados = validateForm(fields, values);
|
|
13611
|
+
setIntentado(true);
|
|
13612
|
+
setErrors(encontrados);
|
|
13613
|
+
if (Object.keys(encontrados).length === 0) onSubmit?.(values);
|
|
13614
|
+
};
|
|
13615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(ITStack, { direction: "column", spacing: 3, alignItems: "stretch", children: [
|
|
13616
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13617
|
+
ITInput,
|
|
13618
|
+
{
|
|
13619
|
+
name: field.name,
|
|
13620
|
+
label: field.label,
|
|
13621
|
+
type: field.kind === "email" ? "email" : "text",
|
|
13622
|
+
value: values[field.name] ?? "",
|
|
13623
|
+
touched: intentado,
|
|
13624
|
+
error: errors[field.name] ? mensaje(errors[field.name], field) : void 0,
|
|
13625
|
+
onChange: (evento) => {
|
|
13626
|
+
const valor = valorDe(evento);
|
|
13627
|
+
setValues((previo) => ({ ...previo, [field.name]: valor }));
|
|
13628
|
+
setErrors((previo) => {
|
|
13629
|
+
if (!previo[field.name]) return previo;
|
|
13630
|
+
const resto = { ...previo };
|
|
13631
|
+
delete resto[field.name];
|
|
13632
|
+
return resto;
|
|
13633
|
+
});
|
|
13634
|
+
}
|
|
13635
|
+
},
|
|
13636
|
+
field.name
|
|
13637
|
+
)),
|
|
13638
|
+
/* @__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 }) })
|
|
13639
|
+
] }) });
|
|
13640
|
+
}
|
|
13641
|
+
|
|
13642
|
+
// src/json-renderer/actions/effects.ts
|
|
13643
|
+
var MAX_EFFECT_DEPTH = 5;
|
|
13644
|
+
var EFFECT_KEYS = ["toast", "navigate", "refresh", "openOverlay", "closeOverlay", "set"];
|
|
13645
|
+
var EFFECT_KEYS_DEL_HOST = ["toast", "navigate", "refresh", "openOverlay", "closeOverlay"];
|
|
13646
|
+
function leerResultado(ruta, resultado) {
|
|
13647
|
+
return ruta.split(".").reduce(
|
|
13648
|
+
(actual, clave) => actual && typeof actual === "object" ? actual[clave] : void 0,
|
|
13649
|
+
resultado
|
|
13650
|
+
);
|
|
13651
|
+
}
|
|
13652
|
+
function resolverResultado(valor, resultado) {
|
|
13653
|
+
if (!valor || typeof valor !== "object" || Array.isArray(valor)) return valor;
|
|
13654
|
+
const objeto = valor;
|
|
13655
|
+
if (typeof objeto.$result === "string") return leerResultado(objeto.$result, resultado) ?? "";
|
|
13656
|
+
if (objeto.params && typeof objeto.params === "object") {
|
|
13657
|
+
const params = Object.fromEntries(
|
|
13658
|
+
Object.entries(objeto.params).map(([clave, valorParam]) => [
|
|
13659
|
+
clave,
|
|
13660
|
+
resolverResultado(valorParam, resultado)
|
|
13661
|
+
])
|
|
13662
|
+
);
|
|
13663
|
+
return { ...objeto, params };
|
|
13664
|
+
}
|
|
13665
|
+
return valor;
|
|
13666
|
+
}
|
|
13667
|
+
function plantilla(texto, resultado) {
|
|
13668
|
+
return texto.replace(/\{([\w.]+)\}/g, (_, ruta) => {
|
|
13669
|
+
const valor = leerResultado(ruta, resultado);
|
|
13670
|
+
return valor === void 0 ? "" : String(valor);
|
|
13671
|
+
});
|
|
13672
|
+
}
|
|
13673
|
+
function efectosSueltos(declarada) {
|
|
13674
|
+
const sueltos = {};
|
|
13675
|
+
for (const clave of EFFECT_KEYS) {
|
|
13676
|
+
if (declarada[clave] !== void 0) sueltos[clave] = declarada[clave];
|
|
13677
|
+
}
|
|
13678
|
+
return Object.keys(sueltos).length > 0 ? sueltos : null;
|
|
13679
|
+
}
|
|
13680
|
+
function comprobarRegistro(efecto, context) {
|
|
13681
|
+
for (const clave of EFFECT_KEYS_DEL_HOST) {
|
|
13682
|
+
if (efecto[clave] === void 0) continue;
|
|
13683
|
+
if (typeof context.effects?.[clave] !== "function") {
|
|
13684
|
+
context.report(
|
|
13685
|
+
issue("JR040", `El host no implementa el efecto \`${clave}\`.`, formatPath(context.path), {
|
|
13686
|
+
severity: "warning",
|
|
13687
|
+
hint: "Reg\xEDstralo en `effects` del renderizador o quita el efecto del esquema."
|
|
13688
|
+
})
|
|
13689
|
+
);
|
|
13690
|
+
}
|
|
13691
|
+
}
|
|
13692
|
+
}
|
|
13693
|
+
function cumplirEfecto(efecto, context, resultado) {
|
|
13694
|
+
if (efecto.set && context.setState) {
|
|
13695
|
+
const cambios = {};
|
|
13696
|
+
for (const [clave, valor] of Object.entries(efecto.set)) {
|
|
13697
|
+
const conResultado = resolverResultado(valor, resultado);
|
|
13698
|
+
cambios[clave] = context.resolveRaw ? context.resolveRaw(conResultado, context.path) : conResultado;
|
|
13699
|
+
}
|
|
13700
|
+
context.setState(cambios);
|
|
13701
|
+
}
|
|
13702
|
+
const registro = context.effects;
|
|
13703
|
+
if (!registro) return;
|
|
13704
|
+
if (efecto.toast && registro.toast) {
|
|
13705
|
+
registro.toast({
|
|
13706
|
+
variant: efecto.toast.variant ?? "info",
|
|
13707
|
+
message: context.resolveText(resolverResultado(efecto.toast.message, resultado), context.path)
|
|
13708
|
+
});
|
|
13709
|
+
}
|
|
13710
|
+
if (typeof efecto.navigate === "string" && registro.navigate) {
|
|
13711
|
+
registro.navigate(plantilla(efecto.navigate, resultado));
|
|
13712
|
+
}
|
|
13713
|
+
if (typeof efecto.refresh === "string" && registro.refresh) registro.refresh(efecto.refresh);
|
|
13714
|
+
if (typeof efecto.openOverlay === "string" && registro.openOverlay) registro.openOverlay(efecto.openOverlay);
|
|
13715
|
+
if (efecto.closeOverlay !== void 0 && registro.closeOverlay) {
|
|
13716
|
+
registro.closeOverlay(typeof efecto.closeOverlay === "string" ? efecto.closeOverlay : void 0);
|
|
13717
|
+
}
|
|
13718
|
+
}
|
|
13719
|
+
function pasosDe(efectos, context) {
|
|
13720
|
+
const profundidad = context.depth ?? 0;
|
|
13721
|
+
return efectos.map((efecto) => {
|
|
13722
|
+
if (typeof efecto.action !== "string") {
|
|
13723
|
+
comprobarRegistro(efecto, context);
|
|
13724
|
+
return (resultado) => cumplirEfecto(efecto, context, resultado);
|
|
13725
|
+
}
|
|
13726
|
+
if (profundidad + 1 > MAX_EFFECT_DEPTH) {
|
|
13727
|
+
context.report(
|
|
13728
|
+
issue("JR042", `El encadenado de acciones supera ${MAX_EFFECT_DEPTH} niveles.`, formatPath(context.path), {
|
|
13729
|
+
severity: "error",
|
|
13730
|
+
hint: "Reduce los `then` anidados."
|
|
13731
|
+
})
|
|
13732
|
+
);
|
|
13733
|
+
return () => void 0;
|
|
13734
|
+
}
|
|
13735
|
+
const handler = context.resolveChained?.(efecto.action);
|
|
13736
|
+
if (!handler) {
|
|
13737
|
+
context.report(
|
|
13738
|
+
issue("JR040", `La acci\xF3n encadenada \`${efecto.action}\` no est\xE1 registrada por el host.`, formatPath(context.path), {
|
|
13739
|
+
severity: "error",
|
|
13740
|
+
hint: "Reg\xEDstrala en las acciones del renderizador o cambia el nombre en el esquema."
|
|
13741
|
+
})
|
|
13742
|
+
);
|
|
13743
|
+
return () => void 0;
|
|
13744
|
+
}
|
|
13745
|
+
const encadenada = wrapAction(handler, efecto, { ...context, depth: profundidad + 1 });
|
|
13746
|
+
return () => encadenada(efecto.args);
|
|
13747
|
+
});
|
|
13748
|
+
}
|
|
13749
|
+
function wrapAction(handler, action, context) {
|
|
13750
|
+
if (!action || typeof action !== "object") return handler;
|
|
13751
|
+
const declarada = action;
|
|
13752
|
+
const sueltos = efectosSueltos(declarada);
|
|
13753
|
+
const alTerminar = [...sueltos ? [sueltos] : [], ...Array.isArray(declarada.then) ? declarada.then : []];
|
|
13754
|
+
const alFallar = declarada.onError;
|
|
13755
|
+
if (alTerminar.length === 0 && !alFallar) return handler;
|
|
13756
|
+
const pasosOk = pasosDe(alTerminar, context);
|
|
13757
|
+
const pasoError = alFallar ? pasosDe([alFallar], context)[0] : void 0;
|
|
13758
|
+
const aplicar = (resultado) => pasosOk.forEach((paso) => paso(resultado));
|
|
13759
|
+
return (...args) => {
|
|
13760
|
+
let resultado;
|
|
13761
|
+
try {
|
|
13762
|
+
resultado = handler(...args);
|
|
13763
|
+
} catch {
|
|
13764
|
+
pasoError?.(void 0);
|
|
13765
|
+
return void 0;
|
|
13766
|
+
}
|
|
13767
|
+
if (resultado && typeof resultado.then === "function") {
|
|
13768
|
+
let resuelta = false;
|
|
13769
|
+
const limite = context.timeoutMs;
|
|
13770
|
+
const temporizador = limite !== void 0 && Number.isFinite(limite) ? setTimeout(() => {
|
|
13771
|
+
if (resuelta) return;
|
|
13772
|
+
resuelta = true;
|
|
13773
|
+
context.reportRuntime?.(
|
|
13774
|
+
issue("JR041", `La acci\xF3n excedi\xF3 ${limite} ms y se considera fallida.`, formatPath(context.path), {
|
|
13775
|
+
severity: "error",
|
|
13776
|
+
hint: "El host debe responder o rechazar la acci\xF3n a tiempo."
|
|
13777
|
+
})
|
|
13778
|
+
);
|
|
13779
|
+
pasoError?.(void 0);
|
|
13780
|
+
}, limite) : void 0;
|
|
13781
|
+
resultado.then(
|
|
13782
|
+
(valor) => {
|
|
13783
|
+
if (resuelta) return;
|
|
13784
|
+
resuelta = true;
|
|
13785
|
+
clearTimeout(temporizador);
|
|
13786
|
+
aplicar(valor);
|
|
13787
|
+
},
|
|
13788
|
+
() => {
|
|
13789
|
+
if (resuelta) return;
|
|
13790
|
+
resuelta = true;
|
|
13791
|
+
clearTimeout(temporizador);
|
|
13792
|
+
pasoError?.(void 0);
|
|
13793
|
+
}
|
|
13794
|
+
);
|
|
13795
|
+
return resultado;
|
|
13796
|
+
}
|
|
13797
|
+
aplicar(resultado);
|
|
13798
|
+
return resultado;
|
|
13799
|
+
};
|
|
13800
|
+
}
|
|
13801
|
+
|
|
13324
13802
|
// src/json-renderer/kernel/renderNode.tsx
|
|
13803
|
+
function effectContext(options, path, node) {
|
|
13804
|
+
return {
|
|
13805
|
+
effects: options.effects,
|
|
13806
|
+
path,
|
|
13807
|
+
resolveText: (value, valuePath) => textoDe(options.resolveValue ? options.resolveValue(value, valuePath) : value),
|
|
13808
|
+
report: (aviso) => options.issues.push(aviso),
|
|
13809
|
+
// Una acción encadenada desde un efecto se resuelve con el mismo `resolveAction` del host.
|
|
13810
|
+
resolveChained: (name) => options.resolveAction?.(node, "chain", { action: name }, path),
|
|
13811
|
+
timeoutMs: options.actionTimeoutMs,
|
|
13812
|
+
reportRuntime: options.onIssue,
|
|
13813
|
+
setState: options.setState,
|
|
13814
|
+
resolveRaw: (value, valuePath) => options.resolveValue ? options.resolveValue(value, valuePath) : value
|
|
13815
|
+
};
|
|
13816
|
+
}
|
|
13817
|
+
function nombreDeAccion(action) {
|
|
13818
|
+
const nombre = action?.action;
|
|
13819
|
+
return typeof nombre === "string" ? nombre : "(sin nombre)";
|
|
13820
|
+
}
|
|
13821
|
+
function isFormNode(node) {
|
|
13822
|
+
return node.type === "form";
|
|
13823
|
+
}
|
|
13824
|
+
function textoDe(value) {
|
|
13825
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : "";
|
|
13826
|
+
}
|
|
13325
13827
|
function childList(node) {
|
|
13326
13828
|
if (!node || node.children === void 0 || node.children === null) return [];
|
|
13327
13829
|
return Array.isArray(node.children) ? node.children : [node.children];
|
|
13328
13830
|
}
|
|
13831
|
+
function renderSlot(node, options) {
|
|
13832
|
+
const { path, issues, slots, resolveValue } = options;
|
|
13833
|
+
const name = slotName(node);
|
|
13834
|
+
if (!name) {
|
|
13835
|
+
issues.push(
|
|
13836
|
+
issue("JR011", "El slot no declara `props.name`.", formatPath(propPath(path, "name")), {
|
|
13837
|
+
severity: "error",
|
|
13838
|
+
hint: 'Declara el nombre que el host registr\xF3, por ejemplo { "type": "slot", "props": { "name": "resumen" } }.'
|
|
13839
|
+
})
|
|
13840
|
+
);
|
|
13841
|
+
return null;
|
|
13842
|
+
}
|
|
13843
|
+
const Component = slots && Object.prototype.hasOwnProperty.call(slots, name) ? slots[name] : void 0;
|
|
13844
|
+
if (!Component) {
|
|
13845
|
+
issues.push(
|
|
13846
|
+
issue("JR010", `El slot \`${name}\` no est\xE1 registrado por el host.`, formatPath(path), {
|
|
13847
|
+
severity: "error",
|
|
13848
|
+
hint: "El host debe registrarlo en `slots` del renderizador."
|
|
13849
|
+
})
|
|
13850
|
+
);
|
|
13851
|
+
return null;
|
|
13852
|
+
}
|
|
13853
|
+
const props = {};
|
|
13854
|
+
for (const [key, raw] of Object.entries(node.props ?? {})) {
|
|
13855
|
+
if (key === "name") continue;
|
|
13856
|
+
props[key] = resolveValue ? resolveValue(raw, path) : raw;
|
|
13857
|
+
}
|
|
13858
|
+
return import_react55.default.createElement(Component, { key: node.id ?? path.join("-"), ...props });
|
|
13859
|
+
}
|
|
13860
|
+
function renderForm(node, options) {
|
|
13861
|
+
const { path, issues, resolveValue, resolveAction } = options;
|
|
13862
|
+
const { fields: declarados, issues: avisos } = readFormFields(node.props?.fields, [...path, "props", "fields"]);
|
|
13863
|
+
issues.push(...avisos);
|
|
13864
|
+
const campos = declarados.map((campo, index) => {
|
|
13865
|
+
const etiqueta = resolveValue ? resolveValue(campo.label, [...path, "props", "fields", index]) : campo.label;
|
|
13866
|
+
return {
|
|
13867
|
+
name: campo.name,
|
|
13868
|
+
kind: campo.kind,
|
|
13869
|
+
required: campo.required,
|
|
13870
|
+
minLength: campo.minLength,
|
|
13871
|
+
maxLength: campo.maxLength,
|
|
13872
|
+
label: textoDe(etiqueta) || campo.name
|
|
13873
|
+
};
|
|
13874
|
+
});
|
|
13875
|
+
const textoEnvio = node.props?.submitLabel;
|
|
13876
|
+
const submitLabel = textoDe(resolveValue ? resolveValue(textoEnvio, path) : textoEnvio) || void 0;
|
|
13877
|
+
const accion = resolveAction?.(node, "onSubmit", node.props?.onSubmit, path);
|
|
13878
|
+
if (node.props?.onSubmit !== void 0 && typeof accion !== "function") {
|
|
13879
|
+
issues.push(
|
|
13880
|
+
issue("JR040", `La acci\xF3n "${nombreDeAccion(node.props.onSubmit)}" no est\xE1 registrada por el host.`, formatPath(propPath(path, "onSubmit")), {
|
|
13881
|
+
severity: "warning",
|
|
13882
|
+
hint: "Reg\xEDstrala en `resolveAction` del host. Sin ella, enviar el formulario no hace nada."
|
|
13883
|
+
})
|
|
13884
|
+
);
|
|
13885
|
+
}
|
|
13886
|
+
const conEfectos = accion ? wrapAction(accion, node.props?.onSubmit, effectContext(options, path, node)) : void 0;
|
|
13887
|
+
return import_react55.default.createElement(FormNode, {
|
|
13888
|
+
key: node.id ?? path.join("-"),
|
|
13889
|
+
id: node.id,
|
|
13890
|
+
fields: campos,
|
|
13891
|
+
submitLabel,
|
|
13892
|
+
onSubmit: conEfectos ? (valores) => conEfectos(valores) : void 0
|
|
13893
|
+
});
|
|
13894
|
+
}
|
|
13895
|
+
function prepararColumnas(columnas, node, options, path) {
|
|
13896
|
+
if (!Array.isArray(columnas)) return columnas;
|
|
13897
|
+
return columnas.map((columna, indice) => {
|
|
13898
|
+
if (!columna || typeof columna !== "object") return columna;
|
|
13899
|
+
const declarada = columna;
|
|
13900
|
+
if (declarada.type !== "actions" || !Array.isArray(declarada.rowActions)) return columna;
|
|
13901
|
+
const colPath = [...path, "props", "columns", indice];
|
|
13902
|
+
const botones = declarada.rowActions.flatMap((raw, indiceAccion) => {
|
|
13903
|
+
const accion = raw;
|
|
13904
|
+
const rutaAccion = [...colPath, "rowActions", indiceAccion];
|
|
13905
|
+
if (!accion || typeof accion.action !== "string" || accion.action === "") {
|
|
13906
|
+
options.issues.push(issue("JR021", "Un bot\xF3n de fila no declara `action`.", formatPath(rutaAccion), { severity: "error" }));
|
|
13907
|
+
return [];
|
|
13908
|
+
}
|
|
13909
|
+
const faltan = faltanCapacidades(accion.requires, options.capabilities);
|
|
13910
|
+
if (faltan.length > 0) {
|
|
13911
|
+
options.issues.push(
|
|
13912
|
+
issue("JR061", `El bot\xF3n de fila "${accion.action}" exige ${faltan.join(", ")}, que no est\xE1 concedido.`, formatPath(rutaAccion), {
|
|
13913
|
+
severity: "warning",
|
|
13914
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador."
|
|
13915
|
+
})
|
|
13916
|
+
);
|
|
13917
|
+
return [];
|
|
13918
|
+
}
|
|
13919
|
+
const handler = options.resolveAction?.(node, `fila:${accion.action}`, accion, rutaAccion);
|
|
13920
|
+
if (typeof handler !== "function") {
|
|
13921
|
+
options.issues.push(
|
|
13922
|
+
issue("JR040", `La acci\xF3n de fila "${accion.action}" no est\xE1 registrada por el host.`, formatPath(rutaAccion), {
|
|
13923
|
+
severity: "warning",
|
|
13924
|
+
hint: "Reg\xEDstrala en `resolveAction` del host, o quita el bot\xF3n del esquema."
|
|
13925
|
+
})
|
|
13926
|
+
);
|
|
13927
|
+
return [];
|
|
13928
|
+
}
|
|
13929
|
+
const etiqueta = textoDe(options.resolveValue ? options.resolveValue(accion.label, rutaAccion) : accion.label);
|
|
13930
|
+
return [
|
|
13931
|
+
{
|
|
13932
|
+
clave: String(indiceAccion),
|
|
13933
|
+
etiqueta: etiqueta || accion.action,
|
|
13934
|
+
color: typeof accion.color === "string" ? accion.color : "secondary",
|
|
13935
|
+
variante: typeof accion.variant === "string" ? accion.variant : "outlined",
|
|
13936
|
+
ejecutar: wrapAction(handler, accion, effectContext(options, rutaAccion, node))
|
|
13937
|
+
}
|
|
13938
|
+
];
|
|
13939
|
+
});
|
|
13940
|
+
const copia = { ...declarada };
|
|
13941
|
+
delete copia.rowActions;
|
|
13942
|
+
const etiquetaColumna = textoDe(options.resolveValue ? options.resolveValue(copia.label, colPath) : copia.label);
|
|
13943
|
+
const Boton = ITButton;
|
|
13944
|
+
return {
|
|
13945
|
+
...copia,
|
|
13946
|
+
label: etiquetaColumna || String(copia.key ?? ""),
|
|
13947
|
+
actions: (fila) => import_react55.default.createElement(
|
|
13948
|
+
import_react55.default.Fragment,
|
|
13949
|
+
null,
|
|
13950
|
+
botones.map(
|
|
13951
|
+
(boton) => import_react55.default.createElement(Boton, {
|
|
13952
|
+
key: boton.clave,
|
|
13953
|
+
label: boton.etiqueta,
|
|
13954
|
+
size: "sm",
|
|
13955
|
+
variant: boton.variante,
|
|
13956
|
+
color: boton.color,
|
|
13957
|
+
onClick: () => boton.ejecutar(fila)
|
|
13958
|
+
})
|
|
13959
|
+
)
|
|
13960
|
+
)
|
|
13961
|
+
};
|
|
13962
|
+
});
|
|
13963
|
+
}
|
|
13329
13964
|
function renderNode(node, options) {
|
|
13330
13965
|
const { catalog, path, issues, renderChildren } = options;
|
|
13331
13966
|
if (!node || typeof node !== "object") {
|
|
@@ -13334,6 +13969,12 @@ function renderNode(node, options) {
|
|
|
13334
13969
|
if (isNodePending(node)) {
|
|
13335
13970
|
return options.pendingFallback ?? null;
|
|
13336
13971
|
}
|
|
13972
|
+
if (isSlotNode(node)) {
|
|
13973
|
+
return renderSlot(node, options);
|
|
13974
|
+
}
|
|
13975
|
+
if (isFormNode(node)) {
|
|
13976
|
+
return renderForm(node, options);
|
|
13977
|
+
}
|
|
13337
13978
|
const resolved = resolveNode(node, catalog, path);
|
|
13338
13979
|
issues.push(...resolved.issues);
|
|
13339
13980
|
if (!resolved.ok) {
|
|
@@ -13344,15 +13985,37 @@ function renderNode(node, options) {
|
|
|
13344
13985
|
for (const [name, value] of Object.entries(props)) {
|
|
13345
13986
|
finalProps[name] = options.resolveValue ? options.resolveValue(value, path) : value;
|
|
13346
13987
|
}
|
|
13988
|
+
if (node.type === "ITDataTable" && finalProps.columns !== void 0) {
|
|
13989
|
+
finalProps.columns = prepararColumnas(finalProps.columns, node, options, path);
|
|
13990
|
+
}
|
|
13347
13991
|
for (const [name, action] of Object.entries(actions)) {
|
|
13992
|
+
const faltan = faltanCapacidades(action?.requires, options.capabilities);
|
|
13993
|
+
if (faltan.length > 0) {
|
|
13994
|
+
issues.push(
|
|
13995
|
+
issue("JR061", `La acci\xF3n "${nombreDeAccion(action)}" exige ${faltan.join(", ")}, que no est\xE1 concedido.`, formatPath(propPath(path, name)), {
|
|
13996
|
+
severity: "warning",
|
|
13997
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador. Sin ella, la acci\xF3n no se ejecuta."
|
|
13998
|
+
})
|
|
13999
|
+
);
|
|
14000
|
+
continue;
|
|
14001
|
+
}
|
|
13348
14002
|
const handler = options.resolveAction?.(node, name, action, path);
|
|
13349
|
-
if (typeof handler === "function")
|
|
14003
|
+
if (typeof handler === "function") {
|
|
14004
|
+
finalProps[name] = wrapAction(handler, action, effectContext(options, path, node));
|
|
14005
|
+
} else {
|
|
14006
|
+
issues.push(
|
|
14007
|
+
issue("JR040", `La acci\xF3n "${nombreDeAccion(action)}" no est\xE1 registrada por el host.`, formatPath(propPath(path, name)), {
|
|
14008
|
+
severity: "warning",
|
|
14009
|
+
hint: "Reg\xEDstrala en `resolveAction` del host, o quita la prop del esquema."
|
|
14010
|
+
})
|
|
14011
|
+
);
|
|
14012
|
+
}
|
|
13350
14013
|
}
|
|
13351
14014
|
const content = renderChildren ? renderChildren(node, path) : null;
|
|
13352
14015
|
const rawText = entry.text && node.text !== void 0 ? node.text : void 0;
|
|
13353
14016
|
const text = rawText === void 0 ? void 0 : options.resolveValue ? options.resolveValue(rawText, path) : rawText;
|
|
13354
14017
|
const children = content ?? text;
|
|
13355
|
-
const element =
|
|
14018
|
+
const element = import_react55.default.createElement(
|
|
13356
14019
|
entry.component,
|
|
13357
14020
|
{ ...finalProps, key: node.id ?? path.join("-"), id: node.id },
|
|
13358
14021
|
children
|
|
@@ -13408,7 +14071,7 @@ function countPendingNodes(schema) {
|
|
|
13408
14071
|
}
|
|
13409
14072
|
|
|
13410
14073
|
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
13411
|
-
var
|
|
14074
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13412
14075
|
function renderTree(node, path, context, level) {
|
|
13413
14076
|
if (!node || typeof node !== "object") return null;
|
|
13414
14077
|
if (level > context.limits.maxDepth) return null;
|
|
@@ -13418,6 +14081,16 @@ function renderTree(node, path, context, level) {
|
|
|
13418
14081
|
issues.push(issue2);
|
|
13419
14082
|
context.onIssue?.(issue2);
|
|
13420
14083
|
};
|
|
14084
|
+
const faltan = faltanCapacidades(node.requires, context.capabilities);
|
|
14085
|
+
if (faltan.length > 0) {
|
|
14086
|
+
reportIssue(
|
|
14087
|
+
issue("JR060", `Falta la capacidad ${faltan.join(", ")} para pintar \`${node.type}\`.`, formatPath(path), {
|
|
14088
|
+
severity: "warning",
|
|
14089
|
+
hint: "El host debe conceder la capacidad con la prop `capabilities`, o el nodo debe declarar un `fallback`."
|
|
14090
|
+
})
|
|
14091
|
+
);
|
|
14092
|
+
return node.fallback ? renderTree(node.fallback, [...path, "fallback"], context, level + 1) : null;
|
|
14093
|
+
}
|
|
13421
14094
|
const issuesBefore = issues.length;
|
|
13422
14095
|
const element = renderNode(node, {
|
|
13423
14096
|
catalog: context.catalog,
|
|
@@ -13426,6 +14099,12 @@ function renderTree(node, path, context, level) {
|
|
|
13426
14099
|
resolveValue: context.resolveValue,
|
|
13427
14100
|
resolveAction: context.resolveAction,
|
|
13428
14101
|
pendingFallback: context.pendingFallback,
|
|
14102
|
+
slots: context.slots,
|
|
14103
|
+
effects: context.effects,
|
|
14104
|
+
actionTimeoutMs: context.limits.actionTimeoutMs,
|
|
14105
|
+
onIssue: context.onIssue,
|
|
14106
|
+
setState: context.setState,
|
|
14107
|
+
capabilities: context.capabilities,
|
|
13429
14108
|
renderChildren: (current, currentPath) => {
|
|
13430
14109
|
const children = childList(current);
|
|
13431
14110
|
if (children.length === 0) return void 0;
|
|
@@ -13438,7 +14117,7 @@ function renderTree(node, path, context, level) {
|
|
|
13438
14117
|
context.onIssue?.(issues[index]);
|
|
13439
14118
|
}
|
|
13440
14119
|
const fallback = node.fallback ? renderTree(node.fallback, [...path, "fallback"], context, level + 1) : context.pendingFallback ?? null;
|
|
13441
|
-
const wrapped = /* @__PURE__ */ (0,
|
|
14120
|
+
const wrapped = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13442
14121
|
NodeBoundary,
|
|
13443
14122
|
{
|
|
13444
14123
|
path: path.join("."),
|
|
@@ -13460,43 +14139,84 @@ function ITSchemaRenderer({
|
|
|
13460
14139
|
schema,
|
|
13461
14140
|
catalog = axzyCatalog,
|
|
13462
14141
|
limits,
|
|
14142
|
+
params,
|
|
14143
|
+
dataHandlers,
|
|
14144
|
+
slots,
|
|
14145
|
+
effects,
|
|
14146
|
+
capabilities,
|
|
13463
14147
|
resolveValue,
|
|
13464
14148
|
resolveAction,
|
|
13465
14149
|
pendingFallback,
|
|
13466
14150
|
onIssue,
|
|
13467
14151
|
className
|
|
13468
14152
|
}) {
|
|
13469
|
-
const resolvedLimits = (0,
|
|
14153
|
+
const resolvedLimits = (0, import_react56.useMemo)(() => resolveLimits(limits), [limits]);
|
|
14154
|
+
const [escrito, setEscrito] = (0, import_react56.useState)({
|
|
14155
|
+
origen: schema,
|
|
14156
|
+
valores: {}
|
|
14157
|
+
});
|
|
14158
|
+
const valoresPantalla = (0, import_react56.useMemo)(
|
|
14159
|
+
() => ({ ...schema?.state ?? {}, ...escrito.origen === schema ? escrito.valores : {} }),
|
|
14160
|
+
[schema, escrito]
|
|
14161
|
+
);
|
|
14162
|
+
const escribirEstado = (0, import_react56.useCallback)(
|
|
14163
|
+
(cambios) => setEscrito((previo) => ({
|
|
14164
|
+
origen: schema,
|
|
14165
|
+
valores: { ...previo.origen === schema ? previo.valores : {}, ...cambios }
|
|
14166
|
+
})),
|
|
14167
|
+
[schema]
|
|
14168
|
+
);
|
|
13470
14169
|
const issues = [];
|
|
13471
14170
|
const nodeIds = /* @__PURE__ */ new Set();
|
|
13472
|
-
const audit = (0,
|
|
14171
|
+
const audit = (0, import_react56.useMemo)(
|
|
13473
14172
|
() => schema ? auditTree(schema, resolvedLimits) : null,
|
|
13474
14173
|
[schema, resolvedLimits]
|
|
13475
14174
|
);
|
|
13476
|
-
const context = (0,
|
|
14175
|
+
const context = (0, import_react56.useMemo)(
|
|
13477
14176
|
() => ({
|
|
13478
14177
|
catalog,
|
|
13479
14178
|
nodeIds,
|
|
13480
14179
|
limits: resolvedLimits,
|
|
13481
14180
|
issues,
|
|
13482
14181
|
onIssue,
|
|
13483
|
-
|
|
14182
|
+
// El binding escribe sus avisos (JR030, JR032) en el mismo array que el resto del render.
|
|
14183
|
+
resolveValue: createBindingResolver({
|
|
14184
|
+
data: schema?.data,
|
|
14185
|
+
state: valoresPantalla,
|
|
14186
|
+
params,
|
|
14187
|
+
handlers: dataHandlers,
|
|
14188
|
+
report: (aviso) => issues.push(aviso),
|
|
14189
|
+
host: resolveValue
|
|
14190
|
+
}),
|
|
13484
14191
|
resolveAction,
|
|
13485
|
-
pendingFallback
|
|
14192
|
+
pendingFallback,
|
|
14193
|
+
slots,
|
|
14194
|
+
effects,
|
|
14195
|
+
capabilities,
|
|
14196
|
+
setState: escribirEstado
|
|
13486
14197
|
}),
|
|
13487
14198
|
// `issues` es un array nuevo en cada render a propósito: acumular avisos
|
|
13488
14199
|
// entre renders duplicaría los avisos de esquemas que no han cambiado.
|
|
13489
14200
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13490
|
-
[catalog, resolvedLimits, onIssue, resolveValue, resolveAction, pendingFallback]
|
|
14201
|
+
[schema, params, valoresPantalla, escribirEstado, dataHandlers, slots, effects, capabilities, catalog, resolvedLimits, onIssue, resolveValue, resolveAction, pendingFallback]
|
|
13491
14202
|
);
|
|
13492
|
-
const
|
|
14203
|
+
const faltanRaiz = schema ? faltanCapacidades(schema.requires, capabilities) : [];
|
|
14204
|
+
if (faltanRaiz.length > 0) {
|
|
14205
|
+
issues.push(
|
|
14206
|
+
issue("JR060", `Falta la capacidad ${faltanRaiz.join(", ")} para esta pantalla.`, "requires", {
|
|
14207
|
+
severity: "error",
|
|
14208
|
+
hint: "Concede la capacidad con la prop `capabilities` del renderizador."
|
|
14209
|
+
})
|
|
14210
|
+
);
|
|
14211
|
+
}
|
|
14212
|
+
const content = schema && faltanRaiz.length === 0 ? (Array.isArray(schema.content) ? schema.content : [schema.content]).filter(
|
|
13493
14213
|
(node) => Boolean(node) && typeof node === "object"
|
|
13494
14214
|
) : [];
|
|
13495
14215
|
const children = content.slice(0, resolvedLimits.maxNodes).map((node, index) => renderTree(node, ["content", index], context, 0)).filter(Boolean);
|
|
13496
14216
|
const collected = [...audit?.issues ?? [], ...issues];
|
|
13497
14217
|
const signature = collected.map((issue2) => `${issue2.code}:${issue2.path}`).join("|");
|
|
13498
|
-
const reported = (0,
|
|
13499
|
-
(0,
|
|
14218
|
+
const reported = (0, import_react56.useRef)("");
|
|
14219
|
+
(0, import_react56.useEffect)(() => {
|
|
13500
14220
|
const all = [...collected];
|
|
13501
14221
|
for (const id of nodeIds) {
|
|
13502
14222
|
if (!document.getElementById(id)) {
|
|
@@ -13515,7 +14235,159 @@ function ITSchemaRenderer({
|
|
|
13515
14235
|
for (const issue2 of all) onIssue(issue2);
|
|
13516
14236
|
}, [signature, onIssue]);
|
|
13517
14237
|
if (!schema || children.length === 0) return null;
|
|
13518
|
-
return className ? /* @__PURE__ */ (0,
|
|
14238
|
+
return className ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className, children }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children });
|
|
14239
|
+
}
|
|
14240
|
+
|
|
14241
|
+
// src/json-renderer/routing/routes.ts
|
|
14242
|
+
function joinRoutePath(parent, own2) {
|
|
14243
|
+
return [parent, typeof own2 === "string" ? own2 : ""].flatMap((part) => part.split("/")).filter((segment) => segment !== "").join("/");
|
|
14244
|
+
}
|
|
14245
|
+
var SEGMENT = /^(:[A-Za-z][A-Za-z0-9_]*|[A-Za-z0-9_.-]+)$/;
|
|
14246
|
+
function validateRoutes(input) {
|
|
14247
|
+
const errors = [];
|
|
14248
|
+
const document2 = input;
|
|
14249
|
+
if (!document2 || typeof document2 !== "object" || Array.isArray(document2)) {
|
|
14250
|
+
return [issue("JR020", "El documento de rutas debe ser un objeto.", "", { severity: "error" })];
|
|
14251
|
+
}
|
|
14252
|
+
if (typeof document2.version !== "number") {
|
|
14253
|
+
errors.push(issue("JR020", "El documento de rutas no declara `version`.", "version", { severity: "error" }));
|
|
14254
|
+
}
|
|
14255
|
+
if (!Array.isArray(document2.routes)) {
|
|
14256
|
+
errors.push(issue("JR020", "`routes` debe ser una lista.", "routes", { severity: "error" }));
|
|
14257
|
+
return errors;
|
|
14258
|
+
}
|
|
14259
|
+
const seen = /* @__PURE__ */ new Map();
|
|
14260
|
+
const visit = (route, path, parentPath, isRoot) => {
|
|
14261
|
+
if (!route || typeof route !== "object") {
|
|
14262
|
+
errors.push(issue("JR021", "La ruta no es un objeto.", path, { severity: "error" }));
|
|
14263
|
+
return;
|
|
14264
|
+
}
|
|
14265
|
+
if (typeof route.id !== "string" || route.id === "") {
|
|
14266
|
+
errors.push(issue("JR021", "La ruta no declara `id`.", path, { severity: "error" }));
|
|
14267
|
+
}
|
|
14268
|
+
if (route.path !== void 0 && route.path !== "") {
|
|
14269
|
+
const parts = typeof route.path === "string" ? route.path.split("/").filter(Boolean) : [];
|
|
14270
|
+
if (typeof route.path !== "string" || parts.some((segment) => !SEGMENT.test(segment))) {
|
|
14271
|
+
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`." }));
|
|
14272
|
+
}
|
|
14273
|
+
}
|
|
14274
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14275
|
+
if (isRoot && full === "") {
|
|
14276
|
+
errors.push(issue("JR021", "Una ruta ra\xEDz necesita `path`.", `${path}.path`, { severity: "error" }));
|
|
14277
|
+
}
|
|
14278
|
+
if (route.children !== void 0) {
|
|
14279
|
+
if (route.page !== void 0) {
|
|
14280
|
+
errors.push(issue("JR020", "Un grupo no lleva `page`: la pantalla va en sus hijos.", path, { severity: "error" }));
|
|
14281
|
+
}
|
|
14282
|
+
if (!Array.isArray(route.children)) {
|
|
14283
|
+
errors.push(issue("JR020", "`children` debe ser una lista.", `${path}.children`, { severity: "error" }));
|
|
14284
|
+
} else {
|
|
14285
|
+
route.children.forEach((child, index) => visit(child, `${path}.children[${index}]`, full, false));
|
|
14286
|
+
}
|
|
14287
|
+
} else {
|
|
14288
|
+
if (typeof route.page !== "string" || route.page === "") {
|
|
14289
|
+
errors.push(issue("JR020", "La ruta no declara `page`.", path, { severity: "error" }));
|
|
14290
|
+
}
|
|
14291
|
+
const key = `${full}?${JSON.stringify(Object.entries(route.query ?? {}).sort())}`;
|
|
14292
|
+
if (seen.has(key)) {
|
|
14293
|
+
errors.push(issue("JR020", `La ruta "${full || "/"}" se repite con la misma query (ya est\xE1 en ${seen.get(key)}).`, path, { severity: "error" }));
|
|
14294
|
+
} else {
|
|
14295
|
+
seen.set(key, path);
|
|
14296
|
+
}
|
|
14297
|
+
}
|
|
14298
|
+
const nav = route.nav;
|
|
14299
|
+
if (nav !== void 0 && (typeof nav !== "object" || nav === null || nav.label === void 0 || nav.label === null)) {
|
|
14300
|
+
errors.push(issue("JR021", "La entrada de men\xFA no declara `label`.", `${path}.nav`, { severity: "error" }));
|
|
14301
|
+
}
|
|
14302
|
+
};
|
|
14303
|
+
document2.routes.forEach((route, index) => visit(route, `routes[${index}]`, "", true));
|
|
14304
|
+
return errors;
|
|
14305
|
+
}
|
|
14306
|
+
function flattenRoutes(routes) {
|
|
14307
|
+
const flat = [];
|
|
14308
|
+
const visit = (route, parentPath, groups) => {
|
|
14309
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14310
|
+
if (route.children) {
|
|
14311
|
+
route.children.forEach((child) => visit(child, full, [...groups, route.id]));
|
|
14312
|
+
return;
|
|
14313
|
+
}
|
|
14314
|
+
if (typeof route.page !== "string") return;
|
|
14315
|
+
flat.push({
|
|
14316
|
+
id: route.id,
|
|
14317
|
+
segments: full === "" ? [] : full.split("/"),
|
|
14318
|
+
page: route.page,
|
|
14319
|
+
query: route.query ?? {},
|
|
14320
|
+
nav: route.nav,
|
|
14321
|
+
groups
|
|
14322
|
+
});
|
|
14323
|
+
};
|
|
14324
|
+
routes.forEach((route) => visit(route, "", []));
|
|
14325
|
+
return flat;
|
|
14326
|
+
}
|
|
14327
|
+
|
|
14328
|
+
// src/json-renderer/routing/match.ts
|
|
14329
|
+
function matchRoute(routes, segments, query = {}) {
|
|
14330
|
+
let best = null;
|
|
14331
|
+
let bestStatics = -1;
|
|
14332
|
+
let bestConstraints = -1;
|
|
14333
|
+
for (const route of routes) {
|
|
14334
|
+
if (route.segments.length !== segments.length) continue;
|
|
14335
|
+
const params = {};
|
|
14336
|
+
let statics = 0;
|
|
14337
|
+
let samePath = true;
|
|
14338
|
+
route.segments.forEach((expected, index) => {
|
|
14339
|
+
if (!samePath) return;
|
|
14340
|
+
if (expected.startsWith(":")) {
|
|
14341
|
+
params[expected.slice(1)] = segments[index];
|
|
14342
|
+
return;
|
|
14343
|
+
}
|
|
14344
|
+
statics += 1;
|
|
14345
|
+
samePath = expected === segments[index];
|
|
14346
|
+
});
|
|
14347
|
+
if (!samePath) continue;
|
|
14348
|
+
const constraints = Object.entries(route.query);
|
|
14349
|
+
if (!constraints.every(([key, value]) => query[key] === value)) continue;
|
|
14350
|
+
if (statics > bestStatics || statics === bestStatics && constraints.length > bestConstraints) {
|
|
14351
|
+
best = { route, params };
|
|
14352
|
+
bestStatics = statics;
|
|
14353
|
+
bestConstraints = constraints.length;
|
|
14354
|
+
}
|
|
14355
|
+
}
|
|
14356
|
+
return best;
|
|
14357
|
+
}
|
|
14358
|
+
function routeHref(route, params = {}) {
|
|
14359
|
+
const path = route.segments.map((segment) => segment.startsWith(":") ? params[segment.slice(1)] ?? segment : segment).join("/");
|
|
14360
|
+
const queryString = Object.entries(route.query).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
|
|
14361
|
+
return `/${path}${queryString ? `?${queryString}` : ""}`;
|
|
14362
|
+
}
|
|
14363
|
+
|
|
14364
|
+
// src/json-renderer/routing/navigation.ts
|
|
14365
|
+
function buildNavigationTree(routes) {
|
|
14366
|
+
const hrefs = new Map(flattenRoutes(routes).map((route) => [route.id, routeHref(route)]));
|
|
14367
|
+
const visit = (route, parentPath) => {
|
|
14368
|
+
const full = joinRoutePath(parentPath, route.path);
|
|
14369
|
+
if (route.children) {
|
|
14370
|
+
const children = route.children.flatMap((child) => visit(child, full));
|
|
14371
|
+
if (!route.nav) return children;
|
|
14372
|
+
return [toNode(route.id, route.nav, children, children.find((child) => child.href)?.href)];
|
|
14373
|
+
}
|
|
14374
|
+
if (!route.nav) return [];
|
|
14375
|
+
return [toNode(route.id, route.nav, void 0, hrefs.get(route.id))];
|
|
14376
|
+
};
|
|
14377
|
+
return routes.flatMap((route) => visit(route, ""));
|
|
14378
|
+
}
|
|
14379
|
+
function toNode(id, nav, children, href) {
|
|
14380
|
+
return {
|
|
14381
|
+
id,
|
|
14382
|
+
label: nav.label,
|
|
14383
|
+
icon: nav.icon,
|
|
14384
|
+
badge: nav.badge,
|
|
14385
|
+
href,
|
|
14386
|
+
...children ? { children } : {}
|
|
14387
|
+
};
|
|
14388
|
+
}
|
|
14389
|
+
function navContainsRoute(entry, routeId) {
|
|
14390
|
+
return entry.id === routeId || (entry.children?.some((child) => navContainsRoute(child, routeId)) ?? false);
|
|
13519
14391
|
}
|
|
13520
14392
|
|
|
13521
14393
|
// src/json-renderer/validation/validate.ts
|
|
@@ -13526,6 +14398,17 @@ function validateNodes(node, path, catalog, errors, warnings) {
|
|
|
13526
14398
|
return 0;
|
|
13527
14399
|
}
|
|
13528
14400
|
if (isNodePending(node)) return 1;
|
|
14401
|
+
if (node.type === "form") {
|
|
14402
|
+
const { issues: avisos } = readFormFields(node.props?.fields, [...path, "props", "fields"]);
|
|
14403
|
+
for (const item of avisos) (item.severity === "error" ? errors : warnings).push(item);
|
|
14404
|
+
return 0;
|
|
14405
|
+
}
|
|
14406
|
+
if (isSlotNode(node)) {
|
|
14407
|
+
if (!slotName(node)) {
|
|
14408
|
+
errors.push(issue("JR011", "El slot no declara `props.name`.", formatPath([...path, "props", "name"]), { severity: "error" }));
|
|
14409
|
+
}
|
|
14410
|
+
return 0;
|
|
14411
|
+
}
|
|
13529
14412
|
const resolved = resolveNode(node, catalog, path);
|
|
13530
14413
|
for (const item of resolved.issues) {
|
|
13531
14414
|
(item.severity === "error" ? errors : warnings).push(item);
|
|
@@ -13708,8 +14591,143 @@ function formatVocabularyForPrompt(contract) {
|
|
|
13708
14591
|
return lines.join("\n");
|
|
13709
14592
|
}
|
|
13710
14593
|
|
|
14594
|
+
// src/json-renderer/stream/useSchemaStream.ts
|
|
14595
|
+
var import_react57 = require("react");
|
|
14596
|
+
var VACIO = {
|
|
14597
|
+
tree: null,
|
|
14598
|
+
status: "complete",
|
|
14599
|
+
broken: false,
|
|
14600
|
+
pendingNodes: 0,
|
|
14601
|
+
streaming: false,
|
|
14602
|
+
text: "",
|
|
14603
|
+
issues: []
|
|
14604
|
+
};
|
|
14605
|
+
var grabaciones = /* @__PURE__ */ new WeakMap();
|
|
14606
|
+
function esAsyncIterable(value) {
|
|
14607
|
+
return value !== null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
14608
|
+
}
|
|
14609
|
+
async function* desdeReadable(readable) {
|
|
14610
|
+
const reader = readable.getReader();
|
|
14611
|
+
try {
|
|
14612
|
+
for (; ; ) {
|
|
14613
|
+
const { done, value } = await reader.read();
|
|
14614
|
+
if (done) return;
|
|
14615
|
+
yield value;
|
|
14616
|
+
}
|
|
14617
|
+
} finally {
|
|
14618
|
+
await reader.cancel().catch(() => void 0);
|
|
14619
|
+
}
|
|
14620
|
+
}
|
|
14621
|
+
function mensajeDe(error) {
|
|
14622
|
+
return error instanceof Error ? error.message : String(error);
|
|
14623
|
+
}
|
|
14624
|
+
function crearGrabacion(source) {
|
|
14625
|
+
const iterador = typeof source === "string" ? null : esAsyncIterable(source) ? source[Symbol.asyncIterator]() : desdeReadable(source)[Symbol.asyncIterator]();
|
|
14626
|
+
return {
|
|
14627
|
+
texto: typeof source === "string" ? source : "",
|
|
14628
|
+
iterador,
|
|
14629
|
+
terminado: typeof source === "string",
|
|
14630
|
+
error: null,
|
|
14631
|
+
avisos: [],
|
|
14632
|
+
activos: 0,
|
|
14633
|
+
ultimoValido: null,
|
|
14634
|
+
cerrada: false,
|
|
14635
|
+
cancelada: false
|
|
14636
|
+
};
|
|
14637
|
+
}
|
|
14638
|
+
function estadoDe(grab, streaming) {
|
|
14639
|
+
const parcial = parsePartialSchema(grab.texto);
|
|
14640
|
+
if (!parcial.broken && parcial.tree) grab.ultimoValido = parcial.tree;
|
|
14641
|
+
return {
|
|
14642
|
+
tree: parcial.broken ? grab.ultimoValido : parcial.tree,
|
|
14643
|
+
status: parcial.status,
|
|
14644
|
+
broken: parcial.broken,
|
|
14645
|
+
pendingNodes: parcial.pendingNodes,
|
|
14646
|
+
streaming,
|
|
14647
|
+
text: grab.texto,
|
|
14648
|
+
issues: [...grab.avisos]
|
|
14649
|
+
};
|
|
14650
|
+
}
|
|
14651
|
+
function cerrarGrabacion(grab) {
|
|
14652
|
+
if (grab.cerrada || grab.cancelada) return;
|
|
14653
|
+
grab.cerrada = true;
|
|
14654
|
+
if (grab.error !== null) {
|
|
14655
|
+
grab.avisos.push(issue("JR080", `El stream fall\xF3: ${grab.error}. Se conserva el \xFAltimo \xE1rbol v\xE1lido.`, "", { severity: "error" }));
|
|
14656
|
+
return;
|
|
14657
|
+
}
|
|
14658
|
+
const parcial = parsePartialSchema(grab.texto);
|
|
14659
|
+
if (parcial.broken || parcial.status !== "complete") {
|
|
14660
|
+
grab.avisos.push(
|
|
14661
|
+
issue("JR080", "El stream termin\xF3 con el JSON sin cerrar. Se conserva el \xFAltimo \xE1rbol v\xE1lido.", "", {
|
|
14662
|
+
severity: "warning",
|
|
14663
|
+
hint: "Revisa que el emisor cierre todas las llaves y corchetes."
|
|
14664
|
+
})
|
|
14665
|
+
);
|
|
14666
|
+
}
|
|
14667
|
+
}
|
|
14668
|
+
async function consumir(grab, cancelado, onTrozo) {
|
|
14669
|
+
while (!grab.terminado && grab.iterador) {
|
|
14670
|
+
let paso;
|
|
14671
|
+
try {
|
|
14672
|
+
paso = await grab.iterador.next();
|
|
14673
|
+
} catch (error) {
|
|
14674
|
+
grab.error = mensajeDe(error);
|
|
14675
|
+
grab.terminado = true;
|
|
14676
|
+
break;
|
|
14677
|
+
}
|
|
14678
|
+
if (paso.done) {
|
|
14679
|
+
grab.terminado = true;
|
|
14680
|
+
break;
|
|
14681
|
+
}
|
|
14682
|
+
grab.texto += String(paso.value);
|
|
14683
|
+
if (!cancelado()) onTrozo();
|
|
14684
|
+
if (cancelado()) return;
|
|
14685
|
+
}
|
|
14686
|
+
if (grab.terminado) cerrarGrabacion(grab);
|
|
14687
|
+
}
|
|
14688
|
+
function useSchemaStream(source) {
|
|
14689
|
+
const [estado, setEstado] = (0, import_react57.useState)(VACIO);
|
|
14690
|
+
(0, import_react57.useEffect)(() => {
|
|
14691
|
+
if (source === null || source === void 0) {
|
|
14692
|
+
setEstado(VACIO);
|
|
14693
|
+
return;
|
|
14694
|
+
}
|
|
14695
|
+
let registro;
|
|
14696
|
+
if (typeof source === "string") {
|
|
14697
|
+
registro = crearGrabacion(source);
|
|
14698
|
+
} else {
|
|
14699
|
+
const existente = grabaciones.get(source);
|
|
14700
|
+
registro = existente ?? crearGrabacion(source);
|
|
14701
|
+
if (!existente) grabaciones.set(source, registro);
|
|
14702
|
+
}
|
|
14703
|
+
registro.activos += 1;
|
|
14704
|
+
let cancelado = false;
|
|
14705
|
+
const proceso = consumir(
|
|
14706
|
+
registro,
|
|
14707
|
+
() => cancelado,
|
|
14708
|
+
() => setEstado(estadoDe(registro, true))
|
|
14709
|
+
);
|
|
14710
|
+
setEstado(estadoDe(registro, !registro.terminado));
|
|
14711
|
+
void proceso.then(() => {
|
|
14712
|
+
if (!cancelado) setEstado(estadoDe(registro, false));
|
|
14713
|
+
});
|
|
14714
|
+
return () => {
|
|
14715
|
+
cancelado = true;
|
|
14716
|
+
registro.activos -= 1;
|
|
14717
|
+
setTimeout(() => {
|
|
14718
|
+
if (registro.activos === 0 && !registro.terminado && registro.iterador) {
|
|
14719
|
+
registro.terminado = true;
|
|
14720
|
+
registro.cancelada = true;
|
|
14721
|
+
void registro.iterador.return?.(void 0);
|
|
14722
|
+
}
|
|
14723
|
+
}, 0);
|
|
14724
|
+
};
|
|
14725
|
+
}, [source]);
|
|
14726
|
+
return estado;
|
|
14727
|
+
}
|
|
14728
|
+
|
|
13711
14729
|
// src/components/organisms/dropfile/dropfile.tsx
|
|
13712
|
-
var
|
|
14730
|
+
var import_react58 = require("react");
|
|
13713
14731
|
var import_react_dropzone = require("react-dropzone");
|
|
13714
14732
|
var import_clsx54 = __toESM(require("clsx"), 1);
|
|
13715
14733
|
|
|
@@ -13739,11 +14757,12 @@ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
|
13739
14757
|
})(UploadStatus || {});
|
|
13740
14758
|
|
|
13741
14759
|
// src/components/organisms/dropfile/dropfile.tsx
|
|
13742
|
-
var
|
|
14760
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
13743
14761
|
var ITDropfile = ({
|
|
13744
14762
|
onFileSelect,
|
|
13745
14763
|
onCancel,
|
|
13746
14764
|
onSubmit,
|
|
14765
|
+
autoUpload = false,
|
|
13747
14766
|
contentClassName,
|
|
13748
14767
|
containerClassName,
|
|
13749
14768
|
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 */],
|
|
@@ -13756,15 +14775,15 @@ var ITDropfile = ({
|
|
|
13756
14775
|
modalTitle
|
|
13757
14776
|
}) => {
|
|
13758
14777
|
const { t } = useITTranslation();
|
|
13759
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
13760
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
13761
|
-
const [fileType, setFileType] = (0,
|
|
13762
|
-
const [imagePreview, setImagePreview] = (0,
|
|
13763
|
-
const [isConfirmed, setIsConfirmed] = (0,
|
|
13764
|
-
const [internalUploadStatus, setInternalUploadStatus] = (0,
|
|
14778
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react58.useState)(false);
|
|
14779
|
+
const [selectedFile, setSelectedFile] = (0, import_react58.useState)(null);
|
|
14780
|
+
const [fileType, setFileType] = (0, import_react58.useState)(null);
|
|
14781
|
+
const [imagePreview, setImagePreview] = (0, import_react58.useState)(initialPreviewUrl || null);
|
|
14782
|
+
const [isConfirmed, setIsConfirmed] = (0, import_react58.useState)(false);
|
|
14783
|
+
const [internalUploadStatus, setInternalUploadStatus] = (0, import_react58.useState)(
|
|
13765
14784
|
initialPreviewUrl ? "subido" /* UPLOADED */ : "pendiente" /* PENDING */
|
|
13766
14785
|
);
|
|
13767
|
-
(0,
|
|
14786
|
+
(0, import_react58.useEffect)(() => {
|
|
13768
14787
|
if (initialPreviewUrl && !selectedFile) {
|
|
13769
14788
|
setImagePreview(initialPreviewUrl);
|
|
13770
14789
|
if (externalStatus === void 0) setInternalUploadStatus("subido" /* UPLOADED */);
|
|
@@ -13879,11 +14898,23 @@ var ITDropfile = ({
|
|
|
13879
14898
|
}
|
|
13880
14899
|
};
|
|
13881
14900
|
const { label, color, dotColor } = config2[status];
|
|
13882
|
-
return /* @__PURE__ */ (0,
|
|
13883
|
-
/* @__PURE__ */ (0,
|
|
13884
|
-
/* @__PURE__ */ (0,
|
|
14901
|
+
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: [
|
|
14902
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `w-2 h-2 rounded-full ${dotColor}` }),
|
|
14903
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "text-xs font-medium flex items-center gap-1.5", children: label })
|
|
13885
14904
|
] });
|
|
13886
14905
|
};
|
|
14906
|
+
const runAutoUpload = async (file) => {
|
|
14907
|
+
setIsConfirmed(true);
|
|
14908
|
+
setUploadStatus("subiendo" /* UPLOADING */);
|
|
14909
|
+
try {
|
|
14910
|
+
onFileSelect(file);
|
|
14911
|
+
await onSubmit?.(file);
|
|
14912
|
+
setUploadStatus("subido" /* UPLOADED */);
|
|
14913
|
+
} catch (error) {
|
|
14914
|
+
setUploadStatus("error" /* ERROR */);
|
|
14915
|
+
console.error("Error al subir archivo:", error);
|
|
14916
|
+
}
|
|
14917
|
+
};
|
|
13887
14918
|
const onDrop = (acceptedFiles) => {
|
|
13888
14919
|
const file = acceptedFiles[0];
|
|
13889
14920
|
if (file) {
|
|
@@ -13899,6 +14930,7 @@ var ITDropfile = ({
|
|
|
13899
14930
|
const previewUrl = URL.createObjectURL(file);
|
|
13900
14931
|
setImagePreview(previewUrl);
|
|
13901
14932
|
}
|
|
14933
|
+
if (autoUpload) void runAutoUpload(file);
|
|
13902
14934
|
} else {
|
|
13903
14935
|
alert(t("dropfile.fileTypeNotAllowed"));
|
|
13904
14936
|
setSelectedFile(null);
|
|
@@ -13913,12 +14945,12 @@ var ITDropfile = ({
|
|
|
13913
14945
|
accept: getAcceptedFileTypes(),
|
|
13914
14946
|
maxFiles: 1
|
|
13915
14947
|
});
|
|
13916
|
-
(0,
|
|
14948
|
+
(0, import_react58.useEffect)(() => {
|
|
13917
14949
|
const renderPDF = async () => {
|
|
13918
14950
|
};
|
|
13919
14951
|
renderPDF();
|
|
13920
14952
|
}, [selectedFile, fileType]);
|
|
13921
|
-
(0,
|
|
14953
|
+
(0, import_react58.useEffect)(() => {
|
|
13922
14954
|
return () => {
|
|
13923
14955
|
if (imagePreview) {
|
|
13924
14956
|
URL.revokeObjectURL(imagePreview);
|
|
@@ -13955,7 +14987,7 @@ var ITDropfile = ({
|
|
|
13955
14987
|
const handleDelete = () => {
|
|
13956
14988
|
handleCancel();
|
|
13957
14989
|
};
|
|
13958
|
-
(0,
|
|
14990
|
+
(0, import_react58.useEffect)(() => {
|
|
13959
14991
|
if (view === "button" && isConfirmed && uploadStatus === "subido" /* UPLOADED */) {
|
|
13960
14992
|
const timeout = setTimeout(() => {
|
|
13961
14993
|
setIsModalOpen(false);
|
|
@@ -13972,21 +15004,21 @@ var ITDropfile = ({
|
|
|
13972
15004
|
return () => clearTimeout(timeout);
|
|
13973
15005
|
}
|
|
13974
15006
|
}, [view, isConfirmed, uploadStatus, externalStatus, onStatusChange]);
|
|
13975
|
-
const headerRow = /* @__PURE__ */ (0,
|
|
13976
|
-
/* @__PURE__ */ (0,
|
|
13977
|
-
/* @__PURE__ */ (0,
|
|
15007
|
+
const headerRow = /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
|
|
15008
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("label", { className: "block text-sm font-semibold text-secondary-700", children: [
|
|
15009
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ITText, { as: "span", children: [
|
|
13978
15010
|
t("dropfile.upload"),
|
|
13979
15011
|
" "
|
|
13980
15012
|
] }),
|
|
13981
|
-
/* @__PURE__ */ (0,
|
|
15013
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ITText, { as: "span", className: "text-secondary-400 font-normal text-xs", children: [
|
|
13982
15014
|
"(",
|
|
13983
15015
|
getFileExtensions(),
|
|
13984
15016
|
")"
|
|
13985
15017
|
] })
|
|
13986
15018
|
] }),
|
|
13987
|
-
showStatusBadge && selectedFile && /* @__PURE__ */ (0,
|
|
15019
|
+
showStatusBadge && selectedFile && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(StatusBadge, { status: uploadStatus })
|
|
13988
15020
|
] });
|
|
13989
|
-
const dropZoneOrPreview = /* @__PURE__ */ (0,
|
|
15021
|
+
const dropZoneOrPreview = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: !selectedFile && !imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
13990
15022
|
"div",
|
|
13991
15023
|
{
|
|
13992
15024
|
...getRootProps(),
|
|
@@ -13996,41 +15028,41 @@ var ITDropfile = ({
|
|
|
13996
15028
|
${isDragActive ? "border-primary-500 bg-primary-50 scale-[1.01]" : "border-secondary-300 bg-white hover:border-primary-400 hover:bg-secondary-50"}
|
|
13997
15029
|
`,
|
|
13998
15030
|
children: [
|
|
13999
|
-
/* @__PURE__ */ (0,
|
|
14000
|
-
/* @__PURE__ */ (0,
|
|
15031
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("input", { ...getInputProps() }),
|
|
15032
|
+
/* @__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)(
|
|
14001
15033
|
"svg",
|
|
14002
15034
|
{
|
|
14003
15035
|
className: `w-6 h-6 transition-colors duration-300 ${isDragActive ? "text-primary-600" : "text-secondary-400 group-hover:text-primary-500"}`,
|
|
14004
15036
|
fill: "none",
|
|
14005
15037
|
viewBox: "0 0 24 24",
|
|
14006
15038
|
stroke: "currentColor",
|
|
14007
|
-
children: /* @__PURE__ */ (0,
|
|
15039
|
+
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" })
|
|
14008
15040
|
}
|
|
14009
15041
|
) }),
|
|
14010
|
-
/* @__PURE__ */ (0,
|
|
15042
|
+
/* @__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") }) })
|
|
14011
15043
|
]
|
|
14012
15044
|
}
|
|
14013
|
-
) : /* @__PURE__ */ (0,
|
|
14014
|
-
/* @__PURE__ */ (0,
|
|
14015
|
-
/* @__PURE__ */ (0,
|
|
14016
|
-
/* @__PURE__ */ (0,
|
|
14017
|
-
/* @__PURE__ */ (0,
|
|
14018
|
-
/* @__PURE__ */ (0,
|
|
15045
|
+
) : /* @__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: [
|
|
15046
|
+
/* @__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: [
|
|
15047
|
+
/* @__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" }) }) }),
|
|
15048
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "min-w-0", children: [
|
|
15049
|
+
/* @__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") }),
|
|
15050
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "p", className: "text-[10px] text-secondary-500", children: selectedFile ? (selectedFile.size / 1024 / 1024).toFixed(2) + " MB" : "" })
|
|
14019
15051
|
] })
|
|
14020
15052
|
] }) }),
|
|
14021
|
-
/* @__PURE__ */ (0,
|
|
15053
|
+
/* @__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)(
|
|
14022
15054
|
"img",
|
|
14023
15055
|
{
|
|
14024
15056
|
src: imagePreview,
|
|
14025
15057
|
alt: t("dropfile.previewAlt"),
|
|
14026
15058
|
className: "w-full h-full object-contain max-h-[200px]"
|
|
14027
15059
|
}
|
|
14028
|
-
) : /* @__PURE__ */ (0,
|
|
14029
|
-
/* @__PURE__ */ (0,
|
|
14030
|
-
/* @__PURE__ */ (0,
|
|
15060
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "py-8 flex flex-col items-center text-secondary-400", children: [
|
|
15061
|
+
/* @__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" }) }),
|
|
15062
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "text-xs", children: t("dropfile.noPreview") })
|
|
14031
15063
|
] }) }),
|
|
14032
|
-
/* @__PURE__ */ (0,
|
|
14033
|
-
/* @__PURE__ */ (0,
|
|
15064
|
+
/* @__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: [
|
|
15065
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14034
15066
|
ITButton,
|
|
14035
15067
|
{
|
|
14036
15068
|
type: "button",
|
|
@@ -14038,10 +15070,10 @@ var ITDropfile = ({
|
|
|
14038
15070
|
color: "secondary",
|
|
14039
15071
|
size: "sm",
|
|
14040
15072
|
onClick: handleCancel,
|
|
14041
|
-
children: /* @__PURE__ */ (0,
|
|
15073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.cancel") })
|
|
14042
15074
|
}
|
|
14043
15075
|
),
|
|
14044
|
-
/* @__PURE__ */ (0,
|
|
15076
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14045
15077
|
ITButton,
|
|
14046
15078
|
{
|
|
14047
15079
|
type: "button",
|
|
@@ -14049,13 +15081,13 @@ var ITDropfile = ({
|
|
|
14049
15081
|
color: "primary",
|
|
14050
15082
|
size: "sm",
|
|
14051
15083
|
onClick: handleConfirm,
|
|
14052
|
-
children: /* @__PURE__ */ (0,
|
|
14053
|
-
/* @__PURE__ */ (0,
|
|
14054
|
-
/* @__PURE__ */ (0,
|
|
15084
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15085
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.confirm") }),
|
|
15086
|
+
/* @__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" }) })
|
|
14055
15087
|
] })
|
|
14056
15088
|
}
|
|
14057
15089
|
)
|
|
14058
|
-
] }) : /* @__PURE__ */ (0,
|
|
15090
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14059
15091
|
ITButton,
|
|
14060
15092
|
{
|
|
14061
15093
|
type: "button",
|
|
@@ -14064,12 +15096,12 @@ var ITDropfile = ({
|
|
|
14064
15096
|
size: "sm",
|
|
14065
15097
|
onClick: handleDelete,
|
|
14066
15098
|
children: [
|
|
14067
|
-
/* @__PURE__ */ (0,
|
|
14068
|
-
/* @__PURE__ */ (0,
|
|
15099
|
+
/* @__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" }) }),
|
|
15100
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { children: t("common.delete") })
|
|
14069
15101
|
]
|
|
14070
15102
|
}
|
|
14071
15103
|
) }),
|
|
14072
|
-
uploadStatus === "subiendo" /* UPLOADING */ && /* @__PURE__ */ (0,
|
|
15104
|
+
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)(
|
|
14073
15105
|
"div",
|
|
14074
15106
|
{
|
|
14075
15107
|
className: "bg-primary-600 h-1.5 rounded-full transition-all duration-1000 ease-out",
|
|
@@ -14082,8 +15114,8 @@ var ITDropfile = ({
|
|
|
14082
15114
|
] }) });
|
|
14083
15115
|
if (view === "button") {
|
|
14084
15116
|
const hasFile = Boolean(selectedFile || imagePreview);
|
|
14085
|
-
return /* @__PURE__ */ (0,
|
|
14086
|
-
/* @__PURE__ */ (0,
|
|
15117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_clsx54.default)("inline-block", containerClassName), children: [
|
|
15118
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14087
15119
|
ITButton,
|
|
14088
15120
|
{
|
|
14089
15121
|
type: "button",
|
|
@@ -14091,20 +15123,20 @@ var ITDropfile = ({
|
|
|
14091
15123
|
color: hasFile ? "primary" : "secondary",
|
|
14092
15124
|
size: "sm",
|
|
14093
15125
|
onClick: () => setIsModalOpen(true),
|
|
14094
|
-
children: /* @__PURE__ */ (0,
|
|
14095
|
-
/* @__PURE__ */ (0,
|
|
14096
|
-
/* @__PURE__ */ (0,
|
|
14097
|
-
showStatusBadge && hasFile && /* @__PURE__ */ (0,
|
|
15126
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2 max-w-[220px]", children: [
|
|
15127
|
+
/* @__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" }) }),
|
|
15128
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { className: "truncate", children: selectedFile?.name || (hasFile ? t("dropfile.fileLoaded") : buttonLabel ?? t("dropfile.upload")) }),
|
|
15129
|
+
showStatusBadge && hasFile && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(StatusBadge, { status: uploadStatus })
|
|
14098
15130
|
] })
|
|
14099
15131
|
}
|
|
14100
15132
|
),
|
|
14101
|
-
/* @__PURE__ */ (0,
|
|
15133
|
+
/* @__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: [
|
|
14102
15134
|
headerRow,
|
|
14103
15135
|
dropZoneOrPreview
|
|
14104
15136
|
] }) })
|
|
14105
15137
|
] });
|
|
14106
15138
|
}
|
|
14107
|
-
return /* @__PURE__ */ (0,
|
|
15139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_clsx54.default)("w-full transition-all duration-300", containerClassName), children: [
|
|
14108
15140
|
headerRow,
|
|
14109
15141
|
dropZoneOrPreview
|
|
14110
15142
|
] });
|
|
@@ -14112,13 +15144,13 @@ var ITDropfile = ({
|
|
|
14112
15144
|
var dropfile_default = ITDropfile;
|
|
14113
15145
|
|
|
14114
15146
|
// src/components/templates/layout/layout.tsx
|
|
14115
|
-
var
|
|
15147
|
+
var import_react60 = require("react");
|
|
14116
15148
|
var import_clsx55 = __toESM(require("clsx"), 1);
|
|
14117
15149
|
|
|
14118
15150
|
// src/components/organisms/topbar/topbar.tsx
|
|
14119
15151
|
var import_fa32 = require("react-icons/fa");
|
|
14120
|
-
var
|
|
14121
|
-
var
|
|
15152
|
+
var import_react59 = require("react");
|
|
15153
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14122
15154
|
function ITTopBar({
|
|
14123
15155
|
logo,
|
|
14124
15156
|
logoText,
|
|
@@ -14135,10 +15167,10 @@ function ITTopBar({
|
|
|
14135
15167
|
const flat = useITFlatAppearance();
|
|
14136
15168
|
const { t } = useITTranslation();
|
|
14137
15169
|
const initials = (userMenu?.userName ?? "").trim().split(/\s+/).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
|
|
14138
|
-
const [isUserMenuOpen, setIsUserMenuOpen] = (0,
|
|
14139
|
-
const userMenuRef = (0,
|
|
15170
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = (0, import_react59.useState)(false);
|
|
15171
|
+
const userMenuRef = (0, import_react59.useRef)(null);
|
|
14140
15172
|
useClickOutside_default(userMenuRef, () => setIsUserMenuOpen(false));
|
|
14141
|
-
return /* @__PURE__ */ (0,
|
|
15173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14142
15174
|
"header",
|
|
14143
15175
|
{
|
|
14144
15176
|
className: `sticky top-0 z-40 transition-all duration-300 ${flat ? "" : "backdrop-blur-md"}`,
|
|
@@ -14147,9 +15179,9 @@ function ITTopBar({
|
|
|
14147
15179
|
borderBottom: "1px solid var(--it-topbar-border, rgba(15, 23, 42, 0.06))",
|
|
14148
15180
|
boxShadow: flat ? "none" : "var(--shadow-xs)"
|
|
14149
15181
|
},
|
|
14150
|
-
children: /* @__PURE__ */ (0,
|
|
14151
|
-
/* @__PURE__ */ (0,
|
|
14152
|
-
showMobileMenuButton && /* @__PURE__ */ (0,
|
|
15182
|
+
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: [
|
|
15183
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
15184
|
+
showMobileMenuButton && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14153
15185
|
"button",
|
|
14154
15186
|
{
|
|
14155
15187
|
type: "button",
|
|
@@ -14161,12 +15193,12 @@ function ITTopBar({
|
|
|
14161
15193
|
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "var(--it-topbar-user-hover, #f1f5f9)",
|
|
14162
15194
|
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "transparent",
|
|
14163
15195
|
onClick: onToggleMobileMenu,
|
|
14164
|
-
children: /* @__PURE__ */ (0,
|
|
15196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_fa32.FaBars, { className: "w-[1.125rem] h-[1.125rem]" })
|
|
14165
15197
|
}
|
|
14166
15198
|
),
|
|
14167
|
-
/* @__PURE__ */ (0,
|
|
14168
|
-
logo && /* @__PURE__ */ (0,
|
|
14169
|
-
logoText && /* @__PURE__ */ (0,
|
|
15199
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `items-center gap-3 ${hideBrandOnDesktop ? "flex lg:hidden" : "flex"}`, children: [
|
|
15200
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex-shrink-0 drop-shadow-sm", children: logo }),
|
|
15201
|
+
logoText && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14170
15202
|
ITText,
|
|
14171
15203
|
{
|
|
14172
15204
|
as: "span",
|
|
@@ -14176,7 +15208,7 @@ function ITTopBar({
|
|
|
14176
15208
|
}
|
|
14177
15209
|
)
|
|
14178
15210
|
] }),
|
|
14179
|
-
navItems && navItems.length > 0 && /* @__PURE__ */ (0,
|
|
15211
|
+
navItems && navItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("nav", { className: "hidden md:flex ml-8 space-x-1 border-l pl-8", style: { borderColor: "var(--it-topbar-border, rgba(15, 23, 42, 0.06))" }, children: navItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14180
15212
|
"button",
|
|
14181
15213
|
{
|
|
14182
15214
|
onClick: () => onNavItemClick?.(item.id),
|
|
@@ -14190,19 +15222,19 @@ function ITTopBar({
|
|
|
14190
15222
|
e.currentTarget.style.color = "var(--it-topbar-text, #475569)";
|
|
14191
15223
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
14192
15224
|
},
|
|
14193
|
-
children: /* @__PURE__ */ (0,
|
|
14194
|
-
item.icon && /* @__PURE__ */ (0,
|
|
14195
|
-
/* @__PURE__ */ (0,
|
|
15225
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15226
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "opacity-70", children: item.icon }),
|
|
15227
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", children: item.label })
|
|
14196
15228
|
] })
|
|
14197
15229
|
},
|
|
14198
15230
|
item.id
|
|
14199
15231
|
)) })
|
|
14200
15232
|
] }),
|
|
14201
|
-
centerContent && /* @__PURE__ */ (0,
|
|
14202
|
-
(children || userMenu) && /* @__PURE__ */ (0,
|
|
15233
|
+
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 }) }),
|
|
15234
|
+
(children || userMenu) && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14203
15235
|
children,
|
|
14204
|
-
userMenu && /* @__PURE__ */ (0,
|
|
14205
|
-
/* @__PURE__ */ (0,
|
|
15236
|
+
userMenu && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "relative", children: [
|
|
15237
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
14206
15238
|
"button",
|
|
14207
15239
|
{
|
|
14208
15240
|
type: "button",
|
|
@@ -14218,15 +15250,15 @@ function ITTopBar({
|
|
|
14218
15250
|
},
|
|
14219
15251
|
onClick: () => setIsUserMenuOpen(!isUserMenuOpen),
|
|
14220
15252
|
children: [
|
|
14221
|
-
/* @__PURE__ */ (0,
|
|
14222
|
-
userMenu.userImage ? /* @__PURE__ */ (0,
|
|
15253
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "relative", children: [
|
|
15254
|
+
userMenu.userImage ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14223
15255
|
"img",
|
|
14224
15256
|
{
|
|
14225
15257
|
className: "w-9 h-9 rounded-full object-cover ring-2 ring-white shadow-sm",
|
|
14226
15258
|
src: userMenu.userImage,
|
|
14227
15259
|
alt: t("common.userAvatar")
|
|
14228
15260
|
}
|
|
14229
|
-
) : flat && initials ? /* @__PURE__ */ (0,
|
|
15261
|
+
) : flat && initials ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14230
15262
|
"div",
|
|
14231
15263
|
{
|
|
14232
15264
|
"aria-hidden": "true",
|
|
@@ -14237,11 +15269,11 @@ function ITTopBar({
|
|
|
14237
15269
|
},
|
|
14238
15270
|
children: initials
|
|
14239
15271
|
}
|
|
14240
|
-
) : /* @__PURE__ */ (0,
|
|
14241
|
-
!flat && /* @__PURE__ */ (0,
|
|
15272
|
+
) : /* @__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)" } }) }),
|
|
15273
|
+
!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" })
|
|
14242
15274
|
] }),
|
|
14243
|
-
/* @__PURE__ */ (0,
|
|
14244
|
-
/* @__PURE__ */ (0,
|
|
15275
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `hidden sm:flex flex-col py-0.5 ${flat ? "text-right" : "text-left"}`, children: [
|
|
15276
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14245
15277
|
ITText,
|
|
14246
15278
|
{
|
|
14247
15279
|
as: "span",
|
|
@@ -14250,7 +15282,7 @@ function ITTopBar({
|
|
|
14250
15282
|
children: userMenu.userName
|
|
14251
15283
|
}
|
|
14252
15284
|
),
|
|
14253
|
-
/* @__PURE__ */ (0,
|
|
15285
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14254
15286
|
ITText,
|
|
14255
15287
|
{
|
|
14256
15288
|
as: "span",
|
|
@@ -14263,7 +15295,7 @@ function ITTopBar({
|
|
|
14263
15295
|
]
|
|
14264
15296
|
}
|
|
14265
15297
|
),
|
|
14266
|
-
/* @__PURE__ */ (0,
|
|
15298
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
14267
15299
|
"div",
|
|
14268
15300
|
{
|
|
14269
15301
|
ref: userMenuRef,
|
|
@@ -14276,15 +15308,15 @@ function ITTopBar({
|
|
|
14276
15308
|
border: "1px solid var(--it-topbar-user-dropdown-border, #f1f5f9)"
|
|
14277
15309
|
},
|
|
14278
15310
|
children: [
|
|
14279
|
-
/* @__PURE__ */ (0,
|
|
14280
|
-
/* @__PURE__ */ (0,
|
|
14281
|
-
/* @__PURE__ */ (0,
|
|
15311
|
+
/* @__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: [
|
|
15312
|
+
/* @__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 }),
|
|
15313
|
+
/* @__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 })
|
|
14282
15314
|
] }),
|
|
14283
|
-
/* @__PURE__ */ (0,
|
|
15315
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("ul", { className: "py-2", children: userMenu.menuItems.map((m, i) => {
|
|
14284
15316
|
const isDestructive = m.label.toLowerCase().includes("salir") || m.label.toLowerCase().includes("cerrar") || m.label.toLowerCase().includes("logout");
|
|
14285
|
-
return /* @__PURE__ */ (0,
|
|
14286
|
-
i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && /* @__PURE__ */ (0,
|
|
14287
|
-
/* @__PURE__ */ (0,
|
|
15317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("li", { className: "px-2", children: [
|
|
15318
|
+
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" }),
|
|
15319
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14288
15320
|
"button",
|
|
14289
15321
|
{
|
|
14290
15322
|
onClick: () => {
|
|
@@ -14299,7 +15331,7 @@ function ITTopBar({
|
|
|
14299
15331
|
onMouseLeave: (e) => {
|
|
14300
15332
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
14301
15333
|
},
|
|
14302
|
-
children: /* @__PURE__ */ (0,
|
|
15334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ITText, { as: "span", children: m.label })
|
|
14303
15335
|
}
|
|
14304
15336
|
)
|
|
14305
15337
|
] }, i);
|
|
@@ -14315,7 +15347,7 @@ function ITTopBar({
|
|
|
14315
15347
|
}
|
|
14316
15348
|
|
|
14317
15349
|
// src/components/templates/layout/layout.tsx
|
|
14318
|
-
var
|
|
15350
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14319
15351
|
function ITLayout({
|
|
14320
15352
|
topBar,
|
|
14321
15353
|
sidebar,
|
|
@@ -14324,8 +15356,8 @@ function ITLayout({
|
|
|
14324
15356
|
contentClassName = "",
|
|
14325
15357
|
sidebarFullHeight = false
|
|
14326
15358
|
}) {
|
|
14327
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
14328
|
-
const [mobileSidebarOpen, setMobileSidebarOpen] = (0,
|
|
15359
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react60.useState)(true);
|
|
15360
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react60.useState)(false);
|
|
14329
15361
|
const flat = useITFlatAppearance();
|
|
14330
15362
|
const isControlled = sidebar.isCollapsed !== void 0;
|
|
14331
15363
|
const desktopCollapsed = isControlled ? sidebar.isCollapsed : internalCollapsed;
|
|
@@ -14339,7 +15371,7 @@ function ITLayout({
|
|
|
14339
15371
|
else setMobileSidebarOpen((v) => !v);
|
|
14340
15372
|
};
|
|
14341
15373
|
const brand = sidebarFullHeight ? sidebar.brand ?? { logo: topBar.logo, text: topBar.logoText } : sidebar.brand;
|
|
14342
|
-
const topBarNode = /* @__PURE__ */ (0,
|
|
15374
|
+
const topBarNode = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14343
15375
|
ITTopBar,
|
|
14344
15376
|
{
|
|
14345
15377
|
...topBar,
|
|
@@ -14352,9 +15384,9 @@ function ITLayout({
|
|
|
14352
15384
|
const desktopSidebar = (
|
|
14353
15385
|
// Full-height: the sidebar sits beside the top bar, so it needs to win the
|
|
14354
15386
|
// stacking order when the collapsed rail expands over the content on hover.
|
|
14355
|
-
/* @__PURE__ */ (0,
|
|
14356
|
-
/* @__PURE__ */ (0,
|
|
14357
|
-
/* @__PURE__ */ (0,
|
|
15387
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `hidden lg:block relative h-full ${sidebarFullHeight ? "z-50" : "z-40"}`, children: [
|
|
15388
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `${reservedWidth} h-full flex-shrink-0` }),
|
|
15389
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "absolute top-0 left-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14358
15390
|
ITSidebar,
|
|
14359
15391
|
{
|
|
14360
15392
|
...sidebar,
|
|
@@ -14367,17 +15399,17 @@ function ITLayout({
|
|
|
14367
15399
|
) })
|
|
14368
15400
|
] })
|
|
14369
15401
|
);
|
|
14370
|
-
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0,
|
|
15402
|
+
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14371
15403
|
"div",
|
|
14372
15404
|
{
|
|
14373
15405
|
className: "lg:hidden fixed inset-0 z-[40] transition-opacity duration-300 backdrop-blur-sm bg-black/40",
|
|
14374
15406
|
onClick: () => setMobileSidebarOpen(false),
|
|
14375
|
-
children: /* @__PURE__ */ (0,
|
|
15407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14376
15408
|
"div",
|
|
14377
15409
|
{
|
|
14378
15410
|
className: "h-full w-fit flex transform transition-transform duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
14379
15411
|
onClick: (e) => e.stopPropagation(),
|
|
14380
|
-
children: /* @__PURE__ */ (0,
|
|
15412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14381
15413
|
ITSidebar,
|
|
14382
15414
|
{
|
|
14383
15415
|
...sidebar,
|
|
@@ -14394,16 +15426,16 @@ function ITLayout({
|
|
|
14394
15426
|
)
|
|
14395
15427
|
}
|
|
14396
15428
|
);
|
|
14397
|
-
const main = /* @__PURE__ */ (0,
|
|
15429
|
+
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 }) });
|
|
14398
15430
|
if (sidebarFullHeight) {
|
|
14399
|
-
return /* @__PURE__ */ (0,
|
|
15431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14400
15432
|
"div",
|
|
14401
15433
|
{
|
|
14402
15434
|
className: `flex h-screen overflow-hidden w-full relative ${className}`,
|
|
14403
15435
|
style: { backgroundColor: layoutTokens.backgroundColor },
|
|
14404
15436
|
children: [
|
|
14405
15437
|
desktopSidebar,
|
|
14406
|
-
/* @__PURE__ */ (0,
|
|
15438
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 overflow-hidden", children: [
|
|
14407
15439
|
topBarNode,
|
|
14408
15440
|
main
|
|
14409
15441
|
] }),
|
|
@@ -14412,9 +15444,9 @@ function ITLayout({
|
|
|
14412
15444
|
}
|
|
14413
15445
|
);
|
|
14414
15446
|
}
|
|
14415
|
-
return /* @__PURE__ */ (0,
|
|
15447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `flex flex-col h-screen overflow-hidden w-full ${className}`, children: [
|
|
14416
15448
|
topBarNode,
|
|
14417
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14418
15450
|
"div",
|
|
14419
15451
|
{
|
|
14420
15452
|
className: "flex flex-1 overflow-hidden relative",
|
|
@@ -14431,9 +15463,9 @@ function ITLayout({
|
|
|
14431
15463
|
|
|
14432
15464
|
// src/components/molecules/stepper/stepper.tsx
|
|
14433
15465
|
var import_clsx56 = __toESM(require("clsx"), 1);
|
|
14434
|
-
var
|
|
15466
|
+
var import_react61 = require("react");
|
|
14435
15467
|
var import_fa33 = require("react-icons/fa");
|
|
14436
|
-
var
|
|
15468
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14437
15469
|
function ITStepper({
|
|
14438
15470
|
steps,
|
|
14439
15471
|
currentStep,
|
|
@@ -14449,15 +15481,15 @@ function ITStepper({
|
|
|
14449
15481
|
color = "primary"
|
|
14450
15482
|
}) {
|
|
14451
15483
|
const { t } = useITTranslation();
|
|
14452
|
-
const [direction, setDirection] = (0,
|
|
14453
|
-
const contentRef = (0,
|
|
14454
|
-
const progressRef = (0,
|
|
15484
|
+
const [direction, setDirection] = (0, import_react61.useState)("next");
|
|
15485
|
+
const contentRef = (0, import_react61.useRef)(null);
|
|
15486
|
+
const progressRef = (0, import_react61.useRef)(null);
|
|
14455
15487
|
const isThemeColor = color in theme.colors;
|
|
14456
15488
|
const resolvedColor = isThemeColor ? theme.colors[color][500] : color;
|
|
14457
|
-
(0,
|
|
15489
|
+
(0, import_react61.useEffect)(() => {
|
|
14458
15490
|
onStepChange?.(currentStep);
|
|
14459
15491
|
}, [currentStep, onStepChange]);
|
|
14460
|
-
(0,
|
|
15492
|
+
(0, import_react61.useEffect)(() => {
|
|
14461
15493
|
const pct = currentStep / Math.max(1, steps.length - 1) * 100;
|
|
14462
15494
|
if (progressRef.current) {
|
|
14463
15495
|
progressRef.current.style.width = `${pct}%`;
|
|
@@ -14501,23 +15533,23 @@ function ITStepper({
|
|
|
14501
15533
|
const renderStepContent = (index, isCompleted) => {
|
|
14502
15534
|
const step = steps[index];
|
|
14503
15535
|
if (isCompleted) {
|
|
14504
|
-
return /* @__PURE__ */ (0,
|
|
15536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaCheck, { className: "w-4 h-4" });
|
|
14505
15537
|
}
|
|
14506
15538
|
if (step.icon && useIcons) {
|
|
14507
|
-
return /* @__PURE__ */ (0,
|
|
15539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-center justify-center w-5 h-5", children: step.icon });
|
|
14508
15540
|
}
|
|
14509
|
-
return /* @__PURE__ */ (0,
|
|
15541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", className: "text-sm font-semibold", children: index + 1 });
|
|
14510
15542
|
};
|
|
14511
|
-
return /* @__PURE__ */ (0,
|
|
14512
|
-
/* @__PURE__ */ (0,
|
|
14513
|
-
/* @__PURE__ */ (0,
|
|
15543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: (0, import_clsx56.default)("w-full max-w-5xl mx-auto px-4", containerClassName), children: [
|
|
15544
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "relative mb-8", children: [
|
|
15545
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14514
15546
|
"div",
|
|
14515
15547
|
{
|
|
14516
15548
|
className: "absolute left-6 right-6 top-5 h-1 bg-secondary-200 rounded-full z-0",
|
|
14517
15549
|
"aria-hidden": true
|
|
14518
15550
|
}
|
|
14519
15551
|
),
|
|
14520
|
-
/* @__PURE__ */ (0,
|
|
15552
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14521
15553
|
"div",
|
|
14522
15554
|
{
|
|
14523
15555
|
ref: progressRef,
|
|
@@ -14525,11 +15557,11 @@ function ITStepper({
|
|
|
14525
15557
|
"aria-hidden": true
|
|
14526
15558
|
}
|
|
14527
15559
|
),
|
|
14528
|
-
/* @__PURE__ */ (0,
|
|
15560
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-start justify-between space-x-2 relative z-20", children: steps.map((step, idx) => {
|
|
14529
15561
|
const isActive = idx === currentStep;
|
|
14530
15562
|
const isCompleted = idx < currentStep;
|
|
14531
15563
|
const hasIcon = step.icon && useIcons;
|
|
14532
|
-
return /* @__PURE__ */ (0,
|
|
15564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14533
15565
|
"button",
|
|
14534
15566
|
{
|
|
14535
15567
|
type: "button",
|
|
@@ -14539,8 +15571,8 @@ function ITStepper({
|
|
|
14539
15571
|
"aria-label": t("stepper.stepAria", { n: idx + 1, label: step.label }),
|
|
14540
15572
|
className: "flex-1 group",
|
|
14541
15573
|
title: step.label,
|
|
14542
|
-
children: /* @__PURE__ */ (0,
|
|
14543
|
-
/* @__PURE__ */ (0,
|
|
15574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
15575
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14544
15576
|
"div",
|
|
14545
15577
|
{
|
|
14546
15578
|
className: (0, import_clsx56.default)(
|
|
@@ -14554,7 +15586,7 @@ function ITStepper({
|
|
|
14554
15586
|
children: renderStepContent(idx, isCompleted)
|
|
14555
15587
|
}
|
|
14556
15588
|
),
|
|
14557
|
-
/* @__PURE__ */ (0,
|
|
15589
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14558
15590
|
ITText,
|
|
14559
15591
|
{
|
|
14560
15592
|
as: "span",
|
|
@@ -14572,7 +15604,7 @@ function ITStepper({
|
|
|
14572
15604
|
);
|
|
14573
15605
|
}) })
|
|
14574
15606
|
] }),
|
|
14575
|
-
/* @__PURE__ */ (0,
|
|
15607
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14576
15608
|
"div",
|
|
14577
15609
|
{
|
|
14578
15610
|
ref: contentRef,
|
|
@@ -14588,32 +15620,32 @@ function ITStepper({
|
|
|
14588
15620
|
children: steps[currentStep].content
|
|
14589
15621
|
}
|
|
14590
15622
|
),
|
|
14591
|
-
/* @__PURE__ */ (0,
|
|
14592
|
-
/* @__PURE__ */ (0,
|
|
15623
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
15624
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14593
15625
|
ITButton,
|
|
14594
15626
|
{
|
|
14595
15627
|
variant: "outlined",
|
|
14596
15628
|
color: "secondary",
|
|
14597
15629
|
disabled: currentStep === 0,
|
|
14598
15630
|
onClick: prevStep,
|
|
14599
|
-
children: /* @__PURE__ */ (0,
|
|
14600
|
-
/* @__PURE__ */ (0,
|
|
14601
|
-
/* @__PURE__ */ (0,
|
|
15631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15632
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaChevronLeft, {}),
|
|
15633
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", children: t("common.back") })
|
|
14602
15634
|
] })
|
|
14603
15635
|
}
|
|
14604
15636
|
),
|
|
14605
|
-
/* @__PURE__ */ (0,
|
|
14606
|
-
/* @__PURE__ */ (0,
|
|
14607
|
-
/* @__PURE__ */ (0,
|
|
15637
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
15638
|
+
/* @__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 }) }),
|
|
15639
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14608
15640
|
ITButton,
|
|
14609
15641
|
{
|
|
14610
15642
|
variant: "solid",
|
|
14611
15643
|
color,
|
|
14612
15644
|
disabled: disableNext,
|
|
14613
15645
|
onClick: nextStep,
|
|
14614
|
-
children: /* @__PURE__ */ (0,
|
|
14615
|
-
/* @__PURE__ */ (0,
|
|
14616
|
-
currentStep === steps.length - 1 ? /* @__PURE__ */ (0,
|
|
15646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15647
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", children: currentStep === steps.length - 1 ? t("common.finish") : t("common.next") }),
|
|
15648
|
+
currentStep === steps.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_fa33.FaChevronRight, {})
|
|
14617
15649
|
] })
|
|
14618
15650
|
}
|
|
14619
15651
|
)
|
|
@@ -14623,7 +15655,7 @@ function ITStepper({
|
|
|
14623
15655
|
}
|
|
14624
15656
|
|
|
14625
15657
|
// src/components/theme-provider/themeProvider.tsx
|
|
14626
|
-
var
|
|
15658
|
+
var import_react62 = require("react");
|
|
14627
15659
|
var import_md3 = require("react-icons/md");
|
|
14628
15660
|
|
|
14629
15661
|
// src/components/theme-provider/themePresets.ts
|
|
@@ -14801,7 +15833,7 @@ var PRESETS = [
|
|
|
14801
15833
|
];
|
|
14802
15834
|
|
|
14803
15835
|
// src/components/theme-provider/themeProvider.tsx
|
|
14804
|
-
var
|
|
15836
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14805
15837
|
var STORAGE_KEY = "it-theme-palette";
|
|
14806
15838
|
var SHADOW_LEVELS = {
|
|
14807
15839
|
0: {
|
|
@@ -14904,7 +15936,7 @@ function ITThemeProvider({
|
|
|
14904
15936
|
appearance = "soft"
|
|
14905
15937
|
}) {
|
|
14906
15938
|
const { t } = useITTranslation();
|
|
14907
|
-
const [palette2, setPaletteState] = (0,
|
|
15939
|
+
const [palette2, setPaletteState] = (0, import_react62.useState)(() => {
|
|
14908
15940
|
const basePalette = {
|
|
14909
15941
|
...DEFAULT_PALETTE,
|
|
14910
15942
|
...theme2,
|
|
@@ -14930,8 +15962,8 @@ function ITThemeProvider({
|
|
|
14930
15962
|
}
|
|
14931
15963
|
return basePalette;
|
|
14932
15964
|
});
|
|
14933
|
-
const [isOpen, setIsOpen] = (0,
|
|
14934
|
-
const [customPresets, setCustomPresets] = (0,
|
|
15965
|
+
const [isOpen, setIsOpen] = (0, import_react62.useState)(false);
|
|
15966
|
+
const [customPresets, setCustomPresets] = (0, import_react62.useState)(() => {
|
|
14935
15967
|
try {
|
|
14936
15968
|
const saved = localStorage.getItem("it-theme-custom-presets");
|
|
14937
15969
|
return saved ? JSON.parse(saved) : [];
|
|
@@ -14940,8 +15972,8 @@ function ITThemeProvider({
|
|
|
14940
15972
|
return [];
|
|
14941
15973
|
}
|
|
14942
15974
|
});
|
|
14943
|
-
const [newPresetName, setNewPresetName] = (0,
|
|
14944
|
-
const [isSavingPreset, setIsSavingPreset] = (0,
|
|
15975
|
+
const [newPresetName, setNewPresetName] = (0, import_react62.useState)("");
|
|
15976
|
+
const [isSavingPreset, setIsSavingPreset] = (0, import_react62.useState)(false);
|
|
14945
15977
|
const handleSavePreset = () => {
|
|
14946
15978
|
if (!newPresetName.trim()) return;
|
|
14947
15979
|
const newPreset = {
|
|
@@ -14960,8 +15992,8 @@ function ITThemeProvider({
|
|
|
14960
15992
|
setCustomPresets(updated);
|
|
14961
15993
|
localStorage.setItem("it-theme-custom-presets", JSON.stringify(updated));
|
|
14962
15994
|
};
|
|
14963
|
-
const [resolvedTheme, setResolvedTheme] = (0,
|
|
14964
|
-
const [darkModeMode, setDarkModeMode] = (0,
|
|
15995
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react62.useState)("light");
|
|
15996
|
+
const [darkModeMode, setDarkModeMode] = (0, import_react62.useState)(
|
|
14965
15997
|
() => {
|
|
14966
15998
|
const saved = localStorage.getItem("it-theme-dark-mode");
|
|
14967
15999
|
if (saved === "light" || saved === "dark" || saved === "system") {
|
|
@@ -14970,7 +16002,7 @@ function ITThemeProvider({
|
|
|
14970
16002
|
return "system";
|
|
14971
16003
|
}
|
|
14972
16004
|
);
|
|
14973
|
-
(0,
|
|
16005
|
+
(0, import_react62.useEffect)(() => {
|
|
14974
16006
|
localStorage.setItem("it-theme-dark-mode", darkModeMode);
|
|
14975
16007
|
const applyDarkMode = (isDark) => {
|
|
14976
16008
|
if (isDark) {
|
|
@@ -14995,7 +16027,7 @@ function ITThemeProvider({
|
|
|
14995
16027
|
applyDarkMode(darkModeMode === "dark");
|
|
14996
16028
|
}
|
|
14997
16029
|
}, [darkModeMode]);
|
|
14998
|
-
(0,
|
|
16030
|
+
(0, import_react62.useEffect)(() => {
|
|
14999
16031
|
if (!showFab) {
|
|
15000
16032
|
setPaletteState({
|
|
15001
16033
|
...DEFAULT_PALETTE,
|
|
@@ -15005,7 +16037,7 @@ function ITThemeProvider({
|
|
|
15005
16037
|
});
|
|
15006
16038
|
}
|
|
15007
16039
|
}, [theme2, showFab]);
|
|
15008
|
-
(0,
|
|
16040
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15009
16041
|
const root = document.documentElement;
|
|
15010
16042
|
const scale = typeof density === "number" && isFinite(density) ? Math.min(Math.max(density, 0.5), 1.5) : 1;
|
|
15011
16043
|
root.style.setProperty("--it-density", String(scale));
|
|
@@ -15015,12 +16047,12 @@ function ITThemeProvider({
|
|
|
15015
16047
|
root.style.fontSize = "";
|
|
15016
16048
|
};
|
|
15017
16049
|
}, [density]);
|
|
15018
|
-
(0,
|
|
16050
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15019
16051
|
const root = document.documentElement;
|
|
15020
16052
|
root.setAttribute("data-it-appearance", appearance);
|
|
15021
16053
|
return () => root.removeAttribute("data-it-appearance");
|
|
15022
16054
|
}, [appearance]);
|
|
15023
|
-
(0,
|
|
16055
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
15024
16056
|
const root = document.documentElement;
|
|
15025
16057
|
const radiusTokens = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
15026
16058
|
if (typeof radius === "number" && isFinite(radius)) {
|
|
@@ -15052,7 +16084,7 @@ function ITThemeProvider({
|
|
|
15052
16084
|
surfaceStyle?.remove();
|
|
15053
16085
|
};
|
|
15054
16086
|
}, [radius, shadow]);
|
|
15055
|
-
(0,
|
|
16087
|
+
(0, import_react62.useEffect)(() => {
|
|
15056
16088
|
const injectStyles = (obj, prefix = "") => {
|
|
15057
16089
|
Object.entries(obj).forEach(([key, val]) => {
|
|
15058
16090
|
if (typeof val === "object" && val !== null) {
|
|
@@ -16206,14 +17238,14 @@ function ITThemeProvider({
|
|
|
16206
17238
|
const isNested = colorKey.includes(".");
|
|
16207
17239
|
const label = isNested ? colorKey.split(".")[1] : colorKey;
|
|
16208
17240
|
const value = getNestedValue3(palette2, colorKey);
|
|
16209
|
-
return /* @__PURE__ */ (0,
|
|
17241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16210
17242
|
"div",
|
|
16211
17243
|
{
|
|
16212
17244
|
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",
|
|
16213
17245
|
children: [
|
|
16214
|
-
/* @__PURE__ */ (0,
|
|
16215
|
-
/* @__PURE__ */ (0,
|
|
16216
|
-
/* @__PURE__ */ (0,
|
|
17246
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
|
|
17247
|
+
/* @__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: [
|
|
17248
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16217
17249
|
"input",
|
|
16218
17250
|
{
|
|
16219
17251
|
type: "color",
|
|
@@ -16222,23 +17254,23 @@ function ITThemeProvider({
|
|
|
16222
17254
|
className: "absolute inset-0 opacity-0 cursor-pointer w-full h-full"
|
|
16223
17255
|
}
|
|
16224
17256
|
),
|
|
16225
|
-
/* @__PURE__ */ (0,
|
|
17257
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "w-full h-full", style: { backgroundColor: value } })
|
|
16226
17258
|
] }),
|
|
16227
|
-
/* @__PURE__ */ (0,
|
|
16228
|
-
/* @__PURE__ */ (0,
|
|
16229
|
-
/* @__PURE__ */ (0,
|
|
16230
|
-
/* @__PURE__ */ (0,
|
|
17259
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
17260
|
+
/* @__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() }),
|
|
17261
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center gap-2 mt-0.5", children: [
|
|
17262
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16231
17263
|
"span",
|
|
16232
17264
|
{
|
|
16233
17265
|
className: "w-3 h-3 rounded-full border border-slate-200 dark:border-slate-600",
|
|
16234
17266
|
style: { backgroundColor: value }
|
|
16235
17267
|
}
|
|
16236
17268
|
),
|
|
16237
|
-
/* @__PURE__ */ (0,
|
|
17269
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "span", className: "font-mono text-[11px] text-slate-400", children: value })
|
|
16238
17270
|
] })
|
|
16239
17271
|
] })
|
|
16240
17272
|
] }),
|
|
16241
|
-
/* @__PURE__ */ (0,
|
|
17273
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16242
17274
|
"input",
|
|
16243
17275
|
{
|
|
16244
17276
|
type: "text",
|
|
@@ -16257,14 +17289,14 @@ function ITThemeProvider({
|
|
|
16257
17289
|
isCustom
|
|
16258
17290
|
}) => {
|
|
16259
17291
|
const isSelected = JSON.stringify(preset.colors) === JSON.stringify(palette2);
|
|
16260
|
-
return /* @__PURE__ */ (0,
|
|
17292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16261
17293
|
"button",
|
|
16262
17294
|
{
|
|
16263
17295
|
type: "button",
|
|
16264
17296
|
onClick: () => applyPreset(preset.colors),
|
|
16265
17297
|
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"}`,
|
|
16266
17298
|
children: [
|
|
16267
|
-
isCustom && /* @__PURE__ */ (0,
|
|
17299
|
+
isCustom && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16268
17300
|
"span",
|
|
16269
17301
|
{
|
|
16270
17302
|
onClick: (e) => {
|
|
@@ -16273,11 +17305,11 @@ function ITThemeProvider({
|
|
|
16273
17305
|
},
|
|
16274
17306
|
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",
|
|
16275
17307
|
title: t("themeProvider.designer.deletePreset"),
|
|
16276
|
-
children: /* @__PURE__ */ (0,
|
|
17308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdClose, { size: 12 })
|
|
16277
17309
|
}
|
|
16278
17310
|
),
|
|
16279
|
-
/* @__PURE__ */ (0,
|
|
16280
|
-
/* @__PURE__ */ (0,
|
|
17311
|
+
/* @__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 }),
|
|
17312
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "flex gap-1", children: ["primary", "secondary", "ternary", "success"].map((c) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16281
17313
|
"span",
|
|
16282
17314
|
{
|
|
16283
17315
|
className: "w-3 h-3 rounded-full border border-black/10",
|
|
@@ -16289,7 +17321,7 @@ function ITThemeProvider({
|
|
|
16289
17321
|
}
|
|
16290
17322
|
);
|
|
16291
17323
|
};
|
|
16292
|
-
return /* @__PURE__ */ (0,
|
|
17324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
16293
17325
|
ITThemeContext.Provider,
|
|
16294
17326
|
{
|
|
16295
17327
|
value: {
|
|
@@ -16306,28 +17338,28 @@ function ITThemeProvider({
|
|
|
16306
17338
|
},
|
|
16307
17339
|
children: [
|
|
16308
17340
|
children,
|
|
16309
|
-
showFab && /* @__PURE__ */ (0,
|
|
17341
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16310
17342
|
"button",
|
|
16311
17343
|
{
|
|
16312
17344
|
onClick: () => setIsOpen((prev) => !prev),
|
|
16313
17345
|
className: "it-theme-fab it-theme-bounce",
|
|
16314
17346
|
style: { backgroundColor: "var(--color-primary)" },
|
|
16315
17347
|
"aria-label": t("themeProvider.fab.ariaLabel"),
|
|
16316
|
-
children: /* @__PURE__ */ (0,
|
|
17348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdPalette, { size: 28 })
|
|
16317
17349
|
}
|
|
16318
17350
|
),
|
|
16319
|
-
showFab && /* @__PURE__ */ (0,
|
|
17351
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16320
17352
|
ITDialog,
|
|
16321
17353
|
{
|
|
16322
17354
|
isOpen,
|
|
16323
17355
|
onClose: () => setIsOpen(false),
|
|
16324
17356
|
title: t("themeProvider.designer.title"),
|
|
16325
17357
|
useFormHeader: true,
|
|
16326
|
-
children: /* @__PURE__ */ (0,
|
|
16327
|
-
/* @__PURE__ */ (0,
|
|
16328
|
-
/* @__PURE__ */ (0,
|
|
16329
|
-
/* @__PURE__ */ (0,
|
|
16330
|
-
/* @__PURE__ */ (0,
|
|
17358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex gap-6 h-[580px]", children: [
|
|
17359
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "w-64 flex-shrink-0 flex flex-col gap-5 overflow-y-auto pr-1", children: [
|
|
17360
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17361
|
+
/* @__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") }),
|
|
17362
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16331
17363
|
ITSegmentedControl,
|
|
16332
17364
|
{
|
|
16333
17365
|
options: [
|
|
@@ -16341,16 +17373,16 @@ function ITThemeProvider({
|
|
|
16341
17373
|
}
|
|
16342
17374
|
)
|
|
16343
17375
|
] }),
|
|
16344
|
-
/* @__PURE__ */ (0,
|
|
16345
|
-
/* @__PURE__ */ (0,
|
|
16346
|
-
/* @__PURE__ */ (0,
|
|
17376
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17377
|
+
/* @__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") }) }),
|
|
17378
|
+
/* @__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)) })
|
|
16347
17379
|
] }),
|
|
16348
|
-
customPresets.length > 0 && /* @__PURE__ */ (0,
|
|
16349
|
-
/* @__PURE__ */ (0,
|
|
16350
|
-
/* @__PURE__ */ (0,
|
|
17380
|
+
customPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
17381
|
+
/* @__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") }),
|
|
17382
|
+
/* @__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)) })
|
|
16351
17383
|
] }),
|
|
16352
|
-
isSavingPreset && /* @__PURE__ */ (0,
|
|
16353
|
-
/* @__PURE__ */ (0,
|
|
17384
|
+
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: [
|
|
17385
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16354
17386
|
ITInput,
|
|
16355
17387
|
{
|
|
16356
17388
|
name: "presetName",
|
|
@@ -16368,8 +17400,8 @@ function ITThemeProvider({
|
|
|
16368
17400
|
}
|
|
16369
17401
|
}
|
|
16370
17402
|
),
|
|
16371
|
-
/* @__PURE__ */ (0,
|
|
16372
|
-
/* @__PURE__ */ (0,
|
|
17403
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex gap-2", children: [
|
|
17404
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16373
17405
|
ITButton,
|
|
16374
17406
|
{
|
|
16375
17407
|
label: t("themeProvider.designer.save"),
|
|
@@ -16380,7 +17412,7 @@ function ITThemeProvider({
|
|
|
16380
17412
|
className: "flex-1"
|
|
16381
17413
|
}
|
|
16382
17414
|
),
|
|
16383
|
-
/* @__PURE__ */ (0,
|
|
17415
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16384
17416
|
ITButton,
|
|
16385
17417
|
{
|
|
16386
17418
|
label: t("themeProvider.designer.cancelSave"),
|
|
@@ -16394,31 +17426,31 @@ function ITThemeProvider({
|
|
|
16394
17426
|
)
|
|
16395
17427
|
] })
|
|
16396
17428
|
] }),
|
|
16397
|
-
!isSavingPreset && /* @__PURE__ */ (0,
|
|
17429
|
+
!isSavingPreset && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16398
17430
|
ITButton,
|
|
16399
17431
|
{
|
|
16400
17432
|
variant: "outlined",
|
|
16401
|
-
icon: /* @__PURE__ */ (0,
|
|
17433
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdPalette, { size: 14 }),
|
|
16402
17434
|
label: t("themeProvider.designer.saveCurrent"),
|
|
16403
17435
|
onClick: () => setIsSavingPreset(true),
|
|
16404
17436
|
size: "sm"
|
|
16405
17437
|
}
|
|
16406
17438
|
),
|
|
16407
|
-
/* @__PURE__ */ (0,
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16408
17440
|
ITButton,
|
|
16409
17441
|
{
|
|
16410
17442
|
variant: "outlined",
|
|
16411
17443
|
color: "danger",
|
|
16412
|
-
icon: /* @__PURE__ */ (0,
|
|
17444
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_md3.MdRefresh, { size: 14 }),
|
|
16413
17445
|
label: t("themeProvider.designer.reset"),
|
|
16414
17446
|
onClick: resetTheme,
|
|
16415
17447
|
size: "sm"
|
|
16416
17448
|
}
|
|
16417
17449
|
)
|
|
16418
17450
|
] }),
|
|
16419
|
-
/* @__PURE__ */ (0,
|
|
16420
|
-
/* @__PURE__ */ (0,
|
|
16421
|
-
/* @__PURE__ */ (0,
|
|
17451
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITDivider, { orientation: "vertical" }),
|
|
17452
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
17453
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16422
17454
|
tabs_default,
|
|
16423
17455
|
{
|
|
16424
17456
|
variant: "pill",
|
|
@@ -16426,7 +17458,7 @@ function ITThemeProvider({
|
|
|
16426
17458
|
{
|
|
16427
17459
|
id: "brand",
|
|
16428
17460
|
label: t("themeProvider.tabs.brand"),
|
|
16429
|
-
content: /* @__PURE__ */ (0,
|
|
17461
|
+
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: [
|
|
16430
17462
|
"primary",
|
|
16431
17463
|
"secondary",
|
|
16432
17464
|
"ternary",
|
|
@@ -16435,35 +17467,35 @@ function ITThemeProvider({
|
|
|
16435
17467
|
"info",
|
|
16436
17468
|
"alert",
|
|
16437
17469
|
"warning"
|
|
16438
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17470
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16439
17471
|
},
|
|
16440
17472
|
{
|
|
16441
17473
|
id: "layout",
|
|
16442
17474
|
label: t("themeProvider.tabs.layout"),
|
|
16443
|
-
content: /* @__PURE__ */ (0,
|
|
17475
|
+
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
17476
|
"layout.sidebarBg",
|
|
16445
17477
|
"layout.sidebarText",
|
|
16446
17478
|
"layout.navbarBg",
|
|
16447
17479
|
"layout.navbarText"
|
|
16448
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17480
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16449
17481
|
},
|
|
16450
17482
|
{
|
|
16451
17483
|
id: "tables",
|
|
16452
17484
|
label: t("themeProvider.tabs.tables"),
|
|
16453
|
-
content: /* @__PURE__ */ (0,
|
|
17485
|
+
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: [
|
|
16454
17486
|
"table.headerBg",
|
|
16455
17487
|
"table.headerText",
|
|
16456
17488
|
"table.rowBg",
|
|
16457
17489
|
"table.rowText",
|
|
16458
17490
|
"table.rowHover"
|
|
16459
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
17491
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
16460
17492
|
}
|
|
16461
17493
|
]
|
|
16462
17494
|
}
|
|
16463
17495
|
),
|
|
16464
|
-
/* @__PURE__ */ (0,
|
|
16465
|
-
/* @__PURE__ */ (0,
|
|
16466
|
-
/* @__PURE__ */ (0,
|
|
17496
|
+
/* @__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: [
|
|
17497
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ITText, { as: "p", className: "text-[11px] text-slate-400 mr-auto", children: t("themeProvider.designer.autosave") }),
|
|
17498
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16467
17499
|
ITButton,
|
|
16468
17500
|
{
|
|
16469
17501
|
label: t("themeProvider.designer.close"),
|
|
@@ -16571,13 +17603,16 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16571
17603
|
auditTree,
|
|
16572
17604
|
axzyCatalog,
|
|
16573
17605
|
axzyCatalogTypes,
|
|
17606
|
+
buildNavigationTree,
|
|
16574
17607
|
buildVocabularyContract,
|
|
16575
17608
|
countPendingNodes,
|
|
17609
|
+
createBindingResolver,
|
|
16576
17610
|
createCatalog,
|
|
16577
17611
|
createLimitTracker,
|
|
16578
17612
|
createValidationSchema,
|
|
16579
17613
|
enMessages,
|
|
16580
17614
|
esMessages,
|
|
17615
|
+
flattenRoutes,
|
|
16581
17616
|
formatPath,
|
|
16582
17617
|
formatVocabularyForPrompt,
|
|
16583
17618
|
getCatalogEntry,
|
|
@@ -16588,7 +17623,10 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16588
17623
|
isLightColor,
|
|
16589
17624
|
isNodePending,
|
|
16590
17625
|
issue,
|
|
17626
|
+
joinRoutePath,
|
|
17627
|
+
matchRoute,
|
|
16591
17628
|
migrateSchema,
|
|
17629
|
+
navContainsRoute,
|
|
16592
17630
|
parsePartialSchema,
|
|
16593
17631
|
parsePath,
|
|
16594
17632
|
propPath,
|
|
@@ -16598,6 +17636,7 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16598
17636
|
resolveCssColor,
|
|
16599
17637
|
resolveLimits,
|
|
16600
17638
|
resolveNode,
|
|
17639
|
+
routeHref,
|
|
16601
17640
|
useClickOutside,
|
|
16602
17641
|
useDebouncedSearch,
|
|
16603
17642
|
useEditableRow,
|
|
@@ -16607,7 +17646,9 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
16607
17646
|
useITThemeSafe,
|
|
16608
17647
|
useITTranslation,
|
|
16609
17648
|
useJsonRender,
|
|
17649
|
+
useSchemaStream,
|
|
16610
17650
|
useTableState,
|
|
17651
|
+
validateRoutes,
|
|
16611
17652
|
validateSchema
|
|
16612
17653
|
});
|
|
16613
17654
|
//# sourceMappingURL=index.cjs.map
|