@particle-academy/react-fancy 2.5.0 → 2.6.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.
@@ -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-OK4HP7AB.js.map
273
- //# sourceMappingURL=diagram.serializers-OK4HP7AB.js.map
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,CAAA;AAChC,QAAA,IAAI,KAAA,CAAM,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,MAAM,IAAI,CAAA;AACrC,QAAA,IAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAClC,QAAA,IAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAClC,QAAA,IAAI,KAAA,CAAM,QAAA,EAAU,KAAA,CAAM,IAAA,CAAK,GAAG,CAAA;AAClC,QAAA,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAG,CAAC,CAAA;AAAA,MAC5B;AAAA,IACF;AACA,IAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AAAA,EACf;AAEA,EAAA,KAAA,MAAW,GAAA,IAAO,OAAO,SAAA,EAAW;AAClC,IAAA,MAAM,UAAA,GAAa,OAAO,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAM,CA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V,CAAA;AACD,MAAA;AAAA,IACF;AAGA,IAAA,MAAM,YAAY,IAAA,CAAK,KAAA;AAAA,MACrB;AAAA,KACF;AACA,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAM,QAAA,GAAW,UAAU,CAAC,CAAA;AAC5B,MAAA,MAAM,MAAA,GAAS,UAAU,CAAC,CAAA;AAC1B,MAAA,MAAM,KAAA,GAAQ,UAAU,CAAC,CAAA;AAEzB,MAAA,MAAM,aAAa,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,QAAQ,CAAA;AAC3D,MAAA,MAAM,WAAW,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,MAAM,CAAA;AACvD,MAAA,IAAI,cAAc,QAAA,EAAU;AAC1B,QAAA,SAAA,CAAU,IAAA,CAAK;AAAA,UACb,EAAA,EAAI,CAAA,EAAG,UAAA,CAAW,EAAA,IAAM,UAAA,CAAW,IAAI,CAAA,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,283 @@ 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
+ children
2914
+ }) {
2915
+ const panel = useAccordionPanel();
2916
+ const { orientation, isOpen, toggle, registerSection } = panel;
2917
+ react.useEffect(() => registerSection(id), [id, registerSection]);
2918
+ const open = pinned || isOpen(id);
2919
+ const sectionCtx = react.useMemo(
2920
+ () => ({
2921
+ id,
2922
+ open,
2923
+ pinned,
2924
+ orientation,
2925
+ toggle: () => toggle(id)
2926
+ }),
2927
+ [id, open, pinned, orientation, toggle]
2928
+ );
2929
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionSectionContext.Provider, { value: sectionCtx, children: /* @__PURE__ */ jsxRuntime.jsx(
2930
+ "div",
2931
+ {
2932
+ "data-react-fancy-accordion-section": "",
2933
+ "data-state": open ? "open" : "closed",
2934
+ "data-pinned": pinned ? "" : void 0,
2935
+ "data-orientation": orientation,
2936
+ className: cn(
2937
+ "flex shrink-0 items-center gap-1",
2938
+ orientation === "horizontal" ? "flex-row" : "flex-col",
2939
+ className,
2940
+ open ? openClassName : closedClassName
2941
+ ),
2942
+ children
2943
+ }
2944
+ ) });
2945
+ }
2946
+ AccordionPanelSection.displayName = "AccordionPanelSection";
2947
+ function renderSlot(slot, state) {
2948
+ return typeof slot === "function" ? slot(state) : slot;
2949
+ }
2950
+ function AccordionPanelTrigger({
2951
+ children,
2952
+ className,
2953
+ "aria-label": ariaLabel
2954
+ }) {
2955
+ const { id, open, orientation, toggle } = useAccordionSection();
2956
+ const state = { id, open, orientation, toggle };
2957
+ if (children !== void 0) {
2958
+ return /* @__PURE__ */ jsxRuntime.jsx(
2959
+ "div",
2960
+ {
2961
+ "data-react-fancy-accordion-trigger": "",
2962
+ "data-state": open ? "open" : "closed",
2963
+ "data-orientation": orientation,
2964
+ className,
2965
+ children: renderSlot(children, state)
2966
+ }
2967
+ );
2968
+ }
2969
+ if (open) {
2970
+ return /* @__PURE__ */ jsxRuntime.jsx(
2971
+ "button",
2972
+ {
2973
+ type: "button",
2974
+ onClick: toggle,
2975
+ "aria-label": ariaLabel ?? "Collapse section",
2976
+ "data-react-fancy-accordion-trigger": "",
2977
+ "data-state": "open",
2978
+ "data-orientation": orientation,
2979
+ className: cn(
2980
+ "group relative flex shrink-0 items-center justify-center cursor-pointer",
2981
+ "text-zinc-500 dark:text-zinc-500",
2982
+ "hover:text-zinc-900 dark:hover:text-zinc-100",
2983
+ orientation === "horizontal" ? "w-px self-stretch hover:w-3 mx-1" : "h-px self-stretch hover:h-3 my-1",
2984
+ "before:absolute before:inset-0 before:bg-zinc-200 dark:before:bg-zinc-700",
2985
+ orientation === "horizontal" ? "before:w-px before:left-1/2 before:-translate-x-1/2" : "before:h-px before:top-1/2 before:-translate-y-1/2",
2986
+ "transition-all duration-150",
2987
+ className
2988
+ ),
2989
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2990
+ ChevronIcon,
2991
+ {
2992
+ orientation,
2993
+ purpose: "collapse",
2994
+ className: "relative opacity-0 group-hover:opacity-100 transition-opacity"
2995
+ }
2996
+ )
2997
+ }
2998
+ );
2999
+ }
3000
+ return /* @__PURE__ */ jsxRuntime.jsx(
3001
+ "button",
3002
+ {
3003
+ type: "button",
3004
+ onClick: toggle,
3005
+ "aria-label": ariaLabel ?? "Expand section",
3006
+ "data-react-fancy-accordion-trigger": "",
3007
+ "data-state": "closed",
3008
+ "data-orientation": orientation,
3009
+ className: cn(
3010
+ "flex shrink-0 items-center justify-center rounded-md",
3011
+ "text-zinc-400 dark:text-zinc-500",
3012
+ "hover:text-zinc-900 dark:hover:text-zinc-100",
3013
+ "hover:bg-zinc-100 dark:hover:bg-zinc-800",
3014
+ "transition-colors cursor-pointer",
3015
+ orientation === "horizontal" ? "h-8 w-6 mx-0.5" : "w-8 h-6 my-0.5",
3016
+ className
3017
+ ),
3018
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { orientation, purpose: "expand" })
3019
+ }
3020
+ );
3021
+ }
3022
+ AccordionPanelTrigger.displayName = "AccordionPanelTrigger";
3023
+ function ChevronIcon({
3024
+ orientation,
3025
+ purpose,
3026
+ className
3027
+ }) {
3028
+ const transform = orientation === "horizontal" ? "rotate(180deg)" : purpose === "expand" ? "rotate(90deg)" : "rotate(270deg)";
3029
+ return /* @__PURE__ */ jsxRuntime.jsx(
3030
+ "svg",
3031
+ {
3032
+ viewBox: "0 0 16 16",
3033
+ width: "12",
3034
+ height: "12",
3035
+ fill: "none",
3036
+ stroke: "currentColor",
3037
+ strokeWidth: "2",
3038
+ strokeLinecap: "round",
3039
+ strokeLinejoin: "round",
3040
+ style: { transform },
3041
+ className,
3042
+ "aria-hidden": "true",
3043
+ children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 4 10 8 6 12" })
3044
+ }
3045
+ );
3046
+ }
3047
+ function AccordionPanelContent({
3048
+ children,
3049
+ className
3050
+ }) {
3051
+ const { open, orientation } = useAccordionSection();
3052
+ if (!open) return null;
3053
+ return /* @__PURE__ */ jsxRuntime.jsx(
3054
+ "div",
3055
+ {
3056
+ "data-react-fancy-accordion-content": "",
3057
+ "data-orientation": orientation,
3058
+ className: cn(
3059
+ "flex items-center gap-1",
3060
+ orientation === "horizontal" ? "flex-row" : "flex-col",
3061
+ className
3062
+ ),
3063
+ children
3064
+ }
3065
+ );
3066
+ }
3067
+ AccordionPanelContent.displayName = "AccordionPanelContent";
3068
+ function AccordionPanelRoot({
3069
+ orientation = "horizontal",
3070
+ value: controlledValue,
3071
+ defaultValue,
3072
+ onValueChange,
3073
+ className,
3074
+ children
3075
+ }) {
3076
+ const [openIds, setOpenIds] = useControllableState(
3077
+ controlledValue,
3078
+ defaultValue ?? [],
3079
+ onValueChange
3080
+ );
3081
+ const openSet = react.useMemo(() => new Set(openIds), [openIds]);
3082
+ const isOpen = react.useCallback((id) => openSet.has(id), [openSet]);
3083
+ const open = react.useCallback(
3084
+ (id) => {
3085
+ setOpenIds(openSet.has(id) ? openIds ?? [] : [...openIds ?? [], id]);
3086
+ },
3087
+ [openSet, openIds, setOpenIds]
3088
+ );
3089
+ const close = react.useCallback(
3090
+ (id) => {
3091
+ setOpenIds((openIds ?? []).filter((x) => x !== id));
3092
+ },
3093
+ [openIds, setOpenIds]
3094
+ );
3095
+ const toggle = react.useCallback(
3096
+ (id) => {
3097
+ setOpenIds(
3098
+ openSet.has(id) ? (openIds ?? []).filter((x) => x !== id) : [...openIds ?? [], id]
3099
+ );
3100
+ },
3101
+ [openSet, openIds, setOpenIds]
3102
+ );
3103
+ const [sectionIds, setSectionIds] = react.useState([]);
3104
+ const orderRef = react.useRef([]);
3105
+ const registerSection = react.useCallback((id) => {
3106
+ if (!orderRef.current.includes(id)) {
3107
+ orderRef.current = [...orderRef.current, id];
3108
+ setSectionIds(orderRef.current);
3109
+ }
3110
+ return () => {
3111
+ orderRef.current = orderRef.current.filter((x) => x !== id);
3112
+ setSectionIds(orderRef.current);
3113
+ };
3114
+ }, []);
3115
+ const ctx = react.useMemo(
3116
+ () => ({
3117
+ orientation,
3118
+ isOpen,
3119
+ toggle,
3120
+ open,
3121
+ close,
3122
+ sectionIds,
3123
+ registerSection
3124
+ }),
3125
+ [orientation, isOpen, toggle, open, close, sectionIds, registerSection]
3126
+ );
3127
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionPanelContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
3128
+ "div",
3129
+ {
3130
+ "data-react-fancy-accordion-panel": "",
3131
+ "data-orientation": orientation,
3132
+ className: cn(
3133
+ "inline-flex items-stretch",
3134
+ orientation === "horizontal" ? "flex-row" : "flex-col",
3135
+ className
3136
+ ),
3137
+ children
3138
+ }
3139
+ ) });
3140
+ }
3141
+ AccordionPanelRoot.displayName = "AccordionPanel";
3142
+ var AccordionPanel = AccordionPanelRoot;
3143
+ AccordionPanel.Section = AccordionPanelSection;
3144
+ AccordionPanel.Trigger = AccordionPanelTrigger;
3145
+ AccordionPanel.Content = AccordionPanelContent;
2869
3146
 
2870
3147
  // src/components/inputs/inputs.utils.ts
2871
3148
  var inputSizeClasses = {
@@ -3752,24 +4029,6 @@ var Select = react.forwardRef(
3752
4029
  }
3753
4030
  );
3754
4031
  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
4032
  var Checkbox = react.forwardRef(
3774
4033
  ({
3775
4034
  size = "md",
@@ -12002,9 +12261,12 @@ var VERTICAL_GAP = 60;
12002
12261
  function getEntityHeight(fieldCount) {
12003
12262
  return HEADER_HEIGHT2 + Math.max(fieldCount, 1) * FIELD_HEIGHT2;
12004
12263
  }
12264
+ function resolveEntityId(entity) {
12265
+ return entity.id ?? entity.name;
12266
+ }
12005
12267
  function computeDiagramLayout(schema) {
12006
12268
  const positions = /* @__PURE__ */ new Map();
12007
- const entityIds = new Set(schema.entities.map((e) => e.id));
12269
+ const entityIds = new Set(schema.entities.map(resolveEntityId));
12008
12270
  const incoming = /* @__PURE__ */ new Map();
12009
12271
  for (const id of entityIds) {
12010
12272
  incoming.set(id, /* @__PURE__ */ new Set());
@@ -12025,7 +12287,7 @@ function computeDiagramLayout(schema) {
12025
12287
  }
12026
12288
  }
12027
12289
  if (queue.length === 0 && entityIds.size > 0) {
12028
- const firstId = schema.entities[0].id;
12290
+ const firstId = resolveEntityId(schema.entities[0]);
12029
12291
  rowAssignment.set(firstId, 0);
12030
12292
  assigned.add(firstId);
12031
12293
  queue.push(firstId);
@@ -12065,7 +12327,7 @@ function computeDiagramLayout(schema) {
12065
12327
  }
12066
12328
  const fieldCounts = /* @__PURE__ */ new Map();
12067
12329
  for (const entity of schema.entities) {
12068
- fieldCounts.set(entity.id, entity.fields?.length ?? 0);
12330
+ fieldCounts.set(resolveEntityId(entity), entity.fields?.length ?? 0);
12069
12331
  }
12070
12332
  const sortedRows = Array.from(rows.keys()).sort((a, b) => a - b);
12071
12333
  let currentY = 0;
@@ -12262,7 +12524,7 @@ function FolderIcon({ open }) {
12262
12524
  }
12263
12525
  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
12526
  }
12265
- function ChevronIcon({ open }) {
12527
+ function ChevronIcon2({ open }) {
12266
12528
  return /* @__PURE__ */ jsxRuntime.jsx(
12267
12529
  "svg",
12268
12530
  {
@@ -12444,7 +12706,7 @@ function TreeNode({ node, depth }) {
12444
12706
  ),
12445
12707
  style: { paddingLeft },
12446
12708
  children: [
12447
- isFolder && /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { open: isExpanded }),
12709
+ isFolder && /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon2, { open: isExpanded }),
12448
12710
  !isFolder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-3.5 shrink-0" }),
12449
12711
  showIcons && (node.icon ?? (isFolder ? /* @__PURE__ */ jsxRuntime.jsx(FolderIcon, { open: isExpanded }) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { ext: node.ext ?? node.label.split(".").pop() }))),
12450
12712
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: node.label })
@@ -12574,6 +12836,10 @@ var TreeNav = Object.assign(TreeNavRoot, {
12574
12836
  });
12575
12837
 
12576
12838
  exports.Accordion = Accordion;
12839
+ exports.AccordionPanel = AccordionPanel;
12840
+ exports.AccordionPanelContent = AccordionPanelContent;
12841
+ exports.AccordionPanelSection = AccordionPanelSection;
12842
+ exports.AccordionPanelTrigger = AccordionPanelTrigger;
12577
12843
  exports.Action = Action;
12578
12844
  exports.Autocomplete = Autocomplete;
12579
12845
  exports.Avatar = Avatar;
@@ -12652,6 +12918,8 @@ exports.sanitizeHtml = sanitizeHtml;
12652
12918
  exports.search = search;
12653
12919
  exports.skinTones = skinTones;
12654
12920
  exports.useAccordion = useAccordion;
12921
+ exports.useAccordionPanel = useAccordionPanel;
12922
+ exports.useAccordionSection = useAccordionSection;
12655
12923
  exports.useAnimation = useAnimation;
12656
12924
  exports.useCanvas = useCanvas;
12657
12925
  exports.useCarousel = useCarousel;