@brycks/core-front 0.3.6 → 0.6.0

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 (119) hide show
  1. package/dist/components/data/List/List.cjs +1 -1
  2. package/dist/components/data/List/List.cjs.map +1 -1
  3. package/dist/components/data/List/List.js +68 -148
  4. package/dist/components/data/List/List.js.map +1 -1
  5. package/dist/components/data/Table/Table.cjs +1 -1
  6. package/dist/components/data/Table/Table.cjs.map +1 -1
  7. package/dist/components/data/Table/Table.js +148 -217
  8. package/dist/components/data/Table/Table.js.map +1 -1
  9. package/dist/components/data/TreeView/TreeView.cjs +1 -1
  10. package/dist/components/data/TreeView/TreeView.cjs.map +1 -1
  11. package/dist/components/data/TreeView/TreeView.js +141 -182
  12. package/dist/components/data/TreeView/TreeView.js.map +1 -1
  13. package/dist/components/data.cjs +1 -1
  14. package/dist/components/data.js +23 -21
  15. package/dist/components/feedback/Banner/Banner.cjs +2 -0
  16. package/dist/components/feedback/Banner/Banner.cjs.map +1 -0
  17. package/dist/components/feedback/Banner/Banner.js +77 -0
  18. package/dist/components/feedback/Banner/Banner.js.map +1 -0
  19. package/dist/components/feedback/ConfirmDialog/ConfirmDialog.cjs +2 -0
  20. package/dist/components/feedback/ConfirmDialog/ConfirmDialog.cjs.map +1 -0
  21. package/dist/components/feedback/ConfirmDialog/ConfirmDialog.js +68 -0
  22. package/dist/components/feedback/ConfirmDialog/ConfirmDialog.js.map +1 -0
  23. package/dist/components/feedback/Drawer/Drawer.cjs +1 -22
  24. package/dist/components/feedback/Drawer/Drawer.cjs.map +1 -1
  25. package/dist/components/feedback/Drawer/Drawer.js +84 -184
  26. package/dist/components/feedback/Drawer/Drawer.js.map +1 -1
  27. package/dist/components/feedback/Modal/Modal.cjs +1 -1
  28. package/dist/components/feedback/Modal/Modal.cjs.map +1 -1
  29. package/dist/components/feedback/Modal/Modal.js +73 -150
  30. package/dist/components/feedback/Modal/Modal.js.map +1 -1
  31. package/dist/components/feedback/Popover/Popover.cjs +2 -2
  32. package/dist/components/feedback/Popover/Popover.cjs.map +1 -1
  33. package/dist/components/feedback/Popover/Popover.js +43 -44
  34. package/dist/components/feedback/Popover/Popover.js.map +1 -1
  35. package/dist/components/feedback/Toast/Toast.cjs +1 -10
  36. package/dist/components/feedback/Toast/Toast.cjs.map +1 -1
  37. package/dist/components/feedback/Toast/Toast.js +94 -187
  38. package/dist/components/feedback/Toast/Toast.js.map +1 -1
  39. package/dist/components/feedback.cjs +1 -1
  40. package/dist/components/feedback.js +17 -13
  41. package/dist/components/feedback.js.map +1 -1
  42. package/dist/components/form/Checkbox/Checkbox.cjs +1 -1
  43. package/dist/components/form/Checkbox/Checkbox.js +11 -11
  44. package/dist/components/form/Combobox/Combobox.cjs +1 -6
  45. package/dist/components/form/Combobox/Combobox.cjs.map +1 -1
  46. package/dist/components/form/Combobox/Combobox.js +190 -266
  47. package/dist/components/form/Combobox/Combobox.js.map +1 -1
  48. package/dist/components/form/Input/Input.cjs +1 -1
  49. package/dist/components/form/Input/Input.cjs.map +1 -1
  50. package/dist/components/form/Input/Input.js +38 -133
  51. package/dist/components/form/Input/Input.js.map +1 -1
  52. package/dist/components/form/SearchInput/SearchInput.cjs +2 -0
  53. package/dist/components/form/SearchInput/SearchInput.cjs.map +1 -0
  54. package/dist/components/form/SearchInput/SearchInput.js +68 -0
  55. package/dist/components/form/SearchInput/SearchInput.js.map +1 -0
  56. package/dist/components/form/Select/Select.cjs +1 -1
  57. package/dist/components/form/Select/Select.cjs.map +1 -1
  58. package/dist/components/form/Select/Select.js +36 -82
  59. package/dist/components/form/Select/Select.js.map +1 -1
  60. package/dist/components/form/TagInput/TagInput.cjs +1 -1
  61. package/dist/components/form/TagInput/TagInput.js +8 -8
  62. package/dist/components/form/Textarea/Textarea.cjs +1 -1
  63. package/dist/components/form/Textarea/Textarea.cjs.map +1 -1
  64. package/dist/components/form/Textarea/Textarea.js +61 -95
  65. package/dist/components/form/Textarea/Textarea.js.map +1 -1
  66. package/dist/components/form.cjs +1 -1
  67. package/dist/components/form.js +15 -13
  68. package/dist/components/form.js.map +1 -1
  69. package/dist/components/layout/Card/Card.cjs +1 -1
  70. package/dist/components/layout/Card/Card.cjs.map +1 -1
  71. package/dist/components/layout/Card/Card.js +7 -5
  72. package/dist/components/layout/Card/Card.js.map +1 -1
  73. package/dist/components/navigation/ContextMenu/ContextMenu.cjs +1 -1
  74. package/dist/components/navigation/ContextMenu/ContextMenu.js +9 -9
  75. package/dist/components/navigation/Menu/Menu.cjs +1 -1
  76. package/dist/components/navigation/Menu/Menu.cjs.map +1 -1
  77. package/dist/components/navigation/Menu/Menu.js +70 -135
  78. package/dist/components/navigation/Menu/Menu.js.map +1 -1
  79. package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
  80. package/dist/components/navigation/Pagination/Pagination.cjs.map +1 -1
  81. package/dist/components/navigation/Pagination/Pagination.js +87 -157
  82. package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
  83. package/dist/components/navigation/SegmentedControl/SegmentedControl.cjs +2 -0
  84. package/dist/components/navigation/SegmentedControl/SegmentedControl.cjs.map +1 -0
  85. package/dist/components/navigation/SegmentedControl/SegmentedControl.js +90 -0
  86. package/dist/components/navigation/SegmentedControl/SegmentedControl.js.map +1 -0
  87. package/dist/components/navigation.cjs +1 -1
  88. package/dist/components/navigation.js +25 -23
  89. package/dist/components/navigation.js.map +1 -1
  90. package/dist/components/utility/Avatar/Avatar.cjs +1 -1
  91. package/dist/components/utility/Avatar/Avatar.cjs.map +1 -1
  92. package/dist/components/utility/Avatar/Avatar.js +18 -18
  93. package/dist/components/utility/Avatar/Avatar.js.map +1 -1
  94. package/dist/components/utility/Badge/Badge.cjs +1 -1
  95. package/dist/components/utility/Badge/Badge.cjs.map +1 -1
  96. package/dist/components/utility/Badge/Badge.js +31 -23
  97. package/dist/components/utility/Badge/Badge.js.map +1 -1
  98. package/dist/components/utility/Kbd/Kbd.cjs +2 -0
  99. package/dist/components/utility/Kbd/Kbd.cjs.map +1 -0
  100. package/dist/components/utility/Kbd/Kbd.js +20 -0
  101. package/dist/components/utility/Kbd/Kbd.js.map +1 -0
  102. package/dist/components/utility/Logo/Logo.cjs +1 -1
  103. package/dist/components/utility/Logo/Logo.cjs.map +1 -1
  104. package/dist/components/utility/Logo/Logo.js +19 -19
  105. package/dist/components/utility/Logo/Logo.js.map +1 -1
  106. package/dist/components/utility.cjs +1 -1
  107. package/dist/components/utility.js +9 -7
  108. package/dist/components/utility.js.map +1 -1
  109. package/dist/data.d.ts +34 -1
  110. package/dist/feedback.d.ts +67 -2
  111. package/dist/form.d.ts +31 -0
  112. package/dist/index.cjs +1 -1
  113. package/dist/index.d.ts +184 -3
  114. package/dist/index.js +177 -165
  115. package/dist/index.js.map +1 -1
  116. package/dist/navigation.d.ts +39 -0
  117. package/dist/styles.css +1 -1
  118. package/dist/utility.d.ts +19 -0
  119. package/package.json +1 -1
@@ -1,338 +1,262 @@
1
- import { jsxs as v, jsx as o, Fragment as ke } from "react/jsx-runtime";
2
- import { forwardRef as we, useState as g, useRef as j, useMemo as X, useEffect as I, useCallback as L } from "react";
3
- import { createPortal as xe } from "react-dom";
4
- import { cx as Se } from "../../../utils/styles.js";
5
- import { useId as Ce } from "../../../hooks/useId.js";
6
- import { durations as w, easings as x } from "../../../design-system/tokens/motion.js";
7
- import { iconSizes as B, componentPaddingX as E, componentHeights as P, componentGap as $e } from "../../../design-system/primitives/sizing.js";
8
- import { fontSizes as R } from "../../../design-system/tokens/typography.js";
9
- import { spacing as d } from "../../../design-system/tokens/spacing.js";
10
- const ze = {
11
- sm: { height: P.sm, fontSize: R.base - 1, padding: E.sm, iconSize: B.sm },
12
- md: { height: P.md, fontSize: R.base, padding: E.md, iconSize: B.md },
13
- lg: { height: P.lg, fontSize: R.md, padding: E.lg, iconSize: B.lg }
14
- }, Ie = (S, f) => {
15
- const c = f.toLowerCase();
16
- return S.label.toLowerCase().includes(c) || S.value.toLowerCase().includes(c) || (S.description?.toLowerCase().includes(c) ?? !1);
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as ne, useState as k, useRef as D, useMemo as j, useEffect as C, useCallback as N } from "react";
3
+ import { createPortal as se } from "react-dom";
4
+ import { cx as g } from "../../../utils/styles.js";
5
+ import { useId as ce } from "../../../hooks/useId.js";
6
+ import { spacing as ie } from "../../../design-system/tokens/spacing.js";
7
+ const ae = (v, b) => {
8
+ const a = b.toLowerCase();
9
+ return v.label.toLowerCase().includes(a) || v.value.toLowerCase().includes(a) || (v.description?.toLowerCase().includes(a) ?? !1);
17
10
  };
18
- function Le() {
19
- return /* @__PURE__ */ o("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
11
+ function le() {
12
+ return /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
20
13
  }
21
- function Ee() {
22
- return /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M4 4l6 6M10 4l-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
14
+ function de() {
15
+ return /* @__PURE__ */ t("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M4 4l6 6M10 4l-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
23
16
  }
24
- const Re = we(function({
25
- options: f,
26
- value: c,
27
- defaultValue: G = null,
28
- onChange: W,
29
- onInputChange: F,
30
- placeholder: U = "Select or search...",
31
- size: T = "md",
32
- disabled: b = !1,
33
- isInvalid: A = !1,
34
- required: J = !1,
35
- clearable: Q = !0,
36
- "aria-label": Y,
37
- "aria-labelledby": Z,
38
- filterFn: N = Ie,
39
- emptyText: _ = "No options found",
40
- creatable: M = !1,
41
- onCreate: O,
42
- createLabel: ee = (m) => `Create "${m}"`,
43
- clearLabel: re = "Clear selection",
44
- listboxLabel: te = "Options",
45
- className: oe,
46
- testId: ne
47
- }, C) {
48
- const m = Ce("combobox-listbox"), [ae, se] = g(G), [a, y] = g(""), [r, p] = g(!1), [n, s] = g(-1), [q, H] = g(!1), $ = j(null), z = j(null), K = j(null), i = c !== void 0 ? c : ae, h = ze[T], l = X(
49
- () => f.find((e) => e.value === i),
50
- [f, i]
51
- ), u = X(() => a ? f.filter((e) => N(e, a)) : f, [f, a, N]);
52
- I(() => {
53
- !r && l ? y(l.label) : !r && !i && y("");
54
- }, [r, l, i]);
55
- const k = L(
17
+ const be = ne(function({
18
+ options: b,
19
+ value: a,
20
+ defaultValue: S = null,
21
+ onChange: M,
22
+ onInputChange: R,
23
+ placeholder: A = "Select or search...",
24
+ size: z = "md",
25
+ disabled: w = !1,
26
+ isInvalid: $ = !1,
27
+ required: F = !1,
28
+ clearable: K = !0,
29
+ "aria-label": B,
30
+ "aria-labelledby": V,
31
+ filterFn: O = ae,
32
+ emptyText: q = "No options found",
33
+ isLoading: P = !1,
34
+ loadingText: T = "Loading…",
35
+ creatable: L = !1,
36
+ onCreate: I,
37
+ createLabel: U = (p) => `Create "${p}"`,
38
+ clearLabel: X = "Clear selection",
39
+ listboxLabel: Y = "Options",
40
+ className: G,
41
+ testId: H
42
+ }, y) {
43
+ const p = ce("combobox-listbox"), [J, Q] = k(S), [s, f] = k(""), [o, u] = k(!1), [n, c] = k(-1), _ = D(null), x = D(null), W = D(null), l = a !== void 0 ? a : J, i = j(
44
+ () => b.find((e) => e.value === l),
45
+ [b, l]
46
+ ), d = j(() => s ? b.filter((e) => O(e, s)) : b, [b, s, O]);
47
+ C(() => {
48
+ !o && i ? f(i.label) : !o && !l && f("");
49
+ }, [o, i, l]);
50
+ const h = N(
56
51
  (e) => {
57
- c === void 0 && se(e), W?.(e), p(!1), s(-1), z.current?.focus();
52
+ a === void 0 && Q(e), M?.(e), u(!1), c(-1), x.current?.focus();
58
53
  },
59
- [c, W]
60
- ), ie = L(
54
+ [a, M]
55
+ ), Z = N(
61
56
  (e) => {
62
- const t = e.target.value;
63
- y(t), F?.(t), r || p(!0), s(0);
57
+ const r = e.target.value;
58
+ f(r), R?.(r), o || u(!0), c(0);
64
59
  },
65
- [r, F]
66
- ), le = L(
60
+ [o, R]
61
+ ), ee = N(
67
62
  (e) => {
68
- e.stopPropagation(), k(null), y(""), z.current?.focus();
63
+ e.stopPropagation(), h(null), f(""), x.current?.focus();
69
64
  },
70
- [k]
71
- ), de = L(
65
+ [h]
66
+ ), oe = N(
72
67
  (e) => {
73
68
  switch (e.key) {
74
69
  case "ArrowDown":
75
- e.preventDefault(), r ? s((t) => Math.min(t + 1, u.length - 1)) : (p(!0), s(0));
70
+ e.preventDefault(), o ? c((r) => Math.min(r + 1, d.length - 1)) : (u(!0), c(0));
76
71
  break;
77
72
  case "ArrowUp":
78
- e.preventDefault(), r && s((t) => Math.max(t - 1, 0));
73
+ e.preventDefault(), o && c((r) => Math.max(r - 1, 0));
79
74
  break;
80
75
  case "Enter":
81
- e.preventDefault(), r && n >= 0 && u[n] ? u[n].disabled || k(u[n].value) : M && a && u.length === 0 && O?.(a);
76
+ e.preventDefault(), o && n >= 0 && d[n] ? d[n].disabled || h(d[n].value) : L && s && d.length === 0 && I?.(s);
82
77
  break;
83
78
  case "Escape":
84
- e.preventDefault(), p(!1), s(-1), l && y(l.label);
79
+ e.preventDefault(), u(!1), c(-1), i && f(i.label);
85
80
  break;
86
81
  case "Tab":
87
- r && (p(!1), s(-1));
82
+ o && (u(!1), c(-1));
88
83
  break;
89
84
  }
90
85
  },
91
- [r, n, u, k, M, a, O, l]
86
+ [o, n, d, h, L, s, I, i]
92
87
  );
93
- I(() => {
94
- if (!r) return;
95
- const e = (t) => {
96
- $.current?.contains(t.target) || (p(!1), s(-1), l && y(l.label));
88
+ C(() => {
89
+ if (!o) return;
90
+ const e = (r) => {
91
+ _.current?.contains(r.target) || (u(!1), c(-1), i && f(i.label));
97
92
  };
98
93
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
99
- }, [r, l]), I(() => {
100
- if (!r || n < 0) return;
101
- K.current?.children[n]?.scrollIntoView({ block: "nearest" });
102
- }, [r, n]);
103
- const [D, ce] = g({ top: 0, left: 0, width: 0 });
104
- I(() => {
105
- if (!r || !$.current) return;
94
+ }, [o, i]), C(() => {
95
+ if (!o || n < 0) return;
96
+ W.current?.children[n]?.scrollIntoView({ block: "nearest" });
97
+ }, [o, n]);
98
+ const [E, te] = k({ top: 0, left: 0, width: 0 });
99
+ C(() => {
100
+ if (!o || !_.current) return;
106
101
  const e = () => {
107
- const t = $.current.getBoundingClientRect();
108
- ce({
109
- top: t.bottom + window.scrollY + d[1],
110
- left: t.left + window.scrollX,
111
- width: t.width
102
+ const r = _.current.getBoundingClientRect();
103
+ te({
104
+ top: r.bottom + window.scrollY + ie[1],
105
+ left: r.left + window.scrollX,
106
+ width: r.width
112
107
  });
113
108
  };
114
109
  return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
115
110
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
116
111
  };
117
- }, [r]);
118
- const ue = {
119
- position: "relative",
120
- display: "inline-flex",
121
- width: "100%"
122
- }, fe = {
123
- position: "relative",
124
- display: "flex",
125
- alignItems: "center",
126
- width: "100%",
127
- height: h.height,
128
- backgroundColor: b ? "var(--brycks-background-muted)" : "var(--brycks-background-default)",
129
- border: `1px solid ${A ? "var(--brycks-error-default)" : q ? "var(--brycks-primary-default)" : "var(--brycks-border-default)"}`,
130
- borderRadius: "var(--brycks-radius-md)",
131
- transition: `all ${w.fast}ms ${x.easeOut}`,
132
- cursor: b ? "not-allowed" : "text",
133
- boxShadow: q ? "var(--brycks-focus-ring)" : void 0
134
- }, be = {
135
- flex: 1,
136
- height: "100%",
137
- padding: `0 ${h.padding}px`,
138
- paddingRight: d[10],
139
- fontSize: h.fontSize,
140
- color: b ? "var(--brycks-foreground-disabled)" : "var(--brycks-foreground-default)",
141
- backgroundColor: "transparent",
142
- border: "none",
143
- outline: "none",
144
- cursor: b ? "not-allowed" : "text"
145
- }, pe = {
146
- position: "absolute",
147
- right: h.padding,
148
- display: "flex",
149
- alignItems: "center",
150
- gap: d[1],
151
- pointerEvents: "none"
152
- }, me = {
153
- display: "flex",
154
- alignItems: "center",
155
- justifyContent: "center",
156
- width: d[5],
157
- height: d[5],
158
- color: "var(--brycks-foreground-muted)",
159
- cursor: "pointer",
160
- borderRadius: "var(--brycks-radius-sm)",
161
- transition: `all ${w.fast}ms ${x.easeOut}`,
162
- pointerEvents: "auto"
163
- }, ye = {
164
- display: "flex",
165
- alignItems: "center",
166
- justifyContent: "center",
167
- color: "var(--brycks-foreground-muted)",
168
- transform: r ? "rotate(180deg)" : "rotate(0)",
169
- transition: `transform ${w.fast}ms ${x.easeOut}`
170
- }, he = {
171
- position: "absolute",
172
- top: D.top,
173
- left: D.left,
174
- width: D.width,
175
- maxHeight: 300,
176
- overflowY: "auto",
177
- backgroundColor: "var(--brycks-background-elevated)",
178
- border: "1px solid var(--brycks-border-default)",
179
- borderRadius: "var(--brycks-radius-lg)",
180
- boxShadow: "var(--brycks-shadow-lg)",
181
- zIndex: "var(--brycks-z-dropdown)",
182
- padding: d[1],
183
- animation: `brycks-dropdown-in ${w.quick}ms ${x.easeOut}`
184
- }, V = (e, t, ge) => ({
185
- display: "flex",
186
- alignItems: "center",
187
- gap: $e.md,
188
- padding: `${d[2]}px ${E.sm}px`,
189
- fontSize: h.fontSize,
190
- color: t ? "var(--brycks-foreground-disabled)" : "var(--brycks-foreground-default)",
191
- backgroundColor: e ? "var(--brycks-background-muted)" : ge ? "var(--brycks-primary-muted)" : "transparent",
192
- borderRadius: "var(--brycks-radius-md)",
193
- cursor: t ? "not-allowed" : "pointer",
194
- transition: `background-color ${w.fast}ms ${x.easeOut}`
195
- }), ve = {
196
- padding: `${d[4]}px ${d[3]}px`,
197
- fontSize: h.fontSize,
198
- color: "var(--brycks-foreground-muted)",
199
- textAlign: "center"
112
+ }, [o]);
113
+ const re = {
114
+ top: E.top,
115
+ left: E.left,
116
+ width: E.width
200
117
  };
201
- return /* @__PURE__ */ v(
118
+ return /* @__PURE__ */ m(
202
119
  "div",
203
120
  {
204
- ref: $,
205
- className: Se("brycks-combobox", `brycks-combobox--${T}`, oe),
206
- style: ue,
207
- "data-testid": ne,
121
+ ref: _,
122
+ className: g("brycks-combobox", `brycks-combobox--${z}`, G),
123
+ "data-testid": H,
208
124
  children: [
209
- /* @__PURE__ */ v(
125
+ /* @__PURE__ */ m(
210
126
  "div",
211
127
  {
212
- style: fe,
213
- onClick: () => !b && z.current?.focus(),
128
+ className: g(
129
+ "brycks-combobox__wrapper",
130
+ $ && "brycks-combobox__wrapper--invalid",
131
+ w && "brycks-combobox__wrapper--disabled"
132
+ ),
133
+ onClick: () => !w && x.current?.focus(),
214
134
  children: [
215
- /* @__PURE__ */ o(
135
+ /* @__PURE__ */ t(
216
136
  "input",
217
137
  {
218
138
  ref: (e) => {
219
- z.current = e, typeof C == "function" ? C(e) : C && (C.current = e);
139
+ x.current = e, typeof y == "function" ? y(e) : y && (y.current = e);
220
140
  },
221
141
  type: "text",
222
142
  role: "combobox",
223
- "aria-expanded": r,
143
+ "aria-expanded": o,
224
144
  "aria-haspopup": "listbox",
225
145
  "aria-autocomplete": "list",
226
- "aria-controls": r ? m : void 0,
227
- "aria-activedescendant": r && n >= 0 ? `${m}-option-${n}` : void 0,
228
- "aria-invalid": A,
229
- "aria-required": J,
230
- "aria-label": Y,
231
- "aria-labelledby": Z,
232
- value: a,
233
- placeholder: U,
234
- disabled: b,
235
- style: be,
236
- onChange: ie,
237
- onKeyDown: de,
146
+ "aria-controls": o ? p : void 0,
147
+ "aria-activedescendant": o && n >= 0 ? `${p}-option-${n}` : void 0,
148
+ "aria-invalid": $,
149
+ "aria-required": F,
150
+ "aria-label": B,
151
+ "aria-labelledby": V,
152
+ value: s,
153
+ placeholder: A,
154
+ disabled: w,
155
+ className: "brycks-combobox__input",
156
+ onChange: Z,
157
+ onKeyDown: oe,
238
158
  onFocus: () => {
239
- H(!0), p(!0);
240
- },
241
- onBlur: () => H(!1)
159
+ u(!0);
160
+ }
242
161
  }
243
162
  ),
244
- /* @__PURE__ */ v("div", { style: pe, children: [
245
- Q && i && !b && /* @__PURE__ */ o(
163
+ /* @__PURE__ */ m("div", { className: "brycks-combobox__icons", children: [
164
+ K && l && !w && /* @__PURE__ */ t(
246
165
  "button",
247
166
  {
248
167
  type: "button",
249
- "aria-label": re,
250
- style: me,
251
- onClick: le,
252
- onMouseEnter: (e) => {
253
- e.currentTarget.style.backgroundColor = "var(--brycks-background-muted)", e.currentTarget.style.color = "var(--brycks-foreground-default)";
254
- },
255
- onMouseLeave: (e) => {
256
- e.currentTarget.style.backgroundColor = "transparent", e.currentTarget.style.color = "var(--brycks-foreground-muted)";
257
- },
258
- children: /* @__PURE__ */ o(Ee, {})
168
+ "aria-label": X,
169
+ className: "brycks-combobox__clear",
170
+ onClick: ee,
171
+ children: /* @__PURE__ */ t(de, {})
259
172
  }
260
173
  ),
261
- /* @__PURE__ */ o("span", { style: ye, children: /* @__PURE__ */ o(Le, {}) })
174
+ /* @__PURE__ */ t("span", { className: g("brycks-combobox__chevron", o && "brycks-combobox__chevron--open"), children: /* @__PURE__ */ t(le, {}) })
262
175
  ] })
263
176
  ]
264
177
  }
265
178
  ),
266
- r && xe(
267
- /* @__PURE__ */ v(ke, { children: [
268
- /* @__PURE__ */ o("style", { children: `
269
- @keyframes brycks-dropdown-in {
270
- from { opacity: 0; transform: translateY(-4px); }
271
- to { opacity: 1; transform: translateY(0); }
272
- }
273
- ` }),
274
- /* @__PURE__ */ o(
275
- "ul",
276
- {
277
- ref: K,
278
- id: m,
279
- role: "listbox",
280
- "aria-label": Y || te,
281
- style: he,
282
- children: u.length > 0 ? u.map((e, t) => /* @__PURE__ */ v(
283
- "li",
179
+ o && se(
180
+ /* @__PURE__ */ t(
181
+ "ul",
182
+ {
183
+ ref: W,
184
+ id: p,
185
+ role: "listbox",
186
+ "aria-label": B || Y,
187
+ "aria-busy": P || void 0,
188
+ className: "brycks-combobox__dropdown",
189
+ style: re,
190
+ children: P ? /* @__PURE__ */ t("li", { className: "brycks-combobox__empty", role: "status", "aria-live": "polite", children: /* @__PURE__ */ m("span", { className: "brycks-combobox__loading", children: [
191
+ /* @__PURE__ */ m(
192
+ "svg",
284
193
  {
285
- id: `${m}-option-${t}`,
286
- role: "option",
287
- "aria-selected": e.value === i,
288
- "aria-disabled": e.disabled,
289
- style: V(t === n, !!e.disabled, e.value === i),
290
- onClick: () => !e.disabled && k(e.value),
291
- onMouseEnter: () => s(t),
194
+ width: "16",
195
+ height: "16",
196
+ viewBox: "0 0 24 24",
197
+ fill: "none",
198
+ className: "brycks-animate-spin",
199
+ "aria-hidden": "true",
292
200
  children: [
293
- e.icon && /* @__PURE__ */ o("span", { style: { flexShrink: 0 }, children: e.icon }),
294
- /* @__PURE__ */ v("div", { style: { flex: 1, minWidth: 0 }, children: [
295
- /* @__PURE__ */ o("div", { style: { fontWeight: e.value === i ? 500 : 400 }, children: e.label }),
296
- e.description && /* @__PURE__ */ o("div", { style: { fontSize: R.sm, color: "var(--brycks-foreground-muted)" }, children: e.description })
297
- ] }),
298
- e.value === i && /* @__PURE__ */ o("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ o(
299
- "path",
300
- {
301
- d: "M3 8l3 3 7-7",
302
- stroke: "var(--brycks-primary-default)",
303
- strokeWidth: "2",
304
- strokeLinecap: "round",
305
- strokeLinejoin: "round"
306
- }
307
- ) })
201
+ /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.2" }),
202
+ /* @__PURE__ */ t("path", { d: "M12 2C6.47715 2 2 6.47715 2 12", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" })
308
203
  ]
309
- },
310
- e.value
311
- )) : /* @__PURE__ */ o("li", { style: ve, children: M && a ? /* @__PURE__ */ o(
312
- "button",
313
- {
314
- type: "button",
315
- style: {
316
- ...V(!0, !1, !1),
317
- width: "100%",
318
- border: "none",
319
- cursor: "pointer"
320
- },
321
- onClick: () => O?.(a),
322
- children: ee(a)
323
204
  }
324
- ) : _ })
325
- }
326
- )
327
- ] }),
205
+ ),
206
+ T
207
+ ] }) }) : d.length > 0 ? d.map((e, r) => /* @__PURE__ */ m(
208
+ "li",
209
+ {
210
+ id: `${p}-option-${r}`,
211
+ role: "option",
212
+ "aria-selected": e.value === l,
213
+ "aria-disabled": e.disabled,
214
+ className: g(
215
+ "brycks-combobox__option",
216
+ e.value === l && "brycks-combobox__option--selected",
217
+ r === n && "brycks-combobox__option--active",
218
+ e.disabled && "brycks-combobox__option--disabled"
219
+ ),
220
+ onClick: () => !e.disabled && h(e.value),
221
+ onMouseEnter: () => c(r),
222
+ children: [
223
+ e.icon && /* @__PURE__ */ t("span", { className: "brycks-combobox__option-icon", children: e.icon }),
224
+ /* @__PURE__ */ m("div", { className: "brycks-combobox__option-body", children: [
225
+ /* @__PURE__ */ t("div", { className: "brycks-combobox__option-label", children: e.label }),
226
+ e.description && /* @__PURE__ */ t("div", { className: "brycks-combobox__option-description", children: e.description })
227
+ ] }),
228
+ e.value === l && /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "brycks-combobox__option-check", children: /* @__PURE__ */ t(
229
+ "path",
230
+ {
231
+ d: "M3 8l3 3 7-7",
232
+ stroke: "var(--brycks-primary-default)",
233
+ strokeWidth: "2",
234
+ strokeLinecap: "round",
235
+ strokeLinejoin: "round"
236
+ }
237
+ ) })
238
+ ]
239
+ },
240
+ e.value
241
+ )) : /* @__PURE__ */ t("li", { className: "brycks-combobox__empty", children: L && s ? /* @__PURE__ */ t(
242
+ "button",
243
+ {
244
+ type: "button",
245
+ className: "brycks-combobox__option brycks-combobox__option--active brycks-combobox__option--create",
246
+ onClick: () => I?.(s),
247
+ children: U(s)
248
+ }
249
+ ) : q })
250
+ }
251
+ ),
328
252
  document.body
329
253
  )
330
254
  ]
331
255
  }
332
256
  );
333
257
  });
334
- Re.displayName = "Combobox";
258
+ be.displayName = "Combobox";
335
259
  export {
336
- Re as Combobox
260
+ be as Combobox
337
261
  };
338
262
  //# sourceMappingURL=Combobox.js.map