@happeouikit/form-elements 2.3.31 → 2.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("react/jsx-runtime"),v=require("react"),H=require("styled-components"),Ie=require("@happeouikit/typography"),pt=require("@happeouikit/icons"),Mp=require("react-dom"),P=require("@happeouikit/colors"),xr=require("@happeouikit/theme"),F=require("prop-types"),rn=require("react-intl"),fa=require("@happeouikit/tooltip"),Ra=require("@happeouikit/layout"),br=require("@happeouikit/buttons"),kp=require("@happeo/react-core"),Sp=require("@happeouikit/loaders");function Op(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const $=Op(v),Ep=e=>e.replace(/(_|-|,|\.)(.)/g,t=>t[1].toUpperCase()),Np=64,Pp=e=>{if(typeof e!="string"||e.length===0)return"";const t=new RegExp(/[^\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]/u),n=e.replace(/^#/,"").replace(/_+/g,"_"),a=n.match(t),s=a?a.index:n.length,u=n.substring(0,Math.min(s,Np)).toLocaleLowerCase();return u.length===0?"":"#"+u},il=e=>typeof e=="string",sl=e=>v.Children.toArray(e).filter(v.isValidElement),os=e=>{process.env.NODE_ENV!=="production"&&console.warn(`HappeoUiKit/form-elements: ${e}`)},us=(e,t)=>{v.useEffect(()=>{e&&os(t)},[])},Nr=()=>"ixxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),ra={success:"var(--color-success-primary, #00a372)",error:"var(--color-alert-primary, #da3939)",default:"var(--color-secondary-text-on-light, #4a5464)"},Ap=(e,t)=>{const r={width:"20px",height:"20px",fill:"var(--color-secondary-text-on-light, #2b313b)"},n={position:"absolute",top:"10px",left:"10px",fontSize:"18px"},a={...r,...t};return()=>Xe.jsx(Tp,{children:Xe.jsx(e,{...a,style:n})})},Ga=({label:e,description:t,hintText:r,required:n,id:a,icon:s,iconProps:u,state:c,errorMessage:h,disabled:m,...p})=>{const[y]=v.useState(()=>a||Nr()),x=[t?`${y}-description`:"",r?`${y}-hint-message`:"",c==="error"&&h?`${y}-error-message`:""].join(" ");return Xe.jsxs(ul,{isDisabled:m||!1,children:[!!e&&Xe.jsxs(ol,{children:[Xe.jsx(Rp,{bold:!0,for:y,isRequired:n||!1,children:e}),t&&Xe.jsx(Ie.BodyUI,{id:`${y}-description`,color:"var(--color-secondary-text-on-light, #4a5464)",children:t})]}),s&&Ap(s,u)(),Xe.jsx(ls,{title:e||"Styled input",hasIcon:!!(s||"").toString(),state:c||"default",id:y,...t?{"aria-describedby":x}:{},...p}),r&&Xe.jsxs(Bi,{id:`${y}-hint-message`,children:[Xe.jsx(ou,{fill:"var(--color-hint-text-on-light, #68778d)"}),Xe.jsx(Ie.TinyText,{color:"var(--color-secondary-text-on-light, #4a5464)",children:r})]}),c==="error"&&h&&Xe.jsxs(Bi,{id:`${y}-error-message`,children:[Xe.jsx(ou,{fill:"var(--color-alert-primary, #da3939)"}),Xe.jsx(Ie.TinyText,{color:"var(--color-alert-primary, #da3939)",children:h})]})]})},ou=H(pt.IconAlertCircleOutline)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("react/jsx-runtime"),v=require("react"),H=require("styled-components"),Ie=require("@happeouikit/typography"),pt=require("@happeouikit/icons"),Mp=require("react-dom"),P=require("@happeouikit/colors"),xr=require("@happeouikit/theme"),F=require("prop-types"),rn=require("react-intl"),fa=require("@happeouikit/tooltip"),Ra=require("@happeouikit/layout"),br=require("@happeouikit/buttons"),kp=require("@happeo/react-core"),Sp=require("@happeouikit/loaders");function Op(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const $=Op(v),Ep=e=>e.replace(/(_|-|,|\.)(.)/g,t=>t[1].toUpperCase()),Np=64,Pp=e=>{if(typeof e!="string"||e.length===0)return"";const t=new RegExp(/[^\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]/u),n=e.replace(/^#/,"").replace(/_+/g,"_"),a=n.match(t),s=a?a.index:n.length,u=n.substring(0,Math.min(s,Np)).toLocaleLowerCase();return u.length===0?"":"#"+u},il=e=>typeof e=="string",sl=e=>v.Children.toArray(e).filter(v.isValidElement),os=e=>{process.env.NODE_ENV!=="production"&&console.warn(`HappeoUiKit/form-elements: ${e}`)},us=(e,t)=>{v.useEffect(()=>{e&&os(t)},[])},Nr=()=>"ixxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),ra={success:"var(--color-success-primary, #00a372)",error:"var(--color-alert-primary, #da3939)",default:"var(--color-secondary-text-on-light, #4a5464)"},Ap=(e,t)=>{const r={width:"20px",height:"20px",fill:"var(--color-secondary-text-on-light, #2b313b)"},n={position:"absolute",top:"10px",left:"10px",fontSize:"18px"},a={...r,...t};return()=>Xe.jsx(Tp,{children:Xe.jsx(e,{...a,style:n})})},Ga=({label:e,description:t,hintText:r,required:n,id:a,icon:s,iconProps:u,state:c,errorMessage:h,disabled:m,...p})=>{const[y]=v.useState(()=>a||Nr()),x=[t?`${y}-description`:"",r?`${y}-hint-message`:"",c==="error"&&h?`${y}-error-message`:""].join(" ");return Xe.jsxs(ul,{isDisabled:m||!1,children:[!!e&&Xe.jsxs(ol,{children:[Xe.jsx(Rp,{bold:!0,for:y,isRequired:n||!1,children:e}),t&&Xe.jsx(Ie.BodyUI,{id:`${y}-description`,color:"var(--color-secondary-text-on-light, #4a5464)",children:t})]}),s&&Ap(s,u)(),Xe.jsx(ls,{title:e||"Styled input",hasIcon:!!(s||"").toString(),state:c||"default",id:y,disabled:m,...t?{"aria-describedby":x}:{},...p}),r&&Xe.jsxs(Bi,{id:`${y}-hint-message`,children:[Xe.jsx(ou,{fill:"var(--color-hint-text-on-light, #68778d)"}),Xe.jsx(Ie.TinyText,{color:"var(--color-secondary-text-on-light, #4a5464)",children:r})]}),c==="error"&&h&&Xe.jsxs(Bi,{id:`${y}-error-message`,children:[Xe.jsx(ou,{fill:"var(--color-alert-primary, #da3939)"}),Xe.jsx(Ie.TinyText,{color:"var(--color-alert-primary, #da3939)",children:h})]})]})},ou=H(pt.IconAlertCircleOutline)`
2
2
  width: 13px;
3
3
  height: 13px;
4
4
  `,Bi=H.div`