@arc-ui/community-components 3.9.0 → 3.11.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/lib/index.cjs CHANGED
@@ -1,10 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var NavigationHeader = require('@arc-ui/components/NavigationHeader');
5
+ var Popover = require('@arc-ui/components/Popover');
6
+ var Icon = require('@arc-ui/components/Icon');
7
+ var Image$2 = require('@arc-ui/components/Image');
4
8
  var Heading = require('@arc-ui/components/Heading');
5
9
  var Text = require('@arc-ui/components/Text');
10
+ var Tooltip = require('@arc-ui/components/Tooltip');
11
+ var ButtonV2 = require('@arc-ui/components/ButtonV2');
6
12
  var VerticalSpace = require('@arc-ui/components/VerticalSpace');
7
- var Image$2 = require('@arc-ui/components/Image');
8
13
  var Disclosure = require('@arc-ui/components/Disclosure');
9
14
  var Carousel = require('@arc-ui/components/Carousel');
10
15
  var Columns = require('@arc-ui/components/Columns');
@@ -12,8 +17,6 @@ var MediaCard = require('@arc-ui/components/MediaCard');
12
17
  var useMediaQuery = require('@arc-ui/components/use-media-query');
13
18
  var Grid = require('@arc-ui/components/Grid');
14
19
  var Avatar = require('@arc-ui/components/Avatar');
15
- var Icon = require('@arc-ui/components/Icon');
16
- var ButtonV2 = require('@arc-ui/components/ButtonV2');
17
20
  var Download = require('@arc-ui/components/Download');
18
21
  var Link = require('@arc-ui/components/Link');
19
22
  var Tabs = require('@arc-ui/components/Tabs');
@@ -129,30 +132,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
129
132
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
130
133
  };
131
134
 
132
- /**
133
- * Filters out attributes from the given props object based on a pattern.
134
- *
135
- * This function extracts all properties that match either the `data-*` or `aria-*` attribute patterns
136
- * and returns a new object containing only those properties.
137
- *
138
- * @param props - The object containing properties to filter.
139
- * @returns A new object containing only the matched attributes (`data-*` and `aria-*`) from the input props.
140
- */
141
- var attributePrefixes = ["data-", "aria-"];
142
- var filterAttrs = function (props) {
143
- var filteredProps = {};
144
- var _loop_1 = function (prop) {
145
- if (Object.prototype.hasOwnProperty.call(props, prop) &&
146
- attributePrefixes.some(function (prefix) { return prop.startsWith(prefix); })) {
147
- filteredProps[prop] = props[prop];
148
- }
149
- };
150
- for (var prop in props) {
151
- _loop_1(prop);
152
- }
153
- return filteredProps;
154
- };
155
-
156
135
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
157
136
 
158
137
  function getDefaultExportFromCjs (x) {
@@ -246,6 +225,73 @@ function requireClassnames () {
246
225
  var classnamesExports = requireClassnames();
247
226
  var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
248
227
 
228
+ /**
229
+ * Filters out attributes from the given props object based on a pattern.
230
+ *
231
+ * This function extracts all properties that match either the `data-*` or `aria-*` attribute patterns
232
+ * and returns a new object containing only those properties.
233
+ *
234
+ * @param props - The object containing properties to filter.
235
+ * @returns A new object containing only the matched attributes (`data-*` and `aria-*`) from the input props.
236
+ */
237
+ var attributePrefixes = ["data-", "aria-"];
238
+ var filterAttrs = function (props) {
239
+ var filteredProps = {};
240
+ var _loop_1 = function (prop) {
241
+ if (Object.prototype.hasOwnProperty.call(props, prop) &&
242
+ attributePrefixes.some(function (prefix) { return prop.startsWith(prefix); })) {
243
+ filteredProps[prop] = props[prop];
244
+ }
245
+ };
246
+ for (var prop in props) {
247
+ _loop_1(prop);
248
+ }
249
+ return filteredProps;
250
+ };
251
+
252
+ /**
253
+ * Do not edit directly
254
+ * Generated file
255
+ */
256
+
257
+ const BtIconCrossAlt =
258
+ "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e%3cpath fill='currentColor' d='m16.707 16.02 4.482-4.494a.5.5 0 1 0-.707-.706l-4.48 4.493-4.482-4.493a.5.5 0 1 0-.707.706l4.483 4.494-4.483 4.494a.5.5 0 1 0 .707.706l4.481-4.493 4.481 4.493a.5.5 0 1 0 .707-.706Z'/%3e%3c/svg%3e";
259
+
260
+ var styles$v = {"popupNotification":"HeaderBarNotification-module_popupNotification__HAxod","hiddenByDefault":"HeaderBarNotification-module_hiddenByDefault__JHbUy","s":"HeaderBarNotification-module_s__HofMM","m":"HeaderBarNotification-module_m__ZUdjq","l":"HeaderBarNotification-module_l__wlZ1Z","xl":"HeaderBarNotification-module_xl__z7DBP","container":"HeaderBarNotification-module_container__18nau","content":"HeaderBarNotification-module_content__SUo-l","image":"HeaderBarNotification-module_image__uV-nD","details":"HeaderBarNotification-module_details__S5Rrx","closeButtonContainer":"HeaderBarNotification-module_closeButtonContainer__b1UDI"};
261
+
262
+ var HeaderBarNotification = function (_a) {
263
+ var _b;
264
+ var headerActionProps = _a.headerActionProps, notificationId = _a.notificationId, _c = _a.isPersistant, isPersistant = _c === void 0 ? false : _c, icon = _a.icon, image = _a.image, heading = _a.heading, tagline = _a.tagline, children = _a.children, button = _a.button, showAtSize = _a.showAtSize, props = __rest(_a, ["headerActionProps", "notificationId", "isPersistant", "icon", "image", "heading", "tagline", "children", "button", "showAtSize"]);
265
+ var _d = React.useState(isPersistant), showNotification = _d[0], setShowNotification = _d[1];
266
+ var localStorageId = "hide".concat(notificationId.replace(/[^a-zA-Z0-9\-_]/g, ""));
267
+ // Check to see if the notication has been hidden or not and show it if so
268
+ React.useEffect(function () {
269
+ if (typeof window !== "undefined" && !isPersistant) {
270
+ setShowNotification(!localStorage.getItem(localStorageId));
271
+ }
272
+ }, []);
273
+ // Handle the closure of the notification, store it in the session so we don't keep showing it.
274
+ var handleClosePopup = function () {
275
+ if (!isPersistant)
276
+ localStorage.setItem(localStorageId, "true");
277
+ setShowNotification(false);
278
+ };
279
+ return (React.createElement(Popover.Popover, __assign({ open: showNotification, side: "bottom", sideOffset: 12, maxWidth: 900, arrow: true, asChild: true, className: classNames(styles$v.popupNotification, (_b = {}, _b[styles$v.hiddenByDefault] = showAtSize, _b), showAtSize === null || showAtSize === void 0 ? void 0 : showAtSize.map(function (s) { return styles$v[s]; })), content: React.createElement("div", { className: styles$v.container },
280
+ React.createElement("div", { className: styles$v.content },
281
+ (image || icon) && (React.createElement("div", { className: styles$v.image },
282
+ image && (React.createElement(Image$2.Image, { src: image, alt: heading, fit: "cover", width: 55 })),
283
+ icon && React.createElement(Icon.Icon, { icon: icon, size: 35 }))),
284
+ React.createElement("div", { className: styles$v.details },
285
+ tagline && (React.createElement(Text.Text, { size: "m", tone: "muted" }, tagline)),
286
+ React.createElement(Heading.Heading, { size: "s", level: "3" }, heading),
287
+ children)),
288
+ button && (React.createElement(ButtonV2.ButtonV2, { onClick: button.handleClick, label: button.text, buttonStyle: "secondary", isFullWidth: true })),
289
+ React.createElement("div", { className: styles$v.closeButtonContainer },
290
+ React.createElement(Tooltip.Tooltip, { side: "bottom", title: "Dismiss Notification", asChild: true },
291
+ React.createElement(ButtonV2.ButtonV2, { "data-testid": localStorageId, buttonStyle: "tertiary", "aria-label": "Close ".concat(notificationId, " popup"), onClick: handleClosePopup, icon: BtIconCrossAlt })))) }, filterAttrs(props)),
292
+ React.createElement(NavigationHeader.NavigationHeaderAction, __assign({ isAttention: true }, headerActionProps))));
293
+ };
294
+
249
295
  var styles$u = {"accordion-header":"AccordionHeading-module_accordion-header__8s12f","accordion-header--hasImage":"AccordionHeading-module_accordion-header--hasImage__wbDjW","accordion-header--padded":"AccordionHeading-module_accordion-header--padded__me1JY","accordion-header--headingSizeM":"AccordionHeading-module_accordion-header--headingSizeM__amLfy"};
250
296
 
251
297
  var AccordionHeading = function (_a) {
@@ -3942,23 +3988,23 @@ var ProductNavigation = function (_a) {
3942
3988
  return (React.createElement("li", { key: "displayList-".concat(i), tabIndex: -1, ref: i === skipLinkCard ? cardRef : undefined, "data-cy": "list-item-".concat(i) },
3943
3989
  React.createElement(InformationCard.InformationCard, __assign({}, cardProps, { minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : cardProps.minHeight, headingLevel: (_a = cardProps.headingLevel) !== null && _a !== void 0 ? _a : "2" }))));
3944
3990
  })),
3945
- React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
3946
- React.createElement("div", { style: { display: "flex" } },
3947
- !hideButton && !hideLessButton && (React.createElement(ButtonV2.ButtonV2, { label: displayList.length < productList.length
3948
- ? "Show more"
3949
- : "Show less", buttonStyle: "secondary", onClick: clickController, isFullWidth: isMinWidthArcBreakpointS ? false : true, isLoading: isLoading })),
3950
- hideButton ||
3951
- (displaySkipButton && displayList.length > cardsToDisplay && (React.createElement("div", { id: "skip-link", className: classNames(styles$d["productNavigation-skipLink"]), tabIndex: -1 },
3952
- React.createElement(ButtonV2.ButtonV2, { label: "Move to first new card", buttonStyle: "primary", onClick: moveFocus, isFullWidth: isMinWidthArcBreakpointS ? false : true })))),
3953
- React.createElement(VisuallyHidden.VisuallyHidden, null,
3954
- React.createElement("div", { "aria-live": "polite", id: "aria-live-region", "aria-atomic": true },
3955
- React.createElement("p", null,
3956
- "Total products listed ",
3957
- displayList.length,
3958
- ". Total products hidden",
3959
- " ",
3960
- productList.length - displayList.length,
3961
- "."))))));
3991
+ !hideButton &&
3992
+ !(defaultExpanded && displayList.length === productList.length) && (React.createElement(React.Fragment, null,
3993
+ React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
3994
+ React.createElement("div", { style: { display: "flex" } },
3995
+ !hideLessButton && (React.createElement(ButtonV2.ButtonV2, { label: displayList.length < productList.length
3996
+ ? "Show more"
3997
+ : "Show less", buttonStyle: "secondary", onClick: clickController, isFullWidth: isMinWidthArcBreakpointS ? false : true, isLoading: isLoading })),
3998
+ displaySkipButton && displayList.length > cardsToDisplay && (React.createElement("div", { id: "skip-link", className: classNames(styles$d["productNavigation-skipLink"]), tabIndex: -1 },
3999
+ React.createElement(ButtonV2.ButtonV2, { label: "Move to first new card", buttonStyle: "primary", onClick: moveFocus, isFullWidth: isMinWidthArcBreakpointS ? false : true }))),
4000
+ React.createElement(VisuallyHidden.VisuallyHidden, null,
4001
+ React.createElement("div", { "aria-live": "polite", id: "aria-live-region", "aria-atomic": true },
4002
+ React.createElement("p", null,
4003
+ "Total products listed ",
4004
+ displayList.length,
4005
+ ". Total products hidden ",
4006
+ productList.length - displayList.length,
4007
+ "."))))))));
3962
4008
  };
3963
4009
 
3964
4010
  var styles$c = {"container":"ContentInfoWidget-module_container__yaS-8","text":"ContentInfoWidget-module_text__O1BdZ","icon":"ContentInfoWidget-module_icon__LEww1"};
@@ -3972,23 +4018,24 @@ var ContentInfoWidget = function (_a) {
3972
4018
  React.createElement(Text.Text, { size: "xs", tone: "muted" }, text))));
3973
4019
  };
3974
4020
 
3975
- var styles$b = {"action-tile":"ActionTile-module_action-tile__JPwGb","action-tile-content":"ActionTile-module_action-tile-content__ZkgHc","action-tile-icon":"ActionTile-module_action-tile-icon__PY1EN","action-tile-heading":"ActionTile-module_action-tile-heading__Uxdu9","action-tile--active":"ActionTile-module_action-tile--active__-aWze","action-tile-tick":"ActionTile-module_action-tile-tick__vhsJE"};
4021
+ var styles$b = {"action-tile":"ActionTile-module_action-tile__JPwGb","action-tile-content":"ActionTile-module_action-tile-content__ZkgHc","action-tile-content--without-icon":"ActionTile-module_action-tile-content--without-icon__7F5xj","action-tile-icon":"ActionTile-module_action-tile-icon__PY1EN","action-tile-heading":"ActionTile-module_action-tile-heading__Uxdu9","action-tile--active":"ActionTile-module_action-tile--active__-aWze","action-tile-tick":"ActionTile-module_action-tile-tick__vhsJE"};
3976
4022
 
3977
4023
  var ActionTile = function (_a) {
3978
- var _b;
3979
- var icon = _a.icon, activeIcon = _a.activeIcon, heading = _a.heading, _c = _a.isActive, isActive = _c === void 0 ? false : _c, onClick = _a.onClick, className = _a.className, props = __rest(_a, ["icon", "activeIcon", "heading", "isActive", "onClick", "className"]);
3980
- var tileClasses = classNames(styles$b["action-tile"], (_b = {},
3981
- _b[styles$b["action-tile--active"]] = isActive,
3982
- _b), className);
4024
+ var _b, _c;
4025
+ var icon = _a.icon, activeIcon = _a.activeIcon, heading = _a.heading, _d = _a.isActive, isActive = _d === void 0 ? false : _d, onClick = _a.onClick, props = __rest(_a, ["icon", "activeIcon", "heading", "isActive", "onClick"]);
3983
4026
  var displayIcon = isActive && activeIcon ? activeIcon : icon;
3984
4027
  var content = (React.createElement(React.Fragment, null,
3985
- React.createElement("div", { className: styles$b["action-tile-content"] },
4028
+ React.createElement("div", { className: classNames(styles$b["action-tile-content"], (_b = {},
4029
+ _b[styles$b["action-tile-content--without-icon"]] = !displayIcon,
4030
+ _b)) },
3986
4031
  displayIcon && (React.createElement("div", { className: styles$b["action-tile-icon"] },
3987
4032
  React.createElement(Icon.Icon, { icon: displayIcon, size: 48 }))),
3988
4033
  React.createElement("span", { className: styles$b["action-tile-heading"] }, heading)),
3989
4034
  isActive && (React.createElement("div", { className: styles$b["action-tile-tick"] },
3990
4035
  React.createElement(Icon.Icon, { icon: BtIconTickAlt2Px, size: 28 })))));
3991
- return (React.createElement("button", __assign({ type: "button", className: tileClasses, onClick: onClick, "aria-pressed": isActive }, filterAttrs(props)), content));
4036
+ return (React.createElement("button", __assign({ type: "button", className: classNames(styles$b["action-tile"], (_c = {},
4037
+ _c[styles$b["action-tile--active"]] = isActive,
4038
+ _c)), onClick: onClick, "aria-pressed": isActive }, filterAttrs(props)), content));
3992
4039
  };
3993
4040
 
3994
4041
  var styles$a = {"link-tile":"LinkTile-module_link-tile__xVUP3","link-tile-content":"LinkTile-module_link-tile-content__H-QN8","link-tile-icon":"LinkTile-module_link-tile-icon__kTMfH","link-tile-text":"LinkTile-module_link-tile-text__0K6zf"};
@@ -4265,6 +4312,7 @@ exports.CopyLead = CopyLead;
4265
4312
  exports.DownloadList = DownloadList;
4266
4313
  exports.FAQs = FAQs;
4267
4314
  exports.FeaturePost = FeaturePost;
4315
+ exports.HeaderBarNotification = HeaderBarNotification;
4268
4316
  exports.Highlights = Highlights;
4269
4317
  exports.InlineLinkGroup = InlineLinkGroup;
4270
4318
  exports.LinkTile = LinkTile;