@happeouikit/form-elements 2.4.6 → 2.4.8

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.
@@ -7,10 +7,10 @@ export interface InputProps {
7
7
  id?: string;
8
8
  disabled?: boolean;
9
9
  readOnly?: boolean;
10
- icon: React.ComponentType<any>;
11
- iconProps: object;
10
+ icon?: React.ComponentType<any>;
11
+ iconProps?: object;
12
12
  state: "success" | "error" | "default";
13
- errorMessage: string;
13
+ errorMessage?: React.ReactNode;
14
14
  [key: string]: any;
15
15
  }
16
16
  export interface InputNumberProps {
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react/jsx-runtime"),m=require("react"),S=require("styled-components"),H=require("@happeouikit/typography"),Ae=require("@happeouikit/icons"),qu=require("react-dom"),fn=require("@happeouikit/theme"),B=require("prop-types"),V=require("@happeouikit/colors"),pt=require("react-intl"),ho=require("@happeouikit/tooltip"),sr=require("@happeouikit/layout"),ln=require("@happeouikit/buttons"),el=require("@happeo/react-core"),tl=require("@happeouikit/loaders");function nl(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 G=nl(m),rl=e=>e.replace(/(_|-|,|\.)(.)/g,t=>t[1].toUpperCase()),al=64,il=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),i=a?a.index:n.length,o=n.substring(0,Math.min(i,al)).toLocaleLowerCase();return o.length===0?"":"#"+o},po=e=>typeof e=="string",mo=e=>m.Children.toArray(e).filter(m.isValidElement),la=e=>{process.env.NODE_ENV!=="production"&&console.warn(`HappeoUiKit/form-elements: ${e}`)},ca=(e,t)=>{m.useEffect(()=>{e&&la(t)},[])},Ot=()=>"ixxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),En={success:"var(--color-success-primary, #00a372)",error:"var(--color-alert-primary, #da3939)",default:"var(--color-secondary-text-on-light, #4a5464)"},ol=(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()=>A.jsx(sl,{children:A.jsx(e,{...a,style:n})})},ur=({label:e,description:t,hintText:r,required:n,id:a,icon:i,iconProps:o,state:s,errorMessage:u,disabled:l,readOnly:c,...d})=>{const[p]=m.useState(()=>a||Ot()),h=[t?`${p}-description`:"",r?`${p}-hint-message`:"",s==="error"&&u?`${p}-error-message`:""].join(" ");return A.jsxs(vo,{isDisabled:l||!1,children:[!!e&&A.jsxs(go,{children:[A.jsx(cl,{bold:!0,htmlFor:p,isRequired:n||!1,children:e}),t&&A.jsx(H.BodyUI,{id:`${p}-description`,color:"var(--color-secondary-text-on-light, #4a5464)",children:t})]}),i&&ol(i,o)(),A.jsx(da,{title:e||"Styled input",hasIcon:!!(i||"").toString(),state:s||"default",id:p,disabled:l,readOnly:c,"data-1p-ignore":!0,...t?{"aria-describedby":h}:{},...d}),r&&A.jsxs(Lr,{id:`${p}-hint-message`,children:[A.jsx(hi,{fill:"var(--color-hint-text-on-light, #68778d)"}),A.jsx(H.TinyText,{color:"var(--color-secondary-text-on-light, #4a5464)",children:r})]}),s==="error"&&u&&A.jsxs(Lr,{id:`${p}-error-message`,children:[A.jsx(hi,{fill:"var(--color-alert-primary, #da3939)"}),A.jsx(H.TinyText,{color:"var(--color-alert-primary, #da3939)",children:u})]})]})},hi=S(Ae.IconAlertCircleOutline)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react/jsx-runtime"),m=require("react"),S=require("styled-components"),H=require("@happeouikit/typography"),Ae=require("@happeouikit/icons"),qu=require("react-dom"),fn=require("@happeouikit/theme"),B=require("prop-types"),V=require("@happeouikit/colors"),pt=require("react-intl"),ho=require("@happeouikit/tooltip"),sr=require("@happeouikit/layout"),ln=require("@happeouikit/buttons"),el=require("@happeo/react-core"),tl=require("@happeouikit/loaders");function nl(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 G=nl(m),rl=e=>e.replace(/(_|-|,|\.)(.)/g,t=>t[1].toUpperCase()),al=64,il=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),i=a?a.index:n.length,o=n.substring(0,Math.min(i,al)).toLocaleLowerCase();return o.length===0?"":"#"+o},po=e=>typeof e=="string",mo=e=>m.Children.toArray(e).filter(m.isValidElement),la=e=>{process.env.NODE_ENV!=="production"&&console.warn(`HappeoUiKit/form-elements: ${e}`)},ca=(e,t)=>{m.useEffect(()=>{e&&la(t)},[])},Ot=()=>"ixxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),En={success:"var(--color-success-primary, #00a372)",error:"var(--color-alert-primary, #da3939)",default:"var(--color-secondary-text-on-light, #4a5464)"},ol=(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()=>A.jsx(sl,{children:A.jsx(e,{...a,style:n})})},ur=({label:e,description:t,hintText:r,required:n,id:a,icon:i,iconProps:o,state:s,errorMessage:u,disabled:l,readOnly:c,...d})=>{const[p]=m.useState(()=>a||Ot()),h=[t?`${p}-description`:"",r?`${p}-hint-message`:"",s==="error"&&u?`${p}-error-message`:""].join(" ");return A.jsxs(vo,{isDisabled:l||!1,children:[!!e&&A.jsxs(go,{children:[A.jsx(cl,{bold:!0,htmlFor:p,isRequired:n||!1,children:e}),t&&A.jsx(H.BodyUI,{id:`${p}-description`,color:"var(--color-secondary-text-on-light, #4a5464)",children:t})]}),i&&ol(i,o??{})(),A.jsx(da,{title:e||"Styled input",hasIcon:!!(i||"").toString(),state:s||"default",id:p,disabled:l,readOnly:c,"data-1p-ignore":!0,...t?{"aria-describedby":h}:{},...d}),r&&A.jsxs(Lr,{id:`${p}-hint-message`,children:[A.jsx(hi,{fill:"var(--color-hint-text-on-light, #68778d)"}),A.jsx(H.TinyText,{color:"var(--color-secondary-text-on-light, #4a5464)",children:r})]}),s==="error"&&u&&A.jsxs(Lr,{id:`${p}-error-message`,children:[A.jsx(hi,{fill:"var(--color-alert-primary, #da3939)"}),A.jsx(H.TinyText,{color:"var(--color-alert-primary, #da3939)",children:u})]})]})},hi=S(Ae.IconAlertCircleOutline)`
2
2
  width: 13px;
3
3
  height: 13px;
4
4
  `,Lr=S.div`