@nypl/design-system-react-components 1.2.0-rc → 1.2.0-rc-2

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.
@@ -2464,7 +2464,7 @@ var AlphabetFilter = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fu
2464
2464
  id: "filter-" + item.value,
2465
2465
  isDisabled: isButtonDisabled,
2466
2466
  key: item.value,
2467
- __css: buttonStyles,
2467
+ sx: buttonStyles,
2468
2468
  onClick: function onClick(e) {
2469
2469
  handleOnClick(e, item.value);
2470
2470
  }
@@ -5195,7 +5195,8 @@ var AlphabetFilter$1 = {
5195
5195
  }
5196
5196
  },
5197
5197
  _disabled: {
5198
- color: "ui.gray.medium"
5198
+ color: "ui.gray.medium",
5199
+ cursor: "not-allowed"
5199
5200
  }
5200
5201
  }
5201
5202
  }
@@ -9373,6 +9374,7 @@ var theme = /*#__PURE__*/react.extendTheme( /*#__PURE__*/_extends({
9373
9374
  components: /*#__PURE__*/_extends({
9374
9375
  Accordion: Accordion$1,
9375
9376
  AlphabetFilter: AlphabetFilter$1,
9377
+ AudioPlayer: AudioPlayer$1,
9376
9378
  Breadcrumb: Breadcrumb,
9377
9379
  Button: Button$1,
9378
9380
  ButtonGroup: ButtonGroup$1
@@ -9425,8 +9427,7 @@ var theme = /*#__PURE__*/react.extendTheme( /*#__PURE__*/_extends({
9425
9427
  TextInput: TextInput$1
9426
9428
  }, Toggle$1, {
9427
9429
  Tooltip: Tooltip,
9428
- VideoPlayer: VideoPlayer,
9429
- AudioPlayer: AudioPlayer$1
9430
+ VideoPlayer: VideoPlayer
9430
9431
  }),
9431
9432
  config: {
9432
9433
  // Use `cssVarPrefix` to set the prefix used on the CSS vars produced by
@@ -15584,7 +15585,224 @@ var Tabs = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (pr
15584
15585
  }, React__default.createElement(react.Box, Object.assign({}, carouselStyle), tabs)), nextButton), panels);
15585
15586
  })); // Tabs is also exported above so the props can display in Storybook.
15586
15587
 
15587
- var _excluded$2d = ["aboveHeader", "breakout", "contentId", "contentBottom", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement", "renderSkipNavigation"];
15588
+ var _excluded$2d = ["children", "className", "content", "id", "isDisabled", "shouldWrapChildren"];
15589
+ var Tooltip$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
15590
+ var children = props.children,
15591
+ content = props.content,
15592
+ isDisabled = props.isDisabled,
15593
+ shouldWrapChildren = props.shouldWrapChildren,
15594
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2d);
15595
+
15596
+ if (typeof content !== "string") {
15597
+ React__default.Children.map(content, function (contentChild) {
15598
+ if (contentChild.type !== Icon || contentChild.type !== Image) {
15599
+ console.warn("NYPL Reservoir Tooltip: Pass in a string, DS Icon, or DS Image into the 'content' prop.");
15600
+ }
15601
+ });
15602
+ }
15603
+
15604
+ var newChildren = shouldWrapChildren ? React__default.createElement(ComponentWrapper, {
15605
+ width: "fit-content"
15606
+ }, children) : children;
15607
+ var styles = react.useMultiStyleConfig("Tooltip", {});
15608
+ return React__default.createElement(react.Tooltip, Object.assign({
15609
+ hasArrow: true,
15610
+ "aria-label": typeof content !== "string" ? "Tooltip" : undefined,
15611
+ label: content,
15612
+ isDisabled: isDisabled,
15613
+ placement: "top",
15614
+ openDelay: 500,
15615
+ ref: ref,
15616
+ __css: styles
15617
+ }, rest), newChildren);
15618
+ }));
15619
+
15620
+ /**
15621
+ * The "explore" `TagSet` variant will always display the tags passed as data.
15622
+ * The `label` property in the `tagSetData` prop should be set to a link-type
15623
+ * JSX component for linking to specific content.
15624
+ */
15625
+
15626
+ var TagSetExplore$1 = /*#__PURE__*/react.chakra(function (props) {
15627
+ var id = props.id,
15628
+ _props$tagSetData = props.tagSetData,
15629
+ tagSetData = _props$tagSetData === void 0 ? [] : _props$tagSetData;
15630
+ var styles = react.useStyleConfig("TagSetExplore");
15631
+ return React__default.createElement(React__default.Fragment, null, tagSetData.map(function (tagSet, key) {
15632
+ if (typeof tagSet.label === "string") {
15633
+ console.warn("NYPL Reservoir TagSet: Explore tags require all `label` props to be React components.");
15634
+ }
15635
+
15636
+ return React__default.createElement(TooltipWrapper, {
15637
+ key: key,
15638
+ label: tagSet.label
15639
+ }, React__default.createElement(react.Box, {
15640
+ "data-testid": "explore-tags",
15641
+ id: "ts-explore-" + id + "-" + key,
15642
+ __css: styles
15643
+ }, tagSet.iconName ? React__default.createElement(Icon, {
15644
+ align: "left",
15645
+ "data-testid": "ts-icon",
15646
+ name: tagSet.iconName,
15647
+ size: "small"
15648
+ }) : null, React__default.createElement("span", null, tagSet.label)));
15649
+ }));
15650
+ });
15651
+
15652
+ /**
15653
+ * The "filter" `TagSet` variant will display tags that can be removed when
15654
+ * `isDismissible` is true and they are clicked.
15655
+ */
15656
+
15657
+ var TagSetFilter$1 = /*#__PURE__*/react.chakra(function (props) {
15658
+ var id = props.id,
15659
+ _props$isDismissible = props.isDismissible,
15660
+ isDismissible = _props$isDismissible === void 0 ? false : _props$isDismissible,
15661
+ onClick = props.onClick,
15662
+ _props$tagSetData = props.tagSetData,
15663
+ tagSetData = _props$tagSetData === void 0 ? [] : _props$tagSetData;
15664
+
15665
+ var _React$useState = React__default.useState(tagSetData),
15666
+ filters = _React$useState[0],
15667
+ setFilters = _React$useState[1];
15668
+
15669
+ var styles = react.useMultiStyleConfig("TagSetFilter", {
15670
+ isDismissible: isDismissible
15671
+ });
15672
+
15673
+ var finalOnClick = function finalOnClick(tagLabel) {
15674
+ onClick && onClick(tagLabel);
15675
+ }; // This expects that the consuming app passes in a new set of data
15676
+ // whenever the current list of tags needs to be updated.
15677
+
15678
+
15679
+ React.useEffect(function () {
15680
+ setFilters(tagSetData);
15681
+ }, [tagSetData, setFilters]);
15682
+ return React__default.createElement(React__default.Fragment, null, filters.map(function (tagSet, key) {
15683
+ if (typeof tagSet.label !== "string") {
15684
+ console.warn("NYPL Reservoir TagSet: Filter tags require all `label` props to be strings.");
15685
+ }
15686
+
15687
+ if (isDismissible && tagSet.iconName) {
15688
+ console.warn("NYPL Reservoir TagSet: Filter tags will not render icons when `isDismissible` is set to true.");
15689
+ }
15690
+
15691
+ return React__default.createElement(TooltipWrapper, {
15692
+ key: key,
15693
+ label: tagSet.label
15694
+ }, React__default.createElement(Button, {
15695
+ "data-testid": "filter-tags",
15696
+ id: "ts-filter-" + id + "-" + key,
15697
+ onClick: isDismissible ? function () {
15698
+ return finalOnClick(tagSet.label);
15699
+ } : undefined,
15700
+ sx: styles
15701
+ }, !isDismissible && tagSet.iconName ? React__default.createElement(Icon, {
15702
+ align: "left",
15703
+ "data-testid": "ts-icon",
15704
+ name: tagSet.iconName,
15705
+ size: "small"
15706
+ }) : null, React__default.createElement("span", null, tagSet.label), isDismissible ? React__default.createElement(Icon, {
15707
+ "data-testid": "filter-close-icon",
15708
+ align: "right",
15709
+ name: "close",
15710
+ size: "small",
15711
+ color: "ui.gray.x-dark",
15712
+ width: "12px"
15713
+ }) : null));
15714
+ }), filters.length > 1 && isDismissible ? React__default.createElement(Button, {
15715
+ buttonType: "link",
15716
+ "data-testid": "filter-clear-all",
15717
+ id: "ts-filter-clear-all-" + id,
15718
+ onClick: function onClick() {
15719
+ return finalOnClick("clearFilters");
15720
+ },
15721
+ __css: styles.clearAll
15722
+ }, "Clear Filters") : null);
15723
+ });
15724
+
15725
+ var _excluded$2e = ["className", "id", "isDismissible", "onClick", "tagSetData", "type"];
15726
+
15727
+ function isFilterType(type) {
15728
+ return type === "filter";
15729
+ }
15730
+ /**
15731
+ * This helper component wrapper renders a DS `Tooltip` component if the text is
15732
+ * long or a React fragment. This assumes that the `label` prop is a rather
15733
+ * simple single root JSX element, such as `<Link ...>....</Link>`.
15734
+ */
15735
+
15736
+ var TooltipWrapper = function TooltipWrapper(_ref) {
15737
+ var label = _ref.label,
15738
+ children = _ref.children;
15739
+ var maxCharLengthToShow = 20;
15740
+ var labelText = typeof label === "string" ? label : label.props.children;
15741
+
15742
+ if (labelText.length > maxCharLengthToShow && typeof labelText === "string") {
15743
+ return React__default.createElement(Tooltip$1, {
15744
+ content: labelText
15745
+ }, children);
15746
+ }
15747
+
15748
+ return React__default.createElement(React__default.Fragment, null, children);
15749
+ };
15750
+ /**
15751
+ * The `TagSet` component renders a group of individual tags which have two
15752
+ * variants: "explore" and "filter". The "explore" tags are meant to be used for
15753
+ * exploratory linkable elements, whereas the "filter" tags are used to display
15754
+ * the filter values that were selected through another UI. Only "filter" tags
15755
+ * can be dismissible.
15756
+ *
15757
+ * The width of a single tag will never be greater than 200px. If necessary, a
15758
+ * tag’s label text will be truncated to keep a tag’s width at or below 200px.
15759
+ * The full label text will be automatically revealed when the tag is hovered
15760
+ * with a DS `Tooltip` component.
15761
+ */
15762
+
15763
+ var TagSet$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
15764
+ var className = props.className,
15765
+ id = props.id,
15766
+ _props$isDismissible = props.isDismissible,
15767
+ isDismissible = _props$isDismissible === void 0 ? false : _props$isDismissible,
15768
+ onClick = props.onClick,
15769
+ _props$tagSetData = props.tagSetData,
15770
+ tagSetData = _props$tagSetData === void 0 ? [] : _props$tagSetData,
15771
+ _props$type = props.type,
15772
+ type = _props$type === void 0 ? "filter" : _props$type,
15773
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2e);
15774
+
15775
+ var styles = react.useStyleConfig("TagSet", {});
15776
+
15777
+ if (!isFilterType(type)) {
15778
+ if (isDismissible) {
15779
+ console.warn("NYPL Reservoir TagSet: The `isDismissible` prop will be ignored when the `type` prop is set to 'explore'.");
15780
+ }
15781
+
15782
+ if (onClick) {
15783
+ console.warn("NYPL Reservoir TagSet: The `onClick` prop will be ignored when the `type` prop is set to 'explore'.");
15784
+ }
15785
+ }
15786
+
15787
+ return React__default.createElement(react.Flex, Object.assign({
15788
+ className: className,
15789
+ id: id,
15790
+ ref: ref,
15791
+ __css: styles
15792
+ }, rest), !isFilterType(type) && React__default.createElement(TagSetExplore$1, {
15793
+ id: id,
15794
+ tagSetData: tagSetData,
15795
+ type: type
15796
+ }), isFilterType(type) && React__default.createElement(TagSetFilter$1, {
15797
+ id: id,
15798
+ isDismissible: isDismissible,
15799
+ onClick: onClick,
15800
+ tagSetData: tagSetData,
15801
+ type: type
15802
+ }));
15803
+ }));
15804
+
15805
+ var _excluded$2f = ["aboveHeader", "breakout", "contentId", "contentBottom", "contentPrimary", "contentSidebar", "contentTop", "footer", "header", "sidebar", "renderFooterElement", "renderHeaderElement", "renderSkipNavigation"];
15588
15806
  /**
15589
15807
  * The main top-level parent component that wraps all template-related
15590
15808
  * components.
@@ -15834,7 +16052,7 @@ var TemplateAppContainer = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forward
15834
16052
  renderHeaderElement = _props$renderHeaderEl === void 0 ? true : _props$renderHeaderEl,
15835
16053
  _props$renderSkipNavi = props.renderSkipNavigation,
15836
16054
  renderSkipNavigation = _props$renderSkipNavi === void 0 ? false : _props$renderSkipNavi,
15837
- rest = _objectWithoutPropertiesLoose(props, _excluded$2d);
16055
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2f);
15838
16056
 
15839
16057
  var aboveHeaderElem = aboveHeader && React__default.createElement(TemplateAboveHeader, null, aboveHeader);
15840
16058
  var contentTopElem = contentTop && React__default.createElement(TemplateContentTop, null, contentTop);
@@ -15853,7 +16071,7 @@ var TemplateAppContainer = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forward
15853
16071
  }, footer)));
15854
16072
  }));
15855
16073
 
15856
- var _excluded$2e = ["defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
16074
+ var _excluded$2g = ["defaultChecked", "helperText", "id", "invalidText", "isChecked", "isDisabled", "isInvalid", "isRequired", "labelText", "name", "onChange", "size"];
15857
16075
  var onChangeDefault = function onChangeDefault() {
15858
16076
  return;
15859
16077
  };
@@ -15880,7 +16098,7 @@ var Toggle$2 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function
15880
16098
  onChange = _props$onChange === void 0 ? onChangeDefault : _props$onChange,
15881
16099
  _props$size = props.size,
15882
16100
  size = _props$size === void 0 ? "default" : _props$size,
15883
- rest = _objectWithoutPropertiesLoose(props, _excluded$2e);
16101
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2g);
15884
16102
 
15885
16103
  var styles = react.useMultiStyleConfig("Toggle", {
15886
16104
  isDisabled: isDisabled,
@@ -15929,7 +16147,7 @@ var Toggle$2 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function
15929
16147
  }), labelText)));
15930
16148
  }));
15931
16149
 
15932
- var _excluded$2f = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
16150
+ var _excluded$2h = ["aspectRatio", "className", "descriptionText", "embedCode", "headingText", "helperText", "id", "iframeTitle", "showHelperInvalidText", "videoId", "videoType"];
15933
16151
  var VideoPlayer$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
15934
16152
  var aspectRatio = props.aspectRatio,
15935
16153
  className = props.className,
@@ -15943,7 +16161,7 @@ var VideoPlayer$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
15943
16161
  showHelperInvalidText = _props$showHelperInva === void 0 ? true : _props$showHelperInva,
15944
16162
  videoId = props.videoId,
15945
16163
  videoType = props.videoType,
15946
- rest = _objectWithoutPropertiesLoose(props, _excluded$2f);
16164
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2h);
15947
16165
 
15948
16166
  var iframeTitleFinal = videoType === "vimeo" ? iframeTitle || "Vimeo video player" : iframeTitle || "YouTube video player";
15949
16167
  var videoSrc = videoType === "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";
@@ -16013,38 +16231,6 @@ var VideoPlayer$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(fun
16013
16231
  }, embedElement)));
16014
16232
  }));
16015
16233
 
16016
- var _excluded$2g = ["children", "className", "content", "id", "isDisabled", "shouldWrapChildren"];
16017
- var Tooltip$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (props, ref) {
16018
- var children = props.children,
16019
- content = props.content,
16020
- isDisabled = props.isDisabled,
16021
- shouldWrapChildren = props.shouldWrapChildren,
16022
- rest = _objectWithoutPropertiesLoose(props, _excluded$2g);
16023
-
16024
- if (typeof content !== "string") {
16025
- React__default.Children.map(content, function (contentChild) {
16026
- if (contentChild.type !== Icon || contentChild.type !== Image) {
16027
- console.warn("NYPL Reservoir Tooltip: Pass in a string, DS Icon, or DS Image into the 'content' prop.");
16028
- }
16029
- });
16030
- }
16031
-
16032
- var newChildren = shouldWrapChildren ? React__default.createElement(ComponentWrapper, {
16033
- width: "fit-content"
16034
- }, children) : children;
16035
- var styles = react.useMultiStyleConfig("Tooltip", {});
16036
- return React__default.createElement(react.Tooltip, Object.assign({
16037
- hasArrow: true,
16038
- "aria-label": typeof content !== "string" ? "Tooltip" : undefined,
16039
- label: content,
16040
- isDisabled: isDisabled,
16041
- placement: "top",
16042
- openDelay: 500,
16043
- ref: ref,
16044
- __css: styles
16045
- }, rest), newChildren);
16046
- }));
16047
-
16048
16234
  Object.defineProperty(exports, 'Box', {
16049
16235
  enumerable: true,
16050
16236
  get: function () {
@@ -16212,6 +16398,7 @@ exports.StatusBadge = StatusBadge$1;
16212
16398
  exports.StructuredContent = StructuredContent$1;
16213
16399
  exports.Table = Table;
16214
16400
  exports.Tabs = Tabs;
16401
+ exports.TagSet = TagSet$1;
16215
16402
  exports.Template = Template$1;
16216
16403
  exports.TemplateAboveHeader = TemplateAboveHeader;
16217
16404
  exports.TemplateAppContainer = TemplateAppContainer;