@forgedevstack/bear 1.3.3 → 1.3.5
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 +100 -290
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.d.ts +1 -6
- package/dist/components/Alert/Alert.const.js +10 -30
- package/dist/components/Alert/Alert.js +49 -54
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +67 -84
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +72 -64
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +122 -112
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.js +37 -36
- package/dist/components/Chart/Chart.types.d.ts +2 -0
- package/dist/components/Chart/Chart.utils.cjs +1 -1
- package/dist/components/Chart/Chart.utils.d.ts +2 -0
- package/dist/components/Chart/Chart.utils.js +32 -31
- package/dist/components/Chart/FunnelChart.cjs +1 -1
- package/dist/components/Chart/FunnelChart.js +29 -28
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.js +45 -44
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.js +52 -51
- package/dist/components/Chart/RadarChart.cjs +1 -1
- package/dist/components/Chart/RadarChart.js +63 -62
- package/dist/components/Chart/index.d.ts +1 -1
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +2 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +6 -4
- package/dist/components/ChipGroup/ChipGroup.js +52 -48
- package/dist/components/CommandPalette/CommandItem.cjs +1 -0
- package/dist/components/CommandPalette/CommandItem.d.ts +6 -0
- package/dist/components/CommandPalette/CommandItem.js +39 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +129 -144
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +72 -66
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.d.ts +5 -0
- package/dist/components/EmptyState/EmptyState.const.js +30 -15
- package/dist/components/EmptyState/EmptyState.js +35 -35
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -2
- package/dist/components/HoverCard/HoverCard.cjs +4 -3
- package/dist/components/HoverCard/HoverCard.const.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.const.js +5 -0
- package/dist/components/HoverCard/HoverCard.js +62 -56
- package/dist/components/HoverCard/HoverCard.types.d.ts +7 -0
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.const.cjs +1 -0
- package/dist/components/Menu/Menu.const.d.ts +2 -0
- package/dist/components/Menu/Menu.const.js +7 -0
- package/dist/components/Menu/Menu.d.ts +3 -9
- package/dist/components/Menu/Menu.js +57 -89
- package/dist/components/Menu/Menu.types.d.ts +8 -1
- package/dist/components/Menu/MenuDivider.cjs +1 -0
- package/dist/components/Menu/MenuDivider.d.ts +6 -0
- package/dist/components/Menu/MenuDivider.js +7 -0
- package/dist/components/Menu/MenuItem.cjs +1 -0
- package/dist/components/Menu/MenuItem.d.ts +6 -0
- package/dist/components/Menu/MenuItem.js +46 -0
- 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 +1 -0
- package/dist/components/Modal/Modal.const.js +15 -12
- package/dist/components/Modal/Modal.js +62 -59
- package/dist/components/Modal/Modal.types.d.ts +7 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.cjs +1 -1
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.js +10 -9
- package/dist/components/OverlayPortal/OverlayPortal.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.d.ts +4 -0
- package/dist/components/OverlayPortal/OverlayPortal.const.js +21 -5
- package/dist/components/OverlayPortal/OverlayPortal.js +44 -38
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.const.cjs +1 -0
- package/dist/components/Popover/Popover.const.d.ts +15 -1
- package/dist/components/Popover/Popover.const.js +24 -0
- package/dist/components/Popover/Popover.js +77 -73
- package/dist/components/Popover/Popover.types.d.ts +7 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.cjs +1 -1
- package/dist/components/Select/Select.const.d.ts +1 -0
- package/dist/components/Select/Select.const.js +7 -6
- package/dist/components/Select/Select.js +101 -96
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +1 -1
- 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 +2 -0
- package/dist/components/Toast/Toast.const.js +11 -8
- package/dist/components/Toast/Toast.context.cjs +1 -0
- package/dist/components/Toast/Toast.context.d.ts +3 -0
- package/dist/components/Toast/Toast.context.js +11 -0
- package/dist/components/Toast/Toast.d.ts +4 -3
- package/dist/components/Toast/Toast.icons.cjs +1 -0
- package/dist/components/Toast/Toast.icons.d.ts +4 -0
- package/dist/components/Toast/Toast.icons.js +29 -0
- package/dist/components/Toast/Toast.js +32 -160
- package/dist/components/Toast/ToastContainer.cjs +1 -0
- package/dist/components/Toast/ToastContainer.d.ts +3 -0
- package/dist/components/Toast/ToastContainer.js +39 -0
- package/dist/components/Toast/ToastItem.cjs +1 -0
- package/dist/components/Toast/ToastItem.d.ts +5 -0
- package/dist/components/Toast/ToastItem.js +86 -0
- package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.d.ts +15 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.js +33 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.js +5 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +89 -0
- package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +48 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.js +50 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.cjs +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.d.ts +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.js +6 -0
- package/dist/components/ToggleGroup/index.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.const.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.const.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.const.js +13 -0
- package/dist/components/Tooltip/Tooltip.js +59 -61
- package/dist/components/Tooltip/Tooltip.types.d.ts +7 -0
- package/dist/components/Transition/Transition.cjs +1 -1
- package/dist/components/Transition/Transition.const.cjs +1 -1
- package/dist/components/Transition/Transition.const.js +26 -8
- package/dist/components/Transition/Transition.js +77 -74
- package/dist/components/Transition/Transition.types.d.ts +8 -2
- package/dist/components/Typography/Typography.const.cjs +1 -1
- package/dist/components/Typography/Typography.const.js +2 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +429 -419
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.js +85 -86
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +3 -0
- package/dist/constants/numbers.const.js +37 -34
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +6 -4
- package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +3 -0
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +17 -14
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
- package/dist/hooks/useFocusTrap/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.js +41 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.types.d.ts +8 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.d.ts +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.js +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +580 -568
- package/dist/styles/_alerts.css +85 -4
- package/dist/styles/_drawer.css +60 -0
- package/dist/styles/_effects.css +33 -0
- package/dist/styles.css +231 -4
- package/package.json +3 -5
|
@@ -1,72 +1,67 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { INFO as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Box as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { CloseIcon as
|
|
9
|
-
import { Typography as
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
1
|
+
import { jsxs as _, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S } from "react";
|
|
3
|
+
import { INFO as f, VARIANT_STANDARD as T, BOOLEAN_TRUE as n, BOOLEAN_FALSE as i, LABEL_CLOSE_ALERT as x, VARIANT_GHOST as R } from "../../constants/generals.const.js";
|
|
4
|
+
import { cn as g } from "../../utils/cn.js";
|
|
5
|
+
import { Box as o } from "../Box/Box.js";
|
|
6
|
+
import { Button as v } from "../Button/Button.js";
|
|
7
|
+
import { Flex as C } from "../Flex/Flex.js";
|
|
8
|
+
import { CloseIcon as O, InfoIcon as k, BearIcons as l } from "@forgedevstack/bear-icons";
|
|
9
|
+
import { Typography as b } from "../Typography/Typography.js";
|
|
10
|
+
import { ALERT_VARIANT_CLASSES as V, ALERT_SEVERITY_CLASS as y } from "./Alert.const.js";
|
|
11
|
+
const J = (d) => {
|
|
12
12
|
const {
|
|
13
|
-
severity: e =
|
|
14
|
-
variant:
|
|
15
|
-
title:
|
|
16
|
-
icon:
|
|
17
|
-
action:
|
|
18
|
-
closable:
|
|
19
|
-
onClose:
|
|
20
|
-
children:
|
|
21
|
-
className:
|
|
22
|
-
testId:
|
|
23
|
-
...
|
|
24
|
-
} =
|
|
25
|
-
if (!
|
|
13
|
+
severity: e = f,
|
|
14
|
+
variant: p = T,
|
|
15
|
+
title: s,
|
|
16
|
+
icon: t = n,
|
|
17
|
+
action: c,
|
|
18
|
+
closable: h = i,
|
|
19
|
+
onClose: a,
|
|
20
|
+
children: m,
|
|
21
|
+
className: I,
|
|
22
|
+
testId: u,
|
|
23
|
+
...N
|
|
24
|
+
} = d, [B, E] = S(n);
|
|
25
|
+
if (!B)
|
|
26
26
|
return null;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
|
|
27
|
+
const L = () => {
|
|
28
|
+
E(i), a == null || a();
|
|
29
|
+
}, A = t === i ? null : t !== n ? t : e === f ? /* @__PURE__ */ r(k, {}) : e === "success" ? /* @__PURE__ */ r(l.CheckCircleIcon, {}) : e === "warning" ? /* @__PURE__ */ r(l.WarningIcon, {}) : /* @__PURE__ */ r(l.ErrorIcon, {});
|
|
30
|
+
return /* @__PURE__ */ _(
|
|
31
|
+
C,
|
|
32
32
|
{
|
|
33
33
|
role: "alert",
|
|
34
34
|
"aria-live": "polite",
|
|
35
|
-
className:
|
|
35
|
+
className: g(
|
|
36
36
|
"Bear-Alert bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg",
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
y[e],
|
|
38
|
+
V[p](e),
|
|
39
|
+
I
|
|
39
40
|
),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
borderColor: t === g ? o.border : void 0,
|
|
43
|
-
color: l ? void 0 : o.text
|
|
44
|
-
},
|
|
45
|
-
"data-testid": h,
|
|
46
|
-
...L,
|
|
41
|
+
"data-testid": u,
|
|
42
|
+
...N,
|
|
47
43
|
children: [
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
A && /* @__PURE__ */ r(
|
|
45
|
+
o,
|
|
50
46
|
{
|
|
51
47
|
as: "span",
|
|
52
48
|
className: "Bear-Alert__icon bear-flex-shrink-0 bear-mt-0.5",
|
|
53
|
-
|
|
54
|
-
children: b
|
|
49
|
+
children: A
|
|
55
50
|
}
|
|
56
51
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
/* @__PURE__ */ _(o, { className: "Bear-Alert__content bear-flex-1 bear-min-w-0", children: [
|
|
53
|
+
s && /* @__PURE__ */ r(b, { variant: "subtitle2", weight: "semibold", color: "inherit", className: "Bear-Alert__title bear-mb-1", children: s }),
|
|
54
|
+
m && /* @__PURE__ */ r(b, { variant: "body2", color: "inherit", className: "Bear-Alert__message", children: m })
|
|
60
55
|
] }),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
c && /* @__PURE__ */ r(o, { className: "Bear-Alert__action bear-flex-shrink-0", children: c }),
|
|
57
|
+
h && /* @__PURE__ */ r(
|
|
58
|
+
v,
|
|
64
59
|
{
|
|
65
|
-
variant:
|
|
66
|
-
onClick:
|
|
60
|
+
variant: R,
|
|
61
|
+
onClick: L,
|
|
67
62
|
className: "Bear-Alert__close bear-flex-shrink-0 bear-p-1",
|
|
68
|
-
"aria-label":
|
|
69
|
-
children: /* @__PURE__ */ r(
|
|
63
|
+
"aria-label": x,
|
|
64
|
+
children: /* @__PURE__ */ r(O, {})
|
|
70
65
|
}
|
|
71
66
|
)
|
|
72
67
|
]
|
|
@@ -74,5 +69,5 @@ const Q = (N) => {
|
|
|
74
69
|
);
|
|
75
70
|
};
|
|
76
71
|
export {
|
|
77
|
-
|
|
72
|
+
J as Alert
|
|
78
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),j=require("react-dom"),r=require("../../constants/generals.const.cjs"),s=require("../../utils/cn.cjs"),D=require("../../hooks/useFocusTrap/useFocusTrap.cjs"),g=require("../Button/Button.cjs"),m=require("../Typography/Typography.cjs"),L=x=>{const{isOpen:a,onClose:n,onConfirm:f,title:_,description:o,confirmText:y=r.LABEL_CONFIRM,cancelText:p=r.LABEL_CANCEL,confirmVariant:A=r.VARIANT_DANGER,loading:t=r.BOOLEAN_FALSE,loadingText:E,closeOnBackdrop:h=r.BOOLEAN_FALSE,closeOnEscape:v=r.BOOLEAN_TRUE,icon:i,className:B,testId:N}=x,c=l.useId(),d=`${r.ALERT_TITLE_ID_PREFIX}${c}`,b=`${r.ALERT_DESC_ID_PREFIX}${c}`,u=l.useRef(null);if(D.useFocusTrap(u,{enabled:a,onEscape:v&&!t?n:void 0}),l.useEffect(()=>(a&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[a]),!a)return null;const T=e.jsxs("div",{className:"Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4","data-testid":N,children:[e.jsx("div",{className:"Bear-AlertDialog__backdrop bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in",onClick:h&&!t?n:void 0,"aria-hidden":"true"}),e.jsxs("div",{ref:u,role:"alertdialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":o?b:void 0,tabIndex:-1,className:s.cn("Bear-AlertDialog__container bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in bear-p-6",B),children:[i&&e.jsx("div",{className:"Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center",children:i}),e.jsx(m.Typography,{variant:"h6",id:d,className:s.cn("Bear-AlertDialog__title bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white",i&&"bear-text-center"),children:_}),o&&e.jsx(m.Typography,{variant:"body2",id:b,className:s.cn("Bear-AlertDialog__description bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2",i&&"bear-text-center"),children:o}),e.jsxs("div",{className:"Bear-AlertDialog__footer bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6",children:[e.jsx(g.Button,{variant:"ghost",onClick:n,disabled:t,children:p}),e.jsx(g.Button,{variant:A,onClick:f,loading:t,loadingText:E,children:y})]})]})]});return j.createPortal(T,document.body)};exports.AlertDialog=L;
|
|
@@ -1,118 +1,101 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const ae = (B) => {
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useId as I, useRef as k, useEffect as L } from "react";
|
|
3
|
+
import { createPortal as T } from "react-dom";
|
|
4
|
+
import { LABEL_CONFIRM as C, LABEL_CANCEL as R, VARIANT_DANGER as O, BOOLEAN_FALSE as m, BOOLEAN_TRUE as w, ALERT_DESC_ID_PREFIX as j, ALERT_TITLE_ID_PREFIX as F } from "../../constants/generals.const.js";
|
|
5
|
+
import { cn as n } from "../../utils/cn.js";
|
|
6
|
+
import { useFocusTrap as $ } from "../../hooks/useFocusTrap/useFocusTrap.js";
|
|
7
|
+
import { Button as f } from "../Button/Button.js";
|
|
8
|
+
import { Typography as g } from "../Typography/Typography.js";
|
|
9
|
+
const q = (p) => {
|
|
11
10
|
const {
|
|
12
|
-
isOpen:
|
|
13
|
-
onClose:
|
|
14
|
-
onConfirm:
|
|
15
|
-
title:
|
|
16
|
-
description:
|
|
17
|
-
confirmText:
|
|
18
|
-
cancelText:
|
|
19
|
-
confirmVariant:
|
|
20
|
-
loading:
|
|
21
|
-
loadingText:
|
|
22
|
-
closeOnBackdrop:
|
|
23
|
-
closeOnEscape:
|
|
24
|
-
icon:
|
|
25
|
-
className:
|
|
26
|
-
testId:
|
|
27
|
-
} =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return;
|
|
35
|
-
const i = n.current.querySelectorAll(
|
|
36
|
-
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
37
|
-
);
|
|
38
|
-
if (i.length === A)
|
|
39
|
-
return;
|
|
40
|
-
const y = i[A], x = i[i.length - 1];
|
|
41
|
-
e.shiftKey && document.activeElement === y ? (e.preventDefault(), x.focus()) : !e.shiftKey && document.activeElement === x && (e.preventDefault(), y.focus());
|
|
42
|
-
}, []);
|
|
43
|
-
if (P(() => (l && (g.current = document.activeElement, document.addEventListener("keydown", c), document.addEventListener("keydown", s), document.body.style.overflow = "hidden", requestAnimationFrame(() => {
|
|
44
|
-
var e;
|
|
45
|
-
return (e = n.current) == null ? void 0 : e.focus();
|
|
46
|
-
})), () => {
|
|
47
|
-
var e;
|
|
48
|
-
document.removeEventListener("keydown", c), document.removeEventListener("keydown", s), document.body.style.overflow = "", (e = g.current) == null || e.focus();
|
|
49
|
-
}), [l, c, s]), !l)
|
|
11
|
+
isOpen: r,
|
|
12
|
+
onClose: i,
|
|
13
|
+
onConfirm: u,
|
|
14
|
+
title: _,
|
|
15
|
+
description: o,
|
|
16
|
+
confirmText: x = C,
|
|
17
|
+
cancelText: A = R,
|
|
18
|
+
confirmVariant: y = O,
|
|
19
|
+
loading: a = m,
|
|
20
|
+
loadingText: E,
|
|
21
|
+
closeOnBackdrop: h = m,
|
|
22
|
+
closeOnEscape: v = w,
|
|
23
|
+
icon: t,
|
|
24
|
+
className: N,
|
|
25
|
+
testId: B
|
|
26
|
+
} = p, d = I(), b = `${F}${d}`, s = `${j}${d}`, c = k(null);
|
|
27
|
+
if ($(c, {
|
|
28
|
+
enabled: r,
|
|
29
|
+
onEscape: v && !a ? i : void 0
|
|
30
|
+
}), L(() => (r && (document.body.style.overflow = "hidden"), () => {
|
|
31
|
+
document.body.style.overflow = "";
|
|
32
|
+
}), [r]), !r)
|
|
50
33
|
return null;
|
|
51
|
-
const
|
|
34
|
+
const D = /* @__PURE__ */ l(
|
|
52
35
|
"div",
|
|
53
36
|
{
|
|
54
37
|
className: "Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
55
|
-
"data-testid":
|
|
38
|
+
"data-testid": B,
|
|
56
39
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ e(
|
|
58
41
|
"div",
|
|
59
42
|
{
|
|
60
43
|
className: "Bear-AlertDialog__backdrop bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in",
|
|
61
|
-
onClick:
|
|
44
|
+
onClick: h && !a ? i : void 0,
|
|
62
45
|
"aria-hidden": "true"
|
|
63
46
|
}
|
|
64
47
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ l(
|
|
66
49
|
"div",
|
|
67
50
|
{
|
|
68
|
-
ref:
|
|
51
|
+
ref: c,
|
|
69
52
|
role: "alertdialog",
|
|
70
53
|
"aria-modal": "true",
|
|
71
|
-
"aria-labelledby":
|
|
72
|
-
"aria-describedby":
|
|
54
|
+
"aria-labelledby": b,
|
|
55
|
+
"aria-describedby": o ? s : void 0,
|
|
73
56
|
tabIndex: -1,
|
|
74
|
-
className:
|
|
57
|
+
className: n(
|
|
75
58
|
"Bear-AlertDialog__container bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in bear-p-6",
|
|
76
|
-
|
|
59
|
+
N
|
|
77
60
|
),
|
|
78
61
|
children: [
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
62
|
+
t && /* @__PURE__ */ e("div", { className: "Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center", children: t }),
|
|
63
|
+
/* @__PURE__ */ e(
|
|
64
|
+
g,
|
|
82
65
|
{
|
|
83
66
|
variant: "h6",
|
|
84
|
-
id:
|
|
85
|
-
className:
|
|
86
|
-
children:
|
|
67
|
+
id: b,
|
|
68
|
+
className: n("Bear-AlertDialog__title bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white", t && "bear-text-center"),
|
|
69
|
+
children: _
|
|
87
70
|
}
|
|
88
71
|
),
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
o && /* @__PURE__ */ e(
|
|
73
|
+
g,
|
|
91
74
|
{
|
|
92
75
|
variant: "body2",
|
|
93
|
-
id:
|
|
94
|
-
className:
|
|
95
|
-
children:
|
|
76
|
+
id: s,
|
|
77
|
+
className: n("Bear-AlertDialog__description bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2", t && "bear-text-center"),
|
|
78
|
+
children: o
|
|
96
79
|
}
|
|
97
80
|
),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
81
|
+
/* @__PURE__ */ l("div", { className: "Bear-AlertDialog__footer bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6", children: [
|
|
82
|
+
/* @__PURE__ */ e(
|
|
83
|
+
f,
|
|
101
84
|
{
|
|
102
85
|
variant: "ghost",
|
|
103
|
-
onClick:
|
|
104
|
-
disabled:
|
|
105
|
-
children:
|
|
86
|
+
onClick: i,
|
|
87
|
+
disabled: a,
|
|
88
|
+
children: A
|
|
106
89
|
}
|
|
107
90
|
),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
91
|
+
/* @__PURE__ */ e(
|
|
92
|
+
f,
|
|
110
93
|
{
|
|
111
|
-
variant:
|
|
112
|
-
onClick:
|
|
113
|
-
loading:
|
|
114
|
-
loadingText:
|
|
115
|
-
children:
|
|
94
|
+
variant: y,
|
|
95
|
+
onClick: u,
|
|
96
|
+
loading: a,
|
|
97
|
+
loadingText: E,
|
|
98
|
+
children: x
|
|
116
99
|
}
|
|
117
100
|
)
|
|
118
101
|
] })
|
|
@@ -122,8 +105,8 @@ const ae = (B) => {
|
|
|
122
105
|
]
|
|
123
106
|
}
|
|
124
107
|
);
|
|
125
|
-
return
|
|
108
|
+
return T(D, document.body);
|
|
126
109
|
};
|
|
127
110
|
export {
|
|
128
|
-
|
|
111
|
+
q as AlertDialog
|
|
129
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),R=require("react-dom"),g=require("../../hooks/useFocusTrap/useFocusTrap.cjs"),m=require("../../constants/numbers.const.cjs"),e=require("../../constants/generals.const.cjs"),F=require("../../constants/keys.const.cjs"),l=require("../../utils/cn.cjs"),b=require("../Box/Box.cjs"),j=require("../Button/Button.cjs"),O=require("../Flex/Flex.cjs"),q=require("@forgedevstack/bear-icons"),v=require("../Typography/Typography.cjs"),C=require("./BottomSheet.const.cjs"),U=_=>{const{isOpen:i,onClose:n,title:o,children:f,size:y=e.SIZE_MD,showCloseButton:h=e.BOOLEAN_TRUE,closeOnBackdrop:L=e.BOOLEAN_TRUE,closeOnEscape:c=e.BOOLEAN_TRUE,showHandle:N=e.BOOLEAN_TRUE,enableScroll:S=e.BOOLEAN_TRUE,isSticky:p=e.BOOLEAN_FALSE,className:T}=_,[a,x]=t.useState(i),[u,d]=t.useState(e.BOOLEAN_FALSE),[k,B]=t.useState(e.BOOLEAN_FALSE);t.useEffect(()=>{if(i){x(e.BOOLEAN_TRUE),d(e.BOOLEAN_FALSE);const s=requestAnimationFrame(()=>B(e.BOOLEAN_TRUE));return()=>cancelAnimationFrame(s)}if(a){B(e.BOOLEAN_FALSE),d(e.BOOLEAN_TRUE);const s=setTimeout(()=>{x(e.BOOLEAN_FALSE),d(e.BOOLEAN_FALSE)},m.THREE_HUNDRED);return()=>clearTimeout(s)}},[i,a]);const A=t.useRef(null);g.useFocusTrap(A,{enabled:a&&!u,onEscape:c?n:void 0});const E=t.useCallback(s=>{c&&s.key===F.KEY_ESCAPE&&n()},[c,n]);if(t.useEffect(()=>(a&&(document.addEventListener("keydown",E),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",E),document.body.style.overflow=""}),[a,E]),!a)return null;const w=r.jsxs(O.Flex,{className:"bear-fixed bear-inset-0 bear-items-end bear-justify-center",style:{zIndex:m.BACKDROP_DEFAULT_Z_INDEX},children:[r.jsx(b.Box,{className:l.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",u?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${m.THREE_HUNDRED}ms`},onClick:L?n:void 0,"aria-hidden":"true"}),r.jsxs(b.Box,{ref:A,role:"dialog",tabIndex:-1,"aria-modal":"true","aria-labelledby":o?"bottom-sheet-title":void 0,className:l.cn("Bear-BottomSheet bear-relative bear-w-full bear-rounded-t-2xl bear-shadow-2xl bear-transition-transform bear-duration-300","bear-flex bear-flex-col bear-min-h-0 bear-overflow-hidden","bear-bg-white dark:bear-bg-neutral-900 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700",C.BOTTOM_SHEET_SIZE_CLASSES[y],k&&!u?"bear-translate-y-0":"bear-translate-y-full",T),children:[N&&r.jsx(O.Flex,{className:"bear-justify-center bear-pt-2 bear-pb-1",children:r.jsx(b.Box,{className:"bear-w-12 bear-h-1 bear-rounded-full bear-bg-neutral-300 dark:bear-bg-neutral-600","aria-hidden":!0})}),(o||h)&&r.jsxs(O.Flex,{className:l.cn("bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0",p&&"bear-sticky bear-top-0 bear-z-10 bear-bg-white dark:bear-bg-neutral-900"),children:[o&&r.jsx(v.Typography,{id:"bottom-sheet-title",weight:"semibold",className:"bear-text-lg bear-text-neutral-900 dark:bear-text-white",children:o}),h&&r.jsx(j.Button,{variant:e.VARIANT_GHOST,onClick:n,"aria-label":e.LABEL_CLOSE,children:r.jsx(q.XIcon,{className:"bear-w-5 bear-h-5"})})]}),r.jsx(b.Box,{className:l.cn("bear-flex-1 bear-min-h-0 bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",S?"bear-overflow-y-auto":"bear-overflow-hidden"),children:f})]})]});return R.createPortal(w,document.body)};exports.BottomSheet=U;
|
|
@@ -1,99 +1,107 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useEffect as w, useRef as I, useCallback as D } from "react";
|
|
3
|
+
import { createPortal as R } from "react-dom";
|
|
4
|
+
import { useFocusTrap as F } from "../../hooks/useFocusTrap/useFocusTrap.js";
|
|
5
|
+
import { THREE_HUNDRED as N, BACKDROP_DEFAULT_Z_INDEX as H } from "../../constants/numbers.const.js";
|
|
6
|
+
import { SIZE_MD as j, BOOLEAN_TRUE as e, BOOLEAN_FALSE as a, LABEL_CLOSE as M, VARIANT_GHOST as z } from "../../constants/generals.const.js";
|
|
7
|
+
import { KEY_ESCAPE as P } from "../../constants/keys.const.js";
|
|
7
8
|
import { cn as i } from "../../utils/cn.js";
|
|
8
|
-
import { Box as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { Flex as
|
|
11
|
-
import { XIcon as
|
|
12
|
-
import { Typography as
|
|
13
|
-
import { BOTTOM_SHEET_SIZE_CLASSES as
|
|
14
|
-
const
|
|
9
|
+
import { Box as s } from "../Box/Box.js";
|
|
10
|
+
import { Button as U } from "../Button/Button.js";
|
|
11
|
+
import { Flex as h } from "../Flex/Flex.js";
|
|
12
|
+
import { XIcon as Z } from "@forgedevstack/bear-icons";
|
|
13
|
+
import { Typography as K } from "../Typography/Typography.js";
|
|
14
|
+
import { BOTTOM_SHEET_SIZE_CLASSES as X } from "./BottomSheet.const.js";
|
|
15
|
+
const be = (S) => {
|
|
15
16
|
const {
|
|
16
|
-
isOpen:
|
|
17
|
-
onClose:
|
|
17
|
+
isOpen: l,
|
|
18
|
+
onClose: o,
|
|
18
19
|
title: b,
|
|
19
|
-
children:
|
|
20
|
-
size:
|
|
21
|
-
showCloseButton:
|
|
22
|
-
closeOnBackdrop:
|
|
23
|
-
closeOnEscape:
|
|
20
|
+
children: O,
|
|
21
|
+
size: g = j,
|
|
22
|
+
showCloseButton: y = e,
|
|
23
|
+
closeOnBackdrop: v = e,
|
|
24
|
+
closeOnEscape: d = e,
|
|
24
25
|
showHandle: _ = e,
|
|
25
|
-
enableScroll:
|
|
26
|
-
isSticky:
|
|
27
|
-
className:
|
|
28
|
-
} =
|
|
26
|
+
enableScroll: A = e,
|
|
27
|
+
isSticky: B = a,
|
|
28
|
+
className: T
|
|
29
|
+
} = S, [t, E] = p(l), [m, c] = p(a), [C, k] = p(a);
|
|
29
30
|
w(() => {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
return () => cancelAnimationFrame(
|
|
31
|
+
if (l) {
|
|
32
|
+
E(e), c(a);
|
|
33
|
+
const n = requestAnimationFrame(() => k(e));
|
|
34
|
+
return () => cancelAnimationFrame(n);
|
|
34
35
|
}
|
|
35
36
|
if (t) {
|
|
36
|
-
k(a),
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
return () => clearTimeout(
|
|
37
|
+
k(a), c(e);
|
|
38
|
+
const n = setTimeout(() => {
|
|
39
|
+
E(a), c(a);
|
|
40
|
+
}, N);
|
|
41
|
+
return () => clearTimeout(n);
|
|
41
42
|
}
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}, [l, t]);
|
|
44
|
+
const x = I(null);
|
|
45
|
+
F(x, {
|
|
46
|
+
enabled: t && !m,
|
|
47
|
+
onEscape: d ? o : void 0
|
|
48
|
+
});
|
|
49
|
+
const u = D(
|
|
50
|
+
(n) => {
|
|
51
|
+
d && n.key === P && o();
|
|
46
52
|
},
|
|
47
|
-
[
|
|
53
|
+
[d, o]
|
|
48
54
|
);
|
|
49
|
-
if (w(() => (t && (document.addEventListener("keydown",
|
|
50
|
-
document.removeEventListener("keydown",
|
|
51
|
-
}), [t,
|
|
55
|
+
if (w(() => (t && (document.addEventListener("keydown", u), document.body.style.overflow = "hidden"), () => {
|
|
56
|
+
document.removeEventListener("keydown", u), document.body.style.overflow = "";
|
|
57
|
+
}), [t, u]), !t)
|
|
52
58
|
return null;
|
|
53
|
-
const
|
|
54
|
-
|
|
59
|
+
const L = /* @__PURE__ */ f(
|
|
60
|
+
h,
|
|
55
61
|
{
|
|
56
62
|
className: "bear-fixed bear-inset-0 bear-items-end bear-justify-center",
|
|
57
|
-
style: { zIndex:
|
|
63
|
+
style: { zIndex: H },
|
|
58
64
|
children: [
|
|
59
65
|
/* @__PURE__ */ r(
|
|
60
|
-
|
|
66
|
+
s,
|
|
61
67
|
{
|
|
62
68
|
className: i(
|
|
63
69
|
"bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",
|
|
64
|
-
|
|
70
|
+
m ? "bear-opacity-0" : "bear-opacity-100"
|
|
65
71
|
),
|
|
66
|
-
style: { transitionDuration: `${
|
|
67
|
-
onClick:
|
|
72
|
+
style: { transitionDuration: `${N}ms` },
|
|
73
|
+
onClick: v ? o : void 0,
|
|
68
74
|
"aria-hidden": "true"
|
|
69
75
|
}
|
|
70
76
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
77
|
+
/* @__PURE__ */ f(
|
|
78
|
+
s,
|
|
73
79
|
{
|
|
80
|
+
ref: x,
|
|
74
81
|
role: "dialog",
|
|
82
|
+
tabIndex: -1,
|
|
75
83
|
"aria-modal": "true",
|
|
76
84
|
"aria-labelledby": b ? "bottom-sheet-title" : void 0,
|
|
77
85
|
className: i(
|
|
78
86
|
"Bear-BottomSheet bear-relative bear-w-full bear-rounded-t-2xl bear-shadow-2xl bear-transition-transform bear-duration-300",
|
|
79
87
|
"bear-flex bear-flex-col bear-min-h-0 bear-overflow-hidden",
|
|
80
88
|
"bear-bg-white dark:bear-bg-neutral-900 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700",
|
|
81
|
-
|
|
82
|
-
C && !
|
|
83
|
-
|
|
89
|
+
X[g],
|
|
90
|
+
C && !m ? "bear-translate-y-0" : "bear-translate-y-full",
|
|
91
|
+
T
|
|
84
92
|
),
|
|
85
93
|
children: [
|
|
86
|
-
_ && /* @__PURE__ */ r(
|
|
87
|
-
(b ||
|
|
88
|
-
|
|
94
|
+
_ && /* @__PURE__ */ r(h, { className: "bear-justify-center bear-pt-2 bear-pb-1", children: /* @__PURE__ */ r(s, { className: "bear-w-12 bear-h-1 bear-rounded-full bear-bg-neutral-300 dark:bear-bg-neutral-600", "aria-hidden": !0 }) }),
|
|
95
|
+
(b || y) && /* @__PURE__ */ f(
|
|
96
|
+
h,
|
|
89
97
|
{
|
|
90
98
|
className: i(
|
|
91
99
|
"bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0",
|
|
92
|
-
|
|
100
|
+
B && "bear-sticky bear-top-0 bear-z-10 bear-bg-white dark:bear-bg-neutral-900"
|
|
93
101
|
),
|
|
94
102
|
children: [
|
|
95
103
|
b && /* @__PURE__ */ r(
|
|
96
|
-
|
|
104
|
+
K,
|
|
97
105
|
{
|
|
98
106
|
id: "bottom-sheet-title",
|
|
99
107
|
weight: "semibold",
|
|
@@ -101,18 +109,18 @@ const ae = (N) => {
|
|
|
101
109
|
children: b
|
|
102
110
|
}
|
|
103
111
|
),
|
|
104
|
-
|
|
112
|
+
y && /* @__PURE__ */ r(U, { variant: z, onClick: o, "aria-label": M, children: /* @__PURE__ */ r(Z, { className: "bear-w-5 bear-h-5" }) })
|
|
105
113
|
]
|
|
106
114
|
}
|
|
107
115
|
),
|
|
108
116
|
/* @__PURE__ */ r(
|
|
109
|
-
|
|
117
|
+
s,
|
|
110
118
|
{
|
|
111
119
|
className: i(
|
|
112
120
|
"bear-flex-1 bear-min-h-0 bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",
|
|
113
|
-
|
|
121
|
+
A ? "bear-overflow-y-auto" : "bear-overflow-hidden"
|
|
114
122
|
),
|
|
115
|
-
children:
|
|
123
|
+
children: O
|
|
116
124
|
}
|
|
117
125
|
)
|
|
118
126
|
]
|
|
@@ -121,8 +129,8 @@ const ae = (N) => {
|
|
|
121
129
|
]
|
|
122
130
|
}
|
|
123
131
|
);
|
|
124
|
-
return
|
|
132
|
+
return R(L, document.body);
|
|
125
133
|
};
|
|
126
134
|
export {
|
|
127
|
-
|
|
135
|
+
be as BottomSheet
|
|
128
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),ne=require("../../constants/numbers.const.cjs"),Oe=require("../../constants/generals.const.cjs"),A=require("../../utils/cn.cjs"),Be=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");require("../../context/BearProvider.cjs");const l=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs"),je=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs");require("../FormControl/FormControl.context.cjs");const v=require("@forgedevstack/bear-icons"),L=require("../OverlayPortal/OverlayPortal.const.cjs"),oe=require("../Transition/Transition.cjs"),se=require("../Transition/Transition.const.cjs"),s=require("./Calendar.const.cjs"),u=require("./Calendar.utils.cjs"),De=require("./Calendar.helpers.cjs"),Te=M=>{const{viewDate:Y,value:S=null,onSelect:g,onViewChange:n,minDate:z,maxDate:p,disabledDates:q=[],highlightedDates:I=[],weekdayLabels:U=s.DEFAULT_WEEKDAYS,firstDayOfWeek:E=s.NUMBER.ZERO,showWeekNumbers:Re=!1,slots:r={},clearable:ie=!0,onClear:h,showTodayButton:ce=!0,onToday:x,bis:be,style:de,inline:W=!1,className:le,open:H}=M,{openEffect:N,closeEffect:_}=je.resolveOverlayEffects(M),i=Y.getFullYear(),Z=Be.useBearStyles(be,de),c=Y.getMonth(),ue=b.useMemo(()=>new Date,[]),f=b.useCallback(()=>{n==null||n(new Date(i-s.NUMBER.ONE,c,s.NUMBER.ONE))},[i,c,n]),G=b.useCallback(()=>{n==null||n(new Date(i,c-s.NUMBER.ONE,s.NUMBER.ONE))},[i,c,n]),V=b.useCallback(()=>{n==null||n(new Date(i,c+s.NUMBER.ONE,s.NUMBER.ONE))},[i,c,n]),O=b.useCallback(()=>{n==null||n(new Date(i+s.NUMBER.ONE,c,s.NUMBER.ONE))},[i,c,n]),B=G,j=V,he={onPrevYear:f,onPrevMonth:G,onNextMonth:V,onNextYear:O},xe=b.useCallback(t=>z&&t<z||p&&t>p?!0:q.some(a=>u.isSameDay(a,t)),[z,p,q]),Ne=b.useCallback(t=>I.some(a=>u.isSameDay(a,t)),[I]),_e=b.useMemo(()=>u.buildCalendarGrid(i,c,E),[i,c,E]),K=b.useMemo(()=>u.reorderWeekdays(U,E),[U,E]),X=s.MONTHS[c],D=S!=null,ye=W?"Bear-Calendar Bear-Calendar--inline bear-block bear-w-full bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-none bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-text-zinc-900 dark:bear-text-zinc-100":"Bear-Calendar Bear-Calendar--dropdown bear-mt-2 bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-xl bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-w-80 bear-text-zinc-900 dark:bear-text-zinc-100",J=W?void 0:{zIndex:s.CALENDAR_DROPDOWN_Z_INDEX},me=()=>{if(r.header)return r.header({month:X,year:i,onPrev:B,onNext:j,nav:he});const t=r.navPrevYear,a=r.navPrev,o=r.navNext,d=r.navNextYear,C=r.headerLabel||De.DefaultHeaderLabel;return e.jsxs("div",{className:"Bear-Calendar__header bear-flex bear-items-center bear-justify-between bear-gap-1 bear-mb-4",children:[e.jsxs("div",{className:"Bear-Calendar__nav-left bear-flex bear-items-center bear-gap-0.5",children:[t?t({onClick:f}):e.jsx("button",{type:"button",onClick:f,className:"Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors","aria-label":"Previous year",children:e.jsx(v.ChevronsLeftIcon,{size:16})}),a?a({onClick:B}):e.jsx("button",{type:"button",onClick:B,className:"Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors","aria-label":"Previous month",children:e.jsx(v.ChevronLeftIcon,{size:16})})]}),C({month:X,year:i}),e.jsxs("div",{className:"Bear-Calendar__nav-right bear-flex bear-items-center bear-gap-0.5",children:[o?o({onClick:j}):e.jsx("button",{type:"button",onClick:j,className:"Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors","aria-label":"Next month",children:e.jsx(v.ChevronRightIcon,{size:16})}),d?d({onClick:O}):e.jsx("button",{type:"button",onClick:O,className:"Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors","aria-label":"Next year",children:e.jsx(v.ChevronsRightIcon,{size:16})})]})]})},Ee=()=>{if(r.weekdays)return r.weekdays({days:K});const t=r.weekday;return e.jsx("div",{className:"Bear-Calendar__weekdays bear-grid bear-grid-cols-7 bear-gap-1 bear-mb-2",children:K.map(a=>t?e.jsx("div",{children:t({label:a})},a):e.jsx("div",{className:A.cn("Bear-Calendar__weekday bear-text-center bear-text-xs bear-font-medium bear-uppercase bear-text-zinc-500 dark:bear-text-zinc-400",s.WEEKEND_LABELS.includes(a)&&"bear-text-red-500"),children:a},a))})},Ce=(t,a)=>{const{date:o,isCurrentMonth:d}=t,C=o.getDate(),ze=o.getDay(),pe=u.isWeekendDay(ze),m=u.isSameDay(S,o),P=u.isSameDay(ue,o),k=xe(o),ae=Ne(o),te=()=>{k||g==null||g(o)},fe={date:o,day:C,isCurrentMonth:d,isSelected:m,isToday:P,isDisabled:k,isHighlighted:ae,onClick:te};return r.day?e.jsx("span",{children:r.day(fe)},a):e.jsx("button",{type:"button",onClick:te,disabled:k,className:A.cn("Bear-Calendar__day bear-w-8 bear-h-8 bear-rounded-full bear-text-sm bear-font-medium bear-transition-colors bear-flex bear-items-center bear-justify-center",m&&"Bear-Calendar__day--selected bear-bg-primary-500 bear-text-white hover:bear-bg-primary-600",!m&&P&&"Bear-Calendar__day--today bear-ring-2 bear-ring-primary-500/50 bear-bg-transparent",!m&&!P&&(d?pe?"Bear-Calendar__day--weekend bear-text-red-500 dark:bear-text-red-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800":"bear-text-zinc-700 dark:bear-text-zinc-300 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800":"Bear-Calendar__day--other bear-text-zinc-500 dark:bear-text-zinc-600 hover:bear-bg-zinc-50 dark:hover:bear-bg-zinc-800/50"),ae&&!m&&"Bear-Calendar__day--highlighted bear-bg-primary-500/15",k&&"Bear-Calendar__day--disabled bear-opacity-40 bear-cursor-not-allowed"),children:C},a)},ke=()=>{const t=_e.map((a,o)=>Ce(a,o));return r.daysGrid?r.daysGrid({children:t,className:"Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1"}):e.jsx("div",{className:"Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1",children:t})},ve=()=>{const t=ie&&D&&h,a=ce&&x;if(!t&&!a)return null;if(r.footer){const o=r.clearButton,d=r.todayButton;return r.footer({children:e.jsxs("div",{className:"Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700",children:[t&&o?o({onClick:h,hasSelection:D}):t?e.jsx("button",{type:"button",onClick:h,className:"Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors",children:"Clear"}):e.jsx("span",{}),a&&d?d({onClick:x}):a?e.jsx("button",{type:"button",onClick:x,className:"Bear-Calendar__today-btn bear-text-sm bear-text-primary-600 dark:bear-text-primary-400 hover:bear-text-primary-700 dark:hover:bear-text-primary-300 bear-font-medium",children:"Today"}):null]})})}return r.clearButton&&r.todayButton?e.jsxs("div",{className:"Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700",children:[t&&r.clearButton({onClick:h,hasSelection:D}),a&&r.todayButton({onClick:x})]}):e.jsxs("div",{className:"Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700",children:[t?e.jsx("button",{type:"button",onClick:h,className:"Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors",children:"Clear"}):e.jsx("span",{}),a?e.jsx("button",{type:"button",onClick:x,className:"Bear-Calendar__today-btn bear-text-sm bear-text-primary-400 hover:bear-text-primary-300 bear-font-medium bear-transition-colors",children:"Today"}):null]})},T=e.jsxs(e.Fragment,{children:[me(),Ee(),ke(),ve()]}),R=A.cn(ye,le),Q=Object.keys(Z).length?Z:void 0,$=J?{...Q,...J}:Q,w=r.root?r.root({children:T,className:R}):e.jsx("div",{className:R,style:$,children:T}),ge=H!==void 0,y=H??Oe.BOOLEAN_TRUE;if(!(ge&&(N!==l.OVERLAY_OPEN_EFFECT_NONE||_!==l.OVERLAY_OPEN_EFFECT_NONE)))return w;const ee=y?N:_,F=ee===l.OVERLAY_OPEN_EFFECT_NONE?N===l.OVERLAY_OPEN_EFFECT_NONE?_===l.OVERLAY_OPEN_EFFECT_NONE?void 0:L.OVERLAY_EFFECT_TRANSITION[_]:L.OVERLAY_EFFECT_TRANSITION[N]:L.OVERLAY_EFFECT_TRANSITION[ee],re=y&&N===l.OVERLAY_OPEN_EFFECT_NONE||!y&&_===l.OVERLAY_OPEN_EFFECT_NONE;return F?r.root?e.jsx(oe.Transition,{show:y,name:F,duration:re?ne.ZERO:se.DEFAULT_DURATION,children:w}):e.jsx(oe.Transition,{show:y,name:F,duration:re?ne.ZERO:se.DEFAULT_DURATION,className:R,style:$,children:T}):w};exports.Calendar=Te;
|