@opennsw/jsonforms-renderers 0.0.1
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 +67 -0
- package/dist/jsonforms-renderers.css +1 -0
- package/dist/renderers.cjs.js +6 -0
- package/dist/renderers.es.js +379 -0
- package/package.json +43 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { ControlProps } from '@jsonforms/core';
|
|
3
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
4
|
+
import { JSX } from 'react/jsx-runtime';
|
|
5
|
+
import { LayoutProps } from '@jsonforms/core';
|
|
6
|
+
import { OwnPropsOfControl } from '@jsonforms/core';
|
|
7
|
+
import { RankedTester } from '@jsonforms/core';
|
|
8
|
+
import { TesterContext } from '@jsonforms/core';
|
|
9
|
+
import { UISchemaElement } from '@jsonforms/core';
|
|
10
|
+
|
|
11
|
+
export declare const BooleanControl: ({ data, handleChange, path, label, required, errors, schema, enabled }: ControlProps) => JSX.Element;
|
|
12
|
+
|
|
13
|
+
export declare const BooleanControlTester: RankedTester;
|
|
14
|
+
|
|
15
|
+
export declare interface CategorizationLayoutProps extends LayoutProps {
|
|
16
|
+
data: any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare const CategorizationLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: CategorizationLayoutProps) => JSX.Element | null;
|
|
20
|
+
|
|
21
|
+
export declare const CategorizationLayoutTester: RankedTester;
|
|
22
|
+
|
|
23
|
+
export declare const DateControl: ({ data, handleChange, path, label, required, errors, schema, enabled }: ControlProps) => JSX.Element;
|
|
24
|
+
|
|
25
|
+
export declare const DateControlTester: RankedTester;
|
|
26
|
+
|
|
27
|
+
export declare const FileControl: ComponentType<OwnPropsOfControl>;
|
|
28
|
+
|
|
29
|
+
export declare const FileControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
30
|
+
|
|
31
|
+
export declare const GroupLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: LayoutProps) => JSX.Element;
|
|
32
|
+
|
|
33
|
+
export declare const GroupLayoutTester: RankedTester;
|
|
34
|
+
|
|
35
|
+
export declare const HorizontalLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: LayoutProps) => JSX.Element;
|
|
36
|
+
|
|
37
|
+
export declare const HorizontalLayoutTester: RankedTester;
|
|
38
|
+
|
|
39
|
+
export declare const LabelRenderer: ({ uischema, visible }: any) => JSX.Element | null;
|
|
40
|
+
|
|
41
|
+
export declare const LabelTester: RankedTester;
|
|
42
|
+
|
|
43
|
+
export declare const NumberControl: ({ data, handleChange, path, label, required, errors, uischema, schema, enabled }: ControlProps) => JSX.Element;
|
|
44
|
+
|
|
45
|
+
export declare const NumberControlTester: RankedTester;
|
|
46
|
+
|
|
47
|
+
export declare const radixRenderers: ({
|
|
48
|
+
tester: RankedTester;
|
|
49
|
+
renderer: ComponentType<OwnPropsOfControl>;
|
|
50
|
+
} | {
|
|
51
|
+
tester: RankedTester;
|
|
52
|
+
renderer: ({ uischema, schema, path, renderers, cells, enabled }: CategorizationLayoutProps) => JSX.Element | null;
|
|
53
|
+
})[];
|
|
54
|
+
|
|
55
|
+
export declare const SelectControl: ({ data, handleChange, path, label, required, errors, schema, uischema, enabled }: ControlProps) => JSX.Element;
|
|
56
|
+
|
|
57
|
+
export declare const SelectControlTester: RankedTester;
|
|
58
|
+
|
|
59
|
+
export declare const TextControl: ({ data, handleChange, path, label, required, errors, uischema, schema, enabled }: ControlProps) => JSX.Element;
|
|
60
|
+
|
|
61
|
+
export declare const TextControlTester: RankedTester;
|
|
62
|
+
|
|
63
|
+
export declare const VerticalLayoutRenderer: ({ uischema, schema, path, renderers, cells, enabled }: LayoutProps) => JSX.Element;
|
|
64
|
+
|
|
65
|
+
export declare const VerticalLayoutTester: RankedTester;
|
|
66
|
+
|
|
67
|
+
export { }
|
|
@@ -0,0 +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}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@jsonforms/core"),C=require("@jsonforms/react"),r=require("@radix-ui/themes"),v=require("react"),F=require("@radix-ui/react-icons"),N=({data:s,handleChange:u,path:t,label:g,required:p,errors:n,uischema:c,schema:l,enabled:x})=>{var m;const d=n.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:[g," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{value:s||"",onChange:b=>u(t,b.target.value),disabled:!x,placeholder:(m=c.options)==null?void 0:m.placeholder,color:d?void 0:"red",id:t}),!d&&n!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:n}),l.description&&e.jsx(r.Text,{size:"1",color:"gray",children:l.description})]})})},R=a.rankWith(1,a.isStringControl),ne=C.withJsonFormsControlProps(N),S=({data:s,handleChange:u,path:t,label:g,required:p,errors:n,uischema:c,schema:l,enabled:x})=>{var b;const d=n.length===0,m=h=>{if(h===""){u(t,void 0);return}const i=Number(h);isNaN(i)||u(t,i)};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:[g," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"number",value:s??"",onChange:h=>m(h.target.value),disabled:!x,placeholder:(b=c.options)==null?void 0:b.placeholder,color:d?void 0:"red",id:t}),!d&&n!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:n}),l.description&&e.jsx(r.Text,{size:"1",color:"gray",children:l.description})]})})},$=a.rankWith(2,a.or(a.isNumberControl,a.isIntegerControl)),se=C.withJsonFormsControlProps(S),B=({data:s,handleChange:u,path:t,label:g,required:p,errors:n,schema:c,enabled:l})=>{const x=n.length===0;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.Checkbox,{checked:!!s,onCheckedChange:d=>u(t,d===!0),disabled:!l,id:t}),e.jsxs(r.Text,{as:"label",size:"2",htmlFor:t,children:[g," ",p&&"*"]})]}),!x&&e.jsx(r.Text,{color:"red",size:"1",className:"block mt-1",children:n}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",className:"block mt-1",children:c.description})]})},I=a.rankWith(2,a.isBooleanControl),le=C.withJsonFormsControlProps(B),W=({data:s,handleChange:u,path:t,label:g,required:p,errors:n,schema:c,uischema:l,enabled:x})=>{var h;const d=n.length===0;let m=[];c.enum?m=c.enum.map(i=>({value:String(i),label:String(i)})):c.oneOf&&(m=c.oneOf.map(i=>({value:String(i.const),label:i.title||String(i.const)})));const b=s!==void 0?String(s):"";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:[g," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs(r.Select.Root,{value:b,onValueChange:i=>u(t,i),disabled:!x,children:[e.jsx(r.Select.Trigger,{placeholder:((h=l.options)==null?void 0:h.placeholder)||"Select an option",color:d?void 0:"red",id:t}),e.jsx(r.Select.Content,{children:m.map(i=>e.jsx(r.Select.Item,{value:i.value,children:i.label},i.value))})]}),!d&&n!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:n}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},V=a.rankWith(2,a.or(a.isEnumControl,a.isOneOfControl)),ie=C.withJsonFormsControlProps(W),P=({data:s,handleChange:u,path:t,label:g,required:p,errors:n,schema:c,enabled:l})=>{const x=n.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:[g," ",p&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"date",value:s||"",onChange:d=>u(t,d.target.value),disabled:!l,color:x?void 0:"red",id:t}),!x&&n!=="is a required property"&&e.jsx(r.Text,{color:"red",size:"1",children:n}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},q=a.rankWith(2,a.isDateControl),ae=C.withJsonFormsControlProps(P),J=({uischema:s,schema:u,path:t,renderers:g,cells:p,enabled:n})=>{const l=s.elements;return e.jsx(r.Flex,{direction:"column",gap:"4",children:l.map((x,d)=>e.jsx(C.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:g,cells:p,enabled:n},`${t}-${d}`))})},E=a.rankWith(1,a.uiTypeIs("VerticalLayout")),H=({uischema:s,schema:u,path:t,renderers:g,cells:p,enabled:n})=>{const l=s.elements;return e.jsx(r.Flex,{direction:"row",gap:"4",children:l.map((x,d)=>e.jsx(r.Box,{style:{flex:1},children:e.jsx(C.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:g,cells:p,enabled:n})},`${t}-${d}`))})},A=a.rankWith(1,a.uiTypeIs("HorizontalLayout")),M=({uischema:s,schema:u,path:t,renderers:g,cells:p,enabled:n})=>{const c=s,l=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:l.map((x,d)=>e.jsx(C.JsonFormsDispatch,{uischema:x,schema:u,path:t,renderers:g,cells:p,enabled:n},`${t}-${d}`))})]})},O=a.rankWith(1,a.uiTypeIs("Group")),G=({uischema:s,schema:u,path:t,renderers:g,cells:p,enabled:n})=>{var b;const l=s.elements.filter(h=>h.type==="Category"),[x,d]=v.useState(((b=l[0])==null?void 0:b.label)||"");if(!l.length)return null;const m=l.find(h=>h.label===x)?x:l[0].label;return e.jsxs(r.Tabs.Root,{value:m,onValueChange:d,children:[e.jsx(r.Tabs.List,{children:l.map((h,i)=>e.jsx(r.Tabs.Trigger,{value:h.label,children:h.label},`${t}-${i}`))}),e.jsx(r.Box,{pt:"3",children:l.map((h,i)=>e.jsx(r.Tabs.Content,{value:h.label,children:e.jsx(r.Flex,{direction:"column",gap:"4",children:h.elements.map((z,y)=>e.jsx(C.JsonFormsDispatch,{uischema:z,schema:u,path:t,renderers:g,cells:p,enabled:n},`${t}-${i}-${y}`))})},`${t}-${i}`))})]})},U=a.rankWith(1,a.uiTypeIs("Categorization")),ce=({data:s,handleChange:u,path:t,label:g,required:p,uischema:n,enabled:c})=>{const[l,x]=v.useState(!1),[d,m]=v.useState(null),[b,h]=v.useState(null),i=v.useRef(null),z=(n==null?void 0:n.options)||{},y=z.maxSize||5*1024*1024,f=z.accept||"image/*,application/pdf",T=c!==!1,Z=()=>b||(s?"Uploaded File":null),D=o=>{if(o.size>y){const j=(y/1048576).toFixed(0);m(`File size exceeds ${j}MB limit.`);return}const oe=f.split(",").map(j=>j.trim()).some(j=>j.endsWith("/*")?o.type.startsWith(j.slice(0,-1)):j.startsWith(".")?o.name.toLowerCase().endsWith(j.toLowerCase()):o.type===j);if(f!=="*"&&!oe&&!f.includes("*/*")){m(`Invalid file type. Accepted types: ${f}`);return}const k=new FileReader;k.onload=()=>{const j=k.result;u(t,j),h(o.name),m(null)},k.onerror=()=>{m("Failed to read file")},k.readAsDataURL(o)},w=o=>{o.preventDefault(),o.stopPropagation(),!(!T||s)&&(o.type==="dragenter"||o.type==="dragover"?x(!0):o.type==="dragleave"&&x(!1))},_=o=>{o.preventDefault(),o.stopPropagation(),x(!1),!(!T||s)&&o.dataTransfer.files&&o.dataTransfer.files[0]&&D(o.dataTransfer.files[0])},ee=o=>{o.target.files&&o.target.files[0]&&D(o.target.files[0])},re=()=>{T&&(u(t,null),h(null),m(null),i.current&&(i.current.value=""))},te=o=>{var L;T&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),(L=i.current)==null||L.click())};return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",mb:"1",className:"block",children:[g," ",p&&"*"]}),s?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(F.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:Z()}),T?e.jsx(r.Text,{size:"1",color:"gray",children:"Ready to submit"}):e.jsx("a",{href:s,download:b||"document",className:"text-xs text-blue-600 hover:underline cursor-pointer",onClick:o=>o.stopPropagation(),children:"Download"})]}),e.jsxs(r.Flex,{align:"center",gap:"2",children:[e.jsx(F.CheckCircledIcon,{className:"text-green-600 w-5 h-5"}),T&&e.jsx(r.IconButton,{variant:"ghost",color:"gray",onClick:re,className:"hover:text-red-600 transition-colors",children:e.jsx(F.Cross2Icon,{})})]})]})}):e.jsxs("div",{className:`
|
|
2
|
+
border-2 border-dashed rounded-lg p-6 text-center transition-all duration-200 ease-in-out
|
|
3
|
+
${l?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"}
|
|
4
|
+
${d?"border-red-300 bg-red-50":""}
|
|
5
|
+
${T?"cursor-pointer":"opacity-60 cursor-not-allowed pointer-events-none"}
|
|
6
|
+
`,onDragEnter:w,onDragLeave:w,onDragOver:w,onDrop:_,onClick:()=>{var o;return T&&((o=i.current)==null?void 0:o.click())},onKeyDown:te,role:"button",tabIndex:T?0:-1,children:[e.jsx("input",{ref:i,type:"file",className:"hidden",accept:f,onChange:ee,disabled:!T}),e.jsx(r.Flex,{direction:"column",align:"center",gap:"2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(F.ExclamationTriangleIcon,{className:"w-8 h-8 text-red-500"}),e.jsx(r.Text,{size:"2",color:"red",weight:"medium",children:d}),e.jsx(r.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(F.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(y/(1024*1024)),"MB"]})]})})]})]})},K=C.withJsonFormsControlProps(ce),Q=a.rankWith(3,a.formatIs("data-url")),X=({uischema:s,visible:u})=>{const t=s;return u===!1?null:e.jsx(r.Box,{mb:"4",children:e.jsx(r.Heading,{size:"4",children:t.text})})},Y=a.rankWith(1,a.uiTypeIs("Label")),de=[{tester:R,renderer:ne},{tester:$,renderer:se},{tester:I,renderer:le},{tester:V,renderer:ie},{tester:q,renderer:ae},{tester:E,renderer:J},{tester:A,renderer:H},{tester:O,renderer:M},{tester:U,renderer:G},{tester:Q,renderer:K},{tester:Y,renderer:X}];exports.BooleanControl=B;exports.BooleanControlTester=I;exports.CategorizationLayoutRenderer=G;exports.CategorizationLayoutTester=U;exports.DateControl=P;exports.DateControlTester=q;exports.FileControl=K;exports.FileControlTester=Q;exports.GroupLayoutRenderer=M;exports.GroupLayoutTester=O;exports.HorizontalLayoutRenderer=H;exports.HorizontalLayoutTester=A;exports.LabelRenderer=X;exports.LabelTester=Y;exports.NumberControl=S;exports.NumberControlTester=$;exports.SelectControl=W;exports.SelectControlTester=V;exports.TextControl=N;exports.TextControlTester=R;exports.VerticalLayoutRenderer=J;exports.VerticalLayoutTester=E;exports.radixRenderers=de;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { rankWith as z, isStringControl as U, or as W, isNumberControl as j, isIntegerControl as J, isBooleanControl as Q, isEnumControl as X, isOneOfControl as Y, isDateControl as Z, uiTypeIs as N, formatIs as _ } from "@jsonforms/core";
|
|
3
|
+
import { withJsonFormsControlProps as T, JsonFormsDispatch as S } from "@jsonforms/react";
|
|
4
|
+
import { Box as v, Flex as C, Text as c, TextField as B, Checkbox as ee, Select as k, Tabs as L, Card as M, Heading as O, IconButton as re } from "@radix-ui/themes";
|
|
5
|
+
import { useState as R, useRef as te } from "react";
|
|
6
|
+
import { FileTextIcon as oe, CheckCircledIcon as ne, Cross2Icon as le, ExclamationTriangleIcon as ie, UploadIcon as ce } from "@radix-ui/react-icons";
|
|
7
|
+
const se = ({ data: n, handleChange: d, path: r, label: p, required: m, errors: o, uischema: s, schema: l, enabled: u }) => {
|
|
8
|
+
var b;
|
|
9
|
+
const a = o.length === 0;
|
|
10
|
+
return /* @__PURE__ */ e(v, { mb: "4", children: /* @__PURE__ */ h(C, { direction: "column", gap: "1", children: [
|
|
11
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
12
|
+
p,
|
|
13
|
+
" ",
|
|
14
|
+
m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
15
|
+
] }),
|
|
16
|
+
/* @__PURE__ */ e(
|
|
17
|
+
B.Root,
|
|
18
|
+
{
|
|
19
|
+
value: n || "",
|
|
20
|
+
onChange: (f) => d(r, f.target.value),
|
|
21
|
+
disabled: !u,
|
|
22
|
+
placeholder: (b = s.options) == null ? void 0 : b.placeholder,
|
|
23
|
+
color: a ? void 0 : "red",
|
|
24
|
+
id: r
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
!a && o !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: o }),
|
|
28
|
+
l.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: l.description })
|
|
29
|
+
] }) });
|
|
30
|
+
}, ae = z(
|
|
31
|
+
1,
|
|
32
|
+
U
|
|
33
|
+
), de = T(se), ue = ({ data: n, handleChange: d, path: r, label: p, required: m, errors: o, uischema: s, schema: l, enabled: u }) => {
|
|
34
|
+
var f;
|
|
35
|
+
const a = o.length === 0, b = (g) => {
|
|
36
|
+
if (g === "") {
|
|
37
|
+
d(r, void 0);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const i = Number(g);
|
|
41
|
+
isNaN(i) || d(r, i);
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ e(v, { mb: "4", children: /* @__PURE__ */ h(C, { direction: "column", gap: "1", children: [
|
|
44
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
45
|
+
p,
|
|
46
|
+
" ",
|
|
47
|
+
m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
B.Root,
|
|
51
|
+
{
|
|
52
|
+
type: "number",
|
|
53
|
+
value: n ?? "",
|
|
54
|
+
onChange: (g) => b(g.target.value),
|
|
55
|
+
disabled: !u,
|
|
56
|
+
placeholder: (f = s.options) == null ? void 0 : f.placeholder,
|
|
57
|
+
color: a ? void 0 : "red",
|
|
58
|
+
id: r
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
!a && o !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: o }),
|
|
62
|
+
l.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: l.description })
|
|
63
|
+
] }) });
|
|
64
|
+
}, he = z(
|
|
65
|
+
2,
|
|
66
|
+
W(j, J)
|
|
67
|
+
), ge = T(ue), pe = ({ data: n, handleChange: d, path: r, label: p, required: m, errors: o, schema: s, enabled: l }) => {
|
|
68
|
+
const u = o.length === 0;
|
|
69
|
+
return /* @__PURE__ */ h(v, { mb: "4", children: [
|
|
70
|
+
/* @__PURE__ */ h(C, { gap: "2", align: "center", children: [
|
|
71
|
+
/* @__PURE__ */ e(
|
|
72
|
+
ee,
|
|
73
|
+
{
|
|
74
|
+
checked: !!n,
|
|
75
|
+
onCheckedChange: (a) => d(r, a === !0),
|
|
76
|
+
disabled: !l,
|
|
77
|
+
id: r
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", htmlFor: r, children: [
|
|
81
|
+
p,
|
|
82
|
+
" ",
|
|
83
|
+
m && "*"
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
86
|
+
!u && /* @__PURE__ */ e(c, { color: "red", size: "1", className: "block mt-1", children: o }),
|
|
87
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", className: "block mt-1", children: s.description })
|
|
88
|
+
] });
|
|
89
|
+
}, me = z(
|
|
90
|
+
2,
|
|
91
|
+
Q
|
|
92
|
+
), be = T(pe), fe = ({ data: n, handleChange: d, path: r, label: p, required: m, errors: o, schema: s, uischema: l, enabled: u }) => {
|
|
93
|
+
var g;
|
|
94
|
+
const a = o.length === 0;
|
|
95
|
+
let b = [];
|
|
96
|
+
s.enum ? b = s.enum.map((i) => ({ value: String(i), label: String(i) })) : s.oneOf && (b = s.oneOf.map((i) => ({
|
|
97
|
+
value: String(i.const),
|
|
98
|
+
label: i.title || String(i.const)
|
|
99
|
+
})));
|
|
100
|
+
const f = n !== void 0 ? String(n) : "";
|
|
101
|
+
return /* @__PURE__ */ e(v, { mb: "4", children: /* @__PURE__ */ h(C, { direction: "column", gap: "1", children: [
|
|
102
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
103
|
+
p,
|
|
104
|
+
" ",
|
|
105
|
+
m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ h(
|
|
108
|
+
k.Root,
|
|
109
|
+
{
|
|
110
|
+
value: f,
|
|
111
|
+
onValueChange: (i) => d(r, i),
|
|
112
|
+
disabled: !u,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ e(
|
|
115
|
+
k.Trigger,
|
|
116
|
+
{
|
|
117
|
+
placeholder: ((g = l.options) == null ? void 0 : g.placeholder) || "Select an option",
|
|
118
|
+
color: a ? void 0 : "red",
|
|
119
|
+
id: r
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ e(k.Content, { children: b.map((i) => /* @__PURE__ */ e(k.Item, { value: i.value, children: i.label }, i.value)) })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
!a && o !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: o }),
|
|
127
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
|
|
128
|
+
] }) });
|
|
129
|
+
}, Ce = z(
|
|
130
|
+
2,
|
|
131
|
+
W(X, Y)
|
|
132
|
+
), ye = T(fe), ve = ({ data: n, handleChange: d, path: r, label: p, required: m, errors: o, schema: s, enabled: l }) => {
|
|
133
|
+
const u = o.length === 0;
|
|
134
|
+
return /* @__PURE__ */ e(v, { mb: "4", children: /* @__PURE__ */ h(C, { direction: "column", gap: "1", children: [
|
|
135
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
136
|
+
p,
|
|
137
|
+
" ",
|
|
138
|
+
m && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
B.Root,
|
|
142
|
+
{
|
|
143
|
+
type: "date",
|
|
144
|
+
value: n || "",
|
|
145
|
+
onChange: (a) => d(r, a.target.value),
|
|
146
|
+
disabled: !l,
|
|
147
|
+
color: u ? void 0 : "red",
|
|
148
|
+
id: r
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
!u && o !== "is a required property" && /* @__PURE__ */ e(c, { color: "red", size: "1", children: o }),
|
|
152
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
|
|
153
|
+
] }) });
|
|
154
|
+
}, ze = z(
|
|
155
|
+
2,
|
|
156
|
+
Z
|
|
157
|
+
), xe = T(ve), Te = ({ uischema: n, schema: d, path: r, renderers: p, cells: m, enabled: o }) => {
|
|
158
|
+
const l = n.elements;
|
|
159
|
+
return /* @__PURE__ */ e(C, { direction: "column", gap: "4", children: l.map((u, a) => /* @__PURE__ */ e(
|
|
160
|
+
S,
|
|
161
|
+
{
|
|
162
|
+
uischema: u,
|
|
163
|
+
schema: d,
|
|
164
|
+
path: r,
|
|
165
|
+
renderers: p,
|
|
166
|
+
cells: m,
|
|
167
|
+
enabled: o
|
|
168
|
+
},
|
|
169
|
+
`${r}-${a}`
|
|
170
|
+
)) });
|
|
171
|
+
}, we = z(1, N("VerticalLayout")), Fe = ({ uischema: n, schema: d, path: r, renderers: p, cells: m, enabled: o }) => {
|
|
172
|
+
const l = n.elements;
|
|
173
|
+
return /* @__PURE__ */ e(C, { direction: "row", gap: "4", children: l.map((u, a) => /* @__PURE__ */ e(v, { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
174
|
+
S,
|
|
175
|
+
{
|
|
176
|
+
uischema: u,
|
|
177
|
+
schema: d,
|
|
178
|
+
path: r,
|
|
179
|
+
renderers: p,
|
|
180
|
+
cells: m,
|
|
181
|
+
enabled: o
|
|
182
|
+
}
|
|
183
|
+
) }, `${r}-${a}`)) });
|
|
184
|
+
}, Ne = z(1, N("HorizontalLayout")), $e = ({ uischema: n, schema: d, path: r, renderers: p, cells: m, enabled: o }) => {
|
|
185
|
+
const s = n, l = s.elements;
|
|
186
|
+
return /* @__PURE__ */ h(M, { mb: "4", children: [
|
|
187
|
+
s.label && /* @__PURE__ */ e(O, { size: "4", mb: "4", children: s.label }),
|
|
188
|
+
/* @__PURE__ */ e(C, { direction: "column", gap: "4", children: l.map((u, a) => /* @__PURE__ */ e(
|
|
189
|
+
S,
|
|
190
|
+
{
|
|
191
|
+
uischema: u,
|
|
192
|
+
schema: d,
|
|
193
|
+
path: r,
|
|
194
|
+
renderers: p,
|
|
195
|
+
cells: m,
|
|
196
|
+
enabled: o
|
|
197
|
+
},
|
|
198
|
+
`${r}-${a}`
|
|
199
|
+
)) })
|
|
200
|
+
] });
|
|
201
|
+
}, De = z(1, N("Group")), ke = ({ uischema: n, schema: d, path: r, renderers: p, cells: m, enabled: o }) => {
|
|
202
|
+
var f;
|
|
203
|
+
const l = n.elements.filter((g) => g.type === "Category"), [u, a] = R(((f = l[0]) == null ? void 0 : f.label) || "");
|
|
204
|
+
if (!l.length) return null;
|
|
205
|
+
const b = l.find((g) => g.label === u) ? u : l[0].label;
|
|
206
|
+
return /* @__PURE__ */ h(L.Root, { value: b, onValueChange: a, children: [
|
|
207
|
+
/* @__PURE__ */ e(L.List, { children: l.map((g, i) => /* @__PURE__ */ e(L.Trigger, { value: g.label, children: g.label }, `${r}-${i}`)) }),
|
|
208
|
+
/* @__PURE__ */ e(v, { pt: "3", children: l.map((g, i) => /* @__PURE__ */ e(L.Content, { value: g.label, children: /* @__PURE__ */ e(C, { direction: "column", gap: "4", children: g.elements.map(($, w) => /* @__PURE__ */ e(
|
|
209
|
+
S,
|
|
210
|
+
{
|
|
211
|
+
uischema: $,
|
|
212
|
+
schema: d,
|
|
213
|
+
path: r,
|
|
214
|
+
renderers: p,
|
|
215
|
+
cells: m,
|
|
216
|
+
enabled: o
|
|
217
|
+
},
|
|
218
|
+
`${r}-${i}-${w}`
|
|
219
|
+
)) }) }, `${r}-${i}`)) })
|
|
220
|
+
] });
|
|
221
|
+
}, Le = z(1, N("Categorization")), Re = ({ data: n, handleChange: d, path: r, label: p, required: m, uischema: o, enabled: s }) => {
|
|
222
|
+
const [l, u] = R(!1), [a, b] = R(null), [f, g] = R(null), i = te(null), $ = (o == null ? void 0 : o.options) || {}, w = $.maxSize || 5 * 1024 * 1024, F = $.accept || "image/*,application/pdf", x = s !== !1, P = () => f || (n ? "Uploaded File" : null), E = (t) => {
|
|
223
|
+
if (t.size > w) {
|
|
224
|
+
const y = (w / 1048576).toFixed(0);
|
|
225
|
+
b(`File size exceeds ${y}MB limit.`);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const K = F.split(",").map((y) => y.trim()).some((y) => y.endsWith("/*") ? t.type.startsWith(y.slice(0, -1)) : y.startsWith(".") ? t.name.toLowerCase().endsWith(y.toLowerCase()) : t.type === y);
|
|
229
|
+
if (F !== "*" && !K && !F.includes("*/*")) {
|
|
230
|
+
b(`Invalid file type. Accepted types: ${F}`);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const D = new FileReader();
|
|
234
|
+
D.onload = () => {
|
|
235
|
+
const y = D.result;
|
|
236
|
+
d(r, y), g(t.name), b(null);
|
|
237
|
+
}, D.onerror = () => {
|
|
238
|
+
b("Failed to read file");
|
|
239
|
+
}, D.readAsDataURL(t);
|
|
240
|
+
}, I = (t) => {
|
|
241
|
+
t.preventDefault(), t.stopPropagation(), !(!x || n) && (t.type === "dragenter" || t.type === "dragover" ? u(!0) : t.type === "dragleave" && u(!1));
|
|
242
|
+
}, q = (t) => {
|
|
243
|
+
t.preventDefault(), t.stopPropagation(), u(!1), !(!x || n) && t.dataTransfer.files && t.dataTransfer.files[0] && E(t.dataTransfer.files[0]);
|
|
244
|
+
}, H = (t) => {
|
|
245
|
+
t.target.files && t.target.files[0] && E(t.target.files[0]);
|
|
246
|
+
}, G = () => {
|
|
247
|
+
x && (d(r, null), g(null), b(null), i.current && (i.current.value = ""));
|
|
248
|
+
};
|
|
249
|
+
return /* @__PURE__ */ h(v, { mb: "4", children: [
|
|
250
|
+
/* @__PURE__ */ h(c, { as: "label", size: "2", weight: "bold", mb: "1", className: "block", children: [
|
|
251
|
+
p,
|
|
252
|
+
" ",
|
|
253
|
+
m && "*"
|
|
254
|
+
] }),
|
|
255
|
+
n ? /* @__PURE__ */ e(M, { size: "2", variant: "surface", className: "relative group", children: /* @__PURE__ */ h(C, { align: "center", gap: "3", children: [
|
|
256
|
+
/* @__PURE__ */ e(v, { className: "bg-blue-100 p-2 rounded text-blue-600", children: /* @__PURE__ */ e(oe, { width: "20", height: "20" }) }),
|
|
257
|
+
/* @__PURE__ */ h(v, { style: { flex: 1, overflow: "hidden" }, children: [
|
|
258
|
+
/* @__PURE__ */ e(c, { size: "2", weight: "bold", className: "block truncate", children: P() }),
|
|
259
|
+
x ? /* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Ready to submit" }) : /* @__PURE__ */ e(
|
|
260
|
+
"a",
|
|
261
|
+
{
|
|
262
|
+
href: n,
|
|
263
|
+
download: f || "document",
|
|
264
|
+
className: "text-xs text-blue-600 hover:underline cursor-pointer",
|
|
265
|
+
onClick: (t) => t.stopPropagation(),
|
|
266
|
+
children: "Download"
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }),
|
|
270
|
+
/* @__PURE__ */ h(C, { align: "center", gap: "2", children: [
|
|
271
|
+
/* @__PURE__ */ e(ne, { className: "text-green-600 w-5 h-5" }),
|
|
272
|
+
x && /* @__PURE__ */ e(
|
|
273
|
+
re,
|
|
274
|
+
{
|
|
275
|
+
variant: "ghost",
|
|
276
|
+
color: "gray",
|
|
277
|
+
onClick: G,
|
|
278
|
+
className: "hover:text-red-600 transition-colors",
|
|
279
|
+
children: /* @__PURE__ */ e(le, {})
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
] })
|
|
283
|
+
] }) }) : /* @__PURE__ */ h(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
className: `
|
|
287
|
+
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
|
+
${a ? "border-red-300 bg-red-50" : ""}
|
|
290
|
+
${x ? "cursor-pointer" : "opacity-60 cursor-not-allowed pointer-events-none"}
|
|
291
|
+
`,
|
|
292
|
+
onDragEnter: I,
|
|
293
|
+
onDragLeave: I,
|
|
294
|
+
onDragOver: I,
|
|
295
|
+
onDrop: q,
|
|
296
|
+
onClick: () => {
|
|
297
|
+
var t;
|
|
298
|
+
return x && ((t = i.current) == null ? void 0 : t.click());
|
|
299
|
+
},
|
|
300
|
+
onKeyDown: (t) => {
|
|
301
|
+
var V;
|
|
302
|
+
x && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), (V = i.current) == null || V.click());
|
|
303
|
+
},
|
|
304
|
+
role: "button",
|
|
305
|
+
tabIndex: x ? 0 : -1,
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ e(
|
|
308
|
+
"input",
|
|
309
|
+
{
|
|
310
|
+
ref: i,
|
|
311
|
+
type: "file",
|
|
312
|
+
className: "hidden",
|
|
313
|
+
accept: F,
|
|
314
|
+
onChange: H,
|
|
315
|
+
disabled: !x
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e(C, { direction: "column", align: "center", gap: "2", children: a ? /* @__PURE__ */ h(A, { children: [
|
|
319
|
+
/* @__PURE__ */ e(ie, { className: "w-8 h-8 text-red-500" }),
|
|
320
|
+
/* @__PURE__ */ e(c, { size: "2", color: "red", weight: "medium", children: a }),
|
|
321
|
+
/* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Click to try again" })
|
|
322
|
+
] }) : /* @__PURE__ */ h(A, { children: [
|
|
323
|
+
/* @__PURE__ */ e(ce, { className: "w-8 h-8 text-gray-400" }),
|
|
324
|
+
/* @__PURE__ */ e(c, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
|
|
325
|
+
/* @__PURE__ */ h(c, { size: "1", color: "gray", children: [
|
|
326
|
+
"Max ",
|
|
327
|
+
Math.round(w / (1024 * 1024)),
|
|
328
|
+
"MB"
|
|
329
|
+
] })
|
|
330
|
+
] }) })
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] });
|
|
335
|
+
}, Se = T(Re), Ie = z(
|
|
336
|
+
3,
|
|
337
|
+
// Rank
|
|
338
|
+
_("data-url")
|
|
339
|
+
), Ve = ({ uischema: n, visible: d }) => {
|
|
340
|
+
const r = n;
|
|
341
|
+
return d === !1 ? null : /* @__PURE__ */ e(v, { mb: "4", children: /* @__PURE__ */ e(O, { size: "4", children: r.text }) });
|
|
342
|
+
}, Be = z(1, N("Label")), He = [
|
|
343
|
+
{ tester: ae, renderer: de },
|
|
344
|
+
{ tester: he, renderer: ge },
|
|
345
|
+
{ tester: me, renderer: be },
|
|
346
|
+
{ tester: Ce, renderer: ye },
|
|
347
|
+
{ tester: ze, renderer: xe },
|
|
348
|
+
{ tester: we, renderer: Te },
|
|
349
|
+
{ tester: Ne, renderer: Fe },
|
|
350
|
+
{ tester: De, renderer: $e },
|
|
351
|
+
{ tester: Le, renderer: ke },
|
|
352
|
+
{ tester: Ie, renderer: Se },
|
|
353
|
+
{ tester: Be, renderer: Ve }
|
|
354
|
+
];
|
|
355
|
+
export {
|
|
356
|
+
pe as BooleanControl,
|
|
357
|
+
me as BooleanControlTester,
|
|
358
|
+
ke as CategorizationLayoutRenderer,
|
|
359
|
+
Le as CategorizationLayoutTester,
|
|
360
|
+
ve as DateControl,
|
|
361
|
+
ze as DateControlTester,
|
|
362
|
+
Se as FileControl,
|
|
363
|
+
Ie as FileControlTester,
|
|
364
|
+
$e as GroupLayoutRenderer,
|
|
365
|
+
De as GroupLayoutTester,
|
|
366
|
+
Fe as HorizontalLayoutRenderer,
|
|
367
|
+
Ne as HorizontalLayoutTester,
|
|
368
|
+
Ve as LabelRenderer,
|
|
369
|
+
Be as LabelTester,
|
|
370
|
+
ue as NumberControl,
|
|
371
|
+
he as NumberControlTester,
|
|
372
|
+
fe as SelectControl,
|
|
373
|
+
Ce as SelectControlTester,
|
|
374
|
+
se as TextControl,
|
|
375
|
+
ae as TextControlTester,
|
|
376
|
+
Te as VerticalLayoutRenderer,
|
|
377
|
+
we as VerticalLayoutTester,
|
|
378
|
+
He as radixRenderers
|
|
379
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opennsw/jsonforms-renderers",
|
|
3
|
+
"version": "0.0.1",
|
|
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
|
+
"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
|
+
}
|