@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,50 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { BOTTOM_NAVIGATION_ACTIVE_CLASSES as A, BOTTOM_NAVIGATION_INACTIVE_CLASSES as I, BOTTOM_NAVIGATION_ROOT_CLASS as o, BOTTOM_NAVIGATION_VARIANT_CLASSES as T } from "./BottomNavigation.const.js";
|
|
3
|
+
import { cn as t } from "../../utils/cn.js";
|
|
3
4
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
5
|
+
import { resolveBearId as h } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as O } from "../../utils/useBearId.js";
|
|
7
|
+
const V = (l) => {
|
|
8
|
+
const {
|
|
9
|
+
items: n,
|
|
10
|
+
value: d,
|
|
11
|
+
onChange: s,
|
|
12
|
+
showLabels: b = "active",
|
|
13
|
+
variant: c = "default",
|
|
14
|
+
className: m,
|
|
15
|
+
id: f,
|
|
16
|
+
testId: u
|
|
17
|
+
} = l, p = O("BottomNavigation"), N = h(f, p), x = (e) => b === !0 || b === "always" ? !0 : b === "active" ? e : !1;
|
|
18
|
+
return /* @__PURE__ */ r(
|
|
19
|
+
"nav",
|
|
20
|
+
{
|
|
21
|
+
id: N,
|
|
22
|
+
"data-testid": u,
|
|
23
|
+
className: t(
|
|
24
|
+
o,
|
|
25
|
+
"bear-fixed bear-bottom-0 bear-left-0 bear-right-0 bear-z-50 bear-h-16 bear-flex bear-items-center bear-justify-around bear-px-2",
|
|
26
|
+
T[c],
|
|
27
|
+
m
|
|
28
|
+
),
|
|
29
|
+
children: n.map((e) => {
|
|
30
|
+
const a = d === e.id;
|
|
31
|
+
return /* @__PURE__ */ i(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: () => !e.disabled && (s == null ? void 0 : s(e.id)),
|
|
36
|
+
disabled: e.disabled,
|
|
37
|
+
className: t(
|
|
38
|
+
`${o}__item`,
|
|
39
|
+
"bear-flex bear-flex-col bear-items-center bear-justify-center bear-flex-1 bear-h-full bear-py-2 bear-transition-all",
|
|
40
|
+
a ? A : I,
|
|
41
|
+
e.disabled && "bear-opacity-50 bear-cursor-not-allowed"
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ i("div", { className: "bear-relative", children: [
|
|
45
|
+
/* @__PURE__ */ r("span", { className: t("bear-transition-transform", a && "bear-scale-110"), children: e.icon }),
|
|
46
|
+
e.badge !== void 0 && /* @__PURE__ */ r("span", { className: "bear-absolute -bear-top-1 -bear-right-1 bear-min-w-[16px] bear-h-4 bear-px-1 bear-flex bear-items-center bear-justify-center bear-text-xs bear-font-medium bear-bg-primary-500 bear-text-white bear-rounded-full", children: e.badge })
|
|
47
|
+
] }),
|
|
48
|
+
x(a) && /* @__PURE__ */ r(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: t(
|
|
52
|
+
"bear-text-xs bear-mt-1 bear-transition-all",
|
|
53
|
+
a ? "bear-font-medium" : ""
|
|
54
|
+
),
|
|
55
|
+
children: e.label
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
e.id
|
|
61
|
+
);
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
);
|
|
47
65
|
};
|
|
48
66
|
export {
|
|
49
|
-
|
|
67
|
+
V as BottomNavigation
|
|
50
68
|
};
|
|
@@ -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"),v=require("../../context/BearProvider.cjs"),Z=require("../../utils/maxVisible.utils.cjs"),w=require("../../utils/cn.cjs"),D=require("../Dropdown/Dropdown.cjs"),d=require("../Icon/index.cjs"),l=require("./Breadcrumbs.const.cjs"),V=_=>{const{items:n,separator:k,maxItems:p,itemsBeforeCollapse:h=l.BREADCRUMBS_DEFAULTS.ITEMS_BEFORE_COLLAPSE,itemsAfterCollapse:u=l.BREADCRUMBS_DEFAULTS.ITEMS_AFTER_COLLAPSE,className:A,size:x=l.BREADCRUMBS_DEFAULTS.SIZE,showHomeIcon:z=l.BREADCRUMBS_DEFAULTS.SHOW_HOME_ICON,testId:M,"aria-label":O="Breadcrumb"}=_,f=v.useBearThemeOptional(),{direction:I}=v.useBearDirectionOptional(),[o,E]=b.useState(null),[U,S]=b.useState({}),[B,L]=b.useState(()=>typeof window<"u"?window.innerWidth:1200);b.useEffect(()=>{const e=()=>L(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),b.useEffect(()=>{E(null),S({})},[n]);const C=b.useMemo(()=>p==null?void 0:Z.resolveMaxVisible(p,{width:B,theme:f}),[p,B,f]),T=()=>k||(I==="rtl"?r.jsx(d.BearIcons.ChevronLeftIcon,{className:w.cn(l.BREADCRUMBS_ICON_SIZE[x],"bear-text-zinc-500 bear-mx-2")}):r.jsx(d.BearIcons.ChevronRightIcon,{className:w.cn(l.BREADCRUMBS_ICON_SIZE[x],"bear-text-zinc-500 bear-mx-2")})),y=(e,s,t)=>{const a=r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1 bear-max-w-[12rem] bear-truncate md:bear-max-w-none",children:[s===0&&z&&r.jsx(d.BearIcons.HomeIcon,{className:l.BREADCRUMBS_ICON_SIZE[x]}),e.icon,e.label]}),c=t?r.jsx("span",{className:"bear-text-zinc-300 bear-font-medium","aria-current":"page",children:a}):e.href?r.jsx("a",{href:e.href,className:"bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate",children:a}):e.onClick?r.jsx("button",{type:"button",onClick:e.onClick,className:"bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate",children:a}):r.jsx("span",{className:"bear-text-zinc-400 bear-truncate",children:a});if(e.dropdownItems&&e.dropdownItems.length>0&&!t){const m=U[s],N=e.dropdownItems.find(i=>i.key===m);return r.jsx(D.Dropdown,{placement:"bottom-start",closeOnSelect:!0,trigger:r.jsxs("button",{type:"button",className:"bear-inline-flex bear-items-center bear-gap-1 bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors","aria-haspopup":"true",children:[a,N&&r.jsx("span",{className:"bear-ml-1 bear-max-w-[8rem] bear-truncate bear-text-xs bear-text-zinc-300",children:N.label}),r.jsx(d.BearIcons.ChevronDownIcon,{size:14})]}),items:e.dropdownItems.map(i=>({key:i.key,label:i.label,disabled:i.disabled,selected:m===i.key,onClick:()=>{var g;S(H=>({...H,[s]:i.key})),(g=i.onClick)==null||g.call(i)}}))})}return c},P=C!=null&&n.length>C,j=h,q=n.length-u;let R=n.map((e,s)=>({type:"item",item:e,index:s}));if(P){const e=n.slice(0,h),s=n.slice(-u),t=n.slice(h,n.length-u);R=[...e.map((a,c)=>({type:"item",item:a,index:c})),...t.length?[{type:"ellipsis",hidden:t}]:[],...s.map((a,c)=>({type:"item",item:a,index:n.length-u+c}))]}const F=o!=null&&o>=j&&o<q;return r.jsx("nav",{dir:I,"data-testid":M,className:w.cn("bear-flex bear-min-w-0 bear-items-center bear-flex-wrap",l.BREADCRUMBS_SIZE[x],A),"aria-label":O,children:r.jsx("ol",{className:"bear-flex bear-min-w-0 bear-items-center bear-flex-wrap bear-list-none bear-p-0 bear-m-0",children:R.map((e,s)=>r.jsxs("li",{className:"bear-flex bear-min-w-0 bear-items-center",children:[s>0&&r.jsx("span",{"aria-hidden":"true",children:T()}),e.type==="ellipsis"?r.jsxs("span",{className:"bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-1",children:[r.jsx(D.Dropdown,{placement:"bottom-start",closeOnSelect:!0,trigger:r.jsx("button",{type:"button",className:"bear-inline-flex bear-items-center bear-justify-center bear-rounded bear-px-2 bear-py-1 bear-text-zinc-400 hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-primary-400 bear-transition-colors","aria-label":"Hidden breadcrumbs",children:r.jsx(d.BearIcons.MoreHorizIcon,{size:18})}),items:e.hidden.map((t,a)=>{const c=j+a;return{key:`${t.label}-${a}`,label:t.label,onClick:()=>{var m;E(c),(m=t.onClick)==null||m.call(t)}}})}),F&&o!=null&&r.jsx("span",{className:"bear-min-w-0 bear-max-w-[12rem] bear-truncate md:bear-max-w-none bear-inline-flex bear-items-center",children:y(n[o],o,o===n.length-1)})]}):y(e.item,e.index,e.index===n.length-1)]},s))})})};exports.Breadcrumbs=V;
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useState as f, useEffect as
|
|
3
|
-
import { useBearThemeOptional as
|
|
4
|
-
import { resolveMaxVisible as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Dropdown as
|
|
7
|
-
import { BearIcons as
|
|
8
|
-
import { BREADCRUMBS_DEFAULTS as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as R, useMemo as $ } from "react";
|
|
3
|
+
import { useBearThemeOptional as K, useBearDirectionOptional as q } from "../../context/BearProvider.js";
|
|
4
|
+
import { resolveMaxVisible as G } from "../../utils/maxVisible.utils.js";
|
|
5
|
+
import { cn as w } from "../../utils/cn.js";
|
|
6
|
+
import { Dropdown as _ } from "../Dropdown/Dropdown.js";
|
|
7
|
+
import { BearIcons as b } from "../Icon/index.js";
|
|
8
|
+
import { BREADCRUMBS_DEFAULTS as h, BREADCRUMBS_SIZE as J, BREADCRUMBS_ICON_SIZE as I } from "./Breadcrumbs.const.js";
|
|
9
|
+
const le = (D) => {
|
|
10
10
|
const {
|
|
11
11
|
items: a,
|
|
12
12
|
separator: M,
|
|
13
|
-
maxItems:
|
|
14
|
-
itemsBeforeCollapse:
|
|
15
|
-
itemsAfterCollapse:
|
|
13
|
+
maxItems: u,
|
|
14
|
+
itemsBeforeCollapse: x = h.ITEMS_BEFORE_COLLAPSE,
|
|
15
|
+
itemsAfterCollapse: m = h.ITEMS_AFTER_COLLAPSE,
|
|
16
16
|
className: A,
|
|
17
|
-
size:
|
|
18
|
-
showHomeIcon:
|
|
19
|
-
testId:
|
|
20
|
-
"aria-label":
|
|
21
|
-
} =
|
|
22
|
-
|
|
23
|
-
const e = () =>
|
|
17
|
+
size: d = h.SIZE,
|
|
18
|
+
showHomeIcon: L = h.SHOW_HOME_ICON,
|
|
19
|
+
testId: P,
|
|
20
|
+
"aria-label": H = "Breadcrumb"
|
|
21
|
+
} = D, y = K(), { direction: C } = q(), [i, E] = f(null), [T, N] = f({}), [g, U] = f(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
22
|
+
R(() => {
|
|
23
|
+
const e = () => U(window.innerWidth);
|
|
24
24
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
25
|
-
}, []),
|
|
26
|
-
|
|
25
|
+
}, []), R(() => {
|
|
26
|
+
E(null), N({});
|
|
27
27
|
}, [a]);
|
|
28
|
-
const
|
|
29
|
-
() =>
|
|
30
|
-
[
|
|
31
|
-
),
|
|
32
|
-
const
|
|
33
|
-
l === 0 &&
|
|
28
|
+
const k = $(
|
|
29
|
+
() => u == null ? void 0 : G(u, { width: g, theme: y }),
|
|
30
|
+
[u, g, y]
|
|
31
|
+
), j = () => M || (C === "rtl" ? /* @__PURE__ */ r(b.ChevronLeftIcon, { className: w(I[d], "bear-text-zinc-500 bear-mx-2") }) : /* @__PURE__ */ r(b.ChevronRightIcon, { className: w(I[d], "bear-text-zinc-500 bear-mx-2") })), v = (e, l, n) => {
|
|
32
|
+
const t = /* @__PURE__ */ p("span", { className: "bear-flex bear-items-center bear-gap-1 bear-max-w-[12rem] bear-truncate md:bear-max-w-none", children: [
|
|
33
|
+
l === 0 && L && /* @__PURE__ */ r(b.HomeIcon, { className: I[d] }),
|
|
34
34
|
e.icon,
|
|
35
35
|
e.label
|
|
36
|
-
] }), o =
|
|
37
|
-
if (e.dropdownItems && e.dropdownItems.length > 0 && !
|
|
38
|
-
const c =
|
|
36
|
+
] }), o = n ? /* @__PURE__ */ r("span", { className: "bear-text-zinc-300 bear-font-medium", "aria-current": "page", children: t }) : e.href ? /* @__PURE__ */ r("a", { href: e.href, className: "bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate", children: t }) : e.onClick ? /* @__PURE__ */ r("button", { type: "button", onClick: e.onClick, className: "bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate", children: t }) : /* @__PURE__ */ r("span", { className: "bear-text-zinc-400 bear-truncate", children: t });
|
|
37
|
+
if (e.dropdownItems && e.dropdownItems.length > 0 && !n) {
|
|
38
|
+
const c = T[l], B = e.dropdownItems.find((s) => s.key === c);
|
|
39
39
|
return /* @__PURE__ */ r(
|
|
40
|
-
|
|
40
|
+
_,
|
|
41
41
|
{
|
|
42
42
|
placement: "bottom-start",
|
|
43
43
|
closeOnSelect: !0,
|
|
44
|
-
trigger: /* @__PURE__ */
|
|
44
|
+
trigger: /* @__PURE__ */ p(
|
|
45
45
|
"button",
|
|
46
46
|
{
|
|
47
47
|
type: "button",
|
|
48
48
|
className: "bear-inline-flex bear-items-center bear-gap-1 bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors",
|
|
49
49
|
"aria-haspopup": "true",
|
|
50
50
|
children: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */ r(
|
|
51
|
+
t,
|
|
52
|
+
B && /* @__PURE__ */ r("span", { className: "bear-ml-1 bear-max-w-[8rem] bear-truncate bear-text-xs bear-text-zinc-300", children: B.label }),
|
|
53
|
+
/* @__PURE__ */ r(b.ChevronDownIcon, { size: 14 })
|
|
54
54
|
]
|
|
55
55
|
}
|
|
56
56
|
),
|
|
@@ -60,40 +60,41 @@ const ne = (_) => {
|
|
|
60
60
|
disabled: s.disabled,
|
|
61
61
|
selected: c === s.key,
|
|
62
62
|
onClick: () => {
|
|
63
|
-
var
|
|
64
|
-
|
|
63
|
+
var O;
|
|
64
|
+
N((V) => ({ ...V, [l]: s.key })), (O = s.onClick) == null || O.call(s);
|
|
65
65
|
}
|
|
66
66
|
}))
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
return o;
|
|
71
|
-
},
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
const e = a.slice(0,
|
|
75
|
-
|
|
76
|
-
...e.map((
|
|
77
|
-
...
|
|
78
|
-
...l.map((
|
|
71
|
+
}, F = k != null && a.length > k, S = x, W = a.length - m;
|
|
72
|
+
let z = a.map((e, l) => ({ type: "item", item: e, index: l }));
|
|
73
|
+
if (F) {
|
|
74
|
+
const e = a.slice(0, x), l = a.slice(-m), n = a.slice(x, a.length - m);
|
|
75
|
+
z = [
|
|
76
|
+
...e.map((t, o) => ({ type: "item", item: t, index: o })),
|
|
77
|
+
...n.length ? [{ type: "ellipsis", hidden: n }] : [],
|
|
78
|
+
...l.map((t, o) => ({
|
|
79
79
|
type: "item",
|
|
80
|
-
item:
|
|
81
|
-
index: a.length -
|
|
80
|
+
item: t,
|
|
81
|
+
index: a.length - m + o
|
|
82
82
|
}))
|
|
83
83
|
];
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const Z = i != null && i >= S && i < W;
|
|
86
86
|
return /* @__PURE__ */ r(
|
|
87
87
|
"nav",
|
|
88
88
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
dir: C,
|
|
90
|
+
"data-testid": P,
|
|
91
|
+
className: w("bear-flex bear-min-w-0 bear-items-center bear-flex-wrap", J[d], A),
|
|
92
|
+
"aria-label": H,
|
|
93
|
+
children: /* @__PURE__ */ r("ol", { className: "bear-flex bear-min-w-0 bear-items-center bear-flex-wrap bear-list-none bear-p-0 bear-m-0", children: z.map((e, l) => /* @__PURE__ */ p("li", { className: "bear-flex bear-min-w-0 bear-items-center", children: [
|
|
94
|
+
l > 0 && /* @__PURE__ */ r("span", { "aria-hidden": "true", children: j() }),
|
|
95
|
+
e.type === "ellipsis" ? /* @__PURE__ */ p("span", { className: "bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-1", children: [
|
|
95
96
|
/* @__PURE__ */ r(
|
|
96
|
-
|
|
97
|
+
_,
|
|
97
98
|
{
|
|
98
99
|
placement: "bottom-start",
|
|
99
100
|
closeOnSelect: !0,
|
|
@@ -103,32 +104,32 @@ const ne = (_) => {
|
|
|
103
104
|
type: "button",
|
|
104
105
|
className: "bear-inline-flex bear-items-center bear-justify-center bear-rounded bear-px-2 bear-py-1 bear-text-zinc-400 hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-primary-400 bear-transition-colors",
|
|
105
106
|
"aria-label": "Hidden breadcrumbs",
|
|
106
|
-
children: /* @__PURE__ */ r(
|
|
107
|
+
children: /* @__PURE__ */ r(b.MoreHorizIcon, { size: 18 })
|
|
107
108
|
}
|
|
108
109
|
),
|
|
109
|
-
items: e.hidden.map((
|
|
110
|
-
const o =
|
|
110
|
+
items: e.hidden.map((n, t) => {
|
|
111
|
+
const o = S + t;
|
|
111
112
|
return {
|
|
112
|
-
key: `${
|
|
113
|
-
label:
|
|
113
|
+
key: `${n.label}-${t}`,
|
|
114
|
+
label: n.label,
|
|
114
115
|
onClick: () => {
|
|
115
116
|
var c;
|
|
116
|
-
|
|
117
|
+
E(o), (c = n.onClick) == null || c.call(n);
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
})
|
|
120
121
|
}
|
|
121
122
|
),
|
|
122
|
-
|
|
123
|
+
Z && i != null && /* @__PURE__ */ r("span", { className: "bear-min-w-0 bear-max-w-[12rem] bear-truncate md:bear-max-w-none bear-inline-flex bear-items-center", children: v(
|
|
123
124
|
a[i],
|
|
124
125
|
i,
|
|
125
126
|
i === a.length - 1
|
|
126
127
|
) })
|
|
127
|
-
] }) :
|
|
128
|
+
] }) : v(e.item, e.index, e.index === a.length - 1)
|
|
128
129
|
] }, l)) })
|
|
129
130
|
}
|
|
130
131
|
);
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
le as Breadcrumbs
|
|
134
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),B=require("react"),l=require("../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),B=require("react"),l=require("../../utils/cn.cjs"),Te=require("../../utils/generateBearId.utils.cjs"),Se=require("../../utils/useBearId.cjs"),Ce=require("../Spinner/Spinner.cjs"),z=require("../Typography/Typography.cjs"),Me=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const P=require("../../context/BearProvider.cjs");require("../FormControl/FormControl.context.cjs");const n=require("./Button.constants.cjs"),D=require("./Button.utils.cjs"),$e=require("./useSpotlight.cjs"),L=B.forwardRef((Z,d)=>{var U,V;const{variant:e="primary",size:o="md",loading:c=!1,loadingText:m,fullWidth:F=!1,icon:p,iconPosition:T="left",leftIcon:Y,rightIcon:H,textVariant:S="inherit",iconOnly:W=!1,radius:X="default",ripple:G=!1,disableRipple:J=!1,disableElevation:K=!1,href:u,component:Q="button",tooltip:ee,compact:te,gradient:b,gradientDirection:C=135,prefix:M,suffix:$,spotlight:j=!1,spotlightColor:re="rgba(255, 255, 255, 0.35)",spotlightSize:f=150,disabled:ne,className:ae,children:oe,id:ie,testId:se,bis:le,style:ce,onMouseMove:ue,onMouseEnter:be,onMouseLeave:de,onClick:_,...pe}=Z,fe=Se.useBearId("Button"),ge=Te.resolveBearId(ie,fe),{density:he}=P.useBearDensityOptional(),Be=te??he==="compact",O=G&&!J,x=ne||c,v=Me.useBearStyles(le,ce),q=Y??(p&&T==="left"?p:void 0),R=H??(p&&T==="right"?p:void 0),[w,E]=B.useState(null),me=r=>{if(O){const g=r.currentTarget.getBoundingClientRect(),h=Math.max(g.width,g.height)*2;E({width:h,height:h,left:r.clientX-g.left-h/2,top:r.clientY-g.top-h/2}),setTimeout(()=>E(null),600)}_==null||_(r)},i=B.useContext(P.BearContext),y=((V=(U=i==null?void 0:i.components)==null?void 0:U.Button)==null?void 0:V.root)||{},k=(i==null?void 0:i.customVariants)||{},N=!D.isBuiltInVariant(e)&&e in k,a=N?k[e]:null,{spotlightRef:_e,position:A,isHovered:xe,handlers:I}=$e.useSpotlight({enabled:j,onMouseMove:ue,onMouseEnter:be,onMouseLeave:de}),s=n.VARIANT_DEFAULTS[e]||n.VARIANT_DEFAULTS.primary,ve=B.useMemo(()=>N&&a?{backgroundColor:`var(--bear-${e}-bg, ${a.bg})`,color:a.text||"#ffffff",borderColor:a.border,"--bear-ring-color":a.ring||a.bg,...y,...v}:{backgroundColor:b?void 0:`var(--bear-btn-${e}-bg, ${s.bg})`,background:b?`linear-gradient(${C}deg, ${b[0]}, ${b[1]})`:void 0,color:e==="outline"||e==="ghost"?`var(--bear-btn-${e}-text, ${s.text||"inherit"})`:"white",borderColor:e==="outline"?`var(--bear-btn-${e}-border, ${s.border||s.bg})`:void 0,"--bear-ring-color":`var(--bear-btn-${e}-ring, ${s.ring})`,...y,...v},[e,s,y,v,N,a,b,C]),ye=r=>{_e.current=r,typeof d=="function"?d(r):d&&(d.current=r)},Ne=u?"a":Q,Ie=u?{href:x?void 0:u}:{};return t.jsxs(Ne,{ref:ye,id:ge,disabled:u?void 0:x,"aria-disabled":u&&x?!0:void 0,"aria-busy":c||void 0,style:ve,title:ee,className:l.cn("Bear-Button","bear-inline-flex bear-items-center bear-justify-center bear-font-medium bear-transition-all bear-duration-200 bear-outline-none bear-relative bear-overflow-hidden",!K&&"bear-shadow-sm",n.BUTTON_RADIUS[X],W?n.BUTTON_ICON_ONLY_SIZE[o]:Be?n.BUTTON_COMPACT_SIZE[o]:n.BUTTON_SIZE[o],D.isBuiltInVariant(e)?n.BUTTON_VARIANT[e]:"bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",F&&"bear-w-full",c&&"bear-cursor-wait",ae),"data-testid":se,onClick:me,onMouseMove:I.handleMouseMove,onMouseEnter:I.handleMouseEnter,onMouseLeave:I.handleMouseLeave,...Ie,...pe,children:[j&&t.jsx("span",{className:l.cn("Bear-Button__spotlight","bear-absolute bear-left-0 bear-top-0 bear-rounded-full bear-pointer-events-none bear-z-[1]","bear-transition-opacity bear-duration-150 bear-ease-out",xe?"bear-opacity-100":"bear-opacity-0"),"aria-hidden":"true",style:{width:f,height:f,background:`radial-gradient(circle at center, ${re} 0%, transparent 70%)`,transform:`translate(${A.x-f/2}px, ${A.y-f/2}px)`,mixBlendMode:"overlay"}}),c&&t.jsxs("span",{className:l.cn("Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",!m&&"bear-absolute"),children:[t.jsx(Ce.Spinner,{size:o==="xs"?"xs":"sm",className:"Bear-Button__spinner"}),m&&t.jsx(z.Typography,{variant:S,className:"Bear-Button__text",children:m})]}),t.jsxs("span",{className:l.cn("Bear-Button__content bear-inline-flex bear-items-center bear-gap-inherit bear-relative bear-z-10",c&&"bear-invisible"),children:[M&&t.jsx("span",{className:"Bear-Button__prefix bear-inline-flex bear-shrink-0",children:M}),q&&t.jsx("span",{className:l.cn("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0",n.BUTTON_ICON_SIZE[o]),children:q}),t.jsx(z.Typography,{variant:S,className:"Bear-Button__text",children:oe}),R&&t.jsx("span",{className:l.cn("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0",n.BUTTON_ICON_SIZE[o]),children:R}),$&&t.jsx("span",{className:"Bear-Button__suffix bear-inline-flex bear-shrink-0",children:$})]}),O&&w&&t.jsx("span",{className:"Bear-Button__ripple bear-absolute bear-rounded-full bear-pointer-events-none bear-z-[2] bear-animate-ping bear-opacity-30 bear-bg-white",style:w,"aria-hidden":"true"})]})});L.displayName="Button";exports.Button=L;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as N, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as Ie, useState as Ce, useContext as Te, useMemo as Se } from "react";
|
|
3
3
|
import { cn as s } from "../../utils/cn.js";
|
|
4
|
-
import { resolveBearId as
|
|
5
|
-
import { useBearId as
|
|
6
|
-
import { Spinner as
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { useBearStyles as
|
|
4
|
+
import { resolveBearId as Me } from "../../utils/generateBearId.utils.js";
|
|
5
|
+
import { useBearId as $e } from "../../utils/useBearId.js";
|
|
6
|
+
import { Spinner as we } from "../Spinner/Spinner.js";
|
|
7
|
+
import { Typography as D } from "../Typography/Typography.js";
|
|
8
|
+
import { useBearStyles as Oe } from "../../hooks/useBearStyles.js";
|
|
9
9
|
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
10
|
-
import { BearContext as
|
|
10
|
+
import { useBearDensityOptional as ke, BearContext as Ee } from "../../context/BearProvider.js";
|
|
11
11
|
import "../FormControl/FormControl.context.js";
|
|
12
|
-
import { VARIANT_DEFAULTS as
|
|
12
|
+
import { VARIANT_DEFAULTS as L, BUTTON_ICON_SIZE as P, BUTTON_VARIANT as Re, BUTTON_ICON_ONLY_SIZE as ze, BUTTON_COMPACT_SIZE as Ue, BUTTON_SIZE as Ve, BUTTON_RADIUS as Ae } from "./Button.constants.js";
|
|
13
13
|
import { isBuiltInVariant as Z } from "./Button.utils.js";
|
|
14
|
-
import { useSpotlight as
|
|
15
|
-
const
|
|
14
|
+
import { useSpotlight as De } from "./useSpotlight.js";
|
|
15
|
+
const Le = Ie(
|
|
16
16
|
(j, d) => {
|
|
17
17
|
var V, A;
|
|
18
18
|
const {
|
|
@@ -25,18 +25,18 @@ const Ve = ye(
|
|
|
25
25
|
iconPosition: I = "left",
|
|
26
26
|
leftIcon: F,
|
|
27
27
|
rightIcon: H,
|
|
28
|
-
textVariant:
|
|
28
|
+
textVariant: C = "inherit",
|
|
29
29
|
iconOnly: W = !1,
|
|
30
30
|
radius: X = "default",
|
|
31
31
|
ripple: q = !1,
|
|
32
32
|
disableRipple: G = !1,
|
|
33
33
|
disableElevation: J = !1,
|
|
34
|
-
href:
|
|
34
|
+
href: c,
|
|
35
35
|
component: K = "button",
|
|
36
36
|
tooltip: Q,
|
|
37
|
-
compact: ee
|
|
38
|
-
gradient:
|
|
39
|
-
gradientDirection:
|
|
37
|
+
compact: ee,
|
|
38
|
+
gradient: b,
|
|
39
|
+
gradientDirection: T = 135,
|
|
40
40
|
prefix: S,
|
|
41
41
|
suffix: M,
|
|
42
42
|
spotlight: $ = !1,
|
|
@@ -49,12 +49,12 @@ const Ve = ye(
|
|
|
49
49
|
testId: ie,
|
|
50
50
|
bis: se,
|
|
51
51
|
style: le,
|
|
52
|
-
onMouseMove:
|
|
53
|
-
onMouseEnter:
|
|
52
|
+
onMouseMove: ce,
|
|
53
|
+
onMouseEnter: be,
|
|
54
54
|
onMouseLeave: de,
|
|
55
55
|
onClick: g,
|
|
56
56
|
...ue
|
|
57
|
-
} = j, pe =
|
|
57
|
+
} = j, pe = $e("Button"), fe = Me(ne, pe), { density: me } = ke(), he = ee ?? me === "compact", w = q && !G, B = re || l, v = Oe(se, le), O = F ?? (u && I === "left" ? u : void 0), k = H ?? (u && I === "right" ? u : void 0), [E, R] = Ce(null), ge = (t) => {
|
|
58
58
|
if (w) {
|
|
59
59
|
const f = t.currentTarget.getBoundingClientRect(), m = Math.max(f.width, f.height) * 2;
|
|
60
60
|
R({
|
|
@@ -65,12 +65,12 @@ const Ve = ye(
|
|
|
65
65
|
}), setTimeout(() => R(null), 600);
|
|
66
66
|
}
|
|
67
67
|
g == null || g(t);
|
|
68
|
-
}, n =
|
|
68
|
+
}, n = Te(Ee), _ = ((A = (V = n == null ? void 0 : n.components) == null ? void 0 : V.Button) == null ? void 0 : A.root) || {}, z = (n == null ? void 0 : n.customVariants) || {}, y = !Z(e) && e in z, a = y ? z[e] : null, { spotlightRef: Be, position: U, isHovered: ve, handlers: x } = De({
|
|
69
69
|
enabled: $,
|
|
70
|
-
onMouseMove:
|
|
71
|
-
onMouseEnter:
|
|
70
|
+
onMouseMove: ce,
|
|
71
|
+
onMouseEnter: be,
|
|
72
72
|
onMouseLeave: de
|
|
73
|
-
}), i =
|
|
73
|
+
}), i = L[e] || L.primary, _e = Se(() => y && a ? {
|
|
74
74
|
backgroundColor: `var(--bear-${e}-bg, ${a.bg})`,
|
|
75
75
|
color: a.text || "#ffffff",
|
|
76
76
|
borderColor: a.border,
|
|
@@ -78,43 +78,43 @@ const Ve = ye(
|
|
|
78
78
|
..._,
|
|
79
79
|
...v
|
|
80
80
|
} : {
|
|
81
|
-
backgroundColor:
|
|
82
|
-
background:
|
|
81
|
+
backgroundColor: b ? void 0 : `var(--bear-btn-${e}-bg, ${i.bg})`,
|
|
82
|
+
background: b ? `linear-gradient(${T}deg, ${b[0]}, ${b[1]})` : void 0,
|
|
83
83
|
color: e === "outline" || e === "ghost" ? `var(--bear-btn-${e}-text, ${i.text || "inherit"})` : "white",
|
|
84
84
|
borderColor: e === "outline" ? `var(--bear-btn-${e}-border, ${i.border || i.bg})` : void 0,
|
|
85
85
|
"--bear-ring-color": `var(--bear-btn-${e}-ring, ${i.ring})`,
|
|
86
86
|
..._,
|
|
87
87
|
...v
|
|
88
|
-
}, [e, i, _, v,
|
|
89
|
-
|
|
90
|
-
},
|
|
88
|
+
}, [e, i, _, v, y, a, b, T]), ye = (t) => {
|
|
89
|
+
Be.current = t, typeof d == "function" ? d(t) : d && (d.current = t);
|
|
90
|
+
}, xe = c ? "a" : K, Ne = c ? { href: B ? void 0 : c } : {};
|
|
91
91
|
return /* @__PURE__ */ N(
|
|
92
|
-
|
|
92
|
+
xe,
|
|
93
93
|
{
|
|
94
|
-
ref:
|
|
94
|
+
ref: ye,
|
|
95
95
|
id: fe,
|
|
96
|
-
disabled:
|
|
97
|
-
"aria-disabled":
|
|
96
|
+
disabled: c ? void 0 : B,
|
|
97
|
+
"aria-disabled": c && B ? !0 : void 0,
|
|
98
98
|
"aria-busy": l || void 0,
|
|
99
|
-
style:
|
|
99
|
+
style: _e,
|
|
100
100
|
title: Q,
|
|
101
101
|
className: s(
|
|
102
102
|
"Bear-Button",
|
|
103
103
|
"bear-inline-flex bear-items-center bear-justify-center bear-font-medium bear-transition-all bear-duration-200 bear-outline-none bear-relative bear-overflow-hidden",
|
|
104
104
|
!J && "bear-shadow-sm",
|
|
105
|
-
|
|
106
|
-
W ?
|
|
107
|
-
Z(e) ?
|
|
105
|
+
Ae[X],
|
|
106
|
+
W ? ze[o] : he ? Ue[o] : Ve[o],
|
|
107
|
+
Z(e) ? Re[e] : "bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",
|
|
108
108
|
Y && "bear-w-full",
|
|
109
109
|
l && "bear-cursor-wait",
|
|
110
110
|
ae
|
|
111
111
|
),
|
|
112
112
|
"data-testid": ie,
|
|
113
|
-
onClick:
|
|
114
|
-
onMouseMove:
|
|
115
|
-
onMouseEnter:
|
|
116
|
-
onMouseLeave:
|
|
117
|
-
...
|
|
113
|
+
onClick: ge,
|
|
114
|
+
onMouseMove: x.handleMouseMove,
|
|
115
|
+
onMouseEnter: x.handleMouseEnter,
|
|
116
|
+
onMouseLeave: x.handleMouseLeave,
|
|
117
|
+
...Ne,
|
|
118
118
|
...ue,
|
|
119
119
|
children: [
|
|
120
120
|
$ && /* @__PURE__ */ r(
|
|
@@ -124,7 +124,7 @@ const Ve = ye(
|
|
|
124
124
|
"Bear-Button__spotlight",
|
|
125
125
|
"bear-absolute bear-left-0 bear-top-0 bear-rounded-full bear-pointer-events-none bear-z-[1]",
|
|
126
126
|
"bear-transition-opacity bear-duration-150 bear-ease-out",
|
|
127
|
-
|
|
127
|
+
ve ? "bear-opacity-100" : "bear-opacity-0"
|
|
128
128
|
),
|
|
129
129
|
"aria-hidden": "true",
|
|
130
130
|
style: {
|
|
@@ -140,8 +140,8 @@ const Ve = ye(
|
|
|
140
140
|
"Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",
|
|
141
141
|
!h && "bear-absolute"
|
|
142
142
|
), children: [
|
|
143
|
-
/* @__PURE__ */ r(
|
|
144
|
-
h && /* @__PURE__ */ r(
|
|
143
|
+
/* @__PURE__ */ r(we, { size: o === "xs" ? "xs" : "sm", className: "Bear-Button__spinner" }),
|
|
144
|
+
h && /* @__PURE__ */ r(D, { variant: C, className: "Bear-Button__text", children: h })
|
|
145
145
|
] }),
|
|
146
146
|
/* @__PURE__ */ N(
|
|
147
147
|
"span",
|
|
@@ -152,9 +152,9 @@ const Ve = ye(
|
|
|
152
152
|
),
|
|
153
153
|
children: [
|
|
154
154
|
S && /* @__PURE__ */ r("span", { className: "Bear-Button__prefix bear-inline-flex bear-shrink-0", children: S }),
|
|
155
|
-
O && /* @__PURE__ */ r("span", { className: s("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0",
|
|
156
|
-
/* @__PURE__ */ r(
|
|
157
|
-
k && /* @__PURE__ */ r("span", { className: s("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0",
|
|
155
|
+
O && /* @__PURE__ */ r("span", { className: s("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0", P[o]), children: O }),
|
|
156
|
+
/* @__PURE__ */ r(D, { variant: C, className: "Bear-Button__text", children: oe }),
|
|
157
|
+
k && /* @__PURE__ */ r("span", { className: s("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0", P[o]), children: k }),
|
|
158
158
|
M && /* @__PURE__ */ r("span", { className: "Bear-Button__suffix bear-inline-flex bear-shrink-0", children: M })
|
|
159
159
|
]
|
|
160
160
|
}
|
|
@@ -172,7 +172,7 @@ const Ve = ye(
|
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
|
-
|
|
175
|
+
Le.displayName = "Button";
|
|
176
176
|
export {
|
|
177
|
-
|
|
177
|
+
Le as Button
|
|
178
178
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),e=require("./Chip.const.cjs"),l=require("../../utils/cn.cjs");require("react");const P=require("../../utils/generateBearId.utils.cjs"),A=require("../../utils/useBearId.cjs"),v=require("../../context/BearProvider.cjs"),E=c=>{const{children:_,variant:d="filled",color:C="default",size:s="md",icon:t,avatar:o,onDelete:i,onClick:n,disabled:a=!1,className:u,id:b,testId:S}=c,I=A.useBearId("Chip"),p=P.resolveBearId(b,I),{density:m}=v.useBearDensityOptional(),O=m==="compact"?e.CHIP_SIZE_COMPACT_CLASSES:e.CHIP_SIZE_CLASSES,h=n?"button":"span";return r.jsxs(h,{id:p,"data-testid":S,onClick:n,disabled:a,className:l.cn(e.C_H_I_P_ROOT_CLASS,"bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",O[s],o&&e.CHIP_AVATAR_SIZE_CLASSES[s],e.CHIP_COLOR_CLASSES[d][C],n&&!a&&"bear-cursor-pointer hover:bear-opacity-80",a&&"bear-opacity-50 bear-cursor-not-allowed",u),children:[o&&r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__avatar bear--ml-1`,children:o}),t&&r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__icon`,children:t}),r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__label`,children:_}),i&&r.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),i()},disabled:a,className:l.cn(`${e.C_H_I_P_ROOT_CLASS}__delete`,"bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/10 dark:hover:bear-bg-black/20 bear-transition-colors",a&&"bear-cursor-not-allowed"),"aria-label":"Remove",children:r.jsx("svg",{className:e.CHIP_DELETE_ICON_SIZES[s],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Chip",r={filled:{default:"bear-bg-gray-600 bear-text-white dark:bear-bg-zinc-600",primary:"bear-bg-primary-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-gray-400 bear-text-gray-700 dark:bear-border-zinc-500 dark:bear-text-zinc-300",primary:"bear-border bear-border-primary-500 bear-text-primary-600 dark:bear-text-primary-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-600 dark:bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-700 dark:bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-700 dark:bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-600 dark:bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-600 dark:bear-text-blue-400"},soft:{default:"bear-bg-gray-500/15 bear-text-gray-700 dark:bear-bg-zinc-500/20 dark:bear-text-zinc-300",primary:"bear-bg-primary-500/15 bear-text-primary-700 dark:bear-bg-primary-500/20 dark:bear-text-primary-400",secondary:"bear-bg-purple-500/15 bear-text-purple-700 dark:bear-bg-purple-500/20 dark:bear-text-purple-400",success:"bear-bg-green-500/15 bear-text-green-700 dark:bear-bg-green-500/20 dark:bear-text-green-400",warning:"bear-bg-yellow-500/15 bear-text-yellow-800 dark:bear-bg-yellow-500/20 dark:bear-text-yellow-400",error:"bear-bg-red-500/15 bear-text-red-700 dark:bear-bg-red-500/20 dark:bear-text-red-400",info:"bear-bg-blue-500/15 bear-text-blue-700 dark:bear-bg-blue-500/20 dark:bear-text-blue-400"}},a={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},b={sm:"bear-h-5 bear-text-xs bear-px-1.5 bear-gap-0.5",md:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",lg:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5"},t={sm:"[&_.Bear-Avatar]:bear-w-4 [&_.Bear-Avatar]:bear-h-4",md:"[&_.Bear-Avatar]:bear-w-5 [&_.Bear-Avatar]:bear-h-5",lg:"[&_.Bear-Avatar]:bear-w-6 [&_.Bear-Avatar]:bear-h-6"},d={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"};exports.CHIP_AVATAR_SIZE_CLASSES=t;exports.CHIP_COLOR_CLASSES=r;exports.CHIP_DELETE_ICON_SIZES=d;exports.CHIP_SIZE_CLASSES=a;exports.CHIP_SIZE_COMPACT_CLASSES=b;exports.C_H_I_P_ROOT_CLASS=e;
|