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