orcs-design-system 3.3.76 → 3.4.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/README.md +41 -1
- package/es/assets/Colour/index.js +1 -1
- package/es/components/ActionsMenu/index.js +73 -77
- package/es/components/ActionsMenu/useActionMenu.js +8 -6
- package/es/components/Avatar/CroppedImage.js +5 -4
- package/es/components/Avatar/index.js +73 -71
- package/es/components/Badge/index.js +24 -20
- package/es/components/Box/index.js +14 -9
- package/es/components/Breadcrumbs/index.js +12 -8
- package/es/components/Button/index.js +33 -33
- package/es/components/ButtonGroup/index.js +16 -11
- package/es/components/Card/index.js +24 -20
- package/es/components/Checkbox/index.js +32 -28
- package/es/components/CodeBlock/CodeBlock.stories.js +86 -103
- package/es/components/CodeBlock/index.js +251 -45
- package/es/components/ColorPicker/index.js +52 -49
- package/es/components/DatePicker/index.js +31 -28
- package/es/components/Divider/index.js +17 -13
- package/es/components/Expandable/index.js +17 -13
- package/es/components/Flex/index.js +19 -18
- package/es/components/FloatingPanels/FloatingPanels.stories.js +1 -1
- package/es/components/FloatingPanels/FloatingPanels.styles.js +2 -6
- package/es/components/FloatingPanels/index.js +9 -8
- package/es/components/Grid/index.js +11 -7
- package/es/components/Header/Header.styles.js +2 -2
- package/es/components/HeaderSimple/HeaderSimple.stories.js +2 -2
- package/es/components/Icon/index.js +30 -25
- package/es/components/Loading/index.js +16 -12
- package/es/components/Modal/Modal.stories.js +4 -226
- package/es/components/Modal/index.js +28 -23
- package/es/components/Notification/index.js +30 -26
- package/es/components/Popover/index.js +48 -50
- package/es/components/ProgressBar/index.js +18 -13
- package/es/components/RadioButton/index.js +24 -20
- package/es/components/Range/index.js +18 -29
- package/es/components/Select/index.js +43 -55
- package/es/components/SideNavV2/NavItem.js +18 -16
- package/es/components/SideNavV2/PanelLink.stories.js +4 -3
- package/es/components/SideNavV2/SideNav.js +1 -1
- package/es/components/SideNavV2/SideNavV2.stories.js +13 -13
- package/es/components/SideNavV2/__tests__/interaction-scenarios.test.js +9 -8
- package/es/components/SideNavV2/__tests__/sections.test.js +64 -63
- package/es/components/SideNavV2/components/BaseSection.js +5 -3
- package/es/components/SideNavV2/components/CurrentViewSectionPortalTarget.js +2 -2
- package/es/components/SideNavV2/components/RenderCurrentViewSection.js +5 -3
- package/es/components/SideNavV2/hooks/useResize.js +5 -4
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +11 -15
- package/es/components/SideNavV2/sections/SideNavPinnedSection.js +1 -1
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +27 -25
- package/es/components/SideNavV2/utils/itemUtils.js +4 -2
- package/es/components/SideNavV2/utils/resizeUtils.js +3 -3
- package/es/components/Spacer/index.js +12 -11
- package/es/components/StatusDot/index.js +11 -7
- package/es/components/StyledLink/index.js +14 -11
- package/es/components/Table/Table.stories.js +2 -2
- package/es/components/Table/getExpandColumnConfig.js +16 -19
- package/es/components/Table/index.js +18 -17
- package/es/components/Table/muiStyleOverrides.js +3 -2
- package/es/components/Tabs/Tabs.stories.js +1 -1
- package/es/components/Tabs/index.js +33 -31
- package/es/components/TabsAlt/TabsAlt.stories.js +1 -1
- package/es/components/TabsAlt/index.js +25 -22
- package/es/components/Tag/Tag.stories.js +1 -1
- package/es/components/Tag/index.js +32 -27
- package/es/components/TextArea/index.js +16 -13
- package/es/components/TextInput/index.js +30 -24
- package/es/components/Toggle/index.js +20 -16
- package/es/components/TreeNav/index.js +12 -7
- package/es/components.test.js +1 -74
- package/es/systemThemeCollapsed.js +9 -9
- package/es/systemtheme.js +9 -9
- package/es/utils/floatingUiHelpers.js +6 -3
- package/package.json +24 -15
package/README.md
CHANGED
|
@@ -76,13 +76,49 @@ npm run deploy-storybook
|
|
|
76
76
|
|
|
77
77
|
## Using ORCS in a project
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
### GitHub Packages (Recommended)
|
|
80
|
+
|
|
81
|
+
For internal repositories, use the GitHub Packages version `@teamform/orcs-design-system`. This package is published in parallel with the public version and uses your existing GitHub authentication.
|
|
82
|
+
|
|
83
|
+
**Setup:**
|
|
84
|
+
|
|
85
|
+
1. Add `.npmrc` to your repository root with the following content:
|
|
86
|
+
```ini
|
|
87
|
+
@teamform:registry=https://npm.pkg.github.com
|
|
88
|
+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
2. Update `package.json` to use npm aliases (no code changes needed):
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"dependencies": {
|
|
95
|
+
"orcs-design-system": "npm:@teamform/orcs-design-system@^3.4.0"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Install: `npm install`
|
|
101
|
+
|
|
102
|
+
**Note:** In GitHub Actions, `GITHUB_TOKEN` is automatically available. For local development, set `GITHUB_TOKEN` as an environment variable with a Personal Access Token (with `read:packages` permission).
|
|
103
|
+
|
|
104
|
+
Your imports remain the same:
|
|
105
|
+
```javascript
|
|
106
|
+
import { Box } from 'orcs-design-system';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Public Package (Deprecated)
|
|
110
|
+
|
|
111
|
+
> **⚠️ Deprecated**: The public npm package (`orcs-design-system`) is deprecated and will be removed by January 2026 at the latest. Please migrate to the GitHub Packages version (`@teamform/orcs-design-system`) as soon as possible.
|
|
112
|
+
|
|
113
|
+
If you are still using the public package, you can install it with:
|
|
80
114
|
|
|
81
115
|
```
|
|
82
116
|
npm i orcs-design-system
|
|
83
117
|
npm i styled-components
|
|
84
118
|
```
|
|
85
119
|
|
|
120
|
+
However, **new projects should use the GitHub Packages version** (see above).
|
|
121
|
+
|
|
86
122
|
### Using components
|
|
87
123
|
|
|
88
124
|
Once ORCS is installed, you can directly import components. For example, for `Box`:
|
|
@@ -125,6 +161,10 @@ import { ThemeProvider } from "styled-components"
|
|
|
125
161
|
|
|
126
162
|
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
163
|
|
|
164
|
+
### Styled Components v6
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
128
168
|
### Using icons
|
|
129
169
|
|
|
130
170
|
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(
|
|
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
|
-
|
|
103
|
-
|
|
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
|
|
109
|
-
props
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
|
146
|
-
originalOnClick
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
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(() =>
|
|
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
|
-
|
|
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
|
|
18
|
-
const setOpen = setControlledOpen
|
|
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
|
-
|
|
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(
|
|
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:
|
|
39
|
-
y:
|
|
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:
|
|
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
|
};
|