@particle-academy/react-fancy 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{diagram.serializers-OK4HP7AB.js → diagram.serializers-6RPUO46U.js} +11 -11
- package/dist/diagram.serializers-6RPUO46U.js.map +1 -0
- package/dist/index.cjs +315 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -3
- package/dist/index.d.ts +197 -3
- package/dist/index.js +304 -31
- package/dist/index.js.map +1 -1
- package/docs/AccordionPanel.md +135 -0
- package/package.json +1 -1
- package/dist/diagram.serializers-OK4HP7AB.js.map +0 -1
|
@@ -139,9 +139,9 @@ function deserializeERD(input) {
|
|
|
139
139
|
const toEntity = entities.find((e) => e.name === toName);
|
|
140
140
|
if (fromEntity && toEntity) {
|
|
141
141
|
relations.push({
|
|
142
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
143
|
-
from: fromEntity.id,
|
|
144
|
-
to: toEntity.id,
|
|
142
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
143
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
144
|
+
to: toEntity.id ?? toEntity.name,
|
|
145
145
|
type: parseERDMarker(marker),
|
|
146
146
|
label
|
|
147
147
|
});
|
|
@@ -218,9 +218,9 @@ function deserializeUML(input) {
|
|
|
218
218
|
if (fromEntity && toEntity) {
|
|
219
219
|
const type = fromCard === "1" && toCard === "1" ? "one-to-one" : fromCard === "1" && toCard === "*" ? "one-to-many" : "many-to-many";
|
|
220
220
|
relations.push({
|
|
221
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
222
|
-
from: fromEntity.id,
|
|
223
|
-
to: toEntity.id,
|
|
221
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
222
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
223
|
+
to: toEntity.id ?? toEntity.name,
|
|
224
224
|
type,
|
|
225
225
|
label
|
|
226
226
|
});
|
|
@@ -256,9 +256,9 @@ function deserializeDFD(input) {
|
|
|
256
256
|
const toEntity = entities.find((e) => e.name === toName);
|
|
257
257
|
if (fromEntity && toEntity) {
|
|
258
258
|
relations.push({
|
|
259
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
260
|
-
from: fromEntity.id,
|
|
261
|
-
to: toEntity.id,
|
|
259
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
260
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
261
|
+
to: toEntity.id ?? toEntity.name,
|
|
262
262
|
type: "one-to-many",
|
|
263
263
|
label
|
|
264
264
|
});
|
|
@@ -269,5 +269,5 @@ function deserializeDFD(input) {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
export { deserializeSchema, serializeToDFD, serializeToERD, serializeToUML };
|
|
272
|
-
//# sourceMappingURL=diagram.serializers-
|
|
273
|
-
//# sourceMappingURL=diagram.serializers-
|
|
272
|
+
//# sourceMappingURL=diagram.serializers-6RPUO46U.js.map
|
|
273
|
+
//# sourceMappingURL=diagram.serializers-6RPUO46U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Diagram/diagram.serializers.ts"],"names":[],"mappings":";AAyBO,SAAS,eAAe,MAAA,EAA+B;AAC5D,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,KAAA,MAAW,MAAA,IAAU,OAAO,QAAA,EAAU;AACpC,IAAA,KAAA,CAAM,IAAA,CAAK,CAAA,CAAA,EAAI,MAAA,CAAO,IAAI,CAAA,CAAA,CAAG,CAAA;AAC7B,IAAA,IAAI,OAAO,MAAA,EAAQ;AACjB,MAAA,KAAA,MAAW,KAAA,IAAS,OAAO,MAAA,EAAQ;AACjC,QAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,EAAA,EAAK,KAAA,CAAM,IAAI,CAAA,CAAE,CAA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,CAAA,EAAI,QAAA,CAAS,EAAA,IAAM,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,UACvE,IAAA,EAAM,UAAA,CAAW,EAAA,IAAM,UAAA,CAAW,IAAA;AAAA,UAClC,EAAA,EAAI,QAAA,CAAS,EAAA,IAAM,QAAA,CAAS,IAAA;AAAA,UAC5B,IAAA,EAAM,aAAA;AAAA,UACN;AAAA,SACD,CAAA;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,UAAU,SAAA,EAAU;AAC/B","file":"diagram.serializers-6RPUO46U.js","sourcesContent":["import type {\n DiagramSchema,\n DiagramEntityData,\n DiagramRelationData,\n DiagramFieldData,\n ExportFormat,\n RelationType,\n} from \"./Diagram.types\";\n\n/**\n * Serialize a diagram schema to PlantUML-style ERD text.\n *\n * Example output:\n * ```\n * [Users]\n * id int PK\n * email varchar\n *\n * [Posts]\n * id int PK\n * user_id int FK\n *\n * Users 1--* Posts\n * ```\n */\nexport function serializeToERD(schema: DiagramSchema): string {\n const lines: string[] = [];\n\n for (const entity of schema.entities) {\n lines.push(`[${entity.name}]`);\n if (entity.fields) {\n for (const field of entity.fields) {\n const parts = [` ${field.name}`];\n if (field.type) parts.push(field.type);\n if (field.primary) parts.push(\"PK\");\n if (field.foreign) parts.push(\"FK\");\n if (field.nullable) parts.push(\"?\");\n lines.push(parts.join(\" \"));\n }\n }\n lines.push(\"\");\n }\n\n for (const rel of schema.relations) {\n const fromEntity = schema.entities.find((e) => e.id === rel.from);\n const toEntity = schema.entities.find((e) => e.id === rel.to);\n if (!fromEntity || !toEntity) continue;\n\n const marker = getERDMarker(rel.type);\n const parts = [fromEntity.name, marker, toEntity.name];\n if (rel.label) parts.push(`: ${rel.label}`);\n lines.push(parts.join(\" \"));\n }\n\n return lines.join(\"\\n\").trim();\n}\n\nfunction getERDMarker(type: RelationType): string {\n switch (type) {\n case \"one-to-one\":\n return \"1--1\";\n case \"one-to-many\":\n return \"1--*\";\n case \"many-to-many\":\n return \"*--*\";\n }\n}\n\n/**\n * Serialize a diagram schema to PlantUML class diagram text.\n */\nexport function serializeToUML(schema: DiagramSchema): string {\n const lines: string[] = [\"@startuml\"];\n\n for (const entity of schema.entities) {\n lines.push(`class ${entity.name} {`);\n if (entity.fields) {\n for (const field of entity.fields) {\n const typeStr = field.type ?? \"any\";\n const nullable = field.nullable ? \"?\" : \"\";\n const stereotype = field.primary\n ? \" <<PK>>\"\n : field.foreign\n ? \" <<FK>>\"\n : \"\";\n lines.push(` ${field.name} : ${typeStr}${nullable}${stereotype}`);\n }\n }\n lines.push(\"}\");\n lines.push(\"\");\n }\n\n for (const rel of schema.relations) {\n const fromEntity = schema.entities.find((e) => e.id === rel.from);\n const toEntity = schema.entities.find((e) => e.id === rel.to);\n if (!fromEntity || !toEntity) continue;\n\n const arrow = getUMLArrow(rel.type);\n const label = rel.label ? ` : ${rel.label}` : \"\";\n lines.push(`${fromEntity.name} ${arrow} ${toEntity.name}${label}`);\n }\n\n lines.push(\"@enduml\");\n return lines.join(\"\\n\");\n}\n\nfunction getUMLArrow(type: RelationType): string {\n switch (type) {\n case \"one-to-one\":\n return '\"1\" -- \"1\"';\n case \"one-to-many\":\n return '\"1\" -- \"*\"';\n case \"many-to-many\":\n return '\"*\" -- \"*\"';\n }\n}\n\n/**\n * Serialize a diagram schema to a simple DFD text format.\n */\nexport function serializeToDFD(schema: DiagramSchema): string {\n const lines: string[] = [];\n\n for (const entity of schema.entities) {\n lines.push(`entity ${entity.name}`);\n }\n\n lines.push(\"\");\n\n for (const rel of schema.relations) {\n const fromEntity = schema.entities.find((e) => e.id === rel.from);\n const toEntity = schema.entities.find((e) => e.id === rel.to);\n if (!fromEntity || !toEntity) continue;\n\n const label = rel.label ? ` \"${rel.label}\"` : \"\";\n lines.push(`${fromEntity.name} -> ${toEntity.name}${label}`);\n }\n\n return lines.join(\"\\n\").trim();\n}\n\n/**\n * Parse a serialized schema string back into a DiagramSchema.\n */\nexport function deserializeSchema(\n input: string,\n format: ExportFormat,\n): DiagramSchema {\n switch (format) {\n case \"erd\":\n return deserializeERD(input);\n case \"uml\":\n return deserializeUML(input);\n case \"dfd\":\n return deserializeDFD(input);\n }\n}\n\nfunction deserializeERD(input: string): DiagramSchema {\n const entities: DiagramEntityData[] = [];\n const relations: DiagramRelationData[] = [];\n const lines = input.split(\"\\n\");\n\n let currentEntity: DiagramEntityData | null = null;\n\n for (const rawLine of lines) {\n const line = rawLine.trim();\n\n // Entity header: [EntityName]\n const entityMatch = line.match(/^\\[(.+)\\]$/);\n if (entityMatch) {\n currentEntity = {\n id: entityMatch[1].toLowerCase().replace(/\\s+/g, \"_\"),\n name: entityMatch[1],\n fields: [],\n };\n entities.push(currentEntity);\n continue;\n }\n\n // Field line (indented): name type PK FK ?\n if (currentEntity && rawLine.startsWith(\" \") && line.length > 0) {\n const parts = line.split(/\\s+/);\n const field: DiagramFieldData = { name: parts[0] };\n if (parts.length > 1 && ![\"PK\", \"FK\", \"?\"].includes(parts[1])) {\n field.type = parts[1];\n }\n if (parts.includes(\"PK\")) field.primary = true;\n if (parts.includes(\"FK\")) field.foreign = true;\n if (parts.includes(\"?\")) field.nullable = true;\n currentEntity.fields!.push(field);\n continue;\n }\n\n // Relation: EntityA 1--* EntityB : label\n const relMatch = line.match(\n /^(\\S+)\\s+(1--1|1--\\*|\\*--\\*)\\s+(\\S+)(?:\\s*:\\s*(.+))?$/,\n );\n if (relMatch) {\n currentEntity = null;\n const fromName = relMatch[1];\n const marker = relMatch[2];\n const toName = relMatch[3];\n const label = relMatch[4];\n\n const fromEntity = entities.find((e) => e.name === fromName);\n const toEntity = entities.find((e) => e.name === toName);\n if (fromEntity && toEntity) {\n relations.push({\n id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,\n from: fromEntity.id ?? fromEntity.name,\n to: toEntity.id ?? toEntity.name,\n type: parseERDMarker(marker),\n label,\n });\n }\n continue;\n }\n\n // Empty line resets current entity context\n if (line === \"\") {\n currentEntity = null;\n }\n }\n\n return { entities, relations };\n}\n\nfunction parseERDMarker(marker: string): RelationType {\n switch (marker) {\n case \"1--1\":\n return \"one-to-one\";\n case \"1--*\":\n return \"one-to-many\";\n case \"*--*\":\n return \"many-to-many\";\n default:\n return \"one-to-many\";\n }\n}\n\nfunction deserializeUML(input: string): DiagramSchema {\n const entities: DiagramEntityData[] = [];\n const relations: DiagramRelationData[] = [];\n const lines = input.split(\"\\n\");\n\n let currentEntity: DiagramEntityData | null = null;\n\n for (const rawLine of lines) {\n const line = rawLine.trim();\n\n if (line === \"@startuml\" || line === \"@enduml\" || line === \"\") continue;\n\n // Class header: class EntityName {\n const classMatch = line.match(/^class\\s+(\\S+)\\s*\\{$/);\n if (classMatch) {\n currentEntity = {\n id: classMatch[1].toLowerCase().replace(/\\s+/g, \"_\"),\n name: classMatch[1],\n fields: [],\n };\n entities.push(currentEntity);\n continue;\n }\n\n // Closing brace\n if (line === \"}\") {\n currentEntity = null;\n continue;\n }\n\n // Field: name : type<<stereotype>>\n if (currentEntity) {\n const fieldMatch = line.match(\n /^(\\S+)\\s*:\\s*(\\S+?)(\\?)?(?:\\s*<<(PK|FK)>>)?$/,\n );\n if (fieldMatch) {\n const field: DiagramFieldData = {\n name: fieldMatch[1],\n type: fieldMatch[2],\n };\n if (fieldMatch[3]) field.nullable = true;\n if (fieldMatch[4] === \"PK\") field.primary = true;\n if (fieldMatch[4] === \"FK\") field.foreign = true;\n currentEntity.fields!.push(field);\n }\n continue;\n }\n\n // Relation: EntityA \"1\" -- \"*\" EntityB : label\n const relMatch = line.match(\n /^(\\S+)\\s+\"([1*])\"\\s+--\\s+\"([1*])\"\\s+(\\S+)(?:\\s*:\\s*(.+))?$/,\n );\n if (relMatch) {\n const fromName = relMatch[1];\n const fromCard = relMatch[2];\n const toCard = relMatch[3];\n const toName = relMatch[4];\n const label = relMatch[5];\n\n const fromEntity = entities.find((e) => e.name === fromName);\n const toEntity = entities.find((e) => e.name === toName);\n if (fromEntity && toEntity) {\n const type: RelationType =\n fromCard === \"1\" && toCard === \"1\"\n ? \"one-to-one\"\n : fromCard === \"1\" && toCard === \"*\"\n ? \"one-to-many\"\n : \"many-to-many\";\n relations.push({\n id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,\n from: fromEntity.id ?? fromEntity.name,\n to: toEntity.id ?? toEntity.name,\n type,\n label,\n });\n }\n }\n }\n\n return { entities, relations };\n}\n\nfunction deserializeDFD(input: string): DiagramSchema {\n const entities: DiagramEntityData[] = [];\n const relations: DiagramRelationData[] = [];\n const lines = input.split(\"\\n\");\n\n for (const rawLine of lines) {\n const line = rawLine.trim();\n if (line === \"\") continue;\n\n // Entity: entity EntityName\n const entityMatch = line.match(/^entity\\s+(\\S+)$/);\n if (entityMatch) {\n entities.push({\n id: entityMatch[1].toLowerCase().replace(/\\s+/g, \"_\"),\n name: entityMatch[1],\n fields: [],\n });\n continue;\n }\n\n // Flow: EntityA -> EntityB \"label\"\n const flowMatch = line.match(\n /^(\\S+)\\s+->\\s+(\\S+)(?:\\s+\"(.+)\")?$/,\n );\n if (flowMatch) {\n const fromName = flowMatch[1];\n const toName = flowMatch[2];\n const label = flowMatch[3];\n\n const fromEntity = entities.find((e) => e.name === fromName);\n const toEntity = entities.find((e) => e.name === toName);\n if (fromEntity && toEntity) {\n relations.push({\n id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,\n from: fromEntity.id ?? fromEntity.name,\n to: toEntity.id ?? toEntity.name,\n type: \"one-to-many\",\n label,\n });\n }\n }\n }\n\n return { entities, relations };\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -186,9 +186,9 @@ function deserializeERD(input) {
|
|
|
186
186
|
const toEntity = entities.find((e) => e.name === toName);
|
|
187
187
|
if (fromEntity && toEntity) {
|
|
188
188
|
relations.push({
|
|
189
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
190
|
-
from: fromEntity.id,
|
|
191
|
-
to: toEntity.id,
|
|
189
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
190
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
191
|
+
to: toEntity.id ?? toEntity.name,
|
|
192
192
|
type: parseERDMarker(marker),
|
|
193
193
|
label
|
|
194
194
|
});
|
|
@@ -265,9 +265,9 @@ function deserializeUML(input) {
|
|
|
265
265
|
if (fromEntity && toEntity) {
|
|
266
266
|
const type = fromCard === "1" && toCard === "1" ? "one-to-one" : fromCard === "1" && toCard === "*" ? "one-to-many" : "many-to-many";
|
|
267
267
|
relations.push({
|
|
268
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
269
|
-
from: fromEntity.id,
|
|
270
|
-
to: toEntity.id,
|
|
268
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
269
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
270
|
+
to: toEntity.id ?? toEntity.name,
|
|
271
271
|
type,
|
|
272
272
|
label
|
|
273
273
|
});
|
|
@@ -303,9 +303,9 @@ function deserializeDFD(input) {
|
|
|
303
303
|
const toEntity = entities.find((e) => e.name === toName);
|
|
304
304
|
if (fromEntity && toEntity) {
|
|
305
305
|
relations.push({
|
|
306
|
-
id: `${fromEntity.id}_${toEntity.id}`,
|
|
307
|
-
from: fromEntity.id,
|
|
308
|
-
to: toEntity.id,
|
|
306
|
+
id: `${fromEntity.id ?? fromEntity.name}_${toEntity.id ?? toEntity.name}`,
|
|
307
|
+
from: fromEntity.id ?? fromEntity.name,
|
|
308
|
+
to: toEntity.id ?? toEntity.name,
|
|
309
309
|
type: "one-to-many",
|
|
310
310
|
label
|
|
311
311
|
});
|
|
@@ -2866,6 +2866,288 @@ var Action = react.forwardRef(
|
|
|
2866
2866
|
}
|
|
2867
2867
|
);
|
|
2868
2868
|
Action.displayName = "Action";
|
|
2869
|
+
function useControllableState(controlledValue, defaultValue, onChange) {
|
|
2870
|
+
const [uncontrolledValue, setUncontrolledValue] = react.useState(defaultValue);
|
|
2871
|
+
const isControlled = controlledValue !== void 0;
|
|
2872
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
2873
|
+
const onChangeRef = react.useRef(onChange);
|
|
2874
|
+
onChangeRef.current = onChange;
|
|
2875
|
+
const setValue = react.useCallback(
|
|
2876
|
+
(next) => {
|
|
2877
|
+
const nextValue = typeof next === "function" ? next(value) : next;
|
|
2878
|
+
if (!isControlled) {
|
|
2879
|
+
setUncontrolledValue(nextValue);
|
|
2880
|
+
}
|
|
2881
|
+
onChangeRef.current?.(nextValue);
|
|
2882
|
+
},
|
|
2883
|
+
[isControlled, value]
|
|
2884
|
+
);
|
|
2885
|
+
return [value, setValue];
|
|
2886
|
+
}
|
|
2887
|
+
var AccordionPanelContext = react.createContext(null);
|
|
2888
|
+
function useAccordionPanel() {
|
|
2889
|
+
const ctx = react.useContext(AccordionPanelContext);
|
|
2890
|
+
if (!ctx) {
|
|
2891
|
+
throw new Error(
|
|
2892
|
+
"AccordionPanel components must be used inside <AccordionPanel>"
|
|
2893
|
+
);
|
|
2894
|
+
}
|
|
2895
|
+
return ctx;
|
|
2896
|
+
}
|
|
2897
|
+
var AccordionSectionContext = react.createContext(null);
|
|
2898
|
+
function useAccordionSection() {
|
|
2899
|
+
const ctx = react.useContext(AccordionSectionContext);
|
|
2900
|
+
if (!ctx) {
|
|
2901
|
+
throw new Error(
|
|
2902
|
+
"<AccordionPanel.Trigger> must be rendered inside <AccordionPanel.Section>"
|
|
2903
|
+
);
|
|
2904
|
+
}
|
|
2905
|
+
return ctx;
|
|
2906
|
+
}
|
|
2907
|
+
function AccordionPanelSection({
|
|
2908
|
+
id,
|
|
2909
|
+
pinned = false,
|
|
2910
|
+
className,
|
|
2911
|
+
openClassName,
|
|
2912
|
+
closedClassName,
|
|
2913
|
+
unstyled,
|
|
2914
|
+
children
|
|
2915
|
+
}) {
|
|
2916
|
+
const panel = useAccordionPanel();
|
|
2917
|
+
const { orientation, isOpen, toggle, registerSection } = panel;
|
|
2918
|
+
react.useEffect(() => registerSection(id), [id, registerSection]);
|
|
2919
|
+
const open = pinned || isOpen(id);
|
|
2920
|
+
const sectionCtx = react.useMemo(
|
|
2921
|
+
() => ({
|
|
2922
|
+
id,
|
|
2923
|
+
open,
|
|
2924
|
+
pinned,
|
|
2925
|
+
orientation,
|
|
2926
|
+
toggle: () => toggle(id)
|
|
2927
|
+
}),
|
|
2928
|
+
[id, open, pinned, orientation, toggle]
|
|
2929
|
+
);
|
|
2930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccordionSectionContext.Provider, { value: sectionCtx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2931
|
+
"div",
|
|
2932
|
+
{
|
|
2933
|
+
"data-react-fancy-accordion-section": "",
|
|
2934
|
+
"data-state": open ? "open" : "closed",
|
|
2935
|
+
"data-pinned": pinned ? "" : void 0,
|
|
2936
|
+
"data-orientation": orientation,
|
|
2937
|
+
className: cn(
|
|
2938
|
+
"flex shrink-0",
|
|
2939
|
+
!unstyled && "items-center gap-1",
|
|
2940
|
+
orientation === "horizontal" ? "flex-row" : "flex-col",
|
|
2941
|
+
className,
|
|
2942
|
+
open ? openClassName : closedClassName
|
|
2943
|
+
),
|
|
2944
|
+
children
|
|
2945
|
+
}
|
|
2946
|
+
) });
|
|
2947
|
+
}
|
|
2948
|
+
AccordionPanelSection.displayName = "AccordionPanelSection";
|
|
2949
|
+
function renderSlot(slot, state) {
|
|
2950
|
+
return typeof slot === "function" ? slot(state) : slot;
|
|
2951
|
+
}
|
|
2952
|
+
function AccordionPanelTrigger({
|
|
2953
|
+
children,
|
|
2954
|
+
className,
|
|
2955
|
+
"aria-label": ariaLabel
|
|
2956
|
+
}) {
|
|
2957
|
+
const { id, open, orientation, toggle } = useAccordionSection();
|
|
2958
|
+
const state = { id, open, orientation, toggle };
|
|
2959
|
+
if (children !== void 0) {
|
|
2960
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2961
|
+
"div",
|
|
2962
|
+
{
|
|
2963
|
+
"data-react-fancy-accordion-trigger": "",
|
|
2964
|
+
"data-state": open ? "open" : "closed",
|
|
2965
|
+
"data-orientation": orientation,
|
|
2966
|
+
className,
|
|
2967
|
+
children: renderSlot(children, state)
|
|
2968
|
+
}
|
|
2969
|
+
);
|
|
2970
|
+
}
|
|
2971
|
+
if (open) {
|
|
2972
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2973
|
+
"button",
|
|
2974
|
+
{
|
|
2975
|
+
type: "button",
|
|
2976
|
+
onClick: toggle,
|
|
2977
|
+
"aria-label": ariaLabel ?? "Collapse section",
|
|
2978
|
+
"data-react-fancy-accordion-trigger": "",
|
|
2979
|
+
"data-state": "open",
|
|
2980
|
+
"data-orientation": orientation,
|
|
2981
|
+
className: cn(
|
|
2982
|
+
"group relative flex shrink-0 items-center justify-center cursor-pointer",
|
|
2983
|
+
"text-zinc-500 dark:text-zinc-500",
|
|
2984
|
+
"hover:text-zinc-900 dark:hover:text-zinc-100",
|
|
2985
|
+
// Wide hitbox + thin visible line (drawn via ::before).
|
|
2986
|
+
orientation === "horizontal" ? "w-3 self-stretch" : "h-3 self-stretch",
|
|
2987
|
+
"before:absolute before:bg-zinc-200 dark:before:bg-zinc-700",
|
|
2988
|
+
"before:transition-colors group-hover:before:bg-zinc-400 dark:group-hover:before:bg-zinc-500",
|
|
2989
|
+
orientation === "horizontal" ? "before:top-0 before:bottom-0 before:w-px before:left-1/2 before:-translate-x-1/2" : "before:left-0 before:right-0 before:h-px before:top-1/2 before:-translate-y-1/2",
|
|
2990
|
+
"transition-colors",
|
|
2991
|
+
className
|
|
2992
|
+
),
|
|
2993
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2994
|
+
ChevronIcon,
|
|
2995
|
+
{
|
|
2996
|
+
orientation,
|
|
2997
|
+
purpose: "collapse",
|
|
2998
|
+
className: "relative opacity-0 group-hover:opacity-100 transition-opacity"
|
|
2999
|
+
}
|
|
3000
|
+
)
|
|
3001
|
+
}
|
|
3002
|
+
);
|
|
3003
|
+
}
|
|
3004
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3005
|
+
"button",
|
|
3006
|
+
{
|
|
3007
|
+
type: "button",
|
|
3008
|
+
onClick: toggle,
|
|
3009
|
+
"aria-label": ariaLabel ?? "Expand section",
|
|
3010
|
+
"data-react-fancy-accordion-trigger": "",
|
|
3011
|
+
"data-state": "closed",
|
|
3012
|
+
"data-orientation": orientation,
|
|
3013
|
+
className: cn(
|
|
3014
|
+
"flex shrink-0 items-center justify-center rounded-md",
|
|
3015
|
+
"text-zinc-400 dark:text-zinc-500",
|
|
3016
|
+
"hover:text-zinc-900 dark:hover:text-zinc-100",
|
|
3017
|
+
"hover:bg-zinc-100 dark:hover:bg-zinc-800",
|
|
3018
|
+
"transition-colors cursor-pointer",
|
|
3019
|
+
orientation === "horizontal" ? "h-8 w-6 mx-0.5" : "w-8 h-6 my-0.5",
|
|
3020
|
+
className
|
|
3021
|
+
),
|
|
3022
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { orientation, purpose: "expand" })
|
|
3023
|
+
}
|
|
3024
|
+
);
|
|
3025
|
+
}
|
|
3026
|
+
AccordionPanelTrigger.displayName = "AccordionPanelTrigger";
|
|
3027
|
+
function ChevronIcon({
|
|
3028
|
+
orientation,
|
|
3029
|
+
purpose,
|
|
3030
|
+
className
|
|
3031
|
+
}) {
|
|
3032
|
+
const transform = orientation === "horizontal" ? "rotate(180deg)" : purpose === "expand" ? "rotate(90deg)" : "rotate(270deg)";
|
|
3033
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3034
|
+
"svg",
|
|
3035
|
+
{
|
|
3036
|
+
viewBox: "0 0 16 16",
|
|
3037
|
+
width: "12",
|
|
3038
|
+
height: "12",
|
|
3039
|
+
fill: "none",
|
|
3040
|
+
stroke: "currentColor",
|
|
3041
|
+
strokeWidth: "2",
|
|
3042
|
+
strokeLinecap: "round",
|
|
3043
|
+
strokeLinejoin: "round",
|
|
3044
|
+
style: { transform },
|
|
3045
|
+
className,
|
|
3046
|
+
"aria-hidden": "true",
|
|
3047
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 4 10 8 6 12" })
|
|
3048
|
+
}
|
|
3049
|
+
);
|
|
3050
|
+
}
|
|
3051
|
+
function AccordionPanelContent({
|
|
3052
|
+
children,
|
|
3053
|
+
className,
|
|
3054
|
+
unstyled
|
|
3055
|
+
}) {
|
|
3056
|
+
const { open, orientation } = useAccordionSection();
|
|
3057
|
+
if (!open) return null;
|
|
3058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3059
|
+
"div",
|
|
3060
|
+
{
|
|
3061
|
+
"data-react-fancy-accordion-content": "",
|
|
3062
|
+
"data-orientation": orientation,
|
|
3063
|
+
className: cn(
|
|
3064
|
+
!unstyled && "flex items-center gap-1",
|
|
3065
|
+
!unstyled && (orientation === "horizontal" ? "flex-row" : "flex-col"),
|
|
3066
|
+
className
|
|
3067
|
+
),
|
|
3068
|
+
children
|
|
3069
|
+
}
|
|
3070
|
+
);
|
|
3071
|
+
}
|
|
3072
|
+
AccordionPanelContent.displayName = "AccordionPanelContent";
|
|
3073
|
+
function AccordionPanelRoot({
|
|
3074
|
+
orientation = "horizontal",
|
|
3075
|
+
value: controlledValue,
|
|
3076
|
+
defaultValue,
|
|
3077
|
+
onValueChange,
|
|
3078
|
+
className,
|
|
3079
|
+
children
|
|
3080
|
+
}) {
|
|
3081
|
+
const [openIds, setOpenIds] = useControllableState(
|
|
3082
|
+
controlledValue,
|
|
3083
|
+
defaultValue ?? [],
|
|
3084
|
+
onValueChange
|
|
3085
|
+
);
|
|
3086
|
+
const openSet = react.useMemo(() => new Set(openIds), [openIds]);
|
|
3087
|
+
const isOpen = react.useCallback((id) => openSet.has(id), [openSet]);
|
|
3088
|
+
const open = react.useCallback(
|
|
3089
|
+
(id) => {
|
|
3090
|
+
setOpenIds(openSet.has(id) ? openIds ?? [] : [...openIds ?? [], id]);
|
|
3091
|
+
},
|
|
3092
|
+
[openSet, openIds, setOpenIds]
|
|
3093
|
+
);
|
|
3094
|
+
const close = react.useCallback(
|
|
3095
|
+
(id) => {
|
|
3096
|
+
setOpenIds((openIds ?? []).filter((x) => x !== id));
|
|
3097
|
+
},
|
|
3098
|
+
[openIds, setOpenIds]
|
|
3099
|
+
);
|
|
3100
|
+
const toggle = react.useCallback(
|
|
3101
|
+
(id) => {
|
|
3102
|
+
setOpenIds(
|
|
3103
|
+
openSet.has(id) ? (openIds ?? []).filter((x) => x !== id) : [...openIds ?? [], id]
|
|
3104
|
+
);
|
|
3105
|
+
},
|
|
3106
|
+
[openSet, openIds, setOpenIds]
|
|
3107
|
+
);
|
|
3108
|
+
const [sectionIds, setSectionIds] = react.useState([]);
|
|
3109
|
+
const orderRef = react.useRef([]);
|
|
3110
|
+
const registerSection = react.useCallback((id) => {
|
|
3111
|
+
if (!orderRef.current.includes(id)) {
|
|
3112
|
+
orderRef.current = [...orderRef.current, id];
|
|
3113
|
+
setSectionIds(orderRef.current);
|
|
3114
|
+
}
|
|
3115
|
+
return () => {
|
|
3116
|
+
orderRef.current = orderRef.current.filter((x) => x !== id);
|
|
3117
|
+
setSectionIds(orderRef.current);
|
|
3118
|
+
};
|
|
3119
|
+
}, []);
|
|
3120
|
+
const ctx = react.useMemo(
|
|
3121
|
+
() => ({
|
|
3122
|
+
orientation,
|
|
3123
|
+
isOpen,
|
|
3124
|
+
toggle,
|
|
3125
|
+
open,
|
|
3126
|
+
close,
|
|
3127
|
+
sectionIds,
|
|
3128
|
+
registerSection
|
|
3129
|
+
}),
|
|
3130
|
+
[orientation, isOpen, toggle, open, close, sectionIds, registerSection]
|
|
3131
|
+
);
|
|
3132
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPanelContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3133
|
+
"div",
|
|
3134
|
+
{
|
|
3135
|
+
"data-react-fancy-accordion-panel": "",
|
|
3136
|
+
"data-orientation": orientation,
|
|
3137
|
+
className: cn(
|
|
3138
|
+
"inline-flex items-stretch",
|
|
3139
|
+
orientation === "horizontal" ? "flex-row" : "flex-col",
|
|
3140
|
+
className
|
|
3141
|
+
),
|
|
3142
|
+
children
|
|
3143
|
+
}
|
|
3144
|
+
) });
|
|
3145
|
+
}
|
|
3146
|
+
AccordionPanelRoot.displayName = "AccordionPanel";
|
|
3147
|
+
var AccordionPanel = AccordionPanelRoot;
|
|
3148
|
+
AccordionPanel.Section = AccordionPanelSection;
|
|
3149
|
+
AccordionPanel.Trigger = AccordionPanelTrigger;
|
|
3150
|
+
AccordionPanel.Content = AccordionPanelContent;
|
|
2869
3151
|
|
|
2870
3152
|
// src/components/inputs/inputs.utils.ts
|
|
2871
3153
|
var inputSizeClasses = {
|
|
@@ -3752,24 +4034,6 @@ var Select = react.forwardRef(
|
|
|
3752
4034
|
}
|
|
3753
4035
|
);
|
|
3754
4036
|
Select.displayName = "Select";
|
|
3755
|
-
function useControllableState(controlledValue, defaultValue, onChange) {
|
|
3756
|
-
const [uncontrolledValue, setUncontrolledValue] = react.useState(defaultValue);
|
|
3757
|
-
const isControlled = controlledValue !== void 0;
|
|
3758
|
-
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
3759
|
-
const onChangeRef = react.useRef(onChange);
|
|
3760
|
-
onChangeRef.current = onChange;
|
|
3761
|
-
const setValue = react.useCallback(
|
|
3762
|
-
(next) => {
|
|
3763
|
-
const nextValue = typeof next === "function" ? next(value) : next;
|
|
3764
|
-
if (!isControlled) {
|
|
3765
|
-
setUncontrolledValue(nextValue);
|
|
3766
|
-
}
|
|
3767
|
-
onChangeRef.current?.(nextValue);
|
|
3768
|
-
},
|
|
3769
|
-
[isControlled, value]
|
|
3770
|
-
);
|
|
3771
|
-
return [value, setValue];
|
|
3772
|
-
}
|
|
3773
4037
|
var Checkbox = react.forwardRef(
|
|
3774
4038
|
({
|
|
3775
4039
|
size = "md",
|
|
@@ -11159,11 +11423,13 @@ var KanbanColumnContext = react.createContext("");
|
|
|
11159
11423
|
function useKanbanColumn() {
|
|
11160
11424
|
return react.useContext(KanbanColumnContext);
|
|
11161
11425
|
}
|
|
11426
|
+
var DEFAULT_COLUMN_CLASSES = "min-h-[200px] w-72 rounded-xl bg-zinc-50 p-3 dark:bg-zinc-800/50";
|
|
11162
11427
|
function KanbanColumn({
|
|
11163
11428
|
children,
|
|
11164
11429
|
id,
|
|
11165
11430
|
title,
|
|
11166
|
-
className
|
|
11431
|
+
className,
|
|
11432
|
+
unstyled
|
|
11167
11433
|
}) {
|
|
11168
11434
|
const { onCardMove, draggedCard, dragSource } = useKanban();
|
|
11169
11435
|
const [dragOver, setDragOver] = react.useState(false);
|
|
@@ -11190,7 +11456,8 @@ function KanbanColumn({
|
|
|
11190
11456
|
onDragOver: handleDragOver,
|
|
11191
11457
|
onDragLeave: handleDragLeave,
|
|
11192
11458
|
className: cn(
|
|
11193
|
-
"flex
|
|
11459
|
+
"flex flex-col",
|
|
11460
|
+
!unstyled && DEFAULT_COLUMN_CLASSES,
|
|
11194
11461
|
dragOver && "ring-2 ring-blue-400 ring-inset",
|
|
11195
11462
|
className
|
|
11196
11463
|
),
|
|
@@ -11202,7 +11469,8 @@ function KanbanColumn({
|
|
|
11202
11469
|
) });
|
|
11203
11470
|
}
|
|
11204
11471
|
KanbanColumn.displayName = "KanbanColumn";
|
|
11205
|
-
|
|
11472
|
+
var DEFAULT_CARD_CLASSES = "rounded-lg border border-zinc-200 bg-white p-3 shadow-sm transition-shadow hover:shadow-md dark:border-zinc-700 dark:bg-zinc-900";
|
|
11473
|
+
function KanbanCard({ children, id, className, unstyled }) {
|
|
11206
11474
|
const { setDraggedCard, setDragSource } = useKanban();
|
|
11207
11475
|
const columnId = useKanbanColumn();
|
|
11208
11476
|
const handleDragStart = react.useCallback(() => {
|
|
@@ -11221,7 +11489,9 @@ function KanbanCard({ children, id, className }) {
|
|
|
11221
11489
|
onDragStart: handleDragStart,
|
|
11222
11490
|
onDragEnd: handleDragEnd,
|
|
11223
11491
|
className: cn(
|
|
11224
|
-
|
|
11492
|
+
// Drag affordance — kept even when unstyled so users still see grab cursors.
|
|
11493
|
+
"cursor-grab active:cursor-grabbing",
|
|
11494
|
+
!unstyled && DEFAULT_CARD_CLASSES,
|
|
11225
11495
|
className
|
|
11226
11496
|
),
|
|
11227
11497
|
children
|
|
@@ -12002,9 +12272,12 @@ var VERTICAL_GAP = 60;
|
|
|
12002
12272
|
function getEntityHeight(fieldCount) {
|
|
12003
12273
|
return HEADER_HEIGHT2 + Math.max(fieldCount, 1) * FIELD_HEIGHT2;
|
|
12004
12274
|
}
|
|
12275
|
+
function resolveEntityId(entity) {
|
|
12276
|
+
return entity.id ?? entity.name;
|
|
12277
|
+
}
|
|
12005
12278
|
function computeDiagramLayout(schema) {
|
|
12006
12279
|
const positions = /* @__PURE__ */ new Map();
|
|
12007
|
-
const entityIds = new Set(schema.entities.map(
|
|
12280
|
+
const entityIds = new Set(schema.entities.map(resolveEntityId));
|
|
12008
12281
|
const incoming = /* @__PURE__ */ new Map();
|
|
12009
12282
|
for (const id of entityIds) {
|
|
12010
12283
|
incoming.set(id, /* @__PURE__ */ new Set());
|
|
@@ -12025,7 +12298,7 @@ function computeDiagramLayout(schema) {
|
|
|
12025
12298
|
}
|
|
12026
12299
|
}
|
|
12027
12300
|
if (queue.length === 0 && entityIds.size > 0) {
|
|
12028
|
-
const firstId = schema.entities[0]
|
|
12301
|
+
const firstId = resolveEntityId(schema.entities[0]);
|
|
12029
12302
|
rowAssignment.set(firstId, 0);
|
|
12030
12303
|
assigned.add(firstId);
|
|
12031
12304
|
queue.push(firstId);
|
|
@@ -12065,7 +12338,7 @@ function computeDiagramLayout(schema) {
|
|
|
12065
12338
|
}
|
|
12066
12339
|
const fieldCounts = /* @__PURE__ */ new Map();
|
|
12067
12340
|
for (const entity of schema.entities) {
|
|
12068
|
-
fieldCounts.set(entity
|
|
12341
|
+
fieldCounts.set(resolveEntityId(entity), entity.fields?.length ?? 0);
|
|
12069
12342
|
}
|
|
12070
12343
|
const sortedRows = Array.from(rows.keys()).sort((a, b) => a - b);
|
|
12071
12344
|
let currentY = 0;
|
|
@@ -12262,7 +12535,7 @@ function FolderIcon({ open }) {
|
|
|
12262
12535
|
}
|
|
12263
12536
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1.5 3a1 1 0 011-1h3l1.5 1.5H13a1 1 0 011 1v8a1 1 0 01-1 1H2.5a1 1 0 01-1-1V3z", fill: "#fbbf24" }) });
|
|
12264
12537
|
}
|
|
12265
|
-
function
|
|
12538
|
+
function ChevronIcon2({ open }) {
|
|
12266
12539
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12267
12540
|
"svg",
|
|
12268
12541
|
{
|
|
@@ -12444,7 +12717,7 @@ function TreeNode({ node, depth }) {
|
|
|
12444
12717
|
),
|
|
12445
12718
|
style: { paddingLeft },
|
|
12446
12719
|
children: [
|
|
12447
|
-
isFolder && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12720
|
+
isFolder && /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon2, { open: isExpanded }),
|
|
12448
12721
|
!isFolder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-3.5 shrink-0" }),
|
|
12449
12722
|
showIcons && (node.icon ?? (isFolder ? /* @__PURE__ */ jsxRuntime.jsx(FolderIcon, { open: isExpanded }) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { ext: node.ext ?? node.label.split(".").pop() }))),
|
|
12450
12723
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: node.label })
|
|
@@ -12574,6 +12847,10 @@ var TreeNav = Object.assign(TreeNavRoot, {
|
|
|
12574
12847
|
});
|
|
12575
12848
|
|
|
12576
12849
|
exports.Accordion = Accordion;
|
|
12850
|
+
exports.AccordionPanel = AccordionPanel;
|
|
12851
|
+
exports.AccordionPanelContent = AccordionPanelContent;
|
|
12852
|
+
exports.AccordionPanelSection = AccordionPanelSection;
|
|
12853
|
+
exports.AccordionPanelTrigger = AccordionPanelTrigger;
|
|
12577
12854
|
exports.Action = Action;
|
|
12578
12855
|
exports.Autocomplete = Autocomplete;
|
|
12579
12856
|
exports.Avatar = Avatar;
|
|
@@ -12652,6 +12929,8 @@ exports.sanitizeHtml = sanitizeHtml;
|
|
|
12652
12929
|
exports.search = search;
|
|
12653
12930
|
exports.skinTones = skinTones;
|
|
12654
12931
|
exports.useAccordion = useAccordion;
|
|
12932
|
+
exports.useAccordionPanel = useAccordionPanel;
|
|
12933
|
+
exports.useAccordionSection = useAccordionSection;
|
|
12655
12934
|
exports.useAnimation = useAnimation;
|
|
12656
12935
|
exports.useCanvas = useCanvas;
|
|
12657
12936
|
exports.useCarousel = useCarousel;
|