@cyclone-ui/state 0.0.63 → 0.0.65

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  # Changelog for Cyclone UI - State
4
4
 
5
+ ## [0.0.64](https://github.com/storm-software/cyclone-ui/releases/tag/state%400.0.64) (11/09/2026)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **helpers** to **v0.3.62**
10
+
11
+ ## [0.0.63](https://github.com/storm-software/cyclone-ui/releases/tag/state%400.0.63) (11/08/2026)
12
+
13
+ ### Updated Dependencies
14
+
15
+ - Updated **helpers** to **v0.3.61**
16
+
5
17
  ## [0.0.62](https://github.com/storm-software/cyclone-ui/releases/tag/state%400.0.62) (11/08/2026)
6
18
 
7
19
  ### Updated Dependencies
@@ -1 +1 @@
1
- const e=require("../molecules/field-molecule.cjs"),t=require("../types.cjs");let n=require("jotai/utils"),r=require("react"),i=require("@stryke/type-checks/is-promise");const a={initialize:`onInitialize`,change:`onChange`,blur:`onBlur`,submit:`onSubmit`,server:`onServer`},o=()=>{let o=e.FieldApi.useMolecule(),s=(0,n.useAtomCallback)((0,r.useCallback)(async(e,n,r,s)=>{let c=e(o.options),l=c.validate?.[a[s]],u=c.validate?.[a.initialize];if(l&&l.length>0||u&&u.length>0){let a=e(o.previousValue),c=[];if(l&&l.length>0)for(let t of l)c.push(t(r,a,s,e,n));if(s!==t.ValidationCause.INITIALIZE&&u&&u.length>0)for(let t of u)c.push(t(r,a,s,e,n));let d=[],f=[];for(let e of c)e&&((0,i.isPromise)(e)?f.push(e):d.push(...e));if(f.length>0){n(o.validating,!0);for(let e of await Promise.all(f))e&&e.length>0&&d.push(...e);n(o.validating,!1)}n(o.validationResults,e=>({...e,[s]:d}))}},[])),c=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{t(o.value,e(o.initialValue)),t(o.options,n.RESET)},[])),l=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r=!0)=>{r&&e(o.dirty)||n!==e(o.initialValue)&&t(o.initialValue,n)},[])),u=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r=!1)=>{if(!e(o.disabled)){!e(o.touched)&&r&&t(o.touched,r);let i=e(o.options),a=e(o.value),s=n;i.parse&&(s=i.parse(n)),i.isEqual(s,a)||t(o.value,s)}},[])),d=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{e(o.disabled)||(e(o.touched)||t(o.touched,!0),t(o.focused,!0))},[])),f=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{e(o.disabled)||(e(o.touched)||t(o.touched,!0),t(o.focused,!1),t(o.blurred,!0))},[])),p=(0,r.useCallback)(async e=>e?d():f(),[d,f]),m=(0,n.useAtomCallback)((0,r.useCallback)(async e=>p(!e(o.focused)),[p]));return{mount:(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r)=>{if(t(o.ref,()=>n),t(o.tabIndex,r??0),!e(o.initialValue)){let n=e(o.options);t(o.initialValue,n.defaultValue??null)}},[])),initialize:l,change:u,focus:d,blur:f,setFocused:p,toggleFocused:m,validate:s,reset:c}};exports.useFieldActions=o;
1
+ const e=require("../molecules/field-molecule.cjs"),t=require("../types.cjs");let n=require("jotai/utils"),r=require("react"),i=require("@stryke/type-checks/is-promise");const a={initialize:`onInitialize`,change:`onChange`,blur:`onBlur`,submit:`onSubmit`,server:`onServer`},o=()=>{let o=e.FieldApi.useMolecule(),s=(0,n.useAtomCallback)((0,r.useCallback)(async(e,n,r,s)=>{let c=e(o.options),l=c.validate?.[a[s]],u=c.validate?.[a.initialize];if(l&&l.length>0||u&&u.length>0){let a=e(o.previousValue),c=[];if(l&&l.length>0)for(let t of l)c.push(t(r,a,s,e,n));if(s!==t.ValidationCause.INITIALIZE&&u&&u.length>0)for(let t of u)c.push(t(r,a,s,e,n));let d=[],f=[];for(let e of c)e&&((0,i.isPromise)(e)?f.push(e):d.push(...e));if(f.length>0){n(o.validating,!0);for(let e of await Promise.all(f))e&&e.length>0&&d.push(...e);n(o.validating,!1)}n(o.validationResults,e=>({...e,[s]:d}))}},[])),c=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{t(o.value,e(o.initialValue)),t(o.options,n.RESET)},[])),l=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r=!0)=>{r&&e(o.dirty)||n!==e(o.initialValue)&&t(o.initialValue,n)},[])),u=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r=!1)=>{if(!e(o.disabled)&&!e(o.readOnly)){!e(o.touched)&&r&&t(o.touched,r);let i=e(o.options),a=e(o.value),s=n;i.parse&&(s=i.parse(n)),i.isEqual(s,a)||t(o.value,s)}},[])),d=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{e(o.disabled)||(e(o.touched)||t(o.touched,!0),t(o.focused,!0))},[])),f=(0,n.useAtomCallback)((0,r.useCallback)(async(e,t)=>{e(o.disabled)||(e(o.touched)||t(o.touched,!0),t(o.focused,!1),t(o.blurred,!0))},[])),p=(0,r.useCallback)(async e=>e?d():f(),[d,f]),m=(0,n.useAtomCallback)((0,r.useCallback)(async e=>p(!e(o.focused)),[p]));return{mount:(0,n.useAtomCallback)((0,r.useCallback)(async(e,t,n,r)=>{if(t(o.ref,()=>n),t(o.tabIndex,r??0),!e(o.initialValue)){let n=e(o.options);t(o.initialValue,n.defaultValue??null)}},[])),initialize:l,change:u,focus:d,blur:f,setFocused:p,toggleFocused:m,validate:s,reset:c}};exports.useFieldActions=o;
@@ -1,2 +1,2 @@
1
- import{FieldApi as e}from"../molecules/field-molecule.mjs";import{ValidationCause as t}from"../types.mjs";import{RESET as n,useAtomCallback as r}from"jotai/utils";import{useCallback as i}from"react";import{isPromise as a}from"@stryke/type-checks/is-promise";const o={initialize:`onInitialize`,change:`onChange`,blur:`onBlur`,submit:`onSubmit`,server:`onServer`},s=()=>{let s=e.useMolecule(),c=r(i(async(e,n,r,i)=>{let c=e(s.options),l=c.validate?.[o[i]],u=c.validate?.[o.initialize];if(l&&l.length>0||u&&u.length>0){let o=e(s.previousValue),c=[];if(l&&l.length>0)for(let t of l)c.push(t(r,o,i,e,n));if(i!==t.INITIALIZE&&u&&u.length>0)for(let t of u)c.push(t(r,o,i,e,n));let d=[],f=[];for(let e of c)e&&(a(e)?f.push(e):d.push(...e));if(f.length>0){n(s.validating,!0);for(let e of await Promise.all(f))e&&e.length>0&&d.push(...e);n(s.validating,!1)}n(s.validationResults,e=>({...e,[i]:d}))}},[])),l=r(i(async(e,t)=>{t(s.value,e(s.initialValue)),t(s.options,n)},[])),u=r(i(async(e,t,n,r=!0)=>{r&&e(s.dirty)||n!==e(s.initialValue)&&t(s.initialValue,n)},[])),d=r(i(async(e,t,n,r=!1)=>{if(!e(s.disabled)){!e(s.touched)&&r&&t(s.touched,r);let i=e(s.options),a=e(s.value),o=n;i.parse&&(o=i.parse(n)),i.isEqual(o,a)||t(s.value,o)}},[])),f=r(i(async(e,t)=>{e(s.disabled)||(e(s.touched)||t(s.touched,!0),t(s.focused,!0))},[])),p=r(i(async(e,t)=>{e(s.disabled)||(e(s.touched)||t(s.touched,!0),t(s.focused,!1),t(s.blurred,!0))},[])),m=i(async e=>e?f():p(),[f,p]),h=r(i(async e=>m(!e(s.focused)),[m]));return{mount:r(i(async(e,t,n,r)=>{if(t(s.ref,()=>n),t(s.tabIndex,r??0),!e(s.initialValue)){let n=e(s.options);t(s.initialValue,n.defaultValue??null)}},[])),initialize:u,change:d,focus:f,blur:p,setFocused:m,toggleFocused:h,validate:c,reset:l}};export{s as useFieldActions};
1
+ import{FieldApi as e}from"../molecules/field-molecule.mjs";import{ValidationCause as t}from"../types.mjs";import{RESET as n,useAtomCallback as r}from"jotai/utils";import{useCallback as i}from"react";import{isPromise as a}from"@stryke/type-checks/is-promise";const o={initialize:`onInitialize`,change:`onChange`,blur:`onBlur`,submit:`onSubmit`,server:`onServer`},s=()=>{let s=e.useMolecule(),c=r(i(async(e,n,r,i)=>{let c=e(s.options),l=c.validate?.[o[i]],u=c.validate?.[o.initialize];if(l&&l.length>0||u&&u.length>0){let o=e(s.previousValue),c=[];if(l&&l.length>0)for(let t of l)c.push(t(r,o,i,e,n));if(i!==t.INITIALIZE&&u&&u.length>0)for(let t of u)c.push(t(r,o,i,e,n));let d=[],f=[];for(let e of c)e&&(a(e)?f.push(e):d.push(...e));if(f.length>0){n(s.validating,!0);for(let e of await Promise.all(f))e&&e.length>0&&d.push(...e);n(s.validating,!1)}n(s.validationResults,e=>({...e,[i]:d}))}},[])),l=r(i(async(e,t)=>{t(s.value,e(s.initialValue)),t(s.options,n)},[])),u=r(i(async(e,t,n,r=!0)=>{r&&e(s.dirty)||n!==e(s.initialValue)&&t(s.initialValue,n)},[])),d=r(i(async(e,t,n,r=!1)=>{if(!e(s.disabled)&&!e(s.readOnly)){!e(s.touched)&&r&&t(s.touched,r);let i=e(s.options),a=e(s.value),o=n;i.parse&&(o=i.parse(n)),i.isEqual(o,a)||t(s.value,o)}},[])),f=r(i(async(e,t)=>{e(s.disabled)||(e(s.touched)||t(s.touched,!0),t(s.focused,!0))},[])),p=r(i(async(e,t)=>{e(s.disabled)||(e(s.touched)||t(s.touched,!0),t(s.focused,!1),t(s.blurred,!0))},[])),m=i(async e=>e?f():p(),[f,p]),h=r(i(async e=>m(!e(s.focused)),[m]));return{mount:r(i(async(e,t,n,r)=>{if(t(s.ref,()=>n),t(s.tabIndex,r??0),!e(s.initialValue)){let n=e(s.options);t(s.initialValue,n.defaultValue??null)}},[])),initialize:u,change:d,focus:f,blur:p,setFocused:m,toggleFocused:h,validate:c,reset:l}};export{s as useFieldActions};
2
2
  //# sourceMappingURL=use-field-actions.mjs.map
@@ -1 +1 @@
1
- const e=require("../../base/utilities/create-molecule.cjs");require("../../base/index.cjs");const t=require("../atoms/atom-with-field.cjs"),n=require("../atoms/atom-with-messages.cjs"),r=require("../utilities/validators.cjs"),i=require("./form-molecule.cjs");let ee=require("@stryke/type-checks/is-function"),a=require("jotai/utils"),o=require("@stryke/helpers/is-equal"),s=require("jotai"),c=require("@stryke/type-checks/is-string"),l=require("@stryke/helpers/deep-merge"),te=require("@stryke/helpers/get-field"),u=require("@stryke/helpers/to-path"),d=require("@stryke/type-checks/is-set"),f=require("jotai-optics");const p={theme:`base`,size:`md`,debounceMs:100,isEqual:o.isEqual,required:!1,disabled:!1,clearable:!1,initialValue:null},m=e.createMoleculeApi(o=>{let m=e.use(i.FormApi.Scope),h=(0,s.atom)(()=>m),g=e.use(i.FormApi.Molecule),_=(0,s.atom)(p),v=(0,s.atom)(e=>{let t=e(g.options),n=e(_),i=(0,l.deepMerge)(t.defaultFieldOptions,n);return(0,l.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,ee.isFunction)(n)?n(e(_)):n===a.RESET?{}:n,t(_,(0,l.deepMerge)(p,r))}),y=`${m}-`,b=(0,u.toPath)(o.startsWith(y)?o.slice(y.length):o.includes(`-`)?o.slice(o.indexOf(`-`)+1):o),x=(0,s.atom)(()=>b),S=(0,s.atom)(e=>e(x).slice(-1)[0]),C=(0,f.focusAtom)(g.focusedFields,e=>e.path(...b)),w=(0,f.focusAtom)(g.requiredFields,e=>e.path(...b)),T=(0,f.focusAtom)(g.disabledFields,e=>e.path(...b)),E=(0,s.atom)(e=>e(w)??e(v).required,(e,t,n)=>{t(w,n)}),D=(0,s.atom)(e=>e(T)??e(v).disabled,(e,t,n)=>{t(T,n)}),O=(0,s.atom)(e=>e(v).clearable),k=(0,f.focusAtom)(g.touchedFields,e=>e.path(...b)),A=(0,f.focusAtom)(g.blurredFields,e=>e.path(...b)),ne=(0,f.focusAtom)(g.validatingFields,e=>e.path(...b)),j=(0,f.focusAtom)(g.validationResultsFields,e=>e.path(...b)),re=(0,f.focusAtom)(g.tabIndexes,e=>e.path(...b)),ie=(0,f.focusAtom)(g.refs,e=>e.path(...b)),M=(0,f.focusAtom)(g.initialValues,e=>e.path(...b)),N=(0,f.focusAtom)(g.values,e=>e.path(...b)),P=(0,s.atom)(e=>e(v).isEqual(e(N),e(M))),F=(0,s.atom)(e=>!!e(v).showErrorsBeforeBlur||!!e(A)||e(g.submitAttempts)>0),I=n.atomWithFieldsMessageTypes(j,`danger`),L=(0,s.atom)(e=>e(F)?e(I):[]),R=n.atomWithFieldsMessageTypes(j,`warning`),z=n.atomWithFieldsMessageTypes(j,`info`),B=n.atomWithFieldsMessageTypes(j,`discovery`),V=n.atomWithFieldsMessageTypes(j,`success`),H=n.atomWithFieldsMessageTypes(j,`success`),U=n.atomWithFieldsMessageTypes(j,`danger`),W=n.atomWithFieldsMessageList(j,`danger`),G=(0,s.atom)(e=>e(F)?e(W):[]),K=n.atomWithFieldsMessageList(j,`warning`),q=n.atomWithFieldsMessageList(j,`info`),J=n.atomWithFieldsMessageList(j,`discovery`),Y=n.atomWithFieldsMessageList(j,`success`),X=n.atomWithFieldsMessageList(j,`success`),Z=n.atomWithFieldsMessageList(j,`danger`),Q=(0,s.atom)(e=>e(G).length>0),ae=(0,s.atom)(e=>!e(Q)),oe=(0,s.atom)(e=>{let t=e(v),n=e(N),r;return r=t?.format?t.format(n):n,(0,d.isSet)(r)?(0,c.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(v,N,D),se=(0,a.splitAtom)($),ce=(0,a.atomWithDefault)(e=>e(v).size??`md`);return{options:v,form:h,name:S,path:x,initialValue:M,previousValue:(0,s.atom)(e=>{let t=e(g.previousValues);return(0,te.getField)(t,e(x).join(`.`))??null}),value:N,formattedValue:oe,focused:C,required:E,disabled:D,clearable:O,touched:k,blurred:A,validating:ne,validationResults:j,tabIndex:re,ref:ie,pristine:(0,s.atom)(e=>!e(P)),dirty:P,items:$,itemsAtoms:se,size:ce,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:G,warningMessages:K,infoMessages:q,discoveryMessages:J,successMessages:Y,positiveMessages:X,negativeMessages:Z,theme:n.atomWithTheme(v,G,K,q,J,Y,X,Z),messages:n.atomWithMessages(G,K,q,J,Y,X,Z),invalid:Q,valid:ae}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=p,exports.FieldApi=m;
1
+ const e=require("../../base/utilities/create-molecule.cjs");require("../../base/index.cjs");const t=require("../atoms/atom-with-field.cjs"),n=require("../atoms/atom-with-messages.cjs"),r=require("../utilities/validators.cjs"),i=require("./form-molecule.cjs");let ee=require("@stryke/type-checks/is-function"),a=require("jotai/utils"),o=require("@stryke/helpers/is-equal"),s=require("jotai"),c=require("@stryke/type-checks/is-string"),l=require("@stryke/helpers/deep-merge"),u=require("@stryke/helpers/get-field"),d=require("@stryke/helpers/to-path"),f=require("@stryke/type-checks/is-set"),p=require("jotai-optics");const m={theme:`base`,size:`md`,debounceMs:100,isEqual:o.isEqual,required:!1,disabled:!1,readOnly:!1,clearable:!1,initialValue:null},h=e.createMoleculeApi(o=>{let h=e.use(i.FormApi.Scope),te=(0,s.atom)(()=>h),g=e.use(i.FormApi.Molecule),_=(0,s.atom)(m),v=(0,s.atom)(e=>{let t=e(g.options),n=e(_),i=(0,l.deepMerge)(t.defaultFieldOptions,n);return(0,l.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,ee.isFunction)(n)?n(e(_)):n===a.RESET?{}:n,t(_,(0,l.deepMerge)(m,r))}),y=`${h}-`,b=(0,d.toPath)(o.startsWith(y)?o.slice(y.length):o.includes(`-`)?o.slice(o.indexOf(`-`)+1):o),x=(0,s.atom)(()=>b),ne=(0,s.atom)(e=>e(x).slice(-1)[0]),re=(0,p.focusAtom)(g.focusedFields,e=>e.path(...b)),S=(0,p.focusAtom)(g.requiredFields,e=>e.path(...b)),C=(0,p.focusAtom)(g.disabledFields,e=>e.path(...b)),w=(0,p.focusAtom)(g.readOnlyFields,e=>e.path(...b)),ie=(0,s.atom)(e=>e(S)??e(v).required,(e,t,n)=>{t(S,n)}),T=(0,s.atom)(e=>e(C)??e(v).disabled,(e,t,n)=>{t(C,n)}),E=(0,s.atom)(e=>e(w)??e(v).readOnly,(e,t,n)=>{t(w,n)}),D=(0,s.atom)(e=>e(v).clearable),O=(0,p.focusAtom)(g.touchedFields,e=>e.path(...b)),k=(0,p.focusAtom)(g.blurredFields,e=>e.path(...b)),ae=(0,p.focusAtom)(g.validatingFields,e=>e.path(...b)),A=(0,p.focusAtom)(g.validationResultsFields,e=>e.path(...b)),oe=(0,p.focusAtom)(g.tabIndexes,e=>e.path(...b)),j=(0,p.focusAtom)(g.refs,e=>e.path(...b)),M=(0,p.focusAtom)(g.initialValues,e=>e.path(...b)),N=(0,p.focusAtom)(g.values,e=>e.path(...b)),P=(0,s.atom)(e=>e(v).isEqual(e(N),e(M))),F=(0,s.atom)(e=>!!e(v).showErrorsBeforeBlur||!!e(k)||e(g.submitAttempts)>0),I=n.atomWithFieldsMessageTypes(A,`danger`),L=(0,s.atom)(e=>e(F)?e(I):[]),R=n.atomWithFieldsMessageTypes(A,`warning`),z=n.atomWithFieldsMessageTypes(A,`info`),B=n.atomWithFieldsMessageTypes(A,`discovery`),V=n.atomWithFieldsMessageTypes(A,`success`),H=n.atomWithFieldsMessageTypes(A,`success`),U=n.atomWithFieldsMessageTypes(A,`danger`),W=n.atomWithFieldsMessageList(A,`danger`),G=(0,s.atom)(e=>e(F)?e(W):[]),K=n.atomWithFieldsMessageList(A,`warning`),q=n.atomWithFieldsMessageList(A,`info`),J=n.atomWithFieldsMessageList(A,`discovery`),Y=n.atomWithFieldsMessageList(A,`success`),X=n.atomWithFieldsMessageList(A,`success`),Z=n.atomWithFieldsMessageList(A,`danger`),Q=(0,s.atom)(e=>e(G).length>0),se=(0,s.atom)(e=>!e(Q)),ce=(0,s.atom)(e=>{let t=e(v),n=e(N),r;return r=t?.format?t.format(n):n,(0,f.isSet)(r)?(0,c.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(v,N,T),le=(0,a.splitAtom)($),ue=(0,a.atomWithDefault)(e=>e(v).size??`md`);return{options:v,form:te,name:ne,path:x,initialValue:M,previousValue:(0,s.atom)(e=>{let t=e(g.previousValues);return(0,u.getField)(t,e(x).join(`.`))??null}),value:N,formattedValue:ce,focused:re,required:ie,disabled:T,readOnly:E,clearable:D,touched:O,blurred:k,validating:ae,validationResults:A,tabIndex:oe,ref:j,pristine:(0,s.atom)(e=>!e(P)),dirty:P,items:$,itemsAtoms:le,size:ue,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:G,warningMessages:K,infoMessages:q,discoveryMessages:J,successMessages:Y,positiveMessages:X,negativeMessages:Z,theme:n.atomWithTheme(v,G,K,q,J,Y,X,Z),messages:n.atomWithMessages(G,K,q,J,Y,X,Z),invalid:Q,valid:se}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=m,exports.FieldApi=h;
@@ -1 +1 @@
1
- {"version":3,"file":"field-molecule.d.cts","names":["_$_____0.MoleculeApi"],"sources":["../../../src/form/molecules/field-molecule.ts"],"mappings":";;;cAiDa,uBAAuB;cAWvB,UAAQA,YAAA"}
1
+ {"version":3,"file":"field-molecule.d.cts","names":["_$_____0.MoleculeApi"],"sources":["../../../src/form/molecules/field-molecule.ts"],"mappings":";;;cAiDa,uBAAuB;cAYvB,UAAQA,YAAA"}
@@ -1,2 +1,2 @@
1
- import{createMoleculeApi as e,use as t}from"../../base/utilities/create-molecule.mjs";import"../../base/index.mjs";import{atomWithFieldItems as n}from"../atoms/atom-with-field.mjs";import{atomWithFieldsMessageList as r,atomWithFieldsMessageTypes as i,atomWithMessages as a,atomWithTheme as ee}from"../atoms/atom-with-messages.mjs";import{requiredValidator as te}from"../utilities/validators.mjs";import{FormApi as o}from"./form-molecule.mjs";import{isFunction as s}from"@stryke/type-checks/is-function";import{RESET as c,atomWithDefault as l,splitAtom as ne}from"jotai/utils";import{isEqual as u}from"@stryke/helpers/is-equal";import{atom as d}from"jotai";import{isString as f}from"@stryke/type-checks/is-string";import{deepMerge as p}from"@stryke/helpers/deep-merge";import{getField as re}from"@stryke/helpers/get-field";import{toPath as m}from"@stryke/helpers/to-path";import{isSet as ie}from"@stryke/type-checks/is-set";import{focusAtom as h}from"jotai-optics";const g={theme:`base`,size:`md`,debounceMs:100,isEqual:u,required:!1,disabled:!1,clearable:!1,initialValue:null},_=e(e=>{let u=t(o.Scope),_=d(()=>u),v=t(o.Molecule),y=d(g),b=d(e=>{let t=e(v.options),n=e(y),r=p(t.defaultFieldOptions,n);return p({validate:{onBlur:r.required?[te]:[]}},r)},(e,t,n)=>{let r={};r=s(n)?n(e(y)):n===c?{}:n,t(y,p(g,r))}),x=`${u}-`,S=m(e.startsWith(x)?e.slice(x.length):e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=d(()=>S),w=d(e=>e(C).slice(-1)[0]),ae=h(v.focusedFields,e=>e.path(...S)),T=h(v.requiredFields,e=>e.path(...S)),E=h(v.disabledFields,e=>e.path(...S)),oe=d(e=>e(T)??e(b).required,(e,t,n)=>{t(T,n)}),D=d(e=>e(E)??e(b).disabled,(e,t,n)=>{t(E,n)}),se=d(e=>e(b).clearable),ce=h(v.touchedFields,e=>e.path(...S)),O=h(v.blurredFields,e=>e.path(...S)),k=h(v.validatingFields,e=>e.path(...S)),A=h(v.validationResultsFields,e=>e.path(...S)),j=h(v.tabIndexes,e=>e.path(...S)),M=h(v.refs,e=>e.path(...S)),N=h(v.initialValues,e=>e.path(...S)),P=h(v.values,e=>e.path(...S)),F=d(e=>e(b).isEqual(e(P),e(N))),I=d(e=>!!e(b).showErrorsBeforeBlur||!!e(O)||e(v.submitAttempts)>0),L=i(A,`danger`),R=d(e=>e(I)?e(L):[]),z=i(A,`warning`),B=i(A,`info`),V=i(A,`discovery`),H=i(A,`success`),U=i(A,`success`),W=i(A,`danger`),le=r(A,`danger`),G=d(e=>e(I)?e(le):[]),K=r(A,`warning`),q=r(A,`info`),J=r(A,`discovery`),Y=r(A,`success`),X=r(A,`success`),Z=r(A,`danger`),Q=d(e=>e(G).length>0),ue=d(e=>!e(Q)),de=d(e=>{let t=e(b),n=e(P),r;return r=t?.format?t.format(n):n,ie(r)?f(r)?r:String(r):``}),$=n(b,P,D),fe=ne($),pe=l(e=>e(b).size??`md`);return{options:b,form:_,name:w,path:C,initialValue:N,previousValue:d(e=>{let t=e(v.previousValues);return re(t,e(C).join(`.`))??null}),value:P,formattedValue:de,focused:ae,required:oe,disabled:D,clearable:se,touched:ce,blurred:O,validating:k,validationResults:A,tabIndex:j,ref:M,pristine:d(e=>!e(F)),dirty:F,items:$,itemsAtoms:fe,size:pe,errors:R,warnings:z,info:B,discovery:V,success:H,positive:U,negative:W,dangerMessages:G,warningMessages:K,infoMessages:q,discoveryMessages:J,successMessages:Y,positiveMessages:X,negativeMessages:Z,theme:ee(b,G,K,q,J,Y,X,Z),messages:a(G,K,q,J,Y,X,Z),invalid:Q,valid:ue}},{type:`field`});export{g as DEFAULT_FIELD_OPTIONS,_ as FieldApi};
1
+ import{createMoleculeApi as e,use as t}from"../../base/utilities/create-molecule.mjs";import"../../base/index.mjs";import{atomWithFieldItems as n}from"../atoms/atom-with-field.mjs";import{atomWithFieldsMessageList as r,atomWithFieldsMessageTypes as i,atomWithMessages as a,atomWithTheme as ee}from"../atoms/atom-with-messages.mjs";import{requiredValidator as te}from"../utilities/validators.mjs";import{FormApi as o}from"./form-molecule.mjs";import{isFunction as s}from"@stryke/type-checks/is-function";import{RESET as c,atomWithDefault as l,splitAtom as ne}from"jotai/utils";import{isEqual as u}from"@stryke/helpers/is-equal";import{atom as d}from"jotai";import{isString as f}from"@stryke/type-checks/is-string";import{deepMerge as p}from"@stryke/helpers/deep-merge";import{getField as re}from"@stryke/helpers/get-field";import{toPath as m}from"@stryke/helpers/to-path";import{isSet as ie}from"@stryke/type-checks/is-set";import{focusAtom as h}from"jotai-optics";const g={theme:`base`,size:`md`,debounceMs:100,isEqual:u,required:!1,disabled:!1,readOnly:!1,clearable:!1,initialValue:null},_=e(e=>{let u=t(o.Scope),_=d(()=>u),v=t(o.Molecule),y=d(g),b=d(e=>{let t=e(v.options),n=e(y),r=p(t.defaultFieldOptions,n);return p({validate:{onBlur:r.required?[te]:[]}},r)},(e,t,n)=>{let r={};r=s(n)?n(e(y)):n===c?{}:n,t(y,p(g,r))}),x=`${u}-`,S=m(e.startsWith(x)?e.slice(x.length):e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=d(()=>S),w=d(e=>e(C).slice(-1)[0]),T=h(v.focusedFields,e=>e.path(...S)),E=h(v.requiredFields,e=>e.path(...S)),D=h(v.disabledFields,e=>e.path(...S)),O=h(v.readOnlyFields,e=>e.path(...S)),ae=d(e=>e(E)??e(b).required,(e,t,n)=>{t(E,n)}),k=d(e=>e(D)??e(b).disabled,(e,t,n)=>{t(D,n)}),oe=d(e=>e(O)??e(b).readOnly,(e,t,n)=>{t(O,n)}),se=d(e=>e(b).clearable),ce=h(v.touchedFields,e=>e.path(...S)),A=h(v.blurredFields,e=>e.path(...S)),j=h(v.validatingFields,e=>e.path(...S)),M=h(v.validationResultsFields,e=>e.path(...S)),N=h(v.tabIndexes,e=>e.path(...S)),P=h(v.refs,e=>e.path(...S)),F=h(v.initialValues,e=>e.path(...S)),I=h(v.values,e=>e.path(...S)),L=d(e=>e(b).isEqual(e(I),e(F))),R=d(e=>!!e(b).showErrorsBeforeBlur||!!e(A)||e(v.submitAttempts)>0),z=i(M,`danger`),B=d(e=>e(R)?e(z):[]),V=i(M,`warning`),H=i(M,`info`),U=i(M,`discovery`),W=i(M,`success`),le=i(M,`success`),ue=i(M,`danger`),de=r(M,`danger`),G=d(e=>e(R)?e(de):[]),K=r(M,`warning`),q=r(M,`info`),J=r(M,`discovery`),Y=r(M,`success`),X=r(M,`success`),Z=r(M,`danger`),Q=d(e=>e(G).length>0),fe=d(e=>!e(Q)),pe=d(e=>{let t=e(b),n=e(I),r;return r=t?.format?t.format(n):n,ie(r)?f(r)?r:String(r):``}),$=n(b,I,k),me=ne($),he=l(e=>e(b).size??`md`);return{options:b,form:_,name:w,path:C,initialValue:F,previousValue:d(e=>{let t=e(v.previousValues);return re(t,e(C).join(`.`))??null}),value:I,formattedValue:pe,focused:T,required:ae,disabled:k,readOnly:oe,clearable:se,touched:ce,blurred:A,validating:j,validationResults:M,tabIndex:N,ref:P,pristine:d(e=>!e(L)),dirty:L,items:$,itemsAtoms:me,size:he,errors:B,warnings:V,info:H,discovery:U,success:W,positive:le,negative:ue,dangerMessages:G,warningMessages:K,infoMessages:q,discoveryMessages:J,successMessages:Y,positiveMessages:X,negativeMessages:Z,theme:ee(b,G,K,q,J,Y,X,Z),messages:a(G,K,q,J,Y,X,Z),invalid:Q,valid:fe}},{type:`field`});export{g as DEFAULT_FIELD_OPTIONS,_ as FieldApi};
2
2
  //# sourceMappingURL=field-molecule.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-molecule.mjs","names":["DEFAULT_FIELD_OPTIONS","FieldApi","createMoleculeApi","formScope","use","FormApi","formScopeAtom","atom","form","optionsBaseAtom","optionsAtom","formOptions","get","options","result","deepMerge","requiredValidator","nextValue","isFunction","update","RESET","set","formPrefix","path","toPath","scope","pathAtom","nameAtom","focusedAtom","focusAtom","optic","requiredStateAtom","disabledStateAtom","requiredAtom","disabledAtom","clearableAtom","touchedAtom","blurredAtom","validatingAtom","validationResultsAtom","tabIndexAtom","refAtom","initialValueAtom","valueAtom","dirtyAtom","showErrorsAtom","allErrorsAtom","atomWithFieldsMessageTypes","errorsAtom","warningsAtom","infoAtom","discoveryAtom","successesAtom","positivesAtom","negativesAtom","allErrorMessagesAtom","atomWithFieldsMessageList","errorMessagesAtom","warningMessagesAtom","infoMessagesAtom","discoveryMessagesAtom","successMessagesAtom","positiveMessagesAtom","negativeMessagesAtom","invalidAtom","validAtom","formattedValueAtom","value","formattedValue","isSet","isString","itemsAtom","atomWithFieldItems","itemsAtomsAtom","splitAtom","sizeAtom","atomWithDefault","previousValues","getField","atomWithTheme","atomWithMessages"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"field-molecule.mjs","names":["DEFAULT_FIELD_OPTIONS","FieldApi","createMoleculeApi","formScope","use","FormApi","formScopeAtom","atom","form","optionsBaseAtom","optionsAtom","formOptions","get","options","result","deepMerge","requiredValidator","nextValue","isFunction","update","RESET","set","formPrefix","path","toPath","scope","pathAtom","nameAtom","focusedAtom","focusAtom","optic","requiredStateAtom","disabledStateAtom","readOnlyStateAtom","requiredAtom","disabledAtom","readOnlyAtom","clearableAtom","touchedAtom","blurredAtom","validatingAtom","validationResultsAtom","tabIndexAtom","refAtom","initialValueAtom","valueAtom","dirtyAtom","showErrorsAtom","allErrorsAtom","atomWithFieldsMessageTypes","errorsAtom","warningsAtom","infoAtom","discoveryAtom","successesAtom","positivesAtom","negativesAtom","allErrorMessagesAtom","atomWithFieldsMessageList","errorMessagesAtom","warningMessagesAtom","infoMessagesAtom","discoveryMessagesAtom","successMessagesAtom","positiveMessagesAtom","negativeMessagesAtom","invalidAtom","validAtom","formattedValueAtom","value","formattedValue","isSet","isString","itemsAtom","atomWithFieldItems","itemsAtomsAtom","splitAtom","sizeAtom","atomWithDefault","previousValues","getField","atomWithTheme","atomWithMessages"],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- const e=require("../../base/utilities/create-molecule.cjs"),t=require("../atoms/atom-with-messages.cjs");let n=require("@stryke/type-checks/is-function"),r=require("jotai/utils"),i=require("@stryke/helpers/is-equal"),a=require("jotai"),o=require("@stryke/type-checks/is-string"),s=require("@stryke/helpers/deep-merge"),c=require("@stryke/helpers/flatten-object"),l=require("@stryke/helpers/set-field"),u=require("@stryke/type-checks/is-number");const d={theme:`base`,debounceMs:100,isEqual:i.isEqual,disabled:!1,initialValues:{},defaultFieldOptions:{}},f=e.createMoleculeApi(e=>{let i=(0,r.atomWithReset)(d),f=(0,a.atom)(e=>e(i),(e,t,a)=>{let o={};o=(0,n.isFunction)(a)?a(e(i)):a===r.RESET?{}:a,t(i,(0,s.deepMerge)(d,o))}),p=(0,a.atom)(e),m=(0,r.atomWithDefault)(e=>!!e(f).disabled),h=(0,r.atomWithReset)(!1),g=(0,r.atomWithReset)({}),_=(0,a.atom)(e=>e(g),(e,t,n)=>{}),v=(0,r.atomWithDefault)(e=>e(f).initialValues),y=(0,r.atomWithDefault)(e=>e(f).initialValues),b=(0,a.atom)(e=>e(y),(e,t,r)=>{let i={};r&&(i=(0,n.isFunction)(r)?r(e(y)):r),t(g,e(y)),t(y,i)}),x=(0,r.atomWithReset)({initialize:[],change:[],blur:[],submit:[],server:[]}),S=(0,r.atomWithReset)(!1),C=(0,r.atomWithReset)(!1),w=(0,r.atomWithReset)(0),T=(0,r.atomWithReset)({}),E=(0,r.atomWithReset)({}),D=(0,r.atomWithReset)({}),O=(0,r.atomWithReset)({}),k=(0,r.atomWithReset)({}),A=(0,r.atomWithReset)({}),j=(0,r.atomWithReset)({}),M=(0,r.atomWithReset)({}),N=(0,r.atomWithReset)({}),P=(0,a.atom)(e=>e(N),(e,t,i)=>{let a={};if((0,n.isFunction)(i))a=i(e(N));else if(i===r.RESET)a={};else{let t=e(N);if(`field`in i&&i.field&&(0,o.isString)(i.field)){let e=i.tabIndex;if(!(0,u.isNumber)(e)||e>-1){let n=(0,c.flattenObject)(t),r=-1;for(let e in n)(0,u.isNumber)(n[e])&&n[e]>r&&(r=n[e]);e=r+1}a=(0,l.setField)(t,i.field,e)}else a=i}t(N,a)}),F=(0,a.atom)(e=>e(f).isEqual(e(b),e(v))),ee=(0,a.atom)(e=>!e(F)),te=(0,a.atom)(e=>{let t=(0,c.flattenObject)(e(k));return Object.keys(t).some(e=>t[e])}),I=(0,a.atom)(e=>{let t=(0,c.flattenObject)(e(O));return Object.keys(t).some(e=>t[e])}),L=(0,a.atom)(e=>{if(e(h))return!0;let t=(0,c.flattenObject)(e(A));return Object.keys(t).some(e=>t[e])}),R=t.atomWithMessageTypes(x,`danger`),z=t.atomWithMessageTypes(x,`warning`),B=t.atomWithMessageTypes(x,`info`),V=t.atomWithMessageTypes(x,`discovery`),H=t.atomWithMessageTypes(x,`success`),U=t.atomWithMessageTypes(x,`success`),W=t.atomWithMessageTypes(x,`danger`),G=(0,a.atom)(e=>e(R).length>0),K=t.atomWithFieldsMessageTypes(j,`danger`),q=t.atomWithFieldsMessageTypes(j,`warning`),J=t.atomWithFieldsMessageTypes(j,`info`),Y=t.atomWithFieldsMessageTypes(j,`discovery`),X=t.atomWithFieldsMessageTypes(j,`success`),Z=t.atomWithFieldsMessageList(j,`danger`),ne=t.atomWithFieldsMessageList(j,`warning`),re=t.atomWithFieldsMessageList(j,`info`),ie=t.atomWithFieldsMessageList(j,`discovery`),ae=t.atomWithFieldsMessageList(j,`success`),Q=(0,a.atom)(e=>e(Z).length>0||e(G)),$=(0,a.atom)(e=>!e(Q)),oe=(0,a.atom)(e=>e($)&&!e(L)&&!e(S)&&!e(m));return{options:f,name:p,disabled:m,formValidating:h,validationResults:x,submitting:S,submitted:C,submitAttempts:w,focusedFields:T,requiredFields:E,disabledFields:D,touchedFields:O,blurredFields:k,validatingFields:A,validationResultsFields:j,tabIndexes:P,refs:M,dirty:F,pristine:ee,blurred:te,touched:I,validating:L,previousValues:_,initialValues:v,values:b,dangerMessages:R,warningMessages:z,infoMessages:B,discoveryMessages:V,successMessages:H,positiveMessages:U,negativeMessages:W,messages:t.atomWithMessages(R,z,B,V,H,U,W),dangerFields:K,warningFields:q,infoFields:J,discoveryFields:Y,successFields:X,fieldDangerMessages:Z,fieldWarningMessages:ne,fieldInfoMessages:re,fieldHelpMessages:ie,fieldsSuccessMessages:ae,valid:$,invalid:Q,theme:t.atomWithTheme(f,R,z,B,V,H,U,W),canSubmit:oe}},{type:`form`});exports.DEFAULT_FORM_OPTIONS=d,exports.FormApi=f;
1
+ const e=require("../../base/utilities/create-molecule.cjs"),t=require("../atoms/atom-with-messages.cjs");let n=require("@stryke/type-checks/is-function"),r=require("jotai/utils"),i=require("@stryke/helpers/is-equal"),a=require("jotai"),o=require("@stryke/type-checks/is-string"),s=require("@stryke/helpers/deep-merge"),c=require("@stryke/helpers/flatten-object"),l=require("@stryke/helpers/set-field"),u=require("@stryke/type-checks/is-number");const d={theme:`base`,debounceMs:100,isEqual:i.isEqual,disabled:!1,initialValues:{},defaultFieldOptions:{}},f=e.createMoleculeApi(e=>{let i=(0,r.atomWithReset)(d),f=(0,a.atom)(e=>e(i),(e,t,a)=>{let o={};o=(0,n.isFunction)(a)?a(e(i)):a===r.RESET?{}:a,t(i,(0,s.deepMerge)(d,o))}),p=(0,a.atom)(e),m=(0,r.atomWithDefault)(e=>!!e(f).disabled),h=(0,r.atomWithReset)(!1),g=(0,r.atomWithReset)({}),_=(0,a.atom)(e=>e(g),(e,t,n)=>{}),v=(0,r.atomWithDefault)(e=>e(f).initialValues),y=(0,r.atomWithDefault)(e=>e(f).initialValues),b=(0,a.atom)(e=>e(y),(e,t,r)=>{let i={};r&&(i=(0,n.isFunction)(r)?r(e(y)):r),t(g,e(y)),t(y,i)}),x=(0,r.atomWithReset)({initialize:[],change:[],blur:[],submit:[],server:[]}),S=(0,r.atomWithReset)(!1),ee=(0,r.atomWithReset)(!1),te=(0,r.atomWithReset)(0),C=(0,r.atomWithReset)({}),w=(0,r.atomWithReset)({}),T=(0,r.atomWithReset)({}),E=(0,r.atomWithReset)({}),D=(0,r.atomWithReset)({}),O=(0,r.atomWithReset)({}),k=(0,r.atomWithReset)({}),A=(0,r.atomWithReset)({}),j=(0,r.atomWithReset)({}),M=(0,r.atomWithReset)({}),ne=(0,a.atom)(e=>e(M),(e,t,i)=>{let a={};if((0,n.isFunction)(i))a=i(e(M));else if(i===r.RESET)a={};else{let t=e(M);if(`field`in i&&i.field&&(0,o.isString)(i.field)){let e=i.tabIndex;if(!(0,u.isNumber)(e)||e>-1){let n=(0,c.flattenObject)(t),r=-1;for(let e in n)(0,u.isNumber)(n[e])&&n[e]>r&&(r=n[e]);e=r+1}a=(0,l.setField)(t,i.field,e)}else a=i}t(M,a)}),N=(0,a.atom)(e=>e(f).isEqual(e(b),e(v))),P=(0,a.atom)(e=>!e(N)),F=(0,a.atom)(e=>{let t=(0,c.flattenObject)(e(O));return Object.keys(t).some(e=>t[e])}),I=(0,a.atom)(e=>{let t=(0,c.flattenObject)(e(D));return Object.keys(t).some(e=>t[e])}),L=(0,a.atom)(e=>{if(e(h))return!0;let t=(0,c.flattenObject)(e(k));return Object.keys(t).some(e=>t[e])}),R=t.atomWithMessageTypes(x,`danger`),z=t.atomWithMessageTypes(x,`warning`),B=t.atomWithMessageTypes(x,`info`),V=t.atomWithMessageTypes(x,`discovery`),H=t.atomWithMessageTypes(x,`success`),U=t.atomWithMessageTypes(x,`success`),W=t.atomWithMessageTypes(x,`danger`),G=(0,a.atom)(e=>e(R).length>0),K=t.atomWithFieldsMessageTypes(A,`danger`),q=t.atomWithFieldsMessageTypes(A,`warning`),J=t.atomWithFieldsMessageTypes(A,`info`),Y=t.atomWithFieldsMessageTypes(A,`discovery`),X=t.atomWithFieldsMessageTypes(A,`success`),Z=t.atomWithFieldsMessageList(A,`danger`),re=t.atomWithFieldsMessageList(A,`warning`),ie=t.atomWithFieldsMessageList(A,`info`),ae=t.atomWithFieldsMessageList(A,`discovery`),oe=t.atomWithFieldsMessageList(A,`success`),Q=(0,a.atom)(e=>e(Z).length>0||e(G)),$=(0,a.atom)(e=>!e(Q)),se=(0,a.atom)(e=>e($)&&!e(L)&&!e(S)&&!e(m));return{options:f,name:p,disabled:m,formValidating:h,validationResults:x,submitting:S,submitted:ee,submitAttempts:te,focusedFields:C,requiredFields:w,disabledFields:T,readOnlyFields:E,touchedFields:D,blurredFields:O,validatingFields:k,validationResultsFields:A,tabIndexes:ne,refs:j,dirty:N,pristine:P,blurred:F,touched:I,validating:L,previousValues:_,initialValues:v,values:b,dangerMessages:R,warningMessages:z,infoMessages:B,discoveryMessages:V,successMessages:H,positiveMessages:U,negativeMessages:W,messages:t.atomWithMessages(R,z,B,V,H,U,W),dangerFields:K,warningFields:q,infoFields:J,discoveryFields:Y,successFields:X,fieldDangerMessages:Z,fieldWarningMessages:re,fieldInfoMessages:ie,fieldHelpMessages:ae,fieldsSuccessMessages:oe,valid:$,invalid:Q,theme:t.atomWithTheme(f,R,z,B,V,H,U,W),canSubmit:se}},{type:`form`});exports.DEFAULT_FORM_OPTIONS=d,exports.FormApi=f;
@@ -1,2 +1,2 @@
1
- import{createMoleculeApi as e}from"../../base/utilities/create-molecule.mjs";import{atomWithFieldsMessageList as t,atomWithFieldsMessageTypes as n,atomWithMessageTypes as r,atomWithMessages as i,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{isFunction as o}from"@stryke/type-checks/is-function";import{RESET as s,atomWithDefault as c,atomWithReset as l}from"jotai/utils";import{isEqual as u}from"@stryke/helpers/is-equal";import{atom as d}from"jotai";import{isString as f}from"@stryke/type-checks/is-string";import{deepMerge as p}from"@stryke/helpers/deep-merge";import{flattenObject as m}from"@stryke/helpers/flatten-object";import{setField as ee}from"@stryke/helpers/set-field";import{isNumber as h}from"@stryke/type-checks/is-number";const g={theme:`base`,debounceMs:100,isEqual:u,disabled:!1,initialValues:{},defaultFieldOptions:{}},_=e(e=>{let u=l(g),_=d(e=>e(u),(e,t,n)=>{let r={};r=o(n)?n(e(u)):n===s?{}:n,t(u,p(g,r))}),v=d(e),y=c(e=>!!e(_).disabled),b=l(!1),x=l({}),S=d(e=>e(x),(e,t,n)=>{}),C=c(e=>e(_).initialValues),w=c(e=>e(_).initialValues),T=d(e=>e(w),(e,t,n)=>{let r={};n&&(r=o(n)?n(e(w)):n),t(x,e(w)),t(w,r)}),E=l({initialize:[],change:[],blur:[],submit:[],server:[]}),D=l(!1),O=l(!1),k=l(0),te=l({}),A=l({}),j=l({}),M=l({}),N=l({}),P=l({}),F=l({}),ne=l({}),I=l({}),L=d(e=>e(I),(e,t,n)=>{let r={};if(o(n))r=n(e(I));else if(n===s)r={};else{let t=e(I);if(`field`in n&&n.field&&f(n.field)){let e=n.tabIndex;if(!h(e)||e>-1){let n=m(t),r=-1;for(let e in n)h(n[e])&&n[e]>r&&(r=n[e]);e=r+1}r=ee(t,n.field,e)}else r=n}t(I,r)}),R=d(e=>e(_).isEqual(e(T),e(C))),z=d(e=>!e(R)),B=d(e=>{let t=m(e(N));return Object.keys(t).some(e=>t[e])}),V=d(e=>{let t=m(e(M));return Object.keys(t).some(e=>t[e])}),H=d(e=>{if(e(b))return!0;let t=m(e(P));return Object.keys(t).some(e=>t[e])}),U=r(E,`danger`),W=r(E,`warning`),G=r(E,`info`),K=r(E,`discovery`),q=r(E,`success`),J=r(E,`success`),Y=r(E,`danger`),X=d(e=>e(U).length>0),re=n(F,`danger`),ie=n(F,`warning`),ae=n(F,`info`),oe=n(F,`discovery`),se=n(F,`success`),Z=t(F,`danger`),ce=t(F,`warning`),le=t(F,`info`),ue=t(F,`discovery`),de=t(F,`success`),Q=d(e=>e(Z).length>0||e(X)),$=d(e=>!e(Q)),fe=d(e=>e($)&&!e(H)&&!e(D)&&!e(y));return{options:_,name:v,disabled:y,formValidating:b,validationResults:E,submitting:D,submitted:O,submitAttempts:k,focusedFields:te,requiredFields:A,disabledFields:j,touchedFields:M,blurredFields:N,validatingFields:P,validationResultsFields:F,tabIndexes:L,refs:ne,dirty:R,pristine:z,blurred:B,touched:V,validating:H,previousValues:S,initialValues:C,values:T,dangerMessages:U,warningMessages:W,infoMessages:G,discoveryMessages:K,successMessages:q,positiveMessages:J,negativeMessages:Y,messages:i(U,W,G,K,q,J,Y),dangerFields:re,warningFields:ie,infoFields:ae,discoveryFields:oe,successFields:se,fieldDangerMessages:Z,fieldWarningMessages:ce,fieldInfoMessages:le,fieldHelpMessages:ue,fieldsSuccessMessages:de,valid:$,invalid:Q,theme:a(_,U,W,G,K,q,J,Y),canSubmit:fe}},{type:`form`});export{g as DEFAULT_FORM_OPTIONS,_ as FormApi};
1
+ import{createMoleculeApi as e}from"../../base/utilities/create-molecule.mjs";import{atomWithFieldsMessageList as t,atomWithFieldsMessageTypes as n,atomWithMessageTypes as r,atomWithMessages as i,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{isFunction as o}from"@stryke/type-checks/is-function";import{RESET as s,atomWithDefault as c,atomWithReset as l}from"jotai/utils";import{isEqual as u}from"@stryke/helpers/is-equal";import{atom as d}from"jotai";import{isString as ee}from"@stryke/type-checks/is-string";import{deepMerge as te}from"@stryke/helpers/deep-merge";import{flattenObject as f}from"@stryke/helpers/flatten-object";import{setField as p}from"@stryke/helpers/set-field";import{isNumber as m}from"@stryke/type-checks/is-number";const h={theme:`base`,debounceMs:100,isEqual:u,disabled:!1,initialValues:{},defaultFieldOptions:{}},g=e(e=>{let u=l(h),g=d(e=>e(u),(e,t,n)=>{let r={};r=o(n)?n(e(u)):n===s?{}:n,t(u,te(h,r))}),_=d(e),v=c(e=>!!e(g).disabled),y=l(!1),b=l({}),ne=d(e=>e(b),(e,t,n)=>{}),x=c(e=>e(g).initialValues),S=c(e=>e(g).initialValues),C=d(e=>e(S),(e,t,n)=>{let r={};n&&(r=o(n)?n(e(S)):n),t(b,e(S)),t(S,r)}),w=l({initialize:[],change:[],blur:[],submit:[],server:[]}),T=l(!1),E=l(!1),D=l(0),O=l({}),k=l({}),A=l({}),j=l({}),M=l({}),N=l({}),P=l({}),F=l({}),re=l({}),I=l({}),L=d(e=>e(I),(e,t,n)=>{let r={};if(o(n))r=n(e(I));else if(n===s)r={};else{let t=e(I);if(`field`in n&&n.field&&ee(n.field)){let e=n.tabIndex;if(!m(e)||e>-1){let n=f(t),r=-1;for(let e in n)m(n[e])&&n[e]>r&&(r=n[e]);e=r+1}r=p(t,n.field,e)}else r=n}t(I,r)}),R=d(e=>e(g).isEqual(e(C),e(x))),z=d(e=>!e(R)),B=d(e=>{let t=f(e(N));return Object.keys(t).some(e=>t[e])}),V=d(e=>{let t=f(e(M));return Object.keys(t).some(e=>t[e])}),H=d(e=>{if(e(y))return!0;let t=f(e(P));return Object.keys(t).some(e=>t[e])}),U=r(w,`danger`),W=r(w,`warning`),G=r(w,`info`),K=r(w,`discovery`),q=r(w,`success`),J=r(w,`success`),Y=r(w,`danger`),ie=d(e=>e(U).length>0),ae=n(F,`danger`),oe=n(F,`warning`),se=n(F,`info`),ce=n(F,`discovery`),le=n(F,`success`),X=t(F,`danger`),ue=t(F,`warning`),de=t(F,`info`),Z=t(F,`discovery`),fe=t(F,`success`),Q=d(e=>e(X).length>0||e(ie)),$=d(e=>!e(Q)),pe=d(e=>e($)&&!e(H)&&!e(T)&&!e(v));return{options:g,name:_,disabled:v,formValidating:y,validationResults:w,submitting:T,submitted:E,submitAttempts:D,focusedFields:O,requiredFields:k,disabledFields:A,readOnlyFields:j,touchedFields:M,blurredFields:N,validatingFields:P,validationResultsFields:F,tabIndexes:L,refs:re,dirty:R,pristine:z,blurred:B,touched:V,validating:H,previousValues:ne,initialValues:x,values:C,dangerMessages:U,warningMessages:W,infoMessages:G,discoveryMessages:K,successMessages:q,positiveMessages:J,negativeMessages:Y,messages:i(U,W,G,K,q,J,Y),dangerFields:ae,warningFields:oe,infoFields:se,discoveryFields:ce,successFields:le,fieldDangerMessages:X,fieldWarningMessages:ue,fieldInfoMessages:de,fieldHelpMessages:Z,fieldsSuccessMessages:fe,valid:$,invalid:Q,theme:a(g,U,W,G,K,q,J,Y),canSubmit:pe}},{type:`form`});export{h as DEFAULT_FORM_OPTIONS,g as FormApi};
2
2
  //# sourceMappingURL=form-molecule.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-molecule.mjs","names":["DEFAULT_FORM_OPTIONS","FormApi","createMoleculeApi","optionsBaseAtom","atomWithReset","optionsAtom","atom","get","nextValue","isFunction","update","RESET","set","deepMerge","nameAtom","scope","disabledAtom","atomWithDefault","formValidatingAtom","previousValuesBaseAtom","previousValuesAtom","initialValuesAtom","valuesBaseAtom","valuesAtom","validationResultsAtom","submittingAtom","submittedAtom","submitAttemptsAtom","focusedFieldsAtom","requiredFieldsAtom","disabledFieldsAtom","touchedFieldsAtom","blurredFieldsAtom","validatingFieldsAtom","validationResultsFieldsAtom","refsAtom","tabIndexesBaseAtom","tabIndexesAtom","tabIndexes","isString","tabIndex","isNumber","flat","flattenObject","lastIndex","key","setField","dirtyAtom","pristineAtom","blurredAtom","blurredFields","touchedAtom","touchedFields","validatingAtom","validatingFields","formErrorsAtom","atomWithMessageTypes","formWarningsAtom","formInfoAtom","formHelpAtom","formSuccessesAtom","formPositivesAtom","formNegativesAtom","isFormInvalidAtom","errorFieldsAtom","atomWithFieldsMessageTypes","warningFieldsAtom","infoFieldsAtom","helpFieldsAtom","successFieldsAtom","fieldErrorMessagesAtom","atomWithFieldsMessageList","fieldWarningMessagesAtom","fieldInfoMessagesAtom","fieldHelpMessagesAtom","fieldsSuccessMessagesAtom","invalidAtom","validAtom","canSubmitAtom","atomWithMessages","atomWithTheme"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"form-molecule.mjs","names":["DEFAULT_FORM_OPTIONS","FormApi","createMoleculeApi","optionsBaseAtom","atomWithReset","optionsAtom","atom","get","nextValue","isFunction","update","RESET","set","deepMerge","nameAtom","scope","disabledAtom","atomWithDefault","formValidatingAtom","previousValuesBaseAtom","previousValuesAtom","initialValuesAtom","valuesBaseAtom","valuesAtom","validationResultsAtom","submittingAtom","submittedAtom","submitAttemptsAtom","focusedFieldsAtom","requiredFieldsAtom","disabledFieldsAtom","readOnlyFieldsAtom","touchedFieldsAtom","blurredFieldsAtom","validatingFieldsAtom","validationResultsFieldsAtom","refsAtom","tabIndexesBaseAtom","tabIndexesAtom","tabIndexes","isString","tabIndex","isNumber","flat","flattenObject","lastIndex","key","setField","dirtyAtom","pristineAtom","blurredAtom","blurredFields","touchedAtom","touchedFields","validatingAtom","validatingFields","formErrorsAtom","atomWithMessageTypes","formWarningsAtom","formInfoAtom","formHelpAtom","formSuccessesAtom","formPositivesAtom","formNegativesAtom","isFormInvalidAtom","errorFieldsAtom","atomWithFieldsMessageTypes","warningFieldsAtom","infoFieldsAtom","helpFieldsAtom","successFieldsAtom","fieldErrorMessagesAtom","atomWithFieldsMessageList","fieldWarningMessagesAtom","fieldInfoMessagesAtom","fieldHelpMessagesAtom","fieldsSuccessMessagesAtom","invalidAtom","validAtom","canSubmitAtom","atomWithMessages","atomWithTheme"],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- require("@cyclone-ui/helpers");const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};exports.ValidationCause=e;
1
+ const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};exports.ValidationCause=e;
@@ -105,6 +105,7 @@ interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any
105
105
  focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
106
106
  requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
107
107
  disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
+ readOnlyFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
109
  touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
109
110
  blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
110
111
  validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
@@ -168,6 +169,8 @@ interface FieldOptions<TFieldValue> {
168
169
  * @defaultValue false
169
170
  */
170
171
  disabled?: boolean;
172
+ /** Prevent user edits while preserving the field's normal appearance. */
173
+ readOnly?: boolean;
171
174
  /**
172
175
  * Whether the field's value can be cleared by its control.
173
176
  *
@@ -245,7 +248,7 @@ interface FieldOptions<TFieldValue> {
245
248
  parse?: (value: any) => TFieldValue;
246
249
  [key: string]: any;
247
250
  }
248
- type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
251
+ type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "readOnly" | "clearable" | "required" | "initialValue">>;
249
252
  interface FieldAtoms<TFieldValue> {
250
253
  options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
251
254
  form: Atom<string>;
@@ -254,6 +257,7 @@ interface FieldAtoms<TFieldValue> {
254
257
  focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
255
258
  required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
256
259
  disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
260
+ readOnly: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
257
261
  clearable: Atom<boolean>;
258
262
  touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
259
263
  blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction$1<InferFieldState<TFieldValue, boolean>>], void>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":["ValidationDetails","SetStateAction"],"sources":["../../src/form/types.ts"],"mappings":";;;;;;;;;;;;;;KA4CY;cAGC;EACiB,YAAA;EACR,QAAA;EACJ,MAAA;EACI,QAAA;EACA,QAAA;;KAGV,UAAU,iBACpB,OAAO,QACP,eAAe,QACf,OAAO,iBACP,KAAK,QACL,KAAK,WACF,aAAaA;KAEN,oBAAoB,QAC9B,OAAO,iB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KAAKA;EACX,WAAW,KAAKA;EAChB,SAAS,KAAKA;EACd,UAAU,KAAKA;EACf,UAAU,KAAKA;EAEf,gBAAgB,KAAKA;EACrB,iBAAiB,KAAKA;EACtB,cAAc,KAAKA;EACnB,mBAAmB,KAAKA;EACxB,iBAAiB,KAAKA;EACtB,kBAAkB,KAAKA;EACvB,kBAAkB,KAAKA;EAEvB,OAAO;EACP,UAAU,KAAKA;EAEf,SAAS;EACT,OAAO"}
1
+ {"version":3,"file":"types.d.cts","names":["ValidationDetails","SetStateAction"],"sources":["../../src/form/types.ts"],"mappings":";;;;;;;;;;;;;;KA4CY;cAGC;EACiB,YAAA;EACR,QAAA;EACJ,MAAA;EACI,QAAA;EACA,QAAA;;KAGV,UAAU,iBACpB,OAAO,QACP,eAAe,QACf,OAAO,iBACP,KAAK,QACL,KAAK,WACF,aAAaA;KAEN,oBAAoB,QAC9B,OAAO,iBAAiBA;;;;KAMd;KA6BA,gBAAgB,SAAS,UACnC,cAAc,2BAEP,cAAc,UAAU,gBAAgB,QAAQ,OAAO,aAE1D;KAEM,eAAe,gBAAgB,qBAAqB,aAC7D,cAAc,UAAU,gBAAgB,QAAQ,OAAO;KAG9C,gBAAgB,gBAAgB,uBAAuB,aAChE,cAAc,UAAU,cAAc,QAAQ,sBAC3C,gBAAgB,QAAQ,SACxB,QAAQ;KAGF,wBAAwB,sBAClC,OAAO,YAAY;UAGJ,gBACf,eAAe,qBAAqB,UAAU,eAAe;EAE7D,KAAK;EACL,KAAK;EACL,OAAO,cAAc;;;;;UAMN,YACf,oBAAoB,sBAAsB;;;;EAK1C;;;;;;EAOA;;;;EAKA,gBAAgB,gBAAgB;;;;EAKhC,WAAW,QACT,YACO,WAAW,oBAChB,UAAU,gBAAgB;;;;;;EAS9B;;;;;;;;;EAUA,WACE,QAAQ,gBAAgB,cACxB,QAAQ,gBAAgB;;;;EAM1B,sBAAsB,QACpB,KAAK,aAAa;;;;EAMpB,gBACE,SAAS,gBAAgB,UAAU,kBAChC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,gBAAgB;EAGlC,WAAW;EACX,SAAS,aACP,gBAAgB,wBACfA,iBAAe,gBAAgB;EAGlC,SAAS,aACP,gBAAgB,wBACfA,iBAAe,gBAAgB;EAGlC,YAAY,aACV,gBAAgB,wBACfA,iBAAe,gBAAgB;EAGlC,mBAAmB,aACjB,gBAAgB,aAAa,qBAC5BA,iBAAe,gBAAgB,aAAa;EAG/C,UAAU,aACR,gBAAgB,uBACfA,iBAAe,gBAAgB;EAGlC,KAAK,aACH,gBAAgB,aAAa,IAAI,qBAChCA,iBAAe,gBAAgB,aAAa,IAAI;EAInD,UAAU;EACV,OAAO;EAEP,eAAe,KAAK;EACpB,cAAc,aAAa,cAAcA,iBAAe;EACxD,OAAO,aAAa,cAAcA,iBAAe;EACjD,gBAAgB;EAEhB,OAAO,aACL,aAAa,+BACZA,iBAAe,aAAa;EAG/B,YAAY,aACV,cAAc,aAAa,gCAC1B,gBAAgB,aAAa;EAIhC,MAAM,aAAa,kBAAkBA,iBAAe;EAEpD,QAAQ,KAAKD;EACb,UAAU,KAAKA;EACf,MAAM,KAAKA;EACX,WAAW,KAAKA;EAChB,SAAS,KAAKA;EACd,UAAU,KAAKA;EACf,UAAU,KAAKA;EAEf,gBAAgB,KAAKA;EACrB,iBAAiB,KAAKA;EACtB,cAAc,KAAKA;EACnB,mBAAmB,KAAKA;EACxB,iBAAiB,KAAKA;EACtB,kBAAkB,KAAKA;EACvB,kBAAkB,KAAKA;EAEvB,OAAO;EACP,UAAU,KAAKA;EAEf,SAAS;EACT,OAAO"}
@@ -105,6 +105,7 @@ interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any
105
105
  focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
106
106
  requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
107
107
  disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
+ readOnlyFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
109
  touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
109
110
  blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
110
111
  validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
@@ -168,6 +169,8 @@ interface FieldOptions<TFieldValue> {
168
169
  * @defaultValue false
169
170
  */
170
171
  disabled?: boolean;
172
+ /** Prevent user edits while preserving the field's normal appearance. */
173
+ readOnly?: boolean;
171
174
  /**
172
175
  * Whether the field's value can be cleared by its control.
173
176
  *
@@ -245,7 +248,7 @@ interface FieldOptions<TFieldValue> {
245
248
  parse?: (value: any) => TFieldValue;
246
249
  [key: string]: any;
247
250
  }
248
- type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
251
+ type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "readOnly" | "clearable" | "required" | "initialValue">>;
249
252
  interface FieldAtoms<TFieldValue> {
250
253
  options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
251
254
  form: Atom<string>;
@@ -254,6 +257,7 @@ interface FieldAtoms<TFieldValue> {
254
257
  focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
255
258
  required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
256
259
  disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
260
+ readOnly: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
257
261
  clearable: Atom<boolean>;
258
262
  touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
259
263
  blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
@@ -1,2 +1,2 @@
1
- import"@cyclone-ui/helpers";const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};export{e as ValidationCause};
1
+ const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};export{e as ValidationCause};
2
2
  //# sourceMappingURL=types.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/state",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "type": "module",
5
5
  "description": "A state management package used to handle state in Storm Software applications.",
6
6
  "repository": {
@@ -98,7 +98,7 @@
98
98
  "react-native": { "optional": true }
99
99
  },
100
100
  "dependencies": {
101
- "@cyclone-ui/helpers": "0.3.61",
101
+ "@cyclone-ui/helpers": "0.3.63",
102
102
  "@maskito/core": "^3.11.1",
103
103
  "@maskito/react": "^3.11.1",
104
104
  "@stryke/async": "^0.1.45",
@@ -123,5 +123,5 @@
123
123
  },
124
124
  "publishConfig": { "access": "public" },
125
125
  "module": "./dist/index.mjs",
126
- "gitHead": "6f51b913d94f00f24107270fc55b2931fdb573ed"
126
+ "gitHead": "afe81470a1c2e4e4ffee6626945e49723d35e4d2"
127
127
  }