@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,98 +1,103 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as D, useEffect as I } from "react";
|
|
3
|
+
import { createPortal as w } from "react-dom";
|
|
4
|
+
import { cn as o } from "../../utils/cn.js";
|
|
5
|
+
import { resolveBearId as x } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as T } from "../../utils/useBearId.js";
|
|
7
|
+
import { CloseIcon as g } from "../Icon/icons/navigation.js";
|
|
8
|
+
import { Backdrop as j } from "../Backdrop/Backdrop.js";
|
|
9
|
+
import { MODAL_TITLE_CLASSES as R, MODAL_CLOSE_CLASSES as z, MODAL_HEADER_CLASSES as P, MODAL_BODY_CLASSES as $, MODAL_FOOTER_CLASSES as F, MODAL_SIZE_CLASSES as H, MODAL_CONTAINER_CLASSES as K } from "./Modal.const.js";
|
|
10
|
+
const X = (u) => {
|
|
8
11
|
const {
|
|
9
|
-
isOpen:
|
|
10
|
-
onClose:
|
|
12
|
+
isOpen: a,
|
|
13
|
+
onClose: r,
|
|
11
14
|
title: l,
|
|
12
15
|
children: S,
|
|
13
|
-
size:
|
|
14
|
-
showCloseButton:
|
|
15
|
-
closeOnEscape:
|
|
16
|
+
size: p = "md",
|
|
17
|
+
showCloseButton: c = !0,
|
|
18
|
+
closeOnEscape: b = !0,
|
|
16
19
|
disableEscapeKeyDown: E = !1,
|
|
17
20
|
lockBodyScroll: C = !0,
|
|
18
|
-
cancelPreventScroll:
|
|
21
|
+
cancelPreventScroll: B = !1,
|
|
19
22
|
closeOnBackdrop: L = !0,
|
|
20
|
-
hideBackdrop:
|
|
21
|
-
keepMounted:
|
|
22
|
-
isCancelBackgroundClick:
|
|
23
|
-
className:
|
|
24
|
-
footer:
|
|
25
|
-
testId:
|
|
26
|
-
id:
|
|
27
|
-
} =
|
|
28
|
-
(
|
|
29
|
-
|
|
23
|
+
hideBackdrop: M = !1,
|
|
24
|
+
keepMounted: n = !1,
|
|
25
|
+
isCancelBackgroundClick: i,
|
|
26
|
+
className: k,
|
|
27
|
+
footer: m,
|
|
28
|
+
testId: A,
|
|
29
|
+
id: h
|
|
30
|
+
} = u, v = T("Modal"), d = x(h, v), _ = C && !B, O = i !== void 0 ? i : L, f = b && !E, t = D(
|
|
31
|
+
(N) => {
|
|
32
|
+
f && N.key === "Escape" && r();
|
|
30
33
|
},
|
|
31
|
-
[
|
|
34
|
+
[f, r]
|
|
32
35
|
);
|
|
33
|
-
if (
|
|
34
|
-
if (
|
|
35
|
-
return document.addEventListener("keydown",
|
|
36
|
-
document.removeEventListener("keydown",
|
|
36
|
+
if (I(() => {
|
|
37
|
+
if (a)
|
|
38
|
+
return document.addEventListener("keydown", t), _ && (document.body.style.overflow = "hidden"), () => {
|
|
39
|
+
document.removeEventListener("keydown", t), document.body.style.overflow = "";
|
|
37
40
|
};
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
41
|
+
}, [a, t, _]), !a && !n) return null;
|
|
42
|
+
const y = /* @__PURE__ */ s(
|
|
40
43
|
"div",
|
|
41
44
|
{
|
|
42
45
|
className: "Bear-Modal bear-fixed bear-inset-0 bear-z-[11000] bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
43
|
-
"data-testid":
|
|
44
|
-
id:
|
|
46
|
+
"data-testid": A,
|
|
47
|
+
id: d,
|
|
45
48
|
children: [
|
|
46
|
-
!
|
|
47
|
-
|
|
49
|
+
!M && /* @__PURE__ */ e(
|
|
50
|
+
j,
|
|
48
51
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
open: a,
|
|
53
|
+
keepMounted: n,
|
|
54
|
+
blur: !0,
|
|
55
|
+
className: "Bear-Modal__backdrop",
|
|
56
|
+
onClick: O ? () => r() : void 0
|
|
52
57
|
}
|
|
53
58
|
),
|
|
54
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ s(
|
|
55
60
|
"div",
|
|
56
61
|
{
|
|
57
62
|
role: "dialog",
|
|
58
63
|
"aria-modal": "true",
|
|
59
|
-
"aria-labelledby": l ?
|
|
60
|
-
className:
|
|
64
|
+
"aria-labelledby": l ? `${d}-title` : void 0,
|
|
65
|
+
className: o(
|
|
61
66
|
"Bear-Modal__container",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
K,
|
|
68
|
+
H[p],
|
|
69
|
+
k
|
|
65
70
|
),
|
|
66
71
|
children: [
|
|
67
|
-
(l ||
|
|
68
|
-
l && /* @__PURE__ */
|
|
72
|
+
(l || c) && /* @__PURE__ */ s("div", { className: o("Bear-Modal__header", P), children: [
|
|
73
|
+
l && /* @__PURE__ */ e(
|
|
69
74
|
"h2",
|
|
70
75
|
{
|
|
71
|
-
id:
|
|
72
|
-
className:
|
|
76
|
+
id: `${d}-title`,
|
|
77
|
+
className: o("Bear-Modal__title", R),
|
|
73
78
|
children: l
|
|
74
79
|
}
|
|
75
80
|
),
|
|
76
|
-
|
|
81
|
+
c && /* @__PURE__ */ e(
|
|
77
82
|
"button",
|
|
78
83
|
{
|
|
79
|
-
onClick:
|
|
80
|
-
className:
|
|
84
|
+
onClick: r,
|
|
85
|
+
className: o("Bear-Modal__close", z),
|
|
81
86
|
"aria-label": "Close modal",
|
|
82
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ e(g, { className: "bear-w-5 bear-h-5" })
|
|
83
88
|
}
|
|
84
89
|
)
|
|
85
90
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
91
|
+
/* @__PURE__ */ e("div", { className: o("Bear-Modal__body", $), children: S }),
|
|
92
|
+
m && /* @__PURE__ */ e("div", { className: o("Bear-Modal__footer", F), children: m })
|
|
88
93
|
]
|
|
89
94
|
}
|
|
90
95
|
)
|
|
91
96
|
]
|
|
92
97
|
}
|
|
93
98
|
);
|
|
94
|
-
return
|
|
99
|
+
return w(y, document.body);
|
|
95
100
|
};
|
|
96
101
|
export {
|
|
97
|
-
|
|
102
|
+
X as Modal
|
|
98
103
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),e=require("./PageHeader.const.cjs"),E=require("../Typography/Typography.cjs"),a=require("../Flex/Flex.cjs"),s=require("../../utils/cn.cjs");require("react");const R=require("../../utils/generateBearId.utils.cjs"),u=require("../../utils/useBearId.cjs"),P=n=>{const{id:t,testId:A,title:i,description:_,breadcrumbs:o,actions:c,className:S}=n,d=u.useBearId("PageHeader"),l=R.resolveBearId(t,d);return r.jsxs("header",{id:l,"data-testid":A,className:s.cn(e.PAGE_HEADER_ROOT_CLASS,e.PAGE_HEADER_BASE_CLASSES,S),children:[o,r.jsxs(a.Flex,{className:s.cn(`${e.PAGE_HEADER_ROOT_CLASS}__row`,e.PAGE_HEADER_ROW_CLASSES),children:[r.jsxs(a.Flex,{direction:"column",gap:1,className:`${e.PAGE_HEADER_ROOT_CLASS}__copy`,children:[r.jsx(E.Typography,{component:"h1",className:s.cn(`${e.PAGE_HEADER_ROOT_CLASS}__title`,e.PAGE_HEADER_TITLE_CLASSES),children:i}),_&&r.jsx(E.Typography,{component:"p",className:s.cn(`${e.PAGE_HEADER_ROOT_CLASS}__description`,e.PAGE_HEADER_DESCRIPTION_CLASSES),children:_})]}),c&&r.jsx("div",{className:s.cn(`${e.PAGE_HEADER_ROOT_CLASS}__actions`,e.PAGE_HEADER_ACTIONS_CLASSES),children:c})]})]})};exports.PageHeader=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-PageHeader",E="bear-flex bear-flex-col bear-gap-3 bear-w-full",S="bear-flex bear-flex-col sm:bear-flex-row sm:bear-items-start sm:bear-justify-between bear-gap-3",A="bear-text-2xl bear-font-semibold bear-text-[var(--bear-text-primary)]",a="bear-text-sm bear-text-[var(--bear-text-secondary)] bear-max-w-2xl",r="bear-flex bear-flex-wrap bear-items-center bear-gap-2";exports.PAGE_HEADER_ACTIONS_CLASSES=r;exports.PAGE_HEADER_BASE_CLASSES=E;exports.PAGE_HEADER_DESCRIPTION_CLASSES=a;exports.PAGE_HEADER_ROOT_CLASS=e;exports.PAGE_HEADER_ROW_CLASSES=S;exports.PAGE_HEADER_TITLE_CLASSES=A;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PAGE_HEADER_ROOT_CLASS = "Bear-PageHeader";
|
|
2
|
+
export declare const PAGE_HEADER_BASE_CLASSES = "bear-flex bear-flex-col bear-gap-3 bear-w-full";
|
|
3
|
+
export declare const PAGE_HEADER_ROW_CLASSES = "bear-flex bear-flex-col sm:bear-flex-row sm:bear-items-start sm:bear-justify-between bear-gap-3";
|
|
4
|
+
export declare const PAGE_HEADER_TITLE_CLASSES = "bear-text-2xl bear-font-semibold bear-text-[var(--bear-text-primary)]";
|
|
5
|
+
export declare const PAGE_HEADER_DESCRIPTION_CLASSES = "bear-text-sm bear-text-[var(--bear-text-secondary)] bear-max-w-2xl";
|
|
6
|
+
export declare const PAGE_HEADER_ACTIONS_CLASSES = "bear-flex bear-flex-wrap bear-items-center bear-gap-2";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e = "Bear-PageHeader", a = "bear-flex bear-flex-col bear-gap-3 bear-w-full", r = "bear-flex bear-flex-col sm:bear-flex-row sm:bear-items-start sm:bear-justify-between bear-gap-3", t = "bear-text-2xl bear-font-semibold bear-text-[var(--bear-text-primary)]", E = "bear-text-sm bear-text-[var(--bear-text-secondary)] bear-max-w-2xl", b = "bear-flex bear-flex-wrap bear-items-center bear-gap-2";
|
|
2
|
+
export {
|
|
3
|
+
b as PAGE_HEADER_ACTIONS_CLASSES,
|
|
4
|
+
a as PAGE_HEADER_BASE_CLASSES,
|
|
5
|
+
E as PAGE_HEADER_DESCRIPTION_CLASSES,
|
|
6
|
+
e as PAGE_HEADER_ROOT_CLASS,
|
|
7
|
+
r as PAGE_HEADER_ROW_CLASSES,
|
|
8
|
+
t as PAGE_HEADER_TITLE_CLASSES
|
|
9
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { PAGE_HEADER_ROOT_CLASS as e, PAGE_HEADER_TITLE_CLASSES as p, PAGE_HEADER_DESCRIPTION_CLASSES as h, PAGE_HEADER_ACTIONS_CLASSES as I, PAGE_HEADER_ROW_CLASSES as N, PAGE_HEADER_BASE_CLASSES as P } from "./PageHeader.const.js";
|
|
3
|
+
import { Typography as c } from "../Typography/Typography.js";
|
|
4
|
+
import { Flex as i } from "../Flex/Flex.js";
|
|
5
|
+
import { cn as r } from "../../utils/cn.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { resolveBearId as R } from "../../utils/generateBearId.utils.js";
|
|
8
|
+
import { useBearId as C } from "../../utils/useBearId.js";
|
|
9
|
+
const $ = (_) => {
|
|
10
|
+
const {
|
|
11
|
+
id: m,
|
|
12
|
+
testId: E,
|
|
13
|
+
title: d,
|
|
14
|
+
description: s,
|
|
15
|
+
breadcrumbs: n,
|
|
16
|
+
actions: a,
|
|
17
|
+
className: A
|
|
18
|
+
} = _, S = C("PageHeader"), l = R(m, S);
|
|
19
|
+
return /* @__PURE__ */ o(
|
|
20
|
+
"header",
|
|
21
|
+
{
|
|
22
|
+
id: l,
|
|
23
|
+
"data-testid": E,
|
|
24
|
+
className: r(e, P, A),
|
|
25
|
+
children: [
|
|
26
|
+
n,
|
|
27
|
+
/* @__PURE__ */ o(i, { className: r(`${e}__row`, N), children: [
|
|
28
|
+
/* @__PURE__ */ o(i, { direction: "column", gap: 1, className: `${e}__copy`, children: [
|
|
29
|
+
/* @__PURE__ */ t(
|
|
30
|
+
c,
|
|
31
|
+
{
|
|
32
|
+
component: "h1",
|
|
33
|
+
className: r(`${e}__title`, p),
|
|
34
|
+
children: d
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
s && /* @__PURE__ */ t(
|
|
38
|
+
c,
|
|
39
|
+
{
|
|
40
|
+
component: "p",
|
|
41
|
+
className: r(
|
|
42
|
+
`${e}__description`,
|
|
43
|
+
h
|
|
44
|
+
),
|
|
45
|
+
children: s
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }),
|
|
49
|
+
a && /* @__PURE__ */ t("div", { className: r(`${e}__actions`, I), children: a })
|
|
50
|
+
] })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
$ as PageHeader
|
|
57
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("./Progress.const.cjs"),s=require("../../utils/cn.cjs");require("react");const E=require("../../utils/generateBearId.utils.cjs"),P=require("../../utils/useBearId.cjs"),v=m=>{const{id:_,value:l,max:n=100,bufferValue:d,size:b="md",color:R="default",showLabel:o=!1,label:u=e.PROGRESS_DEFAULT_LABEL,labelPosition:S="outside",striped:i=!1,animated:g=!1,indeterminate:r=!1,className:x,testId:f}=m,O=P.useBearId("Progress"),h=E.resolveBearId(_,O),t=Math.min(100,Math.max(0,l/n*100)),c=d==null?null:Math.min(100,Math.max(t,Math.max(0,d/n*100)));return a.jsxs("div",{id:h,className:s.cn(e.PROGRESS_ROOT_CLASS,"bear-w-full",x),"data-testid":f,children:[o&&S==="outside"&&a.jsxs("div",{className:`${e.PROGRESS_ROOT_CLASS}__label-row bear-flex bear-justify-between bear-mb-1`,children:[a.jsx("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:u}),a.jsxs("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:[Math.round(t),"%"]})]}),a.jsxs("div",{className:s.cn(`${e.PROGRESS_ROOT_CLASS}__track`,e.PROGRESS_TRACK_CLASSES,e.PROGRESS_SIZE_CLASSES[b]),children:[c!=null&&!r&&a.jsx("div",{className:s.cn(`${e.PROGRESS_ROOT_CLASS}__buffer`,"bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full",e.PROGRESS_BUFFER_CLASSES),style:{width:`${c}%`}}),a.jsx("div",{className:s.cn(`${e.PROGRESS_ROOT_CLASS}__bar`,"bear-relative bear-h-full bear-rounded-full bear-transition-all bear-duration-300 bear-ease-out","bear-flex bear-items-center bear-justify-center",e.PROGRESS_COLOR_CLASSES[R],i&&"bear-bg-stripes",g&&"bear-animate-stripes",r&&"bear-animate-indeterminate"),style:{width:r?"50%":`${t}%`,backgroundSize:i?"1rem 1rem":void 0,backgroundImage:i?"linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)":void 0},role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":n,"aria-label":u,children:o&&S==="inside"&&b==="lg"&&!r&&a.jsxs("span",{className:"bear-text-xs bear-font-medium bear-text-white",children:[Math.round(t),"%"]})})]})]})};exports.Progress=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S="Bear-Progress",e={sm:"bear-h-1.5",md:"bear-h-2.5",lg:"bear-h-4"},r={default:"bear-bg-bear-500",success:"bear-bg-green-500",warning:"bear-bg-amber-500",danger:"bear-bg-red-500",info:"bear-bg-blue-500"},b="bear-bg-bear-500/30 dark:bear-bg-bear-400/25",R="bear-w-full bear-bg-gray-200 dark:bear-bg-gray-700 bear-rounded-full bear-overflow-hidden bear-relative",a="Progress";exports.PROGRESS_BUFFER_CLASSES=b;exports.PROGRESS_COLOR_CLASSES=r;exports.PROGRESS_DEFAULT_LABEL=a;exports.PROGRESS_ROOT_CLASS=S;exports.PROGRESS_SIZE_CLASSES=e;exports.PROGRESS_TRACK_CLASSES=R;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const PROGRESS_ROOT_CLASS = "Bear-Progress";
|
|
2
|
+
export declare const PROGRESS_SIZE_CLASSES: {
|
|
3
|
+
readonly sm: "bear-h-1.5";
|
|
4
|
+
readonly md: "bear-h-2.5";
|
|
5
|
+
readonly lg: "bear-h-4";
|
|
6
|
+
};
|
|
7
|
+
export declare const PROGRESS_COLOR_CLASSES: {
|
|
8
|
+
readonly default: "bear-bg-bear-500";
|
|
9
|
+
readonly success: "bear-bg-green-500";
|
|
10
|
+
readonly warning: "bear-bg-amber-500";
|
|
11
|
+
readonly danger: "bear-bg-red-500";
|
|
12
|
+
readonly info: "bear-bg-blue-500";
|
|
13
|
+
};
|
|
14
|
+
export declare const PROGRESS_BUFFER_CLASSES = "bear-bg-bear-500/30 dark:bear-bg-bear-400/25";
|
|
15
|
+
export declare const PROGRESS_TRACK_CLASSES = "bear-w-full bear-bg-gray-200 dark:bear-bg-gray-700 bear-rounded-full bear-overflow-hidden bear-relative";
|
|
16
|
+
export declare const PROGRESS_DEFAULT_LABEL = "Progress";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const r = "Bear-Progress", e = {
|
|
2
|
+
sm: "bear-h-1.5",
|
|
3
|
+
md: "bear-h-2.5",
|
|
4
|
+
lg: "bear-h-4"
|
|
5
|
+
}, b = {
|
|
6
|
+
default: "bear-bg-bear-500",
|
|
7
|
+
success: "bear-bg-green-500",
|
|
8
|
+
warning: "bear-bg-amber-500",
|
|
9
|
+
danger: "bear-bg-red-500",
|
|
10
|
+
info: "bear-bg-blue-500"
|
|
11
|
+
}, a = "bear-bg-bear-500/30 dark:bear-bg-bear-400/25", S = "bear-w-full bear-bg-gray-200 dark:bear-bg-gray-700 bear-rounded-full bear-overflow-hidden bear-relative", g = "Progress";
|
|
12
|
+
export {
|
|
13
|
+
a as PROGRESS_BUFFER_CLASSES,
|
|
14
|
+
b as PROGRESS_COLOR_CLASSES,
|
|
15
|
+
g as PROGRESS_DEFAULT_LABEL,
|
|
16
|
+
r as PROGRESS_ROOT_CLASS,
|
|
17
|
+
e as PROGRESS_SIZE_CLASSES,
|
|
18
|
+
S as PROGRESS_TRACK_CLASSES
|
|
19
|
+
};
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ProgressProps } from './Progress.types';
|
|
3
|
-
/**
|
|
4
|
-
* Progress - Progress bar with multiple variants
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <Progress value={75} showLabel />
|
|
9
|
-
* <Progress value={50} color="success" striped animated />
|
|
10
|
-
* <Progress indeterminate />
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
3
|
export declare const Progress: FC<ProgressProps>;
|
|
@@ -1,75 +1,85 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { PROGRESS_DEFAULT_LABEL as E, PROGRESS_ROOT_CLASS as r, PROGRESS_BUFFER_CLASSES as L, PROGRESS_COLOR_CLASSES as O, PROGRESS_SIZE_CLASSES as P, PROGRESS_TRACK_CLASSES as y } from "./Progress.const.js";
|
|
3
|
+
import { cn as s } from "../../utils/cn.js";
|
|
3
4
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
5
|
+
import { resolveBearId as N } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as w } from "../../utils/useBearId.js";
|
|
7
|
+
const k = (S) => {
|
|
8
|
+
const {
|
|
9
|
+
id: g,
|
|
10
|
+
value: d,
|
|
11
|
+
max: i = 100,
|
|
12
|
+
bufferValue: b,
|
|
13
|
+
size: o = "md",
|
|
14
|
+
color: _ = "default",
|
|
15
|
+
showLabel: m = !1,
|
|
16
|
+
label: u = E,
|
|
17
|
+
labelPosition: c = "outside",
|
|
18
|
+
striped: l = !1,
|
|
19
|
+
animated: h = !1,
|
|
20
|
+
indeterminate: e = !1,
|
|
21
|
+
className: p,
|
|
22
|
+
testId: x
|
|
23
|
+
} = S, R = w("Progress"), v = N(g, R), t = Math.min(100, Math.max(0, d / i * 100)), f = b == null ? null : Math.min(100, Math.max(t, Math.max(0, b / i * 100)));
|
|
24
|
+
return /* @__PURE__ */ a(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
id: v,
|
|
28
|
+
className: s(r, "bear-w-full", p),
|
|
29
|
+
"data-testid": x,
|
|
30
|
+
children: [
|
|
31
|
+
m && c === "outside" && /* @__PURE__ */ a("div", { className: `${r}__label-row bear-flex bear-justify-between bear-mb-1`, children: [
|
|
32
|
+
/* @__PURE__ */ n("span", { className: "bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200", children: u }),
|
|
33
|
+
/* @__PURE__ */ a("span", { className: "bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200", children: [
|
|
34
|
+
Math.round(t),
|
|
35
|
+
"%"
|
|
36
|
+
] })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ a("div", { className: s(`${r}__track`, y, P[o]), children: [
|
|
39
|
+
f != null && !e && /* @__PURE__ */ n(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: s(
|
|
43
|
+
`${r}__buffer`,
|
|
44
|
+
"bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full",
|
|
45
|
+
L
|
|
46
|
+
),
|
|
47
|
+
style: { width: `${f}%` }
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ n(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: s(
|
|
54
|
+
`${r}__bar`,
|
|
55
|
+
"bear-relative bear-h-full bear-rounded-full bear-transition-all bear-duration-300 bear-ease-out",
|
|
56
|
+
"bear-flex bear-items-center bear-justify-center",
|
|
57
|
+
O[_],
|
|
58
|
+
l && "bear-bg-stripes",
|
|
59
|
+
h && "bear-animate-stripes",
|
|
60
|
+
e && "bear-animate-indeterminate"
|
|
61
|
+
),
|
|
62
|
+
style: {
|
|
63
|
+
width: e ? "50%" : `${t}%`,
|
|
64
|
+
backgroundSize: l ? "1rem 1rem" : void 0,
|
|
65
|
+
backgroundImage: l ? "linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)" : void 0
|
|
66
|
+
},
|
|
67
|
+
role: "progressbar",
|
|
68
|
+
"aria-valuenow": e ? void 0 : d,
|
|
69
|
+
"aria-valuemin": 0,
|
|
70
|
+
"aria-valuemax": i,
|
|
71
|
+
"aria-label": u,
|
|
72
|
+
children: m && c === "inside" && o === "lg" && !e && /* @__PURE__ */ a("span", { className: "bear-text-xs bear-font-medium bear-text-white", children: [
|
|
73
|
+
Math.round(t),
|
|
74
|
+
"%"
|
|
75
|
+
] })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
72
82
|
};
|
|
73
83
|
export {
|
|
74
|
-
|
|
84
|
+
k as Progress
|
|
75
85
|
};
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
export interface ProgressProps {
|
|
2
2
|
id?: string;
|
|
3
|
-
/** Progress value (0-100) */
|
|
4
3
|
value: number;
|
|
5
|
-
/** Maximum value */
|
|
6
4
|
max?: number;
|
|
7
|
-
|
|
5
|
+
bufferValue?: number;
|
|
8
6
|
size?: 'sm' | 'md' | 'lg';
|
|
9
|
-
/** Color variant */
|
|
10
7
|
color?: 'default' | 'success' | 'warning' | 'danger' | 'info';
|
|
11
|
-
/** Show percentage label */
|
|
12
8
|
showLabel?: boolean;
|
|
13
|
-
|
|
9
|
+
label?: string;
|
|
14
10
|
labelPosition?: 'inside' | 'outside';
|
|
15
|
-
/** Striped animation */
|
|
16
11
|
striped?: boolean;
|
|
17
|
-
/** Animated stripes */
|
|
18
12
|
animated?: boolean;
|
|
19
|
-
/** Indeterminate loading state */
|
|
20
13
|
indeterminate?: boolean;
|
|
21
|
-
/** Custom class name */
|
|
22
14
|
className?: string;
|
|
23
|
-
/** Test ID */
|
|
24
15
|
testId?: string;
|
|
25
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("../../utils/cn.cjs"),j=require("../Icon/Icon.cjs"),l=require("./PropsPlayground.const.cjs"),$=require("./PropsPlayground.utils.cjs"),q=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),I=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),O=({size:b})=>e.jsxs(j.Icon,{size:b,children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),R=({config:b,render:v,title:z="Props",size:S="md",defaultCollapsed:C=!1,showReset:w=!0,columns:P=3,className:L,testId:E})=>{const u=c.useMemo(()=>$.getDefaults(b),[b]),[g,f]=c.useState(u),[m,A]=c.useState(C),o=c.useCallback((r,s)=>{f(i=>({...i,[r]:s}))},[]),_=c.useCallback(()=>{f(u)},[u]),t=l.SIZE_CLASSES[S],N=Object.keys(b).length,p=n.cn("bear-w-full bear-rounded-md bear-border bear-border-zinc-700","bear-bg-zinc-800 bear-text-zinc-100","placeholder:bear-text-zinc-500","focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-primary-500/30 focus:bear-border-primary-500","bear-transition-colors",t.input);return e.jsxs("div",{"data-testid":E,className:n.cn(l.ROOT_CLASS,"bear-rounded-lg bear-border bear-border-zinc-700 bear-overflow-hidden",L),children:[e.jsxs("button",{type:"button",onClick:()=>A(r=>!r),className:n.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-font-medium bear-transition-colors","bear-bg-zinc-800/60 hover:bear-bg-zinc-800","bear-text-zinc-200 bear-border-b bear-border-zinc-700","bear-px-4 bear-py-3",t.text),children:[e.jsx("span",{className:"bear-text-primary-500",children:m?e.jsx(I,{size:12}):e.jsx(q,{size:12})}),e.jsx("span",{className:"bear-text-primary-500",children:e.jsx(O,{size:14})}),e.jsx("span",{className:"bear-font-semibold",children:z}),e.jsxs("span",{className:"bear-ml-auto bear-flex bear-items-center bear-gap-2",children:[e.jsxs("span",{className:"bear-text-[10px] bear-font-medium bear-text-zinc-500",children:[N," ",N===1?"control":"controls"]}),w&&!m&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),_()},className:"bear-text-[10px] bear-font-semibold bear-text-primary-500 hover:bear-text-primary-400 hover:bear-underline",children:"Reset"})]})]}),!m&&e.jsx("div",{className:n.cn("bear-bg-zinc-900/50",t.padding),children:e.jsx("div",{className:n.cn("bear-grid",t.gap,l.COLUMN_CLASSES[P]),children:Object.entries(b).map(([r,s])=>{const i=g[r],d=r.replace(/([A-Z])/g," $1").replace(/^./,a=>a.toUpperCase()).trim();if(s.type==="boolean"){const a=i===!0;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsx("span",{className:n.cn("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500 bear-mb-2",t.label),children:l.TYPE_LABELS.boolean}),e.jsxs("label",{className:"bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":a,onClick:()=>o(r,!a),className:n.cn("bear-relative bear-inline-flex bear-h-5 bear-w-9 bear-flex-shrink-0 bear-rounded-full bear-border-2 bear-border-transparent bear-transition-colors",a?"bear-bg-primary-500":"bear-bg-zinc-600"),children:e.jsx("span",{className:n.cn("bear-pointer-events-none bear-inline-block bear-h-4 bear-w-4 bear-transform bear-rounded-full bear-bg-white bear-shadow bear-transition",a?"bear-translate-x-4":"bear-translate-x-0")})}),e.jsx("span",{className:n.cn("bear-font-medium bear-text-zinc-200 bear-truncate",t.text),children:d})]})]},r)}if(s.type==="select"&&s.options)return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.select})]}),e.jsx("select",{id:`pp-${r}`,value:String(i),onChange:a=>{const x=s.options.find(h=>String(h.value)===a.target.value);o(r,x?x.value:a.target.value)},className:n.cn(p,"bear-cursor-pointer bear-appearance-none"),children:s.options.map(a=>e.jsx("option",{value:String(a.value),children:a.label},String(a.value)))})]},r);if(s.type==="number"){const a=Number(i),x=Number.isNaN(a)?s.default:a;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.number})]}),e.jsx("input",{id:`pp-${r}`,type:"number",value:x,min:s.min,max:s.max,step:s.step,onChange:h=>{const y=h.target.valueAsNumber;o(r,Number.isNaN(y)?s.default:y)},className:p})]},r)}return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.string})]}),e.jsx("input",{id:`pp-${r}`,type:"text",value:String(i??""),onChange:a=>o(r,a.target.value),placeholder:s.placeholder,className:p})]},r)})})}),e.jsx("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:e.jsx("div",{className:"bear-w-full",children:v(g)})})]})};exports.PropsPlayground=R;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("../../utils/cn.cjs"),j=require("../Icon/Icon.cjs"),l=require("./PropsPlayground.const.cjs"),$=require("./PropsPlayground.utils.cjs"),q=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),I=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),O=({size:b})=>e.jsxs(j.Icon,{size:b,children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),R=({config:b,render:v,title:z="Props",size:S="md",defaultCollapsed:C=!1,showReset:w=!0,columns:P=3,className:L,testId:E})=>{const u=c.useMemo(()=>$.getDefaults(b),[b]),[g,f]=c.useState(u),[m,A]=c.useState(C),o=c.useCallback((r,s)=>{f(i=>({...i,[r]:s}))},[]),_=c.useCallback(()=>{f(u)},[u]),t=l.SIZE_CLASSES[S],N=Object.keys(b).length,p=n.cn("bear-w-full bear-rounded-md bear-border bear-border-zinc-700","bear-bg-zinc-800 bear-text-zinc-100","placeholder:bear-text-zinc-500","focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-primary-500/30 focus:bear-border-primary-500","bear-transition-colors",t.input);return e.jsxs("div",{"data-testid":E,className:n.cn(l.ROOT_CLASS,"bear-rounded-lg bear-border bear-border-zinc-700 bear-overflow-hidden",L),children:[e.jsxs("button",{type:"button",onClick:()=>A(r=>!r),className:n.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-font-medium bear-transition-colors","bear-bg-zinc-800/60 hover:bear-bg-zinc-800","bear-text-zinc-200 bear-border-b bear-border-zinc-700","bear-px-4 bear-py-3",t.text),children:[e.jsx("span",{className:"bear-text-primary-500",children:m?e.jsx(I,{size:12}):e.jsx(q,{size:12})}),e.jsx("span",{className:"bear-text-primary-500",children:e.jsx(O,{size:14})}),e.jsx("span",{className:"bear-font-semibold",children:z}),e.jsxs("span",{className:"bear-ml-auto bear-flex bear-items-center bear-gap-2",children:[e.jsxs("span",{className:"bear-text-[10px] bear-font-medium bear-text-zinc-500",children:[N," ",N===1?"control":"controls"]}),w&&!m&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),_()},className:"bear-text-[10px] bear-font-semibold bear-text-primary-500 hover:bear-text-primary-400 hover:bear-underline",children:"Reset"})]})]}),!m&&e.jsx("div",{className:n.cn("bear-bg-gray-50 dark:bear-bg-zinc-900/50",t.padding),children:e.jsx("div",{className:n.cn("bear-grid",t.gap,l.COLUMN_CLASSES[P]),children:Object.entries(b).map(([r,s])=>{const i=g[r],d=r.replace(/([A-Z])/g," $1").replace(/^./,a=>a.toUpperCase()).trim();if(s.type==="boolean"){const a=i===!0;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsx("span",{className:n.cn("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500 bear-mb-2",t.label),children:l.TYPE_LABELS.boolean}),e.jsxs("label",{className:"bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":a,onClick:()=>o(r,!a),className:n.cn("bear-relative bear-inline-flex bear-h-5 bear-w-9 bear-flex-shrink-0 bear-rounded-full bear-border-2 bear-border-transparent bear-transition-colors",a?"bear-bg-primary-500":"bear-bg-zinc-600"),children:e.jsx("span",{className:n.cn("bear-pointer-events-none bear-inline-block bear-h-4 bear-w-4 bear-transform bear-rounded-full bear-bg-white bear-shadow bear-transition",a?"bear-translate-x-4":"bear-translate-x-0")})}),e.jsx("span",{className:n.cn("bear-font-medium bear-text-zinc-200 bear-truncate",t.text),children:d})]})]},r)}if(s.type==="select"&&s.options)return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.select})]}),e.jsx("select",{id:`pp-${r}`,value:String(i),onChange:a=>{const x=s.options.find(h=>String(h.value)===a.target.value);o(r,x?x.value:a.target.value)},className:n.cn(p,"bear-cursor-pointer bear-appearance-none"),children:s.options.map(a=>e.jsx("option",{value:String(a.value),children:a.label},String(a.value)))})]},r);if(s.type==="number"){const a=Number(i),x=Number.isNaN(a)?s.default:a;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.number})]}),e.jsx("input",{id:`pp-${r}`,type:"number",value:x,min:s.min,max:s.max,step:s.step,onChange:h=>{const y=h.target.valueAsNumber;o(r,Number.isNaN(y)?s.default:y)},className:p})]},r)}return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.string})]}),e.jsx("input",{id:`pp-${r}`,type:"text",value:String(i??""),onChange:a=>o(r,a.target.value),placeholder:s.placeholder,className:p})]},r)})})}),e.jsx("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:e.jsx("div",{className:"bear-w-full",children:v(g)})})]})};exports.PropsPlayground=R;
|