@strapi/design-system 1.6.6 → 1.7.0-alpha.1

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.
Files changed (82) hide show
  1. package/README.md +55 -0
  2. package/dist/BaseButton/BaseButton.cjs +1 -1
  3. package/dist/BaseButton/BaseButton.js +1 -1
  4. package/dist/BaseLink/BaseLink.cjs +1 -3
  5. package/dist/BaseLink/BaseLink.js +14 -14
  6. package/dist/Combobox/Combobox.cjs +104 -1
  7. package/dist/Combobox/Combobox.js +348 -278
  8. package/dist/Combobox/ComboboxList.cjs +1 -1
  9. package/dist/Combobox/ComboboxList.js +7 -6
  10. package/dist/Combobox/ComboboxOption.cjs +1 -1
  11. package/dist/Combobox/ComboboxOption.js +3 -29
  12. package/dist/DatePicker/DatePicker.cjs +6 -2
  13. package/dist/DatePicker/DatePicker.js +55 -49
  14. package/dist/DateTimePicker/parseDate.cjs +1 -0
  15. package/dist/DateTimePicker/parseDate.js +8 -0
  16. package/dist/NumberInput/NumberInput.cjs +2 -2
  17. package/dist/NumberInput/NumberInput.js +31 -31
  18. package/dist/Select/MultiSelect.cjs +30 -0
  19. package/dist/Select/MultiSelect.js +239 -0
  20. package/dist/Select/MultiSelectNested.cjs +3 -1
  21. package/dist/Select/MultiSelectNested.js +25 -12
  22. package/dist/Select/OptGroup.cjs +1 -1
  23. package/dist/Select/OptGroup.js +3 -22
  24. package/dist/Select/Option.cjs +1 -45
  25. package/dist/Select/Option.js +12 -100
  26. package/dist/Select/Select.cjs +1 -3
  27. package/dist/Select/Select.js +9 -207
  28. package/dist/Select/SelectList.cjs +1 -1
  29. package/dist/Select/SelectList.js +98 -80
  30. package/dist/Select/SelectParts.cjs +79 -0
  31. package/dist/Select/SelectParts.js +221 -0
  32. package/dist/Select/SingleSelect.cjs +1 -0
  33. package/dist/Select/SingleSelect.js +129 -0
  34. package/dist/Select/index.cjs +1 -1
  35. package/dist/Select/index.js +15 -10
  36. package/dist/TimePicker/TimePicker.cjs +2 -2
  37. package/dist/TimePicker/TimePicker.js +42 -40
  38. package/dist/helpers/objects.cjs +1 -1
  39. package/dist/helpers/objects.js +6 -22
  40. package/dist/hooks/useComposeRefs.cjs +1 -0
  41. package/dist/hooks/useComposeRefs.js +14 -0
  42. package/dist/hooks/useIntersection.cjs +1 -1
  43. package/dist/hooks/useIntersection.js +7 -7
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.js +143 -138
  46. package/dist/themes/extendTheme.cjs +4 -4
  47. package/dist/themes/extendTheme.js +21 -13
  48. package/dist/themes/utils.cjs +6 -6
  49. package/dist/themes/utils.js +7 -6
  50. package/dist/v2/Link/Link.cjs +13 -11
  51. package/dist/v2/Link/Link.js +52 -37
  52. package/dist/v2/SimpleMenu/Menu.cjs +65 -0
  53. package/dist/v2/SimpleMenu/Menu.js +229 -0
  54. package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -33
  55. package/dist/v2/SimpleMenu/SimpleMenu.js +37 -176
  56. package/dist/v2/SimpleMenu/index.cjs +1 -1
  57. package/dist/v2/SimpleMenu/index.js +5 -3
  58. package/dist/v2/index.cjs +1 -1
  59. package/dist/v2/index.js +53 -51
  60. package/package.json +6 -19
  61. package/dist/Combobox/components.cjs +0 -53
  62. package/dist/Combobox/components.js +0 -64
  63. package/dist/Combobox/utils.cjs +0 -1
  64. package/dist/Combobox/utils.js +0 -78
  65. package/dist/Select/SelectButton.cjs +0 -19
  66. package/dist/Select/SelectButton.js +0 -69
  67. package/dist/Select/SelectTags.cjs +0 -6
  68. package/dist/Select/SelectTags.js +0 -38
  69. package/dist/Select/components.cjs +0 -39
  70. package/dist/Select/components.js +0 -48
  71. package/dist/Select/constants.cjs +0 -1
  72. package/dist/Select/constants.js +0 -8
  73. package/dist/Select/hooks/useButtonRef.cjs +0 -1
  74. package/dist/Select/hooks/useButtonRef.js +0 -13
  75. package/dist/Select/hooks/useListRef.cjs +0 -1
  76. package/dist/Select/hooks/useListRef.js +0 -18
  77. package/dist/Select/utils.cjs +0 -1
  78. package/dist/Select/utils.js +0 -17
  79. package/dist/helpers/arrays.cjs +0 -1
  80. package/dist/helpers/arrays.js +0 -6
  81. package/dist/v2/SimpleMenu/utils.cjs +0 -12
  82. package/dist/v2/SimpleMenu/utils.js +0 -15
@@ -1,287 +1,357 @@
1
- import o, { useState as y, useRef as C, useEffect as _, useLayoutEffect as xe, Children as j, cloneElement as ye } from "react";
2
- import { Cross as Ie, CarretDown as Oe } from "@strapi/icons";
3
- import e from "prop-types";
4
- import { ComboboxOption as ke } from "./ComboboxOption.js";
5
- import { MainRow as Me, InputContainer as $e, ValueContainer as we, Input as Le } from "./components.js";
6
- import { filterOptions as q, maintainScrollVisibility as De, getActionFromKey as Re, MenuActions as b, getUpdatedIndex as R } from "./utils.js";
7
- import { Box as Be } from "../Box/Box.js";
8
- import { Field as Fe } from "../Field/Field.js";
9
- import { FieldLabel as Se } from "../Field/FieldLabel.js";
1
+ import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { Cross as re, CarretDown as oe } from "@strapi/icons";
4
+ import { Combobox as t } from "@strapi/ui-primitives";
5
+ import l from "styled-components";
6
+ import { Box as B } from "../Box/Box.js";
7
+ import { Field as te } from "../Field/Field.js";
8
+ import { FieldLabel as ne } from "../Field/FieldLabel.js";
10
9
  import "../Field/FieldInput.js";
11
- import { FieldHint as Te } from "../Field/FieldHint.js";
12
- import { FieldError as Ae } from "../Field/FieldError.js";
10
+ import { FieldHint as le } from "../Field/FieldHint.js";
11
+ import { FieldError as ie } from "../Field/FieldError.js";
13
12
  import "../Field/FieldContext.js";
14
13
  import "../Field/FieldAction.js";
15
- import { Flex as B } from "../Flex/Flex.js";
16
- import { KeyboardKeys as Pe } from "../helpers/keyboardKeys.js";
17
- import { useId as Ve } from "../hooks/useId.js";
18
- import { Loader as Ke } from "../Loader/Loader.js";
19
- import { Popover as Ne } from "../Popover/Popover.js";
20
- import { IconBox as He, CaretBox as Ue } from "../Select/components.js";
21
- import { Typography as z } from "../Typography/Typography.js";
22
- import { VisuallyHidden as _e } from "../VisuallyHidden/VisuallyHidden.js";
23
- const I = ({
24
- children: s,
25
- clearLabel: G,
26
- creatable: h,
27
- createMessage: J,
28
- disabled: c,
29
- error: O,
30
- hasMoreItems: Q,
31
- hint: $,
32
- id: X,
33
- label: E,
34
- labelAction: Y,
35
- loading: w,
36
- loadingMessage: Z,
37
- noOptionsMessage: ee,
38
- onChange: F,
39
- onClear: S,
40
- onCreateOption: te,
41
- onInputChange: T,
42
- onLoadMore: oe,
43
- placeholder: ne,
44
- required: A,
45
- value: d,
46
- ...re
14
+ import { Flex as $ } from "../Flex/Flex.js";
15
+ import { useControllableState as ae } from "../hooks/useControllableState.js";
16
+ import { useId as se } from "../hooks/useId.js";
17
+ import { useIntersection as de } from "../hooks/useIntersection.js";
18
+ import { Loader as ce } from "../Loader/Loader.js";
19
+ import "../themes/lightTheme/index.js";
20
+ import "../themes/darkTheme/index.js";
21
+ import "lodash";
22
+ import { inputFocusStyle as ue } from "../themes/utils.js";
23
+ import { Typography as p } from "../Typography/Typography.js";
24
+ const he = ({
25
+ children: e,
26
+ clearLabel: n = "clear",
27
+ creatable: s = !1,
28
+ createMessage: m = (b) => `Create "${b}"`,
29
+ disabled: d = !1,
30
+ error: c,
31
+ hasMoreItems: O = !1,
32
+ hint: j,
33
+ id: E,
34
+ label: P,
35
+ labelAction: q,
36
+ loading: f = !1,
37
+ loadingMessage: D = "Loading content...",
38
+ noOptionsMessage: H = () => "No results found",
39
+ onChange: C,
40
+ onClear: g,
41
+ onCreateOption: w,
42
+ onInputChange: I,
43
+ onLoadMore: v,
44
+ placeholder: N = "Select or enter a value",
45
+ required: V = !1,
46
+ defaultTextValue: W,
47
+ textValue: z,
48
+ value: L
47
49
  }) => {
48
- const ae = () => s.find((t) => t.props?.value.toLowerCase() === d.toLowerCase()).props?.children, [i, P] = y(0), [ie, le] = y(null), [l, V] = y(s), [u, se] = y(!1), [r, k] = y(""), v = C(), M = C(!1), x = C(), K = C(), ce = C(), N = C(!0), a = Ve(X), pe = `${a}-label`;
49
- if (!E && !re["aria-label"])
50
- throw new Error('The Combobox component needs a "label" or an "aria-label" props');
51
- _(() => {
52
- V(q(s, r));
53
- }, [r, s]), _(() => {
54
- u && v.current && De(v.current);
55
- }, [i, u]), xe(() => {
56
- N.current && (N.current = !1);
57
- }, [d]);
58
- const de = u ? `${a}-${i}` : "", H = () => {
59
- F(null), k("");
60
- }, fe = (t) => {
61
- T && T(t);
62
- const n = x.current.value;
63
- V(q(s, n)), P(0), le(null), r !== n && k(n), u || f(!0, !1);
64
- }, ue = (t) => {
65
- const { key: n } = t, p = h && r ? l.length : l.length - 1, g = Re(n, u);
66
- switch (d && !r && n === Pe.BACKSPACE && H(), g) {
67
- case b.Next: {
68
- if (i === p) {
69
- m(0);
70
- break;
71
- }
72
- m(R(i, p, g));
73
- break;
74
- }
75
- case b.Previous: {
76
- if (i === 0) {
77
- m(p);
78
- break;
79
- }
80
- m(R(i, p, g));
81
- break;
82
- }
83
- case b.Last:
84
- case b.First: {
85
- if (i === p) {
86
- m(0);
87
- break;
88
- }
89
- m(R(i, p, g));
90
- break;
91
- }
92
- case b.CloseSelect:
93
- t.preventDefault(), L(i);
94
- break;
95
- case b.Close:
96
- t.preventDefault(), f(!1);
97
- break;
98
- case b.Open:
99
- f(!0);
100
- break;
101
- }
102
- }, me = (t) => {
103
- if (t.preventDefault(), d && !M.current && k(""), M.current) {
104
- M.current = !1;
105
- return;
50
+ const [b, U] = a.useState(!1), [i, y] = ae({
51
+ prop: z,
52
+ defaultProp: W
53
+ }), [A, R] = a.useState(""), k = a.useRef(null), T = a.useRef(null), G = a.useRef(null), u = se(E), J = (o) => {
54
+ g && !d && (y(""), R(""), g(o), T.current.focus());
55
+ }, K = (o) => {
56
+ U(o);
57
+ }, Q = (o) => {
58
+ y(o);
59
+ }, X = (o) => {
60
+ R(o);
61
+ }, Y = (o) => {
62
+ I && I(o);
63
+ }, Z = (o) => {
64
+ C && C(o);
65
+ }, F = `intersection-${u}`, _ = (o) => {
66
+ v && O && !f && v(o);
67
+ }, S = () => {
68
+ w && i && w(i);
69
+ };
70
+ de(k, _, {
71
+ selectorToWatch: `#${F}`,
72
+ skipWhen: !b
73
+ });
74
+ const M = `${u}-hint`, ee = `${u}-error`;
75
+ return r(te, {
76
+ hint: j,
77
+ error: c,
78
+ id: u,
79
+ required: V,
80
+ children: h($, {
81
+ direction: "column",
82
+ alignItems: "stretch",
83
+ gap: 1,
84
+ children: [r(ne, {
85
+ action: q,
86
+ children: P
87
+ }), h(t.Root, {
88
+ autocomplete: s ? "list" : "both",
89
+ onOpenChange: K,
90
+ onTextValueChange: Q,
91
+ textValue: i,
92
+ allowCustomValue: !0,
93
+ disabled: d,
94
+ required: V,
95
+ value: L,
96
+ onValueChange: Z,
97
+ filterValue: A,
98
+ onFilterValueChange: X,
99
+ children: [h(me, {
100
+ $hasError: Boolean(c),
101
+ children: [r(fe, {
102
+ placeholder: N,
103
+ id: u,
104
+ "aria-invalid": Boolean(c),
105
+ "aria-labelledby": `${M} ${ee}`,
106
+ onChange: Y,
107
+ ref: T
108
+ }), h($, {
109
+ as: "span",
110
+ gap: 3,
111
+ children: [i && g ? r(pe, {
112
+ as: "button",
113
+ hasRadius: !0,
114
+ background: "transparent",
115
+ type: "button",
116
+ onClick: J,
117
+ "aria-disabled": d,
118
+ "aria-label": n,
119
+ title: n,
120
+ ref: G,
121
+ children: r(re, {})
122
+ }) : null, r(ge, {
123
+ children: r(oe, {})
124
+ })]
125
+ })]
126
+ }), r(t.Portal, {
127
+ children: r(be, {
128
+ sideOffset: 4,
129
+ children: h($e, {
130
+ ref: k,
131
+ children: [e, s ? r(t.CreateItem, {
132
+ onPointerUp: S,
133
+ onClick: S,
134
+ asChild: !0,
135
+ children: r(x, {
136
+ children: r(p, {
137
+ children: m(i ?? "")
138
+ })
139
+ })
140
+ }) : null, !s && !f ? r(t.NoValueFound, {
141
+ asChild: !0,
142
+ children: r(x, {
143
+ $hasHover: !1,
144
+ children: r(p, {
145
+ children: H(i ?? "")
146
+ })
147
+ })
148
+ }) : null, f ? r($, {
149
+ justifyContent: "center",
150
+ alignItems: "center",
151
+ paddingTop: 2,
152
+ paddingBottom: 2,
153
+ children: r(ce, {
154
+ small: !0,
155
+ children: D
156
+ })
157
+ }) : null, r(B, {
158
+ id: F,
159
+ width: "100%",
160
+ height: "1px"
161
+ })]
162
+ })
163
+ })
164
+ })]
165
+ }), r(le, {}), r(ie, {})]
166
+ })
167
+ });
168
+ }, ze = (e) => r(he, {
169
+ ...e,
170
+ creatable: !0
171
+ }), pe = l(B)`
172
+ border: none;
173
+
174
+ svg {
175
+ height: ${11 / 16}rem;
176
+ width: ${11 / 16}rem;
177
+ }
178
+
179
+ svg path {
180
+ fill: ${({
181
+ theme: e
182
+ }) => e.colors.neutral600};
183
+ }
184
+ `, me = l(t.Trigger)`
185
+ position: relative;
186
+ border: 1px solid ${({
187
+ theme: e,
188
+ $hasError: n
189
+ }) => n ? e.colors.danger600 : e.colors.neutral200};
190
+ padding-right: ${({
191
+ theme: e
192
+ }) => e.spaces[3]};
193
+ padding-left: ${({
194
+ theme: e
195
+ }) => e.spaces[3]};
196
+ border-radius: ${({
197
+ theme: e
198
+ }) => e.borderRadius};
199
+ background: ${({
200
+ theme: e
201
+ }) => e.colors.neutral0};
202
+ overflow: hidden;
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: space-between;
206
+ gap: ${({
207
+ theme: e
208
+ }) => e.spaces[4]};
209
+
210
+ &[data-disabled] {
211
+ color: ${({
212
+ theme: e
213
+ }) => e.colors.neutral600};
214
+ background: ${({
215
+ theme: e
216
+ }) => e.colors.neutral150};
217
+ cursor: not-allowed;
218
+ }
219
+
220
+ /* Required to ensure the below inputFocusStyles are adhered too */
221
+ &:focus-visible {
222
+ outline: none;
223
+ }
224
+
225
+ ${({
226
+ theme: e,
227
+ $hasError: n
228
+ }) => ue()({
229
+ theme: e,
230
+ hasError: n
231
+ })};
232
+ `, fe = l(t.TextInput)`
233
+ width: 100%;
234
+ font-size: ${14 / 16}rem;
235
+ color: ${({
236
+ theme: e
237
+ }) => e.colors.neutral800};
238
+ min-height: ${40 / 16}rem;
239
+ border: none;
240
+ background-color: transparent;
241
+
242
+ &:focus-visible {
243
+ outline: none;
244
+ }
245
+
246
+ &[aria-disabled='true'] {
247
+ cursor: inherit;
248
+ }
249
+ `, ge = l(t.Icon)`
250
+ & > svg {
251
+ width: ${6 / 16}rem;
252
+
253
+ & > path {
254
+ fill: ${({
255
+ theme: e
256
+ }) => e.colors.neutral600};
106
257
  }
107
- f(!1, !1);
108
- }, m = (t) => {
109
- P(t);
110
- }, be = (t) => {
111
- m(t), L(t);
112
- }, U = () => {
113
- M.current = !0;
114
- }, L = (t) => {
115
- const n = l[t];
116
- if (k(""), n) {
117
- F(n.props.value), f(!1);
118
- return;
258
+ }
259
+
260
+ &[aria-disabled='true'] {
261
+ cursor: inherit;
262
+ }
263
+ `, be = l(t.Content)`
264
+ background: ${({
265
+ theme: e
266
+ }) => e.colors.neutral0};
267
+ box-shadow: ${({
268
+ theme: e
269
+ }) => e.shadows.filterShadow};
270
+ border: 1px solid ${({
271
+ theme: e
272
+ }) => e.colors.neutral150};
273
+ border-radius: ${({
274
+ theme: e
275
+ }) => e.borderRadius};
276
+ width: var(--radix-combobox-trigger-width);
277
+ /* This is from the design-system figma file. */
278
+ max-height: 15rem;
279
+ `, $e = l(t.Viewport)`
280
+ padding: ${({
281
+ theme: e
282
+ }) => e.spaces[1]};
283
+ `, Le = a.forwardRef(({
284
+ children: e,
285
+ value: n,
286
+ disabled: s,
287
+ textValue: m,
288
+ ...d
289
+ }, c) => r(t.ComboboxItem, {
290
+ asChild: !0,
291
+ value: n,
292
+ disabled: s,
293
+ textValue: m,
294
+ children: r(x, {
295
+ ref: c,
296
+ ...d,
297
+ children: r(t.ItemText, {
298
+ asChild: !0,
299
+ children: r(p, {
300
+ children: e
301
+ })
302
+ })
303
+ })
304
+ })), x = l.div`
305
+ width: 100%;
306
+ border: none;
307
+ text-align: left;
308
+ outline-offset: -3px;
309
+ padding: ${({
310
+ theme: e
311
+ }) => e.spaces[2]} ${({
312
+ theme: e
313
+ }) => e.spaces[4]};
314
+ background-color: ${({
315
+ theme: e
316
+ }) => e.colors.neutral0};
317
+ border-radius: ${({
318
+ theme: e
319
+ }) => e.borderRadius};
320
+
321
+ &[data-selected] {
322
+ background-color: ${({
323
+ theme: e
324
+ }) => e.colors.primary100};
325
+
326
+ ${p} {
327
+ color: ${({
328
+ theme: e
329
+ }) => e.colors.primary600};
330
+ font-weight: bold;
119
331
  }
120
- h && (te(r), f(!1));
121
- }, f = (t, n = !0) => {
122
- se(t), n && x.current.focus();
123
- }, ge = j.toArray(l).map((t, n) => {
124
- const p = i === n;
125
- return ye(t, {
126
- id: `${a}-${n}`,
127
- "aria-selected": ie === n,
128
- "aria-posinset": n + 1,
129
- "aria-setsize": j.toArray(l).length,
130
- ref(g) {
131
- p && (v.current = g);
132
- },
133
- onClick: () => be(n),
134
- onMouseDown: U,
135
- isSelected: p
136
- });
137
- }), Ce = () => {
138
- x.current.focus(), S && S(), H();
139
- }, he = () => {
140
- x.current.focus(), f(!0);
141
- }, Ee = () => {
142
- const t = l.findIndex((n) => n.props?.children === r);
143
- return r && t === -1;
144
- }, ve = (t) => {
145
- t.preventDefault(), f(t, !0);
146
- };
147
- let D;
148
- return O ? D = `${a}-error` : $ && (D = `${a}-hint`), /* @__PURE__ */ o.createElement(Fe, { hint: $, error: O, id: a, required: A }, /* @__PURE__ */ o.createElement(_e, { "aria-live": "polite", "aria-atomic": "false", "aria-relevant": "additions text" }, d), /* @__PURE__ */ o.createElement(B, { direction: "column", alignItems: "stretch", gap: E || $ || O ? 1 : 0 }, E && /* @__PURE__ */ o.createElement(Se, { action: Y }, E), /* @__PURE__ */ o.createElement(Me, { ref: K, $disabled: c, hasError: O }, /* @__PURE__ */ o.createElement($e, { wrap: "wrap" }, !r && d && /* @__PURE__ */ o.createElement(we, { id: `${a}-selected-value` }, /* @__PURE__ */ o.createElement(z, null, ae())), /* @__PURE__ */ o.createElement(
149
- Le,
150
- {
151
- "aria-activedescendant": de,
152
- "aria-autocomplete": "list",
153
- "aria-controls": `${a}-listbox`,
154
- "aria-disabled": c,
155
- "aria-expanded": u,
156
- "aria-haspopup": "listbox",
157
- "aria-describedby": D,
158
- autoComplete: "off",
159
- autoCorrect: "off",
160
- id: a,
161
- onBlur: c ? void 0 : me,
162
- onClick: c ? void 0 : ve,
163
- onInput: c ? void 0 : fe,
164
- onKeyDown: c ? void 0 : ue,
165
- placeholder: d ? "" : ne,
166
- readOnly: c,
167
- ref: x,
168
- required: A,
169
- role: "combobox",
170
- spellCheck: "off",
171
- type: "text",
172
- value: r
332
+ }
333
+
334
+ &:hover,
335
+ &[data-highlighted] {
336
+ outline: none;
337
+ background-color: ${({
338
+ theme: e,
339
+ $hasHover: n = !0
340
+ }) => n ? e.colors.primary100 : e.colors.neutral0};
341
+ }
342
+
343
+ &[data-highlighted] {
344
+ ${p} {
345
+ color: ${({
346
+ theme: e
347
+ }) => e.colors.primary600};
348
+ font-weight: bold;
173
349
  }
174
- )), /* @__PURE__ */ o.createElement(B, null, (d || r) && /* @__PURE__ */ o.createElement(
175
- He,
176
- {
177
- id: `${a}-clear`,
178
- "aria-label": G,
179
- disabled: c,
180
- paddingLeft: 3,
181
- as: "button",
182
- onClick: Ce,
183
- type: "button"
184
- },
185
- /* @__PURE__ */ o.createElement(Ie, null)
186
- ), /* @__PURE__ */ o.createElement(
187
- Ue,
188
- {
189
- disabled: c,
190
- paddingLeft: 3,
191
- "aria-hidden": !0,
192
- as: "button",
193
- onClick: he,
194
- tabIndex: -1,
195
- type: "button"
196
- },
197
- /* @__PURE__ */ o.createElement(Oe, null)
198
- ))), /* @__PURE__ */ o.createElement(Te, null), /* @__PURE__ */ o.createElement(Ae, null)), u && /* @__PURE__ */ o.createElement(
199
- Ne,
200
- {
201
- id: `${a}-popover`,
202
- source: K,
203
- spacing: 4,
204
- fullWidth: !0,
205
- intersectionId: `${a}-listbox-popover-intersection`,
206
- onReachEnd: Q && !w ? oe : void 0
207
- },
208
- /* @__PURE__ */ o.createElement(
209
- "div",
210
- {
211
- role: "listbox",
212
- ref: ce,
213
- id: `${a}-listbox`,
214
- "aria-labelledby": E ? pe : void 0
215
- },
216
- (Boolean(l.length) || h) && /* @__PURE__ */ o.createElement(o.Fragment, null, ge, Ee() && h && /* @__PURE__ */ o.createElement(
217
- ke,
218
- {
219
- isSelected: i === l.length,
220
- ref: (t) => {
221
- i === l.length && (v.current = t);
222
- },
223
- onMouseDown: U,
224
- onClick: () => L(),
225
- taindex: 0
226
- },
227
- J(r)
228
- )),
229
- !l.length && !h && !w && /* @__PURE__ */ o.createElement(Be, { paddingLeft: 4, paddingRight: 4, paddingTop: 2, paddingBottom: 2, ref: v }, /* @__PURE__ */ o.createElement(z, { textColor: "neutral800" }, ee(r))),
230
- w && /* @__PURE__ */ o.createElement(B, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2 }, /* @__PURE__ */ o.createElement(Ke, { small: !0 }, Z))
231
- )
232
- ));
233
- }, W = (s) => /* @__PURE__ */ o.createElement(I, { ...s, creatable: !0 });
234
- I.defaultProps = {
235
- "aria-label": void 0,
236
- clearLabel: "clear",
237
- creatable: !1,
238
- createMessage: (s) => `Create "${s}"`,
239
- disabled: !1,
240
- error: void 0,
241
- hasMoreItems: !1,
242
- hint: void 0,
243
- id: void 0,
244
- label: void 0,
245
- loading: !1,
246
- loadingMessage: "Loading content...",
247
- noOptionsMessage: () => "No results found",
248
- onClear: void 0,
249
- onCreateOption: void 0,
250
- onInputChange: void 0,
251
- onLoadMore: void 0,
252
- placeholder: "Select or enter a value",
253
- value: void 0
254
- };
255
- W.defaultProps = I.defaultProps;
256
- I.propTypes = {
257
- "aria-label": e.string,
258
- children: e.oneOfType([e.arrayOf(e.node), e.node]),
259
- clearLabel: e.string,
260
- creatable: e.bool,
261
- createMessage: e.func,
262
- disabled: e.bool,
263
- error: e.string,
264
- hasMoreItems: e.bool,
265
- id: e.string,
266
- hint: e.oneOfType([e.string, e.node, e.arrayOf(e.node)]),
267
- label: e.string,
268
- labelAction: e.element,
269
- loading: e.bool,
270
- loadingMessage: e.string,
271
- noOptionsMessage: e.func,
272
- onChange: e.func.isRequired,
273
- onClear: e.func,
274
- onCreateOption: e.func,
275
- onInputChange: e.func,
276
- onLoadMore: e.func,
277
- placeholder: e.string,
278
- value: e.string
279
- };
280
- W.propTypes = {
281
- ...I.propTypes,
282
- onCreateOption: e.func.isRequired
283
- };
350
+ }
351
+ `;
284
352
  export {
285
- I as Combobox,
286
- W as CreatableCombobox
353
+ he as Combobox,
354
+ ze as CreatableCombobox,
355
+ Le as Option,
356
+ x as OptionBox
287
357
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("prop-types"),r=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},s=r(t),o=({options:e})=>e;o.propTypes={options:s.default.array.isRequired};exports.ComboboxList=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),o=({options:t})=>e.jsx(e.Fragment,{children:t});exports.ComboboxList=o;
@@ -1,8 +1,9 @@
1
- import r from "prop-types";
2
- const p = ({ options: o }) => o;
3
- p.propTypes = {
4
- options: r.array.isRequired
5
- };
1
+ import { jsx as r, Fragment as t } from "react/jsx-runtime";
2
+ const m = ({
3
+ options: o
4
+ }) => r(t, {
5
+ children: o
6
+ });
6
7
  export {
7
- p as ComboboxList
8
+ m as ComboboxList
8
9
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),d=require("prop-types"),i=require("./components.cjs"),s=require("../Typography/Typography.cjs"),n=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},r=n(a),o=n(d),t=a.forwardRef(({isSelected:e,children:p,...u},l)=>r.default.createElement(i.OptionBox,{hasRadius:!0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2,role:"option",background:"neutral0",isSelected:e,ref:l,...u},r.default.createElement(s.Typography,{textColor:e?"primary600":"neutral800",fontWeight:e?"bold":null},p)));t.defaultProps={isSelected:!1};t.propTypes={children:o.default.oneOfType([o.default.string,o.default.number]).isRequired,isSelected:o.default.bool};t.displayName="ComboboxOption";exports.ComboboxOption=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./Combobox.cjs"),e=o.Option;exports.ComboboxOption=e;