@useloops/design-system 1.4.597 → 1.4.598
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
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{useTheme as o,Stack as i}from"@mui/material";import{mergeSx as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{useTheme as o,Stack as i}from"@mui/material";import{mergeSx as n}from"merge-sx";import{useState as s,useEffect as m}from"react";import{Controller as a}from"react-hook-form";import{isValidPhoneNumber as l}from"react-phone-number-input";import c from"../../../Checkbox/Checkbox.js";import"../../../Checkbox/StyledCheckbox.js";import p from"../../../CheckboxGroup/CheckboxGroup.js";import f from"../../../CreatableAutocomplete/CreatableAutocomplete.js";import h from"../../../CustomField/CustomField.js";import u from"../../../Differential/Differential.js";import d from"../../../Html/Html.js";import x from"../../../InputLabel/InputLabel.js";import g from"../../../Likert/Likert.js";import j from"../../../NumberField/NumberField.js";import b from"../../../RadioGroup/RadioGroup.js";import S from"../../../Rank/Rank.js";import k from"../../../RichTextField/RichTextField.js";import v from"../../../Select/Select.js";import"../../../Select/SelectItem.js";import T from"../../../Slider/Slider.js";import C from"../../../StarRating/StarRating.js";import R from"../../../Switch/Switch.js";import w from"../../../Textarea/Textarea.js";import y from"../../../TextField/TextField.js";import I from"../StengthIndicator/StrengthIndicator.js";import F from"./components/InputWrapperHelperText/InputWrapperHelperText.js";const B={textfield:y,numberfield:j,textarea:w,creatableautocomplete:f,select:v,checkbox:c,checkboxGroup:p,switch:R,slider:T,starRating:C,differential:u,likert:g,radioGroup:b,ranking:S,richTextfield:k,customfield:h},G=(e,t)=>e.filter(e=>{if(e.includes("-value-")){const t=e.split("-value-")[1];return t&&t.length>0}return e!==t}).length,H=({fieldRef:c,name:p,fieldType:f,label:h,control:u,errors:g,labelProps:j,helperText:b,helpTextProps:S,validation:k,content:v,styleOverrides:T,defaultValue:C,onChange:R,watch:w,trigger:y,strengthIndicator:H,...L})=>{const{custom:N}=o(),$=void 0!==g&&Object.keys(g).length>0,[_,A]=s(0);m(()=>{H&&_>0&&y(p)},[_]);const D=k?.match?.field,O=w(D);return m(()=>{D&&y(p)},[O,D,y,p]),e(i,{sx:n(T?.sxInputStack,L?.hidden&&{display:"none!important"}),gap:N.margin.sm,children:["switch"!==f?h&&t(x,{...j,children:h}):null,"html"===f&&v?t(d,{children:v}):e(r,{children:[t(a,{name:p,control:u,render:e=>function({field:{ref:e,...r}}){return t(B[f],{...L,...r,inputRef:t=>{e(t),c&&(c.current=t)},..."switch"===f?{label:h}:{}})}(e),rules:{...k,validate:e=>{if(k&&"phone"in k)return l(`+${w("extension")}${e}`)||k.phone.message;if(k&&"score"in k)return _<=k.score.value?k.score.message:void 0;if(k&&"white_space"in k)return!e.match(/^\s*$/g)||k.white_space.message;if(k&&"match"in k&&k?.match?.field)switch(k?.match?.comparison){case"not_eq":return e!=w(k.match.field)||k.match.message;case"gt":return e>w(k.match.field)||k.match.message;case"lt":return e<w(k.match.field)||k.match.message;default:return e===w(k.match.field)||k.match.message}if(k&&"minSelections"in k){const t=e;if(!(k.selectionsBypass&&t.includes(k.selectionsBypass))){const e=L.other?.enabled?L.other?.name||"other-option":void 0;if(G(t,e)<k.minSelections.value)return k.minSelections.message}}if(k&&"maxSelections"in k){const t=e;if(!(k.selectionsBypass&&t.includes(k.selectionsBypass))){const e=L.other?.enabled?L.other?.name||"other-option":void 0;if(G(t,e)>k.maxSelections.value)return k.maxSelections.message}}}}}),H&&t(I,{value:w(p),onChange:A})]}),e(r,{children:[Boolean($)?t(F,{helperText:void 0,inputName:p,errors:g,showicon:!0}):null,Boolean(b)?t(F,{helperText:b,inputName:p,errors:void 0,...S}):null]})]})};export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material"),t=require("merge-sx"),i=require("react"),s=require("react-hook-form"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material"),t=require("merge-sx"),i=require("react"),s=require("react-hook-form"),n=require("react-phone-number-input"),a=require("../../../Checkbox/Checkbox.js");require("../../../Checkbox/StyledCheckbox.js");var l=require("../../../CheckboxGroup/CheckboxGroup.js"),o=require("../../../CreatableAutocomplete/CreatableAutocomplete.js"),c=require("../../../CustomField/CustomField.js"),u=require("../../../Differential/Differential.js"),h=require("../../../Html/Html.js"),m=require("../../../InputLabel/InputLabel.js"),d=require("../../../Likert/Likert.js"),p=require("../../../NumberField/NumberField.js"),x=require("../../../RadioGroup/RadioGroup.js"),f=require("../../../Rank/Rank.js"),j=require("../../../RichTextField/RichTextField.js"),g=require("../../../Select/Select.js");require("../../../Select/SelectItem.js");var q=require("../../../Slider/Slider.js"),b=require("../../../StarRating/StarRating.js"),S=require("../../../Switch/Switch.js"),k=require("../../../Textarea/Textarea.js"),v=require("../../../TextField/TextField.js"),T=require("../StengthIndicator/StrengthIndicator.js"),C=require("./components/InputWrapperHelperText/InputWrapperHelperText.js");const R={textfield:v,numberfield:p,textarea:k,creatableautocomplete:o,select:g,checkbox:a,checkboxGroup:l,switch:S,slider:q,starRating:b,differential:u,likert:d,radioGroup:x,ranking:f,richTextfield:j,customfield:c},w=(e,r)=>e.filter(e=>{if(e.includes("-value-")){const r=e.split("-value-")[1];return r&&r.length>0}return e!==r}).length;module.exports=({fieldRef:a,name:l,fieldType:o,label:c,control:u,errors:d,labelProps:p,helperText:x,helpTextProps:f,validation:j,content:g,styleOverrides:q,defaultValue:b,onChange:S,watch:k,trigger:v,strengthIndicator:F,...y})=>{const{custom:I}=r.useTheme(),B=void 0!==d&&Object.keys(d).length>0,[G,N]=i.useState(0);i.useEffect(()=>{F&&G>0&&v(l)},[G]);const H=j?.match?.field,L=k(H);return i.useEffect(()=>{H&&v(l)},[L,H,v,l]),e.jsxs(r.Stack,{sx:t.mergeSx(q?.sxInputStack,y?.hidden&&{display:"none!important"}),gap:I.margin.sm,children:["switch"!==o?c&&e.jsx(m,{...p,children:c}):null,"html"===o&&g?e.jsx(h,{children:g}):e.jsxs(e.Fragment,{children:[e.jsx(s.Controller,{name:l,control:u,render:r=>function({field:{ref:r,...t}}){const i=R[o];return e.jsx(i,{...y,...t,inputRef:e=>{r(e),a&&(a.current=e)},..."switch"===o?{label:c}:{}})}(r),rules:{...j,validate:e=>{if(j&&"phone"in j)return n.isValidPhoneNumber(`+${k("extension")}${e}`)||j.phone.message;if(j&&"score"in j)return G<=j.score.value?j.score.message:void 0;if(j&&"white_space"in j)return!e.match(/^\s*$/g)||j.white_space.message;if(j&&"match"in j&&j?.match?.field)switch(j?.match?.comparison){case"not_eq":return e!=k(j.match.field)||j.match.message;case"gt":return e>k(j.match.field)||j.match.message;case"lt":return e<k(j.match.field)||j.match.message;default:return e===k(j.match.field)||j.match.message}if(j&&"minSelections"in j){const r=e;if(!(j.selectionsBypass&&r.includes(j.selectionsBypass))){const e=y.other?.enabled?y.other?.name||"other-option":void 0;if(w(r,e)<j.minSelections.value)return j.minSelections.message}}if(j&&"maxSelections"in j){const r=e;if(!(j.selectionsBypass&&r.includes(j.selectionsBypass))){const e=y.other?.enabled?y.other?.name||"other-option":void 0;if(w(r,e)>j.maxSelections.value)return j.maxSelections.message}}}}}),F&&e.jsx(T,{value:k(l),onChange:N})]}),e.jsxs(e.Fragment,{children:[Boolean(B)?e.jsx(C,{helperText:void 0,inputName:l,errors:d,showicon:!0}):null,Boolean(x)?e.jsx(C,{helperText:x,inputName:l,errors:void 0,...f}):null]})]})};
|
|
@@ -4,7 +4,7 @@ import { PaletteMode, Direction } from '@mui/material';
|
|
|
4
4
|
import { ScreenSize, CustomTheme } from './types.js';
|
|
5
5
|
|
|
6
6
|
declare const useThemeBuilder: (initialMode?: PaletteMode, initialScreenSize?: ScreenSize, initialDirection?: Direction) => {
|
|
7
|
-
breakpoint: "" | "sm" | "
|
|
7
|
+
breakpoint: "" | "sm" | "lg" | "md" | "xl";
|
|
8
8
|
custom: CustomTheme;
|
|
9
9
|
gridOverlayVisible: boolean;
|
|
10
10
|
mode: PaletteMode;
|