@cyclone-ui/state 0.0.2 → 0.0.4

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 ADDED
@@ -0,0 +1,10 @@
1
+ ![Cyclone UI's logo banner](https://public.storm-cdn.com/cyclone-ui/media/banner-1280x320-dark.gif)
2
+
3
+ # Changelog for Cyclone UI - State
4
+
5
+ ## [0.0.3](https://github.com/storm-software/cyclone-ui/releases/tag/state%400.0.3) (09/06/2026)
6
+
7
+ ### Features
8
+
9
+ - **themes:** Simplified semantic tokens to include a single `base` and only one background color ([3c71be2](https://github.com/storm-software/cyclone-ui/commit/3c71be2))
10
+ - **themes:** Added the `brand` sub-theme to package ([94201d5](https://github.com/storm-software/cyclone-ui/commit/94201d5))
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../theme/molecules/theme-molecule.cjs"),t=require("../theme/hooks/use-theme-actions.cjs"),n=require("../theme/utilities/theme-helpers.cjs"),r=require("../theme/hooks/use-theme-store.cjs"),i=require("../theme/providers/ThemeProvider.cjs"),a=require("../theme/types.cjs");require("../theme/index.cjs"),exports.ColorThemeName=a.ColorThemeName,exports.ThemeApi=e.ThemeApi,exports.ThemeProvider=i.ThemeProvider,exports.getThemeColorThemeName=n.getThemeColorThemeName,exports.themeColorThemeNameExists=n.themeColorThemeNameExists,exports.useColorThemeName=r.useColorThemeName,exports.useColorThemeNameExists=r.useColorThemeNameExists,exports.useThemeActions=t.useThemeActions,exports.useThemeMode=r.useThemeMode;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../theme/molecules/theme-molecule.cjs"),t=require("../theme/hooks/use-theme-actions.cjs"),n=require("../theme/utilities/theme-helpers.cjs"),r=require("../theme/hooks/use-theme-store.cjs"),i=require("../theme/providers/ThemeProvider.cjs");require("../theme/index.cjs"),exports.ThemeApi=e.ThemeApi,exports.ThemeProvider=i.ThemeProvider,exports.getThemeColorThemeName=n.getThemeColorThemeName,exports.themeColorThemeNameExists=n.themeColorThemeNameExists,exports.useColorThemeName=r.useColorThemeName,exports.useColorThemeNameExists=r.useColorThemeNameExists,exports.useThemeActions=t.useThemeActions,exports.useThemeMode=r.useThemeMode;
@@ -1 +1 @@
1
- import{ThemeApi as e}from"../theme/molecules/theme-molecule.mjs";import{useThemeActions as t}from"../theme/hooks/use-theme-actions.mjs";import{getThemeColorThemeName as n,themeColorThemeNameExists as r}from"../theme/utilities/theme-helpers.mjs";import{useColorThemeName as i,useColorThemeNameExists as a,useThemeMode as o}from"../theme/hooks/use-theme-store.mjs";import{ThemeProvider as s}from"../theme/providers/ThemeProvider.mjs";import{ColorThemeName as c}from"../theme/types.mjs";import"../theme/index.mjs";export{c as ColorThemeName,e as ThemeApi,s as ThemeProvider,n as getThemeColorThemeName,r as themeColorThemeNameExists,i as useColorThemeName,a as useColorThemeNameExists,t as useThemeActions,o as useThemeMode};
1
+ import{ThemeApi as e}from"../theme/molecules/theme-molecule.mjs";import{useThemeActions as t}from"../theme/hooks/use-theme-actions.mjs";import{getThemeColorThemeName as n,themeColorThemeNameExists as r}from"../theme/utilities/theme-helpers.mjs";import{useColorThemeName as i,useColorThemeNameExists as a,useThemeMode as o}from"../theme/hooks/use-theme-store.mjs";import{ThemeProvider as s}from"../theme/providers/ThemeProvider.mjs";import"../theme/index.mjs";export{e as ThemeApi,s as ThemeProvider,n as getThemeColorThemeName,r as themeColorThemeNameExists,i as useColorThemeName,a as useColorThemeNameExists,t as useThemeActions,o as useThemeMode};
@@ -1 +1 @@
1
- const e=require("../utilities/is-validation-results.cjs");let t=require("jotai"),n=require("@stryke/type-checks/is-set-object");const r=(e,t)=>{let n=[];return e.initialize&&n.push(...e.initialize.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.change&&n.push(...e.change.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.blur&&n.push(...e.blur.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.server&&n.push(...e.server.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.submit&&n.push(...e.submit.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),n},i=(t,n)=>e.isValidationResults(t)?r(t,n):Object.entries(t).reduce((t,[a,o])=>(t[a]=e.isValidationResults(o)?r(o,n):i(o,n),t),{}),a=(e,n)=>(0,t.atom)(t=>i(t(e),n)),o=(t,i)=>e.isValidationResults(t)?r(t,i):Object.entries(t??{}).reduce((t,[a,s])=>((0,n.isSetObject)(s)&&(e.isValidationResults(s)?t.push(...r(s,i)):t.push(...o(s,i))),t),[]),s=(e,n)=>(0,t.atom)(t=>o(t(e),n)),c=(e,n)=>(0,t.atom)(t=>r(t(e),n)),l=(e,n,r,i,a,o,s)=>(0,t.atom)(t=>{let c=t(e);if(c.length>0)return c;let l=t(n);if(l.length>0)return l;let u=t(r);if(u.length>0)return u;let d=t(i);if(d.length>0)return d;let f=t(a);if(f.length>0)return f;let p=t(o);if(p.length>0)return p;let m=t(s);return m.length>0?m:[]}),u=(e,n,r,i,a,o,s,c)=>(0,t.atom)(t=>{let l=t(e);return t(n).length>0||l.theme?.includes(`danger`)?`danger`:t(r).length>0||l.theme?.includes(`warning`)?`warning`:t(o).length>0||l.theme?.includes(`success`)?`success`:t(i).length>0||l.theme?.includes(`info`)?`info`:t(a).length>0||l.theme?.includes(`discovery`)?`discovery`:t(s).length>0||l.theme?.includes(`positive`)?`positive`:t(c).length>0||l.theme?.includes(`negative`)?`negative`:`primary`});exports.atomWithFieldsMessageList=s,exports.atomWithFieldsMessageTypes=a,exports.atomWithMessageTypes=c,exports.atomWithMessages=l,exports.atomWithTheme=u,exports.getFieldsMessageList=o,exports.getFieldsMessageTypes=i,exports.getMessageType=r;
1
+ const e=require("../utilities/is-validation-results.cjs");let t=require("jotai"),n=require("@stryke/type-checks/is-set-object");const r=(e,t)=>{let n=[];return e.initialize&&n.push(...e.initialize.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.change&&n.push(...e.change.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.blur&&n.push(...e.blur.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.server&&n.push(...e.server.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.submit&&n.push(...e.submit.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),n},i=(t,n)=>e.isValidationResults(t)?r(t,n):Object.entries(t).reduce((t,[a,o])=>(t[a]=e.isValidationResults(o)?r(o,n):i(o,n),t),{}),a=(e,n)=>(0,t.atom)(t=>i(t(e),n)),o=(t,i)=>e.isValidationResults(t)?r(t,i):Object.entries(t??{}).reduce((t,[a,s])=>((0,n.isSetObject)(s)&&(e.isValidationResults(s)?t.push(...r(s,i)):t.push(...o(s,i))),t),[]),s=(e,n)=>(0,t.atom)(t=>o(t(e),n)),c=(e,n)=>(0,t.atom)(t=>r(t(e),n)),l=(e,n,r,i,a,o,s)=>(0,t.atom)(t=>{let c=t(e);if(c.length>0)return c;let l=t(n);if(l.length>0)return l;let u=t(r);if(u.length>0)return u;let d=t(i);if(d.length>0)return d;let f=t(a);if(f.length>0)return f;let p=t(o);if(p.length>0)return p;let m=t(s);return m.length>0?m:[]}),u=(e,n,r,i,a,o,s,c)=>(0,t.atom)(t=>{let l=t(e);return t(n).length>0||l.theme?.includes(`danger`)?`danger`:t(r).length>0||l.theme?.includes(`warning`)?`warning`:t(o).length>0||l.theme?.includes(`success`)?`success`:t(i).length>0||l.theme?.includes(`info`)?`info`:t(a).length>0||l.theme?.includes(`discovery`)?`discovery`:t(s).length>0||l.theme?.includes(`positive`)?`positive`:t(c).length>0||l.theme?.includes(`negative`)?`negative`:`base`});exports.atomWithFieldsMessageList=s,exports.atomWithFieldsMessageTypes=a,exports.atomWithMessageTypes=c,exports.atomWithMessages=l,exports.atomWithTheme=u,exports.getFieldsMessageList=o,exports.getFieldsMessageTypes=i,exports.getMessageType=r;
@@ -1,2 +1,2 @@
1
- import{isValidationResults as e}from"../utilities/is-validation-results.mjs";import{atom as t}from"jotai";import{isSetObject as n}from"@stryke/type-checks/is-set-object";const r=(e,t)=>{let n=[];return e.initialize&&n.push(...e.initialize.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.change&&n.push(...e.change.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.blur&&n.push(...e.blur.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.server&&n.push(...e.server.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.submit&&n.push(...e.submit.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),n},i=(t,n)=>e(t)?r(t,n):Object.entries(t).reduce((t,[a,o])=>(t[a]=e(o)?r(o,n):i(o,n),t),{}),a=(e,n)=>t(t=>i(t(e),n)),o=(t,i)=>e(t)?r(t,i):Object.entries(t??{}).reduce((t,[a,s])=>(n(s)&&(e(s)?t.push(...r(s,i)):t.push(...o(s,i))),t),[]),s=(e,n)=>t(t=>o(t(e),n)),c=(e,n)=>t(t=>r(t(e),n)),l=(e,n,r,i,a,o,s)=>t(t=>{let c=t(e);if(c.length>0)return c;let l=t(n);if(l.length>0)return l;let u=t(r);if(u.length>0)return u;let d=t(i);if(d.length>0)return d;let f=t(a);if(f.length>0)return f;let p=t(o);if(p.length>0)return p;let m=t(s);return m.length>0?m:[]}),u=(e,n,r,i,a,o,s,c)=>t(t=>{let l=t(e);return t(n).length>0||l.theme?.includes(`danger`)?`danger`:t(r).length>0||l.theme?.includes(`warning`)?`warning`:t(o).length>0||l.theme?.includes(`success`)?`success`:t(i).length>0||l.theme?.includes(`info`)?`info`:t(a).length>0||l.theme?.includes(`discovery`)?`discovery`:t(s).length>0||l.theme?.includes(`positive`)?`positive`:t(c).length>0||l.theme?.includes(`negative`)?`negative`:`primary`});export{s as atomWithFieldsMessageList,a as atomWithFieldsMessageTypes,c as atomWithMessageTypes,l as atomWithMessages,u as atomWithTheme,o as getFieldsMessageList,i as getFieldsMessageTypes,r as getMessageType};
1
+ import{isValidationResults as e}from"../utilities/is-validation-results.mjs";import{atom as t}from"jotai";import{isSetObject as n}from"@stryke/type-checks/is-set-object";const r=(e,t)=>{let n=[];return e.initialize&&n.push(...e.initialize.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.change&&n.push(...e.change.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.blur&&n.push(...e.blur.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.server&&n.push(...e.server.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),e.submit&&n.push(...e.submit.filter(e=>t===e.type&&(e.message||e.code)&&!n.some(t=>t.message===e.message||t.code===e.code))),n},i=(t,n)=>e(t)?r(t,n):Object.entries(t).reduce((t,[a,o])=>(t[a]=e(o)?r(o,n):i(o,n),t),{}),a=(e,n)=>t(t=>i(t(e),n)),o=(t,i)=>e(t)?r(t,i):Object.entries(t??{}).reduce((t,[a,s])=>(n(s)&&(e(s)?t.push(...r(s,i)):t.push(...o(s,i))),t),[]),s=(e,n)=>t(t=>o(t(e),n)),c=(e,n)=>t(t=>r(t(e),n)),l=(e,n,r,i,a,o,s)=>t(t=>{let c=t(e);if(c.length>0)return c;let l=t(n);if(l.length>0)return l;let u=t(r);if(u.length>0)return u;let d=t(i);if(d.length>0)return d;let f=t(a);if(f.length>0)return f;let p=t(o);if(p.length>0)return p;let m=t(s);return m.length>0?m:[]}),u=(e,n,r,i,a,o,s,c)=>t(t=>{let l=t(e);return t(n).length>0||l.theme?.includes(`danger`)?`danger`:t(r).length>0||l.theme?.includes(`warning`)?`warning`:t(o).length>0||l.theme?.includes(`success`)?`success`:t(i).length>0||l.theme?.includes(`info`)?`info`:t(a).length>0||l.theme?.includes(`discovery`)?`discovery`:t(s).length>0||l.theme?.includes(`positive`)?`positive`:t(c).length>0||l.theme?.includes(`negative`)?`negative`:`base`});export{s as atomWithFieldsMessageList,a as atomWithFieldsMessageTypes,c as atomWithMessageTypes,l as atomWithMessages,u as atomWithTheme,o as getFieldsMessageList,i as getFieldsMessageTypes,r as getMessageType};
2
2
  //# sourceMappingURL=atom-with-messages.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 a=require("@stryke/type-checks/is-function"),o=require("jotai/utils"),s=require("@stryke/helpers/is-equal"),c=require("jotai"),l=require("@stryke/type-checks/is-string"),u=require("@stryke/helpers/deep-merge"),ee=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:`primary`,size:`$true`,debounceMs:100,isEqual:s.isEqual,required:!1,disabled:!1,clearable:!1,initialValue:null},h=e.createMoleculeApi(s=>{let h=e.use(i.FormApi.Scope),g=(0,c.atom)(()=>h),_=e.use(i.FormApi.Molecule),v=(0,c.atom)(m),y=(0,c.atom)(e=>{let t=e(_.options),n=e(v),i=(0,u.deepMerge)(t.defaultFieldOptions,n);return(0,u.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,a.isFunction)(n)?n(e(v)):n===o.RESET?{}:n,t(v,(0,u.deepMerge)(m,r))}),b=(0,d.toPath)(s.includes(`-`)?s.slice(s.indexOf(`-`)+1):s),x=(0,c.atom)(()=>b),S=(0,c.atom)(e=>e(x).slice(-1)[0]),C=(0,p.focusAtom)(_.focusedFields,e=>e.path(...b)),w=(0,p.focusAtom)(_.requiredFields,e=>e.path(...b)),T=(0,p.focusAtom)(_.disabledFields,e=>e.path(...b)),E=(0,c.atom)(e=>e(w)??e(y).required,(e,t,n)=>{t(w,n)}),D=(0,c.atom)(e=>e(T)??e(y).disabled,(e,t,n)=>{t(T,n)}),O=(0,c.atom)(e=>e(y).clearable),k=(0,p.focusAtom)(_.touchedFields,e=>e.path(...b)),A=(0,p.focusAtom)(_.blurredFields,e=>e.path(...b)),j=(0,p.focusAtom)(_.validatingFields,e=>e.path(...b)),M=(0,p.focusAtom)(_.validationResultsFields,e=>e.path(...b)),te=(0,p.focusAtom)(_.tabIndexes,e=>e.path(...b)),N=(0,p.focusAtom)(_.refs,e=>e.path(...b)),P=(0,p.focusAtom)(_.initialValues,e=>e.path(...b)),F=(0,p.focusAtom)(_.values,e=>e.path(...b)),I=(0,c.atom)(e=>e(y).isEqual(e(F),e(P))),L=n.atomWithFieldsMessageTypes(M,`danger`),R=n.atomWithFieldsMessageTypes(M,`warning`),z=n.atomWithFieldsMessageTypes(M,`info`),B=n.atomWithFieldsMessageTypes(M,`discovery`),V=n.atomWithFieldsMessageTypes(M,`success`),H=n.atomWithFieldsMessageTypes(M,`positive`),U=n.atomWithFieldsMessageTypes(M,`negative`),W=n.atomWithFieldsMessageList(M,`danger`),G=n.atomWithFieldsMessageList(M,`warning`),K=n.atomWithFieldsMessageList(M,`info`),q=n.atomWithFieldsMessageList(M,`discovery`),J=n.atomWithFieldsMessageList(M,`success`),Y=n.atomWithFieldsMessageList(M,`positive`),X=n.atomWithFieldsMessageList(M,`negative`),Z=(0,c.atom)(e=>e(W).length>0),Q=(0,c.atom)(e=>!e(Z)),ne=(0,c.atom)(e=>{let t=e(y),n=e(F),r;return r=t?.format?t.format(n):n,(0,f.isSet)(r)?(0,l.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(y,F,D),re=(0,o.splitAtom)($),ie=(0,o.atomWithDefault)(e=>e(y).size??`$true`);return{options:y,form:g,name:S,path:x,initialValue:P,previousValue:(0,c.atom)(e=>{let t=e(_.previousValues);return(0,ee.getField)(t,e(x).join(`.`))??null}),value:F,formattedValue:ne,focused:C,required:E,disabled:D,clearable:O,touched:k,blurred:A,validating:j,validationResults:M,tabIndex:te,ref:N,pristine:(0,c.atom)(e=>!e(I)),dirty:I,items:$,itemsAtoms:re,size:ie,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:n.atomWithTheme(y,W,G,K,q,J,Y,X),messages:n.atomWithMessages(W,G,K,q,J,Y,X),invalid:Z,valid:Q}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=m,exports.FieldApi=h;
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 a=require("@stryke/type-checks/is-function"),o=require("jotai/utils"),s=require("@stryke/helpers/is-equal"),c=require("jotai"),l=require("@stryke/type-checks/is-string"),u=require("@stryke/helpers/deep-merge"),ee=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:`$true`,debounceMs:100,isEqual:s.isEqual,required:!1,disabled:!1,clearable:!1,initialValue:null},h=e.createMoleculeApi(s=>{let h=e.use(i.FormApi.Scope),g=(0,c.atom)(()=>h),_=e.use(i.FormApi.Molecule),v=(0,c.atom)(m),y=(0,c.atom)(e=>{let t=e(_.options),n=e(v),i=(0,u.deepMerge)(t.defaultFieldOptions,n);return(0,u.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,a.isFunction)(n)?n(e(v)):n===o.RESET?{}:n,t(v,(0,u.deepMerge)(m,r))}),b=(0,d.toPath)(s.includes(`-`)?s.slice(s.indexOf(`-`)+1):s),x=(0,c.atom)(()=>b),S=(0,c.atom)(e=>e(x).slice(-1)[0]),C=(0,p.focusAtom)(_.focusedFields,e=>e.path(...b)),w=(0,p.focusAtom)(_.requiredFields,e=>e.path(...b)),T=(0,p.focusAtom)(_.disabledFields,e=>e.path(...b)),E=(0,c.atom)(e=>e(w)??e(y).required,(e,t,n)=>{t(w,n)}),D=(0,c.atom)(e=>e(T)??e(y).disabled,(e,t,n)=>{t(T,n)}),O=(0,c.atom)(e=>e(y).clearable),k=(0,p.focusAtom)(_.touchedFields,e=>e.path(...b)),A=(0,p.focusAtom)(_.blurredFields,e=>e.path(...b)),j=(0,p.focusAtom)(_.validatingFields,e=>e.path(...b)),M=(0,p.focusAtom)(_.validationResultsFields,e=>e.path(...b)),te=(0,p.focusAtom)(_.tabIndexes,e=>e.path(...b)),N=(0,p.focusAtom)(_.refs,e=>e.path(...b)),P=(0,p.focusAtom)(_.initialValues,e=>e.path(...b)),F=(0,p.focusAtom)(_.values,e=>e.path(...b)),I=(0,c.atom)(e=>e(y).isEqual(e(F),e(P))),L=n.atomWithFieldsMessageTypes(M,`danger`),R=n.atomWithFieldsMessageTypes(M,`warning`),z=n.atomWithFieldsMessageTypes(M,`info`),B=n.atomWithFieldsMessageTypes(M,`discovery`),V=n.atomWithFieldsMessageTypes(M,`success`),H=n.atomWithFieldsMessageTypes(M,`positive`),U=n.atomWithFieldsMessageTypes(M,`negative`),W=n.atomWithFieldsMessageList(M,`danger`),G=n.atomWithFieldsMessageList(M,`warning`),K=n.atomWithFieldsMessageList(M,`info`),q=n.atomWithFieldsMessageList(M,`discovery`),J=n.atomWithFieldsMessageList(M,`success`),Y=n.atomWithFieldsMessageList(M,`positive`),X=n.atomWithFieldsMessageList(M,`negative`),Z=(0,c.atom)(e=>e(W).length>0),Q=(0,c.atom)(e=>!e(Z)),ne=(0,c.atom)(e=>{let t=e(y),n=e(F),r;return r=t?.format?t.format(n):n,(0,f.isSet)(r)?(0,l.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(y,F,D),re=(0,o.splitAtom)($),ie=(0,o.atomWithDefault)(e=>e(y).size??`$true`);return{options:y,form:g,name:S,path:x,initialValue:P,previousValue:(0,c.atom)(e=>{let t=e(_.previousValues);return(0,ee.getField)(t,e(x).join(`.`))??null}),value:F,formattedValue:ne,focused:C,required:E,disabled:D,clearable:O,touched:k,blurred:A,validating:j,validationResults:M,tabIndex:te,ref:N,pristine:(0,c.atom)(e=>!e(I)),dirty:I,items:$,itemsAtoms:re,size:ie,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:n.atomWithTheme(y,W,G,K,q,J,Y,X),messages:n.atomWithMessages(W,G,K,q,J,Y,X),invalid:Z,valid:Q}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=m,exports.FieldApi=h;
@@ -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 ee,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{requiredValidator as o}from"../utilities/validators.mjs";import{FormApi as s}from"./form-molecule.mjs";import{isFunction as c}from"@stryke/type-checks/is-function";import{RESET as l,atomWithDefault as u,splitAtom as d}from"jotai/utils";import{isEqual as f}from"@stryke/helpers/is-equal";import{atom as p}from"jotai";import{isString as m}from"@stryke/type-checks/is-string";import{deepMerge as h}from"@stryke/helpers/deep-merge";import{getField as te}from"@stryke/helpers/get-field";import{toPath as ne}from"@stryke/helpers/to-path";import{isSet as re}from"@stryke/type-checks/is-set";import{focusAtom as g}from"jotai-optics";const _={theme:`primary`,size:`$true`,debounceMs:100,isEqual:f,required:!1,disabled:!1,clearable:!1,initialValue:null},v=e(e=>{let f=t(s.Scope),v=p(()=>f),y=t(s.Molecule),b=p(_),x=p(e=>{let t=e(y.options),n=e(b),r=h(t.defaultFieldOptions,n);return h({validate:{onBlur:r.required?[o]:[]}},r)},(e,t,n)=>{let r={};r=c(n)?n(e(b)):n===l?{}:n,t(b,h(_,r))}),S=ne(e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=p(()=>S),ie=p(e=>e(C).slice(-1)[0]),ae=g(y.focusedFields,e=>e.path(...S)),w=g(y.requiredFields,e=>e.path(...S)),T=g(y.disabledFields,e=>e.path(...S)),oe=p(e=>e(w)??e(x).required,(e,t,n)=>{t(w,n)}),E=p(e=>e(T)??e(x).disabled,(e,t,n)=>{t(T,n)}),D=p(e=>e(x).clearable),O=g(y.touchedFields,e=>e.path(...S)),k=g(y.blurredFields,e=>e.path(...S)),A=g(y.validatingFields,e=>e.path(...S)),j=g(y.validationResultsFields,e=>e.path(...S)),M=g(y.tabIndexes,e=>e.path(...S)),N=g(y.refs,e=>e.path(...S)),P=g(y.initialValues,e=>e.path(...S)),F=g(y.values,e=>e.path(...S)),I=p(e=>e(x).isEqual(e(F),e(P))),L=i(j,`danger`),R=i(j,`warning`),z=i(j,`info`),B=i(j,`discovery`),V=i(j,`success`),H=i(j,`positive`),U=i(j,`negative`),W=r(j,`danger`),G=r(j,`warning`),K=r(j,`info`),q=r(j,`discovery`),J=r(j,`success`),Y=r(j,`positive`),X=r(j,`negative`),Z=p(e=>e(W).length>0),se=p(e=>!e(Z)),ce=p(e=>{let t=e(x),n=e(F),r;return r=t?.format?t.format(n):n,re(r)?m(r)?r:String(r):``}),Q=n(x,F,E),le=d(Q),$=u(e=>e(x).size??`$true`);return{options:x,form:v,name:ie,path:C,initialValue:P,previousValue:p(e=>{let t=e(y.previousValues);return te(t,e(C).join(`.`))??null}),value:F,formattedValue:ce,focused:ae,required:oe,disabled:E,clearable:D,touched:O,blurred:k,validating:A,validationResults:j,tabIndex:M,ref:N,pristine:p(e=>!e(I)),dirty:I,items:Q,itemsAtoms:le,size:$,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:a(x,W,G,K,q,J,Y,X),messages:ee(W,G,K,q,J,Y,X),invalid:Z,valid:se}},{type:`field`});export{_ as DEFAULT_FIELD_OPTIONS,v 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 ee,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{requiredValidator as o}from"../utilities/validators.mjs";import{FormApi as s}from"./form-molecule.mjs";import{isFunction as c}from"@stryke/type-checks/is-function";import{RESET as l,atomWithDefault as u,splitAtom as d}from"jotai/utils";import{isEqual as f}from"@stryke/helpers/is-equal";import{atom as p}from"jotai";import{isString as m}from"@stryke/type-checks/is-string";import{deepMerge as h}from"@stryke/helpers/deep-merge";import{getField as te}from"@stryke/helpers/get-field";import{toPath as ne}from"@stryke/helpers/to-path";import{isSet as re}from"@stryke/type-checks/is-set";import{focusAtom as g}from"jotai-optics";const _={theme:`base`,size:`$true`,debounceMs:100,isEqual:f,required:!1,disabled:!1,clearable:!1,initialValue:null},v=e(e=>{let f=t(s.Scope),v=p(()=>f),y=t(s.Molecule),b=p(_),x=p(e=>{let t=e(y.options),n=e(b),r=h(t.defaultFieldOptions,n);return h({validate:{onBlur:r.required?[o]:[]}},r)},(e,t,n)=>{let r={};r=c(n)?n(e(b)):n===l?{}:n,t(b,h(_,r))}),S=ne(e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=p(()=>S),ie=p(e=>e(C).slice(-1)[0]),ae=g(y.focusedFields,e=>e.path(...S)),w=g(y.requiredFields,e=>e.path(...S)),T=g(y.disabledFields,e=>e.path(...S)),oe=p(e=>e(w)??e(x).required,(e,t,n)=>{t(w,n)}),E=p(e=>e(T)??e(x).disabled,(e,t,n)=>{t(T,n)}),D=p(e=>e(x).clearable),O=g(y.touchedFields,e=>e.path(...S)),k=g(y.blurredFields,e=>e.path(...S)),A=g(y.validatingFields,e=>e.path(...S)),j=g(y.validationResultsFields,e=>e.path(...S)),M=g(y.tabIndexes,e=>e.path(...S)),N=g(y.refs,e=>e.path(...S)),P=g(y.initialValues,e=>e.path(...S)),F=g(y.values,e=>e.path(...S)),I=p(e=>e(x).isEqual(e(F),e(P))),L=i(j,`danger`),R=i(j,`warning`),z=i(j,`info`),B=i(j,`discovery`),V=i(j,`success`),H=i(j,`positive`),U=i(j,`negative`),W=r(j,`danger`),G=r(j,`warning`),K=r(j,`info`),q=r(j,`discovery`),J=r(j,`success`),Y=r(j,`positive`),X=r(j,`negative`),Z=p(e=>e(W).length>0),se=p(e=>!e(Z)),ce=p(e=>{let t=e(x),n=e(F),r;return r=t?.format?t.format(n):n,re(r)?m(r)?r:String(r):``}),Q=n(x,F,E),le=d(Q),$=u(e=>e(x).size??`$true`);return{options:x,form:v,name:ie,path:C,initialValue:P,previousValue:p(e=>{let t=e(y.previousValues);return te(t,e(C).join(`.`))??null}),value:F,formattedValue:ce,focused:ae,required:oe,disabled:E,clearable:D,touched:O,blurred:k,validating:A,validationResults:j,tabIndex:M,ref:N,pristine:p(e=>!e(I)),dirty:I,items:Q,itemsAtoms:le,size:$,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:a(x,W,G,K,q,J,Y,X),messages:ee(W,G,K,q,J,Y,X),invalid:Z,valid:se}},{type:`field`});export{_ as DEFAULT_FIELD_OPTIONS,v as FieldApi};
2
2
  //# sourceMappingURL=field-molecule.mjs.map
@@ -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:`primary`,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,`positive`),W=t.atomWithMessageTypes(x,`negative`),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),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,`positive`),W=t.atomWithMessageTypes(x,`negative`),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,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:`primary`,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,`positive`),Y=r(E,`negative`),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 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,`positive`),Y=r(E,`negative`),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};
2
2
  //# sourceMappingURL=form-molecule.mjs.map
@@ -25,7 +25,7 @@ type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
25
25
  /**
26
26
  * The field status.
27
27
  */
28
- type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
28
+ type FieldStatus = "base" | "brand" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
29
29
  type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
30
30
  type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
31
31
  type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
@@ -25,7 +25,7 @@ type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
25
25
  /**
26
26
  * The field status.
27
27
  */
28
- type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
28
+ type FieldStatus = "base" | "brand" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
29
29
  type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
30
30
  type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
31
31
  type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./molecules/theme-molecule.cjs"),t=require("./hooks/use-theme-actions.cjs"),n=require("./utilities/theme-helpers.cjs"),r=require("./hooks/use-theme-store.cjs");require("./hooks/index.cjs"),require("./molecules/index.cjs");const i=require("./providers/ThemeProvider.cjs"),a=require("./types.cjs");exports.ColorThemeName=a.ColorThemeName,exports.ThemeApi=e.ThemeApi,exports.ThemeProvider=i.ThemeProvider,exports.getThemeColorThemeName=n.getThemeColorThemeName,exports.themeColorThemeNameExists=n.themeColorThemeNameExists,exports.useColorThemeName=r.useColorThemeName,exports.useColorThemeNameExists=r.useColorThemeNameExists,exports.useThemeActions=t.useThemeActions,exports.useThemeMode=r.useThemeMode;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./molecules/theme-molecule.cjs"),t=require("./hooks/use-theme-actions.cjs"),n=require("./utilities/theme-helpers.cjs"),r=require("./hooks/use-theme-store.cjs");require("./hooks/index.cjs"),require("./molecules/index.cjs");const i=require("./providers/ThemeProvider.cjs");exports.ThemeApi=e.ThemeApi,exports.ThemeProvider=i.ThemeProvider,exports.getThemeColorThemeName=n.getThemeColorThemeName,exports.themeColorThemeNameExists=n.themeColorThemeNameExists,exports.useColorThemeName=r.useColorThemeName,exports.useColorThemeNameExists=r.useColorThemeNameExists,exports.useThemeActions=t.useThemeActions,exports.useThemeMode=r.useThemeMode;
@@ -1 +1 @@
1
- import{ThemeApi as e}from"./molecules/theme-molecule.mjs";import{useThemeActions as t}from"./hooks/use-theme-actions.mjs";import{getThemeColorThemeName as n,themeColorThemeNameExists as r}from"./utilities/theme-helpers.mjs";import{useColorThemeName as i,useColorThemeNameExists as a,useThemeMode as o}from"./hooks/use-theme-store.mjs";import"./hooks/index.mjs";import"./molecules/index.mjs";import{ThemeProvider as s}from"./providers/ThemeProvider.mjs";import{ColorThemeName as c}from"./types.mjs";export{c as ColorThemeName,e as ThemeApi,s as ThemeProvider,n as getThemeColorThemeName,r as themeColorThemeNameExists,i as useColorThemeName,a as useColorThemeNameExists,t as useThemeActions,o as useThemeMode};
1
+ import{ThemeApi as e}from"./molecules/theme-molecule.mjs";import{useThemeActions as t}from"./hooks/use-theme-actions.mjs";import{getThemeColorThemeName as n,themeColorThemeNameExists as r}from"./utilities/theme-helpers.mjs";import{useColorThemeName as i,useColorThemeNameExists as a,useThemeMode as o}from"./hooks/use-theme-store.mjs";import"./hooks/index.mjs";import"./molecules/index.mjs";import{ThemeProvider as s}from"./providers/ThemeProvider.mjs";export{e as ThemeApi,s as ThemeProvider,n as getThemeColorThemeName,r as themeColorThemeNameExists,i as useColorThemeName,a as useColorThemeNameExists,t as useThemeActions,o as useThemeMode};
@@ -1,17 +1,6 @@
1
1
  //#region src/theme/types.d.ts
2
2
  type ColorThemeMode = "light" | "dark";
3
- type ColorThemeName = "primary" | "secondary" | "discovery" | "info" | "warning" | "danger" | "success" | "positive" | "negative";
4
- declare const ColorThemeName: {
5
- readonly PRIMARY: "primary";
6
- readonly SECONDARY: "secondary";
7
- readonly DISCOVERY: "discovery";
8
- readonly INFO: "info";
9
- readonly WARNING: "warning";
10
- readonly DANGER: "danger";
11
- readonly SUCCESS: "success";
12
- readonly POSITIVE: "positive";
13
- readonly NEGATIVE: "negative";
14
- };
3
+ type ColorThemeName = "base" | "brand" | "discovery" | "info" | "warning" | "danger" | "success" | "positive" | "negative";
15
4
  interface ThemeOptions {
16
5
  /**
17
6
  * The theme mode options.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/theme/types.ts"],"mappings":";KAkBY;KAEA;cAWC;;;;;;;;;;;UAYI;;;;;;EAMf,OAAO;;;;;;EAOP,aAAa;;UAGE;;;;EAIf,SAAS;;;;EAKT,MAAM"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/theme/types.ts"],"mappings":";KAkBY;KAEA;UAWK;;;;;;EAMf,OAAO;;;;;;EAOP,aAAa;;UAGE;;;;EAIf,SAAS;;;;EAKT,MAAM"}
@@ -1,17 +1,6 @@
1
1
  //#region src/theme/types.d.ts
2
2
  type ColorThemeMode = "light" | "dark";
3
- type ColorThemeName = "primary" | "secondary" | "discovery" | "info" | "warning" | "danger" | "success" | "positive" | "negative";
4
- declare const ColorThemeName: {
5
- readonly PRIMARY: "primary";
6
- readonly SECONDARY: "secondary";
7
- readonly DISCOVERY: "discovery";
8
- readonly INFO: "info";
9
- readonly WARNING: "warning";
10
- readonly DANGER: "danger";
11
- readonly SUCCESS: "success";
12
- readonly POSITIVE: "positive";
13
- readonly NEGATIVE: "negative";
14
- };
3
+ type ColorThemeName = "base" | "brand" | "discovery" | "info" | "warning" | "danger" | "success" | "positive" | "negative";
15
4
  interface ThemeOptions {
16
5
  /**
17
6
  * The theme mode options.
@@ -1 +1 @@
1
- const e=e=>{if(e){if(e.includes(`primary`))return`primary`;if(e.includes(`secondary`))return`secondary`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);exports.getThemeColorThemeName=e,exports.themeColorThemeNameExists=t;
1
+ const e=e=>{if(e){if(e.includes(`base`))return`base`;if(e.includes(`brand`))return`brand`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);exports.getThemeColorThemeName=e,exports.themeColorThemeNameExists=t;
@@ -6,13 +6,14 @@ import { ColorThemeName } from "../types.cjs";
6
6
  * @example
7
7
  * getThemeColorThemeName('dark') // undefined
8
8
  * getThemeColorThemeName('dark_Input') // undefined
9
- * getThemeColorThemeName('dark_primary_Input') // "primary"
9
+ * getThemeColorThemeName('dark_base_Input') // "base"
10
10
  * getThemeColorThemeName('dark_brand_Input') // "brand"
11
11
  *
12
12
  * @remarks
13
13
  * The following color roles are checked:
14
- * - primary
14
+ * - base
15
15
  * - secondary
16
+ * - brand
16
17
  * - discovery
17
18
  * - info
18
19
  * - warning
@@ -31,13 +32,14 @@ declare const getThemeColorThemeName: (theme?: string) => ColorThemeName | undef
31
32
  * @example
32
33
  * themeColorThemeNameExists('dark') // false
33
34
  * themeColorThemeNameExists('dark_Input') // false
34
- * themeColorThemeNameExists('dark_primary_Input') // true
35
+ * themeColorThemeNameExists('dark_base_Input') // true
35
36
  * themeColorThemeNameExists('dark_brand_Input') // true
36
37
  *
37
38
  * @remarks
38
39
  * The following color roles are checked:
39
- * - primary
40
+ * - base
40
41
  * - secondary
42
+ * - brand
41
43
  * - discovery
42
44
  * - info
43
45
  * - warning
@@ -1 +1 @@
1
- {"version":3,"file":"theme-helpers.d.cts","names":[],"sources":["../../../src/theme/utilities/theme-helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA4Ca,yBACX,mBACC;;;;;;;;;;;;;;;;;;;;;;;;;cAkDU,4BAA6B"}
1
+ {"version":3,"file":"theme-helpers.d.cts","names":[],"sources":["../../../src/theme/utilities/theme-helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;cA6Ca,yBACX,mBACC;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDU,4BAA6B"}
@@ -6,13 +6,14 @@ import { ColorThemeName } from "../types.mjs";
6
6
  * @example
7
7
  * getThemeColorThemeName('dark') // undefined
8
8
  * getThemeColorThemeName('dark_Input') // undefined
9
- * getThemeColorThemeName('dark_primary_Input') // "primary"
9
+ * getThemeColorThemeName('dark_base_Input') // "base"
10
10
  * getThemeColorThemeName('dark_brand_Input') // "brand"
11
11
  *
12
12
  * @remarks
13
13
  * The following color roles are checked:
14
- * - primary
14
+ * - base
15
15
  * - secondary
16
+ * - brand
16
17
  * - discovery
17
18
  * - info
18
19
  * - warning
@@ -31,13 +32,14 @@ declare const getThemeColorThemeName: (theme?: string) => ColorThemeName | undef
31
32
  * @example
32
33
  * themeColorThemeNameExists('dark') // false
33
34
  * themeColorThemeNameExists('dark_Input') // false
34
- * themeColorThemeNameExists('dark_primary_Input') // true
35
+ * themeColorThemeNameExists('dark_base_Input') // true
35
36
  * themeColorThemeNameExists('dark_brand_Input') // true
36
37
  *
37
38
  * @remarks
38
39
  * The following color roles are checked:
39
- * - primary
40
+ * - base
40
41
  * - secondary
42
+ * - brand
41
43
  * - discovery
42
44
  * - info
43
45
  * - warning
@@ -1,2 +1,2 @@
1
- const e=e=>{if(e){if(e.includes(`primary`))return`primary`;if(e.includes(`secondary`))return`secondary`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);export{e as getThemeColorThemeName,t as themeColorThemeNameExists};
1
+ const e=e=>{if(e){if(e.includes(`base`))return`base`;if(e.includes(`brand`))return`brand`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);export{e as getThemeColorThemeName,t as themeColorThemeNameExists};
2
2
  //# sourceMappingURL=theme-helpers.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/state",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "A state management package used to handle state in Storm Software applications.",
6
6
  "repository": {
@@ -101,8 +101,8 @@
101
101
  "types": "./dist/index.d.cts",
102
102
  "peerDependencies": {
103
103
  "jotai": "^2.20.3",
104
- "react": "^19.2.8",
105
- "react-dom": "^19.2.8",
104
+ "react": "^19.3.0",
105
+ "react-dom": "^19.3.0",
106
106
  "react-native": "^0.87.1"
107
107
  },
108
108
  "peerDependenciesMeta": {
@@ -114,15 +114,15 @@
114
114
  "dependencies": {
115
115
  "@maskito/core": "^3.11.1",
116
116
  "@maskito/react": "^3.11.1",
117
- "@stryke/async": "^0.1.41",
118
- "@stryke/env": "^0.20.132",
119
- "@stryke/helpers": "^0.10.53",
120
- "@stryke/hooks": "^0.4.130",
121
- "@stryke/json": "^0.15.37",
122
- "@stryke/string-format": "^0.17.55",
123
- "@stryke/type-checks": "^0.6.46",
124
- "@stryke/types": "^0.12.41",
125
- "@stryke/unique-id": "^0.3.126",
117
+ "@stryke/async": "^0.1.42",
118
+ "@stryke/env": "^0.20.133",
119
+ "@stryke/helpers": "^0.10.54",
120
+ "@stryke/hooks": "^0.4.131",
121
+ "@stryke/json": "^0.15.38",
122
+ "@stryke/string-format": "^0.17.56",
123
+ "@stryke/type-checks": "^0.6.47",
124
+ "@stryke/types": "^0.12.42",
125
+ "@stryke/unique-id": "^0.3.127",
126
126
  "@tamagui/core": "^2.7.7",
127
127
  "@tamagui/portal": "^2.7.7",
128
128
  "@tamagui/toast": "^2.7.7",
@@ -134,13 +134,13 @@
134
134
  "valibot": "^0.42.1"
135
135
  },
136
136
  "devDependencies": {
137
- "@powerlines/plugin-tsdown": "^0.1.612",
137
+ "@powerlines/plugin-tsdown": "^0.1.613",
138
138
  "jotai": "^2.20.3",
139
- "react": "^19.2.8",
140
- "react-dom": "^19.2.8",
139
+ "react": "^19.3.0",
140
+ "react-dom": "^19.3.0",
141
141
  "react-native": "^0.87.1"
142
142
  },
143
143
  "publishConfig": { "access": "public" },
144
144
  "module": "./dist/index.mjs",
145
- "gitHead": "78ff8af419bf314b579debf7dd9c07b25e5732c1"
145
+ "gitHead": "9db5f851b36388d0389803ae12a59a6227b6f657"
146
146
  }
@@ -1 +0,0 @@
1
- const e={PRIMARY:`primary`,SECONDARY:`secondary`,DISCOVERY:`discovery`,INFO:`info`,WARNING:`warning`,DANGER:`danger`,SUCCESS:`success`,POSITIVE:`positive`,NEGATIVE:`negative`};exports.ColorThemeName=e;
@@ -1,2 +0,0 @@
1
- const e={PRIMARY:`primary`,SECONDARY:`secondary`,DISCOVERY:`discovery`,INFO:`info`,WARNING:`warning`,DANGER:`danger`,SUCCESS:`success`,POSITIVE:`positive`,NEGATIVE:`negative`};export{e as ColorThemeName};
2
- //# sourceMappingURL=types.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":[],"mappings":""}