@kaizen/components 0.0.0-canary-typescript-transform-paths-3.5.2-20241113035843 → 0.0.0-canary-package-bundler-v2-20241113071536

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.
Files changed (33) hide show
  1. package/dist/cjs/Filter/FilterBar/FilterBar.cjs +1 -3
  2. package/dist/cjs/Filter/FilterBar/FilterBar.module.css.cjs +0 -1
  3. package/dist/cjs/Pagination/Pagination.cjs +1 -1
  4. package/dist/esm/Filter/FilterBar/FilterBar.mjs +1 -3
  5. package/dist/esm/Filter/FilterBar/FilterBar.module.css.mjs +0 -1
  6. package/dist/esm/Pagination/Pagination.mjs +1 -1
  7. package/dist/styles.css +5 -9
  8. package/package.json +3 -3
  9. package/src/Filter/FilterBar/FilterBar.module.css +0 -4
  10. package/src/Filter/FilterBar/FilterBar.tsx +12 -14
  11. package/src/Pagination/Pagination.tsx +1 -1
  12. package/src/Pagination/subcomponents/PaginationLink/PaginationLink.module.scss +1 -1
  13. package/src/Pagination/subcomponents/TruncateIndicator/TruncateIndicator.module.css +1 -1
  14. package/dist/types/Heading-Bq3fifM0.js +0 -114
  15. package/dist/types/IconButton-AN3AP9ja.js +0 -855
  16. package/dist/types/RemovableTag-CIqQvZuu.js +0 -674
  17. package/dist/types/ReversedColors-D9BxpiSS.js +0 -14
  18. package/dist/types/Tooltip-DNGasNM8.js +0 -286
  19. package/dist/types/actionsV1.js +0 -11
  20. package/dist/types/actionsV2.js +0 -10
  21. package/dist/types/actionsV3.js +0 -74
  22. package/dist/types/future.js +0 -211
  23. package/dist/types/index-hKXin_Zl.js +0 -10
  24. package/dist/types/index-offJCDcb.js +0 -6
  25. package/dist/types/index.js +0 -1016
  26. package/dist/types/mergeClassNames-BuzaWRqN.js +0 -25
  27. package/dist/types/overlaysV1.js +0 -8
  28. package/dist/types/overlaysV2.js +0 -7
  29. package/dist/types/overlaysV3.js +0 -104
  30. package/dist/types/reactAriaComponentsV3.js +0 -1
  31. package/dist/types/reactAriaV3.js +0 -1
  32. package/dist/types/styles.css +0 -11923
  33. package/dist/types/utilitiesV3.js +0 -2
@@ -1,855 +0,0 @@
1
- import { __assign, __rest } from 'tslib';
2
- import React, { useState, useCallback, useEffect, useRef, useId, cloneElement, forwardRef, useImperativeHandle } from 'react';
3
- import ReactDOM from 'react-dom';
4
- import classnames from 'classnames';
5
- import { FocusOn } from 'react-focus-on';
6
- import { usePopper } from 'react-popper';
7
- import { H as Heading, a as BadgeAnimated, B as Badge } from './Heading-Bq3fifM0.js';
8
- import { useLink, useFocusable } from 'react-aria';
9
- import { useContextProps, LinkContext } from 'react-aria-components';
10
- var styles$b = {
11
- "menuContainer": "MenuDropdown-module_menuContainer__X4272",
12
- "defaultWidth": "MenuDropdown-module_defaultWidth__8jWqB"
13
- };
14
- const MenuDropdown = /*#__PURE__*/function () {
15
- const MenuDropdown = function (_a) {
16
- var children = _a.children,
17
- referenceElement = _a.referenceElement,
18
- id = _a.id,
19
- hideMenuDropdown = _a.hideMenuDropdown,
20
- _b = _a.autoHide,
21
- autoHide = _b === void 0 ? "on" : _b,
22
- _c = _a.align,
23
- align = _c === void 0 ? "left" : _c,
24
- _d = _a.width,
25
- width = _d === void 0 ? "default" : _d;
26
- var _e = useState(null),
27
- popperElement = _e[0],
28
- setPopperElement = _e[1];
29
- var _f = usePopper(referenceElement, popperElement, {
30
- modifiers: [{
31
- name: "offset",
32
- options: {
33
- offset: [0, 6] // value used from the $spacing-xs scss variable,
34
- }
35
- }, {
36
- name: "preventOverflow",
37
- options: {
38
- // Gives some room so the menu shadow doesn't get clipped if near the edge of the viewport.
39
- padding: 8
40
- }
41
- }],
42
- placement: align === "left" ? "bottom-start" : "bottom-end"
43
- }),
44
- popperStyles = _f.styles,
45
- attributes = _f.attributes;
46
- // This callback handler will not run when autoHide === "off"
47
- var handleDocumentClickForAutoHide = useCallback(function (e) {
48
- if (popperElement && e.target instanceof Node && !popperElement.contains(e.target) && referenceElement !== e.target && !(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.contains(e.target))) {
49
- hideMenuDropdown();
50
- }
51
- }, [popperElement, referenceElement, hideMenuDropdown]);
52
- var handleDocumentResize = useCallback(function () {
53
- hideMenuDropdown();
54
- }, [hideMenuDropdown]);
55
- var handleRootClick = function () {
56
- if (autoHide === "on") {
57
- // ie. is not equal to "off" | "outside-click-only"
58
- hideMenuDropdown();
59
- }
60
- };
61
- useEffect(function () {
62
- window.addEventListener("resize", handleDocumentResize, false);
63
- return function () {
64
- window.removeEventListener("resize", handleDocumentResize, false);
65
- };
66
- }, [handleDocumentResize]);
67
- useEffect(function () {
68
- if (autoHide !== "off") {
69
- document.addEventListener("click", handleDocumentClickForAutoHide, true);
70
- }
71
- return function () {
72
- if (autoHide !== "off") {
73
- document.removeEventListener("click", handleDocumentClickForAutoHide, true);
74
- }
75
- };
76
- }, [autoHide, handleDocumentClickForAutoHide]);
77
- return /*#__PURE__*/React.createElement(FocusOn, {
78
- enabled: !!referenceElement,
79
- scrollLock: false,
80
- noIsolation: true,
81
- shards: referenceElement ? [referenceElement] : undefined,
82
- onEscapeKey: hideMenuDropdown,
83
- returnFocus: function () {
84
- referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.focus();
85
- return false;
86
- }
87
- }, /*#__PURE__*/React.createElement("div", __assign({
88
- id: id,
89
- ref: setPopperElement
90
- }, attributes.popper, {
91
- style: popperStyles.popper,
92
- className: classnames(styles$b.menuContainer, width == "default" && styles$b.defaultWidth),
93
- onClick: handleRootClick
94
- }), children));
95
- };
96
- MenuDropdown.displayName = "MenuDropdown";
97
- return MenuDropdown;
98
- }();
99
- var styles$a = {
100
- "buttonWrapper": "StatelessMenu-module_buttonWrapper__ov51l"
101
- };
102
- const StatelessMenu = /*#__PURE__*/function () {
103
- const StatelessMenu = function (_a) {
104
- var _b = _a.align,
105
- align = _b === void 0 ? "left" : _b,
106
- _c = _a.dropdownWidth,
107
- dropdownWidth = _c === void 0 ? "default" : _c,
108
- _d = _a.autoHide,
109
- autoHide = _d === void 0 ? "on" : _d,
110
- dataTestId = _a["data-testid"],
111
- dropdownId = _a.dropdownId,
112
- children = _a.children,
113
- portalSelector = _a.portalSelector,
114
- isMenuVisible = _a.isMenuVisible,
115
- toggleMenuDropdown = _a.toggleMenuDropdown,
116
- hideMenuDropdown = _a.hideMenuDropdown,
117
- renderButton = _a.renderButton,
118
- onClick = _a.onClick;
119
- var _e = useState(null),
120
- referenceElement = _e[0],
121
- setReferenceElement = _e[1];
122
- var portalSelectorElementRef = useRef(null);
123
- var menuButton = renderButton({
124
- onClick: function (e) {
125
- e.preventDefault();
126
- e.stopPropagation();
127
- toggleMenuDropdown();
128
- },
129
- onMouseDown: function (e) {
130
- return e.preventDefault();
131
- },
132
- "aria-haspopup": true,
133
- "aria-expanded": isMenuVisible
134
- });
135
- useEffect(function () {
136
- portalSelectorElementRef.current = portalSelector ? document.querySelector(portalSelector) : null;
137
- }, [portalSelector]);
138
- useEffect(function () {
139
- if (portalSelector && !portalSelectorElementRef.current) {
140
- // eslint-disable-next-line no-console
141
- console.warn("The portal could not be created using the selector: " + portalSelector);
142
- }
143
- }, [portalSelectorElementRef, portalSelector]);
144
- var menu = isMenuVisible ? ( /*#__PURE__*/React.createElement(MenuDropdown, {
145
- referenceElement: referenceElement,
146
- align: align,
147
- hideMenuDropdown: hideMenuDropdown,
148
- width: dropdownWidth,
149
- id: dropdownId,
150
- autoHide: autoHide
151
- }, children)) : null;
152
- return (
153
- /*#__PURE__*/
154
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
155
- React.createElement("div", {
156
- "data-testid": dataTestId,
157
- onClick: onClick
158
- }, /*#__PURE__*/React.createElement("div", {
159
- className: styles$a.buttonWrapper,
160
- ref: setReferenceElement
161
- }, menuButton), portalSelector && portalSelectorElementRef.current ? /*#__PURE__*/ReactDOM.createPortal(menu, portalSelectorElementRef.current) : menu)
162
- );
163
- };
164
- StatelessMenu.displayName = "StatelessMenu";
165
-
166
- /**
167
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082059782/Menu Guidance} |
168
- * {@link https://cultureamp.design/?path=/docs/components-menu--docs Storybook}
169
- */
170
- return StatelessMenu;
171
- }();
172
- const Menu = /*#__PURE__*/function () {
173
- const Menu = function (_a) {
174
- var button = _a.button,
175
- _b = _a.menuVisible,
176
- menuVisible = _b === void 0 ? false : _b,
177
- rest = __rest(_a, ["button", "menuVisible"]);
178
- var _c = useState(menuVisible),
179
- isMenuVisible = _c[0],
180
- setIsMenuVisible = _c[1];
181
- var toggleMenuDropdown = function () {
182
- setIsMenuVisible(!isMenuVisible);
183
- };
184
- var hideMenuDropdown = function () {
185
- setIsMenuVisible(false);
186
- };
187
- return /*#__PURE__*/React.createElement(StatelessMenu, __assign({}, rest, {
188
- isMenuVisible: isMenuVisible,
189
- toggleMenuDropdown: toggleMenuDropdown,
190
- hideMenuDropdown: hideMenuDropdown,
191
- // `StatelessMenu` is one of the newer components, so it uses a render function,
192
- // as opposed to `React.cloneElement`.
193
- // `cloneElement` has its problems, mainly because it's somewhat magical, can lead
194
- // to unexpected behaviour, and it doesn't self document. Hence, the switch
195
- // to the render function. It would be nice if the `Menu` component also
196
- // used this pattern, but it's probably not worth the time and effort.
197
- renderButton: function (props) {
198
- return /*#__PURE__*/React.cloneElement(button, __assign(__assign({}, props), {
199
- onClick: function (e) {
200
- var _a, _b;
201
- props.onClick(e);
202
- (_b = (_a = button.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
203
- },
204
- onMouseDown: function (e) {
205
- var _a, _b;
206
- props.onMouseDown(e);
207
- (_b = (_a = button.props).onMouseDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
208
- }
209
- }));
210
- }
211
- }));
212
- };
213
- Menu.displayName = "Menu";
214
- return Menu;
215
- }();
216
- var styles$9 = {
217
- "menuSection": "MenuList-module_menuSection__FBeC8"
218
- };
219
- const MenuList = /*#__PURE__*/function () {
220
- const MenuList = function (props) {
221
- var _a;
222
- var heading = props.heading,
223
- children = props.children,
224
- restProps = __rest(props, ["heading", "children"]);
225
- var reactId = useId();
226
- var listHeadingID = (_a = heading === null || heading === void 0 ? void 0 : heading.props.id) !== null && _a !== void 0 ? _a : reactId;
227
- return /*#__PURE__*/React.createElement(React.Fragment, null, heading && /*#__PURE__*/cloneElement(heading, {
228
- id: listHeadingID
229
- }), /*#__PURE__*/React.createElement("ul", __assign({
230
- className: styles$9.menuSection,
231
- "aria-labelledby": heading ? listHeadingID : undefined
232
- }, restProps), children));
233
- };
234
- MenuList.displayName = "MenuList";
235
- return MenuList;
236
- }();
237
- var styles$8 = {
238
- "menuListItem": "MenuItem-module_menuListItem__zWJSG",
239
- "menuItem": "MenuItem-module_menuItem__3gZEN",
240
- "menuItem--disabled": "MenuItem-module_menuItem--disabled__V3N8q",
241
- "menuItem__Icon": "MenuItem-module_menuItem__Icon__ckzae",
242
- "menuItem--destructive": "MenuItem-module_menuItem--destructive__z-9Ds",
243
- "menuItem--active": "MenuItem-module_menuItem--active__tIKBp",
244
- "menuItem__Label": "MenuItem-module_menuItem__Label__r9ZbQ"
245
- };
246
- const MenuItem = /*#__PURE__*/function () {
247
- const MenuItem = function (_a) {
248
- var label = _a.label,
249
- icon = _a.icon,
250
- destructive = _a.destructive,
251
- disabled = _a.disabled,
252
- onClick = _a.onClick,
253
- href = _a.href,
254
- target = _a.target,
255
- isActive = _a.isActive,
256
- dataTestId = _a["data-testid"],
257
- id = _a.id;
258
- var wrappedLabel = /*#__PURE__*/React.createElement("span", {
259
- className: styles$8.menuItem__Label
260
- }, label);
261
- var iconNode = icon && /*#__PURE__*/React.createElement("span", {
262
- className: styles$8.menuItem__Icon
263
- }, icon);
264
- var className = classnames(styles$8.menuItem, destructive && styles$8["menuItem--destructive"], disabled && styles$8["menuItem--disabled"], isActive && styles$8["menuItem--active"]);
265
- if (disabled) {
266
- return /*#__PURE__*/React.createElement("li", {
267
- className: styles$8.menuListItem
268
- }, /*#__PURE__*/React.createElement("button", {
269
- id: id,
270
- type: "button",
271
- disabled: true,
272
- className: className,
273
- "data-testid": dataTestId
274
- }, iconNode, wrappedLabel));
275
- }
276
- if (href) {
277
- return /*#__PURE__*/React.createElement("li", {
278
- className: styles$8.menuListItem
279
- }, /*#__PURE__*/React.createElement("a", {
280
- id: id,
281
- href: href,
282
- onClick: onClick,
283
- className: className,
284
- target: target,
285
- "aria-current": isActive ? "page" : undefined,
286
- "data-testid": dataTestId
287
- }, iconNode, wrappedLabel));
288
- }
289
- return /*#__PURE__*/React.createElement("li", {
290
- className: styles$8.menuListItem
291
- }, /*#__PURE__*/React.createElement("button", {
292
- id: id,
293
- type: "button",
294
- onClick: onClick,
295
- className: className,
296
- "data-testid": dataTestId
297
- }, iconNode, wrappedLabel));
298
- };
299
- MenuItem.displayName = "MenuItem";
300
- return MenuItem;
301
- }();
302
- var styles$7 = {
303
- "heading": "MenuHeading-module_heading__WISMF"
304
- };
305
- const MenuHeading = /*#__PURE__*/function () {
306
- const MenuHeading = function (_a) {
307
- var id = _a.id,
308
- classNameOverride = _a.classNameOverride,
309
- restProps = __rest(_a, ["id", "classNameOverride"]);
310
- return /*#__PURE__*/React.createElement(Heading, __assign({
311
- id: id,
312
- variant: "heading-6",
313
- tag: "span",
314
- classNameOverride: classnames(styles$7.heading, classNameOverride)
315
- }, restProps));
316
- };
317
- MenuHeading.displayName = "MenuHeading";
318
- return MenuHeading;
319
- }();
320
- var styles$6 = {
321
- "loadingGraphic": "LoadingGraphic-module_loadingGraphic__lg-gH",
322
- "isAnimated": "LoadingGraphic-module_isAnimated__tyskp",
323
- "fade-in-out": "LoadingGraphic-module_fade-in-out__VFBMB",
324
- "isReversed": "LoadingGraphic-module_isReversed__HmZ4H"
325
- };
326
- var loadingGraphicSizeMap = new Map([["small", 1.25], ["medium", 3], ["large", 4.5], ["xlarge", 6], ["xxlarge", 7.5], ["scene", 18.75]]);
327
- /**
328
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060062/Loading+Skeleton Guidance} |
329
- * {@link https://cultureamp.design/?path=/docs/components-loading-states-loadinggraphic--docs Storybook}
330
- */
331
- const LoadingGraphic = /*#__PURE__*/function () {
332
- const LoadingGraphic = function (_a) {
333
- var isAnimated = _a.isAnimated,
334
- isReversed = _a.isReversed,
335
- size = _a.size,
336
- classNameOverride = _a.classNameOverride,
337
- props = __rest(_a, ["isAnimated", "isReversed", "size", "classNameOverride"]);
338
- var sizeValue = "".concat(loadingGraphicSizeMap.get(size), "rem");
339
- return /*#__PURE__*/React.createElement("div", __assign({
340
- className: classnames(styles$6.loadingGraphic, isAnimated && styles$6.isAnimated, isReversed && styles$6.isReversed, classNameOverride),
341
- style: {
342
- width: sizeValue,
343
- height: sizeValue
344
- }
345
- }, props));
346
- };
347
- LoadingGraphic.displayName = "LoadingGraphic";
348
- return LoadingGraphic;
349
- }();
350
- var styles$5 = {
351
- "loadingHeading": "LoadingHeading-module_loadingHeading__tb9a-",
352
- "isAnimated": "LoadingHeading-module_isAnimated__cbstI",
353
- "fade-in-out": "LoadingHeading-module_fade-in-out__4e-Ds",
354
- "display-0": "LoadingHeading-module_display-0__SXmNU",
355
- "heading-1": "LoadingHeading-module_heading-1__09eOy",
356
- "heading-2": "LoadingHeading-module_heading-2__bxtDS",
357
- "heading-3": "LoadingHeading-module_heading-3__h8MXB",
358
- "heading-4": "LoadingHeading-module_heading-4__VsC1Y",
359
- "heading-5": "LoadingHeading-module_heading-5__5arKU",
360
- "heading-6": "LoadingHeading-module_heading-6__sLipd",
361
- "isReversed": "LoadingHeading-module_isReversed__vz6G1",
362
- "link": "LoadingHeading-module_link__E7uU1"
363
- };
364
-
365
- /**
366
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060062/Loading+Skeleton Guidance} |
367
- * {@link https://cultureamp.design/?path=/docs/components-loading-states-loadingheading--docs Storybook}
368
- */
369
- const LoadingHeading = /*#__PURE__*/function () {
370
- const LoadingHeading = function (_a) {
371
- var isAnimated = _a.isAnimated,
372
- isReversed = _a.isReversed,
373
- width = _a.width,
374
- isLink = _a.isLink,
375
- classNameOverride = _a.classNameOverride,
376
- variant = _a.variant,
377
- props = __rest(_a, ["isAnimated", "isReversed", "width", "isLink", "classNameOverride", "variant"]);
378
- return /*#__PURE__*/React.createElement("div", __assign({
379
- className: classnames(styles$5.loadingHeading, classNameOverride, styles$5[variant], isAnimated && styles$5.isAnimated, isReversed && styles$5.isReversed, isLink && styles$5.link),
380
- style: {
381
- width: "".concat(width, "%")
382
- }
383
- }, props));
384
- };
385
- LoadingHeading.displayName = "LoadingHeading";
386
- return LoadingHeading;
387
- }();
388
- var styles$4 = {
389
- "loadingInput": "LoadingInput-module_loadingInput__65Cpe",
390
- "isAnimated": "LoadingInput-module_isAnimated__hJtl-",
391
- "fade-in-out": "LoadingInput-module_fade-in-out__XW4tT",
392
- "isReversed": "LoadingInput-module_isReversed__wyVkD"
393
- };
394
-
395
- /**
396
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060062/Loading+Skeleton Guidance} |
397
- * {@link https://cultureamp.design/?path=/docs/components-loading-states-loadinginput--docs Storybook}
398
- */
399
- const LoadingInput = /*#__PURE__*/function () {
400
- const LoadingInput = function (_a) {
401
- var isAnimated = _a.isAnimated,
402
- isReversed = _a.isReversed,
403
- width = _a.width,
404
- classNameOverride = _a.classNameOverride,
405
- _b = _a.height,
406
- height = _b === void 0 ? 48 : _b,
407
- props = __rest(_a, ["isAnimated", "isReversed", "width", "classNameOverride", "height"]);
408
- return /*#__PURE__*/React.createElement("div", __assign({
409
- className: classnames(styles$4.loadingInput, isAnimated && styles$4.isAnimated, isReversed && styles$4.isReversed, classNameOverride),
410
- style: {
411
- width: "".concat(width, "%"),
412
- height: "".concat(height, "px")
413
- }
414
- }, props));
415
- };
416
- LoadingInput.displayName = "LoadingInput";
417
- return LoadingInput;
418
- }();
419
- var styles$3 = {
420
- "loadingParagraph": "LoadingParagraph-module_loadingParagraph__-riGM",
421
- "isAnimated": "LoadingParagraph-module_isAnimated__FWmuv",
422
- "fade-in-out": "LoadingParagraph-module_fade-in-out__wzszr",
423
- "isReversed": "LoadingParagraph-module_isReversed__hD0mn",
424
- "isLink": "LoadingParagraph-module_isLink__gVurw",
425
- "isCentered": "LoadingParagraph-module_isCentered__Pkyts",
426
- "isInline": "LoadingParagraph-module_isInline__-mSTd",
427
- "noBottomMargin": "LoadingParagraph-module_noBottomMargin__9Qt0n",
428
- "inheritBaseline": "LoadingParagraph-module_inheritBaseline__RU-tb"
429
- };
430
-
431
- /**
432
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060062/Loading+Skeleton Guidance} |
433
- * {@link https://cultureamp.design/?path=/docs/components-loading-states-loadingparagraph--docs Storybook}
434
- */
435
- const LoadingParagraph = /*#__PURE__*/function () {
436
- const LoadingParagraph = function (_a) {
437
- var isAnimated = _a.isAnimated,
438
- isCentred = _a.isCentred,
439
- isReversed = _a.isReversed,
440
- isInline = _a.isInline,
441
- noBottomMargin = _a.noBottomMargin,
442
- width = _a.width,
443
- isLink = _a.isLink,
444
- inheritBaseline = _a.inheritBaseline,
445
- classNameOverride = _a.classNameOverride,
446
- restProps = __rest(_a, ["isAnimated", "isCentred", "isReversed", "isInline", "noBottomMargin", "width", "isLink", "inheritBaseline", "classNameOverride"]);
447
- return /*#__PURE__*/React.createElement("div", __assign({
448
- className: classnames(styles$3.loadingParagraph, classNameOverride, isAnimated && styles$3.isAnimated, isCentred && styles$3.isCentered, isReversed && styles$3.isReversed, isLink && styles$3.isLink, inheritBaseline && styles$3.inheritBaseline, isInline && styles$3.isInline, noBottomMargin && styles$3.noBottomMargin),
449
- style: {
450
- width: "".concat(width, "%")
451
- }
452
- }, restProps));
453
- };
454
- LoadingParagraph.displayName = "LoadingParagraph";
455
- return LoadingParagraph;
456
- }();
457
- var styles$2 = {
458
- "srOnly": "VisuallyHidden-module_srOnly__tTjOK"
459
- };
460
- const VisuallyHidden = /*#__PURE__*/function () {
461
- const VisuallyHidden = function (_a) {
462
- var children = _a.children,
463
- classNameOverride = _a.classNameOverride,
464
- restProps = __rest(_a, ["children", "classNameOverride"]);
465
- return /*#__PURE__*/React.createElement("span", __assign({
466
- className: classnames(styles$2.srOnly, classNameOverride)
467
- }, restProps), children);
468
- };
469
- VisuallyHidden.displayName = "VisuallyHidden";
470
- return VisuallyHidden;
471
- }();
472
- var styles$1 = {
473
- "loadingSpinner": "LoadingSpinner-module_loadingSpinner__Zc2mJ",
474
- "xs": "LoadingSpinner-module_xs__y46OT",
475
- "sm": "LoadingSpinner-module_sm__nkmIa",
476
- "md": "LoadingSpinner-module_md__OWP2-",
477
- "spinner": "LoadingSpinner-module_spinner__BKrX0"
478
- };
479
- var SmallSpinnerIcon = function () {
480
- return /*#__PURE__*/React.createElement("svg", {
481
- className: styles$1.spinner,
482
- "aria-hidden": "true",
483
- viewBox: "0 0 24 24",
484
- fill: "none",
485
- xmlns: "http://www.w3.org/2000/svg"
486
- }, /*#__PURE__*/React.createElement("circle", {
487
- cx: "12",
488
- cy: "12",
489
- r: "9",
490
- stroke: "currentColor",
491
- strokeWidth: "2",
492
- strokeOpacity: "0.3"
493
- }), /*#__PURE__*/React.createElement("path", {
494
- fillRule: "evenodd",
495
- clipRule: "evenodd",
496
- fill: "currentColor",
497
- d: "M21.0564 13c.5076 0 .9377-.3851.9431-.8926.0004-.0358.0005-.0716.0005-.1074 0-5.52285-4.4771-10-10-10-.0359 0-.0718.00019-.1076.00057-.5076.00535-.8926.43552-.8926.94308v.11543C10.9998 3.59163 11.4675 4 12 4c4.4183 0 8 3.58172 8 8 0 .5324.4083 1 .9407 1h.1157z"
498
- }));
499
- };
500
- var MediumSpinnerIcon = function () {
501
- return /*#__PURE__*/React.createElement("svg", {
502
- className: styles$1.spinner,
503
- "aria-hidden": "true",
504
- viewBox: "0 0 48 48",
505
- fill: "none",
506
- xmlns: "http://www.w3.org/2000/svg"
507
- }, /*#__PURE__*/React.createElement("circle", {
508
- cx: "24",
509
- cy: "24",
510
- r: "22.5",
511
- stroke: "currentColor",
512
- strokeWidth: "3",
513
- strokeOpacity: "0.3"
514
- }), /*#__PURE__*/React.createElement("path", {
515
- fillRule: "evenodd",
516
- clipRule: "evenodd",
517
- fill: "currentColor",
518
- d: "M46.5 24c.8284 0 1.5049-.6734 1.4539-1.5002C47.21 10.44 37.5601.789989 25.5003.0461639 24.6734-.004835 24 .671607 24 1.50003c0 .82843.6738 1.49444 1.5002 1.55277 10.4023.73424 18.7128 9.0447 19.447 19.447C45.0056 23.3262 45.6716 24 46.5 24z"
519
- }));
520
- };
521
- var ExtraSmallSpinnerIcon = function () {
522
- return /*#__PURE__*/React.createElement("svg", {
523
- className: styles$1.spinner,
524
- viewBox: "0 0 16 16",
525
- fill: "none",
526
- xmlns: "http://www.w3.org/2000/svg"
527
- }, /*#__PURE__*/React.createElement("circle", {
528
- opacity: "0.3",
529
- cx: "8",
530
- cy: "8",
531
- r: "6",
532
- stroke: "currentColor",
533
- strokeWidth: "2"
534
- }), /*#__PURE__*/React.createElement("path", {
535
- d: "M14 8C14 4.68629 11.3137 2 8 2",
536
- stroke: "currentColor",
537
- strokeWidth: "2",
538
- strokeLinecap: "round",
539
- strokeLinejoin: "round"
540
- }));
541
- };
542
- var SpinnerIcon = function (_a) {
543
- var size = _a.size;
544
- if (size === "xs") return /*#__PURE__*/React.createElement(ExtraSmallSpinnerIcon, null);
545
- if (size === "sm") return /*#__PURE__*/React.createElement(SmallSpinnerIcon, null);
546
- return /*#__PURE__*/React.createElement(MediumSpinnerIcon, null);
547
- };
548
-
549
- /**
550
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093253/Loading+Spinner Guidance} |
551
- * {@link https://cultureamp.design/?path=/docs/components-loading-loadingspinner--docs Storybook}
552
- */
553
- const LoadingSpinner = /*#__PURE__*/function () {
554
- const LoadingSpinner = function (_a) {
555
- var _b = _a.accessibilityLabel,
556
- accessibilityLabel = _b === void 0 ? "Loading" : _b,
557
- _c = _a.size,
558
- size = _c === void 0 ? "md" : _c,
559
- classNameOverride = _a.classNameOverride,
560
- props = __rest(_a, ["accessibilityLabel", "size", "classNameOverride"]);
561
- return /*#__PURE__*/React.createElement("div", __assign({
562
- className: classnames(styles$1.loadingSpinner, styles$1[size], classNameOverride),
563
- role: "status"
564
- }, props), /*#__PURE__*/React.createElement(VisuallyHidden, null, accessibilityLabel), /*#__PURE__*/React.createElement(SpinnerIcon, {
565
- size: size
566
- }));
567
- };
568
- LoadingSpinner.displayName = "LoadingSpinner";
569
- return LoadingSpinner;
570
- }();
571
- var styles = {
572
- "button": "GenericButton-module_button__vTuHz",
573
- "disabled": "GenericButton-module_disabled__NQENR",
574
- "working": "GenericButton-module_working__Ia8R2",
575
- "reversed": "GenericButton-module_reversed__m6Nia",
576
- "content": "GenericButton-module_content__McBme",
577
- "default": "GenericButton-module_default__08ztk",
578
- "primary": "GenericButton-module_primary__8wfKy",
579
- "destructive": "GenericButton-module_destructive__O-1WX",
580
- "secondary": "GenericButton-module_secondary__e3lqK",
581
- "small": "GenericButton-module_small__vlMuA",
582
- "iconButton": "GenericButton-module_iconButton__jQQ4E",
583
- "circleButton": "GenericButton-module_circleButton__Ovqs1",
584
- "paginationLink": "GenericButton-module_paginationLink__t54TU",
585
- "isPaginationLinkActive": "GenericButton-module_isPaginationLinkActive__FbfXr",
586
- "directionalLink": "GenericButton-module_directionalLink__jgRQf",
587
- "container": "GenericButton-module_container__sMeVe",
588
- "label": "GenericButton-module_label__Z08Ax",
589
- "fullWidth": "GenericButton-module_fullWidth__2MPO6",
590
- "iconWrapper": "GenericButton-module_iconWrapper__eFGAT",
591
- "additionalContentWrapper": "GenericButton-module_additionalContentWrapper__RwK-G",
592
- "loadingSpinner": "GenericButton-module_loadingSpinner__lbL3G",
593
- "centeredLoadingSpinner": "GenericButton-module_centeredLoadingSpinner__OPppp",
594
- "hidden": "GenericButton-module_hidden__MacT-"
595
- };
596
-
597
- // We're treating custom props as anything that is kebab cased.
598
- // This is so we can support properties like aria-* or data-*
599
- var getCustomProps = function (props) {
600
- var keys = Object.keys(props).filter(function (k) {
601
- return k.indexOf("-") !== -1;
602
- });
603
- return keys.reduce(function (acc, val) {
604
- acc[val] = props[val];
605
- return acc;
606
- }, {});
607
- };
608
- const GenericButton = /*#__PURE__*/function () {
609
- const GenericButton = /*#__PURE__*/forwardRef(function (_a, ref) {
610
- var _b = _a.iconPosition,
611
- iconPosition = _b === void 0 ? "start" : _b,
612
- _c = _a.iconButton,
613
- iconButton = _c === void 0 ? false : _c,
614
- _d = _a.primary,
615
- primary = _d === void 0 ? false : _d,
616
- _e = _a.secondary,
617
- secondary = _e === void 0 ? false : _e,
618
- _f = _a.newTabAndIUnderstandTheAccessibilityImplications,
619
- newTabAndIUnderstandTheAccessibilityImplications = _f === void 0 ? false : _f,
620
- _g = _a.disableTabFocusAndIUnderstandTheAccessibilityImplications,
621
- disableTabFocusAndIUnderstandTheAccessibilityImplications = _g === void 0 ? false : _g,
622
- _h = _a.type,
623
- type = _h === void 0 ? "button" : _h,
624
- otherProps = __rest(_a, ["iconPosition", "iconButton", "primary", "secondary", "newTabAndIUnderstandTheAccessibilityImplications", "disableTabFocusAndIUnderstandTheAccessibilityImplications", "type"]);
625
- var buttonRef = useRef();
626
- var wrapperRef = useRef(null);
627
- useImperativeHandle(ref, function () {
628
- return {
629
- focus: function () {
630
- var _a;
631
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
632
- }
633
- };
634
- });
635
- var props = __assign({
636
- iconPosition: iconPosition,
637
- iconButton: iconButton,
638
- primary: primary,
639
- secondary: secondary,
640
- newTabAndIUnderstandTheAccessibilityImplications: newTabAndIUnderstandTheAccessibilityImplications,
641
- disableTabFocusAndIUnderstandTheAccessibilityImplications: disableTabFocusAndIUnderstandTheAccessibilityImplications,
642
- type: type
643
- }, otherProps);
644
- if (props.component) {
645
- return renderCustomComponent(props.component, props, wrapperRef);
646
- }
647
- return /*#__PURE__*/React.createElement("span", {
648
- ref: wrapperRef,
649
- className: classnames(styles.container, props.fullWidth && styles.fullWidth),
650
- "aria-live": "workingLabel" in props ? "polite" : undefined
651
- }, props.href && !props.disabled && !props.working ? renderLink(props, buttonRef) : renderButton(props, buttonRef));
652
- });
653
- GenericButton.displayName = "GenericButton";
654
- return GenericButton;
655
- }();
656
- var renderCustomComponent = function (CustomComponent, props, ref) {
657
- var passedInProps = __assign({
658
- id: props.id,
659
- className: buttonClass(props),
660
- disabled: props.disabled,
661
- href: props.href,
662
- onClick: props.onClick,
663
- onFocus: props.onFocus,
664
- onBlur: props.onBlur,
665
- "aria-label": generateAriaLabel(props)
666
- }, getCustomProps(props));
667
- var _a = useContextProps(passedInProps, ref,
668
- // @ts-expect-error we're using span ref on link context, but that's ok because we need only sizing
669
- LinkContext),
670
- contextProps = _a[0],
671
- contextRef = _a[1];
672
- // @ts-expect-error
673
- // @todo: Make a wrapper and take it out of Button
674
- var linkProps = useLink(contextProps, contextRef).linkProps;
675
- // Unset this because the one defined in buttonProps shows
676
- // focus-visible styles on click, in future we'll style using [data-focus-visible] which is consistent across browsers
677
- delete linkProps.onPointerDown;
678
- return /*#__PURE__*/React.createElement("span", {
679
- ref: contextRef,
680
- className: classnames(styles.container, props.fullWidth && styles.fullWidth),
681
- "aria-live": "workingLabel" in props ? "polite" : undefined
682
- }, /*#__PURE__*/React.createElement(CustomComponent, __assign({}, contextProps, linkProps, {
683
- "aria-describedby": props["aria-describedby"] === null ? undefined : linkProps["aria-describedby"]
684
- }), renderContent(props)));
685
- };
686
- var renderButton = function (props, ref) {
687
- var disableActions = props.disabled || props.working;
688
- var passedInProps = __assign({
689
- id: props.id,
690
- disabled: props.disabled,
691
- onClick: !disableActions ? props.onClick : undefined,
692
- onMouseDown: !disableActions ? props.onMouseDown : undefined,
693
- type: props.type,
694
- onFocus: props.onFocus,
695
- onBlur: props.onBlur,
696
- form: props.form,
697
- formAction: props.formAction,
698
- formMethod: props.formMethod,
699
- formEncType: props.formEncType,
700
- formTarget: props.formTarget,
701
- formNoValidate: props.formNoValidate,
702
- className: buttonClass(props),
703
- "aria-label": generateAriaLabel(props),
704
- "aria-disabled": props.disabled || props.working ? true : undefined,
705
- tabIndex: props.disableTabFocusAndIUnderstandTheAccessibilityImplications ? -1 : undefined
706
- }, getCustomProps(props));
707
- // we're using useFocusable instead of useButton because at this stage we want to hook only to focusable.
708
- // Not standardize button behavior as we're currently relying on some weird native behaviours (like onClick firing on enter key press) see https://react-spectrum.adobe.com/blog/building-a-button-part-1.html
709
- // @ts-ignore
710
- var focusableProps = useFocusable(passedInProps, ref).focusableProps;
711
- return (
712
- /*#__PURE__*/
713
- // eslint-disable-next-line react/button-has-type
714
- React.createElement("button", __assign({}, passedInProps, focusableProps, {
715
- "aria-describedby": props["aria-describedby"] === null ? undefined : props["aria-describedby"] || focusableProps["aria-describedby"],
716
- // Unset this because the one defined in buttonProps shows
717
- // focus-visible styles on click
718
- onPointerDown: undefined,
719
- ref: ref
720
- }), renderContent(props))
721
- );
722
- };
723
- var renderLink = function (props, ref) {
724
- var target = props.newTabAndIUnderstandTheAccessibilityImplications ? "_blank" : "_self";
725
- var passedInProps = __assign({
726
- id: props.id,
727
- href: props.href,
728
- target: target,
729
- rel: target === "_blank" ? "noopener noreferrer" : undefined,
730
- className: buttonClass(props),
731
- onClick: props.onClick,
732
- onFocus: props.onFocus,
733
- onBlur: props.onBlur,
734
- "aria-label": generateAriaLabel(props)
735
- }, getCustomProps(props));
736
- // we're using useFocusable instead of useLink because at this stage we want to hook only to focusable.
737
- // Not standardize button behavior as we're currently relying on some weird native behaviours (like onClick firing on enter key press) see https://react-spectrum.adobe.com/blog/building-a-button-part-1.html
738
- // @ts-ignore
739
- var focusableProps = useFocusable(passedInProps, ref).focusableProps;
740
- return /*#__PURE__*/React.createElement("a", __assign({}, passedInProps, focusableProps, {
741
- "aria-describedby": props["aria-describedby"] === null ? undefined : props["aria-describedby"] || focusableProps["aria-describedby"],
742
- // Unset this because the one defined in linkProps shows
743
- // focus-visible styles on click
744
- onPointerDown: undefined,
745
- ref: ref
746
- }), renderContent(props));
747
- };
748
- var buttonClass = function (props) {
749
- var isDefault = !props.primary && !props.destructive && !props.secondary;
750
- return classnames(styles.button, isDefault && styles.default,
751
- // @ts-ignore
752
- (props.disabled || props["aria-disabled"]) && styles.disabled, props.primary && styles.primary, props.destructive && styles.destructive, props.secondary && styles.secondary, props.size && styles[props.size], props.reversed && styles.reversed, props.iconButton && styles.iconButton, props.working && styles.working, (props.directionalLink || props.paginationLink) && styles.circleButton, props.directionalLink && styles.directionalLink, props.paginationLink && styles.paginationLink, props.isActive && styles.isPaginationLinkActive, props.classNameOverride);
753
- };
754
- var renderLoadingSpinner = function () {
755
- return /*#__PURE__*/React.createElement("div", {
756
- className: styles.loadingSpinner
757
- }, /*#__PURE__*/React.createElement(LoadingSpinner, {
758
- accessibilityLabel: "",
759
- size: "sm"
760
- }));
761
- };
762
- var renderWorkingContent = function (props) {
763
- if (props.workingLabelHidden) {
764
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
765
- className: styles.hidden,
766
- "aria-hidden": "true"
767
- }, renderDefaultContent(props)), /*#__PURE__*/React.createElement("span", {
768
- className: styles.centeredLoadingSpinner
769
- }, renderLoadingSpinner()));
770
- }
771
- return /*#__PURE__*/React.createElement(React.Fragment, null, props.iconPosition !== "end" && renderLoadingSpinner(), /*#__PURE__*/React.createElement("span", {
772
- className: styles.label
773
- }, props.workingLabel), props.additionalContent && ( /*#__PURE__*/React.createElement("span", {
774
- className: styles.additionalContentWrapper
775
- }, props.additionalContent)), props.iconPosition === "end" && renderLoadingSpinner());
776
- };
777
- var renderDefaultContent = function (props) {
778
- return /*#__PURE__*/React.createElement(React.Fragment, null, props.icon && props.iconPosition !== "end" && renderIcon(props.icon), (!props.icon || !props.iconButton) && ( /*#__PURE__*/React.createElement("span", {
779
- className: styles.label
780
- }, props.label)), props.additionalContent && ( /*#__PURE__*/React.createElement("span", {
781
- className: styles.additionalContentWrapper
782
- }, props.additionalContent)), renderBadge(props), props.icon && props.iconPosition === "end" && renderIcon(props.icon));
783
- };
784
- var renderBadge = function (props) {
785
- if (!props.badge) return null;
786
- var _a = props.badge,
787
- text = _a.text,
788
- animateChange = _a.animateChange,
789
- reversed = _a.reversed,
790
- variant = _a.variant;
791
- if (animateChange) {
792
- return /*#__PURE__*/React.createElement(BadgeAnimated, {
793
- variant: variant,
794
- reversed: reversed
795
- }, text);
796
- }
797
- return /*#__PURE__*/React.createElement(Badge, {
798
- variant: variant,
799
- reversed: reversed
800
- }, text);
801
- };
802
- var renderContent = function (props) {
803
- return /*#__PURE__*/React.createElement("span", {
804
- className: styles.content
805
- }, props.working ? renderWorkingContent(props) : renderDefaultContent(props));
806
- };
807
- var renderIcon = function (icon) {
808
- return /*#__PURE__*/React.createElement("span", {
809
- className: styles.iconWrapper
810
- }, icon);
811
- };
812
- // We only want an aria-label in the case that the button has just an icon and no text
813
- // This can happen when the button is working and workingLabelHidden is true,
814
- // or when this is an IconButton
815
- var generateAriaLabel = function (props) {
816
- if (props.working && props.workingLabelHidden) {
817
- return props.workingLabel;
818
- }
819
- if (props.iconButton) {
820
- return props.label;
821
- }
822
- return undefined;
823
- };
824
-
825
- /**
826
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3062890984/Button Guidance} |
827
- * {@link https://cultureamp.design/?path=/docs/components-buttons-button--docs Storybook}
828
- */
829
- const Button = /*#__PURE__*/function () {
830
- const Button = /*#__PURE__*/forwardRef(function (props, ref) {
831
- return /*#__PURE__*/React.createElement(GenericButton, __assign({
832
- iconPosition: "start",
833
- ref: ref
834
- }, props));
835
- });
836
- Button.displayName = "Button";
837
-
838
- /**
839
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3062890984/Button Guidance} |
840
- * {@link https://cultureamp.design/?path=/docs/components-iconbutton--docs Storybook}
841
- */
842
- return Button;
843
- }();
844
- const IconButton = /*#__PURE__*/function () {
845
- const IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
846
- return /*#__PURE__*/React.createElement(GenericButton, __assign({
847
- iconButton: true
848
- }, props, {
849
- ref: ref
850
- }));
851
- });
852
- IconButton.displayName = "IconButton";
853
- return IconButton;
854
- }();
855
- export { Button as B, GenericButton as G, IconButton as I, LoadingSpinner as L, Menu as M, StatelessMenu as S, VisuallyHidden as V, MenuList as a, MenuDropdown as b, MenuItem as c, MenuHeading as d, LoadingInput as e, LoadingParagraph as f, LoadingGraphic as g, LoadingHeading as h };