design-system-silkhaus 3.2.0-beta.dropdown.1 → 3.2.0-beta.dropdown.10
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/{Checkbox-DILK8-Kw.js → Checkbox-BiCYJqNy.js} +138 -142
- package/dist/{Checkbox-D0PLHW4-.cjs → Checkbox-CYnBe4tB.cjs} +6 -6
- package/dist/app/index.d.ts +17 -7
- package/dist/app/index.js +1 -1
- package/dist/index.d.ts +58 -2
- package/dist/index.js +32 -32
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/app/index.d.ts
CHANGED
|
@@ -40,12 +40,7 @@ export declare interface ButtonsGroupSelectorProps extends HTMLAttributes<HTMLDi
|
|
|
40
40
|
startIcon?: default_2.ReactNode;
|
|
41
41
|
endIcon?: default_2.ReactNode;
|
|
42
42
|
}>;
|
|
43
|
-
options: Array<
|
|
44
|
-
label: string;
|
|
45
|
-
value: string;
|
|
46
|
-
startIcon?: default_2.ReactNode;
|
|
47
|
-
endIcon?: default_2.ReactNode;
|
|
48
|
-
}>;
|
|
43
|
+
options: Array<OptionType | Separator>;
|
|
49
44
|
onSelectionChange?: (selected: Array<{
|
|
50
45
|
label: string;
|
|
51
46
|
value: string;
|
|
@@ -99,7 +94,7 @@ export declare interface DropdownProps {
|
|
|
99
94
|
/**
|
|
100
95
|
* Callback when dropdown value is changed
|
|
101
96
|
*/
|
|
102
|
-
onChange?: (selectedOption: DropdownOption) => void;
|
|
97
|
+
onChange?: (selectedOption: DropdownOption | DropdownOption[]) => void;
|
|
103
98
|
/**
|
|
104
99
|
* Pass this callback function if you want to override the default selected value display text.
|
|
105
100
|
* By default the dropdown will display the label from the selected option
|
|
@@ -129,10 +124,12 @@ export declare interface DropdownProps {
|
|
|
129
124
|
disabled?: boolean;
|
|
130
125
|
/**
|
|
131
126
|
* Adjust the height of the dropdown popover to fit the content in viewport
|
|
127
|
+
* @default true
|
|
132
128
|
*/
|
|
133
129
|
adjustHeight?: boolean | number;
|
|
134
130
|
/**
|
|
135
131
|
* Adjust the width of the dropdown popover to fit the content in viewport
|
|
132
|
+
* @default true
|
|
136
133
|
*/
|
|
137
134
|
adjustWidth?: boolean;
|
|
138
135
|
/**
|
|
@@ -146,4 +143,17 @@ export declare const findOptionByValue: (value: string | string[] | undefined, o
|
|
|
146
143
|
|
|
147
144
|
export declare const MobileDropdown: FC<PropsWithChildren<DropdownProps>>;
|
|
148
145
|
|
|
146
|
+
declare type OptionType = {
|
|
147
|
+
type?: 'option';
|
|
148
|
+
label: string;
|
|
149
|
+
value: string;
|
|
150
|
+
startIcon?: default_2.ReactNode;
|
|
151
|
+
endIcon?: default_2.ReactNode;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
declare type Separator = {
|
|
155
|
+
type: 'separator';
|
|
156
|
+
component?: default_2.ReactNode;
|
|
157
|
+
};
|
|
158
|
+
|
|
149
159
|
export { }
|
package/dist/app/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=Object.defineProperty,Z=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var W=(e,t,d)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[t]=d,w=(e,t)=>{for(var d in t||(t={}))P.call(t,d)&&W(e,d,t[d]);if(z)for(var d of z(t))T.call(t,d)&&W(e,d,t[d]);return e},F=(e,t)=>Z(e,O(t));var A=(e,t)=>{var d={};for(var r in e)P.call(e,r)&&t.indexOf(r)<0&&(d[r]=e[r]);if(e!=null&&z)for(var r of z(e))t.indexOf(r)<0&&T.call(e,r)&&(d[r]=e[r]);return d};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Checkbox-D0PLHW4-.cjs"),f=require("react"),U=({children:e,size:t="small"})=>s.jsxRuntimeExports.jsx("div",{className:`ds-flex ds-items-center ds-justify-center ${t==="small"?"ds-h-5 ds-w-5":"ds-h-6 ds-w-6"}`,children:e}),ss={primary:"ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-rounded-sm hover:ds-text-Text-textPrimaryDark hover:ds-bg-Background-accentEggplant-highlight hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-Background-accentEggplant-darkened focus:ds-bg-Background-accentEggplant-100 focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:focus:ds-shadow-none disabled:ds-bg-Background-accentEggplant-20 ds-text-mediumFootnoteEmphasized",secondary:"ds-text-black ds-rounded-sm ds-border ds-border-Fills-terciary hover:ds-bg-[#F6F8FC] hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-[#F6F8FC] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] focus:ds-bg-[#F6F8FC] focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:ds-border disabled:ds-border-Fills-terciary disabled:ds-text-Text-tertiary disabled:ds-bg-transparent ds-text-mediumFootnoteEmphasized"},es={primary:"ds-rounded-sm ds-border ds-text-black ds-border-Fills-terciary ds-bg-[#F6F8FC] ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized",secondary:"ds-rounded-sm ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized"},D=f.forwardRef((E,y)=>{var l=E,{color:e="primary",disabled:t=!1,className:d,children:r,startIcon:n,selected:p,endIcon:x,trackingId:i,helperText:j,helpterTextClassName:R,buttonClassName:h}=l,c=A(l,["color","disabled","className","children","startIcon","selected","endIcon","trackingId","helperText","helpterTextClassName","buttonClassName"]);return s.jsxRuntimeExports.jsxs("div",{className:s.cn("ds-flex ds-flex-col ds-gap-1",d),children:[s.jsxRuntimeExports.jsxs("button",F(w({"data-tracking-id":i,ref:y,disabled:t,className:s.twMerge(s.clsx({[es[e]]:p,[ss[e]]:!p},"ds-px-2 ds-py-1","ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center",h))},c),{children:[n&&s.jsxRuntimeExports.jsx(U,{children:n}),r&&s.jsxRuntimeExports.jsx("div",{className:`${n?"ds-ml-1":""} ${x?"ds-mr-1":""}`,children:r}),x&&s.jsxRuntimeExports.jsx(U,{children:x})]})),j&&s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-w-full ds-text-right ds-text-mediumFootnoteRegular",R),children:j})]})});D.displayName="Button";const $=f.forwardRef((e,t)=>{const C=e,{value:d,options:r,onSelectionChange:n=()=>{},isMultiSelect:p,noDataError:x,buttonMinWidth:i,buttonWidth:j,minSelectionError:R,buttonsContainerClassName:h,buttonClassName:c}=C,y=A(C,["value","options","onSelectionChange","isMultiSelect","noDataError","buttonMinWidth","buttonWidth","minSelectionError","buttonsContainerClassName","buttonClassName"]),[E,l]=f.useState([]),[b,u]=f.useState("");f.useEffect(()=>{d&&d.length?l(d):l([])},[d]);const g=(a,o)=>{o.currentTarget.blur();const m=[...E],B=m.findIndex(I=>I.value===a.value);B!==-1?m.length>1?(m.splice(B,1),u("")):u(R):(m.push(a),u("")),l(m),n(m)},k=(a,o)=>{o.currentTarget.blur();const m=[a];l(m),n(m)};return s.jsxRuntimeExports.jsxs("div",F(w({ref:t},y),{children:[s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-flex ds-flex-wrap ds-gap-2",h),children:r.length>0?r.map(a=>s.jsxRuntimeExports.jsx(f.Fragment,{children:p?s.jsxRuntimeExports.jsx(D,{selected:E.some(o=>o.value===a.value),onClick:o=>g(a,o),color:"secondary",style:{minWidth:i,width:j},className:c,startIcon:a.startIcon,endIcon:a.endIcon,children:a.label}):s.jsxRuntimeExports.jsx(D,{selected:E.some(o=>o.value===a.value),onClick:o=>k(a,o),color:"secondary",style:{minWidth:i,width:j},className:c,startIcon:a.startIcon,endIcon:a.endIcon,children:a.label})},a.value)):s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:x})}),b&&s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:b})]}))});$.displayName="ButtonsGroupSelector";const G=e=>window.innerWidth<s.tabletMinWidth?s.jsxRuntimeExports.jsx(V,w({},e)):s.jsxRuntimeExports.jsx(M,w({},e));G.displayName="Dropdown";const M=({placement:e="bottom-start",trigger:t,triggerContainerClassName:d,disabled:r,onOpenChange:n,adjustHeight:p,adjustWidth:x,options:i,getSelectedValueDisplayText:j=K,placeholder:R,value:h,isMultiSelect:c})=>{const[y,E]=f.useState(),l=typeof h=="undefined"?y:h,b=typeof h=="undefined"?E:()=>{},[u,g]=f.useState(!1),{refs:k,floatingStyles:C,context:a}=s.useFloating({open:u,onOpenChange:v=>{g(v),n&&n(v)},middleware:[s.offset(8),s.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end"}),s.shift({padding:4}),s.size({apply({availableWidth:v,availableHeight:N,elements:_}){p&&(_.floating.style.maxHeight=`${N-4}px`),x&&(_.floating.style.maxWidth=`${v-4}px`)}})],whileElementsMounted:s.autoUpdate,placement:e}),o=s.useClick(a),m=s.useFocus(a),B=s.useDismiss(a),I=s.useRole(a),{getReferenceProps:L,getFloatingProps:Q}=s.useInteractions([o,m,B,I]);return t||(t=s.jsxRuntimeExports.jsx(H,{selectedOption:S(l,i),getSelectedValueDisplayText:j,placeholder:R})),r?s.jsxRuntimeExports.jsx("div",{className:d,children:t}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",F(w({className:s.cn("ds-cursor-pointer",d),ref:k.setReference},L()),{children:t})),u&&s.jsxRuntimeExports.jsx(s.FloatingPortal,{children:s.jsxRuntimeExports.jsx("div",F(w({ref:k.setFloating,style:C},Q()),{className:s.cn("ds-z-[29999] ds-flex ds-min-w-[200px] ds-flex-col ds-gap-1 ds-rounded ds-bg-white ds-p-2 ds-shadow-md"),children:s.jsxRuntimeExports.jsx(J,{isMultiSelect:c,options:i,onOptionClick:v=>{let N;if(c){const _=l||[];_.includes(v.value)?N=_.filter(X=>X!==v.value):N=[..._,v.value]}else N=v.value,g(!1);b(N)},selectedOption:S(l,i)})}))})]})};M.displayName="DesktopDropdown";const V=({trigger:e,triggerContainerClassName:t,disabled:d,onOpenChange:r,getSelectedValueDisplayText:n=K,placeholder:p,value:x,options:i,isMultiSelect:j})=>{const[R,h]=f.useState(),c=typeof x=="undefined"?R:x,y=typeof x=="undefined"?h:()=>{},[E,l]=f.useState(!1);return e||(e=s.jsxRuntimeExports.jsx(H,{selectedOption:S(c,i),getSelectedValueDisplayText:n,placeholder:p})),d?s.jsxRuntimeExports.jsx("div",{className:t,children:e}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:t,onClick:()=>{l(!0),r&&r(!0)},children:e}),s.jsxRuntimeExports.jsx(s.AnimatedModal,{animation:"slideUp",show:E,handleClose:()=>{l(!1),r&&r(!1)},contentClassName:s.cn("ds-absolute ds-mb-0 ds-w-full"),className:"ds-z-[29999]",children:s.jsxRuntimeExports.jsx(q,{onClose:()=>{l(!1),r&&r(!1)},children:s.jsxRuntimeExports.jsx(J,{isMultiSelect:j,options:i,onOptionClick:b=>{let u;if(j){const g=c||[];g.includes(b.value)?u=g.filter(k=>k!==b.value):u=[...g,b.value]}else u=b.value,l(!1);y(u)},selectedOption:S(c,i)})})})]})};V.displayName="MobileDropdown";const q=({onClose:e,children:t})=>s.jsxRuntimeExports.jsxs("div",{className:"ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white",children:[s.jsxRuntimeExports.jsxs("div",{className:"ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4",children:[s.jsxRuntimeExports.jsx("div",{onClick:e,className:"ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",children:s.jsxRuntimeExports.jsx(s.CloseIcon,{className:"ds-size-4"})}),s.jsxRuntimeExports.jsx("div",{className:"ds-size-5"})]}),s.jsxRuntimeExports.jsx("div",{className:"ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular",children:t}),s.jsxRuntimeExports.jsx("div",{className:"ds-px-8 ds-py-4",children:s.jsxRuntimeExports.jsx(s.Button,{onClick:e,children:"Close"})})]});q.displayName="MobilePopoverContentWrapper";const H=({selectedOption:e,getSelectedValueDisplayText:t,placeholder:d})=>{const r=!e||Array.isArray(e)&&e.length===0?d||"":t(e);return s.jsxRuntimeExports.jsx(D,{color:"secondary",endIcon:s.jsxRuntimeExports.jsx(s.ChevronDownRegularIcon,{className:"ds-size-4"}),buttonClassName:"ds-justify-between",children:r})},J=({options:e,onOptionClick:t,isMultiSelect:d,selectedOption:r})=>e&&e.map(n=>s.jsxRuntimeExports.jsx(ts,{onClick:()=>t(n),option:n,isSelected:Array.isArray(r)?r.some(p=>p.value===n.value):(r==null?void 0:r.value)===n.value,showCheckbox:d},n.value)),ts=({onClick:e,option:t,isSelected:d,showCheckbox:r})=>s.jsxRuntimeExports.jsxs("div",{onClick:t.disabled?void 0:e,className:s.cn("ds-flex ds-min-h-[72px] ds-transform ds-cursor-pointer ds-items-center ds-gap-4 ds-rounded ds-px-4 ds-py-2 ds-text-smallFootnoteEmphasized hover:ds-bg-[#F6F8FC] ds-tablet:ds-gap-2 ds-tablet:ds-px-2 ds-desktop:ds-text-mediumFootnoteEmphasized",!r&&"ds-transform ds-transition-all ds-duration-300 hover:ds-px-4"),children:[t.thumbnailUrl&&s.jsxRuntimeExports.jsx("img",{src:t.thumbnailUrl,className:"ds-h-14 ds-w-14 ds-shrink-0 ds-rounded ds-object-cover ds-tablet:ds-h-6 ds-tablet:ds-w-9 ds-tablet:ds-rounded-sm"}),t.icon,s.jsxRuntimeExports.jsx("div",{className:"ds-flex-grow",children:t.label}),d&&!r&&s.jsxRuntimeExports.jsx(s.CheckmarkIcon,{className:"ds-size-4 ds-shrink-0"}),r&&s.jsxRuntimeExports.jsx(s.Checkbox,{isChecked:d,disabled:t.disabled})]}),S=(e,t)=>Array.isArray(e)?t.filter(d=>e.includes(d.value)):t.find(d=>d.value===e),K=e=>Array.isArray(e)?e.map(t=>t.label).join(", "):e.label;exports.Button=D;exports.ButtonsGroupSelector=$;exports.DesktopDropdown=M;exports.Dropdown=G;exports.MobileDropdown=V;exports.findOptionByValue=S;
|
|
1
|
+
"use strict";var X=Object.defineProperty,Y=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var P=(e,t,d)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[t]=d,y=(e,t)=>{for(var d in t||(t={}))V.call(t,d)&&P(e,d,t[d]);if(S)for(var d of S(t))W.call(t,d)&&P(e,d,t[d]);return e},w=(e,t)=>Y(e,Z(t));var z=(e,t)=>{var d={};for(var r in e)V.call(e,r)&&t.indexOf(r)<0&&(d[r]=e[r]);if(e!=null&&S)for(var r of S(e))t.indexOf(r)<0&&W.call(e,r)&&(d[r]=e[r]);return d};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Checkbox-CYnBe4tB.cjs"),m=require("react"),T=({children:e,size:t="small"})=>s.jsxRuntimeExports.jsx("div",{className:`ds-flex ds-items-center ds-justify-center ${t==="small"?"ds-h-5 ds-w-5":"ds-h-6 ds-w-6"}`,children:e}),ss={primary:"ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-rounded-sm hover:ds-text-Text-textPrimaryDark hover:ds-bg-Background-accentEggplant-highlight hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-Background-accentEggplant-darkened focus:ds-bg-Background-accentEggplant-100 focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:focus:ds-shadow-none disabled:ds-bg-Background-accentEggplant-20 ds-text-mediumFootnoteEmphasized",secondary:"ds-text-black ds-rounded-sm ds-border ds-border-Fills-terciary hover:ds-bg-[#F6F8FC] hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-[#F6F8FC] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] focus:ds-bg-[#F6F8FC] focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:ds-border disabled:ds-border-Fills-terciary disabled:ds-text-Text-tertiary disabled:ds-bg-transparent ds-text-mediumFootnoteEmphasized"},es={primary:"ds-rounded-sm ds-border ds-text-black ds-border-Fills-terciary ds-bg-[#F6F8FC] ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized",secondary:"ds-rounded-sm ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized"},N=m.forwardRef((g,E)=>{var u=g,{color:e="primary",disabled:t=!1,className:d,children:r,startIcon:i,selected:c,endIcon:a,trackingId:o,helperText:x,helpterTextClassName:f,buttonClassName:h}=u,b=z(u,["color","disabled","className","children","startIcon","selected","endIcon","trackingId","helperText","helpterTextClassName","buttonClassName"]);return s.jsxRuntimeExports.jsxs("div",{className:s.cn("ds-flex ds-flex-col ds-gap-1",d),children:[s.jsxRuntimeExports.jsxs("button",w(y({"data-tracking-id":o,ref:E,disabled:t,className:s.twMerge(s.clsx({[es[e]]:c,[ss[e]]:!c},"ds-px-2 ds-py-1","ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center",h))},b),{children:[i&&s.jsxRuntimeExports.jsx(T,{children:i}),r&&s.jsxRuntimeExports.jsx("div",{className:`${i?"ds-ml-1":""} ${a?"ds-mr-1":""}`,children:r}),a&&s.jsxRuntimeExports.jsx(T,{children:a})]})),x&&s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-w-full ds-text-right ds-text-mediumFootnoteRegular",f),children:x})]})});N.displayName="Button";const U=m.forwardRef((e,t)=>{const v=e,{value:d,options:r,onSelectionChange:i=()=>{},isMultiSelect:c,noDataError:a,buttonMinWidth:o,buttonWidth:x,minSelectionError:f,buttonsContainerClassName:h,buttonClassName:b}=v,E=z(v,["value","options","onSelectionChange","isMultiSelect","noDataError","buttonMinWidth","buttonWidth","minSelectionError","buttonsContainerClassName","buttonClassName"]),[g,u]=m.useState([]),[p,R]=m.useState("");m.useEffect(()=>{d&&d.length?u(d):u([])},[d]);const F=(n,j)=>{j.currentTarget.blur();const l=[...g],_=l.findIndex(B=>B.value===n.value);_!==-1?l.length>1?(l.splice(_,1),R("")):R(f):(l.push(n),R("")),u(l),i(l)},k=(n,j)=>{j.currentTarget.blur();const l=[n];u(l),i(l)};return s.jsxRuntimeExports.jsxs("div",w(y({ref:t},E),{children:[s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-flex ds-flex-wrap ds-items-center ds-gap-2",h),children:r.length>0?r.map((n,j)=>n.type==="separator"?n.component?s.jsxRuntimeExports.jsx(m.Fragment,{children:n.component},`separator-${j}`):s.jsxRuntimeExports.jsx("div",{className:"ds-h-full ds-min-h-[30px] ds-w-[1px] ds-bg-Fills-terciary"}):s.jsxRuntimeExports.jsx(m.Fragment,{children:c?s.jsxRuntimeExports.jsx(N,{selected:g.some(l=>l.value===n.value),onClick:l=>F(n,l),color:"secondary",style:{minWidth:o,width:x},className:b,startIcon:n.startIcon,endIcon:n.endIcon,children:n.label}):s.jsxRuntimeExports.jsx(N,{selected:g.some(l=>l.value===n.value),onClick:l=>k(n,l),color:"secondary",style:{minWidth:o,width:x},className:b,startIcon:n.startIcon,endIcon:n.endIcon,children:n.label})},n.value)):s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:a})}),p&&s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:p})]}))});U.displayName="ButtonsGroupSelector";const $=e=>window.innerWidth<s.tabletMinWidth?s.jsxRuntimeExports.jsx(M,y({},e)):s.jsxRuntimeExports.jsx(I,y({},e));$.displayName="Dropdown";const I=({placement:e="bottom-start",trigger:t,triggerContainerClassName:d,disabled:r,onOpenChange:i,adjustHeight:c=!0,adjustWidth:a=!0,options:o,getSelectedValueDisplayText:x=J,placeholder:f,value:h,isMultiSelect:b,onChange:E})=>{const[g,u]=m.useState(),p=typeof h=="undefined"?g:h,R=typeof h=="undefined"?u:()=>{},[F,k]=m.useState(!1),{refs:v,floatingStyles:n,context:j}=s.useFloating({open:F,onOpenChange:D=>{k(D),i&&i(D)},middleware:[s.offset(8),s.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end"}),s.shift({padding:4}),s.size({apply({availableWidth:D,availableHeight:Q,elements:A}){c&&(A.floating.style.maxHeight=`${Q-4}px`),a&&(A.floating.style.maxWidth=`${D-4}px`)}})],whileElementsMounted:s.autoUpdate,placement:e}),l=s.useClick(j),_=s.useFocus(j),B=s.useDismiss(j),K=s.useRole(j),{getReferenceProps:L,getFloatingProps:O}=s.useInteractions([l,_,B,K]);return t||(t=s.jsxRuntimeExports.jsx(q,{selectedOption:C(p,o),getSelectedValueDisplayText:x,placeholder:f})),r?s.jsxRuntimeExports.jsx("div",{className:d,children:t}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",w(y({className:s.cn("ds-cursor-pointer",d),ref:v.setReference},L()),{children:t})),F&&s.jsxRuntimeExports.jsx(s.FloatingPortal,{children:s.jsxRuntimeExports.jsx("div",w(y({ref:v.setFloating,style:n},O()),{className:s.cn("ds-z-[29999] ds-flex ds-min-w-[200px] ds-flex-col ds-gap-1 ds-rounded ds-bg-white ds-p-2 ds-shadow-md",c&&"ds-overflow-y-auto",a&&"ds-overflow-x-auto"),children:s.jsxRuntimeExports.jsx(H,{isMultiSelect:b,options:o,value:p,setValue:R,setIsOpen:k,onChange:E})}))})]})};I.displayName="DesktopDropdown";const M=({trigger:e,triggerContainerClassName:t,disabled:d,onOpenChange:r,getSelectedValueDisplayText:i=J,placeholder:c,value:a,options:o,isMultiSelect:x,onChange:f})=>{const[h,b]=m.useState(),E=typeof a=="undefined"?h:a,g=typeof a=="undefined"?b:()=>{},[u,p]=m.useState(!1);return e||(e=s.jsxRuntimeExports.jsx(q,{selectedOption:C(E,o),getSelectedValueDisplayText:i,placeholder:c})),d?s.jsxRuntimeExports.jsx("div",{className:t,children:e}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:t,onClick:()=>{p(!0),r&&r(!0)},children:e}),s.jsxRuntimeExports.jsx(s.AnimatedModal,{animation:"slideUp",show:u,handleClose:()=>{p(!1),r&&r(!1)},contentClassName:s.cn("ds-absolute ds-mb-0 ds-w-full"),className:"ds-z-[29999]",children:s.jsxRuntimeExports.jsx(G,{onClose:()=>{p(!1),r&&r(!1)},children:s.jsxRuntimeExports.jsx(H,{isMultiSelect:x,options:o,value:E,setValue:g,setIsOpen:p,onChange:f})})})]})};M.displayName="MobileDropdown";const G=({onClose:e,children:t})=>s.jsxRuntimeExports.jsxs("div",{className:"ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white",children:[s.jsxRuntimeExports.jsxs("div",{className:"ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4",children:[s.jsxRuntimeExports.jsx("div",{onClick:e,className:"ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",children:s.jsxRuntimeExports.jsx(s.CloseIcon,{className:"ds-size-4"})}),s.jsxRuntimeExports.jsx("div",{className:"ds-size-5"})]}),s.jsxRuntimeExports.jsx("div",{className:"ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular",children:t}),s.jsxRuntimeExports.jsx("div",{className:"ds-px-8 ds-py-4",children:s.jsxRuntimeExports.jsx(s.Button,{buttonClassName:"ds-py-3",onClick:e,children:"Close"})})]});G.displayName="MobilePopoverContentWrapper";const q=({selectedOption:e,getSelectedValueDisplayText:t,placeholder:d})=>{const r=!e||Array.isArray(e)&&e.length===0?d||"":t(e);return s.jsxRuntimeExports.jsx(N,{color:"secondary",endIcon:s.jsxRuntimeExports.jsx(s.ChevronDownRegularIcon,{className:"ds-size-4"}),buttonClassName:"ds-justify-between",children:r})},H=({options:e,isMultiSelect:t,value:d,setValue:r,setIsOpen:i,onChange:c})=>e&&e.map(a=>s.jsxRuntimeExports.jsx(ts,{onClick:()=>{let o;if(t){const x=d||[];x.includes(a.value)?o=x.filter(f=>f!==a.value):o=[...x,a.value]}else o=a.value,i(!1);r(o),c&&c(C(o,e))},option:a,isSelected:Array.isArray(d)?d.some(o=>o===a.value):d===a.value,showCheckbox:t},a.value)),ts=({onClick:e,option:t,isSelected:d,showCheckbox:r})=>s.jsxRuntimeExports.jsxs("div",{onClick:t.disabled?void 0:e,className:s.cn("ds-flex ds-min-h-[72px] ds-transform ds-cursor-pointer ds-items-center ds-gap-4 ds-rounded ds-px-4 ds-py-2 ds-text-smallFootnoteEmphasized hover:ds-bg-[#F6F8FC] ds-tablet:ds-min-h-[auto] ds-tablet:ds-gap-2 ds-tablet:ds-px-2 ds-desktop:ds-text-mediumFootnoteEmphasized",!r&&"ds-transform ds-transition-all ds-duration-300 hover:ds-px-4"),children:[t.thumbnailUrl&&s.jsxRuntimeExports.jsx("img",{src:t.thumbnailUrl,className:"ds-h-14 ds-w-14 ds-shrink-0 ds-rounded ds-object-cover ds-tablet:ds-h-6 ds-tablet:ds-w-9 ds-tablet:ds-rounded-sm"}),t.icon,s.jsxRuntimeExports.jsx("div",{className:"ds-flex-grow",children:t.label}),d&&!r&&s.jsxRuntimeExports.jsx(s.CheckmarkIcon,{className:"ds-size-4 ds-shrink-0"}),r&&s.jsxRuntimeExports.jsx(s.Checkbox,{isChecked:d,disabled:t.disabled})]}),C=(e,t)=>Array.isArray(e)?t.filter(d=>e.includes(d.value)):t.find(d=>d.value===e),J=e=>Array.isArray(e)?e.map(t=>t.label).join(", "):e.label;exports.Button=N;exports.ButtonsGroupSelector=U;exports.DesktopDropdown=I;exports.Dropdown=$;exports.MobileDropdown=M;exports.findOptionByValue=C;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { CalendarDayShape } from 'react-dates';
|
|
|
2
2
|
import { ClassProp } from 'class-variance-authority/types';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
import { default as default_2 } from 'react';
|
|
5
|
+
import { ElementType } from 'react';
|
|
5
6
|
import { FC } from 'react';
|
|
6
7
|
import { ForwardRefExoticComponent } from 'react';
|
|
7
8
|
import { HTMLAttributes } from 'react';
|
|
9
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
8
10
|
import { LazyLoadTypes } from 'react-slick';
|
|
9
11
|
import { ModifiersShape } from 'react-dates';
|
|
10
12
|
import { Moment } from 'moment';
|
|
@@ -104,6 +106,10 @@ export declare const ArrowRightIcon: FC<{
|
|
|
104
106
|
className?: string;
|
|
105
107
|
}>;
|
|
106
108
|
|
|
109
|
+
export declare const ArrowTopRightIcon: FC<{
|
|
110
|
+
className?: string;
|
|
111
|
+
}>;
|
|
112
|
+
|
|
107
113
|
export declare const ArrowUndoIcon: FC<{
|
|
108
114
|
className?: string;
|
|
109
115
|
}>;
|
|
@@ -170,6 +176,14 @@ export declare interface BookingQuoteLineItemType {
|
|
|
170
176
|
description?: string;
|
|
171
177
|
}
|
|
172
178
|
|
|
179
|
+
export declare const BoxCheckIcon: FC<{
|
|
180
|
+
className?: string;
|
|
181
|
+
}>;
|
|
182
|
+
|
|
183
|
+
export declare const BoxLineGraphUpIcon: FC<{
|
|
184
|
+
className?: string;
|
|
185
|
+
}>;
|
|
186
|
+
|
|
173
187
|
export declare const BuildingIcon: FC<{
|
|
174
188
|
className?: string;
|
|
175
189
|
}>;
|
|
@@ -241,6 +255,10 @@ export declare const CalendarIcon: FC<{
|
|
|
241
255
|
className?: string;
|
|
242
256
|
}>;
|
|
243
257
|
|
|
258
|
+
export declare const CalendarPlusIcon: FC<{
|
|
259
|
+
className?: string;
|
|
260
|
+
}>;
|
|
261
|
+
|
|
244
262
|
export declare const Card: React_2.ForwardRefExoticComponent<CardProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
245
263
|
|
|
246
264
|
export declare const CardContent: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -264,15 +282,19 @@ declare const cardVariants: (props?: ({
|
|
|
264
282
|
cardType?: "default" | "shadowCard" | null | undefined;
|
|
265
283
|
} & ClassProp) | undefined) => string;
|
|
266
284
|
|
|
285
|
+
export declare const ChairIcon: FC<{
|
|
286
|
+
className?: string;
|
|
287
|
+
}>;
|
|
288
|
+
|
|
267
289
|
export declare const Checkbox: default_2.ForwardRefExoticComponent<CheckboxProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
268
290
|
|
|
269
291
|
export declare interface CheckboxProps extends HTMLAttributes<HTMLInputElement> {
|
|
270
292
|
isChecked: boolean;
|
|
271
293
|
onSelectionChange?: () => void;
|
|
272
|
-
label?:
|
|
273
|
-
onClick?: (e: default_2.MouseEvent) => void;
|
|
294
|
+
label?: default_2.ReactNode;
|
|
274
295
|
disabled?: boolean;
|
|
275
296
|
className?: string;
|
|
297
|
+
labelPosition?: 'left' | 'right';
|
|
276
298
|
}
|
|
277
299
|
|
|
278
300
|
export declare const CheckmarkCircleIcon: FC<{
|
|
@@ -309,6 +331,24 @@ export declare const CloseIcon: FC<{
|
|
|
309
331
|
|
|
310
332
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
311
333
|
|
|
334
|
+
/**
|
|
335
|
+
* A wrapper component that follows design system's margins on pages for different screen sizes
|
|
336
|
+
*/
|
|
337
|
+
export declare const Container: <T extends ElementType = "div">({ as, children, className, dataTestId, ...rest }: ContainerProps<T>) => JSX_2.Element;
|
|
338
|
+
|
|
339
|
+
export declare type ContainerProps<T extends ElementType = 'div'> = React.PropsWithChildren<{
|
|
340
|
+
/**
|
|
341
|
+
* Element type to render as
|
|
342
|
+
* @default 'div'
|
|
343
|
+
*/
|
|
344
|
+
as?: T;
|
|
345
|
+
dataTestId?: string;
|
|
346
|
+
}> & React.ComponentPropsWithoutRef<T>;
|
|
347
|
+
|
|
348
|
+
export declare const ContractIcon: FC<{
|
|
349
|
+
className?: string;
|
|
350
|
+
}>;
|
|
351
|
+
|
|
312
352
|
export declare const DashboardIcon: FC<{
|
|
313
353
|
className?: string;
|
|
314
354
|
}>;
|
|
@@ -518,6 +558,10 @@ export declare const HandCursorTapIcon: FC<{
|
|
|
518
558
|
className?: string;
|
|
519
559
|
}>;
|
|
520
560
|
|
|
561
|
+
export declare const HeadsetIcon: FC<{
|
|
562
|
+
className?: string;
|
|
563
|
+
}>;
|
|
564
|
+
|
|
521
565
|
export declare const HelperText: FC<HelperTextProps>;
|
|
522
566
|
|
|
523
567
|
export declare interface HelperTextProps {
|
|
@@ -771,6 +815,10 @@ declare interface Option_2 {
|
|
|
771
815
|
}
|
|
772
816
|
export { Option_2 as Option }
|
|
773
817
|
|
|
818
|
+
export declare const PartnerIcon: FC<{
|
|
819
|
+
className?: string;
|
|
820
|
+
}>;
|
|
821
|
+
|
|
774
822
|
export declare const PartyPopperIcon: FC<{
|
|
775
823
|
className?: string;
|
|
776
824
|
}>;
|
|
@@ -963,6 +1011,10 @@ export declare const PreviewIcon: FC<{
|
|
|
963
1011
|
className?: string;
|
|
964
1012
|
}>;
|
|
965
1013
|
|
|
1014
|
+
export declare const PriceCheckIcon: FC<{
|
|
1015
|
+
className?: string;
|
|
1016
|
+
}>;
|
|
1017
|
+
|
|
966
1018
|
export declare const PriceRangeSlider: default_2.FC<PriceRangeSliderProps>;
|
|
967
1019
|
|
|
968
1020
|
export declare interface PriceRangeSliderProps {
|
|
@@ -1373,6 +1425,10 @@ export declare interface TopNavContainerMobileProps extends HTMLAttributes<HTMLD
|
|
|
1373
1425
|
buttonText: string;
|
|
1374
1426
|
}
|
|
1375
1427
|
|
|
1428
|
+
export declare const TowerBuildingIcon: FC<{
|
|
1429
|
+
className?: string;
|
|
1430
|
+
}>;
|
|
1431
|
+
|
|
1376
1432
|
export declare const TowersIcon: FC<{
|
|
1377
1433
|
className?: string;
|
|
1378
1434
|
}>;
|