@mirohq/design-system-combobox 0.1.0-combobox.6 → 0.1.0-combobox.8
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 +191 -146
- package/dist/main.js.map +1 -1
- package/dist/module.js +194 -149
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +18 -18
- package/package.json +11 -11
package/dist/main.js
CHANGED
|
@@ -6,17 +6,17 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var react = require('@ariakit/react');
|
|
8
8
|
var designSystemBaseForm = require('@mirohq/design-system-base-form');
|
|
9
|
-
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
10
9
|
var RadixPopover = require('@radix-ui/react-popover');
|
|
10
|
+
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
11
11
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
12
12
|
var designSystemInput = require('@mirohq/design-system-input');
|
|
13
13
|
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
14
14
|
var designSystemIcons = require('@mirohq/design-system-icons');
|
|
15
15
|
var designSystemScrollArea = require('@mirohq/design-system-scroll-area');
|
|
16
|
+
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
16
17
|
var utils = require('@react-aria/utils');
|
|
17
18
|
var designSystemUseAriaDisabled = require('@mirohq/design-system-use-aria-disabled');
|
|
18
19
|
var designSystemStyles = require('@mirohq/design-system-styles');
|
|
19
|
-
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
20
20
|
var designSystemBaseButton = require('@mirohq/design-system-base-button');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -42,6 +42,10 @@ function _interopNamespace(e) {
|
|
|
42
42
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
43
|
var RadixPopover__namespace = /*#__PURE__*/_interopNamespace(RadixPopover);
|
|
44
44
|
|
|
45
|
+
const StyledAnchor = designSystemStitches.styled(RadixPopover.Anchor, {
|
|
46
|
+
position: "relative",
|
|
47
|
+
width: "100%"
|
|
48
|
+
});
|
|
45
49
|
const StyledInput = designSystemStitches.styled(designSystemInput.Input, {
|
|
46
50
|
flexWrap: "wrap",
|
|
47
51
|
flexGrow: 1,
|
|
@@ -163,25 +167,48 @@ const StyledActionButton = designSystemStitches.styled(designSystemInput.Input.A
|
|
|
163
167
|
|
|
164
168
|
const TriggerActionButton = ({
|
|
165
169
|
openActionLabel,
|
|
170
|
+
closeActionLabel,
|
|
166
171
|
clearActionLabel,
|
|
167
172
|
size
|
|
168
173
|
}) => {
|
|
169
|
-
const { setOpenState, value = [], setValue } = useComboboxContext();
|
|
174
|
+
const { openState, setOpenState, value = [], setValue } = useComboboxContext();
|
|
170
175
|
const isEmpty = value.length === 0;
|
|
171
|
-
const
|
|
172
|
-
const label = isEmpty ? openActionLabel : clearActionLabel;
|
|
173
|
-
const onActionButtonClick = React.useCallback(
|
|
176
|
+
const onToggleClick = React.useCallback(
|
|
174
177
|
(event) => {
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
} else {
|
|
178
|
-
setOpenState((prevOpen = false) => !prevOpen);
|
|
178
|
+
if (openState) {
|
|
179
|
+
setOpenState(false);
|
|
179
180
|
}
|
|
180
181
|
event.stopPropagation();
|
|
181
182
|
},
|
|
182
|
-
[
|
|
183
|
+
[setOpenState, openState]
|
|
184
|
+
);
|
|
185
|
+
const onClearClick = React.useCallback(
|
|
186
|
+
(event) => {
|
|
187
|
+
setValue([]);
|
|
188
|
+
event.stopPropagation();
|
|
189
|
+
},
|
|
190
|
+
[setValue]
|
|
191
|
+
);
|
|
192
|
+
if (isEmpty) {
|
|
193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover.Trigger, { asChild: true, "aria-haspopup": "listbox", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
StyledActionButton,
|
|
195
|
+
{
|
|
196
|
+
label: openState ? closeActionLabel : openActionLabel,
|
|
197
|
+
size,
|
|
198
|
+
onClick: onToggleClick,
|
|
199
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconChevronDown, { size: "small", weight: "thin" })
|
|
200
|
+
}
|
|
201
|
+
) });
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
204
|
+
StyledActionButton,
|
|
205
|
+
{
|
|
206
|
+
label: clearActionLabel,
|
|
207
|
+
size,
|
|
208
|
+
onClick: onClearClick,
|
|
209
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCross, { size: "small", weight: "thin" })
|
|
210
|
+
}
|
|
183
211
|
);
|
|
184
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledActionButton, { label, size, onClick: onActionButtonClick, children: /* @__PURE__ */ jsxRuntime.jsx(ActionButtonIcon, { size: "small", weight: "thin" }) });
|
|
185
212
|
};
|
|
186
213
|
|
|
187
214
|
const Trigger = React__default["default"].forwardRef(
|
|
@@ -193,8 +220,10 @@ const Trigger = React__default["default"].forwardRef(
|
|
|
193
220
|
"aria-invalid": ariaInvalid,
|
|
194
221
|
placeholder,
|
|
195
222
|
openActionLabel,
|
|
223
|
+
closeActionLabel,
|
|
196
224
|
clearActionLabel,
|
|
197
225
|
onChange,
|
|
226
|
+
css,
|
|
198
227
|
...restProps
|
|
199
228
|
}, forwardRef) => {
|
|
200
229
|
const {
|
|
@@ -202,15 +231,16 @@ const Trigger = React__default["default"].forwardRef(
|
|
|
202
231
|
valid: comboboxValid,
|
|
203
232
|
disabled,
|
|
204
233
|
value = [],
|
|
234
|
+
readOnly,
|
|
205
235
|
triggerRef,
|
|
206
236
|
inputRef,
|
|
207
237
|
onSearchValueChange,
|
|
208
238
|
searchValue,
|
|
209
|
-
setSearchValue
|
|
239
|
+
setSearchValue,
|
|
240
|
+
setOpenState
|
|
210
241
|
} = useComboboxContext();
|
|
211
242
|
const {
|
|
212
243
|
formElementId,
|
|
213
|
-
ariaDescribedBy: formFieldContextDescribedBy,
|
|
214
244
|
ariaInvalid: formFieldAriaInvalid,
|
|
215
245
|
valid: formFieldValid,
|
|
216
246
|
label,
|
|
@@ -222,18 +252,17 @@ const Trigger = React__default["default"].forwardRef(
|
|
|
222
252
|
...restProps,
|
|
223
253
|
"aria-disabled": ariaDisabled,
|
|
224
254
|
"aria-invalid": ariaInvalid != null ? ariaInvalid : formFieldAriaInvalid,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
formFieldContextDescribedBy
|
|
228
|
-
),
|
|
255
|
+
// todo MDS-1011: use formFieldContextDescribedBy after removing form context from BaseInput
|
|
256
|
+
"aria-describedby": ariaDescribedBy,
|
|
229
257
|
valid,
|
|
230
258
|
disabled,
|
|
259
|
+
readOnly,
|
|
231
260
|
invalid: designSystemUtils.booleanishAttrValue(valid),
|
|
232
261
|
id: id != null ? id : formElementId,
|
|
233
262
|
placeholder: value.length === 0 ? placeholder : void 0
|
|
234
263
|
};
|
|
235
264
|
const shouldUseFloatingLabel = label !== null && isFloatingLabel;
|
|
236
|
-
const isFloating = placeholder !== void 0 || value.length !== 0 || focused;
|
|
265
|
+
const isFloating = placeholder !== void 0 || value.length !== 0 || focused || searchValue !== "";
|
|
237
266
|
const scrollIntoView = (event) => {
|
|
238
267
|
var _a;
|
|
239
268
|
const trigger = triggerRef == null ? void 0 : triggerRef.current;
|
|
@@ -253,73 +282,85 @@ const Trigger = React__default["default"].forwardRef(
|
|
|
253
282
|
onSearchValueChange == null ? void 0 : onSearchValueChange(e.target.value);
|
|
254
283
|
onChange == null ? void 0 : onChange(e);
|
|
255
284
|
};
|
|
256
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
285
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
286
|
+
StyledAnchor,
|
|
287
|
+
{
|
|
288
|
+
ref: designSystemUtils.mergeRefs([triggerRef, forwardRef]),
|
|
289
|
+
css,
|
|
290
|
+
onClick: () => {
|
|
291
|
+
if (!designSystemUtils.booleanify(disabled) && !designSystemUtils.booleanify(ariaDisabled) && !designSystemUtils.booleanify(readOnly)) {
|
|
292
|
+
setOpenState(true);
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
children: [
|
|
296
|
+
shouldUseFloatingLabel && /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseForm.FloatingLabel, { floating: isFloating, size, children: label }),
|
|
297
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
298
|
+
react.Combobox,
|
|
263
299
|
{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
300
|
+
render: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
301
|
+
StyledInput,
|
|
302
|
+
{
|
|
303
|
+
...inputProps,
|
|
304
|
+
value: searchValue,
|
|
305
|
+
size,
|
|
306
|
+
ref: inputRef,
|
|
307
|
+
onChange: onInputChange,
|
|
308
|
+
onFocus: scrollIntoView,
|
|
309
|
+
children: [
|
|
310
|
+
children,
|
|
311
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
312
|
+
TriggerActionButton,
|
|
313
|
+
{
|
|
314
|
+
openActionLabel,
|
|
315
|
+
closeActionLabel,
|
|
316
|
+
clearActionLabel,
|
|
317
|
+
size
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
)
|
|
281
323
|
}
|
|
282
324
|
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
);
|
|
286
328
|
}
|
|
287
329
|
);
|
|
288
330
|
|
|
331
|
+
const NoResultPlaceholder = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
332
|
+
padding: "$100"
|
|
333
|
+
});
|
|
289
334
|
const StyledContent = designSystemStitches.styled(RadixPopover__namespace.Content, {
|
|
290
335
|
backgroundColor: "$background-neutrals-container",
|
|
291
336
|
borderRadius: "$50",
|
|
292
337
|
boxShadow: "$50",
|
|
293
338
|
fontSize: "$175",
|
|
294
339
|
fontWeight: "normal",
|
|
295
|
-
lineHeight: "
|
|
340
|
+
lineHeight: "20px",
|
|
296
341
|
width: "var(--radix-popover-trigger-width)",
|
|
297
342
|
zIndex: "$select",
|
|
298
343
|
overflowY: "auto",
|
|
299
|
-
padding: "$
|
|
344
|
+
padding: "$50",
|
|
300
345
|
boxSizing: "border-box",
|
|
301
346
|
outline: "1px solid transparent"
|
|
302
347
|
});
|
|
303
348
|
|
|
304
349
|
const StyledItemCheck = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
305
|
-
color: "$icon-primary"
|
|
306
|
-
paddingX: "$100"
|
|
350
|
+
color: "$icon-primary"
|
|
307
351
|
});
|
|
308
352
|
const StyledItem = designSystemStitches.styled(react.ComboboxItem, {
|
|
309
|
-
display: "
|
|
310
|
-
|
|
311
|
-
justifyContent: "space-between",
|
|
312
|
-
gap: "$200",
|
|
353
|
+
display: "grid",
|
|
354
|
+
gridTemplateColumns: "20px 1fr",
|
|
313
355
|
borderRadius: "$50",
|
|
314
356
|
boxSizing: "border-box",
|
|
315
357
|
color: "$text-neutrals",
|
|
316
358
|
cursor: "pointer",
|
|
317
359
|
fontSize: "$175",
|
|
318
|
-
lineHeight:
|
|
360
|
+
lineHeight: "20px",
|
|
319
361
|
position: "relative",
|
|
320
362
|
userSelect: "none",
|
|
321
|
-
|
|
322
|
-
paddingY: "10px",
|
|
363
|
+
padding: "6px $100 6px $150",
|
|
323
364
|
...designSystemStyles.focus.css({
|
|
324
365
|
boxShadow: "$focus-small"
|
|
325
366
|
}),
|
|
@@ -334,7 +375,13 @@ const StyledItem = designSystemStitches.styled(react.ComboboxItem, {
|
|
|
334
375
|
},
|
|
335
376
|
"&:disabled, &[aria-disabled=true], &[data-disabled]": {
|
|
336
377
|
cursor: "default",
|
|
337
|
-
color: "$text-neutrals-disabled"
|
|
378
|
+
color: "$text-neutrals-disabled",
|
|
379
|
+
["".concat(StyledItemCheck)]: {
|
|
380
|
+
color: "$icon-neutrals-disabled"
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
'&[aria-selected="true"]:not(:disabled,[aria-disabled=true],[data-disabled])': {
|
|
384
|
+
color: "$text-primary-selected"
|
|
338
385
|
}
|
|
339
386
|
});
|
|
340
387
|
|
|
@@ -361,13 +408,13 @@ const Item = React__default["default"].forwardRef(
|
|
|
361
408
|
{
|
|
362
409
|
...utils.mergeProps(restProps, restAriaDisabledProps),
|
|
363
410
|
focusable: true,
|
|
364
|
-
|
|
365
|
-
|
|
411
|
+
hideOnClick: false,
|
|
412
|
+
accessibleWhenDisabled: designSystemUtils.booleanify(ariaDisabled),
|
|
413
|
+
disabled: designSystemUtils.booleanify(ariaDisabled) || disabled,
|
|
366
414
|
ref: forwardRef,
|
|
367
415
|
value,
|
|
368
416
|
onClick: scrollIntoView,
|
|
369
417
|
children: [
|
|
370
|
-
children,
|
|
371
418
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
372
419
|
react.ComboboxItemCheck,
|
|
373
420
|
{
|
|
@@ -383,7 +430,8 @@ const Item = React__default["default"].forwardRef(
|
|
|
383
430
|
}
|
|
384
431
|
)
|
|
385
432
|
}
|
|
386
|
-
)
|
|
433
|
+
),
|
|
434
|
+
children
|
|
387
435
|
]
|
|
388
436
|
}
|
|
389
437
|
);
|
|
@@ -418,7 +466,13 @@ const isInsideRef = (element, ref) => {
|
|
|
418
466
|
return (_b = element != null && ((_a = ref.current) == null ? void 0 : _a.contains(element))) != null ? _b : false;
|
|
419
467
|
};
|
|
420
468
|
const Content = React__default["default"].forwardRef(
|
|
421
|
-
({
|
|
469
|
+
({
|
|
470
|
+
sideOffset = CONTENT_OFFSET,
|
|
471
|
+
maxHeight,
|
|
472
|
+
overflow,
|
|
473
|
+
children,
|
|
474
|
+
...restProps
|
|
475
|
+
}, forwardRef) => {
|
|
422
476
|
const {
|
|
423
477
|
triggerRef,
|
|
424
478
|
contentRef,
|
|
@@ -439,11 +493,13 @@ const Content = React__default["default"].forwardRef(
|
|
|
439
493
|
)
|
|
440
494
|
);
|
|
441
495
|
}, [children, autoFilter, setFilteredItems, searchValue]);
|
|
442
|
-
const content = filteredItems.size === 0 ? noResultsText : children;
|
|
496
|
+
const content = filteredItems.size === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoResultPlaceholder, { children: noResultsText }) : children;
|
|
443
497
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
444
498
|
StyledContent,
|
|
445
499
|
{
|
|
500
|
+
asChild: true,
|
|
446
501
|
...restProps,
|
|
502
|
+
dir: direction,
|
|
447
503
|
sideOffset,
|
|
448
504
|
ref: designSystemUtils.mergeRefs([forwardRef, contentRef]),
|
|
449
505
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
@@ -455,18 +511,18 @@ const Content = React__default["default"].forwardRef(
|
|
|
455
511
|
event.preventDefault();
|
|
456
512
|
}
|
|
457
513
|
},
|
|
458
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystemScrollArea.ScrollArea, { type: "always", dir: direction, children: [
|
|
514
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.ComboboxList, { role: "listbox", children: overflow === "auto" ? /* @__PURE__ */ jsxRuntime.jsxs(designSystemScrollArea.ScrollArea, { type: "always", dir: direction, children: [
|
|
459
515
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
460
516
|
designSystemScrollArea.ScrollArea.Viewport,
|
|
461
517
|
{
|
|
462
518
|
availableHeight: "var(--radix-popover-content-available-height)",
|
|
463
|
-
verticalGap: "
|
|
519
|
+
verticalGap: "var(--space-50) * 2",
|
|
464
520
|
maxHeight,
|
|
465
521
|
children: content
|
|
466
522
|
}
|
|
467
523
|
),
|
|
468
524
|
/* @__PURE__ */ jsxRuntime.jsx(designSystemScrollArea.ScrollArea.Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsxRuntime.jsx(designSystemScrollArea.ScrollArea.Thumb, {}) })
|
|
469
|
-
] })
|
|
525
|
+
] }) : content })
|
|
470
526
|
}
|
|
471
527
|
);
|
|
472
528
|
}
|
|
@@ -474,6 +530,8 @@ const Content = React__default["default"].forwardRef(
|
|
|
474
530
|
|
|
475
531
|
const Portal = (props) => /* @__PURE__ */ jsxRuntime.jsx(RadixPopover.Portal, { ...props });
|
|
476
532
|
|
|
533
|
+
const StyledGroup = designSystemStitches.styled(react.Group);
|
|
534
|
+
|
|
477
535
|
const Group = React__default["default"].forwardRef(({ children, ...rest }, forwardRef) => {
|
|
478
536
|
const { autoFilter, filteredItems } = useComboboxContext();
|
|
479
537
|
const childValues = React.useMemo(
|
|
@@ -491,15 +549,12 @@ const Group = React__default["default"].forwardRef(({ children, ...rest }, forwa
|
|
|
491
549
|
if (!hasVisibleChildren) {
|
|
492
550
|
return null;
|
|
493
551
|
}
|
|
494
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
552
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledGroup, { ...rest, ref: forwardRef, children });
|
|
495
553
|
});
|
|
496
554
|
|
|
497
555
|
const StyledGroupLabel = designSystemStitches.styled(react.GroupLabel, {
|
|
498
|
-
padding: "$100",
|
|
499
|
-
color: "$text-neutrals-subtle"
|
|
500
|
-
fontSize: "$150",
|
|
501
|
-
textTransform: "uppercase",
|
|
502
|
-
fontWeight: 650
|
|
556
|
+
padding: "6px $100",
|
|
557
|
+
color: "$text-neutrals-subtle"
|
|
503
558
|
});
|
|
504
559
|
|
|
505
560
|
const GroupLabel = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(StyledGroupLabel, { ...props, ref: forwardRef }));
|
|
@@ -513,13 +568,13 @@ const StyledChip = designSystemStitches.styled(designSystemPrimitive.Primitive.d
|
|
|
513
568
|
gap: "$50",
|
|
514
569
|
whiteSpace: "nowrap",
|
|
515
570
|
maxWidth: "$35",
|
|
516
|
-
|
|
517
|
-
color: "$
|
|
571
|
+
backgroundColor: "$background-neutrals-subtle",
|
|
572
|
+
color: "$text-neutrals"
|
|
518
573
|
});
|
|
519
574
|
const StyledChipButton = designSystemStitches.styled(designSystemBaseButton.BaseButton, {
|
|
575
|
+
color: "$icon-neutrals-inactive",
|
|
520
576
|
...designSystemStyles.focus.css({
|
|
521
|
-
boxShadow: "$focus-small-outline"
|
|
522
|
-
borderColor: "$blue-400 !important"
|
|
577
|
+
boxShadow: "$focus-small-outline"
|
|
523
578
|
})
|
|
524
579
|
});
|
|
525
580
|
const StyledChipContent = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
@@ -537,9 +592,9 @@ const StyledLeftSlot = designSystemStitches.styled(designSystemPrimitive.Primiti
|
|
|
537
592
|
const LeftSlot = StyledLeftSlot;
|
|
538
593
|
|
|
539
594
|
const Chip = React__default["default"].forwardRef(
|
|
540
|
-
({ children, disabled = false, onRemove,
|
|
595
|
+
({ children, disabled = false, onRemove, removeAriaLabel, ...restProps }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsxs(StyledChip, { ...restProps, ref: forwardRef, children: [
|
|
541
596
|
/* @__PURE__ */ jsxRuntime.jsx(StyledChipContent, { children }),
|
|
542
|
-
!designSystemUtils.booleanify(disabled) && /* @__PURE__ */ jsxRuntime.jsx(StyledChipButton, { onClick: onRemove, "aria-label":
|
|
597
|
+
!designSystemUtils.booleanify(disabled) && /* @__PURE__ */ jsxRuntime.jsx(StyledChipButton, { onClick: onRemove, "aria-label": removeAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCross, { size: "small", weight: "thin", "aria-hidden": true }) })
|
|
543
598
|
] })
|
|
544
599
|
);
|
|
545
600
|
Chip.LeftSlot = LeftSlot;
|
|
@@ -548,7 +603,7 @@ const StyledValue = designSystemStitches.styled(Chip, {
|
|
|
548
603
|
marginTop: "$50"
|
|
549
604
|
});
|
|
550
605
|
|
|
551
|
-
const Value = ({
|
|
606
|
+
const Value = ({ unselectAriaLabel }) => {
|
|
552
607
|
const {
|
|
553
608
|
value = [],
|
|
554
609
|
setValue,
|
|
@@ -567,7 +622,7 @@ const Value = ({ removeChipAriaLabel }) => {
|
|
|
567
622
|
{
|
|
568
623
|
onRemove: () => onItemRemove(item),
|
|
569
624
|
disabled: isDisabled,
|
|
570
|
-
|
|
625
|
+
removeAriaLabel: "".concat(unselectAriaLabel, " ").concat(item),
|
|
571
626
|
"data-testid": process.env.NODE_ENV === "test" ? "combobox-value-".concat(item) : void 0,
|
|
572
627
|
children: item
|
|
573
628
|
},
|
|
@@ -590,12 +645,11 @@ const Separator = React__default["default"].forwardRef((props, forwardRef) => {
|
|
|
590
645
|
return /* @__PURE__ */ jsxRuntime.jsx(StyledSeparator, { ...props, ref: forwardRef, "aria-hidden": true });
|
|
591
646
|
});
|
|
592
647
|
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const Root = React__default["default"].forwardRef(({ value: valueProp, onValueChange, children, ...restProps }, forwardRef) => {
|
|
648
|
+
const Root = ({
|
|
649
|
+
value: valueProp,
|
|
650
|
+
children,
|
|
651
|
+
...restProps
|
|
652
|
+
}) => {
|
|
599
653
|
const {
|
|
600
654
|
openState,
|
|
601
655
|
setOpenState,
|
|
@@ -605,8 +659,7 @@ const Root = React__default["default"].forwardRef(({ value: valueProp, onValueCh
|
|
|
605
659
|
required,
|
|
606
660
|
readOnly,
|
|
607
661
|
"aria-disabled": ariaDisabled,
|
|
608
|
-
disabled
|
|
609
|
-
direction
|
|
662
|
+
disabled
|
|
610
663
|
} = useComboboxContext();
|
|
611
664
|
const { setRequired, setDisabled, setAriaDisabled, setReadOnly } = designSystemBaseForm.useFormFieldContext();
|
|
612
665
|
React.useEffect(() => {
|
|
@@ -627,78 +680,70 @@ const Root = React__default["default"].forwardRef(({ value: valueProp, onValueCh
|
|
|
627
680
|
const onSetSelectedValue = (newValue) => {
|
|
628
681
|
setValue(typeof newValue === "string" ? [newValue] : newValue);
|
|
629
682
|
};
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
if (!designSystemUtils.booleanify(disabled)) {
|
|
634
|
-
setOpenState(true);
|
|
635
|
-
}
|
|
636
|
-
if (restProps.onClick !== void 0) {
|
|
637
|
-
restProps.onClick(event);
|
|
638
|
-
}
|
|
683
|
+
const onOpenChange = (value2) => {
|
|
684
|
+
if (!designSystemUtils.booleanify(readOnly)) {
|
|
685
|
+
setOpenState(value2);
|
|
639
686
|
}
|
|
640
687
|
};
|
|
641
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
-
|
|
688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
RadixPopover__namespace.Root,
|
|
643
690
|
{
|
|
644
691
|
open: openState,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
selectedValue: value,
|
|
648
|
-
setSelectedValue: onSetSelectedValue,
|
|
692
|
+
onOpenChange,
|
|
693
|
+
...restProps,
|
|
649
694
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
650
|
-
|
|
695
|
+
react.ComboboxProvider,
|
|
651
696
|
{
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
697
|
+
open: openState,
|
|
698
|
+
setOpen: onOpenChange,
|
|
699
|
+
defaultSelectedValue: defaultValue,
|
|
700
|
+
selectedValue: value,
|
|
701
|
+
setSelectedValue: onSetSelectedValue,
|
|
655
702
|
children
|
|
656
703
|
}
|
|
657
704
|
)
|
|
658
705
|
}
|
|
659
|
-
)
|
|
660
|
-
}
|
|
661
|
-
const Combobox =
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
706
|
+
);
|
|
707
|
+
};
|
|
708
|
+
const Combobox = ({
|
|
709
|
+
"aria-disabled": ariaDisabled,
|
|
710
|
+
defaultOpen = false,
|
|
711
|
+
open,
|
|
712
|
+
valid,
|
|
713
|
+
disabled,
|
|
714
|
+
readOnly,
|
|
715
|
+
required,
|
|
716
|
+
value,
|
|
717
|
+
defaultValue,
|
|
718
|
+
onOpen,
|
|
719
|
+
onClose,
|
|
720
|
+
onSearchValueChange,
|
|
721
|
+
onValueChange,
|
|
722
|
+
direction = "ltr",
|
|
723
|
+
autoFilter = true,
|
|
724
|
+
noResultsText,
|
|
725
|
+
...restProps
|
|
726
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
727
|
+
ComboboxProvider,
|
|
728
|
+
{
|
|
729
|
+
defaultValue,
|
|
730
|
+
value,
|
|
731
|
+
onValueChange,
|
|
732
|
+
onSearchValueChange,
|
|
733
|
+
defaultOpen,
|
|
665
734
|
open,
|
|
735
|
+
onOpen,
|
|
736
|
+
onClose,
|
|
666
737
|
valid,
|
|
738
|
+
required,
|
|
667
739
|
disabled,
|
|
668
740
|
readOnly,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
onOpen,
|
|
673
|
-
onClose,
|
|
674
|
-
onSearchValueChange,
|
|
675
|
-
onValueChange,
|
|
676
|
-
direction = "ltr",
|
|
677
|
-
autoFilter = true,
|
|
741
|
+
"aria-disabled": ariaDisabled,
|
|
742
|
+
direction,
|
|
743
|
+
autoFilter,
|
|
678
744
|
noResultsText,
|
|
679
|
-
...restProps
|
|
680
|
-
}
|
|
681
|
-
ComboboxProvider,
|
|
682
|
-
{
|
|
683
|
-
defaultValue,
|
|
684
|
-
value,
|
|
685
|
-
onValueChange,
|
|
686
|
-
onSearchValueChange,
|
|
687
|
-
defaultOpen,
|
|
688
|
-
open,
|
|
689
|
-
onOpen,
|
|
690
|
-
onClose,
|
|
691
|
-
valid,
|
|
692
|
-
required,
|
|
693
|
-
disabled,
|
|
694
|
-
readOnly,
|
|
695
|
-
"aria-disabled": ariaDisabled,
|
|
696
|
-
direction,
|
|
697
|
-
autoFilter,
|
|
698
|
-
noResultsText,
|
|
699
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Root, { ...restProps, value, ref: forwardRef })
|
|
700
|
-
}
|
|
701
|
-
)
|
|
745
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Root, { ...restProps, value })
|
|
746
|
+
}
|
|
702
747
|
);
|
|
703
748
|
Combobox.Portal = Portal;
|
|
704
749
|
Combobox.Trigger = Trigger;
|