@forgedevstack/bear 1.2.6 → 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 +6 -2
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +37 -36
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +32 -32
- package/dist/components/Backdrop/Backdrop.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.d.ts +2 -1
- package/dist/components/Backdrop/Backdrop.const.js +4 -3
- package/dist/components/Backdrop/Backdrop.js +36 -29
- package/dist/components/Backdrop/Backdrop.types.d.ts +2 -0
- 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 -1
- package/dist/components/Chip/Chip.const.d.ts +10 -0
- package/dist/components/Chip/Chip.const.js +11 -1
- package/dist/components/Chip/Chip.js +24 -22
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +6 -3
- package/dist/components/ChipGroup/ChipGroup.const.js +6 -3
- package/dist/components/ChipGroup/ChipGroup.js +83 -29
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +5 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +57 -54
- 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 +96 -96
- package/dist/components/MessageList/MessageList.cjs +1 -1
- package/dist/components/MessageList/MessageList.js +98 -92
- package/dist/components/MessageList/MessageList.types.d.ts +2 -0
- 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/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +108 -99
- 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/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 -1
- package/dist/components/Toast/Toast.const.js +7 -15
- package/dist/components/Toast/Toast.js +99 -95
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +267 -265
- package/dist/context/BearProvider.js +1 -1
- 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 +446 -431
- package/dist/styles.css +0 -4
- 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,53 +1,56 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useBearDirectionOptional as
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as S, useCallback as R } from "react";
|
|
3
|
+
import { createPortal as C } from "react-dom";
|
|
4
|
+
import { useBearDirectionOptional as L } from "../../context/BearProvider.js";
|
|
5
|
+
import { cn as T } from "../../utils/cn.js";
|
|
6
|
+
import { resolveBearId as F } from "../../utils/generateBearId.utils.js";
|
|
7
|
+
import { useBearId as P } from "../../utils/useBearId.js";
|
|
8
|
+
import { XIcon as j } from "../Icon/index.js";
|
|
9
|
+
import { Backdrop as $ } from "../Backdrop/Backdrop.js";
|
|
10
|
+
import { DRAWER_ANIMATION_MS as u, TRANSFORM_OPEN as q, TRANSFORM_CLOSED as z, SIZE_CLASSES as H, POSITION_CLASSES as W, BORDER_SIDE_MAP as X } from "./Drawer.const.js";
|
|
11
|
+
import { lockBodyScroll as Z } from "./Drawer.utils.js";
|
|
12
|
+
const ne = ({
|
|
10
13
|
isOpen: s,
|
|
11
14
|
onClose: o,
|
|
12
15
|
title: n,
|
|
13
|
-
children:
|
|
14
|
-
side:
|
|
15
|
-
anchor:
|
|
16
|
-
variant:
|
|
17
|
-
size:
|
|
18
|
-
showCloseButton:
|
|
19
|
-
closeOnBackdrop:
|
|
20
|
-
closeOnEscape:
|
|
21
|
-
className:
|
|
22
|
-
container:
|
|
23
|
-
id:
|
|
24
|
-
testId:
|
|
16
|
+
children: N,
|
|
17
|
+
side: g = "right",
|
|
18
|
+
anchor: E,
|
|
19
|
+
variant: G = "temporary",
|
|
20
|
+
size: I = "md",
|
|
21
|
+
showCloseButton: f = !0,
|
|
22
|
+
closeOnBackdrop: _ = !0,
|
|
23
|
+
closeOnEscape: p = !0,
|
|
24
|
+
className: y,
|
|
25
|
+
container: D,
|
|
26
|
+
id: A,
|
|
27
|
+
testId: B
|
|
25
28
|
}) => {
|
|
26
|
-
const { direction: h } =
|
|
27
|
-
|
|
29
|
+
const M = P("Drawer"), d = F(A, M), { direction: h } = L(), i = E ?? g, r = h === "rtl" && (i === "left" || i === "right") ? i === "left" ? "right" : "left" : i, [a, v] = m(s), [k, b] = m(!1), [x, w] = m(!1);
|
|
30
|
+
S(() => {
|
|
28
31
|
if (s) {
|
|
29
32
|
v(!0), b(!1);
|
|
30
|
-
const e = requestAnimationFrame(() =>
|
|
33
|
+
const e = requestAnimationFrame(() => w(!0));
|
|
31
34
|
return () => cancelAnimationFrame(e);
|
|
32
35
|
}
|
|
33
36
|
if (a) {
|
|
34
|
-
|
|
37
|
+
w(!1), b(!0);
|
|
35
38
|
const e = setTimeout(() => {
|
|
36
39
|
v(!1), b(!1);
|
|
37
40
|
}, u);
|
|
38
41
|
return () => clearTimeout(e);
|
|
39
42
|
}
|
|
40
43
|
}, [s, a]);
|
|
41
|
-
const l =
|
|
44
|
+
const l = R(
|
|
42
45
|
(e) => {
|
|
43
|
-
|
|
46
|
+
p && e.key === "Escape" && o();
|
|
44
47
|
},
|
|
45
|
-
[
|
|
48
|
+
[p, o]
|
|
46
49
|
);
|
|
47
|
-
if (
|
|
50
|
+
if (S(() => {
|
|
48
51
|
if (a) {
|
|
49
52
|
document.addEventListener("keydown", l);
|
|
50
|
-
const e =
|
|
53
|
+
const e = Z();
|
|
51
54
|
return () => {
|
|
52
55
|
document.removeEventListener("keydown", l), e();
|
|
53
56
|
};
|
|
@@ -56,64 +59,64 @@ const U = ({
|
|
|
56
59
|
document.removeEventListener("keydown", l);
|
|
57
60
|
};
|
|
58
61
|
}, [a, l]), !a) return null;
|
|
59
|
-
const
|
|
62
|
+
const O = /* @__PURE__ */ c("div", { id: d, "data-testid": B, className: "Bear-Drawer bear-fixed bear-inset-0 bear-z-[11000]", children: [
|
|
60
63
|
/* @__PURE__ */ t(
|
|
61
|
-
|
|
64
|
+
$,
|
|
62
65
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
onClick:
|
|
69
|
-
"aria-hidden": "true"
|
|
66
|
+
open: x && !k,
|
|
67
|
+
keepMounted: !0,
|
|
68
|
+
blur: !0,
|
|
69
|
+
transitionDuration: u,
|
|
70
|
+
className: "Bear-Drawer__backdrop",
|
|
71
|
+
onClick: _ ? () => o() : void 0
|
|
70
72
|
}
|
|
71
73
|
),
|
|
72
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ c(
|
|
73
75
|
"div",
|
|
74
76
|
{
|
|
75
77
|
role: "dialog",
|
|
76
78
|
"aria-modal": "true",
|
|
77
|
-
"aria-labelledby": n ?
|
|
78
|
-
className:
|
|
79
|
+
"aria-labelledby": n ? `${d}-title` : void 0,
|
|
80
|
+
className: T(
|
|
81
|
+
"Bear-Drawer__panel",
|
|
79
82
|
"bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl",
|
|
80
83
|
"bear-border-neutral-200 dark:bear-border-neutral-700",
|
|
81
84
|
"bear-flex bear-flex-col bear-overflow-hidden",
|
|
82
85
|
"bear-transform bear-transition-transform",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
X[r],
|
|
87
|
+
W[r],
|
|
88
|
+
H[r][I],
|
|
89
|
+
x && !k ? q[r] : z[r],
|
|
90
|
+
y
|
|
88
91
|
),
|
|
89
92
|
style: { transitionDuration: `${u}ms` },
|
|
90
93
|
children: [
|
|
91
|
-
(n ||
|
|
94
|
+
(n || f) && /* @__PURE__ */ c("div", { className: "bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0", dir: h, children: [
|
|
92
95
|
n && /* @__PURE__ */ t(
|
|
93
96
|
"h2",
|
|
94
97
|
{
|
|
95
|
-
id:
|
|
98
|
+
id: `${d}-title`,
|
|
96
99
|
className: "bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",
|
|
97
100
|
children: n
|
|
98
101
|
}
|
|
99
102
|
),
|
|
100
|
-
|
|
103
|
+
f && /* @__PURE__ */ t(
|
|
101
104
|
"button",
|
|
102
105
|
{
|
|
103
106
|
onClick: o,
|
|
104
107
|
className: "bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors",
|
|
105
108
|
"aria-label": "Close drawer",
|
|
106
|
-
children: /* @__PURE__ */ t(
|
|
109
|
+
children: /* @__PURE__ */ t(j, { className: "bear-w-5 bear-h-5" })
|
|
107
110
|
}
|
|
108
111
|
)
|
|
109
112
|
] }),
|
|
110
|
-
/* @__PURE__ */ t("div", { className: "bear-flex-1 bear-min-h-0 bear-overflow-y-auto bear-overscroll-contain bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300", children:
|
|
113
|
+
/* @__PURE__ */ t("div", { className: "bear-flex-1 bear-min-h-0 bear-overflow-y-auto bear-overscroll-contain bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300", children: N })
|
|
111
114
|
]
|
|
112
115
|
}
|
|
113
116
|
)
|
|
114
117
|
] });
|
|
115
|
-
return
|
|
118
|
+
return C(O, D ?? document.body);
|
|
116
119
|
};
|
|
117
120
|
export {
|
|
118
|
-
|
|
121
|
+
ne as Drawer
|
|
119
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),e=require("./EmptyState.const.cjs"),a=require("../../utils/cn.cjs");require("react");const A=require("../../utils/generateBearId.utils.cjs"),m=require("../../utils/useBearId.cjs"),C=({className:r})=>s.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),h=({icon:r,title:l,description:S,action:n,secondaryAction:c,className:d,size:i="md",variant:E="default",id:T,testId:_})=>{const o=m.useBearId("EmptyState"),u=A.resolveBearId(T,o),t=e.EMPTY_STATE_SIZE_CLASSES[i];return s.jsxs("div",{id:u,"data-testid":_,className:a.cn(e.EMPTY_STATE_ROOT_CLASS,e.EMPTY_STATE_BASE_CLASSES,t.padding,E==="card"&&e.EMPTY_STATE_CARD_CLASSES,d),children:[s.jsx("div",{className:a.cn(e.EMPTY_STATE_ICON_CLASSES,t.icon),children:r||s.jsx(C,{className:"bear-w-full bear-h-full"})}),s.jsx("h3",{className:a.cn(e.EMPTY_STATE_TITLE_CLASSES,t.title),children:l}),S&&s.jsx("p",{className:a.cn(e.EMPTY_STATE_DESCRIPTION_CLASSES,t.desc),children:S}),(n||c)&&s.jsxs("div",{className:`${e.EMPTY_STATE_ROOT_CLASS}__actions bear-flex bear-items-center bear-gap-3`,children:[n,c]})]})};exports.EmptyState=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-EmptyState",S="bear-flex bear-flex-col bear-items-center bear-text-center",r="bear-bg-[var(--bear-bg-secondary)] bear-rounded-xl bear-border bear-border-[var(--bear-border-default)]",a="bear-text-[var(--bear-text-muted)] bear-mb-4",t="bear-font-semibold bear-text-[var(--bear-text-primary)] bear-mb-2",b="bear-text-[var(--bear-text-secondary)] bear-max-w-md bear-mb-6",T={sm:{icon:"bear-w-12 bear-h-12",title:"bear-text-lg",desc:"bear-text-sm",padding:"bear-py-6 bear-px-4"},md:{icon:"bear-w-16 bear-h-16",title:"bear-text-xl",desc:"bear-text-base",padding:"bear-py-10 bear-px-6"},lg:{icon:"bear-w-20 bear-h-20",title:"bear-text-2xl",desc:"bear-text-lg",padding:"bear-py-14 bear-px-8"}};exports.EMPTY_STATE_BASE_CLASSES=S;exports.EMPTY_STATE_CARD_CLASSES=r;exports.EMPTY_STATE_DESCRIPTION_CLASSES=b;exports.EMPTY_STATE_ICON_CLASSES=a;exports.EMPTY_STATE_ROOT_CLASS=e;exports.EMPTY_STATE_SIZE_CLASSES=T;exports.EMPTY_STATE_TITLE_CLASSES=t;
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const EMPTY_STATE_ROOT_CLASS = "Bear-EmptyState";
|
|
2
|
+
export declare const EMPTY_STATE_BASE_CLASSES = "bear-flex bear-flex-col bear-items-center bear-text-center";
|
|
3
|
+
export declare const EMPTY_STATE_CARD_CLASSES = "bear-bg-[var(--bear-bg-secondary)] bear-rounded-xl bear-border bear-border-[var(--bear-border-default)]";
|
|
4
|
+
export declare const EMPTY_STATE_ICON_CLASSES = "bear-text-[var(--bear-text-muted)] bear-mb-4";
|
|
5
|
+
export declare const EMPTY_STATE_TITLE_CLASSES = "bear-font-semibold bear-text-[var(--bear-text-primary)] bear-mb-2";
|
|
6
|
+
export declare const EMPTY_STATE_DESCRIPTION_CLASSES = "bear-text-[var(--bear-text-secondary)] bear-max-w-md bear-mb-6";
|
|
7
|
+
export declare const EMPTY_STATE_SIZE_CLASSES: {
|
|
8
|
+
readonly sm: {
|
|
9
|
+
readonly icon: "bear-w-12 bear-h-12";
|
|
10
|
+
readonly title: "bear-text-lg";
|
|
11
|
+
readonly desc: "bear-text-sm";
|
|
12
|
+
readonly padding: "bear-py-6 bear-px-4";
|
|
13
|
+
};
|
|
14
|
+
readonly md: {
|
|
15
|
+
readonly icon: "bear-w-16 bear-h-16";
|
|
16
|
+
readonly title: "bear-text-xl";
|
|
17
|
+
readonly desc: "bear-text-base";
|
|
18
|
+
readonly padding: "bear-py-10 bear-px-6";
|
|
19
|
+
};
|
|
20
|
+
readonly lg: {
|
|
21
|
+
readonly icon: "bear-w-20 bear-h-20";
|
|
22
|
+
readonly title: "bear-text-2xl";
|
|
23
|
+
readonly desc: "bear-text-lg";
|
|
24
|
+
readonly padding: "bear-py-14 bear-px-8";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = "Bear-EmptyState", r = "bear-flex bear-flex-col bear-items-center bear-text-center", a = "bear-bg-[var(--bear-bg-secondary)] bear-rounded-xl bear-border bear-border-[var(--bear-border-default)]", b = "bear-text-[var(--bear-text-muted)] bear-mb-4", t = "bear-font-semibold bear-text-[var(--bear-text-primary)] bear-mb-2", S = "bear-text-[var(--bear-text-secondary)] bear-max-w-md bear-mb-6", E = {
|
|
2
|
+
sm: {
|
|
3
|
+
icon: "bear-w-12 bear-h-12",
|
|
4
|
+
title: "bear-text-lg",
|
|
5
|
+
desc: "bear-text-sm",
|
|
6
|
+
padding: "bear-py-6 bear-px-4"
|
|
7
|
+
},
|
|
8
|
+
md: {
|
|
9
|
+
icon: "bear-w-16 bear-h-16",
|
|
10
|
+
title: "bear-text-xl",
|
|
11
|
+
desc: "bear-text-base",
|
|
12
|
+
padding: "bear-py-10 bear-px-6"
|
|
13
|
+
},
|
|
14
|
+
lg: {
|
|
15
|
+
icon: "bear-w-20 bear-h-20",
|
|
16
|
+
title: "bear-text-2xl",
|
|
17
|
+
desc: "bear-text-lg",
|
|
18
|
+
padding: "bear-py-14 bear-px-8"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
r as EMPTY_STATE_BASE_CLASSES,
|
|
23
|
+
a as EMPTY_STATE_CARD_CLASSES,
|
|
24
|
+
S as EMPTY_STATE_DESCRIPTION_CLASSES,
|
|
25
|
+
b as EMPTY_STATE_ICON_CLASSES,
|
|
26
|
+
e as EMPTY_STATE_ROOT_CLASS,
|
|
27
|
+
E as EMPTY_STATE_SIZE_CLASSES,
|
|
28
|
+
t as EMPTY_STATE_TITLE_CLASSES
|
|
29
|
+
};
|
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { EMPTY_STATE_SIZE_CLASSES as p, EMPTY_STATE_ICON_CLASSES as h, EMPTY_STATE_TITLE_CLASSES as C, EMPTY_STATE_DESCRIPTION_CLASSES as f, EMPTY_STATE_ROOT_CLASS as d, EMPTY_STATE_CARD_CLASSES as I, EMPTY_STATE_BASE_CLASSES as L } from "./EmptyState.const.js";
|
|
3
|
+
import { cn as r } from "../../utils/cn.js";
|
|
3
4
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { resolveBearId as u } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as v } from "../../utils/useBearId.js";
|
|
7
|
+
const M = ({ className: t }) => /* @__PURE__ */ e("svg", { className: t, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
8
|
+
"path",
|
|
9
|
+
{
|
|
10
|
+
strokeLinecap: "round",
|
|
11
|
+
strokeLinejoin: "round",
|
|
12
|
+
strokeWidth: 1.5,
|
|
13
|
+
d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
|
|
14
|
+
}
|
|
15
|
+
) }), k = ({
|
|
16
|
+
icon: t,
|
|
17
|
+
title: E,
|
|
18
|
+
description: s,
|
|
19
|
+
action: S,
|
|
20
|
+
secondaryAction: o,
|
|
21
|
+
className: i,
|
|
22
|
+
size: T = "md",
|
|
23
|
+
variant: m = "default",
|
|
24
|
+
id: n,
|
|
25
|
+
testId: _
|
|
13
26
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const c = v("EmptyState"), A = u(n, c), a = p[T];
|
|
28
|
+
return /* @__PURE__ */ l(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
id: A,
|
|
32
|
+
"data-testid": _,
|
|
33
|
+
className: r(
|
|
34
|
+
d,
|
|
35
|
+
L,
|
|
36
|
+
a.padding,
|
|
37
|
+
m === "card" && I,
|
|
38
|
+
i
|
|
39
|
+
),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ e("div", { className: r(h, a.icon), children: t || /* @__PURE__ */ e(M, { className: "bear-w-full bear-h-full" }) }),
|
|
42
|
+
/* @__PURE__ */ e("h3", { className: r(C, a.title), children: E }),
|
|
43
|
+
s && /* @__PURE__ */ e("p", { className: r(f, a.desc), children: s }),
|
|
44
|
+
(S || o) && /* @__PURE__ */ l("div", { className: `${d}__actions bear-flex bear-items-center bear-gap-3`, children: [
|
|
45
|
+
S,
|
|
46
|
+
o
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
33
51
|
};
|
|
34
52
|
export {
|
|
35
|
-
|
|
53
|
+
k as EmptyState
|
|
36
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),d=require("../../utils/cn.cjs"),we=require("../../utils/generateBearId.utils.cjs"),Ce=require("../../utils/useBearId.cjs"),T=require("../../context/BearProvider.cjs"),Ne=require("./components/ClearIcon/ClearIcon.cjs"),Te=require("./Input.utils.cjs"),Se=require("../Form/Form.utils.cjs"),c=require("./Input.const.cjs"),Q=o.forwardRef(({label:S,helperText:V,error:v,success:E,size:j="md",variant:Ee,radius:je,InputProps:l,leftAddon:Y,rightAddon:Z,prefix:ke,suffix:Ae,fullWidth:ee=!1,clearable:re=!1,onClear:ae,showCharCount:k=!1,charCountMax:te,autoFormat:m,validation:t,validateOnBlur:se,validateOnChange:A=!1,loading:Le,copyable:qe,onCopy:Ue,floatingLabel:Oe,multiline:b=!1,rows:ne,minRows:oe=c.INPUT_MULTILINE_MIN_ROWS,maxRows:Me,readOnly:L,inputRef:s,inputProps:q,id:ie,testId:ce,className:le,disabled:u,value:f,defaultValue:_,maxLength:B,onChange:x,onBlur:p,...U},n)=>{var K;const be=Ce.useBearId("Input"),w=we.resolveBearId(ie,be),{density:de}=T.useBearDensityOptional(),O=de==="compact",C=o.useContext(T.BearContext),r=(K=C==null?void 0:C.components)==null?void 0:K.Input,ue=r==null?void 0:r.root,fe=r==null?void 0:r.input,_e=r==null?void 0:r.label,xe=r==null?void 0:r.helper,pe=r==null?void 0:r.prefix,he=r==null?void 0:r.suffix,[ge,M]=o.useState(null),R=o.useRef(!1),Ie=O?c.INPUT_TEXT_COMPACT_CLASSES:c.INPUT_TEXT_CLASSES,ye=O?c.INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES:c.INPUT_WRAPPER_HEIGHT_CLASSES,H=t?se??!0:!1,P=v||ge,i=!!P,h=!!E&&!i,g=te??B,N=typeof f=="string"?f.length:typeof _=="string"?_.length:0,W=g!=null&&N>g,ve=re&&!u&&N>0,{direction:me}=T.useBearDirectionOptional(),D=(l==null?void 0:l.startAdornment)??Y,F=(l==null?void 0:l.endAdornment)??Z,G=P||E||V,I=o.useCallback(async e=>{if(!t)return;R.current=!0;const y=await Se.validateFieldValue(e,t);R.current=!1,M(y)},[t]);o.useEffect(()=>{v&&M(null)},[v]);const X=o.useCallback(e=>{if(m&&!b){const y=Te.applyAutoFormat(e.target.value,m);y!==e.target.value&&(e.target.value=y)}x==null||x(e),A&&t&&I(e.target.value)},[m,b,x,A,t,I]),$=o.useCallback(e=>{p==null||p(e),H&&t&&I(e.target.value)},[p,H,t,I]),z=d.cn("Bear-Input__field","bear-flex-1 bear-min-w-0 bear-border-0 bear-outline-none bear-bg-transparent","placeholder:opacity-100 placeholder:[color:var(--bear-text-muted)]",Ie[j],b&&"bear-resize-y bear-py-2 bear-min-h-0 bear-h-auto",le),J={color:"var(--bear-text-primary)",...fe},Be=ne??oe??c.INPUT_MULTILINE_DEFAULT_ROWS;return a.jsxs("div",{id:w,"data-testid":ce,className:d.cn(c.INPUT_ROOT_CLASS,"bear-flex bear-flex-col bear-gap-1.5",ee&&"bear-w-full"),style:ue,children:[S&&a.jsx("label",{className:"Bear-Input__label bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)",..._e},children:S}),a.jsxs("div",{className:d.cn("Bear-Input__wrapper bear-flex bear-items-center bear-rounded-lg bear-border bear-overflow-hidden bear-transition-all bear-duration-200","focus-within:bear-ring-2 focus-within:bear-ring-offset-2","focus-within:bear-ring-offset-[var(--bear-bg-primary)]",i?"Bear-Input__wrapper--error bear-border-red-500 focus-within:bear-ring-red-500":h?"Bear-Input__wrapper--success bear-border-green-500 focus-within:bear-ring-green-500":"focus-within:bear-border-bear-500 focus-within:bear-ring-bear-500 dark:focus-within:bear-border-bear-500 dark:focus-within:bear-ring-bear-500",u&&"bear-opacity-50 bear-cursor-not-allowed",!b&&ye[j]),dir:me,style:{backgroundColor:"var(--bear-bg-primary)",borderColor:i||h?void 0:"var(--bear-border-default)"},children:[D&&a.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--left bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-text-sm bear-font-medium bear-select-none bear-pointer-events-none",style:{backgroundColor:"var(--bear-bg-tertiary)",borderInlineEnd:"1px solid var(--bear-border-default)",color:"var(--bear-text-secondary)",...pe},children:D}),b?a.jsx("textarea",{ref:e=>{typeof n=="function"?n(e):n&&(n.current=e),typeof s=="function"?s(e):s&&(s.current=e)},id:`${w}-field`,disabled:u,readOnly:L,value:f,defaultValue:_,maxLength:B,rows:Be,"aria-invalid":i||void 0,className:z,style:J,...q,...U,onChange:e=>X(e),onBlur:e=>$(e)}):a.jsx("input",{ref:e=>{typeof n=="function"?n(e):n&&(n.current=e),typeof s=="function"?s(e):s&&(s.current=e)},id:`${w}-field`,disabled:u,readOnly:L,value:f,defaultValue:_,maxLength:B,"aria-invalid":i||void 0,onChange:X,onBlur:$,className:z,style:J,...q,...U}),ve&&a.jsx("div",{className:"Bear-Input__clear bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-2 bear-cursor-pointer",style:{color:"var(--bear-text-muted)"},children:a.jsx(Ne.ClearIcon,{onClick:ae})}),F&&a.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--right bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-gap-1.5",style:{backgroundColor:"var(--bear-bg-tertiary)",borderInlineStart:"1px solid var(--bear-border-default)",color:"var(--bear-text-secondary)",...he},children:F})]}),a.jsxs("div",{className:"Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2",children:[G?a.jsx("p",{className:d.cn("Bear-Input__helper bear-text-sm bear-flex-1",i&&"Bear-Input__helper--error bear-text-red-500",h&&"Bear-Input__helper--success bear-text-green-500"),style:{...i||h?{}:{color:"var(--bear-text-muted)"},...xe},children:G}):k?a.jsx("span",{}):null,k&&g!=null&&a.jsxs("span",{className:d.cn("Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",W&&"bear-text-red-500"),style:W?void 0:{color:"var(--bear-text-muted)"},children:[N,"/",g]})]})]})});Q.displayName="Input";exports.Input=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="Bear-Input",T={sm:"bear-h-8",md:"bear-h-10",lg:"bear-h-12"},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="Bear-Input",T={sm:"bear-h-8",md:"bear-h-10",lg:"bear-h-12"},e={sm:"bear-h-7",md:"bear-h-8",lg:"bear-h-10"},S={sm:"bear-text-sm bear-px-3",md:"bear-text-base bear-px-4",lg:"bear-text-lg bear-px-5"},I={sm:"bear-text-xs bear-px-2.5",md:"bear-text-sm bear-px-3",lg:"bear-text-base bear-px-4"},P=3,t=4;exports.INPUT_MULTILINE_DEFAULT_ROWS=t;exports.INPUT_MULTILINE_MIN_ROWS=P;exports.INPUT_ROOT_CLASS=_;exports.INPUT_TEXT_CLASSES=S;exports.INPUT_TEXT_COMPACT_CLASSES=I;exports.INPUT_WRAPPER_HEIGHT_CLASSES=T;exports.INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES=e;
|
|
@@ -4,10 +4,20 @@ export declare const INPUT_WRAPPER_HEIGHT_CLASSES: {
|
|
|
4
4
|
readonly md: "bear-h-10";
|
|
5
5
|
readonly lg: "bear-h-12";
|
|
6
6
|
};
|
|
7
|
+
export declare const INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES: {
|
|
8
|
+
readonly sm: "bear-h-7";
|
|
9
|
+
readonly md: "bear-h-8";
|
|
10
|
+
readonly lg: "bear-h-10";
|
|
11
|
+
};
|
|
7
12
|
export declare const INPUT_TEXT_CLASSES: {
|
|
8
13
|
readonly sm: "bear-text-sm bear-px-3";
|
|
9
14
|
readonly md: "bear-text-base bear-px-4";
|
|
10
15
|
readonly lg: "bear-text-lg bear-px-5";
|
|
11
16
|
};
|
|
17
|
+
export declare const INPUT_TEXT_COMPACT_CLASSES: {
|
|
18
|
+
readonly sm: "bear-text-xs bear-px-2.5";
|
|
19
|
+
readonly md: "bear-text-sm bear-px-3";
|
|
20
|
+
readonly lg: "bear-text-base bear-px-4";
|
|
21
|
+
};
|
|
12
22
|
export declare const INPUT_MULTILINE_MIN_ROWS = 3;
|
|
13
23
|
export declare const INPUT_MULTILINE_DEFAULT_ROWS = 4;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
const e = "Bear-Input",
|
|
1
|
+
const e = "Bear-Input", a = {
|
|
2
2
|
sm: "bear-h-8",
|
|
3
3
|
md: "bear-h-10",
|
|
4
4
|
lg: "bear-h-12"
|
|
5
|
-
},
|
|
5
|
+
}, t = {
|
|
6
|
+
sm: "bear-h-7",
|
|
7
|
+
md: "bear-h-8",
|
|
8
|
+
lg: "bear-h-10"
|
|
9
|
+
}, b = {
|
|
6
10
|
sm: "bear-text-sm bear-px-3",
|
|
7
11
|
md: "bear-text-base bear-px-4",
|
|
8
12
|
lg: "bear-text-lg bear-px-5"
|
|
9
|
-
},
|
|
13
|
+
}, r = {
|
|
14
|
+
sm: "bear-text-xs bear-px-2.5",
|
|
15
|
+
md: "bear-text-sm bear-px-3",
|
|
16
|
+
lg: "bear-text-base bear-px-4"
|
|
17
|
+
}, _ = 3, T = 4;
|
|
10
18
|
export {
|
|
11
19
|
T as INPUT_MULTILINE_DEFAULT_ROWS,
|
|
12
|
-
|
|
20
|
+
_ as INPUT_MULTILINE_MIN_ROWS,
|
|
13
21
|
e as INPUT_ROOT_CLASS,
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
b as INPUT_TEXT_CLASSES,
|
|
23
|
+
r as INPUT_TEXT_COMPACT_CLASSES,
|
|
24
|
+
a as INPUT_WRAPPER_HEIGHT_CLASSES,
|
|
25
|
+
t as INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES
|
|
16
26
|
};
|