@cyclone-ui/helpers 0.3.51 → 0.3.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./form-size.cjs"),t=require("./get-sized.cjs");let n=require("@tamagui/core"),r=require("react"),i=require("react/jsx-runtime");const a=(0,r.createContext)(void 0),o=()=>(0,r.use)(a),s=e=>{let t=o()?.setLabelDefaults;(0,r.useLayoutEffect)(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},c=e=>{let t=o()?.setControlOptions;(0,r.useLayoutEffect)(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},l=Symbol(`field-placeholder-unset`),u=(e=l)=>{let t=o(),n=t?.setHasPlaceholder,i=e===l?l:!!e;return(0,r.useLayoutEffect)(()=>{if(i!==l&&n)return n(i),()=>n(!1)},[i,n]),t?.variant??`outlined`},d=()=>o()?.hasStartIcon??!1,f=()=>o()?.hasValidationMessage??!1,p=()=>{let e=o();return e?.labelVariant===`floating`?e.variant===`outlined`?`border`:`inset`:void 0},m=(t,n)=>t?t===`border`?3:13*e.getFormSizeScale(n):0,h=e=>e!=null&&e!==``,g=e=>{let t=o();return t?.labelVariant!==`floating`||!h(e)&&!!t.focused},_=e=>{let t=o();return(e??t?.labelVariant)===`floating`&&(h(t?.formattedValue)||!!t?.focused)},v=()=>{let e=o(),t=e?.disabled,n=e?.focused,r=e?.theme,i=(!r||r===`base`)&&!e?.hasValidationMessage,a=e?.hasValidationMessage,s=a?`primary`:`outline`,c=a?`primary-active`:`outline-active`,l=a?`primary-hovered`:`outline-hovered`,u=a?`primary-disabled`:`outline-disabled`;return{iconColor:t?u:n?c:s,hoverIconColor:t?u:n?c:l,isNeutral:i}},y=(0,n.styled)(n.View,{displayName:`FieldNotchedOutline`,render:`fieldset`,transition:`200ms`,position:`absolute`,top:0,right:0,bottom:0,left:0,margin:0,padding:0,minWidth:0,borderWidth:1,borderStyle:`solid`,borderRadius:`control`,pointerEvents:`none`}),b=(0,n.styled)(n.View,{displayName:`FieldNotchedOutline`,render:`legend`,width:0,height:0,padding:0,overflow:`hidden`}),x=(0,n.createStyledHOC)(y,(a,s)=>{let c=o(),l=c?.labelContentRef,u=c?.labelVariant,d=c?.size,f=(0,r.useRef)(null),p=(0,r.useRef)(null),m=(0,n.useComposedRefs)(s,f),h=t.getSpaced(`sm`)*e.getFormSizeScale(d);return(0,r.useLayoutEffect)(()=>{let e=f.current,t=p.current,n=l?.current;if(!e||!t||!n||u!==`floating`)return;let r=()=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=i.height>0?Math.min(1,Math.max(0,(r.top-i.top)/(i.height*.2))):0;t.style.marginLeft=`${Math.max(0,i.left-r.left-h)}px`,t.style.width=`${(i.width+h*2)*a}px`};r();let i=e.ownerDocument,a=e=>{e.target.contains(n)&&r()};i.addEventListener(`transitionend`,a,!0),i.addEventListener(`transitioncancel`,a,!0);let o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return o?.observe(e),o?.observe(n),()=>{o?.disconnect(),i.removeEventListener(`transitionend`,a,!0),i.removeEventListener(`transitioncancel`,a,!0)}},[h,l,u]),/* @__PURE__ */ (0,i.jsx)(y,{ref:m,"aria-hidden":!0,...a,children:/* @__PURE__ */ (0,i.jsx)(b,{ref:p})})},{displayName:`FieldNotchedOutline`});exports.FieldNotchedOutline=x,exports.FormControlContext=a,exports.getFieldLabelInset=m,exports.useFieldHasStartIcon=d,exports.useFieldHasValidationMessage=f,exports.useFieldIconColor=v,exports.useFieldLabelDefaults=s,exports.useFieldLabelFloated=_,exports.useFieldLabelPlacement=p,exports.useFieldOptions=c,exports.useFieldShouldShowPlaceholder=g,exports.useFieldVariant=u,exports.useFormControl=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./form-size.cjs"),t=require("./get-sized.cjs");let n=require("@tamagui/core"),r=require("react"),i=require("react/jsx-runtime");const a=(0,r.createContext)(void 0),o=()=>(0,r.use)(a),s=e=>{let t=o()?.setLabelDefaults;(0,r.useLayoutEffect)(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},c=e=>{let t=o()?.setControlOptions;(0,r.useLayoutEffect)(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},l=Symbol(`field-placeholder-unset`),u=(e=l)=>{let t=o(),n=t?.setHasPlaceholder,i=e===l?l:!!e;return(0,r.useLayoutEffect)(()=>{if(i!==l&&n)return n(i),()=>n(!1)},[i,n]),t?.variant??`outlined`},d=()=>o()?.hasStartIcon??!1,f=()=>o()?.hasValidationMessage??!1,p=()=>{let e=o();return e?.labelVariant===`floating`?e.variant===`outlined`?`border`:`inset`:void 0},m=(t,n)=>t?t===`border`?3:13*e.getFormSizeScale(n):0,h=e=>e!=null&&e!==``,g=e=>{let t=o();return t?.labelVariant!==`floating`||!h(e)&&!!t.focused},_=e=>{let t=o();return(e??t?.labelVariant)===`floating`&&(h(t?.formattedValue)||!!t?.focused)},v=()=>{let e=o(),t=e?.disabled,n=e?.focused,r=e?.theme,i=(!r||r===`base`)&&!e?.hasValidationMessage,a=e?.hasValidationMessage,s=a?`primary`:`hairline`,c=a?`primary-active`:`hairline-active`,l=a?`primary-hovered`:`hairline-hovered`,u=a?`primary-disabled`:`hairline-disabled`;return{iconColor:t?u:n?c:s,hoverIconColor:t?u:n?c:l,isNeutral:i}},y=(0,n.styled)(n.View,{displayName:`FieldNotchedOutline`,render:`fieldset`,transition:`200ms`,position:`absolute`,top:0,right:0,bottom:0,left:0,margin:0,padding:0,minWidth:0,borderWidth:1,borderStyle:`solid`,borderRadius:`control`,pointerEvents:`none`}),b=(0,n.styled)(n.View,{displayName:`FieldNotchedOutline`,render:`legend`,width:0,height:0,padding:0,overflow:`hidden`}),x=(0,n.createStyledHOC)(y,(a,s)=>{let c=o(),l=c?.labelContentRef,u=c?.labelVariant,d=c?.size,f=(0,r.useRef)(null),p=(0,r.useRef)(null),m=(0,n.useComposedRefs)(s,f),h=t.getSpaced(`sm`)*e.getFormSizeScale(d);return(0,r.useLayoutEffect)(()=>{let e=f.current,t=p.current,n=l?.current;if(!e||!t||!n||u!==`floating`)return;let r=()=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=i.height>0?Math.min(1,Math.max(0,(r.top-i.top)/(i.height*.2))):0;t.style.marginLeft=`${Math.max(0,i.left-r.left-h)}px`,t.style.width=`${(i.width+h*2)*a}px`};r();let i=e.ownerDocument,a=e=>{e.target.contains(n)&&r()};i.addEventListener(`transitionend`,a,!0),i.addEventListener(`transitioncancel`,a,!0);let o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return o?.observe(e),o?.observe(n),()=>{o?.disconnect(),i.removeEventListener(`transitionend`,a,!0),i.removeEventListener(`transitioncancel`,a,!0)}},[h,l,u]),/* @__PURE__ */ (0,i.jsx)(y,{ref:m,"aria-hidden":!0,...a,children:/* @__PURE__ */ (0,i.jsx)(b,{ref:p})})},{displayName:`FieldNotchedOutline`});exports.FieldNotchedOutline=x,exports.FormControlContext=a,exports.getFieldLabelInset=m,exports.useFieldHasStartIcon=d,exports.useFieldHasValidationMessage=f,exports.useFieldIconColor=v,exports.useFieldLabelDefaults=s,exports.useFieldLabelFloated=_,exports.useFieldLabelPlacement=p,exports.useFieldOptions=c,exports.useFieldShouldShowPlaceholder=g,exports.useFieldVariant=u,exports.useFormControl=o;
@@ -172,7 +172,7 @@ declare const useFieldShouldShowPlaceholder: (value: unknown) => boolean;
172
172
  declare const useFieldLabelFloated: (labelVariant?: FieldLabelVariant) => boolean;
173
173
  /**
174
174
  * Resolves the color tokens used by field icons (and their dividers): `primary`
175
- * when the field has a validation message, otherwise `outline`, matching the
175
+ * when the field has a validation message, otherwise `hairline`, matching the
176
176
  * field border. Pair `iconColor` with `group-hover/field:${hoverIconColor}` on
177
177
  * an element whose CSS color the icon inherits through `currentColor`, since
178
178
  * Tamagui v3 icons do not resolve flat `group-hover/` values.
@@ -172,7 +172,7 @@ declare const useFieldShouldShowPlaceholder: (value: unknown) => boolean;
172
172
  declare const useFieldLabelFloated: (labelVariant?: FieldLabelVariant) => boolean;
173
173
  /**
174
174
  * Resolves the color tokens used by field icons (and their dividers): `primary`
175
- * when the field has a validation message, otherwise `outline`, matching the
175
+ * when the field has a validation message, otherwise `hairline`, matching the
176
176
  * field border. Pair `iconColor` with `group-hover/field:${hoverIconColor}` on
177
177
  * an element whose CSS color the icon inherits through `currentColor`, since
178
178
  * Tamagui v3 icons do not resolve flat `group-hover/` values.
@@ -1,2 +1,2 @@
1
- import{getFormSizeScale as e}from"./form-size.mjs";import{getSpaced as t}from"./get-sized.mjs";import{View as n,createStyledHOC as r,styled as i,useComposedRefs as a}from"@tamagui/core";import{createContext as o,use as s,useLayoutEffect as c,useRef as l}from"react";import{jsx as u}from"react/jsx-runtime";const d=o(void 0),f=()=>s(d),p=e=>{let t=f()?.setLabelDefaults;c(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},m=e=>{let t=f()?.setControlOptions;c(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},h=Symbol(`field-placeholder-unset`),g=(e=h)=>{let t=f(),n=t?.setHasPlaceholder,r=e===h?h:!!e;return c(()=>{if(r!==h&&n)return n(r),()=>n(!1)},[r,n]),t?.variant??`outlined`},_=()=>f()?.hasStartIcon??!1,v=()=>f()?.hasValidationMessage??!1,y=()=>{let e=f();return e?.labelVariant===`floating`?e.variant===`outlined`?`border`:`inset`:void 0},b=(t,n)=>t?t===`border`?3:13*e(n):0,x=e=>e!=null&&e!==``,S=e=>{let t=f();return t?.labelVariant!==`floating`||!x(e)&&!!t.focused},C=e=>{let t=f();return(e??t?.labelVariant)===`floating`&&(x(t?.formattedValue)||!!t?.focused)},w=()=>{let e=f(),t=e?.disabled,n=e?.focused,r=e?.theme,i=(!r||r===`base`)&&!e?.hasValidationMessage,a=e?.hasValidationMessage,o=a?`primary`:`outline`,s=a?`primary-active`:`outline-active`,c=a?`primary-hovered`:`outline-hovered`,l=a?`primary-disabled`:`outline-disabled`;return{iconColor:t?l:n?s:o,hoverIconColor:t?l:n?s:c,isNeutral:i}},T=i(n,{displayName:`FieldNotchedOutline`,render:`fieldset`,transition:`200ms`,position:`absolute`,top:0,right:0,bottom:0,left:0,margin:0,padding:0,minWidth:0,borderWidth:1,borderStyle:`solid`,borderRadius:`control`,pointerEvents:`none`}),E=i(n,{displayName:`FieldNotchedOutline`,render:`legend`,width:0,height:0,padding:0,overflow:`hidden`}),D=r(T,(n,r)=>{let i=f(),o=i?.labelContentRef,s=i?.labelVariant,d=i?.size,p=l(null),m=l(null),h=a(r,p),g=t(`sm`)*e(d);return c(()=>{let e=p.current,t=m.current,n=o?.current;if(!e||!t||!n||s!==`floating`)return;let r=()=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=i.height>0?Math.min(1,Math.max(0,(r.top-i.top)/(i.height*.2))):0;t.style.marginLeft=`${Math.max(0,i.left-r.left-g)}px`,t.style.width=`${(i.width+g*2)*a}px`};r();let i=e.ownerDocument,a=e=>{e.target.contains(n)&&r()};i.addEventListener(`transitionend`,a,!0),i.addEventListener(`transitioncancel`,a,!0);let c=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return c?.observe(e),c?.observe(n),()=>{c?.disconnect(),i.removeEventListener(`transitionend`,a,!0),i.removeEventListener(`transitioncancel`,a,!0)}},[g,o,s]),/* @__PURE__ */ u(T,{ref:h,"aria-hidden":!0,...n,children:/* @__PURE__ */ u(E,{ref:m})})},{displayName:`FieldNotchedOutline`});export{D as FieldNotchedOutline,d as FormControlContext,b as getFieldLabelInset,_ as useFieldHasStartIcon,v as useFieldHasValidationMessage,w as useFieldIconColor,p as useFieldLabelDefaults,C as useFieldLabelFloated,y as useFieldLabelPlacement,m as useFieldOptions,S as useFieldShouldShowPlaceholder,g as useFieldVariant,f as useFormControl};
1
+ import{getFormSizeScale as e}from"./form-size.mjs";import{getSpaced as t}from"./get-sized.mjs";import{View as n,createStyledHOC as r,styled as i,useComposedRefs as a}from"@tamagui/core";import{createContext as o,use as s,useLayoutEffect as c,useRef as l}from"react";import{jsx as u}from"react/jsx-runtime";const d=o(void 0),f=()=>s(d),p=e=>{let t=f()?.setLabelDefaults;c(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},m=e=>{let t=f()?.setControlOptions;c(()=>{if(t)return t(e),()=>t(void 0)},[e,t])},h=Symbol(`field-placeholder-unset`),g=(e=h)=>{let t=f(),n=t?.setHasPlaceholder,r=e===h?h:!!e;return c(()=>{if(r!==h&&n)return n(r),()=>n(!1)},[r,n]),t?.variant??`outlined`},_=()=>f()?.hasStartIcon??!1,v=()=>f()?.hasValidationMessage??!1,y=()=>{let e=f();return e?.labelVariant===`floating`?e.variant===`outlined`?`border`:`inset`:void 0},b=(t,n)=>t?t===`border`?3:13*e(n):0,x=e=>e!=null&&e!==``,S=e=>{let t=f();return t?.labelVariant!==`floating`||!x(e)&&!!t.focused},C=e=>{let t=f();return(e??t?.labelVariant)===`floating`&&(x(t?.formattedValue)||!!t?.focused)},w=()=>{let e=f(),t=e?.disabled,n=e?.focused,r=e?.theme,i=(!r||r===`base`)&&!e?.hasValidationMessage,a=e?.hasValidationMessage,o=a?`primary`:`hairline`,s=a?`primary-active`:`hairline-active`,c=a?`primary-hovered`:`hairline-hovered`,l=a?`primary-disabled`:`hairline-disabled`;return{iconColor:t?l:n?s:o,hoverIconColor:t?l:n?s:c,isNeutral:i}},T=i(n,{displayName:`FieldNotchedOutline`,render:`fieldset`,transition:`200ms`,position:`absolute`,top:0,right:0,bottom:0,left:0,margin:0,padding:0,minWidth:0,borderWidth:1,borderStyle:`solid`,borderRadius:`control`,pointerEvents:`none`}),E=i(n,{displayName:`FieldNotchedOutline`,render:`legend`,width:0,height:0,padding:0,overflow:`hidden`}),D=r(T,(n,r)=>{let i=f(),o=i?.labelContentRef,s=i?.labelVariant,d=i?.size,p=l(null),m=l(null),h=a(r,p),g=t(`sm`)*e(d);return c(()=>{let e=p.current,t=m.current,n=o?.current;if(!e||!t||!n||s!==`floating`)return;let r=()=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=i.height>0?Math.min(1,Math.max(0,(r.top-i.top)/(i.height*.2))):0;t.style.marginLeft=`${Math.max(0,i.left-r.left-g)}px`,t.style.width=`${(i.width+g*2)*a}px`};r();let i=e.ownerDocument,a=e=>{e.target.contains(n)&&r()};i.addEventListener(`transitionend`,a,!0),i.addEventListener(`transitioncancel`,a,!0);let c=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return c?.observe(e),c?.observe(n),()=>{c?.disconnect(),i.removeEventListener(`transitionend`,a,!0),i.removeEventListener(`transitioncancel`,a,!0)}},[g,o,s]),/* @__PURE__ */ u(T,{ref:h,"aria-hidden":!0,...n,children:/* @__PURE__ */ u(E,{ref:m})})},{displayName:`FieldNotchedOutline`});export{D as FieldNotchedOutline,d as FormControlContext,b as getFieldLabelInset,_ as useFieldHasStartIcon,v as useFieldHasValidationMessage,w as useFieldIconColor,p as useFieldLabelDefaults,C as useFieldLabelFloated,y as useFieldLabelPlacement,m as useFieldOptions,S as useFieldShouldShowPlaceholder,g as useFieldVariant,f as useFormControl};
2
2
  //# sourceMappingURL=form-control.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/helpers",
3
- "version": "0.3.51",
3
+ "version": "0.3.52",
4
4
  "private": false,
5
5
  "description": "A repository containing the core front-end components used by Storm Software across many platforms",
6
6
  "repository": {
@@ -183,5 +183,5 @@
183
183
  "publishConfig": { "access": "public" },
184
184
  "module": "./dist/index.mjs",
185
185
  "peerDependencies": { "react": "^19.3.1" },
186
- "gitHead": "b5002510d7b600176edf294db8b0facdc4968bbc"
186
+ "gitHead": "d29cc04c1070d7825e453d0764c7cdd2c9542e61"
187
187
  }