@nypl/design-system-react-components 1.0.6 → 1.0.7
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 +9 -0
- package/dist/components/SearchBar/SearchBar.d.ts +6 -1
- package/dist/design-system-react-components.cjs.development.js +59 -42
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +59 -42
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/theme/components/hero.d.ts +138 -84
- package/dist/theme/components/list.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,15 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
|
|
|
8
8
|
|
|
9
9
|
## Prerelease
|
|
10
10
|
|
|
11
|
+
## 1.0.7 (July 29, 2022)
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
|
|
15
|
+
- Updates border color in the `Description` variant of the `List` component.
|
|
16
|
+
- Updates how options are passed to the `SearchBar` component for its internal `Select` component.
|
|
17
|
+
- Updates how style props are passed to the `Link` component when using with third-party libraries, such as React Router.
|
|
18
|
+
- Updates the layout of the `Image` in the `Hero` "secondary" and "fiftyFifty" variants for mobile and desktop.
|
|
19
|
+
|
|
11
20
|
## 1.0.6 (July 21, 2022)
|
|
12
21
|
|
|
13
22
|
### Adds
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
3
3
|
interface BaseProps {
|
|
4
|
+
id?: string;
|
|
4
5
|
labelText: string;
|
|
5
6
|
name: string;
|
|
6
7
|
onChange?: (event: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
7
8
|
value?: string;
|
|
8
9
|
}
|
|
10
|
+
interface SelectOptionsProps {
|
|
11
|
+
text: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
9
14
|
export interface SelectProps extends BaseProps {
|
|
10
|
-
optionsData:
|
|
15
|
+
optionsData: SelectOptionsProps[];
|
|
11
16
|
onChange?: (event: React.FormEvent) => void;
|
|
12
17
|
}
|
|
13
18
|
export interface TextInputProps extends BaseProps {
|
|
@@ -2117,7 +2117,7 @@ var Link = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (pr
|
|
|
2117
2117
|
var variant = "link";
|
|
2118
2118
|
|
|
2119
2119
|
if (typeof children === "string" && !href) {
|
|
2120
|
-
throw new Error("`Link` needs the `href` prop.");
|
|
2120
|
+
throw new Error("NYPL Reservoir Link: The `Link` component needs the `href` prop if its child element is a string.");
|
|
2121
2121
|
}
|
|
2122
2122
|
|
|
2123
2123
|
if (type === "action" || type === "forwards" || type === "backwards" || type === "external") {
|
|
@@ -2141,15 +2141,15 @@ var Link = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (pr
|
|
|
2141
2141
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32832
|
|
2142
2142
|
// let children = React.Children.only(children);
|
|
2143
2143
|
if (React__default.Children.count(children) > 1) {
|
|
2144
|
-
throw new Error("Please pass only one child into `Link
|
|
2144
|
+
throw new Error("NYPL Reservoir Link: Please pass only one child into the `Link` component.");
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
2147
|
var childrenToClone = children[0] ? children[0] : children;
|
|
2148
2148
|
var childProps = childrenToClone.props;
|
|
2149
|
-
return React__default.createElement(react.Box, {
|
|
2149
|
+
return React__default.createElement(react.Box, Object.assign({
|
|
2150
2150
|
as: "span",
|
|
2151
2151
|
__css: style
|
|
2152
|
-
}, React__default.cloneElement(childrenToClone, _extends({
|
|
2152
|
+
}, rest), React__default.cloneElement(childrenToClone, _extends({
|
|
2153
2153
|
className: className
|
|
2154
2154
|
}, linkProps, childProps, {
|
|
2155
2155
|
ref: ref,
|
|
@@ -2365,9 +2365,9 @@ var Image = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (p
|
|
|
2365
2365
|
className: className,
|
|
2366
2366
|
size: size
|
|
2367
2367
|
}, caption || credit ? {} : rest), imageComponent) : imageComponent;
|
|
2368
|
-
return React__default.createElement(react.Box, {
|
|
2368
|
+
return React__default.createElement(react.Box, Object.assign({
|
|
2369
2369
|
ref: finalRefs
|
|
2370
|
-
}, caption || credit ? React__default.createElement(react.Box, Object.assign({
|
|
2370
|
+
}, rest), caption || credit ? React__default.createElement(react.Box, Object.assign({
|
|
2371
2371
|
as: "figure",
|
|
2372
2372
|
__css: _extends({}, styles.figure, additionalFigureStyles)
|
|
2373
2373
|
}, rest), finalImage, React__default.createElement(react.Box, {
|
|
@@ -2378,7 +2378,11 @@ var Image = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (p
|
|
|
2378
2378
|
}, caption), credit && React__default.createElement(react.Box, {
|
|
2379
2379
|
__css: styles.captionWrappers
|
|
2380
2380
|
}, credit))) : finalImage);
|
|
2381
|
-
})
|
|
2381
|
+
}), {
|
|
2382
|
+
shouldForwardProp: function shouldForwardProp() {
|
|
2383
|
+
return true;
|
|
2384
|
+
}
|
|
2385
|
+
});
|
|
2382
2386
|
|
|
2383
2387
|
var _excluded$Y = ["children"],
|
|
2384
2388
|
_excluded2$1 = ["bottomBorder", "children", "isCentered", "layout", "topBorder"],
|
|
@@ -5508,21 +5512,32 @@ var secondaryBase = {
|
|
|
5508
5512
|
flexFlow: {
|
|
5509
5513
|
base: "column nowrap",
|
|
5510
5514
|
md: "row wrap"
|
|
5515
|
+
}
|
|
5516
|
+
}),
|
|
5517
|
+
imgWrapper: {
|
|
5518
|
+
marginEnd: {
|
|
5519
|
+
base: "calc(-50vw + 50%)",
|
|
5520
|
+
md: "0"
|
|
5521
|
+
},
|
|
5522
|
+
marginStart: {
|
|
5523
|
+
base: "calc(-50vw + 50%)",
|
|
5524
|
+
md: "0"
|
|
5525
|
+
},
|
|
5526
|
+
flex: {
|
|
5527
|
+
base: "1 1 100%",
|
|
5528
|
+
md: "0 0 250px"
|
|
5529
|
+
},
|
|
5530
|
+
order: {
|
|
5531
|
+
base: "2",
|
|
5532
|
+
md: "3"
|
|
5511
5533
|
},
|
|
5512
5534
|
img: {
|
|
5513
|
-
flex: {
|
|
5514
|
-
base: "1 1 100%",
|
|
5515
|
-
md: "0 0 250px"
|
|
5516
|
-
},
|
|
5517
|
-
order: {
|
|
5518
|
-
md: "3"
|
|
5519
|
-
},
|
|
5520
5535
|
height: "150px",
|
|
5521
5536
|
minWidth: "0",
|
|
5522
5537
|
objectFit: "cover",
|
|
5523
5538
|
width: "100%"
|
|
5524
5539
|
}
|
|
5525
|
-
}
|
|
5540
|
+
},
|
|
5526
5541
|
bodyText: {
|
|
5527
5542
|
paddingBottom: "inset.default",
|
|
5528
5543
|
paddingEnd: {
|
|
@@ -5533,6 +5548,7 @@ var secondaryBase = {
|
|
|
5533
5548
|
md: "1 1 50%"
|
|
5534
5549
|
},
|
|
5535
5550
|
order: {
|
|
5551
|
+
base: "3",
|
|
5536
5552
|
md: "2"
|
|
5537
5553
|
}
|
|
5538
5554
|
}
|
|
@@ -5540,18 +5556,14 @@ var secondaryBase = {
|
|
|
5540
5556
|
|
|
5541
5557
|
var secondaryHeadingBase = {
|
|
5542
5558
|
marginBottom: "0",
|
|
5543
|
-
bg: "ui.black",
|
|
5544
5559
|
color: "ui.white",
|
|
5545
5560
|
flex: "1 1 100%",
|
|
5546
5561
|
marginTop: "0",
|
|
5547
5562
|
paddingBottom: "xxs",
|
|
5548
5563
|
position: "relative",
|
|
5549
5564
|
zIndex: "0",
|
|
5550
|
-
order:
|
|
5551
|
-
md: "1"
|
|
5552
|
-
},
|
|
5565
|
+
order: "1",
|
|
5553
5566
|
_before: {
|
|
5554
|
-
bg: "ui.black",
|
|
5555
5567
|
content: "\"\"",
|
|
5556
5568
|
height: "100%",
|
|
5557
5569
|
left: "-2000px",
|
|
@@ -5563,6 +5575,10 @@ var secondaryHeadingBase = {
|
|
|
5563
5575
|
// update the background color.
|
|
5564
5576
|
|
|
5565
5577
|
var getSecondaryVariantStyles = function getSecondaryVariantStyles(bgColor) {
|
|
5578
|
+
if (bgColor === void 0) {
|
|
5579
|
+
bgColor = "ui.black";
|
|
5580
|
+
}
|
|
5581
|
+
|
|
5566
5582
|
return _extends({}, secondaryBase, {
|
|
5567
5583
|
heading: _extends({}, secondaryHeadingBase, {
|
|
5568
5584
|
bg: bgColor,
|
|
@@ -5609,11 +5625,7 @@ var primary$1 = {
|
|
|
5609
5625
|
}
|
|
5610
5626
|
}
|
|
5611
5627
|
};
|
|
5612
|
-
|
|
5613
|
-
var secondary$1 = /*#__PURE__*/_extends({}, secondaryBase, {
|
|
5614
|
-
heading: /*#__PURE__*/_extends({}, secondaryHeadingBase)
|
|
5615
|
-
});
|
|
5616
|
-
|
|
5628
|
+
var secondary$1 = /*#__PURE__*/getSecondaryVariantStyles();
|
|
5617
5629
|
var secondaryBooksAndMore = /*#__PURE__*/getSecondaryVariantStyles("section.books-and-more.primary");
|
|
5618
5630
|
var secondaryLocations = /*#__PURE__*/getSecondaryVariantStyles("section.locations.primary");
|
|
5619
5631
|
var secondaryResearch = /*#__PURE__*/getSecondaryVariantStyles("section.research.primary");
|
|
@@ -5717,18 +5729,22 @@ var fiftyFifty = {
|
|
|
5717
5729
|
lg: "unset"
|
|
5718
5730
|
}
|
|
5719
5731
|
}),
|
|
5720
|
-
|
|
5732
|
+
imgWrapper: {
|
|
5721
5733
|
marginBottom: {
|
|
5722
5734
|
base: "s",
|
|
5723
5735
|
lg: "unset"
|
|
5724
5736
|
},
|
|
5725
5737
|
marginEnd: {
|
|
5738
|
+
base: "-15px",
|
|
5726
5739
|
lg: "s"
|
|
5727
5740
|
},
|
|
5741
|
+
marginStart: {
|
|
5742
|
+
base: "-15px"
|
|
5743
|
+
},
|
|
5728
5744
|
maxWidth: {
|
|
5729
|
-
base: "fit-content",
|
|
5730
5745
|
lg: "50%"
|
|
5731
|
-
}
|
|
5746
|
+
},
|
|
5747
|
+
width: "auto"
|
|
5732
5748
|
}
|
|
5733
5749
|
};
|
|
5734
5750
|
var Hero = {
|
|
@@ -5904,18 +5920,18 @@ var baseUnorderedStyles = function baseUnorderedStyles(noStyling) {
|
|
|
5904
5920
|
}
|
|
5905
5921
|
});
|
|
5906
5922
|
};
|
|
5907
|
-
var
|
|
5923
|
+
var baseSectionDescriptionStyles = {
|
|
5908
5924
|
borderBottom: "1px solid",
|
|
5909
5925
|
borderColor: "ui.gray.light-cool",
|
|
5910
5926
|
paddingStart: "0",
|
|
5911
5927
|
h2: {
|
|
5912
5928
|
borderTop: "3px solid",
|
|
5913
|
-
borderColor: "
|
|
5929
|
+
borderColor: "ui.gray.medium",
|
|
5914
5930
|
margin: "0",
|
|
5915
5931
|
padding: "var(--nypl-space-xs) 0 0"
|
|
5916
5932
|
}
|
|
5917
5933
|
};
|
|
5918
|
-
var
|
|
5934
|
+
var baseDescriptionStyles = /*#__PURE__*/_extends({}, baseSectionDescriptionStyles, {
|
|
5919
5935
|
dl: {
|
|
5920
5936
|
display: "grid",
|
|
5921
5937
|
gridTemplateColumns: {
|
|
@@ -5965,7 +5981,7 @@ var List = {
|
|
|
5965
5981
|
return baseUnorderedStyles(noStyling);
|
|
5966
5982
|
},
|
|
5967
5983
|
ol: textMargin,
|
|
5968
|
-
dl:
|
|
5984
|
+
dl: baseDescriptionStyles
|
|
5969
5985
|
}
|
|
5970
5986
|
};
|
|
5971
5987
|
|
|
@@ -6882,10 +6898,10 @@ var StructuredContent = {
|
|
|
6882
6898
|
}, baseUnorderedStyles()),
|
|
6883
6899
|
ol: _extends({}, baseListStyles(), textMargin),
|
|
6884
6900
|
// For section, h2 in the definition list.
|
|
6885
|
-
section:
|
|
6886
|
-
dl:
|
|
6887
|
-
dt:
|
|
6888
|
-
dd:
|
|
6901
|
+
section: baseSectionDescriptionStyles,
|
|
6902
|
+
dl: baseDescriptionStyles.dl,
|
|
6903
|
+
dt: baseDescriptionStyles.dt,
|
|
6904
|
+
dd: baseDescriptionStyles.dd,
|
|
6889
6905
|
table: {
|
|
6890
6906
|
width: "100%",
|
|
6891
6907
|
th: _extends({
|
|
@@ -7623,7 +7639,8 @@ var Hero$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (
|
|
|
7623
7639
|
__css: styles.interior
|
|
7624
7640
|
}, finalHeading, subHeaderText)) : React__default.createElement(React__default.Fragment, null, heroType !== "primary" && heroType !== "tertiary" && React__default.createElement(Image, {
|
|
7625
7641
|
alt: imageProps.alt,
|
|
7626
|
-
src: imageProps.src
|
|
7642
|
+
src: imageProps.src,
|
|
7643
|
+
__css: styles.imgWrapper
|
|
7627
7644
|
}), finalHeading, heroType === "tertiary" && subHeaderText ? React__default.createElement("p", null, subHeaderText) : React__default.createElement(react.Box, {
|
|
7628
7645
|
__css: styles.bodyText
|
|
7629
7646
|
}, subHeaderText));
|
|
@@ -11222,7 +11239,7 @@ var SearchBar$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(funct
|
|
|
11222
11239
|
|
|
11223
11240
|
|
|
11224
11241
|
var selectElem = selectProps && React__default.createElement(Select$1, Object.assign({
|
|
11225
|
-
id: "searchbar-select-" + id,
|
|
11242
|
+
id: (selectProps == null ? void 0 : selectProps.id) || "searchbar-select-" + id,
|
|
11226
11243
|
labelText: selectProps == null ? void 0 : selectProps.labelText,
|
|
11227
11244
|
name: selectProps == null ? void 0 : selectProps.name,
|
|
11228
11245
|
onChange: selectProps == null ? void 0 : selectProps.onChange,
|
|
@@ -11231,13 +11248,13 @@ var SearchBar$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(funct
|
|
|
11231
11248
|
__css: styles.select
|
|
11232
11249
|
}, stateProps), selectProps == null ? void 0 : selectProps.optionsData.map(function (option) {
|
|
11233
11250
|
return React__default.createElement("option", {
|
|
11234
|
-
key: option,
|
|
11235
|
-
value: option
|
|
11236
|
-
}, option);
|
|
11251
|
+
key: option.value,
|
|
11252
|
+
value: option.value
|
|
11253
|
+
}, option.text);
|
|
11237
11254
|
})); // Render the `TextInput` component.
|
|
11238
11255
|
|
|
11239
11256
|
var textInputNative = textInputProps && React__default.createElement(TextInput, Object.assign({
|
|
11240
|
-
id: "searchbar-textinput-" + id,
|
|
11257
|
+
id: (textInputProps == null ? void 0 : textInputProps.id) || "searchbar-textinput-" + id,
|
|
11241
11258
|
labelText: textInputProps == null ? void 0 : textInputProps.labelText,
|
|
11242
11259
|
name: textInputProps == null ? void 0 : textInputProps.name,
|
|
11243
11260
|
onChange: textInputProps == null ? void 0 : textInputProps.onChange,
|