@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,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 n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("react"),H=require("../../context/BearProvider.cjs"),ee=require("../../utils/maxVisible.utils.cjs"),c=require("../../utils/cn.cjs"),U=require("../Typography/Typography.cjs"),re=require("../Dropdown/Dropdown.cjs"),ne=require("../Icon/index.cjs"),r=require("./Stepper.const.cjs"),m=require("./Stepper.utils.cjs"),te=1200,se=16,oe=640,W=3,ie=()=>n.jsx("svg",{width:r.CHECK_ICON_SIZE,height:r.CHECK_ICON_SIZE,viewBox:r.CHECK_ICON_VIEWBOX,fill:"none",stroke:"currentColor",strokeWidth:"3",children:n.jsx("polyline",{points:r.CHECK_ICON_POINTS})}),ce=()=>n.jsxs("svg",{width:r.ERROR_ICON_SIZE,height:r.ERROR_ICON_SIZE,viewBox:r.ERROR_ICON_VIEWBOX,fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),D=E.forwardRef(({steps:o,activeStep:_,onStepClick:S,orientation:M=r.DEFAULT_ORIENTATION,size:A=r.DEFAULT_SIZE,showNumbers:V=r.DEFAULT_SHOW_NUMBERS,clickable:g=r.DEFAULT_CLICKABLE,showConnectors:q=r.DEFAULT_SHOW_CONNECTORS,connectorStyle:R=r.DEFAULT_CONNECTOR_STYLE,alternativeLabel:L=r.DEFAULT_ALTERNATIVE_LABEL,completedIcon:Z,errorIcon:z,labelTypographyProps:K,descriptionTypographyProps:k,maxVisibleSteps:C,testId:X,className:$,...G},Y)=>{const f=H.useBearThemeOptional(),{direction:p}=H.useBearDirectionOptional(),[O,J]=E.useState(()=>typeof window<"u"?window.innerWidth:te);E.useEffect(()=>{const e=()=>J(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const h=E.useMemo(()=>{if(C!=null)return ee.resolveMaxVisible(C,{width:O,theme:f});if(O<oe&&o.length>W)return W},[C,O,f,o.length]),d=M==="horizontal",v=r.STEP_INDICATOR_SIZES[A],x=r.STEP_LABEL_SIZES[A],T=d&&h!=null&&o.length>h,{visibleIndices:j,leftHidden:b,rightHidden:N}=E.useMemo(()=>{if(!T||h==null)return{visibleIndices:o.map((a,I)=>I),leftHidden:[],rightHidden:[]};const e=h,t=Math.floor(e/2),s=Math.max(0,Math.min(_-t,o.length-e)),i=Array.from({length:e},(a,I)=>s+I),l=[],F=[];for(let a=0;a<s;a++)l.push(a);for(let a=s+e;a<o.length;a++)F.push(a);return{visibleIndices:i,leftHidden:l,rightHidden:F}},[T,h,o,_]),w=(e,t,s)=>{const i=r.STEP_STATUS_CLASSES[s],l=m.resolveIndicatorContent(e,t,s,V,Z,z,n.jsx(ie,{}),n.jsx(ce,{}));return n.jsx("div",{className:c.cn(r.STEP_INDICATOR_BASE,v,i.indicator,g&&!e.disabled&&"cursor-pointer hover:scale-105"),onClick:()=>{g&&!e.disabled&&S&&S(t)},children:l})},u=(e,t)=>{if(!q||t)return null;const s=e<_;return d?n.jsx("div",{className:c.cn("Bear-Stepper__connector flex-1 self-center mx-1","h-0.5 min-w-[12px] transition-colors",s?r.CONNECTOR_STATUS.completed:r.CONNECTOR_STATUS.pending,R==="dashed"&&"border-t-2 border-dashed bg-transparent")}):n.jsx("div",{className:c.cn(r.CONNECTOR_BASE,r.CONNECTOR_VERTICAL,s?r.CONNECTOR_STATUS.completed:r.CONNECTOR_STATUS.pending,R==="dashed"&&"border-t-2 border-dashed bg-transparent")})},B=(e,t)=>{const s=r.STEP_STATUS_CLASSES[t],i={...K,...e.labelTypographyProps},l={...k,...e.descriptionTypographyProps};return n.jsxs(n.Fragment,{children:[n.jsx(U.Typography,{variant:"body2",...i,className:c.cn(r.STEP_LABEL_BASE,x.label,s.label,i==null?void 0:i.className),children:e.label}),e.description&&n.jsx(U.Typography,{variant:"caption",...l,className:c.cn(r.STEP_DESCRIPTION_CLASSES,x.description,l==null?void 0:l.className),children:e.description})]})},P=(e,t)=>{const s=m.resolveStepStatus(e,t,_);return n.jsxs("div",{className:c.cn("Bear-Stepper__content flex shrink-0",L?"flex-col items-center":"items-center gap-2"),children:[w(e,t,s),n.jsx("div",{className:c.cn(L&&"text-center mt-2","whitespace-nowrap"),children:B(e,s)})]})},Q=(e,t)=>{const s=m.resolveStepStatus(e,t,_);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 mr-4",children:w(e,t,s)}),n.jsxs("div",{className:"flex-1 pt-0.5",children:[B(e,s),e.content&&s==="active"&&n.jsx("div",{className:"mt-4",children:e.content})]})]})},y=(e,t)=>n.jsx("div",{className:"Bear-Stepper__overflow shrink-0",children:n.jsx(re.Dropdown,{placement:"bottom-start",closeOnSelect:!0,trigger:n.jsx("button",{type:"button",className:c.cn(r.STEP_INDICATOR_BASE,v,r.STEP_STATUS_CLASSES.pending.indicator,"bear-cursor-pointer bear-border-0"),"aria-label":t==="left"?r.OVERFLOW_LEFT_LABEL:r.OVERFLOW_RIGHT_LABEL,children:n.jsx(ne.BearIcons.MoreHorizIcon,{size:se})}),items:e.map(s=>({key:`step-${s}`,label:o[s].label,disabled:o[s].disabled,onClick:()=>{o[s].disabled||S==null||S(s)}}))})},`overflow-${t}`);return n.jsxs("div",{ref:Y,dir:p,className:c.cn(r.STEPPER_BASE_CLASSES,d?r.STEPPER_HORIZONTAL_CLASSES:r.STEPPER_VERTICAL_CLASSES,p==="rtl"&&d&&"bear-flex-row-reverse",$),"data-testid":X,...G,children:[d&&!T&&o.map((e,t)=>n.jsxs(E.Fragment,{children:[P(e,t),u(t,t===o.length-1)]},t)),d&&T&&n.jsxs(n.Fragment,{children:[b.length>0&&n.jsxs(n.Fragment,{children:[y(b,"left"),u(-1,!1)]}),j.map((e,t)=>{const s=o[e],i=t===j.length-1&&N.length===0;return n.jsxs(E.Fragment,{children:[P(s,e),u(e,i)]},e)}),N.length>0&&y(N,"right")]}),!d&&o.map((e,t)=>n.jsxs("div",{className:c.cn("Bear-Stepper__step",r.STEP_WRAPPER_VERTICAL),children:[Q(e,t),u(t,t===o.length-1)]},t))]})});D.displayName="Stepper";exports.Stepper=D;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
import { jsxs as i, Fragment as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useBearThemeOptional as
|
|
4
|
-
import { resolveMaxVisible as
|
|
2
|
+
import U, { forwardRef as ie, useState as le, useEffect as se, useMemo as V } from "react";
|
|
3
|
+
import { useBearThemeOptional as ae, useBearDirectionOptional as ce } from "../../context/BearProvider.js";
|
|
4
|
+
import { resolveMaxVisible as de } from "../../utils/maxVisible.utils.js";
|
|
5
5
|
import { cn as s } from "../../utils/cn.js";
|
|
6
|
-
import { Typography as
|
|
7
|
-
import { Dropdown as
|
|
8
|
-
import { BearIcons as
|
|
9
|
-
import { STEP_WRAPPER_VERTICAL as
|
|
10
|
-
import { resolveStepStatus as
|
|
11
|
-
const
|
|
6
|
+
import { Typography as M } from "../Typography/Typography.js";
|
|
7
|
+
import { Dropdown as Ee } from "../Dropdown/Dropdown.js";
|
|
8
|
+
import { BearIcons as he } from "../Icon/index.js";
|
|
9
|
+
import { STEP_WRAPPER_VERTICAL as _e, STEPPER_HORIZONTAL_CLASSES as me, STEPPER_VERTICAL_CLASSES as Te, STEPPER_BASE_CLASSES as fe, DEFAULT_ORIENTATION as Se, DEFAULT_SIZE as Ie, DEFAULT_SHOW_NUMBERS as Oe, DEFAULT_CLICKABLE as Ce, DEFAULT_SHOW_CONNECTORS as Ne, DEFAULT_CONNECTOR_STYLE as ue, DEFAULT_ALTERNATIVE_LABEL as Ae, CONNECTOR_STATUS as S, CONNECTOR_VERTICAL as Le, CONNECTOR_BASE as ge, OVERFLOW_LEFT_LABEL as Re, OVERFLOW_RIGHT_LABEL as pe, STEP_STATUS_CLASSES as u, STEP_INDICATOR_SIZES as ve, STEP_INDICATOR_BASE as z, STEP_LABEL_SIZES as we, STEP_LABEL_BASE as be, STEP_DESCRIPTION_CLASSES as Be, ERROR_ICON_VIEWBOX as Pe, ERROR_ICON_SIZE as Z, CHECK_ICON_VIEWBOX as ye, CHECK_ICON_SIZE as K, CHECK_ICON_POINTS as He } from "./Stepper.const.js";
|
|
10
|
+
import { resolveStepStatus as k, resolveIndicatorContent as We } from "./Stepper.utils.js";
|
|
11
|
+
const Fe = 1200, De = 16, Ue = 640, x = 3, Ve = () => /* @__PURE__ */ t("svg", { width: K, height: K, viewBox: ye, fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ t("polyline", { points: He }) }), Me = () => /* @__PURE__ */ i("svg", { width: Z, height: Z, viewBox: Pe, fill: "none", stroke: "currentColor", strokeWidth: "3", children: [
|
|
12
12
|
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
13
13
|
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
14
|
-
] }),
|
|
14
|
+
] }), ze = ie(
|
|
15
15
|
({
|
|
16
16
|
steps: o,
|
|
17
17
|
activeStep: E,
|
|
18
18
|
onStepClick: h,
|
|
19
|
-
orientation: X =
|
|
20
|
-
size: A =
|
|
21
|
-
showNumbers: j =
|
|
22
|
-
clickable: L =
|
|
23
|
-
showConnectors:
|
|
24
|
-
connectorStyle: g =
|
|
25
|
-
alternativeLabel: R =
|
|
26
|
-
completedIcon:
|
|
27
|
-
errorIcon:
|
|
28
|
-
labelTypographyProps:
|
|
29
|
-
descriptionTypographyProps:
|
|
19
|
+
orientation: X = Se,
|
|
20
|
+
size: A = Ie,
|
|
21
|
+
showNumbers: j = Oe,
|
|
22
|
+
clickable: L = Ce,
|
|
23
|
+
showConnectors: $ = Ne,
|
|
24
|
+
connectorStyle: g = ue,
|
|
25
|
+
alternativeLabel: R = Ae,
|
|
26
|
+
completedIcon: G,
|
|
27
|
+
errorIcon: Y,
|
|
28
|
+
labelTypographyProps: q,
|
|
29
|
+
descriptionTypographyProps: J,
|
|
30
30
|
maxVisibleSteps: I,
|
|
31
|
-
testId:
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
const p =
|
|
36
|
-
|
|
37
|
-
const e = () =>
|
|
31
|
+
testId: Q,
|
|
32
|
+
className: ee,
|
|
33
|
+
...re
|
|
34
|
+
}, ne) => {
|
|
35
|
+
const p = ae(), { direction: v } = ce(), [O, te] = le(() => typeof window < "u" ? window.innerWidth : Fe);
|
|
36
|
+
se(() => {
|
|
37
|
+
const e = () => te(window.innerWidth);
|
|
38
38
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
39
39
|
}, []);
|
|
40
|
-
const _ =
|
|
40
|
+
const _ = V(() => {
|
|
41
41
|
if (I != null)
|
|
42
|
-
return
|
|
43
|
-
if (O <
|
|
44
|
-
return
|
|
45
|
-
}, [I, O, p, o.length]), d = X === "horizontal",
|
|
42
|
+
return de(I, { width: O, theme: p });
|
|
43
|
+
if (O < Ue && o.length > x)
|
|
44
|
+
return x;
|
|
45
|
+
}, [I, O, p, o.length]), d = X === "horizontal", w = ve[A], b = we[A], m = d && _ != null && o.length > _, { visibleIndices: B, leftHidden: P, rightHidden: C } = V(() => {
|
|
46
46
|
if (!m || _ == null)
|
|
47
47
|
return {
|
|
48
48
|
visibleIndices: o.map((c, N) => N),
|
|
49
49
|
leftHidden: [],
|
|
50
50
|
rightHidden: []
|
|
51
51
|
};
|
|
52
|
-
const e = _, r = Math.floor(e / 2), n = Math.max(0, Math.min(E - r, o.length - e)), l = Array.from({ length: e }, (c, N) => n + N), a = [],
|
|
52
|
+
const e = _, r = Math.floor(e / 2), n = Math.max(0, Math.min(E - r, o.length - e)), l = Array.from({ length: e }, (c, N) => n + N), a = [], D = [];
|
|
53
53
|
for (let c = 0; c < n; c++) a.push(c);
|
|
54
|
-
for (let c = n + e; c < o.length; c++)
|
|
55
|
-
return { visibleIndices: l, leftHidden: a, rightHidden:
|
|
56
|
-
}, [m, _, o, E]),
|
|
57
|
-
const l = u[n], a =
|
|
54
|
+
for (let c = n + e; c < o.length; c++) D.push(c);
|
|
55
|
+
return { visibleIndices: l, leftHidden: a, rightHidden: D };
|
|
56
|
+
}, [m, _, o, E]), y = (e, r, n) => {
|
|
57
|
+
const l = u[n], a = We(
|
|
58
58
|
e,
|
|
59
59
|
r,
|
|
60
60
|
n,
|
|
61
61
|
j,
|
|
62
|
-
$,
|
|
63
62
|
G,
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */ t(
|
|
63
|
+
Y,
|
|
64
|
+
/* @__PURE__ */ t(Ve, {}),
|
|
65
|
+
/* @__PURE__ */ t(Me, {})
|
|
66
66
|
);
|
|
67
67
|
return /* @__PURE__ */ t(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
70
|
className: s(
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
z,
|
|
72
|
+
w,
|
|
73
73
|
l.indicator,
|
|
74
74
|
L && !e.disabled && "cursor-pointer hover:scale-105"
|
|
75
75
|
),
|
|
@@ -80,7 +80,7 @@ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", {
|
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
}, T = (e, r) => {
|
|
83
|
-
if (
|
|
83
|
+
if (!$ || r) return null;
|
|
84
84
|
const n = e < E;
|
|
85
85
|
return d ? /* @__PURE__ */ t(
|
|
86
86
|
"div",
|
|
@@ -96,52 +96,52 @@ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", {
|
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
98
|
className: s(
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
ge,
|
|
100
|
+
Le,
|
|
101
101
|
n ? S.completed : S.pending,
|
|
102
102
|
g === "dashed" && "border-t-2 border-dashed bg-transparent"
|
|
103
103
|
)
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
|
-
},
|
|
107
|
-
const n = u[r], l = { ...
|
|
106
|
+
}, H = (e, r) => {
|
|
107
|
+
const n = u[r], l = { ...q, ...e.labelTypographyProps }, a = { ...J, ...e.descriptionTypographyProps };
|
|
108
108
|
return /* @__PURE__ */ i(f, { children: [
|
|
109
109
|
/* @__PURE__ */ t(
|
|
110
|
-
|
|
110
|
+
M,
|
|
111
111
|
{
|
|
112
112
|
variant: "body2",
|
|
113
113
|
...l,
|
|
114
|
-
className: s(
|
|
114
|
+
className: s(be, b.label, n.label, l == null ? void 0 : l.className),
|
|
115
115
|
children: e.label
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
118
|
e.description && /* @__PURE__ */ t(
|
|
119
|
-
|
|
119
|
+
M,
|
|
120
120
|
{
|
|
121
121
|
variant: "caption",
|
|
122
122
|
...a,
|
|
123
|
-
className: s(
|
|
123
|
+
className: s(Be, b.description, a == null ? void 0 : a.className),
|
|
124
124
|
children: e.description
|
|
125
125
|
}
|
|
126
126
|
)
|
|
127
127
|
] });
|
|
128
|
-
},
|
|
129
|
-
const n =
|
|
128
|
+
}, W = (e, r) => {
|
|
129
|
+
const n = k(e, r, E);
|
|
130
130
|
return /* @__PURE__ */ i("div", { className: s("Bear-Stepper__content flex shrink-0", R ? "flex-col items-center" : "items-center gap-2"), children: [
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */ t("div", { className: s(R && "text-center mt-2", "whitespace-nowrap"), children:
|
|
131
|
+
y(e, r, n),
|
|
132
|
+
/* @__PURE__ */ t("div", { className: s(R && "text-center mt-2", "whitespace-nowrap"), children: H(e, n) })
|
|
133
133
|
] });
|
|
134
|
-
},
|
|
135
|
-
const n =
|
|
134
|
+
}, oe = (e, r) => {
|
|
135
|
+
const n = k(e, r, E);
|
|
136
136
|
return /* @__PURE__ */ i(f, { children: [
|
|
137
|
-
/* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-4", children:
|
|
137
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-4", children: y(e, r, n) }),
|
|
138
138
|
/* @__PURE__ */ i("div", { className: "flex-1 pt-0.5", children: [
|
|
139
|
-
|
|
139
|
+
H(e, n),
|
|
140
140
|
e.content && n === "active" && /* @__PURE__ */ t("div", { className: "mt-4", children: e.content })
|
|
141
141
|
] })
|
|
142
142
|
] });
|
|
143
|
-
},
|
|
144
|
-
|
|
143
|
+
}, F = (e, r) => /* @__PURE__ */ t("div", { className: "Bear-Stepper__overflow shrink-0", children: /* @__PURE__ */ t(
|
|
144
|
+
Ee,
|
|
145
145
|
{
|
|
146
146
|
placement: "bottom-start",
|
|
147
147
|
closeOnSelect: !0,
|
|
@@ -150,13 +150,13 @@ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", {
|
|
|
150
150
|
{
|
|
151
151
|
type: "button",
|
|
152
152
|
className: s(
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
z,
|
|
154
|
+
w,
|
|
155
155
|
u.pending.indicator,
|
|
156
156
|
"bear-cursor-pointer bear-border-0"
|
|
157
157
|
),
|
|
158
|
-
"aria-label": r === "left" ?
|
|
159
|
-
children: /* @__PURE__ */ t(
|
|
158
|
+
"aria-label": r === "left" ? Re : pe,
|
|
159
|
+
children: /* @__PURE__ */ t(he.MoreHorizIcon, { size: De })
|
|
160
160
|
}
|
|
161
161
|
),
|
|
162
162
|
items: e.map((n) => ({
|
|
@@ -172,31 +172,37 @@ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", {
|
|
|
172
172
|
return /* @__PURE__ */ i(
|
|
173
173
|
"div",
|
|
174
174
|
{
|
|
175
|
-
ref:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
ref: ne,
|
|
176
|
+
dir: v,
|
|
177
|
+
className: s(
|
|
178
|
+
fe,
|
|
179
|
+
d ? me : Te,
|
|
180
|
+
v === "rtl" && d && "bear-flex-row-reverse",
|
|
181
|
+
ee
|
|
182
|
+
),
|
|
183
|
+
"data-testid": Q,
|
|
184
|
+
...re,
|
|
179
185
|
children: [
|
|
180
|
-
d && !m && o.map((e, r) => /* @__PURE__ */ i(
|
|
181
|
-
|
|
186
|
+
d && !m && o.map((e, r) => /* @__PURE__ */ i(U.Fragment, { children: [
|
|
187
|
+
W(e, r),
|
|
182
188
|
T(r, r === o.length - 1)
|
|
183
189
|
] }, r)),
|
|
184
190
|
d && m && /* @__PURE__ */ i(f, { children: [
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
P.length > 0 && /* @__PURE__ */ i(f, { children: [
|
|
192
|
+
F(P, "left"),
|
|
187
193
|
T(-1, !1)
|
|
188
194
|
] }),
|
|
189
|
-
|
|
190
|
-
const n = o[e], l = r ===
|
|
191
|
-
return /* @__PURE__ */ i(
|
|
192
|
-
|
|
195
|
+
B.map((e, r) => {
|
|
196
|
+
const n = o[e], l = r === B.length - 1 && C.length === 0;
|
|
197
|
+
return /* @__PURE__ */ i(U.Fragment, { children: [
|
|
198
|
+
W(n, e),
|
|
193
199
|
T(e, l)
|
|
194
200
|
] }, e);
|
|
195
201
|
}),
|
|
196
|
-
C.length > 0 &&
|
|
202
|
+
C.length > 0 && F(C, "right")
|
|
197
203
|
] }),
|
|
198
|
-
!d && o.map((e, r) => /* @__PURE__ */ i("div", { className: s("Bear-Stepper__step",
|
|
199
|
-
|
|
204
|
+
!d && o.map((e, r) => /* @__PURE__ */ i("div", { className: s("Bear-Stepper__step", _e), children: [
|
|
205
|
+
oe(e, r),
|
|
200
206
|
T(r, r === o.length - 1)
|
|
201
207
|
] }, r))
|
|
202
208
|
]
|
|
@@ -204,7 +210,7 @@ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", {
|
|
|
204
210
|
);
|
|
205
211
|
}
|
|
206
212
|
);
|
|
207
|
-
|
|
213
|
+
ze.displayName = "Stepper";
|
|
208
214
|
export {
|
|
209
|
-
|
|
215
|
+
ze as Stepper
|
|
210
216
|
};
|
|
@@ -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;
|