@forgedevstack/bear 1.1.9 → 1.2.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.
- package/README.md +4 -0
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +2 -2
- package/dist/components/AlertDialog/AlertDialog.const.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.js +76 -62
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/CloseButton/CloseButton.cjs +1 -0
- package/dist/components/CloseButton/CloseButton.d.ts +4 -0
- package/dist/components/CloseButton/CloseButton.js +60 -0
- package/dist/components/CloseButton/CloseButton.types.d.ts +15 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +12 -11
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/commerce.cjs +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +25 -0
- package/dist/components/Icon/icons/commerce.js +124 -0
- package/dist/components/Icon/icons/device.cjs +1 -0
- package/dist/components/Icon/icons/device.d.ts +27 -0
- package/dist/components/Icon/icons/device.js +122 -0
- package/dist/components/Icon/icons/file.cjs +1 -0
- package/dist/components/Icon/icons/file.d.ts +25 -0
- package/dist/components/Icon/icons/file.js +120 -0
- package/dist/components/Icon/icons/social.cjs +1 -0
- package/dist/components/Icon/icons/social.d.ts +24 -0
- package/dist/components/Icon/icons/social.js +89 -0
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +93 -56
- package/dist/components/Icon/index.js +38 -26
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/Overlay/Overlay.cjs +1 -0
- package/dist/components/Overlay/Overlay.d.ts +4 -0
- package/dist/components/Overlay/Overlay.js +38 -0
- package/dist/components/Overlay/Overlay.types.d.ts +23 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -0
- package/dist/components/Portal/Portal.d.ts +8 -0
- package/dist/components/Portal/Portal.js +6 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +3 -2
- package/dist/components/Stepper/Stepper.const.js +15 -14
- package/dist/components/Stepper/Stepper.d.ts +0 -7
- package/dist/components/Stepper/Stepper.js +164 -117
- package/dist/components/Stepper/Stepper.types.d.ts +3 -0
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/ThemeIcon/ThemeIcon.cjs +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.d.ts +4 -0
- package/dist/components/ThemeIcon/ThemeIcon.js +54 -0
- package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +22 -0
- package/dist/components/ThemeIcon/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/VisuallyHidden/VisuallyHidden.cjs +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +22 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +15 -3
- package/dist/components/index.js +296 -280
- package/dist/hooks/bearStyled.cjs +1 -1
- package/dist/hooks/bearStyled.d.ts +31 -9
- package/dist/hooks/bearStyled.js +17 -12
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +9 -1
- package/dist/hooks/useResponsive.cjs +1 -1
- package/dist/hooks/useResponsive.d.ts +2 -17
- package/dist/hooks/useResponsive.js +47 -41
- package/dist/index.cjs +1 -1
- package/dist/index.js +383 -366
- package/dist/styles/_effects.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/types/theme.types.d.ts +1 -0
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,151 +1,198 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as l, Fragment as V, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useState as re, useEffect as te, useMemo as j } from "react";
|
|
3
|
+
import { useBearThemeOptional as ne } from "../../context/BearProvider.js";
|
|
4
|
+
import { resolveMaxVisible as oe } from "../../utils/maxVisible.utils.js";
|
|
3
5
|
import { cn as i } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Button as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { STEP_WRAPPER_HORIZONTAL as F, STEP_WRAPPER_HORIZONTAL_WINDOW as ie, STEP_WRAPPER_VERTICAL as le, STEPPER_HORIZONTAL_CLASSES as se, STEPPER_VERTICAL_CLASSES as ae, STEPPER_BASE_CLASSES as ce, STEP_STATUS_CLASSES as v, STEP_LABEL_SIZES as de, STEP_LABEL_BASE as U, STEP_DESCRIPTION_CLASSES as $, CONNECTOR_STATUS as q, CONNECTOR_HORIZONTAL as me, CONNECTOR_VERTICAL as he, CONNECTOR_BASE as fe, STEP_INDICATOR_SIZES as ue, STEP_INDICATOR_BASE as G } from "./Stepper.const.js";
|
|
7
|
+
import { Button as O } from "../Button/Button.js";
|
|
8
|
+
import { Dropdown as pe } from "../Dropdown/Dropdown.js";
|
|
9
|
+
import { BearIcons as Ee } from "../Icon/index.js";
|
|
10
|
+
const Se = () => /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ t("polyline", { points: "20 6 9 17 4 12" }) }), _e = () => /* @__PURE__ */ l("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: [
|
|
11
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
12
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
13
|
+
] }), Ne = J(
|
|
10
14
|
({
|
|
11
|
-
steps:
|
|
12
|
-
activeStep:
|
|
13
|
-
onStepClick:
|
|
14
|
-
orientation:
|
|
15
|
-
size:
|
|
16
|
-
showNumbers:
|
|
17
|
-
clickable:
|
|
15
|
+
steps: o,
|
|
16
|
+
activeStep: d,
|
|
17
|
+
onStepClick: m,
|
|
18
|
+
orientation: C = "horizontal",
|
|
19
|
+
size: S = "md",
|
|
20
|
+
showNumbers: g = !0,
|
|
21
|
+
clickable: _ = !1,
|
|
18
22
|
showConnectors: T = !0,
|
|
19
|
-
connectorStyle:
|
|
20
|
-
alternativeLabel:
|
|
21
|
-
completedIcon:
|
|
22
|
-
errorIcon:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
connectorStyle: b = "solid",
|
|
24
|
+
alternativeLabel: h = !1,
|
|
25
|
+
completedIcon: w,
|
|
26
|
+
errorIcon: A,
|
|
27
|
+
maxVisibleSteps: u,
|
|
28
|
+
testId: I,
|
|
29
|
+
className: K,
|
|
30
|
+
...Q
|
|
31
|
+
}, X) => {
|
|
32
|
+
const B = ne(), [y, Y] = re(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
33
|
+
te(() => {
|
|
34
|
+
const e = () => Y(window.innerWidth);
|
|
35
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
36
|
+
}, []);
|
|
37
|
+
const p = j(
|
|
38
|
+
() => u == null ? void 0 : oe(u, { width: y, theme: B }),
|
|
39
|
+
[u, y, B]
|
|
40
|
+
), L = (e, r) => r.status ? r.status : e < d ? "completed" : e === d ? "active" : "pending", f = C === "horizontal", H = ue[S], N = de[S], E = f && p != null && o.length > p, { visibleIndices: W, leftHidden: x, rightHidden: z } = j(() => {
|
|
41
|
+
if (!E || p == null)
|
|
42
|
+
return {
|
|
43
|
+
visibleIndices: o.map((c, R) => R),
|
|
44
|
+
leftHidden: [],
|
|
45
|
+
rightHidden: []
|
|
46
|
+
};
|
|
47
|
+
const e = p, r = Math.max(0, Math.min(d - Math.floor(e / 2), o.length - e)), n = Array.from({ length: e }, (c, R) => r + R), s = [], a = [];
|
|
48
|
+
for (let c = 0; c < r; c++) s.push(c);
|
|
49
|
+
for (let c = r + e; c < o.length; c++) a.push(c);
|
|
50
|
+
return { visibleIndices: n, leftHidden: s, rightHidden: a };
|
|
51
|
+
}, [E, p, o.length, d]), M = E ? ie : F, k = (e, r, n) => {
|
|
52
|
+
const s = v[n];
|
|
53
|
+
let a = null;
|
|
54
|
+
return e.icon ? a = e.icon : n === "completed" ? a = w || /* @__PURE__ */ t(Se, {}) : n === "error" ? a = A || /* @__PURE__ */ t(_e, {}) : g && (a = r + 1), /* @__PURE__ */ t(
|
|
31
55
|
"div",
|
|
32
56
|
{
|
|
33
57
|
className: i(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
G,
|
|
59
|
+
H,
|
|
60
|
+
s.indicator,
|
|
61
|
+
_ && !e.disabled && "cursor-pointer hover:scale-105"
|
|
38
62
|
),
|
|
39
63
|
onClick: () => {
|
|
40
|
-
|
|
64
|
+
_ && !e.disabled && m && m(r);
|
|
41
65
|
},
|
|
42
|
-
children:
|
|
66
|
+
children: a
|
|
43
67
|
}
|
|
44
68
|
);
|
|
45
|
-
},
|
|
46
|
-
if (!T || e ===
|
|
47
|
-
const
|
|
48
|
-
return /* @__PURE__ */
|
|
69
|
+
}, P = (e) => {
|
|
70
|
+
if (!T || e === o.length - 1) return null;
|
|
71
|
+
const r = e < d;
|
|
72
|
+
return /* @__PURE__ */ t(
|
|
49
73
|
"div",
|
|
50
74
|
{
|
|
51
75
|
className: i(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
76
|
+
fe,
|
|
77
|
+
f ? me : he,
|
|
78
|
+
r ? q.completed : q.pending,
|
|
79
|
+
b === "dashed" && "border-t-2 border-dashed bg-transparent"
|
|
56
80
|
)
|
|
57
81
|
}
|
|
58
82
|
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
"div",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
children:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
}, Z = (e, r) => {
|
|
84
|
+
const n = L(r, e), s = v[n];
|
|
85
|
+
return /* @__PURE__ */ l("div", { className: i("flex", h ? "flex-col items-center" : "items-center gap-3"), children: [
|
|
86
|
+
k(e, r, n),
|
|
87
|
+
/* @__PURE__ */ l("div", { className: i(h && "text-center mt-2"), children: [
|
|
88
|
+
/* @__PURE__ */ t("div", { className: i(U, N.label, s.label), children: e.label }),
|
|
89
|
+
e.description && /* @__PURE__ */ t("div", { className: i($, N.description), children: e.description })
|
|
90
|
+
] })
|
|
91
|
+
] });
|
|
92
|
+
}, ee = (e, r) => {
|
|
93
|
+
const n = L(r, e), s = v[n];
|
|
94
|
+
return /* @__PURE__ */ l(V, { children: [
|
|
95
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-4", children: k(e, r, n) }),
|
|
96
|
+
/* @__PURE__ */ l("div", { className: "flex-1 pt-0.5", children: [
|
|
97
|
+
/* @__PURE__ */ t("div", { className: i(U, N.label, s.label), children: e.label }),
|
|
98
|
+
e.description && /* @__PURE__ */ t("div", { className: i($, N.description), children: e.description }),
|
|
99
|
+
e.content && n === "active" && /* @__PURE__ */ t("div", { className: "mt-4", children: e.content })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
}, D = (e, r) => /* @__PURE__ */ t("div", { className: i("Bear-Stepper__step", "Bear-Stepper__overflow", M), children: /* @__PURE__ */ l("div", { className: i("flex", h ? "flex-col items-center" : "items-center gap-3"), children: [
|
|
103
|
+
/* @__PURE__ */ t(
|
|
104
|
+
pe,
|
|
105
|
+
{
|
|
106
|
+
placement: "bottom-start",
|
|
107
|
+
closeOnSelect: !0,
|
|
108
|
+
trigger: /* @__PURE__ */ t(
|
|
109
|
+
"button",
|
|
75
110
|
{
|
|
111
|
+
type: "button",
|
|
76
112
|
className: i(
|
|
77
|
-
|
|
78
|
-
|
|
113
|
+
G,
|
|
114
|
+
H,
|
|
115
|
+
v.pending.indicator,
|
|
116
|
+
"bear-cursor-pointer bear-border-0"
|
|
79
117
|
),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
"aria-label": r === "left" ? "Previous steps" : "More steps",
|
|
119
|
+
children: /* @__PURE__ */ t(Ee.MoreHorizIcon, { size: 16 })
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
items: e.map((n) => ({
|
|
123
|
+
key: `step-${n}`,
|
|
124
|
+
label: o[n].label,
|
|
125
|
+
disabled: o[n].disabled,
|
|
126
|
+
onClick: () => {
|
|
127
|
+
o[n].disabled || m == null || m(n);
|
|
128
|
+
}
|
|
129
|
+
}))
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
h && /* @__PURE__ */ t("div", { className: "text-center mt-2 bear-text-xs bear-text-gray-400", children: " " })
|
|
133
|
+
] }) }, `overflow-${r}`);
|
|
134
|
+
return /* @__PURE__ */ l(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: X,
|
|
138
|
+
className: i(ce, f ? se : ae, K),
|
|
139
|
+
"data-testid": I,
|
|
140
|
+
...Q,
|
|
141
|
+
children: [
|
|
142
|
+
f && !E && o.map((e, r) => /* @__PURE__ */ l("div", { className: i("Bear-Stepper__step", F), children: [
|
|
143
|
+
Z(e, r),
|
|
144
|
+
P(r)
|
|
145
|
+
] }, r)),
|
|
146
|
+
f && E && /* @__PURE__ */ l(V, { children: [
|
|
147
|
+
x.length > 0 && D(x, "left"),
|
|
148
|
+
W.map((e, r) => {
|
|
149
|
+
const n = o[e], s = W[r + 1], a = s != null && s === e + 1;
|
|
150
|
+
return /* @__PURE__ */ l("div", { className: i("Bear-Stepper__step", M), children: [
|
|
151
|
+
Z(n, e),
|
|
152
|
+
a && P(e)
|
|
153
|
+
] }, e);
|
|
154
|
+
}),
|
|
155
|
+
z.length > 0 && D(z, "right")
|
|
156
|
+
] }),
|
|
157
|
+
!f && o.map((e, r) => /* @__PURE__ */ l("div", { className: i("Bear-Stepper__step", le), children: [
|
|
158
|
+
ee(e, r),
|
|
159
|
+
P(r)
|
|
160
|
+
] }, r))
|
|
161
|
+
]
|
|
107
162
|
}
|
|
108
163
|
);
|
|
109
164
|
}
|
|
110
165
|
);
|
|
111
|
-
|
|
112
|
-
const
|
|
166
|
+
Ne.displayName = "Stepper";
|
|
167
|
+
const ve = J(
|
|
113
168
|
({
|
|
114
|
-
activeStep:
|
|
115
|
-
totalSteps:
|
|
116
|
-
onPrev:
|
|
117
|
-
onNext:
|
|
118
|
-
onComplete:
|
|
119
|
-
disablePrev:
|
|
120
|
-
disableNext:
|
|
169
|
+
activeStep: o,
|
|
170
|
+
totalSteps: d,
|
|
171
|
+
onPrev: m,
|
|
172
|
+
onNext: C,
|
|
173
|
+
onComplete: S,
|
|
174
|
+
disablePrev: g = !1,
|
|
175
|
+
disableNext: _ = !1,
|
|
121
176
|
prevLabel: T = "Previous",
|
|
122
|
-
nextLabel:
|
|
123
|
-
completeLabel:
|
|
124
|
-
showIndicator:
|
|
125
|
-
},
|
|
126
|
-
const
|
|
127
|
-
return /* @__PURE__ */ l("div", { ref:
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
variant: "outline",
|
|
132
|
-
onClick: a,
|
|
133
|
-
disabled: A || f,
|
|
134
|
-
children: T
|
|
135
|
-
}
|
|
136
|
-
),
|
|
137
|
-
p && /* @__PURE__ */ l("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
177
|
+
nextLabel: b = "Next",
|
|
178
|
+
completeLabel: h = "Complete",
|
|
179
|
+
showIndicator: w = !0
|
|
180
|
+
}, A) => {
|
|
181
|
+
const u = o === 0, I = o === d - 1;
|
|
182
|
+
return /* @__PURE__ */ l("div", { ref: A, className: "Bear-StepperControls flex items-center justify-between mt-6", children: [
|
|
183
|
+
/* @__PURE__ */ t(O, { variant: "outline", onClick: m, disabled: u || g, children: T }),
|
|
184
|
+
w && /* @__PURE__ */ l("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
138
185
|
"Step ",
|
|
139
|
-
|
|
186
|
+
o + 1,
|
|
140
187
|
" of ",
|
|
141
|
-
|
|
188
|
+
d
|
|
142
189
|
] }),
|
|
143
|
-
|
|
190
|
+
I ? /* @__PURE__ */ t(O, { variant: "primary", onClick: S, children: h }) : /* @__PURE__ */ t(O, { variant: "primary", onClick: C, disabled: _, children: b })
|
|
144
191
|
] });
|
|
145
192
|
}
|
|
146
193
|
);
|
|
147
|
-
|
|
194
|
+
ve.displayName = "StepperControls";
|
|
148
195
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
196
|
+
Ne as Stepper,
|
|
197
|
+
ve as StepperControls
|
|
151
198
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
2
3
|
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
3
4
|
export type StepStatus = 'pending' | 'active' | 'completed' | 'error';
|
|
4
5
|
export type StepperSize = 'sm' | 'md' | 'lg';
|
|
@@ -43,6 +44,8 @@ export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCh
|
|
|
43
44
|
errorIcon?: ReactNode;
|
|
44
45
|
/** Test ID */
|
|
45
46
|
testId?: string;
|
|
47
|
+
/** When set on horizontal layout, show at most this many steps with ⋯ menus for the rest (breakpoint map supported). */
|
|
48
|
+
maxVisibleSteps?: MaxVisibleInput;
|
|
46
49
|
}
|
|
47
50
|
export interface StepperControlsProps {
|
|
48
51
|
/** Current step */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("react"),C=require("../../utils/cn.cjs"),z=require("../../context/BearProvider.cjs"),B=require("../../utils/maxVisible.utils.cjs"),I=require("../Dropdown/Dropdown.cjs"),L=require("../Icon/index.cjs"),N=require("./Tabs.cjs");function S(n){var l;return o.isValidElement(n)&&typeof n.type!="string"&&((l=n.props)==null?void 0:l.id)!=null}const _=({children:n,maxVisibleTabs:l,wrap:i=!1,className:q})=>{const f=o.useContext(N.TabsContext);if(!f)throw new Error("TabList must be used within Tabs");const v=z.useBearThemeOptional(),[x,E]=o.useState(()=>typeof window<"u"?window.innerWidth:1200);o.useEffect(()=>{const e=()=>E(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a=o.useMemo(()=>B.resolveMaxVisible(l,{width:x,theme:v}),[l,x,v]),{activeTab:b,setActiveTab:M,variant:s}=f,w=o.Children.toArray(n).filter(S),c=w.map(e=>({id:e.props.id,label:e.props.children,disabled:e.props.disabled})),d=b?[b,...c.map(e=>e.id).filter(e=>e!==b)]:c.map(e=>e.id),h=a??d.length,k=d.slice(0,h),u=d.slice(h),p=u.includes(b),y=C.cn("Bear-Tabs__list",`Bear-Tabs__list--${s}`,a!=null&&!i&&"bear-flex bear-w-full bear-min-w-0 bear-items-stretch",(!a||i)&&"bear-flex bear-gap-1",i&&"bear-flex-wrap",!i&&!a&&"bear-gap-1",s==="line"&&"bear-border-b",s==="pills"&&"bear-p-1 bear-rounded-lg",s==="enclosed"&&"bear-border-b",q),g={...s==="line"||s==="enclosed"?{borderColor:"var(--bear-border-default)"}:{},...s==="pills"?{backgroundColor:"var(--bear-bg-tertiary)"}:{}},T=t.jsx(t.Fragment,{children:a!=null?k.map(e=>{const r=w.find(m=>m.props.id===e);return r?o.cloneElement(r,{key:r.props.id}):null}):n}),j=a!=null&&u.length>0?t.jsx("div",{className:"bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch",children:t.jsx(I.Dropdown,{placement:"bottom-end",closeOnSelect:!0,trigger:t.jsx("button",{type:"button",role:"tab","aria-haspopup":"listbox","aria-label":"More tabs",className:C.cn("bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",s==="pills"&&"bear-rounded-md",p&&"bear-shadow-sm",!p&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"),style:p?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:{color:"var(--bear-text-muted)"},children:t.jsx(L.BearIcons.MoreHorizIcon,{size:18})}),items:u.map(e=>{const r=c.find(m=>m.id===e);return{key:e,label:(r==null?void 0:r.label)??e,disabled:r==null?void 0:r.disabled,onClick:()=>M(e)}})})}):null;return a!=null&&!i?t.jsxs("div",{role:"tablist",className:y,style:g,children:[t.jsx("div",{className:"bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap",children:T}),j]}):t.jsxs("div",{role:"tablist",className:y,style:g,children:[T,j]})};exports.TabList=_;
|
|
@@ -1,69 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as s, Fragment as N, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as B, useState as L, useEffect as _, useMemo as A, Children as S, cloneElement as j, isValidElement as O } from "react";
|
|
3
|
+
import { cn as E } from "../../utils/cn.js";
|
|
4
|
+
import { useBearThemeOptional as R } from "../../context/BearProvider.js";
|
|
5
|
+
import { resolveMaxVisible as V } from "../../utils/maxVisible.utils.js";
|
|
6
|
+
import { Dropdown as W } from "../Dropdown/Dropdown.js";
|
|
7
|
+
import { BearIcons as D } from "../Icon/index.js";
|
|
8
|
+
import { TabsContext as F } from "./Tabs.js";
|
|
9
|
+
function H(a) {
|
|
10
|
+
var l;
|
|
11
|
+
return O(a) && typeof a.type != "string" && ((l = a.props) == null ? void 0 : l.id) != null;
|
|
10
12
|
}
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
13
|
+
const X = ({ children: a, maxVisibleTabs: l, wrap: n = !1, className: M }) => {
|
|
14
|
+
const u = B(F);
|
|
15
|
+
if (!u) throw new Error("TabList must be used within Tabs");
|
|
16
|
+
const f = R(), [v, k] = L(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
17
|
+
_(() => {
|
|
18
|
+
const e = () => k(window.innerWidth);
|
|
19
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
20
|
+
}, []);
|
|
21
|
+
const o = A(
|
|
22
|
+
() => V(l, { width: v, theme: f }),
|
|
23
|
+
[l, v, f]
|
|
24
|
+
), { activeTab: i, setActiveTab: z, variant: t } = u, w = S.toArray(a).filter(H), b = w.map((e) => ({ id: e.props.id, label: e.props.children, disabled: e.props.disabled })), d = i ? [i, ...b.map((e) => e.id).filter((e) => e !== i)] : b.map((e) => e.id), x = o ?? d.length, I = d.slice(0, x), c = d.slice(x), m = c.includes(i), h = E(
|
|
15
25
|
"Bear-Tabs__list",
|
|
16
26
|
`Bear-Tabs__list--${t}`,
|
|
17
|
-
"bear-flex bear-
|
|
18
|
-
|
|
27
|
+
o != null && !n && "bear-flex bear-w-full bear-min-w-0 bear-items-stretch",
|
|
28
|
+
(!o || n) && "bear-flex bear-gap-1",
|
|
29
|
+
n && "bear-flex-wrap",
|
|
30
|
+
!n && !o && "bear-gap-1",
|
|
19
31
|
t === "line" && "bear-border-b",
|
|
20
32
|
t === "pills" && "bear-p-1 bear-rounded-lg",
|
|
21
33
|
t === "enclosed" && "bear-border-b",
|
|
22
|
-
|
|
23
|
-
),
|
|
34
|
+
M
|
|
35
|
+
), y = {
|
|
24
36
|
...t === "line" || t === "enclosed" ? { borderColor: "var(--bear-border-default)" } : {},
|
|
25
37
|
...t === "pills" ? { backgroundColor: "var(--bear-bg-tertiary)" } : {}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
38
|
+
}, g = /* @__PURE__ */ s(N, { children: o != null ? I.map((e) => {
|
|
39
|
+
const r = w.find((p) => p.props.id === e);
|
|
40
|
+
return r ? j(r, { key: r.props.id }) : null;
|
|
41
|
+
}) : a }), C = o != null && c.length > 0 ? /* @__PURE__ */ s("div", { className: "bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch", children: /* @__PURE__ */ s(
|
|
42
|
+
W,
|
|
43
|
+
{
|
|
44
|
+
placement: "bottom-end",
|
|
45
|
+
closeOnSelect: !0,
|
|
46
|
+
trigger: /* @__PURE__ */ s(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
role: "tab",
|
|
51
|
+
"aria-haspopup": "listbox",
|
|
52
|
+
"aria-label": "More tabs",
|
|
53
|
+
className: E(
|
|
54
|
+
"bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",
|
|
55
|
+
t === "pills" && "bear-rounded-md",
|
|
56
|
+
m && "bear-shadow-sm",
|
|
57
|
+
!m && "hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"
|
|
58
|
+
),
|
|
59
|
+
style: m ? { backgroundColor: "var(--bear-bg-primary)", color: "var(--bear-text-primary)" } : { color: "var(--bear-text-muted)" },
|
|
60
|
+
children: /* @__PURE__ */ s(D.MoreHorizIcon, { size: 18 })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
items: c.map((e) => {
|
|
64
|
+
const r = b.find((p) => p.id === e);
|
|
65
|
+
return {
|
|
66
|
+
key: e,
|
|
67
|
+
label: (r == null ? void 0 : r.label) ?? e,
|
|
68
|
+
disabled: r == null ? void 0 : r.disabled,
|
|
69
|
+
onClick: () => z(e)
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
) }) : null;
|
|
74
|
+
return o != null && !n ? /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
|
|
75
|
+
/* @__PURE__ */ s("div", { className: "bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap", children: g }),
|
|
76
|
+
C
|
|
77
|
+
] }) : /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
|
|
78
|
+
g,
|
|
79
|
+
C
|
|
65
80
|
] });
|
|
66
81
|
};
|
|
67
82
|
export {
|
|
68
|
-
|
|
83
|
+
X as TabList
|
|
69
84
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
3
|
+
export { type MaxVisibleByBreakpoint, type MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
2
4
|
export interface TabsContextValue {
|
|
3
5
|
activeTab: string;
|
|
4
6
|
setActiveTab: (id: string) => void;
|
|
@@ -23,8 +25,8 @@ export interface TabsProps {
|
|
|
23
25
|
export interface TabListProps {
|
|
24
26
|
/** Tab buttons */
|
|
25
27
|
children: ReactNode;
|
|
26
|
-
/** Max
|
|
27
|
-
maxVisibleTabs?:
|
|
28
|
+
/** Max visible tabs before "…" dropdown. Number, or breakpoint map using theme.breakpoints (mobile < md, tablet md–lg, desktop ≥ lg). `custom` overrides all widths. */
|
|
29
|
+
maxVisibleTabs?: MaxVisibleInput;
|
|
28
30
|
/** Allow tabs to wrap to next line (flex-wrap), no breakpoints */
|
|
29
31
|
wrap?: boolean;
|
|
30
32
|
/** Custom class name */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Tabs, Tab, TabsContext } from './Tabs';
|
|
1
|
+
export { Tabs, Tab, Tab as ActiveTab, TabsContext } from './Tabs';
|
|
2
2
|
export { TabList } from './TabList';
|
|
3
3
|
export { TabPanel } from './TabPanel';
|
|
4
|
-
export type { TabsProps, TabListProps, TabProps, TabPanelProps, TabsContextValue } from './Tabs.types';
|
|
4
|
+
export type { TabsProps, TabListProps, TabProps, TabPanelProps, TabsContextValue, MaxVisibleInput, MaxVisibleByBreakpoint, } from './Tabs.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),y=require("../../utils/cn.cjs");require("react");const a={xs:"bear-w-6 bear-h-6",sm:"bear-w-8 bear-h-8",md:"bear-w-10 bear-h-10",lg:"bear-w-12 bear-h-12",xl:"bear-w-16 bear-h-16"},t={sm:"bear-rounded-sm",md:"bear-rounded-md",lg:"bear-rounded-lg",xl:"bear-rounded-xl",full:"bear-rounded-full"},b={primary:"bear-bg-pink-500 bear-text-white",secondary:"bear-bg-gray-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",danger:"bear-bg-red-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",ghost:"bear-bg-gray-100 dark:bear-bg-zinc-800 bear-text-gray-600 dark:bear-text-gray-300",outline:"bear-bg-transparent bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-text-gray-600 dark:bear-text-gray-300"},x=({children:n,variant:o="primary",size:e="md",radius:d="md",gradient:r,className:s,testId:i})=>{const g=typeof e=="string"?a[e]??a.md:void 0,c=typeof e=="number"?{width:e,height:e}:void 0,l=t[d]??t.md,m=r?"bear-text-white":b[o]??b.primary,u=r?{background:`linear-gradient(${r.deg??135}deg, ${r.from}, ${r.to})`}:void 0;return h.jsx("div",{className:y.cn("Bear-ThemeIcon","bear-inline-flex bear-items-center bear-justify-center bear-shrink-0",g,l,m,s),style:{...c,...u},"data-testid":i,children:n})};exports.ThemeIcon=x;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { cn as y } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
const a = {
|
|
5
|
+
xs: "bear-w-6 bear-h-6",
|
|
6
|
+
sm: "bear-w-8 bear-h-8",
|
|
7
|
+
md: "bear-w-10 bear-h-10",
|
|
8
|
+
lg: "bear-w-12 bear-h-12",
|
|
9
|
+
xl: "bear-w-16 bear-h-16"
|
|
10
|
+
}, t = {
|
|
11
|
+
sm: "bear-rounded-sm",
|
|
12
|
+
md: "bear-rounded-md",
|
|
13
|
+
lg: "bear-rounded-lg",
|
|
14
|
+
xl: "bear-rounded-xl",
|
|
15
|
+
full: "bear-rounded-full"
|
|
16
|
+
}, b = {
|
|
17
|
+
primary: "bear-bg-pink-500 bear-text-white",
|
|
18
|
+
secondary: "bear-bg-gray-500 bear-text-white",
|
|
19
|
+
success: "bear-bg-green-500 bear-text-white",
|
|
20
|
+
danger: "bear-bg-red-500 bear-text-white",
|
|
21
|
+
warning: "bear-bg-yellow-500 bear-text-white",
|
|
22
|
+
info: "bear-bg-blue-500 bear-text-white",
|
|
23
|
+
ghost: "bear-bg-gray-100 dark:bear-bg-zinc-800 bear-text-gray-600 dark:bear-text-gray-300",
|
|
24
|
+
outline: "bear-bg-transparent bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-text-gray-600 dark:bear-text-gray-300"
|
|
25
|
+
}, f = ({
|
|
26
|
+
children: n,
|
|
27
|
+
variant: o = "primary",
|
|
28
|
+
size: e = "md",
|
|
29
|
+
radius: d = "md",
|
|
30
|
+
gradient: r,
|
|
31
|
+
className: s,
|
|
32
|
+
testId: i
|
|
33
|
+
}) => {
|
|
34
|
+
const g = typeof e == "string" ? a[e] ?? a.md : void 0, l = typeof e == "number" ? { width: e, height: e } : void 0, m = t[d] ?? t.md, c = r ? "bear-text-white" : b[o] ?? b.primary, h = r ? { background: `linear-gradient(${r.deg ?? 135}deg, ${r.from}, ${r.to})` } : void 0;
|
|
35
|
+
return /* @__PURE__ */ x(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: y(
|
|
39
|
+
"Bear-ThemeIcon",
|
|
40
|
+
"bear-inline-flex bear-items-center bear-justify-center bear-shrink-0",
|
|
41
|
+
g,
|
|
42
|
+
m,
|
|
43
|
+
c,
|
|
44
|
+
s
|
|
45
|
+
),
|
|
46
|
+
style: { ...l, ...h },
|
|
47
|
+
"data-testid": i,
|
|
48
|
+
children: n
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
f as ThemeIcon
|
|
54
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BearVariant, BearSize } from '../../types';
|
|
3
|
+
export interface ThemeIconProps {
|
|
4
|
+
/** The icon element to render inside */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Color variant */
|
|
7
|
+
variant?: BearVariant | (string & {});
|
|
8
|
+
/** Size of the wrapper */
|
|
9
|
+
size?: BearSize | number;
|
|
10
|
+
/** Border radius style */
|
|
11
|
+
radius?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
12
|
+
/** Gradient background (overrides variant) */
|
|
13
|
+
gradient?: {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
deg?: number;
|
|
17
|
+
};
|
|
18
|
+
/** Additional class name */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Test ID */
|
|
21
|
+
testId?: string;
|
|
22
|
+
}
|