@nypl/design-system-react-components 1.4.0-rc → 1.4.0-rc3
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/components/MultiSelect/MultiSelect.d.ts +8 -8
- package/dist/components/MultiSelect/MultiSelectDialog.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelectListbox.d.ts +2 -2
- package/dist/components/MultiSelect/MultiSelectMenuButton.d.ts +2 -2
- package/dist/design-system-react-components.cjs.development.js +24 -26
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +24 -26
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,12 +20,12 @@ interface MultiSelectCommonProps {
|
|
|
20
20
|
isBlockElement?: boolean;
|
|
21
21
|
/** The items to be rendered in the Multiselect as checkbox options. */
|
|
22
22
|
items: MultiSelectItem[];
|
|
23
|
-
/** The label
|
|
24
|
-
|
|
23
|
+
/** The label text rendered within the MultiSelect. */
|
|
24
|
+
labelText: string;
|
|
25
25
|
/** The action to perform for clear/reset button of MultiSelect. */
|
|
26
26
|
onClear?: () => void;
|
|
27
|
-
/** The
|
|
28
|
-
|
|
27
|
+
/** The type of MultiSelect that will be rendered. */
|
|
28
|
+
type: "listbox" | "dialog";
|
|
29
29
|
/** The selected items state (items that were checked by user). */
|
|
30
30
|
selectedItems: SelectedItems;
|
|
31
31
|
/** Value used to set the width for the MultiSelect component. */
|
|
@@ -34,13 +34,13 @@ interface MultiSelectCommonProps {
|
|
|
34
34
|
declare type ListboxOnChange = (selectedItem: MultiSelectItem, id: string) => void;
|
|
35
35
|
declare type DialogOnChange = (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
36
36
|
declare type MultiSelectVariantsProps = {
|
|
37
|
-
|
|
37
|
+
type: "listbox";
|
|
38
38
|
onApply?: never;
|
|
39
39
|
/** The action to perform for downshift's onSelectedItemChange function. */
|
|
40
40
|
onChange: ListboxOnChange;
|
|
41
41
|
onMixedStateChange?: never;
|
|
42
42
|
} | {
|
|
43
|
-
|
|
43
|
+
type: "dialog";
|
|
44
44
|
/** The action to perform for save/apply button of multiselect. */
|
|
45
45
|
onApply: () => void;
|
|
46
46
|
/** The action to perform on the checkbox's onChange function. */
|
|
@@ -57,7 +57,7 @@ export declare type MultiSelectProps = MultiSelectCommonProps & MultiSelectVaria
|
|
|
57
57
|
* differences, the two variants are broken out in separate stories below.
|
|
58
58
|
*/
|
|
59
59
|
export declare const MultiSelect: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<(MultiSelectCommonProps & {
|
|
60
|
-
|
|
60
|
+
type: "listbox";
|
|
61
61
|
onApply?: never;
|
|
62
62
|
/** The action to perform for downshift's onSelectedItemChange function. */
|
|
63
63
|
onChange: ListboxOnChange;
|
|
@@ -65,7 +65,7 @@ export declare const MultiSelect: import("@chakra-ui/react").ChakraComponent<Rea
|
|
|
65
65
|
} & {
|
|
66
66
|
children?: React.ReactNode;
|
|
67
67
|
} & React.RefAttributes<HTMLDivElement>) | (MultiSelectCommonProps & {
|
|
68
|
-
|
|
68
|
+
type: "dialog";
|
|
69
69
|
/** The action to perform for save/apply button of multiselect. */
|
|
70
70
|
onApply: () => void;
|
|
71
71
|
/** The action to perform on the checkbox's onChange function. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MultiSelectProps } from "./MultiSelect";
|
|
3
|
-
export declare const MultiSelectDialog: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<Pick<MultiSelectProps, "id" | "isDefaultOpen" | "isBlockElement" | "items" | "
|
|
3
|
+
export declare const MultiSelectDialog: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<Pick<MultiSelectProps, "id" | "isDefaultOpen" | "isBlockElement" | "items" | "labelText" | "onClear" | "type" | "selectedItems" | "width" | "onApply" | "onMixedStateChange"> & {
|
|
4
4
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
5
|
} & {
|
|
6
6
|
children?: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MultiSelectItem, MultiSelectProps } from "./MultiSelect";
|
|
3
|
-
/** MultiSelectListbox renders a non-hierarchical list of checkbox options for the `
|
|
4
|
-
export declare const MultiSelectListbox: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<Pick<MultiSelectProps, "id" | "isDefaultOpen" | "isBlockElement" | "items" | "
|
|
3
|
+
/** MultiSelectListbox renders a non-hierarchical list of checkbox options for the `type="listbox". It leverager downshift-js for accessiblity. */
|
|
4
|
+
export declare const MultiSelectListbox: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<Pick<MultiSelectProps, "id" | "isDefaultOpen" | "isBlockElement" | "items" | "labelText" | "onClear" | "type" | "selectedItems" | "width" | "onApply" | "onMixedStateChange"> & {
|
|
5
5
|
onChange: (selectedItem: MultiSelectItem, id: string) => void;
|
|
6
6
|
} & {
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -4,8 +4,8 @@ export interface MultiSelectMenuButtonProps {
|
|
|
4
4
|
id: string;
|
|
5
5
|
/** The id of the MultiSelect using this button. */
|
|
6
6
|
multiSelectId: string;
|
|
7
|
-
/** The label
|
|
8
|
-
|
|
7
|
+
/** The label text rendered within the MultiSelect using this button. */
|
|
8
|
+
multiSelectLabelText: string;
|
|
9
9
|
/** The open status of the MultiSelect menu. */
|
|
10
10
|
isOpen: boolean;
|
|
11
11
|
/** The selected items state (items that were checked by user). */
|
|
@@ -3044,8 +3044,7 @@ var CheckboxGroup = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
|
|
|
3044
3044
|
"data-testid": "checkbox-group",
|
|
3045
3045
|
direction: [layout],
|
|
3046
3046
|
spacing: spacingProp,
|
|
3047
|
-
ref: ref
|
|
3048
|
-
"aria-label": !showLabel ? labelText : undefined
|
|
3047
|
+
ref: ref
|
|
3049
3048
|
}, newChildren)), footnote && showHelperInvalidText && React__default.createElement(HelperErrorText, {
|
|
3050
3049
|
id: id + "-helperErrorText",
|
|
3051
3050
|
isInvalid: isInvalid,
|
|
@@ -9552,7 +9551,6 @@ var RadioGroup$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(func
|
|
|
9552
9551
|
});
|
|
9553
9552
|
// Props for the `ChakraRadioGroup` component.
|
|
9554
9553
|
var radioGroupProps = {
|
|
9555
|
-
"aria-label": !showLabel ? labelText : undefined,
|
|
9556
9554
|
name: name,
|
|
9557
9555
|
onChange: function onChange(selected) {
|
|
9558
9556
|
setValue(selected);
|
|
@@ -10050,7 +10048,7 @@ function useFeedbackBox() {
|
|
|
10050
10048
|
};
|
|
10051
10049
|
}
|
|
10052
10050
|
|
|
10053
|
-
var _excluded$1f = ["id", "isOpen", "multiSelectId", "
|
|
10051
|
+
var _excluded$1f = ["id", "isOpen", "multiSelectId", "multiSelectLabelText", "onClear", "onKeyDown", "onMenuToggle", "selectedItems"];
|
|
10054
10052
|
var _templateObject;
|
|
10055
10053
|
var grow = /*#__PURE__*/react.keyframes(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n from {width: 22px; opacity: 0; }\n to {width: 46px; opacity: 1;}\n"])));
|
|
10056
10054
|
/**
|
|
@@ -10065,7 +10063,7 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
|
|
|
10065
10063
|
var id = props.id,
|
|
10066
10064
|
isOpen = props.isOpen,
|
|
10067
10065
|
multiSelectId = props.multiSelectId,
|
|
10068
|
-
|
|
10066
|
+
multiSelectLabelText = props.multiSelectLabelText,
|
|
10069
10067
|
onClear = props.onClear,
|
|
10070
10068
|
onMenuToggle = props.onMenuToggle,
|
|
10071
10069
|
selectedItems = props.selectedItems,
|
|
@@ -10078,7 +10076,7 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
|
|
|
10078
10076
|
if (((_selectedItems$multiS = selectedItems[multiSelectId]) == null ? void 0 : _selectedItems$multiS.items.length) > 0) {
|
|
10079
10077
|
getSelectedItemsCount = "" + selectedItems[multiSelectId].items.length;
|
|
10080
10078
|
var itemPlural = getSelectedItemsCount === "1" ? "" : "s";
|
|
10081
|
-
selectedItemsAriaLabel = getSelectedItemsCount + " item" + itemPlural + " selected";
|
|
10079
|
+
selectedItemsAriaLabel = "remove " + getSelectedItemsCount + " item" + itemPlural + " selected from " + multiSelectLabelText;
|
|
10082
10080
|
}
|
|
10083
10081
|
var styles = react.useMultiStyleConfig("MultiSelectMenuButton", {
|
|
10084
10082
|
isOpen: isOpen,
|
|
@@ -10100,9 +10098,9 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
|
|
|
10100
10098
|
__css: styles.menuButton
|
|
10101
10099
|
}, rest), React__default.createElement(react.Box, {
|
|
10102
10100
|
as: "span",
|
|
10103
|
-
title:
|
|
10101
|
+
title: multiSelectLabelText,
|
|
10104
10102
|
__css: styles.buttonLabel
|
|
10105
|
-
},
|
|
10103
|
+
}, multiSelectLabelText), React__default.createElement(Icon, {
|
|
10106
10104
|
id: "ms-" + multiSelectId + "-icon",
|
|
10107
10105
|
name: iconType,
|
|
10108
10106
|
size: "small"
|
|
@@ -10123,18 +10121,19 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
|
|
|
10123
10121
|
id: "ms-" + multiSelectId + "-selected-items-count-icon",
|
|
10124
10122
|
marginLeft: "xs",
|
|
10125
10123
|
name: "close",
|
|
10126
|
-
size: "xsmall"
|
|
10124
|
+
size: "xsmall",
|
|
10125
|
+
title: "Remove selected items"
|
|
10127
10126
|
})));
|
|
10128
10127
|
});
|
|
10129
10128
|
|
|
10130
|
-
var _excluded$1g = ["id", "isBlockElement", "isDefaultOpen", "items", "
|
|
10131
|
-
/** MultiSelectListbox renders a non-hierarchical list of checkbox options for the `
|
|
10129
|
+
var _excluded$1g = ["id", "isBlockElement", "isDefaultOpen", "items", "labelText", "onChange", "onClear", "selectedItems", "width"];
|
|
10130
|
+
/** MultiSelectListbox renders a non-hierarchical list of checkbox options for the `type="listbox". It leverager downshift-js for accessiblity. */
|
|
10132
10131
|
var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
10133
10132
|
var id = props.id,
|
|
10134
10133
|
isBlockElement = props.isBlockElement,
|
|
10135
10134
|
isDefaultOpen = props.isDefaultOpen,
|
|
10136
10135
|
items = props.items,
|
|
10137
|
-
|
|
10136
|
+
labelText = props.labelText,
|
|
10138
10137
|
onChange = props.onChange,
|
|
10139
10138
|
onClear = props.onClear,
|
|
10140
10139
|
selectedItems = props.selectedItems,
|
|
@@ -10177,18 +10176,18 @@ var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRe
|
|
|
10177
10176
|
isBlockElement: isBlockElement,
|
|
10178
10177
|
isOpen: isOpen
|
|
10179
10178
|
});
|
|
10180
|
-
// If a item passed to the listbox
|
|
10179
|
+
// If a item passed to the listbox type has children,
|
|
10181
10180
|
if (items.some(function (item) {
|
|
10182
10181
|
return item.children;
|
|
10183
10182
|
})) {
|
|
10184
|
-
console.warn("NYPL Reservoir MultiSelect: Only the
|
|
10183
|
+
console.warn("NYPL Reservoir MultiSelect: Only the type 'dialog' can render nested select items.");
|
|
10185
10184
|
}
|
|
10186
10185
|
return React__default.createElement(react.Box, Object.assign({
|
|
10187
10186
|
id: id,
|
|
10188
10187
|
__css: styles
|
|
10189
10188
|
}, rest), React__default.createElement(MultiSelectMenuButton$1, Object.assign({
|
|
10190
10189
|
multiSelectId: id,
|
|
10191
|
-
|
|
10190
|
+
multiSelectLabelText: labelText,
|
|
10192
10191
|
isOpen: isOpen,
|
|
10193
10192
|
selectedItems: selectedItems,
|
|
10194
10193
|
onClear: onClear,
|
|
@@ -10244,13 +10243,13 @@ var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRe
|
|
|
10244
10243
|
}
|
|
10245
10244
|
});
|
|
10246
10245
|
|
|
10247
|
-
var _excluded$1h = ["id", "isBlockElement", "isDefaultOpen", "items", "
|
|
10246
|
+
var _excluded$1h = ["id", "isBlockElement", "isDefaultOpen", "items", "labelText", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "width"];
|
|
10248
10247
|
var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
10249
10248
|
var id = props.id,
|
|
10250
10249
|
isBlockElement = props.isBlockElement,
|
|
10251
10250
|
isDefaultOpen = props.isDefaultOpen,
|
|
10252
10251
|
items = props.items,
|
|
10253
|
-
|
|
10252
|
+
labelText = props.labelText,
|
|
10254
10253
|
onApply = props.onApply,
|
|
10255
10254
|
onChange = props.onChange,
|
|
10256
10255
|
onClear = props.onClear,
|
|
@@ -10337,7 +10336,7 @@ var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef
|
|
|
10337
10336
|
}, React__default.createElement(MultiSelectMenuButton$1, {
|
|
10338
10337
|
id: "ms-" + id + "-menu-button",
|
|
10339
10338
|
multiSelectId: id,
|
|
10340
|
-
|
|
10339
|
+
multiSelectLabelText: labelText,
|
|
10341
10340
|
isOpen: isOpen,
|
|
10342
10341
|
selectedItems: selectedItems,
|
|
10343
10342
|
onMenuToggle: function onMenuToggle() {
|
|
@@ -10418,7 +10417,7 @@ var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef
|
|
|
10418
10417
|
}
|
|
10419
10418
|
});
|
|
10420
10419
|
|
|
10421
|
-
var _excluded$1i = ["id", "isBlockElement", "isDefaultOpen", "items", "
|
|
10420
|
+
var _excluded$1i = ["id", "isBlockElement", "isDefaultOpen", "items", "labelText", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "type", "width"];
|
|
10422
10421
|
/**
|
|
10423
10422
|
* The `MultiSelect` component is a form input element that presents a list
|
|
10424
10423
|
* of `Checkbox` components from which a user can make one or multiple
|
|
@@ -10433,13 +10432,13 @@ var MultiSelect$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
|
|
|
10433
10432
|
_props$isDefaultOpen = props.isDefaultOpen,
|
|
10434
10433
|
isDefaultOpen = _props$isDefaultOpen === void 0 ? false : _props$isDefaultOpen,
|
|
10435
10434
|
items = props.items,
|
|
10436
|
-
|
|
10435
|
+
labelText = props.labelText,
|
|
10437
10436
|
onApply = props.onApply,
|
|
10438
10437
|
onChange = props.onChange,
|
|
10439
10438
|
onClear = props.onClear,
|
|
10440
10439
|
onMixedStateChange = props.onMixedStateChange,
|
|
10441
10440
|
selectedItems = props.selectedItems,
|
|
10442
|
-
|
|
10441
|
+
type = props.type,
|
|
10443
10442
|
_props$width = props.width,
|
|
10444
10443
|
width = _props$width === void 0 ? "default" : _props$width,
|
|
10445
10444
|
rest = _objectWithoutPropertiesLoose(props, _excluded$1i);
|
|
@@ -10448,20 +10447,20 @@ var MultiSelect$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
|
|
|
10448
10447
|
isBlockElement: isBlockElement,
|
|
10449
10448
|
isDefaultOpen: isDefaultOpen,
|
|
10450
10449
|
items: items,
|
|
10451
|
-
|
|
10450
|
+
labelText: labelText,
|
|
10452
10451
|
onClear: onClear,
|
|
10453
10452
|
selectedItems: selectedItems,
|
|
10454
|
-
|
|
10453
|
+
type: type,
|
|
10455
10454
|
width: width
|
|
10456
10455
|
};
|
|
10457
|
-
if (
|
|
10456
|
+
if (type === "listbox") {
|
|
10458
10457
|
var listboxOnChange = onChange;
|
|
10459
10458
|
return React__default.createElement(MultiSelectListbox, Object.assign({}, commonProps, {
|
|
10460
10459
|
ref: ref,
|
|
10461
10460
|
onChange: listboxOnChange
|
|
10462
10461
|
}, rest));
|
|
10463
10462
|
}
|
|
10464
|
-
if (
|
|
10463
|
+
if (type === "dialog") {
|
|
10465
10464
|
var dialogOnChange = onChange;
|
|
10466
10465
|
return React__default.createElement(MultiSelectDialog, Object.assign({}, commonProps, {
|
|
10467
10466
|
onChange: dialogOnChange,
|
|
@@ -10535,7 +10534,6 @@ var MultiSelectGroup = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(
|
|
|
10535
10534
|
isLegendHidden: !showLabel,
|
|
10536
10535
|
__css: styles
|
|
10537
10536
|
}, rest), React__default.createElement(react.Stack, {
|
|
10538
|
-
"aria-label": !showLabel ? labelText : undefined,
|
|
10539
10537
|
className: className,
|
|
10540
10538
|
columnGap: "xs",
|
|
10541
10539
|
"data-testid": "multi-select-group",
|