@nypl/design-system-react-components 1.2.0-rc-2 → 1.2.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 +1653 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/TextInput/TextInput.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/design-system-react-components.cjs.development.js +44 -25
- 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 +44 -25
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2508,33 +2508,49 @@ var AudioPlayer = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props,
|
|
|
2508
2508
|
id = props.id,
|
|
2509
2509
|
_props$iframeTitle = props.iframeTitle,
|
|
2510
2510
|
iframeTitle = _props$iframeTitle === void 0 ? null : _props$iframeTitle,
|
|
2511
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$Z);
|
|
2511
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$Z);
|
|
2512
2512
|
|
|
2513
|
+
var _useState = useState(false),
|
|
2514
|
+
invalidEmbed = _useState[0],
|
|
2515
|
+
setInvalidEmbed = _useState[1];
|
|
2513
2516
|
|
|
2514
|
-
var
|
|
2517
|
+
var _useState2 = useState(undefined),
|
|
2518
|
+
iframeDoc = _useState2[0],
|
|
2519
|
+
setIframeDoc = _useState2[1];
|
|
2520
|
+
/**
|
|
2521
|
+
* Main hooks to check the embedCode structure.
|
|
2522
|
+
*/
|
|
2515
2523
|
|
|
2516
|
-
var isInvalidEmbed = !embedCode || !iframeDoc || !isValidEmbedCode(iframeDoc);
|
|
2517
|
-
var errorMessage = "<strong>Error: </strong>This audio player has not been configured properly. Please contact the site administrator.";
|
|
2518
2524
|
|
|
2519
|
-
function
|
|
2520
|
-
|
|
2525
|
+
useEffect(function () {
|
|
2526
|
+
// The root iframe object generated from the embedCode.
|
|
2527
|
+
var iframe = parseIframeEmbedCode(embedCode); // when no embedCode or it was a broken code.
|
|
2521
2528
|
|
|
2522
|
-
|
|
2523
|
-
} // Only set the iframe title if it doesn't already have it in the iframe.
|
|
2529
|
+
var isInvalidEmbed = !embedCode || !iframe || !isValidEmbedCode(audioType, iframe); // Only set the iframe title if it doesn't already have it in the iframe.
|
|
2524
2530
|
|
|
2531
|
+
if (iframe && !iframe.title) {
|
|
2532
|
+
iframe.title = iframeTitle ? iframeTitle : "Embedded audio player";
|
|
2533
|
+
}
|
|
2525
2534
|
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2535
|
+
var isThirdPartyService = !!thirdPartyServices.find(function (service) {
|
|
2536
|
+
return service === audioType;
|
|
2537
|
+
});
|
|
2538
|
+
var isThirdPartyWithoutCode = isThirdPartyService && !embedCode;
|
|
2529
2539
|
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2540
|
+
if (isThirdPartyWithoutCode) {
|
|
2541
|
+
console.warn("NYPL Reservoir AudioPlayer: The `embedCode` prop is required when using a 3rd party streaming service.");
|
|
2542
|
+
isInvalidEmbed = true;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
setInvalidEmbed(isInvalidEmbed);
|
|
2546
|
+
setIframeDoc(iframe);
|
|
2547
|
+
}, [embedCode, audioType, iframeTitle]);
|
|
2548
|
+
var errorMessage = "<strong>Error: </strong>This audio player has not been configured properly. Please contact the site administrator.";
|
|
2534
2549
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2550
|
+
function isValidEmbedCode(audioType, doc) {
|
|
2551
|
+
var _doc$src;
|
|
2552
|
+
|
|
2553
|
+
return audioType !== "file" && (doc == null ? void 0 : (_doc$src = doc.src) == null ? void 0 : _doc$src.includes(audioType + ".com"));
|
|
2538
2554
|
}
|
|
2539
2555
|
|
|
2540
2556
|
var styles = useMultiStyleConfig("AudioPlayer", {});
|
|
@@ -2561,7 +2577,7 @@ var AudioPlayer = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props,
|
|
|
2561
2577
|
"data-testid": "audio-player-component",
|
|
2562
2578
|
ref: ref,
|
|
2563
2579
|
__css: styles
|
|
2564
|
-
}, rest),
|
|
2580
|
+
}, rest), invalidEmbed ? React__default.createElement(Box, {
|
|
2565
2581
|
dangerouslySetInnerHTML: {
|
|
2566
2582
|
__html: errorMessage
|
|
2567
2583
|
},
|
|
@@ -4047,7 +4063,7 @@ var Form = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
4047
4063
|
}
|
|
4048
4064
|
});
|
|
4049
4065
|
|
|
4050
|
-
var _excluded$18 = ["children", "className", "htmlFor", "id", "isInlined", "isRequired"];
|
|
4066
|
+
var _excluded$18 = ["children", "className", "htmlFor", "id", "isInlined", "isRequired", "requiredLabelText"];
|
|
4051
4067
|
/**
|
|
4052
4068
|
* A label for form inputs. It should never be used alone.
|
|
4053
4069
|
*/
|
|
@@ -4061,6 +4077,7 @@ var Label = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
4061
4077
|
isInlined = _props$isInlined === void 0 ? false : _props$isInlined,
|
|
4062
4078
|
_props$isRequired = props.isRequired,
|
|
4063
4079
|
isRequired = _props$isRequired === void 0 ? false : _props$isRequired,
|
|
4080
|
+
requiredLabelText = props.requiredLabelText,
|
|
4064
4081
|
rest = _objectWithoutPropertiesLoose(props, _excluded$18);
|
|
4065
4082
|
|
|
4066
4083
|
var styles = useStyleConfig("Label", {
|
|
@@ -4078,10 +4095,10 @@ var Label = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
4078
4095
|
htmlFor: htmlFor,
|
|
4079
4096
|
ref: ref,
|
|
4080
4097
|
__css: styles
|
|
4081
|
-
}, rest), children, isRequired && React__default.createElement("span", null, " (Required)"));
|
|
4098
|
+
}, rest), children, isRequired && React__default.createElement("span", null, requiredLabelText ? " (" + requiredLabelText + ")" : " (Required)"));
|
|
4082
4099
|
}));
|
|
4083
4100
|
|
|
4084
|
-
var _excluded$19 = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "max", "maxLength", "min", "name", "onChange", "onClick", "onFocus", "placeholder", "showHelperInvalidText", "showLabel", "showRequiredLabel", "step", "textInputType", "type", "value"];
|
|
4101
|
+
var _excluded$19 = ["className", "defaultValue", "helperText", "id", "invalidText", "isDisabled", "isInvalid", "isRequired", "labelText", "max", "maxLength", "min", "name", "onChange", "onClick", "onFocus", "placeholder", "showHelperInvalidText", "showLabel", "showRequiredLabel", "requiredLabelText", "step", "textInputType", "type", "value"];
|
|
4085
4102
|
|
|
4086
4103
|
var TextInputFormats = {
|
|
4087
4104
|
email: "jdoe@domain.com",
|
|
@@ -4125,6 +4142,7 @@ var TextInput = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, re
|
|
|
4125
4142
|
showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
|
|
4126
4143
|
_props$showRequiredLa = props.showRequiredLabel,
|
|
4127
4144
|
showRequiredLabel = _props$showRequiredLa === void 0 ? true : _props$showRequiredLa,
|
|
4145
|
+
requiredLabelText = props.requiredLabelText,
|
|
4128
4146
|
_props$step = props.step,
|
|
4129
4147
|
step = _props$step === void 0 ? 1 : _props$step,
|
|
4130
4148
|
_props$textInputType = props.textInputType,
|
|
@@ -4220,7 +4238,8 @@ var TextInput = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, re
|
|
|
4220
4238
|
}, rest), labelText && showLabel && !isHidden && React__default.createElement(Label, {
|
|
4221
4239
|
htmlFor: id,
|
|
4222
4240
|
id: id + "-label",
|
|
4223
|
-
isRequired: showRequiredLabel && isRequired
|
|
4241
|
+
isRequired: showRequiredLabel && isRequired,
|
|
4242
|
+
requiredLabelText: requiredLabelText
|
|
4224
4243
|
}, labelText), fieldOutput);
|
|
4225
4244
|
}));
|
|
4226
4245
|
|
|
@@ -15587,10 +15606,10 @@ var Tooltip$1 = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, re
|
|
|
15587
15606
|
shouldWrapChildren = props.shouldWrapChildren,
|
|
15588
15607
|
rest = _objectWithoutPropertiesLoose(props, _excluded$2d);
|
|
15589
15608
|
|
|
15590
|
-
if (typeof content !== "string") {
|
|
15609
|
+
if (typeof content !== "string" && typeof content !== "number") {
|
|
15591
15610
|
React__default.Children.map(content, function (contentChild) {
|
|
15592
15611
|
if (contentChild.type !== Icon || contentChild.type !== Image) {
|
|
15593
|
-
console.warn("NYPL Reservoir Tooltip: Pass in a string, DS Icon, or DS Image into the 'content' prop.");
|
|
15612
|
+
console.warn("NYPL Reservoir Tooltip: Pass in a string, number, DS Icon, or DS Image into the 'content' prop.");
|
|
15594
15613
|
}
|
|
15595
15614
|
});
|
|
15596
15615
|
}
|