@net-advantage/nabs-ui-dynamicform 0.30.0 → 0.33.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.
@@ -1,6 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);let t=require("react");var n={right:`nabs-ui-checkbox--label-right`,left:`nabs-ui-checkbox--label-left`,top:`nabs-ui-checkbox--label-top`,bottom:`nabs-ui-checkbox--label-bottom`},r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),i=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),a=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=r():t.exports=i()}))(),o=(0,t.forwardRef)(function({label:e=`Checkbox`,labelPosition:r=`right`,className:i=``,inputClassName:o=``,labelClassName:s=``,id:c,disabled:l,...u},d){let f=(0,t.useId)(),p=c??`nabs-ui-checkbox-${f.replace(/:/g,``)}`,m=[`nabs-ui-checkbox`,l?`nabs-ui-checkbox--disabled`:``,n[r]??n.right,i].filter(Boolean).join(` `),h=[`nabs-ui-checkbox__input`,o].filter(Boolean).join(` `),g=[`nabs-ui-checkbox__label`,s].filter(Boolean).join(` `);return(0,a.jsxs)(`label`,{className:m,htmlFor:p,children:[(0,a.jsx)(`input`,{ref:d,id:p,className:h,type:`checkbox`,disabled:l,...u}),(0,a.jsx)(`span`,{className:g,children:e})]})});o.displayName=`Checkbox`;var s={right:`nabs-ui-radiobutton--label-right`,left:`nabs-ui-radiobutton--label-left`,top:`nabs-ui-radiobutton--label-top`,bottom:`nabs-ui-radiobutton--label-bottom`};function c({label:e=`Radio button`,labelPosition:n=`right`,className:r=``,inputClassName:i=``,labelClassName:o=``,id:c,...l}){let u=l.disabled===!0,d=(0,t.useId)(),f=c??`nabs-ui-radiobutton-${d.replace(/:/g,``)}`,p=[`nabs-ui-radiobutton`,u?`nabs-ui-radiobutton--disabled`:``,s[n]??s.right,r].filter(Boolean).join(` `),m=[`nabs-ui-radiobutton__input`,i].filter(Boolean).join(` `),h=[`nabs-ui-radiobutton__label`,o].filter(Boolean).join(` `);return(0,a.jsxs)(`label`,{className:p,htmlFor:f,children:[(0,a.jsx)(`input`,{id:f,className:m,type:`radio`,...l}),(0,a.jsx)(`span`,{className:h,children:e})]})}var l=(0,t.forwardRef)(({label:e,className:n=``,inputClassName:r=``,labelClassName:i=``,id:o,rows:s=4,resize:c=`vertical`,...l},u)=>{let d=(0,t.useId)(),f=o??`nabs-ui-textarea-${d.replace(/:/g,``)}`,p=[`nabs-ui-textarea`,n].filter(Boolean).join(` `),m=[`nabs-ui-textarea__input`,r].filter(Boolean).join(` `),h=[`nabs-ui-textarea__label`,i].filter(Boolean).join(` `);return(0,a.jsxs)(`div`,{className:p,children:[e?(0,a.jsx)(`label`,{className:h,htmlFor:f,children:e}):null,(0,a.jsx)(`textarea`,{ref:u,id:f,className:m,rows:s,"data-resize":c,...l})]})});l.displayName=`Textarea`;var u={none:``,top:`nabs-ui-textbox--label-top`,left:`nabs-ui-textbox--label-left`},d=(0,t.forwardRef)(({label:e,labelPosition:n=`top`,className:r=``,inputClassName:i=``,labelClassName:o=``,id:s,type:c=`text`,...l},d)=>{let f=(0,t.useId)(),p=s??`nabs-ui-textbox-${f.replace(/:/g,``)}`,m=[`nabs-ui-textbox`,e?u[n]??u.top:``,r].filter(Boolean).join(` `),h=[`nabs-ui-textbox__input`,i].filter(Boolean).join(` `),g=[`nabs-ui-textbox__label`,o].filter(Boolean).join(` `);return(0,a.jsxs)(`div`,{className:m,children:[e?(0,a.jsx)(`label`,{className:g,htmlFor:p,children:e}):null,(0,a.jsx)(`input`,{ref:d,id:p,className:h,type:c,...l})]})});d.displayName=`Textbox`;function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return!e||e.type!==`object`||!f(e.properties)?{}:Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,m(t)]))}function m(e){if(!e||!f(e))return``;if(e.default!==void 0)return e.default;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];switch(e.type){case`boolean`:return!1;case`integer`:case`number`:return``;case`object`:return p(e);default:return``}}function h(e,t){if(!e||!f(e))return t;if(e.type===`object`&&f(e.properties)){let n=f(t)?t:{};return Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,h(t,n[e]===void 0?m(t):n[e])]))}if(e.type===`boolean`)return t===!0;if(e.type===`integer`){if(t===``||t==null)return``;let e=Number.parseInt(String(t),10);return Number.isNaN(e)?``:e}if(e.type===`number`){if(t===``||t==null)return``;let e=Number.parseFloat(String(t));return Number.isNaN(e)?``:e}return t??``}function g(e){return!e||!f(e)?`textbox`:Array.isArray(e.enum)&&e.enum.length>0?`radio`:e.type===`string`?e.maxLength!==void 0&&e.maxLength>50?`textarea`:`textbox`:e.type===`integer`?`int`:e.type===`number`?String(e.format??``).toLowerCase()===`decimal`?`decimal`:`double`:e.type===`boolean`?`bool`:`textbox`}var _={type:`object`,properties:{}};function v({schema:e,name:t,value:n,onChange:r}){let i=e.title??t,s=e.description,u=g(e),f=n??m(e);if(u===`radio`){let n=Array.isArray(e.enum)?e.enum:[];return(0,a.jsxs)(`fieldset`,{className:`nabs-ui-dynamicform__fieldset`,children:[(0,a.jsx)(`legend`,{className:`nabs-ui-dynamicform__legend`,children:i}),s?(0,a.jsx)(`p`,{className:`nabs-ui-dynamicform__description`,children:s}):null,(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__radioGroup`,children:n.map(e=>(0,a.jsx)(c,{label:String(e),name:t,checked:f===e,onChange:()=>r(e)},String(e)))})]})}return u===`textarea`?(0,a.jsx)(l,{label:i,rows:5,value:String(f??``),placeholder:String(e.default??``),onChange:e=>r(e.target.value)}):u===`bool`?(0,a.jsx)(o,{label:i,checked:f===!0,onChange:e=>r(e.target.checked)}):(0,a.jsx)(d,{label:i,type:u===`int`||u===`decimal`||u===`double`?`number`:`text`,step:u===`int`?1:u===`decimal`||u===`double`?`any`:void 0,value:String(f??``),placeholder:String(e.default??``),onChange:e=>{let t=e.target.value;if(u===`int`){r(t===``?``:Number.parseInt(t,10));return}if(u===`decimal`||u===`double`){r(t===``?``:Number.parseFloat(t));return}r(t)}})}var y=(0,t.forwardRef)(function({schema:e,value:n,onChange:r,className:i=``,id:o,disabled:s=!1,...c},l){let u=(0,t.useId)(),d=o??`nabs-ui-dynamicform-${u.replace(/:/g,``)}`,m=e&&e.type===`object`?e:_,[g,y]=(0,t.useState)(()=>h(m,n??p(m)));(0,t.useEffect)(()=>{y(h(m,n??p(m)))},[m,n]);let b=f(g)?g:{},x=m.title??`Dynamic form`,S=m.description,C=[`nabs-ui-dynamicform`,s?`nabs-ui-dynamicform--disabled`:``,i].filter(Boolean).join(` `),w=e=>{y(e),r?.(e)};return s?(0,a.jsxs)(`div`,{ref:l,id:d,className:C,"aria-disabled":`true`,...c,children:[(0,a.jsxs)(`div`,{className:`nabs-ui-dynamicform__header`,children:[(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__title`,children:x}),S?(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__description`,children:S}):null]}),(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__fields`,children:Object.entries(m.properties??{}).map(([e,t])=>(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__field`,children:(0,a.jsx)(v,{schema:t,name:e,value:b[e],onChange:n=>w({...b,[e]:h(t,n)})})},e))})]}):(0,a.jsxs)(`div`,{ref:l,id:d,className:C,...c,children:[(0,a.jsxs)(`div`,{className:`nabs-ui-dynamicform__header`,children:[(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__title`,children:x}),S?(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__description`,children:S}):null]}),(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__fields`,children:Object.entries(m.properties??{}).map(([e,t])=>(0,a.jsx)(`div`,{className:`nabs-ui-dynamicform__field`,children:(0,a.jsx)(v,{schema:t,name:e,value:b[e],onChange:n=>w({...b,[e]:h(t,n)})})},e))})]})});y.displayName=`DynamicForm`,exports.DynamicForm=y;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime");var n={right:`nabs-ui-checkbox--label-right`,left:`nabs-ui-checkbox--label-left`,top:`nabs-ui-checkbox--label-top`,bottom:`nabs-ui-checkbox--label-bottom`},r=(0,e.forwardRef)(function({label:r=`Checkbox`,labelPosition:i=`right`,className:a=``,inputClassName:o=``,labelClassName:s=``,id:c,disabled:l,...u},d){let f=(0,e.useId)(),p=c??`nabs-ui-checkbox-${f.replace(/:/g,``)}`,m=[`nabs-ui-checkbox`,l?`nabs-ui-checkbox--disabled`:``,n[i]??n.right,a].filter(Boolean).join(` `),h=[`nabs-ui-checkbox__input`,o].filter(Boolean).join(` `),g=[`nabs-ui-checkbox__label`,s].filter(Boolean).join(` `);return(0,t.jsxs)(`label`,{className:m,htmlFor:p,children:[(0,t.jsx)(`input`,{ref:d,id:p,className:h,type:`checkbox`,disabled:l,...u}),(0,t.jsx)(`span`,{className:g,children:r})]})});r.displayName=`Checkbox`;var i={right:`nabs-ui-radiobutton--label-right`,left:`nabs-ui-radiobutton--label-left`,top:`nabs-ui-radiobutton--label-top`,bottom:`nabs-ui-radiobutton--label-bottom`};function a({label:n=`Radio button`,labelPosition:r=`right`,className:a=``,inputClassName:o=``,labelClassName:s=``,id:c,...l}){let u=l.disabled===!0,d=(0,e.useId)(),f=c??`nabs-ui-radiobutton-${d.replace(/:/g,``)}`,p=[`nabs-ui-radiobutton`,u?`nabs-ui-radiobutton--disabled`:``,i[r]??i.right,a].filter(Boolean).join(` `),m=[`nabs-ui-radiobutton__input`,o].filter(Boolean).join(` `),h=[`nabs-ui-radiobutton__label`,s].filter(Boolean).join(` `);return(0,t.jsxs)(`label`,{className:p,htmlFor:f,children:[(0,t.jsx)(`input`,{id:f,className:m,type:`radio`,...l}),(0,t.jsx)(`span`,{className:h,children:n})]})}var o=(0,e.forwardRef)(({label:n,className:r=``,inputClassName:i=``,labelClassName:a=``,id:o,rows:s=4,resize:c=`vertical`,...l},u)=>{let d=(0,e.useId)(),f=o??`nabs-ui-textarea-${d.replace(/:/g,``)}`,p=[`nabs-ui-textarea`,r].filter(Boolean).join(` `),m=[`nabs-ui-textarea__input`,i].filter(Boolean).join(` `),h=[`nabs-ui-textarea__label`,a].filter(Boolean).join(` `);return(0,t.jsxs)(`div`,{className:p,children:[n?(0,t.jsx)(`label`,{className:h,htmlFor:f,children:n}):null,(0,t.jsx)(`textarea`,{ref:u,id:f,className:m,rows:s,"data-resize":c,...l})]})});o.displayName=`Textarea`;var s={none:``,top:`nabs-ui-textbox--label-top`,left:`nabs-ui-textbox--label-left`},c=(0,e.forwardRef)(({label:n,labelPosition:r=`top`,className:i=``,inputClassName:a=``,labelClassName:o=``,id:c,type:l=`text`,...u},d)=>{let f=(0,e.useId)(),p=c??`nabs-ui-textbox-${f.replace(/:/g,``)}`,m=[`nabs-ui-textbox`,n?s[r]??s.top:``,i].filter(Boolean).join(` `),h=[`nabs-ui-textbox__input`,a].filter(Boolean).join(` `),g=[`nabs-ui-textbox__label`,o].filter(Boolean).join(` `);return(0,t.jsxs)(`div`,{className:m,children:[n?(0,t.jsx)(`label`,{className:g,htmlFor:p,children:n}):null,(0,t.jsx)(`input`,{ref:d,id:p,className:h,type:l,...u})]})});c.displayName=`Textbox`;function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return!e||e.type!==`object`||!l(e.properties)?{}:Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,d(t)]))}function d(e){if(!e||!l(e))return``;if(e.default!==void 0)return e.default;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];switch(e.type){case`boolean`:return!1;case`integer`:case`number`:return``;case`object`:return u(e);default:return``}}function f(e,t){if(!e||!l(e))return t;if(e.type===`object`&&l(e.properties)){let n=l(t)?t:{};return Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,f(t,n[e]===void 0?d(t):n[e])]))}if(e.type===`boolean`)return t===!0;if(e.type===`integer`){if(t===``||t==null)return``;let e=Number.parseInt(String(t),10);return Number.isNaN(e)?``:e}if(e.type===`number`){if(t===``||t==null)return``;let e=Number.parseFloat(String(t));return Number.isNaN(e)?``:e}return t??``}function p(e){return!e||!l(e)?`textbox`:Array.isArray(e.enum)&&e.enum.length>0?`radio`:e.type===`string`?e.maxLength!==void 0&&e.maxLength>50?`textarea`:`textbox`:e.type===`integer`?`int`:e.type===`number`?String(e.format??``).toLowerCase()===`decimal`?`decimal`:`double`:e.type===`boolean`?`bool`:`textbox`}var m={type:`object`,properties:{}};function h({schema:e,name:n,value:i,onChange:s}){let l=e.title??n,u=e.description,f=p(e),m=i??d(e);if(f===`radio`){let r=Array.isArray(e.enum)?e.enum:[];return(0,t.jsxs)(`fieldset`,{className:`nabs-ui-dynamicform__fieldset`,children:[(0,t.jsx)(`legend`,{className:`nabs-ui-dynamicform__legend`,children:l}),u?(0,t.jsx)(`p`,{className:`nabs-ui-dynamicform__description`,children:u}):null,(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__radioGroup`,children:r.map(e=>(0,t.jsx)(a,{label:String(e),name:n,checked:m===e,onChange:()=>s(e)},String(e)))})]})}return f===`textarea`?(0,t.jsx)(o,{label:l,rows:5,value:String(m??``),placeholder:String(e.default??``),onChange:e=>s(e.target.value)}):f===`bool`?(0,t.jsx)(r,{label:l,checked:m===!0,onChange:e=>s(e.target.checked)}):(0,t.jsx)(c,{label:l,type:f===`int`||f===`decimal`||f===`double`?`number`:`text`,step:f===`int`?1:f===`decimal`||f===`double`?`any`:void 0,value:String(m??``),placeholder:String(e.default??``),onChange:e=>{let t=e.target.value;if(f===`int`){s(t===``?``:Number.parseInt(t,10));return}if(f===`decimal`||f===`double`){s(t===``?``:Number.parseFloat(t));return}s(t)}})}var g=(0,e.forwardRef)(function({schema:n,value:r,onChange:i,className:a=``,id:o,disabled:s=!1,...c},d){let p=(0,e.useId)(),g=o??`nabs-ui-dynamicform-${p.replace(/:/g,``)}`,_=n&&n.type===`object`?n:m,[v,y]=(0,e.useState)(()=>f(_,r??u(_)));(0,e.useEffect)(()=>{y(f(_,r??u(_)))},[_,r]);let b=l(v)?v:{},x=_.title??`Dynamic form`,S=_.description,C=[`nabs-ui-dynamicform`,s?`nabs-ui-dynamicform--disabled`:``,a].filter(Boolean).join(` `),w=e=>{y(e),i?.(e)};return s?(0,t.jsxs)(`div`,{ref:d,id:g,className:C,"aria-disabled":`true`,...c,children:[(0,t.jsxs)(`div`,{className:`nabs-ui-dynamicform__header`,children:[(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__title`,children:x}),S?(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__description`,children:S}):null]}),(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__fields`,children:Object.entries(_.properties??{}).map(([e,n])=>(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__field`,children:(0,t.jsx)(h,{schema:n,name:e,value:b[e],onChange:t=>w({...b,[e]:f(n,t)})})},e))})]}):(0,t.jsxs)(`div`,{ref:d,id:g,className:C,...c,children:[(0,t.jsxs)(`div`,{className:`nabs-ui-dynamicform__header`,children:[(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__title`,children:x}),S?(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__description`,children:S}):null]}),(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__fields`,children:Object.entries(_.properties??{}).map(([e,n])=>(0,t.jsx)(`div`,{className:`nabs-ui-dynamicform__field`,children:(0,t.jsx)(h,{schema:n,name:e,value:b[e],onChange:t=>w({...b,[e]:f(n,t)})})},e))})]})});g.displayName=`DynamicForm`,exports.DynamicForm=g;
@@ -1,215 +1,38 @@
1
1
  import { forwardRef as e, useEffect as t, useId as n, useState as r } from "react";
2
- //#region \0rolldown/runtime.js
3
- var i = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), a = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
4
- if (typeof require < "u") return require.apply(this, arguments);
5
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
6
- }), o = {
2
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ //#region ../nabs-ui-checkbox/src/checkbox.utils.ts
4
+ var o = {
7
5
  right: "nabs-ui-checkbox--label-right",
8
6
  left: "nabs-ui-checkbox--label-left",
9
7
  top: "nabs-ui-checkbox--label-top",
10
8
  bottom: "nabs-ui-checkbox--label-bottom"
11
- }, s = /* @__PURE__ */ i(((e) => {
12
- var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
13
- function r(e, n, r) {
14
- var i = null;
15
- if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
16
- else r = n;
17
- return n = r.ref, {
18
- $$typeof: t,
19
- type: e,
20
- key: i,
21
- ref: n === void 0 ? null : n,
22
- props: r
23
- };
24
- }
25
- e.Fragment = n, e.jsx = r, e.jsxs = r;
26
- })), c = /* @__PURE__ */ i(((e) => {
27
- process.env.NODE_ENV !== "production" && (function() {
28
- function t(e) {
29
- if (e == null) return null;
30
- if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
31
- if (typeof e == "string") return e;
32
- switch (e) {
33
- case v: return "Fragment";
34
- case b: return "Profiler";
35
- case y: return "StrictMode";
36
- case w: return "Suspense";
37
- case T: return "SuspenseList";
38
- case O: return "Activity";
39
- }
40
- if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
41
- case _: return "Portal";
42
- case S: return e.displayName || "Context";
43
- case x: return (e._context.displayName || "Context") + ".Consumer";
44
- case C:
45
- var n = e.render;
46
- return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
47
- case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
48
- case D:
49
- n = e._payload, e = e._init;
50
- try {
51
- return t(e(n));
52
- } catch {}
53
- }
54
- return null;
55
- }
56
- function n(e) {
57
- return "" + e;
58
- }
59
- function r(e) {
60
- try {
61
- n(e);
62
- var t = !1;
63
- } catch {
64
- t = !0;
65
- }
66
- if (t) {
67
- t = console;
68
- var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
69
- return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
70
- }
71
- }
72
- function i(e) {
73
- if (e === v) return "<>";
74
- if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
75
- try {
76
- var n = t(e);
77
- return n ? "<" + n + ">" : "<...>";
78
- } catch {
79
- return "<...>";
80
- }
81
- }
82
- function o() {
83
- var e = A.A;
84
- return e === null ? null : e.getOwner();
85
- }
86
- function s() {
87
- return Error("react-stack-top-frame");
88
- }
89
- function c(e) {
90
- if (j.call(e, "key")) {
91
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
92
- if (t && t.isReactWarning) return !1;
93
- }
94
- return e.key !== void 0;
95
- }
96
- function l(e, t) {
97
- function n() {
98
- P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
99
- }
100
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
101
- get: n,
102
- configurable: !0
103
- });
104
- }
105
- function u() {
106
- var e = t(this.type);
107
- return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
108
- }
109
- function d(e, t, n, r, i, a) {
110
- var o = n.ref;
111
- return e = {
112
- $$typeof: g,
113
- type: e,
114
- key: t,
115
- props: n,
116
- _owner: r
117
- }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
118
- enumerable: !1,
119
- value: null
120
- }) : Object.defineProperty(e, "ref", {
121
- enumerable: !1,
122
- get: u
123
- }), e._store = {}, Object.defineProperty(e._store, "validated", {
124
- configurable: !1,
125
- enumerable: !1,
126
- writable: !0,
127
- value: 0
128
- }), Object.defineProperty(e, "_debugInfo", {
129
- configurable: !1,
130
- enumerable: !1,
131
- writable: !0,
132
- value: null
133
- }), Object.defineProperty(e, "_debugStack", {
134
- configurable: !1,
135
- enumerable: !1,
136
- writable: !0,
137
- value: i
138
- }), Object.defineProperty(e, "_debugTask", {
139
- configurable: !1,
140
- enumerable: !1,
141
- writable: !0,
142
- value: a
143
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
144
- }
145
- function f(e, n, i, a, s, u) {
146
- var f = n.children;
147
- if (f !== void 0) if (a) if (M(f)) {
148
- for (a = 0; a < f.length; a++) p(f[a]);
149
- Object.freeze && Object.freeze(f);
150
- } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
151
- else p(f);
152
- if (j.call(n, "key")) {
153
- f = t(e);
154
- var m = Object.keys(n).filter(function(e) {
155
- return e !== "key";
156
- });
157
- a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
158
- }
159
- if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
160
- else i = n;
161
- return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, o(), s, u);
162
- }
163
- function p(e) {
164
- m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
165
- }
166
- function m(e) {
167
- return typeof e == "object" && !!e && e.$$typeof === g;
168
- }
169
- var h = a("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
170
- return null;
171
- };
172
- h = { react_stack_bottom_frame: function(e) {
173
- return e();
174
- } };
175
- var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(i(s)), R = {};
176
- e.Fragment = v, e.jsx = function(e, t, n) {
177
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
178
- return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
179
- }, e.jsxs = function(e, t, n) {
180
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
181
- return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
182
- };
183
- })();
184
- })), l = (/* @__PURE__ */ i(((e, t) => {
185
- process.env.NODE_ENV === "production" ? t.exports = s() : t.exports = c();
186
- })))(), u = e(function({ label: e = "Checkbox", labelPosition: t = "right", className: r = "", inputClassName: i = "", labelClassName: a = "", id: s, disabled: c, ...u }, d) {
187
- let f = n(), p = s ?? `nabs-ui-checkbox-${f.replace(/:/g, "")}`, m = [
9
+ }, s = e(function({ label: e = "Checkbox", labelPosition: t = "right", className: r = "", inputClassName: s = "", labelClassName: c = "", id: l, disabled: u, ...d }, f) {
10
+ let p = n(), m = l ?? `nabs-ui-checkbox-${p.replace(/:/g, "")}`, h = [
188
11
  "nabs-ui-checkbox",
189
- c ? "nabs-ui-checkbox--disabled" : "",
12
+ u ? "nabs-ui-checkbox--disabled" : "",
190
13
  o[t] ?? o.right,
191
14
  r
192
- ].filter(Boolean).join(" "), h = ["nabs-ui-checkbox__input", i].filter(Boolean).join(" "), g = ["nabs-ui-checkbox__label", a].filter(Boolean).join(" ");
193
- return /* @__PURE__ */ (0, l.jsxs)("label", {
194
- className: m,
195
- htmlFor: p,
196
- children: [/* @__PURE__ */ (0, l.jsx)("input", {
197
- ref: d,
198
- id: p,
199
- className: h,
200
- type: "checkbox",
201
- disabled: c,
202
- ...u
203
- }), /* @__PURE__ */ (0, l.jsx)("span", {
15
+ ].filter(Boolean).join(" "), g = ["nabs-ui-checkbox__input", s].filter(Boolean).join(" "), _ = ["nabs-ui-checkbox__label", c].filter(Boolean).join(" ");
16
+ return /* @__PURE__ */ a("label", {
17
+ className: h,
18
+ htmlFor: m,
19
+ children: [/* @__PURE__ */ i("input", {
20
+ ref: f,
21
+ id: m,
204
22
  className: g,
23
+ type: "checkbox",
24
+ disabled: u,
25
+ ...d
26
+ }), /* @__PURE__ */ i("span", {
27
+ className: _,
205
28
  children: e
206
29
  })]
207
30
  });
208
31
  });
209
- u.displayName = "Checkbox";
32
+ s.displayName = "Checkbox";
210
33
  //#endregion
211
34
  //#region ../nabs-ui-radiobutton/src/radiobutton.utils.ts
212
- var d = {
35
+ var c = {
213
36
  right: "nabs-ui-radiobutton--label-right",
214
37
  left: "nabs-ui-radiobutton--label-left",
215
38
  top: "nabs-ui-radiobutton--label-top",
@@ -217,101 +40,101 @@ var d = {
217
40
  };
218
41
  //#endregion
219
42
  //#region ../nabs-ui-radiobutton/src/RadioButton.tsx
220
- function f({ label: e = "Radio button", labelPosition: t = "right", className: r = "", inputClassName: i = "", labelClassName: a = "", id: o, ...s }) {
221
- let c = s.disabled === !0, u = n(), f = o ?? `nabs-ui-radiobutton-${u.replace(/:/g, "")}`, p = [
43
+ function l({ label: e = "Radio button", labelPosition: t = "right", className: r = "", inputClassName: o = "", labelClassName: s = "", id: l, ...u }) {
44
+ let d = u.disabled === !0, f = n(), p = l ?? `nabs-ui-radiobutton-${f.replace(/:/g, "")}`, m = [
222
45
  "nabs-ui-radiobutton",
223
- c ? "nabs-ui-radiobutton--disabled" : "",
224
- d[t] ?? d.right,
46
+ d ? "nabs-ui-radiobutton--disabled" : "",
47
+ c[t] ?? c.right,
225
48
  r
226
- ].filter(Boolean).join(" "), m = ["nabs-ui-radiobutton__input", i].filter(Boolean).join(" "), h = ["nabs-ui-radiobutton__label", a].filter(Boolean).join(" ");
227
- return /* @__PURE__ */ (0, l.jsxs)("label", {
228
- className: p,
229
- htmlFor: f,
230
- children: [/* @__PURE__ */ (0, l.jsx)("input", {
231
- id: f,
232
- className: m,
233
- type: "radio",
234
- ...s
235
- }), /* @__PURE__ */ (0, l.jsx)("span", {
49
+ ].filter(Boolean).join(" "), h = ["nabs-ui-radiobutton__input", o].filter(Boolean).join(" "), g = ["nabs-ui-radiobutton__label", s].filter(Boolean).join(" ");
50
+ return /* @__PURE__ */ a("label", {
51
+ className: m,
52
+ htmlFor: p,
53
+ children: [/* @__PURE__ */ i("input", {
54
+ id: p,
236
55
  className: h,
56
+ type: "radio",
57
+ ...u
58
+ }), /* @__PURE__ */ i("span", {
59
+ className: g,
237
60
  children: e
238
61
  })]
239
62
  });
240
63
  }
241
64
  //#endregion
242
65
  //#region ../nabs-ui-textarea/src/Textarea.tsx
243
- var p = e(({ label: e, className: t = "", inputClassName: r = "", labelClassName: i = "", id: a, rows: o = 4, resize: s = "vertical", ...c }, u) => {
244
- let d = n(), f = a ?? `nabs-ui-textarea-${d.replace(/:/g, "")}`, p = ["nabs-ui-textarea", t].filter(Boolean).join(" "), m = ["nabs-ui-textarea__input", r].filter(Boolean).join(" "), h = ["nabs-ui-textarea__label", i].filter(Boolean).join(" ");
245
- return /* @__PURE__ */ (0, l.jsxs)("div", {
246
- className: p,
247
- children: [e ? /* @__PURE__ */ (0, l.jsx)("label", {
248
- className: h,
249
- htmlFor: f,
66
+ var u = e(({ label: e, className: t = "", inputClassName: r = "", labelClassName: o = "", id: s, rows: c = 4, resize: l = "vertical", ...u }, d) => {
67
+ let f = n(), p = s ?? `nabs-ui-textarea-${f.replace(/:/g, "")}`, m = ["nabs-ui-textarea", t].filter(Boolean).join(" "), h = ["nabs-ui-textarea__input", r].filter(Boolean).join(" "), g = ["nabs-ui-textarea__label", o].filter(Boolean).join(" ");
68
+ return /* @__PURE__ */ a("div", {
69
+ className: m,
70
+ children: [e ? /* @__PURE__ */ i("label", {
71
+ className: g,
72
+ htmlFor: p,
250
73
  children: e
251
- }) : null, /* @__PURE__ */ (0, l.jsx)("textarea", {
252
- ref: u,
253
- id: f,
254
- className: m,
255
- rows: o,
256
- "data-resize": s,
257
- ...c
74
+ }) : null, /* @__PURE__ */ i("textarea", {
75
+ ref: d,
76
+ id: p,
77
+ className: h,
78
+ rows: c,
79
+ "data-resize": l,
80
+ ...u
258
81
  })]
259
82
  });
260
83
  });
261
- p.displayName = "Textarea";
84
+ u.displayName = "Textarea";
262
85
  //#endregion
263
86
  //#region ../nabs-ui-textbox/src/textbox.utils.ts
264
- var m = {
87
+ var d = {
265
88
  none: "",
266
89
  top: "nabs-ui-textbox--label-top",
267
90
  left: "nabs-ui-textbox--label-left"
268
- }, h = e(({ label: e, labelPosition: t = "top", className: r = "", inputClassName: i = "", labelClassName: a = "", id: o, type: s = "text", ...c }, u) => {
269
- let d = n(), f = o ?? `nabs-ui-textbox-${d.replace(/:/g, "")}`, p = [
91
+ }, f = e(({ label: e, labelPosition: t = "top", className: r = "", inputClassName: o = "", labelClassName: s = "", id: c, type: l = "text", ...u }, f) => {
92
+ let p = n(), m = c ?? `nabs-ui-textbox-${p.replace(/:/g, "")}`, h = [
270
93
  "nabs-ui-textbox",
271
- e ? m[t] ?? m.top : "",
94
+ e ? d[t] ?? d.top : "",
272
95
  r
273
- ].filter(Boolean).join(" "), h = ["nabs-ui-textbox__input", i].filter(Boolean).join(" "), g = ["nabs-ui-textbox__label", a].filter(Boolean).join(" ");
274
- return /* @__PURE__ */ (0, l.jsxs)("div", {
275
- className: p,
276
- children: [e ? /* @__PURE__ */ (0, l.jsx)("label", {
277
- className: g,
278
- htmlFor: f,
96
+ ].filter(Boolean).join(" "), g = ["nabs-ui-textbox__input", o].filter(Boolean).join(" "), _ = ["nabs-ui-textbox__label", s].filter(Boolean).join(" ");
97
+ return /* @__PURE__ */ a("div", {
98
+ className: h,
99
+ children: [e ? /* @__PURE__ */ i("label", {
100
+ className: _,
101
+ htmlFor: m,
279
102
  children: e
280
- }) : null, /* @__PURE__ */ (0, l.jsx)("input", {
281
- ref: u,
282
- id: f,
283
- className: h,
284
- type: s,
285
- ...c
103
+ }) : null, /* @__PURE__ */ i("input", {
104
+ ref: f,
105
+ id: m,
106
+ className: g,
107
+ type: l,
108
+ ...u
286
109
  })]
287
110
  });
288
111
  });
289
- h.displayName = "Textbox";
112
+ f.displayName = "Textbox";
290
113
  //#endregion
291
114
  //#region src/dynamicform.utils.ts
292
- function g(e) {
115
+ function p(e) {
293
116
  return typeof e == "object" && !!e && !Array.isArray(e);
294
117
  }
295
- function _(e) {
296
- return !e || e.type !== "object" || !g(e.properties) ? {} : Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, v(t)]));
118
+ function m(e) {
119
+ return !e || e.type !== "object" || !p(e.properties) ? {} : Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, h(t)]));
297
120
  }
298
- function v(e) {
299
- if (!e || !g(e)) return "";
121
+ function h(e) {
122
+ if (!e || !p(e)) return "";
300
123
  if (e.default !== void 0) return e.default;
301
124
  if (Array.isArray(e.enum) && e.enum.length > 0) return e.enum[0];
302
125
  switch (e.type) {
303
126
  case "boolean": return !1;
304
127
  case "integer":
305
128
  case "number": return "";
306
- case "object": return _(e);
129
+ case "object": return m(e);
307
130
  default: return "";
308
131
  }
309
132
  }
310
- function y(e, t) {
311
- if (!e || !g(e)) return t;
312
- if (e.type === "object" && g(e.properties)) {
313
- let n = g(t) ? t : {};
314
- return Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, y(t, n[e] === void 0 ? v(t) : n[e])]));
133
+ function g(e, t) {
134
+ if (!e || !p(e)) return t;
135
+ if (e.type === "object" && p(e.properties)) {
136
+ let n = p(t) ? t : {};
137
+ return Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, g(t, n[e] === void 0 ? h(t) : n[e])]));
315
138
  }
316
139
  if (e.type === "boolean") return t === !0;
317
140
  if (e.type === "integer") {
@@ -326,65 +149,65 @@ function y(e, t) {
326
149
  }
327
150
  return t ?? "";
328
151
  }
329
- function b(e) {
330
- return !e || !g(e) ? "textbox" : Array.isArray(e.enum) && e.enum.length > 0 ? "radio" : e.type === "string" ? e.maxLength !== void 0 && e.maxLength > 50 ? "textarea" : "textbox" : e.type === "integer" ? "int" : e.type === "number" ? String(e.format ?? "").toLowerCase() === "decimal" ? "decimal" : "double" : e.type === "boolean" ? "bool" : "textbox";
152
+ function _(e) {
153
+ return !e || !p(e) ? "textbox" : Array.isArray(e.enum) && e.enum.length > 0 ? "radio" : e.type === "string" ? e.maxLength !== void 0 && e.maxLength > 50 ? "textarea" : "textbox" : e.type === "integer" ? "int" : e.type === "number" ? String(e.format ?? "").toLowerCase() === "decimal" ? "decimal" : "double" : e.type === "boolean" ? "bool" : "textbox";
331
154
  }
332
155
  //#endregion
333
156
  //#region src/DynamicForm.tsx
334
- var x = {
157
+ var v = {
335
158
  type: "object",
336
159
  properties: {}
337
160
  };
338
- function S({ schema: e, name: t, value: n, onChange: r }) {
339
- let i = e.title ?? t, a = e.description, o = b(e), s = n ?? v(e);
340
- if (o === "radio") {
161
+ function y({ schema: e, name: t, value: n, onChange: r }) {
162
+ let o = e.title ?? t, c = e.description, d = _(e), p = n ?? h(e);
163
+ if (d === "radio") {
341
164
  let n = Array.isArray(e.enum) ? e.enum : [];
342
- return /* @__PURE__ */ (0, l.jsxs)("fieldset", {
165
+ return /* @__PURE__ */ a("fieldset", {
343
166
  className: "nabs-ui-dynamicform__fieldset",
344
167
  children: [
345
- /* @__PURE__ */ (0, l.jsx)("legend", {
168
+ /* @__PURE__ */ i("legend", {
346
169
  className: "nabs-ui-dynamicform__legend",
347
- children: i
170
+ children: o
348
171
  }),
349
- a ? /* @__PURE__ */ (0, l.jsx)("p", {
172
+ c ? /* @__PURE__ */ i("p", {
350
173
  className: "nabs-ui-dynamicform__description",
351
- children: a
174
+ children: c
352
175
  }) : null,
353
- /* @__PURE__ */ (0, l.jsx)("div", {
176
+ /* @__PURE__ */ i("div", {
354
177
  className: "nabs-ui-dynamicform__radioGroup",
355
- children: n.map((e) => /* @__PURE__ */ (0, l.jsx)(f, {
178
+ children: n.map((e) => /* @__PURE__ */ i(l, {
356
179
  label: String(e),
357
180
  name: t,
358
- checked: s === e,
181
+ checked: p === e,
359
182
  onChange: () => r(e)
360
183
  }, String(e)))
361
184
  })
362
185
  ]
363
186
  });
364
187
  }
365
- return o === "textarea" ? /* @__PURE__ */ (0, l.jsx)(p, {
366
- label: i,
188
+ return d === "textarea" ? /* @__PURE__ */ i(u, {
189
+ label: o,
367
190
  rows: 5,
368
- value: String(s ?? ""),
191
+ value: String(p ?? ""),
369
192
  placeholder: String(e.default ?? ""),
370
193
  onChange: (e) => r(e.target.value)
371
- }) : o === "bool" ? /* @__PURE__ */ (0, l.jsx)(u, {
372
- label: i,
373
- checked: s === !0,
194
+ }) : d === "bool" ? /* @__PURE__ */ i(s, {
195
+ label: o,
196
+ checked: p === !0,
374
197
  onChange: (e) => r(e.target.checked)
375
- }) : /* @__PURE__ */ (0, l.jsx)(h, {
376
- label: i,
377
- type: o === "int" || o === "decimal" || o === "double" ? "number" : "text",
378
- step: o === "int" ? 1 : o === "decimal" || o === "double" ? "any" : void 0,
379
- value: String(s ?? ""),
198
+ }) : /* @__PURE__ */ i(f, {
199
+ label: o,
200
+ type: d === "int" || d === "decimal" || d === "double" ? "number" : "text",
201
+ step: d === "int" ? 1 : d === "decimal" || d === "double" ? "any" : void 0,
202
+ value: String(p ?? ""),
380
203
  placeholder: String(e.default ?? ""),
381
204
  onChange: (e) => {
382
205
  let t = e.target.value;
383
- if (o === "int") {
206
+ if (d === "int") {
384
207
  r(t === "" ? "" : Number.parseInt(t, 10));
385
208
  return;
386
209
  }
387
- if (o === "decimal" || o === "double") {
210
+ if (d === "decimal" || d === "double") {
388
211
  r(t === "" ? "" : Number.parseFloat(t));
389
212
  return;
390
213
  }
@@ -392,79 +215,79 @@ function S({ schema: e, name: t, value: n, onChange: r }) {
392
215
  }
393
216
  });
394
217
  }
395
- var C = e(function({ schema: e, value: i, onChange: a, className: o = "", id: s, disabled: c = !1, ...u }, d) {
396
- let f = n(), p = s ?? `nabs-ui-dynamicform-${f.replace(/:/g, "")}`, m = e && e.type === "object" ? e : x, [h, v] = r(() => y(m, i ?? _(m)));
218
+ var b = e(function({ schema: e, value: o, onChange: s, className: c = "", id: l, disabled: u = !1, ...d }, f) {
219
+ let h = n(), _ = l ?? `nabs-ui-dynamicform-${h.replace(/:/g, "")}`, b = e && e.type === "object" ? e : v, [x, S] = r(() => g(b, o ?? m(b)));
397
220
  t(() => {
398
- v(y(m, i ?? _(m)));
399
- }, [m, i]);
400
- let b = g(h) ? h : {}, C = m.title ?? "Dynamic form", w = m.description, T = [
221
+ S(g(b, o ?? m(b)));
222
+ }, [b, o]);
223
+ let C = p(x) ? x : {}, w = b.title ?? "Dynamic form", T = b.description, E = [
401
224
  "nabs-ui-dynamicform",
402
- c ? "nabs-ui-dynamicform--disabled" : "",
403
- o
404
- ].filter(Boolean).join(" "), E = (e) => {
405
- v(e), a?.(e);
225
+ u ? "nabs-ui-dynamicform--disabled" : "",
226
+ c
227
+ ].filter(Boolean).join(" "), D = (e) => {
228
+ S(e), s?.(e);
406
229
  };
407
- return c ? /* @__PURE__ */ (0, l.jsxs)("div", {
408
- ref: d,
409
- id: p,
410
- className: T,
230
+ return u ? /* @__PURE__ */ a("div", {
231
+ ref: f,
232
+ id: _,
233
+ className: E,
411
234
  "aria-disabled": "true",
412
- ...u,
413
- children: [/* @__PURE__ */ (0, l.jsxs)("div", {
235
+ ...d,
236
+ children: [/* @__PURE__ */ a("div", {
414
237
  className: "nabs-ui-dynamicform__header",
415
- children: [/* @__PURE__ */ (0, l.jsx)("div", {
238
+ children: [/* @__PURE__ */ i("div", {
416
239
  className: "nabs-ui-dynamicform__title",
417
- children: C
418
- }), w ? /* @__PURE__ */ (0, l.jsx)("div", {
419
- className: "nabs-ui-dynamicform__description",
420
240
  children: w
241
+ }), T ? /* @__PURE__ */ i("div", {
242
+ className: "nabs-ui-dynamicform__description",
243
+ children: T
421
244
  }) : null]
422
- }), /* @__PURE__ */ (0, l.jsx)("div", {
245
+ }), /* @__PURE__ */ i("div", {
423
246
  className: "nabs-ui-dynamicform__fields",
424
- children: Object.entries(m.properties ?? {}).map(([e, t]) => /* @__PURE__ */ (0, l.jsx)("div", {
247
+ children: Object.entries(b.properties ?? {}).map(([e, t]) => /* @__PURE__ */ i("div", {
425
248
  className: "nabs-ui-dynamicform__field",
426
- children: /* @__PURE__ */ (0, l.jsx)(S, {
249
+ children: /* @__PURE__ */ i(y, {
427
250
  schema: t,
428
251
  name: e,
429
- value: b[e],
430
- onChange: (n) => E({
431
- ...b,
432
- [e]: y(t, n)
252
+ value: C[e],
253
+ onChange: (n) => D({
254
+ ...C,
255
+ [e]: g(t, n)
433
256
  })
434
257
  })
435
258
  }, e))
436
259
  })]
437
- }) : /* @__PURE__ */ (0, l.jsxs)("div", {
438
- ref: d,
439
- id: p,
440
- className: T,
441
- ...u,
442
- children: [/* @__PURE__ */ (0, l.jsxs)("div", {
260
+ }) : /* @__PURE__ */ a("div", {
261
+ ref: f,
262
+ id: _,
263
+ className: E,
264
+ ...d,
265
+ children: [/* @__PURE__ */ a("div", {
443
266
  className: "nabs-ui-dynamicform__header",
444
- children: [/* @__PURE__ */ (0, l.jsx)("div", {
267
+ children: [/* @__PURE__ */ i("div", {
445
268
  className: "nabs-ui-dynamicform__title",
446
- children: C
447
- }), w ? /* @__PURE__ */ (0, l.jsx)("div", {
448
- className: "nabs-ui-dynamicform__description",
449
269
  children: w
270
+ }), T ? /* @__PURE__ */ i("div", {
271
+ className: "nabs-ui-dynamicform__description",
272
+ children: T
450
273
  }) : null]
451
- }), /* @__PURE__ */ (0, l.jsx)("div", {
274
+ }), /* @__PURE__ */ i("div", {
452
275
  className: "nabs-ui-dynamicform__fields",
453
- children: Object.entries(m.properties ?? {}).map(([e, t]) => /* @__PURE__ */ (0, l.jsx)("div", {
276
+ children: Object.entries(b.properties ?? {}).map(([e, t]) => /* @__PURE__ */ i("div", {
454
277
  className: "nabs-ui-dynamicform__field",
455
- children: /* @__PURE__ */ (0, l.jsx)(S, {
278
+ children: /* @__PURE__ */ i(y, {
456
279
  schema: t,
457
280
  name: e,
458
- value: b[e],
459
- onChange: (n) => E({
460
- ...b,
461
- [e]: y(t, n)
281
+ value: C[e],
282
+ onChange: (n) => D({
283
+ ...C,
284
+ [e]: g(t, n)
462
285
  })
463
286
  })
464
287
  }, e))
465
288
  })]
466
289
  });
467
290
  });
468
- C.displayName = "DynamicForm";
291
+ b.displayName = "DynamicForm";
469
292
  //#endregion
470
- export { C as DynamicForm };
293
+ export { b as DynamicForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@net-advantage/nabs-ui-dynamicform",
3
- "version": "0.30.0",
3
+ "version": "0.33.0",
4
4
  "description": "Reusable schema-driven dynamic form for the Nabs UI library.",
5
5
  "type": "module",
6
6
  "main": "./dist/nabs-ui-dynamicform.cjs",