@forgedevstack/bear 1.2.6 → 1.2.8
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/AppShell/AppShell.cjs +1 -0
- package/dist/components/AppShell/AppShell.const.cjs +1 -0
- package/dist/components/AppShell/AppShell.const.d.ts +19 -0
- package/dist/components/AppShell/AppShell.const.js +25 -0
- package/dist/components/AppShell/AppShell.d.ts +3 -0
- package/dist/components/AppShell/AppShell.js +82 -0
- package/dist/components/AppShell/AppShell.types.d.ts +16 -0
- package/dist/components/AppShell/index.d.ts +2 -0
- 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/Banner/Banner.cjs +1 -0
- package/dist/components/Banner/Banner.const.cjs +1 -0
- package/dist/components/Banner/Banner.const.d.ts +21 -0
- package/dist/components/Banner/Banner.const.js +33 -0
- package/dist/components/Banner/Banner.d.ts +3 -0
- package/dist/components/Banner/Banner.js +70 -0
- package/dist/components/Banner/Banner.types.d.ts +21 -0
- package/dist/components/Banner/helpers/BannerErrorSvg.cjs +1 -0
- package/dist/components/Banner/helpers/BannerErrorSvg.d.ts +2 -0
- package/dist/components/Banner/helpers/BannerErrorSvg.js +22 -0
- package/dist/components/Banner/helpers/BannerInfoSvg.cjs +1 -0
- package/dist/components/Banner/helpers/BannerInfoSvg.d.ts +2 -0
- package/dist/components/Banner/helpers/BannerInfoSvg.js +22 -0
- package/dist/components/Banner/helpers/BannerSuccessSvg.cjs +1 -0
- package/dist/components/Banner/helpers/BannerSuccessSvg.d.ts +2 -0
- package/dist/components/Banner/helpers/BannerSuccessSvg.js +21 -0
- package/dist/components/Banner/helpers/BannerWarningSvg.cjs +1 -0
- package/dist/components/Banner/helpers/BannerWarningSvg.d.ts +2 -0
- package/dist/components/Banner/helpers/BannerWarningSvg.js +22 -0
- package/dist/components/Banner/helpers/index.d.ts +4 -0
- package/dist/components/Banner/index.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 +6 -0
- package/dist/components/index.js +277 -271
- 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 +452 -433
- 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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),t=require("./Select.const.cjs"),A=require("../Icon/index.cjs"),Z=require("../Portal/Portal.cjs"),n=require("../../utils/cn.cjs"),G=require("../../utils/generateBearId.utils.cjs"),V=require("../../utils/useBearId.cjs"),W=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const H=require("../../hooks/useFormControl/useFormControl.cjs"),J=P=>{const{options:E,value:s,onChange:i,placeholder:x=t.SELECT_DEFAULT_PLACEHOLDER,label:u,error:S,disabled:D=!1,required:M=!1,size:C="md",fullWidth:T=!1,displayEmpty:m=!1,renderValue:O,native:_=!1,className:j,id:B,testId:N}=P,$=V.useBearId("Select"),f=G.resolveBearId(B,$),a=H.useFormControl(),[l,h]=b.useState(!1),[g,F]=b.useState({top:0,left:0,width:0}),w=b.useRef(null),q=b.useRef(null),d=D||!!(a!=null&&a.disabled),y=M||!!(a!=null&&a.required),o=!!S||!!(a!=null&&a.error),v=typeof S=="string"?S:void 0,p=E.find(e=>e.value===s),L=s===void 0||s==="",I=L||m&&L,U=b.useCallback(()=>h(!1),[]);W.useClickOutsideMultiple([w,q],U,{enabled:l&&!_&&!d});const z=e=>{i==null||i(e),h(!1)};b.useEffect(()=>{if(!l||_)return;const e=()=>{var k;const c=(k=w.current)==null?void 0:k.getBoundingClientRect();c&&F({top:c.bottom+t.SELECT_MENU_OFFSET_PX,left:Math.max(t.SELECT_MENU_EDGE_PAD_PX,Math.min(c.left,window.innerWidth-c.width-t.SELECT_MENU_EDGE_PAD_PX)),width:c.width})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[l,_]);const X=O&&!L?O(s):I||!p?x:p.label,R={backgroundColor:"var(--bear-bg-primary)",borderColor:o?void 0:"var(--bear-border-default)",color:p&&!I?"var(--bear-text-primary)":"var(--bear-text-muted)"};return _?r.jsxs("div",{id:f,"data-testid":N,className:n.cn(t.S_E_L_E_C_T_ROOT_CLASS,"bear-relative bear-flex bear-flex-col bear-gap-1.5",T&&"bear-w-full"),children:[u&&r.jsx("label",{htmlFor:`${f}-native`,className:"bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)"},children:u}),r.jsxs("select",{id:`${f}-native`,disabled:d,required:y,value:s??"",onChange:e=>i==null?void 0:i(e.target.value),className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__native`,"bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200","focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",o?"bear-border-red-500 focus:bear-ring-red-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500",d&&"bear-opacity-50 bear-cursor-not-allowed",t.SELECT_SIZE_CLASSES[C],j),style:R,"aria-invalid":o||void 0,"aria-required":y||void 0,"aria-describedby":a==null?void 0:a.helperId,children:[(m||x)&&r.jsx("option",{value:"",disabled:!m,children:x}),E.map(e=>r.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))]}),v&&r.jsx("p",{className:"bear-text-sm bear-text-red-500",children:v})]}):r.jsxs("div",{ref:w,id:f,"data-testid":N,className:n.cn(t.S_E_L_E_C_T_ROOT_CLASS,"bear-relative bear-flex bear-flex-col bear-gap-1.5",T&&"bear-w-full"),children:[u&&r.jsx("label",{className:"bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)"},children:u}),r.jsxs("button",{type:"button",disabled:d,onClick:()=>!d&&h(!l),className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__trigger`,"bear-flex bear-items-center bear-justify-between bear-w-full","bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200","focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",o?"bear-border-red-500 focus:bear-ring-red-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",d&&"bear-opacity-50 bear-cursor-not-allowed",t.SELECT_SIZE_CLASSES[C],j),style:R,"aria-haspopup":"listbox","aria-expanded":l,"aria-invalid":o||void 0,"aria-required":y||void 0,"aria-describedby":a==null?void 0:a.helperId,children:[r.jsx("span",{className:`${t.S_E_L_E_C_T_ROOT_CLASS}__value`,children:X}),r.jsx(A.ChevronDownIcon,{className:n.cn("bear-w-4 bear-h-4 bear-shrink-0 bear-transition-transform",l&&"bear-rotate-180"),style:{color:"var(--bear-text-muted)"}})]}),l&&r.jsx(Z.Portal,{children:r.jsx("div",{ref:q,className:`${t.S_E_L_E_C_T_ROOT_CLASS}__menu bear-fixed bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden`,style:{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",top:g.top,left:g.left,width:g.width,zIndex:t.SELECT_MENU_Z_INDEX},role:"listbox",children:r.jsx("div",{className:"bear-max-h-60 bear-overflow-y-auto",children:E.map(e=>r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>!e.disabled&&z(e.value),role:"option","aria-selected":e.value===s,className:n.cn(`${t.S_E_L_E_C_T_ROOT_CLASS}__option`,"bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2","bear-text-left bear-transition-colors",e.disabled&&"bear-cursor-not-allowed",e.value===s&&"bear-bg-bear-100 bear-text-bear-700 dark:bear-bg-bear-600/20 dark:bear-text-bear-300",!e.disabled&&e.value!==s&&"hover:bear-bg-[var(--bear-bg-tertiary)]"),style:e.disabled?{color:"var(--bear-text-muted)"}:e.value===s?void 0:{color:"var(--bear-text-secondary)"},children:[e.label,e.value===s&&r.jsx(A.CheckIcon,{className:"bear-w-4 bear-h-4 bear-shrink-0 bear-text-bear-600 dark:bear-text-bear-400"})]},e.value))})})}),v&&r.jsx("p",{className:"bear-text-sm bear-text-red-500",children:v})]})};exports.Select=J;
|
|
@@ -1,151 +1,160 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { SELECT_DEFAULT_PLACEHOLDER as
|
|
4
|
-
import { ChevronDownIcon as
|
|
5
|
-
import { Portal as
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B, useRef as R, useCallback as G, useEffect as H } from "react";
|
|
3
|
+
import { SELECT_DEFAULT_PLACEHOLDER as J, SELECT_SIZE_CLASSES as $, S_E_L_E_C_T_ROOT_CLASS as s, SELECT_MENU_Z_INDEX as K, SELECT_MENU_EDGE_PAD_PX as q, SELECT_MENU_OFFSET_PX as Q } from "./Select.const.js";
|
|
4
|
+
import { ChevronDownIcon as Y, CheckIcon as ee } from "../Icon/index.js";
|
|
5
|
+
import { Portal as re } from "../Portal/Portal.js";
|
|
6
6
|
import { cn as b } from "../../utils/cn.js";
|
|
7
|
-
import { resolveBearId as
|
|
8
|
-
import { useBearId as
|
|
9
|
-
import { useClickOutsideMultiple as
|
|
7
|
+
import { resolveBearId as ae } from "../../utils/generateBearId.utils.js";
|
|
8
|
+
import { useBearId as te } from "../../utils/useBearId.js";
|
|
9
|
+
import { useClickOutsideMultiple as le } from "../../hooks/useClickOutside.js";
|
|
10
10
|
import "../../context/BearProvider.js";
|
|
11
11
|
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
12
|
-
import "
|
|
13
|
-
const
|
|
12
|
+
import { useFormControl as se } from "../../hooks/useFormControl/useFormControl.js";
|
|
13
|
+
const xe = (A) => {
|
|
14
14
|
const {
|
|
15
|
-
options:
|
|
16
|
-
value:
|
|
17
|
-
onChange:
|
|
18
|
-
placeholder: h =
|
|
19
|
-
label:
|
|
20
|
-
error:
|
|
21
|
-
disabled:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
options: p,
|
|
16
|
+
value: t,
|
|
17
|
+
onChange: i,
|
|
18
|
+
placeholder: h = J,
|
|
19
|
+
label: u,
|
|
20
|
+
error: x,
|
|
21
|
+
disabled: F = !1,
|
|
22
|
+
required: j = !1,
|
|
23
|
+
size: L = "md",
|
|
24
|
+
fullWidth: k = !1,
|
|
25
|
+
displayEmpty: w = !1,
|
|
26
|
+
renderValue: I,
|
|
27
|
+
native: f = !1,
|
|
28
|
+
className: C,
|
|
29
|
+
id: z,
|
|
30
|
+
testId: P
|
|
31
|
+
} = A, U = te("Select"), m = ae(z, U), r = se(), [l, g] = B(!1), [y, X] = B({
|
|
31
32
|
top: 0,
|
|
32
33
|
left: 0,
|
|
33
34
|
width: 0
|
|
34
|
-
}), E =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
}), E = R(null), T = R(null), d = F || !!(r != null && r.disabled), _ = j || !!(r != null && r.required), o = !!x || !!(r != null && r.error), v = typeof x == "string" ? x : void 0, N = p.find((e) => e.value === t), S = t === void 0 || t === "", D = S || w && S, V = G(() => g(!1), []);
|
|
36
|
+
le([E, T], V, {
|
|
37
|
+
enabled: l && !f && !d
|
|
38
|
+
});
|
|
39
|
+
const W = (e) => {
|
|
40
|
+
i == null || i(e), g(!1);
|
|
38
41
|
};
|
|
39
|
-
|
|
40
|
-
if (!
|
|
42
|
+
H(() => {
|
|
43
|
+
if (!l || f) return;
|
|
41
44
|
const e = () => {
|
|
42
|
-
var
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
top:
|
|
45
|
+
var O;
|
|
46
|
+
const n = (O = E.current) == null ? void 0 : O.getBoundingClientRect();
|
|
47
|
+
n && X({
|
|
48
|
+
top: n.bottom + Q,
|
|
46
49
|
left: Math.max(
|
|
47
|
-
|
|
48
|
-
Math.min(
|
|
50
|
+
q,
|
|
51
|
+
Math.min(n.left, window.innerWidth - n.width - q)
|
|
49
52
|
),
|
|
50
|
-
width:
|
|
53
|
+
width: n.width
|
|
51
54
|
});
|
|
52
55
|
};
|
|
53
56
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
54
57
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
55
58
|
};
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
59
|
+
}, [l, f]);
|
|
60
|
+
const Z = I && !S ? I(t) : D || !N ? h : N.label, M = {
|
|
58
61
|
backgroundColor: "var(--bear-bg-primary)",
|
|
59
|
-
borderColor:
|
|
60
|
-
color:
|
|
62
|
+
borderColor: o ? void 0 : "var(--bear-border-default)",
|
|
63
|
+
color: N && !D ? "var(--bear-text-primary)" : "var(--bear-text-muted)"
|
|
61
64
|
};
|
|
62
|
-
return
|
|
65
|
+
return f ? /* @__PURE__ */ c(
|
|
63
66
|
"div",
|
|
64
67
|
{
|
|
65
|
-
id:
|
|
66
|
-
"data-testid":
|
|
68
|
+
id: m,
|
|
69
|
+
"data-testid": P,
|
|
67
70
|
className: b(
|
|
68
|
-
|
|
71
|
+
s,
|
|
69
72
|
"bear-relative bear-flex bear-flex-col bear-gap-1.5",
|
|
70
|
-
|
|
73
|
+
k && "bear-w-full"
|
|
71
74
|
),
|
|
72
75
|
children: [
|
|
73
|
-
|
|
76
|
+
u && /* @__PURE__ */ a(
|
|
74
77
|
"label",
|
|
75
78
|
{
|
|
76
|
-
htmlFor: `${
|
|
79
|
+
htmlFor: `${m}-native`,
|
|
77
80
|
className: "bear-text-sm bear-font-medium",
|
|
78
81
|
style: { color: "var(--bear-text-secondary)" },
|
|
79
|
-
children:
|
|
82
|
+
children: u
|
|
80
83
|
}
|
|
81
84
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ c(
|
|
83
86
|
"select",
|
|
84
87
|
{
|
|
85
|
-
id: `${
|
|
88
|
+
id: `${m}-native`,
|
|
86
89
|
disabled: d,
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
required: _,
|
|
91
|
+
value: t ?? "",
|
|
92
|
+
onChange: (e) => i == null ? void 0 : i(e.target.value),
|
|
89
93
|
className: b(
|
|
90
|
-
`${
|
|
94
|
+
`${s}__native`,
|
|
91
95
|
"bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200",
|
|
92
96
|
"focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",
|
|
93
|
-
|
|
97
|
+
o ? "bear-border-red-500 focus:bear-ring-red-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500",
|
|
94
98
|
d && "bear-opacity-50 bear-cursor-not-allowed",
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
$[L],
|
|
100
|
+
C
|
|
97
101
|
),
|
|
98
|
-
style:
|
|
99
|
-
"aria-invalid":
|
|
102
|
+
style: M,
|
|
103
|
+
"aria-invalid": o || void 0,
|
|
104
|
+
"aria-required": _ || void 0,
|
|
105
|
+
"aria-describedby": r == null ? void 0 : r.helperId,
|
|
100
106
|
children: [
|
|
101
|
-
(
|
|
102
|
-
|
|
107
|
+
(w || h) && /* @__PURE__ */ a("option", { value: "", disabled: !w, children: h }),
|
|
108
|
+
p.map((e) => /* @__PURE__ */ a("option", { value: e.value, disabled: e.disabled, children: e.label }, e.value))
|
|
103
109
|
]
|
|
104
110
|
}
|
|
105
111
|
),
|
|
106
|
-
|
|
112
|
+
v && /* @__PURE__ */ a("p", { className: "bear-text-sm bear-text-red-500", children: v })
|
|
107
113
|
]
|
|
108
114
|
}
|
|
109
|
-
) : /* @__PURE__ */
|
|
115
|
+
) : /* @__PURE__ */ c(
|
|
110
116
|
"div",
|
|
111
117
|
{
|
|
112
118
|
ref: E,
|
|
113
|
-
id:
|
|
114
|
-
"data-testid":
|
|
119
|
+
id: m,
|
|
120
|
+
"data-testid": P,
|
|
115
121
|
className: b(
|
|
116
|
-
|
|
122
|
+
s,
|
|
117
123
|
"bear-relative bear-flex bear-flex-col bear-gap-1.5",
|
|
118
|
-
|
|
124
|
+
k && "bear-w-full"
|
|
119
125
|
),
|
|
120
126
|
children: [
|
|
121
|
-
|
|
122
|
-
/* @__PURE__ */
|
|
127
|
+
u && /* @__PURE__ */ a("label", { className: "bear-text-sm bear-font-medium", style: { color: "var(--bear-text-secondary)" }, children: u }),
|
|
128
|
+
/* @__PURE__ */ c(
|
|
123
129
|
"button",
|
|
124
130
|
{
|
|
125
131
|
type: "button",
|
|
126
132
|
disabled: d,
|
|
127
|
-
onClick: () => !d &&
|
|
133
|
+
onClick: () => !d && g(!l),
|
|
128
134
|
className: b(
|
|
129
|
-
`${
|
|
135
|
+
`${s}__trigger`,
|
|
130
136
|
"bear-flex bear-items-center bear-justify-between bear-w-full",
|
|
131
137
|
"bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200",
|
|
132
138
|
"focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-[var(--bear-bg-primary)]",
|
|
133
|
-
|
|
139
|
+
o ? "bear-border-red-500 focus:bear-ring-red-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",
|
|
134
140
|
d && "bear-opacity-50 bear-cursor-not-allowed",
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
$[L],
|
|
142
|
+
C
|
|
137
143
|
),
|
|
138
|
-
style:
|
|
144
|
+
style: M,
|
|
139
145
|
"aria-haspopup": "listbox",
|
|
140
|
-
"aria-expanded":
|
|
146
|
+
"aria-expanded": l,
|
|
147
|
+
"aria-invalid": o || void 0,
|
|
148
|
+
"aria-required": _ || void 0,
|
|
149
|
+
"aria-describedby": r == null ? void 0 : r.helperId,
|
|
141
150
|
children: [
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
151
|
+
/* @__PURE__ */ a("span", { className: `${s}__value`, children: Z }),
|
|
152
|
+
/* @__PURE__ */ a(
|
|
153
|
+
Y,
|
|
145
154
|
{
|
|
146
155
|
className: b(
|
|
147
156
|
"bear-w-4 bear-h-4 bear-shrink-0 bear-transition-transform",
|
|
148
|
-
|
|
157
|
+
l && "bear-rotate-180"
|
|
149
158
|
),
|
|
150
159
|
style: { color: "var(--bear-text-muted)" }
|
|
151
160
|
}
|
|
@@ -153,51 +162,51 @@ const ue = (R) => {
|
|
|
153
162
|
]
|
|
154
163
|
}
|
|
155
164
|
),
|
|
156
|
-
|
|
165
|
+
l && /* @__PURE__ */ a(re, { children: /* @__PURE__ */ a(
|
|
157
166
|
"div",
|
|
158
167
|
{
|
|
159
|
-
ref:
|
|
160
|
-
className: `${
|
|
168
|
+
ref: T,
|
|
169
|
+
className: `${s}__menu bear-fixed bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden`,
|
|
161
170
|
style: {
|
|
162
171
|
backgroundColor: "var(--bear-bg-primary)",
|
|
163
172
|
borderColor: "var(--bear-border-default)",
|
|
164
|
-
top:
|
|
165
|
-
left:
|
|
166
|
-
width:
|
|
167
|
-
zIndex:
|
|
173
|
+
top: y.top,
|
|
174
|
+
left: y.left,
|
|
175
|
+
width: y.width,
|
|
176
|
+
zIndex: K
|
|
168
177
|
},
|
|
169
178
|
role: "listbox",
|
|
170
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ a("div", { className: "bear-max-h-60 bear-overflow-y-auto", children: p.map((e) => /* @__PURE__ */ c(
|
|
171
180
|
"button",
|
|
172
181
|
{
|
|
173
182
|
type: "button",
|
|
174
183
|
disabled: e.disabled,
|
|
175
|
-
onClick: () => !e.disabled &&
|
|
184
|
+
onClick: () => !e.disabled && W(e.value),
|
|
176
185
|
role: "option",
|
|
177
|
-
"aria-selected": e.value ===
|
|
186
|
+
"aria-selected": e.value === t,
|
|
178
187
|
className: b(
|
|
179
|
-
`${
|
|
188
|
+
`${s}__option`,
|
|
180
189
|
"bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2",
|
|
181
190
|
"bear-text-left bear-transition-colors",
|
|
182
191
|
e.disabled && "bear-cursor-not-allowed",
|
|
183
|
-
e.value ===
|
|
184
|
-
!e.disabled && e.value !==
|
|
192
|
+
e.value === t && "bear-bg-bear-100 bear-text-bear-700 dark:bear-bg-bear-600/20 dark:bear-text-bear-300",
|
|
193
|
+
!e.disabled && e.value !== t && "hover:bear-bg-[var(--bear-bg-tertiary)]"
|
|
185
194
|
),
|
|
186
|
-
style: e.disabled ? { color: "var(--bear-text-muted)" } : e.value ===
|
|
195
|
+
style: e.disabled ? { color: "var(--bear-text-muted)" } : e.value === t ? void 0 : { color: "var(--bear-text-secondary)" },
|
|
187
196
|
children: [
|
|
188
197
|
e.label,
|
|
189
|
-
e.value ===
|
|
198
|
+
e.value === t && /* @__PURE__ */ a(ee, { className: "bear-w-4 bear-h-4 bear-shrink-0 bear-text-bear-600 dark:bear-text-bear-400" })
|
|
190
199
|
]
|
|
191
200
|
},
|
|
192
201
|
e.value
|
|
193
202
|
)) })
|
|
194
203
|
}
|
|
195
204
|
) }),
|
|
196
|
-
|
|
205
|
+
v && /* @__PURE__ */ a("p", { className: "bear-text-sm bear-text-red-500", children: v })
|
|
197
206
|
]
|
|
198
207
|
}
|
|
199
208
|
);
|
|
200
209
|
};
|
|
201
210
|
export {
|
|
202
|
-
|
|
211
|
+
xe as Select
|
|
203
212
|
};
|
|
@@ -18,9 +18,11 @@ export interface SelectProps {
|
|
|
18
18
|
/** Select label */
|
|
19
19
|
label?: string;
|
|
20
20
|
/** Error message */
|
|
21
|
-
error?: string;
|
|
21
|
+
error?: string | boolean;
|
|
22
22
|
/** Whether select is disabled */
|
|
23
23
|
disabled?: boolean;
|
|
24
|
+
/** Whether the field is required */
|
|
25
|
+
required?: boolean;
|
|
24
26
|
/** Select size */
|
|
25
27
|
size?: 'sm' | 'md' | 'lg';
|
|
26
28
|
/** Whether select is full width */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),K=require("react-dom"),w=require("../../utils/cn.cjs");require("react");const z=require("../../utils/generateBearId.utils.cjs"),L=require("../../utils/useBearId.cjs"),U=require("../../utils/liveRegion.utils.cjs"),X=require("../Paper/Paper.cjs"),d=require("../Flex/Flex.cjs"),B=require("../Typography/Typography.cjs"),Z=require("../Progress/Progress.cjs"),H=require("../CloseButton/CloseButton.cjs"),s=require("./Snackbar.const.cjs"),M=require("./hooks/useSnackbar.cjs"),G=(i,a,o,t)=>{const e={zIndex:s.SNACKBAR_Z_INDEX};return i==="top"?e.top=t:e.bottom=t,a==="left"?(e.left=o,e.right="auto"):a==="right"?(e.right=o,e.left="auto"):(e.left="50%",e.right="auto",e.transform="translateX(-50%)"),e},V=i=>{const{open:a,message:o,description:t,severity:e="default",action:u,autoHideDuration:h=s.SNACKBAR_DEFAULT_AUTO_HIDE_MS,onClose:c,anchorOrigin:b={vertical:"bottom",horizontal:"center"},offsetX:A=s.SNACKBAR_DEFAULT_OFFSET_X,offsetY:x=s.SNACKBAR_DEFAULT_OFFSET_Y,size:C="md",progress:N=null,progressPosition:_="bottom",progressColor:k="default",countdownProgress:v=!1,showCloseButton:y,closeOnClickOutside:R,container:q,id:I,testId:O,className:D}=i,F=L.useBearId("Snackbar"),P=z.resolveBearId(I,F),g=q??(typeof document<"u"?document.body:null),n=!!c,j=y??n,S=R??n,{surfaceRef:E,progressValue:m}=M.useSnackbar({open:a,autoHideDuration:h,onClose:c,countdownProgress:v,staticProgress:N,closeOnClickOutside:S});if(!a||!g)return null;const p=U.getBearLiveRegionProps(e),l=typeof m=="number",f=l?r.jsx(Z.Progress,{value:m,size:"sm",color:k,className:"Bear-Snackbar__progress"}):null,T=r.jsxs(r.Fragment,{children:[S&&n&&r.jsx("div",{className:"Bear-Snackbar__backdrop bear-fixed bear-inset-0",style:{zIndex:s.SNACKBAR_BACKDROP_Z_INDEX},"aria-hidden":!0}),r.jsxs(X.Paper,{ref:E,id:P,"data-testid":O,role:p.role,"aria-live":p["aria-live"],elevation:4,rounded:"lg",padding:"none",background:"transparent",className:w.cn(s.SNACKBAR_ROOT_CLASS,s.SNACKBAR_SURFACE_CLASSES,"bear-fixed bear-flex bear-flex-col bear-overflow-hidden","bear-border bear-border-[var(--bear-border-default)]",s.SNACKBAR_SIZE_PADDING[C],D),style:G(b.vertical,b.horizontal,A,x),children:[l&&_==="top"&&f,r.jsxs(d.Flex,{className:"Bear-Snackbar__content bear-w-full",align:"center",gap:3,children:[r.jsxs(d.Flex,{direction:"column",className:"Bear-Snackbar__text bear-flex-1 bear-min-w-0",gap:1,children:[o&&r.jsx(B.Typography,{variant:"body2",className:"Bear-Snackbar__message",children:o}),t&&r.jsx(B.Typography,{variant:"caption",color:"muted",className:"Bear-Snackbar__description",children:t})]}),u&&r.jsx(d.Flex,{className:"Bear-Snackbar__action bear-shrink-0",align:"center",children:u}),j&&n&&r.jsx(H.CloseButton,{size:"sm",onClick:c,"aria-label":"Dismiss notification",className:"Bear-Snackbar__close bear-shrink-0"})]}),l&&_==="bottom"&&f]})]});return K.createPortal(T,g)};exports.Snackbar=V;
|
|
@@ -1,99 +1,101 @@
|
|
|
1
|
-
import { jsxs as n, Fragment as
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { jsxs as n, Fragment as z, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal as L } from "react-dom";
|
|
3
|
+
import { cn as U } from "../../utils/cn.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { resolveBearId as
|
|
6
|
-
import { useBearId as
|
|
7
|
-
import {
|
|
5
|
+
import { resolveBearId as X } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as Z } from "../../utils/useBearId.js";
|
|
7
|
+
import { getBearLiveRegionProps as j } from "../../utils/liveRegion.utils.js";
|
|
8
|
+
import { Paper as H } from "../Paper/Paper.js";
|
|
8
9
|
import { Flex as d } from "../Flex/Flex.js";
|
|
9
|
-
import { Typography as
|
|
10
|
-
import { Progress as
|
|
11
|
-
import { CloseButton as
|
|
12
|
-
import { SNACKBAR_DEFAULT_AUTO_HIDE_MS as
|
|
13
|
-
import { useSnackbar as
|
|
14
|
-
const
|
|
15
|
-
const e = { zIndex:
|
|
10
|
+
import { Typography as A } from "../Typography/Typography.js";
|
|
11
|
+
import { Progress as G } from "../Progress/Progress.js";
|
|
12
|
+
import { CloseButton as M } from "../CloseButton/CloseButton.js";
|
|
13
|
+
import { SNACKBAR_DEFAULT_AUTO_HIDE_MS as V, SNACKBAR_DEFAULT_OFFSET_X as Y, SNACKBAR_DEFAULT_OFFSET_Y as q, SNACKBAR_BACKDROP_Z_INDEX as J, SNACKBAR_SIZE_PADDING as Q, SNACKBAR_SURFACE_CLASSES as W, SNACKBAR_ROOT_CLASS as $, SNACKBAR_Z_INDEX as ee } from "./Snackbar.const.js";
|
|
14
|
+
import { useSnackbar as re } from "./hooks/useSnackbar.js";
|
|
15
|
+
const oe = (i, o, a, t) => {
|
|
16
|
+
const e = { zIndex: ee };
|
|
16
17
|
return i === "top" ? e.top = t : e.bottom = t, o === "left" ? (e.left = a, e.right = "auto") : o === "right" ? (e.right = a, e.left = "auto") : (e.left = "50%", e.right = "auto", e.transform = "translateX(-50%)"), e;
|
|
17
|
-
},
|
|
18
|
+
}, ge = (i) => {
|
|
18
19
|
const {
|
|
19
20
|
open: o,
|
|
20
21
|
message: a,
|
|
21
22
|
description: t,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
severity: e = "default",
|
|
24
|
+
action: m,
|
|
25
|
+
autoHideDuration: h = V,
|
|
24
26
|
onClose: l,
|
|
25
|
-
anchorOrigin:
|
|
26
|
-
offsetX:
|
|
27
|
-
offsetY:
|
|
28
|
-
size:
|
|
29
|
-
progress:
|
|
30
|
-
progressPosition:
|
|
31
|
-
progressColor:
|
|
32
|
-
countdownProgress:
|
|
27
|
+
anchorOrigin: f = { vertical: "bottom", horizontal: "center" },
|
|
28
|
+
offsetX: B = Y,
|
|
29
|
+
offsetY: N = q,
|
|
30
|
+
size: C = "md",
|
|
31
|
+
progress: k = null,
|
|
32
|
+
progressPosition: p = "bottom",
|
|
33
|
+
progressColor: v = "default",
|
|
34
|
+
countdownProgress: R = !1,
|
|
33
35
|
showCloseButton: O,
|
|
34
36
|
closeOnClickOutside: x,
|
|
35
37
|
container: D,
|
|
36
38
|
id: I,
|
|
37
|
-
testId:
|
|
38
|
-
className:
|
|
39
|
-
} = i,
|
|
39
|
+
testId: y,
|
|
40
|
+
className: E
|
|
41
|
+
} = i, F = Z("Snackbar"), P = X(I, F), u = D ?? (typeof document < "u" ? document.body : null), s = !!l, K = O ?? s, b = x ?? s, { surfaceRef: T, progressValue: _ } = re({
|
|
40
42
|
open: o,
|
|
41
|
-
autoHideDuration:
|
|
43
|
+
autoHideDuration: h,
|
|
42
44
|
onClose: l,
|
|
43
|
-
countdownProgress:
|
|
44
|
-
staticProgress:
|
|
45
|
-
closeOnClickOutside:
|
|
45
|
+
countdownProgress: R,
|
|
46
|
+
staticProgress: k,
|
|
47
|
+
closeOnClickOutside: b
|
|
46
48
|
});
|
|
47
|
-
if (!o || !
|
|
49
|
+
if (!o || !u)
|
|
48
50
|
return null;
|
|
49
|
-
const c = typeof
|
|
50
|
-
|
|
51
|
+
const g = j(e), c = typeof _ == "number", S = c ? /* @__PURE__ */ r(
|
|
52
|
+
G,
|
|
51
53
|
{
|
|
52
|
-
value:
|
|
54
|
+
value: _,
|
|
53
55
|
size: "sm",
|
|
54
|
-
color:
|
|
56
|
+
color: v,
|
|
55
57
|
className: "Bear-Snackbar__progress"
|
|
56
58
|
}
|
|
57
|
-
) : null,
|
|
58
|
-
|
|
59
|
+
) : null, w = /* @__PURE__ */ n(z, { children: [
|
|
60
|
+
b && s && /* @__PURE__ */ r(
|
|
59
61
|
"div",
|
|
60
62
|
{
|
|
61
63
|
className: "Bear-Snackbar__backdrop bear-fixed bear-inset-0",
|
|
62
|
-
style: { zIndex:
|
|
64
|
+
style: { zIndex: J },
|
|
63
65
|
"aria-hidden": !0
|
|
64
66
|
}
|
|
65
67
|
),
|
|
66
68
|
/* @__PURE__ */ n(
|
|
67
|
-
|
|
69
|
+
H,
|
|
68
70
|
{
|
|
69
|
-
ref:
|
|
70
|
-
id:
|
|
71
|
-
"data-testid":
|
|
72
|
-
role:
|
|
73
|
-
"aria-live": "
|
|
71
|
+
ref: T,
|
|
72
|
+
id: P,
|
|
73
|
+
"data-testid": y,
|
|
74
|
+
role: g.role,
|
|
75
|
+
"aria-live": g["aria-live"],
|
|
74
76
|
elevation: 4,
|
|
75
77
|
rounded: "lg",
|
|
76
78
|
padding: "none",
|
|
77
79
|
background: "transparent",
|
|
78
|
-
className:
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
className: U(
|
|
81
|
+
$,
|
|
82
|
+
W,
|
|
81
83
|
"bear-fixed bear-flex bear-flex-col bear-overflow-hidden",
|
|
82
84
|
"bear-border bear-border-[var(--bear-border-default)]",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
Q[C],
|
|
86
|
+
E
|
|
85
87
|
),
|
|
86
|
-
style:
|
|
88
|
+
style: oe(f.vertical, f.horizontal, B, N),
|
|
87
89
|
children: [
|
|
88
|
-
c &&
|
|
90
|
+
c && p === "top" && S,
|
|
89
91
|
/* @__PURE__ */ n(d, { className: "Bear-Snackbar__content bear-w-full", align: "center", gap: 3, children: [
|
|
90
92
|
/* @__PURE__ */ n(d, { direction: "column", className: "Bear-Snackbar__text bear-flex-1 bear-min-w-0", gap: 1, children: [
|
|
91
|
-
a && /* @__PURE__ */ r(
|
|
92
|
-
t && /* @__PURE__ */ r(
|
|
93
|
+
a && /* @__PURE__ */ r(A, { variant: "body2", className: "Bear-Snackbar__message", children: a }),
|
|
94
|
+
t && /* @__PURE__ */ r(A, { variant: "caption", color: "muted", className: "Bear-Snackbar__description", children: t })
|
|
93
95
|
] }),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
m && /* @__PURE__ */ r(d, { className: "Bear-Snackbar__action bear-shrink-0", align: "center", children: m }),
|
|
97
|
+
K && s && /* @__PURE__ */ r(
|
|
98
|
+
M,
|
|
97
99
|
{
|
|
98
100
|
size: "sm",
|
|
99
101
|
onClick: l,
|
|
@@ -102,13 +104,13 @@ const $ = (i, o, a, t) => {
|
|
|
102
104
|
}
|
|
103
105
|
)
|
|
104
106
|
] }),
|
|
105
|
-
c &&
|
|
107
|
+
c && p === "bottom" && S
|
|
106
108
|
]
|
|
107
109
|
}
|
|
108
110
|
)
|
|
109
111
|
] });
|
|
110
|
-
return w
|
|
112
|
+
return L(w, u);
|
|
111
113
|
};
|
|
112
114
|
export {
|
|
113
|
-
|
|
115
|
+
ge as Snackbar
|
|
114
116
|
};
|
|
@@ -5,10 +5,12 @@ export type SnackbarAnchorOriginHorizontal = 'left' | 'center' | 'right';
|
|
|
5
5
|
export type SnackbarProgressPosition = 'top' | 'bottom';
|
|
6
6
|
export type SnackbarSize = Extract<BearSize, 'sm' | 'md' | 'lg'>;
|
|
7
7
|
export type SnackbarProgressColor = 'default' | 'success' | 'warning' | 'danger' | 'info';
|
|
8
|
+
export type SnackbarSeverity = 'success' | 'info' | 'warning' | 'error' | 'default';
|
|
8
9
|
export interface SnackbarProps {
|
|
9
10
|
open: boolean;
|
|
10
11
|
message?: ReactNode;
|
|
11
12
|
description?: ReactNode;
|
|
13
|
+
severity?: SnackbarSeverity;
|
|
12
14
|
action?: ReactNode;
|
|
13
15
|
autoHideDuration?: number | null;
|
|
14
16
|
onClose?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),t=require("../../utils/cn.cjs"),S=require("../../utils/generateBearId.utils.cjs"),g=require("../../utils/useBearId.cjs"),f=require("../../context/BearProvider.cjs"),B=require("./Tabs.const.cjs"),x=p.createContext(null),I=({children:b,value:n,defaultTab:r,variant:c="line",onChange:a,className:i,testId:l,id:s})=>{const d=g.useBearId("Tabs"),e=S.resolveBearId(s,d),{density:u}=f.useBearDensityOptional(),m=u==="compact",[v,T]=p.useState(r),_=n!==void 0,C=_?n:v,A=y=>{_||T(y),a==null||a(y)};return o.jsx(x.Provider,{value:{activeTab:C,setActiveTab:A,variant:c,compact:m},children:o.jsx("div",{id:e,"data-testid":l,className:t.cn("Bear-Tabs",i),children:b})})},j=({id:b,children:n,disabled:r=!1,icon:c})=>{const a=p.useContext(x);if(!a)throw new Error("Tab must be used within Tabs");const{activeTab:i,setActiveTab:l,variant:s,compact:d}=a,e=i===b,u=d?B.TABS_TAB_PADDING_COMPACT_CLASSES:B.TABS_TAB_PADDING_CLASSES,m=t.cn("bear-flex bear-items-center bear-gap-2 bear-text-sm bear-font-medium bear-transition-colors",u),v={line:t.cn("bear-border-b-2 bear--mb-px",e?"bear-border-primary-500 bear-text-primary-600 dark:bear-text-primary-400":"bear-border-transparent hover:bear-border-[var(--bear-border-default)]"),pills:t.cn("bear-rounded-md",e&&"bear-shadow-sm"),enclosed:t.cn("bear-rounded-t-lg bear-border bear-border-transparent",e&&"bear--mb-px")},T=r?void 0:e?s==="pills"?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:s==="enclosed"?{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",borderBottomColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:void 0:{color:"var(--bear-text-muted)"};return o.jsxs("button",{role:"tab","aria-selected":e,disabled:r,onClick:()=>!r&&l(b),className:t.cn("Bear-Tabs__tab",e&&"Bear-Tabs__tab--active",m,v[s],!e&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]",r&&"Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"),style:T,children:[c&&o.jsx("span",{className:"Bear-Tabs__tab-icon",children:c}),o.jsx("span",{className:"Bear-Tabs__tab-label",children:n})]})};exports.Tab=j;exports.Tabs=I;exports.TabsContext=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A="bear-px-4 bear-py-2",S="bear-px-3 bear-py-1";exports.TABS_TAB_PADDING_CLASSES=A;exports.TABS_TAB_PADDING_COMPACT_CLASSES=S;
|