@opennsw/jsonforms-renderers 0.3.1 → 0.4.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/README.md +3 -3
- package/dist/index.d.ts +33 -3
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +711 -783
- package/package.json +29 -9
package/README.md
CHANGED
|
@@ -37,14 +37,14 @@ To use the custom renderers, register them inside the `<JsonForms>` provider in
|
|
|
37
37
|
|
|
38
38
|
```tsx
|
|
39
39
|
import { JsonForms } from '@jsonforms/react'
|
|
40
|
-
import {
|
|
41
|
-
materialCells, // fallback cells
|
|
40
|
+
import {
|
|
41
|
+
materialCells, // fallback cells
|
|
42
42
|
} from '@jsonforms/material-renderers' // or other fallbacks
|
|
43
43
|
import openNswRenderers from '@opennsw/jsonforms-renderers'
|
|
44
44
|
|
|
45
45
|
function App() {
|
|
46
46
|
const [data, setData] = useState({})
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
return (
|
|
49
49
|
<JsonForms
|
|
50
50
|
schema={schema}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { ControlProps } from '@jsonforms/core';
|
|
3
3
|
import { JsonSchema } from '@jsonforms/core';
|
|
4
|
-
import { JSX } from 'react
|
|
4
|
+
import { JSX } from 'react';
|
|
5
5
|
import { LayoutProps } from '@jsonforms/core';
|
|
6
6
|
import { OwnPropsOfControl } from '@jsonforms/core';
|
|
7
7
|
import { RankedTester } from '@jsonforms/core';
|
|
@@ -41,8 +41,6 @@ export declare const FileControlTester: (uischema: UISchemaElement, schema: Json
|
|
|
41
41
|
|
|
42
42
|
export declare type GetDownloadUrl = (key: string) => Promise<DownloadUrlResult>;
|
|
43
43
|
|
|
44
|
-
export declare const getErrorMessage: (errors: string, label?: string) => string;
|
|
45
|
-
|
|
46
44
|
export declare const GroupLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled, visible, }: LayoutProps) => JSX.Element | null;
|
|
47
45
|
|
|
48
46
|
export declare const GroupLayoutTester: RankedTester;
|
|
@@ -71,6 +69,36 @@ export declare const radixRenderers: ({
|
|
|
71
69
|
renderer: ({ uischema, schema, path, renderers, cells, enabled, visible, }: CategorizationLayoutProps) => JSX.Element | null;
|
|
72
70
|
})[];
|
|
73
71
|
|
|
72
|
+
export declare interface SearchOption {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare interface SearchResult {
|
|
78
|
+
options: SearchOption[];
|
|
79
|
+
nextCursor?: unknown;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export declare const SearchSelectControl: React_2.ComponentType<OwnPropsOfControl>;
|
|
83
|
+
|
|
84
|
+
export declare const SearchSelectControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
85
|
+
|
|
86
|
+
export declare interface SearchService {
|
|
87
|
+
search(args: {
|
|
88
|
+
query: string;
|
|
89
|
+
cursor?: unknown;
|
|
90
|
+
signal: AbortSignal;
|
|
91
|
+
}): Promise<SearchResult>;
|
|
92
|
+
resolve?(value: string): Promise<SearchOption | undefined>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare function SearchServiceProvider({ children, services, }: {
|
|
96
|
+
children: ReactNode;
|
|
97
|
+
services: SearchServiceRegistry;
|
|
98
|
+
}): JSX.Element;
|
|
99
|
+
|
|
100
|
+
export declare type SearchServiceRegistry = Record<string, SearchService>;
|
|
101
|
+
|
|
74
102
|
export declare const SelectControl: ({ data, handleChange, path, label, required, errors, schema, uischema, enabled, visible, }: ControlProps) => JSX.Element | null;
|
|
75
103
|
|
|
76
104
|
export declare const SelectControlTester: RankedTester;
|
|
@@ -101,6 +129,8 @@ export declare interface UploadResponse {
|
|
|
101
129
|
name?: string;
|
|
102
130
|
}
|
|
103
131
|
|
|
132
|
+
export declare function useSearchService(name: string | undefined): SearchService | null;
|
|
133
|
+
|
|
104
134
|
export declare function useUpload(): UploadContextValue | null;
|
|
105
135
|
|
|
106
136
|
export declare const VerticalLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled, visible, }: LayoutProps) => JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tailwindcss v4.1
|
|
1
|
+
/*! tailwindcss v4.3.1 | 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-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--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-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--font-weight-semibold:600;--tracking-wide:.025em;--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{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.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-red-50{background-color:var(--color-red-50)}.p-6{padding:calc(var(--spacing) * 6)}.text-center{text-align:center}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-gray-500{color:var(--color-gray-500)}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.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))}.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-3\):hover{background-color:var(--gray-3)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
package/dist/renderers.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
-
`).map(
|
|
3
|
-
`):"",ue=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,uischema:u,schema:S,enabled:h,visible:x=!0})=>{var D;if(R.useEffect(()=>{x===!1&&n(r,void 0)},[x,r,n]),x===!1)return null;const f=w.length===0;return e.jsx(t.Box,{mb:"4",children:e.jsxs(t.Flex,{direction:"column",gap:"1",children:[e.jsxs(t.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[y," ",F&&e.jsx(t.Text,{color:"red",children:"*"})]}),e.jsx(t.TextField.Root,{value:s||"",onChange:b=>n(r,b.target.value),disabled:!h,placeholder:(D=u.options)==null?void 0:D.placeholder,color:f?void 0:"red",id:r}),!f&&e.jsx(t.Text,{color:"red",size:"1",children:q(w,y)}),S.description&&e.jsx(t.Text,{size:"1",color:"gray",children:S.description})]})})},de=C.rankWith(1,C.isStringControl),Be=E.withJsonFormsControlProps(ue),fe=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,uischema:u,schema:S,enabled:h,visible:x=!0})=>{var b;if(R.useEffect(()=>{x===!1&&n(r,void 0)},[x,r,n]),x===!1)return null;const f=w.length===0,D=v=>{if(v===""){n(r,void 0);return}const m=Number(v);isNaN(m)||n(r,m)};return e.jsx(t.Box,{mb:"4",children:e.jsxs(t.Flex,{direction:"column",gap:"1",children:[e.jsxs(t.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[y," ",F&&e.jsx(t.Text,{color:"red",children:"*"})]}),e.jsx(t.TextField.Root,{type:"number",value:s??"",onChange:v=>D(v.target.value),disabled:!h,placeholder:(b=u.options)==null?void 0:b.placeholder,color:f?void 0:"red",id:r}),!f&&e.jsx(t.Text,{color:"red",size:"1",children:q(w,y)}),S.description&&e.jsx(t.Text,{size:"1",color:"gray",children:S.description})]})})},xe=C.rankWith(2,C.or(C.isNumberControl,C.isIntegerControl)),Ie=E.withJsonFormsControlProps(fe),he=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,schema:u,enabled:S,visible:h=!0})=>{if(R.useEffect(()=>{h===!1&&n(r,void 0)},[h,r,n]),h===!1)return null;const x=w.length===0;return e.jsxs(t.Box,{mb:"4",children:[e.jsxs(t.Flex,{gap:"2",align:"center",children:[e.jsx(t.Checkbox,{checked:!!s,onCheckedChange:f=>n(r,f===!0),disabled:!S,id:r}),e.jsxs(t.Text,{as:"label",size:"2",htmlFor:r,children:[y," ",F&&"*"]})]}),!x&&e.jsx(t.Text,{color:"red",size:"1",className:"block mt-1",children:q(w,y)}),u.description&&e.jsx(t.Text,{size:"1",color:"gray",className:"block mt-1",children:u.description})]})},me=C.rankWith(2,C.isBooleanControl),Ue=E.withJsonFormsControlProps(he),pe=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,schema:u,enabled:S,visible:h=!0})=>{if(R.useEffect(()=>{h===!1&&n(r,void 0)},[h,r,n]),h===!1)return null;const x=w.length===0;let f=[];u.enum?f=u.enum.map(b=>({value:b,label:String(b)})):u.oneOf&&(f=u.oneOf.map(b=>({value:b.const,label:b.title||String(b.const)})));const D=s;return e.jsx(t.Box,{mb:"4",children:e.jsxs(t.Flex,{direction:"column",gap:"1",children:[e.jsxs(t.Text,{as:"div",size:"2",weight:"bold",children:[y," ",F&&e.jsx(t.Text,{color:"red",children:"*"})]}),e.jsx(t.RadioGroup.Root,{value:D!==void 0?String(D):"",onValueChange:b=>{const v=f.find(m=>String(m.value)===b);v&&n(r,v.value)},disabled:!S,children:e.jsx(t.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:f.map(b=>e.jsxs(t.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[e.jsx(t.RadioGroup.Item,{value:String(b.value)}),e.jsx(t.Text,{size:"2",color:S?void 0:"gray",children:b.label})]},String(b.value)))})}),!x&&e.jsx(t.Text,{color:"red",size:"1",children:q(w,y)}),u.description&&e.jsx(t.Text,{size:"1",color:"gray",children:u.description})]})})},ge=(s,n,r)=>{var F;return C.or(C.isEnumControl,C.isOneOfControl)(s,n,r)&&((F=s==null?void 0:s.options)==null?void 0:F.format)==="radio"?3:-1},We=E.withJsonFormsControlProps(pe),ye=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,schema:u,uischema:S,enabled:h,visible:x=!0})=>{var v;if(R.useEffect(()=>{x===!1&&n(r,void 0)},[x,r,n]),x===!1)return null;const f=w.length===0;let D=[];u.enum?D=u.enum.map(m=>({value:String(m),label:String(m)})):u.oneOf&&(D=u.oneOf.map(m=>({value:String(m.const),label:m.title||String(m.const)})));const b=s!==void 0?String(s):"";return e.jsx(t.Box,{mb:"4",children:e.jsxs(t.Flex,{direction:"column",gap:"1",children:[e.jsxs(t.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[y," ",F&&e.jsx(t.Text,{color:"red",children:"*"})]}),e.jsxs(t.Select.Root,{value:b,onValueChange:m=>n(r,m),disabled:!h,children:[e.jsx(t.Select.Trigger,{placeholder:((v=S.options)==null?void 0:v.placeholder)||"Select an option",color:f?void 0:"red",id:r}),e.jsx(t.Select.Content,{children:D.map(m=>e.jsx(t.Select.Item,{value:m.value,children:m.label},m.value))})]}),!f&&e.jsx(t.Text,{color:"red",size:"1",children:q(w,y)}),u.description&&e.jsx(t.Text,{size:"1",color:"gray",children:u.description})]})})},je=C.rankWith(2,C.or(C.isEnumControl,C.isOneOfControl)),_e=E.withJsonFormsControlProps(ye);function Ee(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var se={exports:{}},Ve=se.exports,le;function Pe(){return le||(le=1,(function(s,n){(function(r,y){s.exports=y()})(Ve,(function(){var r=1e3,y=6e4,F=36e5,w="millisecond",u="second",S="minute",h="hour",x="day",f="week",D="month",b="quarter",v="year",m="date",A="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,M=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(d){var a=["th","st","nd","rd"],o=d%100;return"["+d+(a[(o-20)%10]||a[o]||a[0])+"]"}},Y=function(d,a,o){var c=String(d);return!c||c.length>=a?d:""+Array(a+1-c.length).join(o)+d},G={s:Y,z:function(d){var a=-d.utcOffset(),o=Math.abs(a),c=Math.floor(o/60),i=o%60;return(a<=0?"+":"-")+Y(c,2,"0")+":"+Y(i,2,"0")},m:function d(a,o){if(a.date()<o.date())return-d(o,a);var c=12*(o.year()-a.year())+(o.month()-a.month()),i=a.clone().add(c,D),p=o-i<0,g=a.clone().add(c+(p?-1:1),D);return+(-(c+(o-i)/(p?i-g:g-i))||0)},a:function(d){return d<0?Math.ceil(d)||0:Math.floor(d)},p:function(d){return{M:D,y:v,w:f,d:x,D:m,h,m:S,s:u,ms:w,Q:b}[d]||String(d||"").toLowerCase().replace(/s$/,"")},u:function(d){return d===void 0}},P="en",I={};I[P]=O;var X="$isDayjsObject",Q=function(d){return d instanceof H||!(!d||!d[X])},N=function d(a,o,c){var i;if(!a)return P;if(typeof a=="string"){var p=a.toLowerCase();I[p]&&(i=p),o&&(I[p]=o,i=p);var g=a.split("-");if(!i&&g.length>1)return d(g[0])}else{var l=a.name;I[l]=a,i=l}return!c&&i&&(P=i),i||!c&&P},z=function(d,a){if(Q(d))return d.clone();var o=typeof a=="object"?a:{};return o.date=d,o.args=arguments,new H(o)},T=G;T.l=N,T.i=Q,T.w=function(d,a){return z(d,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var H=(function(){function d(o){this.$L=N(o.locale,null,!0),this.parse(o),this.$x=this.$x||o.x||{},this[X]=!0}var a=d.prototype;return a.parse=function(o){this.$d=(function(c){var i=c.date,p=c.utc;if(i===null)return new Date(NaN);if(T.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var g=i.match(B);if(g){var l=g[2]-1||0,j=(g[7]||"0").substring(0,3);return p?new Date(Date.UTC(g[1],l,g[3]||1,g[4]||0,g[5]||0,g[6]||0,j)):new Date(g[1],l,g[3]||1,g[4]||0,g[5]||0,g[6]||0,j)}}return new Date(i)})(o),this.init()},a.init=function(){var o=this.$d;this.$y=o.getFullYear(),this.$M=o.getMonth(),this.$D=o.getDate(),this.$W=o.getDay(),this.$H=o.getHours(),this.$m=o.getMinutes(),this.$s=o.getSeconds(),this.$ms=o.getMilliseconds()},a.$utils=function(){return T},a.isValid=function(){return this.$d.toString()!==A},a.isSame=function(o,c){var i=z(o);return this.startOf(c)<=i&&i<=this.endOf(c)},a.isAfter=function(o,c){return z(o)<this.startOf(c)},a.isBefore=function(o,c){return this.endOf(c)<z(o)},a.$g=function(o,c,i){return T.u(o)?this[c]:this.set(i,o)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(o,c){var i=this,p=!!T.u(c)||c,g=T.p(o),l=function(K,W){var J=T.w(i.$u?Date.UTC(i.$y,W,K):new Date(i.$y,W,K),i);return p?J:J.endOf(x)},j=function(K,W){return T.w(i.toDate()[K].apply(i.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),i)},k=this.$W,$=this.$M,L=this.$D,U="set"+(this.$u?"UTC":"");switch(g){case v:return p?l(1,0):l(31,11);case D:return p?l(1,$):l(0,$+1);case f:var _=this.$locale().weekStart||0,V=(k<_?k+7:k)-_;return l(p?L-V:L+(6-V),$);case x:case m:return j(U+"Hours",0);case h:return j(U+"Minutes",1);case S:return j(U+"Seconds",2);case u:return j(U+"Milliseconds",3);default:return this.clone()}},a.endOf=function(o){return this.startOf(o,!1)},a.$set=function(o,c){var i,p=T.p(o),g="set"+(this.$u?"UTC":""),l=(i={},i[x]=g+"Date",i[m]=g+"Date",i[D]=g+"Month",i[v]=g+"FullYear",i[h]=g+"Hours",i[S]=g+"Minutes",i[u]=g+"Seconds",i[w]=g+"Milliseconds",i)[p],j=p===x?this.$D+(c-this.$W):c;if(p===D||p===v){var k=this.clone().set(m,1);k.$d[l](j),k.init(),this.$d=k.set(m,Math.min(this.$D,k.daysInMonth())).$d}else l&&this.$d[l](j);return this.init(),this},a.set=function(o,c){return this.clone().$set(o,c)},a.get=function(o){return this[T.p(o)]()},a.add=function(o,c){var i,p=this;o=Number(o);var g=T.p(c),l=function($){var L=z(p);return T.w(L.date(L.date()+Math.round($*o)),p)};if(g===D)return this.set(D,this.$M+o);if(g===v)return this.set(v,this.$y+o);if(g===x)return l(1);if(g===f)return l(7);var j=(i={},i[S]=y,i[h]=F,i[u]=r,i)[g]||1,k=this.$d.getTime()+o*j;return T.w(k,this)},a.subtract=function(o,c){return this.add(-1*o,c)},a.format=function(o){var c=this,i=this.$locale();if(!this.isValid())return i.invalidDate||A;var p=o||"YYYY-MM-DDTHH:mm:ssZ",g=T.z(this),l=this.$H,j=this.$m,k=this.$M,$=i.weekdays,L=i.months,U=i.meridiem,_=function(W,J,te,re){return W&&(W[J]||W(c,p))||te[J].slice(0,re)},V=function(W){return T.s(l%12||12,W,"0")},K=U||function(W,J,te){var re=W<12?"AM":"PM";return te?re.toLowerCase():re};return p.replace(M,(function(W,J){return J||(function(te){switch(te){case"YY":return String(c.$y).slice(-2);case"YYYY":return T.s(c.$y,4,"0");case"M":return k+1;case"MM":return T.s(k+1,2,"0");case"MMM":return _(i.monthsShort,k,L,3);case"MMMM":return _(L,k);case"D":return c.$D;case"DD":return T.s(c.$D,2,"0");case"d":return String(c.$W);case"dd":return _(i.weekdaysMin,c.$W,$,2);case"ddd":return _(i.weekdaysShort,c.$W,$,3);case"dddd":return $[c.$W];case"H":return String(l);case"HH":return T.s(l,2,"0");case"h":return V(1);case"hh":return V(2);case"a":return K(l,j,!0);case"A":return K(l,j,!1);case"m":return String(j);case"mm":return T.s(j,2,"0");case"s":return String(c.$s);case"ss":return T.s(c.$s,2,"0");case"SSS":return T.s(c.$ms,3,"0");case"Z":return g}return null})(W)||g.replace(":","")}))},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(o,c,i){var p,g=this,l=T.p(c),j=z(o),k=(j.utcOffset()-this.utcOffset())*y,$=this-j,L=function(){return T.m(g,j)};switch(l){case v:p=L()/12;break;case D:p=L();break;case b:p=L()/3;break;case f:p=($-k)/6048e5;break;case x:p=($-k)/864e5;break;case h:p=$/F;break;case S:p=$/y;break;case u:p=$/r;break;default:p=$}return i?p:T.a(p)},a.daysInMonth=function(){return this.endOf(D).$D},a.$locale=function(){return I[this.$L]},a.locale=function(o,c){if(!o)return this.$L;var i=this.clone(),p=N(o,c,!0);return p&&(i.$L=p),i},a.clone=function(){return T.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},d})(),ee=H.prototype;return z.prototype=ee,[["$ms",w],["$s",u],["$m",S],["$H",h],["$W",x],["$M",D],["$y",v],["$D",m]].forEach((function(d){ee[d[1]]=function(a){return this.$g(a,d[0],d[1])}})),z.extend=function(d,a){return d.$i||(d(a,H,z),d.$i=!0),z},z.locale=N,z.isDayjs=Q,z.unix=function(d){return z(1e3*d)},z.en=I[P],z.Ls=I,z.p={},z}))})(se)),se.exports}var Ne=Pe();const He=Ee(Ne),Ye=(s,n)=>He(`${s}T${n}`).format(),Je=({path:s,label:n,required:r,errors:y,description:F,children:w})=>{const u=y.length===0;return e.jsx(t.Box,{mb:"4",children:e.jsxs(t.Flex,{direction:"column",gap:"1",children:[e.jsxs(t.Text,{as:"label",size:"2",weight:"bold",htmlFor:s,children:[n," ",r&&e.jsx(t.Text,{color:"red",children:"*"})]}),w,!u&&e.jsx(t.Text,{color:"red",size:"1",children:q(y,n)}),F&&e.jsx(t.Text,{size:"1",color:"gray",children:F})]})})},ve=({data:s,handleChange:n,path:r,label:y,required:F,errors:w,schema:u,enabled:S,visible:h=!0})=>{if(R.useEffect(()=>{h===!1&&n(r,void 0)},[h,r,n]),h===!1)return null;const x=w.length===0,f=typeof s=="string"?s:"",D=M=>e.jsx(Je,{path:r,label:y,required:F,errors:w,description:u.description,children:M});if(u.format==="time")return D(e.jsx(t.TextField.Root,{type:"time",value:f,onChange:M=>n(r,M.target.value),disabled:!S,color:x?void 0:"red",id:r}));const b=u.format==="date-time",[v="",m=""]=f.split("T"),A=m.slice(0,5),B=(M,O)=>{if(!M){n(r,void 0);return}n(r,b?Ye(M,O||"00:00"):M)};return D(e.jsxs(t.Flex,{gap:"2",align:"center",children:[e.jsx(t.TextField.Root,{type:"date",value:v,disabled:!S,color:x?void 0:"red",onChange:M=>B(M.target.value,A),id:r,style:{flex:1}}),b&&e.jsx(t.TextField.Root,{type:"time",value:A,disabled:!S||!v,color:x?void 0:"red",onChange:M=>B(v,M.target.value),style:{flex:1}})]}))},$e=C.rankWith(2,C.or(C.isDateControl,C.isDateTimeControl,C.isTimeControl)),qe=E.withJsonFormsControlProps(ve),be=({uischema:s,schema:n,path:r,renderers:y,cells:F,enabled:w,visible:u=!0})=>{const h=s.elements;return u===!1?null:e.jsx(t.Flex,{direction:"column",gap:"4",children:h.map((x,f)=>e.jsx(E.JsonFormsDispatch,{uischema:x,schema:n,path:r,renderers:y,cells:F,enabled:w},`${r}-${f}`))})},Te=C.rankWith(1,C.uiTypeIs("VerticalLayout")),Ce=({uischema:s,schema:n,path:r,renderers:y,cells:F,enabled:w,visible:u=!0})=>{const h=s.elements;return u===!1?null:e.jsx(t.Flex,{direction:"row",gap:"4",children:h.map((x,f)=>e.jsx(t.Box,{style:{flex:1},children:e.jsx(E.JsonFormsDispatch,{uischema:x,schema:n,path:r,renderers:y,cells:F,enabled:w})},`${r}-${f}`))})},we=C.rankWith(1,C.uiTypeIs("HorizontalLayout")),Se=({uischema:s,schema:n,path:r,renderers:y,cells:F,enabled:w,visible:u=!0})=>{const S=s,h=S.elements;return u===!1?null:e.jsxs(t.Box,{mb:"6",children:[S.label&&e.jsx(t.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:S.label}),e.jsx(t.Flex,{direction:"column",gap:"4",children:h.map((x,f)=>e.jsx(E.JsonFormsDispatch,{uischema:x,schema:n,path:r,renderers:y,cells:F,enabled:w},`${r}-${f}`))})]})},Fe=C.rankWith(1,C.uiTypeIs("Group")),De=({uischema:s,schema:n,path:r,renderers:y,cells:F,enabled:w,visible:u=!0})=>{var b;const h=s.elements.filter(v=>v.type==="Category"),[x,f]=R.useState(((b=h[0])==null?void 0:b.label)||"");if(u===!1||!h.length)return null;const D=h.find(v=>v.label===x)?x:h[0].label;return e.jsxs(t.Tabs.Root,{value:D,onValueChange:f,children:[e.jsx(t.Tabs.List,{children:h.map((v,m)=>e.jsx(t.Tabs.Trigger,{value:v.label,children:v.label},`${r}-${m}`))}),e.jsx(t.Box,{pt:"3",children:h.map((v,m)=>e.jsx(t.Tabs.Content,{value:v.label,children:e.jsx(t.Flex,{direction:"column",gap:"4",children:v.elements.map((A,B)=>e.jsx(E.JsonFormsDispatch,{uischema:A,schema:n,path:r,renderers:y,cells:F,enabled:w},`${r}-${m}-${B}`))})},`${r}-${m}`))})]})},ke=C.rankWith(1,C.uiTypeIs("Categorization"));function Ge(s){return s?Array.isArray(s)?s:[s]:[]}function ne(s){return s>=1024*1024?`${(s/(1024*1024)).toFixed(0)} MB`:s>=1024?`${(s/1024).toFixed(0)} KB`:`${s} B`}function oe(s){return s.split(",").map(n=>{if(n=n.trim(),n.endsWith("/*"))return n.split("/")[0].toUpperCase()+"S";if(n.startsWith("."))return n.slice(1).toUpperCase();const r=n.split("/")[1];return r?r.toUpperCase():n}).join(", ")}const Ke=({data:s,handleChange:n,path:r,label:y,required:F,uischema:w,schema:u,enabled:S,errors:h,visible:x=!0})=>{const f=ce();if(R.useEffect(()=>{x===!1&&n(r,null)},[x,r,n]),x===!1)return null;const D=!h||h.length===0,b=(u==null?void 0:u["x-file"])??{},v=(w==null?void 0:w.options)??{},m=b.maxFiles??v.maxFiles??1,A=b.maxSize??v.maxSize??5*1024*1024,B=b.accept??v.accept??"image/*,application/pdf",M=m>1,O=S!==!1,[Y,G]=R.useState(!1),[P,I]=R.useState(null),[X,Q]=R.useState({}),N=R.useRef(new Set),z=R.useRef(null),T=Ge(s),H=T.length>=m;R.useEffect(()=>()=>{N.current.forEach(l=>URL.revokeObjectURL(l)),N.current.clear()},[]);const ee=R.useCallback(async l=>{if(I(null),T.length>=m){I(`Maximum ${m} file${m>1?"s":""} allowed.`);return}if(l.size>A){I(`File exceeds the ${ne(A)} limit.`);return}if(!B.split(",").map($=>$.trim()).some($=>$==="*"||$==="*/*"?!0:$.endsWith("/*")?l.type.startsWith($.slice(0,-1)):$.startsWith(".")?l.name.toLowerCase().endsWith($.toLowerCase()):l.type===$)){I(`Invalid type. Accepted: ${oe(B)}`);return}if(!(f!=null&&f.onUpload)){I("Upload service not configured.");return}try{const $=await f.onUpload(l),L=URL.createObjectURL(l);N.current.add(L);const U={key:$.key,name:$.name??l.name,blobUrl:L};Q(V=>({...V,[$.key]:U}));const _=[...T,$.key];n(r,M?_:_[0])}catch{I("Upload failed. Please try again."),z.current&&(z.current.value="")}},[T,m,A,B,f,r,n,M]),d=l=>{l.preventDefault(),l.stopPropagation(),!(!O||H)&&G(l.type==="dragenter"||l.type==="dragover")},a=l=>{var j;l.preventDefault(),l.stopPropagation(),G(!1),!(!O||H)&&(j=l.dataTransfer.files)!=null&&j[0]&&ee(l.dataTransfer.files[0])},o=l=>{var j;(j=l.target.files)!=null&&j[0]&&(ee(l.target.files[0]),l.target.value="")},c=l=>{if(!O)return;Q(k=>{var U;const $={...k},L=(U=$[l])==null?void 0:U.blobUrl;return L&&(URL.revokeObjectURL(L),N.current.delete(L)),delete $[l],$});const j=T.filter(k=>k!==l);n(r,M?j.length>0?j:null:j[0]??null)},i=async(l,j)=>{var L,U,_;l.preventDefault();const k=(L=X[j])==null?void 0:L.blobUrl;if(k){(U=window.open(k,"_blank","noopener,noreferrer"))==null||U.focus();return}const $=window.open("","_blank");if($)try{const V=await((_=f==null?void 0:f.getDownloadUrl)==null?void 0:_.call(f,j));V!=null&&V.url?$.location.href=V.url:$.close()}catch{$.close()}};if(!O&&T.length===0)return null;const p=m-T.length,g=O&&!H;return e.jsxs(t.Box,{mb:"4",children:[e.jsxs(t.Flex,{align:"center",justify:"between",mb:"2",children:[e.jsxs(t.Text,{as:"label",size:"2",weight:"bold",children:[y,F&&e.jsx(t.Text,{color:"red",children:" *"})]}),e.jsx(t.Text,{size:"1",color:"gray",children:M?`Up to ${m} files · ${ne(A)} each · ${oe(B)}`:`${ne(A)} · ${oe(B)}`})]}),T.map(l=>{var j;return e.jsx(t.Card,{size:"2",variant:"surface",mb:"2",children:e.jsxs(t.Flex,{align:"center",gap:"3",children:[e.jsx(t.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:e.jsx(Z.FileTextIcon,{width:"20",height:"20"})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((j=X[l])==null?void 0:j.name)??"Uploaded File"})}),e.jsxs(t.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[e.jsx(t.Button,{variant:"soft",color:"blue",size:"1",onClick:k=>i(k,l),children:"View"}),e.jsx(Z.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),O&&e.jsx(t.IconButton,{variant:"ghost",color:"gray",onClick:()=>c(l),children:e.jsx(Z.Cross2Icon,{})})]})]})},l)}),g&&e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var l;return(l=z.current)==null?void 0:l.click()},onKeyDown:l=>{var j;(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),(j=z.current)==null||j.click())},onDragEnter:d,onDragLeave:d,onDragOver:d,onDrop:a,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",Y?"border-blue-500 bg-blue-50":P?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[e.jsx("input",{ref:z,type:"file",style:{display:"none"},accept:B,onChange:o}),e.jsx(t.Flex,{direction:"column",align:"center",gap:"2",children:P?e.jsxs(e.Fragment,{children:[e.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),e.jsx(t.Text,{size:"2",color:"red",weight:"medium",children:P}),e.jsx(t.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),e.jsx(t.Text,{size:"2",weight:"medium",children:T.length>0?`Add another file (${p} remaining)`:"Click to upload or drag and drop"}),e.jsxs(t.Text,{size:"1",color:"gray",children:[ne(A)," max · ",oe(B)]})]})})]}),O&&H&&M&&e.jsxs(t.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",m," files uploaded. Remove one to replace it."]}),!D&&e.jsx(t.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:q(h,y)})]})},Me=E.withJsonFormsControlProps(Ke),ze=C.rankWith(10,C.and(C.schemaMatches(s=>{if(s.type==="string"&&s.format==="file")return!0;if(s.type==="array"){const n=s.items;return(n==null?void 0:n.type)==="string"&&(n==null?void 0:n.format)==="file"}return!1}))),Ze=({data:s,path:n,schema:r,uischema:y,enabled:F,visible:w,addItem:u,removeItems:S,rootSchema:h,arraySchema:x})=>{const f=x?r:r.items,D=x||r;if(w===!1||!f||typeof f!="object"||Array.isArray(f))return null;const b=f,v=Array.isArray(s)?s:[],m=D.title||"Array Items",A=()=>{const M=C.createDefaultValue(b,h);u&&u(n,M)()},B=M=>{if(S){const O=S(n,[M]);O&&O()}};return e.jsx(t.Box,{mb:"6",children:e.jsxs(t.Flex,{direction:"column",gap:"4",children:[e.jsx(t.Text,{as:"div",size:"4",weight:"bold",children:m}),v.length===0&&e.jsx(t.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:e.jsx(t.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),v.map((M,O)=>{var G;const Y=`${n}.${O}`;return e.jsx(t.Card,{size:"3",variant:"surface",children:e.jsxs(t.Flex,{direction:"column",gap:"4",children:[e.jsxs(t.Flex,{justify:"between",align:"center",children:[e.jsxs(t.Text,{size:"3",weight:"bold",children:["Item ",O+1]}),F&&e.jsxs(t.Button,{type:"button",color:"red",variant:"soft",onClick:()=>B(O),title:"Remove item",children:[e.jsx(Z.TrashIcon,{}),"Remove"]})]}),e.jsx(t.Box,{children:e.jsx(E.JsonFormsDispatch,{schema:b,uischema:((G=y.options)==null?void 0:G.detail)||(b.type==="object"||b.properties?{type:"VerticalLayout",elements:Object.keys(b.properties||{}).map(P=>({type:"Control",scope:`#/properties/${P}`}))}:{type:"Control",scope:"#"}),path:Y,enabled:F,renderers:void 0,cells:void 0})})]})},Y)}),F&&e.jsx(t.Box,{mt:"2",children:e.jsxs(t.Button,{type:"button",variant:"surface",onClick:A,children:[e.jsx(Z.PlusIcon,{}),"Add Item"]})})]})})},ie=E.withJsonFormsArrayControlProps(Ze),Le=C.rankWith(3,C.isObjectArrayControl),Oe=({uischema:s,visible:n})=>{const r=s;return n===!1?null:e.jsx(t.Box,{mb:"4",children:e.jsx(t.Heading,{size:"4",children:r.text})})},Re=C.rankWith(1,C.uiTypeIs("Label")),Qe=C.rankWith(3,C.isPrimitiveArrayControl),Xe=[{tester:de,renderer:Be},{tester:xe,renderer:Ie},{tester:me,renderer:Ue},{tester:ge,renderer:We},{tester:je,renderer:_e},{tester:$e,renderer:qe},{tester:Te,renderer:be},{tester:we,renderer:Ce},{tester:Fe,renderer:Se},{tester:ke,renderer:De},{tester:ze,renderer:Me},{tester:Le,renderer:ie},{tester:Qe,renderer:ie},{tester:Re,renderer:Oe}];exports.ArrayControl=ie;exports.ArrayControlTester=Le;exports.BooleanControl=he;exports.BooleanControlTester=me;exports.CategorizationLayoutRenderer=De;exports.CategorizationLayoutTester=ke;exports.DateControl=ve;exports.DateControlTester=$e;exports.FileControl=Me;exports.FileControlTester=ze;exports.GroupLayoutRenderer=Se;exports.GroupLayoutTester=Fe;exports.HorizontalLayoutRenderer=Ce;exports.HorizontalLayoutTester=we;exports.LabelRenderer=Oe;exports.LabelTester=Re;exports.NumberControl=fe;exports.NumberControlTester=xe;exports.RadioControl=pe;exports.RadioControlTester=ge;exports.SelectControl=ye;exports.SelectControlTester=je;exports.TextControl=ue;exports.TextControlTester=de;exports.UploadProvider=Ae;exports.VerticalLayoutRenderer=be;exports.VerticalLayoutTester=Te;exports.getErrorMessage=q;exports.radixRenderers=Xe;exports.useUpload=ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),x=require("@jsonforms/core"),k=require("@jsonforms/react"),r=require("@radix-ui/themes"),H=require("@radix-ui/react-icons"),Ne=require("dayjs"),ae=m.createContext(null);function Je({children:n,onUpload:t,getDownloadUrl:o}){const a={onUpload:t,getDownloadUrl:o};return e.jsx(ae.Provider,{value:a,children:n})}function de(){return m.useContext(ae)}const ue=m.createContext(null);function Me({children:n,services:t}){const o=m.useMemo(()=>t,[t]);return e.jsx(ue.Provider,{value:o,children:n})}function xe(n){const t=m.useContext(ue);return!t||!n?null:t[n]??null}const _=(n,t,o,a=void 0)=>{m.useEffect(()=>{n===!1&&o(t,a)},[n,t,o,a])},q=(n,t)=>n?n.split(`
|
|
2
|
+
`).map(o=>o.trim()==="is a required property"?`${t||"This field"} is required`:o).join(`
|
|
3
|
+
`):"",fe=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,uischema:c,schema:y,enabled:d,visible:h=!0})=>{var T;if(_(h,o,t),h===!1)return null;const l=p.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:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{value:n||"",onChange:f=>t(o,f.target.value),disabled:!d,placeholder:(T=c.options)==null?void 0:T.placeholder,color:l?void 0:"red",id:o}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),y.description&&e.jsx(r.Text,{size:"1",color:"gray",children:y.description})]})})},pe=x.rankWith(1,x.isStringControl),He=k.withJsonFormsControlProps(fe),he=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,uischema:c,schema:y,enabled:d,visible:h=!0})=>{var f;if(_(h,o,t),h===!1)return null;const l=p.length===0,T=s=>{if(s===""){t(o,void 0);return}const u=Number(s);isNaN(u)||t(o,u)};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:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"number",value:n??"",onChange:s=>T(s.target.value),disabled:!d,placeholder:(f=c.options)==null?void 0:f.placeholder,color:l?void 0:"red",id:o}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),y.description&&e.jsx(r.Text,{size:"1",color:"gray",children:y.description})]})})},ge=x.rankWith(2,x.or(x.isNumberControl,x.isIntegerControl)),qe=k.withJsonFormsControlProps(he),je=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(_(d,o,t),d===!1)return null;const h=p.length===0;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.Checkbox,{checked:!!n,onCheckedChange:l=>t(o,l===!0),disabled:!y,id:o}),e.jsxs(r.Text,{as:"label",size:"2",htmlFor:o,children:[a," ",j&&"*"]})]}),!h&&e.jsx(r.Text,{color:"red",size:"1",className:"block mt-1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",className:"block mt-1",children:c.description})]})},me=x.rankWith(2,x.isBooleanControl),Ge=k.withJsonFormsControlProps(je),ye=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(_(d,o,t),d===!1)return null;const h=p.length===0;let l=[];c.enum?l=c.enum.map(f=>({value:f,label:String(f)})):c.oneOf&&(l=c.oneOf.map(f=>({value:f.const,label:f.title||String(f.const)})));const T=n;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"div",size:"2",weight:"bold",children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.RadioGroup.Root,{value:T!==void 0?String(T):"",onValueChange:f=>{const s=l.find(u=>String(u.value)===f);s&&t(o,s.value)},disabled:!y,children:e.jsx(r.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:l.map(f=>e.jsxs(r.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[e.jsx(r.RadioGroup.Item,{value:String(f.value)}),e.jsx(r.Text,{size:"2",color:y?void 0:"gray",children:f.label})]},String(f.value)))})}),!h&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},ve=(n,t,o)=>{var j;return x.or(x.isEnumControl,x.isOneOfControl)(n,t,o)&&((j=n==null?void 0:n.options)==null?void 0:j.format)==="radio"?3:-1},Ke=k.withJsonFormsControlProps(ye),be=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,uischema:y,enabled:d,visible:h=!0})=>{var s;if(_(h,o,t),h===!1)return null;const l=p.length===0;let T=[];c.enum?T=c.enum.map(u=>({value:String(u),label:String(u)})):c.oneOf&&(T=c.oneOf.map(u=>({value:String(u.const),label:u.title||String(u.const)})));const f=n!==void 0?String(n):"";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:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs(r.Select.Root,{value:f,onValueChange:u=>t(o,u),disabled:!d,children:[e.jsx(r.Select.Trigger,{placeholder:((s=y.options)==null?void 0:s.placeholder)||"Select an option",color:l?void 0:"red",id:o}),e.jsx(r.Select.Content,{children:T.map(u=>e.jsx(r.Select.Item,{value:u.value,children:u.label},u.value))})]}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},Te=x.rankWith(2,x.or(x.isEnumControl,x.isOneOfControl)),_e=k.withJsonFormsControlProps(be),Ze={"small-list":{fetchOnOpen:!0,searchable:!1,paginated:!1},"large-searchable-list":{fetchOnOpen:!0,searchable:!0,paginated:!1},"large-paginated-list":{fetchOnOpen:!1,searchable:!0,paginated:!0}},Qe=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,enabled:c,visible:y=!0,schema:d,uischema:h})=>{var le;const l=(d==null?void 0:d["x-search"])??{service:""},T=l.service??"",f=l.mode??"large-paginated-list",s=Ze[f],u=(s==null?void 0:s.fetchOnOpen)??!1,C=xe(T),z=T?C?s?null:`Invalid x-search.mode "${f}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${T}" is not registered.`:"Search not configured.",b=c!==!1,w=!p||p.length===0,[F,I]=m.useState(!1),[$,E]=m.useState(""),[Q,A]=m.useState([]),[Z,L]=m.useState(!1),[B,P]=m.useState(!1),[X,W]=m.useState(!1),[Y,V]=m.useState(null),[ee,G]=m.useState(void 0),N=m.useRef(void 0),K=m.useRef(null),i=m.useRef(null),S=m.useRef(null),R=m.useRef(void 0);m.useEffect(()=>{if(!n){G(void 0),R.current=void 0;return}if(R.current===n||(R.current=n,G({id:n,name:n}),!(C!=null&&C.resolve)))return;let g=!1;return C.resolve(n).then(O=>{!g&&O&&G(O)}).catch(()=>{}),()=>{g=!0}},[n,C]);const v=m.useCallback(async(g,O=!1)=>{var ie;if(!C){V("Search service not configured.");return}(ie=i.current)==null||ie.abort();const re=new AbortController;i.current=re,O?W(!0):(P(!0),W(!1),V(null));try{const te=await C.search({query:g,cursor:O?N.current:void 0,signal:re.signal}),ce=te.options??[];A(O?Ve=>[...Ve,...ce]:ce),N.current=te.nextCursor,L(((s==null?void 0:s.paginated)??!1)&&te.nextCursor!=null)}catch{if(re.signal.aborted)return;V("Failed to load results. Please try again.")}finally{re.signal.aborted||(O?W(!1):P(!1))}},[C,s==null?void 0:s.paginated]);if(m.useEffect(()=>{if(!F)return;const g=O=>{S.current&&!S.current.contains(O.target)&&I(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[F]),m.useEffect(()=>{var g;F||((g=i.current)==null||g.abort(),E(""),A([]),L(!1),V(null),P(!1),W(!1),N.current=void 0)},[F]),m.useEffect(()=>{if(!F)return;if(!$&&!u){A([]),L(!1),V(null),N.current=void 0;return}K.current&&clearTimeout(K.current);const g=$?300:0;return K.current=setTimeout(()=>{A([]),L(!1),N.current=void 0,v($)},g),()=>{K.current&&clearTimeout(K.current)}},[$,F,u,v]),_(y,o,t,null),y===!1)return null;const D=()=>{E(""),A([]),L(!1),V(null),N.current=void 0,I(!0)},U=g=>{t(o,g.id),G(g),R.current=g.id,I(!1)},J=g=>{g.stopPropagation(),t(o,null),G(void 0)},M=g=>{(g.key==="Enter"||g.key===" ")&&J(g)},We=((le=h==null?void 0:h.options)==null?void 0:le.placeholder)??"Select an option";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:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs("div",{ref:S,style:{position:"relative"},children:[e.jsx(r.TextField.Root,{id:o,value:F?$:(ee==null?void 0:ee.name)??"",placeholder:F&&(s!=null&&s.searchable)?"Search...":We,disabled:!b,readOnly:F&&!(s!=null&&s.searchable),style:w?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:g=>{s!=null&&s.searchable&&(E(g.target.value),F||D())},onFocus:()=>{b&&!F&&D()},onKeyDown:g=>{g.key==="Escape"&&I(!1)},children:e.jsx(r.TextField.Slot,{side:"right",children:e.jsxs(r.Flex,{align:"center",gap:"1",children:[n&&b&&e.jsx("span",{role:"button",tabIndex:0,onMouseDown:g=>g.preventDefault(),onClick:J,onKeyDown:M,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),e.jsx(H.ChevronDownIcon,{style:{transform:F?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),F&&e.jsx(r.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:z?e.jsx(r.Box,{p:"3",children:e.jsx(r.Text,{size:"2",color:"gray",children:z})}):e.jsx(r.ScrollArea,{style:{maxHeight:240},children:e.jsxs(r.Box,{p:"1",children:[B&&e.jsx(r.Flex,{justify:"center",p:"4",children:e.jsx(r.Spinner,{})}),!B&&Y&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Text,{size:"2",color:"red",children:Y})}),!B&&!Y&&Q.length===0&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Text,{size:"2",color:"gray",children:$||u?"No results found.":"Type to search…"})}),Q.map(g=>e.jsx(r.Box,{px:"3",py:"2",onMouseDown:O=>O.preventDefault(),onClick:()=>U(g),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:g.id===n?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:e.jsx(r.Text,{size:"2",children:g.name})},g.id)),(s==null?void 0:s.paginated)&&Z&&!X&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:g=>g.preventDefault(),onClick:()=>void v($,!0),children:"Load more"})}),X&&e.jsx(r.Flex,{justify:"center",p:"2",children:e.jsx(r.Spinner,{})})]})})})]}),!w&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),d.description&&e.jsx(r.Text,{size:"1",color:"gray",children:d.description})]})})},Ce=k.withJsonFormsControlProps(Qe),Se=x.rankWith(3,x.schemaMatches(n=>{const t=n["x-search"];return n.type==="string"&&typeof(t==null?void 0:t.service)=="string"&&t.service!==""})),Xe=(n,t)=>Ne(`${n}T${t}`).format(),Ye=({path:n,label:t,required:o,errors:a,description:j,children:p})=>{const c=a.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:n,children:[t," ",o&&e.jsx(r.Text,{color:"red",children:"*"})]}),p,!c&&e.jsx(r.Text,{color:"red",size:"1",children:q(a,t)}),j&&e.jsx(r.Text,{size:"1",color:"gray",children:j})]})})},we=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(m.useEffect(()=>{d===!1&&t(o,void 0)},[d,o,t]),d===!1)return null;const h=p.length===0,l=typeof n=="string"?n:"",T=b=>e.jsx(Ye,{path:o,label:a,required:j,errors:p,description:c.description,children:b});if(c.format==="time")return T(e.jsx(r.TextField.Root,{type:"time",value:l,onChange:b=>t(o,b.target.value),disabled:!y,color:h?void 0:"red",id:o}));const f=c.format==="date-time",[s="",u=""]=l.split("T"),C=u.slice(0,5),z=(b,w)=>{if(!b){t(o,void 0);return}t(o,f?Xe(b,w||"00:00"):b)};return T(e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.TextField.Root,{type:"date",value:s,disabled:!y,color:h?void 0:"red",onChange:b=>z(b.target.value,C),id:o,style:{flex:1}}),f&&e.jsx(r.TextField.Root,{type:"time",value:C,disabled:!y||!s,color:h?void 0:"red",onChange:b=>z(s,b.target.value),style:{flex:1}})]}))},Fe=x.rankWith(2,x.or(x.isDateControl,x.isDateTimeControl,x.isTimeControl)),er=k.withJsonFormsControlProps(we),ze=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const d=n.elements;return c===!1?null:e.jsx(r.Flex,{direction:"column",gap:"4",children:d.map((h,l)=>e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${l}`))})},Re=x.rankWith(1,x.uiTypeIs("VerticalLayout")),ke=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const d=n.elements;return c===!1?null:e.jsx(r.Flex,{direction:"row",gap:"4",children:d.map((h,l)=>e.jsx(r.Box,{style:{flex:1},children:e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p})},`${o}-${l}`))})},$e=x.rankWith(1,x.uiTypeIs("HorizontalLayout")),Be=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const y=n,d=y.elements;return c===!1?null:e.jsxs(r.Box,{mb:"6",children:[y.label&&e.jsx(r.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:y.label}),e.jsx(r.Flex,{direction:"column",gap:"4",children:d.map((h,l)=>e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${l}`))})]})},De=x.rankWith(1,x.uiTypeIs("Group")),Le=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{var f;const d=n.elements.filter(s=>s.type==="Category"),[h,l]=m.useState(((f=d[0])==null?void 0:f.label)||"");if(c===!1||!d.length)return null;const T=d.find(s=>s.label===h)?h:d[0].label;return e.jsxs(r.Tabs.Root,{value:T,onValueChange:l,children:[e.jsx(r.Tabs.List,{children:d.map((s,u)=>e.jsx(r.Tabs.Trigger,{value:s.label,children:s.label},`${o}-${u}`))}),e.jsx(r.Box,{pt:"3",children:d.map((s,u)=>e.jsx(r.Tabs.Content,{value:s.label,children:e.jsx(r.Flex,{direction:"column",gap:"4",children:s.elements.map((C,z)=>e.jsx(k.JsonFormsDispatch,{uischema:C,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${u}-${z}`))})},`${o}-${u}`))})]})},Oe=x.rankWith(1,x.uiTypeIs("Categorization"));function rr(n){return n?Array.isArray(n)?n:[n]:[]}function ne(n){return n>=1024*1024?`${(n/(1024*1024)).toFixed(0)} MB`:n>=1024?`${(n/1024).toFixed(0)} KB`:`${n} B`}function oe(n){return n.split(",").map(t=>{if(t=t.trim(),t.endsWith("/*"))return t.split("/")[0].toUpperCase()+"S";if(t.startsWith("."))return t.slice(1).toUpperCase();const o=t.split("/")[1];return o?o.toUpperCase():t}).join(", ")}const tr=({data:n,handleChange:t,path:o,label:a,required:j,uischema:p,schema:c,enabled:y,errors:d,visible:h=!0})=>{const l=de();_(h,o,t,null);const T=!d||d.length===0,f=(c==null?void 0:c["x-file"])??{},s=(p==null?void 0:p.options)??{},u=f.maxFiles??s.maxFiles??1,C=f.maxSize??s.maxSize??5*1024*1024,z=f.accept??s.accept??"image/*,application/pdf",b=u>1,w=y!==!1,[F,I]=m.useState(!1),[$,E]=m.useState(null),[Q,A]=m.useState({}),Z=m.useRef(new Set),L=m.useRef(null),B=rr(n),P=B.length>=u;m.useEffect(()=>()=>{Z.current.forEach(i=>URL.revokeObjectURL(i)),Z.current.clear()},[]);const X=m.useCallback(async i=>{if(E(null),B.length>=u){E(`Maximum ${u} file${u>1?"s":""} allowed.`);return}if(i.size>C){E(`File exceeds the ${ne(C)} limit.`);return}if(!z.split(",").map(v=>v.trim()).some(v=>v==="*"||v==="*/*"?!0:v.endsWith("/*")?i.type.startsWith(v.slice(0,-1)):v.startsWith(".")?i.name.toLowerCase().endsWith(v.toLowerCase()):i.type===v)){E(`Invalid type. Accepted: ${oe(z)}`);return}if(!(l!=null&&l.onUpload)){E("Upload service not configured.");return}try{const v=await l.onUpload(i),D=URL.createObjectURL(i);Z.current.add(D);const U={key:v.key,name:v.name??i.name,blobUrl:D};A(M=>({...M,[v.key]:U}));const J=[...B,v.key];t(o,b?J:J[0])}catch{E("Upload failed. Please try again."),L.current&&(L.current.value="")}},[B,u,C,z,l,o,t,b]);if(h===!1)return null;const W=i=>{i.preventDefault(),i.stopPropagation(),!(!w||P)&&I(i.type==="dragenter"||i.type==="dragover")},Y=i=>{var S;i.preventDefault(),i.stopPropagation(),I(!1),!(!w||P)&&(S=i.dataTransfer.files)!=null&&S[0]&&X(i.dataTransfer.files[0])},V=i=>{var S;(S=i.target.files)!=null&&S[0]&&(X(i.target.files[0]),i.target.value="")},ee=i=>{if(!w)return;A(R=>{var U;const v={...R},D=(U=v[i])==null?void 0:U.blobUrl;return D&&(URL.revokeObjectURL(D),Z.current.delete(D)),delete v[i],v});const S=B.filter(R=>R!==i);t(o,b?S.length>0?S:null:S[0]??null)},G=async(i,S)=>{var D,U,J;i.preventDefault();const R=(D=Q[S])==null?void 0:D.blobUrl;if(R){(U=window.open(R,"_blank","noopener,noreferrer"))==null||U.focus();return}const v=window.open("","_blank");if(v)try{const M=await((J=l==null?void 0:l.getDownloadUrl)==null?void 0:J.call(l,S));M!=null&&M.url?v.location.href=M.url:v.close()}catch{v.close()}};if(!w&&B.length===0)return null;const N=u-B.length,K=w&&!P;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{align:"center",justify:"between",mb:"2",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",children:[a,j&&e.jsx(r.Text,{color:"red",children:" *"})]}),e.jsx(r.Text,{size:"1",color:"gray",children:b?`Up to ${u} files · ${ne(C)} each · ${oe(z)}`:`${ne(C)} · ${oe(z)}`})]}),B.map(i=>{var S;return e.jsx(r.Card,{size:"2",variant:"surface",mb:"2",children:e.jsxs(r.Flex,{align:"center",gap:"3",children:[e.jsx(r.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:e.jsx(H.FileTextIcon,{width:"20",height:"20"})}),e.jsx(r.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(r.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((S=Q[i])==null?void 0:S.name)??"Uploaded File"})}),e.jsxs(r.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[e.jsx(r.Button,{variant:"soft",color:"blue",size:"1",onClick:R=>G(R,i),children:"View"}),e.jsx(H.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),w&&e.jsx(r.IconButton,{variant:"ghost",color:"gray",onClick:()=>ee(i),children:e.jsx(H.Cross2Icon,{})})]})]})},i)}),K&&e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var i;return(i=L.current)==null?void 0:i.click()},onKeyDown:i=>{var S;(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),(S=L.current)==null||S.click())},onDragEnter:W,onDragLeave:W,onDragOver:W,onDrop:Y,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",F?"border-blue-500 bg-blue-50":$?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[e.jsx("input",{ref:L,type:"file",style:{display:"none"},accept:z,onChange:V}),e.jsx(r.Flex,{direction:"column",align:"center",gap:"2",children:$?e.jsxs(e.Fragment,{children:[e.jsx(H.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),e.jsx(r.Text,{size:"2",color:"red",weight:"medium",children:$}),e.jsx(r.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),e.jsx(r.Text,{size:"2",weight:"medium",children:B.length>0?`Add another file (${N} remaining)`:"Click to upload or drag and drop"}),e.jsxs(r.Text,{size:"1",color:"gray",children:[ne(C)," max · ",oe(z)]})]})})]}),w&&P&&b&&e.jsxs(r.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",u," files uploaded. Remove one to replace it."]}),!T&&e.jsx(r.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:q(d,a)})]})},Ie=k.withJsonFormsControlProps(tr),Ee=x.rankWith(10,x.and(x.schemaMatches(n=>{if(n.type==="string"&&n.format==="file")return!0;if(n.type==="array"){const t=n.items;return(t==null?void 0:t.type)==="string"&&(t==null?void 0:t.format)==="file"}return!1}))),nr=({data:n,path:t,schema:o,uischema:a,enabled:j,visible:p,addItem:c,removeItems:y,rootSchema:d,arraySchema:h})=>{const l=h?o:o.items,T=h||o;if(p===!1||!l||typeof l!="object"||Array.isArray(l))return null;const f=l,s=Array.isArray(n)?n:[],u=T.title||"Array Items",C=()=>{const b=x.createDefaultValue(f,d);c&&c(t,b)()},z=b=>{if(y){const w=y(t,[b]);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:u}),s.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."})}),s.map((b,w)=>{var I;const F=`${t}.${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]}),j&&e.jsxs(r.Button,{type:"button",color:"red",variant:"soft",onClick:()=>z(w),title:"Remove item",children:[e.jsx(H.TrashIcon,{}),"Remove"]})]}),e.jsx(r.Box,{children:e.jsx(k.JsonFormsDispatch,{schema:f,uischema:((I=a.options)==null?void 0:I.detail)||(f.type==="object"||f.properties?{type:"VerticalLayout",elements:Object.keys(f.properties||{}).map($=>({type:"Control",scope:`#/properties/${$}`}))}:{type:"Control",scope:"#"}),path:F,enabled:j,renderers:void 0,cells:void 0})})]})},F)}),j&&e.jsx(r.Box,{mt:"2",children:e.jsxs(r.Button,{type:"button",variant:"surface",onClick:C,children:[e.jsx(H.PlusIcon,{}),"Add Item"]})})]})})},se=k.withJsonFormsArrayControlProps(nr),Ae=x.rankWith(3,x.isObjectArrayControl),Ue=({uischema:n,visible:t})=>{const o=n;return t===!1?null:e.jsx(r.Box,{mb:"4",children:e.jsx(r.Heading,{size:"4",children:o.text})})},Pe=x.rankWith(1,x.uiTypeIs("Label")),or=x.rankWith(3,x.isPrimitiveArrayControl),sr=[{tester:pe,renderer:He},{tester:ge,renderer:qe},{tester:me,renderer:Ge},{tester:ve,renderer:Ke},{tester:Se,renderer:Ce},{tester:Te,renderer:_e},{tester:Fe,renderer:er},{tester:Re,renderer:ze},{tester:$e,renderer:ke},{tester:De,renderer:Be},{tester:Oe,renderer:Le},{tester:Ee,renderer:Ie},{tester:Ae,renderer:se},{tester:or,renderer:se},{tester:Pe,renderer:Ue}];exports.ArrayControl=se;exports.ArrayControlTester=Ae;exports.BooleanControl=je;exports.BooleanControlTester=me;exports.CategorizationLayoutRenderer=Le;exports.CategorizationLayoutTester=Oe;exports.DateControl=we;exports.DateControlTester=Fe;exports.FileControl=Ie;exports.FileControlTester=Ee;exports.GroupLayoutRenderer=Be;exports.GroupLayoutTester=De;exports.HorizontalLayoutRenderer=ke;exports.HorizontalLayoutTester=$e;exports.LabelRenderer=Ue;exports.LabelTester=Pe;exports.NumberControl=he;exports.NumberControlTester=ge;exports.RadioControl=ye;exports.RadioControlTester=ve;exports.SearchSelectControl=Ce;exports.SearchSelectControlTester=Se;exports.SearchServiceProvider=Me;exports.SelectControl=be;exports.SelectControlTester=Te;exports.TextControl=fe;exports.TextControlTester=pe;exports.UploadProvider=Je;exports.VerticalLayoutRenderer=ze;exports.VerticalLayoutTester=Re;exports.radixRenderers=sr;exports.useSearchService=xe;exports.useUpload=de;
|