@czi-sds/components 20.1.1 → 20.2.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 +13 -5
- package/dist/index.cjs.js +59 -18
- package/dist/index.esm.d.ts +13 -5
- package/dist/index.esm.js +59 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.cjs.d.ts
CHANGED
|
@@ -280,6 +280,9 @@ interface Typography {
|
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
interface FontWeights {
|
|
283
|
+
bold: number;
|
|
284
|
+
light: number;
|
|
285
|
+
medium: number;
|
|
283
286
|
regular: number;
|
|
284
287
|
semibold: number;
|
|
285
288
|
}
|
|
@@ -481,11 +484,15 @@ interface Borders {
|
|
|
481
484
|
positive: Border;
|
|
482
485
|
}
|
|
483
486
|
declare const defaultTheme: import("@mui/material/styles").Theme;
|
|
487
|
+
declare const SDSAppTheme: AppTheme;
|
|
484
488
|
/**
|
|
485
|
-
* (masoudmanson): This is to
|
|
489
|
+
* (masoudmanson): This is to make sure that the old defaultAppTheme
|
|
490
|
+
* export is still available for backward compatibility.
|
|
491
|
+
*
|
|
492
|
+
* @deprecated
|
|
493
|
+
* Please use `SDSAppTheme` instead. This export will be removed in the future.
|
|
486
494
|
*/
|
|
487
|
-
declare const defaultAppTheme:
|
|
488
|
-
declare const SDSAppTheme: AppTheme;
|
|
495
|
+
declare const defaultAppTheme: AppTheme;
|
|
489
496
|
/**
|
|
490
497
|
* This function creates the theme options for the MUI theme provider
|
|
491
498
|
*/
|
|
@@ -1172,9 +1179,10 @@ interface ComplexFilterProps<T extends DefaultAutocompleteOption, Multiple exten
|
|
|
1172
1179
|
className?: string;
|
|
1173
1180
|
PopperComponent?: typeof StyledPopper$1;
|
|
1174
1181
|
InputDropdownComponent?: typeof InputDropdown;
|
|
1182
|
+
isTriggerChangeOnOptionClick?: boolean;
|
|
1175
1183
|
}
|
|
1176
1184
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
1177
|
-
declare const ComplexFilter: <T extends DefaultAutocompleteOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined>({ options, label, multiple, search, onChange, DropdownMenuProps, InputDropdownProps, value: propValue, PopperComponent, InputDropdownComponent, ...rest }: ComplexFilterProps<T, Multiple, DisableClearable, FreeSolo>) => JSX.Element;
|
|
1185
|
+
declare const ComplexFilter: <T extends DefaultAutocompleteOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined>({ options, label, multiple, search, onChange, DropdownMenuProps, InputDropdownProps, value: propValue, PopperComponent, InputDropdownComponent, isTriggerChangeOnOptionClick, ...rest }: ComplexFilterProps<T, Multiple, DisableClearable, FreeSolo>) => JSX.Element;
|
|
1178
1186
|
type DialogPaperProps = PaperProps;
|
|
1179
1187
|
/**
|
|
1180
1188
|
* @see https://mui.com/material-ui/react-paper/
|
|
@@ -1573,5 +1581,5 @@ type TooltipTableContentProps = TooltipTableExtraProps;
|
|
|
1573
1581
|
* @see https://mui.com/material-ui/react-table/
|
|
1574
1582
|
*/
|
|
1575
1583
|
declare const TooltipTableContent: (props: TooltipTableContentProps) => JSX.Element;
|
|
1576
|
-
export { AccordionDetails, AccordionHeader, AccordionProps, Accordion, Alert, AutocompleteSingleColumnOption, AutocompleteMultiColumnOption, SDSAutocompleteOptions, AutocompleteMultiColumnValue, AutocompleteSingleColumnValue, SDSAutocompleteValue, AutocompleteSingleColumnOnChange, AutocompleteMultiColumnOnChange, SDSAutocompleteOnChange, AutocompleteProps, StyledPopper as AutocompleteMultiColumnStyledPopper, StyledPaper$0 as AutocompleteSingleColumnStyledPaper, Autocomplete$0 as Autocomplete, BannerProps, Banner, ButtonProps, Button, ButtonDropdownProps, ButtonDropdown, ButtonIconInternalProps, ButtonIconProps, ButtonIcon, CalloutIntentType, CalloutProps, ExposedCalloutProps, Callout, CalloutTitle, CellBasicRawProps, CellBasicProps, CellBasic, CellComponentProps, CellComponent, CellHeaderDirection, CellHeaderProps, CellHeader, Chip, InputDropdown as ComplexFilterInputDropdown, InputDropdown as DropdownInputDropdown, InputDropdown, StyledPopper$1 as ComplexFilterPopper, StyledPopper$1 as DropdownPopper, ComplexFilterProps, ComplexFilter, DialogContext, DialogProps, Dialog, DialogActionsProps, DialogActions, DialogContentProps, _default, _default as DialogContent, DialogPaperProps, DialogPaper, Subtitle$0 as DialogTitleSubtitle, Title as DialogTitleTitle, Overline as DialogTitleOverline, DialogTitleProps, DialogTitle, StyledPaper$1 as DropdownPaper, ExtraDropdownProps, DropdownProps, Dropdown, DefaultDropdownMenuOption, MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, DropdownMenuProps, DropdownMenu, SdsIconWithColor$0 as SdsIconWithColor, IconProps, Icon, CheckboxProps, InputCheckbox, InputDropdownProps$0 as InputDropdownProps, RadioContentProps, RadioProps, InputRadio, AccessibleInputSearchProps, InputSearchProps, InputSearch, InputSliderProps, InputSlider, InputTextProps, InputText, InputToggle, LinkProps$0 as LinkProps, Link, ListProps, List, ListItemLabel, ListItemProps, ListItem, ListSubheaderProps, ListSubheader, LoadingIndicatorProps$0 as LoadingIndicatorProps, LoadingIndicator, MenuProps, Menu, IconNameToSmallSizes, MenuItemExtraProps, MenuItemProps, MenuItem, DefaultMenuSelectOption, MenuSelectProps, MenuSelect, NavigationJumpToProps, NavigationJumpTo, NotificationIntentType, NotificationProps, ExposedNotificationProps, Notification, PaginationInternalProps, PaginationProps, Pagination, SingleButtonDefinition, SegmentedControlProps, SegmentedControl, SdsTableProps, TableProps, Table, TableHeaderProps, TableHeader, TableRowProps, TableRow, Tabs, TabProps$0 as TabProps, Tab, SdsTagProps, TagProps, Tag, SdsTagFilterProps, TagFilterProps, TagFilter, Tooltip, TooltipCondensedProps, TooltipCondensed, TooltipTableContent, TooltipTableContent as TooltipTable, SDSComponentPalette, SDSTextPalette, SDSTheme, SDSThemeOptions, AppTheme, Shadows, Typography, FontWeights, Corners, Spaces, Spacings, Color, Colors, AccentColor, BaseColor, BetaColor, InfoColor, NegativeColor, NeutralColor, NoticeColor, PositiveColor, SemanticComponentColors, SemanticTextColors, IconSize, IconSizes, Border, Borders, defaultTheme,
|
|
1584
|
+
export { AccordionDetails, AccordionHeader, AccordionProps, Accordion, Alert, AutocompleteSingleColumnOption, AutocompleteMultiColumnOption, SDSAutocompleteOptions, AutocompleteMultiColumnValue, AutocompleteSingleColumnValue, SDSAutocompleteValue, AutocompleteSingleColumnOnChange, AutocompleteMultiColumnOnChange, SDSAutocompleteOnChange, AutocompleteProps, StyledPopper as AutocompleteMultiColumnStyledPopper, StyledPaper$0 as AutocompleteSingleColumnStyledPaper, Autocomplete$0 as Autocomplete, BannerProps, Banner, ButtonProps, Button, ButtonDropdownProps, ButtonDropdown, ButtonIconInternalProps, ButtonIconProps, ButtonIcon, CalloutIntentType, CalloutProps, ExposedCalloutProps, Callout, CalloutTitle, CellBasicRawProps, CellBasicProps, CellBasic, CellComponentProps, CellComponent, CellHeaderDirection, CellHeaderProps, CellHeader, Chip, InputDropdown as ComplexFilterInputDropdown, InputDropdown as DropdownInputDropdown, InputDropdown, StyledPopper$1 as ComplexFilterPopper, StyledPopper$1 as DropdownPopper, ComplexFilterProps, ComplexFilter, DialogContext, DialogProps, Dialog, DialogActionsProps, DialogActions, DialogContentProps, _default, _default as DialogContent, DialogPaperProps, DialogPaper, Subtitle$0 as DialogTitleSubtitle, Title as DialogTitleTitle, Overline as DialogTitleOverline, DialogTitleProps, DialogTitle, StyledPaper$1 as DropdownPaper, ExtraDropdownProps, DropdownProps, Dropdown, DefaultDropdownMenuOption, MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, DropdownMenuProps, DropdownMenu, SdsIconWithColor$0 as SdsIconWithColor, IconProps, Icon, CheckboxProps, InputCheckbox, InputDropdownProps$0 as InputDropdownProps, RadioContentProps, RadioProps, InputRadio, AccessibleInputSearchProps, InputSearchProps, InputSearch, InputSliderProps, InputSlider, InputTextProps, InputText, InputToggle, LinkProps$0 as LinkProps, Link, ListProps, List, ListItemLabel, ListItemProps, ListItem, ListSubheaderProps, ListSubheader, LoadingIndicatorProps$0 as LoadingIndicatorProps, LoadingIndicator, MenuProps, Menu, IconNameToSmallSizes, MenuItemExtraProps, MenuItemProps, MenuItem, DefaultMenuSelectOption, MenuSelectProps, MenuSelect, NavigationJumpToProps, NavigationJumpTo, NotificationIntentType, NotificationProps, ExposedNotificationProps, Notification, PaginationInternalProps, PaginationProps, Pagination, SingleButtonDefinition, SegmentedControlProps, SegmentedControl, SdsTableProps, TableProps, Table, TableHeaderProps, TableHeader, TableRowProps, TableRow, Tabs, TabProps$0 as TabProps, Tab, SdsTagProps, TagProps, Tag, SdsTagFilterProps, TagFilterProps, TagFilter, Tooltip, TooltipCondensedProps, TooltipCondensed, TooltipTableContent, TooltipTableContent as TooltipTable, SDSComponentPalette, SDSTextPalette, SDSTheme, SDSThemeOptions, AppTheme, Shadows, Typography, FontWeights, Corners, Spaces, Spacings, Color, Colors, AccentColor, BaseColor, BetaColor, InfoColor, NegativeColor, NeutralColor, NoticeColor, PositiveColor, SemanticComponentColors, SemanticTextColors, IconSize, IconSizes, Border, Borders, defaultTheme, SDSAppTheme, defaultAppTheme, makeThemeOptions, focusVisibleA11yStyle, fontBody, fontBodyL, fontBodyM, fontBodyS, fontBodyXs, fontBodyXxs, fontBodyXxxs, fontBodySemiboldL, fontBodySemiboldM, fontBodySemiboldS, fontBodySemiboldXs, fontBodySemiboldXxs, fontBodySemiboldXxxs, fontCaps, fontCapsXxs, fontCapsXxxs, fontCapsXxxxs, fontHeader, fontHeaderXxl, fontHeaderXl, fontHeaderL, fontHeaderM, fontHeaderS, fontHeaderXs, fontHeaderXxs, fontHeaderXxxs, fontCode, fontCodeXs, fontCodeS, fontCodeSemiboldXs, fontCodeSemiboldS, fontTabular, fontTabularXs, fontTabularS, fontTabularSemiboldXs, fontTabularSemiboldS, CommonThemeProps, getSpaces, getSpacings, getTypography, getPalette, getColors, getSemanticComponentColors, getSemanticTextColors, getShadows, getCorners, getFontWeights, getIconSizes, getBorders };
|
|
1577
1585
|
export type { AutocompleteBaseProps, AutocompleteMultiColumnProps, AutocompleteOptionBasic, AutocompleteOptionComponent, DefaultAutocompleteOption, ChipProps, IconNameToSizes, InputToggleExtraProps as InputToggleProps, TabsProps$0 as TabsProps, SdsTagColorType, TooltipProps, TooltipTableContentProps };
|
package/dist/index.cjs.js
CHANGED
|
@@ -160,6 +160,9 @@ var SDSAppTheme = {
|
|
|
160
160
|
s: 2,
|
|
161
161
|
},
|
|
162
162
|
fontWeights: {
|
|
163
|
+
bold: 700,
|
|
164
|
+
light: 300,
|
|
165
|
+
medium: 800,
|
|
163
166
|
regular: 400,
|
|
164
167
|
semibold: 600,
|
|
165
168
|
},
|
|
@@ -461,6 +464,14 @@ var SDSAppTheme = {
|
|
|
461
464
|
},
|
|
462
465
|
},
|
|
463
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* (masoudmanson): This is to make sure that the old defaultAppTheme
|
|
469
|
+
* export is still available for backward compatibility.
|
|
470
|
+
*
|
|
471
|
+
* @deprecated
|
|
472
|
+
* Please use `SDSAppTheme` instead. This export will be removed in the future.
|
|
473
|
+
*/
|
|
474
|
+
var defaultAppTheme = SDSAppTheme;
|
|
464
475
|
// (mlila) whenever our theme uses colors, we need to make sure we allow consuming
|
|
465
476
|
// applications to override those colors using their own custom theme.
|
|
466
477
|
// By defining borders using SDSAppTheme.colors instead of defaultThemeColors,
|
|
@@ -819,10 +830,6 @@ function makeThemeOptions(appTheme) {
|
|
|
819
830
|
|
|
820
831
|
var defaultThemeOptions = makeThemeOptions(SDSAppTheme);
|
|
821
832
|
var defaultTheme = styles.createTheme(defaultThemeOptions);
|
|
822
|
-
/**
|
|
823
|
-
* (masoudmanson): This is to keep the old defaultAppTheme export for backward compatibility.
|
|
824
|
-
*/
|
|
825
|
-
var defaultAppTheme = defaultTheme;
|
|
826
833
|
|
|
827
834
|
function focusVisibleA11yStyle() {
|
|
828
835
|
return "\n &.Mui-focusVisible, &:focus-visible {\n outline: 5px auto Highlight;\n outline: 5px auto -webkit-focus-ring-color;\n }\n ";
|
|
@@ -4561,7 +4568,13 @@ var AutocompleteMultiColumn = function (props) {
|
|
|
4561
4568
|
},
|
|
4562
4569
|
], open: popperOpen, anchorEl: anchorEl, placement: PopperPlacement, disablePortal: true }, PopperBaseProps, { children: jsxRuntime.jsx(StyledAutocompleteGroupWrapper, { className: "SdsAutocompleteMultiColumn-wrapper", children: options.map(function (autocompleteOptions) { return (jsxRuntime.jsx(AutocompleteGroup, __assign({ autocompleteProps: autocompleteOptions, onValueChange: defaultOnValueChange, value: autocompleteMultiColumnValue
|
|
4563
4570
|
? autocompleteMultiColumnValue[autocompleteOptions.name]
|
|
4564
|
-
: undefined, multiple: multiple, label: label,
|
|
4571
|
+
: undefined, multiple: multiple, label: label,
|
|
4572
|
+
/**
|
|
4573
|
+
* (masoudmanson): In a multi-column autocomplete, the search input for
|
|
4574
|
+
* inner autocompletes should remain hidden and unfocused when the parent
|
|
4575
|
+
* input is focused. This prevents blurring of the main search input.
|
|
4576
|
+
*/
|
|
4577
|
+
InputBaseProps: __assign(__assign({}, InputBaseProps), { autoFocus: false }), popperOpen: popperOpen, inputValue: inputValue, PaperComponent: StyledPaper$2 }, rest), autocompleteOptions.name)); }) }) })))] }) })));
|
|
4565
4578
|
function clearInput() {
|
|
4566
4579
|
setInputValue("");
|
|
4567
4580
|
/**
|
|
@@ -5331,7 +5344,7 @@ var DropdownMenu = function (props) {
|
|
|
5331
5344
|
: width });
|
|
5332
5345
|
}, [PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx, isMultiColumn, width]);
|
|
5333
5346
|
var DefaultInputBaseProps = React.useMemo(function () {
|
|
5334
|
-
return __assign(__assign({}, InputBaseProps), { onClick: noop });
|
|
5347
|
+
return __assign(__assign({}, InputBaseProps), { autoFocus: true, onClick: noop });
|
|
5335
5348
|
}, [InputBaseProps]);
|
|
5336
5349
|
return (jsxRuntime.jsx(PopperComponent, __assign({ id: id, modifiers: [
|
|
5337
5350
|
{
|
|
@@ -5551,12 +5564,12 @@ function renderDetailsText(_a) {
|
|
|
5551
5564
|
var tagSizeS = function (props) {
|
|
5552
5565
|
var spaces = getSpaces(props);
|
|
5553
5566
|
var iconSizes = getIconSizes(props);
|
|
5554
|
-
return react.css(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n
|
|
5567
|
+
return react.css(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "], ["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "])), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xs, fontBodyXxxs$1(props), iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.xs.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.xs.width, spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, fontHeaderXs(props), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.width);
|
|
5555
5568
|
};
|
|
5556
5569
|
var tagSizeL = function (props) {
|
|
5557
5570
|
var spaces = getSpaces(props);
|
|
5558
5571
|
var iconSizes = getIconSizes(props);
|
|
5559
|
-
return react.css(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n
|
|
5572
|
+
return react.css(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "], ["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "])), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xs, fontBodyXs$2(props), iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.l.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.l.width, spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, fontHeaderXs(props), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.width);
|
|
5560
5573
|
};
|
|
5561
5574
|
var rounded = function (props) {
|
|
5562
5575
|
var corners = getCorners(props);
|
|
@@ -5698,11 +5711,11 @@ var Chips = function (_a) {
|
|
|
5698
5711
|
return null;
|
|
5699
5712
|
if (!multiple) {
|
|
5700
5713
|
var name_1 = value.name;
|
|
5701
|
-
return jsxRuntime.jsx(TagFilter, { label: name_1, onDelete: onDelete });
|
|
5714
|
+
return (jsxRuntime.jsx(TagFilter, { label: name_1, onDelete: onDelete, onClick: function () { return onDelete(name_1); } }));
|
|
5702
5715
|
}
|
|
5703
5716
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: value.map(function (item) {
|
|
5704
5717
|
var name = item.name;
|
|
5705
|
-
return (jsxRuntime.jsx(TagFilter, { label: name, onDelete: function () { return onDelete(item); } }, name));
|
|
5718
|
+
return (jsxRuntime.jsx(TagFilter, { label: name, onDelete: function () { return onDelete(item); }, onClick: function () { return onDelete(item); } }, name));
|
|
5706
5719
|
}) }));
|
|
5707
5720
|
};
|
|
5708
5721
|
|
|
@@ -5715,11 +5728,16 @@ var templateObject_1$v, templateObject_2$g;
|
|
|
5715
5728
|
|
|
5716
5729
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
5717
5730
|
var ComplexFilter = function (_a) {
|
|
5718
|
-
var options = _a.options, _b = _a.label, label = _b === void 0 ? "" : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? false : _d, onChange = _a.onChange, _e = _a.DropdownMenuProps, DropdownMenuProps = _e === void 0 ? {} : _e, _f = _a.InputDropdownProps, InputDropdownProps = _f === void 0 ? { sdsStyle: "minimal" } : _f, propValue = _a.value, PopperComponent = _a.PopperComponent, _g = _a.InputDropdownComponent, InputDropdownComponent = _g === void 0 ? InputDropdown : _g, rest = __rest(_a, ["options", "label", "multiple", "search", "onChange", "DropdownMenuProps", "InputDropdownProps", "value", "PopperComponent", "InputDropdownComponent"]);
|
|
5731
|
+
var options = _a.options, _b = _a.label, label = _b === void 0 ? "" : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? false : _d, onChange = _a.onChange, _e = _a.DropdownMenuProps, DropdownMenuProps = _e === void 0 ? {} : _e, _f = _a.InputDropdownProps, InputDropdownProps = _f === void 0 ? { sdsStyle: "minimal" } : _f, propValue = _a.value, PopperComponent = _a.PopperComponent, _g = _a.InputDropdownComponent, InputDropdownComponent = _g === void 0 ? InputDropdown : _g, _h = _a.isTriggerChangeOnOptionClick, isTriggerChangeOnOptionClick = _h === void 0 ? false : _h, rest = __rest(_a, ["options", "label", "multiple", "search", "onChange", "DropdownMenuProps", "InputDropdownProps", "value", "PopperComponent", "InputDropdownComponent", "isTriggerChangeOnOptionClick"]);
|
|
5719
5732
|
var isControlled = propValue !== undefined;
|
|
5720
|
-
var
|
|
5721
|
-
var
|
|
5722
|
-
var
|
|
5733
|
+
var _j = React.useState(false), open = _j[0], setOpen = _j[1];
|
|
5734
|
+
var _k = React.useState(null), anchorEl = _k[0], setAnchorEl = _k[1];
|
|
5735
|
+
var _l = React.useState(getInitialValue()), value = _l[0], setValue = _l[1];
|
|
5736
|
+
var _m = React.useState(getInitialValue()), pendingValue = _m[0], setPendingValue = _m[1];
|
|
5737
|
+
React.useEffect(function () {
|
|
5738
|
+
onChange(value);
|
|
5739
|
+
setPendingValue(value);
|
|
5740
|
+
}, [onChange, value]);
|
|
5723
5741
|
React.useEffect(function () {
|
|
5724
5742
|
if (isControlled) {
|
|
5725
5743
|
setValue(propValue);
|
|
@@ -5728,9 +5746,12 @@ var ComplexFilter = function (_a) {
|
|
|
5728
5746
|
// * (mlila): likely, this portion on ComplexFilter will need to be replaced with Dropdown (or a
|
|
5729
5747
|
// * new DropdownFilter) component. As ComplexFilter evolves, there will be more types added,
|
|
5730
5748
|
// * such as sliders for ranges, inline multi selects, etc.
|
|
5731
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper$1, __assign({}, rest, { children: [jsxRuntime.jsx(InputDropdownComponent, __assign({ label: label, onClick: handleClick, sdsStage: open ? "userInput" : "default" }, InputDropdownProps)), jsxRuntime.jsx(StyledChipsWrapper, { children: jsxRuntime.jsx(Chips, { value: value, multiple: multiple, onDelete: handleDelete }) })] })), jsxRuntime.jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, onClose: handleMenuSelectClose, search: search, multiple: multiple, value: value, onChange: handleChange, disableCloseOnSelect: multiple, options: options, PopperComponent: PopperComponent, PopperBaseProps: { sx: { minWidth: 250 } }, onClickAway: handleClose }, DropdownMenuProps, rest))] }));
|
|
5749
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper$1, __assign({}, rest, { children: [jsxRuntime.jsx(InputDropdownComponent, __assign({ label: label, onClick: handleClick, sdsStage: open ? "userInput" : "default" }, InputDropdownProps)), jsxRuntime.jsx(StyledChipsWrapper, { children: jsxRuntime.jsx(Chips, { value: value, multiple: multiple, onDelete: handleDelete }) })] })), jsxRuntime.jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, onClose: handleMenuSelectClose, search: search, multiple: multiple, value: multiple ? pendingValue : value, onChange: handleChange, disableCloseOnSelect: multiple, options: options, PopperComponent: PopperComponent, PopperBaseProps: { sx: { minWidth: 250 } }, onClickAway: handleClose }, DropdownMenuProps, rest))] }));
|
|
5732
5750
|
function handleClick(event) {
|
|
5733
5751
|
if (open) {
|
|
5752
|
+
if (multiple) {
|
|
5753
|
+
setValue(pendingValue);
|
|
5754
|
+
}
|
|
5734
5755
|
setOpen(false);
|
|
5735
5756
|
if (anchorEl) {
|
|
5736
5757
|
anchorEl.focus();
|
|
@@ -5738,6 +5759,9 @@ var ComplexFilter = function (_a) {
|
|
|
5738
5759
|
setAnchorEl(null);
|
|
5739
5760
|
}
|
|
5740
5761
|
else {
|
|
5762
|
+
if (multiple) {
|
|
5763
|
+
setPendingValue(value);
|
|
5764
|
+
}
|
|
5741
5765
|
setAnchorEl(event.currentTarget);
|
|
5742
5766
|
setOpen(true);
|
|
5743
5767
|
}
|
|
@@ -5745,6 +5769,9 @@ var ComplexFilter = function (_a) {
|
|
|
5745
5769
|
function handleClose() {
|
|
5746
5770
|
if (open) {
|
|
5747
5771
|
setOpen(false);
|
|
5772
|
+
if (multiple) {
|
|
5773
|
+
setValue(pendingValue);
|
|
5774
|
+
}
|
|
5748
5775
|
}
|
|
5749
5776
|
}
|
|
5750
5777
|
function handleMenuSelectClose(event, reason) {
|
|
@@ -5754,11 +5781,20 @@ var ComplexFilter = function (_a) {
|
|
|
5754
5781
|
}
|
|
5755
5782
|
}
|
|
5756
5783
|
function handleChange(event, newValue) {
|
|
5784
|
+
if (multiple) {
|
|
5785
|
+
if (isTriggerChangeOnOptionClick) {
|
|
5786
|
+
setPendingValue(newValue);
|
|
5787
|
+
return setValueAndCallOnChange(event, newValue);
|
|
5788
|
+
}
|
|
5789
|
+
return setPendingValue(newValue);
|
|
5790
|
+
}
|
|
5791
|
+
setValueAndCallOnChange(event, newValue);
|
|
5792
|
+
if (!multiple)
|
|
5793
|
+
setOpen(false);
|
|
5794
|
+
}
|
|
5795
|
+
function setValueAndCallOnChange(event, newValue) {
|
|
5757
5796
|
setValue(newValue);
|
|
5758
5797
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
5759
|
-
if (!multiple) {
|
|
5760
|
-
setOpen(false);
|
|
5761
|
-
}
|
|
5762
5798
|
}
|
|
5763
5799
|
function handleDelete(option) {
|
|
5764
5800
|
if (!multiple) {
|
|
@@ -5767,6 +5803,11 @@ var ComplexFilter = function (_a) {
|
|
|
5767
5803
|
var newValue = (value === null || value === void 0 ? void 0 : value.filter(function (item) { return item !== option; })) || null;
|
|
5768
5804
|
setValue(newValue);
|
|
5769
5805
|
}
|
|
5806
|
+
function getInitialValue() {
|
|
5807
|
+
return multiple
|
|
5808
|
+
? []
|
|
5809
|
+
: null;
|
|
5810
|
+
}
|
|
5770
5811
|
};
|
|
5771
5812
|
|
|
5772
5813
|
var DialogContext = React.createContext({ sdsSize: "m" });
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -280,6 +280,9 @@ interface Typography {
|
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
interface FontWeights {
|
|
283
|
+
bold: number;
|
|
284
|
+
light: number;
|
|
285
|
+
medium: number;
|
|
283
286
|
regular: number;
|
|
284
287
|
semibold: number;
|
|
285
288
|
}
|
|
@@ -481,11 +484,15 @@ interface Borders {
|
|
|
481
484
|
positive: Border;
|
|
482
485
|
}
|
|
483
486
|
declare const defaultTheme: import("@mui/material/styles").Theme;
|
|
487
|
+
declare const SDSAppTheme: AppTheme;
|
|
484
488
|
/**
|
|
485
|
-
* (masoudmanson): This is to
|
|
489
|
+
* (masoudmanson): This is to make sure that the old defaultAppTheme
|
|
490
|
+
* export is still available for backward compatibility.
|
|
491
|
+
*
|
|
492
|
+
* @deprecated
|
|
493
|
+
* Please use `SDSAppTheme` instead. This export will be removed in the future.
|
|
486
494
|
*/
|
|
487
|
-
declare const defaultAppTheme:
|
|
488
|
-
declare const SDSAppTheme: AppTheme;
|
|
495
|
+
declare const defaultAppTheme: AppTheme;
|
|
489
496
|
/**
|
|
490
497
|
* This function creates the theme options for the MUI theme provider
|
|
491
498
|
*/
|
|
@@ -1172,9 +1179,10 @@ interface ComplexFilterProps<T extends DefaultAutocompleteOption, Multiple exten
|
|
|
1172
1179
|
className?: string;
|
|
1173
1180
|
PopperComponent?: typeof StyledPopper$1;
|
|
1174
1181
|
InputDropdownComponent?: typeof InputDropdown;
|
|
1182
|
+
isTriggerChangeOnOptionClick?: boolean;
|
|
1175
1183
|
}
|
|
1176
1184
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
1177
|
-
declare const ComplexFilter: <T extends DefaultAutocompleteOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined>({ options, label, multiple, search, onChange, DropdownMenuProps, InputDropdownProps, value: propValue, PopperComponent, InputDropdownComponent, ...rest }: ComplexFilterProps<T, Multiple, DisableClearable, FreeSolo>) => JSX.Element;
|
|
1185
|
+
declare const ComplexFilter: <T extends DefaultAutocompleteOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined>({ options, label, multiple, search, onChange, DropdownMenuProps, InputDropdownProps, value: propValue, PopperComponent, InputDropdownComponent, isTriggerChangeOnOptionClick, ...rest }: ComplexFilterProps<T, Multiple, DisableClearable, FreeSolo>) => JSX.Element;
|
|
1178
1186
|
type DialogPaperProps = PaperProps;
|
|
1179
1187
|
/**
|
|
1180
1188
|
* @see https://mui.com/material-ui/react-paper/
|
|
@@ -1573,5 +1581,5 @@ type TooltipTableContentProps = TooltipTableExtraProps;
|
|
|
1573
1581
|
* @see https://mui.com/material-ui/react-table/
|
|
1574
1582
|
*/
|
|
1575
1583
|
declare const TooltipTableContent: (props: TooltipTableContentProps) => JSX.Element;
|
|
1576
|
-
export { AccordionDetails, AccordionHeader, AccordionProps, Accordion, Alert, AutocompleteSingleColumnOption, AutocompleteMultiColumnOption, SDSAutocompleteOptions, AutocompleteMultiColumnValue, AutocompleteSingleColumnValue, SDSAutocompleteValue, AutocompleteSingleColumnOnChange, AutocompleteMultiColumnOnChange, SDSAutocompleteOnChange, AutocompleteProps, StyledPopper as AutocompleteMultiColumnStyledPopper, StyledPaper$0 as AutocompleteSingleColumnStyledPaper, Autocomplete$0 as Autocomplete, BannerProps, Banner, ButtonProps, Button, ButtonDropdownProps, ButtonDropdown, ButtonIconInternalProps, ButtonIconProps, ButtonIcon, CalloutIntentType, CalloutProps, ExposedCalloutProps, Callout, CalloutTitle, CellBasicRawProps, CellBasicProps, CellBasic, CellComponentProps, CellComponent, CellHeaderDirection, CellHeaderProps, CellHeader, Chip, InputDropdown as ComplexFilterInputDropdown, InputDropdown as DropdownInputDropdown, InputDropdown, StyledPopper$1 as ComplexFilterPopper, StyledPopper$1 as DropdownPopper, ComplexFilterProps, ComplexFilter, DialogContext, DialogProps, Dialog, DialogActionsProps, DialogActions, DialogContentProps, _default, _default as DialogContent, DialogPaperProps, DialogPaper, Subtitle$0 as DialogTitleSubtitle, Title as DialogTitleTitle, Overline as DialogTitleOverline, DialogTitleProps, DialogTitle, StyledPaper$1 as DropdownPaper, ExtraDropdownProps, DropdownProps, Dropdown, DefaultDropdownMenuOption, MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, DropdownMenuProps, DropdownMenu, SdsIconWithColor$0 as SdsIconWithColor, IconProps, Icon, CheckboxProps, InputCheckbox, InputDropdownProps$0 as InputDropdownProps, RadioContentProps, RadioProps, InputRadio, AccessibleInputSearchProps, InputSearchProps, InputSearch, InputSliderProps, InputSlider, InputTextProps, InputText, InputToggle, LinkProps$0 as LinkProps, Link, ListProps, List, ListItemLabel, ListItemProps, ListItem, ListSubheaderProps, ListSubheader, LoadingIndicatorProps$0 as LoadingIndicatorProps, LoadingIndicator, MenuProps, Menu, IconNameToSmallSizes, MenuItemExtraProps, MenuItemProps, MenuItem, DefaultMenuSelectOption, MenuSelectProps, MenuSelect, NavigationJumpToProps, NavigationJumpTo, NotificationIntentType, NotificationProps, ExposedNotificationProps, Notification, PaginationInternalProps, PaginationProps, Pagination, SingleButtonDefinition, SegmentedControlProps, SegmentedControl, SdsTableProps, TableProps, Table, TableHeaderProps, TableHeader, TableRowProps, TableRow, Tabs, TabProps$0 as TabProps, Tab, SdsTagProps, TagProps, Tag, SdsTagFilterProps, TagFilterProps, TagFilter, Tooltip, TooltipCondensedProps, TooltipCondensed, TooltipTableContent, TooltipTableContent as TooltipTable, SDSComponentPalette, SDSTextPalette, SDSTheme, SDSThemeOptions, AppTheme, Shadows, Typography, FontWeights, Corners, Spaces, Spacings, Color, Colors, AccentColor, BaseColor, BetaColor, InfoColor, NegativeColor, NeutralColor, NoticeColor, PositiveColor, SemanticComponentColors, SemanticTextColors, IconSize, IconSizes, Border, Borders, defaultTheme,
|
|
1584
|
+
export { AccordionDetails, AccordionHeader, AccordionProps, Accordion, Alert, AutocompleteSingleColumnOption, AutocompleteMultiColumnOption, SDSAutocompleteOptions, AutocompleteMultiColumnValue, AutocompleteSingleColumnValue, SDSAutocompleteValue, AutocompleteSingleColumnOnChange, AutocompleteMultiColumnOnChange, SDSAutocompleteOnChange, AutocompleteProps, StyledPopper as AutocompleteMultiColumnStyledPopper, StyledPaper$0 as AutocompleteSingleColumnStyledPaper, Autocomplete$0 as Autocomplete, BannerProps, Banner, ButtonProps, Button, ButtonDropdownProps, ButtonDropdown, ButtonIconInternalProps, ButtonIconProps, ButtonIcon, CalloutIntentType, CalloutProps, ExposedCalloutProps, Callout, CalloutTitle, CellBasicRawProps, CellBasicProps, CellBasic, CellComponentProps, CellComponent, CellHeaderDirection, CellHeaderProps, CellHeader, Chip, InputDropdown as ComplexFilterInputDropdown, InputDropdown as DropdownInputDropdown, InputDropdown, StyledPopper$1 as ComplexFilterPopper, StyledPopper$1 as DropdownPopper, ComplexFilterProps, ComplexFilter, DialogContext, DialogProps, Dialog, DialogActionsProps, DialogActions, DialogContentProps, _default, _default as DialogContent, DialogPaperProps, DialogPaper, Subtitle$0 as DialogTitleSubtitle, Title as DialogTitleTitle, Overline as DialogTitleOverline, DialogTitleProps, DialogTitle, StyledPaper$1 as DropdownPaper, ExtraDropdownProps, DropdownProps, Dropdown, DefaultDropdownMenuOption, MINIMUM_DROPDOWN_MENU_POPPER_WIDTH, DropdownMenuProps, DropdownMenu, SdsIconWithColor$0 as SdsIconWithColor, IconProps, Icon, CheckboxProps, InputCheckbox, InputDropdownProps$0 as InputDropdownProps, RadioContentProps, RadioProps, InputRadio, AccessibleInputSearchProps, InputSearchProps, InputSearch, InputSliderProps, InputSlider, InputTextProps, InputText, InputToggle, LinkProps$0 as LinkProps, Link, ListProps, List, ListItemLabel, ListItemProps, ListItem, ListSubheaderProps, ListSubheader, LoadingIndicatorProps$0 as LoadingIndicatorProps, LoadingIndicator, MenuProps, Menu, IconNameToSmallSizes, MenuItemExtraProps, MenuItemProps, MenuItem, DefaultMenuSelectOption, MenuSelectProps, MenuSelect, NavigationJumpToProps, NavigationJumpTo, NotificationIntentType, NotificationProps, ExposedNotificationProps, Notification, PaginationInternalProps, PaginationProps, Pagination, SingleButtonDefinition, SegmentedControlProps, SegmentedControl, SdsTableProps, TableProps, Table, TableHeaderProps, TableHeader, TableRowProps, TableRow, Tabs, TabProps$0 as TabProps, Tab, SdsTagProps, TagProps, Tag, SdsTagFilterProps, TagFilterProps, TagFilter, Tooltip, TooltipCondensedProps, TooltipCondensed, TooltipTableContent, TooltipTableContent as TooltipTable, SDSComponentPalette, SDSTextPalette, SDSTheme, SDSThemeOptions, AppTheme, Shadows, Typography, FontWeights, Corners, Spaces, Spacings, Color, Colors, AccentColor, BaseColor, BetaColor, InfoColor, NegativeColor, NeutralColor, NoticeColor, PositiveColor, SemanticComponentColors, SemanticTextColors, IconSize, IconSizes, Border, Borders, defaultTheme, SDSAppTheme, defaultAppTheme, makeThemeOptions, focusVisibleA11yStyle, fontBody, fontBodyL, fontBodyM, fontBodyS, fontBodyXs, fontBodyXxs, fontBodyXxxs, fontBodySemiboldL, fontBodySemiboldM, fontBodySemiboldS, fontBodySemiboldXs, fontBodySemiboldXxs, fontBodySemiboldXxxs, fontCaps, fontCapsXxs, fontCapsXxxs, fontCapsXxxxs, fontHeader, fontHeaderXxl, fontHeaderXl, fontHeaderL, fontHeaderM, fontHeaderS, fontHeaderXs, fontHeaderXxs, fontHeaderXxxs, fontCode, fontCodeXs, fontCodeS, fontCodeSemiboldXs, fontCodeSemiboldS, fontTabular, fontTabularXs, fontTabularS, fontTabularSemiboldXs, fontTabularSemiboldS, CommonThemeProps, getSpaces, getSpacings, getTypography, getPalette, getColors, getSemanticComponentColors, getSemanticTextColors, getShadows, getCorners, getFontWeights, getIconSizes, getBorders };
|
|
1577
1585
|
export type { AutocompleteBaseProps, AutocompleteMultiColumnProps, AutocompleteOptionBasic, AutocompleteOptionComponent, DefaultAutocompleteOption, ChipProps, IconNameToSizes, InputToggleExtraProps as InputToggleProps, TabsProps$0 as TabsProps, SdsTagColorType, TooltipProps, TooltipTableContentProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -140,6 +140,9 @@ var SDSAppTheme = {
|
|
|
140
140
|
s: 2,
|
|
141
141
|
},
|
|
142
142
|
fontWeights: {
|
|
143
|
+
bold: 700,
|
|
144
|
+
light: 300,
|
|
145
|
+
medium: 800,
|
|
143
146
|
regular: 400,
|
|
144
147
|
semibold: 600,
|
|
145
148
|
},
|
|
@@ -441,6 +444,14 @@ var SDSAppTheme = {
|
|
|
441
444
|
},
|
|
442
445
|
},
|
|
443
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* (masoudmanson): This is to make sure that the old defaultAppTheme
|
|
449
|
+
* export is still available for backward compatibility.
|
|
450
|
+
*
|
|
451
|
+
* @deprecated
|
|
452
|
+
* Please use `SDSAppTheme` instead. This export will be removed in the future.
|
|
453
|
+
*/
|
|
454
|
+
var defaultAppTheme = SDSAppTheme;
|
|
444
455
|
// (mlila) whenever our theme uses colors, we need to make sure we allow consuming
|
|
445
456
|
// applications to override those colors using their own custom theme.
|
|
446
457
|
// By defining borders using SDSAppTheme.colors instead of defaultThemeColors,
|
|
@@ -799,10 +810,6 @@ function makeThemeOptions(appTheme) {
|
|
|
799
810
|
|
|
800
811
|
var defaultThemeOptions = makeThemeOptions(SDSAppTheme);
|
|
801
812
|
var defaultTheme = createTheme(defaultThemeOptions);
|
|
802
|
-
/**
|
|
803
|
-
* (masoudmanson): This is to keep the old defaultAppTheme export for backward compatibility.
|
|
804
|
-
*/
|
|
805
|
-
var defaultAppTheme = defaultTheme;
|
|
806
813
|
|
|
807
814
|
function focusVisibleA11yStyle() {
|
|
808
815
|
return "\n &.Mui-focusVisible, &:focus-visible {\n outline: 5px auto Highlight;\n outline: 5px auto -webkit-focus-ring-color;\n }\n ";
|
|
@@ -4541,7 +4548,13 @@ var AutocompleteMultiColumn = function (props) {
|
|
|
4541
4548
|
},
|
|
4542
4549
|
], open: popperOpen, anchorEl: anchorEl, placement: PopperPlacement, disablePortal: true }, PopperBaseProps, { children: jsx(StyledAutocompleteGroupWrapper, { className: "SdsAutocompleteMultiColumn-wrapper", children: options.map(function (autocompleteOptions) { return (jsx(AutocompleteGroup, __assign({ autocompleteProps: autocompleteOptions, onValueChange: defaultOnValueChange, value: autocompleteMultiColumnValue
|
|
4543
4550
|
? autocompleteMultiColumnValue[autocompleteOptions.name]
|
|
4544
|
-
: undefined, multiple: multiple, label: label,
|
|
4551
|
+
: undefined, multiple: multiple, label: label,
|
|
4552
|
+
/**
|
|
4553
|
+
* (masoudmanson): In a multi-column autocomplete, the search input for
|
|
4554
|
+
* inner autocompletes should remain hidden and unfocused when the parent
|
|
4555
|
+
* input is focused. This prevents blurring of the main search input.
|
|
4556
|
+
*/
|
|
4557
|
+
InputBaseProps: __assign(__assign({}, InputBaseProps), { autoFocus: false }), popperOpen: popperOpen, inputValue: inputValue, PaperComponent: StyledPaper$2 }, rest), autocompleteOptions.name)); }) }) })))] }) })));
|
|
4545
4558
|
function clearInput() {
|
|
4546
4559
|
setInputValue("");
|
|
4547
4560
|
/**
|
|
@@ -5311,7 +5324,7 @@ var DropdownMenu = function (props) {
|
|
|
5311
5324
|
: width });
|
|
5312
5325
|
}, [PopperBaseProps === null || PopperBaseProps === void 0 ? void 0 : PopperBaseProps.sx, isMultiColumn, width]);
|
|
5313
5326
|
var DefaultInputBaseProps = useMemo(function () {
|
|
5314
|
-
return __assign(__assign({}, InputBaseProps), { onClick: noop });
|
|
5327
|
+
return __assign(__assign({}, InputBaseProps), { autoFocus: true, onClick: noop });
|
|
5315
5328
|
}, [InputBaseProps]);
|
|
5316
5329
|
return (jsx(PopperComponent, __assign({ id: id, modifiers: [
|
|
5317
5330
|
{
|
|
@@ -5531,12 +5544,12 @@ function renderDetailsText(_a) {
|
|
|
5531
5544
|
var tagSizeS = function (props) {
|
|
5532
5545
|
var spaces = getSpaces(props);
|
|
5533
5546
|
var iconSizes = getIconSizes(props);
|
|
5534
|
-
return css(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n
|
|
5547
|
+
return css(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "], ["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "])), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xs, fontBodyXxxs$1(props), iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.xs.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.xs.width, spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, fontHeaderXs(props), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.width);
|
|
5535
5548
|
};
|
|
5536
5549
|
var tagSizeL = function (props) {
|
|
5537
5550
|
var spaces = getSpaces(props);
|
|
5538
5551
|
var iconSizes = getIconSizes(props);
|
|
5539
|
-
return css(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n
|
|
5552
|
+
return css(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "], ["\n height: unset;\n margin: 0 ", "px ", "px 0;\n\n .MuiChip-label {\n ", "\n padding: 0;\n }\n\n .MuiSvgIcon-root {\n height: ", "px;\n width: ", "px;\n margin: 0 ", "px 0 -", "px;\n }\n\n .MuiChip-deleteIcon {\n ", "\n color: white;\n margin: 0 0 0 ", "px;\n height: ", "px;\n width: ", "px;\n }\n "])), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xs, fontBodyXs$2(props), iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.l.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.l.width, spaces === null || spaces === void 0 ? void 0 : spaces.xxs, spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, fontHeaderXs(props), spaces === null || spaces === void 0 ? void 0 : spaces.xxs, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.height, iconSizes === null || iconSizes === void 0 ? void 0 : iconSizes.s.width);
|
|
5540
5553
|
};
|
|
5541
5554
|
var rounded = function (props) {
|
|
5542
5555
|
var corners = getCorners(props);
|
|
@@ -5678,11 +5691,11 @@ var Chips = function (_a) {
|
|
|
5678
5691
|
return null;
|
|
5679
5692
|
if (!multiple) {
|
|
5680
5693
|
var name_1 = value.name;
|
|
5681
|
-
return jsx(TagFilter, { label: name_1, onDelete: onDelete });
|
|
5694
|
+
return (jsx(TagFilter, { label: name_1, onDelete: onDelete, onClick: function () { return onDelete(name_1); } }));
|
|
5682
5695
|
}
|
|
5683
5696
|
return (jsx(Fragment, { children: value.map(function (item) {
|
|
5684
5697
|
var name = item.name;
|
|
5685
|
-
return (jsx(TagFilter, { label: name, onDelete: function () { return onDelete(item); } }, name));
|
|
5698
|
+
return (jsx(TagFilter, { label: name, onDelete: function () { return onDelete(item); }, onClick: function () { return onDelete(item); } }, name));
|
|
5686
5699
|
}) }));
|
|
5687
5700
|
};
|
|
5688
5701
|
|
|
@@ -5695,11 +5708,16 @@ var templateObject_1$v, templateObject_2$g;
|
|
|
5695
5708
|
|
|
5696
5709
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
5697
5710
|
var ComplexFilter = function (_a) {
|
|
5698
|
-
var options = _a.options, _b = _a.label, label = _b === void 0 ? "" : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? false : _d, onChange = _a.onChange, _e = _a.DropdownMenuProps, DropdownMenuProps = _e === void 0 ? {} : _e, _f = _a.InputDropdownProps, InputDropdownProps = _f === void 0 ? { sdsStyle: "minimal" } : _f, propValue = _a.value, PopperComponent = _a.PopperComponent, _g = _a.InputDropdownComponent, InputDropdownComponent = _g === void 0 ? InputDropdown : _g, rest = __rest(_a, ["options", "label", "multiple", "search", "onChange", "DropdownMenuProps", "InputDropdownProps", "value", "PopperComponent", "InputDropdownComponent"]);
|
|
5711
|
+
var options = _a.options, _b = _a.label, label = _b === void 0 ? "" : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? false : _d, onChange = _a.onChange, _e = _a.DropdownMenuProps, DropdownMenuProps = _e === void 0 ? {} : _e, _f = _a.InputDropdownProps, InputDropdownProps = _f === void 0 ? { sdsStyle: "minimal" } : _f, propValue = _a.value, PopperComponent = _a.PopperComponent, _g = _a.InputDropdownComponent, InputDropdownComponent = _g === void 0 ? InputDropdown : _g, _h = _a.isTriggerChangeOnOptionClick, isTriggerChangeOnOptionClick = _h === void 0 ? false : _h, rest = __rest(_a, ["options", "label", "multiple", "search", "onChange", "DropdownMenuProps", "InputDropdownProps", "value", "PopperComponent", "InputDropdownComponent", "isTriggerChangeOnOptionClick"]);
|
|
5699
5712
|
var isControlled = propValue !== undefined;
|
|
5700
|
-
var
|
|
5701
|
-
var
|
|
5702
|
-
var
|
|
5713
|
+
var _j = useState(false), open = _j[0], setOpen = _j[1];
|
|
5714
|
+
var _k = useState(null), anchorEl = _k[0], setAnchorEl = _k[1];
|
|
5715
|
+
var _l = useState(getInitialValue()), value = _l[0], setValue = _l[1];
|
|
5716
|
+
var _m = useState(getInitialValue()), pendingValue = _m[0], setPendingValue = _m[1];
|
|
5717
|
+
useEffect(function () {
|
|
5718
|
+
onChange(value);
|
|
5719
|
+
setPendingValue(value);
|
|
5720
|
+
}, [onChange, value]);
|
|
5703
5721
|
useEffect(function () {
|
|
5704
5722
|
if (isControlled) {
|
|
5705
5723
|
setValue(propValue);
|
|
@@ -5708,9 +5726,12 @@ var ComplexFilter = function (_a) {
|
|
|
5708
5726
|
// * (mlila): likely, this portion on ComplexFilter will need to be replaced with Dropdown (or a
|
|
5709
5727
|
// * new DropdownFilter) component. As ComplexFilter evolves, there will be more types added,
|
|
5710
5728
|
// * such as sliders for ranges, inline multi selects, etc.
|
|
5711
|
-
return (jsxs(Fragment, { children: [jsxs(Wrapper$1, __assign({}, rest, { children: [jsx(InputDropdownComponent, __assign({ label: label, onClick: handleClick, sdsStage: open ? "userInput" : "default" }, InputDropdownProps)), jsx(StyledChipsWrapper, { children: jsx(Chips, { value: value, multiple: multiple, onDelete: handleDelete }) })] })), jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, onClose: handleMenuSelectClose, search: search, multiple: multiple, value: value, onChange: handleChange, disableCloseOnSelect: multiple, options: options, PopperComponent: PopperComponent, PopperBaseProps: { sx: { minWidth: 250 } }, onClickAway: handleClose }, DropdownMenuProps, rest))] }));
|
|
5729
|
+
return (jsxs(Fragment, { children: [jsxs(Wrapper$1, __assign({}, rest, { children: [jsx(InputDropdownComponent, __assign({ label: label, onClick: handleClick, sdsStage: open ? "userInput" : "default" }, InputDropdownProps)), jsx(StyledChipsWrapper, { children: jsx(Chips, { value: value, multiple: multiple, onDelete: handleDelete }) })] })), jsx(DropdownMenu, __assign({ anchorEl: anchorEl, open: open, onClose: handleMenuSelectClose, search: search, multiple: multiple, value: multiple ? pendingValue : value, onChange: handleChange, disableCloseOnSelect: multiple, options: options, PopperComponent: PopperComponent, PopperBaseProps: { sx: { minWidth: 250 } }, onClickAway: handleClose }, DropdownMenuProps, rest))] }));
|
|
5712
5730
|
function handleClick(event) {
|
|
5713
5731
|
if (open) {
|
|
5732
|
+
if (multiple) {
|
|
5733
|
+
setValue(pendingValue);
|
|
5734
|
+
}
|
|
5714
5735
|
setOpen(false);
|
|
5715
5736
|
if (anchorEl) {
|
|
5716
5737
|
anchorEl.focus();
|
|
@@ -5718,6 +5739,9 @@ var ComplexFilter = function (_a) {
|
|
|
5718
5739
|
setAnchorEl(null);
|
|
5719
5740
|
}
|
|
5720
5741
|
else {
|
|
5742
|
+
if (multiple) {
|
|
5743
|
+
setPendingValue(value);
|
|
5744
|
+
}
|
|
5721
5745
|
setAnchorEl(event.currentTarget);
|
|
5722
5746
|
setOpen(true);
|
|
5723
5747
|
}
|
|
@@ -5725,6 +5749,9 @@ var ComplexFilter = function (_a) {
|
|
|
5725
5749
|
function handleClose() {
|
|
5726
5750
|
if (open) {
|
|
5727
5751
|
setOpen(false);
|
|
5752
|
+
if (multiple) {
|
|
5753
|
+
setValue(pendingValue);
|
|
5754
|
+
}
|
|
5728
5755
|
}
|
|
5729
5756
|
}
|
|
5730
5757
|
function handleMenuSelectClose(event, reason) {
|
|
@@ -5734,11 +5761,20 @@ var ComplexFilter = function (_a) {
|
|
|
5734
5761
|
}
|
|
5735
5762
|
}
|
|
5736
5763
|
function handleChange(event, newValue) {
|
|
5764
|
+
if (multiple) {
|
|
5765
|
+
if (isTriggerChangeOnOptionClick) {
|
|
5766
|
+
setPendingValue(newValue);
|
|
5767
|
+
return setValueAndCallOnChange(event, newValue);
|
|
5768
|
+
}
|
|
5769
|
+
return setPendingValue(newValue);
|
|
5770
|
+
}
|
|
5771
|
+
setValueAndCallOnChange(event, newValue);
|
|
5772
|
+
if (!multiple)
|
|
5773
|
+
setOpen(false);
|
|
5774
|
+
}
|
|
5775
|
+
function setValueAndCallOnChange(event, newValue) {
|
|
5737
5776
|
setValue(newValue);
|
|
5738
5777
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
5739
|
-
if (!multiple) {
|
|
5740
|
-
setOpen(false);
|
|
5741
|
-
}
|
|
5742
5778
|
}
|
|
5743
5779
|
function handleDelete(option) {
|
|
5744
5780
|
if (!multiple) {
|
|
@@ -5747,6 +5783,11 @@ var ComplexFilter = function (_a) {
|
|
|
5747
5783
|
var newValue = (value === null || value === void 0 ? void 0 : value.filter(function (item) { return item !== option; })) || null;
|
|
5748
5784
|
setValue(newValue);
|
|
5749
5785
|
}
|
|
5786
|
+
function getInitialValue() {
|
|
5787
|
+
return multiple
|
|
5788
|
+
? []
|
|
5789
|
+
: null;
|
|
5790
|
+
}
|
|
5750
5791
|
};
|
|
5751
5792
|
|
|
5752
5793
|
var DialogContext = createContext({ sdsSize: "m" });
|