@arc-ui/community-components 3.9.0 → 3.10.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');
@@ -153,6 +156,48 @@ var filterAttrs = function (props) {
153
156
  return filteredProps;
154
157
  };
155
158
 
159
+ /**
160
+ * Do not edit directly
161
+ * Generated file
162
+ */
163
+
164
+ const BtIconCrossAlt =
165
+ "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";
166
+
167
+ var styles$v = {"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"};
168
+
169
+ var HeaderBarNotification = function (_a) {
170
+ var headerActionProps = _a.headerActionProps, notificationId = _a.notificationId, _b = _a.isPersistant, isPersistant = _b === void 0 ? false : _b, icon = _a.icon, image = _a.image, heading = _a.heading, tagline = _a.tagline, children = _a.children, button = _a.button, props = __rest(_a, ["headerActionProps", "notificationId", "isPersistant", "icon", "image", "heading", "tagline", "children", "button"]);
171
+ var _c = React.useState(isPersistant), showNotification = _c[0], setShowNotification = _c[1];
172
+ var localStorageId = "hide".concat(notificationId.replace(/[^a-zA-Z0-9\-_]/g, ""));
173
+ // Check to see if the notication has been hidden or not and show it if so
174
+ React.useEffect(function () {
175
+ if (typeof window !== "undefined" && !isPersistant) {
176
+ setShowNotification(!localStorage.getItem(localStorageId));
177
+ }
178
+ }, []);
179
+ // Handle the closure of the notification, store it in the session so we don't keep showing it.
180
+ var handleClosePopup = function () {
181
+ if (!isPersistant)
182
+ localStorage.setItem(localStorageId, "true");
183
+ setShowNotification(false);
184
+ };
185
+ return (React.createElement(Popover.Popover, __assign({ open: showNotification, side: "bottom", sideOffset: 12, maxWidth: 900, arrow: true, content: React.createElement("div", { className: styles$v.container },
186
+ React.createElement("div", { className: styles$v.content },
187
+ (image || icon) && (React.createElement("div", { className: styles$v.image },
188
+ image && (React.createElement(Image$2.Image, { src: image, alt: heading, fit: "cover", width: 55 })),
189
+ icon && React.createElement(Icon.Icon, { icon: icon, size: 35 }))),
190
+ React.createElement("div", { className: styles$v.details },
191
+ tagline && (React.createElement(Text.Text, { size: "m", tone: "muted" }, tagline)),
192
+ React.createElement(Heading.Heading, { size: "s", level: "3" }, heading),
193
+ children)),
194
+ button && (React.createElement(ButtonV2.ButtonV2, { onClick: button.handleClick, label: button.text, buttonStyle: "secondary", isFullWidth: true })),
195
+ React.createElement("div", { className: styles$v.closeButtonContainer },
196
+ React.createElement(Tooltip.Tooltip, { side: "bottom", title: "Dismiss Notification", asChild: true },
197
+ React.createElement(ButtonV2.ButtonV2, { "data-testid": localStorageId, buttonStyle: "tertiary", "aria-label": "Close ".concat(notificationId, " popup"), onClick: handleClosePopup, icon: BtIconCrossAlt })))) }, filterAttrs(props)),
198
+ React.createElement(NavigationHeader.NavigationHeaderAction, __assign({ isAttention: true }, headerActionProps))));
199
+ };
200
+
156
201
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
157
202
 
158
203
  function getDefaultExportFromCjs (x) {
@@ -3942,23 +3987,23 @@ var ProductNavigation = function (_a) {
3942
3987
  return (React.createElement("li", { key: "displayList-".concat(i), tabIndex: -1, ref: i === skipLinkCard ? cardRef : undefined, "data-cy": "list-item-".concat(i) },
3943
3988
  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
3989
  })),
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
- "."))))));
3990
+ !hideButton &&
3991
+ !(defaultExpanded && displayList.length === productList.length) && (React.createElement(React.Fragment, null,
3992
+ React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
3993
+ React.createElement("div", { style: { display: "flex" } },
3994
+ !hideLessButton && (React.createElement(ButtonV2.ButtonV2, { label: displayList.length < productList.length
3995
+ ? "Show more"
3996
+ : "Show less", buttonStyle: "secondary", onClick: clickController, isFullWidth: isMinWidthArcBreakpointS ? false : true, isLoading: isLoading })),
3997
+ displaySkipButton && displayList.length > cardsToDisplay && (React.createElement("div", { id: "skip-link", className: classNames(styles$d["productNavigation-skipLink"]), tabIndex: -1 },
3998
+ React.createElement(ButtonV2.ButtonV2, { label: "Move to first new card", buttonStyle: "primary", onClick: moveFocus, isFullWidth: isMinWidthArcBreakpointS ? false : true }))),
3999
+ React.createElement(VisuallyHidden.VisuallyHidden, null,
4000
+ React.createElement("div", { "aria-live": "polite", id: "aria-live-region", "aria-atomic": true },
4001
+ React.createElement("p", null,
4002
+ "Total products listed ",
4003
+ displayList.length,
4004
+ ". Total products hidden ",
4005
+ productList.length - displayList.length,
4006
+ "."))))))));
3962
4007
  };
3963
4008
 
3964
4009
  var styles$c = {"container":"ContentInfoWidget-module_container__yaS-8","text":"ContentInfoWidget-module_text__O1BdZ","icon":"ContentInfoWidget-module_icon__LEww1"};
@@ -3972,23 +4017,24 @@ var ContentInfoWidget = function (_a) {
3972
4017
  React.createElement(Text.Text, { size: "xs", tone: "muted" }, text))));
3973
4018
  };
3974
4019
 
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"};
4020
+ 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
4021
 
3977
4022
  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);
4023
+ var _b, _c;
4024
+ 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
4025
  var displayIcon = isActive && activeIcon ? activeIcon : icon;
3984
4026
  var content = (React.createElement(React.Fragment, null,
3985
- React.createElement("div", { className: styles$b["action-tile-content"] },
4027
+ React.createElement("div", { className: classNames(styles$b["action-tile-content"], (_b = {},
4028
+ _b[styles$b["action-tile-content--without-icon"]] = !displayIcon,
4029
+ _b)) },
3986
4030
  displayIcon && (React.createElement("div", { className: styles$b["action-tile-icon"] },
3987
4031
  React.createElement(Icon.Icon, { icon: displayIcon, size: 48 }))),
3988
4032
  React.createElement("span", { className: styles$b["action-tile-heading"] }, heading)),
3989
4033
  isActive && (React.createElement("div", { className: styles$b["action-tile-tick"] },
3990
4034
  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));
4035
+ return (React.createElement("button", __assign({ type: "button", className: classNames(styles$b["action-tile"], (_c = {},
4036
+ _c[styles$b["action-tile--active"]] = isActive,
4037
+ _c)), onClick: onClick, "aria-pressed": isActive }, filterAttrs(props)), content));
3992
4038
  };
3993
4039
 
3994
4040
  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 +4311,7 @@ exports.CopyLead = CopyLead;
4265
4311
  exports.DownloadList = DownloadList;
4266
4312
  exports.FAQs = FAQs;
4267
4313
  exports.FeaturePost = FeaturePost;
4314
+ exports.HeaderBarNotification = HeaderBarNotification;
4268
4315
  exports.Highlights = Highlights;
4269
4316
  exports.InlineLinkGroup = InlineLinkGroup;
4270
4317
  exports.LinkTile = LinkTile;