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