@forgedevstack/bear 1.0.2 → 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/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/Calendar/Calendar.cjs +1 -1
- 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.js +131 -145
- package/dist/components/Calendar/Calendar.types.d.ts +4 -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 +2 -0
- 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/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +28 -28
- 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 +9 -9
- 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/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/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/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +87 -63
- package/dist/index.cjs +1 -1
- package/dist/index.js +107 -83
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -1,203 +1,189 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useBearStyles as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value: a = null,
|
|
25
|
-
onSelect: f,
|
|
26
|
-
onViewChange: b,
|
|
27
|
-
minDate: l,
|
|
28
|
-
maxDate: v,
|
|
29
|
-
disabledDates: y = [],
|
|
30
|
-
highlightedDates: g = [],
|
|
31
|
-
weekdayLabels: p = he,
|
|
32
|
-
firstDayOfWeek: i = 0,
|
|
33
|
-
showWeekNumbers: H = !1,
|
|
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,
|
|
34
24
|
slots: e = {},
|
|
35
|
-
clearable:
|
|
36
|
-
onClear:
|
|
37
|
-
showTodayButton:
|
|
38
|
-
onToday:
|
|
39
|
-
bis:
|
|
40
|
-
style:
|
|
41
|
-
inline:
|
|
42
|
-
className:
|
|
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
|
|
43
33
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
}, [
|
|
53
|
-
onPrevYear:
|
|
54
|
-
onPrevMonth:
|
|
55
|
-
onNextMonth:
|
|
56
|
-
onNextYear:
|
|
57
|
-
},
|
|
58
|
-
(
|
|
59
|
-
[
|
|
60
|
-
),
|
|
61
|
-
(
|
|
62
|
-
[
|
|
63
|
-
),
|
|
64
|
-
() =>
|
|
65
|
-
[
|
|
66
|
-
),
|
|
67
|
-
() =>
|
|
68
|
-
[
|
|
69
|
-
),
|
|
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 = () => {
|
|
70
60
|
if (e.header)
|
|
71
|
-
return e.header({ month:
|
|
72
|
-
const
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
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(
|
|
76
66
|
"button",
|
|
77
67
|
{
|
|
78
68
|
type: "button",
|
|
79
|
-
onClick:
|
|
80
|
-
className: "
|
|
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",
|
|
81
71
|
"aria-label": "Previous year",
|
|
82
|
-
children:
|
|
72
|
+
children: /* @__PURE__ */ n(me, { size: 16 })
|
|
83
73
|
}
|
|
84
74
|
),
|
|
85
|
-
|
|
75
|
+
t ? t({ onClick: Y }) : /* @__PURE__ */ n(
|
|
86
76
|
"button",
|
|
87
77
|
{
|
|
88
78
|
type: "button",
|
|
89
|
-
onClick:
|
|
90
|
-
className: "
|
|
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",
|
|
91
81
|
"aria-label": "Previous month",
|
|
92
|
-
children:
|
|
82
|
+
children: /* @__PURE__ */ n(he, { size: 16 })
|
|
93
83
|
}
|
|
94
84
|
)
|
|
95
85
|
] }),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
s
|
|
100
|
-
] }),
|
|
101
|
-
/* @__PURE__ */ m("div", { className: "bear-flex bear-items-center bear-gap-0.5", children: [
|
|
102
|
-
o ? o({ onClick: B }) : /* @__PURE__ */ c(
|
|
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(
|
|
103
89
|
"button",
|
|
104
90
|
{
|
|
105
91
|
type: "button",
|
|
106
92
|
onClick: B,
|
|
107
|
-
className: "
|
|
93
|
+
className: "p-1.5 rounded text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
108
94
|
"aria-label": "Next month",
|
|
109
|
-
children:
|
|
95
|
+
children: /* @__PURE__ */ n(ke, { size: 16 })
|
|
110
96
|
}
|
|
111
97
|
),
|
|
112
|
-
|
|
98
|
+
s ? s({ onClick: P }) : /* @__PURE__ */ n(
|
|
113
99
|
"button",
|
|
114
100
|
{
|
|
115
101
|
type: "button",
|
|
116
|
-
onClick:
|
|
117
|
-
className: "
|
|
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",
|
|
118
104
|
"aria-label": "Next year",
|
|
119
|
-
children:
|
|
105
|
+
children: /* @__PURE__ */ n(xe, { size: 16 })
|
|
120
106
|
}
|
|
121
107
|
)
|
|
122
108
|
] })
|
|
123
109
|
] });
|
|
124
|
-
},
|
|
125
|
-
if (e.weekdays) return e.weekdays({ days:
|
|
126
|
-
const
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
-
(
|
|
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(
|
|
129
115
|
"div",
|
|
130
116
|
{
|
|
131
|
-
className:
|
|
132
|
-
"
|
|
133
|
-
(
|
|
117
|
+
className: O(
|
|
118
|
+
"text-center text-xs font-medium uppercase",
|
|
119
|
+
ze.includes(t) && "text-red-500"
|
|
134
120
|
),
|
|
135
|
-
children:
|
|
121
|
+
children: t
|
|
136
122
|
},
|
|
137
|
-
|
|
123
|
+
t
|
|
138
124
|
)
|
|
139
125
|
) });
|
|
140
|
-
}, ce = (
|
|
141
|
-
const { date: o, isCurrentMonth:
|
|
142
|
-
|
|
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);
|
|
143
129
|
}, le = {
|
|
144
130
|
date: o,
|
|
145
|
-
day:
|
|
146
|
-
isCurrentMonth:
|
|
147
|
-
isSelected:
|
|
148
|
-
isToday:
|
|
149
|
-
isDisabled:
|
|
150
|
-
isHighlighted:
|
|
151
|
-
onClick:
|
|
131
|
+
day: p,
|
|
132
|
+
isCurrentMonth: s,
|
|
133
|
+
isSelected: h,
|
|
134
|
+
isToday: j,
|
|
135
|
+
isDisabled: z,
|
|
136
|
+
isHighlighted: T,
|
|
137
|
+
onClick: _
|
|
152
138
|
};
|
|
153
|
-
return e.day ? /* @__PURE__ */
|
|
139
|
+
return e.day ? /* @__PURE__ */ n("span", { children: e.day(le) }, t) : /* @__PURE__ */ n(
|
|
154
140
|
"button",
|
|
155
141
|
{
|
|
156
142
|
type: "button",
|
|
157
|
-
onClick:
|
|
158
|
-
disabled:
|
|
159
|
-
className:
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
!
|
|
163
|
-
!
|
|
164
|
-
|
|
165
|
-
|
|
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"
|
|
166
152
|
),
|
|
167
|
-
children:
|
|
153
|
+
children: p
|
|
168
154
|
},
|
|
169
|
-
|
|
155
|
+
t
|
|
170
156
|
);
|
|
171
157
|
}, oe = () => {
|
|
172
|
-
const
|
|
173
|
-
return e.daysGrid ? e.daysGrid({ children:
|
|
174
|
-
},
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
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;
|
|
177
163
|
if (e.footer) {
|
|
178
|
-
const o = e.clearButton,
|
|
164
|
+
const o = e.clearButton, s = e.todayButton;
|
|
179
165
|
return e.footer({
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
|
|
182
|
-
|
|
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
|
|
183
169
|
] })
|
|
184
170
|
});
|
|
185
171
|
}
|
|
186
|
-
return e.clearButton && e.todayButton ? /* @__PURE__ */
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
] }) : /* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
|
|
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
|
|
192
178
|
] });
|
|
193
|
-
},
|
|
179
|
+
}, A = /* @__PURE__ */ l(ue, { children: [
|
|
180
|
+
re(),
|
|
194
181
|
ne(),
|
|
195
|
-
be(),
|
|
196
182
|
oe(),
|
|
197
|
-
|
|
198
|
-
] }),
|
|
199
|
-
return e.root ? e.root({ children:
|
|
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 });
|
|
200
186
|
};
|
|
201
187
|
export {
|
|
202
|
-
|
|
188
|
+
Ce as Calendar
|
|
203
189
|
};
|
|
@@ -8,6 +8,10 @@ export interface CalendarDayProps {
|
|
|
8
8
|
isDisabled: boolean;
|
|
9
9
|
isHighlighted?: boolean;
|
|
10
10
|
}
|
|
11
|
+
export type HeaderLabelRFC = (props: {
|
|
12
|
+
month: string;
|
|
13
|
+
year: number;
|
|
14
|
+
}) => ReactNode;
|
|
11
15
|
export interface CalendarNavActions {
|
|
12
16
|
onPrevYear: () => void;
|
|
13
17
|
onPrevMonth: () => void;
|
|
@@ -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
|
+
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { Calendar } from './Calendar';
|
|
2
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';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),x=c.forwardRef(({code:a,language:o="typescript",showLineNumbers:g=!0,title:s,copyable:d=!0,maxHeight:t,theme:r="dark",className:y="",...p},h)=>{const[n,i]=c.useState(!1),b=async()=>{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},u=a.split(`
|
|
2
|
+
`),j=r==="dark"?"bg-gray-900 text-gray-100":"bg-gray-50 text-gray-900 border border-gray-200";return e.jsxs("div",{className:`bear-code-block rounded-lg overflow-hidden ${j} ${y}`.trim(),children:[(s||d)&&e.jsxs("div",{className:`flex items-center justify-between px-4 py-2 ${r==="dark"?"bg-gray-800 border-b border-gray-700":"bg-gray-100 border-b border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s&&e.jsx("span",{className:`text-sm font-medium ${r==="dark"?"text-gray-300":"text-gray-700"}`,children:s}),o&&e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r==="dark"?"bg-gray-700 text-gray-400":"bg-gray-200 text-gray-600"}`,children:o})]}),d&&e.jsx("button",{onClick:b,className:`p-1.5 rounded transition-colors ${r==="dark"?"hover:bg-gray-700 text-gray-400 hover:text-gray-200":"hover:bg-gray-200 text-gray-500 hover:text-gray-700"}`,title:n?"Copied!":"Copy code",children:n?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),e.jsx("pre",{ref:h,className:"overflow-x-auto p-4",style:{maxHeight:t?typeof t=="number"?`${t}px`:t:void 0},...p,children:e.jsx("code",{className:"text-sm font-mono",children:u.map((m,l)=>e.jsxs("div",{className:"flex",children:[g&&e.jsx("span",{className:`select-none w-8 flex-shrink-0 text-right pr-4 ${r==="dark"?"text-gray-600":"text-gray-400"}`,children:l+1}),e.jsx("span",{className:"flex-1",children:m||" "})]},l))})})]})});x.displayName="CodeBlock";exports.CodeBlock=x;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f, useState as v } from "react";
|
|
3
|
+
const k = f(({
|
|
4
|
+
code: s,
|
|
5
|
+
language: d = "typescript",
|
|
6
|
+
showLineNumbers: g = !0,
|
|
7
|
+
title: o,
|
|
8
|
+
copyable: i = !0,
|
|
9
|
+
maxHeight: a,
|
|
10
|
+
theme: r = "dark",
|
|
11
|
+
className: y = "",
|
|
12
|
+
...x
|
|
13
|
+
}, p) => {
|
|
14
|
+
const [l, n] = v(!1), h = async () => {
|
|
15
|
+
await navigator.clipboard.writeText(s), n(!0), setTimeout(() => n(!1), 2e3);
|
|
16
|
+
}, m = s.split(`
|
|
17
|
+
`);
|
|
18
|
+
return /* @__PURE__ */ t("div", { className: `bear-code-block rounded-lg overflow-hidden ${r === "dark" ? "bg-gray-900 text-gray-100" : "bg-gray-50 text-gray-900 border border-gray-200"} ${y}`.trim(), children: [
|
|
19
|
+
(o || i) && /* @__PURE__ */ t("div", { className: `flex items-center justify-between px-4 py-2 ${r === "dark" ? "bg-gray-800 border-b border-gray-700" : "bg-gray-100 border-b border-gray-200"}`, children: [
|
|
20
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
21
|
+
o && /* @__PURE__ */ e("span", { className: `text-sm font-medium ${r === "dark" ? "text-gray-300" : "text-gray-700"}`, children: o }),
|
|
22
|
+
d && /* @__PURE__ */ e("span", { className: `text-xs px-2 py-0.5 rounded ${r === "dark" ? "bg-gray-700 text-gray-400" : "bg-gray-200 text-gray-600"}`, children: d })
|
|
23
|
+
] }),
|
|
24
|
+
i && /* @__PURE__ */ e(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
onClick: h,
|
|
28
|
+
className: `p-1.5 rounded transition-colors ${r === "dark" ? "hover:bg-gray-700 text-gray-400 hover:text-gray-200" : "hover:bg-gray-200 text-gray-500 hover:text-gray-700"}`,
|
|
29
|
+
title: l ? "Copied!" : "Copy code",
|
|
30
|
+
children: l ? /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
31
|
+
/* @__PURE__ */ e("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
32
|
+
/* @__PURE__ */ e("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
33
|
+
] })
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
"pre",
|
|
39
|
+
{
|
|
40
|
+
ref: p,
|
|
41
|
+
className: "overflow-x-auto p-4",
|
|
42
|
+
style: { maxHeight: a ? typeof a == "number" ? `${a}px` : a : void 0 },
|
|
43
|
+
...x,
|
|
44
|
+
children: /* @__PURE__ */ e("code", { className: "text-sm font-mono", children: m.map((b, c) => /* @__PURE__ */ t("div", { className: "flex", children: [
|
|
45
|
+
g && /* @__PURE__ */ e("span", { className: `select-none w-8 flex-shrink-0 text-right pr-4 ${r === "dark" ? "text-gray-600" : "text-gray-400"}`, children: c + 1 }),
|
|
46
|
+
/* @__PURE__ */ e("span", { className: "flex-1", children: b || " " })
|
|
47
|
+
] }, c)) })
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
});
|
|
52
|
+
k.displayName = "CodeBlock";
|
|
53
|
+
export {
|
|
54
|
+
k as CodeBlock
|
|
55
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface CodeBlockProps extends HTMLAttributes<HTMLPreElement> {
|
|
3
|
+
code: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
showLineNumbers?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
copyable?: boolean;
|
|
8
|
+
maxHeight?: number | string;
|
|
9
|
+
theme?: 'dark' | 'light';
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),a=require("../../utils/cn.cjs"),c={none:"0",xs:"0.5rem",sm:"1rem",md:"1.5rem",lg:"2rem",xl:"3rem"},b=({children:l,count:e="auto",gap:n="md",fill:r=!1,minWidth:o,className:s,style:m})=>{const t={columnCount:e==="auto"?"auto":e,columnGap:c[n],columnFill:r?"balance":"auto",...o&&{columnWidth:typeof o=="number"?`${o}px`:o},...m};return u.jsx("div",{className:a.cn("bear-w-full",s),style:t,children:l})},i=({children:l,span:e="avoid",className:n,style:r})=>u.jsx("div",{className:a.cn("bear-inline-block bear-w-full bear-mb-4",e==="avoid"&&"bear-break-inside-avoid",n),style:r,children:l});exports.Column=i;exports.Columns=b;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as n } from "../../utils/cn.js";
|
|
3
|
+
const c = {
|
|
4
|
+
none: "0",
|
|
5
|
+
xs: "0.5rem",
|
|
6
|
+
sm: "1rem",
|
|
7
|
+
md: "1.5rem",
|
|
8
|
+
lg: "2rem",
|
|
9
|
+
xl: "3rem"
|
|
10
|
+
}, d = ({
|
|
11
|
+
children: l,
|
|
12
|
+
count: o = "auto",
|
|
13
|
+
gap: a = "md",
|
|
14
|
+
fill: r = !1,
|
|
15
|
+
minWidth: e,
|
|
16
|
+
className: u,
|
|
17
|
+
style: s
|
|
18
|
+
}) => {
|
|
19
|
+
const t = {
|
|
20
|
+
columnCount: o === "auto" ? "auto" : o,
|
|
21
|
+
columnGap: c[a],
|
|
22
|
+
columnFill: r ? "balance" : "auto",
|
|
23
|
+
...e && { columnWidth: typeof e == "number" ? `${e}px` : e },
|
|
24
|
+
...s
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ m(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: n("bear-w-full", u),
|
|
30
|
+
style: t,
|
|
31
|
+
children: l
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}, f = ({
|
|
35
|
+
children: l,
|
|
36
|
+
span: o = "avoid",
|
|
37
|
+
className: a,
|
|
38
|
+
style: r
|
|
39
|
+
}) => /* @__PURE__ */ m(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: n(
|
|
43
|
+
"bear-inline-block bear-w-full bear-mb-4",
|
|
44
|
+
o === "avoid" && "bear-break-inside-avoid",
|
|
45
|
+
a
|
|
46
|
+
),
|
|
47
|
+
style: r,
|
|
48
|
+
children: l
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
export {
|
|
52
|
+
f as Column,
|
|
53
|
+
d as Columns
|
|
54
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
export interface ColumnsProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
count?: 1 | 2 | 3 | 4 | 5 | 6 | 'auto';
|
|
5
|
+
gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
fill?: boolean;
|
|
7
|
+
minWidth?: string | number;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export interface ColumnProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
span?: 'avoid' | 'auto';
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
export type ColumnsCountType = 1 | 2 | 3 | 4 | 5 | 6 | 'auto';
|