@worldresources/wri-design-systems 2.185.0 → 2.186.0
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 +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3684,7 +3684,7 @@ function Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Obj
|
|
|
3684
3684
|
background-image: url(${n});
|
|
3685
3685
|
background-size: cover;
|
|
3686
3686
|
background-position: center;
|
|
3687
|
-
`)}),t.jsxs("div",{css:Ln,children:[t.jsxs("div",{className:"ds-base-map-title-container",children:[t.jsx("p",{className:"ds-base-map-title",children:e.label}),e.active?t.jsx(Gt,{label:"Active",variant:"warning",size:"small",icon:t.jsx(C,{})}):null]}),t.jsx("p",{className:"ds-base-map-caption",children:e.caption}),e.active&&e.children?t.jsx("div",{className:"ds-base-map-children",children:e.children}):null]})]},e.label);var n}))}):null]})]})})},exports.Breadcrumb=({links:r,separator:o,maxItems:i=99,linkRouter:a,size:s="default"})=>{const[l,c]=n.useState(r.length>i);n.useEffect((()=>{c(r.length>i)}),[r.length]);const d=a;return t.jsx(e.Breadcrumb.Root,{children:t.jsx(e.Breadcrumb.List,{gap:"small"===s?"6px":"10px",children:l?t.jsxs(t.Fragment,{children:[t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:t.jsxs(d,{to:r[0].link,href:r[0].link,children:[r[0].icon,r[0].label]})}),t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}),t.jsx("li",{className:"chakra-breadcrumb__item",children:t.jsx("button",{css:_h,type:"button",onClick:()=>c(!1),children:"..."})}),t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}),t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:t.jsxs("p",{"aria-current":"page","aria-label":r[r.length-1].label,children:[r[r.length-1].icon,r[r.length-1].label]})})]}):r.map(((i,a)=>i?.label?t.jsxs(n.Fragment,{children:[t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:a<r.length-1?t.jsxs(d,{to:i.link,href:i.link,children:[i.icon,i.label]}):t.jsxs("p",{"aria-current":"page","aria-label":i.label,children:[i.label&&i.icon?i.icon:"",i.label]})}),a<r.length-1?t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}):null]},i.label):null))})})},exports.Button=b,exports.Checkbox=Le,exports.CheckboxList=({label:o,caption:i,checkboxes:a,
|
|
3687
|
+
`)}),t.jsxs("div",{css:Ln,children:[t.jsxs("div",{className:"ds-base-map-title-container",children:[t.jsx("p",{className:"ds-base-map-title",children:e.label}),e.active?t.jsx(Gt,{label:"Active",variant:"warning",size:"small",icon:t.jsx(C,{})}):null]}),t.jsx("p",{className:"ds-base-map-caption",children:e.caption}),e.active&&e.children?t.jsx("div",{className:"ds-base-map-children",children:e.children}):null]})]},e.label);var n}))}):null]})]})})},exports.Breadcrumb=({links:r,separator:o,maxItems:i=99,linkRouter:a,size:s="default"})=>{const[l,c]=n.useState(r.length>i);n.useEffect((()=>{c(r.length>i)}),[r.length]);const d=a;return t.jsx(e.Breadcrumb.Root,{children:t.jsx(e.Breadcrumb.List,{gap:"small"===s?"6px":"10px",children:l?t.jsxs(t.Fragment,{children:[t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:t.jsxs(d,{to:r[0].link,href:r[0].link,children:[r[0].icon,r[0].label]})}),t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}),t.jsx("li",{className:"chakra-breadcrumb__item",children:t.jsx("button",{css:_h,type:"button",onClick:()=>c(!1),children:"..."})}),t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}),t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:t.jsxs("p",{"aria-current":"page","aria-label":r[r.length-1].label,children:[r[r.length-1].icon,r[r.length-1].label]})})]}):r.map(((i,a)=>i?.label?t.jsxs(n.Fragment,{children:[t.jsx(e.Breadcrumb.Item,{css:Mh(s),children:a<r.length-1?t.jsxs(d,{to:i.link,href:i.link,children:[i.icon,i.label]}):t.jsxs("p",{"aria-current":"page","aria-label":i.label,children:[i.label&&i.icon?i.icon:"",i.label]})}),a<r.length-1?t.jsx(e.Breadcrumb.Separator,{css:Ph(s),children:o||t.jsx($,{rotate:"270"})}):null]},i.label):null))})})},exports.Button=b,exports.Checkbox=Le,exports.CheckboxList=({label:o,caption:i,checkboxes:a,defaultValues:s,onCheckedChange:l,errorMessage:c,horizontal:d,required:u,hideCheckedCounter:p=!1,hideExpandToggle:h=!1})=>{const[f,x]=n.useState(s?s.reduce(((e,t)=>({...e,[t]:!0})),{}):{}),[g,v]=n.useState(!0),m="string"!=typeof o,b=a.length>0&&a.every((e=>e.name&&f[e.name])),y=a.some((e=>e.name&&f[e.name]))&&!b,w=a.length,C=`${a.filter((e=>e?.name&&f[e.name])).length} / ${w}`,j=i?`${i}.`:"",k=u?"Required.":"Optional",S=c?`Error: ${c}.`:"",E=`${m?o.label:o}. ${j} ${k} ${S} `;return t.jsxs(e.Group,{css:ot,"aria-label":E,children:[c?t.jsx("div",{css:lt}):null,t.jsxs("div",{css:(R=!!c,r.css`
|
|
3688
3688
|
margin-left: ${R?"19px":"0px"};
|
|
3689
3689
|
width: 100%;
|
|
3690
3690
|
`),children:[t.jsx("div",{css:it,children:"string"==typeof o?t.jsxs(t.Fragment,{children:[u&&t.jsx("span",{id:"required-symbol","aria-label":"required",children:"*"}),o]}):t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[t.jsxs(Le,{checked:b,indeterminate:y,onCheckedChange:e=>(e=>{const t=a.filter((e=>void 0!==e.name)).reduce(((t,n)=>(t[n.name]=e,t)),{});x(t),l?.(t)})(!!e.checked),children:[o.label," ",!p&&t.jsx("span",{"aria-hidden":"true",css:dt,children:C})]}),!h&&t.jsxs("button",{type:"button",onClick:()=>v((e=>!e)),"aria-expanded":g,"aria-controls":"checkbox-list",css:ut,children:[g?"Hide":"Expand",t.jsx("span",{"aria-hidden":"true",children:g?t.jsx($,{style:{transform:"rotate(180deg)"}}):t.jsx($,{})})]})]})}),t.jsx("p",{css:at,"aria-label":i,children:i}),c?t.jsx("p",{css:ct,"aria-label":c,children:c}):null,t.jsx("div",{id:"checkbox-list",css:st(d,g),children:a.map((e=>t.jsx(Le,{ms:m&&!d?"6":"",css:{},checked:!!e?.name&&!!f[e.name],onCheckedChange:({checked:t})=>((e,t)=>{const n={...f};t&&(n[t]=e,x(n)),l&&l(n)})(t,e.name),...e},e.name)))})]})]});var R},exports.CheckboxOptionCard=({defaultValue:n,items:o,onValueChange:i})=>t.jsx(e.CheckboxGroup,{defaultValue:n,onValueChange:i,children:t.jsx(e.HStack,{alignItems:"flex-start",flexWrap:"wrap",gap:"12px",children:o.map((o=>{return t.jsxs(e.CheckboxCard.Root,{css:Oe,defaultChecked:-1!==n?.indexOf(o.value),disabled:o.disabled,value:o.value,children:[t.jsx(e.CheckboxCard.HiddenInput,{}),t.jsxs(e.CheckboxCard.Control,{css:Te,children:[t.jsxs(e.CheckboxCard.Content,{css:(a=o.variant,r.css`
|
package/dist/index.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ type CheckboxListProps = {
|
|
|
247
247
|
label: CheckboxListLabel;
|
|
248
248
|
caption?: string;
|
|
249
249
|
checkboxes: CheckboxProps[];
|
|
250
|
-
|
|
250
|
+
defaultValues?: string[];
|
|
251
251
|
onCheckedChange?: (checkedValues: {
|
|
252
252
|
[name: string]: boolean;
|
|
253
253
|
}) => void;
|
|
@@ -258,7 +258,7 @@ type CheckboxListProps = {
|
|
|
258
258
|
hideExpandToggle?: boolean;
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
declare const CheckboxList: ({ label, caption, checkboxes,
|
|
261
|
+
declare const CheckboxList: ({ label, caption, checkboxes, defaultValues, onCheckedChange, errorMessage, horizontal, required, hideCheckedCounter, hideExpandToggle, }: CheckboxListProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
262
262
|
|
|
263
263
|
type InputWithUnitsProps = {
|
|
264
264
|
label: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -1052,7 +1052,7 @@ import{createSystem as e,defaultConfig as t,Button as n,Box as r,Spinner as o,Ic
|
|
|
1052
1052
|
> span {
|
|
1053
1053
|
margin-left: 6px;
|
|
1054
1054
|
}
|
|
1055
|
-
`,Sn=({label:e,caption:t,checkboxes:n,
|
|
1055
|
+
`,Sn=({label:e,caption:t,checkboxes:n,defaultValues:r,onCheckedChange:o,errorMessage:i,horizontal:a,required:l,hideCheckedCounter:c=!1,hideExpandToggle:d=!1})=>{const[u,p]=J(r?r.reduce(((e,t)=>({...e,[t]:!0})),{}):{}),[h,f]=J(!0),g="string"!=typeof e,v=n.length>0&&n.every((e=>e.name&&u[e.name])),m=n.some((e=>e.name&&u[e.name]))&&!v,x=n.length,b=`${n.filter((e=>e?.name&&u[e.name])).length} / ${x}`,y=t?`${t}.`:"",w=l?"Required.":"Optional",C=i?`Error: ${i}.`:"",$=`${g?e.label:e}. ${y} ${w} ${C} `;return q(s,{css:mn,"aria-label":$,children:[i?G("div",{css:wn}):null,q("div",{css:(k=!!i,de`
|
|
1056
1056
|
margin-left: ${k?"19px":"0px"};
|
|
1057
1057
|
width: 100%;
|
|
1058
1058
|
`),children:[G("div",{css:xn,children:"string"==typeof e?q(U,{children:[l&&G("span",{id:"required-symbol","aria-label":"required",children:"*"}),e]}):q("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[q(At,{checked:v,indeterminate:m,onCheckedChange:e=>(e=>{const t=n.filter((e=>void 0!==e.name)).reduce(((t,n)=>(t[n.name]=e,t)),{});p(t),o?.(t)})(!!e.checked),children:[e.label," ",!c&&G("span",{"aria-hidden":"true",css:$n,children:b})]}),!d&&q("button",{type:"button",onClick:()=>f((e=>!e)),"aria-expanded":h,"aria-controls":"checkbox-list",css:kn,children:[h?"Hide":"Expand",G("span",{"aria-hidden":"true",children:G(Me,h?{style:{transform:"rotate(180deg)"}}:{})})]})]})}),G("p",{css:bn,"aria-label":t,children:t}),i?G("p",{css:Cn,"aria-label":i,children:i}):null,G("div",{id:"checkbox-list",css:yn(a,h),children:n.map((e=>G(At,{ms:g&&!a?"6":"",css:{},checked:!!e?.name&&!!u[e.name],onCheckedChange:({checked:t})=>((e,t)=>{const n={...u};t&&(n[t]=e,p(n)),o&&o(n)})(t,e.name),...e},e.name)))})]})]});var k},En=de`
|