@forgedevstack/bear 1.2.8 → 1.3.0
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/dist/components/Backdrop/Backdrop.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.d.ts +4 -1
- package/dist/components/Backdrop/Backdrop.const.js +11 -8
- package/dist/components/Backdrop/Backdrop.js +39 -36
- package/dist/components/Backdrop/Backdrop.types.d.ts +1 -0
- package/dist/components/Backdrop/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.d.ts +3 -0
- package/dist/components/Drawer/Drawer.const.js +14 -11
- package/dist/components/Drawer/Drawer.js +95 -82
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +3 -1
- package/dist/components/Modal/Modal.const.js +12 -9
- package/dist/components/Modal/Modal.js +45 -41
- package/dist/components/Modal/Modal.types.d.ts +1 -0
- package/dist/components/ModalsProvider/ModalsContext.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsContext.d.ts +2 -0
- package/dist/components/ModalsProvider/ModalsContext.js +5 -0
- package/dist/components/ModalsProvider/ModalsProvider.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.d.ts +39 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.js +40 -0
- package/dist/components/ModalsProvider/ModalsProvider.d.ts +3 -0
- package/dist/components/ModalsProvider/ModalsProvider.js +97 -0
- package/dist/components/ModalsProvider/ModalsProvider.types.d.ts +75 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.d.ts +8 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.js +24 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.cjs +1 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.d.ts +2 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.js +24 -0
- package/dist/components/ModalsProvider/components/ModalsHost/index.d.ts +1 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.cjs +1 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.d.ts +2 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.js +66 -0
- package/dist/components/ModalsProvider/components/StackedModal/index.d.ts +1 -0
- package/dist/components/ModalsProvider/components/index.d.ts +2 -0
- package/dist/components/ModalsProvider/hooks/index.d.ts +1 -0
- package/dist/components/ModalsProvider/hooks/useModals.cjs +1 -0
- package/dist/components/ModalsProvider/hooks/useModals.d.ts +2 -0
- package/dist/components/ModalsProvider/hooks/useModals.js +12 -0
- package/dist/components/ModalsProvider/index.d.ts +3 -0
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.d.ts +13 -2
- package/dist/components/SignPad/SignPad.const.js +22 -13
- package/dist/components/SignPad/SignPad.js +127 -121
- package/dist/components/SignPad/SignPad.types.d.ts +2 -1
- package/dist/components/SignPad/SignPad.utils.cjs +1 -0
- package/dist/components/SignPad/SignPad.utils.d.ts +34 -0
- package/dist/components/SignPad/SignPad.utils.js +42 -0
- package/dist/components/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.const.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.const.d.ts +7 -1
- package/dist/components/Snackbar/Snackbar.const.js +21 -11
- package/dist/components/Snackbar/Snackbar.js +60 -59
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.cjs +1 -0
- package/dist/components/StatCard/StatCard.const.d.ts +11 -1
- package/dist/components/StatCard/StatCard.const.js +14 -0
- package/dist/components/StatCard/StatCard.d.ts +0 -4
- package/dist/components/StatCard/StatCard.js +44 -32
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +23 -11
- package/dist/components/Stepper/Stepper.const.js +60 -48
- package/dist/components/Stepper/Stepper.js +126 -118
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -1
- package/dist/components/Toast/Toast.const.d.ts +4 -1
- package/dist/components/Toast/Toast.const.js +20 -5
- package/dist/components/Toast/Toast.js +97 -110
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +389 -385
- package/dist/index.cjs +1 -1
- package/dist/index.js +504 -500
- package/dist/styles/_feedback.css +130 -0
- package/dist/styles/_overlays.css +24 -0
- package/dist/styles/main.css +2 -0
- package/dist/styles.css +193 -25
- package/package.json +1 -1
|
@@ -1,117 +1,116 @@
|
|
|
1
|
-
import { jsxs as i, Fragment as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as i, Fragment as O, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import F, { forwardRef as le, useState as Ee, useEffect as se, useMemo as U } from "react";
|
|
3
3
|
import { useBearThemeOptional as ae, useBearDirectionOptional as ce } from "../../context/BearProvider.js";
|
|
4
4
|
import { resolveMaxVisible as de } from "../../utils/maxVisible.utils.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as E } from "../../utils/cn.js";
|
|
6
6
|
import { Typography as M } from "../Typography/Typography.js";
|
|
7
|
-
import { Dropdown as
|
|
8
|
-
import { BearIcons as
|
|
9
|
-
import { STEP_WRAPPER_VERTICAL as
|
|
10
|
-
import { resolveStepStatus as
|
|
11
|
-
const
|
|
7
|
+
import { Dropdown as _e } from "../Dropdown/Dropdown.js";
|
|
8
|
+
import { BearIcons as Te } from "../Icon/index.js";
|
|
9
|
+
import { STEP_WRAPPER_VERTICAL as he, STEPPER_HORIZONTAL_CLASSES as Ne, STEPPER_VERTICAL_CLASSES as Oe, STEPPER_BASE_CLASSES as Se, DEFAULT_ORIENTATION as Ce, DEFAULT_SIZE as Ie, DEFAULT_SHOW_NUMBERS as Ae, DEFAULT_CLICKABLE as Le, DEFAULT_SHOW_CONNECTORS as me, DEFAULT_CONNECTOR_STYLE as Re, DEFAULT_ALTERNATIVE_LABEL as fe, STEP_LABEL_ALTERNATIVE as ue, STEP_LABEL_INLINE as ge, STEP_CONTENT_ALTERNATIVE as Pe, STEP_CONTENT_INLINE as ve, STEP_CONTENT_BASE as Be, CONNECTOR_DASHED_CLASSES as Z, CONNECTOR_STATUS as S, CONNECTOR_HORIZONTAL_LAYOUT as we, CONNECTOR_VERTICAL as be, CONNECTOR_BASE as pe, STEP_OVERFLOW_ROOT as He, OVERFLOW_LEFT_LABEL as We, OVERFLOW_RIGHT_LABEL as De, STEP_STATUS_CLASSES as m, STEP_INDICATOR_SIZES as Ve, STEP_INDICATOR_BASE as z, STEP_VERTICAL_INDICATOR_WRAP as ye, STEP_VERTICAL_BODY as Fe, STEP_VERTICAL_CONTENT as Ue, STEP_CLICKABLE_CLASSES as Me, STEP_LABEL_SIZES as Ze, STEP_LABEL_BASE as ze, STEP_DESCRIPTION_CLASSES as Ke, ERROR_ICON_VIEWBOX as Xe, ERROR_ICON_SIZE as K, CHECK_ICON_VIEWBOX as Ye, CHECK_ICON_SIZE as X, CHECK_ICON_POINTS as je } from "./Stepper.const.js";
|
|
10
|
+
import { resolveStepStatus as Y, resolveIndicatorContent as $e } from "./Stepper.utils.js";
|
|
11
|
+
const ke = 1200, Ge = 16, qe = 640, j = 3, Je = () => /* @__PURE__ */ t("svg", { width: X, height: X, viewBox: Ye, fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ t("polyline", { points: je }) }), Qe = () => /* @__PURE__ */ i("svg", { width: K, height: K, viewBox: Xe, 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
|
+
] }), xe = le(
|
|
15
15
|
({
|
|
16
16
|
steps: o,
|
|
17
|
-
activeStep:
|
|
18
|
-
onStepClick:
|
|
19
|
-
orientation:
|
|
20
|
-
size:
|
|
21
|
-
showNumbers:
|
|
22
|
-
clickable:
|
|
23
|
-
showConnectors:
|
|
24
|
-
connectorStyle:
|
|
25
|
-
alternativeLabel:
|
|
26
|
-
completedIcon:
|
|
27
|
-
errorIcon:
|
|
28
|
-
labelTypographyProps:
|
|
29
|
-
descriptionTypographyProps:
|
|
30
|
-
maxVisibleSteps:
|
|
31
|
-
testId:
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
const
|
|
17
|
+
activeStep: d,
|
|
18
|
+
onStepClick: _,
|
|
19
|
+
orientation: $ = Ce,
|
|
20
|
+
size: R = Ie,
|
|
21
|
+
showNumbers: k = Ae,
|
|
22
|
+
clickable: f = Le,
|
|
23
|
+
showConnectors: G = me,
|
|
24
|
+
connectorStyle: u = Re,
|
|
25
|
+
alternativeLabel: g = fe,
|
|
26
|
+
completedIcon: q,
|
|
27
|
+
errorIcon: J,
|
|
28
|
+
labelTypographyProps: Q,
|
|
29
|
+
descriptionTypographyProps: x,
|
|
30
|
+
maxVisibleSteps: C,
|
|
31
|
+
testId: ee,
|
|
32
|
+
className: re,
|
|
33
|
+
...ne
|
|
34
|
+
}, te) => {
|
|
35
|
+
const P = ae(), { direction: v } = ce(), [I, oe] = Ee(() => typeof window < "u" ? window.innerWidth : ke);
|
|
36
36
|
se(() => {
|
|
37
|
-
const e = () =>
|
|
37
|
+
const e = () => oe(window.innerWidth);
|
|
38
38
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
39
39
|
}, []);
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
return de(
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
}, [
|
|
46
|
-
if (!
|
|
40
|
+
const T = U(() => {
|
|
41
|
+
if (C != null)
|
|
42
|
+
return de(C, { width: I, theme: P });
|
|
43
|
+
if (I < qe && o.length > j)
|
|
44
|
+
return j;
|
|
45
|
+
}, [C, I, P, o.length]), c = $ === "horizontal", B = Ve[R], w = Ze[R], h = c && T != null && o.length > T, { visibleIndices: b, leftHidden: p, rightHidden: A } = U(() => {
|
|
46
|
+
if (!h || T == null)
|
|
47
47
|
return {
|
|
48
|
-
visibleIndices: o.map((
|
|
48
|
+
visibleIndices: o.map((a, L) => L),
|
|
49
49
|
leftHidden: [],
|
|
50
50
|
rightHidden: []
|
|
51
51
|
};
|
|
52
|
-
const e =
|
|
53
|
-
for (let
|
|
54
|
-
for (let
|
|
55
|
-
return { visibleIndices: l, leftHidden:
|
|
56
|
-
}, [
|
|
57
|
-
const l =
|
|
52
|
+
const e = T, r = Math.floor(e / 2), n = Math.max(0, Math.min(d - r, o.length - e)), l = Array.from({ length: e }, (a, L) => n + L), s = [], y = [];
|
|
53
|
+
for (let a = 0; a < n; a++) s.push(a);
|
|
54
|
+
for (let a = n + e; a < o.length; a++) y.push(a);
|
|
55
|
+
return { visibleIndices: l, leftHidden: s, rightHidden: y };
|
|
56
|
+
}, [h, T, o, d]), H = (e, r, n) => {
|
|
57
|
+
const l = m[n], s = $e(
|
|
58
58
|
e,
|
|
59
59
|
r,
|
|
60
60
|
n,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ t(
|
|
65
|
-
/* @__PURE__ */ t(
|
|
61
|
+
k,
|
|
62
|
+
q,
|
|
63
|
+
J,
|
|
64
|
+
/* @__PURE__ */ t(Je, {}),
|
|
65
|
+
/* @__PURE__ */ t(Qe, {})
|
|
66
66
|
);
|
|
67
67
|
return /* @__PURE__ */ t(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
|
-
className:
|
|
70
|
+
className: E(
|
|
71
71
|
z,
|
|
72
|
-
|
|
72
|
+
B,
|
|
73
73
|
l.indicator,
|
|
74
|
-
|
|
74
|
+
f && !e.disabled && Me
|
|
75
75
|
),
|
|
76
76
|
onClick: () => {
|
|
77
|
-
|
|
77
|
+
f && !e.disabled && _ && _(r);
|
|
78
78
|
},
|
|
79
|
-
children:
|
|
79
|
+
children: s
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
|
-
},
|
|
83
|
-
if (
|
|
84
|
-
const n = e <
|
|
85
|
-
return
|
|
82
|
+
}, N = (e, r) => {
|
|
83
|
+
if (!G || r) return null;
|
|
84
|
+
const n = e < d;
|
|
85
|
+
return c ? /* @__PURE__ */ t(
|
|
86
86
|
"div",
|
|
87
87
|
{
|
|
88
|
-
className:
|
|
89
|
-
|
|
90
|
-
"h-0.5 min-w-[12px] transition-colors",
|
|
88
|
+
className: E(
|
|
89
|
+
we,
|
|
91
90
|
n ? S.completed : S.pending,
|
|
92
|
-
|
|
91
|
+
u === "dashed" && Z
|
|
93
92
|
)
|
|
94
93
|
}
|
|
95
94
|
) : /* @__PURE__ */ t(
|
|
96
95
|
"div",
|
|
97
96
|
{
|
|
98
|
-
className:
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
className: E(
|
|
98
|
+
pe,
|
|
99
|
+
be,
|
|
101
100
|
n ? S.completed : S.pending,
|
|
102
|
-
|
|
101
|
+
u === "dashed" && Z
|
|
103
102
|
)
|
|
104
103
|
}
|
|
105
104
|
);
|
|
106
|
-
},
|
|
107
|
-
const n =
|
|
108
|
-
return /* @__PURE__ */ i(
|
|
105
|
+
}, W = (e, r) => {
|
|
106
|
+
const n = m[r], l = { ...Q, ...e.labelTypographyProps }, s = { ...x, ...e.descriptionTypographyProps };
|
|
107
|
+
return /* @__PURE__ */ i(O, { children: [
|
|
109
108
|
/* @__PURE__ */ t(
|
|
110
109
|
M,
|
|
111
110
|
{
|
|
112
111
|
variant: "body2",
|
|
113
112
|
...l,
|
|
114
|
-
className:
|
|
113
|
+
className: E(ze, w.label, n.label, l == null ? void 0 : l.className),
|
|
115
114
|
children: e.label
|
|
116
115
|
}
|
|
117
116
|
),
|
|
@@ -119,29 +118,38 @@ const Fe = 1200, De = 16, Ue = 640, x = 3, Ve = () => /* @__PURE__ */ t("svg", {
|
|
|
119
118
|
M,
|
|
120
119
|
{
|
|
121
120
|
variant: "caption",
|
|
122
|
-
...
|
|
123
|
-
className:
|
|
121
|
+
...s,
|
|
122
|
+
className: E(Ke, w.description, s == null ? void 0 : s.className),
|
|
124
123
|
children: e.description
|
|
125
124
|
}
|
|
126
125
|
)
|
|
127
126
|
] });
|
|
128
|
-
},
|
|
129
|
-
const n =
|
|
130
|
-
return /* @__PURE__ */ i(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
127
|
+
}, D = (e, r) => {
|
|
128
|
+
const n = Y(e, r, d);
|
|
129
|
+
return /* @__PURE__ */ i(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: E(
|
|
133
|
+
Be,
|
|
134
|
+
g ? Pe : ve
|
|
135
|
+
),
|
|
136
|
+
children: [
|
|
137
|
+
H(e, r, n),
|
|
138
|
+
/* @__PURE__ */ t("div", { className: E(g ? ue : ge), children: W(e, n) })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}, ie = (e, r) => {
|
|
143
|
+
const n = Y(e, r, d);
|
|
144
|
+
return /* @__PURE__ */ i(O, { children: [
|
|
145
|
+
/* @__PURE__ */ t("div", { className: ye, children: H(e, r, n) }),
|
|
146
|
+
/* @__PURE__ */ i("div", { className: Fe, children: [
|
|
147
|
+
W(e, n),
|
|
148
|
+
e.content && n === "active" && /* @__PURE__ */ t("div", { className: Ue, children: e.content })
|
|
141
149
|
] })
|
|
142
150
|
] });
|
|
143
|
-
},
|
|
144
|
-
|
|
151
|
+
}, V = (e, r) => /* @__PURE__ */ t("div", { className: He, children: /* @__PURE__ */ t(
|
|
152
|
+
_e,
|
|
145
153
|
{
|
|
146
154
|
placement: "bottom-start",
|
|
147
155
|
closeOnSelect: !0,
|
|
@@ -149,14 +157,14 @@ const Fe = 1200, De = 16, Ue = 640, x = 3, Ve = () => /* @__PURE__ */ t("svg", {
|
|
|
149
157
|
"button",
|
|
150
158
|
{
|
|
151
159
|
type: "button",
|
|
152
|
-
className:
|
|
160
|
+
className: E(
|
|
153
161
|
z,
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
B,
|
|
163
|
+
m.pending.indicator,
|
|
156
164
|
"bear-cursor-pointer bear-border-0"
|
|
157
165
|
),
|
|
158
|
-
"aria-label": r === "left" ?
|
|
159
|
-
children: /* @__PURE__ */ t(
|
|
166
|
+
"aria-label": r === "left" ? We : De,
|
|
167
|
+
children: /* @__PURE__ */ t(Te.MoreHorizIcon, { size: Ge })
|
|
160
168
|
}
|
|
161
169
|
),
|
|
162
170
|
items: e.map((n) => ({
|
|
@@ -164,7 +172,7 @@ const Fe = 1200, De = 16, Ue = 640, x = 3, Ve = () => /* @__PURE__ */ t("svg", {
|
|
|
164
172
|
label: o[n].label,
|
|
165
173
|
disabled: o[n].disabled,
|
|
166
174
|
onClick: () => {
|
|
167
|
-
o[n].disabled ||
|
|
175
|
+
o[n].disabled || _ == null || _(n);
|
|
168
176
|
}
|
|
169
177
|
}))
|
|
170
178
|
}
|
|
@@ -172,45 +180,45 @@ const Fe = 1200, De = 16, Ue = 640, x = 3, Ve = () => /* @__PURE__ */ t("svg", {
|
|
|
172
180
|
return /* @__PURE__ */ i(
|
|
173
181
|
"div",
|
|
174
182
|
{
|
|
175
|
-
ref:
|
|
183
|
+
ref: te,
|
|
176
184
|
dir: v,
|
|
177
|
-
className:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
v === "rtl" &&
|
|
181
|
-
|
|
185
|
+
className: E(
|
|
186
|
+
Se,
|
|
187
|
+
c ? Ne : Oe,
|
|
188
|
+
v === "rtl" && c && "bear-flex-row-reverse",
|
|
189
|
+
re
|
|
182
190
|
),
|
|
183
|
-
"data-testid":
|
|
184
|
-
...
|
|
191
|
+
"data-testid": ee,
|
|
192
|
+
...ne,
|
|
185
193
|
children: [
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
194
|
+
c && !h && o.map((e, r) => /* @__PURE__ */ i(F.Fragment, { children: [
|
|
195
|
+
D(e, r),
|
|
196
|
+
N(r, r === o.length - 1)
|
|
189
197
|
] }, r)),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
c && h && /* @__PURE__ */ i(O, { children: [
|
|
199
|
+
p.length > 0 && /* @__PURE__ */ i(O, { children: [
|
|
200
|
+
V(p, "left"),
|
|
201
|
+
N(-1, !1)
|
|
194
202
|
] }),
|
|
195
|
-
|
|
196
|
-
const n = o[e], l = r ===
|
|
197
|
-
return /* @__PURE__ */ i(
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
b.map((e, r) => {
|
|
204
|
+
const n = o[e], l = r === b.length - 1 && A.length === 0;
|
|
205
|
+
return /* @__PURE__ */ i(F.Fragment, { children: [
|
|
206
|
+
D(n, e),
|
|
207
|
+
N(e, l)
|
|
200
208
|
] }, e);
|
|
201
209
|
}),
|
|
202
|
-
|
|
210
|
+
A.length > 0 && V(A, "right")
|
|
203
211
|
] }),
|
|
204
|
-
!
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
!c && o.map((e, r) => /* @__PURE__ */ i("div", { className: E("Bear-Stepper__step", he), children: [
|
|
213
|
+
ie(e, r),
|
|
214
|
+
N(r, r === o.length - 1)
|
|
207
215
|
] }, r))
|
|
208
216
|
]
|
|
209
217
|
}
|
|
210
218
|
);
|
|
211
219
|
}
|
|
212
220
|
);
|
|
213
|
-
|
|
221
|
+
xe.displayName = "Stepper";
|
|
214
222
|
export {
|
|
215
|
-
|
|
223
|
+
xe as Stepper
|
|
216
224
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),x=require("./Toast.const.cjs"),I=require("../../utils/cn.cjs"),R=require("../../utils/generateBearId.utils.cjs"),A=require("../../utils/liveRegion.utils.cjs"),P={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},L=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),M=x.TOAST_SEVERITY_MODIFIER,N=x.TOAST_POSITION_CLASSES,y=s.createContext(null),B=()=>{const l=s.useContext(y);if(!l)throw new Error("useToast must be used within a ToastProvider");return l},q=({id:l,testId:b,message:h,title:u,severity:a="info",duration:i=5e3,closable:n=!0,icon:o,action:f,onClose:c,onRemove:T,className:j,autoScroll:v=!1,pauseOnHover:_=!1})=>{const[m,t]=s.useState(!1),[r,d]=s.useState(!1),S=s.useRef(null),g=s.useRef(i),k=s.useRef(0);s.useEffect(()=>{v&&S.current&&S.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[v]),s.useEffect(()=>{if(i<=0||r)return;k.current=Date.now();const O=setTimeout(()=>{t(!0),setTimeout(()=>{T(),c==null||c()},x.TOAST_EXIT_MS)},g.current);return()=>{clearTimeout(O),g.current=Math.max(0,g.current-(Date.now()-k.current))}},[i,r,T,c]);const E=()=>{t(!0),setTimeout(()=>{T(),c==null||c()},x.TOAST_EXIT_MS)},w=()=>o===!1?null:o||P[a],p=A.getBearLiveRegionProps(a);return e.jsxs("div",{ref:S,id:l,"data-testid":b,...p,"aria-atomic":"true",onMouseEnter:_?()=>d(!0):void 0,onMouseLeave:_?()=>d(!1):void 0,className:I.cn(x.T_O_A_S_T_ROOT_CLASS,x.TOAST_ITEM_CLASSES,m?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",M[a],j),children:[w()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:w()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[u&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:u}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:h})]}),f&&e.jsx("div",{className:"bear-flex-shrink-0",children:f}),n&&e.jsx("button",{type:"button",onClick:E,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-black/10 dark:hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(L,{})})]})},C=({position:l="top-right",maxToasts:b=5,className:h})=>{const u=s.useContext(y);if(!u)return null;const{_toasts:a,_removeToast:i}=u,n=a.slice(0,b);return e.jsx("div",{className:I.cn(`${x.T_O_A_S_T_ROOT_CLASS}__container`,"bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",N[l],h),"aria-relevant":"additions",children:n.map(o=>e.jsx(q,{...o,onRemove:()=>i(o.id)},o.id))})},V=({children:l,position:b="top-right",maxToasts:h})=>{const[u,a]=s.useState([]),i=s.useCallback(t=>{a(r=>r.filter(d=>d.id!==t))},[]),n=s.useCallback(t=>{const r=t.id||R.generateBearId("Toast");return a(d=>[...d,{...t,id:r}]),r},[]),o=s.useCallback(t=>n(t),[n]),f=s.useCallback((t,r)=>n({message:t,severity:"success",...r}),[n]),c=s.useCallback((t,r)=>n({message:t,severity:"info",...r}),[n]),T=s.useCallback((t,r)=>n({message:t,severity:"warning",...r}),[n]),j=s.useCallback((t,r)=>n({message:t,severity:"error",...r}),[n]),v=s.useCallback(t=>i(t),[i]),_=s.useCallback(()=>a([]),[]),m={toast:o,success:f,info:c,warning:T,error:j,dismiss:v,dismissAll:_,_toasts:u,_removeToast:i};return e.jsxs(y.Provider,{value:m,children:[l,e.jsx(C,{position:b,maxToasts:h})]})};exports.ToastContainer=C;exports.ToastProvider=V;exports.useToast=B;
|
|
@@ -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("../../utils/liveRegion.const.cjs"),e="Bear-Toast";r.BEAR_ARIA_LIVE_BY_SEVERITY.success,r.BEAR_ARIA_LIVE_BY_SEVERITY.info,r.BEAR_ARIA_LIVE_BY_SEVERITY.warning,r.BEAR_ARIA_LIVE_BY_SEVERITY.error;r.BEAR_ARIA_ROLE_BY_SEVERITY.success,r.BEAR_ARIA_ROLE_BY_SEVERITY.info,r.BEAR_ARIA_ROLE_BY_SEVERITY.warning,r.BEAR_ARIA_ROLE_BY_SEVERITY.error;const _=200,t={success:`${e}--success`,info:`${e}--info`,warning:`${e}--warning`,error:`${e}--error`},a={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},o="bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px] bear-transition-all bear-duration-200";exports.TOAST_EXIT_MS=_;exports.TOAST_ITEM_CLASSES=o;exports.TOAST_POSITION_CLASSES=a;exports.TOAST_SEVERITY_MODIFIER=t;exports.T_O_A_S_T_ROOT_CLASS=e;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { ToastSeverity } from './Toast.types';
|
|
1
|
+
import { ToastSeverity, ToastPosition } from './Toast.types';
|
|
2
2
|
export declare const T_O_A_S_T_ROOT_CLASS = "Bear-Toast";
|
|
3
3
|
export declare const TOAST_ARIA_LIVE: Record<ToastSeverity, 'polite' | 'assertive'>;
|
|
4
4
|
export declare const TOAST_ARIA_ROLE: Record<ToastSeverity, 'status' | 'alert'>;
|
|
5
5
|
export declare const TOAST_EXIT_MS = 200;
|
|
6
|
+
export declare const TOAST_SEVERITY_MODIFIER: Record<ToastSeverity, string>;
|
|
7
|
+
export declare const TOAST_POSITION_CLASSES: Record<ToastPosition, string>;
|
|
8
|
+
export declare const TOAST_ITEM_CLASSES = "bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px] bear-transition-all bear-duration-200";
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import { BEAR_ARIA_LIVE_BY_SEVERITY as r, BEAR_ARIA_ROLE_BY_SEVERITY as
|
|
2
|
-
const
|
|
1
|
+
import { BEAR_ARIA_LIVE_BY_SEVERITY as r, BEAR_ARIA_ROLE_BY_SEVERITY as e } from "../../utils/liveRegion.const.js";
|
|
2
|
+
const t = "Bear-Toast";
|
|
3
3
|
r.success, r.info, r.warning, r.error;
|
|
4
|
-
|
|
5
|
-
const o = 200
|
|
4
|
+
e.success, e.info, e.warning, e.error;
|
|
5
|
+
const o = 200, n = {
|
|
6
|
+
success: `${t}--success`,
|
|
7
|
+
info: `${t}--info`,
|
|
8
|
+
warning: `${t}--warning`,
|
|
9
|
+
error: `${t}--error`
|
|
10
|
+
}, b = {
|
|
11
|
+
"top-left": "bear-top-4 bear-left-4",
|
|
12
|
+
"top-center": "bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
|
|
13
|
+
"top-right": "bear-top-4 bear-right-4",
|
|
14
|
+
"bottom-left": "bear-bottom-4 bear-left-4",
|
|
15
|
+
"bottom-center": "bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
|
|
16
|
+
"bottom-right": "bear-bottom-4 bear-right-4"
|
|
17
|
+
}, s = "bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px] bear-transition-all bear-duration-200";
|
|
6
18
|
export {
|
|
7
19
|
o as TOAST_EXIT_MS,
|
|
8
|
-
|
|
20
|
+
s as TOAST_ITEM_CLASSES,
|
|
21
|
+
b as TOAST_POSITION_CLASSES,
|
|
22
|
+
n as TOAST_SEVERITY_MODIFIER,
|
|
23
|
+
t as T_O_A_S_T_ROOT_CLASS
|
|
9
24
|
};
|