@nypl/design-system-react-components 1.4.0-rc2 → 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.
@@ -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 of the MultiSelect. */
24
- label: string;
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 variant of the MultiSelect. */
28
- variant: "listbox" | "dialog";
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
- variant: "listbox";
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
- variant: "dialog";
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
- variant: "listbox";
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
- variant: "dialog";
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" | "label" | "onClear" | "variant" | "selectedItems" | "width" | "onApply" | "onMixedStateChange"> & {
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 `variant="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" | "label" | "onClear" | "variant" | "selectedItems" | "width" | "onApply" | "onMixedStateChange"> & {
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 of the MultiSelect using this button. */
8
- multiSelectLabel: string;
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). */
@@ -10048,7 +10048,7 @@ function useFeedbackBox() {
10048
10048
  };
10049
10049
  }
10050
10050
 
10051
- var _excluded$1f = ["id", "isOpen", "multiSelectId", "multiSelectLabel", "onClear", "onKeyDown", "onMenuToggle", "selectedItems"];
10051
+ var _excluded$1f = ["id", "isOpen", "multiSelectId", "multiSelectLabelText", "onClear", "onKeyDown", "onMenuToggle", "selectedItems"];
10052
10052
  var _templateObject;
10053
10053
  var grow = /*#__PURE__*/react.keyframes(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n from {width: 22px; opacity: 0; }\n to {width: 46px; opacity: 1;}\n"])));
10054
10054
  /**
@@ -10063,7 +10063,7 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
10063
10063
  var id = props.id,
10064
10064
  isOpen = props.isOpen,
10065
10065
  multiSelectId = props.multiSelectId,
10066
- multiSelectLabel = props.multiSelectLabel,
10066
+ multiSelectLabelText = props.multiSelectLabelText,
10067
10067
  onClear = props.onClear,
10068
10068
  onMenuToggle = props.onMenuToggle,
10069
10069
  selectedItems = props.selectedItems,
@@ -10076,7 +10076,7 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
10076
10076
  if (((_selectedItems$multiS = selectedItems[multiSelectId]) == null ? void 0 : _selectedItems$multiS.items.length) > 0) {
10077
10077
  getSelectedItemsCount = "" + selectedItems[multiSelectId].items.length;
10078
10078
  var itemPlural = getSelectedItemsCount === "1" ? "" : "s";
10079
- selectedItemsAriaLabel = "remove " + getSelectedItemsCount + " item" + itemPlural + " selected from " + multiSelectLabel;
10079
+ selectedItemsAriaLabel = "remove " + getSelectedItemsCount + " item" + itemPlural + " selected from " + multiSelectLabelText;
10080
10080
  }
10081
10081
  var styles = react.useMultiStyleConfig("MultiSelectMenuButton", {
10082
10082
  isOpen: isOpen,
@@ -10098,9 +10098,9 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
10098
10098
  __css: styles.menuButton
10099
10099
  }, rest), React__default.createElement(react.Box, {
10100
10100
  as: "span",
10101
- title: multiSelectLabel,
10101
+ title: multiSelectLabelText,
10102
10102
  __css: styles.buttonLabel
10103
- }, multiSelectLabel), React__default.createElement(Icon, {
10103
+ }, multiSelectLabelText), React__default.createElement(Icon, {
10104
10104
  id: "ms-" + multiSelectId + "-icon",
10105
10105
  name: iconType,
10106
10106
  size: "small"
@@ -10126,14 +10126,14 @@ var MultiSelectMenuButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref
10126
10126
  })));
10127
10127
  });
10128
10128
 
10129
- var _excluded$1g = ["id", "isBlockElement", "isDefaultOpen", "items", "label", "onChange", "onClear", "selectedItems", "width"];
10130
- /** MultiSelectListbox renders a non-hierarchical list of checkbox options for the `variant="listbox". It leverager downshift-js for accessiblity. */
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. */
10131
10131
  var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
10132
10132
  var id = props.id,
10133
10133
  isBlockElement = props.isBlockElement,
10134
10134
  isDefaultOpen = props.isDefaultOpen,
10135
10135
  items = props.items,
10136
- label = props.label,
10136
+ labelText = props.labelText,
10137
10137
  onChange = props.onChange,
10138
10138
  onClear = props.onClear,
10139
10139
  selectedItems = props.selectedItems,
@@ -10176,18 +10176,18 @@ var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRe
10176
10176
  isBlockElement: isBlockElement,
10177
10177
  isOpen: isOpen
10178
10178
  });
10179
- // If a item passed to the listbox variant has children,
10179
+ // If a item passed to the listbox type has children,
10180
10180
  if (items.some(function (item) {
10181
10181
  return item.children;
10182
10182
  })) {
10183
- console.warn("NYPL Reservoir MultiSelect: Only the variant 'dialog' can render nested select items.");
10183
+ console.warn("NYPL Reservoir MultiSelect: Only the type 'dialog' can render nested select items.");
10184
10184
  }
10185
10185
  return React__default.createElement(react.Box, Object.assign({
10186
10186
  id: id,
10187
10187
  __css: styles
10188
10188
  }, rest), React__default.createElement(MultiSelectMenuButton$1, Object.assign({
10189
10189
  multiSelectId: id,
10190
- multiSelectLabel: label,
10190
+ multiSelectLabelText: labelText,
10191
10191
  isOpen: isOpen,
10192
10192
  selectedItems: selectedItems,
10193
10193
  onClear: onClear,
@@ -10243,13 +10243,13 @@ var MultiSelectListbox = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRe
10243
10243
  }
10244
10244
  });
10245
10245
 
10246
- var _excluded$1h = ["id", "isBlockElement", "isDefaultOpen", "items", "label", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "width"];
10246
+ var _excluded$1h = ["id", "isBlockElement", "isDefaultOpen", "items", "labelText", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "width"];
10247
10247
  var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
10248
10248
  var id = props.id,
10249
10249
  isBlockElement = props.isBlockElement,
10250
10250
  isDefaultOpen = props.isDefaultOpen,
10251
10251
  items = props.items,
10252
- label = props.label,
10252
+ labelText = props.labelText,
10253
10253
  onApply = props.onApply,
10254
10254
  onChange = props.onChange,
10255
10255
  onClear = props.onClear,
@@ -10336,7 +10336,7 @@ var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef
10336
10336
  }, React__default.createElement(MultiSelectMenuButton$1, {
10337
10337
  id: "ms-" + id + "-menu-button",
10338
10338
  multiSelectId: id,
10339
- multiSelectLabel: label,
10339
+ multiSelectLabelText: labelText,
10340
10340
  isOpen: isOpen,
10341
10341
  selectedItems: selectedItems,
10342
10342
  onMenuToggle: function onMenuToggle() {
@@ -10417,7 +10417,7 @@ var MultiSelectDialog = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef
10417
10417
  }
10418
10418
  });
10419
10419
 
10420
- var _excluded$1i = ["id", "isBlockElement", "isDefaultOpen", "items", "label", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "variant", "width"];
10420
+ var _excluded$1i = ["id", "isBlockElement", "isDefaultOpen", "items", "labelText", "onApply", "onChange", "onClear", "onMixedStateChange", "selectedItems", "type", "width"];
10421
10421
  /**
10422
10422
  * The `MultiSelect` component is a form input element that presents a list
10423
10423
  * of `Checkbox` components from which a user can make one or multiple
@@ -10432,13 +10432,13 @@ var MultiSelect$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
10432
10432
  _props$isDefaultOpen = props.isDefaultOpen,
10433
10433
  isDefaultOpen = _props$isDefaultOpen === void 0 ? false : _props$isDefaultOpen,
10434
10434
  items = props.items,
10435
- label = props.label,
10435
+ labelText = props.labelText,
10436
10436
  onApply = props.onApply,
10437
10437
  onChange = props.onChange,
10438
10438
  onClear = props.onClear,
10439
10439
  onMixedStateChange = props.onMixedStateChange,
10440
10440
  selectedItems = props.selectedItems,
10441
- variant = props.variant,
10441
+ type = props.type,
10442
10442
  _props$width = props.width,
10443
10443
  width = _props$width === void 0 ? "default" : _props$width,
10444
10444
  rest = _objectWithoutPropertiesLoose(props, _excluded$1i);
@@ -10447,20 +10447,20 @@ var MultiSelect$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
10447
10447
  isBlockElement: isBlockElement,
10448
10448
  isDefaultOpen: isDefaultOpen,
10449
10449
  items: items,
10450
- label: label,
10450
+ labelText: labelText,
10451
10451
  onClear: onClear,
10452
10452
  selectedItems: selectedItems,
10453
- variant: variant,
10453
+ type: type,
10454
10454
  width: width
10455
10455
  };
10456
- if (variant === "listbox") {
10456
+ if (type === "listbox") {
10457
10457
  var listboxOnChange = onChange;
10458
10458
  return React__default.createElement(MultiSelectListbox, Object.assign({}, commonProps, {
10459
10459
  ref: ref,
10460
10460
  onChange: listboxOnChange
10461
10461
  }, rest));
10462
10462
  }
10463
- if (variant === "dialog") {
10463
+ if (type === "dialog") {
10464
10464
  var dialogOnChange = onChange;
10465
10465
  return React__default.createElement(MultiSelectDialog, Object.assign({}, commonProps, {
10466
10466
  onChange: dialogOnChange,