@arc-ui/community-components 3.10.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/lib/HeaderBarNotification/HeaderBarNotification.cjs +6 -4
- package/lib/HeaderBarNotification/HeaderBarNotification.mjs +6 -4
- package/lib/HeaderBarNotification/styles.css +1 -1
- package/lib/index.cjs +67 -66
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +4 -0
- package/lib/index.d.mts +4 -0
- package/lib/index.mjs +67 -66
- package/lib/index.mjs.map +1 -1
- package/lib/styles.css +1 -1
- package/package.json +4 -4
- package/src/components/HeaderBarNotification/HeaderBarNotification.module.css +40 -0
- package/src/components/HeaderBarNotification/HeaderBarNotification.tsx +12 -2
- package/versions.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -59,6 +59,10 @@ interface HeaderBarNotificationProps {
|
|
|
59
59
|
handleClick: () => void;
|
|
60
60
|
text: string;
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Specify a size or mutliple sizes where the notification only appears.
|
|
64
|
+
*/
|
|
65
|
+
showAtSize?: ("s" | "m" | "l" | "xl")[];
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
interface AccordionHeadingProps {
|
package/lib/index.d.mts
CHANGED
|
@@ -59,6 +59,10 @@ interface HeaderBarNotificationProps {
|
|
|
59
59
|
handleClick: () => void;
|
|
60
60
|
text: string;
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Specify a size or mutliple sizes where the notification only appears.
|
|
64
|
+
*/
|
|
65
|
+
showAtSize?: ("s" | "m" | "l" | "xl")[];
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
interface AccordionHeadingProps {
|
package/lib/index.mjs
CHANGED
|
@@ -130,72 +130,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
130
130
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* Filters out attributes from the given props object based on a pattern.
|
|
135
|
-
*
|
|
136
|
-
* This function extracts all properties that match either the `data-*` or `aria-*` attribute patterns
|
|
137
|
-
* and returns a new object containing only those properties.
|
|
138
|
-
*
|
|
139
|
-
* @param props - The object containing properties to filter.
|
|
140
|
-
* @returns A new object containing only the matched attributes (`data-*` and `aria-*`) from the input props.
|
|
141
|
-
*/
|
|
142
|
-
var attributePrefixes = ["data-", "aria-"];
|
|
143
|
-
var filterAttrs = function (props) {
|
|
144
|
-
var filteredProps = {};
|
|
145
|
-
var _loop_1 = function (prop) {
|
|
146
|
-
if (Object.prototype.hasOwnProperty.call(props, prop) &&
|
|
147
|
-
attributePrefixes.some(function (prefix) { return prop.startsWith(prefix); })) {
|
|
148
|
-
filteredProps[prop] = props[prop];
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
for (var prop in props) {
|
|
152
|
-
_loop_1(prop);
|
|
153
|
-
}
|
|
154
|
-
return filteredProps;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Do not edit directly
|
|
159
|
-
* Generated file
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
const BtIconCrossAlt =
|
|
163
|
-
"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";
|
|
164
|
-
|
|
165
|
-
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"};
|
|
166
|
-
|
|
167
|
-
var HeaderBarNotification = function (_a) {
|
|
168
|
-
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"]);
|
|
169
|
-
var _c = useState(isPersistant), showNotification = _c[0], setShowNotification = _c[1];
|
|
170
|
-
var localStorageId = "hide".concat(notificationId.replace(/[^a-zA-Z0-9\-_]/g, ""));
|
|
171
|
-
// Check to see if the notication has been hidden or not and show it if so
|
|
172
|
-
useEffect(function () {
|
|
173
|
-
if (typeof window !== "undefined" && !isPersistant) {
|
|
174
|
-
setShowNotification(!localStorage.getItem(localStorageId));
|
|
175
|
-
}
|
|
176
|
-
}, []);
|
|
177
|
-
// Handle the closure of the notification, store it in the session so we don't keep showing it.
|
|
178
|
-
var handleClosePopup = function () {
|
|
179
|
-
if (!isPersistant)
|
|
180
|
-
localStorage.setItem(localStorageId, "true");
|
|
181
|
-
setShowNotification(false);
|
|
182
|
-
};
|
|
183
|
-
return (React.createElement(Popover, __assign({ open: showNotification, side: "bottom", sideOffset: 12, maxWidth: 900, arrow: true, content: React.createElement("div", { className: styles$v.container },
|
|
184
|
-
React.createElement("div", { className: styles$v.content },
|
|
185
|
-
(image || icon) && (React.createElement("div", { className: styles$v.image },
|
|
186
|
-
image && (React.createElement(Image$2, { src: image, alt: heading, fit: "cover", width: 55 })),
|
|
187
|
-
icon && React.createElement(Icon, { icon: icon, size: 35 }))),
|
|
188
|
-
React.createElement("div", { className: styles$v.details },
|
|
189
|
-
tagline && (React.createElement(Text, { size: "m", tone: "muted" }, tagline)),
|
|
190
|
-
React.createElement(Heading, { size: "s", level: "3" }, heading),
|
|
191
|
-
children)),
|
|
192
|
-
button && (React.createElement(ButtonV2, { onClick: button.handleClick, label: button.text, buttonStyle: "secondary", isFullWidth: true })),
|
|
193
|
-
React.createElement("div", { className: styles$v.closeButtonContainer },
|
|
194
|
-
React.createElement(Tooltip, { side: "bottom", title: "Dismiss Notification", asChild: true },
|
|
195
|
-
React.createElement(ButtonV2, { "data-testid": localStorageId, buttonStyle: "tertiary", "aria-label": "Close ".concat(notificationId, " popup"), onClick: handleClosePopup, icon: BtIconCrossAlt })))) }, filterAttrs(props)),
|
|
196
|
-
React.createElement(NavigationHeaderAction, __assign({ isAttention: true }, headerActionProps))));
|
|
197
|
-
};
|
|
198
|
-
|
|
199
133
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
200
134
|
|
|
201
135
|
function getDefaultExportFromCjs (x) {
|
|
@@ -289,6 +223,73 @@ function requireClassnames () {
|
|
|
289
223
|
var classnamesExports = requireClassnames();
|
|
290
224
|
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
291
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Filters out attributes from the given props object based on a pattern.
|
|
228
|
+
*
|
|
229
|
+
* This function extracts all properties that match either the `data-*` or `aria-*` attribute patterns
|
|
230
|
+
* and returns a new object containing only those properties.
|
|
231
|
+
*
|
|
232
|
+
* @param props - The object containing properties to filter.
|
|
233
|
+
* @returns A new object containing only the matched attributes (`data-*` and `aria-*`) from the input props.
|
|
234
|
+
*/
|
|
235
|
+
var attributePrefixes = ["data-", "aria-"];
|
|
236
|
+
var filterAttrs = function (props) {
|
|
237
|
+
var filteredProps = {};
|
|
238
|
+
var _loop_1 = function (prop) {
|
|
239
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) &&
|
|
240
|
+
attributePrefixes.some(function (prefix) { return prop.startsWith(prefix); })) {
|
|
241
|
+
filteredProps[prop] = props[prop];
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
for (var prop in props) {
|
|
245
|
+
_loop_1(prop);
|
|
246
|
+
}
|
|
247
|
+
return filteredProps;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Do not edit directly
|
|
252
|
+
* Generated file
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
const BtIconCrossAlt =
|
|
256
|
+
"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";
|
|
257
|
+
|
|
258
|
+
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"};
|
|
259
|
+
|
|
260
|
+
var HeaderBarNotification = function (_a) {
|
|
261
|
+
var _b;
|
|
262
|
+
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"]);
|
|
263
|
+
var _d = useState(isPersistant), showNotification = _d[0], setShowNotification = _d[1];
|
|
264
|
+
var localStorageId = "hide".concat(notificationId.replace(/[^a-zA-Z0-9\-_]/g, ""));
|
|
265
|
+
// Check to see if the notication has been hidden or not and show it if so
|
|
266
|
+
useEffect(function () {
|
|
267
|
+
if (typeof window !== "undefined" && !isPersistant) {
|
|
268
|
+
setShowNotification(!localStorage.getItem(localStorageId));
|
|
269
|
+
}
|
|
270
|
+
}, []);
|
|
271
|
+
// Handle the closure of the notification, store it in the session so we don't keep showing it.
|
|
272
|
+
var handleClosePopup = function () {
|
|
273
|
+
if (!isPersistant)
|
|
274
|
+
localStorage.setItem(localStorageId, "true");
|
|
275
|
+
setShowNotification(false);
|
|
276
|
+
};
|
|
277
|
+
return (React.createElement(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 },
|
|
278
|
+
React.createElement("div", { className: styles$v.content },
|
|
279
|
+
(image || icon) && (React.createElement("div", { className: styles$v.image },
|
|
280
|
+
image && (React.createElement(Image$2, { src: image, alt: heading, fit: "cover", width: 55 })),
|
|
281
|
+
icon && React.createElement(Icon, { icon: icon, size: 35 }))),
|
|
282
|
+
React.createElement("div", { className: styles$v.details },
|
|
283
|
+
tagline && (React.createElement(Text, { size: "m", tone: "muted" }, tagline)),
|
|
284
|
+
React.createElement(Heading, { size: "s", level: "3" }, heading),
|
|
285
|
+
children)),
|
|
286
|
+
button && (React.createElement(ButtonV2, { onClick: button.handleClick, label: button.text, buttonStyle: "secondary", isFullWidth: true })),
|
|
287
|
+
React.createElement("div", { className: styles$v.closeButtonContainer },
|
|
288
|
+
React.createElement(Tooltip, { side: "bottom", title: "Dismiss Notification", asChild: true },
|
|
289
|
+
React.createElement(ButtonV2, { "data-testid": localStorageId, buttonStyle: "tertiary", "aria-label": "Close ".concat(notificationId, " popup"), onClick: handleClosePopup, icon: BtIconCrossAlt })))) }, filterAttrs(props)),
|
|
290
|
+
React.createElement(NavigationHeaderAction, __assign({ isAttention: true }, headerActionProps))));
|
|
291
|
+
};
|
|
292
|
+
|
|
292
293
|
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"};
|
|
293
294
|
|
|
294
295
|
var AccordionHeading = function (_a) {
|