@forgedevstack/bear 1.2.5 → 1.2.7
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/README.md +20 -1
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.const.cjs +1 -0
- package/dist/components/AppBar/AppBar.const.d.ts +36 -1
- package/dist/components/AppBar/AppBar.const.js +39 -0
- package/dist/components/AppBar/AppBar.js +66 -42
- package/dist/components/AppBar/AppBar.types.d.ts +9 -3
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +32 -32
- package/dist/components/Backdrop/Backdrop.cjs +1 -0
- package/dist/components/Backdrop/Backdrop.const.cjs +1 -0
- package/dist/components/Backdrop/Backdrop.const.d.ts +8 -0
- package/dist/components/Backdrop/Backdrop.const.js +11 -0
- package/dist/components/Backdrop/Backdrop.d.ts +3 -0
- package/dist/components/Backdrop/Backdrop.js +50 -0
- package/dist/components/Backdrop/Backdrop.types.d.ts +14 -0
- package/dist/components/Backdrop/index.d.ts +2 -0
- package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.const.cjs +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.const.d.ts +8 -1
- package/dist/components/BottomNavigation/BottomNavigation.const.js +11 -0
- package/dist/components/BottomNavigation/BottomNavigation.js +64 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +65 -64
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.js +48 -48
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.const.cjs +1 -0
- package/dist/components/Chip/Chip.const.d.ts +49 -0
- package/dist/components/Chip/Chip.const.js +53 -0
- package/dist/components/Chip/Chip.js +46 -65
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -0
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -0
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +11 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +14 -0
- package/dist/components/ChipGroup/ChipGroup.d.ts +3 -0
- package/dist/components/ChipGroup/ChipGroup.js +95 -0
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +14 -0
- package/dist/components/ChipGroup/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +68 -64
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -0
- package/dist/components/EmptyState/EmptyState.const.d.ts +26 -1
- package/dist/components/EmptyState/EmptyState.const.js +29 -0
- package/dist/components/EmptyState/EmptyState.js +49 -31
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.const.cjs +1 -1
- package/dist/components/Input/Input.const.d.ts +10 -0
- package/dist/components/Input/Input.const.js +16 -6
- package/dist/components/Input/Input.js +108 -107
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +133 -123
- package/dist/components/List/List.types.d.ts +2 -0
- package/dist/components/MessageList/MessageList.cjs +1 -1
- package/dist/components/MessageList/MessageList.const.cjs +1 -1
- package/dist/components/MessageList/MessageList.const.d.ts +6 -0
- package/dist/components/MessageList/MessageList.const.js +26 -20
- package/dist/components/MessageList/MessageList.d.ts +0 -16
- package/dist/components/MessageList/MessageList.js +133 -115
- package/dist/components/MessageList/MessageList.types.d.ts +4 -0
- package/dist/components/MessageList/MessageList.utils.cjs +1 -1
- package/dist/components/MessageList/MessageList.utils.d.ts +7 -0
- package/dist/components/MessageList/MessageList.utils.js +47 -28
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.js +7 -8
- package/dist/components/Modal/Modal.js +60 -55
- package/dist/components/PageHeader/PageHeader.cjs +1 -0
- package/dist/components/PageHeader/PageHeader.const.cjs +1 -0
- package/dist/components/PageHeader/PageHeader.const.d.ts +6 -0
- package/dist/components/PageHeader/PageHeader.const.js +9 -0
- package/dist/components/PageHeader/PageHeader.d.ts +3 -0
- package/dist/components/PageHeader/PageHeader.js +57 -0
- package/dist/components/PageHeader/PageHeader.types.d.ts +10 -0
- package/dist/components/PageHeader/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.const.cjs +1 -0
- package/dist/components/Progress/Progress.const.d.ts +16 -1
- package/dist/components/Progress/Progress.const.js +19 -0
- package/dist/components/Progress/Progress.d.ts +0 -10
- package/dist/components/Progress/Progress.js +81 -71
- package/dist/components/Progress/Progress.types.d.ts +2 -11
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -1
- package/dist/components/PropsPlayground/PropsPlayground.js +40 -40
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.cjs +1 -0
- package/dist/components/Select/Select.const.d.ts +9 -0
- package/dist/components/Select/Select.const.js +13 -0
- package/dist/components/Select/Select.js +151 -66
- package/dist/components/Select/Select.types.d.ts +3 -1
- package/dist/components/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.js +62 -60
- package/dist/components/Snackbar/Snackbar.types.d.ts +2 -0
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.js +89 -83
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.const.cjs +1 -0
- package/dist/components/Tabs/Tabs.const.d.ts +2 -0
- package/dist/components/Tabs/Tabs.const.js +5 -0
- package/dist/components/Tabs/Tabs.js +40 -35
- package/dist/components/Tabs/Tabs.types.d.ts +1 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -0
- package/dist/components/Toast/Toast.const.d.ts +4 -0
- package/dist/components/Toast/Toast.const.js +9 -0
- package/dist/components/Toast/Toast.d.ts +0 -1
- package/dist/components/Toast/Toast.js +111 -101
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +285 -279
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +8 -0
- package/dist/context/BearProvider.js +149 -139
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +12 -10
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +45 -41
- package/dist/hooks/useBreakpoint/index.d.ts +4 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.cjs +1 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.cjs +1 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.d.ts +8 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.js +10 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +2 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.js +26 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.types.d.ts +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +464 -443
- package/dist/styles.css +67 -23
- package/dist/utils/generateBearId.const.cjs +1 -1
- package/dist/utils/generateBearId.const.d.ts +4 -2
- package/dist/utils/generateBearId.const.js +6 -4
- package/dist/utils/generateBearId.utils.cjs +1 -1
- package/dist/utils/generateBearId.utils.js +33 -21
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.js +27 -18
- package/dist/utils/liveRegion.const.cjs +1 -0
- package/dist/utils/liveRegion.const.d.ts +5 -0
- package/dist/utils/liveRegion.const.js +17 -0
- package/dist/utils/liveRegion.utils.cjs +1 -0
- package/dist/utils/liveRegion.utils.d.ts +7 -0
- package/dist/utils/liveRegion.utils.js +10 -0
- package/dist/utils/useBearId.cjs +1 -1
- package/dist/utils/useBearId.js +5 -4
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as _, useState as z, useCallback as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as _, useState as z, useCallback as w } from "react";
|
|
3
3
|
import { cn as n } from "../../utils/cn.js";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as g } from "../Icon/Icon.js";
|
|
5
5
|
import { SIZE_CLASSES as F, TYPE_LABELS as m, COLUMN_CLASSES as I, ROOT_CLASS as V } from "./PropsPlayground.const.js";
|
|
6
|
-
import { getDefaults as
|
|
7
|
-
const
|
|
6
|
+
import { getDefaults as k } from "./PropsPlayground.utils.js";
|
|
7
|
+
const D = ({ size: i }) => /* @__PURE__ */ e(g, { size: i, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) }), M = ({ size: i }) => /* @__PURE__ */ e(g, { size: i, children: /* @__PURE__ */ e("polyline", { points: "9 18 15 12 9 6" }) }), T = ({ size: i }) => /* @__PURE__ */ t(g, { size: i, children: [
|
|
8
8
|
/* @__PURE__ */ e("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
9
9
|
/* @__PURE__ */ e("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
10
10
|
/* @__PURE__ */ e("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
@@ -14,9 +14,9 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
14
14
|
/* @__PURE__ */ e("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
15
15
|
/* @__PURE__ */ e("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
16
16
|
/* @__PURE__ */ e("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
17
|
-
] }),
|
|
17
|
+
] }), H = ({
|
|
18
18
|
config: i,
|
|
19
|
-
render:
|
|
19
|
+
render: C,
|
|
20
20
|
title: S = "Props",
|
|
21
21
|
size: j = "md",
|
|
22
22
|
defaultCollapsed: $ = !1,
|
|
@@ -25,12 +25,12 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
25
25
|
className: E,
|
|
26
26
|
testId: O
|
|
27
27
|
}) => {
|
|
28
|
-
const p = _(() =>
|
|
29
|
-
(r,
|
|
30
|
-
N((s) => ({ ...s, [r]:
|
|
28
|
+
const p = _(() => k(i), [i]), [f, N] = z(p), [u, P] = z($), o = w(
|
|
29
|
+
(r, b) => {
|
|
30
|
+
N((s) => ({ ...s, [r]: b }));
|
|
31
31
|
},
|
|
32
32
|
[]
|
|
33
|
-
), R =
|
|
33
|
+
), R = w(() => {
|
|
34
34
|
N(p);
|
|
35
35
|
}, [p]), l = F[j], v = Object.keys(i).length, h = n(
|
|
36
36
|
"bear-w-full bear-rounded-md bear-border bear-border-zinc-700",
|
|
@@ -40,7 +40,7 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
40
40
|
"bear-transition-colors",
|
|
41
41
|
l.input
|
|
42
42
|
);
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ t(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
46
|
"data-testid": O,
|
|
@@ -50,7 +50,7 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
50
50
|
E
|
|
51
51
|
),
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ t(
|
|
54
54
|
"button",
|
|
55
55
|
{
|
|
56
56
|
type: "button",
|
|
@@ -63,11 +63,11 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
63
63
|
l.text
|
|
64
64
|
),
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */ e("span", { className: "bear-text-primary-500", children: u ? /* @__PURE__ */ e(
|
|
67
|
-
/* @__PURE__ */ e("span", { className: "bear-text-primary-500", children: /* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e("span", { className: "bear-text-primary-500", children: u ? /* @__PURE__ */ e(M, { size: 12 }) : /* @__PURE__ */ e(D, { size: 12 }) }),
|
|
67
|
+
/* @__PURE__ */ e("span", { className: "bear-text-primary-500", children: /* @__PURE__ */ e(T, { size: 14 }) }),
|
|
68
68
|
/* @__PURE__ */ e("span", { className: "bear-font-semibold", children: S }),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ t("span", { className: "bear-ml-auto bear-flex bear-items-center bear-gap-2", children: [
|
|
70
|
+
/* @__PURE__ */ t("span", { className: "bear-text-[10px] bear-font-medium bear-text-zinc-500", children: [
|
|
71
71
|
v,
|
|
72
72
|
" ",
|
|
73
73
|
v === 1 ? "control" : "controls"
|
|
@@ -87,17 +87,17 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
|
-
!u && /* @__PURE__ */ e("div", { className: n("bear-bg-zinc-900/50", l.padding), children: /* @__PURE__ */ e("div", { className: n("bear-grid", l.gap, I[L]), children: Object.entries(i).map(([r,
|
|
91
|
-
const s =
|
|
92
|
-
if (
|
|
90
|
+
!u && /* @__PURE__ */ e("div", { className: n("bear-bg-gray-50 dark:bear-bg-zinc-900/50", l.padding), children: /* @__PURE__ */ e("div", { className: n("bear-grid", l.gap, I[L]), children: Object.entries(i).map(([r, b]) => {
|
|
91
|
+
const s = f[r], c = r.replace(/([A-Z])/g, " $1").replace(/^./, (a) => a.toUpperCase()).trim();
|
|
92
|
+
if (b.type === "boolean") {
|
|
93
93
|
const a = s === !0;
|
|
94
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ t(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
98
98
|
children: [
|
|
99
99
|
/* @__PURE__ */ e("span", { className: n("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500 bear-mb-2", l.label), children: m.boolean }),
|
|
100
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ t("label", { className: "bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer", children: [
|
|
101
101
|
/* @__PURE__ */ e(
|
|
102
102
|
"button",
|
|
103
103
|
{
|
|
@@ -127,13 +127,13 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
127
127
|
r
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
131
|
-
return /* @__PURE__ */
|
|
130
|
+
if (b.type === "select" && b.options)
|
|
131
|
+
return /* @__PURE__ */ t(
|
|
132
132
|
"div",
|
|
133
133
|
{
|
|
134
134
|
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
135
135
|
children: [
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ t("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
137
137
|
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
138
138
|
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500", l.label), children: m.select })
|
|
139
139
|
] }),
|
|
@@ -143,25 +143,25 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
143
143
|
id: `pp-${r}`,
|
|
144
144
|
value: String(s),
|
|
145
145
|
onChange: (a) => {
|
|
146
|
-
const d =
|
|
146
|
+
const d = b.options.find((x) => String(x.value) === a.target.value);
|
|
147
147
|
o(r, d ? d.value : a.target.value);
|
|
148
148
|
},
|
|
149
149
|
className: n(h, "bear-cursor-pointer bear-appearance-none"),
|
|
150
|
-
children:
|
|
150
|
+
children: b.options.map((a) => /* @__PURE__ */ e("option", { value: String(a.value), children: a.label }, String(a.value)))
|
|
151
151
|
}
|
|
152
152
|
)
|
|
153
153
|
]
|
|
154
154
|
},
|
|
155
155
|
r
|
|
156
156
|
);
|
|
157
|
-
if (
|
|
158
|
-
const a = Number(s), d = Number.isNaN(a) ?
|
|
159
|
-
return /* @__PURE__ */
|
|
157
|
+
if (b.type === "number") {
|
|
158
|
+
const a = Number(s), d = Number.isNaN(a) ? b.default : a;
|
|
159
|
+
return /* @__PURE__ */ t(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
162
|
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
163
163
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ t("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
165
165
|
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
166
166
|
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500", l.label), children: m.number })
|
|
167
167
|
] }),
|
|
@@ -171,12 +171,12 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
171
171
|
id: `pp-${r}`,
|
|
172
172
|
type: "number",
|
|
173
173
|
value: d,
|
|
174
|
-
min:
|
|
175
|
-
max:
|
|
176
|
-
step:
|
|
174
|
+
min: b.min,
|
|
175
|
+
max: b.max,
|
|
176
|
+
step: b.step,
|
|
177
177
|
onChange: (x) => {
|
|
178
178
|
const y = x.target.valueAsNumber;
|
|
179
|
-
o(r, Number.isNaN(y) ?
|
|
179
|
+
o(r, Number.isNaN(y) ? b.default : y);
|
|
180
180
|
},
|
|
181
181
|
className: h
|
|
182
182
|
}
|
|
@@ -186,12 +186,12 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
186
186
|
r
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ t(
|
|
190
190
|
"div",
|
|
191
191
|
{
|
|
192
192
|
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
193
193
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ t("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
195
195
|
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
196
196
|
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500", l.label), children: m.string })
|
|
197
197
|
] }),
|
|
@@ -202,7 +202,7 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
202
202
|
type: "text",
|
|
203
203
|
value: String(s ?? ""),
|
|
204
204
|
onChange: (a) => o(r, a.target.value),
|
|
205
|
-
placeholder:
|
|
205
|
+
placeholder: b.placeholder,
|
|
206
206
|
className: h
|
|
207
207
|
}
|
|
208
208
|
)
|
|
@@ -211,11 +211,11 @@ const M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE_
|
|
|
211
211
|
r
|
|
212
212
|
);
|
|
213
213
|
}) }) }),
|
|
214
|
-
/* @__PURE__ */ e("div", { className: "bear-border-t bear-border-zinc-700 bear-p-6 bear-bg-zinc-900 bear-flex bear-items-center bear-justify-center bear-min-h-[180px]", children: /* @__PURE__ */ e("div", { className: "bear-w-full", children:
|
|
214
|
+
/* @__PURE__ */ e("div", { className: "bear-border-t bear-border-gray-200 dark:bear-border-zinc-700 bear-p-6 bear-bg-white dark:bear-bg-zinc-900 bear-flex bear-items-center bear-justify-center bear-min-h-[180px]", children: /* @__PURE__ */ e("div", { className: "bear-w-full", children: C(f) }) })
|
|
215
215
|
]
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
218
|
};
|
|
219
219
|
export {
|
|
220
|
-
|
|
220
|
+
H as PropsPlayground
|
|
221
221
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),t=require("./Select.const.cjs"),A=require("../Icon/index.cjs"),Z=require("../Portal/Portal.cjs"),n=require("../../utils/cn.cjs"),G=require("../../utils/generateBearId.utils.cjs"),V=require("../../utils/useBearId.cjs"),W=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const H=require("../../hooks/useFormControl/useFormControl.cjs"),J=P=>{const{options:E,value:s,onChange:i,placeholder:x=t.SELECT_DEFAULT_PLACEHOLDER,label:u,error:S,disabled:D=!1,required:M=!1,size:C="md",fullWidth:T=!1,displayEmpty:m=!1,renderValue:O,native:_=!1,className:j,id:B,testId:N}=P,$=V.useBearId("Select"),f=G.resolveBearId(B,$),a=H.useFormControl(),[l,h]=b.useState(!1),[g,F]=b.useState({top:0,left:0,width:0}),w=b.useRef(null),q=b.useRef(null),d=D||!!(a!=null&&a.disabled),y=M||!!(a!=null&&a.required),o=!!S||!!(a!=null&&a.error),v=typeof S=="string"?S:void 0,p=E.find(e=>e.value===s),L=s===void 0||s==="",I=L||m&&L,U=b.useCallback(()=>h(!1),[]);W.useClickOutsideMultiple([w,q],U,{enabled:l&&!_&&!d});const z=e=>{i==null||i(e),h(!1)};b.useEffect(()=>{if(!l||_)return;const e=()=>{var k;const c=(k=w.current)==null?void 0:k.getBoundingClientRect();c&&F({top:c.bottom+t.SELECT_MENU_OFFSET_PX,left:Math.max(t.SELECT_MENU_EDGE_PAD_PX,Math.min(c.left,window.innerWidth-c.width-t.SELECT_MENU_EDGE_PAD_PX)),width:c.width})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[l,_]);const X=O&&!L?O(s):I||!p?x:p.label,R={backgroundColor:"var(--bear-bg-primary)",borderColor:o?void 0:"var(--bear-border-default)",color:p&&!I?"var(--bear-text-primary)":"var(--bear-text-muted)"};return _?r.jsxs("div",{id:f,"data-testid":N,className:n.cn(t.S_E_L_E_C_T_ROOT_CLASS,"bear-relative bear-flex bear-flex-col bear-gap-1.5",T&&"bear-w-full"),children:[u&&r.jsx("label",{htmlFor:`${f}-native`,className:"bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)"},children:u}),r.jsxs("select",{id:`${f}-native`,disabled:d,required:y,value:s??"",onChange:e=>i==null?void 0:i(e.target.value),className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__native`,"bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200","focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",o?"bear-border-red-500 focus:bear-ring-red-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500",d&&"bear-opacity-50 bear-cursor-not-allowed",t.SELECT_SIZE_CLASSES[C],j),style:R,"aria-invalid":o||void 0,"aria-required":y||void 0,"aria-describedby":a==null?void 0:a.helperId,children:[(m||x)&&r.jsx("option",{value:"",disabled:!m,children:x}),E.map(e=>r.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))]}),v&&r.jsx("p",{className:"bear-text-sm bear-text-red-500",children:v})]}):r.jsxs("div",{ref:w,id:f,"data-testid":N,className:n.cn(t.S_E_L_E_C_T_ROOT_CLASS,"bear-relative bear-flex bear-flex-col bear-gap-1.5",T&&"bear-w-full"),children:[u&&r.jsx("label",{className:"bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)"},children:u}),r.jsxs("button",{type:"button",disabled:d,onClick:()=>!d&&h(!l),className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__trigger`,"bear-flex bear-items-center bear-justify-between bear-w-full","bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200","focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",o?"bear-border-red-500 focus:bear-ring-red-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",d&&"bear-opacity-50 bear-cursor-not-allowed",t.SELECT_SIZE_CLASSES[C],j),style:R,"aria-haspopup":"listbox","aria-expanded":l,"aria-invalid":o||void 0,"aria-required":y||void 0,"aria-describedby":a==null?void 0:a.helperId,children:[r.jsx("span",{className:`${t.S_E_L_E_C_T_ROOT_CLASS}__value`,children:X}),r.jsx(A.ChevronDownIcon,{className:n.cn("bear-w-4 bear-h-4 bear-shrink-0 bear-transition-transform",l&&"bear-rotate-180"),style:{color:"var(--bear-text-muted)"}})]}),l&&r.jsx(Z.Portal,{children:r.jsx("div",{ref:q,className:`${t.S_E_L_E_C_T_ROOT_CLASS}__menu bear-fixed bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden`,style:{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",top:g.top,left:g.left,width:g.width,zIndex:t.SELECT_MENU_Z_INDEX},role:"listbox",children:r.jsx("div",{className:"bear-max-h-60 bear-overflow-y-auto",children:E.map(e=>r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>!e.disabled&&z(e.value),role:"option","aria-selected":e.value===s,className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__option`,"bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2","bear-text-left bear-transition-colors",e.disabled&&"bear-cursor-not-allowed",e.value===s&&"bear-bg-bear-100 bear-text-bear-700 dark:bear-bg-bear-600/20 dark:bear-text-bear-300",!e.disabled&&e.value!==s&&"hover:bear-bg-[var(--bear-bg-tertiary)]"),style:e.disabled?{color:"var(--bear-text-muted)"}:e.value===s?void 0:{color:"var(--bear-text-secondary)"},children:[e.label,e.value===s&&r.jsx(A.CheckIcon,{className:"bear-w-4 bear-h-4 bear-shrink-0 bear-text-bear-600 dark:bear-text-bear-400"})]},e.value))})})}),v&&r.jsx("p",{className:"bear-text-sm bear-text-red-500",children:v})]})};exports.Select=J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E="Bear-Select",_="Select an option",S=4,e=8,L=1e4,t={sm:"bear-h-8 bear-text-sm bear-px-3",md:"bear-h-10 bear-text-base bear-px-4",lg:"bear-h-12 bear-text-lg bear-px-5"};exports.SELECT_DEFAULT_PLACEHOLDER=_;exports.SELECT_MENU_EDGE_PAD_PX=e;exports.SELECT_MENU_OFFSET_PX=S;exports.SELECT_MENU_Z_INDEX=L;exports.SELECT_SIZE_CLASSES=t;exports.S_E_L_E_C_T_ROOT_CLASS=E;
|
|
@@ -1 +1,10 @@
|
|
|
1
1
|
export declare const S_E_L_E_C_T_ROOT_CLASS = "Bear-Select";
|
|
2
|
+
export declare const SELECT_DEFAULT_PLACEHOLDER = "Select an option";
|
|
3
|
+
export declare const SELECT_MENU_OFFSET_PX = 4;
|
|
4
|
+
export declare const SELECT_MENU_EDGE_PAD_PX = 8;
|
|
5
|
+
export declare const SELECT_MENU_Z_INDEX = 10000;
|
|
6
|
+
export declare const SELECT_SIZE_CLASSES: {
|
|
7
|
+
readonly sm: "bear-h-8 bear-text-sm bear-px-3";
|
|
8
|
+
readonly md: "bear-h-10 bear-text-base bear-px-4";
|
|
9
|
+
readonly lg: "bear-h-12 bear-text-lg bear-px-5";
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const E = "Bear-Select", _ = "Select an option", e = 4, t = 8, S = 1e4, a = {
|
|
2
|
+
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
3
|
+
md: "bear-h-10 bear-text-base bear-px-4",
|
|
4
|
+
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
_ as SELECT_DEFAULT_PLACEHOLDER,
|
|
8
|
+
t as SELECT_MENU_EDGE_PAD_PX,
|
|
9
|
+
e as SELECT_MENU_OFFSET_PX,
|
|
10
|
+
S as SELECT_MENU_Z_INDEX,
|
|
11
|
+
a as SELECT_SIZE_CLASSES,
|
|
12
|
+
E as S_E_L_E_C_T_ROOT_CLASS
|
|
13
|
+
};
|
|
@@ -1,106 +1,191 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B, useRef as R, useCallback as G, useEffect as H } from "react";
|
|
3
|
+
import { SELECT_DEFAULT_PLACEHOLDER as J, SELECT_SIZE_CLASSES as $, S_E_L_E_C_T_ROOT_CLASS as s, SELECT_MENU_Z_INDEX as K, SELECT_MENU_EDGE_PAD_PX as q, SELECT_MENU_OFFSET_PX as Q } from "./Select.const.js";
|
|
4
|
+
import { ChevronDownIcon as Y, CheckIcon as ee } from "../Icon/index.js";
|
|
5
|
+
import { Portal as re } from "../Portal/Portal.js";
|
|
6
|
+
import { cn as b } from "../../utils/cn.js";
|
|
7
|
+
import { resolveBearId as ae } from "../../utils/generateBearId.utils.js";
|
|
8
|
+
import { useBearId as te } from "../../utils/useBearId.js";
|
|
9
|
+
import { useClickOutsideMultiple as le } from "../../hooks/useClickOutside.js";
|
|
5
10
|
import "../../context/BearProvider.js";
|
|
6
11
|
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
import { useFormControl as se } from "../../hooks/useFormControl/useFormControl.js";
|
|
13
|
+
const xe = (A) => {
|
|
14
|
+
const {
|
|
15
|
+
options: p,
|
|
16
|
+
value: t,
|
|
17
|
+
onChange: i,
|
|
18
|
+
placeholder: h = J,
|
|
19
|
+
label: u,
|
|
20
|
+
error: x,
|
|
21
|
+
disabled: F = !1,
|
|
22
|
+
required: j = !1,
|
|
23
|
+
size: L = "md",
|
|
24
|
+
fullWidth: k = !1,
|
|
25
|
+
displayEmpty: w = !1,
|
|
26
|
+
renderValue: I,
|
|
27
|
+
native: f = !1,
|
|
28
|
+
className: C,
|
|
29
|
+
id: z,
|
|
30
|
+
testId: P
|
|
31
|
+
} = A, U = te("Select"), m = ae(z, U), r = se(), [l, g] = B(!1), [y, X] = B({
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
width: 0
|
|
35
|
+
}), E = R(null), T = R(null), d = F || !!(r != null && r.disabled), _ = j || !!(r != null && r.required), o = !!x || !!(r != null && r.error), v = typeof x == "string" ? x : void 0, N = p.find((e) => e.value === t), S = t === void 0 || t === "", D = S || w && S, V = G(() => g(!1), []);
|
|
36
|
+
le([E, T], V, {
|
|
37
|
+
enabled: l && !f && !d
|
|
38
|
+
});
|
|
39
|
+
const W = (e) => {
|
|
40
|
+
i == null || i(e), g(!1);
|
|
30
41
|
};
|
|
31
|
-
|
|
32
|
-
if (!
|
|
42
|
+
H(() => {
|
|
43
|
+
if (!l || f) return;
|
|
33
44
|
const e = () => {
|
|
34
|
-
var
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
top:
|
|
38
|
-
left: Math.max(
|
|
39
|
-
|
|
45
|
+
var O;
|
|
46
|
+
const n = (O = E.current) == null ? void 0 : O.getBoundingClientRect();
|
|
47
|
+
n && X({
|
|
48
|
+
top: n.bottom + Q,
|
|
49
|
+
left: Math.max(
|
|
50
|
+
q,
|
|
51
|
+
Math.min(n.left, window.innerWidth - n.width - q)
|
|
52
|
+
),
|
|
53
|
+
width: n.width
|
|
40
54
|
});
|
|
41
55
|
};
|
|
42
56
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
43
57
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
44
58
|
};
|
|
45
|
-
}, [
|
|
59
|
+
}, [l, f]);
|
|
60
|
+
const Z = I && !S ? I(t) : D || !N ? h : N.label, M = {
|
|
61
|
+
backgroundColor: "var(--bear-bg-primary)",
|
|
62
|
+
borderColor: o ? void 0 : "var(--bear-border-default)",
|
|
63
|
+
color: N && !D ? "var(--bear-text-primary)" : "var(--bear-text-muted)"
|
|
64
|
+
};
|
|
65
|
+
return f ? /* @__PURE__ */ c(
|
|
46
66
|
"div",
|
|
47
67
|
{
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
id: m,
|
|
69
|
+
"data-testid": P,
|
|
70
|
+
className: b(
|
|
71
|
+
s,
|
|
72
|
+
"bear-relative bear-flex bear-flex-col bear-gap-1.5",
|
|
73
|
+
k && "bear-w-full"
|
|
74
|
+
),
|
|
50
75
|
children: [
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
u && /* @__PURE__ */ a(
|
|
77
|
+
"label",
|
|
78
|
+
{
|
|
79
|
+
htmlFor: `${m}-native`,
|
|
80
|
+
className: "bear-text-sm bear-font-medium",
|
|
81
|
+
style: { color: "var(--bear-text-secondary)" },
|
|
82
|
+
children: u
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ c(
|
|
86
|
+
"select",
|
|
87
|
+
{
|
|
88
|
+
id: `${m}-native`,
|
|
89
|
+
disabled: d,
|
|
90
|
+
required: _,
|
|
91
|
+
value: t ?? "",
|
|
92
|
+
onChange: (e) => i == null ? void 0 : i(e.target.value),
|
|
93
|
+
className: b(
|
|
94
|
+
`${s}__native`,
|
|
95
|
+
"bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200",
|
|
96
|
+
"focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",
|
|
97
|
+
o ? "bear-border-red-500 focus:bear-ring-red-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500",
|
|
98
|
+
d && "bear-opacity-50 bear-cursor-not-allowed",
|
|
99
|
+
$[L],
|
|
100
|
+
C
|
|
101
|
+
),
|
|
102
|
+
style: M,
|
|
103
|
+
"aria-invalid": o || void 0,
|
|
104
|
+
"aria-required": _ || void 0,
|
|
105
|
+
"aria-describedby": r == null ? void 0 : r.helperId,
|
|
106
|
+
children: [
|
|
107
|
+
(w || h) && /* @__PURE__ */ a("option", { value: "", disabled: !w, children: h }),
|
|
108
|
+
p.map((e) => /* @__PURE__ */ a("option", { value: e.value, disabled: e.disabled, children: e.label }, e.value))
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
v && /* @__PURE__ */ a("p", { className: "bear-text-sm bear-text-red-500", children: v })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
) : /* @__PURE__ */ c(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: E,
|
|
119
|
+
id: m,
|
|
120
|
+
"data-testid": P,
|
|
121
|
+
className: b(
|
|
122
|
+
s,
|
|
123
|
+
"bear-relative bear-flex bear-flex-col bear-gap-1.5",
|
|
124
|
+
k && "bear-w-full"
|
|
125
|
+
),
|
|
126
|
+
children: [
|
|
127
|
+
u && /* @__PURE__ */ a("label", { className: "bear-text-sm bear-font-medium", style: { color: "var(--bear-text-secondary)" }, children: u }),
|
|
128
|
+
/* @__PURE__ */ c(
|
|
53
129
|
"button",
|
|
54
130
|
{
|
|
55
131
|
type: "button",
|
|
56
132
|
disabled: d,
|
|
57
|
-
onClick: () => !d &&
|
|
58
|
-
className:
|
|
133
|
+
onClick: () => !d && g(!l),
|
|
134
|
+
className: b(
|
|
135
|
+
`${s}__trigger`,
|
|
59
136
|
"bear-flex bear-items-center bear-justify-between bear-w-full",
|
|
60
137
|
"bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200",
|
|
61
138
|
"focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",
|
|
62
|
-
|
|
139
|
+
o ? "bear-border-red-500 focus:bear-ring-red-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",
|
|
63
140
|
d && "bear-opacity-50 bear-cursor-not-allowed",
|
|
64
|
-
|
|
141
|
+
$[L],
|
|
65
142
|
C
|
|
66
143
|
),
|
|
67
|
-
style:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
style: M,
|
|
145
|
+
"aria-haspopup": "listbox",
|
|
146
|
+
"aria-expanded": l,
|
|
147
|
+
"aria-invalid": o || void 0,
|
|
148
|
+
"aria-required": _ || void 0,
|
|
149
|
+
"aria-describedby": r == null ? void 0 : r.helperId,
|
|
72
150
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
151
|
+
/* @__PURE__ */ a("span", { className: `${s}__value`, children: Z }),
|
|
152
|
+
/* @__PURE__ */ a(
|
|
153
|
+
Y,
|
|
76
154
|
{
|
|
77
|
-
className:
|
|
155
|
+
className: b(
|
|
156
|
+
"bear-w-4 bear-h-4 bear-shrink-0 bear-transition-transform",
|
|
157
|
+
l && "bear-rotate-180"
|
|
158
|
+
),
|
|
78
159
|
style: { color: "var(--bear-text-muted)" }
|
|
79
160
|
}
|
|
80
161
|
)
|
|
81
162
|
]
|
|
82
163
|
}
|
|
83
164
|
),
|
|
84
|
-
|
|
165
|
+
l && /* @__PURE__ */ a(re, { children: /* @__PURE__ */ a(
|
|
85
166
|
"div",
|
|
86
167
|
{
|
|
87
|
-
ref:
|
|
88
|
-
className:
|
|
168
|
+
ref: T,
|
|
169
|
+
className: `${s}__menu bear-fixed bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden`,
|
|
89
170
|
style: {
|
|
90
171
|
backgroundColor: "var(--bear-bg-primary)",
|
|
91
172
|
borderColor: "var(--bear-border-default)",
|
|
92
|
-
top:
|
|
93
|
-
left:
|
|
94
|
-
width:
|
|
95
|
-
zIndex:
|
|
173
|
+
top: y.top,
|
|
174
|
+
left: y.left,
|
|
175
|
+
width: y.width,
|
|
176
|
+
zIndex: K
|
|
96
177
|
},
|
|
97
|
-
|
|
178
|
+
role: "listbox",
|
|
179
|
+
children: /* @__PURE__ */ a("div", { className: "bear-max-h-60 bear-overflow-y-auto", children: p.map((e) => /* @__PURE__ */ c(
|
|
98
180
|
"button",
|
|
99
181
|
{
|
|
100
182
|
type: "button",
|
|
101
183
|
disabled: e.disabled,
|
|
102
|
-
onClick: () => !e.disabled &&
|
|
103
|
-
|
|
184
|
+
onClick: () => !e.disabled && W(e.value),
|
|
185
|
+
role: "option",
|
|
186
|
+
"aria-selected": e.value === t,
|
|
187
|
+
className: b(
|
|
188
|
+
`${s}__option`,
|
|
104
189
|
"bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2",
|
|
105
190
|
"bear-text-left bear-transition-colors",
|
|
106
191
|
e.disabled && "bear-cursor-not-allowed",
|
|
@@ -110,18 +195,18 @@ const B = {
|
|
|
110
195
|
style: e.disabled ? { color: "var(--bear-text-muted)" } : e.value === t ? void 0 : { color: "var(--bear-text-secondary)" },
|
|
111
196
|
children: [
|
|
112
197
|
e.label,
|
|
113
|
-
e.value === t && /* @__PURE__ */
|
|
198
|
+
e.value === t && /* @__PURE__ */ a(ee, { className: "bear-w-4 bear-h-4 bear-shrink-0 bear-text-bear-600 dark:bear-text-bear-400" })
|
|
114
199
|
]
|
|
115
200
|
},
|
|
116
201
|
e.value
|
|
117
202
|
)) })
|
|
118
203
|
}
|
|
119
204
|
) }),
|
|
120
|
-
|
|
205
|
+
v && /* @__PURE__ */ a("p", { className: "bear-text-sm bear-text-red-500", children: v })
|
|
121
206
|
]
|
|
122
207
|
}
|
|
123
208
|
);
|
|
124
209
|
};
|
|
125
210
|
export {
|
|
126
|
-
|
|
211
|
+
xe as Select
|
|
127
212
|
};
|
|
@@ -18,9 +18,11 @@ export interface SelectProps {
|
|
|
18
18
|
/** Select label */
|
|
19
19
|
label?: string;
|
|
20
20
|
/** Error message */
|
|
21
|
-
error?: string;
|
|
21
|
+
error?: string | boolean;
|
|
22
22
|
/** Whether select is disabled */
|
|
23
23
|
disabled?: boolean;
|
|
24
|
+
/** Whether the field is required */
|
|
25
|
+
required?: boolean;
|
|
24
26
|
/** Select size */
|
|
25
27
|
size?: 'sm' | 'md' | 'lg';
|
|
26
28
|
/** Whether select is full width */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),K=require("react-dom"),w=require("../../utils/cn.cjs");require("react");const z=require("../../utils/generateBearId.utils.cjs"),L=require("../../utils/useBearId.cjs"),U=require("../../utils/liveRegion.utils.cjs"),X=require("../Paper/Paper.cjs"),d=require("../Flex/Flex.cjs"),B=require("../Typography/Typography.cjs"),Z=require("../Progress/Progress.cjs"),H=require("../CloseButton/CloseButton.cjs"),s=require("./Snackbar.const.cjs"),M=require("./hooks/useSnackbar.cjs"),G=(i,a,o,t)=>{const e={zIndex:s.SNACKBAR_Z_INDEX};return i==="top"?e.top=t:e.bottom=t,a==="left"?(e.left=o,e.right="auto"):a==="right"?(e.right=o,e.left="auto"):(e.left="50%",e.right="auto",e.transform="translateX(-50%)"),e},V=i=>{const{open:a,message:o,description:t,severity:e="default",action:u,autoHideDuration:h=s.SNACKBAR_DEFAULT_AUTO_HIDE_MS,onClose:c,anchorOrigin:b={vertical:"bottom",horizontal:"center"},offsetX:A=s.SNACKBAR_DEFAULT_OFFSET_X,offsetY:x=s.SNACKBAR_DEFAULT_OFFSET_Y,size:C="md",progress:N=null,progressPosition:_="bottom",progressColor:k="default",countdownProgress:v=!1,showCloseButton:y,closeOnClickOutside:R,container:q,id:I,testId:O,className:D}=i,F=L.useBearId("Snackbar"),P=z.resolveBearId(I,F),g=q??(typeof document<"u"?document.body:null),n=!!c,j=y??n,S=R??n,{surfaceRef:E,progressValue:m}=M.useSnackbar({open:a,autoHideDuration:h,onClose:c,countdownProgress:v,staticProgress:N,closeOnClickOutside:S});if(!a||!g)return null;const p=U.getBearLiveRegionProps(e),l=typeof m=="number",f=l?r.jsx(Z.Progress,{value:m,size:"sm",color:k,className:"Bear-Snackbar__progress"}):null,T=r.jsxs(r.Fragment,{children:[S&&n&&r.jsx("div",{className:"Bear-Snackbar__backdrop bear-fixed bear-inset-0",style:{zIndex:s.SNACKBAR_BACKDROP_Z_INDEX},"aria-hidden":!0}),r.jsxs(X.Paper,{ref:E,id:P,"data-testid":O,role:p.role,"aria-live":p["aria-live"],elevation:4,rounded:"lg",padding:"none",background:"transparent",className:w.cn(s.SNACKBAR_ROOT_CLASS,s.SNACKBAR_SURFACE_CLASSES,"bear-fixed bear-flex bear-flex-col bear-overflow-hidden","bear-border bear-border-[var(--bear-border-default)]",s.SNACKBAR_SIZE_PADDING[C],D),style:G(b.vertical,b.horizontal,A,x),children:[l&&_==="top"&&f,r.jsxs(d.Flex,{className:"Bear-Snackbar__content bear-w-full",align:"center",gap:3,children:[r.jsxs(d.Flex,{direction:"column",className:"Bear-Snackbar__text bear-flex-1 bear-min-w-0",gap:1,children:[o&&r.jsx(B.Typography,{variant:"body2",className:"Bear-Snackbar__message",children:o}),t&&r.jsx(B.Typography,{variant:"caption",color:"muted",className:"Bear-Snackbar__description",children:t})]}),u&&r.jsx(d.Flex,{className:"Bear-Snackbar__action bear-shrink-0",align:"center",children:u}),j&&n&&r.jsx(H.CloseButton,{size:"sm",onClick:c,"aria-label":"Dismiss notification",className:"Bear-Snackbar__close bear-shrink-0"})]}),l&&_==="bottom"&&f]})]});return K.createPortal(T,g)};exports.Snackbar=V;
|