orcs-design-system 3.3.76 → 3.3.77

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 (73) hide show
  1. package/README.md +4 -0
  2. package/es/assets/Colour/index.js +1 -1
  3. package/es/components/ActionsMenu/index.js +73 -77
  4. package/es/components/ActionsMenu/useActionMenu.js +8 -6
  5. package/es/components/Avatar/CroppedImage.js +5 -4
  6. package/es/components/Avatar/index.js +73 -71
  7. package/es/components/Badge/index.js +24 -20
  8. package/es/components/Box/index.js +14 -9
  9. package/es/components/Breadcrumbs/index.js +12 -8
  10. package/es/components/Button/index.js +33 -33
  11. package/es/components/ButtonGroup/index.js +16 -11
  12. package/es/components/Card/index.js +24 -20
  13. package/es/components/Checkbox/index.js +32 -28
  14. package/es/components/CodeBlock/CodeBlock.stories.js +86 -103
  15. package/es/components/CodeBlock/index.js +251 -45
  16. package/es/components/ColorPicker/index.js +52 -49
  17. package/es/components/DatePicker/index.js +31 -28
  18. package/es/components/Divider/index.js +17 -13
  19. package/es/components/Expandable/index.js +17 -13
  20. package/es/components/Flex/index.js +19 -18
  21. package/es/components/FloatingPanels/FloatingPanels.stories.js +1 -1
  22. package/es/components/FloatingPanels/FloatingPanels.styles.js +2 -6
  23. package/es/components/FloatingPanels/index.js +9 -8
  24. package/es/components/Grid/index.js +11 -7
  25. package/es/components/Header/Header.styles.js +2 -2
  26. package/es/components/HeaderSimple/HeaderSimple.stories.js +2 -2
  27. package/es/components/Icon/index.js +30 -25
  28. package/es/components/Loading/index.js +16 -12
  29. package/es/components/Modal/Modal.stories.js +4 -226
  30. package/es/components/Modal/index.js +28 -23
  31. package/es/components/Notification/index.js +30 -26
  32. package/es/components/Popover/index.js +48 -50
  33. package/es/components/ProgressBar/index.js +18 -13
  34. package/es/components/RadioButton/index.js +24 -20
  35. package/es/components/Range/index.js +18 -29
  36. package/es/components/Select/index.js +43 -55
  37. package/es/components/SideNavV2/NavItem.js +18 -16
  38. package/es/components/SideNavV2/PanelLink.stories.js +4 -3
  39. package/es/components/SideNavV2/SideNav.js +1 -1
  40. package/es/components/SideNavV2/SideNavV2.stories.js +13 -13
  41. package/es/components/SideNavV2/__tests__/interaction-scenarios.test.js +9 -8
  42. package/es/components/SideNavV2/__tests__/sections.test.js +64 -63
  43. package/es/components/SideNavV2/components/BaseSection.js +5 -3
  44. package/es/components/SideNavV2/components/CurrentViewSectionPortalTarget.js +2 -2
  45. package/es/components/SideNavV2/components/RenderCurrentViewSection.js +5 -3
  46. package/es/components/SideNavV2/hooks/useResize.js +5 -4
  47. package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +11 -15
  48. package/es/components/SideNavV2/sections/SideNavPinnedSection.js +1 -1
  49. package/es/components/SideNavV2/styles/SideNavV2.styles.js +27 -25
  50. package/es/components/SideNavV2/utils/itemUtils.js +4 -2
  51. package/es/components/SideNavV2/utils/resizeUtils.js +3 -3
  52. package/es/components/Spacer/index.js +12 -11
  53. package/es/components/StatusDot/index.js +11 -7
  54. package/es/components/StyledLink/index.js +14 -11
  55. package/es/components/Table/Table.stories.js +2 -2
  56. package/es/components/Table/getExpandColumnConfig.js +16 -19
  57. package/es/components/Table/index.js +18 -17
  58. package/es/components/Table/muiStyleOverrides.js +3 -2
  59. package/es/components/Tabs/Tabs.stories.js +1 -1
  60. package/es/components/Tabs/index.js +33 -31
  61. package/es/components/TabsAlt/TabsAlt.stories.js +1 -1
  62. package/es/components/TabsAlt/index.js +25 -22
  63. package/es/components/Tag/Tag.stories.js +1 -1
  64. package/es/components/Tag/index.js +32 -27
  65. package/es/components/TextArea/index.js +16 -13
  66. package/es/components/TextInput/index.js +30 -24
  67. package/es/components/Toggle/index.js +20 -16
  68. package/es/components/TreeNav/index.js +12 -7
  69. package/es/components.test.js +1 -74
  70. package/es/systemThemeCollapsed.js +9 -9
  71. package/es/systemtheme.js +9 -9
  72. package/es/utils/floatingUiHelpers.js +6 -3
  73. package/package.json +24 -15
package/README.md CHANGED
@@ -125,6 +125,10 @@ import { ThemeProvider } from "styled-components"
125
125
 
126
126
  Variables can be referenced using `theme.arrayName.variableAlias`. When using Styled System props, components refer to the theme field associated with the prop as set out in the [reference table](https://styled-system.com/table).
127
127
 
128
+ ### Styled Components v6
129
+
130
+ This design system uses **styled-components v6**. When creating or updating styled components, **always use the `&` prefix for pseudo-selectors** (e.g., `&:checked`, `&:focus`, `&:hover`) to ensure proper CSS specificity. See component documentation (e.g., Checkbox, Toggle) for examples.
131
+
128
132
  ### Using icons
129
133
 
130
134
  You will need to add the icon library that we are using (which is Font Awesome). To do this, install the Font Awesome packages:
@@ -8,7 +8,7 @@ export const Colour = /*#__PURE__*/styled("div").withConfig({
8
8
  componentId: "sc-uyvdow-0"
9
9
  })(props => {
10
10
  return css({
11
- backgroundColor: themeGet(`colors.${props.bg}`)(props),
11
+ backgroundColor: themeGet("colors.".concat(props.bg))(props),
12
12
  width: "75px",
13
13
  height: "75px"
14
14
  });
@@ -1,3 +1,9 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ const _excluded = ["as"],
4
+ _excluded2 = ["theme", "onToggle", "toggleState", "direction", "menuWidth", "customTriggerComponent", "renderTrigger", "children", "ariaLabel", "onTriggerFocus", "closeMenu", "closeOnClick", "data-testid", "variant", "disabled"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
7
  import React, { useState, useImperativeHandle, createContext, useContext, useMemo, useId, useLayoutEffect } from "react";
2
8
  import styled, { css, ThemeProvider } from "styled-components";
3
9
  import PropTypes from "prop-types";
@@ -99,17 +105,20 @@ export const ActionsMenuHeading = /*#__PURE__*/styled(props => {
99
105
  // // Only sets `aria-labelledby` on the Popover root element
100
106
  // // if this component is mounted inside it.
101
107
  useLayoutEffect(() => {
102
- actionMenu?.setLabelId?.(id);
103
- return () => actionMenu?.setLabelId?.(undefined);
108
+ var _actionMenu$setLabelI;
109
+ actionMenu === null || actionMenu === void 0 || (_actionMenu$setLabelI = actionMenu.setLabelId) === null || _actionMenu$setLabelI === void 0 || _actionMenu$setLabelI.call(actionMenu, id);
110
+ return () => {
111
+ var _actionMenu$setLabelI2;
112
+ return actionMenu === null || actionMenu === void 0 || (_actionMenu$setLabelI2 = actionMenu.setLabelId) === null || _actionMenu$setLabelI2 === void 0 ? void 0 : _actionMenu$setLabelI2.call(actionMenu, undefined);
113
+ };
104
114
  }, [id, actionMenu]);
105
- return /*#__PURE__*/_jsx("div", {
106
- ...props,
115
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, props), {}, {
107
116
  onKeyUp: e => {
108
- if (e.key === commonKeys.ENTER && props?.canClick) {
109
- props?.onClick();
117
+ if (e.key === commonKeys.ENTER && props !== null && props !== void 0 && props.canClick) {
118
+ props === null || props === void 0 || props.onClick();
110
119
  }
111
120
  }
112
- });
121
+ }));
113
122
  }).attrs({
114
123
  tabIndex: "0",
115
124
  role: "button"
@@ -123,54 +132,47 @@ const StyledNavLink = /*#__PURE__*/styled(NavLink).withConfig({
123
132
  componentId: "sc-yvbni2-7"
124
133
  })(["text-decoration:none;"]);
125
134
  export const ActionsMenuItem = /*#__PURE__*/styled(props => {
135
+ var _actionMenu$getItemPr;
126
136
  const {
127
137
  id,
128
138
  onItemClick,
129
139
  actionMenu
130
140
  } = useContext(ActionMenuContext);
131
141
  const {
132
- as,
133
- ...others
134
- } = props;
142
+ as
143
+ } = props,
144
+ others = _objectWithoutProperties(props, _excluded);
135
145
  const Component = as ? as : others.href ? "a" : "button";
136
146
  const disabled = props.disabled;
137
- let newProps = {
138
- ...others,
139
- ...(actionMenu?.getItemProps?.() || {})
140
- };
147
+ let newProps = _objectSpread(_objectSpread({}, others), (actionMenu === null || actionMenu === void 0 || (_actionMenu$getItemPr = actionMenu.getItemProps) === null || _actionMenu$getItemPr === void 0 ? void 0 : _actionMenu$getItemPr.call(actionMenu)) || {});
141
148
  const {
142
149
  onClick: originalOnClick
143
150
  } = newProps;
144
151
  const onClick = useMemo(() => e => {
145
- onItemClick?.(e);
146
- originalOnClick?.(e);
152
+ onItemClick === null || onItemClick === void 0 || onItemClick(e);
153
+ originalOnClick === null || originalOnClick === void 0 || originalOnClick(e);
147
154
  }, [originalOnClick, onItemClick]);
148
155
  if (props.to) {
149
156
  const LinkedComponent = props.Component || Component;
150
157
  return /*#__PURE__*/_jsx(StyledNavLink, {
151
158
  to: props.to,
152
- children: /*#__PURE__*/_jsx(LinkedComponent, {
153
- ...newProps
154
- })
159
+ children: /*#__PURE__*/_jsx(LinkedComponent, _objectSpread({}, newProps))
155
160
  });
156
161
  }
157
162
  if (Component === "button") {
158
- newProps = {
159
- ...others,
163
+ newProps = _objectSpread(_objectSpread({}, others), {}, {
160
164
  type: "button",
161
165
  ["data-action-menu-id"]: id
162
- };
166
+ });
163
167
  }
164
- if (props.Component) return /*#__PURE__*/_jsx(props.Component, {
165
- ...newProps,
168
+ if (props.Component) return /*#__PURE__*/_jsx(props.Component, _objectSpread(_objectSpread({}, newProps), {}, {
166
169
  onClick: onClick,
167
170
  disabled: disabled
168
- });
169
- return /*#__PURE__*/_jsx(Component, {
170
- ...newProps,
171
+ }));
172
+ return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, newProps), {}, {
171
173
  onClick: onClick,
172
174
  disabled: disabled
173
- });
175
+ }));
174
176
  }).attrs({
175
177
  role: "menuitem"
176
178
  }).withConfig({
@@ -184,52 +186,49 @@ export const ActionsMenuItem = /*#__PURE__*/styled(props => {
184
186
  });
185
187
  export const ActionsMenuBody = _ref2 => {
186
188
  let {
187
- theme,
188
- onToggle,
189
- toggleState,
190
- // direction - Deprecated
191
- direction = "right-start",
192
- menuWidth,
193
- customTriggerComponent,
194
- renderTrigger,
195
- children,
196
- ariaLabel = "Options Menu",
197
- onTriggerFocus,
198
- closeMenu,
199
- closeOnClick = false,
200
- "data-testid": dataTestId = "ActionsMenu",
201
- variant = "default",
202
- disabled = false,
203
- ...props
204
- } = _ref2;
189
+ theme,
190
+ onToggle,
191
+ toggleState,
192
+ // direction - Deprecated
193
+ direction = "right-start",
194
+ menuWidth,
195
+ customTriggerComponent,
196
+ renderTrigger,
197
+ children,
198
+ ariaLabel = "Options Menu",
199
+ onTriggerFocus,
200
+ closeMenu,
201
+ closeOnClick = false,
202
+ "data-testid": dataTestId = "ActionsMenu",
203
+ variant = "default",
204
+ disabled = false
205
+ } = _ref2,
206
+ props = _objectWithoutProperties(_ref2, _excluded2);
205
207
  const id = useId();
206
208
  const actionMenu = useActionMenu({
207
209
  placement: direction,
208
210
  open: toggleState,
209
211
  onOpenChange: (_, e) => {
210
212
  if (e) {
211
- onToggle?.(e);
213
+ onToggle === null || onToggle === void 0 || onToggle(e);
212
214
  }
213
215
  }
214
216
  });
215
217
  const childrenRef = children.ref;
216
218
  const triggerRef = useMergeRefs([actionMenu.refs.setReference, childrenRef]);
217
219
  const ref = useMergeRefs([actionMenu.refs.setFloating]);
218
- const triggerProps = useMemo(() => ({
220
+ const triggerProps = useMemo(() => _objectSpread({
219
221
  "aria-label": ariaLabel,
220
222
  onFocus: onTriggerFocus,
221
223
  id,
222
- disabled,
223
- ...actionMenu.getReferenceProps({
224
- ...props,
225
- onClick: disabled ? undefined : onToggle,
226
- ref: triggerRef,
227
- "data-state": actionMenu.open ? "open" : "closed",
228
- "data-testid": dataTestId
229
- })
230
- }), [ariaLabel, onTriggerFocus, id, actionMenu, onToggle, props, triggerRef, dataTestId, disabled]);
231
- let triggerComponent = /*#__PURE__*/_jsxs(Control, {
232
- ...triggerProps,
224
+ disabled
225
+ }, actionMenu.getReferenceProps(_objectSpread(_objectSpread({}, props), {}, {
226
+ onClick: disabled ? undefined : onToggle,
227
+ ref: triggerRef,
228
+ "data-state": actionMenu.open ? "open" : "closed",
229
+ "data-testid": dataTestId
230
+ }))), [ariaLabel, onTriggerFocus, id, actionMenu, onToggle, props, triggerRef, dataTestId, disabled]);
231
+ let triggerComponent = /*#__PURE__*/_jsxs(Control, _objectSpread(_objectSpread({}, triggerProps), {}, {
233
232
  variant: variant,
234
233
  disabled: disabled,
235
234
  children: [/*#__PURE__*/_jsx(Dots, {
@@ -239,16 +238,16 @@ export const ActionsMenuBody = _ref2 => {
239
238
  className: "actionsMenu__cross",
240
239
  variant: variant
241
240
  })]
242
- });
241
+ }));
243
242
  if (renderTrigger) {
244
243
  triggerComponent = renderTrigger(triggerProps);
245
244
  }
246
245
  if (customTriggerComponent) {
247
- triggerComponent = /*#__PURE__*/_jsx("div", {
248
- role: "button",
249
- ...triggerProps,
246
+ triggerComponent = /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
247
+ role: "button"
248
+ }, triggerProps), {}, {
250
249
  children: customTriggerComponent
251
- });
250
+ }));
252
251
  }
253
252
  const value = useMemo(() => ({
254
253
  id,
@@ -259,28 +258,26 @@ export const ActionsMenuBody = _ref2 => {
259
258
  },
260
259
  actionMenu
261
260
  }), [closeOnClick, closeMenu, id, actionMenu]);
262
- const style = useMemo(() => ({
263
- ...actionMenu.floatingStyles,
261
+ const style = useMemo(() => _objectSpread(_objectSpread({}, actionMenu.floatingStyles), {}, {
264
262
  zIndex: getFloatingUiZIndex(actionMenu.refs.reference)
265
263
  }), [actionMenu.floatingStyles, actionMenu.refs.reference]);
266
- const menuDataTestId = useMemo(() => `${dataTestId}__menu`, [dataTestId]);
264
+ const menuDataTestId = useMemo(() => "".concat(dataTestId, "__menu"), [dataTestId]);
267
265
  const {
268
266
  getFloatingProps
269
267
  } = actionMenu;
270
268
  const floatingProps = useMemo(() => getFloatingProps(props), [getFloatingProps, props]);
271
269
  const component = /*#__PURE__*/_jsx(ActionMenuContext.Provider, {
272
270
  value: value,
273
- children: /*#__PURE__*/_jsxs(Wrapper, {
274
- ...props,
271
+ children: /*#__PURE__*/_jsxs(Wrapper, _objectSpread(_objectSpread({}, props), {}, {
275
272
  children: [triggerComponent, toggleState ? /*#__PURE__*/_jsx(FloatingPortal, {
276
273
  root: getFloatingUiRootElement(actionMenu.refs.reference),
277
274
  children: /*#__PURE__*/_jsx(FloatingFocusManager, {
278
275
  context: actionMenu.context,
279
276
  modal: true,
280
- children: /*#__PURE__*/_jsx(StyledActionsMenuContainer, {
277
+ children: /*#__PURE__*/_jsx(StyledActionsMenuContainer, _objectSpread(_objectSpread({
281
278
  "aria-labelledby": actionMenu.labelId,
282
- "data-testid": menuDataTestId,
283
- ...floatingProps,
279
+ "data-testid": menuDataTestId
280
+ }, floatingProps), {}, {
284
281
  style: style,
285
282
  className: "actionMenu-content visible",
286
283
  "aria-hidden": "false",
@@ -290,7 +287,7 @@ export const ActionsMenuBody = _ref2 => {
290
287
  isOpen: toggleState,
291
288
  children: children
292
289
  })
293
- })
290
+ }))
294
291
  })
295
292
  }) :
296
293
  /*#__PURE__*/
@@ -310,7 +307,7 @@ export const ActionsMenuBody = _ref2 => {
310
307
  children: children
311
308
  })
312
309
  })]
313
- })
310
+ }))
314
311
  });
315
312
  return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
316
313
  theme: theme,
@@ -349,13 +346,12 @@ const ActionsMenu = /*#__PURE__*/React.forwardRef((props, ref) => {
349
346
  setToggle(false);
350
347
  }
351
348
  }));
352
- return /*#__PURE__*/_jsx(ActionsMenuBody, {
353
- ...props,
349
+ return /*#__PURE__*/_jsx(ActionsMenuBody, _objectSpread(_objectSpread({}, props), {}, {
354
350
  closeMenu: () => setToggle(false),
355
351
  toggleState: toggleState,
356
352
  onToggle: onToggle,
357
353
  children: props.children
358
- });
354
+ }));
359
355
  });
360
356
  ActionsMenu.propTypes = {
361
357
  isOpen: PropTypes.bool,
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import React, { useCallback, useMemo, useRef, useState } from "react";
2
5
  import { useFloating, autoUpdate, offset, flip, shift, useClick, useDismiss, useRole, useInteractions, FloatingArrow, arrow } from "@floating-ui/react";
3
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -14,8 +17,8 @@ export default function useActionMenu(_ref) {
14
17
  const [labelId, setLabelId] = useState();
15
18
  const [descriptionId, setDescriptionId] = useState();
16
19
  const arrowRef = useRef();
17
- const open = controlledOpen ?? uncontrolledOpen;
18
- const setOpen = setControlledOpen ?? setUncontrolledOpen;
20
+ const open = controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : uncontrolledOpen;
21
+ const setOpen = setControlledOpen !== null && setControlledOpen !== void 0 ? setControlledOpen : setUncontrolledOpen;
19
22
  const data = useFloating({
20
23
  placement,
21
24
  open,
@@ -44,11 +47,10 @@ export default function useActionMenu(_ref) {
44
47
  ref: arrowRef,
45
48
  context: context
46
49
  }), [context]);
47
- return useMemo(() => ({
50
+ return useMemo(() => _objectSpread(_objectSpread(_objectSpread({
48
51
  open,
49
- setOpen,
50
- ...interactions,
51
- ...data,
52
+ setOpen
53
+ }, interactions), data), {}, {
52
54
  modal,
53
55
  labelId,
54
56
  descriptionId,
@@ -22,10 +22,11 @@ const resolveCustomSize = (customSize, props) => {
22
22
  if (customSize.includes("px") || customSize.includes("rem") || customSize.includes("em") || customSize.includes("%")) {
23
23
  return customSize;
24
24
  } else {
25
- return themeGet(`avatarScale.${customSize}`)(props) || customSize;
25
+ return themeGet("avatarScale.".concat(customSize))(props) || customSize;
26
26
  }
27
27
  };
28
28
  const CroppedImage = _ref => {
29
+ var _croppedAreaPercent$x, _croppedAreaPercent$y;
29
30
  let {
30
31
  src,
31
32
  alt,
@@ -35,12 +36,12 @@ const CroppedImage = _ref => {
35
36
  } = _ref;
36
37
  const scale = 100 / (croppedAreaPercent.width || 1);
37
38
  const transform = {
38
- x: `${-(croppedAreaPercent.x ?? 0) * scale}%`,
39
- y: `${-(croppedAreaPercent.y ?? 0) * scale}%`,
39
+ x: "".concat(-((_croppedAreaPercent$x = croppedAreaPercent.x) !== null && _croppedAreaPercent$x !== void 0 ? _croppedAreaPercent$x : 0) * scale, "%"),
40
+ y: "".concat(-((_croppedAreaPercent$y = croppedAreaPercent.y) !== null && _croppedAreaPercent$y !== void 0 ? _croppedAreaPercent$y : 0) * scale, "%"),
40
41
  scale
41
42
  };
42
43
  const imageStyle = {
43
- transform: `translate3d(${transform.x}, ${transform.y}, 0) scale3d(${transform.scale}, ${transform.scale}, 1)`,
44
+ transform: "translate3d(".concat(transform.x, ", ").concat(transform.y, ", 0) scale3d(").concat(transform.scale, ", ").concat(transform.scale, ", 1)"),
44
45
  width: "calc(100% + 0.5px)",
45
46
  height: "auto"
46
47
  };
@@ -1,3 +1,9 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ const _excluded = ["titleLevel"],
4
+ _excluded2 = ["sizing", "image", "croppedAreaPercent", "gradient", "fallbackGradient", "imageAlt", "initials", "title", "titleLevel", "subtitle", "subtitleContent", "type", "theme", "shape", "localTime", "uppercase", "customSize", "headerAvatar", "onClick", "loading"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
7
  import React, { useMemo } from "react";
2
8
  import styled, { ThemeProvider, keyframes } from "styled-components";
3
9
  import { space, layout, variant, position, compose } from "styled-system";
@@ -22,7 +28,7 @@ const resolveCustomSize = (customSize, props) => {
22
28
  return customSize;
23
29
  } else {
24
30
  // It's a theme value, resolve it using themeGet
25
- return themeGet(`avatarScale.${customSize}`)(props) || customSize;
31
+ return themeGet("avatarScale.".concat(customSize))(props) || customSize;
26
32
  }
27
33
  };
28
34
  const AvatarWrapper = /*#__PURE__*/styled("div").withConfig({
@@ -125,7 +131,7 @@ const Shape = /*#__PURE__*/styled("div").withConfig({
125
131
  height: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
126
132
  fontWeight: themeGet("fontWeights.2")(props),
127
133
  flex: "0 0 auto",
128
- background: props.gradient ? props.gradient : `linear-gradient(135deg, ${themeGet("colors.primaryLightest")(props)}, ${themeGet("colors.primaryLight")(props)})`,
134
+ background: props.gradient ? props.gradient : "linear-gradient(135deg, ".concat(themeGet("colors.primaryLightest")(props), ", ").concat(themeGet("colors.primaryLight")(props), ")"),
129
135
  color: themeGet("colors.white")(props),
130
136
  border: "0",
131
137
  display: "flex",
@@ -133,7 +139,7 @@ const Shape = /*#__PURE__*/styled("div").withConfig({
133
139
  alignItems: "center",
134
140
  justifyContent: "center",
135
141
  textAlign: "center",
136
- textTransform: `${props => props.uppercase ? "uppercase" : "none"}`,
142
+ textTransform: "".concat(props => props.uppercase ? "uppercase" : "none"),
137
143
  a: {
138
144
  color: themeGet("colors.greyDarkest")(props)
139
145
  },
@@ -181,9 +187,9 @@ const Shape = /*#__PURE__*/styled("div").withConfig({
181
187
  }));
182
188
  const Title = /*#__PURE__*/styled(_ref => {
183
189
  let {
184
- titleLevel,
185
- ...props
186
- } = _ref;
190
+ titleLevel
191
+ } = _ref,
192
+ props = _objectWithoutProperties(_ref, _excluded);
187
193
  const Heading = Header[titleLevel];
188
194
  return /*#__PURE__*/React.cloneElement(/*#__PURE__*/_jsx(Heading, {}), props);
189
195
  }).withConfig({
@@ -364,25 +370,23 @@ const HeaderAvatarShape = /*#__PURE__*/styled("div").withConfig({
364
370
  } : {
365
371
  background: "#e6e6e6"
366
372
  };
367
- return {
373
+ return _objectSpread(_objectSpread(_objectSpread({
368
374
  width: $size,
369
375
  height: $size,
370
376
  transition: "width 200ms ease-in-out, height 200ms ease-in-out",
371
377
  display: "flex",
372
378
  alignItems: "center",
373
- justifyContent: "center",
374
- ...backgroundStyles,
379
+ justifyContent: "center"
380
+ }, backgroundStyles), {}, {
375
381
  color: "#fff",
376
382
  fontWeight: 600,
377
- fontSize: `calc(${$size} / 2.5)`,
378
- borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
379
- ...($shape === "hexagon" && {
380
- clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
381
- }),
382
- ...($shape === "tag" && {
383
- clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
384
- })
385
- };
383
+ fontSize: "calc(".concat($size, " / 2.5)"),
384
+ borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0"
385
+ }, $shape === "hexagon" && {
386
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
387
+ }), $shape === "tag" && {
388
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
389
+ });
386
390
  });
387
391
  const HeaderAvatarAction = /*#__PURE__*/styled("button").withConfig({
388
392
  displayName: "HeaderAvatarAction",
@@ -391,7 +395,7 @@ const HeaderAvatarAction = /*#__PURE__*/styled("button").withConfig({
391
395
  let {
392
396
  $shape
393
397
  } = _ref8;
394
- return {
398
+ return _objectSpread(_objectSpread(_objectSpread({
395
399
  cursor: "pointer",
396
400
  padding: "0",
397
401
  background: "none",
@@ -400,19 +404,18 @@ const HeaderAvatarAction = /*#__PURE__*/styled("button").withConfig({
400
404
  appearance: "none",
401
405
  position: "relative",
402
406
  zIndex: "5",
403
- borderRadius: $shape === "circle" || !$shape ? "50%" : "6px",
404
- ...($shape === "hexagon" && {
405
- clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
406
- }),
407
- ...($shape === "tag" && {
408
- clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
409
- }),
407
+ borderRadius: $shape === "circle" || !$shape ? "50%" : "6px"
408
+ }, $shape === "hexagon" && {
409
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
410
+ }), $shape === "tag" && {
411
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
412
+ }), {}, {
410
413
  "&:hover, &:focus": {
411
414
  "& > .icon-container": {
412
415
  opacity: "1"
413
416
  }
414
417
  }
415
- };
418
+ });
416
419
  });
417
420
  const IconContainer = /*#__PURE__*/styled("div").withConfig({
418
421
  displayName: "IconContainer",
@@ -428,8 +431,8 @@ const IconContainer = /*#__PURE__*/styled("div").withConfig({
428
431
 
429
432
  // Height calculation with reduction when no image
430
433
  const heightReduction = $sizing === "large" ? $hasImage ? 17 : 12 : $hasImage ? 12 : 8;
431
- const height = `calc(100% - ${heightReduction}px)`;
432
- return {
434
+ const height = "calc(100% - ".concat(heightReduction, "px)");
435
+ return _objectSpread(_objectSpread({
433
436
  opacity: "0",
434
437
  transition: "opacity 0.2s ease-in-out",
435
438
  position: "absolute",
@@ -442,39 +445,38 @@ const IconContainer = /*#__PURE__*/styled("div").withConfig({
442
445
  justifyContent: "center",
443
446
  background: "rgba(0, 0, 0, 0.5)",
444
447
  zIndex: "2",
445
- borderRadius: $shape === "circle" || !$shape ? "50%" : "0",
446
- ...($shape === "hexagon" && {
447
- clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
448
- }),
449
- ...($shape === "tag" && {
450
- clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
451
- })
452
- };
448
+ borderRadius: $shape === "circle" || !$shape ? "50%" : "0"
449
+ }, $shape === "hexagon" && {
450
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
451
+ }), $shape === "tag" && {
452
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
453
+ });
453
454
  });
454
455
  const Avatar = _ref0 => {
456
+ var _theme$colors, _theme$colors2, _theme$colors3;
455
457
  let {
456
- sizing,
457
- image,
458
- croppedAreaPercent,
459
- gradient,
460
- fallbackGradient,
461
- imageAlt,
462
- initials,
463
- title,
464
- titleLevel = "H3",
465
- subtitle,
466
- subtitleContent,
467
- type,
468
- theme,
469
- shape = "circle",
470
- localTime,
471
- uppercase = true,
472
- customSize,
473
- headerAvatar = false,
474
- onClick,
475
- loading = false,
476
- ...props
477
- } = _ref0;
458
+ sizing,
459
+ image,
460
+ croppedAreaPercent,
461
+ gradient,
462
+ fallbackGradient,
463
+ imageAlt,
464
+ initials,
465
+ title,
466
+ titleLevel = "H3",
467
+ subtitle,
468
+ subtitleContent,
469
+ type,
470
+ theme,
471
+ shape = "circle",
472
+ localTime,
473
+ uppercase = true,
474
+ customSize,
475
+ headerAvatar = false,
476
+ onClick,
477
+ loading = false
478
+ } = _ref0,
479
+ props = _objectWithoutProperties(_ref0, _excluded2);
478
480
  const hasTitle = !!title;
479
481
  const hasSubtitle = !!subtitle;
480
482
  const hasSubtitleContent = !!subtitleContent;
@@ -482,20 +484,22 @@ const Avatar = _ref0 => {
482
484
  if (imageAlt) {
483
485
  return imageAlt;
484
486
  } else if (typeof title === "string") {
485
- return `Avatar for ${title}`;
487
+ return "Avatar for ".concat(title);
486
488
  }
487
489
  }, [imageAlt, title]);
488
490
 
489
491
  // Resolve a default icon color suitable on accent/gradient backgrounds
490
492
  // Prefer theme tokens if available to avoid hard-coded colors
491
- const defaultIconColor = theme?.colors?.iconOnAccent || theme?.colors?.iconDefault || theme?.colors?.white || "white";
493
+ const defaultIconColor = (theme === null || theme === void 0 || (_theme$colors = theme.colors) === null || _theme$colors === void 0 ? void 0 : _theme$colors.iconOnAccent) || (theme === null || theme === void 0 || (_theme$colors2 = theme.colors) === null || _theme$colors2 === void 0 ? void 0 : _theme$colors2.iconDefault) || (theme === null || theme === void 0 || (_theme$colors3 = theme.colors) === null || _theme$colors3 === void 0 ? void 0 : _theme$colors3.white) || "white";
492
494
 
493
495
  // HeaderAvatar logic
494
496
  if (headerAvatar) {
497
+ var _theme$avatarScale;
495
498
  // Sizing logic
496
- let size = theme?.avatarScale?.headerAvatarDefault || "65px";
499
+ let size = (theme === null || theme === void 0 || (_theme$avatarScale = theme.avatarScale) === null || _theme$avatarScale === void 0 ? void 0 : _theme$avatarScale.headerAvatarDefault) || "65px";
497
500
  if (sizing === "large") {
498
- size = theme?.avatarScale?.headerAvatarLarge || "150px";
501
+ var _theme$avatarScale2;
502
+ size = (theme === null || theme === void 0 || (_theme$avatarScale2 = theme.avatarScale) === null || _theme$avatarScale2 === void 0 ? void 0 : _theme$avatarScale2.headerAvatarLarge) || "150px";
499
503
  }
500
504
  if (customSize) {
501
505
  size = resolveCustomSize(customSize, {
@@ -531,8 +535,7 @@ const Avatar = _ref0 => {
531
535
  color: defaultIconColor
532
536
  })
533
537
  });
534
- const avatarContent = /*#__PURE__*/_jsx(HeaderAvatarWrapper, {
535
- ...props,
538
+ const avatarContent = /*#__PURE__*/_jsx(HeaderAvatarWrapper, _objectSpread(_objectSpread({}, props), {}, {
536
539
  $size: size,
537
540
  $shape: shape,
538
541
  children: /*#__PURE__*/_jsx(HeaderAvatarBorder, {
@@ -543,7 +546,7 @@ const Avatar = _ref0 => {
543
546
  $size: size
544
547
  }) : imgContent
545
548
  })
546
- });
549
+ }));
547
550
  if (onClick && !loading) {
548
551
  return /*#__PURE__*/_jsx(Popover, {
549
552
  direction: "right",
@@ -577,8 +580,7 @@ const Avatar = _ref0 => {
577
580
  }
578
581
  return avatarContent;
579
582
  }
580
- const component = /*#__PURE__*/_jsxs(AvatarWrapper, {
581
- ...props,
583
+ const component = /*#__PURE__*/_jsxs(AvatarWrapper, _objectSpread(_objectSpread({}, props), {}, {
582
584
  type: type,
583
585
  sizing: sizing,
584
586
  children: [image ? croppedAreaPercent ? /*#__PURE__*/_jsx(CroppedImageWrapper, {
@@ -645,7 +647,7 @@ const Avatar = _ref0 => {
645
647
  })
646
648
  })
647
649
  })]
648
- });
650
+ }));
649
651
  return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
650
652
  theme: theme,
651
653
  children: component
@@ -677,10 +679,10 @@ Avatar.propTypes = {
677
679
  /** Specifies the alt text for an image. This must be specified if image prop is used and title prop is not a string. */
678
680
  imageAlt: (props, propName) => {
679
681
  if (props.image && props.title && typeof props.title !== "string" && (props[propName] == null || props[propName] === "")) {
680
- return new Error(`Missing prop \`${propName}\` not specified for Avatar component. When \`image\` is provided, \`${propName}\` is required.`);
682
+ return new Error("Missing prop `".concat(propName, "` not specified for Avatar component. When `image` is provided, `").concat(propName, "` is required."));
681
683
  }
682
684
  if (props[propName] && typeof props[propName] !== "string") {
683
- return new Error(`Invalid propType \`${propName}\` supplied to Avatar component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
685
+ return new Error("Invalid propType `".concat(propName, "` supplied to Avatar component. Expected `string`, received `").concat(typeof props[propName], "`."));
684
686
  }
685
687
  return null;
686
688
  },