@mirohq/design-system-combobox 0.1.0-combobox.3 → 0.1.0-combobox.5

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 CHANGED
@@ -4,17 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var Ariakit = require('@ariakit/react');
7
+ var react = require('@ariakit/react');
8
8
  var designSystemBaseForm = require('@mirohq/design-system-base-form');
9
9
  var RadixPopover = require('@radix-ui/react-popover');
10
10
  var designSystemUtils = require('@mirohq/design-system-utils');
11
- var designSystemIcons = require('@mirohq/design-system-icons');
12
11
  var designSystemStitches = require('@mirohq/design-system-stitches');
13
12
  var designSystemInput = require('@mirohq/design-system-input');
13
+ var designSystemIcons = require('@mirohq/design-system-icons');
14
+ var utils = require('@react-aria/utils');
14
15
  var designSystemUseAriaDisabled = require('@mirohq/design-system-use-aria-disabled');
15
16
  var designSystemStyles = require('@mirohq/design-system-styles');
16
- var designSystemBaseButton = require('@mirohq/design-system-base-button');
17
17
  var designSystemPrimitive = require('@mirohq/design-system-primitive');
18
+ var designSystemBaseButton = require('@mirohq/design-system-base-button');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
21
 
@@ -37,27 +38,40 @@ function _interopNamespace(e) {
37
38
  }
38
39
 
39
40
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
40
- var Ariakit__namespace = /*#__PURE__*/_interopNamespace(Ariakit);
41
41
  var RadixPopover__namespace = /*#__PURE__*/_interopNamespace(RadixPopover);
42
42
 
43
- const StyledActionButton = designSystemStitches.styled(designSystemInput.Input.ActionButton, {
44
- position: "absolute",
45
- right: "$100",
46
- top: "10px"
47
- });
48
43
  const StyledInput = designSystemStitches.styled(designSystemInput.Input, {
49
44
  flexWrap: "wrap",
50
45
  flexGrow: 1,
51
- gap: "$50",
52
- minHeight: "$12",
53
- "&&&": {
54
- height: "max-content",
55
- padding: "$100 $400 $100 $100"
46
+ gap: "0 $50",
47
+ overflowY: "scroll",
48
+ "&[data-valid], &[data-invalid]": {
49
+ // we don't need a bigger padding here as Input component will render its own icon
50
+ paddingRight: "$100"
56
51
  },
57
52
  "& input": {
58
- minWidth: "30px",
53
+ minWidth: "$8",
59
54
  flexBasis: 0,
60
55
  flexGrow: 1
56
+ },
57
+ variants: {
58
+ size: {
59
+ large: {
60
+ minHeight: "$10",
61
+ height: "auto",
62
+ padding: "5px $100",
63
+ paddingRight: "$500"
64
+ },
65
+ "x-large": {
66
+ minHeight: "$12",
67
+ height: "auto",
68
+ padding: "5px $100",
69
+ paddingRight: "$500"
70
+ }
71
+ }
72
+ },
73
+ defaultVariants: {
74
+ size: "large"
61
75
  }
62
76
  });
63
77
 
@@ -68,14 +82,18 @@ const ComboboxProvider = ({
68
82
  valid,
69
83
  value: valueProp,
70
84
  defaultValue: defaultValueProp,
85
+ onSearchValueChange,
86
+ autoFilter = true,
71
87
  ...restProps
72
88
  }) => {
73
89
  const triggerRef = React.useRef(null);
90
+ const inputRef = React.useRef(null);
74
91
  const contentRef = React.useRef(null);
75
- const [openState, setOpenState] = React.useState(defaultOpen);
92
+ const [openState, setOpenState] = React.useState(defaultOpen != null ? defaultOpen : false);
76
93
  const [value, setValue] = React.useState(valueProp != null ? valueProp : []);
77
94
  const [defaultValue, setDefaultValue] = React.useState(defaultValueProp);
78
- const [searchValue, setSearchValue] = React.useState();
95
+ const [filteredItems, setFilteredItems] = React.useState(/* @__PURE__ */ new Set());
96
+ const [searchValue, setSearchValue] = React.useState("");
79
97
  const { valid: formFieldValid } = designSystemBaseForm.useFormFieldContext();
80
98
  return /* @__PURE__ */ jsxRuntime.jsx(
81
99
  ComboboxContext.Provider,
@@ -89,10 +107,15 @@ const ComboboxProvider = ({
89
107
  setValue,
90
108
  setDefaultValue,
91
109
  defaultValue,
110
+ onSearchValueChange,
111
+ triggerRef,
112
+ inputRef,
113
+ contentRef,
114
+ autoFilter,
92
115
  searchValue,
93
116
  setSearchValue,
94
- triggerRef,
95
- contentRef
117
+ filteredItems,
118
+ setFilteredItems
96
119
  },
97
120
  children
98
121
  }
@@ -100,6 +123,47 @@ const ComboboxProvider = ({
100
123
  };
101
124
  const useComboboxContext = () => React.useContext(ComboboxContext);
102
125
 
126
+ const StyledActionButton = designSystemStitches.styled(designSystemInput.Input.ActionButton, {
127
+ position: "absolute",
128
+ right: "$100",
129
+ variants: {
130
+ size: {
131
+ large: {
132
+ top: "5px"
133
+ },
134
+ "x-large": {
135
+ top: "9px"
136
+ }
137
+ }
138
+ },
139
+ defaultVariants: {
140
+ size: "large"
141
+ }
142
+ });
143
+
144
+ const TriggerActionButton = ({
145
+ openActionLabel,
146
+ clearActionLabel,
147
+ size
148
+ }) => {
149
+ const { setOpenState, value, setValue } = useComboboxContext();
150
+ const isEmpty = value.length === 0;
151
+ const ActionButtonIcon = isEmpty ? designSystemIcons.IconChevronDown : designSystemIcons.IconCross;
152
+ const label = isEmpty ? openActionLabel : clearActionLabel;
153
+ const onActionButtonClick = React.useCallback(
154
+ (event) => {
155
+ if (!isEmpty) {
156
+ setValue([]);
157
+ } else {
158
+ setOpenState((prevOpen) => !prevOpen);
159
+ }
160
+ event.stopPropagation();
161
+ },
162
+ [isEmpty, setValue, setOpenState]
163
+ );
164
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledActionButton, { label, size, onClick: onActionButtonClick, children: /* @__PURE__ */ jsxRuntime.jsx(ActionButtonIcon, { size: "small", weight: "thin" }) });
165
+ };
166
+
103
167
  const Trigger = React__default["default"].forwardRef(
104
168
  ({
105
169
  id,
@@ -108,6 +172,9 @@ const Trigger = React__default["default"].forwardRef(
108
172
  "aria-describedby": ariaDescribedBy,
109
173
  "aria-invalid": ariaInvalid,
110
174
  placeholder,
175
+ openActionLabel,
176
+ clearActionLabel,
177
+ onChange,
111
178
  ...restProps
112
179
  }, forwardRef) => {
113
180
  const {
@@ -115,13 +182,20 @@ const Trigger = React__default["default"].forwardRef(
115
182
  valid: comboboxValid,
116
183
  disabled,
117
184
  value,
118
- triggerRef
185
+ triggerRef,
186
+ inputRef,
187
+ onSearchValueChange,
188
+ searchValue,
189
+ setSearchValue
119
190
  } = useComboboxContext();
120
191
  const {
121
192
  formElementId,
122
193
  ariaDescribedBy: formFieldContextDescribedBy,
123
194
  ariaInvalid: formFieldAriaInvalid,
124
- valid: formFieldValid
195
+ valid: formFieldValid,
196
+ label,
197
+ isFloatingLabel,
198
+ focused
125
199
  } = designSystemBaseForm.useFormFieldContext();
126
200
  const valid = formFieldValid != null ? formFieldValid : comboboxValid;
127
201
  const inputProps = {
@@ -136,20 +210,59 @@ const Trigger = React__default["default"].forwardRef(
136
210
  disabled,
137
211
  invalid: designSystemUtils.booleanishAttrValue(valid),
138
212
  id: id != null ? id : formElementId,
139
- placeholder: (value == null ? void 0 : value.length) === 0 ? placeholder : void 0
140
- };
141
- const variants = {
142
- size
213
+ placeholder: value.length === 0 ? placeholder : void 0
143
214
  };
144
- return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Anchor, { ref: designSystemUtils.mergeRefs([triggerRef, forwardRef]), children: /* @__PURE__ */ jsxRuntime.jsx(
145
- Ariakit.Combobox,
146
- {
147
- render: /* @__PURE__ */ jsxRuntime.jsxs(StyledInput, { ...inputProps, ...variants, children: [
148
- children,
149
- /* @__PURE__ */ jsxRuntime.jsx(StyledActionButton, { label: "custom label", children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconChevronDown, { size: "small", weight: "thin" }) })
150
- ] })
215
+ const shouldUseFloatingLabel = label !== null && isFloatingLabel;
216
+ const isFloating = placeholder !== void 0 || value.length !== 0 || focused;
217
+ const scrollIntoView = (event) => {
218
+ var _a;
219
+ const trigger = triggerRef == null ? void 0 : triggerRef.current;
220
+ const baseInput = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.parentElement;
221
+ if (baseInput != null && trigger != null) {
222
+ event.preventDefault();
223
+ baseInput.scrollTo({
224
+ top: trigger.scrollHeight
225
+ });
226
+ }
227
+ if (restProps.onFocus !== void 0) {
228
+ restProps.onFocus(event);
151
229
  }
152
- ) });
230
+ };
231
+ const onInputChange = (e) => {
232
+ setSearchValue(e.target.value);
233
+ onSearchValueChange == null ? void 0 : onSearchValueChange(e.target.value);
234
+ onChange == null ? void 0 : onChange(e);
235
+ };
236
+ return /* @__PURE__ */ jsxRuntime.jsxs(RadixPopover__namespace.Anchor, { ref: designSystemUtils.mergeRefs([triggerRef, forwardRef]), children: [
237
+ shouldUseFloatingLabel && /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseForm.FloatingLabel, { floating: isFloating, size, children: label }),
238
+ /* @__PURE__ */ jsxRuntime.jsx(
239
+ react.Combobox,
240
+ {
241
+ render: /* @__PURE__ */ jsxRuntime.jsxs(
242
+ StyledInput,
243
+ {
244
+ ...inputProps,
245
+ value: searchValue,
246
+ size,
247
+ ref: inputRef,
248
+ onChange: onInputChange,
249
+ onFocus: scrollIntoView,
250
+ children: [
251
+ children,
252
+ /* @__PURE__ */ jsxRuntime.jsx(
253
+ TriggerActionButton,
254
+ {
255
+ openActionLabel,
256
+ clearActionLabel,
257
+ size
258
+ }
259
+ )
260
+ ]
261
+ }
262
+ )
263
+ }
264
+ )
265
+ ] });
153
266
  }
154
267
  );
155
268
 
@@ -160,37 +273,24 @@ const StyledContent = designSystemStitches.styled(RadixPopover__namespace.Conten
160
273
  fontSize: "$175",
161
274
  fontWeight: "normal",
162
275
  lineHeight: "1.5",
163
- minWidth: "var(--radix-popover-trigger-width)",
276
+ width: "var(--radix-popover-trigger-width)",
164
277
  zIndex: "$select",
165
278
  overflowY: "auto",
166
- marginTop: "$200"
279
+ marginTop: "$200",
280
+ padding: "$150",
281
+ boxSizing: "border-box",
282
+ outline: "1px solid transparent"
167
283
  });
168
284
 
169
- const Content = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
170
- const { triggerRef, contentRef } = useComboboxContext();
171
- return /* @__PURE__ */ jsxRuntime.jsx(
172
- StyledContent,
173
- {
174
- ...restProps,
175
- ref: designSystemUtils.mergeRefs([forwardRef, contentRef]),
176
- onOpenAutoFocus: (event) => event.preventDefault(),
177
- onInteractOutside: (event) => {
178
- var _a, _b;
179
- const target = event.target;
180
- const isTrigger = target === triggerRef.current;
181
- const isContent = (_b = target != null && ((_a = contentRef.current) == null ? void 0 : _a.contains(target))) != null ? _b : false;
182
- if (isTrigger || isContent) {
183
- event.preventDefault();
184
- }
185
- },
186
- children
187
- }
188
- );
285
+ const StyledItemCheck = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
286
+ color: "$icon-primary",
287
+ paddingX: "$100"
189
288
  });
190
-
191
- const StyledItem = designSystemStitches.styled(Ariakit.ComboboxItem, {
289
+ const StyledItem = designSystemStitches.styled(react.ComboboxItem, {
192
290
  display: "flex",
193
291
  alignItems: "center",
292
+ justifyContent: "space-between",
293
+ gap: "$200",
194
294
  borderRadius: "$50",
195
295
  boxSizing: "border-box",
196
296
  color: "$text-neutrals",
@@ -199,15 +299,19 @@ const StyledItem = designSystemStitches.styled(Ariakit.ComboboxItem, {
199
299
  lineHeight: 1.5,
200
300
  position: "relative",
201
301
  userSelect: "none",
202
- padding: "6px 0",
203
- paddingInline: "$150 $100",
302
+ paddingX: "$100",
303
+ paddingY: "10px",
204
304
  ...designSystemStyles.focus.css({
205
- boxShadow: "$focus-small",
206
- outline: "1px solid transparent"
305
+ boxShadow: "$focus-small"
207
306
  }),
208
- '&:hover:not([aria-disabled="true"])': {
209
- background: "$background-primary-subtle-hover",
210
- color: "$text-primary-hover"
307
+ '&:not([aria-disabled="true"])': {
308
+ _hover: {
309
+ background: "$background-primary-subtle-hover",
310
+ color: "$text-primary-hover",
311
+ ["".concat(StyledItemCheck)]: {
312
+ color: "$icon-primary-hover"
313
+ }
314
+ }
211
315
  },
212
316
  "&:disabled, &[aria-disabled=true], &[data-disabled]": {
213
317
  cursor: "default",
@@ -218,39 +322,150 @@ const StyledItem = designSystemStitches.styled(Ariakit.ComboboxItem, {
218
322
  const Item = React__default["default"].forwardRef(
219
323
  ({ disabled = false, value, textValue, children, ...restProps }, forwardRef) => {
220
324
  const { "aria-disabled": ariaDisabled, ...restAriaDisabledProps } = designSystemUseAriaDisabled.useAriaDisabled(restProps, { allowArrows: true });
325
+ const { autoFilter, filteredItems, triggerRef, inputRef } = useComboboxContext();
326
+ if (autoFilter !== false && !filteredItems.has(value)) {
327
+ return null;
328
+ }
329
+ const scrollIntoView = (event) => {
330
+ var _a;
331
+ if (((_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.parentElement) != null && (triggerRef == null ? void 0 : triggerRef.current) != null) {
332
+ inputRef.current.parentElement.scrollTo({
333
+ top: triggerRef.current.scrollHeight
334
+ });
335
+ }
336
+ if (restProps.onClick !== void 0) {
337
+ restProps.onClick(event);
338
+ }
339
+ };
221
340
  return /* @__PURE__ */ jsxRuntime.jsxs(
222
341
  StyledItem,
223
342
  {
224
- ...restProps,
225
- ...restAriaDisabledProps,
343
+ ...utils.mergeProps(restProps, restAriaDisabledProps),
226
344
  focusable: true,
227
345
  accessibleWhenDisabled: ariaDisabled === true,
228
346
  disabled: ariaDisabled === true || disabled,
229
347
  ref: forwardRef,
230
348
  value,
349
+ onClick: scrollIntoView,
231
350
  children: [
232
- /* @__PURE__ */ jsxRuntime.jsx(Ariakit__namespace.ComboboxItemCheck, {}),
233
- children
351
+ children,
352
+ /* @__PURE__ */ jsxRuntime.jsx(
353
+ react.ComboboxItemCheck,
354
+ {
355
+ render: ({ style, ...props }) => (
356
+ // AriakitComboboxItemCheck adds its owm inline styles which we want to omit here
357
+ /* @__PURE__ */ jsxRuntime.jsx(StyledItemCheck, { ...props })
358
+ ),
359
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, { size: "small" })
360
+ }
361
+ )
234
362
  ]
235
363
  }
236
364
  );
237
365
  }
238
366
  );
239
367
 
240
- const Portal = (props) => /* @__PURE__ */ jsxRuntime.jsx(RadixPopover.Portal, { ...props });
368
+ const itemType = React__default["default"].createElement(Item).type;
369
+ const getChildrenItemValues = (componentChildren) => {
370
+ const values = [];
371
+ const recurse = (children) => {
372
+ React__default["default"].Children.forEach(children, (child) => {
373
+ if (!React__default["default"].isValidElement(child)) {
374
+ return;
375
+ }
376
+ if (child.type === itemType) {
377
+ const props = child.props;
378
+ values.push(props.value);
379
+ return;
380
+ }
381
+ if (child.props.children) {
382
+ recurse(child.props.children);
383
+ }
384
+ });
385
+ };
386
+ recurse(componentChildren);
387
+ return values;
388
+ };
241
389
 
242
- const StyledGroup = designSystemStitches.styled(Ariakit.Group, {});
390
+ const isInsideRef = (element, ref) => {
391
+ var _a, _b;
392
+ return (_b = element != null && ((_a = ref.current) == null ? void 0 : _a.contains(element))) != null ? _b : false;
393
+ };
394
+ const Content = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
395
+ const {
396
+ triggerRef,
397
+ contentRef,
398
+ autoFilter,
399
+ filteredItems,
400
+ setFilteredItems,
401
+ searchValue,
402
+ noResultsText
403
+ } = useComboboxContext();
404
+ React.useEffect(() => {
405
+ const childrenItemValues = getChildrenItemValues(children);
406
+ setFilteredItems(
407
+ new Set(
408
+ autoFilter === false ? childrenItemValues : childrenItemValues.filter(
409
+ (child) => child.toLowerCase().includes(searchValue.toLowerCase())
410
+ )
411
+ )
412
+ );
413
+ }, [children, autoFilter, setFilteredItems, searchValue]);
414
+ return /* @__PURE__ */ jsxRuntime.jsx(
415
+ StyledContent,
416
+ {
417
+ ...restProps,
418
+ ref: designSystemUtils.mergeRefs([forwardRef, contentRef]),
419
+ onOpenAutoFocus: (event) => event.preventDefault(),
420
+ onInteractOutside: (event) => {
421
+ const target = event.target;
422
+ const isTrigger = isInsideRef(target, triggerRef);
423
+ const isContent = isInsideRef(target, contentRef);
424
+ if (isTrigger || isContent) {
425
+ event.preventDefault();
426
+ }
427
+ },
428
+ children: filteredItems.size === 0 ? noResultsText : children
429
+ }
430
+ );
431
+ });
432
+
433
+ const Portal = (props) => /* @__PURE__ */ jsxRuntime.jsx(RadixPopover.Portal, { ...props });
243
434
 
244
- const Group = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(StyledGroup, { ...props, ref: forwardRef }));
435
+ const Group = React__default["default"].forwardRef(({ children, ...rest }, forwardRef) => {
436
+ const { autoFilter, filteredItems } = useComboboxContext();
437
+ const childValues = React.useMemo(
438
+ // don't perform calculation if auto filter is disabled
439
+ () => autoFilter !== false ? getChildrenItemValues(children) : [],
440
+ [children, autoFilter]
441
+ );
442
+ const hasVisibleChildren = React.useMemo(
443
+ () => (
444
+ // don't perform calculation if auto filter is disabled
445
+ autoFilter !== false ? childValues.some((value) => filteredItems.has(value)) : true
446
+ ),
447
+ [childValues, filteredItems, autoFilter]
448
+ );
449
+ if (!hasVisibleChildren) {
450
+ return null;
451
+ }
452
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Group, { ...rest, ref: forwardRef, children });
453
+ });
245
454
 
246
- const StyledGroupLabel = designSystemStitches.styled(Ariakit.GroupLabel, {});
455
+ const StyledGroupLabel = designSystemStitches.styled(react.GroupLabel, {
456
+ padding: "$100",
457
+ color: "$text-neutrals-subtle",
458
+ fontSize: "$150",
459
+ textTransform: "uppercase",
460
+ fontWeight: 650
461
+ });
247
462
 
248
463
  const GroupLabel = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(StyledGroupLabel, { ...props, ref: forwardRef }));
249
464
 
250
465
  const StyledChip = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
251
466
  fontSize: "$150",
252
467
  padding: "$50 $100",
253
- borderRadius: "$half",
468
+ borderRadius: "$round",
254
469
  display: "flex",
255
470
  alignItems: "center",
256
471
  gap: "$50",
@@ -259,6 +474,12 @@ const StyledChip = designSystemStitches.styled(designSystemPrimitive.Primitive.d
259
474
  background: "$gray-100",
260
475
  color: "$gray-900"
261
476
  });
477
+ const StyledChipButton = designSystemStitches.styled(designSystemBaseButton.BaseButton, {
478
+ ...designSystemStyles.focus.css({
479
+ boxShadow: "$focus-small-outline",
480
+ borderColor: "$blue-400 !important"
481
+ })
482
+ });
262
483
  const StyledChipContent = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
263
484
  textOverflow: "ellipsis",
264
485
  whiteSpace: "nowrap",
@@ -276,11 +497,15 @@ const LeftSlot = StyledLeftSlot;
276
497
  const Chip = React__default["default"].forwardRef(
277
498
  ({ children, disabled = false, onRemove, removeChipAriaLabel, ...restProps }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsxs(StyledChip, { ...restProps, ref: forwardRef, children: [
278
499
  /* @__PURE__ */ jsxRuntime.jsx(StyledChipContent, { children }),
279
- !designSystemUtils.booleanify(disabled) && /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseButton.BaseButton, { onClick: onRemove, "aria-label": removeChipAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCross, { size: "small", weight: "thin", color: "gray-500" }) })
500
+ !designSystemUtils.booleanify(disabled) && /* @__PURE__ */ jsxRuntime.jsx(StyledChipButton, { onClick: onRemove, "aria-label": removeChipAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCross, { size: "small", weight: "thin", color: "gray-500" }) })
280
501
  ] })
281
502
  );
282
503
  Chip.LeftSlot = LeftSlot;
283
504
 
505
+ const StyledValue = designSystemStitches.styled(Chip, {
506
+ marginTop: "$50"
507
+ });
508
+
284
509
  const Value = ({ removeChipAriaLabel }) => {
285
510
  const {
286
511
  value,
@@ -288,16 +513,15 @@ const Value = ({ removeChipAriaLabel }) => {
288
513
  disabled,
289
514
  "aria-disabled": ariaDisabled
290
515
  } = useComboboxContext();
291
- const isEmpty = value === void 0 || value.length === 0;
292
516
  const isDisabled = ariaDisabled === true || disabled;
293
517
  const onItemRemove = (item) => {
294
518
  setValue((prevValue) => prevValue.filter((value2) => value2 !== item));
295
519
  };
296
- if (isEmpty) {
520
+ if (value.length === 0) {
297
521
  return null;
298
522
  }
299
523
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: value.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
300
- Chip,
524
+ StyledValue,
301
525
  {
302
526
  onRemove: () => onItemRemove(item),
303
527
  disabled: isDisabled,
@@ -308,7 +532,18 @@ const Value = ({ removeChipAriaLabel }) => {
308
532
  )) });
309
533
  };
310
534
 
311
- const StyledComboboxContent = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {});
535
+ const StyledSeparator = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
536
+ backgroundColor: "$border-neutrals-subtle",
537
+ height: "1px",
538
+ width: "100%",
539
+ margin: "$100 0"
540
+ });
541
+
542
+ const Separator = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(StyledSeparator, { ...props, ref: forwardRef, "aria-hidden": true }));
543
+
544
+ const StyledComboboxContent = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
545
+ position: "relative"
546
+ });
312
547
 
313
548
  const Root = React__default["default"].forwardRef(({ value: valueProp, onValueChange, children, ...restProps }, forwardRef) => {
314
549
  const {
@@ -344,7 +579,7 @@ const Root = React__default["default"].forwardRef(({ value: valueProp, onValueCh
344
579
  setValue(newValue);
345
580
  };
346
581
  return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Root, { open: openState, onOpenChange: setOpenState, children: /* @__PURE__ */ jsxRuntime.jsx(
347
- Ariakit__namespace.ComboboxProvider,
582
+ react.ComboboxProvider,
348
583
  {
349
584
  open: openState,
350
585
  setOpen: setOpenState,
@@ -366,15 +601,19 @@ const Combobox = React__default["default"].forwardRef(
366
601
  required,
367
602
  value,
368
603
  defaultValue,
604
+ onSearchValueChange,
369
605
  onOpen,
370
606
  onValueChange,
371
607
  direction = "ltr",
608
+ autoFilter = true,
609
+ noResultsText,
372
610
  ...restProps
373
611
  }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(
374
612
  ComboboxProvider,
375
613
  {
376
614
  defaultValue,
377
615
  value,
616
+ onSearchValueChange,
378
617
  defaultOpen,
379
618
  open,
380
619
  valid,
@@ -383,7 +622,17 @@ const Combobox = React__default["default"].forwardRef(
383
622
  readOnly,
384
623
  "aria-disabled": ariaDisabled,
385
624
  direction,
386
- children: /* @__PURE__ */ jsxRuntime.jsx(Root, { ...restProps, value, ref: forwardRef })
625
+ autoFilter,
626
+ noResultsText,
627
+ children: /* @__PURE__ */ jsxRuntime.jsx(
628
+ Root,
629
+ {
630
+ ...restProps,
631
+ noResultsText,
632
+ value,
633
+ ref: forwardRef
634
+ }
635
+ )
387
636
  }
388
637
  )
389
638
  );
@@ -394,7 +643,12 @@ Combobox.Item = Item;
394
643
  Combobox.Group = Group;
395
644
  Combobox.GroupLabel = GroupLabel;
396
645
  Combobox.Value = Value;
646
+ Combobox.Separator = Separator;
647
+
648
+ var types = /*#__PURE__*/Object.freeze({
649
+ __proto__: null
650
+ });
397
651
 
398
- exports.Chip = Chip;
399
652
  exports.Combobox = Combobox;
653
+ exports.ComboboxTypes = types;
400
654
  //# sourceMappingURL=main.js.map