@nypl/design-system-react-components 1.5.0 → 1.5.1

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,22 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
+ ## 1.5.1 (March 23, 2023)
12
+
13
+ ### Updates
14
+
15
+ - Updates the `Button` component to use a transparent background for the default state of the "secondary" variant.
16
+ - Updates the `Hero` component so that the height of the image in the "campaign" and "fiftyFifty" variants will grow and shrink based on the text content.
17
+ - Updates the `SearchBar` component to include `defaultValue` as a prop in `textInputProps`.
18
+
19
+ ### Removes
20
+
21
+ - Removes the `Color Mode` docs page from Storybook due to the addition of the `Supporting Dark Mode` docs page.
22
+
23
+ ### Fixes
24
+
25
+ - Removes the `Slider` component's internal state update function (`setCurrentValue`) from Chakra's own `RangeSlider` component's `onChangeEnd` prop function. This fixes an issue where both Chakra's `onChange` and `onChangeEnd` prop functions were being called regardless of whether they were passed to the DS `Slider` component or not. Since Chakra's `onChange` function will always be called, the internal state function is kept. This ensures that there is no multiple calls or loop of state update calls when using keyboard controls to change the range slider's value.
26
+
11
27
  ## 1.5.0 (March 16, 2023)
12
28
 
13
29
  ### Adds
@@ -9,7 +9,7 @@ interface SelectOptionsProps {
9
9
  export declare type SelectProps = Partial<Pick<InitialSelectProps, "id" | "labelText" | "name" | "onChange" | "value">> & {
10
10
  optionsData: SelectOptionsProps[];
11
11
  };
12
- export declare type TextInputProps = Pick<InitialInputProps, "labelText" | "name"> & Partial<Pick<InitialInputProps, "id" | "isClearable" | "isClearableCallback" | "max" | "maxLength" | "min" | "onChange" | "pattern" | "placeholder" | "value">>;
12
+ export declare type TextInputProps = Pick<InitialInputProps, "labelText" | "name"> & Partial<Pick<InitialInputProps, "defaultValue" | "id" | "isClearable" | "isClearableCallback" | "max" | "maxLength" | "min" | "onChange" | "pattern" | "placeholder" | "value">>;
13
13
  export interface SearchBarProps {
14
14
  /** Adds 'action' property to the `form` element. */
15
15
  action?: string;
@@ -5193,7 +5193,6 @@ var secondary = function secondary(_ref2) {
5193
5193
  var _ref2$buttonSize = _ref2.buttonSize,
5194
5194
  buttonSize = _ref2$buttonSize === void 0 ? "medium" : _ref2$buttonSize;
5195
5195
  return _extends({
5196
- bg: "ui.white",
5197
5196
  border: "1px solid",
5198
5197
  borderColor: "ui.link.primary",
5199
5198
  color: "ui.link.primary"
@@ -7702,13 +7701,13 @@ var campaign = {
7702
7701
  },
7703
7702
  position: "relative",
7704
7703
  content: {
7705
- alignItems: "center",
7704
+ alignItems: "stretch",
7706
7705
  bg: "ui.black",
7707
7706
  color: "ui.white",
7708
7707
  display: "flex",
7709
7708
  flexFlow: {
7710
7709
  base: "column nowrap",
7711
- md: "row nowrap"
7710
+ lg: "row nowrap"
7712
7711
  },
7713
7712
  minHeight: "320px",
7714
7713
  flex: {
@@ -7732,60 +7731,63 @@ var campaign = {
7732
7731
  color: "inherit",
7733
7732
  display: "inline-block"
7734
7733
  },
7735
- img: {
7736
- flex: {
7737
- base: "1 1 100%",
7738
- md: "0 0 50%"
7739
- },
7740
- minWidth: "0",
7741
- objectFit: "cover",
7742
- width: "100%",
7743
- height: {
7744
- md: "320px"
7734
+ img: /*#__PURE__*/screenreaderOnly(),
7735
+ imgWrapper: {
7736
+ backgroundPosition: "center",
7737
+ backgroundSize: "cover",
7738
+ minHeight: "230px",
7739
+ width: {
7740
+ base: "100%",
7741
+ lg: "50%"
7745
7742
  }
7746
7743
  },
7747
7744
  interior: {
7748
- flex: {
7749
- base: "0 0 100%",
7750
- md: "0 0 50%"
7751
- },
7752
- padding: "inset.wide",
7745
+ alignSelf: "center",
7753
7746
  maxWidth: {
7754
7747
  md: "960px"
7748
+ },
7749
+ padding: {
7750
+ base: "inset.default",
7751
+ md: "inset.wide"
7752
+ },
7753
+ width: {
7754
+ base: "100%",
7755
+ lg: "50%"
7755
7756
  }
7756
7757
  }
7757
7758
  };
7758
7759
  var fiftyFifty = {
7759
7760
  content: /*#__PURE__*/_extends({}, wrapperStyles, {
7760
- alignItems: "center",
7761
+ alignItems: "stretch",
7761
7762
  display: "flex",
7762
7763
  flexFlow: {
7763
7764
  base: "column nowrap",
7764
7765
  lg: "row nowrap"
7765
- },
7766
- paddingBottom: "s",
7767
- paddingEnd: "s",
7768
- paddingStart: "s",
7769
- padding: {
7770
- lg: "unset"
7771
7766
  }
7772
7767
  }),
7773
7768
  imgWrapper: {
7774
- marginBottom: {
7775
- base: "s",
7776
- lg: "unset"
7777
- },
7778
- marginEnd: {
7779
- base: "-15px",
7780
- lg: "s"
7769
+ backgroundPosition: "center",
7770
+ backgroundSize: "cover",
7771
+ minHeight: "160px",
7772
+ width: {
7773
+ base: "100%",
7774
+ lg: "50%"
7775
+ }
7776
+ },
7777
+ img: /*#__PURE__*/screenreaderOnly(),
7778
+ bodyText: {
7779
+ alignSelf: "center",
7780
+ maxWidth: {
7781
+ md: "960px"
7781
7782
  },
7782
- marginStart: {
7783
- base: "-15px"
7783
+ padding: {
7784
+ base: "inset.default",
7785
+ md: "inset.wide"
7784
7786
  },
7785
- maxWidth: {
7787
+ width: {
7788
+ base: "100%",
7786
7789
  lg: "50%"
7787
- },
7788
- width: "auto"
7790
+ }
7789
7791
  }
7790
7792
  };
7791
7793
  var Hero = {
@@ -15541,13 +15543,19 @@ var Hero$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (
15541
15543
  } else if (foregroundColor || backgroundColor) {
15542
15544
  console.warn("NYPL Reservoir Hero: The `foregroundColor` and/or `backgroundColor` " + "props have been passed, but the `'secondary'` `heroType` " + "variant will not use them.");
15543
15545
  }
15544
- var childrenToRender = heroType === "campaign" ? React__default.createElement(React__default.Fragment, null, React__default.createElement(Image, {
15546
+ var childrenToRender = heroType === "campaign" ? React__default.createElement(React__default.Fragment, null, React__default.createElement(react.Box, {
15547
+ __css: _extends({}, styles.imgWrapper, {
15548
+ backgroundImage: "url(" + imageProps.src + ")"
15549
+ })
15550
+ }, React__default.createElement(Image, {
15545
15551
  alt: imageProps.alt,
15546
15552
  src: imageProps.src
15547
- }), React__default.createElement(react.Box, {
15553
+ })), React__default.createElement(react.Box, {
15548
15554
  __css: styles.interior
15549
15555
  }, finalHeading, subHeaderText)) : React__default.createElement(React__default.Fragment, null, heroType !== "primary" && heroType !== "tertiary" && React__default.createElement(react.Box, {
15550
- __css: styles.imgWrapper
15556
+ __css: _extends({}, styles.imgWrapper, {
15557
+ backgroundImage: heroType === "fiftyFifty" ? "url(" + imageProps.src + ")" : undefined
15558
+ })
15551
15559
  }, React__default.createElement(Image, {
15552
15560
  alt: imageProps.alt,
15553
15561
  src: imageProps.src
@@ -16139,6 +16147,7 @@ var SearchBar$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(funct
16139
16147
  }));
16140
16148
  // Render the `TextInput` component.
16141
16149
  var textInputNative = textInputProps && React__default.createElement(TextInput, Object.assign({
16150
+ defaultValue: textInputProps == null ? void 0 : textInputProps.defaultValue,
16142
16151
  id: (textInputProps == null ? void 0 : textInputProps.id) || "searchbar-textinput-" + id,
16143
16152
  isClearable: textInputProps == null ? void 0 : textInputProps.isClearable,
16144
16153
  isClearableCallback: textInputProps == null ? void 0 : textInputProps.isClearableCallback,
@@ -16363,7 +16372,6 @@ var Slider = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (
16363
16372
  _onChange && _onChange(val);
16364
16373
  },
16365
16374
  onChangeEnd: function onChangeEnd(val) {
16366
- setCurrentValue(val);
16367
16375
  _onChangeEnd && _onChangeEnd(val);
16368
16376
  },
16369
16377
  step: step,