@czi-sds/components 22.7.0 → 22.9.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.d.ts +4 -0
- package/dist/index.cjs.js +20 -14
- package/dist/index.esm.d.ts +4 -0
- package/dist/index.esm.js +20 -14
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.cjs.d.ts
CHANGED
|
@@ -1079,6 +1079,7 @@ interface StyleProps$1 extends CommonThemeProps {
|
|
|
1079
1079
|
count?: number;
|
|
1080
1080
|
icon?: ReactElement;
|
|
1081
1081
|
search?: boolean;
|
|
1082
|
+
isSearchAutoFocus?: boolean;
|
|
1082
1083
|
title?: string;
|
|
1083
1084
|
isMultiColumn?: boolean;
|
|
1084
1085
|
}
|
|
@@ -1322,6 +1323,7 @@ interface ExtraDropdownProps<T, Multiple extends boolean | undefined, DisableCle
|
|
|
1322
1323
|
label: ReactNode;
|
|
1323
1324
|
options: AutocompleteSingleColumnOption<T>[] | AutocompleteMultiColumnOption<T, Multiple, DisableClearable, FreeSolo>[];
|
|
1324
1325
|
search?: boolean;
|
|
1326
|
+
isSearchAutoFocus?: boolean;
|
|
1325
1327
|
DropdownMenuProps?: Partial<SdsDropdownMenuProps<T, Multiple, DisableClearable, FreeSolo>>;
|
|
1326
1328
|
InputDropdownProps?: Partial<InputDropdownPropsType$0>;
|
|
1327
1329
|
value?: AutocompleteValue$1<T, Multiple, DisableClearable, FreeSolo>;
|
|
@@ -1694,6 +1696,7 @@ interface BasicPanelProps extends Omit<DrawerProps, "variant"> {
|
|
|
1694
1696
|
sdsType: "basic"; // Discriminator
|
|
1695
1697
|
position?: "left" | "right";
|
|
1696
1698
|
width?: number | string;
|
|
1699
|
+
isBackdropClickEnabled?: boolean;
|
|
1697
1700
|
}
|
|
1698
1701
|
interface OverlayPanelProps extends Omit<DrawerProps, "variant"> {
|
|
1699
1702
|
sdsType: "overlay"; // Discriminator
|
|
@@ -1702,6 +1705,7 @@ interface OverlayPanelProps extends Omit<DrawerProps, "variant"> {
|
|
|
1702
1705
|
HeaderComponent?: React.ReactNode;
|
|
1703
1706
|
closeButtonOnClick?: PanelHeaderCloseProps["onClick"];
|
|
1704
1707
|
CloseButtonComponent?: PanelHeaderCloseProps["CloseButtonComponent"];
|
|
1708
|
+
isBackdropClickEnabled?: boolean;
|
|
1705
1709
|
}
|
|
1706
1710
|
// Discriminated Union
|
|
1707
1711
|
type PanelProps = BasicPanelProps | OverlayPanelProps;
|
package/dist/index.cjs.js
CHANGED
|
@@ -6405,7 +6405,7 @@ var StyledPaper$1 = styled__default.default(material.Paper, {
|
|
|
6405
6405
|
var borders = getBorders(props);
|
|
6406
6406
|
var shadows = getShadows(props);
|
|
6407
6407
|
var semanticColors = getSemanticColors(props);
|
|
6408
|
-
return "\n box-shadow: ".concat(shadows === null || shadows === void 0 ? void 0 : shadows.none, " !important;\n border: ").concat(borders === null || borders === void 0 ? void 0 : borders.none, ";\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.surface, ";\n background-image: none;\n margin: 0;\n padding: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxs, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n .MuiAutocomplete-root,\n .MuiFormControl-root.MuiTextField-root {\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n }\n\n // (masoudmanson): Remove margin-right and margin-bottom for the single column autocomplete\n // as it has been added to the parent container\n .MuiAutocomplete-root .MuiFormControl-root.MuiTextField-root {\n margin-right: 0;\n margin-bottom: 0
|
|
6408
|
+
return "\n box-shadow: ".concat(shadows === null || shadows === void 0 ? void 0 : shadows.none, " !important;\n border: ").concat(borders === null || borders === void 0 ? void 0 : borders.none, ";\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.surface, ";\n background-image: none;\n margin: 0;\n padding: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxs, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n .MuiAutocomplete-root,\n .MuiFormControl-root.MuiTextField-root {\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n }\n\n // (masoudmanson): Remove margin-right and margin-bottom for the single column autocomplete\n // as it has been added to the parent container\n .MuiAutocomplete-root .MuiFormControl-root.MuiTextField-root {\n margin-right: 0;\n margin-bottom: 0;\n }\n ");
|
|
6409
6409
|
});
|
|
6410
6410
|
var StyledDropdownMenuHeader = styled__default.default("div")(templateObject_5$f || (templateObject_5$f = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
6411
6411
|
var search = props.search;
|
|
@@ -6423,7 +6423,7 @@ var DEFAULT_POPPER_BASE_PROPS = {
|
|
|
6423
6423
|
var DropdownMenu = function (props) {
|
|
6424
6424
|
var _a, _b;
|
|
6425
6425
|
var theme = material.useTheme();
|
|
6426
|
-
var anchorEl = props.anchorEl, id = props.id, InputBaseProps = props.InputBaseProps, _c = props.open, open = _c === void 0 ? false : _c, _d = props.PopperComponent, PopperComponent = _d === void 0 ? StyledPopper : _d, _e = props.PaperComponent, PaperComponent = _e === void 0 ? StyledPaper$1 : _e, _f = props.PopperPlacement, PopperPlacement = _f === void 0 ? "bottom-start" : _f, _g = props.PopperBaseProps, PopperBaseProps = _g === void 0 ? {} : _g, _h = props.search, search =
|
|
6426
|
+
var anchorEl = props.anchorEl, id = props.id, InputBaseProps = props.InputBaseProps, _c = props.open, open = _c === void 0 ? false : _c, _d = props.PopperComponent, PopperComponent = _d === void 0 ? StyledPopper : _d, _e = props.PaperComponent, PaperComponent = _e === void 0 ? StyledPaper$1 : _e, _f = props.PopperPlacement, PopperPlacement = _f === void 0 ? "bottom-start" : _f, _g = props.PopperBaseProps, PopperBaseProps = _g === void 0 ? {} : _g, _h = props.isSearchAutoFocus, isSearchAutoFocus = _h === void 0 ? true : _h, _j = props.search, search = _j === void 0 ? false : _j, title = props.title, headerComponentSlot = props.headerComponentSlot, _k = props.label, label = _k === void 0 ? "Search" : _k, children = props.children, options = props.options, _l = props.onClickAway, onClickAway = _l === void 0 ? noop : _l, ClickAwayListenerProps = props.ClickAwayListenerProps, _m = props.width, width = _m === void 0 ? MINIMUM_DROPDOWN_MENU_POPPER_WIDTH : _m, rest = __rest(props, ["anchorEl", "id", "InputBaseProps", "open", "PopperComponent", "PaperComponent", "PopperPlacement", "PopperBaseProps", "isSearchAutoFocus", "search", "title", "headerComponentSlot", "label", "children", "options", "onClickAway", "ClickAwayListenerProps", "width"]);
|
|
6427
6427
|
var isMultiColumn = "options" in ((options === null || options === void 0 ? void 0 : options[0]) || EMPTY_OBJECT);
|
|
6428
6428
|
// (masoudmanson): The DropdownMenu's Popper component should have a minimum
|
|
6429
6429
|
// width of MINIMUM_DROPDOWN_MENU_POPPER_WIDTH pixels if the DropdownMenu is
|
|
@@ -6433,8 +6433,8 @@ var DropdownMenu = function (props) {
|
|
|
6433
6433
|
return __assign({ minWidth: MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, width: isMultiColumn ? "auto" : width }, PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx);
|
|
6434
6434
|
}, [PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx, isMultiColumn, width]);
|
|
6435
6435
|
var DefaultInputBaseProps = React.useMemo(function () {
|
|
6436
|
-
return __assign(__assign({}, InputBaseProps), { autoFocus:
|
|
6437
|
-
}, [InputBaseProps]);
|
|
6436
|
+
return __assign(__assign({}, InputBaseProps), { autoFocus: isSearchAutoFocus, onClick: noop });
|
|
6437
|
+
}, [InputBaseProps, isSearchAutoFocus]);
|
|
6438
6438
|
return (jsxRuntime.jsx(PopperComponent, __assign({ id: id, modifiers: [
|
|
6439
6439
|
{
|
|
6440
6440
|
name: "offset",
|
|
@@ -7429,29 +7429,29 @@ var templateObject_1$A, templateObject_2$n;
|
|
|
7429
7429
|
|
|
7430
7430
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
7431
7431
|
var Dropdown = function (props) {
|
|
7432
|
-
var options = props.options, _a = props.label, label = _a === void 0 ? "" : _a, _b = props.multiple, multiple = _b === void 0 ? false : _b, _c = props.search, search = _c === void 0 ? false : _c, _d = props.buttonPosition, buttonPosition =
|
|
7432
|
+
var options = props.options, _a = props.label, label = _a === void 0 ? "" : _a, _b = props.multiple, multiple = _b === void 0 ? false : _b, _c = props.search, search = _c === void 0 ? false : _c, _d = props.isSearchAutoFocus, isSearchAutoFocus = _d === void 0 ? true : _d, _e = props.buttonPosition, buttonPosition = _e === void 0 ? "right" : _e, _f = props.buttons, buttons = _f === void 0 ? false : _f,
|
|
7433
7433
|
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
7434
7434
|
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
7435
7435
|
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
7436
7436
|
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
7437
7437
|
// unapplied changes.
|
|
7438
|
-
|
|
7438
|
+
_g = props.closeOnBlur,
|
|
7439
7439
|
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
7440
7440
|
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
7441
7441
|
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
7442
7442
|
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
7443
7443
|
// unapplied changes.
|
|
7444
|
-
closeOnBlur =
|
|
7444
|
+
closeOnBlur = _g === void 0 ? !buttons : _g, onClose = props.onClose, onChange = props.onChange, _h = props.DropdownMenuProps, DropdownMenuProps = _h === void 0 ? {} : _h, _j = props.InputDropdownProps, InputDropdownProps = _j === void 0 ? { sdsStyle: "minimal" } : _j, _k = props.InputDropdownComponent, InputDropdownComponent = _k === void 0 ? InputDropdown : _k, _l = props.isTriggerChangeOnOptionClick, isTriggerChangeOnOptionClick = _l === void 0 ? false : _l, _m = props.disabled, disabled = _m === void 0 ? false : _m, propValue = props.value, onClick = props.onClick, rest = __rest(props, ["options", "label", "multiple", "search", "isSearchAutoFocus", "buttonPosition", "buttons", "closeOnBlur", "onClose", "onChange", "DropdownMenuProps", "InputDropdownProps", "InputDropdownComponent", "isTriggerChangeOnOptionClick", "disabled", "value", "onClick"]);
|
|
7445
7445
|
if (buttons && !multiple) {
|
|
7446
7446
|
// eslint-disable-next-line no-console
|
|
7447
7447
|
console.warn("Warning: buttons are only supported for multiple select dropdowns.");
|
|
7448
7448
|
}
|
|
7449
7449
|
var isMultiColumn = "options" in ((options === null || options === void 0 ? void 0 : options[0]) || EMPTY_OBJECT);
|
|
7450
7450
|
var isControlled = propValue !== undefined;
|
|
7451
|
-
var
|
|
7452
|
-
var
|
|
7453
|
-
var
|
|
7454
|
-
var
|
|
7451
|
+
var _o = React.useState(null), anchorEl = _o[0], setAnchorEl = _o[1];
|
|
7452
|
+
var _p = React.useState(false), open = _p[0], setOpen = _p[1];
|
|
7453
|
+
var _q = React.useState(getInitialValue()), value = _q[0], setValue = _q[1];
|
|
7454
|
+
var _r = React.useState(getInitialValue()), pendingValue = _r[0], setPendingValue = _r[1];
|
|
7455
7455
|
var shouldShowButtons = buttons && !isTriggerChangeOnOptionClick && multiple;
|
|
7456
7456
|
React.useEffect(function () {
|
|
7457
7457
|
if (isControlled) {
|
|
@@ -7461,7 +7461,7 @@ var Dropdown = function (props) {
|
|
|
7461
7461
|
}
|
|
7462
7462
|
}
|
|
7463
7463
|
}, [isControlled, propValue, multiple]);
|
|
7464
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(InputDropdownComponent, __assign({ disabled: disabled, label: label, onClick: handleClick }, InputDropdownProps, rest)), jsxRuntime.jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, search: search, onClose: handleClose, multiple: multiple, disableCloseOnSelect: multiple, options: options, onClickAway: handleClickAway, width: 250, onChange: handleChange, value: isMultiColumn ? value : multiple ? pendingValue : value }, DropdownMenuProps, rest, { children: shouldShowButtons ? (jsxRuntime.jsx(StyledButtonsWrapper, { buttonPosition: buttonPosition, children: buttonPosition === "left" ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" }), jsxRuntime.jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" })] })) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" }), jsxRuntime.jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" })] })) })) : null }))] }));
|
|
7464
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(InputDropdownComponent, __assign({ disabled: disabled, label: label, onClick: handleClick }, InputDropdownProps, rest)), jsxRuntime.jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, search: search, onClose: handleClose, multiple: multiple, disableCloseOnSelect: multiple, options: options, onClickAway: handleClickAway, width: 250, onChange: handleChange, value: isMultiColumn ? value : multiple ? pendingValue : value, isSearchAutoFocus: isSearchAutoFocus }, DropdownMenuProps, rest, { children: shouldShowButtons ? (jsxRuntime.jsx(StyledButtonsWrapper, { buttonPosition: buttonPosition, children: buttonPosition === "left" ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" }), jsxRuntime.jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" })] })) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" }), jsxRuntime.jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" })] })) })) : null }))] }));
|
|
7465
7465
|
function getInitialValue() {
|
|
7466
7466
|
return multiple
|
|
7467
7467
|
? []
|
|
@@ -15484,6 +15484,7 @@ var doNotForwardProps$2 = [
|
|
|
15484
15484
|
"disableScrollLock",
|
|
15485
15485
|
"closeButtonOnClick",
|
|
15486
15486
|
"CloseButtonComponent",
|
|
15487
|
+
"isBackdropClickEnabled",
|
|
15487
15488
|
];
|
|
15488
15489
|
var basicPanelStyles = function (props) {
|
|
15489
15490
|
var _a;
|
|
@@ -15536,11 +15537,16 @@ var PanelHeaderClose = function (props) {
|
|
|
15536
15537
|
function isOverlayPanelProps(props) {
|
|
15537
15538
|
return props.sdsType === "overlay";
|
|
15538
15539
|
}
|
|
15540
|
+
var SLOT_PROPS = {
|
|
15541
|
+
backdrop: {
|
|
15542
|
+
invisible: true,
|
|
15543
|
+
},
|
|
15544
|
+
};
|
|
15539
15545
|
/**
|
|
15540
15546
|
* @see https://mui.com/material-ui/react-drawer/
|
|
15541
15547
|
*/
|
|
15542
15548
|
var Panel = React__namespace.default.forwardRef(function (props, ref) {
|
|
15543
|
-
var children = props.children, _a = props.sdsType, sdsType = _a === void 0 ? "basic" : _a, _b = props.position, position = _b === void 0 ? "left" : _b, width = props.width, ModalProps = props.ModalProps;
|
|
15549
|
+
var children = props.children, _a = props.sdsType, sdsType = _a === void 0 ? "basic" : _a, _b = props.position, position = _b === void 0 ? "left" : _b, width = props.width, ModalProps = props.ModalProps, _c = props.isBackdropClickEnabled, isBackdropClickEnabled = _c === void 0 ? false : _c;
|
|
15544
15550
|
var drawerWidth = width !== null && width !== void 0 ? width : (sdsType === "basic"
|
|
15545
15551
|
? PANEL_BASIC_MIN_WIDTH_PX
|
|
15546
15552
|
: PANEL_OVERLAY_MIN_WIDTH_PX);
|
|
@@ -15573,7 +15579,7 @@ var Panel = React__namespace.default.forwardRef(function (props, ref) {
|
|
|
15573
15579
|
// (masoudmanson): Set disableScrollLock: true to prevent the Drawer from locking
|
|
15574
15580
|
// the page scroll when it is open. This is necessary for the SDS Panel, as it should
|
|
15575
15581
|
// not lock the page scroll when it is open.
|
|
15576
|
-
disableScrollLock: true }), hideBackdrop:
|
|
15582
|
+
disableScrollLock: true }), slotProps: SLOT_PROPS, hideBackdrop: !isBackdropClickEnabled, children: [isOverlayPanelProps(props) && (jsxRuntime.jsxs(StyledHeaderComponent, { children: [(props === null || props === void 0 ? void 0 : props.HeaderComponent) && (jsxRuntime.jsx(PanelHeader, { children: props === null || props === void 0 ? void 0 : props.HeaderComponent })), jsxRuntime.jsx(PanelHeaderClose, { onClick: props === null || props === void 0 ? void 0 : props.closeButtonOnClick, CloseButtonComponent: props === null || props === void 0 ? void 0 : props.CloseButtonComponent })] })), children] })));
|
|
15577
15583
|
});
|
|
15578
15584
|
|
|
15579
15585
|
var doNotForwardProps$1 = ["buttonDefinition"];
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -1079,6 +1079,7 @@ interface StyleProps$1 extends CommonThemeProps {
|
|
|
1079
1079
|
count?: number;
|
|
1080
1080
|
icon?: ReactElement;
|
|
1081
1081
|
search?: boolean;
|
|
1082
|
+
isSearchAutoFocus?: boolean;
|
|
1082
1083
|
title?: string;
|
|
1083
1084
|
isMultiColumn?: boolean;
|
|
1084
1085
|
}
|
|
@@ -1322,6 +1323,7 @@ interface ExtraDropdownProps<T, Multiple extends boolean | undefined, DisableCle
|
|
|
1322
1323
|
label: ReactNode;
|
|
1323
1324
|
options: AutocompleteSingleColumnOption<T>[] | AutocompleteMultiColumnOption<T, Multiple, DisableClearable, FreeSolo>[];
|
|
1324
1325
|
search?: boolean;
|
|
1326
|
+
isSearchAutoFocus?: boolean;
|
|
1325
1327
|
DropdownMenuProps?: Partial<SdsDropdownMenuProps<T, Multiple, DisableClearable, FreeSolo>>;
|
|
1326
1328
|
InputDropdownProps?: Partial<InputDropdownPropsType$0>;
|
|
1327
1329
|
value?: AutocompleteValue$1<T, Multiple, DisableClearable, FreeSolo>;
|
|
@@ -1694,6 +1696,7 @@ interface BasicPanelProps extends Omit<DrawerProps, "variant"> {
|
|
|
1694
1696
|
sdsType: "basic"; // Discriminator
|
|
1695
1697
|
position?: "left" | "right";
|
|
1696
1698
|
width?: number | string;
|
|
1699
|
+
isBackdropClickEnabled?: boolean;
|
|
1697
1700
|
}
|
|
1698
1701
|
interface OverlayPanelProps extends Omit<DrawerProps, "variant"> {
|
|
1699
1702
|
sdsType: "overlay"; // Discriminator
|
|
@@ -1702,6 +1705,7 @@ interface OverlayPanelProps extends Omit<DrawerProps, "variant"> {
|
|
|
1702
1705
|
HeaderComponent?: React.ReactNode;
|
|
1703
1706
|
closeButtonOnClick?: PanelHeaderCloseProps["onClick"];
|
|
1704
1707
|
CloseButtonComponent?: PanelHeaderCloseProps["CloseButtonComponent"];
|
|
1708
|
+
isBackdropClickEnabled?: boolean;
|
|
1705
1709
|
}
|
|
1706
1710
|
// Discriminated Union
|
|
1707
1711
|
type PanelProps = BasicPanelProps | OverlayPanelProps;
|
package/dist/index.esm.js
CHANGED
|
@@ -6382,7 +6382,7 @@ var StyledPaper$1 = styled$2(Paper, {
|
|
|
6382
6382
|
var borders = getBorders(props);
|
|
6383
6383
|
var shadows = getShadows(props);
|
|
6384
6384
|
var semanticColors = getSemanticColors(props);
|
|
6385
|
-
return "\n box-shadow: ".concat(shadows === null || shadows === void 0 ? void 0 : shadows.none, " !important;\n border: ").concat(borders === null || borders === void 0 ? void 0 : borders.none, ";\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.surface, ";\n background-image: none;\n margin: 0;\n padding: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxs, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n .MuiAutocomplete-root,\n .MuiFormControl-root.MuiTextField-root {\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n }\n\n // (masoudmanson): Remove margin-right and margin-bottom for the single column autocomplete\n // as it has been added to the parent container\n .MuiAutocomplete-root .MuiFormControl-root.MuiTextField-root {\n margin-right: 0;\n margin-bottom: 0
|
|
6385
|
+
return "\n box-shadow: ".concat(shadows === null || shadows === void 0 ? void 0 : shadows.none, " !important;\n border: ").concat(borders === null || borders === void 0 ? void 0 : borders.none, ";\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.surface, ";\n background-image: none;\n margin: 0;\n padding: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxs, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n .MuiAutocomplete-root,\n .MuiFormControl-root.MuiTextField-root {\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n }\n\n // (masoudmanson): Remove margin-right and margin-bottom for the single column autocomplete\n // as it has been added to the parent container\n .MuiAutocomplete-root .MuiFormControl-root.MuiTextField-root {\n margin-right: 0;\n margin-bottom: 0;\n }\n ");
|
|
6386
6386
|
});
|
|
6387
6387
|
var StyledDropdownMenuHeader = styled$2("div")(templateObject_5$f || (templateObject_5$f = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
6388
6388
|
var search = props.search;
|
|
@@ -6400,7 +6400,7 @@ var DEFAULT_POPPER_BASE_PROPS = {
|
|
|
6400
6400
|
var DropdownMenu = function (props) {
|
|
6401
6401
|
var _a, _b;
|
|
6402
6402
|
var theme = useTheme$4();
|
|
6403
|
-
var anchorEl = props.anchorEl, id = props.id, InputBaseProps = props.InputBaseProps, _c = props.open, open = _c === void 0 ? false : _c, _d = props.PopperComponent, PopperComponent = _d === void 0 ? StyledPopper : _d, _e = props.PaperComponent, PaperComponent = _e === void 0 ? StyledPaper$1 : _e, _f = props.PopperPlacement, PopperPlacement = _f === void 0 ? "bottom-start" : _f, _g = props.PopperBaseProps, PopperBaseProps = _g === void 0 ? {} : _g, _h = props.search, search =
|
|
6403
|
+
var anchorEl = props.anchorEl, id = props.id, InputBaseProps = props.InputBaseProps, _c = props.open, open = _c === void 0 ? false : _c, _d = props.PopperComponent, PopperComponent = _d === void 0 ? StyledPopper : _d, _e = props.PaperComponent, PaperComponent = _e === void 0 ? StyledPaper$1 : _e, _f = props.PopperPlacement, PopperPlacement = _f === void 0 ? "bottom-start" : _f, _g = props.PopperBaseProps, PopperBaseProps = _g === void 0 ? {} : _g, _h = props.isSearchAutoFocus, isSearchAutoFocus = _h === void 0 ? true : _h, _j = props.search, search = _j === void 0 ? false : _j, title = props.title, headerComponentSlot = props.headerComponentSlot, _k = props.label, label = _k === void 0 ? "Search" : _k, children = props.children, options = props.options, _l = props.onClickAway, onClickAway = _l === void 0 ? noop : _l, ClickAwayListenerProps = props.ClickAwayListenerProps, _m = props.width, width = _m === void 0 ? MINIMUM_DROPDOWN_MENU_POPPER_WIDTH : _m, rest = __rest(props, ["anchorEl", "id", "InputBaseProps", "open", "PopperComponent", "PaperComponent", "PopperPlacement", "PopperBaseProps", "isSearchAutoFocus", "search", "title", "headerComponentSlot", "label", "children", "options", "onClickAway", "ClickAwayListenerProps", "width"]);
|
|
6404
6404
|
var isMultiColumn = "options" in ((options === null || options === void 0 ? void 0 : options[0]) || EMPTY_OBJECT);
|
|
6405
6405
|
// (masoudmanson): The DropdownMenu's Popper component should have a minimum
|
|
6406
6406
|
// width of MINIMUM_DROPDOWN_MENU_POPPER_WIDTH pixels if the DropdownMenu is
|
|
@@ -6410,8 +6410,8 @@ var DropdownMenu = function (props) {
|
|
|
6410
6410
|
return __assign({ minWidth: MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, width: isMultiColumn ? "auto" : width }, PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx);
|
|
6411
6411
|
}, [PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx, isMultiColumn, width]);
|
|
6412
6412
|
var DefaultInputBaseProps = useMemo(function () {
|
|
6413
|
-
return __assign(__assign({}, InputBaseProps), { autoFocus:
|
|
6414
|
-
}, [InputBaseProps]);
|
|
6413
|
+
return __assign(__assign({}, InputBaseProps), { autoFocus: isSearchAutoFocus, onClick: noop });
|
|
6414
|
+
}, [InputBaseProps, isSearchAutoFocus]);
|
|
6415
6415
|
return (jsx(PopperComponent, __assign({ id: id, modifiers: [
|
|
6416
6416
|
{
|
|
6417
6417
|
name: "offset",
|
|
@@ -7406,29 +7406,29 @@ var templateObject_1$A, templateObject_2$n;
|
|
|
7406
7406
|
|
|
7407
7407
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
7408
7408
|
var Dropdown = function (props) {
|
|
7409
|
-
var options = props.options, _a = props.label, label = _a === void 0 ? "" : _a, _b = props.multiple, multiple = _b === void 0 ? false : _b, _c = props.search, search = _c === void 0 ? false : _c, _d = props.buttonPosition, buttonPosition =
|
|
7409
|
+
var options = props.options, _a = props.label, label = _a === void 0 ? "" : _a, _b = props.multiple, multiple = _b === void 0 ? false : _b, _c = props.search, search = _c === void 0 ? false : _c, _d = props.isSearchAutoFocus, isSearchAutoFocus = _d === void 0 ? true : _d, _e = props.buttonPosition, buttonPosition = _e === void 0 ? "right" : _e, _f = props.buttons, buttons = _f === void 0 ? false : _f,
|
|
7410
7410
|
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
7411
7411
|
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
7412
7412
|
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
7413
7413
|
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
7414
7414
|
// unapplied changes.
|
|
7415
|
-
|
|
7415
|
+
_g = props.closeOnBlur,
|
|
7416
7416
|
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
7417
7417
|
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
7418
7418
|
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
7419
7419
|
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
7420
7420
|
// unapplied changes.
|
|
7421
|
-
closeOnBlur =
|
|
7421
|
+
closeOnBlur = _g === void 0 ? !buttons : _g, onClose = props.onClose, onChange = props.onChange, _h = props.DropdownMenuProps, DropdownMenuProps = _h === void 0 ? {} : _h, _j = props.InputDropdownProps, InputDropdownProps = _j === void 0 ? { sdsStyle: "minimal" } : _j, _k = props.InputDropdownComponent, InputDropdownComponent = _k === void 0 ? InputDropdown : _k, _l = props.isTriggerChangeOnOptionClick, isTriggerChangeOnOptionClick = _l === void 0 ? false : _l, _m = props.disabled, disabled = _m === void 0 ? false : _m, propValue = props.value, onClick = props.onClick, rest = __rest(props, ["options", "label", "multiple", "search", "isSearchAutoFocus", "buttonPosition", "buttons", "closeOnBlur", "onClose", "onChange", "DropdownMenuProps", "InputDropdownProps", "InputDropdownComponent", "isTriggerChangeOnOptionClick", "disabled", "value", "onClick"]);
|
|
7422
7422
|
if (buttons && !multiple) {
|
|
7423
7423
|
// eslint-disable-next-line no-console
|
|
7424
7424
|
console.warn("Warning: buttons are only supported for multiple select dropdowns.");
|
|
7425
7425
|
}
|
|
7426
7426
|
var isMultiColumn = "options" in ((options === null || options === void 0 ? void 0 : options[0]) || EMPTY_OBJECT);
|
|
7427
7427
|
var isControlled = propValue !== undefined;
|
|
7428
|
-
var
|
|
7429
|
-
var
|
|
7430
|
-
var
|
|
7431
|
-
var
|
|
7428
|
+
var _o = useState(null), anchorEl = _o[0], setAnchorEl = _o[1];
|
|
7429
|
+
var _p = useState(false), open = _p[0], setOpen = _p[1];
|
|
7430
|
+
var _q = useState(getInitialValue()), value = _q[0], setValue = _q[1];
|
|
7431
|
+
var _r = useState(getInitialValue()), pendingValue = _r[0], setPendingValue = _r[1];
|
|
7432
7432
|
var shouldShowButtons = buttons && !isTriggerChangeOnOptionClick && multiple;
|
|
7433
7433
|
useEffect(function () {
|
|
7434
7434
|
if (isControlled) {
|
|
@@ -7438,7 +7438,7 @@ var Dropdown = function (props) {
|
|
|
7438
7438
|
}
|
|
7439
7439
|
}
|
|
7440
7440
|
}, [isControlled, propValue, multiple]);
|
|
7441
|
-
return (jsxs(Fragment, { children: [jsx(InputDropdownComponent, __assign({ disabled: disabled, label: label, onClick: handleClick }, InputDropdownProps, rest)), jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, search: search, onClose: handleClose, multiple: multiple, disableCloseOnSelect: multiple, options: options, onClickAway: handleClickAway, width: 250, onChange: handleChange, value: isMultiColumn ? value : multiple ? pendingValue : value }, DropdownMenuProps, rest, { children: shouldShowButtons ? (jsx(StyledButtonsWrapper, { buttonPosition: buttonPosition, children: buttonPosition === "left" ? (jsxs("div", { children: [jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" }), jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" })] })) : (jsxs("div", { children: [jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" }), jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" })] })) })) : null }))] }));
|
|
7441
|
+
return (jsxs(Fragment, { children: [jsx(InputDropdownComponent, __assign({ disabled: disabled, label: label, onClick: handleClick }, InputDropdownProps, rest)), jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, search: search, onClose: handleClose, multiple: multiple, disableCloseOnSelect: multiple, options: options, onClickAway: handleClickAway, width: 250, onChange: handleChange, value: isMultiColumn ? value : multiple ? pendingValue : value, isSearchAutoFocus: isSearchAutoFocus }, DropdownMenuProps, rest, { children: shouldShowButtons ? (jsx(StyledButtonsWrapper, { buttonPosition: buttonPosition, children: buttonPosition === "left" ? (jsxs("div", { children: [jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" }), jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" })] })) : (jsxs("div", { children: [jsx(StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" }), jsx(StyledButton, { onClick: handleButtonClose, sdsStyle: "square", sdsType: "primary", children: "Apply" })] })) })) : null }))] }));
|
|
7442
7442
|
function getInitialValue() {
|
|
7443
7443
|
return multiple
|
|
7444
7444
|
? []
|
|
@@ -15461,6 +15461,7 @@ var doNotForwardProps$2 = [
|
|
|
15461
15461
|
"disableScrollLock",
|
|
15462
15462
|
"closeButtonOnClick",
|
|
15463
15463
|
"CloseButtonComponent",
|
|
15464
|
+
"isBackdropClickEnabled",
|
|
15464
15465
|
];
|
|
15465
15466
|
var basicPanelStyles = function (props) {
|
|
15466
15467
|
var _a;
|
|
@@ -15513,11 +15514,16 @@ var PanelHeaderClose = function (props) {
|
|
|
15513
15514
|
function isOverlayPanelProps(props) {
|
|
15514
15515
|
return props.sdsType === "overlay";
|
|
15515
15516
|
}
|
|
15517
|
+
var SLOT_PROPS = {
|
|
15518
|
+
backdrop: {
|
|
15519
|
+
invisible: true,
|
|
15520
|
+
},
|
|
15521
|
+
};
|
|
15516
15522
|
/**
|
|
15517
15523
|
* @see https://mui.com/material-ui/react-drawer/
|
|
15518
15524
|
*/
|
|
15519
15525
|
var Panel = React__default.forwardRef(function (props, ref) {
|
|
15520
|
-
var children = props.children, _a = props.sdsType, sdsType = _a === void 0 ? "basic" : _a, _b = props.position, position = _b === void 0 ? "left" : _b, width = props.width, ModalProps = props.ModalProps;
|
|
15526
|
+
var children = props.children, _a = props.sdsType, sdsType = _a === void 0 ? "basic" : _a, _b = props.position, position = _b === void 0 ? "left" : _b, width = props.width, ModalProps = props.ModalProps, _c = props.isBackdropClickEnabled, isBackdropClickEnabled = _c === void 0 ? false : _c;
|
|
15521
15527
|
var drawerWidth = width !== null && width !== void 0 ? width : (sdsType === "basic"
|
|
15522
15528
|
? PANEL_BASIC_MIN_WIDTH_PX
|
|
15523
15529
|
: PANEL_OVERLAY_MIN_WIDTH_PX);
|
|
@@ -15550,7 +15556,7 @@ var Panel = React__default.forwardRef(function (props, ref) {
|
|
|
15550
15556
|
// (masoudmanson): Set disableScrollLock: true to prevent the Drawer from locking
|
|
15551
15557
|
// the page scroll when it is open. This is necessary for the SDS Panel, as it should
|
|
15552
15558
|
// not lock the page scroll when it is open.
|
|
15553
|
-
disableScrollLock: true }), hideBackdrop:
|
|
15559
|
+
disableScrollLock: true }), slotProps: SLOT_PROPS, hideBackdrop: !isBackdropClickEnabled, children: [isOverlayPanelProps(props) && (jsxs(StyledHeaderComponent, { children: [(props === null || props === void 0 ? void 0 : props.HeaderComponent) && (jsx(PanelHeader, { children: props === null || props === void 0 ? void 0 : props.HeaderComponent })), jsx(PanelHeaderClose, { onClick: props === null || props === void 0 ? void 0 : props.closeButtonOnClick, CloseButtonComponent: props === null || props === void 0 ? void 0 : props.CloseButtonComponent })] })), children] })));
|
|
15554
15560
|
});
|
|
15555
15561
|
|
|
15556
15562
|
var doNotForwardProps$1 = ["buttonDefinition"];
|