@forgedevstack/bear 1.0.1 → 1.0.3
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/ActiveBar/ActiveBar.cjs +8 -0
- package/dist/components/ActiveBar/ActiveBar.d.ts +2 -0
- package/dist/components/ActiveBar/ActiveBar.js +90 -0
- package/dist/components/ActiveBar/ActiveBar.types.d.ts +16 -0
- package/dist/components/ActiveBar/index.d.ts +2 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +38 -38
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +15 -15
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.constants.cjs +1 -0
- package/dist/components/Badge/Badge.constants.d.ts +6 -0
- package/dist/components/Badge/Badge.constants.js +34 -0
- package/dist/components/Badge/Badge.js +27 -52
- package/dist/components/Box/Box.cjs +1 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.js +64 -0
- package/dist/components/Box/Box.types.d.ts +24 -0
- package/dist/components/Box/Box.utils.cjs +1 -0
- package/dist/components/Box/Box.utils.d.ts +3 -0
- package/dist/components/Box/Box.utils.js +21 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -57
- package/dist/components/Button/Button.constants.cjs +57 -0
- package/dist/components/Button/Button.constants.d.ts +3 -0
- package/dist/components/Button/Button.constants.js +77 -0
- package/dist/components/Button/Button.js +55 -119
- package/dist/components/Button/Button.types.d.ts +6 -1
- package/dist/components/ButtonGroup/ButtonGroup.cjs +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +17 -17
- package/dist/components/Calendar/Calendar.cjs +1 -0
- package/dist/components/Calendar/Calendar.const.cjs +1 -0
- package/dist/components/Calendar/Calendar.const.d.ts +18 -0
- package/dist/components/Calendar/Calendar.const.js +27 -0
- package/dist/components/Calendar/Calendar.d.ts +3 -0
- package/dist/components/Calendar/Calendar.js +189 -0
- package/dist/components/Calendar/Calendar.types.d.ts +128 -0
- package/dist/components/Calendar/Calendar.utils.cjs +1 -0
- package/dist/components/Calendar/Calendar.utils.d.ts +41 -0
- package/dist/components/Calendar/Calendar.utils.js +33 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.js +65 -65
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.js +48 -48
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +2 -0
- package/dist/components/CodeBlock/CodeBlock.js +55 -0
- package/dist/components/CodeBlock/CodeBlock.types.d.ts +10 -0
- package/dist/components/CodeBlock/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -0
- package/dist/components/Columns/Columns.d.ts +5 -0
- package/dist/components/Columns/Columns.js +54 -0
- package/dist/components/Columns/Columns.types.d.ts +17 -0
- package/dist/components/Columns/index.d.ts +2 -0
- package/dist/components/Container/Container.cjs +1 -1
- package/dist/components/Container/Container.js +15 -15
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +77 -85
- package/dist/components/DatePicker/DatePicker.types.d.ts +9 -0
- package/dist/components/DatePicker/DatePicker.utils.cjs +1 -0
- package/dist/components/DatePicker/DatePicker.utils.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.utils.js +9 -0
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +178 -0
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +26 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +2 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.js +16 -0
- package/dist/components/DateTimePicker/index.d.ts +2 -0
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +29 -29
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +70 -70
- package/dist/components/Editable/Editable.cjs +1 -0
- package/dist/components/Editable/Editable.d.ts +10 -0
- package/dist/components/Editable/Editable.js +194 -0
- package/dist/components/Editable/Editable.types.d.ts +39 -0
- package/dist/components/Editable/index.d.ts +2 -0
- package/dist/components/Em/Em.cjs +1 -0
- package/dist/components/Em/Em.d.ts +2 -0
- package/dist/components/Em/Em.js +24 -0
- package/dist/components/Em/Em.types.d.ts +5 -0
- package/dist/components/Em/index.d.ts +2 -0
- package/dist/components/Fab/Fab.cjs +1 -1
- package/dist/components/Fab/Fab.js +43 -43
- package/dist/components/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/FileUpload/FileUpload.js +46 -49
- package/dist/components/FileUpload/FileUpload.utils.cjs +1 -0
- package/dist/components/FileUpload/FileUpload.utils.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.utils.js +9 -0
- package/dist/components/Flex/Flex.cjs +1 -1
- package/dist/components/Flex/Flex.js +58 -58
- package/dist/components/Grid/Grid.cjs +1 -1
- package/dist/components/Grid/Grid.js +60 -60
- package/dist/components/Highlight/Highlight.cjs +1 -0
- package/dist/components/Highlight/Highlight.d.ts +2 -0
- package/dist/components/Highlight/Highlight.js +28 -0
- package/dist/components/Highlight/Highlight.types.d.ts +6 -0
- package/dist/components/Highlight/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -0
- package/dist/components/HoverCard/HoverCard.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.js +68 -0
- package/dist/components/HoverCard/HoverCard.types.d.ts +13 -0
- package/dist/components/HoverCard/HoverCard.utils.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.utils.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.utils.js +23 -0
- package/dist/components/HoverCard/index.d.ts +2 -0
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +5 -0
- package/dist/components/Icon/index.js +28 -21
- package/dist/components/Link/Link.cjs +1 -1
- package/dist/components/Link/Link.js +47 -47
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +117 -117
- package/dist/components/Mark/Mark.cjs +1 -0
- package/dist/components/Mark/Mark.d.ts +2 -0
- package/dist/components/Mark/Mark.js +26 -0
- package/dist/components/Mark/Mark.types.d.ts +5 -0
- package/dist/components/Mark/index.d.ts +2 -0
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +58 -58
- package/dist/components/Paper/Paper.cjs +1 -1
- package/dist/components/Paper/Paper.js +36 -36
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.js +79 -79
- package/dist/components/Rating/Rating.cjs +1 -1
- package/dist/components/Rating/Rating.js +37 -37
- package/dist/components/RichEditor/RichEditor.cjs +10 -0
- package/dist/components/RichEditor/RichEditor.d.ts +4 -0
- package/dist/components/RichEditor/RichEditor.icons.cjs +1 -0
- package/dist/components/RichEditor/RichEditor.icons.d.ts +16 -0
- package/dist/components/RichEditor/RichEditor.icons.js +62 -0
- package/dist/components/RichEditor/RichEditor.js +151 -0
- package/dist/components/RichEditor/RichEditor.types.d.ts +20 -0
- package/dist/components/RichEditor/RichEditor.utils.cjs +1 -0
- package/dist/components/RichEditor/RichEditor.utils.d.ts +3 -0
- package/dist/components/RichEditor/RichEditor.utils.js +22 -0
- package/dist/components/RichEditor/index.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/Sidebar.js +158 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +40 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.js +8 -8
- package/dist/components/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/SpeedDial/SpeedDial.js +40 -40
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +24 -24
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.constants.d.ts +5 -0
- package/dist/components/TimePicker/TimePicker.constants.js +16 -0
- package/dist/components/TimePicker/TimePicker.js +91 -70
- package/dist/components/TimePicker/TimePicker.types.d.ts +5 -2
- package/dist/components/TimePicker/TimePicker.utils.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.utils.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.utils.js +7 -0
- package/dist/components/TransferList/TransferList.cjs +1 -1
- package/dist/components/TransferList/TransferList.js +74 -74
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +52 -52
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +119 -91
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +6 -1
- package/dist/context/BearProvider.js +42 -38
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +6 -5
- package/dist/hooks/bearStyled.cjs +1 -0
- package/dist/hooks/bearStyled.d.ts +17 -0
- package/dist/hooks/bearStyled.js +17 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +14 -10
- package/dist/hooks/useBearStyles.cjs +1 -0
- package/dist/hooks/useBearStyles.d.ts +11 -0
- package/dist/hooks/useBearStyles.js +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +146 -113
- package/dist/styles.css +1 -1
- package/dist/types/bis.types.d.ts +9 -0
- package/dist/types/component.types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsxs as l, Fragment as ue, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as L, useCallback as u } from "react";
|
|
3
|
+
import { cn as O } from "../../utils/cn.js";
|
|
4
|
+
import { useBearStyles as be } from "../../hooks/useBearStyles.js";
|
|
5
|
+
import { ChevronsLeftIcon as me, ChevronLeftIcon as he, ChevronRightIcon as ke, ChevronsRightIcon as xe } from "../Icon/index.js";
|
|
6
|
+
import { NUMBER as a, DEFAULT_WEEKDAYS as ve, MONTHS as pe, WEEKEND_LABELS as ze } from "./Calendar.const.js";
|
|
7
|
+
import { isSameDay as N, buildCalendarGrid as Ne, reorderWeekdays as ye, isWeekendDay as fe } from "./Calendar.utils.js";
|
|
8
|
+
const ge = ({ month: k, year: x }) => /* @__PURE__ */ l("span", { className: "font-semibold text-sm select-none", children: [
|
|
9
|
+
k,
|
|
10
|
+
" ",
|
|
11
|
+
x
|
|
12
|
+
] }), Ce = ({
|
|
13
|
+
viewDate: k,
|
|
14
|
+
value: x = null,
|
|
15
|
+
onSelect: y,
|
|
16
|
+
onViewChange: c,
|
|
17
|
+
minDate: f,
|
|
18
|
+
maxDate: g,
|
|
19
|
+
disabledDates: D = [],
|
|
20
|
+
highlightedDates: C = [],
|
|
21
|
+
weekdayLabels: W = ve,
|
|
22
|
+
firstDayOfWeek: v = a.ZERO,
|
|
23
|
+
showWeekNumbers: Ee = !1,
|
|
24
|
+
slots: e = {},
|
|
25
|
+
clearable: w = !0,
|
|
26
|
+
onClear: b,
|
|
27
|
+
showTodayButton: K = !0,
|
|
28
|
+
onToday: m,
|
|
29
|
+
bis: U,
|
|
30
|
+
style: Z,
|
|
31
|
+
inline: q = !1,
|
|
32
|
+
className: J
|
|
33
|
+
}) => {
|
|
34
|
+
const i = k.getFullYear(), H = be(U, Z), d = k.getMonth(), Q = L(() => /* @__PURE__ */ new Date(), []), E = u(() => {
|
|
35
|
+
c == null || c(new Date(i - a.ONE, d, a.ONE));
|
|
36
|
+
}, [i, d, c]), R = u(() => {
|
|
37
|
+
c == null || c(new Date(i, d - a.ONE, a.ONE));
|
|
38
|
+
}, [i, d, c]), S = u(() => {
|
|
39
|
+
c == null || c(new Date(i, d + a.ONE, a.ONE));
|
|
40
|
+
}, [i, d, c]), P = u(() => {
|
|
41
|
+
c == null || c(new Date(i + a.ONE, d, a.ONE));
|
|
42
|
+
}, [i, d, c]), Y = R, B = S, X = {
|
|
43
|
+
onPrevYear: E,
|
|
44
|
+
onPrevMonth: R,
|
|
45
|
+
onNextMonth: S,
|
|
46
|
+
onNextYear: P
|
|
47
|
+
}, $ = u(
|
|
48
|
+
(r) => f && r < f || g && r > g ? !0 : D.some((t) => N(t, r)),
|
|
49
|
+
[f, g, D]
|
|
50
|
+
), V = u(
|
|
51
|
+
(r) => C.some((t) => N(t, r)),
|
|
52
|
+
[C]
|
|
53
|
+
), ee = L(
|
|
54
|
+
() => Ne(i, d, v),
|
|
55
|
+
[i, d, v]
|
|
56
|
+
), F = L(
|
|
57
|
+
() => ye(W, v),
|
|
58
|
+
[W, v]
|
|
59
|
+
), I = pe[d], M = x != null, te = q ? "block w-full bg-white dark:bg-gray-900 rounded-xl shadow-none border border-zinc-200 dark:border-zinc-700 p-4 text-zinc-900 dark:text-zinc-100" : "absolute z-50 mt-2 bg-white dark:bg-gray-900 rounded-xl shadow-xl border border-zinc-200 dark:border-zinc-700 p-4 w-80 text-zinc-900 dark:text-zinc-100", re = () => {
|
|
60
|
+
if (e.header)
|
|
61
|
+
return e.header({ month: I, year: i, onPrev: Y, onNext: B, nav: X });
|
|
62
|
+
const r = e.navPrevYear, t = e.navPrev, o = e.navNext, s = e.navNextYear, p = e.headerLabel || ge;
|
|
63
|
+
return /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-1 mb-4", children: [
|
|
64
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-0.5", children: [
|
|
65
|
+
r ? r({ onClick: E }) : /* @__PURE__ */ n(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: E,
|
|
70
|
+
className: "p-1.5 rounded text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
71
|
+
"aria-label": "Previous year",
|
|
72
|
+
children: /* @__PURE__ */ n(me, { size: 16 })
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
t ? t({ onClick: Y }) : /* @__PURE__ */ n(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: Y,
|
|
80
|
+
className: "p-1.5 rounded text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
81
|
+
"aria-label": "Previous month",
|
|
82
|
+
children: /* @__PURE__ */ n(he, { size: 16 })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] }),
|
|
86
|
+
p({ month: I, year: i }),
|
|
87
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-0.5", children: [
|
|
88
|
+
o ? o({ onClick: B }) : /* @__PURE__ */ n(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
type: "button",
|
|
92
|
+
onClick: B,
|
|
93
|
+
className: "p-1.5 rounded text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
94
|
+
"aria-label": "Next month",
|
|
95
|
+
children: /* @__PURE__ */ n(ke, { size: 16 })
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
s ? s({ onClick: P }) : /* @__PURE__ */ n(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
type: "button",
|
|
102
|
+
onClick: P,
|
|
103
|
+
className: "p-1.5 rounded text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
104
|
+
"aria-label": "Next year",
|
|
105
|
+
children: /* @__PURE__ */ n(xe, { size: 16 })
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] })
|
|
109
|
+
] });
|
|
110
|
+
}, ne = () => {
|
|
111
|
+
if (e.weekdays) return e.weekdays({ days: F });
|
|
112
|
+
const r = e.weekday;
|
|
113
|
+
return /* @__PURE__ */ n("div", { className: "grid grid-cols-7 gap-1 mb-2", children: F.map(
|
|
114
|
+
(t) => r ? /* @__PURE__ */ n("div", { children: r({ label: t }) }, t) : /* @__PURE__ */ n(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: O(
|
|
118
|
+
"text-center text-xs font-medium uppercase",
|
|
119
|
+
ze.includes(t) && "text-red-500"
|
|
120
|
+
),
|
|
121
|
+
children: t
|
|
122
|
+
},
|
|
123
|
+
t
|
|
124
|
+
)
|
|
125
|
+
) });
|
|
126
|
+
}, ce = (r, t) => {
|
|
127
|
+
const { date: o, isCurrentMonth: s } = r, p = o.getDate(), ae = o.getDay(), se = fe(ae), h = N(x, o), j = N(Q, o), z = $(o), T = V(o), _ = () => {
|
|
128
|
+
z || y == null || y(o);
|
|
129
|
+
}, le = {
|
|
130
|
+
date: o,
|
|
131
|
+
day: p,
|
|
132
|
+
isCurrentMonth: s,
|
|
133
|
+
isSelected: h,
|
|
134
|
+
isToday: j,
|
|
135
|
+
isDisabled: z,
|
|
136
|
+
isHighlighted: T,
|
|
137
|
+
onClick: _
|
|
138
|
+
};
|
|
139
|
+
return e.day ? /* @__PURE__ */ n("span", { children: e.day(le) }, t) : /* @__PURE__ */ n(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
type: "button",
|
|
143
|
+
onClick: _,
|
|
144
|
+
disabled: z,
|
|
145
|
+
className: O(
|
|
146
|
+
"w-8 h-8 rounded-full text-sm font-medium transition-colors flex items-center justify-center",
|
|
147
|
+
h && "bg-pink-500 text-white hover:bg-pink-600",
|
|
148
|
+
!h && j && "ring-2 ring-pink-500/50 bg-transparent",
|
|
149
|
+
!h && !j && (s ? se ? "text-red-500 dark:text-red-400 hover:bg-zinc-100 dark:hover:bg-zinc-800" : "text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800" : "text-zinc-400 dark:text-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50"),
|
|
150
|
+
T && !h && "bg-pink-500/15",
|
|
151
|
+
z && "opacity-40 cursor-not-allowed"
|
|
152
|
+
),
|
|
153
|
+
children: p
|
|
154
|
+
},
|
|
155
|
+
t
|
|
156
|
+
);
|
|
157
|
+
}, oe = () => {
|
|
158
|
+
const r = ee.map((t, o) => ce(t, o));
|
|
159
|
+
return e.daysGrid ? e.daysGrid({ children: r, className: "grid grid-cols-7 gap-1" }) : /* @__PURE__ */ n("div", { className: "grid grid-cols-7 gap-1", children: r });
|
|
160
|
+
}, ie = () => {
|
|
161
|
+
const r = w && M && b, t = K && m;
|
|
162
|
+
if (!r && !t) return null;
|
|
163
|
+
if (e.footer) {
|
|
164
|
+
const o = e.clearButton, s = e.todayButton;
|
|
165
|
+
return e.footer({
|
|
166
|
+
children: /* @__PURE__ */ l("div", { className: "flex justify-between gap-2 mt-4 pt-3 border-t border-zinc-200 dark:border-zinc-700", children: [
|
|
167
|
+
r && o ? o({ onClick: b, hasSelection: M }) : r ? /* @__PURE__ */ n("button", { type: "button", onClick: b, className: "text-sm text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200", children: "Clear" }) : /* @__PURE__ */ n("span", {}),
|
|
168
|
+
t && s ? s({ onClick: m }) : t ? /* @__PURE__ */ n("button", { type: "button", onClick: m, className: "text-sm text-pink-600 hover:text-pink-700 font-medium", children: "Today" }) : null
|
|
169
|
+
] })
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return e.clearButton && e.todayButton ? /* @__PURE__ */ l("div", { className: "flex justify-between gap-2 mt-4 pt-3 border-t border-zinc-200 dark:border-zinc-700", children: [
|
|
173
|
+
r && e.clearButton({ onClick: b, hasSelection: M }),
|
|
174
|
+
t && e.todayButton({ onClick: m })
|
|
175
|
+
] }) : /* @__PURE__ */ l("div", { className: "flex justify-between gap-2 mt-4 pt-3 border-t border-zinc-200 dark:border-zinc-700", children: [
|
|
176
|
+
r ? /* @__PURE__ */ n("button", { type: "button", onClick: b, className: "text-sm text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors", children: "Clear" }) : /* @__PURE__ */ n("span", {}),
|
|
177
|
+
t ? /* @__PURE__ */ n("button", { type: "button", onClick: m, className: "text-sm text-pink-600 dark:text-pink-400 hover:text-pink-700 dark:hover:text-pink-300 font-medium transition-colors", children: "Today" }) : null
|
|
178
|
+
] });
|
|
179
|
+
}, A = /* @__PURE__ */ l(ue, { children: [
|
|
180
|
+
re(),
|
|
181
|
+
ne(),
|
|
182
|
+
oe(),
|
|
183
|
+
ie()
|
|
184
|
+
] }), G = O(te, J), de = Object.keys(H).length ? H : void 0;
|
|
185
|
+
return e.root ? e.root({ children: A, className: G }) : /* @__PURE__ */ n("div", { className: G, style: de, children: A });
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
Ce as Calendar
|
|
189
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface CalendarDayProps {
|
|
3
|
+
date: Date;
|
|
4
|
+
day: number;
|
|
5
|
+
isCurrentMonth: boolean;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
isToday: boolean;
|
|
8
|
+
isDisabled: boolean;
|
|
9
|
+
isHighlighted?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type HeaderLabelRFC = (props: {
|
|
12
|
+
month: string;
|
|
13
|
+
year: number;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
export interface CalendarNavActions {
|
|
16
|
+
onPrevYear: () => void;
|
|
17
|
+
onPrevMonth: () => void;
|
|
18
|
+
onNextMonth: () => void;
|
|
19
|
+
onNextYear: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface CalendarSlots {
|
|
22
|
+
/** Root calendar container */
|
|
23
|
+
root?: (props: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}) => ReactNode;
|
|
27
|
+
/** Header (month/year + nav) */
|
|
28
|
+
header?: (props: {
|
|
29
|
+
month: string;
|
|
30
|
+
year: number;
|
|
31
|
+
onPrev: () => void;
|
|
32
|
+
onNext: () => void;
|
|
33
|
+
nav?: CalendarNavActions;
|
|
34
|
+
}) => ReactNode;
|
|
35
|
+
/** Prev month button */
|
|
36
|
+
navPrev?: (props: {
|
|
37
|
+
onClick: () => void;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
}) => ReactNode;
|
|
40
|
+
/** Next month button */
|
|
41
|
+
navNext?: (props: {
|
|
42
|
+
onClick: () => void;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}) => ReactNode;
|
|
45
|
+
/** Prev year button (e.g. «) */
|
|
46
|
+
navPrevYear?: (props: {
|
|
47
|
+
onClick: () => void;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}) => ReactNode;
|
|
50
|
+
/** Next year button (e.g. ») */
|
|
51
|
+
navNextYear?: (props: {
|
|
52
|
+
onClick: () => void;
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}) => ReactNode;
|
|
55
|
+
/** Month/year label */
|
|
56
|
+
headerLabel?: (props: {
|
|
57
|
+
month: string;
|
|
58
|
+
year: number;
|
|
59
|
+
}) => ReactNode;
|
|
60
|
+
/** Weekday row (e.g. Su Mo Tu ...) */
|
|
61
|
+
weekdays?: (props: {
|
|
62
|
+
days: string[];
|
|
63
|
+
}) => ReactNode;
|
|
64
|
+
/** Weekday cell */
|
|
65
|
+
weekday?: (props: {
|
|
66
|
+
label: string;
|
|
67
|
+
}) => ReactNode;
|
|
68
|
+
/** Grid of days */
|
|
69
|
+
daysGrid?: (props: {
|
|
70
|
+
children: ReactNode;
|
|
71
|
+
className?: string;
|
|
72
|
+
}) => ReactNode;
|
|
73
|
+
/** Single day cell */
|
|
74
|
+
day?: (props: CalendarDayProps & {
|
|
75
|
+
onClick: () => void;
|
|
76
|
+
}) => ReactNode;
|
|
77
|
+
/** Empty cell (leading/trailing padding) */
|
|
78
|
+
emptyDay?: (props: {
|
|
79
|
+
key: string;
|
|
80
|
+
}) => ReactNode;
|
|
81
|
+
/** Footer (e.g. clear, today) */
|
|
82
|
+
footer?: (props: {
|
|
83
|
+
children?: ReactNode;
|
|
84
|
+
}) => ReactNode;
|
|
85
|
+
/** Clear button */
|
|
86
|
+
clearButton?: (props: {
|
|
87
|
+
onClick: () => void;
|
|
88
|
+
hasSelection: boolean;
|
|
89
|
+
}) => ReactNode;
|
|
90
|
+
/** Today button */
|
|
91
|
+
todayButton?: (props: {
|
|
92
|
+
onClick: () => void;
|
|
93
|
+
}) => ReactNode;
|
|
94
|
+
}
|
|
95
|
+
export interface CalendarProps {
|
|
96
|
+
/** Currently viewed month (controls calendar view) */
|
|
97
|
+
viewDate: Date;
|
|
98
|
+
/** Selected date */
|
|
99
|
+
value?: Date | null;
|
|
100
|
+
/** Callback when date is selected */
|
|
101
|
+
onSelect?: (date: Date) => void;
|
|
102
|
+
/** Callback when view month changes */
|
|
103
|
+
onViewChange?: (date: Date) => void;
|
|
104
|
+
minDate?: Date;
|
|
105
|
+
maxDate?: Date;
|
|
106
|
+
disabledDates?: Date[];
|
|
107
|
+
highlightedDates?: Date[];
|
|
108
|
+
/** Weekday labels, default Su–Sa */
|
|
109
|
+
weekdayLabels?: string[];
|
|
110
|
+
/** First day of week 0=Sun, 1=Mon, etc. */
|
|
111
|
+
firstDayOfWeek?: number;
|
|
112
|
+
showWeekNumbers?: boolean;
|
|
113
|
+
/** Slot overrides for full customization */
|
|
114
|
+
slots?: CalendarSlots;
|
|
115
|
+
/** Show clear button in footer */
|
|
116
|
+
clearable?: boolean;
|
|
117
|
+
onClear?: () => void;
|
|
118
|
+
/** Show Today button in footer */
|
|
119
|
+
showTodayButton?: boolean;
|
|
120
|
+
onToday?: () => void;
|
|
121
|
+
/** Bear Inner Style - sx-like overrides */
|
|
122
|
+
bis?: import('../../types/bis.types').BisProp;
|
|
123
|
+
/** Inline styles */
|
|
124
|
+
style?: React.CSSProperties;
|
|
125
|
+
/** When true, render as block (no absolute). Use when embedding in DateTimePicker etc. */
|
|
126
|
+
inline?: boolean;
|
|
127
|
+
className?: string;
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Calendar.const.cjs"),N=(e,t)=>new Date(e,t+n.NUMBER.ONE,n.NUMBER.ZERO).getDate(),c=(e,t)=>new Date(e,t,n.NUMBER.ONE).getDay(),g=(e,t)=>!e||!t?!1:e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear(),l=e=>e===n.NUMBER.ZERO||e===n.NUMBER.SIX,i=(e,t)=>({prevMonth:t===n.NUMBER.ZERO?n.NUMBER.ELEVEN:t-n.NUMBER.ONE,prevYear:t===n.NUMBER.ZERO?e-n.NUMBER.ONE:e}),B=(e,t)=>({nextMonth:t===n.NUMBER.ELEVEN?n.NUMBER.ZERO:t+n.NUMBER.ONE,nextYear:t===n.NUMBER.ELEVEN?e+n.NUMBER.ONE:e}),D=(e,t)=>t>n.NUMBER.ZERO?[...e.slice(t),...e.slice(n.NUMBER.ZERO,t)]:[...e];function h(e,t,U){const s=(c(e,t)-U+n.NUMBER.SEVEN)%n.NUMBER.SEVEN,o=N(e,t),{prevMonth:a,prevYear:R}=i(e,t),d=N(R,a),M=[];for(let E=n.NUMBER.ZERO;E<n.NUMBER.TOTAL_CELLS;E++)if(E<s){const r=d-s+E+n.NUMBER.ONE;M.push({date:new Date(R,a,r),isCurrentMonth:!1})}else if(E<s+o){const r=E-s+n.NUMBER.ONE;M.push({date:new Date(e,t,r),isCurrentMonth:!0})}else{const r=E-s-o+n.NUMBER.ONE,{nextMonth:O,nextYear:u}=B(e,t);M.push({date:new Date(u,O,r),isCurrentMonth:!1})}return M}exports.buildCalendarGrid=h;exports.getDaysInMonth=N;exports.getFirstDayOfMonth=c;exports.getNextMonthYear=B;exports.getPrevMonthYear=i;exports.isSameDay=g;exports.isWeekendDay=l;exports.reorderWeekdays=D;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get number of days in a given month
|
|
3
|
+
*/
|
|
4
|
+
export declare const getDaysInMonth: (year: number, month: number) => number;
|
|
5
|
+
/**
|
|
6
|
+
* Get the day of week for the first day of a month (0 = Sunday)
|
|
7
|
+
*/
|
|
8
|
+
export declare const getFirstDayOfMonth: (year: number, month: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Check if two dates are the same day
|
|
11
|
+
*/
|
|
12
|
+
export declare const isSameDay: (a: Date | null, b: Date | null) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Check if a day is a weekend (Saturday or Sunday)
|
|
15
|
+
*/
|
|
16
|
+
export declare const isWeekendDay: (weekday: number) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get previous month and year
|
|
19
|
+
*/
|
|
20
|
+
export declare const getPrevMonthYear: (year: number, month: number) => {
|
|
21
|
+
prevMonth: number;
|
|
22
|
+
prevYear: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Get next month and year
|
|
26
|
+
*/
|
|
27
|
+
export declare const getNextMonthYear: (year: number, month: number) => {
|
|
28
|
+
nextMonth: number;
|
|
29
|
+
nextYear: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Reorder weekday labels based on first day of week
|
|
33
|
+
*/
|
|
34
|
+
export declare const reorderWeekdays: <T>(labels: readonly T[], firstDayOfWeek: number) => T[];
|
|
35
|
+
/**
|
|
36
|
+
* Build 6-week calendar grid: prev month trailing, current month, next month leading
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildCalendarGrid(year: number, month: number, firstDayOfWeek: number): {
|
|
39
|
+
date: Date;
|
|
40
|
+
isCurrentMonth: boolean;
|
|
41
|
+
}[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NUMBER as n } from "./Calendar.const.js";
|
|
2
|
+
const i = (t, e) => new Date(t, e + n.ONE, n.ZERO).getDate(), g = (t, e) => new Date(t, e, n.ONE).getDay(), p = (t, e) => !t || !e ? !1 : t.getDate() === e.getDate() && t.getMonth() === e.getMonth() && t.getFullYear() === e.getFullYear(), R = (t) => t === n.ZERO || t === n.SIX, l = (t, e) => ({
|
|
3
|
+
prevMonth: e === n.ZERO ? n.ELEVEN : e - n.ONE,
|
|
4
|
+
prevYear: e === n.ZERO ? t - n.ONE : t
|
|
5
|
+
}), D = (t, e) => ({
|
|
6
|
+
nextMonth: e === n.ELEVEN ? n.ZERO : e + n.ONE,
|
|
7
|
+
nextYear: e === n.ELEVEN ? t + n.ONE : t
|
|
8
|
+
}), Y = (t, e) => e > n.ZERO ? [...t.slice(e), ...t.slice(n.ZERO, e)] : [...t];
|
|
9
|
+
function Z(t, e, N) {
|
|
10
|
+
const r = (g(t, e) - N + n.SEVEN) % n.SEVEN, c = i(t, e), { prevMonth: a, prevYear: O } = l(t, e), M = i(O, a), o = [];
|
|
11
|
+
for (let s = n.ZERO; s < n.TOTAL_CELLS; s++)
|
|
12
|
+
if (s < r) {
|
|
13
|
+
const E = M - r + s + n.ONE;
|
|
14
|
+
o.push({ date: new Date(O, a, E), isCurrentMonth: !1 });
|
|
15
|
+
} else if (s < r + c) {
|
|
16
|
+
const E = s - r + n.ONE;
|
|
17
|
+
o.push({ date: new Date(t, e, E), isCurrentMonth: !0 });
|
|
18
|
+
} else {
|
|
19
|
+
const E = s - r - c + n.ONE, { nextMonth: u, nextYear: d } = D(t, e);
|
|
20
|
+
o.push({ date: new Date(d, u, E), isCurrentMonth: !1 });
|
|
21
|
+
}
|
|
22
|
+
return o;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
Z as buildCalendarGrid,
|
|
26
|
+
i as getDaysInMonth,
|
|
27
|
+
g as getFirstDayOfMonth,
|
|
28
|
+
D as getNextMonthYear,
|
|
29
|
+
l as getPrevMonthYear,
|
|
30
|
+
p as isSameDay,
|
|
31
|
+
R as isWeekendDay,
|
|
32
|
+
Y as reorderWeekdays
|
|
33
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Calendar } from './Calendar';
|
|
2
|
+
export type { CalendarProps, CalendarSlots, CalendarDayProps, CalendarNavActions } from './Calendar.types';
|
|
3
|
+
export { NUMBER, DEFAULT_WEEKDAYS, MONTHS, WEEKEND, WEEKEND_LABELS } from './Calendar.const';
|
|
4
|
+
export { buildCalendarGrid, isSameDay, isWeekendDay, getDaysInMonth, getFirstDayOfMonth, reorderWeekdays } from './Calendar.utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),o=require("react"),t=require("../../utils/cn.cjs"),x={none:"",xs:"bear-p-2",sm:"bear-p-3",md:"bear-p-4",lg:"bear-p-6",xl:"bear-p-8"},p={none:"",sm:"bear-rounded-sm",md:"bear-rounded-md",lg:"bear-rounded-lg",xl:"bear-rounded-xl","2xl":"bear-rounded-2xl"},C={elevated:"bear-bg-white dark:bear-bg-gray-900 bear-shadow-md",outlined:"bear-bg-white dark:bear-bg-gray-900 bear-border bear-border-gray-200 dark:bear-border-gray-700",filled:"bear-bg-gray-100 dark:bear-bg-gray-800",ghost:"bear-bg-transparent"},i=o.forwardRef(({variant:r="elevated",padding:e="none",interactive:a=!1,radius:s="lg",className:b,children:n,testId:l,...u},y)=>d.jsx("div",{ref:y,className:t.cn("bear-overflow-hidden",C[r],x[e],p[s],a&&"bear-transition-all bear-duration-200 bear-cursor-pointer hover:bear-shadow-lg hover:bear-scale-[1.02]",b),"data-testid":l,...u,children:n}));i.displayName="Card";const c=o.forwardRef(({title:r,subtitle:e,action:a,className:s,children:b,...n},l)=>d.jsxs("div",{ref:l,className:t.cn("bear-flex bear-items-start bear-justify-between bear-p-4 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",s),...n,children:[d.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[r&&d.jsx("h3",{className:"bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white bear-truncate",children:r}),e&&d.jsx("p",{className:"bear-text-sm bear-text-gray-500 dark:bear-text-gray-400 bear-mt-1",children:e}),b]}),a&&d.jsx("div",{className:"bear-ml-4 bear-shrink-0",children:a})]}));c.displayName="CardHeader";const g=o.forwardRef(({className:r,children:e,...a},s)=>d.jsx("div",{ref:s,className:t.cn("bear-p-4",r),...a,children:e}));g.displayName="CardBody";const m=o.forwardRef(({divider:r=!0,className:e,children:a,...s},b)=>d.jsx("div",{ref:b,className:t.cn("bear-p-4",r&&"bear-border-t bear-border-gray-200 dark:bear-border-gray-700",e),...s,children:a}));m.displayName="CardFooter";const f=Object.assign(i,{Header:c,Body:g,Footer:m});exports.Card=i;exports.CardBody=g;exports.CardCompound=f;exports.CardFooter=m;exports.CardHeader=c;
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { jsx as b, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { cn as t } from "../../utils/cn.js";
|
|
4
4
|
const h = {
|
|
5
5
|
none: "",
|
|
6
|
-
xs: "
|
|
7
|
-
sm: "
|
|
8
|
-
md: "
|
|
9
|
-
lg: "
|
|
10
|
-
xl: "
|
|
6
|
+
xs: "bear-p-2",
|
|
7
|
+
sm: "bear-p-3",
|
|
8
|
+
md: "bear-p-4",
|
|
9
|
+
lg: "bear-p-6",
|
|
10
|
+
xl: "bear-p-8"
|
|
11
11
|
}, u = {
|
|
12
12
|
none: "",
|
|
13
|
-
sm: "
|
|
14
|
-
md: "
|
|
15
|
-
lg: "
|
|
16
|
-
xl: "
|
|
17
|
-
"2xl": "
|
|
13
|
+
sm: "bear-rounded-sm",
|
|
14
|
+
md: "bear-rounded-md",
|
|
15
|
+
lg: "bear-rounded-lg",
|
|
16
|
+
xl: "bear-rounded-xl",
|
|
17
|
+
"2xl": "bear-rounded-2xl"
|
|
18
18
|
}, C = {
|
|
19
|
-
elevated: "
|
|
20
|
-
outlined: "
|
|
21
|
-
filled: "
|
|
22
|
-
ghost: "
|
|
23
|
-
},
|
|
19
|
+
elevated: "bear-bg-white dark:bear-bg-gray-900 bear-shadow-md",
|
|
20
|
+
outlined: "bear-bg-white dark:bear-bg-gray-900 bear-border bear-border-gray-200 dark:bear-border-gray-700",
|
|
21
|
+
filled: "bear-bg-gray-100 dark:bear-bg-gray-800",
|
|
22
|
+
ghost: "bear-bg-transparent"
|
|
23
|
+
}, m = o(
|
|
24
24
|
({
|
|
25
|
-
variant:
|
|
26
|
-
padding:
|
|
27
|
-
interactive:
|
|
28
|
-
radius:
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
31
|
-
testId:
|
|
25
|
+
variant: r = "elevated",
|
|
26
|
+
padding: e = "none",
|
|
27
|
+
interactive: a = !1,
|
|
28
|
+
radius: d = "lg",
|
|
29
|
+
className: s,
|
|
30
|
+
children: n,
|
|
31
|
+
testId: l,
|
|
32
32
|
...y
|
|
33
|
-
}, x) => /* @__PURE__ */
|
|
33
|
+
}, x) => /* @__PURE__ */ b(
|
|
34
34
|
"div",
|
|
35
35
|
{
|
|
36
36
|
ref: x,
|
|
37
|
-
className:
|
|
38
|
-
"
|
|
39
|
-
C[
|
|
40
|
-
h[
|
|
41
|
-
u[
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
className: t(
|
|
38
|
+
"bear-overflow-hidden",
|
|
39
|
+
C[r],
|
|
40
|
+
h[e],
|
|
41
|
+
u[d],
|
|
42
|
+
a && "bear-transition-all bear-duration-200 bear-cursor-pointer hover:bear-shadow-lg hover:bear-scale-[1.02]",
|
|
43
|
+
s
|
|
44
44
|
),
|
|
45
|
-
"data-testid":
|
|
45
|
+
"data-testid": l,
|
|
46
46
|
...y,
|
|
47
|
-
children:
|
|
47
|
+
children: n
|
|
48
48
|
}
|
|
49
49
|
)
|
|
50
50
|
);
|
|
51
|
-
|
|
52
|
-
const g =
|
|
53
|
-
({ title:
|
|
51
|
+
m.displayName = "Card";
|
|
52
|
+
const g = o(
|
|
53
|
+
({ title: r, subtitle: e, action: a, className: d, children: s, ...n }, l) => /* @__PURE__ */ i(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
ref:
|
|
57
|
-
className:
|
|
58
|
-
"
|
|
59
|
-
|
|
56
|
+
ref: l,
|
|
57
|
+
className: t(
|
|
58
|
+
"bear-flex bear-items-start bear-justify-between bear-p-4 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",
|
|
59
|
+
d
|
|
60
60
|
),
|
|
61
|
-
...
|
|
61
|
+
...n,
|
|
62
62
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
/* @__PURE__ */ i("div", { className: "bear-flex-1 bear-min-w-0", children: [
|
|
64
|
+
r && /* @__PURE__ */ b("h3", { className: "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white bear-truncate", children: r }),
|
|
65
|
+
e && /* @__PURE__ */ b("p", { className: "bear-text-sm bear-text-gray-500 dark:bear-text-gray-400 bear-mt-1", children: e }),
|
|
66
|
+
s
|
|
67
67
|
] }),
|
|
68
|
-
|
|
68
|
+
a && /* @__PURE__ */ b("div", { className: "bear-ml-4 bear-shrink-0", children: a })
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
)
|
|
72
72
|
);
|
|
73
73
|
g.displayName = "CardHeader";
|
|
74
|
-
const c =
|
|
75
|
-
({ className:
|
|
74
|
+
const c = o(
|
|
75
|
+
({ className: r, children: e, ...a }, d) => /* @__PURE__ */ b(
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
|
-
ref:
|
|
79
|
-
className:
|
|
80
|
-
...
|
|
81
|
-
children:
|
|
78
|
+
ref: d,
|
|
79
|
+
className: t("bear-p-4", r),
|
|
80
|
+
...a,
|
|
81
|
+
children: e
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
);
|
|
85
85
|
c.displayName = "CardBody";
|
|
86
|
-
const p =
|
|
87
|
-
({ divider:
|
|
86
|
+
const p = o(
|
|
87
|
+
({ divider: r = !0, className: e, children: a, ...d }, s) => /* @__PURE__ */ b(
|
|
88
88
|
"div",
|
|
89
89
|
{
|
|
90
|
-
ref:
|
|
91
|
-
className:
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
ref: s,
|
|
91
|
+
className: t(
|
|
92
|
+
"bear-p-4",
|
|
93
|
+
r && "bear-border-t bear-border-gray-200 dark:bear-border-gray-700",
|
|
94
|
+
e
|
|
95
95
|
),
|
|
96
|
-
...
|
|
97
|
-
children:
|
|
96
|
+
...d,
|
|
97
|
+
children: a
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
);
|
|
101
101
|
p.displayName = "CardFooter";
|
|
102
|
-
const k = Object.assign(
|
|
102
|
+
const k = Object.assign(m, {
|
|
103
103
|
Header: g,
|
|
104
104
|
Body: c,
|
|
105
105
|
Footer: p
|
|
106
106
|
});
|
|
107
107
|
export {
|
|
108
|
-
|
|
108
|
+
m as Card,
|
|
109
109
|
c as CardBody,
|
|
110
110
|
k as CardCompound,
|
|
111
111
|
p as CardFooter,
|
|
@@ -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"),c=require("react"),t=require("../../utils/cn.cjs"),I={xs:"bear-w-3.5 bear-h-3.5",sm:"bear-w-4 bear-h-4",md:"bear-w-5 bear-h-5",lg:"bear-w-6 bear-h-6",xl:"bear-w-7 bear-h-7"},L={xs:10,sm:12,md:14,lg:18,xl:22},E={xs:"bear-text-xs",sm:"bear-text-sm",md:"bear-text-base",lg:"bear-text-lg",xl:"bear-text-xl"},R={primary:"#ec4899",secondary:"#6b7280",success:"#22c55e",danger:"#ef4444",warning:"#f59e0b",info:"#3b82f6",ghost:"#9ca3af",outline:"#374151",error:"#ef4444"},f=c.forwardRef(({label:i,size:b="md",variant:m="primary",color:y,checked:x,defaultChecked:d,indeterminate:a=!1,disabled:l=!1,error:s=!1,helperText:h,className:g,testId:j,onChange:p,...k},w)=>{const S=c.useRef(null),r=w||S,v=c.useId(),u=y??R[m],n=L[b];c.useEffect(()=>{typeof r=="object"&&(r!=null&&r.current)&&(r.current.indeterminate=a)},[a,r]);const C=()=>e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),N=()=>e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})}),o=x??d;return e.jsxs("div",{className:t.cn("bear-flex bear-flex-col",g),children:[e.jsxs("label",{className:t.cn("bear-inline-flex bear-items-center bear-gap-2 bear-cursor-pointer",l&&"bear-opacity-50 bear-cursor-not-allowed"),children:[e.jsxs("div",{className:"bear-relative bear-flex bear-items-center bear-justify-center",children:[e.jsx("input",{ref:r,type:"checkbox",checked:x,defaultChecked:d,disabled:l,onChange:p,className:"bear-sr-only",id:v,"data-testid":j,...k}),e.jsx("div",{className:t.cn(I[b],"bear-rounded bear-border-2 bear-transition-all bear-flex bear-items-center bear-justify-center",s?"bear-border-red-500":"bear-border-gray-300 dark:bear-border-gray-600",(o||a)&&!s&&"bear-border-transparent",!l&&"hover:bear-border-gray-400"),style:{backgroundColor:o||a?s?"#ef4444":u:"transparent",borderColor:(o||a)&&!s?u:void 0},children:a?e.jsx(N,{}):o?e.jsx(C,{}):null})]}),i&&e.jsx("span",{className:t.cn(E[b],"bear-text-gray-700 dark:bear-text-gray-300",s&&"bear-text-red-500"),children:i})]}),h&&e.jsx("span",{className:t.cn("bear-text-xs bear-mt-1 bear-ml-7",s?"bear-text-red-500":"bear-text-gray-500"),children:h})]})});f.displayName="Checkbox";exports.Checkbox=f;
|