@opennsw/jsonforms-renderers 0.0.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { JSX } from 'react/jsx-runtime';
5
5
  import { LayoutProps } from '@jsonforms/core';
6
6
  import { OwnPropsOfControl } from '@jsonforms/core';
7
7
  import { RankedTester } from '@jsonforms/core';
8
+ import { ReactNode } from 'react';
8
9
  import { TesterContext } from '@jsonforms/core';
9
10
  import { UISchemaElement } from '@jsonforms/core';
10
11
 
@@ -28,10 +29,17 @@ export declare const DateControl: ({ data, handleChange, path, label, required,
28
29
 
29
30
  export declare const DateControlTester: RankedTester;
30
31
 
32
+ export declare interface DownloadUrlResult {
33
+ url: string;
34
+ expiresAt: number;
35
+ }
36
+
31
37
  export declare const FileControl: ComponentType<OwnPropsOfControl>;
32
38
 
33
39
  export declare const FileControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
34
40
 
41
+ export declare type GetDownloadUrl = (key: string) => Promise<DownloadUrlResult>;
42
+
35
43
  export declare const GroupLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: LayoutProps) => JSX.Element;
36
44
 
37
45
  export declare const GroupLayoutTester: RankedTester;
@@ -48,6 +56,8 @@ export declare const NumberControl: ({ data, handleChange, path, label, required
48
56
 
49
57
  export declare const NumberControlTester: RankedTester;
50
58
 
59
+ export declare type OpenFileInNewTab = (key: string) => Promise<void>;
60
+
51
61
  export declare const radixRenderers: ({
52
62
  tester: RankedTester;
53
63
  renderer: ComponentType<OwnPropsOfControl>;
@@ -64,6 +74,32 @@ export declare const TextControl: ({ data, handleChange, path, label, required,
64
74
 
65
75
  export declare const TextControlTester: RankedTester;
66
76
 
77
+ export declare interface UploadContextValue {
78
+ onUpload?: UploadHandler;
79
+ getDownloadUrl?: GetDownloadUrl;
80
+ openFileInNewTab?: OpenFileInNewTab;
81
+ }
82
+
83
+ export declare type UploadHandler = (file: File) => Promise<UploadResponse>;
84
+
85
+ export declare function UploadProvider({ children, onUpload, getDownloadUrl, openFileInNewTab, }: {
86
+ children: ReactNode;
87
+ onUpload?: UploadHandler;
88
+ getDownloadUrl?: GetDownloadUrl;
89
+ openFileInNewTab?: OpenFileInNewTab;
90
+ }): JSX.Element;
91
+
92
+ /**
93
+ * Contract for upload: applications provide the implementation;
94
+ * the renderer only calls these callbacks
95
+ */
96
+ export declare interface UploadResponse {
97
+ key: string;
98
+ name?: string;
99
+ }
100
+
101
+ export declare function useUpload(): UploadContextValue | null;
102
+
67
103
  export declare const VerticalLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: LayoutProps) => JSX.Element;
68
104
 
69
105
  export declare const VerticalLayoutTester: RankedTester;
@@ -1 +1 @@
1
- /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-green-600:oklch(62.7% .194 149.214);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.relative{position:relative}.mt-1{margin-top:calc(var(--spacing)*1)}.block{display:block}.flex{display:flex}.hidden{display:none}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.w-5{width:calc(var(--spacing)*5)}.w-8{width:calc(var(--spacing)*8)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-red-50{background-color:var(--color-red-50)}.p-2{padding:calc(var(--spacing)*2)}.p-6{padding:calc(var(--spacing)*6)}.text-center{text-align:center}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-blue-600{color:var(--color-blue-600)}.text-gray-400{color:var(--color-gray-400)}.text-green-600{color:var(--color-green-600)}.text-red-500{color:var(--color-red-500)}.opacity-60{opacity:.6}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:underline:hover{text-decoration-line:underline}}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-green-600:oklch(62.7% .194 149.214);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--spacing:.25rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.relative{position:relative}.mt-1{margin-top:calc(var(--spacing)*1)}.block{display:block}.flex{display:flex}.hidden{display:none}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.w-5{width:calc(var(--spacing)*5)}.w-8{width:calc(var(--spacing)*8)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-red-50{background-color:var(--color-red-50)}.p-2{padding:calc(var(--spacing)*2)}.p-6{padding:calc(var(--spacing)*6)}.text-center{text-align:center}.text-blue-600{color:var(--color-blue-600)}.text-gray-400{color:var(--color-gray-400)}.text-green-600{color:var(--color-green-600)}.text-red-500{color:var(--color-red-500)}.opacity-60{opacity:.6}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:text-red-600:hover{color:var(--color-red-600)}}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@jsonforms/core"),T=require("@jsonforms/react"),r=require("@radix-ui/themes"),z=require("react"),v=require("@radix-ui/react-icons"),B=({data:l,handleChange:u,path:t,label:p,required:h,errors:o,uischema:c,schema:i,enabled:x})=>{var g;const a=o.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[p," ",h&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{value:l||"",onChange:j=>u(t,j.target.value),disabled:!x,placeholder:(g=c.options)==null?void 0:g.placeholder,color:a?void 0:"red",id:t}),!a&&o!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:o}),i.description&&e.jsx(r.Text,{size:"1",color:"gray",children:i.description})]})})},D=s.rankWith(1,s.isStringControl),le=T.withJsonFormsControlProps(B),I=({data:l,handleChange:u,path:t,label:p,required:h,errors:o,uischema:c,schema:i,enabled:x})=>{var j;const a=o.length===0,g=m=>{if(m===""){u(t,void 0);return}const d=Number(m);isNaN(d)||u(t,d)};return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[p," ",h&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"number",value:l??"",onChange:m=>g(m.target.value),disabled:!x,placeholder:(j=c.options)==null?void 0:j.placeholder,color:a?void 0:"red",id:t}),!a&&o!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:o}),i.description&&e.jsx(r.Text,{size:"1",color:"gray",children:i.description})]})})},N=s.rankWith(2,s.or(s.isNumberControl,s.isIntegerControl)),ie=T.withJsonFormsControlProps(I),S=({data:l,handleChange:u,path:t,label:p,required:h,errors:o,schema:c,enabled:i})=>{const x=o.length===0;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.Checkbox,{checked:!!l,onCheckedChange:a=>u(t,a===!0),disabled:!i,id:t}),e.jsxs(r.Text,{as:"label",size:"2",htmlFor:t,children:[p," ",h&&"*"]})]}),!x&&e.jsx(r.Text,{color:"red",size:"1",className:"block mt-1",children:o}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",className:"block mt-1",children:c.description})]})},A=s.rankWith(2,s.isBooleanControl),ae=T.withJsonFormsControlProps(S),W=({data:l,handleChange:u,path:t,label:p,required:h,errors:o,schema:c,uischema:i,enabled:x})=>{var m;const a=o.length===0;let g=[];c.enum?g=c.enum.map(d=>({value:String(d),label:String(d)})):c.oneOf&&(g=c.oneOf.map(d=>({value:String(d.const),label:d.title||String(d.const)})));const j=l!==void 0?String(l):"";return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[p," ",h&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs(r.Select.Root,{value:j,onValueChange:d=>u(t,d),disabled:!x,children:[e.jsx(r.Select.Trigger,{placeholder:((m=i.options)==null?void 0:m.placeholder)||"Select an option",color:a?void 0:"red",id:t}),e.jsx(r.Select.Content,{children:g.map(d=>e.jsx(r.Select.Item,{value:d.value,children:d.label},d.value))})]}),!a&&o!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:o}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},P=s.rankWith(2,s.or(s.isEnumControl,s.isOneOfControl)),ce=T.withJsonFormsControlProps(W),V=({data:l,handleChange:u,path:t,label:p,required:h,errors:o,schema:c,enabled:i})=>{const x=o.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[p," ",h&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"date",value:l||"",onChange:a=>u(t,a.target.value),disabled:!i,color:x?void 0:"red",id:t}),!x&&o!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:o}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},J=s.rankWith(2,s.isDateControl),de=T.withJsonFormsControlProps(V),q=({uischema:l,schema:u,path:t,renderers:p,cells:h,enabled:o})=>{const i=l.elements;return e.jsx(r.Flex,{direction:"column",gap:"4",children:i.map((x,a)=>e.jsx(T.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:p,cells:h,enabled:o},`${t}-${a}`))})},E=s.rankWith(1,s.uiTypeIs("VerticalLayout")),H=({uischema:l,schema:u,path:t,renderers:p,cells:h,enabled:o})=>{const i=l.elements;return e.jsx(r.Flex,{direction:"row",gap:"4",children:i.map((x,a)=>e.jsx(r.Box,{style:{flex:1},children:e.jsx(T.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:p,cells:h,enabled:o})},`${t}-${a}`))})},O=s.rankWith(1,s.uiTypeIs("HorizontalLayout")),M=({uischema:l,schema:u,path:t,renderers:p,cells:h,enabled:o})=>{const c=l,i=c.elements;return e.jsxs(r.Card,{mb:"4",children:[c.label&&e.jsx(r.Heading,{size:"4",mb:"4",children:c.label}),e.jsx(r.Flex,{direction:"column",gap:"4",children:i.map((x,a)=>e.jsx(T.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:p,cells:h,enabled:o},`${t}-${a}`))})]})},G=s.rankWith(1,s.uiTypeIs("Group")),U=({uischema:l,schema:u,path:t,renderers:p,cells:h,enabled:o})=>{var j;const i=l.elements.filter(m=>m.type==="Category"),[x,a]=z.useState(((j=i[0])==null?void 0:j.label)||"");if(!i.length)return null;const g=i.find(m=>m.label===x)?x:i[0].label;return e.jsxs(r.Tabs.Root,{value:g,onValueChange:a,children:[e.jsx(r.Tabs.List,{children:i.map((m,d)=>e.jsx(r.Tabs.Trigger,{value:m.label,children:m.label},`${t}-${d}`))}),e.jsx(r.Box,{pt:"3",children:i.map((m,d)=>e.jsx(r.Tabs.Content,{value:m.label,children:e.jsx(r.Flex,{direction:"column",gap:"4",children:m.elements.map((F,f)=>e.jsx(T.JsonFormsDispatch,{uischema:F,schema:u,path:t,renderers:p,cells:h,enabled:o},`${t}-${d}-${f}`))})},`${t}-${d}`))})]})},K=s.rankWith(1,s.uiTypeIs("Categorization")),ue=({data:l,handleChange:u,path:t,label:p,required:h,uischema:o,enabled:c})=>{const[i,x]=z.useState(!1),[a,g]=z.useState(null),[j,m]=z.useState(null),d=z.useRef(null),F=(o==null?void 0:o.options)||{},f=F.maxSize||5*1024*1024,y=F.accept||"image/*,application/pdf",b=c!==!1,k=()=>j||(l?"Uploaded File":null),w=n=>{if(n.size>f){const C=(f/1048576).toFixed(0);g(`File size exceeds ${C}MB limit.`);return}const se=y.split(",").map(C=>C.trim()).some(C=>C.endsWith("/*")?n.type.startsWith(C.slice(0,-1)):C.startsWith(".")?n.name.toLowerCase().endsWith(C.toLowerCase()):n.type===C);if(y!=="*"&&!se&&!y.includes("*/*")){g(`Invalid file type. Accepted types: ${y}`);return}const L=new FileReader;L.onload=()=>{const C=L.result;u(t,C),m(n.name),g(null)},L.onerror=()=>{g("Failed to read file")},L.readAsDataURL(n)},R=n=>{n.preventDefault(),n.stopPropagation(),!(!b||l)&&(n.type==="dragenter"||n.type==="dragover"?x(!0):n.type==="dragleave"&&x(!1))},re=n=>{n.preventDefault(),n.stopPropagation(),x(!1),!(!b||l)&&n.dataTransfer.files&&n.dataTransfer.files[0]&&w(n.dataTransfer.files[0])},te=n=>{n.target.files&&n.target.files[0]&&w(n.target.files[0])},oe=()=>{b&&(u(t,null),m(null),g(null),d.current&&(d.current.value=""))},ne=n=>{var $;b&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),($=d.current)==null||$.click())};return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",mb:"1",className:"block",children:[p," ",h&&"*"]}),l?e.jsx(r.Card,{size:"2",variant:"surface",className:"relative group",children:e.jsxs(r.Flex,{align:"center",gap:"3",children:[e.jsx(r.Box,{className:"bg-blue-100 p-2 rounded text-blue-600",children:e.jsx(v.FileTextIcon,{width:"20",height:"20"})}),e.jsxs(r.Box,{style:{flex:1,overflow:"hidden"},children:[e.jsx(r.Text,{size:"2",weight:"bold",className:"block truncate",children:k()}),b?e.jsx(r.Text,{size:"1",color:"gray",children:"Ready to submit"}):e.jsx("a",{href:l,download:j||"document",className:"text-xs text-blue-600 hover:underline cursor-pointer",onClick:n=>n.stopPropagation(),children:"Download"})]}),e.jsxs(r.Flex,{align:"center",gap:"2",children:[e.jsx(v.CheckCircledIcon,{className:"text-green-600 w-5 h-5"}),b&&e.jsx(r.IconButton,{variant:"ghost",color:"gray",onClick:oe,className:"hover:text-red-600 transition-colors",children:e.jsx(v.Cross2Icon,{})})]})]})}):e.jsxs("div",{className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),i=require("@jsonforms/core"),C=require("@jsonforms/react"),r=require("@radix-ui/themes"),R=require("@radix-ui/react-icons"),Z=y.createContext(null);function Be({children:o,onUpload:l,getDownloadUrl:t,openFileInNewTab:u}){const p={onUpload:l,getDownloadUrl:t,openFileInNewTab:u};return e.jsx(Z.Provider,{value:p,children:o})}function Q(){return y.useContext(Z)}const Y=({data:o,handleChange:l,path:t,label:u,required:p,errors:c,uischema:a,schema:s,enabled:b})=>{var g;const d=c.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[u," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{value:o||"",onChange:f=>l(t,f.target.value),disabled:!b,placeholder:(g=a.options)==null?void 0:g.placeholder,color:d?void 0:"red",id:t}),!d&&c!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:c}),s.description&&e.jsx(r.Text,{size:"1",color:"gray",children:s.description})]})})},ee=i.rankWith(1,i.isStringControl),Se=C.withJsonFormsControlProps(Y),re=({data:o,handleChange:l,path:t,label:u,required:p,errors:c,uischema:a,schema:s,enabled:b})=>{var f;const d=c.length===0,g=x=>{if(x===""){l(t,void 0);return}const h=Number(x);isNaN(h)||l(t,h)};return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[u," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"number",value:o??"",onChange:x=>g(x.target.value),disabled:!b,placeholder:(f=a.options)==null?void 0:f.placeholder,color:d?void 0:"red",id:t}),!d&&c!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:c}),s.description&&e.jsx(r.Text,{size:"1",color:"gray",children:s.description})]})})},te=i.rankWith(2,i.or(i.isNumberControl,i.isIntegerControl)),Ae=C.withJsonFormsControlProps(re),oe=({data:o,handleChange:l,path:t,label:u,required:p,errors:c,schema:a,enabled:s})=>{const b=c.length===0;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.Checkbox,{checked:!!o,onCheckedChange:d=>l(t,d===!0),disabled:!s,id:t}),e.jsxs(r.Text,{as:"label",size:"2",htmlFor:t,children:[u," ",p&&"*"]})]}),!b&&e.jsx(r.Text,{color:"red",size:"1",className:"block mt-1",children:c}),a.description&&e.jsx(r.Text,{size:"1",color:"gray",className:"block mt-1",children:a.description})]})},ne=i.rankWith(2,i.isBooleanControl),Ie=C.withJsonFormsControlProps(oe),se=({data:o,handleChange:l,path:t,label:u,required:p,errors:c,schema:a,uischema:s,enabled:b})=>{var x;const d=c.length===0;let g=[];a.enum?g=a.enum.map(h=>({value:String(h),label:String(h)})):a.oneOf&&(g=a.oneOf.map(h=>({value:String(h.const),label:h.title||String(h.const)})));const f=o!==void 0?String(o):"";return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[u," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs(r.Select.Root,{value:f,onValueChange:h=>l(t,h),disabled:!b,children:[e.jsx(r.Select.Trigger,{placeholder:((x=s.options)==null?void 0:x.placeholder)||"Select an option",color:d?void 0:"red",id:t}),e.jsx(r.Select.Content,{children:g.map(h=>e.jsx(r.Select.Item,{value:h.value,children:h.label},h.value))})]}),!d&&c!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:c}),a.description&&e.jsx(r.Text,{size:"1",color:"gray",children:a.description})]})})},le=i.rankWith(2,i.or(i.isEnumControl,i.isOneOfControl)),$e=C.withJsonFormsControlProps(se),ie=({data:o,handleChange:l,path:t,label:u,required:p,errors:c,schema:a,enabled:s})=>{const b=c.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[u," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"date",value:o||"",onChange:d=>l(t,d.target.value),disabled:!s,color:b?void 0:"red",id:t}),!b&&c!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:c}),a.description&&e.jsx(r.Text,{size:"1",color:"gray",children:a.description})]})})},ce=i.rankWith(2,i.isDateControl),Ne=C.withJsonFormsControlProps(ie),ae=({uischema:o,schema:l,path:t,renderers:u,cells:p,enabled:c})=>{const s=o.elements;return e.jsx(r.Flex,{direction:"column",gap:"4",children:s.map((b,d)=>e.jsx(C.JsonFormsDispatch,{uischema:b,schema:l,path:t,renderers:u,cells:p,enabled:c},`${t}-${d}`))})},de=i.rankWith(1,i.uiTypeIs("VerticalLayout")),ue=({uischema:o,schema:l,path:t,renderers:u,cells:p,enabled:c})=>{const s=o.elements;return e.jsx(r.Flex,{direction:"row",gap:"4",children:s.map((b,d)=>e.jsx(r.Box,{style:{flex:1},children:e.jsx(C.JsonFormsDispatch,{uischema:b,schema:l,path:t,renderers:u,cells:p,enabled:c})},`${t}-${d}`))})},xe=i.rankWith(1,i.uiTypeIs("HorizontalLayout")),he=({uischema:o,schema:l,path:t,renderers:u,cells:p,enabled:c})=>{const a=o,s=a.elements;return e.jsxs(r.Card,{mb:"4",children:[a.label&&e.jsx(r.Heading,{size:"4",mb:"4",children:a.label}),e.jsx(r.Flex,{direction:"column",gap:"4",children:s.map((b,d)=>e.jsx(C.JsonFormsDispatch,{uischema:b,schema:l,path:t,renderers:u,cells:p,enabled:c},`${t}-${d}`))})]})},pe=i.rankWith(1,i.uiTypeIs("Group")),be=({uischema:o,schema:l,path:t,renderers:u,cells:p,enabled:c})=>{var f;const s=o.elements.filter(x=>x.type==="Category"),[b,d]=y.useState(((f=s[0])==null?void 0:f.label)||"");if(!s.length)return null;const g=s.find(x=>x.label===b)?b:s[0].label;return e.jsxs(r.Tabs.Root,{value:g,onValueChange:d,children:[e.jsx(r.Tabs.List,{children:s.map((x,h)=>e.jsx(r.Tabs.Trigger,{value:x.label,children:x.label},`${t}-${h}`))}),e.jsx(r.Box,{pt:"3",children:s.map((x,h)=>e.jsx(r.Tabs.Content,{value:x.label,children:e.jsx(r.Flex,{direction:"column",gap:"4",children:x.elements.map((S,F)=>e.jsx(C.JsonFormsDispatch,{uischema:S,schema:l,path:t,renderers:u,cells:p,enabled:c},`${t}-${h}-${F}`))})},`${t}-${h}`))})]})},me=i.rankWith(1,i.uiTypeIs("Categorization")),Pe=50,ge=60,U=new Map;function je(){const o=Date.now()/1e3;for(const[l,t]of U.entries())t.expiresAt<=o+ge&&U.delete(l)}function Ee(o,l,t){if(je(),U.size>=Pe){const u=U.keys().next().value;u!=null&&U.delete(u)}U.set(o,{url:l,expiresAt:t})}function P(o){return!o.startsWith("data:")}const We=({data:o,handleChange:l,path:t,label:u,required:p,uischema:c,enabled:a})=>{const s=Q(),[b,d]=y.useState(!1),[g,f]=y.useState(null),[x,h]=y.useState(null),[S,F]=y.useState(null),[E,z]=y.useState(!1),[w,k]=y.useState(null),[A,I]=y.useState(!1),[T,q]=y.useState(null),L=y.useRef(null);y.useEffect(()=>()=>{T&&URL.revokeObjectURL(T)},[T]);const H=(c==null?void 0:c.options)||{},$=H.maxSize||5*1024*1024,B=H.accept||"image/*,application/pdf",v=a!==!1,M=y.useCallback(async(n,m)=>{je();const D=U.get(n);if(D&&D.expiresAt>Date.now()/1e3+ge){F(D.url);return}if(!(s!=null&&s.getDownloadUrl)){k("Download not configured for this application.");return}z(!0),k(null);try{const j=await s.getDownloadUrl(n);if(m!=null&&m.aborted)return;F(j.url),Ee(n,j.url,j.expiresAt)}catch{if(m!=null&&m.aborted)return;k("Unable to reach the server.")}finally{m!=null&&m.aborted||z(!1)}},[s]);y.useEffect(()=>{if(o&&P(o)&&!T){const n=new AbortController;return M(o,n.signal),()=>n.abort()}T||(F(null),k(null))},[o,M,T]);const we=()=>x||(o?"Uploaded File":null),[Fe,W]=y.useState(null);y.useEffect(()=>{var n;if(o&&!P(o))try{const m=o.split(","),D=((n=m[0].match(/:(.*?);/))==null?void 0:n[1])||"application/octet-stream",j=m[1],O=atob(j),K=new Array(O.length);for(let N=0;N<O.length;N++)K[N]=O.charCodeAt(N);const Re=new Uint8Array(K),Ue=new Blob([Re],{type:D}),X=URL.createObjectURL(Ue);return W(X),()=>URL.revokeObjectURL(X)}catch(m){console.error("Failed to create blob URL:",m),W(null)}else W(null)},[o]);const _=T??(o&&P(o)?S:Fe),G=y.useCallback(async n=>{if(n.size>$){const j=($/1048576).toFixed(0);f(`File size exceeds ${j}MB limit.`);return}const D=B.split(",").map(j=>j.trim()).some(j=>j.endsWith("/*")?n.type.startsWith(j.slice(0,-1)):j.startsWith(".")?n.name.toLowerCase().endsWith(j.toLowerCase()):n.type===j);if(B!=="*"&&!D&&!B.includes("*/*")){f(`Invalid file type. Accepted types: ${B}`);return}if(s!=null&&s.onUpload){try{const j=await s.onUpload(n);q(URL.createObjectURL(n)),l(t,j.key),h(j.name??n.name),f(null)}catch{f("Upload failed."),L.current&&(L.current.value="")}return}f("Upload service not configured for this application.")},[B,s,$,t,l]),V=n=>{n.preventDefault(),n.stopPropagation(),!(!v||o)&&(n.type==="dragenter"||n.type==="dragover"?d(!0):n.type==="dragleave"&&d(!1))},ze=n=>{n.preventDefault(),n.stopPropagation(),d(!1),!(!v||o)&&n.dataTransfer.files&&n.dataTransfer.files[0]&&G(n.dataTransfer.files[0])},ke=n=>{n.target.files&&n.target.files[0]&&G(n.target.files[0])},Le=()=>{v&&(T&&(URL.revokeObjectURL(T),q(null)),l(t,null),h(null),f(null),L.current&&(L.current.value=""))},De=n=>{var m;v&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),(m=L.current)==null||m.click())};return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",mb:"1",className:"block",children:[u," ",p&&"*"]}),o?e.jsx(r.Card,{size:"2",variant:"surface",className:"relative group",children:e.jsxs(r.Flex,{align:"center",gap:"3",children:[e.jsx(r.Box,{className:"bg-blue-100 p-2 rounded text-blue-600",children:e.jsx(R.FileTextIcon,{width:"20",height:"20"})}),e.jsx(r.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(r.Text,{size:"2",weight:"bold",className:"block truncate",children:we()})}),e.jsxs(r.Flex,{align:"center",gap:"3",children:[E?e.jsx(r.Text,{size:"1",color:"gray",children:"Loading..."}):w?e.jsx(r.Text,{size:"1",color:"red",children:"Error"}):A?e.jsx(r.Text,{size:"1",color:"gray",children:"Opening…"}):!T&&(s!=null&&s.openFileInNewTab)&&o&&P(o)?e.jsx(r.Button,{variant:"soft",color:"blue",size:"1",onClick:n=>{n.stopPropagation();const m=s.openFileInNewTab;m&&(I(!0),m(o).finally(()=>I(!1)))},children:"View"}):e.jsx(r.Button,{variant:"soft",color:"blue",size:"1",asChild:!0,children:e.jsx("a",{href:_||"#",target:"_blank",rel:"noopener noreferrer",onClick:n=>{n.stopPropagation(),_||n.preventDefault()},children:"View"})}),e.jsxs(r.Flex,{align:"center",gap:"2",children:[e.jsx(R.CheckCircledIcon,{className:"text-green-600 w-5 h-5"}),v&&e.jsx(r.IconButton,{variant:"ghost",color:"gray",onClick:Le,className:"hover:text-red-600 transition-colors",children:e.jsx(R.Cross2Icon,{})})]})]})]})}):e.jsxs("div",{className:`
2
2
  border-2 border-dashed rounded-lg p-6 text-center transition-all duration-200 ease-in-out
3
- ${i?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"}
4
- ${a?"border-red-300 bg-red-50":""}
5
- ${b?"cursor-pointer":"opacity-60 cursor-not-allowed pointer-events-none"}
6
- `,onDragEnter:R,onDragLeave:R,onDragOver:R,onDrop:re,onClick:()=>{var n;return b&&((n=d.current)==null?void 0:n.click())},onKeyDown:ne,role:"button",tabIndex:b?0:-1,children:[e.jsx("input",{ref:d,type:"file",className:"hidden",accept:y,onChange:te,disabled:!b}),e.jsx(r.Flex,{direction:"column",align:"center",gap:"2",children:a?e.jsxs(e.Fragment,{children:[e.jsx(v.ExclamationTriangleIcon,{className:"w-8 h-8 text-red-500"}),e.jsx(r.Text,{size:"2",color:"red",weight:"medium",children:a}),e.jsx(r.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(v.UploadIcon,{className:"w-8 h-8 text-gray-400"}),e.jsx(r.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),e.jsxs(r.Text,{size:"1",color:"gray",children:["Max ",Math.round(f/(1024*1024)),"MB"]})]})})]})]})},_=T.withJsonFormsControlProps(ue),Q=s.rankWith(3,s.formatIs("data-url")),xe=({data:l,path:u,schema:t,uischema:p,enabled:h,visible:o,addItem:c,removeItems:i,rootSchema:x})=>{const a=t.items;if(o===!1||!a||typeof a!="object"||Array.isArray(a))return null;const g=a,j=Array.isArray(l)?l:[],m=t.title||"Array Items",d=()=>{const f=s.createDefaultValue(g,x);c&&c(u,f)},F=f=>{if(i){const y=i(u,[f]);y&&y()}};return e.jsx(r.Box,{mb:"6",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsx(r.Text,{as:"div",size:"4",weight:"bold",children:m}),j.length===0&&e.jsx(r.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:e.jsx(r.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),j.map((f,y)=>{var k;const b=`${u}.${y}`;return e.jsx(r.Card,{size:"3",variant:"surface",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsxs(r.Flex,{justify:"between",align:"center",children:[e.jsxs(r.Text,{size:"3",weight:"bold",children:["Item ",y+1]}),h&&e.jsxs(r.Button,{color:"red",variant:"soft",onClick:()=>F(y),title:"Remove item",children:[e.jsx(v.TrashIcon,{}),"Remove"]})]}),e.jsx(r.Box,{children:e.jsx(T.JsonFormsDispatch,{schema:g,uischema:((k=p.options)==null?void 0:k.detail)||{type:"VerticalLayout",elements:Object.keys(g.properties||{}).map(w=>({type:"Control",scope:`#/properties/${w}`}))},path:b,enabled:h,renderers:void 0,cells:void 0})})]})},b)}),h&&e.jsx(r.Box,{mt:"2",children:e.jsxs(r.Button,{variant:"surface",onClick:d,children:[e.jsx(v.PlusIcon,{}),"Add Item"]})})]})})},X=T.withJsonFormsArrayControlProps(xe),Y=s.rankWith(2,s.and(s.uiTypeIs("Control"),s.schemaTypeIs("array"))),Z=({uischema:l,visible:u})=>{const t=l;return u===!1?null:e.jsx(r.Box,{mb:"4",children:e.jsx(r.Heading,{size:"4",children:t.text})})},ee=s.rankWith(1,s.uiTypeIs("Label")),he=[{tester:D,renderer:le},{tester:N,renderer:ie},{tester:A,renderer:ae},{tester:P,renderer:ce},{tester:J,renderer:de},{tester:E,renderer:q},{tester:O,renderer:H},{tester:G,renderer:M},{tester:K,renderer:U},{tester:Q,renderer:_},{tester:Y,renderer:X},{tester:ee,renderer:Z}];exports.ArrayControl=X;exports.ArrayControlTester=Y;exports.BooleanControl=S;exports.BooleanControlTester=A;exports.CategorizationLayoutRenderer=U;exports.CategorizationLayoutTester=K;exports.DateControl=V;exports.DateControlTester=J;exports.FileControl=_;exports.FileControlTester=Q;exports.GroupLayoutRenderer=M;exports.GroupLayoutTester=G;exports.HorizontalLayoutRenderer=H;exports.HorizontalLayoutTester=O;exports.LabelRenderer=Z;exports.LabelTester=ee;exports.NumberControl=I;exports.NumberControlTester=N;exports.SelectControl=W;exports.SelectControlTester=P;exports.TextControl=B;exports.TextControlTester=D;exports.VerticalLayoutRenderer=q;exports.VerticalLayoutTester=E;exports.radixRenderers=he;
3
+ ${b?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"}
4
+ ${g?"border-red-300 bg-red-50":""}
5
+ ${v?"cursor-pointer":"opacity-60 cursor-not-allowed pointer-events-none"}
6
+ `,onDragEnter:V,onDragLeave:V,onDragOver:V,onDrop:ze,onClick:()=>{var n;return v&&((n=L.current)==null?void 0:n.click())},onKeyDown:De,role:"button",tabIndex:v?0:-1,children:[e.jsx("input",{ref:L,type:"file",style:{display:"none"},accept:B,onChange:ke,disabled:!v}),e.jsx(r.Flex,{direction:"column",align:"center",gap:"2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(R.ExclamationTriangleIcon,{className:"w-8 h-8 text-red-500"}),e.jsx(r.Text,{size:"2",color:"red",weight:"medium",children:g}),e.jsx(r.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(R.UploadIcon,{className:"w-8 h-8 text-gray-400"}),e.jsx(r.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),e.jsxs(r.Text,{size:"1",color:"gray",children:["Max ",Math.round($/(1024*1024)),"MB"]})]})})]})]})},fe=C.withJsonFormsControlProps(We),ye=i.rankWith(3,i.or(i.formatIs("data-url"),i.formatIs("file"))),Ve=({data:o,path:l,schema:t,uischema:u,enabled:p,visible:c,addItem:a,removeItems:s,rootSchema:b,arraySchema:d})=>{const g=d?t:t.items,f=d||t;if(c===!1||!g||typeof g!="object"||Array.isArray(g))return null;const x=g,h=Array.isArray(o)?o:[],S=f.title||"Array Items",F=()=>{const z=i.createDefaultValue(x,b);a&&a(l,z)()},E=z=>{if(s){const w=s(l,[z]);w&&w()}};return e.jsx(r.Box,{mb:"6",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsx(r.Text,{as:"div",size:"4",weight:"bold",children:S}),h.length===0&&e.jsx(r.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:e.jsx(r.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),h.map((z,w)=>{var A;const k=`${l}.${w}`;return e.jsx(r.Card,{size:"3",variant:"surface",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsxs(r.Flex,{justify:"between",align:"center",children:[e.jsxs(r.Text,{size:"3",weight:"bold",children:["Item ",w+1]}),p&&e.jsxs(r.Button,{type:"button",color:"red",variant:"soft",onClick:()=>E(w),title:"Remove item",children:[e.jsx(R.TrashIcon,{}),"Remove"]})]}),e.jsx(r.Box,{children:e.jsx(C.JsonFormsDispatch,{schema:x,uischema:((A=u.options)==null?void 0:A.detail)||(x.type==="object"||x.properties?{type:"VerticalLayout",elements:Object.keys(x.properties||{}).map(I=>({type:"Control",scope:`#/properties/${I}`}))}:{type:"Control",scope:"#"}),path:k,enabled:p,renderers:void 0,cells:void 0})})]})},k)}),p&&e.jsx(r.Box,{mt:"2",children:e.jsxs(r.Button,{type:"button",variant:"surface",onClick:F,children:[e.jsx(R.PlusIcon,{}),"Add Item"]})})]})})},J=C.withJsonFormsArrayControlProps(Ve),Ce=i.rankWith(3,i.isObjectArrayControl),Te=({uischema:o,visible:l})=>{const t=o;return l===!1?null:e.jsx(r.Box,{mb:"4",children:e.jsx(r.Heading,{size:"4",children:t.text})})},ve=i.rankWith(1,i.uiTypeIs("Label")),Oe=i.rankWith(3,i.isPrimitiveArrayControl),Je=[{tester:ee,renderer:Se},{tester:te,renderer:Ae},{tester:ne,renderer:Ie},{tester:le,renderer:$e},{tester:ce,renderer:Ne},{tester:de,renderer:ae},{tester:xe,renderer:ue},{tester:pe,renderer:he},{tester:me,renderer:be},{tester:ye,renderer:fe},{tester:Ce,renderer:J},{tester:Oe,renderer:J},{tester:ve,renderer:Te}];exports.ArrayControl=J;exports.ArrayControlTester=Ce;exports.BooleanControl=oe;exports.BooleanControlTester=ne;exports.CategorizationLayoutRenderer=be;exports.CategorizationLayoutTester=me;exports.DateControl=ie;exports.DateControlTester=ce;exports.FileControl=fe;exports.FileControlTester=ye;exports.GroupLayoutRenderer=he;exports.GroupLayoutTester=pe;exports.HorizontalLayoutRenderer=ue;exports.HorizontalLayoutTester=xe;exports.LabelRenderer=Te;exports.LabelTester=ve;exports.NumberControl=re;exports.NumberControlTester=te;exports.SelectControl=se;exports.SelectControlTester=le;exports.TextControl=Y;exports.TextControlTester=ee;exports.UploadProvider=Be;exports.VerticalLayoutRenderer=ae;exports.VerticalLayoutTester=de;exports.radixRenderers=Je;exports.useUpload=Q;
@@ -1,330 +1,427 @@
1
- import { jsx as e, jsxs as c, Fragment as O } from "react/jsx-runtime";
2
- import { rankWith as T, isStringControl as K, or as j, isNumberControl as U, isIntegerControl as _, isBooleanControl as Q, isEnumControl as X, isOneOfControl as Y, isDateControl as Z, uiTypeIs as F, formatIs as ee, createDefaultValue as re, and as te, schemaTypeIs as oe } from "@jsonforms/core";
3
- import { withJsonFormsControlProps as N, JsonFormsDispatch as k, withJsonFormsArrayControlProps as ne } from "@jsonforms/react";
4
- import { Box as f, Flex as C, Text as s, TextField as P, Checkbox as le, Select as L, Tabs as A, Card as E, Heading as M, IconButton as ie, Button as W } from "@radix-ui/themes";
5
- import { useState as S, useRef as ce } from "react";
6
- import { FileTextIcon as se, CheckCircledIcon as ae, Cross2Icon as de, ExclamationTriangleIcon as ue, UploadIcon as he, TrashIcon as me, PlusIcon as pe } from "@radix-ui/react-icons";
7
- const ge = ({ data: n, handleChange: u, path: r, label: g, required: m, errors: t, uischema: a, schema: l, enabled: h }) => {
8
- var b;
9
- const i = t.length === 0;
10
- return /* @__PURE__ */ e(f, { mb: "4", children: /* @__PURE__ */ c(C, { direction: "column", gap: "1", children: [
11
- /* @__PURE__ */ c(s, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
12
- g,
1
+ import { jsx as e, jsxs as s, Fragment as ce } from "react/jsx-runtime";
2
+ import { createContext as ze, useContext as Te, useState as L, useRef as Le, useEffect as X, useCallback as se } from "react";
3
+ import { rankWith as z, isStringControl as Ue, or as Z, isNumberControl as Ae, isIntegerControl as De, isBooleanControl as ke, isEnumControl as xe, isOneOfControl as Re, isDateControl as Fe, uiTypeIs as E, formatIs as ae, createDefaultValue as $e, isObjectArrayControl as Ne, isPrimitiveArrayControl as Ie } from "@jsonforms/core";
4
+ import { withJsonFormsControlProps as I, JsonFormsDispatch as B, withJsonFormsArrayControlProps as Se } from "@jsonforms/react";
5
+ import { Box as w, Flex as v, Text as c, TextField as Q, Checkbox as Ee, Select as H, Tabs as M, Card as Y, Heading as ue, Button as _, IconButton as Be } from "@radix-ui/themes";
6
+ import { FileTextIcon as Oe, CheckCircledIcon as Ve, Cross2Icon as Pe, ExclamationTriangleIcon as je, UploadIcon as He, TrashIcon as Me, PlusIcon as We } from "@radix-ui/react-icons";
7
+ const he = ze(null);
8
+ function $r({
9
+ children: t,
10
+ onUpload: l,
11
+ getDownloadUrl: r,
12
+ openFileInNewTab: u
13
+ }) {
14
+ const m = { onUpload: l, getDownloadUrl: r, openFileInNewTab: u };
15
+ return /* @__PURE__ */ e(he.Provider, { value: m, children: t });
16
+ }
17
+ function _e() {
18
+ return Te(he);
19
+ }
20
+ const qe = ({ data: t, handleChange: l, path: r, label: u, required: m, errors: i, uischema: a, schema: n, enabled: b }) => {
21
+ var f;
22
+ const d = i.length === 0;
23
+ return /* @__PURE__ */ e(w, { mb: "4", children: /* @__PURE__ */ s(v, { direction: "column", gap: "1", children: [
24
+ /* @__PURE__ */ s(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
25
+ u,
13
26
  " ",
14
- m && /* @__PURE__ */ e(s, { color: "red", children: "*" })
27
+ m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
15
28
  ] }),
16
29
  /* @__PURE__ */ e(
17
- P.Root,
30
+ Q.Root,
18
31
  {
19
- value: n || "",
20
- onChange: (y) => u(r, y.target.value),
21
- disabled: !h,
22
- placeholder: (b = a.options) == null ? void 0 : b.placeholder,
23
- color: i ? void 0 : "red",
32
+ value: t || "",
33
+ onChange: (C) => l(r, C.target.value),
34
+ disabled: !b,
35
+ placeholder: (f = a.options) == null ? void 0 : f.placeholder,
36
+ color: d ? void 0 : "red",
24
37
  id: r
25
38
  }
26
39
  ),
27
- !i && t !== "is a required property" && /* @__PURE__ */ e(s, { color: "red", size: "1", children: t }),
28
- l.description && /* @__PURE__ */ e(s, { size: "1", color: "gray", children: l.description })
40
+ !d && i !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: i }),
41
+ n.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: n.description })
29
42
  ] }) });
30
- }, be = T(
43
+ }, Ge = z(
31
44
  1,
32
- K
33
- ), ye = N(ge), fe = ({ data: n, handleChange: u, path: r, label: g, required: m, errors: t, uischema: a, schema: l, enabled: h }) => {
34
- var y;
35
- const i = t.length === 0, b = (p) => {
36
- if (p === "") {
37
- u(r, void 0);
45
+ Ue
46
+ ), Je = I(qe), Ke = ({ data: t, handleChange: l, path: r, label: u, required: m, errors: i, uischema: a, schema: n, enabled: b }) => {
47
+ var C;
48
+ const d = i.length === 0, f = (h) => {
49
+ if (h === "") {
50
+ l(r, void 0);
38
51
  return;
39
52
  }
40
- const d = Number(p);
41
- isNaN(d) || u(r, d);
53
+ const p = Number(h);
54
+ isNaN(p) || l(r, p);
42
55
  };
43
- return /* @__PURE__ */ e(f, { mb: "4", children: /* @__PURE__ */ c(C, { direction: "column", gap: "1", children: [
44
- /* @__PURE__ */ c(s, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
45
- g,
56
+ return /* @__PURE__ */ e(w, { mb: "4", children: /* @__PURE__ */ s(v, { direction: "column", gap: "1", children: [
57
+ /* @__PURE__ */ s(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
58
+ u,
46
59
  " ",
47
- m && /* @__PURE__ */ e(s, { color: "red", children: "*" })
60
+ m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
48
61
  ] }),
49
62
  /* @__PURE__ */ e(
50
- P.Root,
63
+ Q.Root,
51
64
  {
52
65
  type: "number",
53
- value: n ?? "",
54
- onChange: (p) => b(p.target.value),
55
- disabled: !h,
56
- placeholder: (y = a.options) == null ? void 0 : y.placeholder,
57
- color: i ? void 0 : "red",
66
+ value: t ?? "",
67
+ onChange: (h) => f(h.target.value),
68
+ disabled: !b,
69
+ placeholder: (C = a.options) == null ? void 0 : C.placeholder,
70
+ color: d ? void 0 : "red",
58
71
  id: r
59
72
  }
60
73
  ),
61
- !i && t !== "is a required property" && /* @__PURE__ */ e(s, { color: "red", size: "1", children: t }),
62
- l.description && /* @__PURE__ */ e(s, { size: "1", color: "gray", children: l.description })
74
+ !d && i !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: i }),
75
+ n.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: n.description })
63
76
  ] }) });
64
- }, Ce = T(
77
+ }, Xe = z(
65
78
  2,
66
- j(U, _)
67
- ), ve = N(fe), ze = ({ data: n, handleChange: u, path: r, label: g, required: m, errors: t, schema: a, enabled: l }) => {
68
- const h = t.length === 0;
69
- return /* @__PURE__ */ c(f, { mb: "4", children: [
70
- /* @__PURE__ */ c(C, { gap: "2", align: "center", children: [
79
+ Z(Ae, De)
80
+ ), Ze = I(Ke), Qe = ({ data: t, handleChange: l, path: r, label: u, required: m, errors: i, schema: a, enabled: n }) => {
81
+ const b = i.length === 0;
82
+ return /* @__PURE__ */ s(w, { mb: "4", children: [
83
+ /* @__PURE__ */ s(v, { gap: "2", align: "center", children: [
71
84
  /* @__PURE__ */ e(
72
- le,
85
+ Ee,
73
86
  {
74
- checked: !!n,
75
- onCheckedChange: (i) => u(r, i === !0),
76
- disabled: !l,
87
+ checked: !!t,
88
+ onCheckedChange: (d) => l(r, d === !0),
89
+ disabled: !n,
77
90
  id: r
78
91
  }
79
92
  ),
80
- /* @__PURE__ */ c(s, { as: "label", size: "2", htmlFor: r, children: [
81
- g,
93
+ /* @__PURE__ */ s(c, { as: "label", size: "2", htmlFor: r, children: [
94
+ u,
82
95
  " ",
83
96
  m && "*"
84
97
  ] })
85
98
  ] }),
86
- !h && /* @__PURE__ */ e(s, { color: "red", size: "1", className: "block mt-1", children: t }),
87
- a.description && /* @__PURE__ */ e(s, { size: "1", color: "gray", className: "block mt-1", children: a.description })
99
+ !b && /* @__PURE__ */ e(c, { color: "red", size: "1", className: "block mt-1", children: i }),
100
+ a.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", className: "block mt-1", children: a.description })
88
101
  ] });
89
- }, Te = T(
102
+ }, Ye = z(
90
103
  2,
91
- Q
92
- ), xe = N(ze), we = ({ data: n, handleChange: u, path: r, label: g, required: m, errors: t, schema: a, uischema: l, enabled: h }) => {
93
- var p;
94
- const i = t.length === 0;
95
- let b = [];
96
- a.enum ? b = a.enum.map((d) => ({ value: String(d), label: String(d) })) : a.oneOf && (b = a.oneOf.map((d) => ({
97
- value: String(d.const),
98
- label: d.title || String(d.const)
104
+ ke
105
+ ), er = I(Qe), rr = ({ data: t, handleChange: l, path: r, label: u, required: m, errors: i, schema: a, uischema: n, enabled: b }) => {
106
+ var h;
107
+ const d = i.length === 0;
108
+ let f = [];
109
+ a.enum ? f = a.enum.map((p) => ({ value: String(p), label: String(p) })) : a.oneOf && (f = a.oneOf.map((p) => ({
110
+ value: String(p.const),
111
+ label: p.title || String(p.const)
99
112
  })));
100
- const y = n !== void 0 ? String(n) : "";
101
- return /* @__PURE__ */ e(f, { mb: "4", children: /* @__PURE__ */ c(C, { direction: "column", gap: "1", children: [
102
- /* @__PURE__ */ c(s, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
103
- g,
113
+ const C = t !== void 0 ? String(t) : "";
114
+ return /* @__PURE__ */ e(w, { mb: "4", children: /* @__PURE__ */ s(v, { direction: "column", gap: "1", children: [
115
+ /* @__PURE__ */ s(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
116
+ u,
104
117
  " ",
105
- m && /* @__PURE__ */ e(s, { color: "red", children: "*" })
118
+ m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
106
119
  ] }),
107
- /* @__PURE__ */ c(
108
- L.Root,
120
+ /* @__PURE__ */ s(
121
+ H.Root,
109
122
  {
110
- value: y,
111
- onValueChange: (d) => u(r, d),
112
- disabled: !h,
123
+ value: C,
124
+ onValueChange: (p) => l(r, p),
125
+ disabled: !b,
113
126
  children: [
114
127
  /* @__PURE__ */ e(
115
- L.Trigger,
128
+ H.Trigger,
116
129
  {
117
- placeholder: ((p = l.options) == null ? void 0 : p.placeholder) || "Select an option",
118
- color: i ? void 0 : "red",
130
+ placeholder: ((h = n.options) == null ? void 0 : h.placeholder) || "Select an option",
131
+ color: d ? void 0 : "red",
119
132
  id: r
120
133
  }
121
134
  ),
122
- /* @__PURE__ */ e(L.Content, { children: b.map((d) => /* @__PURE__ */ e(L.Item, { value: d.value, children: d.label }, d.value)) })
135
+ /* @__PURE__ */ e(H.Content, { children: f.map((p) => /* @__PURE__ */ e(H.Item, { value: p.value, children: p.label }, p.value)) })
123
136
  ]
124
137
  }
125
138
  ),
126
- !i && t !== "is a required property" && /* @__PURE__ */ e(s, { color: "red", size: "1", children: t }),
127
- a.description && /* @__PURE__ */ e(s, { size: "1", color: "gray", children: a.description })
139
+ !d && i !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: i }),
140
+ a.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: a.description })
128
141
  ] }) });
129
- }, $e = T(
142
+ }, tr = z(
130
143
  2,
131
- j(X, Y)
132
- ), Fe = N(we), Ne = ({ data: n, handleChange: u, path: r, label: g, required: m, errors: t, schema: a, enabled: l }) => {
133
- const h = t.length === 0;
134
- return /* @__PURE__ */ e(f, { mb: "4", children: /* @__PURE__ */ c(C, { direction: "column", gap: "1", children: [
135
- /* @__PURE__ */ c(s, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
136
- g,
144
+ Z(xe, Re)
145
+ ), or = I(rr), nr = ({ data: t, handleChange: l, path: r, label: u, required: m, errors: i, schema: a, enabled: n }) => {
146
+ const b = i.length === 0;
147
+ return /* @__PURE__ */ e(w, { mb: "4", children: /* @__PURE__ */ s(v, { direction: "column", gap: "1", children: [
148
+ /* @__PURE__ */ s(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
149
+ u,
137
150
  " ",
138
- m && /* @__PURE__ */ e(s, { color: "red", children: "*" })
151
+ m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
139
152
  ] }),
140
153
  /* @__PURE__ */ e(
141
- P.Root,
154
+ Q.Root,
142
155
  {
143
156
  type: "date",
144
- value: n || "",
145
- onChange: (i) => u(r, i.target.value),
146
- disabled: !l,
147
- color: h ? void 0 : "red",
157
+ value: t || "",
158
+ onChange: (d) => l(r, d.target.value),
159
+ disabled: !n,
160
+ color: b ? void 0 : "red",
148
161
  id: r
149
162
  }
150
163
  ),
151
- !h && t !== "is a required property" && /* @__PURE__ */ e(s, { color: "red", size: "1", children: t }),
152
- a.description && /* @__PURE__ */ e(s, { size: "1", color: "gray", children: a.description })
164
+ !b && i !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: i }),
165
+ a.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: a.description })
153
166
  ] }) });
154
- }, ke = T(
167
+ }, lr = z(
155
168
  2,
156
- Z
157
- ), De = N(Ne), Ie = ({ uischema: n, schema: u, path: r, renderers: g, cells: m, enabled: t }) => {
158
- const l = n.elements;
159
- return /* @__PURE__ */ e(C, { direction: "column", gap: "4", children: l.map((h, i) => /* @__PURE__ */ e(
160
- k,
169
+ Fe
170
+ ), ir = I(nr), cr = ({ uischema: t, schema: l, path: r, renderers: u, cells: m, enabled: i }) => {
171
+ const n = t.elements;
172
+ return /* @__PURE__ */ e(v, { direction: "column", gap: "4", children: n.map((b, d) => /* @__PURE__ */ e(
173
+ B,
161
174
  {
162
- uischema: h,
163
- schema: u,
175
+ uischema: b,
176
+ schema: l,
164
177
  path: r,
165
- renderers: g,
178
+ renderers: u,
166
179
  cells: m,
167
- enabled: t
180
+ enabled: i
168
181
  },
169
- `${r}-${i}`
182
+ `${r}-${d}`
170
183
  )) });
171
- }, Re = T(1, F("VerticalLayout")), Le = ({ uischema: n, schema: u, path: r, renderers: g, cells: m, enabled: t }) => {
172
- const l = n.elements;
173
- return /* @__PURE__ */ e(C, { direction: "row", gap: "4", children: l.map((h, i) => /* @__PURE__ */ e(f, { style: { flex: 1 }, children: /* @__PURE__ */ e(
174
- k,
184
+ }, sr = z(1, E("VerticalLayout")), ar = ({ uischema: t, schema: l, path: r, renderers: u, cells: m, enabled: i }) => {
185
+ const n = t.elements;
186
+ return /* @__PURE__ */ e(v, { direction: "row", gap: "4", children: n.map((b, d) => /* @__PURE__ */ e(w, { style: { flex: 1 }, children: /* @__PURE__ */ e(
187
+ B,
175
188
  {
176
- uischema: h,
177
- schema: u,
189
+ uischema: b,
190
+ schema: l,
178
191
  path: r,
179
- renderers: g,
192
+ renderers: u,
180
193
  cells: m,
181
- enabled: t
194
+ enabled: i
182
195
  }
183
- ) }, `${r}-${i}`)) });
184
- }, Ae = T(1, F("HorizontalLayout")), Se = ({ uischema: n, schema: u, path: r, renderers: g, cells: m, enabled: t }) => {
185
- const a = n, l = a.elements;
186
- return /* @__PURE__ */ c(E, { mb: "4", children: [
187
- a.label && /* @__PURE__ */ e(M, { size: "4", mb: "4", children: a.label }),
188
- /* @__PURE__ */ e(C, { direction: "column", gap: "4", children: l.map((h, i) => /* @__PURE__ */ e(
189
- k,
196
+ ) }, `${r}-${d}`)) });
197
+ }, dr = z(1, E("HorizontalLayout")), ur = ({ uischema: t, schema: l, path: r, renderers: u, cells: m, enabled: i }) => {
198
+ const a = t, n = a.elements;
199
+ return /* @__PURE__ */ s(Y, { mb: "4", children: [
200
+ a.label && /* @__PURE__ */ e(ue, { size: "4", mb: "4", children: a.label }),
201
+ /* @__PURE__ */ e(v, { direction: "column", gap: "4", children: n.map((b, d) => /* @__PURE__ */ e(
202
+ B,
190
203
  {
191
- uischema: h,
192
- schema: u,
204
+ uischema: b,
205
+ schema: l,
193
206
  path: r,
194
- renderers: g,
207
+ renderers: u,
195
208
  cells: m,
196
- enabled: t
209
+ enabled: i
197
210
  },
198
- `${r}-${i}`
211
+ `${r}-${d}`
199
212
  )) })
200
213
  ] });
201
- }, Ve = T(1, F("Group")), Be = ({ uischema: n, schema: u, path: r, renderers: g, cells: m, enabled: t }) => {
202
- var y;
203
- const l = n.elements.filter((p) => p.type === "Category"), [h, i] = S(((y = l[0]) == null ? void 0 : y.label) || "");
204
- if (!l.length) return null;
205
- const b = l.find((p) => p.label === h) ? h : l[0].label;
206
- return /* @__PURE__ */ c(A.Root, { value: b, onValueChange: i, children: [
207
- /* @__PURE__ */ e(A.List, { children: l.map((p, d) => /* @__PURE__ */ e(A.Trigger, { value: p.label, children: p.label }, `${r}-${d}`)) }),
208
- /* @__PURE__ */ e(f, { pt: "3", children: l.map((p, d) => /* @__PURE__ */ e(A.Content, { value: p.label, children: /* @__PURE__ */ e(C, { direction: "column", gap: "4", children: p.elements.map(($, w) => /* @__PURE__ */ e(
209
- k,
214
+ }, hr = z(1, E("Group")), pr = ({ uischema: t, schema: l, path: r, renderers: u, cells: m, enabled: i }) => {
215
+ var C;
216
+ const n = t.elements.filter((h) => h.type === "Category"), [b, d] = L(((C = n[0]) == null ? void 0 : C.label) || "");
217
+ if (!n.length) return null;
218
+ const f = n.find((h) => h.label === b) ? b : n[0].label;
219
+ return /* @__PURE__ */ s(M.Root, { value: f, onValueChange: d, children: [
220
+ /* @__PURE__ */ e(M.List, { children: n.map((h, p) => /* @__PURE__ */ e(M.Trigger, { value: h.label, children: h.label }, `${r}-${p}`)) }),
221
+ /* @__PURE__ */ e(w, { pt: "3", children: n.map((h, p) => /* @__PURE__ */ e(M.Content, { value: h.label, children: /* @__PURE__ */ e(v, { direction: "column", gap: "4", children: h.elements.map((S, D) => /* @__PURE__ */ e(
222
+ B,
210
223
  {
211
- uischema: $,
212
- schema: u,
224
+ uischema: S,
225
+ schema: l,
213
226
  path: r,
214
- renderers: g,
227
+ renderers: u,
215
228
  cells: m,
216
- enabled: t
229
+ enabled: i
217
230
  },
218
- `${r}-${d}-${w}`
219
- )) }) }, `${r}-${d}`)) })
231
+ `${r}-${p}-${D}`
232
+ )) }) }, `${r}-${p}`)) })
220
233
  ] });
221
- }, Pe = T(1, F("Categorization")), Ee = ({ data: n, handleChange: u, path: r, label: g, required: m, uischema: t, enabled: a }) => {
222
- const [l, h] = S(!1), [i, b] = S(null), [y, p] = S(null), d = ce(null), $ = (t == null ? void 0 : t.options) || {}, w = $.maxSize || 5 * 1024 * 1024, z = $.accept || "image/*,application/pdf", v = a !== !1, D = () => y || (n ? "Uploaded File" : null), I = (o) => {
223
- if (o.size > w) {
224
- const x = (w / 1048576).toFixed(0);
225
- b(`File size exceeds ${x}MB limit.`);
234
+ }, mr = z(1, E("Categorization")), br = 50, pe = 60, $ = /* @__PURE__ */ new Map();
235
+ function me() {
236
+ const t = Date.now() / 1e3;
237
+ for (const [l, r] of $.entries())
238
+ r.expiresAt <= t + pe && $.delete(l);
239
+ }
240
+ function gr(t, l, r) {
241
+ if (me(), $.size >= br) {
242
+ const u = $.keys().next().value;
243
+ u != null && $.delete(u);
244
+ }
245
+ $.set(t, { url: l, expiresAt: r });
246
+ }
247
+ function W(t) {
248
+ return !t.startsWith("data:");
249
+ }
250
+ const fr = ({ data: t, handleChange: l, path: r, label: u, required: m, uischema: i, enabled: a }) => {
251
+ const n = _e(), [b, d] = L(!1), [f, C] = L(null), [h, p] = L(null), [S, D] = L(null), [q, k] = L(!1), [A, x] = L(null), [O, V] = L(!1), [T, ee] = L(null), R = Le(null);
252
+ X(() => () => {
253
+ T && URL.revokeObjectURL(T);
254
+ }, [T]);
255
+ const re = (i == null ? void 0 : i.options) || {}, P = re.maxSize || 5 * 1024 * 1024, N = re.accept || "image/*,application/pdf", U = a !== !1, te = se(async (o, g) => {
256
+ me();
257
+ const F = $.get(o);
258
+ if (F && F.expiresAt > Date.now() / 1e3 + pe) {
259
+ D(F.url);
226
260
  return;
227
261
  }
228
- const J = z.split(",").map((x) => x.trim()).some((x) => x.endsWith("/*") ? o.type.startsWith(x.slice(0, -1)) : x.startsWith(".") ? o.name.toLowerCase().endsWith(x.toLowerCase()) : o.type === x);
229
- if (z !== "*" && !J && !z.includes("*/*")) {
230
- b(`Invalid file type. Accepted types: ${z}`);
262
+ if (!(n != null && n.getDownloadUrl)) {
263
+ x("Download not configured for this application.");
231
264
  return;
232
265
  }
233
- const R = new FileReader();
234
- R.onload = () => {
235
- const x = R.result;
236
- u(r, x), p(o.name), b(null);
237
- }, R.onerror = () => {
238
- b("Failed to read file");
239
- }, R.readAsDataURL(o);
240
- }, V = (o) => {
241
- o.preventDefault(), o.stopPropagation(), !(!v || n) && (o.type === "dragenter" || o.type === "dragover" ? h(!0) : o.type === "dragleave" && h(!1));
242
- }, q = (o) => {
243
- o.preventDefault(), o.stopPropagation(), h(!1), !(!v || n) && o.dataTransfer.files && o.dataTransfer.files[0] && I(o.dataTransfer.files[0]);
244
- }, H = (o) => {
245
- o.target.files && o.target.files[0] && I(o.target.files[0]);
246
- }, G = () => {
247
- v && (u(r, null), p(null), b(null), d.current && (d.current.value = ""));
266
+ k(!0), x(null);
267
+ try {
268
+ const y = await n.getDownloadUrl(o);
269
+ if (g != null && g.aborted) return;
270
+ D(y.url), gr(o, y.url, y.expiresAt);
271
+ } catch {
272
+ if (g != null && g.aborted) return;
273
+ x("Unable to reach the server.");
274
+ } finally {
275
+ g != null && g.aborted || k(!1);
276
+ }
277
+ }, [n]);
278
+ X(() => {
279
+ if (t && W(t) && !T) {
280
+ const o = new AbortController();
281
+ return te(t, o.signal), () => o.abort();
282
+ }
283
+ T || (D(null), x(null));
284
+ }, [t, te, T]);
285
+ const be = () => h || (t ? "Uploaded File" : null), [ge, G] = L(null);
286
+ X(() => {
287
+ var o;
288
+ if (t && !W(t))
289
+ try {
290
+ const g = t.split(","), F = ((o = g[0].match(/:(.*?);/)) == null ? void 0 : o[1]) || "application/octet-stream", y = g[1], K = atob(y), le = new Array(K.length);
291
+ for (let j = 0; j < K.length; j++)
292
+ le[j] = K.charCodeAt(j);
293
+ const ve = new Uint8Array(le), we = new Blob([ve], { type: F }), ie = URL.createObjectURL(we);
294
+ return G(ie), () => URL.revokeObjectURL(ie);
295
+ } catch (g) {
296
+ console.error("Failed to create blob URL:", g), G(null);
297
+ }
298
+ else
299
+ G(null);
300
+ }, [t]);
301
+ const oe = T ?? (t && W(t) ? S : ge), ne = se(async (o) => {
302
+ if (o.size > P) {
303
+ const y = (P / 1048576).toFixed(0);
304
+ C(`File size exceeds ${y}MB limit.`);
305
+ return;
306
+ }
307
+ const F = N.split(",").map((y) => y.trim()).some((y) => y.endsWith("/*") ? o.type.startsWith(y.slice(0, -1)) : y.startsWith(".") ? o.name.toLowerCase().endsWith(y.toLowerCase()) : o.type === y);
308
+ if (N !== "*" && !F && !N.includes("*/*")) {
309
+ C(`Invalid file type. Accepted types: ${N}`);
310
+ return;
311
+ }
312
+ if (n != null && n.onUpload) {
313
+ try {
314
+ const y = await n.onUpload(o);
315
+ ee(URL.createObjectURL(o)), l(r, y.key), p(y.name ?? o.name), C(null);
316
+ } catch {
317
+ C("Upload failed."), R.current && (R.current.value = "");
318
+ }
319
+ return;
320
+ }
321
+ C("Upload service not configured for this application.");
322
+ }, [N, n, P, r, l]), J = (o) => {
323
+ o.preventDefault(), o.stopPropagation(), !(!U || t) && (o.type === "dragenter" || o.type === "dragover" ? d(!0) : o.type === "dragleave" && d(!1));
324
+ }, fe = (o) => {
325
+ o.preventDefault(), o.stopPropagation(), d(!1), !(!U || t) && o.dataTransfer.files && o.dataTransfer.files[0] && ne(o.dataTransfer.files[0]);
326
+ }, ye = (o) => {
327
+ o.target.files && o.target.files[0] && ne(o.target.files[0]);
328
+ }, Ce = () => {
329
+ U && (T && (URL.revokeObjectURL(T), ee(null)), l(r, null), p(null), C(null), R.current && (R.current.value = ""));
248
330
  };
249
- return /* @__PURE__ */ c(f, { mb: "4", children: [
250
- /* @__PURE__ */ c(s, { as: "label", size: "2", weight: "bold", mb: "1", className: "block", children: [
251
- g,
331
+ return /* @__PURE__ */ s(w, { mb: "4", children: [
332
+ /* @__PURE__ */ s(c, { as: "label", size: "2", weight: "bold", mb: "1", className: "block", children: [
333
+ u,
252
334
  " ",
253
335
  m && "*"
254
336
  ] }),
255
- n ? /* @__PURE__ */ e(E, { size: "2", variant: "surface", className: "relative group", children: /* @__PURE__ */ c(C, { align: "center", gap: "3", children: [
256
- /* @__PURE__ */ e(f, { className: "bg-blue-100 p-2 rounded text-blue-600", children: /* @__PURE__ */ e(se, { width: "20", height: "20" }) }),
257
- /* @__PURE__ */ c(f, { style: { flex: 1, overflow: "hidden" }, children: [
258
- /* @__PURE__ */ e(s, { size: "2", weight: "bold", className: "block truncate", children: D() }),
259
- v ? /* @__PURE__ */ e(s, { size: "1", color: "gray", children: "Ready to submit" }) : /* @__PURE__ */ e(
260
- "a",
337
+ t ? /* @__PURE__ */ e(Y, { size: "2", variant: "surface", className: "relative group", children: /* @__PURE__ */ s(v, { align: "center", gap: "3", children: [
338
+ /* @__PURE__ */ e(w, { className: "bg-blue-100 p-2 rounded text-blue-600", children: /* @__PURE__ */ e(Oe, { width: "20", height: "20" }) }),
339
+ /* @__PURE__ */ e(w, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(c, { size: "2", weight: "bold", className: "block truncate", children: be() }) }),
340
+ /* @__PURE__ */ s(v, { align: "center", gap: "3", children: [
341
+ q ? /* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Loading..." }) : A ? /* @__PURE__ */ e(c, { size: "1", color: "red", children: "Error" }) : O ? /* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Opening…" }) : !T && (n != null && n.openFileInNewTab) && t && W(t) ? /* @__PURE__ */ e(
342
+ _,
261
343
  {
262
- href: n,
263
- download: y || "document",
264
- className: "text-xs text-blue-600 hover:underline cursor-pointer",
265
- onClick: (o) => o.stopPropagation(),
266
- children: "Download"
344
+ variant: "soft",
345
+ color: "blue",
346
+ size: "1",
347
+ onClick: (o) => {
348
+ o.stopPropagation();
349
+ const g = n.openFileInNewTab;
350
+ g && (V(!0), g(t).finally(() => V(!1)));
351
+ },
352
+ children: "View"
267
353
  }
268
- )
269
- ] }),
270
- /* @__PURE__ */ c(C, { align: "center", gap: "2", children: [
271
- /* @__PURE__ */ e(ae, { className: "text-green-600 w-5 h-5" }),
272
- v && /* @__PURE__ */ e(
273
- ie,
354
+ ) : /* @__PURE__ */ e(_, { variant: "soft", color: "blue", size: "1", asChild: !0, children: /* @__PURE__ */ e(
355
+ "a",
274
356
  {
275
- variant: "ghost",
276
- color: "gray",
277
- onClick: G,
278
- className: "hover:text-red-600 transition-colors",
279
- children: /* @__PURE__ */ e(de, {})
357
+ href: oe || "#",
358
+ target: "_blank",
359
+ rel: "noopener noreferrer",
360
+ onClick: (o) => {
361
+ o.stopPropagation(), oe || o.preventDefault();
362
+ },
363
+ children: "View"
280
364
  }
281
- )
365
+ ) }),
366
+ /* @__PURE__ */ s(v, { align: "center", gap: "2", children: [
367
+ /* @__PURE__ */ e(Ve, { className: "text-green-600 w-5 h-5" }),
368
+ U && /* @__PURE__ */ e(
369
+ Be,
370
+ {
371
+ variant: "ghost",
372
+ color: "gray",
373
+ onClick: Ce,
374
+ className: "hover:text-red-600 transition-colors",
375
+ children: /* @__PURE__ */ e(Pe, {})
376
+ }
377
+ )
378
+ ] })
282
379
  ] })
283
- ] }) }) : /* @__PURE__ */ c(
380
+ ] }) }) : /* @__PURE__ */ s(
284
381
  "div",
285
382
  {
286
383
  className: `
287
384
  border-2 border-dashed rounded-lg p-6 text-center transition-all duration-200 ease-in-out
288
- ${l ? "border-blue-500 bg-blue-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"}
289
- ${i ? "border-red-300 bg-red-50" : ""}
290
- ${v ? "cursor-pointer" : "opacity-60 cursor-not-allowed pointer-events-none"}
385
+ ${b ? "border-blue-500 bg-blue-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"}
386
+ ${f ? "border-red-300 bg-red-50" : ""}
387
+ ${U ? "cursor-pointer" : "opacity-60 cursor-not-allowed pointer-events-none"}
291
388
  `,
292
- onDragEnter: V,
293
- onDragLeave: V,
294
- onDragOver: V,
295
- onDrop: q,
389
+ onDragEnter: J,
390
+ onDragLeave: J,
391
+ onDragOver: J,
392
+ onDrop: fe,
296
393
  onClick: () => {
297
394
  var o;
298
- return v && ((o = d.current) == null ? void 0 : o.click());
395
+ return U && ((o = R.current) == null ? void 0 : o.click());
299
396
  },
300
397
  onKeyDown: (o) => {
301
- var B;
302
- v && (o.key === "Enter" || o.key === " ") && (o.preventDefault(), (B = d.current) == null || B.click());
398
+ var g;
399
+ U && (o.key === "Enter" || o.key === " ") && (o.preventDefault(), (g = R.current) == null || g.click());
303
400
  },
304
401
  role: "button",
305
- tabIndex: v ? 0 : -1,
402
+ tabIndex: U ? 0 : -1,
306
403
  children: [
307
404
  /* @__PURE__ */ e(
308
405
  "input",
309
406
  {
310
- ref: d,
407
+ ref: R,
311
408
  type: "file",
312
- className: "hidden",
313
- accept: z,
314
- onChange: H,
315
- disabled: !v
409
+ style: { display: "none" },
410
+ accept: N,
411
+ onChange: ye,
412
+ disabled: !U
316
413
  }
317
414
  ),
318
- /* @__PURE__ */ e(C, { direction: "column", align: "center", gap: "2", children: i ? /* @__PURE__ */ c(O, { children: [
319
- /* @__PURE__ */ e(ue, { className: "w-8 h-8 text-red-500" }),
320
- /* @__PURE__ */ e(s, { size: "2", color: "red", weight: "medium", children: i }),
321
- /* @__PURE__ */ e(s, { size: "1", color: "gray", children: "Click to try again" })
322
- ] }) : /* @__PURE__ */ c(O, { children: [
323
- /* @__PURE__ */ e(he, { className: "w-8 h-8 text-gray-400" }),
324
- /* @__PURE__ */ e(s, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
325
- /* @__PURE__ */ c(s, { size: "1", color: "gray", children: [
415
+ /* @__PURE__ */ e(v, { direction: "column", align: "center", gap: "2", children: f ? /* @__PURE__ */ s(ce, { children: [
416
+ /* @__PURE__ */ e(je, { className: "w-8 h-8 text-red-500" }),
417
+ /* @__PURE__ */ e(c, { size: "2", color: "red", weight: "medium", children: f }),
418
+ /* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Click to try again" })
419
+ ] }) : /* @__PURE__ */ s(ce, { children: [
420
+ /* @__PURE__ */ e(He, { className: "w-8 h-8 text-gray-400" }),
421
+ /* @__PURE__ */ e(c, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
422
+ /* @__PURE__ */ s(c, { size: "1", color: "gray", children: [
326
423
  "Max ",
327
- Math.round(w / (1024 * 1024)),
424
+ Math.round(P / (1024 * 1024)),
328
425
  "MB"
329
426
  ] })
330
427
  ] }) })
@@ -332,136 +429,148 @@ const ge = ({ data: n, handleChange: u, path: r, label: g, required: m, errors:
332
429
  }
333
430
  )
334
431
  ] });
335
- }, Oe = N(Ee), We = T(
432
+ }, yr = I(fr), Cr = z(
336
433
  3,
337
434
  // Rank
338
- ee("data-url")
339
- ), je = ({
340
- data: n,
341
- path: u,
435
+ Z(ae("data-url"), ae("file"))
436
+ ), vr = ({
437
+ data: t,
438
+ path: l,
342
439
  schema: r,
343
- uischema: g,
440
+ uischema: u,
344
441
  enabled: m,
345
- visible: t,
442
+ visible: i,
346
443
  addItem: a,
347
- removeItems: l,
348
- rootSchema: h
444
+ removeItems: n,
445
+ rootSchema: b,
446
+ arraySchema: d
349
447
  }) => {
350
- const i = r.items;
351
- if (t === !1 || !i || typeof i != "object" || Array.isArray(i))
448
+ const f = d ? r : r.items, C = d || r;
449
+ if (i === !1 || !f || typeof f != "object" || Array.isArray(f))
352
450
  return null;
353
- const b = i, y = Array.isArray(n) ? n : [], p = r.title || "Array Items", d = () => {
354
- const w = re(b, h);
355
- a && a(u, w);
356
- }, $ = (w) => {
357
- if (l) {
358
- const z = l(u, [w]);
359
- z && z();
451
+ const h = f, p = Array.isArray(t) ? t : [], S = C.title || "Array Items", D = () => {
452
+ const k = $e(h, b);
453
+ a && a(l, k)();
454
+ }, q = (k) => {
455
+ if (n) {
456
+ const A = n(l, [k]);
457
+ A && A();
360
458
  }
361
459
  };
362
- return /* @__PURE__ */ e(f, { mb: "6", children: /* @__PURE__ */ c(C, { direction: "column", gap: "4", children: [
363
- /* @__PURE__ */ e(s, { as: "div", size: "4", weight: "bold", children: p }),
364
- y.length === 0 && /* @__PURE__ */ e(f, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ e(s, { size: "2", color: "gray", children: "No items have been added yet." }) }),
365
- y.map((w, z) => {
366
- var D;
367
- const v = `${u}.${z}`;
368
- return /* @__PURE__ */ e(E, { size: "3", variant: "surface", children: /* @__PURE__ */ c(C, { direction: "column", gap: "4", children: [
369
- /* @__PURE__ */ c(C, { justify: "between", align: "center", children: [
370
- /* @__PURE__ */ c(s, { size: "3", weight: "bold", children: [
460
+ return /* @__PURE__ */ e(w, { mb: "6", children: /* @__PURE__ */ s(v, { direction: "column", gap: "4", children: [
461
+ /* @__PURE__ */ e(c, { as: "div", size: "4", weight: "bold", children: S }),
462
+ p.length === 0 && /* @__PURE__ */ e(w, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: "No items have been added yet." }) }),
463
+ p.map((k, A) => {
464
+ var O;
465
+ const x = `${l}.${A}`;
466
+ return /* @__PURE__ */ e(Y, { size: "3", variant: "surface", children: /* @__PURE__ */ s(v, { direction: "column", gap: "4", children: [
467
+ /* @__PURE__ */ s(v, { justify: "between", align: "center", children: [
468
+ /* @__PURE__ */ s(c, { size: "3", weight: "bold", children: [
371
469
  "Item ",
372
- z + 1
470
+ A + 1
373
471
  ] }),
374
- m && /* @__PURE__ */ c(
375
- W,
472
+ m && /* @__PURE__ */ s(
473
+ _,
376
474
  {
475
+ type: "button",
377
476
  color: "red",
378
477
  variant: "soft",
379
- onClick: () => $(z),
478
+ onClick: () => q(A),
380
479
  title: "Remove item",
381
480
  children: [
382
- /* @__PURE__ */ e(me, {}),
481
+ /* @__PURE__ */ e(Me, {}),
383
482
  "Remove"
384
483
  ]
385
484
  }
386
485
  )
387
486
  ] }),
388
- /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
389
- k,
487
+ /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
488
+ B,
390
489
  {
391
- schema: b,
392
- uischema: ((D = g.options) == null ? void 0 : D.detail) || {
490
+ schema: h,
491
+ uischema: ((O = u.options) == null ? void 0 : O.detail) || (h.type === "object" || h.properties ? {
393
492
  type: "VerticalLayout",
394
493
  elements: Object.keys(
395
- b.properties || {}
396
- ).map((I) => ({
494
+ h.properties || {}
495
+ ).map((V) => ({
397
496
  type: "Control",
398
- scope: `#/properties/${I}`
497
+ scope: `#/properties/${V}`
399
498
  }))
400
- },
401
- path: v,
499
+ } : {
500
+ type: "Control",
501
+ scope: "#"
502
+ }),
503
+ path: x,
402
504
  enabled: m,
403
505
  renderers: void 0,
404
506
  cells: void 0
405
507
  }
406
508
  ) })
407
- ] }) }, v);
509
+ ] }) }, x);
408
510
  }),
409
- m && /* @__PURE__ */ e(f, { mt: "2", children: /* @__PURE__ */ c(
410
- W,
511
+ m && /* @__PURE__ */ e(w, { mt: "2", children: /* @__PURE__ */ s(
512
+ _,
411
513
  {
514
+ type: "button",
412
515
  variant: "surface",
413
- onClick: d,
516
+ onClick: D,
414
517
  children: [
415
- /* @__PURE__ */ e(pe, {}),
518
+ /* @__PURE__ */ e(We, {}),
416
519
  "Add Item"
417
520
  ]
418
521
  }
419
522
  ) })
420
523
  ] }) });
421
- }, Me = ne(je), qe = T(
422
- 2,
423
- te(F("Control"), oe("array"))
424
- ), He = ({ uischema: n, visible: u }) => {
425
- const r = n;
426
- return u === !1 ? null : /* @__PURE__ */ e(f, { mb: "4", children: /* @__PURE__ */ e(M, { size: "4", children: r.text }) });
427
- }, Ge = T(1, F("Label")), Ze = [
428
- { tester: be, renderer: ye },
429
- { tester: Ce, renderer: ve },
430
- { tester: Te, renderer: xe },
431
- { tester: $e, renderer: Fe },
432
- { tester: ke, renderer: De },
433
- { tester: Re, renderer: Ie },
434
- { tester: Ae, renderer: Le },
435
- { tester: Ve, renderer: Se },
436
- { tester: Pe, renderer: Be },
437
- { tester: We, renderer: Oe },
438
- { tester: qe, renderer: Me },
439
- { tester: Ge, renderer: He }
524
+ }, de = Se(vr), wr = z(
525
+ 3,
526
+ Ne
527
+ ), zr = ({ uischema: t, visible: l }) => {
528
+ const r = t;
529
+ return l === !1 ? null : /* @__PURE__ */ e(w, { mb: "4", children: /* @__PURE__ */ e(ue, { size: "4", children: r.text }) });
530
+ }, Tr = z(1, E("Label")), Lr = z(
531
+ 3,
532
+ Ie
533
+ ), Nr = [
534
+ { tester: Ge, renderer: Je },
535
+ { tester: Xe, renderer: Ze },
536
+ { tester: Ye, renderer: er },
537
+ { tester: tr, renderer: or },
538
+ { tester: lr, renderer: ir },
539
+ { tester: sr, renderer: cr },
540
+ { tester: dr, renderer: ar },
541
+ { tester: hr, renderer: ur },
542
+ { tester: mr, renderer: pr },
543
+ { tester: Cr, renderer: yr },
544
+ { tester: wr, renderer: de },
545
+ { tester: Lr, renderer: de },
546
+ { tester: Tr, renderer: zr }
440
547
  ];
441
548
  export {
442
- Me as ArrayControl,
443
- qe as ArrayControlTester,
444
- ze as BooleanControl,
445
- Te as BooleanControlTester,
446
- Be as CategorizationLayoutRenderer,
447
- Pe as CategorizationLayoutTester,
448
- Ne as DateControl,
449
- ke as DateControlTester,
450
- Oe as FileControl,
451
- We as FileControlTester,
452
- Se as GroupLayoutRenderer,
453
- Ve as GroupLayoutTester,
454
- Le as HorizontalLayoutRenderer,
455
- Ae as HorizontalLayoutTester,
456
- He as LabelRenderer,
457
- Ge as LabelTester,
458
- fe as NumberControl,
459
- Ce as NumberControlTester,
460
- we as SelectControl,
461
- $e as SelectControlTester,
462
- ge as TextControl,
463
- be as TextControlTester,
464
- Ie as VerticalLayoutRenderer,
465
- Re as VerticalLayoutTester,
466
- Ze as radixRenderers
549
+ de as ArrayControl,
550
+ wr as ArrayControlTester,
551
+ Qe as BooleanControl,
552
+ Ye as BooleanControlTester,
553
+ pr as CategorizationLayoutRenderer,
554
+ mr as CategorizationLayoutTester,
555
+ nr as DateControl,
556
+ lr as DateControlTester,
557
+ yr as FileControl,
558
+ Cr as FileControlTester,
559
+ ur as GroupLayoutRenderer,
560
+ hr as GroupLayoutTester,
561
+ ar as HorizontalLayoutRenderer,
562
+ dr as HorizontalLayoutTester,
563
+ zr as LabelRenderer,
564
+ Tr as LabelTester,
565
+ Ke as NumberControl,
566
+ Xe as NumberControlTester,
567
+ rr as SelectControl,
568
+ tr as SelectControlTester,
569
+ qe as TextControl,
570
+ Ge as TextControlTester,
571
+ $r as UploadProvider,
572
+ cr as VerticalLayoutRenderer,
573
+ sr as VerticalLayoutTester,
574
+ Nr as radixRenderers,
575
+ _e as useUpload
467
576
  };
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
1
  {
2
- "name": "@opennsw/jsonforms-renderers",
3
- "version": "0.0.2",
4
- "type": "module",
5
- "main": "dist/renderers.cjs.js",
6
- "module": "dist/renderers.es.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/renderers.es.js",
12
- "require": "./dist/renderers.cjs.js"
2
+ "name": "@opennsw/jsonforms-renderers",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "dist/renderers.cjs.js",
6
+ "module": "dist/renderers.es.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/renderers.es.js",
12
+ "require": "./dist/renderers.cjs.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -b && vite build",
21
+ "lint": "eslint .",
22
+ "type-check": "tsc -b --noEmit"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^19.2.0",
26
+ "react-dom": "^19.2.0",
27
+ "@jsonforms/core": "^3.2.1",
28
+ "@jsonforms/react": "^3.2.1",
29
+ "@radix-ui/themes": "^3.2.1",
30
+ "@radix-ui/react-icons": "^1.3.2"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^22.10.2",
34
+ "@types/react": "^19.2.5",
35
+ "@types/react-dom": "^19.2.3",
36
+ "@vitejs/plugin-react": "^5.1.1",
37
+ "typescript": "~5.7.2",
38
+ "vite": "^6.2.0",
39
+ "vite-plugin-dts": "^4.5.0",
40
+ "tailwindcss": "^4.0.9",
41
+ "@tailwindcss/vite": "^4.0.9"
13
42
  }
14
- },
15
- "files": [
16
- "dist",
17
- "README.md"
18
- ],
19
- "peerDependencies": {
20
- "react": "^19.2.0",
21
- "react-dom": "^19.2.0",
22
- "@jsonforms/core": "^3.2.1",
23
- "@jsonforms/react": "^3.2.1",
24
- "@radix-ui/themes": "^3.2.1",
25
- "@radix-ui/react-icons": "^1.3.2"
26
- },
27
- "devDependencies": {
28
- "@types/node": "^22.10.2",
29
- "@types/react": "^19.2.5",
30
- "@types/react-dom": "^19.2.3",
31
- "@vitejs/plugin-react": "^5.1.1",
32
- "typescript": "~5.7.2",
33
- "vite": "^6.2.0",
34
- "vite-plugin-dts": "^4.5.0",
35
- "tailwindcss": "^4.0.9",
36
- "@tailwindcss/vite": "^4.0.9"
37
- },
38
- "scripts": {
39
- "build": "tsc -b && vite build",
40
- "lint": "eslint .",
41
- "type-check": "tsc -b --noEmit"
42
- }
43
43
  }