tcce-design-system-test 0.3.6 → 0.3.7

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.
@@ -227,6 +227,7 @@ export declare interface FieldConfig {
227
227
  name: string;
228
228
  label: string;
229
229
  type: AllowedInputType;
230
+ size?: FormFieldSize;
230
231
  placeholder?: string;
231
232
  required?: boolean;
232
233
  disabled?: boolean;
@@ -247,13 +248,6 @@ export declare interface FieldConfig {
247
248
  rows?: number;
248
249
  }
249
250
 
250
- /**
251
- * Tipo to allow partial field configs with optional type (string) for normalization
252
- */
253
- export declare type FieldConfigInput = Omit<FieldConfig, 'type'> & {
254
- type?: string;
255
- };
256
-
257
251
  export declare const flushedStyles: RuleSet<object>;
258
252
 
259
253
  export declare const FormField: default_2.FC<FormFieldComponentProps>;
@@ -662,9 +656,7 @@ export declare interface NavigationItem {
662
656
  * @param fields - Array of field configurations
663
657
  * @returns Normalized field configurations with valid types
664
658
  */
665
- export declare const normalizeFieldTypes: (fields: Array<Partial<FieldConfigInput> & {
666
- type?: string;
667
- }>) => FieldConfig[];
659
+ export declare const normalizeFieldTypes: (fields: Partial<FieldConfig>[]) => FieldConfig[];
668
660
 
669
661
  /**
670
662
  * Transforms select options to the expected format
@@ -7420,7 +7420,8 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7420
7420
  radioName: e.radioName,
7421
7421
  pinLength: e.pinLength || 6,
7422
7422
  pinType: e.pinType || "number",
7423
- rows: e.rows || 4
7423
+ rows: e.rows || 4,
7424
+ size: e.size || "md"
7424
7425
  })), sv = (t) => t.map((e) => ({
7425
7426
  value: e.value,
7426
7427
  label: e.label
@@ -516,7 +516,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[kn]+=1);const yr={80:P`
516
516
  `,kg=P`
517
517
  cursor: not-allowed;
518
518
  opacity: 0.6;
519
- `,Gn=({children:e,htmlFor:t,className:n,required:r,disabled:o=!1,size:i="md",...s})=>m.jsxs(Cg,{className:n,htmlFor:t,$htmlFor:t,$size:i,$disabled:o,...s,children:[e,r&&m.jsx("span",{style:{color:"var(--color-main-warning-state)"},children:"*"})]}),Yl=["text","email","password","number","tel","url","date","datetime-local","time","search","textarea","select","checkbox","radio","pin"],Gl=e=>Yl.includes(e),Ge=e=>e.map(t=>({name:t.name||"",label:t.label||"",type:t.type&&Gl(t.type)?t.type:"text",placeholder:t.placeholder,required:t.required||!1,disabled:t.disabled||!1,options:t.options||[],validation:t.validation,checkboxLabel:t.checkboxLabel,radioName:t.radioName,pinLength:t.pinLength||6,pinType:t.pinType||"number",rows:t.rows||4})),Pg=e=>e.map(t=>({value:t.value,label:t.label})),Eg={text:(e,t,n)=>Ge([{name:e,label:t,type:"text",...n}])[0],email:(e,t,n)=>Ge([{name:e,label:t,type:"email",required:!0,...n}])[0],password:(e,t,n)=>Ge([{name:e,label:t,type:"password",required:!0,validation:{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{8,}$",custom:r=>{if(r&&r.length<8)return"Password must be at least 8 characters long"}},...n}])[0],select:(e,t,n,r)=>Ge([{name:e,label:t,type:"select",options:n,required:!0,...r}])[0],checkbox:(e,t,n)=>Ge([{name:e,label:t,type:"checkbox",checkboxLabel:t,...n}])[0],radio:(e,t,n,r)=>Ge([{name:e,label:t,type:"radio",options:n,radioName:e,required:!0,...r}])[0],pin:(e,t,n=6,r)=>Ge([{name:e,label:t,type:"pin",pinLength:n,pinType:"number",required:!0,validation:{custom:o=>{if(o&&o.length!==n)return`${t} must be ${n} digits long`}},...r}])[0]},Ag=(e,t,n,r,o,i,s,a)=>{const{field:l,...d}=t,u={...l,...d,size:d.size,hasError:d.hasError,disabled:d.disabled,placeholder:d.placeholder,className:d.className};switch(e){case"textarea":return{component:"textarea",props:{...u,rows:s?.rows||4}};case"select":return{component:"select",props:{...u,options:n?.options||[],onOptionSelect:n?.onOptionSelect,placeholder:t.placeholder||"Selecciona una opción"}};case"checkbox":return{component:"checkbox",props:{...u,label:r?.checkboxLabel||r?.label,checked:t.field.value||r?.checked||!1}};case"radio":return{component:"radio",props:{...u,options:o?.options||[],radioName:o?.radioName||t.name,onRadioChange:o?.onRadioChange}};case"pin":return{component:"pin",props:{...u,length:i?.pinLength||6,type:i?.pinType||"number",onComplete:i?.onPinComplete}};case"password":return{component:"password",props:{...u,type:"password"}};case"search":return{component:"search",props:{...u,onSearch:a?.onSearch}};default:return{component:"base",props:{...u,type:t.type||e||"text"}}}},dt=P`
519
+ `,Gn=({children:e,htmlFor:t,className:n,required:r,disabled:o=!1,size:i="md",...s})=>m.jsxs(Cg,{className:n,htmlFor:t,$htmlFor:t,$size:i,$disabled:o,...s,children:[e,r&&m.jsx("span",{style:{color:"var(--color-main-warning-state)"},children:"*"})]}),Yl=["text","email","password","number","tel","url","date","datetime-local","time","search","textarea","select","checkbox","radio","pin"],Gl=e=>Yl.includes(e),Ge=e=>e.map(t=>({name:t.name||"",label:t.label||"",type:t.type&&Gl(t.type)?t.type:"text",placeholder:t.placeholder,required:t.required||!1,disabled:t.disabled||!1,options:t.options||[],validation:t.validation,checkboxLabel:t.checkboxLabel,radioName:t.radioName,pinLength:t.pinLength||6,pinType:t.pinType||"number",rows:t.rows||4,size:t.size||"md"})),Pg=e=>e.map(t=>({value:t.value,label:t.label})),Eg={text:(e,t,n)=>Ge([{name:e,label:t,type:"text",...n}])[0],email:(e,t,n)=>Ge([{name:e,label:t,type:"email",required:!0,...n}])[0],password:(e,t,n)=>Ge([{name:e,label:t,type:"password",required:!0,validation:{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{8,}$",custom:r=>{if(r&&r.length<8)return"Password must be at least 8 characters long"}},...n}])[0],select:(e,t,n,r)=>Ge([{name:e,label:t,type:"select",options:n,required:!0,...r}])[0],checkbox:(e,t,n)=>Ge([{name:e,label:t,type:"checkbox",checkboxLabel:t,...n}])[0],radio:(e,t,n,r)=>Ge([{name:e,label:t,type:"radio",options:n,radioName:e,required:!0,...r}])[0],pin:(e,t,n=6,r)=>Ge([{name:e,label:t,type:"pin",pinLength:n,pinType:"number",required:!0,validation:{custom:o=>{if(o&&o.length!==n)return`${t} must be ${n} digits long`}},...r}])[0]},Ag=(e,t,n,r,o,i,s,a)=>{const{field:l,...d}=t,u={...l,...d,size:d.size,hasError:d.hasError,disabled:d.disabled,placeholder:d.placeholder,className:d.className};switch(e){case"textarea":return{component:"textarea",props:{...u,rows:s?.rows||4}};case"select":return{component:"select",props:{...u,options:n?.options||[],onOptionSelect:n?.onOptionSelect,placeholder:t.placeholder||"Selecciona una opción"}};case"checkbox":return{component:"checkbox",props:{...u,label:r?.checkboxLabel||r?.label,checked:t.field.value||r?.checked||!1}};case"radio":return{component:"radio",props:{...u,options:o?.options||[],radioName:o?.radioName||t.name,onRadioChange:o?.onRadioChange}};case"pin":return{component:"pin",props:{...u,length:i?.pinLength||6,type:i?.pinType||"number",onComplete:i?.onPinComplete}};case"password":return{component:"password",props:{...u,type:"password"}};case"search":return{component:"search",props:{...u,onSearch:a?.onSearch}};default:return{component:"base",props:{...u,type:t.type||e||"text"}}}},dt=P`
520
520
  display: flex;
521
521
  justify-content: space-between;
522
522
  align-items: center;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.6",
6
+ "version": "0.3.7",
7
7
  "description": "This package provides reusable UI components to ensure consistency across all CRM frontend applications",
8
8
  "author": "BizAppsTotal <bizapps@tcce.biz>",
9
9
  "type": "module",