@axzydev/axzy_ui_system 1.7.0 → 1.7.2
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 +1938 -491
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +739 -3
- package/dist/index.d.ts +739 -3
- package/dist/index.js +1830 -417
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +14 -7
- package/src/App.tsx +60 -2
- package/src/components/atoms/image/image.props.ts +2 -0
- package/src/components/atoms/image/image.tsx +3 -2
- package/src/components/atoms/segmented-control/segmented-control.tsx +3 -0
- package/src/components/molecules/card/card.tsx +12 -0
- package/src/components/molecules/stat-card/stat-card.tsx +10 -0
- package/src/components/organisms/dialog/dialog.props.ts +2 -0
- package/src/components/organisms/dialog/dialog.tsx +4 -3
- package/src/dev.css +6 -0
- package/src/index.ts +90 -1
- package/src/json-renderer/catalog/axzyCatalog.ts +362 -0
- package/src/json-renderer/catalog/catalog.props.ts +128 -0
- package/src/json-renderer/catalog/resolve.ts +225 -0
- package/src/json-renderer/index.ts +70 -0
- package/src/json-renderer/kernel/NodeBoundary.tsx +53 -0
- package/src/json-renderer/kernel/SchemaRenderer.tsx +197 -0
- package/src/json-renderer/kernel/kernel.test.tsx +341 -0
- package/src/json-renderer/kernel/partial.ts +92 -0
- package/src/json-renderer/kernel/renderNode.tsx +113 -0
- package/src/json-renderer/kernel/schemaRenderer.props.ts +42 -0
- package/src/json-renderer/kernel/types.ts +159 -0
- package/src/json-renderer/shared/errors.ts +92 -0
- package/src/json-renderer/shared/limits.ts +87 -0
- package/src/json-renderer/shared/paths.ts +66 -0
- package/src/json-renderer/shared/shared.test.ts +108 -0
- package/src/json-renderer/stream/tolerantParse.test.ts +152 -0
- package/src/json-renderer/stream/tolerantParse.ts +449 -0
- package/src/json-renderer/test/setup.ts +38 -0
- package/src/json-renderer/validation/migrate.ts +83 -0
- package/src/json-renderer/validation/validate.ts +161 -0
- package/src/json-renderer/validation/validation.test.ts +165 -0
- package/src/json-renderer/vocabulary/buildContract.ts +158 -0
- package/src/sandbox/axzyConfig.test.ts +40 -0
- package/src/sandbox/axzyConfig.ts +77 -0
- package/src/sandbox/i18n.ts +218 -0
- package/src/sandbox/navigation.ts +1 -0
- package/src/sandbox/useHashRoute.ts +39 -9
- package/src/showcases/DemoJsonDashboard.tsx +489 -0
- package/src/showcases/DemoJsonDocs.tsx +339 -0
- package/src/showcases/DemoJsonPortfolio.tsx +257 -0
- package/src/showcases/JsonScreenShowcase.tsx +341 -0
- package/src/showcases/demoApp/demoData.ts +181 -0
- package/src/showcases/demoApp/nodeTree.test.ts +39 -0
- package/src/showcases/demoApp/nodeTree.ts +35 -0
- package/src/showcases/demoApp/schemas.test.ts +54 -0
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
+
AXZY_CATALOG_ENTRIES: () => AXZY_CATALOG_ENTRIES,
|
|
35
|
+
AXZY_EXCLUDED_TYPES: () => AXZY_EXCLUDED_TYPES,
|
|
36
|
+
CURRENT_SCHEMA_VERSION: () => CURRENT_SCHEMA_VERSION,
|
|
37
|
+
DEFAULT_LIMITS: () => DEFAULT_LIMITS,
|
|
38
|
+
DEFAULT_MIGRATIONS: () => DEFAULT_MIGRATIONS,
|
|
34
39
|
FileTypeEnum: () => FileTypeEnum,
|
|
40
|
+
GLOBALLY_FORBIDDEN_PROPS: () => GLOBALLY_FORBIDDEN_PROPS,
|
|
35
41
|
ITAccordion: () => ITAccordion,
|
|
36
42
|
ITAlert: () => ITAlert,
|
|
37
43
|
ITAvatar: () => ITAvatar,
|
|
@@ -75,6 +81,7 @@ __export(index_exports, {
|
|
|
75
81
|
ITPopover: () => ITPopover,
|
|
76
82
|
ITProgress: () => ITProgress,
|
|
77
83
|
ITRadioGroup: () => ITRadioGroup,
|
|
84
|
+
ITSchemaRenderer: () => ITSchemaRenderer,
|
|
78
85
|
ITSearchSelect: () => ITSearchSelect,
|
|
79
86
|
ITSearchTable: () => ITSearchTable,
|
|
80
87
|
ITSegmentedControl: () => ITSegmentedControl,
|
|
@@ -95,13 +102,39 @@ __export(index_exports, {
|
|
|
95
102
|
ITToast: () => ITToast,
|
|
96
103
|
ITTripleFilter: () => tripleFilter_default,
|
|
97
104
|
ITWysiwyg: () => ITWysiwyg,
|
|
105
|
+
JsonEngineError: () => JsonEngineError,
|
|
106
|
+
NodeBoundary: () => NodeBoundary,
|
|
98
107
|
UploadStatus: () => UploadStatus,
|
|
108
|
+
auditTree: () => auditTree,
|
|
109
|
+
axzyCatalog: () => axzyCatalog,
|
|
110
|
+
axzyCatalogTypes: () => axzyCatalogTypes,
|
|
111
|
+
buildVocabularyContract: () => buildVocabularyContract,
|
|
112
|
+
countPendingNodes: () => countPendingNodes,
|
|
113
|
+
createCatalog: () => createCatalog,
|
|
114
|
+
createLimitTracker: () => createLimitTracker,
|
|
99
115
|
createValidationSchema: () => createValidationSchema,
|
|
100
116
|
enMessages: () => en_default,
|
|
101
117
|
esMessages: () => es_default,
|
|
118
|
+
formatPath: () => formatPath,
|
|
119
|
+
formatVocabularyForPrompt: () => formatVocabularyForPrompt,
|
|
120
|
+
getCatalogEntry: () => getCatalogEntry,
|
|
102
121
|
getContrastTextColor: () => getContrastTextColor,
|
|
122
|
+
getExclusionReason: () => getExclusionReason,
|
|
123
|
+
hasPath: () => hasPath,
|
|
124
|
+
isExcludedType: () => isExcludedType,
|
|
103
125
|
isLightColor: () => isLightColor,
|
|
126
|
+
isNodePending: () => isNodePending,
|
|
127
|
+
issue: () => issue,
|
|
128
|
+
migrateSchema: () => migrateSchema,
|
|
129
|
+
parsePartialSchema: () => parsePartialSchema,
|
|
130
|
+
parsePath: () => parsePath,
|
|
131
|
+
propPath: () => propPath,
|
|
132
|
+
pushPath: () => pushPath,
|
|
133
|
+
readPath: () => readPath,
|
|
134
|
+
renderNode: () => renderNode,
|
|
104
135
|
resolveCssColor: () => resolveCssColor,
|
|
136
|
+
resolveLimits: () => resolveLimits,
|
|
137
|
+
resolveNode: () => resolveNode,
|
|
105
138
|
useClickOutside: () => useClickOutside_default,
|
|
106
139
|
useDebouncedSearch: () => useDebouncedSearch,
|
|
107
140
|
useEditableRow: () => useEditableRow,
|
|
@@ -111,7 +144,8 @@ __export(index_exports, {
|
|
|
111
144
|
useITThemeSafe: () => useITThemeSafe,
|
|
112
145
|
useITTranslation: () => useITTranslation,
|
|
113
146
|
useJsonRender: () => useJsonRender_default,
|
|
114
|
-
useTableState: () => useTableState
|
|
147
|
+
useTableState: () => useTableState,
|
|
148
|
+
validateSchema: () => validateSchema
|
|
115
149
|
});
|
|
116
150
|
module.exports = __toCommonJS(index_exports);
|
|
117
151
|
|
|
@@ -1640,6 +1674,14 @@ function ITCard({
|
|
|
1640
1674
|
onClick,
|
|
1641
1675
|
onMouseEnter: () => onClick && setIsHovered(true),
|
|
1642
1676
|
onMouseLeave: () => onClick && setIsHovered(false),
|
|
1677
|
+
role: onClick ? "button" : void 0,
|
|
1678
|
+
tabIndex: onClick ? 0 : void 0,
|
|
1679
|
+
onKeyDown: onClick ? (e) => {
|
|
1680
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1681
|
+
e.preventDefault();
|
|
1682
|
+
onClick();
|
|
1683
|
+
}
|
|
1684
|
+
} : void 0,
|
|
1643
1685
|
className: (0, import_clsx2.default)("overflow-hidden flex flex-col", className),
|
|
1644
1686
|
style: containerStyle,
|
|
1645
1687
|
children: [
|
|
@@ -1936,7 +1978,7 @@ function ITJsonRenderer({
|
|
|
1936
1978
|
json,
|
|
1937
1979
|
className
|
|
1938
1980
|
}) {
|
|
1939
|
-
const
|
|
1981
|
+
const renderNode2 = (node) => {
|
|
1940
1982
|
if (node == null || typeof node === "boolean") {
|
|
1941
1983
|
return null;
|
|
1942
1984
|
}
|
|
@@ -1947,10 +1989,10 @@ function ITJsonRenderer({
|
|
|
1947
1989
|
return node;
|
|
1948
1990
|
}
|
|
1949
1991
|
if (Array.isArray(node)) {
|
|
1950
|
-
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react13.default.Fragment, { children:
|
|
1992
|
+
return node.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react13.default.Fragment, { children: renderNode2(child) }, idx));
|
|
1951
1993
|
}
|
|
1952
1994
|
const { type, props = {}, children, text } = node;
|
|
1953
|
-
const childContent = children !== void 0 ?
|
|
1995
|
+
const childContent = children !== void 0 ? renderNode2(children) : text;
|
|
1954
1996
|
switch (type) {
|
|
1955
1997
|
case "button":
|
|
1956
1998
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ITButton, { ...props, children: childContent });
|
|
@@ -1972,9 +2014,9 @@ function ITJsonRenderer({
|
|
|
1972
2014
|
}
|
|
1973
2015
|
};
|
|
1974
2016
|
if (Array.isArray(json)) {
|
|
1975
|
-
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_react13.default.Fragment, { children:
|
|
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)(import_react13.default.Fragment, { children: renderNode2(n) }, idx)) });
|
|
1976
2018
|
}
|
|
1977
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children:
|
|
2019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(className), children: renderNode2(json) });
|
|
1978
2020
|
}
|
|
1979
2021
|
|
|
1980
2022
|
// src/hooks/useJsonRender.tsx
|
|
@@ -6065,7 +6107,8 @@ function ITDialog({
|
|
|
6065
6107
|
className,
|
|
6066
6108
|
title,
|
|
6067
6109
|
useFormHeader = false,
|
|
6068
|
-
fullScreen = false
|
|
6110
|
+
fullScreen = false,
|
|
6111
|
+
padded = true
|
|
6069
6112
|
}) {
|
|
6070
6113
|
const { t } = useITTranslation();
|
|
6071
6114
|
const modalRef = (0, import_react29.useRef)(null);
|
|
@@ -6094,7 +6137,7 @@ function ITDialog({
|
|
|
6094
6137
|
"div",
|
|
6095
6138
|
{
|
|
6096
6139
|
ref: modalRef,
|
|
6097
|
-
className: `overflow-hidden relative ${fullScreen ? "w-screen h-screen max-w-none rounded-none m-0 flex flex-col" : `${className || ""} ${useFormHeader ? "p-0" : "p-6"}`}`,
|
|
6140
|
+
className: `overflow-hidden relative ${fullScreen ? "w-screen h-screen max-w-none rounded-none m-0 flex flex-col" : `${className || ""} ${!padded || useFormHeader ? "p-0" : "p-6"}`}`,
|
|
6098
6141
|
style: {
|
|
6099
6142
|
backgroundColor: theme.card.backgroundColor,
|
|
6100
6143
|
borderRadius: fullScreen ? "0" : theme.card.borderRadius,
|
|
@@ -6116,8 +6159,8 @@ function ITDialog({
|
|
|
6116
6159
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_fa15.FaRegTimesCircle, {})
|
|
6117
6160
|
}
|
|
6118
6161
|
),
|
|
6119
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ITText, { as: "h2", className: "text-xl font-semibold mb-4", children: title }),
|
|
6120
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children })
|
|
6162
|
+
title && (padded ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ITText, { as: "h2", className: "text-xl font-semibold mb-4", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-between gap-3 px-6 py-4 border-b border-slate-200", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ITText, { as: "h2", className: "text-lg font-medium", children: title }) })),
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: padded ? void 0 : "min-h-0 flex-1 flex flex-col", children })
|
|
6121
6164
|
] })
|
|
6122
6165
|
}
|
|
6123
6166
|
)
|
|
@@ -7044,7 +7087,8 @@ var ITImage = ({
|
|
|
7044
7087
|
src,
|
|
7045
7088
|
alt,
|
|
7046
7089
|
className = "",
|
|
7047
|
-
fallback = ""
|
|
7090
|
+
fallback = "",
|
|
7091
|
+
fit = "cover"
|
|
7048
7092
|
}) => {
|
|
7049
7093
|
const [imageError, setImageError] = (0, import_react36.useState)(false);
|
|
7050
7094
|
const { t } = useITTranslation();
|
|
@@ -7060,7 +7104,8 @@ var ITImage = ({
|
|
|
7060
7104
|
{
|
|
7061
7105
|
src: fallback,
|
|
7062
7106
|
alt: t("image.fallbackAlt"),
|
|
7063
|
-
className: "w-full h-full
|
|
7107
|
+
className: "w-full h-full",
|
|
7108
|
+
style: { objectFit: fit }
|
|
7064
7109
|
}
|
|
7065
7110
|
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7066
7111
|
"img",
|
|
@@ -7068,7 +7113,8 @@ var ITImage = ({
|
|
|
7068
7113
|
src,
|
|
7069
7114
|
alt,
|
|
7070
7115
|
onError: handleImageError,
|
|
7071
|
-
className: "w-full h-full
|
|
7116
|
+
className: "w-full h-full",
|
|
7117
|
+
style: { objectFit: fit }
|
|
7072
7118
|
}
|
|
7073
7119
|
)
|
|
7074
7120
|
}
|
|
@@ -8342,6 +8388,7 @@ function ITSegmentedControl({
|
|
|
8342
8388
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8343
8389
|
"div",
|
|
8344
8390
|
{
|
|
8391
|
+
role: "group",
|
|
8345
8392
|
className: (0, import_clsx40.default)(
|
|
8346
8393
|
"inline-flex rounded-xl bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700",
|
|
8347
8394
|
container,
|
|
@@ -8353,6 +8400,8 @@ function ITSegmentedControl({
|
|
|
8353
8400
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8354
8401
|
"button",
|
|
8355
8402
|
{
|
|
8403
|
+
type: "button",
|
|
8404
|
+
"aria-pressed": isActive,
|
|
8356
8405
|
onClick: () => !disabled && onChange(opt.value),
|
|
8357
8406
|
disabled,
|
|
8358
8407
|
className: (0, import_clsx40.default)(
|
|
@@ -9029,6 +9078,12 @@ function ITStatCard({
|
|
|
9029
9078
|
onClick,
|
|
9030
9079
|
role: onClick ? "button" : void 0,
|
|
9031
9080
|
tabIndex: onClick ? 0 : void 0,
|
|
9081
|
+
onKeyDown: onClick ? (e) => {
|
|
9082
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9083
|
+
e.preventDefault();
|
|
9084
|
+
onClick();
|
|
9085
|
+
}
|
|
9086
|
+
} : void 0,
|
|
9032
9087
|
children: [
|
|
9033
9088
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-start justify-between mb-1", children: [
|
|
9034
9089
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ITText, { as: "span", className: "text-xs font-medium text-slate-400 dark:text-slate-500", children: label }),
|
|
@@ -11166,7 +11221,7 @@ function ITCodeTreeView({
|
|
|
11166
11221
|
const line = analysis.nodeLines.get(pathKey(node.path))?.line;
|
|
11167
11222
|
const isRoot = node.key === "";
|
|
11168
11223
|
const isCollapsed = collapsed[node.key] ?? (node.childCount > 0 && node.level >= AUTO_EXPANDED_LEVELS);
|
|
11169
|
-
const
|
|
11224
|
+
const hasChildren2 = node.childCount > 0;
|
|
11170
11225
|
const isPrimitive = node.kind !== "object" && node.kind !== "array";
|
|
11171
11226
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
11172
11227
|
"div",
|
|
@@ -11174,7 +11229,7 @@ function ITCodeTreeView({
|
|
|
11174
11229
|
className: "it-json-editor-tree-row",
|
|
11175
11230
|
style: { paddingLeft: node.level * 14 },
|
|
11176
11231
|
children: [
|
|
11177
|
-
|
|
11232
|
+
hasChildren2 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11178
11233
|
"button",
|
|
11179
11234
|
{
|
|
11180
11235
|
type: "button",
|
|
@@ -11189,7 +11244,7 @@ function ITCodeTreeView({
|
|
|
11189
11244
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "it-json-editor-tk-key", children: node.label }),
|
|
11190
11245
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "it-json-editor-tk-punct", children: ":" })
|
|
11191
11246
|
] }),
|
|
11192
|
-
|
|
11247
|
+
hasChildren2 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
11193
11248
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "it-json-editor-tk-punct", children: node.kind === "array" ? "[" : "{" }),
|
|
11194
11249
|
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "it-json-editor-tk-punct", children: node.kind === "array" ? "]" : "}" }),
|
|
11195
11250
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "it-json-editor-tree-badge", children: t("jsonEditor.childCount", { count: node.childCount }) })
|
|
@@ -12209,217 +12264,1661 @@ function EditorToggle({
|
|
|
12209
12264
|
);
|
|
12210
12265
|
}
|
|
12211
12266
|
|
|
12212
|
-
// src/
|
|
12213
|
-
var
|
|
12214
|
-
var import_react_dropzone = require("react-dropzone");
|
|
12215
|
-
var import_clsx54 = __toESM(require("clsx"), 1);
|
|
12267
|
+
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
12268
|
+
var import_react53 = require("react");
|
|
12216
12269
|
|
|
12217
|
-
// src/
|
|
12218
|
-
var
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
FileTypeEnum2["JPG"] = "image/jpg";
|
|
12225
|
-
FileTypeEnum2["JPEG"] = "image/jpeg";
|
|
12226
|
-
FileTypeEnum2["MP4"] = "video/mp4";
|
|
12227
|
-
FileTypeEnum2["MOV"] = "video/quicktime";
|
|
12228
|
-
FileTypeEnum2["AVI"] = "video/x-msvideo";
|
|
12229
|
-
FileTypeEnum2["MKV"] = "video/x-matroska";
|
|
12230
|
-
FileTypeEnum2["VIDEO_3GPP"] = "video/3gpp";
|
|
12231
|
-
FileTypeEnum2["WEBM"] = "video/webm";
|
|
12232
|
-
return FileTypeEnum2;
|
|
12233
|
-
})(FileTypeEnum || {});
|
|
12234
|
-
var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
12235
|
-
UploadStatus2["PENDING"] = "pendiente";
|
|
12236
|
-
UploadStatus2["UPLOADING"] = "subiendo";
|
|
12237
|
-
UploadStatus2["UPLOADED"] = "subido";
|
|
12238
|
-
UploadStatus2["ERROR"] = "error";
|
|
12239
|
-
return UploadStatus2;
|
|
12240
|
-
})(UploadStatus || {});
|
|
12270
|
+
// src/types/loader.types.ts
|
|
12271
|
+
var sizeClasses = {
|
|
12272
|
+
sm: "h-4 w-4",
|
|
12273
|
+
md: "h-8 w-8",
|
|
12274
|
+
lg: "h-12 w-12",
|
|
12275
|
+
xl: "h-16 w-16"
|
|
12276
|
+
};
|
|
12241
12277
|
|
|
12242
|
-
// src/components/
|
|
12278
|
+
// src/components/atoms/loader/loader.tsx
|
|
12243
12279
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
showStatusBadge = true,
|
|
12252
|
-
uploadStatus: externalStatus,
|
|
12253
|
-
onStatusChange,
|
|
12254
|
-
initialPreviewUrl,
|
|
12255
|
-
view = "drop",
|
|
12256
|
-
buttonLabel,
|
|
12257
|
-
modalTitle
|
|
12258
|
-
}) => {
|
|
12280
|
+
function ITLoader({
|
|
12281
|
+
size = "md",
|
|
12282
|
+
variant = "spinner",
|
|
12283
|
+
color = "primary",
|
|
12284
|
+
// Default to semantic primary
|
|
12285
|
+
className = ""
|
|
12286
|
+
}) {
|
|
12259
12287
|
const { t } = useITTranslation();
|
|
12260
|
-
const
|
|
12261
|
-
const
|
|
12262
|
-
const
|
|
12263
|
-
const
|
|
12264
|
-
const
|
|
12265
|
-
const
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
const uploadStatus = externalStatus || internalUploadStatus;
|
|
12275
|
-
const setUploadStatus = (status) => {
|
|
12276
|
-
if (externalStatus === void 0) {
|
|
12277
|
-
setInternalUploadStatus(status);
|
|
12278
|
-
}
|
|
12279
|
-
onStatusChange?.(status);
|
|
12280
|
-
};
|
|
12281
|
-
const getAcceptedFileTypes = () => {
|
|
12282
|
-
const accept = {};
|
|
12283
|
-
acceptedFileTypes.forEach((type) => {
|
|
12284
|
-
switch (type) {
|
|
12285
|
-
case "application/pdf" /* PDF */:
|
|
12286
|
-
accept["application/pdf" /* PDF */] = [".pdf"];
|
|
12287
|
-
break;
|
|
12288
|
-
case "application/vnd.ms-excel" /* XLS */:
|
|
12289
|
-
accept["application/vnd.ms-excel" /* XLS */] = [".xls"];
|
|
12290
|
-
break;
|
|
12291
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */:
|
|
12292
|
-
accept["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */] = [".xlsx"];
|
|
12293
|
-
break;
|
|
12294
|
-
case "text/csv" /* CSV */:
|
|
12295
|
-
accept["text/csv" /* CSV */] = [".csv"];
|
|
12296
|
-
break;
|
|
12297
|
-
case "image/png" /* PNG */:
|
|
12298
|
-
accept["image/png" /* PNG */] = [".png"];
|
|
12299
|
-
break;
|
|
12300
|
-
case "image/jpg" /* JPG */:
|
|
12301
|
-
accept["image/jpg" /* JPG */] = [".jpg", ".jpeg"];
|
|
12302
|
-
break;
|
|
12303
|
-
case "image/jpeg" /* JPEG */:
|
|
12304
|
-
accept["image/jpeg" /* JPEG */] = [".jpeg", ".jpg"];
|
|
12305
|
-
break;
|
|
12306
|
-
case "video/mp4" /* MP4 */:
|
|
12307
|
-
accept["video/mp4" /* MP4 */] = [".mp4"];
|
|
12308
|
-
break;
|
|
12309
|
-
case "video/quicktime" /* MOV */:
|
|
12310
|
-
accept["video/quicktime" /* MOV */] = [".mov"];
|
|
12311
|
-
break;
|
|
12312
|
-
case "video/x-msvideo" /* AVI */:
|
|
12313
|
-
accept["video/x-msvideo" /* AVI */] = [".avi"];
|
|
12314
|
-
break;
|
|
12315
|
-
case "video/x-matroska" /* MKV */:
|
|
12316
|
-
accept["video/x-matroska" /* MKV */] = [".mkv"];
|
|
12317
|
-
break;
|
|
12318
|
-
case "video/3gpp" /* VIDEO_3GPP */:
|
|
12319
|
-
accept["video/3gpp" /* VIDEO_3GPP */] = [".3gp"];
|
|
12320
|
-
break;
|
|
12321
|
-
case "video/webm" /* WEBM */:
|
|
12322
|
-
accept["video/webm" /* WEBM */] = [".webm"];
|
|
12323
|
-
break;
|
|
12324
|
-
}
|
|
12325
|
-
});
|
|
12326
|
-
return accept;
|
|
12327
|
-
};
|
|
12328
|
-
const getFileExtensions = () => {
|
|
12329
|
-
const extensions = [];
|
|
12330
|
-
acceptedFileTypes.forEach((type) => {
|
|
12331
|
-
switch (type) {
|
|
12332
|
-
case "application/pdf" /* PDF */:
|
|
12333
|
-
if (!extensions.includes("PDF")) extensions.push("PDF");
|
|
12334
|
-
break;
|
|
12335
|
-
case "application/vnd.ms-excel" /* XLS */:
|
|
12336
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */:
|
|
12337
|
-
if (!extensions.includes("EXCEL")) extensions.push("EXCEL");
|
|
12338
|
-
break;
|
|
12339
|
-
case "text/csv" /* CSV */:
|
|
12340
|
-
if (!extensions.includes("CSV")) extensions.push("CSV");
|
|
12341
|
-
break;
|
|
12342
|
-
case "image/png" /* PNG */:
|
|
12343
|
-
case "image/jpg" /* JPG */:
|
|
12344
|
-
case "image/jpeg" /* JPEG */:
|
|
12345
|
-
if (!extensions.includes("IMAGEN")) extensions.push("IMAGEN");
|
|
12346
|
-
break;
|
|
12347
|
-
case "video/mp4" /* MP4 */:
|
|
12348
|
-
case "video/quicktime" /* MOV */:
|
|
12349
|
-
case "video/x-msvideo" /* AVI */:
|
|
12350
|
-
case "video/x-matroska" /* MKV */:
|
|
12351
|
-
case "video/3gpp" /* VIDEO_3GPP */:
|
|
12352
|
-
case "video/webm" /* WEBM */:
|
|
12353
|
-
if (!extensions.includes("VIDEO")) extensions.push("VIDEO");
|
|
12354
|
-
break;
|
|
12288
|
+
const isSemantic = color in theme.colors;
|
|
12289
|
+
const resolvedColor = isSemantic ? theme.colors[color][500] : color;
|
|
12290
|
+
const isCssValue = isSemantic || color.startsWith("#") || color.startsWith("rgb");
|
|
12291
|
+
const style = isCssValue ? { color: resolvedColor } : {};
|
|
12292
|
+
const bgStyle = isCssValue ? { backgroundColor: resolvedColor } : {};
|
|
12293
|
+
const colorClass = !isCssValue ? color : "";
|
|
12294
|
+
if (variant === "spinner") {
|
|
12295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12296
|
+
"div",
|
|
12297
|
+
{
|
|
12298
|
+
className: `inline-block ${sizeClasses[size]} animate-spin rounded-full border-2 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite] ${colorClass} ${className}`,
|
|
12299
|
+
role: "status",
|
|
12300
|
+
style,
|
|
12301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ITText, { as: "span", className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]", children: t("common.loading") })
|
|
12355
12302
|
}
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
dotColor: "bg-success-400"
|
|
12375
|
-
},
|
|
12376
|
-
["error" /* ERROR */]: {
|
|
12377
|
-
label: t("dropfile.status.error"),
|
|
12378
|
-
color: "bg-danger-100 text-danger-800 border-danger-200",
|
|
12379
|
-
dotColor: "bg-danger-400"
|
|
12303
|
+
);
|
|
12304
|
+
}
|
|
12305
|
+
if (variant === "dots") {
|
|
12306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12307
|
+
"div",
|
|
12308
|
+
{
|
|
12309
|
+
className: `flex items-center justify-center space-x-2 ${className}`,
|
|
12310
|
+
children: [...Array(3)].map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12311
|
+
"div",
|
|
12312
|
+
{
|
|
12313
|
+
className: `${sizeClasses[size.replace(/l|g/, "")]} animate-bounce rounded-full ${colorClass}`,
|
|
12314
|
+
style: {
|
|
12315
|
+
...bgStyle,
|
|
12316
|
+
animationDelay: `${i * 0.1}s`
|
|
12317
|
+
}
|
|
12318
|
+
},
|
|
12319
|
+
i
|
|
12320
|
+
))
|
|
12380
12321
|
}
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
const previewUrl = URL.createObjectURL(file);
|
|
12401
|
-
setImagePreview(previewUrl);
|
|
12402
|
-
}
|
|
12403
|
-
} else {
|
|
12404
|
-
alert(t("dropfile.fileTypeNotAllowed"));
|
|
12405
|
-
setSelectedFile(null);
|
|
12406
|
-
setFileType(null);
|
|
12407
|
-
setImagePreview(null);
|
|
12408
|
-
setUploadStatus("pendiente" /* PENDING */);
|
|
12322
|
+
);
|
|
12323
|
+
}
|
|
12324
|
+
if (variant === "bar") {
|
|
12325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12326
|
+
"div",
|
|
12327
|
+
{
|
|
12328
|
+
className: `w-full ${size === "sm" ? "h-1" : size === "md" ? "h-1.5" : size === "lg" ? "h-2" : "h-2.5"} bg-secondary-200 rounded-full overflow-hidden ${className}`,
|
|
12329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12330
|
+
"div",
|
|
12331
|
+
{
|
|
12332
|
+
className: `h-full animate-progress ${colorClass}`,
|
|
12333
|
+
style: {
|
|
12334
|
+
backgroundColor: resolvedColor,
|
|
12335
|
+
// Simplified gradient for modern look, or keep it solid
|
|
12336
|
+
backgroundImage: isCssValue ? `linear-gradient(to right, ${resolvedColor}DD, ${resolvedColor})` : void 0,
|
|
12337
|
+
animation: "progress 1.5s ease-in-out infinite"
|
|
12338
|
+
}
|
|
12339
|
+
}
|
|
12340
|
+
)
|
|
12409
12341
|
}
|
|
12410
|
-
|
|
12411
|
-
}
|
|
12412
|
-
|
|
12413
|
-
|
|
12342
|
+
);
|
|
12343
|
+
}
|
|
12344
|
+
if (variant === "pulse") {
|
|
12345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12346
|
+
"div",
|
|
12347
|
+
{
|
|
12348
|
+
className: `rounded-full ${sizeClasses[size]} animate-pulse ${colorClass} ${className}`,
|
|
12349
|
+
style: bgStyle
|
|
12350
|
+
}
|
|
12351
|
+
);
|
|
12352
|
+
}
|
|
12353
|
+
return null;
|
|
12354
|
+
}
|
|
12355
|
+
|
|
12356
|
+
// src/json-renderer/catalog/catalog.props.ts
|
|
12357
|
+
var GLOBALLY_FORBIDDEN_PROPS = [
|
|
12358
|
+
"dangerouslySetInnerHTML",
|
|
12359
|
+
"render",
|
|
12360
|
+
"component",
|
|
12361
|
+
"children",
|
|
12362
|
+
// los hijos se declaran como nodos, nunca como prop
|
|
12363
|
+
"ref",
|
|
12364
|
+
"key",
|
|
12365
|
+
"style",
|
|
12366
|
+
// se permite solo si el catálogo lo declara explícitamente
|
|
12367
|
+
"icon",
|
|
12368
|
+
"actions",
|
|
12369
|
+
"action",
|
|
12370
|
+
"emptyAction",
|
|
12371
|
+
"fallback",
|
|
12372
|
+
"logo",
|
|
12373
|
+
"badge"
|
|
12374
|
+
];
|
|
12375
|
+
function createCatalog(entries, excluded = {}) {
|
|
12376
|
+
const index = {};
|
|
12377
|
+
for (const entry of entries) {
|
|
12378
|
+
if (index[entry.type]) {
|
|
12379
|
+
throw new Error(`Cat\xE1logo duplicado: ${entry.type}`);
|
|
12380
|
+
}
|
|
12381
|
+
index[entry.type] = entry;
|
|
12382
|
+
}
|
|
12383
|
+
return { entries: index, excluded };
|
|
12384
|
+
}
|
|
12385
|
+
function getCatalogEntry(catalog, type) {
|
|
12386
|
+
return catalog.entries[type];
|
|
12387
|
+
}
|
|
12388
|
+
function isExcludedType(catalog, type) {
|
|
12389
|
+
return Boolean(catalog.excluded && type in catalog.excluded);
|
|
12390
|
+
}
|
|
12391
|
+
function getExclusionReason(catalog, type) {
|
|
12392
|
+
return catalog.excluded?.[type];
|
|
12393
|
+
}
|
|
12394
|
+
|
|
12395
|
+
// src/json-renderer/catalog/axzyCatalog.ts
|
|
12396
|
+
var COLORS = ["primary", "secondary", "success", "danger", "warning", "info", "purple", "error", "gray"];
|
|
12397
|
+
var SIZES = ["sm", "md", "lg"];
|
|
12398
|
+
var DIRECTIONS = ["row", "column"];
|
|
12399
|
+
var ALIGNS = ["start", "center", "end", "stretch", "baseline"];
|
|
12400
|
+
var JUSTIFIES = ["start", "center", "end", "between", "around", "evenly"];
|
|
12401
|
+
var WRAPS = ["nowrap", "wrap", "wrap-reverse"];
|
|
12402
|
+
var TEXT_PROPS = {
|
|
12403
|
+
className: { kind: "string", doc: "Clases extra del componente." }
|
|
12404
|
+
};
|
|
12405
|
+
var AXZY_CATALOG_ENTRIES = [
|
|
12406
|
+
{
|
|
12407
|
+
type: "ITText",
|
|
12408
|
+
component: ITText,
|
|
12409
|
+
children: true,
|
|
12410
|
+
text: true,
|
|
12411
|
+
summary: "Texto sem\xE1ntico. Usa `text` o `children` para el contenido.",
|
|
12412
|
+
props: {
|
|
12413
|
+
as: { kind: "enum", values: ["span", "p", "h1", "h2", "h3", "h4", "label", "div", "strong", "em"], default: "span", doc: "Etiqueta HTML sem\xE1ntica." },
|
|
12414
|
+
muted: { kind: "boolean", default: false, doc: "Aten\xFAa el color del texto." },
|
|
12415
|
+
...TEXT_PROPS
|
|
12416
|
+
}
|
|
12417
|
+
},
|
|
12418
|
+
{
|
|
12419
|
+
type: "ITButton",
|
|
12420
|
+
component: ITButton,
|
|
12421
|
+
children: true,
|
|
12422
|
+
text: true,
|
|
12423
|
+
summary: "Bot\xF3n. `onClick` es una acci\xF3n registrada por el host.",
|
|
12424
|
+
props: {
|
|
12425
|
+
label: { kind: "string", doc: "Texto del bot\xF3n (alternativa a `text`)." },
|
|
12426
|
+
color: { kind: "enum", values: COLORS, default: "primary" },
|
|
12427
|
+
size: { kind: "enum", values: SIZES, default: "md" },
|
|
12428
|
+
variant: {
|
|
12429
|
+
kind: "enum",
|
|
12430
|
+
values: ["filled", "outlined", "raised", "rounded", "text", "raised-text", "icon-only", "link"],
|
|
12431
|
+
default: "filled"
|
|
12432
|
+
},
|
|
12433
|
+
disabled: { kind: "boolean", default: false },
|
|
12434
|
+
type: { kind: "enum", values: ["button", "submit", "reset"], default: "button" },
|
|
12435
|
+
ariaLabel: { kind: "string", doc: "Etiqueta accesible cuando el bot\xF3n no lleva texto." },
|
|
12436
|
+
title: { kind: "string" },
|
|
12437
|
+
onClick: { kind: "action", doc: "Nombre de una acci\xF3n registrada." },
|
|
12438
|
+
...TEXT_PROPS
|
|
12439
|
+
},
|
|
12440
|
+
forbidden: ["icon"]
|
|
12441
|
+
},
|
|
12442
|
+
{
|
|
12443
|
+
type: "ITCard",
|
|
12444
|
+
component: ITCard,
|
|
12445
|
+
children: true,
|
|
12446
|
+
summary: "Tarjeta con t\xEDtulo, imagen y contenido.",
|
|
12447
|
+
props: {
|
|
12448
|
+
title: { kind: "string" },
|
|
12449
|
+
image: { kind: "string", doc: "URL de la imagen de cabecera." },
|
|
12450
|
+
alt: { kind: "string" },
|
|
12451
|
+
onClick: { kind: "action" },
|
|
12452
|
+
imageClassName: { kind: "string" },
|
|
12453
|
+
titleClassName: { kind: "string" },
|
|
12454
|
+
contentClassName: { kind: "string" },
|
|
12455
|
+
actionClassName: { kind: "string" },
|
|
12456
|
+
...TEXT_PROPS
|
|
12457
|
+
},
|
|
12458
|
+
forbidden: ["actions"]
|
|
12459
|
+
},
|
|
12460
|
+
{
|
|
12461
|
+
type: "ITAlert",
|
|
12462
|
+
component: ITAlert,
|
|
12463
|
+
children: true,
|
|
12464
|
+
text: true,
|
|
12465
|
+
summary: "Aviso con variante sem\xE1ntica.",
|
|
12466
|
+
props: {
|
|
12467
|
+
variant: { kind: "enum", values: ["info", "success", "warning", "error"], default: "info" },
|
|
12468
|
+
title: { kind: "string" },
|
|
12469
|
+
dismissible: { kind: "boolean", default: false },
|
|
12470
|
+
onDismiss: { kind: "action" },
|
|
12471
|
+
...TEXT_PROPS
|
|
12472
|
+
},
|
|
12473
|
+
forbidden: ["icon"]
|
|
12474
|
+
},
|
|
12475
|
+
{
|
|
12476
|
+
type: "ITEmptyState",
|
|
12477
|
+
component: ITEmptyState,
|
|
12478
|
+
text: true,
|
|
12479
|
+
summary: "Estado vac\xEDo con t\xEDtulo, descripci\xF3n y acci\xF3n.",
|
|
12480
|
+
props: {
|
|
12481
|
+
title: { kind: "string", required: true },
|
|
12482
|
+
description: { kind: "string" },
|
|
12483
|
+
...TEXT_PROPS
|
|
12484
|
+
},
|
|
12485
|
+
forbidden: ["icon", "action"]
|
|
12486
|
+
},
|
|
12487
|
+
{
|
|
12488
|
+
type: "ITStatCard",
|
|
12489
|
+
component: ITStatCard,
|
|
12490
|
+
summary: "M\xE9trica con valor y tendencia.",
|
|
12491
|
+
props: {
|
|
12492
|
+
label: { kind: "string", required: true },
|
|
12493
|
+
value: { kind: "string", required: true, doc: "Valor ya formateado o n\xFAmero." },
|
|
12494
|
+
trend: { kind: "string" },
|
|
12495
|
+
trendDirection: { kind: "enum", values: ["up", "down", "neutral"] },
|
|
12496
|
+
color: { kind: "string", doc: "Color CSS del icono." },
|
|
12497
|
+
onClick: { kind: "action" },
|
|
12498
|
+
...TEXT_PROPS
|
|
12499
|
+
},
|
|
12500
|
+
forbidden: ["icon"]
|
|
12501
|
+
},
|
|
12502
|
+
{
|
|
12503
|
+
type: "ITChip",
|
|
12504
|
+
component: ITChip,
|
|
12505
|
+
children: true,
|
|
12506
|
+
text: true,
|
|
12507
|
+
summary: "Etiqueta compacta, opcionalmente removible o seleccionable.",
|
|
12508
|
+
props: {
|
|
12509
|
+
label: { kind: "string" },
|
|
12510
|
+
color: { kind: "enum", values: COLORS, default: "gray" },
|
|
12511
|
+
size: { kind: "enum", values: SIZES, default: "md" },
|
|
12512
|
+
variant: { kind: "enum", values: ["soft", "filled", "outlined"], default: "soft" },
|
|
12513
|
+
removable: { kind: "boolean", default: false },
|
|
12514
|
+
selected: { kind: "boolean", default: false },
|
|
12515
|
+
disabled: { kind: "boolean", default: false },
|
|
12516
|
+
onRemove: { kind: "action" },
|
|
12517
|
+
onClick: { kind: "action" },
|
|
12518
|
+
...TEXT_PROPS
|
|
12519
|
+
},
|
|
12520
|
+
forbidden: ["icon"]
|
|
12521
|
+
},
|
|
12522
|
+
{
|
|
12523
|
+
type: "ITBadget",
|
|
12524
|
+
component: ITBadget,
|
|
12525
|
+
children: true,
|
|
12526
|
+
text: true,
|
|
12527
|
+
summary: "Insignia de estado.",
|
|
12528
|
+
props: {
|
|
12529
|
+
label: { kind: "string" },
|
|
12530
|
+
color: { kind: "enum", values: COLORS, default: "primary" },
|
|
12531
|
+
size: { kind: "enum", values: SIZES, default: "md" },
|
|
12532
|
+
variant: { kind: "enum", values: ["soft", "filled", "outlined"], default: "soft" },
|
|
12533
|
+
...TEXT_PROPS
|
|
12534
|
+
}
|
|
12535
|
+
},
|
|
12536
|
+
{
|
|
12537
|
+
type: "ITAvatar",
|
|
12538
|
+
component: ITAvatar,
|
|
12539
|
+
summary: "Avatar con imagen o iniciales.",
|
|
12540
|
+
props: {
|
|
12541
|
+
src: { kind: "string" },
|
|
12542
|
+
alt: { kind: "string" },
|
|
12543
|
+
initials: { kind: "string", doc: "Se usa cuando no hay imagen." },
|
|
12544
|
+
size: { kind: "enum", values: ["xs", "sm", "md", "lg", "xl"] },
|
|
12545
|
+
color: { kind: "string" },
|
|
12546
|
+
onClick: { kind: "action" },
|
|
12547
|
+
...TEXT_PROPS
|
|
12548
|
+
},
|
|
12549
|
+
forbidden: ["badge"]
|
|
12550
|
+
},
|
|
12551
|
+
{
|
|
12552
|
+
type: "ITDivider",
|
|
12553
|
+
component: ITDivider,
|
|
12554
|
+
summary: "Separador horizontal o vertical.",
|
|
12555
|
+
props: {
|
|
12556
|
+
orientation: { kind: "enum", values: ["horizontal", "vertical"], default: "horizontal" },
|
|
12557
|
+
color: { kind: "string" },
|
|
12558
|
+
thickness: { kind: "string" },
|
|
12559
|
+
...TEXT_PROPS
|
|
12560
|
+
}
|
|
12561
|
+
},
|
|
12562
|
+
{
|
|
12563
|
+
type: "ITStack",
|
|
12564
|
+
component: ITStack,
|
|
12565
|
+
children: true,
|
|
12566
|
+
summary: "Pila con direcci\xF3n y separaci\xF3n uniforme.",
|
|
12567
|
+
props: {
|
|
12568
|
+
direction: { kind: "enum", values: DIRECTIONS, default: "column" },
|
|
12569
|
+
spacing: { kind: "number", default: 0 },
|
|
12570
|
+
alignItems: { kind: "enum", values: ALIGNS },
|
|
12571
|
+
justifyContent: { kind: "enum", values: JUSTIFIES },
|
|
12572
|
+
flexWrap: { kind: "enum", values: WRAPS },
|
|
12573
|
+
...TEXT_PROPS
|
|
12574
|
+
},
|
|
12575
|
+
forbidden: ["divider", "style"]
|
|
12576
|
+
},
|
|
12577
|
+
{
|
|
12578
|
+
type: "ITFlex",
|
|
12579
|
+
component: ITFlex,
|
|
12580
|
+
children: true,
|
|
12581
|
+
summary: "Contenedor flex completo.",
|
|
12582
|
+
props: {
|
|
12583
|
+
direction: { kind: "enum", values: DIRECTIONS, default: "row" },
|
|
12584
|
+
align: { kind: "enum", values: ALIGNS },
|
|
12585
|
+
justify: { kind: "enum", values: JUSTIFIES },
|
|
12586
|
+
wrap: { kind: "enum", values: WRAPS },
|
|
12587
|
+
gap: { kind: "number", default: 0 },
|
|
12588
|
+
grow: { kind: "boolean" },
|
|
12589
|
+
shrink: { kind: "boolean" },
|
|
12590
|
+
basis: { kind: "string" },
|
|
12591
|
+
...TEXT_PROPS
|
|
12592
|
+
},
|
|
12593
|
+
forbidden: ["style", "onClick"]
|
|
12594
|
+
},
|
|
12595
|
+
{
|
|
12596
|
+
type: "ITGrid",
|
|
12597
|
+
component: ITGrid,
|
|
12598
|
+
children: true,
|
|
12599
|
+
summary: "Rejilla de 12 columnas; `item` para una celda.",
|
|
12600
|
+
props: {
|
|
12601
|
+
container: { kind: "boolean", default: false },
|
|
12602
|
+
item: { kind: "boolean", default: false },
|
|
12603
|
+
spacing: { kind: "number", default: 0 },
|
|
12604
|
+
columns: { kind: "integer", default: 12, doc: "Columnas del contenedor." },
|
|
12605
|
+
xs: { kind: "integer" },
|
|
12606
|
+
sm: { kind: "integer" },
|
|
12607
|
+
md: { kind: "integer" },
|
|
12608
|
+
lg: { kind: "integer" },
|
|
12609
|
+
xl: { kind: "integer" },
|
|
12610
|
+
...TEXT_PROPS
|
|
12611
|
+
},
|
|
12612
|
+
forbidden: ["style"]
|
|
12613
|
+
},
|
|
12614
|
+
{
|
|
12615
|
+
type: "ITLoader",
|
|
12616
|
+
component: ITLoader,
|
|
12617
|
+
summary: "Indicador de carga.",
|
|
12618
|
+
props: {
|
|
12619
|
+
variant: { kind: "enum", values: ["spinner", "dots", "bar", "pulse"], default: "spinner" },
|
|
12620
|
+
size: { kind: "enum", values: ["xs", "sm", "md", "lg", "xl"], default: "md" },
|
|
12621
|
+
color: { kind: "string" },
|
|
12622
|
+
...TEXT_PROPS
|
|
12623
|
+
}
|
|
12624
|
+
},
|
|
12625
|
+
{
|
|
12626
|
+
type: "ITSkeleton",
|
|
12627
|
+
component: ITSkeleton,
|
|
12628
|
+
summary: "Marcador de carga con forma.",
|
|
12629
|
+
props: {
|
|
12630
|
+
variant: { kind: "enum", values: ["text", "rect", "circle"], default: "text" },
|
|
12631
|
+
width: { kind: "string" },
|
|
12632
|
+
height: { kind: "string" },
|
|
12633
|
+
count: { kind: "integer", default: 1 },
|
|
12634
|
+
...TEXT_PROPS
|
|
12635
|
+
},
|
|
12636
|
+
forbidden: ["style"]
|
|
12637
|
+
},
|
|
12638
|
+
{
|
|
12639
|
+
type: "ITProgress",
|
|
12640
|
+
component: ITProgress,
|
|
12641
|
+
summary: "Barra de progreso.",
|
|
12642
|
+
props: {
|
|
12643
|
+
value: { kind: "number", default: 0 },
|
|
12644
|
+
max: { kind: "number", default: 100 },
|
|
12645
|
+
variant: { kind: "enum", values: ["determinate", "indeterminate"], default: "determinate" },
|
|
12646
|
+
color: { kind: "enum", values: COLORS, default: "primary" },
|
|
12647
|
+
size: { kind: "enum", values: SIZES, default: "md" },
|
|
12648
|
+
...TEXT_PROPS
|
|
12649
|
+
},
|
|
12650
|
+
forbidden: ["style"]
|
|
12651
|
+
},
|
|
12652
|
+
{
|
|
12653
|
+
type: "ITDataTable",
|
|
12654
|
+
component: ITDataTable,
|
|
12655
|
+
summary: "Tabla con paginaci\xF3n, orden y filtros. Los datos llegan de una fuente que el host resuelve (`$source`).",
|
|
12656
|
+
props: {
|
|
12657
|
+
columns: {
|
|
12658
|
+
kind: "columns",
|
|
12659
|
+
required: true,
|
|
12660
|
+
doc: "Columnas: { key, label, type, sortable, filter, currencyMX }."
|
|
12661
|
+
},
|
|
12662
|
+
fetchData: {
|
|
12663
|
+
kind: "data",
|
|
12664
|
+
required: true,
|
|
12665
|
+
doc: 'Referencia a una fuente: { "$source": "usuarios" }. El host la convierte en un fetcher.'
|
|
12666
|
+
},
|
|
12667
|
+
title: { kind: "string", doc: "T\xEDtulo opcional sobre la tabla." },
|
|
12668
|
+
defaultItemsPerPage: { kind: "integer", default: 5, doc: "Filas por p\xE1gina al abrir." },
|
|
12669
|
+
itemsPerPageOptions: { kind: "array", doc: "Opciones del paginador, p. ej. [5, 10, 20]." },
|
|
12670
|
+
debounceMs: { kind: "integer", default: 400, doc: "Espera antes de refiltrar al teclear." },
|
|
12671
|
+
variant: { kind: "enum", values: ["default", "striped", "bordered", "minimal"], default: "default" },
|
|
12672
|
+
size: { kind: "enum", values: SIZES, default: "md" },
|
|
12673
|
+
density: { kind: "enum", values: ["compact", "normal", "comfortable"], default: "normal" },
|
|
12674
|
+
layout: { kind: "enum", values: ["auto", "fixed"], default: "auto" },
|
|
12675
|
+
showVerticalBorder: { kind: "boolean", default: true },
|
|
12676
|
+
autoCardBreakpoint: { kind: "integer", default: 0, doc: "Ancho (px) por debajo del cual cae a tarjetas." },
|
|
12677
|
+
onRowClick: { kind: "action", doc: "Nombre de una acci\xF3n registrada; recibe la fila." },
|
|
12678
|
+
className: { kind: "string" },
|
|
12679
|
+
containerClassName: { kind: "string" }
|
|
12680
|
+
},
|
|
12681
|
+
forbidden: ["renderCard", "loadingIndicator"]
|
|
12682
|
+
},
|
|
12683
|
+
{
|
|
12684
|
+
type: "ITImage",
|
|
12685
|
+
component: image_default,
|
|
12686
|
+
summary: "Imagen con respaldo si falla la carga.",
|
|
12687
|
+
props: {
|
|
12688
|
+
src: { kind: "string", required: true },
|
|
12689
|
+
alt: { kind: "string" },
|
|
12690
|
+
fallback: { kind: "string", doc: "URL de respaldo." },
|
|
12691
|
+
onClick: { kind: "action" },
|
|
12692
|
+
...TEXT_PROPS
|
|
12693
|
+
}
|
|
12694
|
+
}
|
|
12695
|
+
];
|
|
12696
|
+
var AXZY_EXCLUDED_TYPES = {
|
|
12697
|
+
ITJsonRenderer: "Recursi\xF3n: un esquema no puede pedir otro renderer.",
|
|
12698
|
+
ITSchemaRenderer: "Recursi\xF3n: un esquema no puede pedir otro renderer.",
|
|
12699
|
+
ITJSONEditor: "Ejecuta entrada del usuario como c\xF3digo.",
|
|
12700
|
+
ITFormBuilder: "Se sustituye por el nodo `form` del motor.",
|
|
12701
|
+
ITWysiwyg: "Produce HTML, que se salta la lista blanca.",
|
|
12702
|
+
ITI18nProvider: "Lo monta el host, no el esquema.",
|
|
12703
|
+
ITThemeProvider: "Lo monta el host, no el esquema.",
|
|
12704
|
+
ITLayout: "El shell lo declara el router, no un nodo suelto.",
|
|
12705
|
+
ITNavbar: "El shell lo declara el router, no un nodo suelto.",
|
|
12706
|
+
ITSidebar: "El shell lo declara el router, no un nodo suelto.",
|
|
12707
|
+
ITTopBar: "El shell lo declara el router, no un nodo suelto."
|
|
12708
|
+
};
|
|
12709
|
+
var axzyCatalog = createCatalog(AXZY_CATALOG_ENTRIES, AXZY_EXCLUDED_TYPES);
|
|
12710
|
+
var axzyCatalogTypes = Object.keys(axzyCatalog.entries);
|
|
12711
|
+
|
|
12712
|
+
// src/json-renderer/shared/limits.ts
|
|
12713
|
+
var DEFAULT_LIMITS = {
|
|
12714
|
+
maxNodes: 5e3,
|
|
12715
|
+
maxDepth: 40,
|
|
12716
|
+
maxMsPerChunk: 8,
|
|
12717
|
+
actionTimeoutMs: 15e3,
|
|
12718
|
+
maxEffectChain: 5
|
|
12719
|
+
};
|
|
12720
|
+
function resolveLimits(overrides = {}) {
|
|
12721
|
+
const merged = { ...DEFAULT_LIMITS, ...overrides };
|
|
12722
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
12723
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
12724
|
+
throw new RangeError(`L\xEDmite inv\xE1lido: ${key} = ${String(value)}`);
|
|
12725
|
+
}
|
|
12726
|
+
}
|
|
12727
|
+
return merged;
|
|
12728
|
+
}
|
|
12729
|
+
function createLimitTracker(limits = DEFAULT_LIMITS) {
|
|
12730
|
+
let nodes = 0;
|
|
12731
|
+
let deepest = 0;
|
|
12732
|
+
let exceeded = false;
|
|
12733
|
+
return {
|
|
12734
|
+
visit(depth) {
|
|
12735
|
+
if (depth > deepest) deepest = depth;
|
|
12736
|
+
if (nodes >= limits.maxNodes || depth > limits.maxDepth) {
|
|
12737
|
+
exceeded = true;
|
|
12738
|
+
return false;
|
|
12739
|
+
}
|
|
12740
|
+
nodes += 1;
|
|
12741
|
+
return true;
|
|
12742
|
+
},
|
|
12743
|
+
get nodes() {
|
|
12744
|
+
return nodes;
|
|
12745
|
+
},
|
|
12746
|
+
get deepest() {
|
|
12747
|
+
return deepest;
|
|
12748
|
+
},
|
|
12749
|
+
get exceeded() {
|
|
12750
|
+
return exceeded;
|
|
12751
|
+
}
|
|
12752
|
+
};
|
|
12753
|
+
}
|
|
12754
|
+
|
|
12755
|
+
// src/json-renderer/kernel/NodeBoundary.tsx
|
|
12756
|
+
var import_react51 = __toESM(require("react"), 1);
|
|
12757
|
+
|
|
12758
|
+
// src/json-renderer/shared/errors.ts
|
|
12759
|
+
var JsonEngineError = class extends Error {
|
|
12760
|
+
constructor(code, message, path, hint) {
|
|
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
|
+
};
|
|
12782
|
+
}
|
|
12783
|
+
};
|
|
12784
|
+
function issue(code, message, path = "", options = {}) {
|
|
12785
|
+
return {
|
|
12786
|
+
code,
|
|
12787
|
+
severity: options.severity ?? "error",
|
|
12788
|
+
message,
|
|
12789
|
+
path,
|
|
12790
|
+
hint: options.hint
|
|
12791
|
+
};
|
|
12792
|
+
}
|
|
12793
|
+
|
|
12794
|
+
// src/json-renderer/kernel/NodeBoundary.tsx
|
|
12795
|
+
var NodeBoundary = class extends import_react51.default.Component {
|
|
12796
|
+
constructor() {
|
|
12797
|
+
super(...arguments);
|
|
12798
|
+
__publicField(this, "state", { failed: false });
|
|
12799
|
+
}
|
|
12800
|
+
static getDerivedStateFromError() {
|
|
12801
|
+
return { failed: true };
|
|
12802
|
+
}
|
|
12803
|
+
componentDidCatch(error) {
|
|
12804
|
+
this.props.onError?.(error, this.props.path);
|
|
12805
|
+
}
|
|
12806
|
+
render() {
|
|
12807
|
+
if (this.state.failed) return this.props.fallback ?? null;
|
|
12808
|
+
return this.props.children;
|
|
12809
|
+
}
|
|
12810
|
+
};
|
|
12811
|
+
|
|
12812
|
+
// src/json-renderer/stream/tolerantParse.ts
|
|
12813
|
+
function isPending(value) {
|
|
12814
|
+
return typeof value === "object" && value !== null && value.$pending === true;
|
|
12815
|
+
}
|
|
12816
|
+
var TRUNCATED_CONTAINERS = /* @__PURE__ */ new WeakSet();
|
|
12817
|
+
function finalize(value, counter) {
|
|
12818
|
+
if (Array.isArray(value)) {
|
|
12819
|
+
return value.map((item) => finalize(item, counter)).filter((item) => item !== void 0);
|
|
12820
|
+
}
|
|
12821
|
+
if (value && typeof value === "object") {
|
|
12822
|
+
if (isPending(value)) {
|
|
12823
|
+
counter.pending += 1;
|
|
12824
|
+
return void 0;
|
|
12825
|
+
}
|
|
12826
|
+
const out = { ...value };
|
|
12827
|
+
let hasPendingChild = false;
|
|
12828
|
+
for (const [key, nested] of Object.entries(out)) {
|
|
12829
|
+
const resolved = finalize(nested, counter);
|
|
12830
|
+
if (resolved === void 0 && isPending(nested)) {
|
|
12831
|
+
hasPendingChild = true;
|
|
12832
|
+
delete out[key];
|
|
12833
|
+
} else {
|
|
12834
|
+
out[key] = resolved;
|
|
12835
|
+
}
|
|
12836
|
+
}
|
|
12837
|
+
const truncated = TRUNCATED_CONTAINERS.has(value);
|
|
12838
|
+
if ((hasPendingChild || truncated) && "type" in out) {
|
|
12839
|
+
out.$status = "pending";
|
|
12840
|
+
}
|
|
12841
|
+
return out;
|
|
12842
|
+
}
|
|
12843
|
+
return value;
|
|
12844
|
+
}
|
|
12845
|
+
var WHITESPACE = /* @__PURE__ */ new Set([" ", " ", "\n", "\r"]);
|
|
12846
|
+
var TolerantParser = class {
|
|
12847
|
+
constructor(text) {
|
|
12848
|
+
__publicField(this, "text", text);
|
|
12849
|
+
__publicField(this, "index", 0);
|
|
12850
|
+
/** `true` cuando se detuvo porque el texto se acabó (y no por un error). */
|
|
12851
|
+
__publicField(this, "truncated", false);
|
|
12852
|
+
/** `true` cuando encontró algo que no puede interpretar. */
|
|
12853
|
+
__publicField(this, "broken", false);
|
|
12854
|
+
}
|
|
12855
|
+
/** Offset actual. */
|
|
12856
|
+
get offset() {
|
|
12857
|
+
return this.index;
|
|
12858
|
+
}
|
|
12859
|
+
/** `true` si el consumo se detuvo por falta de texto. */
|
|
12860
|
+
get isTruncated() {
|
|
12861
|
+
return this.truncated;
|
|
12862
|
+
}
|
|
12863
|
+
/** Salta el espacio en blanco. */
|
|
12864
|
+
skip() {
|
|
12865
|
+
while (this.index < this.text.length && WHITESPACE.has(this.text[this.index])) this.index += 1;
|
|
12866
|
+
}
|
|
12867
|
+
/** Carácter actual, o `undefined` si se acabó. */
|
|
12868
|
+
peek() {
|
|
12869
|
+
return this.text[this.index];
|
|
12870
|
+
}
|
|
12871
|
+
/** Intenta consumir un literal (`true`, `false`, `null`). */
|
|
12872
|
+
tryLiteral(literal) {
|
|
12873
|
+
if (!this.text.startsWith(literal, this.index)) return void 0;
|
|
12874
|
+
const end = this.index + literal.length;
|
|
12875
|
+
if (end > this.text.length) {
|
|
12876
|
+
this.index = this.text.length;
|
|
12877
|
+
this.truncated = true;
|
|
12878
|
+
return { $pending: true };
|
|
12879
|
+
}
|
|
12880
|
+
if (this.text.slice(this.index, end) !== literal) {
|
|
12881
|
+
const prefix = this.text.slice(this.index);
|
|
12882
|
+
if (literal.startsWith(prefix)) {
|
|
12883
|
+
this.index = this.text.length;
|
|
12884
|
+
this.truncated = true;
|
|
12885
|
+
return { $pending: true };
|
|
12886
|
+
}
|
|
12887
|
+
return void 0;
|
|
12888
|
+
}
|
|
12889
|
+
this.index = end;
|
|
12890
|
+
if (literal === "true") return true;
|
|
12891
|
+
if (literal === "false") return false;
|
|
12892
|
+
return null;
|
|
12893
|
+
}
|
|
12894
|
+
/** Lee una cadena. Marca pendiente si no encuentra la comilla de cierre. */
|
|
12895
|
+
readString() {
|
|
12896
|
+
this.index += 1;
|
|
12897
|
+
let out = "";
|
|
12898
|
+
while (this.index < this.text.length) {
|
|
12899
|
+
const char = this.text[this.index];
|
|
12900
|
+
if (char === "\\") {
|
|
12901
|
+
const next = this.text[this.index + 1];
|
|
12902
|
+
if (next === void 0) {
|
|
12903
|
+
this.index = this.text.length;
|
|
12904
|
+
this.truncated = true;
|
|
12905
|
+
return { $pending: true };
|
|
12906
|
+
}
|
|
12907
|
+
out += unescapeChar(next);
|
|
12908
|
+
this.index += 2;
|
|
12909
|
+
continue;
|
|
12910
|
+
}
|
|
12911
|
+
if (char === '"') {
|
|
12912
|
+
this.index += 1;
|
|
12913
|
+
return out;
|
|
12914
|
+
}
|
|
12915
|
+
out += char;
|
|
12916
|
+
this.index += 1;
|
|
12917
|
+
}
|
|
12918
|
+
this.truncated = true;
|
|
12919
|
+
return { $pending: true };
|
|
12920
|
+
}
|
|
12921
|
+
/** Lee un número. Devuelve el texto crudo como número, o pendiente. */
|
|
12922
|
+
readNumber() {
|
|
12923
|
+
const start = this.index;
|
|
12924
|
+
if (this.peek() === "-") this.index += 1;
|
|
12925
|
+
while (this.index < this.text.length && /[0-9.eE+-]/.test(this.text[this.index])) this.index += 1;
|
|
12926
|
+
const raw = this.text.slice(start, this.index);
|
|
12927
|
+
if (raw === "" || raw === "-") {
|
|
12928
|
+
this.index = this.text.length;
|
|
12929
|
+
this.truncated = true;
|
|
12930
|
+
return { $pending: true };
|
|
12931
|
+
}
|
|
12932
|
+
const value = Number(raw);
|
|
12933
|
+
if (Number.isNaN(value)) {
|
|
12934
|
+
this.broken = true;
|
|
12935
|
+
return { $pending: true };
|
|
12936
|
+
}
|
|
12937
|
+
return value;
|
|
12938
|
+
}
|
|
12939
|
+
/** Marca un contenedor como truncado (se cerró por falta de texto). */
|
|
12940
|
+
markTruncated(container) {
|
|
12941
|
+
this.truncated = true;
|
|
12942
|
+
TRUNCATED_CONTAINERS.add(container);
|
|
12943
|
+
}
|
|
12944
|
+
/** Lee un array. */
|
|
12945
|
+
readArray() {
|
|
12946
|
+
this.index += 1;
|
|
12947
|
+
const items = [];
|
|
12948
|
+
this.skip();
|
|
12949
|
+
if (this.peek() === "]") {
|
|
12950
|
+
this.index += 1;
|
|
12951
|
+
return items;
|
|
12952
|
+
}
|
|
12953
|
+
for (; ; ) {
|
|
12954
|
+
this.skip();
|
|
12955
|
+
if (this.peek() === void 0) {
|
|
12956
|
+
if (items.length === 0) {
|
|
12957
|
+
this.truncated = true;
|
|
12958
|
+
return { $pending: true };
|
|
12959
|
+
}
|
|
12960
|
+
this.markTruncated(items);
|
|
12961
|
+
return items;
|
|
12962
|
+
}
|
|
12963
|
+
const value = this.readValue();
|
|
12964
|
+
if (isPending(value)) {
|
|
12965
|
+
if (items.length === 0) {
|
|
12966
|
+
this.truncated = true;
|
|
12967
|
+
return { $pending: true };
|
|
12968
|
+
}
|
|
12969
|
+
this.markTruncated(items);
|
|
12970
|
+
return items;
|
|
12971
|
+
}
|
|
12972
|
+
items.push(value);
|
|
12973
|
+
this.skip();
|
|
12974
|
+
const char = this.peek();
|
|
12975
|
+
if (char === ",") {
|
|
12976
|
+
this.index += 1;
|
|
12977
|
+
continue;
|
|
12978
|
+
}
|
|
12979
|
+
if (char === "]") {
|
|
12980
|
+
this.index += 1;
|
|
12981
|
+
return items;
|
|
12982
|
+
}
|
|
12983
|
+
if (char === void 0) {
|
|
12984
|
+
this.markTruncated(items);
|
|
12985
|
+
return items;
|
|
12986
|
+
}
|
|
12987
|
+
this.broken = true;
|
|
12988
|
+
return items;
|
|
12989
|
+
}
|
|
12990
|
+
}
|
|
12991
|
+
/** Lee un objeto. */
|
|
12992
|
+
readObject() {
|
|
12993
|
+
this.index += 1;
|
|
12994
|
+
const out = {};
|
|
12995
|
+
this.skip();
|
|
12996
|
+
if (this.peek() === "}") {
|
|
12997
|
+
this.index += 1;
|
|
12998
|
+
return out;
|
|
12999
|
+
}
|
|
13000
|
+
for (; ; ) {
|
|
13001
|
+
this.skip();
|
|
13002
|
+
const char = this.peek();
|
|
13003
|
+
if (char === void 0) {
|
|
13004
|
+
if (!Object.keys(out).length) {
|
|
13005
|
+
this.truncated = true;
|
|
13006
|
+
return { $pending: true };
|
|
13007
|
+
}
|
|
13008
|
+
this.markTruncated(out);
|
|
13009
|
+
return out;
|
|
13010
|
+
}
|
|
13011
|
+
if (char !== '"') {
|
|
13012
|
+
this.broken = true;
|
|
13013
|
+
if (!Object.keys(out).length) return { $pending: true };
|
|
13014
|
+
this.markTruncated(out);
|
|
13015
|
+
return out;
|
|
13016
|
+
}
|
|
13017
|
+
const key = this.readString();
|
|
13018
|
+
if (isPending(key)) {
|
|
13019
|
+
if (!Object.keys(out).length) {
|
|
13020
|
+
this.truncated = true;
|
|
13021
|
+
return { $pending: true };
|
|
13022
|
+
}
|
|
13023
|
+
this.markTruncated(out);
|
|
13024
|
+
return out;
|
|
13025
|
+
}
|
|
13026
|
+
this.skip();
|
|
13027
|
+
if (this.peek() !== ":") {
|
|
13028
|
+
this.broken = this.peek() !== void 0;
|
|
13029
|
+
if (!Object.keys(out).length) {
|
|
13030
|
+
this.truncated = true;
|
|
13031
|
+
return { $pending: true };
|
|
13032
|
+
}
|
|
13033
|
+
this.markTruncated(out);
|
|
13034
|
+
return out;
|
|
13035
|
+
}
|
|
13036
|
+
this.index += 1;
|
|
13037
|
+
this.skip();
|
|
13038
|
+
const value = this.readValue();
|
|
13039
|
+
if (isPending(value)) {
|
|
13040
|
+
if (!Object.keys(out).length) {
|
|
13041
|
+
this.truncated = true;
|
|
13042
|
+
return { $pending: true };
|
|
13043
|
+
}
|
|
13044
|
+
this.markTruncated(out);
|
|
13045
|
+
return out;
|
|
13046
|
+
}
|
|
13047
|
+
out[key] = value;
|
|
13048
|
+
this.skip();
|
|
13049
|
+
const separator = this.peek();
|
|
13050
|
+
if (separator === ",") {
|
|
13051
|
+
this.index += 1;
|
|
13052
|
+
continue;
|
|
13053
|
+
}
|
|
13054
|
+
if (separator === "}") {
|
|
13055
|
+
this.index += 1;
|
|
13056
|
+
return out;
|
|
13057
|
+
}
|
|
13058
|
+
if (separator === void 0) {
|
|
13059
|
+
this.markTruncated(out);
|
|
13060
|
+
return out;
|
|
13061
|
+
}
|
|
13062
|
+
this.broken = true;
|
|
13063
|
+
return out;
|
|
13064
|
+
}
|
|
13065
|
+
}
|
|
13066
|
+
/** Lee cualquier valor. */
|
|
13067
|
+
readValue() {
|
|
13068
|
+
this.skip();
|
|
13069
|
+
const char = this.peek();
|
|
13070
|
+
if (char === void 0) {
|
|
13071
|
+
this.truncated = true;
|
|
13072
|
+
return { $pending: true };
|
|
13073
|
+
}
|
|
13074
|
+
if (char === "{") return this.readObject();
|
|
13075
|
+
if (char === "[") return this.readArray();
|
|
13076
|
+
if (char === '"') {
|
|
13077
|
+
const value = this.readString();
|
|
13078
|
+
return isPending(value) ? { $pending: true } : value;
|
|
13079
|
+
}
|
|
13080
|
+
if (char === "t" || char === "f" || char === "n") {
|
|
13081
|
+
const literal = char === "t" ? this.tryLiteral("true") : char === "f" ? this.tryLiteral("false") : this.tryLiteral("null");
|
|
13082
|
+
return literal === void 0 ? { $pending: true } : literal;
|
|
13083
|
+
}
|
|
13084
|
+
if (char === "-" || /[0-9]/.test(char)) return this.readNumber();
|
|
13085
|
+
this.broken = true;
|
|
13086
|
+
this.index = this.text.length;
|
|
13087
|
+
return { $pending: true };
|
|
13088
|
+
}
|
|
13089
|
+
/** Parsea el documento completo (o hasta donde llegue). */
|
|
13090
|
+
parse() {
|
|
13091
|
+
this.skip();
|
|
13092
|
+
if (this.peek() === void 0) {
|
|
13093
|
+
return { value: void 0, truncated: true, broken: false };
|
|
13094
|
+
}
|
|
13095
|
+
const value = this.readValue();
|
|
13096
|
+
this.skip();
|
|
13097
|
+
const truncated = this.truncated || this.index < this.text.length;
|
|
13098
|
+
return { value, truncated, broken: this.broken };
|
|
13099
|
+
}
|
|
13100
|
+
};
|
|
13101
|
+
function unescapeChar(char) {
|
|
13102
|
+
switch (char) {
|
|
13103
|
+
case "n":
|
|
13104
|
+
return "\n";
|
|
13105
|
+
case "t":
|
|
13106
|
+
return " ";
|
|
13107
|
+
case "r":
|
|
13108
|
+
return "\r";
|
|
13109
|
+
case "b":
|
|
13110
|
+
return "\b";
|
|
13111
|
+
case "f":
|
|
13112
|
+
return "\f";
|
|
13113
|
+
default:
|
|
13114
|
+
return char;
|
|
13115
|
+
}
|
|
13116
|
+
}
|
|
13117
|
+
function parsePartialSchema(text) {
|
|
13118
|
+
const parser = new TolerantParser(text);
|
|
13119
|
+
const { value, truncated, broken } = parser.parse();
|
|
13120
|
+
if (value === void 0) {
|
|
13121
|
+
return { tree: null, status: "pending", offset: parser.offset, broken, pendingNodes: 0 };
|
|
13122
|
+
}
|
|
13123
|
+
const counter = { pending: 0 };
|
|
13124
|
+
const finalized = finalize(value, counter);
|
|
13125
|
+
if (finalized === void 0 || finalized === null) {
|
|
13126
|
+
return { tree: null, status: "pending", offset: parser.offset, broken, pendingNodes: counter.pending };
|
|
13127
|
+
}
|
|
13128
|
+
const tree = finalized;
|
|
13129
|
+
return {
|
|
13130
|
+
tree,
|
|
13131
|
+
status: truncated || counter.pending > 0 ? "pending" : "complete",
|
|
13132
|
+
offset: parser.offset,
|
|
13133
|
+
broken,
|
|
13134
|
+
pendingNodes: counter.pending
|
|
13135
|
+
};
|
|
13136
|
+
}
|
|
13137
|
+
function isNodePending(node) {
|
|
13138
|
+
return node?.$status === "pending";
|
|
13139
|
+
}
|
|
13140
|
+
|
|
13141
|
+
// src/json-renderer/kernel/renderNode.tsx
|
|
13142
|
+
var import_react52 = __toESM(require("react"), 1);
|
|
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
|
+
}
|
|
13184
|
+
|
|
13185
|
+
// src/json-renderer/catalog/resolve.ts
|
|
13186
|
+
function isSchemaReference(value) {
|
|
13187
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
13188
|
+
const keys = Object.keys(value);
|
|
13189
|
+
if (keys.length === 0) return false;
|
|
13190
|
+
return keys.some((key) => key === "i18n" || key.startsWith("$"));
|
|
13191
|
+
}
|
|
13192
|
+
function coerce(value, spec) {
|
|
13193
|
+
switch (spec.kind) {
|
|
13194
|
+
case "string":
|
|
13195
|
+
if (typeof value === "string") return value;
|
|
13196
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
13197
|
+
return void 0;
|
|
13198
|
+
case "number":
|
|
13199
|
+
case "integer": {
|
|
13200
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
13201
|
+
return spec.kind === "integer" ? Math.trunc(value) : value;
|
|
13202
|
+
}
|
|
13203
|
+
if (typeof value === "string" && value.trim() !== "" && Number.isFinite(Number(value))) {
|
|
13204
|
+
const parsed = Number(value);
|
|
13205
|
+
return spec.kind === "integer" ? Math.trunc(parsed) : parsed;
|
|
13206
|
+
}
|
|
13207
|
+
return void 0;
|
|
13208
|
+
}
|
|
13209
|
+
case "boolean":
|
|
13210
|
+
if (typeof value === "boolean") return value;
|
|
13211
|
+
if (value === "true") return true;
|
|
13212
|
+
if (value === "false") return false;
|
|
13213
|
+
return void 0;
|
|
13214
|
+
case "enum":
|
|
13215
|
+
if (typeof value !== "string") return void 0;
|
|
13216
|
+
return spec.values?.includes(value) ? value : void 0;
|
|
13217
|
+
case "array":
|
|
13218
|
+
return Array.isArray(value) ? value : void 0;
|
|
13219
|
+
case "object":
|
|
13220
|
+
return value && typeof value === "object" ? value : void 0;
|
|
13221
|
+
default:
|
|
13222
|
+
return value;
|
|
13223
|
+
}
|
|
13224
|
+
}
|
|
13225
|
+
function resolveNode(node, catalog, path) {
|
|
13226
|
+
const issues = [];
|
|
13227
|
+
const type = node.type;
|
|
13228
|
+
if (typeof type !== "string" || type === "") {
|
|
13229
|
+
issues.push(issue("JR021", "El nodo no declara `type`.", formatPath(path), { severity: "error" }));
|
|
13230
|
+
return { ok: false, issues };
|
|
13231
|
+
}
|
|
13232
|
+
if (isExcludedType(catalog, type)) {
|
|
13233
|
+
const reason = getExclusionReason(catalog, type);
|
|
13234
|
+
issues.push(
|
|
13235
|
+
issue("JR010", `El tipo \`${type}\` est\xE1 excluido del cat\xE1logo.`, formatPath(path), {
|
|
13236
|
+
severity: "error",
|
|
13237
|
+
hint: reason
|
|
13238
|
+
})
|
|
13239
|
+
);
|
|
13240
|
+
return { ok: false, issues };
|
|
13241
|
+
}
|
|
13242
|
+
const entry = catalog.entries[type];
|
|
13243
|
+
if (!entry) {
|
|
13244
|
+
const known = Object.keys(catalog.entries).slice(0, 8).join(", ");
|
|
13245
|
+
issues.push(
|
|
13246
|
+
issue("JR010", `El tipo \`${type}\` no est\xE1 en el cat\xE1logo.`, formatPath(path), {
|
|
13247
|
+
severity: "error",
|
|
13248
|
+
hint: `Tipos disponibles (primeros 8): ${known}\u2026`
|
|
13249
|
+
})
|
|
13250
|
+
);
|
|
13251
|
+
return { ok: false, issues };
|
|
13252
|
+
}
|
|
13253
|
+
const specs = entry.props ?? {};
|
|
13254
|
+
const props = {};
|
|
13255
|
+
const actions = {};
|
|
13256
|
+
const input = node.props ?? {};
|
|
13257
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
13258
|
+
if (spec.default !== void 0) props[name] = spec.default;
|
|
13259
|
+
}
|
|
13260
|
+
for (const [name, raw] of Object.entries(input)) {
|
|
13261
|
+
const forbiddenByEntry = entry.forbidden?.includes(name);
|
|
13262
|
+
const forbiddenGlobally = GLOBALLY_FORBIDDEN_PROPS.includes(name);
|
|
13263
|
+
if (forbiddenByEntry || forbiddenGlobally) {
|
|
13264
|
+
issues.push(
|
|
13265
|
+
issue("JR011", `La prop \`${name}\` est\xE1 prohibida en \`${type}\`.`, formatPath(propPath(path, name)), {
|
|
13266
|
+
severity: "warning",
|
|
13267
|
+
hint: "Los nodos React se declaran como hijos del esquema, no como props."
|
|
13268
|
+
})
|
|
13269
|
+
);
|
|
13270
|
+
continue;
|
|
13271
|
+
}
|
|
13272
|
+
const spec = specs[name];
|
|
13273
|
+
if (!spec) {
|
|
13274
|
+
issues.push(
|
|
13275
|
+
issue("JR011", `La prop \`${name}\` no est\xE1 declarada para \`${type}\`.`, formatPath(propPath(path, name)), {
|
|
13276
|
+
severity: "warning",
|
|
13277
|
+
hint: "Se ignora. Si es necesaria, a\xF1\xE1dela al cat\xE1logo con su tipo."
|
|
13278
|
+
})
|
|
13279
|
+
);
|
|
13280
|
+
continue;
|
|
13281
|
+
}
|
|
13282
|
+
if (spec.kind === "action") {
|
|
13283
|
+
actions[name] = raw;
|
|
13284
|
+
continue;
|
|
13285
|
+
}
|
|
13286
|
+
if (isSchemaReference(raw)) {
|
|
13287
|
+
props[name] = raw;
|
|
13288
|
+
continue;
|
|
13289
|
+
}
|
|
13290
|
+
const value = coerce(raw, spec);
|
|
13291
|
+
if (value === void 0) {
|
|
13292
|
+
issues.push(
|
|
13293
|
+
issue(
|
|
13294
|
+
"JR011",
|
|
13295
|
+
`Valor inv\xE1lido para \`${name}\` en \`${type}\`.`,
|
|
13296
|
+
formatPath(propPath(path, name)),
|
|
13297
|
+
{ severity: "warning", hint: spec.values ? `Admitidos: ${spec.values.join(", ")}` : `Se esperaba ${spec.kind}.` }
|
|
13298
|
+
)
|
|
13299
|
+
);
|
|
13300
|
+
continue;
|
|
13301
|
+
}
|
|
13302
|
+
props[name] = value;
|
|
13303
|
+
}
|
|
13304
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
13305
|
+
if (spec.required && props[name] === void 0) {
|
|
13306
|
+
issues.push(
|
|
13307
|
+
issue("JR011", `Falta la prop obligatoria \`${name}\` en \`${type}\`.`, formatPath(propPath(path, name)), {
|
|
13308
|
+
severity: "error"
|
|
13309
|
+
})
|
|
13310
|
+
);
|
|
13311
|
+
}
|
|
13312
|
+
}
|
|
13313
|
+
if (node.children !== void 0 && !entry.children) {
|
|
13314
|
+
issues.push(
|
|
13315
|
+
issue("JR011", `\`${type}\` no acepta \`children\`.`, formatPath([...path, "children"]), {
|
|
13316
|
+
severity: "warning",
|
|
13317
|
+
hint: "Los hijos se ignoran."
|
|
13318
|
+
})
|
|
13319
|
+
);
|
|
13320
|
+
}
|
|
13321
|
+
return { ok: true, entry, props, actions, issues };
|
|
13322
|
+
}
|
|
13323
|
+
|
|
13324
|
+
// src/json-renderer/kernel/renderNode.tsx
|
|
13325
|
+
function childList(node) {
|
|
13326
|
+
if (!node || node.children === void 0 || node.children === null) return [];
|
|
13327
|
+
return Array.isArray(node.children) ? node.children : [node.children];
|
|
13328
|
+
}
|
|
13329
|
+
function renderNode(node, options) {
|
|
13330
|
+
const { catalog, path, issues, renderChildren } = options;
|
|
13331
|
+
if (!node || typeof node !== "object") {
|
|
13332
|
+
return null;
|
|
13333
|
+
}
|
|
13334
|
+
if (isNodePending(node)) {
|
|
13335
|
+
return options.pendingFallback ?? null;
|
|
13336
|
+
}
|
|
13337
|
+
const resolved = resolveNode(node, catalog, path);
|
|
13338
|
+
issues.push(...resolved.issues);
|
|
13339
|
+
if (!resolved.ok) {
|
|
13340
|
+
return null;
|
|
13341
|
+
}
|
|
13342
|
+
const { entry, props, actions } = resolved;
|
|
13343
|
+
const finalProps = {};
|
|
13344
|
+
for (const [name, value] of Object.entries(props)) {
|
|
13345
|
+
finalProps[name] = options.resolveValue ? options.resolveValue(value, path) : value;
|
|
13346
|
+
}
|
|
13347
|
+
for (const [name, action] of Object.entries(actions)) {
|
|
13348
|
+
const handler = options.resolveAction?.(node, name, action, path);
|
|
13349
|
+
if (typeof handler === "function") finalProps[name] = handler;
|
|
13350
|
+
}
|
|
13351
|
+
const content = renderChildren ? renderChildren(node, path) : null;
|
|
13352
|
+
const rawText = entry.text && node.text !== void 0 ? node.text : void 0;
|
|
13353
|
+
const text = rawText === void 0 ? void 0 : options.resolveValue ? options.resolveValue(rawText, path) : rawText;
|
|
13354
|
+
const children = content ?? text;
|
|
13355
|
+
const element = import_react52.default.createElement(
|
|
13356
|
+
entry.component,
|
|
13357
|
+
{ ...finalProps, key: node.id ?? path.join("-"), id: node.id },
|
|
13358
|
+
children
|
|
13359
|
+
);
|
|
13360
|
+
return options.wrap ? options.wrap(node, path, element) : element;
|
|
13361
|
+
}
|
|
13362
|
+
|
|
13363
|
+
// src/json-renderer/kernel/partial.ts
|
|
13364
|
+
function auditTree(schema, limits) {
|
|
13365
|
+
const tracker = createLimitTracker(limits);
|
|
13366
|
+
const issues = [];
|
|
13367
|
+
let pending = 0;
|
|
13368
|
+
let depth = 0;
|
|
13369
|
+
const walk = (node, path, level) => {
|
|
13370
|
+
if (!node || typeof node !== "object") return;
|
|
13371
|
+
if (!tracker.visit(level)) return;
|
|
13372
|
+
if (level > depth) depth = level;
|
|
13373
|
+
if (isNodePending(node)) pending += 1;
|
|
13374
|
+
const children = childList(node);
|
|
13375
|
+
children.forEach((child, index) => {
|
|
13376
|
+
walk(child, `${path}[${index}]`, level + 1);
|
|
13377
|
+
});
|
|
13378
|
+
if (node.fallback) walk(node.fallback, `${path}.fallback`, level + 1);
|
|
13379
|
+
};
|
|
13380
|
+
const content = Array.isArray(schema.content) ? schema.content : [schema.content];
|
|
13381
|
+
content.forEach((node, index) => walk(node, `content[${index}]`, 0));
|
|
13382
|
+
if (tracker.exceeded) {
|
|
13383
|
+
issues.push(
|
|
13384
|
+
issue(
|
|
13385
|
+
"JR013",
|
|
13386
|
+
`El esquema supera el presupuesto (${tracker.nodes} nodos, profundidad ${tracker.deepest}).`,
|
|
13387
|
+
"content",
|
|
13388
|
+
{
|
|
13389
|
+
severity: "warning",
|
|
13390
|
+
hint: `M\xE1ximo configurado: ${limits.maxNodes} nodos y profundidad ${limits.maxDepth}. La parte que sobra no se pinta.`
|
|
13391
|
+
}
|
|
13392
|
+
)
|
|
13393
|
+
);
|
|
13394
|
+
}
|
|
13395
|
+
return { nodes: tracker.nodes, depth: tracker.deepest, pending, exceeded: tracker.exceeded, issues };
|
|
13396
|
+
}
|
|
13397
|
+
function countPendingNodes(schema) {
|
|
13398
|
+
if (!schema) return 0;
|
|
13399
|
+
let total = 0;
|
|
13400
|
+
const walk = (node) => {
|
|
13401
|
+
if (!node || typeof node !== "object") return;
|
|
13402
|
+
if (isNodePending(node)) total += 1;
|
|
13403
|
+
for (const child of childList(node)) walk(child);
|
|
13404
|
+
};
|
|
13405
|
+
const content = Array.isArray(schema.content) ? schema.content : [schema.content];
|
|
13406
|
+
for (const node of content) walk(node);
|
|
13407
|
+
return total;
|
|
13408
|
+
}
|
|
13409
|
+
|
|
13410
|
+
// src/json-renderer/kernel/SchemaRenderer.tsx
|
|
13411
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13412
|
+
function renderTree(node, path, context, level) {
|
|
13413
|
+
if (!node || typeof node !== "object") return null;
|
|
13414
|
+
if (level > context.limits.maxDepth) return null;
|
|
13415
|
+
const issues = context.issues;
|
|
13416
|
+
if (node.id) context.nodeIds.add(node.id);
|
|
13417
|
+
const reportIssue = (issue2) => {
|
|
13418
|
+
issues.push(issue2);
|
|
13419
|
+
context.onIssue?.(issue2);
|
|
13420
|
+
};
|
|
13421
|
+
const issuesBefore = issues.length;
|
|
13422
|
+
const element = renderNode(node, {
|
|
13423
|
+
catalog: context.catalog,
|
|
13424
|
+
path,
|
|
13425
|
+
issues,
|
|
13426
|
+
resolveValue: context.resolveValue,
|
|
13427
|
+
resolveAction: context.resolveAction,
|
|
13428
|
+
pendingFallback: context.pendingFallback,
|
|
13429
|
+
renderChildren: (current, currentPath) => {
|
|
13430
|
+
const children = childList(current);
|
|
13431
|
+
if (children.length === 0) return void 0;
|
|
13432
|
+
return children.map(
|
|
13433
|
+
(child, index) => renderTree(child, [...currentPath, "children", index], context, level + 1)
|
|
13434
|
+
);
|
|
13435
|
+
}
|
|
13436
|
+
});
|
|
13437
|
+
for (let index = issuesBefore; index < issues.length; index += 1) {
|
|
13438
|
+
context.onIssue?.(issues[index]);
|
|
13439
|
+
}
|
|
13440
|
+
const fallback = node.fallback ? renderTree(node.fallback, [...path, "fallback"], context, level + 1) : context.pendingFallback ?? null;
|
|
13441
|
+
const wrapped = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13442
|
+
NodeBoundary,
|
|
13443
|
+
{
|
|
13444
|
+
path: path.join("."),
|
|
13445
|
+
fallback,
|
|
13446
|
+
onError: (error, errorPath) => reportIssue({
|
|
13447
|
+
code: "JR012",
|
|
13448
|
+
severity: "error",
|
|
13449
|
+
message: error.message,
|
|
13450
|
+
path: errorPath,
|
|
13451
|
+
hint: "El nodo se ha aislado; el resto de la pantalla sigue pint\xE1ndose."
|
|
13452
|
+
}),
|
|
13453
|
+
children: element
|
|
13454
|
+
},
|
|
13455
|
+
String(path.join("-"))
|
|
13456
|
+
);
|
|
13457
|
+
return wrapped;
|
|
13458
|
+
}
|
|
13459
|
+
function ITSchemaRenderer({
|
|
13460
|
+
schema,
|
|
13461
|
+
catalog = axzyCatalog,
|
|
13462
|
+
limits,
|
|
13463
|
+
resolveValue,
|
|
13464
|
+
resolveAction,
|
|
13465
|
+
pendingFallback,
|
|
13466
|
+
onIssue,
|
|
13467
|
+
className
|
|
13468
|
+
}) {
|
|
13469
|
+
const resolvedLimits = (0, import_react53.useMemo)(() => resolveLimits(limits), [limits]);
|
|
13470
|
+
const issues = [];
|
|
13471
|
+
const nodeIds = /* @__PURE__ */ new Set();
|
|
13472
|
+
const audit = (0, import_react53.useMemo)(
|
|
13473
|
+
() => schema ? auditTree(schema, resolvedLimits) : null,
|
|
13474
|
+
[schema, resolvedLimits]
|
|
13475
|
+
);
|
|
13476
|
+
const context = (0, import_react53.useMemo)(
|
|
13477
|
+
() => ({
|
|
13478
|
+
catalog,
|
|
13479
|
+
nodeIds,
|
|
13480
|
+
limits: resolvedLimits,
|
|
13481
|
+
issues,
|
|
13482
|
+
onIssue,
|
|
13483
|
+
resolveValue,
|
|
13484
|
+
resolveAction,
|
|
13485
|
+
pendingFallback
|
|
13486
|
+
}),
|
|
13487
|
+
// `issues` es un array nuevo en cada render a propósito: acumular avisos
|
|
13488
|
+
// entre renders duplicaría los avisos de esquemas que no han cambiado.
|
|
13489
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13490
|
+
[catalog, resolvedLimits, onIssue, resolveValue, resolveAction, pendingFallback]
|
|
13491
|
+
);
|
|
13492
|
+
const content = schema ? (Array.isArray(schema.content) ? schema.content : [schema.content]).filter(
|
|
13493
|
+
(node) => Boolean(node) && typeof node === "object"
|
|
13494
|
+
) : [];
|
|
13495
|
+
const children = content.slice(0, resolvedLimits.maxNodes).map((node, index) => renderTree(node, ["content", index], context, 0)).filter(Boolean);
|
|
13496
|
+
const collected = [...audit?.issues ?? [], ...issues];
|
|
13497
|
+
const signature = collected.map((issue2) => `${issue2.code}:${issue2.path}`).join("|");
|
|
13498
|
+
const reported = (0, import_react53.useRef)("");
|
|
13499
|
+
(0, import_react53.useEffect)(() => {
|
|
13500
|
+
const all = [...collected];
|
|
13501
|
+
for (const id of nodeIds) {
|
|
13502
|
+
if (!document.getElementById(id)) {
|
|
13503
|
+
all.push({
|
|
13504
|
+
code: "JR014",
|
|
13505
|
+
severity: "warning",
|
|
13506
|
+
message: `El \`id\` "${id}" no lleg\xF3 al DOM.`,
|
|
13507
|
+
path: id,
|
|
13508
|
+
hint: "El componente no reenv\xEDa props al elemento. Pon el id en un nodo que s\xED lo haga (por ejemplo ITText) o en un contenedor del host."
|
|
13509
|
+
});
|
|
13510
|
+
}
|
|
13511
|
+
}
|
|
13512
|
+
const firma = all.map((issue2) => `${issue2.code}:${issue2.path}`).join("|");
|
|
13513
|
+
if (!onIssue || reported.current === firma) return;
|
|
13514
|
+
reported.current = firma;
|
|
13515
|
+
for (const issue2 of all) onIssue(issue2);
|
|
13516
|
+
}, [signature, onIssue]);
|
|
13517
|
+
if (!schema || children.length === 0) return null;
|
|
13518
|
+
return className ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className, children }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_jsx_runtime75.Fragment, { children });
|
|
13519
|
+
}
|
|
13520
|
+
|
|
13521
|
+
// src/json-renderer/validation/validate.ts
|
|
13522
|
+
var CURRENT_SCHEMA_VERSION = 1;
|
|
13523
|
+
function validateNodes(node, path, catalog, errors, warnings) {
|
|
13524
|
+
if (!node || typeof node !== "object") {
|
|
13525
|
+
errors.push(issue("JR021", "El nodo no es un objeto.", formatPath(path), { severity: "error" }));
|
|
13526
|
+
return 0;
|
|
13527
|
+
}
|
|
13528
|
+
if (isNodePending(node)) return 1;
|
|
13529
|
+
const resolved = resolveNode(node, catalog, path);
|
|
13530
|
+
for (const item of resolved.issues) {
|
|
13531
|
+
(item.severity === "error" ? errors : warnings).push(item);
|
|
13532
|
+
}
|
|
13533
|
+
let pending = 0;
|
|
13534
|
+
const children = node.children === void 0 ? [] : Array.isArray(node.children) ? node.children : [node.children];
|
|
13535
|
+
children.forEach((child, index) => {
|
|
13536
|
+
pending += validateNodes(child, [...path, "children", index], catalog, errors, warnings);
|
|
13537
|
+
});
|
|
13538
|
+
return pending;
|
|
13539
|
+
}
|
|
13540
|
+
function validateSchema(schema, options = {}) {
|
|
13541
|
+
const catalog = options.catalog ?? axzyCatalog;
|
|
13542
|
+
const maxVersion = options.maxVersion ?? CURRENT_SCHEMA_VERSION;
|
|
13543
|
+
const errors = [];
|
|
13544
|
+
const warnings = [];
|
|
13545
|
+
if (schema === null || schema === void 0) {
|
|
13546
|
+
return { verdict: "invalid", errors: [issue("JR020", "No hay esquema que validar.", "")], warnings, pendingNodes: 0 };
|
|
13547
|
+
}
|
|
13548
|
+
if (typeof schema !== "object" || Array.isArray(schema)) {
|
|
13549
|
+
return {
|
|
13550
|
+
verdict: "invalid",
|
|
13551
|
+
errors: [issue("JR020", "El esquema debe ser un objeto.", "", { severity: "error" })],
|
|
13552
|
+
warnings,
|
|
13553
|
+
pendingNodes: 0
|
|
13554
|
+
};
|
|
13555
|
+
}
|
|
13556
|
+
const candidate = schema;
|
|
13557
|
+
if (candidate.$schema !== void 0 && candidate.$schema !== "axzy/screen") {
|
|
13558
|
+
errors.push(
|
|
13559
|
+
issue("JR020", `El formato declarado no es \`axzy/screen\`.`, "$schema", {
|
|
13560
|
+
severity: "error",
|
|
13561
|
+
hint: 'Usa `$schema: "axzy/screen"` o quita la propiedad.'
|
|
13562
|
+
})
|
|
13563
|
+
);
|
|
13564
|
+
}
|
|
13565
|
+
if (candidate.version === void 0) {
|
|
13566
|
+
errors.push(issue("JR020", "Falta `version` en el esquema.", "version", { severity: "error" }));
|
|
13567
|
+
} else if (typeof candidate.version !== "number" || !Number.isInteger(candidate.version)) {
|
|
13568
|
+
errors.push(issue("JR020", "`version` debe ser un entero.", "version", { severity: "error" }));
|
|
13569
|
+
} else if (candidate.version > maxVersion) {
|
|
13570
|
+
errors.push(
|
|
13571
|
+
issue("JR020", `La versi\xF3n ${candidate.version} es m\xE1s nueva que la soportada (${maxVersion}).`, "version", {
|
|
13572
|
+
severity: "error",
|
|
13573
|
+
hint: "Actualiza el motor o migra el esquema."
|
|
13574
|
+
})
|
|
13575
|
+
);
|
|
13576
|
+
}
|
|
13577
|
+
if (typeof candidate.id !== "string" || candidate.id.trim() === "") {
|
|
13578
|
+
errors.push(issue("JR020", "Falta `id` en el esquema.", "id", { severity: "error" }));
|
|
13579
|
+
}
|
|
13580
|
+
if (candidate.content === void 0) {
|
|
13581
|
+
errors.push(issue("JR020", "El esquema no declara `content`.", "content", { severity: "error" }));
|
|
13582
|
+
return { verdict: "invalid", errors, warnings, pendingNodes: 0, version: candidate.version };
|
|
13583
|
+
}
|
|
13584
|
+
const content = Array.isArray(candidate.content) ? candidate.content : [candidate.content];
|
|
13585
|
+
if (content.length === 0) {
|
|
13586
|
+
warnings.push(
|
|
13587
|
+
issue("JR021", "`content` est\xE1 vac\xEDo: la pantalla se pinta sin nodos.", "content", { severity: "warning" })
|
|
13588
|
+
);
|
|
13589
|
+
}
|
|
13590
|
+
let pendingNodes = 0;
|
|
13591
|
+
content.map((node, index) => ({ node, index })).filter(({ node }) => node !== void 0 && node !== null).forEach(({ node, index }) => {
|
|
13592
|
+
pendingNodes += validateNodes(node, ["content", index], catalog, errors, warnings);
|
|
13593
|
+
});
|
|
13594
|
+
const verdict = errors.length > 0 ? "invalid" : pendingNodes > 0 ? "partial" : "valid";
|
|
13595
|
+
return { verdict, errors, warnings, pendingNodes, version: candidate.version };
|
|
13596
|
+
}
|
|
13597
|
+
|
|
13598
|
+
// src/json-renderer/validation/migrate.ts
|
|
13599
|
+
var DEFAULT_MIGRATIONS = {};
|
|
13600
|
+
function migrateSchema(schema, targetVersion, migrations = DEFAULT_MIGRATIONS) {
|
|
13601
|
+
const from = typeof schema.version === "number" ? schema.version : 0;
|
|
13602
|
+
const issues = [];
|
|
13603
|
+
if (from === targetVersion) {
|
|
13604
|
+
return { schema, migrated: false, from, to: targetVersion, issues };
|
|
13605
|
+
}
|
|
13606
|
+
if (from > targetVersion) {
|
|
13607
|
+
issues.push(
|
|
13608
|
+
issue("JR020", `El esquema es de una versi\xF3n posterior (${from}) a la del motor (${targetVersion}).`, "version", {
|
|
13609
|
+
severity: "error",
|
|
13610
|
+
hint: "Actualiza el motor; no se puede degradar un esquema."
|
|
13611
|
+
})
|
|
13612
|
+
);
|
|
13613
|
+
return { schema, migrated: false, from, to: targetVersion, issues };
|
|
13614
|
+
}
|
|
13615
|
+
let current = schema;
|
|
13616
|
+
let version = from;
|
|
13617
|
+
while (version < targetVersion) {
|
|
13618
|
+
const migration = migrations[version];
|
|
13619
|
+
if (!migration) {
|
|
13620
|
+
issues.push(
|
|
13621
|
+
issue("JR070", `No hay migraci\xF3n registrada de la versi\xF3n ${version} a la ${version + 1}.`, "version", {
|
|
13622
|
+
severity: "error",
|
|
13623
|
+
hint: "Registra la migraci\xF3n en `migrations` o guarda el esquema en la versi\xF3n actual."
|
|
13624
|
+
})
|
|
13625
|
+
);
|
|
13626
|
+
return { schema: current, migrated: false, from, to: version, issues };
|
|
13627
|
+
}
|
|
13628
|
+
current = { ...migration(current), version: version + 1 };
|
|
13629
|
+
version += 1;
|
|
13630
|
+
}
|
|
13631
|
+
return { schema: current, migrated: version !== from, from, to: version, issues };
|
|
13632
|
+
}
|
|
13633
|
+
|
|
13634
|
+
// src/json-renderer/vocabulary/buildContract.ts
|
|
13635
|
+
var RULES = [
|
|
13636
|
+
'Emite SOLO JSON v\xE1lido con la forma: { $schema: "axzy/screen", version, id, content }.',
|
|
13637
|
+
"`content` es un nodo o un array de nodos; cada nodo necesita `type` del cat\xE1logo.",
|
|
13638
|
+
"Usa solo props declaradas para ese `type`; el resto se ignora y se avisa.",
|
|
13639
|
+
"Los hijos se expresan con `children` (nodos) y los textos con `text`, nunca con props de nodo React.",
|
|
13640
|
+
'Las acciones se declaran por nombre: `"onClick": { "action": "nombre.registrado" }`. No hay c\xF3digo en el JSON.',
|
|
13641
|
+
"Prohibido: HTML crudo, URLs, fetch, expresiones JS y props como icon/actions/render.",
|
|
13642
|
+
'Los textos visibles deben ser claves de i18n: { "i18n": "namespace.clave" }.'
|
|
13643
|
+
];
|
|
13644
|
+
function buildMinimal(entry) {
|
|
13645
|
+
const props = {};
|
|
13646
|
+
for (const [name, spec] of Object.entries(entry.props ?? {})) {
|
|
13647
|
+
if (!spec.required) continue;
|
|
13648
|
+
props[name] = sampleValue(name, spec);
|
|
13649
|
+
}
|
|
13650
|
+
const node = { type: entry.type };
|
|
13651
|
+
if (Object.keys(props).length > 0) node.props = props;
|
|
13652
|
+
if (entry.text) node.text = "Texto";
|
|
13653
|
+
return node;
|
|
13654
|
+
}
|
|
13655
|
+
function sampleValue(name, spec) {
|
|
13656
|
+
if (spec.values?.length) return spec.values[0];
|
|
13657
|
+
if (spec.kind === "number" || spec.kind === "integer") return 1;
|
|
13658
|
+
if (spec.kind === "boolean") return false;
|
|
13659
|
+
if (spec.kind === "i18n") return { i18n: `ejemplo.${name}` };
|
|
13660
|
+
return name === "src" ? "/imagen.png" : `${name}`;
|
|
13661
|
+
}
|
|
13662
|
+
function buildVocabularyContract(catalog = axzyCatalog, schemaVersion = CURRENT_SCHEMA_VERSION) {
|
|
13663
|
+
const components2 = Object.values(catalog.entries).map((entry) => ({
|
|
13664
|
+
type: entry.type,
|
|
13665
|
+
summary: entry.summary,
|
|
13666
|
+
children: Boolean(entry.children),
|
|
13667
|
+
text: Boolean(entry.text),
|
|
13668
|
+
props: Object.entries(entry.props ?? {}).map(([name, spec]) => ({
|
|
13669
|
+
name,
|
|
13670
|
+
kind: spec.kind,
|
|
13671
|
+
required: Boolean(spec.required),
|
|
13672
|
+
values: spec.values ? [...spec.values] : void 0,
|
|
13673
|
+
default: spec.default,
|
|
13674
|
+
doc: spec.doc
|
|
13675
|
+
})),
|
|
13676
|
+
forbidden: [...entry.forbidden ?? []],
|
|
13677
|
+
minimal: buildMinimal(entry)
|
|
13678
|
+
})).sort((a, b) => a.type.localeCompare(b.type));
|
|
13679
|
+
return {
|
|
13680
|
+
$schema: "axzy/vocabulary",
|
|
13681
|
+
schemaVersion,
|
|
13682
|
+
rules: RULES,
|
|
13683
|
+
components: components2,
|
|
13684
|
+
excluded: catalog.excluded ?? {}
|
|
13685
|
+
};
|
|
13686
|
+
}
|
|
13687
|
+
function formatVocabularyForPrompt(contract) {
|
|
13688
|
+
const lines = [
|
|
13689
|
+
`# Contrato de vocabulario AXZY (formato v${contract.schemaVersion})`,
|
|
13690
|
+
"",
|
|
13691
|
+
"Reglas:",
|
|
13692
|
+
...contract.rules.map((rule) => `- ${rule}`),
|
|
13693
|
+
"",
|
|
13694
|
+
"Componentes:"
|
|
13695
|
+
];
|
|
13696
|
+
for (const component of contract.components) {
|
|
13697
|
+
const props = component.props.map((prop) => {
|
|
13698
|
+
const parts = [`${prop.name}:${prop.kind}${prop.required ? "*" : ""}`];
|
|
13699
|
+
if (prop.values?.length) parts.push(`(${prop.values.join("|")})`);
|
|
13700
|
+
return parts.join(" ");
|
|
13701
|
+
}).join(", ");
|
|
13702
|
+
lines.push(`- ${component.type}${component.summary ? ` \u2014 ${component.summary}` : ""}`);
|
|
13703
|
+
if (props) lines.push(` props: ${props}`);
|
|
13704
|
+
if (component.children) lines.push(" children: s\xED");
|
|
13705
|
+
if (component.text) lines.push(" text: s\xED");
|
|
13706
|
+
lines.push(` m\xEDnimo: ${JSON.stringify(component.minimal)}`);
|
|
13707
|
+
}
|
|
13708
|
+
return lines.join("\n");
|
|
13709
|
+
}
|
|
13710
|
+
|
|
13711
|
+
// src/components/organisms/dropfile/dropfile.tsx
|
|
13712
|
+
var import_react54 = require("react");
|
|
13713
|
+
var import_react_dropzone = require("react-dropzone");
|
|
13714
|
+
var import_clsx54 = __toESM(require("clsx"), 1);
|
|
13715
|
+
|
|
13716
|
+
// src/components/organisms/dropfile/dropfile.props.ts
|
|
13717
|
+
var FileTypeEnum = /* @__PURE__ */ ((FileTypeEnum2) => {
|
|
13718
|
+
FileTypeEnum2["PDF"] = "application/pdf";
|
|
13719
|
+
FileTypeEnum2["XLS"] = "application/vnd.ms-excel";
|
|
13720
|
+
FileTypeEnum2["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
13721
|
+
FileTypeEnum2["CSV"] = "text/csv";
|
|
13722
|
+
FileTypeEnum2["PNG"] = "image/png";
|
|
13723
|
+
FileTypeEnum2["JPG"] = "image/jpg";
|
|
13724
|
+
FileTypeEnum2["JPEG"] = "image/jpeg";
|
|
13725
|
+
FileTypeEnum2["MP4"] = "video/mp4";
|
|
13726
|
+
FileTypeEnum2["MOV"] = "video/quicktime";
|
|
13727
|
+
FileTypeEnum2["AVI"] = "video/x-msvideo";
|
|
13728
|
+
FileTypeEnum2["MKV"] = "video/x-matroska";
|
|
13729
|
+
FileTypeEnum2["VIDEO_3GPP"] = "video/3gpp";
|
|
13730
|
+
FileTypeEnum2["WEBM"] = "video/webm";
|
|
13731
|
+
return FileTypeEnum2;
|
|
13732
|
+
})(FileTypeEnum || {});
|
|
13733
|
+
var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
13734
|
+
UploadStatus2["PENDING"] = "pendiente";
|
|
13735
|
+
UploadStatus2["UPLOADING"] = "subiendo";
|
|
13736
|
+
UploadStatus2["UPLOADED"] = "subido";
|
|
13737
|
+
UploadStatus2["ERROR"] = "error";
|
|
13738
|
+
return UploadStatus2;
|
|
13739
|
+
})(UploadStatus || {});
|
|
13740
|
+
|
|
13741
|
+
// src/components/organisms/dropfile/dropfile.tsx
|
|
13742
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13743
|
+
var ITDropfile = ({
|
|
13744
|
+
onFileSelect,
|
|
13745
|
+
onCancel,
|
|
13746
|
+
onSubmit,
|
|
13747
|
+
contentClassName,
|
|
13748
|
+
containerClassName,
|
|
13749
|
+
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 */],
|
|
13750
|
+
showStatusBadge = true,
|
|
13751
|
+
uploadStatus: externalStatus,
|
|
13752
|
+
onStatusChange,
|
|
13753
|
+
initialPreviewUrl,
|
|
13754
|
+
view = "drop",
|
|
13755
|
+
buttonLabel,
|
|
13756
|
+
modalTitle
|
|
13757
|
+
}) => {
|
|
13758
|
+
const { t } = useITTranslation();
|
|
13759
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react54.useState)(false);
|
|
13760
|
+
const [selectedFile, setSelectedFile] = (0, import_react54.useState)(null);
|
|
13761
|
+
const [fileType, setFileType] = (0, import_react54.useState)(null);
|
|
13762
|
+
const [imagePreview, setImagePreview] = (0, import_react54.useState)(initialPreviewUrl || null);
|
|
13763
|
+
const [isConfirmed, setIsConfirmed] = (0, import_react54.useState)(false);
|
|
13764
|
+
const [internalUploadStatus, setInternalUploadStatus] = (0, import_react54.useState)(
|
|
13765
|
+
initialPreviewUrl ? "subido" /* UPLOADED */ : "pendiente" /* PENDING */
|
|
13766
|
+
);
|
|
13767
|
+
(0, import_react54.useEffect)(() => {
|
|
13768
|
+
if (initialPreviewUrl && !selectedFile) {
|
|
13769
|
+
setImagePreview(initialPreviewUrl);
|
|
13770
|
+
if (externalStatus === void 0) setInternalUploadStatus("subido" /* UPLOADED */);
|
|
13771
|
+
}
|
|
13772
|
+
}, [initialPreviewUrl, selectedFile, externalStatus]);
|
|
13773
|
+
const uploadStatus = externalStatus || internalUploadStatus;
|
|
13774
|
+
const setUploadStatus = (status) => {
|
|
13775
|
+
if (externalStatus === void 0) {
|
|
13776
|
+
setInternalUploadStatus(status);
|
|
13777
|
+
}
|
|
13778
|
+
onStatusChange?.(status);
|
|
13779
|
+
};
|
|
13780
|
+
const getAcceptedFileTypes = () => {
|
|
13781
|
+
const accept = {};
|
|
13782
|
+
acceptedFileTypes.forEach((type) => {
|
|
13783
|
+
switch (type) {
|
|
13784
|
+
case "application/pdf" /* PDF */:
|
|
13785
|
+
accept["application/pdf" /* PDF */] = [".pdf"];
|
|
13786
|
+
break;
|
|
13787
|
+
case "application/vnd.ms-excel" /* XLS */:
|
|
13788
|
+
accept["application/vnd.ms-excel" /* XLS */] = [".xls"];
|
|
13789
|
+
break;
|
|
13790
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */:
|
|
13791
|
+
accept["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */] = [".xlsx"];
|
|
13792
|
+
break;
|
|
13793
|
+
case "text/csv" /* CSV */:
|
|
13794
|
+
accept["text/csv" /* CSV */] = [".csv"];
|
|
13795
|
+
break;
|
|
13796
|
+
case "image/png" /* PNG */:
|
|
13797
|
+
accept["image/png" /* PNG */] = [".png"];
|
|
13798
|
+
break;
|
|
13799
|
+
case "image/jpg" /* JPG */:
|
|
13800
|
+
accept["image/jpg" /* JPG */] = [".jpg", ".jpeg"];
|
|
13801
|
+
break;
|
|
13802
|
+
case "image/jpeg" /* JPEG */:
|
|
13803
|
+
accept["image/jpeg" /* JPEG */] = [".jpeg", ".jpg"];
|
|
13804
|
+
break;
|
|
13805
|
+
case "video/mp4" /* MP4 */:
|
|
13806
|
+
accept["video/mp4" /* MP4 */] = [".mp4"];
|
|
13807
|
+
break;
|
|
13808
|
+
case "video/quicktime" /* MOV */:
|
|
13809
|
+
accept["video/quicktime" /* MOV */] = [".mov"];
|
|
13810
|
+
break;
|
|
13811
|
+
case "video/x-msvideo" /* AVI */:
|
|
13812
|
+
accept["video/x-msvideo" /* AVI */] = [".avi"];
|
|
13813
|
+
break;
|
|
13814
|
+
case "video/x-matroska" /* MKV */:
|
|
13815
|
+
accept["video/x-matroska" /* MKV */] = [".mkv"];
|
|
13816
|
+
break;
|
|
13817
|
+
case "video/3gpp" /* VIDEO_3GPP */:
|
|
13818
|
+
accept["video/3gpp" /* VIDEO_3GPP */] = [".3gp"];
|
|
13819
|
+
break;
|
|
13820
|
+
case "video/webm" /* WEBM */:
|
|
13821
|
+
accept["video/webm" /* WEBM */] = [".webm"];
|
|
13822
|
+
break;
|
|
13823
|
+
}
|
|
13824
|
+
});
|
|
13825
|
+
return accept;
|
|
13826
|
+
};
|
|
13827
|
+
const getFileExtensions = () => {
|
|
13828
|
+
const extensions = [];
|
|
13829
|
+
acceptedFileTypes.forEach((type) => {
|
|
13830
|
+
switch (type) {
|
|
13831
|
+
case "application/pdf" /* PDF */:
|
|
13832
|
+
if (!extensions.includes("PDF")) extensions.push("PDF");
|
|
13833
|
+
break;
|
|
13834
|
+
case "application/vnd.ms-excel" /* XLS */:
|
|
13835
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* XLSX */:
|
|
13836
|
+
if (!extensions.includes("EXCEL")) extensions.push("EXCEL");
|
|
13837
|
+
break;
|
|
13838
|
+
case "text/csv" /* CSV */:
|
|
13839
|
+
if (!extensions.includes("CSV")) extensions.push("CSV");
|
|
13840
|
+
break;
|
|
13841
|
+
case "image/png" /* PNG */:
|
|
13842
|
+
case "image/jpg" /* JPG */:
|
|
13843
|
+
case "image/jpeg" /* JPEG */:
|
|
13844
|
+
if (!extensions.includes("IMAGEN")) extensions.push("IMAGEN");
|
|
13845
|
+
break;
|
|
13846
|
+
case "video/mp4" /* MP4 */:
|
|
13847
|
+
case "video/quicktime" /* MOV */:
|
|
13848
|
+
case "video/x-msvideo" /* AVI */:
|
|
13849
|
+
case "video/x-matroska" /* MKV */:
|
|
13850
|
+
case "video/3gpp" /* VIDEO_3GPP */:
|
|
13851
|
+
case "video/webm" /* WEBM */:
|
|
13852
|
+
if (!extensions.includes("VIDEO")) extensions.push("VIDEO");
|
|
13853
|
+
break;
|
|
13854
|
+
}
|
|
13855
|
+
});
|
|
13856
|
+
return extensions.join(", ");
|
|
13857
|
+
};
|
|
13858
|
+
const StatusBadge = ({ status }) => {
|
|
13859
|
+
const config2 = {
|
|
13860
|
+
["pendiente" /* PENDING */]: {
|
|
13861
|
+
label: t("dropfile.status.pending"),
|
|
13862
|
+
color: "bg-warning-100 text-warning-800 border-warning-200",
|
|
13863
|
+
dotColor: "bg-warning-400"
|
|
13864
|
+
},
|
|
13865
|
+
["subiendo" /* UPLOADING */]: {
|
|
13866
|
+
label: t("dropfile.status.uploading"),
|
|
13867
|
+
color: "bg-primary-100 text-primary-800 border-primary-200",
|
|
13868
|
+
dotColor: "bg-primary-400 animate-pulse"
|
|
13869
|
+
},
|
|
13870
|
+
["subido" /* UPLOADED */]: {
|
|
13871
|
+
label: t("dropfile.status.uploaded"),
|
|
13872
|
+
color: "bg-success-100 text-success-800 border-success-200",
|
|
13873
|
+
dotColor: "bg-success-400"
|
|
13874
|
+
},
|
|
13875
|
+
["error" /* ERROR */]: {
|
|
13876
|
+
label: t("dropfile.status.error"),
|
|
13877
|
+
color: "bg-danger-100 text-danger-800 border-danger-200",
|
|
13878
|
+
dotColor: "bg-danger-400"
|
|
13879
|
+
}
|
|
13880
|
+
};
|
|
13881
|
+
const { label, color, dotColor } = config2[status];
|
|
13882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: `inline-flex items-center gap-2 px-2.5 py-1 rounded-full border ${color}`, children: [
|
|
13883
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: `w-2 h-2 rounded-full ${dotColor}` }),
|
|
13884
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { as: "span", className: "text-xs font-medium flex items-center gap-1.5", children: label })
|
|
13885
|
+
] });
|
|
13886
|
+
};
|
|
13887
|
+
const onDrop = (acceptedFiles) => {
|
|
13888
|
+
const file = acceptedFiles[0];
|
|
13889
|
+
if (file) {
|
|
13890
|
+
if (acceptedFileTypes.includes(file.type)) {
|
|
13891
|
+
setSelectedFile(file);
|
|
13892
|
+
setFileType(file.type);
|
|
13893
|
+
setUploadStatus("pendiente" /* PENDING */);
|
|
13894
|
+
if (imagePreview) {
|
|
13895
|
+
URL.revokeObjectURL(imagePreview);
|
|
13896
|
+
setImagePreview(null);
|
|
13897
|
+
}
|
|
13898
|
+
if (file.type.startsWith("image/")) {
|
|
13899
|
+
const previewUrl = URL.createObjectURL(file);
|
|
13900
|
+
setImagePreview(previewUrl);
|
|
13901
|
+
}
|
|
13902
|
+
} else {
|
|
13903
|
+
alert(t("dropfile.fileTypeNotAllowed"));
|
|
13904
|
+
setSelectedFile(null);
|
|
13905
|
+
setFileType(null);
|
|
13906
|
+
setImagePreview(null);
|
|
13907
|
+
setUploadStatus("pendiente" /* PENDING */);
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13910
|
+
};
|
|
13911
|
+
const { getRootProps, getInputProps, isDragActive } = (0, import_react_dropzone.useDropzone)({
|
|
13912
|
+
onDrop,
|
|
12414
13913
|
accept: getAcceptedFileTypes(),
|
|
12415
13914
|
maxFiles: 1
|
|
12416
13915
|
});
|
|
12417
|
-
(0,
|
|
13916
|
+
(0, import_react54.useEffect)(() => {
|
|
12418
13917
|
const renderPDF = async () => {
|
|
12419
13918
|
};
|
|
12420
13919
|
renderPDF();
|
|
12421
13920
|
}, [selectedFile, fileType]);
|
|
12422
|
-
(0,
|
|
13921
|
+
(0, import_react54.useEffect)(() => {
|
|
12423
13922
|
return () => {
|
|
12424
13923
|
if (imagePreview) {
|
|
12425
13924
|
URL.revokeObjectURL(imagePreview);
|
|
@@ -12456,7 +13955,7 @@ var ITDropfile = ({
|
|
|
12456
13955
|
const handleDelete = () => {
|
|
12457
13956
|
handleCancel();
|
|
12458
13957
|
};
|
|
12459
|
-
(0,
|
|
13958
|
+
(0, import_react54.useEffect)(() => {
|
|
12460
13959
|
if (view === "button" && isConfirmed && uploadStatus === "subido" /* UPLOADED */) {
|
|
12461
13960
|
const timeout = setTimeout(() => {
|
|
12462
13961
|
setIsModalOpen(false);
|
|
@@ -12473,21 +13972,21 @@ var ITDropfile = ({
|
|
|
12473
13972
|
return () => clearTimeout(timeout);
|
|
12474
13973
|
}
|
|
12475
13974
|
}, [view, isConfirmed, uploadStatus, externalStatus, onStatusChange]);
|
|
12476
|
-
const headerRow = /* @__PURE__ */ (0,
|
|
12477
|
-
/* @__PURE__ */ (0,
|
|
12478
|
-
/* @__PURE__ */ (0,
|
|
13975
|
+
const headerRow = /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
|
|
13976
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("label", { className: "block text-sm font-semibold text-secondary-700", children: [
|
|
13977
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(ITText, { as: "span", children: [
|
|
12479
13978
|
t("dropfile.upload"),
|
|
12480
13979
|
" "
|
|
12481
13980
|
] }),
|
|
12482
|
-
/* @__PURE__ */ (0,
|
|
13981
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(ITText, { as: "span", className: "text-secondary-400 font-normal text-xs", children: [
|
|
12483
13982
|
"(",
|
|
12484
13983
|
getFileExtensions(),
|
|
12485
13984
|
")"
|
|
12486
13985
|
] })
|
|
12487
13986
|
] }),
|
|
12488
|
-
showStatusBadge && selectedFile && /* @__PURE__ */ (0,
|
|
13987
|
+
showStatusBadge && selectedFile && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(StatusBadge, { status: uploadStatus })
|
|
12489
13988
|
] });
|
|
12490
|
-
const dropZoneOrPreview = /* @__PURE__ */ (0,
|
|
13989
|
+
const dropZoneOrPreview = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: !selectedFile && !imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
12491
13990
|
"div",
|
|
12492
13991
|
{
|
|
12493
13992
|
...getRootProps(),
|
|
@@ -12497,41 +13996,41 @@ var ITDropfile = ({
|
|
|
12497
13996
|
${isDragActive ? "border-primary-500 bg-primary-50 scale-[1.01]" : "border-secondary-300 bg-white hover:border-primary-400 hover:bg-secondary-50"}
|
|
12498
13997
|
`,
|
|
12499
13998
|
children: [
|
|
12500
|
-
/* @__PURE__ */ (0,
|
|
12501
|
-
/* @__PURE__ */ (0,
|
|
13999
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("input", { ...getInputProps() }),
|
|
14000
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.jsx)(
|
|
12502
14001
|
"svg",
|
|
12503
14002
|
{
|
|
12504
14003
|
className: `w-6 h-6 transition-colors duration-300 ${isDragActive ? "text-primary-600" : "text-secondary-400 group-hover:text-primary-500"}`,
|
|
12505
14004
|
fill: "none",
|
|
12506
14005
|
viewBox: "0 0 24 24",
|
|
12507
14006
|
stroke: "currentColor",
|
|
12508
|
-
children: /* @__PURE__ */ (0,
|
|
14007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.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" })
|
|
12509
14008
|
}
|
|
12510
14009
|
) }),
|
|
12511
|
-
/* @__PURE__ */ (0,
|
|
14010
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-center space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime76.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") }) })
|
|
12512
14011
|
]
|
|
12513
14012
|
}
|
|
12514
|
-
) : /* @__PURE__ */ (0,
|
|
12515
|
-
/* @__PURE__ */ (0,
|
|
12516
|
-
/* @__PURE__ */ (0,
|
|
12517
|
-
/* @__PURE__ */ (0,
|
|
12518
|
-
/* @__PURE__ */ (0,
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
14013
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "w-full bg-white border border-secondary-200 rounded-xl shadow-sm overflow-hidden animate-fade-in", children: [
|
|
14014
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex items-center justify-between p-3 bg-secondary-50 border-b border-secondary-100", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
14015
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime76.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" }) }) }),
|
|
14016
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "min-w-0", children: [
|
|
14017
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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") }),
|
|
14018
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { as: "p", className: "text-[10px] text-secondary-500", children: selectedFile ? (selectedFile.size / 1024 / 1024).toFixed(2) + " MB" : "" })
|
|
12520
14019
|
] })
|
|
12521
14020
|
] }) }),
|
|
12522
|
-
/* @__PURE__ */ (0,
|
|
14021
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.jsx)(
|
|
12523
14022
|
"img",
|
|
12524
14023
|
{
|
|
12525
14024
|
src: imagePreview,
|
|
12526
14025
|
alt: t("dropfile.previewAlt"),
|
|
12527
14026
|
className: "w-full h-full object-contain max-h-[200px]"
|
|
12528
14027
|
}
|
|
12529
|
-
) : /* @__PURE__ */ (0,
|
|
12530
|
-
/* @__PURE__ */ (0,
|
|
12531
|
-
/* @__PURE__ */ (0,
|
|
14028
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "py-8 flex flex-col items-center text-secondary-400", children: [
|
|
14029
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.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" }) }),
|
|
14030
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { as: "span", className: "text-xs", children: t("dropfile.noPreview") })
|
|
12532
14031
|
] }) }),
|
|
12533
|
-
/* @__PURE__ */ (0,
|
|
12534
|
-
/* @__PURE__ */ (0,
|
|
14032
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.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_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
14033
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12535
14034
|
ITButton,
|
|
12536
14035
|
{
|
|
12537
14036
|
type: "button",
|
|
@@ -12539,10 +14038,10 @@ var ITDropfile = ({
|
|
|
12539
14038
|
color: "secondary",
|
|
12540
14039
|
size: "sm",
|
|
12541
14040
|
onClick: handleCancel,
|
|
12542
|
-
children: /* @__PURE__ */ (0,
|
|
14041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { children: t("common.cancel") })
|
|
12543
14042
|
}
|
|
12544
14043
|
),
|
|
12545
|
-
/* @__PURE__ */ (0,
|
|
14044
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12546
14045
|
ITButton,
|
|
12547
14046
|
{
|
|
12548
14047
|
type: "button",
|
|
@@ -12550,13 +14049,13 @@ var ITDropfile = ({
|
|
|
12550
14049
|
color: "primary",
|
|
12551
14050
|
size: "sm",
|
|
12552
14051
|
onClick: handleConfirm,
|
|
12553
|
-
children: /* @__PURE__ */ (0,
|
|
12554
|
-
/* @__PURE__ */ (0,
|
|
12555
|
-
/* @__PURE__ */ (0,
|
|
14052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14053
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { children: t("common.confirm") }),
|
|
14054
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("svg", { className: "w-3 h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
12556
14055
|
] })
|
|
12557
14056
|
}
|
|
12558
14057
|
)
|
|
12559
|
-
] }) : /* @__PURE__ */ (0,
|
|
14058
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
12560
14059
|
ITButton,
|
|
12561
14060
|
{
|
|
12562
14061
|
type: "button",
|
|
@@ -12565,12 +14064,12 @@ var ITDropfile = ({
|
|
|
12565
14064
|
size: "sm",
|
|
12566
14065
|
onClick: handleDelete,
|
|
12567
14066
|
children: [
|
|
12568
|
-
/* @__PURE__ */ (0,
|
|
12569
|
-
/* @__PURE__ */ (0,
|
|
14067
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("svg", { className: "w-3 h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime76.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" }) }),
|
|
14068
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { children: t("common.delete") })
|
|
12570
14069
|
]
|
|
12571
14070
|
}
|
|
12572
14071
|
) }),
|
|
12573
|
-
uploadStatus === "subiendo" /* UPLOADING */ && /* @__PURE__ */ (0,
|
|
14072
|
+
uploadStatus === "subiendo" /* UPLOADING */ && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "px-4 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full bg-secondary-200 rounded-full h-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12574
14073
|
"div",
|
|
12575
14074
|
{
|
|
12576
14075
|
className: "bg-primary-600 h-1.5 rounded-full transition-all duration-1000 ease-out",
|
|
@@ -12583,8 +14082,8 @@ var ITDropfile = ({
|
|
|
12583
14082
|
] }) });
|
|
12584
14083
|
if (view === "button") {
|
|
12585
14084
|
const hasFile = Boolean(selectedFile || imagePreview);
|
|
12586
|
-
return /* @__PURE__ */ (0,
|
|
12587
|
-
/* @__PURE__ */ (0,
|
|
14085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: (0, import_clsx54.default)("inline-block", containerClassName), children: [
|
|
14086
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12588
14087
|
ITButton,
|
|
12589
14088
|
{
|
|
12590
14089
|
type: "button",
|
|
@@ -12592,20 +14091,20 @@ var ITDropfile = ({
|
|
|
12592
14091
|
color: hasFile ? "primary" : "secondary",
|
|
12593
14092
|
size: "sm",
|
|
12594
14093
|
onClick: () => setIsModalOpen(true),
|
|
12595
|
-
children: /* @__PURE__ */ (0,
|
|
12596
|
-
/* @__PURE__ */ (0,
|
|
12597
|
-
/* @__PURE__ */ (0,
|
|
12598
|
-
showStatusBadge && hasFile && /* @__PURE__ */ (0,
|
|
14094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-2 max-w-[220px]", children: [
|
|
14095
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime76.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" }) }),
|
|
14096
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITText, { className: "truncate", children: selectedFile?.name || (hasFile ? t("dropfile.fileLoaded") : buttonLabel ?? t("dropfile.upload")) }),
|
|
14097
|
+
showStatusBadge && hasFile && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(StatusBadge, { status: uploadStatus })
|
|
12599
14098
|
] })
|
|
12600
14099
|
}
|
|
12601
14100
|
),
|
|
12602
|
-
/* @__PURE__ */ (0,
|
|
14101
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ITDialog, { isOpen: isModalOpen, onClose: () => setIsModalOpen(false), title: modalTitle ?? buttonLabel ?? t("dropfile.upload"), children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "w-full transition-all duration-300", children: [
|
|
12603
14102
|
headerRow,
|
|
12604
14103
|
dropZoneOrPreview
|
|
12605
14104
|
] }) })
|
|
12606
14105
|
] });
|
|
12607
14106
|
}
|
|
12608
|
-
return /* @__PURE__ */ (0,
|
|
14107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: (0, import_clsx54.default)("w-full transition-all duration-300", containerClassName), children: [
|
|
12609
14108
|
headerRow,
|
|
12610
14109
|
dropZoneOrPreview
|
|
12611
14110
|
] });
|
|
@@ -12613,13 +14112,13 @@ var ITDropfile = ({
|
|
|
12613
14112
|
var dropfile_default = ITDropfile;
|
|
12614
14113
|
|
|
12615
14114
|
// src/components/templates/layout/layout.tsx
|
|
12616
|
-
var
|
|
14115
|
+
var import_react56 = require("react");
|
|
12617
14116
|
var import_clsx55 = __toESM(require("clsx"), 1);
|
|
12618
14117
|
|
|
12619
14118
|
// src/components/organisms/topbar/topbar.tsx
|
|
12620
14119
|
var import_fa32 = require("react-icons/fa");
|
|
12621
|
-
var
|
|
12622
|
-
var
|
|
14120
|
+
var import_react55 = require("react");
|
|
14121
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12623
14122
|
function ITTopBar({
|
|
12624
14123
|
logo,
|
|
12625
14124
|
logoText,
|
|
@@ -12636,10 +14135,10 @@ function ITTopBar({
|
|
|
12636
14135
|
const flat = useITFlatAppearance();
|
|
12637
14136
|
const { t } = useITTranslation();
|
|
12638
14137
|
const initials = (userMenu?.userName ?? "").trim().split(/\s+/).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
|
|
12639
|
-
const [isUserMenuOpen, setIsUserMenuOpen] = (0,
|
|
12640
|
-
const userMenuRef = (0,
|
|
14138
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = (0, import_react55.useState)(false);
|
|
14139
|
+
const userMenuRef = (0, import_react55.useRef)(null);
|
|
12641
14140
|
useClickOutside_default(userMenuRef, () => setIsUserMenuOpen(false));
|
|
12642
|
-
return /* @__PURE__ */ (0,
|
|
14141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12643
14142
|
"header",
|
|
12644
14143
|
{
|
|
12645
14144
|
className: `sticky top-0 z-40 transition-all duration-300 ${flat ? "" : "backdrop-blur-md"}`,
|
|
@@ -12648,9 +14147,9 @@ function ITTopBar({
|
|
|
12648
14147
|
borderBottom: "1px solid var(--it-topbar-border, rgba(15, 23, 42, 0.06))",
|
|
12649
14148
|
boxShadow: flat ? "none" : "var(--shadow-xs)"
|
|
12650
14149
|
},
|
|
12651
|
-
children: /* @__PURE__ */ (0,
|
|
12652
|
-
/* @__PURE__ */ (0,
|
|
12653
|
-
showMobileMenuButton && /* @__PURE__ */ (0,
|
|
14150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: `flex items-center justify-between px-6 lg:px-8 ${flat ? "h-[64px]" : "h-[72px]"}`, children: [
|
|
14151
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
14152
|
+
showMobileMenuButton && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12654
14153
|
"button",
|
|
12655
14154
|
{
|
|
12656
14155
|
type: "button",
|
|
@@ -12662,12 +14161,12 @@ function ITTopBar({
|
|
|
12662
14161
|
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "var(--it-topbar-user-hover, #f1f5f9)",
|
|
12663
14162
|
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "transparent",
|
|
12664
14163
|
onClick: onToggleMobileMenu,
|
|
12665
|
-
children: /* @__PURE__ */ (0,
|
|
14164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_fa32.FaBars, { className: "w-[1.125rem] h-[1.125rem]" })
|
|
12666
14165
|
}
|
|
12667
14166
|
),
|
|
12668
|
-
/* @__PURE__ */ (0,
|
|
12669
|
-
logo && /* @__PURE__ */ (0,
|
|
12670
|
-
logoText && /* @__PURE__ */ (0,
|
|
14167
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: `items-center gap-3 ${hideBrandOnDesktop ? "flex lg:hidden" : "flex"}`, children: [
|
|
14168
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex-shrink-0 drop-shadow-sm", children: logo }),
|
|
14169
|
+
logoText && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12671
14170
|
ITText,
|
|
12672
14171
|
{
|
|
12673
14172
|
as: "span",
|
|
@@ -12677,7 +14176,7 @@ function ITTopBar({
|
|
|
12677
14176
|
}
|
|
12678
14177
|
)
|
|
12679
14178
|
] }),
|
|
12680
|
-
navItems && navItems.length > 0 && /* @__PURE__ */ (0,
|
|
14179
|
+
navItems && navItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime77.jsx)(
|
|
12681
14180
|
"button",
|
|
12682
14181
|
{
|
|
12683
14182
|
onClick: () => onNavItemClick?.(item.id),
|
|
@@ -12691,19 +14190,19 @@ function ITTopBar({
|
|
|
12691
14190
|
e.currentTarget.style.color = "var(--it-topbar-text, #475569)";
|
|
12692
14191
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
12693
14192
|
},
|
|
12694
|
-
children: /* @__PURE__ */ (0,
|
|
12695
|
-
item.icon && /* @__PURE__ */ (0,
|
|
12696
|
-
/* @__PURE__ */ (0,
|
|
14193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14194
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "opacity-70", children: item.icon }),
|
|
14195
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", children: item.label })
|
|
12697
14196
|
] })
|
|
12698
14197
|
},
|
|
12699
14198
|
item.id
|
|
12700
14199
|
)) })
|
|
12701
14200
|
] }),
|
|
12702
|
-
centerContent && /* @__PURE__ */ (0,
|
|
12703
|
-
(children || userMenu) && /* @__PURE__ */ (0,
|
|
14201
|
+
centerContent && /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime77.jsx)("div", { className: "w-full max-w-[420px]", children: centerContent }) }),
|
|
14202
|
+
(children || userMenu) && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12704
14203
|
children,
|
|
12705
|
-
userMenu && /* @__PURE__ */ (0,
|
|
12706
|
-
/* @__PURE__ */ (0,
|
|
14204
|
+
userMenu && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "relative", children: [
|
|
14205
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
12707
14206
|
"button",
|
|
12708
14207
|
{
|
|
12709
14208
|
type: "button",
|
|
@@ -12719,15 +14218,15 @@ function ITTopBar({
|
|
|
12719
14218
|
},
|
|
12720
14219
|
onClick: () => setIsUserMenuOpen(!isUserMenuOpen),
|
|
12721
14220
|
children: [
|
|
12722
|
-
/* @__PURE__ */ (0,
|
|
12723
|
-
userMenu.userImage ? /* @__PURE__ */ (0,
|
|
14221
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "relative", children: [
|
|
14222
|
+
userMenu.userImage ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12724
14223
|
"img",
|
|
12725
14224
|
{
|
|
12726
14225
|
className: "w-9 h-9 rounded-full object-cover ring-2 ring-white shadow-sm",
|
|
12727
14226
|
src: userMenu.userImage,
|
|
12728
14227
|
alt: t("common.userAvatar")
|
|
12729
14228
|
}
|
|
12730
|
-
) : flat && initials ? /* @__PURE__ */ (0,
|
|
14229
|
+
) : flat && initials ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12731
14230
|
"div",
|
|
12732
14231
|
{
|
|
12733
14232
|
"aria-hidden": "true",
|
|
@@ -12738,11 +14237,11 @@ function ITTopBar({
|
|
|
12738
14237
|
},
|
|
12739
14238
|
children: initials
|
|
12740
14239
|
}
|
|
12741
|
-
) : /* @__PURE__ */ (0,
|
|
12742
|
-
!flat && /* @__PURE__ */ (0,
|
|
14240
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime77.jsx)(import_fa32.FaUserCircle, { className: "w-6 h-6", style: { color: "var(--it-topbar-icon, #94a3b8)" } }) }),
|
|
14241
|
+
!flat && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "absolute bottom-0 right-0 w-2.5 h-2.5 bg-green-500 border-2 border-white rounded-full" })
|
|
12743
14242
|
] }),
|
|
12744
|
-
/* @__PURE__ */ (0,
|
|
12745
|
-
/* @__PURE__ */ (0,
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: `hidden sm:flex flex-col py-0.5 ${flat ? "text-right" : "text-left"}`, children: [
|
|
14244
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12746
14245
|
ITText,
|
|
12747
14246
|
{
|
|
12748
14247
|
as: "span",
|
|
@@ -12751,7 +14250,7 @@ function ITTopBar({
|
|
|
12751
14250
|
children: userMenu.userName
|
|
12752
14251
|
}
|
|
12753
14252
|
),
|
|
12754
|
-
/* @__PURE__ */ (0,
|
|
14253
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12755
14254
|
ITText,
|
|
12756
14255
|
{
|
|
12757
14256
|
as: "span",
|
|
@@ -12764,7 +14263,7 @@ function ITTopBar({
|
|
|
12764
14263
|
]
|
|
12765
14264
|
}
|
|
12766
14265
|
),
|
|
12767
|
-
/* @__PURE__ */ (0,
|
|
14266
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
12768
14267
|
"div",
|
|
12769
14268
|
{
|
|
12770
14269
|
ref: userMenuRef,
|
|
@@ -12777,15 +14276,15 @@ function ITTopBar({
|
|
|
12777
14276
|
border: "1px solid var(--it-topbar-user-dropdown-border, #f1f5f9)"
|
|
12778
14277
|
},
|
|
12779
14278
|
children: [
|
|
12780
|
-
/* @__PURE__ */ (0,
|
|
12781
|
-
/* @__PURE__ */ (0,
|
|
12782
|
-
/* @__PURE__ */ (0,
|
|
14279
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.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: [
|
|
14280
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "block font-bold text-[0.9rem]", style: { color: "var(--it-topbar-user-text, #0f172a)" }, children: userMenu.userName }),
|
|
14281
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.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 })
|
|
12783
14282
|
] }),
|
|
12784
|
-
/* @__PURE__ */ (0,
|
|
14283
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("ul", { className: "py-2", children: userMenu.menuItems.map((m, i) => {
|
|
12785
14284
|
const isDestructive = m.label.toLowerCase().includes("salir") || m.label.toLowerCase().includes("cerrar") || m.label.toLowerCase().includes("logout");
|
|
12786
|
-
return /* @__PURE__ */ (0,
|
|
12787
|
-
i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && /* @__PURE__ */ (0,
|
|
12788
|
-
/* @__PURE__ */ (0,
|
|
14285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("li", { className: "px-2", children: [
|
|
14286
|
+
i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "h-px bg-slate-100 my-1 mx-2" }),
|
|
14287
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12789
14288
|
"button",
|
|
12790
14289
|
{
|
|
12791
14290
|
onClick: () => {
|
|
@@ -12800,7 +14299,7 @@ function ITTopBar({
|
|
|
12800
14299
|
onMouseLeave: (e) => {
|
|
12801
14300
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
12802
14301
|
},
|
|
12803
|
-
children: /* @__PURE__ */ (0,
|
|
14302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", children: m.label })
|
|
12804
14303
|
}
|
|
12805
14304
|
)
|
|
12806
14305
|
] }, i);
|
|
@@ -12816,7 +14315,7 @@ function ITTopBar({
|
|
|
12816
14315
|
}
|
|
12817
14316
|
|
|
12818
14317
|
// src/components/templates/layout/layout.tsx
|
|
12819
|
-
var
|
|
14318
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
12820
14319
|
function ITLayout({
|
|
12821
14320
|
topBar,
|
|
12822
14321
|
sidebar,
|
|
@@ -12825,8 +14324,8 @@ function ITLayout({
|
|
|
12825
14324
|
contentClassName = "",
|
|
12826
14325
|
sidebarFullHeight = false
|
|
12827
14326
|
}) {
|
|
12828
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
12829
|
-
const [mobileSidebarOpen, setMobileSidebarOpen] = (0,
|
|
14327
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react56.useState)(true);
|
|
14328
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react56.useState)(false);
|
|
12830
14329
|
const flat = useITFlatAppearance();
|
|
12831
14330
|
const isControlled = sidebar.isCollapsed !== void 0;
|
|
12832
14331
|
const desktopCollapsed = isControlled ? sidebar.isCollapsed : internalCollapsed;
|
|
@@ -12840,7 +14339,7 @@ function ITLayout({
|
|
|
12840
14339
|
else setMobileSidebarOpen((v) => !v);
|
|
12841
14340
|
};
|
|
12842
14341
|
const brand = sidebarFullHeight ? sidebar.brand ?? { logo: topBar.logo, text: topBar.logoText } : sidebar.brand;
|
|
12843
|
-
const topBarNode = /* @__PURE__ */ (0,
|
|
14342
|
+
const topBarNode = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12844
14343
|
ITTopBar,
|
|
12845
14344
|
{
|
|
12846
14345
|
...topBar,
|
|
@@ -12853,9 +14352,9 @@ function ITLayout({
|
|
|
12853
14352
|
const desktopSidebar = (
|
|
12854
14353
|
// Full-height: the sidebar sits beside the top bar, so it needs to win the
|
|
12855
14354
|
// stacking order when the collapsed rail expands over the content on hover.
|
|
12856
|
-
/* @__PURE__ */ (0,
|
|
12857
|
-
/* @__PURE__ */ (0,
|
|
12858
|
-
/* @__PURE__ */ (0,
|
|
14355
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `hidden lg:block relative h-full ${sidebarFullHeight ? "z-50" : "z-40"}`, children: [
|
|
14356
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: `${reservedWidth} h-full flex-shrink-0` }),
|
|
14357
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "absolute top-0 left-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12859
14358
|
ITSidebar,
|
|
12860
14359
|
{
|
|
12861
14360
|
...sidebar,
|
|
@@ -12868,17 +14367,17 @@ function ITLayout({
|
|
|
12868
14367
|
) })
|
|
12869
14368
|
] })
|
|
12870
14369
|
);
|
|
12871
|
-
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0,
|
|
14370
|
+
const mobileSidebar = mobileSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12872
14371
|
"div",
|
|
12873
14372
|
{
|
|
12874
14373
|
className: "lg:hidden fixed inset-0 z-[40] transition-opacity duration-300 backdrop-blur-sm bg-black/40",
|
|
12875
14374
|
onClick: () => setMobileSidebarOpen(false),
|
|
12876
|
-
children: /* @__PURE__ */ (0,
|
|
14375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12877
14376
|
"div",
|
|
12878
14377
|
{
|
|
12879
14378
|
className: "h-full w-fit flex transform transition-transform duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
12880
14379
|
onClick: (e) => e.stopPropagation(),
|
|
12881
|
-
children: /* @__PURE__ */ (0,
|
|
14380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12882
14381
|
ITSidebar,
|
|
12883
14382
|
{
|
|
12884
14383
|
...sidebar,
|
|
@@ -12895,16 +14394,16 @@ function ITLayout({
|
|
|
12895
14394
|
)
|
|
12896
14395
|
}
|
|
12897
14396
|
);
|
|
12898
|
-
const main = /* @__PURE__ */ (0,
|
|
14397
|
+
const main = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("main", { className: "flex-1 overflow-y-auto w-full custom-scrollbar relative z-0", children: /* @__PURE__ */ (0, import_jsx_runtime78.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 }) });
|
|
12899
14398
|
if (sidebarFullHeight) {
|
|
12900
|
-
return /* @__PURE__ */ (0,
|
|
14399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
12901
14400
|
"div",
|
|
12902
14401
|
{
|
|
12903
14402
|
className: `flex h-screen overflow-hidden w-full relative ${className}`,
|
|
12904
14403
|
style: { backgroundColor: layoutTokens.backgroundColor },
|
|
12905
14404
|
children: [
|
|
12906
14405
|
desktopSidebar,
|
|
12907
|
-
/* @__PURE__ */ (0,
|
|
14406
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 overflow-hidden", children: [
|
|
12908
14407
|
topBarNode,
|
|
12909
14408
|
main
|
|
12910
14409
|
] }),
|
|
@@ -12913,9 +14412,9 @@ function ITLayout({
|
|
|
12913
14412
|
}
|
|
12914
14413
|
);
|
|
12915
14414
|
}
|
|
12916
|
-
return /* @__PURE__ */ (0,
|
|
14415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `flex flex-col h-screen overflow-hidden w-full ${className}`, children: [
|
|
12917
14416
|
topBarNode,
|
|
12918
|
-
/* @__PURE__ */ (0,
|
|
14417
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
12919
14418
|
"div",
|
|
12920
14419
|
{
|
|
12921
14420
|
className: "flex flex-1 overflow-hidden relative",
|
|
@@ -12930,97 +14429,11 @@ function ITLayout({
|
|
|
12930
14429
|
] });
|
|
12931
14430
|
}
|
|
12932
14431
|
|
|
12933
|
-
// src/types/loader.types.ts
|
|
12934
|
-
var sizeClasses = {
|
|
12935
|
-
sm: "h-4 w-4",
|
|
12936
|
-
md: "h-8 w-8",
|
|
12937
|
-
lg: "h-12 w-12",
|
|
12938
|
-
xl: "h-16 w-16"
|
|
12939
|
-
};
|
|
12940
|
-
|
|
12941
|
-
// src/components/atoms/loader/loader.tsx
|
|
12942
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12943
|
-
function ITLoader({
|
|
12944
|
-
size = "md",
|
|
12945
|
-
variant = "spinner",
|
|
12946
|
-
color = "primary",
|
|
12947
|
-
// Default to semantic primary
|
|
12948
|
-
className = ""
|
|
12949
|
-
}) {
|
|
12950
|
-
const { t } = useITTranslation();
|
|
12951
|
-
const isSemantic = color in theme.colors;
|
|
12952
|
-
const resolvedColor = isSemantic ? theme.colors[color][500] : color;
|
|
12953
|
-
const isCssValue = isSemantic || color.startsWith("#") || color.startsWith("rgb");
|
|
12954
|
-
const style = isCssValue ? { color: resolvedColor } : {};
|
|
12955
|
-
const bgStyle = isCssValue ? { backgroundColor: resolvedColor } : {};
|
|
12956
|
-
const colorClass = !isCssValue ? color : "";
|
|
12957
|
-
if (variant === "spinner") {
|
|
12958
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12959
|
-
"div",
|
|
12960
|
-
{
|
|
12961
|
-
className: `inline-block ${sizeClasses[size]} animate-spin rounded-full border-2 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite] ${colorClass} ${className}`,
|
|
12962
|
-
role: "status",
|
|
12963
|
-
style,
|
|
12964
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ITText, { as: "span", className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]", children: t("common.loading") })
|
|
12965
|
-
}
|
|
12966
|
-
);
|
|
12967
|
-
}
|
|
12968
|
-
if (variant === "dots") {
|
|
12969
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12970
|
-
"div",
|
|
12971
|
-
{
|
|
12972
|
-
className: `flex items-center justify-center space-x-2 ${className}`,
|
|
12973
|
-
children: [...Array(3)].map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12974
|
-
"div",
|
|
12975
|
-
{
|
|
12976
|
-
className: `${sizeClasses[size.replace(/l|g/, "")]} animate-bounce rounded-full ${colorClass}`,
|
|
12977
|
-
style: {
|
|
12978
|
-
...bgStyle,
|
|
12979
|
-
animationDelay: `${i * 0.1}s`
|
|
12980
|
-
}
|
|
12981
|
-
},
|
|
12982
|
-
i
|
|
12983
|
-
))
|
|
12984
|
-
}
|
|
12985
|
-
);
|
|
12986
|
-
}
|
|
12987
|
-
if (variant === "bar") {
|
|
12988
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12989
|
-
"div",
|
|
12990
|
-
{
|
|
12991
|
-
className: `w-full ${size === "sm" ? "h-1" : size === "md" ? "h-1.5" : size === "lg" ? "h-2" : "h-2.5"} bg-secondary-200 rounded-full overflow-hidden ${className}`,
|
|
12992
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12993
|
-
"div",
|
|
12994
|
-
{
|
|
12995
|
-
className: `h-full animate-progress ${colorClass}`,
|
|
12996
|
-
style: {
|
|
12997
|
-
backgroundColor: resolvedColor,
|
|
12998
|
-
// Simplified gradient for modern look, or keep it solid
|
|
12999
|
-
backgroundImage: isCssValue ? `linear-gradient(to right, ${resolvedColor}DD, ${resolvedColor})` : void 0,
|
|
13000
|
-
animation: "progress 1.5s ease-in-out infinite"
|
|
13001
|
-
}
|
|
13002
|
-
}
|
|
13003
|
-
)
|
|
13004
|
-
}
|
|
13005
|
-
);
|
|
13006
|
-
}
|
|
13007
|
-
if (variant === "pulse") {
|
|
13008
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
13009
|
-
"div",
|
|
13010
|
-
{
|
|
13011
|
-
className: `rounded-full ${sizeClasses[size]} animate-pulse ${colorClass} ${className}`,
|
|
13012
|
-
style: bgStyle
|
|
13013
|
-
}
|
|
13014
|
-
);
|
|
13015
|
-
}
|
|
13016
|
-
return null;
|
|
13017
|
-
}
|
|
13018
|
-
|
|
13019
14432
|
// src/components/molecules/stepper/stepper.tsx
|
|
13020
14433
|
var import_clsx56 = __toESM(require("clsx"), 1);
|
|
13021
|
-
var
|
|
14434
|
+
var import_react57 = require("react");
|
|
13022
14435
|
var import_fa33 = require("react-icons/fa");
|
|
13023
|
-
var
|
|
14436
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
13024
14437
|
function ITStepper({
|
|
13025
14438
|
steps,
|
|
13026
14439
|
currentStep,
|
|
@@ -13036,15 +14449,15 @@ function ITStepper({
|
|
|
13036
14449
|
color = "primary"
|
|
13037
14450
|
}) {
|
|
13038
14451
|
const { t } = useITTranslation();
|
|
13039
|
-
const [direction, setDirection] = (0,
|
|
13040
|
-
const contentRef = (0,
|
|
13041
|
-
const progressRef = (0,
|
|
14452
|
+
const [direction, setDirection] = (0, import_react57.useState)("next");
|
|
14453
|
+
const contentRef = (0, import_react57.useRef)(null);
|
|
14454
|
+
const progressRef = (0, import_react57.useRef)(null);
|
|
13042
14455
|
const isThemeColor = color in theme.colors;
|
|
13043
14456
|
const resolvedColor = isThemeColor ? theme.colors[color][500] : color;
|
|
13044
|
-
(0,
|
|
14457
|
+
(0, import_react57.useEffect)(() => {
|
|
13045
14458
|
onStepChange?.(currentStep);
|
|
13046
14459
|
}, [currentStep, onStepChange]);
|
|
13047
|
-
(0,
|
|
14460
|
+
(0, import_react57.useEffect)(() => {
|
|
13048
14461
|
const pct = currentStep / Math.max(1, steps.length - 1) * 100;
|
|
13049
14462
|
if (progressRef.current) {
|
|
13050
14463
|
progressRef.current.style.width = `${pct}%`;
|
|
@@ -13088,23 +14501,23 @@ function ITStepper({
|
|
|
13088
14501
|
const renderStepContent = (index, isCompleted) => {
|
|
13089
14502
|
const step = steps[index];
|
|
13090
14503
|
if (isCompleted) {
|
|
13091
|
-
return /* @__PURE__ */ (0,
|
|
14504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_fa33.FaCheck, { className: "w-4 h-4" });
|
|
13092
14505
|
}
|
|
13093
14506
|
if (step.icon && useIcons) {
|
|
13094
|
-
return /* @__PURE__ */ (0,
|
|
14507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex items-center justify-center w-5 h-5", children: step.icon });
|
|
13095
14508
|
}
|
|
13096
|
-
return /* @__PURE__ */ (0,
|
|
14509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ITText, { as: "span", className: "text-sm font-semibold", children: index + 1 });
|
|
13097
14510
|
};
|
|
13098
|
-
return /* @__PURE__ */ (0,
|
|
13099
|
-
/* @__PURE__ */ (0,
|
|
13100
|
-
/* @__PURE__ */ (0,
|
|
14511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: (0, import_clsx56.default)("w-full max-w-5xl mx-auto px-4", containerClassName), children: [
|
|
14512
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "relative mb-8", children: [
|
|
14513
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13101
14514
|
"div",
|
|
13102
14515
|
{
|
|
13103
14516
|
className: "absolute left-6 right-6 top-5 h-1 bg-secondary-200 rounded-full z-0",
|
|
13104
14517
|
"aria-hidden": true
|
|
13105
14518
|
}
|
|
13106
14519
|
),
|
|
13107
|
-
/* @__PURE__ */ (0,
|
|
14520
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13108
14521
|
"div",
|
|
13109
14522
|
{
|
|
13110
14523
|
ref: progressRef,
|
|
@@ -13112,11 +14525,11 @@ function ITStepper({
|
|
|
13112
14525
|
"aria-hidden": true
|
|
13113
14526
|
}
|
|
13114
14527
|
),
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
14528
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex items-start justify-between space-x-2 relative z-20", children: steps.map((step, idx) => {
|
|
13116
14529
|
const isActive = idx === currentStep;
|
|
13117
14530
|
const isCompleted = idx < currentStep;
|
|
13118
14531
|
const hasIcon = step.icon && useIcons;
|
|
13119
|
-
return /* @__PURE__ */ (0,
|
|
14532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13120
14533
|
"button",
|
|
13121
14534
|
{
|
|
13122
14535
|
type: "button",
|
|
@@ -13126,8 +14539,8 @@ function ITStepper({
|
|
|
13126
14539
|
"aria-label": t("stepper.stepAria", { n: idx + 1, label: step.label }),
|
|
13127
14540
|
className: "flex-1 group",
|
|
13128
14541
|
title: step.label,
|
|
13129
|
-
children: /* @__PURE__ */ (0,
|
|
13130
|
-
/* @__PURE__ */ (0,
|
|
14542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
14543
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13131
14544
|
"div",
|
|
13132
14545
|
{
|
|
13133
14546
|
className: (0, import_clsx56.default)(
|
|
@@ -13141,7 +14554,7 @@ function ITStepper({
|
|
|
13141
14554
|
children: renderStepContent(idx, isCompleted)
|
|
13142
14555
|
}
|
|
13143
14556
|
),
|
|
13144
|
-
/* @__PURE__ */ (0,
|
|
14557
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13145
14558
|
ITText,
|
|
13146
14559
|
{
|
|
13147
14560
|
as: "span",
|
|
@@ -13159,7 +14572,7 @@ function ITStepper({
|
|
|
13159
14572
|
);
|
|
13160
14573
|
}) })
|
|
13161
14574
|
] }),
|
|
13162
|
-
/* @__PURE__ */ (0,
|
|
14575
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13163
14576
|
"div",
|
|
13164
14577
|
{
|
|
13165
14578
|
ref: contentRef,
|
|
@@ -13175,32 +14588,32 @@ function ITStepper({
|
|
|
13175
14588
|
children: steps[currentStep].content
|
|
13176
14589
|
}
|
|
13177
14590
|
),
|
|
13178
|
-
/* @__PURE__ */ (0,
|
|
13179
|
-
/* @__PURE__ */ (0,
|
|
14591
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
14592
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13180
14593
|
ITButton,
|
|
13181
14594
|
{
|
|
13182
14595
|
variant: "outlined",
|
|
13183
14596
|
color: "secondary",
|
|
13184
14597
|
disabled: currentStep === 0,
|
|
13185
14598
|
onClick: prevStep,
|
|
13186
|
-
children: /* @__PURE__ */ (0,
|
|
13187
|
-
/* @__PURE__ */ (0,
|
|
13188
|
-
/* @__PURE__ */ (0,
|
|
14599
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14600
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_fa33.FaChevronLeft, {}),
|
|
14601
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ITText, { as: "span", children: t("common.back") })
|
|
13189
14602
|
] })
|
|
13190
14603
|
}
|
|
13191
14604
|
),
|
|
13192
|
-
/* @__PURE__ */ (0,
|
|
13193
|
-
/* @__PURE__ */ (0,
|
|
13194
|
-
/* @__PURE__ */ (0,
|
|
14605
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
14606
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.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 }) }),
|
|
14607
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13195
14608
|
ITButton,
|
|
13196
14609
|
{
|
|
13197
14610
|
variant: "solid",
|
|
13198
14611
|
color,
|
|
13199
14612
|
disabled: disableNext,
|
|
13200
14613
|
onClick: nextStep,
|
|
13201
|
-
children: /* @__PURE__ */ (0,
|
|
13202
|
-
/* @__PURE__ */ (0,
|
|
13203
|
-
currentStep === steps.length - 1 ? /* @__PURE__ */ (0,
|
|
14614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14615
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ITText, { as: "span", children: currentStep === steps.length - 1 ? t("common.finish") : t("common.next") }),
|
|
14616
|
+
currentStep === steps.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_fa33.FaCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_fa33.FaChevronRight, {})
|
|
13204
14617
|
] })
|
|
13205
14618
|
}
|
|
13206
14619
|
)
|
|
@@ -13210,7 +14623,7 @@ function ITStepper({
|
|
|
13210
14623
|
}
|
|
13211
14624
|
|
|
13212
14625
|
// src/components/theme-provider/themeProvider.tsx
|
|
13213
|
-
var
|
|
14626
|
+
var import_react58 = require("react");
|
|
13214
14627
|
var import_md3 = require("react-icons/md");
|
|
13215
14628
|
|
|
13216
14629
|
// src/components/theme-provider/themePresets.ts
|
|
@@ -13388,7 +14801,7 @@ var PRESETS = [
|
|
|
13388
14801
|
];
|
|
13389
14802
|
|
|
13390
14803
|
// src/components/theme-provider/themeProvider.tsx
|
|
13391
|
-
var
|
|
14804
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
13392
14805
|
var STORAGE_KEY = "it-theme-palette";
|
|
13393
14806
|
var SHADOW_LEVELS = {
|
|
13394
14807
|
0: {
|
|
@@ -13491,7 +14904,7 @@ function ITThemeProvider({
|
|
|
13491
14904
|
appearance = "soft"
|
|
13492
14905
|
}) {
|
|
13493
14906
|
const { t } = useITTranslation();
|
|
13494
|
-
const [palette2, setPaletteState] = (0,
|
|
14907
|
+
const [palette2, setPaletteState] = (0, import_react58.useState)(() => {
|
|
13495
14908
|
const basePalette = {
|
|
13496
14909
|
...DEFAULT_PALETTE,
|
|
13497
14910
|
...theme2,
|
|
@@ -13517,8 +14930,8 @@ function ITThemeProvider({
|
|
|
13517
14930
|
}
|
|
13518
14931
|
return basePalette;
|
|
13519
14932
|
});
|
|
13520
|
-
const [isOpen, setIsOpen] = (0,
|
|
13521
|
-
const [customPresets, setCustomPresets] = (0,
|
|
14933
|
+
const [isOpen, setIsOpen] = (0, import_react58.useState)(false);
|
|
14934
|
+
const [customPresets, setCustomPresets] = (0, import_react58.useState)(() => {
|
|
13522
14935
|
try {
|
|
13523
14936
|
const saved = localStorage.getItem("it-theme-custom-presets");
|
|
13524
14937
|
return saved ? JSON.parse(saved) : [];
|
|
@@ -13527,8 +14940,8 @@ function ITThemeProvider({
|
|
|
13527
14940
|
return [];
|
|
13528
14941
|
}
|
|
13529
14942
|
});
|
|
13530
|
-
const [newPresetName, setNewPresetName] = (0,
|
|
13531
|
-
const [isSavingPreset, setIsSavingPreset] = (0,
|
|
14943
|
+
const [newPresetName, setNewPresetName] = (0, import_react58.useState)("");
|
|
14944
|
+
const [isSavingPreset, setIsSavingPreset] = (0, import_react58.useState)(false);
|
|
13532
14945
|
const handleSavePreset = () => {
|
|
13533
14946
|
if (!newPresetName.trim()) return;
|
|
13534
14947
|
const newPreset = {
|
|
@@ -13547,8 +14960,8 @@ function ITThemeProvider({
|
|
|
13547
14960
|
setCustomPresets(updated);
|
|
13548
14961
|
localStorage.setItem("it-theme-custom-presets", JSON.stringify(updated));
|
|
13549
14962
|
};
|
|
13550
|
-
const [resolvedTheme, setResolvedTheme] = (0,
|
|
13551
|
-
const [darkModeMode, setDarkModeMode] = (0,
|
|
14963
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react58.useState)("light");
|
|
14964
|
+
const [darkModeMode, setDarkModeMode] = (0, import_react58.useState)(
|
|
13552
14965
|
() => {
|
|
13553
14966
|
const saved = localStorage.getItem("it-theme-dark-mode");
|
|
13554
14967
|
if (saved === "light" || saved === "dark" || saved === "system") {
|
|
@@ -13557,7 +14970,7 @@ function ITThemeProvider({
|
|
|
13557
14970
|
return "system";
|
|
13558
14971
|
}
|
|
13559
14972
|
);
|
|
13560
|
-
(0,
|
|
14973
|
+
(0, import_react58.useEffect)(() => {
|
|
13561
14974
|
localStorage.setItem("it-theme-dark-mode", darkModeMode);
|
|
13562
14975
|
const applyDarkMode = (isDark) => {
|
|
13563
14976
|
if (isDark) {
|
|
@@ -13582,7 +14995,7 @@ function ITThemeProvider({
|
|
|
13582
14995
|
applyDarkMode(darkModeMode === "dark");
|
|
13583
14996
|
}
|
|
13584
14997
|
}, [darkModeMode]);
|
|
13585
|
-
(0,
|
|
14998
|
+
(0, import_react58.useEffect)(() => {
|
|
13586
14999
|
if (!showFab) {
|
|
13587
15000
|
setPaletteState({
|
|
13588
15001
|
...DEFAULT_PALETTE,
|
|
@@ -13592,7 +15005,7 @@ function ITThemeProvider({
|
|
|
13592
15005
|
});
|
|
13593
15006
|
}
|
|
13594
15007
|
}, [theme2, showFab]);
|
|
13595
|
-
(0,
|
|
15008
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
13596
15009
|
const root = document.documentElement;
|
|
13597
15010
|
const scale = typeof density === "number" && isFinite(density) ? Math.min(Math.max(density, 0.5), 1.5) : 1;
|
|
13598
15011
|
root.style.setProperty("--it-density", String(scale));
|
|
@@ -13602,12 +15015,12 @@ function ITThemeProvider({
|
|
|
13602
15015
|
root.style.fontSize = "";
|
|
13603
15016
|
};
|
|
13604
15017
|
}, [density]);
|
|
13605
|
-
(0,
|
|
15018
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
13606
15019
|
const root = document.documentElement;
|
|
13607
15020
|
root.setAttribute("data-it-appearance", appearance);
|
|
13608
15021
|
return () => root.removeAttribute("data-it-appearance");
|
|
13609
15022
|
}, [appearance]);
|
|
13610
|
-
(0,
|
|
15023
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
13611
15024
|
const root = document.documentElement;
|
|
13612
15025
|
const radiusTokens = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
13613
15026
|
if (typeof radius === "number" && isFinite(radius)) {
|
|
@@ -13639,7 +15052,7 @@ function ITThemeProvider({
|
|
|
13639
15052
|
surfaceStyle?.remove();
|
|
13640
15053
|
};
|
|
13641
15054
|
}, [radius, shadow]);
|
|
13642
|
-
(0,
|
|
15055
|
+
(0, import_react58.useEffect)(() => {
|
|
13643
15056
|
const injectStyles = (obj, prefix = "") => {
|
|
13644
15057
|
Object.entries(obj).forEach(([key, val]) => {
|
|
13645
15058
|
if (typeof val === "object" && val !== null) {
|
|
@@ -14793,14 +16206,14 @@ function ITThemeProvider({
|
|
|
14793
16206
|
const isNested = colorKey.includes(".");
|
|
14794
16207
|
const label = isNested ? colorKey.split(".")[1] : colorKey;
|
|
14795
16208
|
const value = getNestedValue3(palette2, colorKey);
|
|
14796
|
-
return /* @__PURE__ */ (0,
|
|
16209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14797
16210
|
"div",
|
|
14798
16211
|
{
|
|
14799
16212
|
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",
|
|
14800
16213
|
children: [
|
|
14801
|
-
/* @__PURE__ */ (0,
|
|
14802
|
-
/* @__PURE__ */ (0,
|
|
14803
|
-
/* @__PURE__ */ (0,
|
|
16214
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
|
|
16215
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.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: [
|
|
16216
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14804
16217
|
"input",
|
|
14805
16218
|
{
|
|
14806
16219
|
type: "color",
|
|
@@ -14809,23 +16222,23 @@ function ITThemeProvider({
|
|
|
14809
16222
|
className: "absolute inset-0 opacity-0 cursor-pointer w-full h-full"
|
|
14810
16223
|
}
|
|
14811
16224
|
),
|
|
14812
|
-
/* @__PURE__ */ (0,
|
|
16225
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "w-full h-full", style: { backgroundColor: value } })
|
|
14813
16226
|
] }),
|
|
14814
|
-
/* @__PURE__ */ (0,
|
|
14815
|
-
/* @__PURE__ */ (0,
|
|
14816
|
-
/* @__PURE__ */ (0,
|
|
14817
|
-
/* @__PURE__ */ (0,
|
|
16227
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
16228
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.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() }),
|
|
16229
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-2 mt-0.5", children: [
|
|
16230
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14818
16231
|
"span",
|
|
14819
16232
|
{
|
|
14820
16233
|
className: "w-3 h-3 rounded-full border border-slate-200 dark:border-slate-600",
|
|
14821
16234
|
style: { backgroundColor: value }
|
|
14822
16235
|
}
|
|
14823
16236
|
),
|
|
14824
|
-
/* @__PURE__ */ (0,
|
|
16237
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", className: "font-mono text-[11px] text-slate-400", children: value })
|
|
14825
16238
|
] })
|
|
14826
16239
|
] })
|
|
14827
16240
|
] }),
|
|
14828
|
-
/* @__PURE__ */ (0,
|
|
16241
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14829
16242
|
"input",
|
|
14830
16243
|
{
|
|
14831
16244
|
type: "text",
|
|
@@ -14844,14 +16257,14 @@ function ITThemeProvider({
|
|
|
14844
16257
|
isCustom
|
|
14845
16258
|
}) => {
|
|
14846
16259
|
const isSelected = JSON.stringify(preset.colors) === JSON.stringify(palette2);
|
|
14847
|
-
return /* @__PURE__ */ (0,
|
|
16260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14848
16261
|
"button",
|
|
14849
16262
|
{
|
|
14850
16263
|
type: "button",
|
|
14851
16264
|
onClick: () => applyPreset(preset.colors),
|
|
14852
16265
|
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"}`,
|
|
14853
16266
|
children: [
|
|
14854
|
-
isCustom && /* @__PURE__ */ (0,
|
|
16267
|
+
isCustom && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14855
16268
|
"span",
|
|
14856
16269
|
{
|
|
14857
16270
|
onClick: (e) => {
|
|
@@ -14860,11 +16273,11 @@ function ITThemeProvider({
|
|
|
14860
16273
|
},
|
|
14861
16274
|
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",
|
|
14862
16275
|
title: t("themeProvider.designer.deletePreset"),
|
|
14863
|
-
children: /* @__PURE__ */ (0,
|
|
16276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_md3.MdClose, { size: 12 })
|
|
14864
16277
|
}
|
|
14865
16278
|
),
|
|
14866
|
-
/* @__PURE__ */ (0,
|
|
14867
|
-
/* @__PURE__ */ (0,
|
|
16279
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.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 }),
|
|
16280
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex gap-1", children: ["primary", "secondary", "ternary", "success"].map((c) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14868
16281
|
"span",
|
|
14869
16282
|
{
|
|
14870
16283
|
className: "w-3 h-3 rounded-full border border-black/10",
|
|
@@ -14876,7 +16289,7 @@ function ITThemeProvider({
|
|
|
14876
16289
|
}
|
|
14877
16290
|
);
|
|
14878
16291
|
};
|
|
14879
|
-
return /* @__PURE__ */ (0,
|
|
16292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14880
16293
|
ITThemeContext.Provider,
|
|
14881
16294
|
{
|
|
14882
16295
|
value: {
|
|
@@ -14893,28 +16306,28 @@ function ITThemeProvider({
|
|
|
14893
16306
|
},
|
|
14894
16307
|
children: [
|
|
14895
16308
|
children,
|
|
14896
|
-
showFab && /* @__PURE__ */ (0,
|
|
16309
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14897
16310
|
"button",
|
|
14898
16311
|
{
|
|
14899
16312
|
onClick: () => setIsOpen((prev) => !prev),
|
|
14900
16313
|
className: "it-theme-fab it-theme-bounce",
|
|
14901
16314
|
style: { backgroundColor: "var(--color-primary)" },
|
|
14902
16315
|
"aria-label": t("themeProvider.fab.ariaLabel"),
|
|
14903
|
-
children: /* @__PURE__ */ (0,
|
|
16316
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_md3.MdPalette, { size: 28 })
|
|
14904
16317
|
}
|
|
14905
16318
|
),
|
|
14906
|
-
showFab && /* @__PURE__ */ (0,
|
|
16319
|
+
showFab && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14907
16320
|
ITDialog,
|
|
14908
16321
|
{
|
|
14909
16322
|
isOpen,
|
|
14910
16323
|
onClose: () => setIsOpen(false),
|
|
14911
16324
|
title: t("themeProvider.designer.title"),
|
|
14912
16325
|
useFormHeader: true,
|
|
14913
|
-
children: /* @__PURE__ */ (0,
|
|
14914
|
-
/* @__PURE__ */ (0,
|
|
14915
|
-
/* @__PURE__ */ (0,
|
|
14916
|
-
/* @__PURE__ */ (0,
|
|
14917
|
-
/* @__PURE__ */ (0,
|
|
16326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex gap-6 h-[580px]", children: [
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "w-64 flex-shrink-0 flex flex-col gap-5 overflow-y-auto pr-1", children: [
|
|
16328
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
16329
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.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") }),
|
|
16330
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14918
16331
|
ITSegmentedControl,
|
|
14919
16332
|
{
|
|
14920
16333
|
options: [
|
|
@@ -14928,16 +16341,16 @@ function ITThemeProvider({
|
|
|
14928
16341
|
}
|
|
14929
16342
|
)
|
|
14930
16343
|
] }),
|
|
14931
|
-
/* @__PURE__ */ (0,
|
|
14932
|
-
/* @__PURE__ */ (0,
|
|
14933
|
-
/* @__PURE__ */ (0,
|
|
16344
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
16345
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-center justify-between mb-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "span", className: "text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: t("themeProvider.designer.presets") }) }),
|
|
16346
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-2 gap-2", children: PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PresetCard, { preset }, preset.name)) })
|
|
14934
16347
|
] }),
|
|
14935
|
-
customPresets.length > 0 && /* @__PURE__ */ (0,
|
|
14936
|
-
/* @__PURE__ */ (0,
|
|
14937
|
-
/* @__PURE__ */ (0,
|
|
16348
|
+
customPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
16349
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.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") }),
|
|
16350
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex flex-col gap-1.5", children: customPresets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PresetCard, { preset, isCustom: true }, preset.name)) })
|
|
14938
16351
|
] }),
|
|
14939
|
-
isSavingPreset && /* @__PURE__ */ (0,
|
|
14940
|
-
/* @__PURE__ */ (0,
|
|
16352
|
+
isSavingPreset && /* @__PURE__ */ (0, import_jsx_runtime80.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: [
|
|
16353
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14941
16354
|
ITInput,
|
|
14942
16355
|
{
|
|
14943
16356
|
name: "presetName",
|
|
@@ -14955,8 +16368,8 @@ function ITThemeProvider({
|
|
|
14955
16368
|
}
|
|
14956
16369
|
}
|
|
14957
16370
|
),
|
|
14958
|
-
/* @__PURE__ */ (0,
|
|
14959
|
-
/* @__PURE__ */ (0,
|
|
16371
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex gap-2", children: [
|
|
16372
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14960
16373
|
ITButton,
|
|
14961
16374
|
{
|
|
14962
16375
|
label: t("themeProvider.designer.save"),
|
|
@@ -14967,7 +16380,7 @@ function ITThemeProvider({
|
|
|
14967
16380
|
className: "flex-1"
|
|
14968
16381
|
}
|
|
14969
16382
|
),
|
|
14970
|
-
/* @__PURE__ */ (0,
|
|
16383
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14971
16384
|
ITButton,
|
|
14972
16385
|
{
|
|
14973
16386
|
label: t("themeProvider.designer.cancelSave"),
|
|
@@ -14981,31 +16394,31 @@ function ITThemeProvider({
|
|
|
14981
16394
|
)
|
|
14982
16395
|
] })
|
|
14983
16396
|
] }),
|
|
14984
|
-
!isSavingPreset && /* @__PURE__ */ (0,
|
|
16397
|
+
!isSavingPreset && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14985
16398
|
ITButton,
|
|
14986
16399
|
{
|
|
14987
16400
|
variant: "outlined",
|
|
14988
|
-
icon: /* @__PURE__ */ (0,
|
|
16401
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_md3.MdPalette, { size: 14 }),
|
|
14989
16402
|
label: t("themeProvider.designer.saveCurrent"),
|
|
14990
16403
|
onClick: () => setIsSavingPreset(true),
|
|
14991
16404
|
size: "sm"
|
|
14992
16405
|
}
|
|
14993
16406
|
),
|
|
14994
|
-
/* @__PURE__ */ (0,
|
|
16407
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14995
16408
|
ITButton,
|
|
14996
16409
|
{
|
|
14997
16410
|
variant: "outlined",
|
|
14998
16411
|
color: "danger",
|
|
14999
|
-
icon: /* @__PURE__ */ (0,
|
|
16412
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_md3.MdRefresh, { size: 14 }),
|
|
15000
16413
|
label: t("themeProvider.designer.reset"),
|
|
15001
16414
|
onClick: resetTheme,
|
|
15002
16415
|
size: "sm"
|
|
15003
16416
|
}
|
|
15004
16417
|
)
|
|
15005
16418
|
] }),
|
|
15006
|
-
/* @__PURE__ */ (0,
|
|
15007
|
-
/* @__PURE__ */ (0,
|
|
15008
|
-
/* @__PURE__ */ (0,
|
|
16419
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITDivider, { orientation: "vertical" }),
|
|
16420
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
16421
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15009
16422
|
tabs_default,
|
|
15010
16423
|
{
|
|
15011
16424
|
variant: "pill",
|
|
@@ -15013,7 +16426,7 @@ function ITThemeProvider({
|
|
|
15013
16426
|
{
|
|
15014
16427
|
id: "brand",
|
|
15015
16428
|
label: t("themeProvider.tabs.brand"),
|
|
15016
|
-
content: /* @__PURE__ */ (0,
|
|
16429
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
15017
16430
|
"primary",
|
|
15018
16431
|
"secondary",
|
|
15019
16432
|
"ternary",
|
|
@@ -15022,35 +16435,35 @@ function ITThemeProvider({
|
|
|
15022
16435
|
"info",
|
|
15023
16436
|
"alert",
|
|
15024
16437
|
"warning"
|
|
15025
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
16438
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
15026
16439
|
},
|
|
15027
16440
|
{
|
|
15028
16441
|
id: "layout",
|
|
15029
16442
|
label: t("themeProvider.tabs.layout"),
|
|
15030
|
-
content: /* @__PURE__ */ (0,
|
|
16443
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
15031
16444
|
"layout.sidebarBg",
|
|
15032
16445
|
"layout.sidebarText",
|
|
15033
16446
|
"layout.navbarBg",
|
|
15034
16447
|
"layout.navbarText"
|
|
15035
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
16448
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
15036
16449
|
},
|
|
15037
16450
|
{
|
|
15038
16451
|
id: "tables",
|
|
15039
16452
|
label: t("themeProvider.tabs.tables"),
|
|
15040
|
-
content: /* @__PURE__ */ (0,
|
|
16453
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[480px] overflow-y-auto pr-2 mt-3", children: [
|
|
15041
16454
|
"table.headerBg",
|
|
15042
16455
|
"table.headerText",
|
|
15043
16456
|
"table.rowBg",
|
|
15044
16457
|
"table.rowText",
|
|
15045
16458
|
"table.rowHover"
|
|
15046
|
-
].map((key) => /* @__PURE__ */ (0,
|
|
16459
|
+
].map((key) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ColorRow, { colorKey: key }, key)) })
|
|
15047
16460
|
}
|
|
15048
16461
|
]
|
|
15049
16462
|
}
|
|
15050
16463
|
),
|
|
15051
|
-
/* @__PURE__ */ (0,
|
|
15052
|
-
/* @__PURE__ */ (0,
|
|
15053
|
-
/* @__PURE__ */ (0,
|
|
16464
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center justify-end gap-3 mt-auto pt-4 border-t border-slate-100 dark:border-slate-800", children: [
|
|
16465
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ITText, { as: "p", className: "text-[11px] text-slate-400 mr-auto", children: t("themeProvider.designer.autosave") }),
|
|
16466
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15054
16467
|
ITButton,
|
|
15055
16468
|
{
|
|
15056
16469
|
label: t("themeProvider.designer.close"),
|
|
@@ -15081,7 +16494,13 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
15081
16494
|
);
|
|
15082
16495
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15083
16496
|
0 && (module.exports = {
|
|
16497
|
+
AXZY_CATALOG_ENTRIES,
|
|
16498
|
+
AXZY_EXCLUDED_TYPES,
|
|
16499
|
+
CURRENT_SCHEMA_VERSION,
|
|
16500
|
+
DEFAULT_LIMITS,
|
|
16501
|
+
DEFAULT_MIGRATIONS,
|
|
15084
16502
|
FileTypeEnum,
|
|
16503
|
+
GLOBALLY_FORBIDDEN_PROPS,
|
|
15085
16504
|
ITAccordion,
|
|
15086
16505
|
ITAlert,
|
|
15087
16506
|
ITAvatar,
|
|
@@ -15125,6 +16544,7 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
15125
16544
|
ITPopover,
|
|
15126
16545
|
ITProgress,
|
|
15127
16546
|
ITRadioGroup,
|
|
16547
|
+
ITSchemaRenderer,
|
|
15128
16548
|
ITSearchSelect,
|
|
15129
16549
|
ITSearchTable,
|
|
15130
16550
|
ITSegmentedControl,
|
|
@@ -15145,13 +16565,39 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
15145
16565
|
ITToast,
|
|
15146
16566
|
ITTripleFilter,
|
|
15147
16567
|
ITWysiwyg,
|
|
16568
|
+
JsonEngineError,
|
|
16569
|
+
NodeBoundary,
|
|
15148
16570
|
UploadStatus,
|
|
16571
|
+
auditTree,
|
|
16572
|
+
axzyCatalog,
|
|
16573
|
+
axzyCatalogTypes,
|
|
16574
|
+
buildVocabularyContract,
|
|
16575
|
+
countPendingNodes,
|
|
16576
|
+
createCatalog,
|
|
16577
|
+
createLimitTracker,
|
|
15149
16578
|
createValidationSchema,
|
|
15150
16579
|
enMessages,
|
|
15151
16580
|
esMessages,
|
|
16581
|
+
formatPath,
|
|
16582
|
+
formatVocabularyForPrompt,
|
|
16583
|
+
getCatalogEntry,
|
|
15152
16584
|
getContrastTextColor,
|
|
16585
|
+
getExclusionReason,
|
|
16586
|
+
hasPath,
|
|
16587
|
+
isExcludedType,
|
|
15153
16588
|
isLightColor,
|
|
16589
|
+
isNodePending,
|
|
16590
|
+
issue,
|
|
16591
|
+
migrateSchema,
|
|
16592
|
+
parsePartialSchema,
|
|
16593
|
+
parsePath,
|
|
16594
|
+
propPath,
|
|
16595
|
+
pushPath,
|
|
16596
|
+
readPath,
|
|
16597
|
+
renderNode,
|
|
15154
16598
|
resolveCssColor,
|
|
16599
|
+
resolveLimits,
|
|
16600
|
+
resolveNode,
|
|
15155
16601
|
useClickOutside,
|
|
15156
16602
|
useDebouncedSearch,
|
|
15157
16603
|
useEditableRow,
|
|
@@ -15161,6 +16607,7 @@ var createValidationSchema = (fields) => Yup.object().shape(
|
|
|
15161
16607
|
useITThemeSafe,
|
|
15162
16608
|
useITTranslation,
|
|
15163
16609
|
useJsonRender,
|
|
15164
|
-
useTableState
|
|
16610
|
+
useTableState,
|
|
16611
|
+
validateSchema
|
|
15165
16612
|
});
|
|
15166
16613
|
//# sourceMappingURL=index.cjs.map
|