tcce-design-system 0.3.30 → 0.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes } from 'react';
|
|
2
|
+
import { AnySchema } from 'yup';
|
|
2
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
3
4
|
import { Cell } from '@tanstack/react-table';
|
|
4
5
|
import { ChangeEvent } from 'react';
|
|
@@ -1907,7 +1908,7 @@ export declare type StepperSize = 'sm' | 'md' | 'lg';
|
|
|
1907
1908
|
*/
|
|
1908
1909
|
export declare const StoreDialog: <T extends {
|
|
1909
1910
|
id?: number | string;
|
|
1910
|
-
}>({ isOpen, setOpen, handleCreate, handleEdit, item, initialValues, formInputs, option, title, buttonText, }: StoreDialogProps<T>) => JSX.Element;
|
|
1911
|
+
}>({ isOpen, setOpen, handleCreate, handleEdit, item, initialValues, formInputs, option, title, buttonText, validationSchema, }: StoreDialogProps<T>) => JSX.Element;
|
|
1911
1912
|
|
|
1912
1913
|
/**
|
|
1913
1914
|
* Label set used for create and edit mode text.
|
|
@@ -1939,6 +1940,7 @@ export declare type StoreDialogOption = 'create' | 'edit';
|
|
|
1939
1940
|
* @param option - Defines whether the dialog works in create or edit mode.
|
|
1940
1941
|
* @param title - Optional heading labels for each mode.
|
|
1941
1942
|
* @param buttonText - Optional submit button labels for each mode.
|
|
1943
|
+
* @param validationSchema - Optional Yup schema passed to Formik for form validation.
|
|
1942
1944
|
*/
|
|
1943
1945
|
export declare interface StoreDialogProps<T = any> {
|
|
1944
1946
|
isOpen: boolean;
|
|
@@ -1951,6 +1953,7 @@ export declare interface StoreDialogProps<T = any> {
|
|
|
1951
1953
|
option: StoreDialogOption;
|
|
1952
1954
|
title?: StoreDialogLabels;
|
|
1953
1955
|
buttonText?: StoreDialogLabels;
|
|
1956
|
+
validationSchema?: AnySchema;
|
|
1954
1957
|
}
|
|
1955
1958
|
|
|
1956
1959
|
/**
|
|
@@ -9109,7 +9109,7 @@ const w0 = S.div`
|
|
|
9109
9109
|
// Overlays / modals
|
|
9110
9110
|
// Tooltips / menus that should appear above header/sidebar.
|
|
9111
9111
|
TOOLTIP: 1202,
|
|
9112
|
-
POPOVER_MENU:
|
|
9112
|
+
POPOVER_MENU: 9999,
|
|
9113
9113
|
DIALOG_OVERLAY: 2001
|
|
9114
9114
|
}, R0 = S(Ue.div)`
|
|
9115
9115
|
position: fixed;
|
|
@@ -9620,26 +9620,21 @@ const U1 = ({
|
|
|
9620
9620
|
buttonText: c = {
|
|
9621
9621
|
create: "Create",
|
|
9622
9622
|
edit: "Save Changes"
|
|
9623
|
-
}
|
|
9623
|
+
},
|
|
9624
|
+
validationSchema: u
|
|
9624
9625
|
}) => /* @__PURE__ */ D(_r, { isOpen: e, onClose: () => t(!1), showCloseButton: !0, children: [
|
|
9625
9626
|
/* @__PURE__ */ g(Nr, { children: /* @__PURE__ */ g(er, { children: a === "create" ? l.create : l.edit }) }),
|
|
9626
9627
|
/* @__PURE__ */ g(Br, { children: /* @__PURE__ */ g(
|
|
9627
9628
|
_c,
|
|
9628
9629
|
{
|
|
9629
9630
|
initialValues: i,
|
|
9631
|
+
validationSchema: u,
|
|
9630
9632
|
enableReinitialize: !0,
|
|
9631
|
-
onSubmit: (
|
|
9632
|
-
a === "create" ? n(
|
|
9633
|
+
onSubmit: (d) => {
|
|
9634
|
+
a === "create" ? n(d) : a === "edit" && o && r?.id !== void 0 && r?.id !== null && o(r.id, d);
|
|
9633
9635
|
},
|
|
9634
|
-
children: ({ values:
|
|
9635
|
-
s.map((
|
|
9636
|
-
x0,
|
|
9637
|
-
{
|
|
9638
|
-
...f,
|
|
9639
|
-
value: u[f.name]
|
|
9640
|
-
},
|
|
9641
|
-
f.name
|
|
9642
|
-
)),
|
|
9636
|
+
children: ({ values: d, isValid: f }) => /* @__PURE__ */ D(Nc, { children: [
|
|
9637
|
+
s.map((h) => /* @__PURE__ */ g(x0, { ...h, value: d[h.name] }, h.name)),
|
|
9643
9638
|
/* @__PURE__ */ D("section", { className: "flex justify-between py-4", children: [
|
|
9644
9639
|
/* @__PURE__ */ g(
|
|
9645
9640
|
je,
|
|
@@ -9650,7 +9645,7 @@ const U1 = ({
|
|
|
9650
9645
|
children: "Cancel"
|
|
9651
9646
|
}
|
|
9652
9647
|
),
|
|
9653
|
-
/* @__PURE__ */ g(je, { type: "submit", disabled: !
|
|
9648
|
+
/* @__PURE__ */ g(je, { type: "submit", disabled: !f, children: a === "create" ? c.create : c.edit })
|
|
9654
9649
|
] })
|
|
9655
9650
|
] })
|
|
9656
9651
|
}
|
|
@@ -12873,7 +12868,7 @@ const Iv = Ln(Fv), Lv = Is`
|
|
|
12873
12868
|
l.id
|
|
12874
12869
|
);
|
|
12875
12870
|
}),
|
|
12876
|
-
e.length === 0 && /* @__PURE__ */ g("tr", { children: /* @__PURE__ */ g("td", { colSpan: 100, className: "text-main-grey py-4 text-center", children: "No results found" }) })
|
|
12871
|
+
e.length === 0 && /* @__PURE__ */ g("tr", { children: /* @__PURE__ */ g("td", { colSpan: 100, className: "text-main-grey py-4 text-center bg-main-white", children: "No results found" }) })
|
|
12877
12872
|
] }) });
|
|
12878
12873
|
}, zv = S.section`
|
|
12879
12874
|
display: flex;
|
|
@@ -1134,7 +1134,7 @@
|
|
|
1134
1134
|
flex-direction: column;
|
|
1135
1135
|
gap: 0.5rem;
|
|
1136
1136
|
width: 100%;
|
|
1137
|
-
`,E0=m.memo(({inputId:e,label:t,size:n,required:o,disabled:r,hasError:i,errorMessage:s,isCheckbox:a=!1,className:l,labelClassName:c,messageErrorClassName:u,children:d})=>g.jsxs($0,{className:l,children:[t&&!a&&g.jsx(Tn,{htmlFor:e,size:n,required:o,disabled:r,className:c,children:t}),d,i&&s&&g.jsx(fr,{id:`${e}-error`,size:n,className:u,children:s})]})),Il=({id:e,name:t,label:n,type:o="text",size:r="md",placeholder:i,disabled:s=!1,required:a=!1,options:l=[],checkboxLabel:c,radioName:u,pinLength:d=6,pinType:f="number",rows:h=4,className:p,inputClassName:y,labelClassName:b,messageErrorClassName:w,leftIcon:x,rightIcon:C,iconSize:T,iconColor:$,onOptionSelect:M,onRadioChange:F,onPinComplete:E,onChange:D,optionsClassName:P,optionClassName:R,..._})=>{const{field:k,hasError:A,errorMessage:O,inputId:L,ariaProps:G,handleStandardChange:H,handleTextAreaChange:Y,handleCheckboxChange:J,handleSelectChange:te,handleRadioChange:We,handlePinChange:j,handlePinComplete:Q}=C0({name:t,required:a,onChange:D,onOptionSelect:M,onRadioChange:F,onPinComplete:E,options:l}),K=e?.toString?.()||L;return g.jsx(E0,{inputId:K,label:n,size:r,required:a,disabled:s,hasError:A,errorMessage:O,isCheckbox:o==="checkbox",className:p,labelClassName:b,messageErrorClassName:w,children:g.jsx(Fl,{type:o,inputId:K,name:t,size:r,hasError:A,disabled:s,placeholder:i,inputClassName:y,fieldValue:k.value,ariaProps:G,options:l,onSelectChange:te,checkboxLabel:c,onCheckboxChange:J,radioName:u,onRadioChange:We,pinLength:d,pinType:f,rows:h,onPinChange:j,onPinComplete:Q,onStandardChange:H,onTextAreaChange:Y,leftIcon:x,rightIcon:C,iconSize:T,iconColor:$,optionsClassName:P,optionClassName:R,additionalProps:_})})},Ll={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeInOut"},layout:!1},Tr={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:"easeInOut"}},P0={fromBottom:{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.2,ease:"easeInOut"}},fromTop:{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"}},fromLeft:{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2,ease:"easeInOut"}},fromRight:{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.2,ease:"easeInOut"}}},Rl={initial:{height:0,opacity:0,y:-6},animate:{height:"auto",opacity:1,y:0},exit:{height:0,opacity:0,y:-6},transition:{duration:.2,ease:"easeInOut"}},je={HEADER:1e3,HEADER_DROPDOWN:1001,MOBILE_OPEN_BUTTON:1002,SIDEBAR_OVERLAY:1100,SIDEBAR_ASIDE:1101,TOOLTIP:1202,POPOVER_MENU:
|
|
1137
|
+
`,E0=m.memo(({inputId:e,label:t,size:n,required:o,disabled:r,hasError:i,errorMessage:s,isCheckbox:a=!1,className:l,labelClassName:c,messageErrorClassName:u,children:d})=>g.jsxs($0,{className:l,children:[t&&!a&&g.jsx(Tn,{htmlFor:e,size:n,required:o,disabled:r,className:c,children:t}),d,i&&s&&g.jsx(fr,{id:`${e}-error`,size:n,className:u,children:s})]})),Il=({id:e,name:t,label:n,type:o="text",size:r="md",placeholder:i,disabled:s=!1,required:a=!1,options:l=[],checkboxLabel:c,radioName:u,pinLength:d=6,pinType:f="number",rows:h=4,className:p,inputClassName:y,labelClassName:b,messageErrorClassName:w,leftIcon:x,rightIcon:C,iconSize:T,iconColor:$,onOptionSelect:M,onRadioChange:F,onPinComplete:E,onChange:D,optionsClassName:P,optionClassName:R,..._})=>{const{field:k,hasError:A,errorMessage:O,inputId:L,ariaProps:G,handleStandardChange:H,handleTextAreaChange:Y,handleCheckboxChange:J,handleSelectChange:te,handleRadioChange:We,handlePinChange:j,handlePinComplete:Q}=C0({name:t,required:a,onChange:D,onOptionSelect:M,onRadioChange:F,onPinComplete:E,options:l}),K=e?.toString?.()||L;return g.jsx(E0,{inputId:K,label:n,size:r,required:a,disabled:s,hasError:A,errorMessage:O,isCheckbox:o==="checkbox",className:p,labelClassName:b,messageErrorClassName:w,children:g.jsx(Fl,{type:o,inputId:K,name:t,size:r,hasError:A,disabled:s,placeholder:i,inputClassName:y,fieldValue:k.value,ariaProps:G,options:l,onSelectChange:te,checkboxLabel:c,onCheckboxChange:J,radioName:u,onRadioChange:We,pinLength:d,pinType:f,rows:h,onPinChange:j,onPinComplete:Q,onStandardChange:H,onTextAreaChange:Y,leftIcon:x,rightIcon:C,iconSize:T,iconColor:$,optionsClassName:P,optionClassName:R,additionalProps:_})})},Ll={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeInOut"},layout:!1},Tr={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:"easeInOut"}},P0={fromBottom:{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.2,ease:"easeInOut"}},fromTop:{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"}},fromLeft:{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2,ease:"easeInOut"}},fromRight:{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.2,ease:"easeInOut"}}},Rl={initial:{height:0,opacity:0,y:-6},animate:{height:"auto",opacity:1,y:0},exit:{height:0,opacity:0,y:-6},transition:{duration:.2,ease:"easeInOut"}},je={HEADER:1e3,HEADER_DROPDOWN:1001,MOBILE_OPEN_BUTTON:1002,SIDEBAR_OVERLAY:1100,SIDEBAR_ASIDE:1101,TOOLTIP:1202,POPOVER_MENU:9999,DIALOG_OVERLAY:2001},k0=v(Ie.div)`
|
|
1138
1138
|
position: fixed;
|
|
1139
1139
|
inset: 0;
|
|
1140
1140
|
z-index: ${je.DIALOG_OVERLAY};
|
|
@@ -1333,7 +1333,7 @@
|
|
|
1333
1333
|
background-color: var(--color-dark-600);
|
|
1334
1334
|
|
|
1335
1335
|
${({$placement:e})=>j0(e)}
|
|
1336
|
-
`,_l=({content:e,children:t,placement:n="bottom",trigger:o="hover",className:r="",arrowClassName:i="",delay:s=200,showArrow:a=!0})=>{const[l,c]=m.useState(!1),u=m.useRef(null),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(o!=="click"||!l)return;const w=x=>{d.current&&!d.current.contains(x.target)&&f.current&&!f.current.contains(x.target)&&c(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l,o]),m.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const b=o==="hover"?{onMouseEnter:()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>c(!0),s)},onMouseLeave:()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>c(!1),100)}}:{onClick:()=>{c(w=>!w)}};return g.jsxs(N0,{children:[g.jsx(O0,{ref:f,...b,children:t}),l&&g.jsxs(H0,{ref:d,$placement:n,className:r,role:"tooltip","aria-hidden":!l,children:[e,a&&g.jsx(G0,{$placement:n,className:i})]})]})};_l.displayName="Tooltip";const U0=({isOpen:e,setOpen:t,handleCreate:n,handleEdit:o,item:r,initialValues:i,formInputs:s,option:a,title:l={create:"Create New Item",edit:"Edit Item"},buttonText:c={create:"Create",edit:"Save Changes"}})=>g.jsxs(kn,{isOpen:e,onClose:()=>t(!1),showCloseButton:!0,children:[g.jsx(Mn,{children:g.jsx(qt,{children:a==="create"?l.create:l.edit})}),g.jsx(Dn,{children:g.jsx(Un.Formik,{initialValues:i,enableReinitialize:!0,onSubmit:
|
|
1336
|
+
`,_l=({content:e,children:t,placement:n="bottom",trigger:o="hover",className:r="",arrowClassName:i="",delay:s=200,showArrow:a=!0})=>{const[l,c]=m.useState(!1),u=m.useRef(null),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(o!=="click"||!l)return;const w=x=>{d.current&&!d.current.contains(x.target)&&f.current&&!f.current.contains(x.target)&&c(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l,o]),m.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const b=o==="hover"?{onMouseEnter:()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>c(!0),s)},onMouseLeave:()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>c(!1),100)}}:{onClick:()=>{c(w=>!w)}};return g.jsxs(N0,{children:[g.jsx(O0,{ref:f,...b,children:t}),l&&g.jsxs(H0,{ref:d,$placement:n,className:r,role:"tooltip","aria-hidden":!l,children:[e,a&&g.jsx(G0,{$placement:n,className:i})]})]})};_l.displayName="Tooltip";const U0=({isOpen:e,setOpen:t,handleCreate:n,handleEdit:o,item:r,initialValues:i,formInputs:s,option:a,title:l={create:"Create New Item",edit:"Edit Item"},buttonText:c={create:"Create",edit:"Save Changes"},validationSchema:u})=>g.jsxs(kn,{isOpen:e,onClose:()=>t(!1),showCloseButton:!0,children:[g.jsx(Mn,{children:g.jsx(qt,{children:a==="create"?l.create:l.edit})}),g.jsx(Dn,{children:g.jsx(Un.Formik,{initialValues:i,validationSchema:u,enableReinitialize:!0,onSubmit:d=>{a==="create"?n(d):a==="edit"&&o&&r?.id!==void 0&&r?.id!==null&&o(r.id,d)},children:({values:d,isValid:f})=>g.jsxs(Un.Form,{children:[s.map(h=>g.jsx(Il,{...h,value:d[h.name]},h.name)),g.jsxs("section",{className:"flex justify-between py-4",children:[g.jsx(Me,{variant:"secondary",type:"button",onClick:()=>t(!1),children:"Cancel"}),g.jsx(Me,{type:"submit",disabled:!f,children:a==="create"?c.create:c.edit})]})]})})})]}),W0=({isOpen:e,onClose:t,onConfirm:n,isLoading:o=!1,itemLabel:r="this item"})=>g.jsxs(kn,{isOpen:e,onClose:t,showCloseButton:!0,size:"sm",children:[g.jsx(Mn,{showDivider:!0,children:g.jsx(qt,{size:20,color:"var(--color-main-warning-state)",children:"Confirm Delete"})}),g.jsx(Dn,{padded:!0,children:g.jsxs(Ve,{size:14,color:"var(--color-dark-800)",children:["Are you sure you want to delete ",g.jsx("strong",{children:r}),"? This action cannot be undone."]})}),g.jsxs($r,{showDivider:!0,align:"end",children:[g.jsx(Me,{variant:"cancel",size:"md",onClick:t,disabled:o,children:"Cancel"}),g.jsx(Me,{variant:"primary",size:"md",onClick:n,isLoading:o,disabled:o,children:"Delete"})]})]}),Er=m.createContext(void 0),Bl=({children:e})=>{const[t,n]=m.useState(!0),[o,r]=m.useState(!1);return g.jsx(Er.Provider,{value:{isCollapsed:t,setIsCollapsed:n,isMobileOpen:o,setIsMobileOpen:r},children:e})},Vn=()=>{const e=m.useContext(Er);if(!e)throw new Error("useSidebar must be used within a SidebarProvider");return e},Pr=(e=[],t=[])=>!t||t.length===0?!1:t.includes("all")?!0:e.map(o=>o.name).some(o=>t.includes(o)),K0=v.css`
|
|
1337
1337
|
display: flex;
|
|
1338
1338
|
align-items: center;
|
|
1339
1339
|
justify-content: center;
|
|
@@ -2007,7 +2007,7 @@
|
|
|
2007
2007
|
&:hover {
|
|
2008
2008
|
background-color: transparent;
|
|
2009
2009
|
}
|
|
2010
|
-
`,by=e=>{const t=["60%","75%","85%","70%","80%"];return t[e%t.length]},xy=({columnCount:e,cellWidths:t,size:n="md"})=>g.jsx(wy,{role:"row","aria-busy":"true",children:Array.from({length:e}).map((o,r)=>g.jsx(yy,{$width:t?.[r]||by(r),$size:n},r))}),Bn=({rows:e,className:t,rowClassName:n,cellClassName:o,isLoading:r=!1,rowCount:i=5,columnCount:s=3})=>{const{size:a}=Ct();return g.jsx("tbody",{className:t,"aria-busy":r,children:r?Array.from({length:i}).map((l,c)=>g.jsx(xy,{columnCount:s,size:a},`skeleton-${c}`)):g.jsxs(g.Fragment,{children:[e.map(l=>{const c=typeof n=="function"?n(l):n,u=typeof o=="function"?o(l):o;return g.jsx(xc,{row:l,className:c,cellClassName:u},l.id)}),e.length===0&&g.jsx("tr",{children:g.jsx("td",{colSpan:100,className:"text-main-grey py-4 text-center",children:"No results found"})})]})})},Cy=v.section`
|
|
2010
|
+
`,by=e=>{const t=["60%","75%","85%","70%","80%"];return t[e%t.length]},xy=({columnCount:e,cellWidths:t,size:n="md"})=>g.jsx(wy,{role:"row","aria-busy":"true",children:Array.from({length:e}).map((o,r)=>g.jsx(yy,{$width:t?.[r]||by(r),$size:n},r))}),Bn=({rows:e,className:t,rowClassName:n,cellClassName:o,isLoading:r=!1,rowCount:i=5,columnCount:s=3})=>{const{size:a}=Ct();return g.jsx("tbody",{className:t,"aria-busy":r,children:r?Array.from({length:i}).map((l,c)=>g.jsx(xy,{columnCount:s,size:a},`skeleton-${c}`)):g.jsxs(g.Fragment,{children:[e.map(l=>{const c=typeof n=="function"?n(l):n,u=typeof o=="function"?o(l):o;return g.jsx(xc,{row:l,className:c,cellClassName:u},l.id)}),e.length===0&&g.jsx("tr",{children:g.jsx("td",{colSpan:100,className:"text-main-grey py-4 text-center bg-main-white",children:"No results found"})})]})})},Cy=v.section`
|
|
2011
2011
|
display: flex;
|
|
2012
2012
|
align-items: center;
|
|
2013
2013
|
gap: 0.5rem;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.32",
|
|
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",
|