@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.
@@ -1,6 +1,6 @@
1
- import { chakra, useStyleConfig, Icon as Icon$2, Box, Accordion as Accordion$2, AccordionPanel, AccordionItem, AccordionButton, Breadcrumb as Breadcrumb$1, BreadcrumbItem, BreadcrumbLink, Button as Button$2, Heading as Heading$2, useMultiStyleConfig, LinkBox, LinkOverlay, Checkbox as Checkbox$2, CheckboxGroup as CheckboxGroup$2, Stack, SimpleGrid as SimpleGrid$1, Input, Textarea, extendTheme, ChakraProvider, CircularProgress, CircularProgressLabel, Progress, Radio as Radio$2, RadioGroup as RadioGroup$2, Text as Text$2, Select as Select$2, Skeleton as Skeleton$1, RangeSlider, RangeSliderTrack, RangeSliderFilledTrack, RangeSliderThumb, Slider as Slider$1, SliderTrack, SliderFilledTrack, SliderThumb, Tabs as Tabs$1, Tab, TabPanel, TabList, TabPanels, Switch as Switch$1, useTheme, TableCaption, Thead, Tr, Th, Table as Table$1, Tbody, Td } from '@chakra-ui/react';
1
+ import { chakra, useStyleConfig, Icon as Icon$2, Box, Accordion as Accordion$2, AccordionPanel, AccordionItem, AccordionButton, Breadcrumb as Breadcrumb$1, BreadcrumbItem, BreadcrumbLink, Button as Button$2, Heading as Heading$2, useMultiStyleConfig, LinkBox, LinkOverlay, Checkbox as Checkbox$2, CheckboxGroup as CheckboxGroup$2, Stack, SimpleGrid as SimpleGrid$1, Input, Textarea, extendTheme, ChakraProvider, useDisclosure, Modal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ButtonGroup, CircularProgress, CircularProgressLabel, Progress, Radio as Radio$2, RadioGroup as RadioGroup$2, Text as Text$2, Select as Select$2, Skeleton as Skeleton$1, RangeSlider, RangeSliderTrack, RangeSliderFilledTrack, RangeSliderThumb, Slider as Slider$1, SliderTrack, SliderFilledTrack, SliderThumb, Tabs as Tabs$1, Tab, TabPanel, TabList, TabPanels, Switch as Switch$1, useTheme, TableCaption, Thead, Tr, Th, Table as Table$1, Tbody, Td } from '@chakra-ui/react';
2
2
  export { Box, ButtonGroup, Center, Circle, Flex, Grid, GridItem, HStack, Spacer, Square, Stack, Tab, TabList, TabPanel, TabPanels, VStack } from '@chakra-ui/react';
3
- import React__default, { createElement, cloneElement, Fragment, Children, forwardRef, useState, useEffect, Component, useRef } from 'react';
3
+ import React__default, { createElement, cloneElement, Fragment, Children, forwardRef, useState, useEffect, useRef } from 'react';
4
4
  import ReactDatePicker from 'react-datepicker';
5
5
  import { createBreakpoints, cssVar } from '@chakra-ui/theme-tools';
6
6
  import { keyframes } from '@chakra-ui/system';
@@ -23,22 +23,6 @@ function _extends() {
23
23
  return _extends.apply(this, arguments);
24
24
  }
25
25
 
26
- function _inheritsLoose(subClass, superClass) {
27
- subClass.prototype = Object.create(superClass.prototype);
28
- subClass.prototype.constructor = subClass;
29
-
30
- _setPrototypeOf(subClass, superClass);
31
- }
32
-
33
- function _setPrototypeOf(o, p) {
34
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
35
- o.__proto__ = p;
36
- return o;
37
- };
38
-
39
- return _setPrototypeOf(o, p);
40
- }
41
-
42
26
  function _objectWithoutPropertiesLoose(source, excluded) {
43
27
  if (source == null) return {};
44
28
  var target = {};
@@ -4363,8 +4347,7 @@ var select = {
4363
4347
  var Select = {
4364
4348
  parts: ["helperText", "inline", "select"],
4365
4349
  baseStyle: function baseStyle(_ref) {
4366
- var labelPosition = _ref.labelPosition,
4367
- labelWidth = _ref.labelWidth;
4350
+ var labelPosition = _ref.labelPosition;
4368
4351
  return {
4369
4352
  marginBottom: "xs",
4370
4353
  // The backgroundColor set to "ui.white" hides the arrow SVG icon when
@@ -4373,11 +4356,6 @@ var Select = {
4373
4356
  ".chakra-select__icon-wrapper": {
4374
4357
  zIndex: "9999"
4375
4358
  },
4376
- helperText: {
4377
- marginLeft: labelPosition === "inline" ? {
4378
- md: labelWidth + "px"
4379
- } : null
4380
- },
4381
4359
  inline: {
4382
4360
  display: {
4383
4361
  md: "flex"
@@ -8807,43 +8785,119 @@ var Logo$1 = /*#__PURE__*/chakra(function (props) {
8807
8785
  }, rest), childSVG);
8808
8786
  });
8809
8787
 
8810
- /** Full-screen modal that appears on top of the body of the page. */
8788
+ var _excluded$1p = ["bodyContent", "closeButtonLabel", "headingText", "id", "isOpen", "onClose"],
8789
+ _excluded2$5 = ["buttonText", "id", "modalProps"],
8790
+ _excluded3$2 = ["bodyContent", "closeButtonLabel", "headingText", "id"];
8791
+ var BaseModal = /*#__PURE__*/chakra(function (_ref) {
8792
+ var bodyContent = _ref.bodyContent,
8793
+ _ref$closeButtonLabel = _ref.closeButtonLabel,
8794
+ closeButtonLabel = _ref$closeButtonLabel === void 0 ? "Close" : _ref$closeButtonLabel,
8795
+ headingText = _ref.headingText,
8796
+ id = _ref.id,
8797
+ isOpen = _ref.isOpen,
8798
+ onClose = _ref.onClose,
8799
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1p);
8811
8800
 
8812
- var Modal = /*#__PURE__*/function (_React$Component) {
8813
- _inheritsLoose(Modal, _React$Component);
8801
+ // Based on --nypl-breakpoint-medium
8802
+ var breakpointMedium = 600;
8803
+ var defaultSize = "xl";
8804
+ var fullSize = "full";
8814
8805
 
8815
- function Modal() {
8816
- return _React$Component.apply(this, arguments) || this;
8817
- }
8806
+ var _React$useState = useState(defaultSize),
8807
+ size = _React$useState[0],
8808
+ setSize = _React$useState[1];
8818
8809
 
8819
- var _proto = Modal.prototype;
8810
+ var windowDimensions = useWindowSize();
8811
+ useEffect(function () {
8812
+ if (windowDimensions.width <= breakpointMedium) {
8813
+ setSize(fullSize);
8814
+ } else {
8815
+ setSize(defaultSize);
8816
+ }
8817
+ }, [windowDimensions.width]);
8818
+ return createElement(Modal, Object.assign({
8819
+ id: id,
8820
+ isOpen: isOpen,
8821
+ onClose: onClose,
8822
+ scrollBehavior: "inside",
8823
+ size: size
8824
+ }, rest), createElement(ModalOverlay, null), createElement(ModalContent, null, createElement(ModalHeader, null, headingText), createElement(ModalCloseButton, null), createElement(ModalBody, null, bodyContent), createElement(ModalFooter, null, createElement(ButtonGroup, null, createElement(Button, {
8825
+ id: "modal-close-btn",
8826
+ onClick: onClose
8827
+ }, closeButtonLabel)))));
8828
+ });
8829
+ /**
8830
+ * The `ModalTrigger` component renders a button that you click to open the
8831
+ * internal `Modal` component. Note that props to update the internal `Modal`
8832
+ * component are passed through to the `modalProps` prop.
8833
+ */
8820
8834
 
8821
- _proto.componentDidMount = function componentDidMount() {
8822
- document.body.classList.add("no-scroll");
8823
- };
8835
+ var ModalTrigger = /*#__PURE__*/chakra(function (_ref2) {
8836
+ var buttonText = _ref2.buttonText,
8837
+ id = _ref2.id,
8838
+ modalProps = _ref2.modalProps,
8839
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$5);
8824
8840
 
8825
- _proto.componentWillUnmount = function componentWillUnmount() {
8826
- document.body.classList.remove("no-scroll");
8827
- };
8841
+ var _useDisclosure = useDisclosure(),
8842
+ isOpen = _useDisclosure.isOpen,
8843
+ onOpen = _useDisclosure.onOpen,
8844
+ onClose = _useDisclosure.onClose;
8828
8845
 
8829
- _proto.render = function render() {
8830
- var _this$props = this.props,
8831
- id = _this$props.id,
8832
- className = _this$props.className;
8833
- return createElement("div", {
8834
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
8835
- tabIndex: 0,
8836
- className: "modal " + className,
8837
- id: id
8838
- }, this.props.children);
8846
+ var finalOnCloseHandler = function finalOnCloseHandler() {
8847
+ modalProps.onClose && modalProps.onClose();
8848
+ onClose();
8839
8849
  };
8840
8850
 
8841
- return Modal;
8842
- }(Component);
8851
+ return createElement(Fragment, null, createElement(Button, {
8852
+ id: "modal-open-btn",
8853
+ onClick: onOpen
8854
+ }, buttonText), createElement(BaseModal, Object.assign({
8855
+ bodyContent: modalProps.bodyContent,
8856
+ closeButtonLabel: modalProps.closeButtonLabel,
8857
+ headingText: modalProps.headingText,
8858
+ id: id,
8859
+ isOpen: isOpen,
8860
+ onClose: finalOnCloseHandler
8861
+ }, rest)));
8862
+ });
8863
+ /**
8864
+ * This hook function can be used to render the `Modal` component with a custom
8865
+ * open button(s) and optional custom close button(s). You must render your own
8866
+ * button and pass the appropriate `onOpen` and ` handler for the modal to open.
8867
+ */
8868
+
8869
+ function useModal() {
8870
+ var _useDisclosure2 = useDisclosure(),
8871
+ isOpen = _useDisclosure2.isOpen,
8872
+ onClose = _useDisclosure2.onClose,
8873
+ onOpen = _useDisclosure2.onOpen;
8874
+
8875
+ var Modal = chakra(function (_ref3) {
8876
+ var bodyContent = _ref3.bodyContent,
8877
+ closeButtonLabel = _ref3.closeButtonLabel,
8878
+ headingText = _ref3.headingText,
8879
+ id = _ref3.id,
8880
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3$2);
8881
+
8882
+ return createElement(BaseModal, Object.assign({
8883
+ bodyContent: bodyContent,
8884
+ closeButtonLabel: closeButtonLabel,
8885
+ headingText: headingText,
8886
+ id: id,
8887
+ isOpen: isOpen,
8888
+ onClose: onClose
8889
+ }, rest));
8890
+ });
8891
+ return {
8892
+ onClose: onClose,
8893
+ onOpen: onOpen,
8894
+ Modal: Modal
8895
+ };
8896
+ }
8843
8897
 
8844
- var _excluded$1p = ["children", "icon", "id", "isCentered", "notificationType"],
8845
- _excluded2$5 = ["alignText", "children", "icon", "notificationType"],
8846
- _excluded3$2 = ["ariaLabel", "className", "dismissible", "icon", "id", "isCentered", "noMargin", "notificationContent", "notificationHeading", "notificationType", "showIcon"];
8898
+ var _excluded$1q = ["children", "icon", "id", "isCentered", "notificationType"],
8899
+ _excluded2$6 = ["alignText", "children", "icon", "notificationType"],
8900
+ _excluded3$3 = ["ariaLabel", "className", "dismissible", "icon", "id", "isCentered", "noMargin", "notificationContent", "notificationHeading", "notificationType", "showIcon"];
8847
8901
  /**
8848
8902
  * NotificationHeading child-component.
8849
8903
  */
@@ -8854,7 +8908,7 @@ var NotificationHeading$1 = /*#__PURE__*/chakra(function (props) {
8854
8908
  id = props.id,
8855
8909
  isCentered = props.isCentered,
8856
8910
  notificationType = props.notificationType,
8857
- rest = _objectWithoutPropertiesLoose(props, _excluded$1p);
8911
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1q);
8858
8912
 
8859
8913
  var styles = useMultiStyleConfig("NotificationHeading", {
8860
8914
  icon: icon,
@@ -8879,7 +8933,7 @@ var NotificationContent$1 = /*#__PURE__*/chakra(function (props) {
8879
8933
  children = props.children,
8880
8934
  icon = props.icon,
8881
8935
  notificationType = props.notificationType,
8882
- rest = _objectWithoutPropertiesLoose(props, _excluded2$5);
8936
+ rest = _objectWithoutPropertiesLoose(props, _excluded2$6);
8883
8937
 
8884
8938
  var styles = useMultiStyleConfig("NotificationContent", {
8885
8939
  alignText: alignText,
@@ -8914,7 +8968,7 @@ var Notification$1 = /*#__PURE__*/chakra(function (props) {
8914
8968
  notificationType = _props$notificationTy === void 0 ? NotificationTypes.Standard : _props$notificationTy,
8915
8969
  _props$showIcon = props.showIcon,
8916
8970
  showIcon = _props$showIcon === void 0 ? true : _props$showIcon,
8917
- rest = _objectWithoutPropertiesLoose(props, _excluded3$2);
8971
+ rest = _objectWithoutPropertiesLoose(props, _excluded3$3);
8918
8972
 
8919
8973
  var _useState = useState(true),
8920
8974
  isOpen = _useState[0],
@@ -9010,7 +9064,7 @@ var Notification$1 = /*#__PURE__*/chakra(function (props) {
9010
9064
  }, childHeading, childContent), dismissibleButton);
9011
9065
  });
9012
9066
 
9013
- var _excluded$1q = ["className", "currentPage", "getPageHref", "id", "initialPage", "onPageChange", "pageCount"];
9067
+ var _excluded$1r = ["className", "currentPage", "getPageHref", "id", "initialPage", "onPageChange", "pageCount"];
9014
9068
  /**
9015
9069
  * A component that provides a navigational list of page items.
9016
9070
  */
@@ -9024,7 +9078,7 @@ var Pagination$1 = /*#__PURE__*/chakra(function (props) {
9024
9078
  initialPage = _props$initialPage === void 0 ? 1 : _props$initialPage,
9025
9079
  onPageChange = props.onPageChange,
9026
9080
  pageCount = props.pageCount,
9027
- rest = _objectWithoutPropertiesLoose(props, _excluded$1q);
9081
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1r);
9028
9082
 
9029
9083
  var refCurrentPage = useRef(currentPage);
9030
9084
 
@@ -9216,7 +9270,7 @@ var Pagination$1 = /*#__PURE__*/chakra(function (props) {
9216
9270
  }, previousLiLink, getPaginationNumbers(selectedPage), nextLiLink));
9217
9271
  });
9218
9272
 
9219
- var _excluded$1r = ["darkMode", "id", "indicatorType", "isIndeterminate", "labelText", "showLabel", "size", "value"];
9273
+ var _excluded$1s = ["darkMode", "id", "indicatorType", "isIndeterminate", "labelText", "showLabel", "size", "value"];
9220
9274
  /**
9221
9275
  * A component that displays a progress status for any task that takes a long
9222
9276
  * time to complete or consists of multiple steps. Examples include downloading,
@@ -9238,7 +9292,7 @@ var ProgressIndicator$1 = /*#__PURE__*/chakra(function (props) {
9238
9292
  size = _props$size === void 0 ? ProgressIndicatorSizes.Default : _props$size,
9239
9293
  _props$value = props.value,
9240
9294
  value = _props$value === void 0 ? 0 : _props$value,
9241
- rest = _objectWithoutPropertiesLoose(props, _excluded$1r);
9295
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1s);
9242
9296
 
9243
9297
  var styles = useMultiStyleConfig("ProgressIndicator", {
9244
9298
  darkMode: darkMode,
@@ -9304,7 +9358,7 @@ var ProgressIndicator$1 = /*#__PURE__*/chakra(function (props) {
9304
9358
  }, rest), progressComponent(indicatorType));
9305
9359
  });
9306
9360
 
9307
- var _excluded$1s = ["className", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
9361
+ var _excluded$1t = ["className", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
9308
9362
  var Radio$1 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref) {
9309
9363
  var className = props.className,
9310
9364
  helperText = props.helperText,
@@ -9325,7 +9379,7 @@ var Radio$1 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref)
9325
9379
  _props$showLabel = props.showLabel,
9326
9380
  showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
9327
9381
  value = props.value,
9328
- rest = _objectWithoutPropertiesLoose(props, _excluded$1s);
9382
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1t);
9329
9383
 
9330
9384
  var styles = useMultiStyleConfig("Radio", {});
9331
9385
  var footnote = isInvalid ? invalidText : helperText;
@@ -9366,7 +9420,7 @@ var Radio$1 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref)
9366
9420
  }));
9367
9421
  }));
9368
9422
 
9369
- var _excluded$1t = ["children", "className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isFullWidth", "isInvalid", "isRequired", "labelText", "layout", "name", "onChange", "showHelperInvalidText", "showLabel", "showRequiredLabel"];
9423
+ var _excluded$1u = ["children", "className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isFullWidth", "isInvalid", "isRequired", "labelText", "layout", "name", "onChange", "showHelperInvalidText", "showLabel", "showRequiredLabel"];
9370
9424
  /**
9371
9425
  * RadioGroup is a wrapper for DS `Radio` components that renders as a fieldset
9372
9426
  * HTML element along with optional helper text. The `name` prop is essential
@@ -9402,7 +9456,7 @@ var RadioGroup$1 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props,
9402
9456
  showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
9403
9457
  _props$showRequiredLa = props.showRequiredLabel,
9404
9458
  showRequiredLabel = _props$showRequiredLa === void 0 ? true : _props$showRequiredLa,
9405
- rest = _objectWithoutPropertiesLoose(props, _excluded$1t);
9459
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1u);
9406
9460
 
9407
9461
  var _React$useState = useState(defaultValue),
9408
9462
  value = _React$useState[0],
@@ -9480,7 +9534,7 @@ var TextSizes;
9480
9534
  TextSizes["Mini"] = "mini";
9481
9535
  })(TextSizes || (TextSizes = {}));
9482
9536
 
9483
- var _excluded$1u = ["children", "className", "isBold", "isItalic", "noSpace", "size"];
9537
+ var _excluded$1v = ["children", "className", "isBold", "isItalic", "noSpace", "size"];
9484
9538
  var Text$1 = /*#__PURE__*/chakra(function (props) {
9485
9539
  var children = props.children,
9486
9540
  _props$className = props.className,
@@ -9490,7 +9544,7 @@ var Text$1 = /*#__PURE__*/chakra(function (props) {
9490
9544
  noSpace = props.noSpace,
9491
9545
  _props$size = props.size,
9492
9546
  size = _props$size === void 0 ? TextSizes.Default : _props$size,
9493
- rest = _objectWithoutPropertiesLoose(props, _excluded$1u);
9547
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1v);
9494
9548
 
9495
9549
  var variant = getVariant(size, TextSizes, TextSizes.Default);
9496
9550
  var styles = useStyleConfig("Text", {
@@ -9510,7 +9564,7 @@ var Text$1 = /*#__PURE__*/chakra(function (props) {
9510
9564
  }, rest), children);
9511
9565
  });
9512
9566
 
9513
- var _excluded$1v = ["children", "descriptionText", "headingText", "helperText", "id", "invalidText", "isInvalid"];
9567
+ var _excluded$1w = ["children", "descriptionText", "headingText", "helperText", "id", "invalidText", "isInvalid"];
9514
9568
  var ComponentWrapper$1 = /*#__PURE__*/chakra(function (props) {
9515
9569
  var children = props.children,
9516
9570
  descriptionText = props.descriptionText,
@@ -9520,7 +9574,7 @@ var ComponentWrapper$1 = /*#__PURE__*/chakra(function (props) {
9520
9574
  invalidText = props.invalidText,
9521
9575
  _props$isInvalid = props.isInvalid,
9522
9576
  isInvalid = _props$isInvalid === void 0 ? false : _props$isInvalid,
9523
- rest = _objectWithoutPropertiesLoose(props, _excluded$1v);
9577
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1w);
9524
9578
 
9525
9579
  var hasChildren = !!children;
9526
9580
  var styles = useMultiStyleConfig("ComponentWrapper", {
@@ -9562,7 +9616,7 @@ var LabelPositions;
9562
9616
  LabelPositions["Inline"] = "inline";
9563
9617
  })(LabelPositions || (LabelPositions = {}));
9564
9618
 
9565
- var _excluded$1w = ["additionalStyles", "children", "className", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelPosition", "labelText", "name", "onChange", "placeholder", "selectType", "showHelperInvalidText", "showLabel", "showRequiredLabel", "value"];
9619
+ var _excluded$1x = ["additionalStyles", "children", "className", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelPosition", "labelText", "name", "onChange", "placeholder", "selectType", "showHelperInvalidText", "showLabel", "showRequiredLabel", "value"];
9566
9620
  /**
9567
9621
  * Component that renders Chakra's `Select` component along with an accessible
9568
9622
  * `Label` and optional `HelperErrorText` component.
@@ -9598,7 +9652,7 @@ var Select$1 = /*#__PURE__*/chakra( /*#__PURE__*/React__default.forwardRef(funct
9598
9652
  showRequiredLabel = _props$showRequiredLa === void 0 ? true : _props$showRequiredLa,
9599
9653
  _props$value = props.value,
9600
9654
  value = _props$value === void 0 ? "" : _props$value,
9601
- rest = _objectWithoutPropertiesLoose(props, _excluded$1w);
9655
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1x);
9602
9656
 
9603
9657
  var ariaAttributes = {};
9604
9658
 
@@ -9609,8 +9663,7 @@ var Select$1 = /*#__PURE__*/chakra( /*#__PURE__*/React__default.forwardRef(funct
9609
9663
  var labelRef = useRef();
9610
9664
  var styles = useMultiStyleConfig("CustomSelect", {
9611
9665
  variant: selectType,
9612
- labelPosition: labelPosition,
9613
- labelWidth: labelWidth
9666
+ labelPosition: labelPosition
9614
9667
  });
9615
9668
  var finalInvalidText = invalidText ? invalidText : "There is an error related to this field.";
9616
9669
  var footnote = isInvalid ? finalInvalidText : helperText; // To control the `Select` component, both `onChange` and `value`
@@ -9619,7 +9672,10 @@ var Select$1 = /*#__PURE__*/chakra( /*#__PURE__*/React__default.forwardRef(funct
9619
9672
  var controlledProps = onChange ? {
9620
9673
  onChange: onChange,
9621
9674
  value: value
9622
- } : {};
9675
+ } : {}; // The number of pixels between the label and select elements
9676
+ // when the labelPosition is inline (equivalent to --nypl-space-xs).
9677
+
9678
+ var labelSelectGap = 8;
9623
9679
 
9624
9680
  if (!showLabel) {
9625
9681
  ariaAttributes["aria-label"] = labelText && footnote ? labelText + " - " + footnote : labelText;
@@ -9634,9 +9690,11 @@ var Select$1 = /*#__PURE__*/chakra( /*#__PURE__*/React__default.forwardRef(funct
9634
9690
  useEffect(function () {
9635
9691
  if (labelPosition === LabelPositions.Inline) {
9636
9692
  if (labelRef.current) {
9637
- var width = labelRef.current.clientWidth + 8;
9693
+ var width = labelRef.current.clientWidth + labelSelectGap;
9638
9694
  setLabelWidth(width);
9639
9695
  }
9696
+ } else {
9697
+ setLabelWidth(0);
9640
9698
  }
9641
9699
  }, [labelPosition]);
9642
9700
  return React__default.createElement(Box, Object.assign({
@@ -9667,14 +9725,18 @@ var Select$1 = /*#__PURE__*/chakra( /*#__PURE__*/React__default.forwardRef(funct
9667
9725
  size: IconSizes.Medium
9668
9726
  }),
9669
9727
  __css: styles.select
9670
- }), children), footnote && showHelperInvalidText && React__default.createElement(HelperErrorText, {
9728
+ }), children)), footnote && showHelperInvalidText && React__default.createElement(HelperErrorText, {
9671
9729
  id: id + "-helperText",
9672
9730
  isInvalid: isInvalid,
9673
- text: footnote
9674
- })));
9731
+ text: footnote,
9732
+ ml: {
9733
+ sm: "auto",
9734
+ md: labelWidth + "px"
9735
+ }
9736
+ }));
9675
9737
  }));
9676
9738
 
9677
- var _excluded$1x = ["action", "buttonOnClick", "className", "descriptionText", "headingText", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "method", "noBrandButtonType", "onSubmit", "selectProps", "textInputElement", "textInputProps"];
9739
+ var _excluded$1y = ["action", "buttonOnClick", "className", "descriptionText", "headingText", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "method", "noBrandButtonType", "onSubmit", "selectProps", "textInputElement", "textInputProps"];
9678
9740
  /**
9679
9741
  * Renders a wrapper `form` element to be used with `Select` (optional),
9680
9742
  * `Input`, and `Button` components together.
@@ -9704,7 +9766,7 @@ var SearchBar$1 = /*#__PURE__*/chakra(function (props) {
9704
9766
  selectProps = props.selectProps,
9705
9767
  textInputElement = props.textInputElement,
9706
9768
  textInputProps = props.textInputProps,
9707
- rest = _objectWithoutPropertiesLoose(props, _excluded$1x);
9769
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1y);
9708
9770
 
9709
9771
  var styles = useMultiStyleConfig("SearchBar", {});
9710
9772
  var stateProps = {
@@ -9805,7 +9867,7 @@ var SkeletonLoaderImageRatios;
9805
9867
  SkeletonLoaderImageRatios["Square"] = "square";
9806
9868
  })(SkeletonLoaderImageRatios || (SkeletonLoaderImageRatios = {}));
9807
9869
 
9808
- var _excluded$1y = ["className", "contentSize", "headingSize", "imageAspectRatio", "isBordered", "layout", "showButton", "showContent", "showHeading", "showImage", "width"];
9870
+ var _excluded$1z = ["className", "contentSize", "headingSize", "imageAspectRatio", "isBordered", "layout", "showButton", "showContent", "showHeading", "showImage", "width"];
9809
9871
  /**
9810
9872
  * The `SkeletonLoader` component renders a placeholder to be used while
9811
9873
  * dynamic content is loading.
@@ -9832,7 +9894,7 @@ var SkeletonLoader$1 = /*#__PURE__*/chakra(function (props) {
9832
9894
  _props$showImage = props.showImage,
9833
9895
  showImage = _props$showImage === void 0 ? true : _props$showImage,
9834
9896
  width = props.width,
9835
- rest = _objectWithoutPropertiesLoose(props, _excluded$1y);
9897
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1z);
9836
9898
 
9837
9899
  var styles = useMultiStyleConfig("SkeletonLoader", {
9838
9900
  isBordered: isBordered,
@@ -9894,7 +9956,7 @@ var SkeletonLoader$1 = /*#__PURE__*/chakra(function (props) {
9894
9956
  })))));
9895
9957
  });
9896
9958
 
9897
- var _excluded$1z = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRangeSlider", "isRequired", "labelText", "max", "min", "name", "onChange", "showBoxes", "showHelperInvalidText", "showLabel", "showRequiredLabel", "showValues", "step"];
9959
+ var _excluded$1A = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRangeSlider", "isRequired", "labelText", "max", "min", "name", "onChange", "showBoxes", "showHelperInvalidText", "showLabel", "showRequiredLabel", "showValues", "step"];
9898
9960
  /**
9899
9961
  * The `Slider` component renders a singular value slider or a range slider
9900
9962
  * with a min and max value. The value(s) can be updated through the slider
@@ -9935,7 +9997,7 @@ var Slider = /*#__PURE__*/chakra(function (props) {
9935
9997
  showValues = _props$showValues === void 0 ? true : _props$showValues,
9936
9998
  _props$step = props.step,
9937
9999
  step = _props$step === void 0 ? 1 : _props$step,
9938
- rest = _objectWithoutPropertiesLoose(props, _excluded$1z);
10000
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1A);
9939
10001
 
9940
10002
  if (!id) {
9941
10003
  console.warn("NYPL Reservoir Slider: This component's required `id` prop was not passed.");
@@ -10128,7 +10190,7 @@ var StatusBadgeTypes;
10128
10190
  StatusBadgeTypes["High"] = "high";
10129
10191
  })(StatusBadgeTypes || (StatusBadgeTypes = {}));
10130
10192
 
10131
- var _excluded$1A = ["children", "className", "id", "level"];
10193
+ var _excluded$1B = ["children", "className", "id", "level"];
10132
10194
  /**
10133
10195
  * The `StatusBadge` component is used to display a visual badge for three
10134
10196
  * different status levels.
@@ -10140,7 +10202,7 @@ var StatusBadge$1 = /*#__PURE__*/chakra(function (props) {
10140
10202
  id = props.id,
10141
10203
  _props$level = props.level,
10142
10204
  level = _props$level === void 0 ? StatusBadgeTypes.Low : _props$level,
10143
- rest = _objectWithoutPropertiesLoose(props, _excluded$1A);
10205
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1B);
10144
10206
 
10145
10207
  var styles = useStyleConfig("StatusBadge", {
10146
10208
  variant: level
@@ -10165,7 +10227,7 @@ var StructuredContentImagePosition;
10165
10227
  StructuredContentImagePosition["Center"] = "center";
10166
10228
  })(StructuredContentImagePosition || (StructuredContentImagePosition = {}));
10167
10229
 
10168
- var _excluded$1B = ["calloutText", "className", "headingText", "id", "imageProps", "bodyContent"];
10230
+ var _excluded$1C = ["calloutText", "className", "headingText", "id", "imageProps", "bodyContent"];
10169
10231
  /**
10170
10232
  * Internal component used in the `StructuredContent` component
10171
10233
  * that renders the DS `Image` component.
@@ -10217,7 +10279,7 @@ var StructuredContent$1 = /*#__PURE__*/chakra(function (props) {
10217
10279
  src: ""
10218
10280
  } : _props$imageProps,
10219
10281
  bodyContent = props.bodyContent,
10220
- rest = _objectWithoutPropertiesLoose(props, _excluded$1B);
10282
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1C);
10221
10283
 
10222
10284
  var hasImage = imageProps.src || imageProps.component;
10223
10285
  var hasFigureImage = imageProps.caption || imageProps.credit;
@@ -10319,7 +10381,7 @@ var useCarouselStyles = function useCarouselStyles(slidesCount, slideWidth) {
10319
10381
  };
10320
10382
  };
10321
10383
 
10322
- var _excluded$1C = ["children", "defaultIndex", "id", "onChange", "tabsData", "useHash"];
10384
+ var _excluded$1D = ["children", "defaultIndex", "id", "onChange", "tabsData", "useHash"];
10323
10385
  /**
10324
10386
  * An internal function used to update the hash in the URL.
10325
10387
  * This function is only used when `useHash` is `true`.
@@ -10438,7 +10500,7 @@ var Tabs = /*#__PURE__*/chakra(function (props) {
10438
10500
  tabsData = props.tabsData,
10439
10501
  _props$useHash = props.useHash,
10440
10502
  useHash = _props$useHash === void 0 ? false : _props$useHash,
10441
- rest = _objectWithoutPropertiesLoose(props, _excluded$1C);
10503
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1D);
10442
10504
 
10443
10505
  var styles = useMultiStyleConfig("Tabs", {}); // Just an estimate of the tab width for the mobile carousel.
10444
10506
 
@@ -10537,7 +10599,7 @@ var Tabs = /*#__PURE__*/chakra(function (props) {
10537
10599
  }, createElement(Box, Object.assign({}, carouselStyle), tabs)), nextButton), panels);
10538
10600
  }); // Tabs is also exported above so the props can display in Storybook.
10539
10601
 
10540
- var _excluded$1D = ["aboveHeader", "breakout", "contentId", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement"];
10602
+ var _excluded$1E = ["aboveHeader", "breakout", "contentId", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement"];
10541
10603
  /**
10542
10604
  * The main top-level parent component that wraps all template-related
10543
10605
  * components.
@@ -10764,7 +10826,7 @@ var TemplateAppContainer = /*#__PURE__*/chakra(function (props) {
10764
10826
  renderFooterElement = _props$renderFooterEl === void 0 ? true : _props$renderFooterEl,
10765
10827
  _props$renderHeaderEl = props.renderHeaderElement,
10766
10828
  renderHeaderElement = _props$renderHeaderEl === void 0 ? true : _props$renderHeaderEl,
10767
- rest = _objectWithoutPropertiesLoose(props, _excluded$1D);
10829
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1E);
10768
10830
 
10769
10831
  var aboveHeaderElem = aboveHeader && createElement(TemplateAboveHeader, null, aboveHeader);
10770
10832
  var breakoutElem = breakout && createElement(TemplateBreakout$1, null, breakout);
@@ -10781,7 +10843,7 @@ var TemplateAppContainer = /*#__PURE__*/chakra(function (props) {
10781
10843
  }, footer));
10782
10844
  });
10783
10845
 
10784
- var _excluded$1E = ["additionalStyles", "defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
10846
+ var _excluded$1F = ["additionalStyles", "defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
10785
10847
  var onChangeDefault$1 = function onChangeDefault() {
10786
10848
  return;
10787
10849
  };
@@ -10810,7 +10872,7 @@ var Toggle$2 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref
10810
10872
  onChange = _props$onChange === void 0 ? onChangeDefault$1 : _props$onChange,
10811
10873
  _props$size = props.size,
10812
10874
  size = _props$size === void 0 ? ToggleSizes.Default : _props$size,
10813
- rest = _objectWithoutPropertiesLoose(props, _excluded$1E);
10875
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1F);
10814
10876
 
10815
10877
  var footnote = isInvalid ? invalidText : helperText;
10816
10878
  var ariaAttributes = {};
@@ -10956,7 +11018,7 @@ var VideoPlayerAspectRatios;
10956
11018
  VideoPlayerAspectRatios["Square"] = "square";
10957
11019
  })(VideoPlayerAspectRatios || (VideoPlayerAspectRatios = {}));
10958
11020
 
10959
- var _excluded$1F = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
11021
+ var _excluded$1G = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
10960
11022
  var VideoPlayer$1 = /*#__PURE__*/chakra(function (props) {
10961
11023
  var aspectRatio = props.aspectRatio,
10962
11024
  className = props.className,
@@ -10970,7 +11032,7 @@ var VideoPlayer$1 = /*#__PURE__*/chakra(function (props) {
10970
11032
  showHelperInvalidText = _props$showHelperInva === void 0 ? true : _props$showHelperInva,
10971
11033
  videoId = props.videoId,
10972
11034
  videoType = props.videoType,
10973
- rest = _objectWithoutPropertiesLoose(props, _excluded$1F);
11035
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1G);
10974
11036
 
10975
11037
  var iframeTitleFinal = videoType === VideoPlayerTypes.Vimeo ? iframeTitle || "Vimeo video player" : iframeTitle || "YouTube video player";
10976
11038
  var videoSrc = videoType === 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";
@@ -11039,7 +11101,7 @@ var VideoPlayer$1 = /*#__PURE__*/chakra(function (props) {
11039
11101
  }, embedElement)));
11040
11102
  });
11041
11103
 
11042
- var _excluded$1G = ["className", "columnHeaders", "columnHeadersBackgroundColor", "columnHeadersTextColor", "id", "showRowDividers", "tableData", "titleText", "useRowHeaders"];
11104
+ var _excluded$1H = ["className", "columnHeaders", "columnHeadersBackgroundColor", "columnHeadersTextColor", "id", "showRowDividers", "tableData", "titleText", "useRowHeaders"];
11043
11105
  /**
11044
11106
  * Basic `Table` component used to organize and display tabular data in
11045
11107
  * rows and columns.
@@ -11057,7 +11119,7 @@ var Table = /*#__PURE__*/chakra(function (props) {
11057
11119
  titleText = props.titleText,
11058
11120
  _props$useRowHeaders = props.useRowHeaders,
11059
11121
  useRowHeaders = _props$useRowHeaders === void 0 ? false : _props$useRowHeaders,
11060
- rest = _objectWithoutPropertiesLoose(props, _excluded$1G);
11122
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1H);
11061
11123
 
11062
11124
  var customColors = {};
11063
11125
  columnHeadersBackgroundColor && (customColors["backgroundColor"] = columnHeadersBackgroundColor);
@@ -11108,5 +11170,5 @@ var Table = /*#__PURE__*/chakra(function (props) {
11108
11170
  }, rest), tableCaption, columnHeadersElems, tableBodyElems());
11109
11171
  });
11110
11172
 
11111
- export { Accordion, AccordionTypes, Breadcrumbs, BreadcrumbsTypes, Button, ButtonTypes, Card, CardActions, CardContent, CardHeading, Checkbox, CheckboxGroup, DSProvider, DatePicker, DatePickerTypes, Fieldset, Form, FormField, GridGaps as FormGaps, FormRow, GridGaps, Heading, HeadingLevels, HeadingSizes, HelperErrorText, Hero$1 as Hero, HeroTypes, HorizontalRule$1 as HorizontalRule, Icon, IconAlign, IconColors, IconNames, IconRotationTypes, IconSizes, IconTypes, Image, ImageRatios, ImageSizes, ImageTypes, Label, LabelPositions, LayoutTypes, Link, LinkTypes, List$1 as List, ListTypes, Logo$1 as Logo, LogoColors, LogoNames, LogoSizes, Modal, Notification$1 as Notification, NotificationTypes, Pagination$1 as Pagination, ProgressIndicator$1 as ProgressIndicator, ProgressIndicatorSizes, ProgressIndicatorTypes, Radio$1 as Radio, RadioGroup$1 as RadioGroup, SearchBar$1 as SearchBar, Select$1 as Select, SimpleGrid, SkeletonLoader$1 as SkeletonLoader, SkeletonLoaderImageRatios, Slider, StatusBadge$1 as StatusBadge, StatusBadgeTypes, StructuredContent$1 as StructuredContent, StructuredContentImagePosition, Table, Tabs, Template$1 as Template, TemplateAboveHeader, TemplateAppContainer, TemplateBreakout$1 as TemplateBreakout, TemplateContent$1 as TemplateContent, TemplateContentPrimary$1 as TemplateContentPrimary, TemplateContentSidebar$1 as TemplateContentSidebar, TemplateContentTop$1 as TemplateContentTop, TemplateFooter, TemplateHeader$1 as TemplateHeader, Text$1 as Text, TextInput, TextInputTypes, TextSizes, Toggle$2 as Toggle, ToggleSizes, VideoPlayer$1 as VideoPlayer, VideoPlayerAspectRatios, VideoPlayerTypes, useCarouselStyles, useNYPLTheme, useWindowSize };
11173
+ export { Accordion, AccordionTypes, Breadcrumbs, BreadcrumbsTypes, Button, ButtonTypes, Card, CardActions, CardContent, CardHeading, Checkbox, CheckboxGroup, DSProvider, DatePicker, DatePickerTypes, Fieldset, Form, FormField, GridGaps as FormGaps, FormRow, GridGaps, Heading, HeadingLevels, HeadingSizes, HelperErrorText, Hero$1 as Hero, HeroTypes, HorizontalRule$1 as HorizontalRule, Icon, IconAlign, IconColors, IconNames, IconRotationTypes, IconSizes, IconTypes, Image, ImageRatios, ImageSizes, ImageTypes, Label, LabelPositions, LayoutTypes, Link, LinkTypes, List$1 as List, ListTypes, Logo$1 as Logo, LogoColors, LogoNames, LogoSizes, ModalTrigger, Notification$1 as Notification, NotificationTypes, Pagination$1 as Pagination, ProgressIndicator$1 as ProgressIndicator, ProgressIndicatorSizes, ProgressIndicatorTypes, Radio$1 as Radio, RadioGroup$1 as RadioGroup, SearchBar$1 as SearchBar, Select$1 as Select, SimpleGrid, SkeletonLoader$1 as SkeletonLoader, SkeletonLoaderImageRatios, Slider, StatusBadge$1 as StatusBadge, StatusBadgeTypes, StructuredContent$1 as StructuredContent, StructuredContentImagePosition, Table, Tabs, Template$1 as Template, TemplateAboveHeader, TemplateAppContainer, TemplateBreakout$1 as TemplateBreakout, TemplateContent$1 as TemplateContent, TemplateContentPrimary$1 as TemplateContentPrimary, TemplateContentSidebar$1 as TemplateContentSidebar, TemplateContentTop$1 as TemplateContentTop, TemplateFooter, TemplateHeader$1 as TemplateHeader, Text$1 as Text, TextInput, TextInputTypes, TextSizes, Toggle$2 as Toggle, ToggleSizes, VideoPlayer$1 as VideoPlayer, VideoPlayerAspectRatios, VideoPlayerTypes, useCarouselStyles, useModal, useNYPLTheme, useWindowSize };
11112
11174
  //# sourceMappingURL=design-system-react-components.esm.js.map