@mirohq/design-system-dropdown-menu 3.3.0-dropdown.0 → 3.3.0-dropdown.10
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/dist/main.js +522 -155
- package/dist/main.js.map +1 -1
- package/dist/module.js +524 -157
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4919 -258
- package/package.json +11 -9
package/dist/main.js
CHANGED
|
@@ -5,10 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var RadixDropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
7
7
|
var designSystemIcons = require('@mirohq/design-system-icons');
|
|
8
|
+
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
8
9
|
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
9
10
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
10
11
|
var designSystemStyles = require('@mirohq/design-system-styles');
|
|
11
|
-
var
|
|
12
|
+
var designSystemScrollArea = require('@mirohq/design-system-scroll-area');
|
|
13
|
+
var designSystemBaseSwitch = require('@mirohq/design-system-base-switch');
|
|
14
|
+
var designSystemBaseIcon = require('@mirohq/design-system-base-icon');
|
|
12
15
|
|
|
13
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
17
|
|
|
@@ -33,112 +36,311 @@ function _interopNamespace(e) {
|
|
|
33
36
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
37
|
var RadixDropdownMenu__namespace = /*#__PURE__*/_interopNamespace(RadixDropdownMenu);
|
|
35
38
|
|
|
39
|
+
const ItemDescription = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
40
|
+
display: "-webkit-box",
|
|
41
|
+
width: "100%",
|
|
42
|
+
WebkitBoxOrient: "vertical",
|
|
43
|
+
WebkitLineClamp: 2,
|
|
44
|
+
overflow: "hidden",
|
|
45
|
+
gridArea: "item-description",
|
|
46
|
+
fontSize: "$150",
|
|
47
|
+
color: "$text-neutrals-subtle"
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const LeftSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
justifyContent: "center",
|
|
54
|
+
marginRight: "$100",
|
|
55
|
+
gridArea: "left-slot"
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const StyledIllustrationSlot = designSystemStitches.styled(LeftSlot, {
|
|
59
|
+
width: "$13"
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const Context$1 = React.createContext({
|
|
63
|
+
rightSlotMount: () => 0,
|
|
64
|
+
rightSlotDestroy: () => {
|
|
65
|
+
},
|
|
66
|
+
containerSpacing: "medium"
|
|
67
|
+
});
|
|
68
|
+
const ContentProvider = ({
|
|
69
|
+
children,
|
|
70
|
+
containerSpacing = "medium"
|
|
71
|
+
}) => {
|
|
72
|
+
const [maxWidth, setMaxWidth] = React.useState(0);
|
|
73
|
+
const maxRef = React.useRef(0);
|
|
74
|
+
const indexRef = React.useRef(0);
|
|
75
|
+
const widthMapRef = React.useRef(/* @__PURE__ */ new Map());
|
|
76
|
+
const updateMaxWith = React.useCallback((value) => {
|
|
77
|
+
maxRef.current = value;
|
|
78
|
+
setMaxWidth(value);
|
|
79
|
+
}, []);
|
|
80
|
+
const rightSlotMount = React.useCallback(
|
|
81
|
+
(width) => {
|
|
82
|
+
indexRef.current++;
|
|
83
|
+
widthMapRef.current.set(indexRef.current, width);
|
|
84
|
+
if (width > maxRef.current) {
|
|
85
|
+
updateMaxWith(width);
|
|
86
|
+
}
|
|
87
|
+
return indexRef.current;
|
|
88
|
+
},
|
|
89
|
+
[updateMaxWith]
|
|
90
|
+
);
|
|
91
|
+
const rightSlotDestroy = React.useCallback(
|
|
92
|
+
(index) => {
|
|
93
|
+
widthMapRef.current.delete(index);
|
|
94
|
+
if (widthMapRef.current.size === 0) {
|
|
95
|
+
updateMaxWith(0);
|
|
96
|
+
} else {
|
|
97
|
+
const maximum = Math.max(...Array.from(widthMapRef.current.values()));
|
|
98
|
+
updateMaxWith(maximum);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
[updateMaxWith]
|
|
102
|
+
);
|
|
103
|
+
const formattedChildren = designSystemUtils.addPropsToChildren(children, () => true, {
|
|
104
|
+
UNSAFE_style: {
|
|
105
|
+
"--right-slot-max-width": `${Math.ceil(maxWidth)}px`
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return /* @__PURE__ */ React__default["default"].createElement(Context$1.Provider, {
|
|
109
|
+
value: {
|
|
110
|
+
rightSlotMount,
|
|
111
|
+
rightSlotDestroy,
|
|
112
|
+
containerSpacing
|
|
113
|
+
}
|
|
114
|
+
}, formattedChildren);
|
|
115
|
+
};
|
|
116
|
+
const useContent = () => React.useContext(Context$1);
|
|
117
|
+
|
|
118
|
+
const StyledRightSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
119
|
+
display: "flex",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
justifyContent: "center",
|
|
122
|
+
marginLeft: "auto",
|
|
123
|
+
paddingLeft: "$200",
|
|
124
|
+
gridArea: "right-slot",
|
|
125
|
+
height: "$5",
|
|
126
|
+
width: "$7",
|
|
127
|
+
minWidth: "max-content",
|
|
128
|
+
textAlign: "right",
|
|
129
|
+
"&:empty": {
|
|
130
|
+
paddingLeft: "$none"
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const RightSlot = (props) => {
|
|
135
|
+
const { rightSlotMount, rightSlotDestroy } = useContent();
|
|
136
|
+
const ref = React.useRef(null);
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
if (ref.current !== null) {
|
|
139
|
+
const width = ref.current.getBoundingClientRect().width;
|
|
140
|
+
const index = rightSlotMount(width);
|
|
141
|
+
return () => rightSlotDestroy(index);
|
|
142
|
+
}
|
|
143
|
+
return () => {
|
|
144
|
+
};
|
|
145
|
+
}, [rightSlotMount, rightSlotDestroy, ref]);
|
|
146
|
+
return /* @__PURE__ */ React__default["default"].createElement(StyledRightSlot, {
|
|
147
|
+
ref,
|
|
148
|
+
...props
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const HotkeySlot = designSystemStitches.styled(RightSlot, {
|
|
153
|
+
color: "$text-neutrals-subtle"
|
|
154
|
+
});
|
|
155
|
+
|
|
36
156
|
const itemDefaults = {
|
|
37
157
|
all: "unset",
|
|
38
158
|
boxSizing: "border-box",
|
|
39
159
|
fontSize: 14,
|
|
40
160
|
lineHeight: "20px",
|
|
41
|
-
color: "
|
|
161
|
+
color: "$text-neutrals",
|
|
42
162
|
borderRadius: "$50",
|
|
43
|
-
display: "
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
163
|
+
display: "grid",
|
|
164
|
+
gridTemplateColumns: "auto 1fr minmax(auto, var(--right-slot-max-width))",
|
|
165
|
+
gridTemplateRows: "1fr auto",
|
|
166
|
+
gridTemplateAreas: `'left-slot item-text right-slot'
|
|
167
|
+
'left-slot item-description right-slot'`,
|
|
168
|
+
alignItems: "start",
|
|
169
|
+
minHeight: "$10",
|
|
170
|
+
padding: "$100 $100",
|
|
47
171
|
position: "relative",
|
|
48
172
|
userSelect: "none",
|
|
49
173
|
cursor: "pointer",
|
|
50
|
-
"&[data-
|
|
51
|
-
|
|
52
|
-
|
|
174
|
+
"&[data-no-left-slot]": {
|
|
175
|
+
gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
|
|
176
|
+
gridTemplateRows: "auto",
|
|
177
|
+
gridTemplateAreas: `'item-text right-slot'
|
|
178
|
+
'item-description right-slot'`
|
|
179
|
+
},
|
|
180
|
+
"&:not(:last-child)": {
|
|
181
|
+
marginBottom: "$50"
|
|
182
|
+
},
|
|
183
|
+
"&:not(:first-child)": {
|
|
184
|
+
marginTop: "$50"
|
|
53
185
|
},
|
|
54
186
|
...designSystemStyles.focus.defaults,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
187
|
+
'&:disabled, &[aria-disabled="true"], &[data-disabled]': {
|
|
188
|
+
cursor: "default",
|
|
189
|
+
[`&, & ${ItemDescription}, & ${HotkeySlot}`]: {
|
|
190
|
+
color: "$text-neutrals-disabled"
|
|
191
|
+
},
|
|
192
|
+
[`& ${StyledIllustrationSlot}`]: {
|
|
193
|
+
filter: "grayscale(1)"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"&:disabled, &[data-disabled]": {
|
|
197
|
+
pointerEvents: "none"
|
|
198
|
+
},
|
|
199
|
+
'&:hover:not([aria-disabled="true"])': {
|
|
200
|
+
background: "$background-primary-subtle-hover",
|
|
201
|
+
color: "$text-primary-hover",
|
|
202
|
+
'&:not([aria-disabled="true"])': {
|
|
203
|
+
boxShadow: "none"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
'&:active:not([aria-disabled="true"])': {
|
|
207
|
+
background: "$background-primary-subtle-active",
|
|
208
|
+
boxShadow: "none",
|
|
209
|
+
color: "$text-primary-active"
|
|
59
210
|
},
|
|
60
211
|
'&[tabindex="0"]': {
|
|
61
212
|
zIndex: "1"
|
|
62
213
|
}
|
|
63
214
|
};
|
|
64
215
|
|
|
65
|
-
const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
66
|
-
|
|
216
|
+
const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
217
|
+
display: "flex",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
justifyContent: "center"
|
|
220
|
+
});
|
|
221
|
+
const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
67
222
|
...itemDefaults,
|
|
68
223
|
[`&[data-state="checked"] ${StyledIndicator}`]: {
|
|
69
224
|
color: "$icon-primary"
|
|
70
225
|
},
|
|
71
|
-
[`&[data-state="checked"]:hover ${StyledIndicator}`]: {
|
|
226
|
+
[`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledIndicator}`]: {
|
|
72
227
|
color: "$icon-primary-hover"
|
|
73
228
|
},
|
|
74
|
-
[
|
|
229
|
+
[`
|
|
230
|
+
&[aria-disabled="true"] ${StyledIndicator},
|
|
231
|
+
&[data-disabled] ${StyledIndicator}
|
|
232
|
+
`]: {
|
|
75
233
|
color: "$icon-neutrals-disabled"
|
|
76
234
|
}
|
|
77
|
-
};
|
|
78
|
-
const StyledCheckboxItem = designSystemStitches.styled(
|
|
79
|
-
RadixDropdownMenu__namespace.CheckboxItem,
|
|
80
|
-
checkboxItemStyles
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const IconSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
84
|
-
display: "flex",
|
|
85
|
-
alignItems: "center",
|
|
86
|
-
marginRight: "$100",
|
|
87
|
-
width: "$6"
|
|
88
|
-
});
|
|
89
|
-
const RightSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
90
|
-
display: "flex",
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
marginLeft: "auto",
|
|
93
|
-
paddingLeft: "$200"
|
|
94
|
-
});
|
|
95
|
-
const ContentSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
96
|
-
display: "flex",
|
|
97
|
-
alignItems: "center"
|
|
98
235
|
});
|
|
99
236
|
|
|
100
|
-
const
|
|
101
|
-
disabled
|
|
102
|
-
|
|
237
|
+
const useAriaDisabled = ({
|
|
238
|
+
"aria-disabled": ariaDisabled,
|
|
239
|
+
onKeyDown,
|
|
103
240
|
onSelect,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
241
|
+
onPointerMove,
|
|
242
|
+
onClick
|
|
243
|
+
}, preventDefault = false) => React.useMemo(
|
|
244
|
+
() => ({
|
|
245
|
+
"aria-disabled": designSystemUtils.booleanify(ariaDisabled) ? ariaDisabled : void 0,
|
|
246
|
+
onKeyDown: (e) => {
|
|
247
|
+
if (designSystemUtils.booleanify(ariaDisabled) && e.code !== "ArrowUp" && e.code !== "ArrowDown") {
|
|
248
|
+
e.preventDefault();
|
|
249
|
+
e.stopPropagation();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
253
|
+
},
|
|
254
|
+
onSelect: (e) => {
|
|
255
|
+
if (preventDefault) {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
}
|
|
258
|
+
if (designSystemUtils.booleanify(ariaDisabled)) {
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
263
|
+
},
|
|
264
|
+
onPointerMove: (e) => {
|
|
265
|
+
if (designSystemUtils.booleanify(ariaDisabled)) {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
onPointerMove == null ? void 0 : onPointerMove(e);
|
|
270
|
+
},
|
|
271
|
+
onClick: (e) => {
|
|
272
|
+
if (designSystemUtils.booleanify(ariaDisabled)) {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
onClick == null ? void 0 : onClick(e);
|
|
277
|
+
}
|
|
278
|
+
}),
|
|
279
|
+
[ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, preventDefault]
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
const Context = React.createContext({
|
|
283
|
+
leftSlotMount: () => {
|
|
284
|
+
},
|
|
285
|
+
leftSlotDestroy: () => {
|
|
114
286
|
}
|
|
115
287
|
});
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
288
|
+
const ItemProvider = ({
|
|
289
|
+
children
|
|
290
|
+
}) => {
|
|
291
|
+
const [hasSlot, setHasSlot] = React.useState(false);
|
|
292
|
+
const leftSlotMount = React.useCallback(() => {
|
|
293
|
+
setHasSlot(true);
|
|
294
|
+
}, []);
|
|
295
|
+
const leftSlotDestroy = React.useCallback(() => {
|
|
296
|
+
setHasSlot(false);
|
|
297
|
+
}, []);
|
|
298
|
+
const formattedChildren = hasSlot ? children : designSystemUtils.addPropsToChildren(children, () => true, {
|
|
299
|
+
"data-no-left-slot": ""
|
|
300
|
+
});
|
|
301
|
+
return /* @__PURE__ */ React__default["default"].createElement(Context.Provider, {
|
|
302
|
+
value: {
|
|
303
|
+
leftSlotMount,
|
|
304
|
+
leftSlotDestroy
|
|
305
|
+
}
|
|
306
|
+
}, formattedChildren);
|
|
307
|
+
};
|
|
308
|
+
const useItem = () => React.useContext(Context);
|
|
309
|
+
|
|
310
|
+
const CheckboxItem = React__default["default"].forwardRef(({ children, checked, onChange, disabled, ...restProps }, forwardRef) => {
|
|
311
|
+
const ariaDisabledProps = useAriaDisabled(restProps, true);
|
|
312
|
+
const { "aria-disabled": ariaDisabled } = ariaDisabledProps;
|
|
313
|
+
return /* @__PURE__ */ React__default["default"].createElement(ItemProvider, null, /* @__PURE__ */ React__default["default"].createElement(StyledCheckboxItem, {
|
|
314
|
+
...restProps,
|
|
315
|
+
...ariaDisabledProps,
|
|
316
|
+
ref: forwardRef,
|
|
317
|
+
checked,
|
|
318
|
+
disabled,
|
|
319
|
+
onCheckedChange: onChange
|
|
320
|
+
}, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledIndicator, null, (disabled === true || designSystemUtils.booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ React__default["default"].createElement(designSystemIcons.IconProhibit, {
|
|
321
|
+
weight: "thin",
|
|
322
|
+
css: { square: "$3", display: "block" }
|
|
323
|
+
}), checked && /* @__PURE__ */ React__default["default"].createElement(designSystemIcons.IconCheckMark, {
|
|
324
|
+
css: { square: "$3", display: "block" }
|
|
325
|
+
})))));
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
const CONTENT_GUTTER = parseInt(designSystemStitches.theme.space[150]);
|
|
129
329
|
const CONTENT_OFFSET = parseInt(designSystemStitches.theme.space[50]);
|
|
130
|
-
const
|
|
330
|
+
const CONTENT_BORDER_FOCUS_ITEM = "2px";
|
|
331
|
+
const CONTENT_PADDING = {
|
|
332
|
+
small: "$50 $150",
|
|
333
|
+
medium: "$150",
|
|
334
|
+
large: "$150 $300"
|
|
335
|
+
};
|
|
131
336
|
const contentDefaults = {
|
|
132
337
|
maxWidth: "$125",
|
|
133
|
-
backgroundColor: "$
|
|
338
|
+
backgroundColor: "$background-neutrals-container",
|
|
134
339
|
borderRadius: "$50",
|
|
135
|
-
padding: `$${GUTTER_TOKEN}`,
|
|
136
340
|
boxShadow: "$50",
|
|
137
|
-
[
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
[`&:has([role="switch"]) > ${ITEM_WITHOUT_RIGHT_SLOT}`]: {
|
|
141
|
-
paddingRight: "56px"
|
|
341
|
+
"& [data-radix-scroll-area-viewport]": {
|
|
342
|
+
padding: `${CONTENT_BORDER_FOCUS_ITEM} $50 ${CONTENT_BORDER_FOCUS_ITEM} ${CONTENT_BORDER_FOCUS_ITEM}`,
|
|
343
|
+
boxSizing: "border-box"
|
|
142
344
|
},
|
|
143
345
|
"@media (prefers-reduced-motion: no-preference)": {
|
|
144
346
|
animationDuration: "150ms",
|
|
@@ -171,7 +373,56 @@ const contentDefaults = {
|
|
|
171
373
|
zIndex: "$dropdownMenu"
|
|
172
374
|
};
|
|
173
375
|
|
|
174
|
-
const StyledContent = designSystemStitches.styled(RadixDropdownMenu__namespace.Content,
|
|
376
|
+
const StyledContent = designSystemStitches.styled(RadixDropdownMenu__namespace.Content, {
|
|
377
|
+
...contentDefaults,
|
|
378
|
+
variants: {
|
|
379
|
+
containerSpacing: {
|
|
380
|
+
small: {
|
|
381
|
+
'&, [role="menu"]': {
|
|
382
|
+
padding: CONTENT_PADDING.small
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
medium: {
|
|
386
|
+
'&, [role="menu"]': {
|
|
387
|
+
padding: CONTENT_PADDING.medium
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
large: {
|
|
391
|
+
'&, [role="menu"]': {
|
|
392
|
+
padding: CONTENT_PADDING.large
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
const ScrollableContent = ({
|
|
400
|
+
children,
|
|
401
|
+
maxHeight,
|
|
402
|
+
overflow,
|
|
403
|
+
containerSpacing
|
|
404
|
+
}) => {
|
|
405
|
+
const getOverflowMaxHeight = React.useCallback(() => {
|
|
406
|
+
const [top, , bottom] = CONTENT_PADDING[containerSpacing].split(" ").map((value) => value.replace("$", ""));
|
|
407
|
+
const topBottom = top !== void 0 && bottom !== void 0 ? `var(--space-${top}) + var(--space-${bottom})` : `var(--space-${top}) + var(--space-${top})`;
|
|
408
|
+
const overflowMaxHeigh = overflow === "auto" ? `calc(var(--radix-dropdown-menu-content-available-height) - (${topBottom}))` : "auto";
|
|
409
|
+
const newMaxHeight = `calc(${maxHeight} - (${topBottom}))`;
|
|
410
|
+
return {
|
|
411
|
+
maxHeight: maxHeight === void 0 ? overflowMaxHeigh : newMaxHeight
|
|
412
|
+
};
|
|
413
|
+
}, [maxHeight, overflow, containerSpacing]);
|
|
414
|
+
if (overflow === "auto") {
|
|
415
|
+
return /* @__PURE__ */ React__default["default"].createElement(designSystemScrollArea.ScrollArea, {
|
|
416
|
+
css: { margin: `-${CONTENT_BORDER_FOCUS_ITEM}` },
|
|
417
|
+
type: "always"
|
|
418
|
+
}, /* @__PURE__ */ React__default["default"].createElement(designSystemScrollArea.ScrollArea.Viewport, {
|
|
419
|
+
css: { ...getOverflowMaxHeight() }
|
|
420
|
+
}, children), /* @__PURE__ */ React__default["default"].createElement(designSystemScrollArea.ScrollArea.Scrollbar, {
|
|
421
|
+
orientation: "vertical"
|
|
422
|
+
}, /* @__PURE__ */ React__default["default"].createElement(designSystemScrollArea.ScrollArea.Thumb, null)));
|
|
423
|
+
}
|
|
424
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
425
|
+
};
|
|
175
426
|
|
|
176
427
|
const Content = React__default["default"].forwardRef(
|
|
177
428
|
({
|
|
@@ -184,8 +435,14 @@ const Content = React__default["default"].forwardRef(
|
|
|
184
435
|
avoidCollisions = true,
|
|
185
436
|
sticky = "partial",
|
|
186
437
|
hideWhenDetached = false,
|
|
438
|
+
containerSpacing = "medium",
|
|
439
|
+
overflow = "visible",
|
|
440
|
+
maxHeight,
|
|
441
|
+
children,
|
|
187
442
|
...restProps
|
|
188
|
-
}, forwardRef) => /* @__PURE__ */ React__default["default"].createElement(
|
|
443
|
+
}, forwardRef) => /* @__PURE__ */ React__default["default"].createElement(ContentProvider, {
|
|
444
|
+
containerSpacing
|
|
445
|
+
}, /* @__PURE__ */ React__default["default"].createElement(StyledContent, {
|
|
189
446
|
...restProps,
|
|
190
447
|
ref: forwardRef,
|
|
191
448
|
loop,
|
|
@@ -196,29 +453,51 @@ const Content = React__default["default"].forwardRef(
|
|
|
196
453
|
avoidCollisions,
|
|
197
454
|
collisionPadding,
|
|
198
455
|
sticky,
|
|
199
|
-
hideWhenDetached
|
|
200
|
-
|
|
456
|
+
hideWhenDetached,
|
|
457
|
+
containerSpacing
|
|
458
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ScrollableContent, {
|
|
459
|
+
...{ containerSpacing, maxHeight, overflow }
|
|
460
|
+
}, children)))
|
|
201
461
|
);
|
|
202
462
|
|
|
203
|
-
const StyledItem = designSystemStitches.styled(RadixDropdownMenu__namespace.Item,
|
|
463
|
+
const StyledItem = designSystemStitches.styled(RadixDropdownMenu__namespace.Item, {
|
|
464
|
+
...itemDefaults,
|
|
465
|
+
variants: {
|
|
466
|
+
hasRightSlot: {
|
|
467
|
+
true: {
|
|
468
|
+
paddingRight: "$600"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
});
|
|
204
473
|
|
|
205
474
|
const Item = React__default["default"].forwardRef(
|
|
206
|
-
({ disabled = false, ...restProps }, forwardRef) =>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
475
|
+
({ disabled = false, ...restProps }, forwardRef) => {
|
|
476
|
+
const ariaDisabledProps = useAriaDisabled(restProps);
|
|
477
|
+
return /* @__PURE__ */ React__default["default"].createElement(ItemProvider, null, /* @__PURE__ */ React__default["default"].createElement(StyledItem, {
|
|
478
|
+
...restProps,
|
|
479
|
+
...ariaDisabledProps,
|
|
480
|
+
disabled,
|
|
481
|
+
ref: forwardRef
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
211
484
|
);
|
|
212
485
|
|
|
213
|
-
const LinkItem = React__default["default"].forwardRef(({ children, href, ...restProps }, forwardRef) =>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
486
|
+
const LinkItem = React__default["default"].forwardRef(({ children, href, ...restProps }, forwardRef) => {
|
|
487
|
+
const ariaDisabledProps = useAriaDisabled(restProps);
|
|
488
|
+
return /* @__PURE__ */ React__default["default"].createElement(Item, {
|
|
489
|
+
asChild: true,
|
|
490
|
+
ref: forwardRef,
|
|
491
|
+
...restProps,
|
|
492
|
+
...ariaDisabledProps
|
|
493
|
+
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
494
|
+
href
|
|
495
|
+
}, children));
|
|
496
|
+
});
|
|
220
497
|
|
|
221
|
-
const StyledRadioGroup = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioGroup
|
|
498
|
+
const StyledRadioGroup = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioGroup, {
|
|
499
|
+
marginY: "$50"
|
|
500
|
+
});
|
|
222
501
|
|
|
223
502
|
const RadioGroup = React__default["default"].forwardRef((props, forwardRef) => {
|
|
224
503
|
const { onChange, ...restProps } = props;
|
|
@@ -229,7 +508,7 @@ const RadioGroup = React__default["default"].forwardRef((props, forwardRef) => {
|
|
|
229
508
|
});
|
|
230
509
|
});
|
|
231
510
|
|
|
232
|
-
const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.
|
|
511
|
+
const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
233
512
|
display: "flex",
|
|
234
513
|
alignItems: "center",
|
|
235
514
|
justifyContent: "center",
|
|
@@ -239,7 +518,7 @@ const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.P
|
|
|
239
518
|
border: "1px solid $border-neutrals",
|
|
240
519
|
borderRadius: "$half"
|
|
241
520
|
});
|
|
242
|
-
const StyledPill = designSystemStitches.styled(designSystemPrimitive.Primitive.
|
|
521
|
+
const StyledPill = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
243
522
|
display: "none",
|
|
244
523
|
width: "$2",
|
|
245
524
|
height: "$2",
|
|
@@ -247,7 +526,7 @@ const StyledPill = designSystemStitches.styled(designSystemPrimitive.Primitive.s
|
|
|
247
526
|
});
|
|
248
527
|
const StyledProhibited = designSystemStitches.styled(designSystemIcons.IconProhibit, {
|
|
249
528
|
display: "none",
|
|
250
|
-
width: "$3"
|
|
529
|
+
width: "$3 !important"
|
|
251
530
|
});
|
|
252
531
|
const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioItem, {
|
|
253
532
|
...itemDefaults,
|
|
@@ -259,37 +538,46 @@ const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace
|
|
|
259
538
|
backgroundColor: "$background-primary-prominent-selected"
|
|
260
539
|
}
|
|
261
540
|
},
|
|
262
|
-
[`&:hover ${StyledRadioContainer}`]: {
|
|
541
|
+
[`&:hover:not([aria-disabled="true"]) ${StyledRadioContainer}`]: {
|
|
263
542
|
borderColor: "$border-primary-hover",
|
|
264
543
|
[`& ${StyledPill}`]: {
|
|
265
544
|
backgroundColor: "$background-primary-prominent-hover"
|
|
266
545
|
}
|
|
267
546
|
},
|
|
268
|
-
[
|
|
547
|
+
[`
|
|
548
|
+
&[aria-disabled="true"] ${StyledRadioContainer},
|
|
549
|
+
&[data-disabled] ${StyledRadioContainer}
|
|
550
|
+
`]: {
|
|
269
551
|
color: "$icon-neutrals-disabled",
|
|
270
552
|
borderColor: "$border-neutrals-disabled",
|
|
271
553
|
[`& ${StyledPill}`]: {
|
|
272
554
|
backgroundColor: "$icon-neutrals-disabled"
|
|
273
555
|
}
|
|
274
556
|
},
|
|
275
|
-
[
|
|
276
|
-
|
|
557
|
+
'&[data-state="unchecked"]': {
|
|
558
|
+
[`
|
|
559
|
+
&[aria-disabled="true"] ${StyledProhibited},
|
|
560
|
+
&[data-disabled] ${StyledProhibited}
|
|
561
|
+
`]: {
|
|
562
|
+
display: "flex"
|
|
563
|
+
}
|
|
277
564
|
}
|
|
278
565
|
});
|
|
279
566
|
|
|
280
|
-
const RadioItem = React__default["default"].forwardRef(({ disabled = false,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
567
|
+
const RadioItem = React__default["default"].forwardRef(({ disabled = false, children, ...restProps }, forwardRef) => {
|
|
568
|
+
const ariaDisabledProps = useAriaDisabled(restProps, true);
|
|
569
|
+
return /* @__PURE__ */ React__default["default"].createElement(ItemProvider, null, /* @__PURE__ */ React__default["default"].createElement(StyledRadioItem, {
|
|
570
|
+
...restProps,
|
|
571
|
+
...ariaDisabledProps,
|
|
572
|
+
disabled,
|
|
573
|
+
ref: forwardRef
|
|
574
|
+
}, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledRadioContainer, null, /* @__PURE__ */ React__default["default"].createElement(StyledPill, null), /* @__PURE__ */ React__default["default"].createElement(StyledProhibited, {
|
|
575
|
+
weight: "thin"
|
|
576
|
+
})))));
|
|
577
|
+
});
|
|
289
578
|
|
|
290
579
|
const StyledSeparator = designSystemStitches.styled(RadixDropdownMenu__namespace.Separator, {
|
|
291
|
-
borderTop: "1px solid
|
|
292
|
-
marginY: "$100"
|
|
580
|
+
borderTop: "1px solid $border-neutrals-subtle"
|
|
293
581
|
});
|
|
294
582
|
|
|
295
583
|
const Separator = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ React__default["default"].createElement(StyledSeparator, {
|
|
@@ -297,33 +585,48 @@ const Separator = React__default["default"].forwardRef((props, forwardRef) => /*
|
|
|
297
585
|
ref: forwardRef
|
|
298
586
|
}));
|
|
299
587
|
|
|
588
|
+
const StyledSwitch = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
589
|
+
...designSystemBaseSwitch.styles.default,
|
|
590
|
+
width: "$7",
|
|
591
|
+
height: "$4"
|
|
592
|
+
});
|
|
593
|
+
const StyledSwitchItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
594
|
+
...itemDefaults,
|
|
595
|
+
[`&[data-state="checked"] ${StyledSwitch}`]: designSystemBaseSwitch.styles.checked,
|
|
596
|
+
[`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: designSystemBaseSwitch.styles.checkedHovered,
|
|
597
|
+
[`&:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: designSystemBaseSwitch.styles.hovered,
|
|
598
|
+
[`
|
|
599
|
+
&[aria-disabled="true"] ${StyledSwitch},
|
|
600
|
+
&[data-disabled] ${StyledSwitch}
|
|
601
|
+
`]: designSystemBaseSwitch.styles.disabled
|
|
602
|
+
});
|
|
603
|
+
|
|
300
604
|
const SwitchItem = React__default["default"].forwardRef(
|
|
301
|
-
({ disabled = false, checked,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
605
|
+
({ disabled = false, checked, onChange, children, ...restProps }, forwardRef) => {
|
|
606
|
+
const ariaDisabledProps = useAriaDisabled(restProps, true);
|
|
607
|
+
return /* @__PURE__ */ React__default["default"].createElement(ItemProvider, null, /* @__PURE__ */ React__default["default"].createElement(StyledSwitchItem, {
|
|
608
|
+
...restProps,
|
|
609
|
+
...ariaDisabledProps,
|
|
610
|
+
disabled,
|
|
611
|
+
checked,
|
|
612
|
+
onCheckedChange: onChange,
|
|
613
|
+
ref: forwardRef
|
|
614
|
+
}, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledSwitch, null, /* @__PURE__ */ React__default["default"].createElement(designSystemBaseSwitch.Thumb, null)))));
|
|
615
|
+
}
|
|
312
616
|
);
|
|
313
617
|
|
|
314
|
-
const defaultStyles = {
|
|
315
|
-
boxSizing: "border-box",
|
|
316
|
-
cursor: "pointer",
|
|
317
|
-
...designSystemStyles.focus.defaults
|
|
318
|
-
};
|
|
319
618
|
const StyledTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.Trigger, {
|
|
320
619
|
variants: {
|
|
321
620
|
unstyled: {
|
|
322
621
|
true: {
|
|
323
622
|
all: "unset",
|
|
324
|
-
|
|
623
|
+
boxSizing: "border-box",
|
|
624
|
+
cursor: "pointer",
|
|
625
|
+
...designSystemStyles.focus.defaults
|
|
325
626
|
},
|
|
326
|
-
false:
|
|
627
|
+
false: {
|
|
628
|
+
cursor: "pointer"
|
|
629
|
+
}
|
|
327
630
|
}
|
|
328
631
|
}
|
|
329
632
|
});
|
|
@@ -336,26 +639,36 @@ const Trigger = React__default["default"].forwardRef(({ asChild = false, onPress
|
|
|
336
639
|
asChild
|
|
337
640
|
}));
|
|
338
641
|
|
|
642
|
+
const StyledIconContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
643
|
+
color: "$icon-neutrals-with-text",
|
|
644
|
+
display: "flex",
|
|
645
|
+
alignItems: "center"
|
|
646
|
+
});
|
|
339
647
|
const StyledSubTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.SubTrigger, {
|
|
340
648
|
...itemDefaults,
|
|
341
|
-
'&[data-state="open"]': itemDefaults[
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
649
|
+
'&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
|
|
650
|
+
[`&[data-state="open"] ${StyledIconContainer}, &:hover:not([aria-disabled="true"]) ${StyledIconContainer}`]: {
|
|
651
|
+
color: "$icon-primary-hover"
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
const SubTrigger = React__default["default"].forwardRef(({ children, disabled = false, ...restProps }, forwardRef) => {
|
|
656
|
+
const { onSelect, ...ariaDisabledProps } = useAriaDisabled({
|
|
657
|
+
onKeyDown: restProps.onKeyDown,
|
|
658
|
+
"aria-disabled": restProps["aria-disabled"]
|
|
659
|
+
});
|
|
660
|
+
return /* @__PURE__ */ React__default["default"].createElement(StyledSubTrigger, {
|
|
661
|
+
...restProps,
|
|
662
|
+
...ariaDisabledProps,
|
|
663
|
+
disabled,
|
|
664
|
+
ref: forwardRef
|
|
665
|
+
}, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledIconContainer, {
|
|
666
|
+
"data-testid": process.env.NODE_ENV === "test" ? "submenu-arrow-icon" : void 0
|
|
667
|
+
}, /* @__PURE__ */ React__default["default"].createElement(designSystemIcons.IconChevronRight, {
|
|
668
|
+
size: "small",
|
|
669
|
+
weight: "thin"
|
|
670
|
+
}))));
|
|
671
|
+
});
|
|
359
672
|
|
|
360
673
|
const StyledSubContent = designSystemStitches.styled(
|
|
361
674
|
RadixDropdownMenu__namespace.SubContent,
|
|
@@ -369,19 +682,29 @@ const SubContent = React__default["default"].forwardRef(
|
|
|
369
682
|
alignOffset = -CONTENT_GUTTER,
|
|
370
683
|
collisionPadding = 0,
|
|
371
684
|
loop = false,
|
|
372
|
-
hideWhenDetached =
|
|
685
|
+
hideWhenDetached = true,
|
|
373
686
|
sticky = "partial",
|
|
687
|
+
overflow = "visible",
|
|
688
|
+
maxHeight,
|
|
689
|
+
children,
|
|
374
690
|
...restProps
|
|
375
|
-
}, forwardRef) =>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
691
|
+
}, forwardRef) => {
|
|
692
|
+
const { containerSpacing } = useContent();
|
|
693
|
+
return /* @__PURE__ */ React__default["default"].createElement(ContentProvider, {
|
|
694
|
+
containerSpacing
|
|
695
|
+
}, /* @__PURE__ */ React__default["default"].createElement(StyledSubContent, {
|
|
696
|
+
...restProps,
|
|
697
|
+
ref: forwardRef,
|
|
698
|
+
sideOffset,
|
|
699
|
+
alignOffset,
|
|
700
|
+
collisionPadding,
|
|
701
|
+
loop,
|
|
702
|
+
hideWhenDetached,
|
|
703
|
+
sticky
|
|
704
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ScrollableContent, {
|
|
705
|
+
...{ containerSpacing, maxHeight, overflow }
|
|
706
|
+
}, children)));
|
|
707
|
+
}
|
|
385
708
|
);
|
|
386
709
|
|
|
387
710
|
const StyledSub = designSystemStitches.styled(RadixDropdownMenu__namespace.Sub, {});
|
|
@@ -407,6 +730,47 @@ const Portal = (props) => /* @__PURE__ */ React__default["default"].createElemen
|
|
|
407
730
|
...props
|
|
408
731
|
});
|
|
409
732
|
|
|
733
|
+
const StyledIconSlot = designSystemStitches.styled(LeftSlot, {
|
|
734
|
+
square: "$5",
|
|
735
|
+
"& svg:not([data-icon-component]), & img:not([data-icon-component])": {
|
|
736
|
+
...designSystemBaseIcon.styles.size.small,
|
|
737
|
+
...designSystemBaseIcon.styles.weight.thin
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
const IconSlot = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
|
|
742
|
+
const { leftSlotMount, leftSlotDestroy } = useItem();
|
|
743
|
+
const formattedChildren = designSystemUtils.addPropsToChildren(
|
|
744
|
+
children,
|
|
745
|
+
designSystemBaseIcon.isIconComponent,
|
|
746
|
+
{
|
|
747
|
+
"data-icon-component": "",
|
|
748
|
+
size: "small",
|
|
749
|
+
weight: "thin"
|
|
750
|
+
}
|
|
751
|
+
);
|
|
752
|
+
React.useEffect(() => {
|
|
753
|
+
leftSlotMount();
|
|
754
|
+
return () => leftSlotDestroy();
|
|
755
|
+
}, [leftSlotMount, leftSlotDestroy]);
|
|
756
|
+
return /* @__PURE__ */ React__default["default"].createElement(StyledIconSlot, {
|
|
757
|
+
ref: forwardRef,
|
|
758
|
+
...restProps
|
|
759
|
+
}, formattedChildren);
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
const IllustrationSlot = React__default["default"].forwardRef((props, forwardRef) => {
|
|
763
|
+
const { leftSlotMount, leftSlotDestroy } = useItem();
|
|
764
|
+
React.useEffect(() => {
|
|
765
|
+
leftSlotMount();
|
|
766
|
+
return () => leftSlotDestroy();
|
|
767
|
+
}, [leftSlotMount, leftSlotDestroy]);
|
|
768
|
+
return /* @__PURE__ */ React__default["default"].createElement(StyledIllustrationSlot, {
|
|
769
|
+
ref: forwardRef,
|
|
770
|
+
...props
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
|
|
410
774
|
const DropdownMenu = ({
|
|
411
775
|
defaultOpen = false,
|
|
412
776
|
direction = "ltr",
|
|
@@ -432,8 +796,11 @@ const DropdownMenu = ({
|
|
|
432
796
|
};
|
|
433
797
|
DropdownMenu.CheckboxItem = CheckboxItem;
|
|
434
798
|
DropdownMenu.Content = Content;
|
|
799
|
+
DropdownMenu.HotkeySlot = HotkeySlot;
|
|
435
800
|
DropdownMenu.IconSlot = IconSlot;
|
|
801
|
+
DropdownMenu.IllustrationSlot = IllustrationSlot;
|
|
436
802
|
DropdownMenu.Item = Item;
|
|
803
|
+
DropdownMenu.ItemDescription = ItemDescription;
|
|
437
804
|
DropdownMenu.LinkItem = LinkItem;
|
|
438
805
|
DropdownMenu.Portal = Portal;
|
|
439
806
|
DropdownMenu.RadioGroup = RadioGroup;
|