@nypl/design-system-react-components 1.2.0-rc-2 → 1.2.0-rc-3
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/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/design-system-react-components.cjs.development.js +37 -21
- 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 +37 -21
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export interface TooltipProps {
|
|
|
3
3
|
/** Any child node passed to the component. */
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
/** Value used to populate the tooltip content. */
|
|
6
|
-
content: string | React.ReactNode;
|
|
6
|
+
content: string | number | React.ReactNode;
|
|
7
7
|
/** A class name for the Tooltip parent div. */
|
|
8
8
|
className?: string;
|
|
9
9
|
/** ID that other components can cross reference for accessibility purposes. */
|
|
@@ -2514,33 +2514,49 @@ var AudioPlayer = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(funct
|
|
|
2514
2514
|
id = props.id,
|
|
2515
2515
|
_props$iframeTitle = props.iframeTitle,
|
|
2516
2516
|
iframeTitle = _props$iframeTitle === void 0 ? null : _props$iframeTitle,
|
|
2517
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$Z);
|
|
2517
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$Z);
|
|
2518
2518
|
|
|
2519
|
+
var _useState = React.useState(false),
|
|
2520
|
+
invalidEmbed = _useState[0],
|
|
2521
|
+
setInvalidEmbed = _useState[1];
|
|
2519
2522
|
|
|
2520
|
-
var
|
|
2523
|
+
var _useState2 = React.useState(undefined),
|
|
2524
|
+
iframeDoc = _useState2[0],
|
|
2525
|
+
setIframeDoc = _useState2[1];
|
|
2526
|
+
/**
|
|
2527
|
+
* Main hooks to check the embedCode structure.
|
|
2528
|
+
*/
|
|
2521
2529
|
|
|
2522
|
-
var isInvalidEmbed = !embedCode || !iframeDoc || !isValidEmbedCode(iframeDoc);
|
|
2523
|
-
var errorMessage = "<strong>Error: </strong>This audio player has not been configured properly. Please contact the site administrator.";
|
|
2524
2530
|
|
|
2525
|
-
function
|
|
2526
|
-
|
|
2531
|
+
React.useEffect(function () {
|
|
2532
|
+
// The root iframe object generated from the embedCode.
|
|
2533
|
+
var iframe = parseIframeEmbedCode(embedCode); // when no embedCode or it was a broken code.
|
|
2527
2534
|
|
|
2528
|
-
|
|
2529
|
-
} // Only set the iframe title if it doesn't already have it in the iframe.
|
|
2535
|
+
var isInvalidEmbed = !embedCode || !iframe || !isValidEmbedCode(audioType, iframe); // Only set the iframe title if it doesn't already have it in the iframe.
|
|
2530
2536
|
|
|
2537
|
+
if (iframe && !iframe.title) {
|
|
2538
|
+
iframe.title = iframeTitle ? iframeTitle : "Embedded audio player";
|
|
2539
|
+
}
|
|
2531
2540
|
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2541
|
+
var isThirdPartyService = !!thirdPartyServices.find(function (service) {
|
|
2542
|
+
return service === audioType;
|
|
2543
|
+
});
|
|
2544
|
+
var isThirdPartyWithoutCode = isThirdPartyService && !embedCode;
|
|
2535
2545
|
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2546
|
+
if (isThirdPartyWithoutCode) {
|
|
2547
|
+
console.warn("NYPL Reservoir AudioPlayer: The `embedCode` prop is required when using a 3rd party streaming service.");
|
|
2548
|
+
isInvalidEmbed = true;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
setInvalidEmbed(isInvalidEmbed);
|
|
2552
|
+
setIframeDoc(iframe);
|
|
2553
|
+
}, [embedCode, audioType, iframeTitle]);
|
|
2554
|
+
var errorMessage = "<strong>Error: </strong>This audio player has not been configured properly. Please contact the site administrator.";
|
|
2555
|
+
|
|
2556
|
+
function isValidEmbedCode(audioType, doc) {
|
|
2557
|
+
var _doc$src;
|
|
2540
2558
|
|
|
2541
|
-
|
|
2542
|
-
console.warn("NYPL Reservoir AudioPlayer: The `embedCode` prop is required when using a 3rd party streaming service.");
|
|
2543
|
-
isInvalidEmbed = true;
|
|
2559
|
+
return audioType !== "file" && (doc == null ? void 0 : (_doc$src = doc.src) == null ? void 0 : _doc$src.includes(audioType + ".com"));
|
|
2544
2560
|
}
|
|
2545
2561
|
|
|
2546
2562
|
var styles = react.useMultiStyleConfig("AudioPlayer", {});
|
|
@@ -2567,7 +2583,7 @@ var AudioPlayer = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(funct
|
|
|
2567
2583
|
"data-testid": "audio-player-component",
|
|
2568
2584
|
ref: ref,
|
|
2569
2585
|
__css: styles
|
|
2570
|
-
}, rest),
|
|
2586
|
+
}, rest), invalidEmbed ? React__default.createElement(react.Box, {
|
|
2571
2587
|
dangerouslySetInnerHTML: {
|
|
2572
2588
|
__html: errorMessage
|
|
2573
2589
|
},
|
|
@@ -15593,10 +15609,10 @@ var Tooltip$1 = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(functio
|
|
|
15593
15609
|
shouldWrapChildren = props.shouldWrapChildren,
|
|
15594
15610
|
rest = _objectWithoutPropertiesLoose(props, _excluded$2d);
|
|
15595
15611
|
|
|
15596
|
-
if (typeof content !== "string") {
|
|
15612
|
+
if (typeof content !== "string" && typeof content !== "number") {
|
|
15597
15613
|
React__default.Children.map(content, function (contentChild) {
|
|
15598
15614
|
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.");
|
|
15615
|
+
console.warn("NYPL Reservoir Tooltip: Pass in a string, number, DS Icon, or DS Image into the 'content' prop.");
|
|
15600
15616
|
}
|
|
15601
15617
|
});
|
|
15602
15618
|
}
|