@nypl/design-system-react-components 0.26.1 → 0.27.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/CHANGELOG.md CHANGED
@@ -8,6 +8,23 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
+ ## 0.27.0 (April 27, 2022)
12
+
13
+ ### Adds
14
+
15
+ - Adds two patterns for rendering the updated `Modal` component. This is still an ongoing work-in-progress as the `Modal` gets finalized but it is now using Chakra under-the-hood.
16
+ - Adds `@chakra-ui/storybook-addon` so stories automatically pick up the Chakra-based NYPL theme.
17
+
18
+ ### Updates
19
+
20
+ - Updates React and React DOM to version 17.
21
+ - Updates Chakra packages `@chakra-ui/react` and `@chakra-ui/system`.
22
+ - Updates the `HelperErrorText` styling to correctly display when used with a `Select` element with a `labelPosition` of inline.
23
+
24
+ ### Removals
25
+
26
+ - Removes the following packages: `@storybook/addon-queryparams` and `react-router-dom`.
27
+
11
28
  ## 0.26.1 (April 22, 2022)
12
29
 
13
30
  ### Updates
@@ -1,13 +1,33 @@
1
1
  import * as React from "react";
2
- export interface ModalProps {
3
- /** ClassName that appears in addition to "modal" */
4
- className?: string;
2
+ interface BaseModalProps {
3
+ bodyContent?: string | JSX.Element;
4
+ closeButtonLabel?: string;
5
+ headingText?: string | JSX.Element;
5
6
  /** ID that other components can cross reference for accessibility purposes */
6
7
  id?: string;
8
+ isOpen?: boolean;
9
+ onClose?: () => void;
7
10
  }
8
- /** Full-screen modal that appears on top of the body of the page. */
9
- export default class Modal extends React.Component<ModalProps, any> {
10
- componentDidMount(): void;
11
- componentWillUnmount(): void;
12
- render(): JSX.Element;
11
+ export interface ModalProps {
12
+ buttonText?: string;
13
+ /** ID that other components can cross reference for accessibility purposes */
14
+ id?: string;
15
+ modalProps: BaseModalProps;
13
16
  }
17
+ /**
18
+ * The `ModalTrigger` component renders a button that you click to open the
19
+ * internal `Modal` component. Note that props to update the internal `Modal`
20
+ * component are passed through to the `modalProps` prop.
21
+ */
22
+ export declare const ModalTrigger: import("@chakra-ui/react").ChakraComponent<({ buttonText, id, modalProps, ...rest }: React.PropsWithChildren<ModalProps>) => JSX.Element, {}>;
23
+ /**
24
+ * This hook function can be used to render the `Modal` component with a custom
25
+ * open button(s) and optional custom close button(s). You must render your own
26
+ * button and pass the appropriate `onOpen` and ` handler for the modal to open.
27
+ */
28
+ export declare function useModal(): {
29
+ onClose: () => void;
30
+ onOpen: () => void;
31
+ Modal: import("@chakra-ui/react").ChakraComponent<({ bodyContent, closeButtonLabel, headingText, id, ...rest }: React.PropsWithChildren<BaseModalProps>) => JSX.Element, {}>;
32
+ };
33
+ export {};
@@ -29,22 +29,6 @@ function _extends() {
29
29
  return _extends.apply(this, arguments);
30
30
  }
31
31
 
32
- function _inheritsLoose(subClass, superClass) {
33
- subClass.prototype = Object.create(superClass.prototype);
34
- subClass.prototype.constructor = subClass;
35
-
36
- _setPrototypeOf(subClass, superClass);
37
- }
38
-
39
- function _setPrototypeOf(o, p) {
40
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
41
- o.__proto__ = p;
42
- return o;
43
- };
44
-
45
- return _setPrototypeOf(o, p);
46
- }
47
-
48
32
  function _objectWithoutPropertiesLoose(source, excluded) {
49
33
  if (source == null) return {};
50
34
  var target = {};
@@ -4333,8 +4317,7 @@ var select = {
4333
4317
  var Select = {
4334
4318
  parts: ["helperText", "inline", "select"],
4335
4319
  baseStyle: function baseStyle(_ref) {
4336
- var labelPosition = _ref.labelPosition,
4337
- labelWidth = _ref.labelWidth;
4320
+ var labelPosition = _ref.labelPosition;
4338
4321
  return {
4339
4322
  marginBottom: "xs",
4340
4323
  // The backgroundColor set to "ui.white" hides the arrow SVG icon when
@@ -4343,11 +4326,6 @@ var Select = {
4343
4326
  ".chakra-select__icon-wrapper": {
4344
4327
  zIndex: "9999"
4345
4328
  },
4346
- helperText: {
4347
- marginLeft: labelPosition === "inline" ? {
4348
- md: labelWidth + "px"
4349
- } : null
4350
- },
4351
4329
  inline: {
4352
4330
  display: {
4353
4331
  md: "flex"
@@ -8759,43 +8737,119 @@ var Logo$1 = /*#__PURE__*/react.chakra(function (props) {
8759
8737
  }, rest), childSVG);
8760
8738
  });
8761
8739
 
8762
- /** Full-screen modal that appears on top of the body of the page. */
8740
+ var _excluded$1p = ["bodyContent", "closeButtonLabel", "headingText", "id", "isOpen", "onClose"],
8741
+ _excluded2$5 = ["buttonText", "id", "modalProps"],
8742
+ _excluded3$2 = ["bodyContent", "closeButtonLabel", "headingText", "id"];
8743
+ var BaseModal = /*#__PURE__*/react.chakra(function (_ref) {
8744
+ var bodyContent = _ref.bodyContent,
8745
+ _ref$closeButtonLabel = _ref.closeButtonLabel,
8746
+ closeButtonLabel = _ref$closeButtonLabel === void 0 ? "Close" : _ref$closeButtonLabel,
8747
+ headingText = _ref.headingText,
8748
+ id = _ref.id,
8749
+ isOpen = _ref.isOpen,
8750
+ onClose = _ref.onClose,
8751
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1p);
8763
8752
 
8764
- var Modal = /*#__PURE__*/function (_React$Component) {
8765
- _inheritsLoose(Modal, _React$Component);
8753
+ // Based on --nypl-breakpoint-medium
8754
+ var breakpointMedium = 600;
8755
+ var defaultSize = "xl";
8756
+ var fullSize = "full";
8766
8757
 
8767
- function Modal() {
8768
- return _React$Component.apply(this, arguments) || this;
8769
- }
8758
+ var _React$useState = React.useState(defaultSize),
8759
+ size = _React$useState[0],
8760
+ setSize = _React$useState[1];
8770
8761
 
8771
- var _proto = Modal.prototype;
8762
+ var windowDimensions = useWindowSize();
8763
+ React.useEffect(function () {
8764
+ if (windowDimensions.width <= breakpointMedium) {
8765
+ setSize(fullSize);
8766
+ } else {
8767
+ setSize(defaultSize);
8768
+ }
8769
+ }, [windowDimensions.width]);
8770
+ return React.createElement(react.Modal, Object.assign({
8771
+ id: id,
8772
+ isOpen: isOpen,
8773
+ onClose: onClose,
8774
+ scrollBehavior: "inside",
8775
+ size: size
8776
+ }, rest), React.createElement(react.ModalOverlay, null), React.createElement(react.ModalContent, null, React.createElement(react.ModalHeader, null, headingText), React.createElement(react.ModalCloseButton, null), React.createElement(react.ModalBody, null, bodyContent), React.createElement(react.ModalFooter, null, React.createElement(react.ButtonGroup, null, React.createElement(Button, {
8777
+ id: "modal-close-btn",
8778
+ onClick: onClose
8779
+ }, closeButtonLabel)))));
8780
+ });
8781
+ /**
8782
+ * The `ModalTrigger` component renders a button that you click to open the
8783
+ * internal `Modal` component. Note that props to update the internal `Modal`
8784
+ * component are passed through to the `modalProps` prop.
8785
+ */
8772
8786
 
8773
- _proto.componentDidMount = function componentDidMount() {
8774
- document.body.classList.add("no-scroll");
8775
- };
8787
+ var ModalTrigger = /*#__PURE__*/react.chakra(function (_ref2) {
8788
+ var buttonText = _ref2.buttonText,
8789
+ id = _ref2.id,
8790
+ modalProps = _ref2.modalProps,
8791
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$5);
8776
8792
 
8777
- _proto.componentWillUnmount = function componentWillUnmount() {
8778
- document.body.classList.remove("no-scroll");
8779
- };
8793
+ var _useDisclosure = react.useDisclosure(),
8794
+ isOpen = _useDisclosure.isOpen,
8795
+ onOpen = _useDisclosure.onOpen,
8796
+ onClose = _useDisclosure.onClose;
8780
8797
 
8781
- _proto.render = function render() {
8782
- var _this$props = this.props,
8783
- id = _this$props.id,
8784
- className = _this$props.className;
8785
- return React.createElement("div", {
8786
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
8787
- tabIndex: 0,
8788
- className: "modal " + className,
8789
- id: id
8790
- }, this.props.children);
8798
+ var finalOnCloseHandler = function finalOnCloseHandler() {
8799
+ modalProps.onClose && modalProps.onClose();
8800
+ onClose();
8791
8801
  };
8792
8802
 
8793
- return Modal;
8794
- }(React.Component);
8803
+ return React.createElement(React.Fragment, null, React.createElement(Button, {
8804
+ id: "modal-open-btn",
8805
+ onClick: onOpen
8806
+ }, buttonText), React.createElement(BaseModal, Object.assign({
8807
+ bodyContent: modalProps.bodyContent,
8808
+ closeButtonLabel: modalProps.closeButtonLabel,
8809
+ headingText: modalProps.headingText,
8810
+ id: id,
8811
+ isOpen: isOpen,
8812
+ onClose: finalOnCloseHandler
8813
+ }, rest)));
8814
+ });
8815
+ /**
8816
+ * This hook function can be used to render the `Modal` component with a custom
8817
+ * open button(s) and optional custom close button(s). You must render your own
8818
+ * button and pass the appropriate `onOpen` and ` handler for the modal to open.
8819
+ */
8820
+
8821
+ function useModal() {
8822
+ var _useDisclosure2 = react.useDisclosure(),
8823
+ isOpen = _useDisclosure2.isOpen,
8824
+ onClose = _useDisclosure2.onClose,
8825
+ onOpen = _useDisclosure2.onOpen;
8826
+
8827
+ var Modal = react.chakra(function (_ref3) {
8828
+ var bodyContent = _ref3.bodyContent,
8829
+ closeButtonLabel = _ref3.closeButtonLabel,
8830
+ headingText = _ref3.headingText,
8831
+ id = _ref3.id,
8832
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3$2);
8833
+
8834
+ return React.createElement(BaseModal, Object.assign({
8835
+ bodyContent: bodyContent,
8836
+ closeButtonLabel: closeButtonLabel,
8837
+ headingText: headingText,
8838
+ id: id,
8839
+ isOpen: isOpen,
8840
+ onClose: onClose
8841
+ }, rest));
8842
+ });
8843
+ return {
8844
+ onClose: onClose,
8845
+ onOpen: onOpen,
8846
+ Modal: Modal
8847
+ };
8848
+ }
8795
8849
 
8796
- var _excluded$1p = ["children", "icon", "id", "isCentered", "notificationType"],
8797
- _excluded2$5 = ["alignText", "children", "icon", "notificationType"],
8798
- _excluded3$2 = ["ariaLabel", "className", "dismissible", "icon", "id", "isCentered", "noMargin", "notificationContent", "notificationHeading", "notificationType", "showIcon"];
8850
+ var _excluded$1q = ["children", "icon", "id", "isCentered", "notificationType"],
8851
+ _excluded2$6 = ["alignText", "children", "icon", "notificationType"],
8852
+ _excluded3$3 = ["ariaLabel", "className", "dismissible", "icon", "id", "isCentered", "noMargin", "notificationContent", "notificationHeading", "notificationType", "showIcon"];
8799
8853
  /**
8800
8854
  * NotificationHeading child-component.
8801
8855
  */
@@ -8806,7 +8860,7 @@ var NotificationHeading$1 = /*#__PURE__*/react.chakra(function (props) {
8806
8860
  id = props.id,
8807
8861
  isCentered = props.isCentered,
8808
8862
  notificationType = props.notificationType,
8809
- rest = _objectWithoutPropertiesLoose(props, _excluded$1p);
8863
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1q);
8810
8864
 
8811
8865
  var styles = react.useMultiStyleConfig("NotificationHeading", {
8812
8866
  icon: icon,
@@ -8831,7 +8885,7 @@ var NotificationContent$1 = /*#__PURE__*/react.chakra(function (props) {
8831
8885
  children = props.children,
8832
8886
  icon = props.icon,
8833
8887
  notificationType = props.notificationType,
8834
- rest = _objectWithoutPropertiesLoose(props, _excluded2$5);
8888
+ rest = _objectWithoutPropertiesLoose(props, _excluded2$6);
8835
8889
 
8836
8890
  var styles = react.useMultiStyleConfig("NotificationContent", {
8837
8891
  alignText: alignText,
@@ -8866,7 +8920,7 @@ var Notification$1 = /*#__PURE__*/react.chakra(function (props) {
8866
8920
  notificationType = _props$notificationTy === void 0 ? exports.NotificationTypes.Standard : _props$notificationTy,
8867
8921
  _props$showIcon = props.showIcon,
8868
8922
  showIcon = _props$showIcon === void 0 ? true : _props$showIcon,
8869
- rest = _objectWithoutPropertiesLoose(props, _excluded3$2);
8923
+ rest = _objectWithoutPropertiesLoose(props, _excluded3$3);
8870
8924
 
8871
8925
  var _useState = React.useState(true),
8872
8926
  isOpen = _useState[0],
@@ -8962,7 +9016,7 @@ var Notification$1 = /*#__PURE__*/react.chakra(function (props) {
8962
9016
  }, childHeading, childContent), dismissibleButton);
8963
9017
  });
8964
9018
 
8965
- var _excluded$1q = ["className", "currentPage", "getPageHref", "id", "initialPage", "onPageChange", "pageCount"];
9019
+ var _excluded$1r = ["className", "currentPage", "getPageHref", "id", "initialPage", "onPageChange", "pageCount"];
8966
9020
  /**
8967
9021
  * A component that provides a navigational list of page items.
8968
9022
  */
@@ -8976,7 +9030,7 @@ var Pagination$1 = /*#__PURE__*/react.chakra(function (props) {
8976
9030
  initialPage = _props$initialPage === void 0 ? 1 : _props$initialPage,
8977
9031
  onPageChange = props.onPageChange,
8978
9032
  pageCount = props.pageCount,
8979
- rest = _objectWithoutPropertiesLoose(props, _excluded$1q);
9033
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1r);
8980
9034
 
8981
9035
  var refCurrentPage = React.useRef(currentPage);
8982
9036
 
@@ -9168,7 +9222,7 @@ var Pagination$1 = /*#__PURE__*/react.chakra(function (props) {
9168
9222
  }, previousLiLink, getPaginationNumbers(selectedPage), nextLiLink));
9169
9223
  });
9170
9224
 
9171
- var _excluded$1r = ["darkMode", "id", "indicatorType", "isIndeterminate", "labelText", "showLabel", "size", "value"];
9225
+ var _excluded$1s = ["darkMode", "id", "indicatorType", "isIndeterminate", "labelText", "showLabel", "size", "value"];
9172
9226
  /**
9173
9227
  * A component that displays a progress status for any task that takes a long
9174
9228
  * time to complete or consists of multiple steps. Examples include downloading,
@@ -9190,7 +9244,7 @@ var ProgressIndicator$1 = /*#__PURE__*/react.chakra(function (props) {
9190
9244
  size = _props$size === void 0 ? exports.ProgressIndicatorSizes.Default : _props$size,
9191
9245
  _props$value = props.value,
9192
9246
  value = _props$value === void 0 ? 0 : _props$value,
9193
- rest = _objectWithoutPropertiesLoose(props, _excluded$1r);
9247
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1s);
9194
9248
 
9195
9249
  var styles = react.useMultiStyleConfig("ProgressIndicator", {
9196
9250
  darkMode: darkMode,
@@ -9256,7 +9310,7 @@ var ProgressIndicator$1 = /*#__PURE__*/react.chakra(function (props) {
9256
9310
  }, rest), progressComponent(indicatorType));
9257
9311
  });
9258
9312
 
9259
- var _excluded$1s = ["className", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
9313
+ var _excluded$1t = ["className", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
9260
9314
  var Radio$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
9261
9315
  var className = props.className,
9262
9316
  helperText = props.helperText,
@@ -9277,7 +9331,7 @@ var Radio$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function
9277
9331
  _props$showLabel = props.showLabel,
9278
9332
  showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
9279
9333
  value = props.value,
9280
- rest = _objectWithoutPropertiesLoose(props, _excluded$1s);
9334
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1t);
9281
9335
 
9282
9336
  var styles = react.useMultiStyleConfig("Radio", {});
9283
9337
  var footnote = isInvalid ? invalidText : helperText;
@@ -9318,7 +9372,7 @@ var Radio$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function
9318
9372
  }));
9319
9373
  }));
9320
9374
 
9321
- var _excluded$1t = ["children", "className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isFullWidth", "isInvalid", "isRequired", "labelText", "layout", "name", "onChange", "showHelperInvalidText", "showLabel", "showRequiredLabel"];
9375
+ var _excluded$1u = ["children", "className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isFullWidth", "isInvalid", "isRequired", "labelText", "layout", "name", "onChange", "showHelperInvalidText", "showLabel", "showRequiredLabel"];
9322
9376
  /**
9323
9377
  * RadioGroup is a wrapper for DS `Radio` components that renders as a fieldset
9324
9378
  * HTML element along with optional helper text. The `name` prop is essential
@@ -9354,7 +9408,7 @@ var RadioGroup$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(func
9354
9408
  showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
9355
9409
  _props$showRequiredLa = props.showRequiredLabel,
9356
9410
  showRequiredLabel = _props$showRequiredLa === void 0 ? true : _props$showRequiredLa,
9357
- rest = _objectWithoutPropertiesLoose(props, _excluded$1t);
9411
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1u);
9358
9412
 
9359
9413
  var _React$useState = React.useState(defaultValue),
9360
9414
  value = _React$useState[0],
@@ -9430,7 +9484,7 @@ var RadioGroup$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(func
9430
9484
  TextSizes["Mini"] = "mini";
9431
9485
  })(exports.TextSizes || (exports.TextSizes = {}));
9432
9486
 
9433
- var _excluded$1u = ["children", "className", "isBold", "isItalic", "noSpace", "size"];
9487
+ var _excluded$1v = ["children", "className", "isBold", "isItalic", "noSpace", "size"];
9434
9488
  var Text$1 = /*#__PURE__*/react.chakra(function (props) {
9435
9489
  var children = props.children,
9436
9490
  _props$className = props.className,
@@ -9440,7 +9494,7 @@ var Text$1 = /*#__PURE__*/react.chakra(function (props) {
9440
9494
  noSpace = props.noSpace,
9441
9495
  _props$size = props.size,
9442
9496
  size = _props$size === void 0 ? exports.TextSizes.Default : _props$size,
9443
- rest = _objectWithoutPropertiesLoose(props, _excluded$1u);
9497
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1v);
9444
9498
 
9445
9499
  var variant = getVariant(size, exports.TextSizes, exports.TextSizes.Default);
9446
9500
  var styles = react.useStyleConfig("Text", {
@@ -9460,7 +9514,7 @@ var Text$1 = /*#__PURE__*/react.chakra(function (props) {
9460
9514
  }, rest), children);
9461
9515
  });
9462
9516
 
9463
- var _excluded$1v = ["children", "descriptionText", "headingText", "helperText", "id", "invalidText", "isInvalid"];
9517
+ var _excluded$1w = ["children", "descriptionText", "headingText", "helperText", "id", "invalidText", "isInvalid"];
9464
9518
  var ComponentWrapper$1 = /*#__PURE__*/react.chakra(function (props) {
9465
9519
  var children = props.children,
9466
9520
  descriptionText = props.descriptionText,
@@ -9470,7 +9524,7 @@ var ComponentWrapper$1 = /*#__PURE__*/react.chakra(function (props) {
9470
9524
  invalidText = props.invalidText,
9471
9525
  _props$isInvalid = props.isInvalid,
9472
9526
  isInvalid = _props$isInvalid === void 0 ? false : _props$isInvalid,
9473
- rest = _objectWithoutPropertiesLoose(props, _excluded$1v);
9527
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1w);
9474
9528
 
9475
9529
  var hasChildren = !!children;
9476
9530
  var styles = react.useMultiStyleConfig("ComponentWrapper", {
@@ -9510,7 +9564,7 @@ var SelectTypes;
9510
9564
  LabelPositions["Inline"] = "inline";
9511
9565
  })(exports.LabelPositions || (exports.LabelPositions = {}));
9512
9566
 
9513
- var _excluded$1w = ["additionalStyles", "children", "className", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelPosition", "labelText", "name", "onChange", "placeholder", "selectType", "showHelperInvalidText", "showLabel", "showRequiredLabel", "value"];
9567
+ var _excluded$1x = ["additionalStyles", "children", "className", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelPosition", "labelText", "name", "onChange", "placeholder", "selectType", "showHelperInvalidText", "showLabel", "showRequiredLabel", "value"];
9514
9568
  /**
9515
9569
  * Component that renders Chakra's `Select` component along with an accessible
9516
9570
  * `Label` and optional `HelperErrorText` component.
@@ -9546,7 +9600,7 @@ var Select$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React__default.forwardRef
9546
9600
  showRequiredLabel = _props$showRequiredLa === void 0 ? true : _props$showRequiredLa,
9547
9601
  _props$value = props.value,
9548
9602
  value = _props$value === void 0 ? "" : _props$value,
9549
- rest = _objectWithoutPropertiesLoose(props, _excluded$1w);
9603
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1x);
9550
9604
 
9551
9605
  var ariaAttributes = {};
9552
9606
 
@@ -9557,8 +9611,7 @@ var Select$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React__default.forwardRef
9557
9611
  var labelRef = React.useRef();
9558
9612
  var styles = react.useMultiStyleConfig("CustomSelect", {
9559
9613
  variant: selectType,
9560
- labelPosition: labelPosition,
9561
- labelWidth: labelWidth
9614
+ labelPosition: labelPosition
9562
9615
  });
9563
9616
  var finalInvalidText = invalidText ? invalidText : "There is an error related to this field.";
9564
9617
  var footnote = isInvalid ? finalInvalidText : helperText; // To control the `Select` component, both `onChange` and `value`
@@ -9567,7 +9620,10 @@ var Select$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React__default.forwardRef
9567
9620
  var controlledProps = onChange ? {
9568
9621
  onChange: onChange,
9569
9622
  value: value
9570
- } : {};
9623
+ } : {}; // The number of pixels between the label and select elements
9624
+ // when the labelPosition is inline (equivalent to --nypl-space-xs).
9625
+
9626
+ var labelSelectGap = 8;
9571
9627
 
9572
9628
  if (!showLabel) {
9573
9629
  ariaAttributes["aria-label"] = labelText && footnote ? labelText + " - " + footnote : labelText;
@@ -9582,9 +9638,11 @@ var Select$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React__default.forwardRef
9582
9638
  React.useEffect(function () {
9583
9639
  if (labelPosition === exports.LabelPositions.Inline) {
9584
9640
  if (labelRef.current) {
9585
- var width = labelRef.current.clientWidth + 8;
9641
+ var width = labelRef.current.clientWidth + labelSelectGap;
9586
9642
  setLabelWidth(width);
9587
9643
  }
9644
+ } else {
9645
+ setLabelWidth(0);
9588
9646
  }
9589
9647
  }, [labelPosition]);
9590
9648
  return React__default.createElement(react.Box, Object.assign({
@@ -9615,14 +9673,18 @@ var Select$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React__default.forwardRef
9615
9673
  size: exports.IconSizes.Medium
9616
9674
  }),
9617
9675
  __css: styles.select
9618
- }), children), footnote && showHelperInvalidText && React__default.createElement(HelperErrorText, {
9676
+ }), children)), footnote && showHelperInvalidText && React__default.createElement(HelperErrorText, {
9619
9677
  id: id + "-helperText",
9620
9678
  isInvalid: isInvalid,
9621
- text: footnote
9622
- })));
9679
+ text: footnote,
9680
+ ml: {
9681
+ sm: "auto",
9682
+ md: labelWidth + "px"
9683
+ }
9684
+ }));
9623
9685
  }));
9624
9686
 
9625
- var _excluded$1x = ["action", "buttonOnClick", "className", "descriptionText", "headingText", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "method", "noBrandButtonType", "onSubmit", "selectProps", "textInputElement", "textInputProps"];
9687
+ var _excluded$1y = ["action", "buttonOnClick", "className", "descriptionText", "headingText", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "method", "noBrandButtonType", "onSubmit", "selectProps", "textInputElement", "textInputProps"];
9626
9688
  /**
9627
9689
  * Renders a wrapper `form` element to be used with `Select` (optional),
9628
9690
  * `Input`, and `Button` components together.
@@ -9652,7 +9714,7 @@ var SearchBar$1 = /*#__PURE__*/react.chakra(function (props) {
9652
9714
  selectProps = props.selectProps,
9653
9715
  textInputElement = props.textInputElement,
9654
9716
  textInputProps = props.textInputProps,
9655
- rest = _objectWithoutPropertiesLoose(props, _excluded$1x);
9717
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1y);
9656
9718
 
9657
9719
  var styles = react.useMultiStyleConfig("SearchBar", {});
9658
9720
  var stateProps = {
@@ -9751,7 +9813,7 @@ var SearchBar$1 = /*#__PURE__*/react.chakra(function (props) {
9751
9813
  SkeletonLoaderImageRatios["Square"] = "square";
9752
9814
  })(exports.SkeletonLoaderImageRatios || (exports.SkeletonLoaderImageRatios = {}));
9753
9815
 
9754
- var _excluded$1y = ["className", "contentSize", "headingSize", "imageAspectRatio", "isBordered", "layout", "showButton", "showContent", "showHeading", "showImage", "width"];
9816
+ var _excluded$1z = ["className", "contentSize", "headingSize", "imageAspectRatio", "isBordered", "layout", "showButton", "showContent", "showHeading", "showImage", "width"];
9755
9817
  /**
9756
9818
  * The `SkeletonLoader` component renders a placeholder to be used while
9757
9819
  * dynamic content is loading.
@@ -9778,7 +9840,7 @@ var SkeletonLoader$1 = /*#__PURE__*/react.chakra(function (props) {
9778
9840
  _props$showImage = props.showImage,
9779
9841
  showImage = _props$showImage === void 0 ? true : _props$showImage,
9780
9842
  width = props.width,
9781
- rest = _objectWithoutPropertiesLoose(props, _excluded$1y);
9843
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1z);
9782
9844
 
9783
9845
  var styles = react.useMultiStyleConfig("SkeletonLoader", {
9784
9846
  isBordered: isBordered,
@@ -9840,7 +9902,7 @@ var SkeletonLoader$1 = /*#__PURE__*/react.chakra(function (props) {
9840
9902
  })))));
9841
9903
  });
9842
9904
 
9843
- var _excluded$1z = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRangeSlider", "isRequired", "labelText", "max", "min", "name", "onChange", "showBoxes", "showHelperInvalidText", "showLabel", "showRequiredLabel", "showValues", "step"];
9905
+ var _excluded$1A = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRangeSlider", "isRequired", "labelText", "max", "min", "name", "onChange", "showBoxes", "showHelperInvalidText", "showLabel", "showRequiredLabel", "showValues", "step"];
9844
9906
  /**
9845
9907
  * The `Slider` component renders a singular value slider or a range slider
9846
9908
  * with a min and max value. The value(s) can be updated through the slider
@@ -9881,7 +9943,7 @@ var Slider = /*#__PURE__*/react.chakra(function (props) {
9881
9943
  showValues = _props$showValues === void 0 ? true : _props$showValues,
9882
9944
  _props$step = props.step,
9883
9945
  step = _props$step === void 0 ? 1 : _props$step,
9884
- rest = _objectWithoutPropertiesLoose(props, _excluded$1z);
9946
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1A);
9885
9947
 
9886
9948
  if (!id) {
9887
9949
  console.warn("NYPL Reservoir Slider: This component's required `id` prop was not passed.");
@@ -10072,7 +10134,7 @@ var Slider = /*#__PURE__*/react.chakra(function (props) {
10072
10134
  StatusBadgeTypes["High"] = "high";
10073
10135
  })(exports.StatusBadgeTypes || (exports.StatusBadgeTypes = {}));
10074
10136
 
10075
- var _excluded$1A = ["children", "className", "id", "level"];
10137
+ var _excluded$1B = ["children", "className", "id", "level"];
10076
10138
  /**
10077
10139
  * The `StatusBadge` component is used to display a visual badge for three
10078
10140
  * different status levels.
@@ -10084,7 +10146,7 @@ var StatusBadge$1 = /*#__PURE__*/react.chakra(function (props) {
10084
10146
  id = props.id,
10085
10147
  _props$level = props.level,
10086
10148
  level = _props$level === void 0 ? exports.StatusBadgeTypes.Low : _props$level,
10087
- rest = _objectWithoutPropertiesLoose(props, _excluded$1A);
10149
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1B);
10088
10150
 
10089
10151
  var styles = react.useStyleConfig("StatusBadge", {
10090
10152
  variant: level
@@ -10107,7 +10169,7 @@ var StatusBadge$1 = /*#__PURE__*/react.chakra(function (props) {
10107
10169
  StructuredContentImagePosition["Center"] = "center";
10108
10170
  })(exports.StructuredContentImagePosition || (exports.StructuredContentImagePosition = {}));
10109
10171
 
10110
- var _excluded$1B = ["calloutText", "className", "headingText", "id", "imageProps", "bodyContent"];
10172
+ var _excluded$1C = ["calloutText", "className", "headingText", "id", "imageProps", "bodyContent"];
10111
10173
  /**
10112
10174
  * Internal component used in the `StructuredContent` component
10113
10175
  * that renders the DS `Image` component.
@@ -10159,7 +10221,7 @@ var StructuredContent$1 = /*#__PURE__*/react.chakra(function (props) {
10159
10221
  src: ""
10160
10222
  } : _props$imageProps,
10161
10223
  bodyContent = props.bodyContent,
10162
- rest = _objectWithoutPropertiesLoose(props, _excluded$1B);
10224
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1C);
10163
10225
 
10164
10226
  var hasImage = imageProps.src || imageProps.component;
10165
10227
  var hasFigureImage = imageProps.caption || imageProps.credit;
@@ -10261,7 +10323,7 @@ var useCarouselStyles = function useCarouselStyles(slidesCount, slideWidth) {
10261
10323
  };
10262
10324
  };
10263
10325
 
10264
- var _excluded$1C = ["children", "defaultIndex", "id", "onChange", "tabsData", "useHash"];
10326
+ var _excluded$1D = ["children", "defaultIndex", "id", "onChange", "tabsData", "useHash"];
10265
10327
  /**
10266
10328
  * An internal function used to update the hash in the URL.
10267
10329
  * This function is only used when `useHash` is `true`.
@@ -10380,7 +10442,7 @@ var Tabs = /*#__PURE__*/react.chakra(function (props) {
10380
10442
  tabsData = props.tabsData,
10381
10443
  _props$useHash = props.useHash,
10382
10444
  useHash = _props$useHash === void 0 ? false : _props$useHash,
10383
- rest = _objectWithoutPropertiesLoose(props, _excluded$1C);
10445
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1D);
10384
10446
 
10385
10447
  var styles = react.useMultiStyleConfig("Tabs", {}); // Just an estimate of the tab width for the mobile carousel.
10386
10448
 
@@ -10479,7 +10541,7 @@ var Tabs = /*#__PURE__*/react.chakra(function (props) {
10479
10541
  }, React.createElement(react.Box, Object.assign({}, carouselStyle), tabs)), nextButton), panels);
10480
10542
  }); // Tabs is also exported above so the props can display in Storybook.
10481
10543
 
10482
- var _excluded$1D = ["aboveHeader", "breakout", "contentId", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement"];
10544
+ var _excluded$1E = ["aboveHeader", "breakout", "contentId", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement"];
10483
10545
  /**
10484
10546
  * The main top-level parent component that wraps all template-related
10485
10547
  * components.
@@ -10706,7 +10768,7 @@ var TemplateAppContainer = /*#__PURE__*/react.chakra(function (props) {
10706
10768
  renderFooterElement = _props$renderFooterEl === void 0 ? true : _props$renderFooterEl,
10707
10769
  _props$renderHeaderEl = props.renderHeaderElement,
10708
10770
  renderHeaderElement = _props$renderHeaderEl === void 0 ? true : _props$renderHeaderEl,
10709
- rest = _objectWithoutPropertiesLoose(props, _excluded$1D);
10771
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1E);
10710
10772
 
10711
10773
  var aboveHeaderElem = aboveHeader && React.createElement(TemplateAboveHeader, null, aboveHeader);
10712
10774
  var breakoutElem = breakout && React.createElement(TemplateBreakout$1, null, breakout);
@@ -10723,7 +10785,7 @@ var TemplateAppContainer = /*#__PURE__*/react.chakra(function (props) {
10723
10785
  }, footer));
10724
10786
  });
10725
10787
 
10726
- var _excluded$1E = ["additionalStyles", "defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
10788
+ var _excluded$1F = ["additionalStyles", "defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
10727
10789
  var onChangeDefault$1 = function onChangeDefault() {
10728
10790
  return;
10729
10791
  };
@@ -10752,7 +10814,7 @@ var Toggle$2 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function
10752
10814
  onChange = _props$onChange === void 0 ? onChangeDefault$1 : _props$onChange,
10753
10815
  _props$size = props.size,
10754
10816
  size = _props$size === void 0 ? exports.ToggleSizes.Default : _props$size,
10755
- rest = _objectWithoutPropertiesLoose(props, _excluded$1E);
10817
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1F);
10756
10818
 
10757
10819
  var footnote = isInvalid ? invalidText : helperText;
10758
10820
  var ariaAttributes = {};
@@ -10894,7 +10956,7 @@ function useNYPLTheme() {
10894
10956
  VideoPlayerAspectRatios["Square"] = "square";
10895
10957
  })(exports.VideoPlayerAspectRatios || (exports.VideoPlayerAspectRatios = {}));
10896
10958
 
10897
- var _excluded$1F = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
10959
+ var _excluded$1G = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
10898
10960
  var VideoPlayer$1 = /*#__PURE__*/react.chakra(function (props) {
10899
10961
  var aspectRatio = props.aspectRatio,
10900
10962
  className = props.className,
@@ -10908,7 +10970,7 @@ var VideoPlayer$1 = /*#__PURE__*/react.chakra(function (props) {
10908
10970
  showHelperInvalidText = _props$showHelperInva === void 0 ? true : _props$showHelperInva,
10909
10971
  videoId = props.videoId,
10910
10972
  videoType = props.videoType,
10911
- rest = _objectWithoutPropertiesLoose(props, _excluded$1F);
10973
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1G);
10912
10974
 
10913
10975
  var iframeTitleFinal = videoType === exports.VideoPlayerTypes.Vimeo ? iframeTitle || "Vimeo video player" : iframeTitle || "YouTube video player";
10914
10976
  var videoSrc = videoType === exports.VideoPlayerTypes.Vimeo ? "https://player.vimeo.com/video/" + videoId + "?autoplay=0&loop=0" : "https://www.youtube.com/embed/" + videoId + "?disablekb=1&autoplay=0&fs=1&modestbranding=0";
@@ -10977,7 +11039,7 @@ var VideoPlayer$1 = /*#__PURE__*/react.chakra(function (props) {
10977
11039
  }, embedElement)));
10978
11040
  });
10979
11041
 
10980
- var _excluded$1G = ["className", "columnHeaders", "columnHeadersBackgroundColor", "columnHeadersTextColor", "id", "showRowDividers", "tableData", "titleText", "useRowHeaders"];
11042
+ var _excluded$1H = ["className", "columnHeaders", "columnHeadersBackgroundColor", "columnHeadersTextColor", "id", "showRowDividers", "tableData", "titleText", "useRowHeaders"];
10981
11043
  /**
10982
11044
  * Basic `Table` component used to organize and display tabular data in
10983
11045
  * rows and columns.
@@ -10995,7 +11057,7 @@ var Table = /*#__PURE__*/react.chakra(function (props) {
10995
11057
  titleText = props.titleText,
10996
11058
  _props$useRowHeaders = props.useRowHeaders,
10997
11059
  useRowHeaders = _props$useRowHeaders === void 0 ? false : _props$useRowHeaders,
10998
- rest = _objectWithoutPropertiesLoose(props, _excluded$1G);
11060
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1H);
10999
11061
 
11000
11062
  var customColors = {};
11001
11063
  columnHeadersBackgroundColor && (customColors["backgroundColor"] = columnHeadersBackgroundColor);
@@ -11168,7 +11230,7 @@ exports.Label = Label;
11168
11230
  exports.Link = Link;
11169
11231
  exports.List = List$1;
11170
11232
  exports.Logo = Logo$1;
11171
- exports.Modal = Modal;
11233
+ exports.ModalTrigger = ModalTrigger;
11172
11234
  exports.Notification = Notification$1;
11173
11235
  exports.Pagination = Pagination$1;
11174
11236
  exports.ProgressIndicator = ProgressIndicator$1;
@@ -11198,6 +11260,7 @@ exports.TextInput = TextInput;
11198
11260
  exports.Toggle = Toggle$2;
11199
11261
  exports.VideoPlayer = VideoPlayer$1;
11200
11262
  exports.useCarouselStyles = useCarouselStyles;
11263
+ exports.useModal = useModal;
11201
11264
  exports.useNYPLTheme = useNYPLTheme;
11202
11265
  exports.useWindowSize = useWindowSize;
11203
11266
  //# sourceMappingURL=design-system-react-components.cjs.development.js.map