@forgedevstack/bear 1.0.1 → 1.0.2
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/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/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.d.ts +3 -0
- package/dist/components/Calendar/Calendar.js +203 -0
- package/dist/components/Calendar/Calendar.types.d.ts +124 -0
- package/dist/components/Calendar/index.d.ts +2 -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/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/Fab/Fab.cjs +1 -1
- package/dist/components/Fab/Fab.js +42 -42
- 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/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/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/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 +4 -0
- package/dist/components/index.js +67 -63
- 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 +99 -90
- 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 +1 -1
|
@@ -1,111 +1,103 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useRef as q, useEffect as A, useCallback as c } from "react";
|
|
3
|
+
import { Calendar as F } from "../Calendar/Calendar.js";
|
|
3
4
|
import { cn as p } from "../../utils/cn.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
minDate: c,
|
|
12
|
-
maxDate: i,
|
|
5
|
+
import { useBearStyles as G } from "../../hooks/useBearStyles.js";
|
|
6
|
+
import { formatDate as J } from "./DatePicker.utils.js";
|
|
7
|
+
const $ = ({
|
|
8
|
+
value: a,
|
|
9
|
+
onChange: e,
|
|
10
|
+
minDate: x,
|
|
11
|
+
maxDate: w,
|
|
13
12
|
disabled: b = !1,
|
|
14
13
|
placeholder: k = "Select date",
|
|
15
|
-
label:
|
|
16
|
-
error:
|
|
17
|
-
helperText:
|
|
18
|
-
format:
|
|
19
|
-
clearable:
|
|
20
|
-
className:
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
label: o,
|
|
15
|
+
error: l,
|
|
16
|
+
helperText: i,
|
|
17
|
+
format: y = "MM/DD/YYYY",
|
|
18
|
+
clearable: z = !0,
|
|
19
|
+
className: v,
|
|
20
|
+
style: D,
|
|
21
|
+
bis: N,
|
|
22
|
+
showWeekNumbers: S = !1,
|
|
23
|
+
disabledDates: V = [],
|
|
24
|
+
highlightedDates: h = [],
|
|
25
|
+
slots: j,
|
|
26
|
+
weekdayLabels: L,
|
|
27
|
+
firstDayOfWeek: M = 0,
|
|
28
|
+
size: O = "md",
|
|
29
|
+
variant: Y = "default"
|
|
23
30
|
}) => {
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
31
|
+
const [d, s] = f(!1), [B, E] = f(a ?? /* @__PURE__ */ new Date()), n = q(null), m = G(N, D);
|
|
32
|
+
A(() => {
|
|
33
|
+
const r = (W) => {
|
|
34
|
+
n.current && !n.current.contains(W.target) && s(!1);
|
|
28
35
|
};
|
|
29
|
-
return document.addEventListener("mousedown",
|
|
36
|
+
return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
30
37
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return /* @__PURE__ */ l("div", { className: "bear-absolute bear-z-50 bear-mt-1 bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3 bear-w-72", children: [
|
|
42
|
-
/* @__PURE__ */ l("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-3", children: [
|
|
43
|
-
/* @__PURE__ */ t("button", { onClick: F, className: "bear-p-1 bear-rounded hover:bear-bg-zinc-700 bear-text-zinc-400", children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
|
|
44
|
-
/* @__PURE__ */ l("span", { className: "bear-font-medium bear-text-white", children: [
|
|
45
|
-
H[o],
|
|
46
|
-
" ",
|
|
47
|
-
s
|
|
48
|
-
] }),
|
|
49
|
-
/* @__PURE__ */ t("button", { onClick: L, className: "bear-p-1 bear-rounded hover:bear-bg-zinc-700 bear-text-zinc-400", children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })
|
|
50
|
-
] }),
|
|
51
|
-
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-1 bear-mb-2", children: J.map((a) => /* @__PURE__ */ t("div", { className: "bear-text-center bear-text-xs bear-text-zinc-500 bear-font-medium", children: a }, a)) }),
|
|
52
|
-
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-1", children: h.map((a, A) => a === null ? /* @__PURE__ */ t("div", {}, `empty-${A}`) : /* @__PURE__ */ t(
|
|
53
|
-
"button",
|
|
54
|
-
{
|
|
55
|
-
onClick: () => S(a),
|
|
56
|
-
disabled: D(a),
|
|
57
|
-
className: p(
|
|
58
|
-
"bear-w-8 bear-h-8 bear-rounded bear-text-sm bear-transition-colors",
|
|
59
|
-
R(e ?? null, new Date(s, o, a)) ? "bear-bg-pink-500 bear-text-white" : "bear-text-zinc-300 hover:bear-bg-zinc-700",
|
|
60
|
-
D(a) && "bear-opacity-30 bear-cursor-not-allowed"
|
|
61
|
-
),
|
|
62
|
-
children: a
|
|
63
|
-
},
|
|
64
|
-
a
|
|
65
|
-
)) }),
|
|
66
|
-
v && e && /* @__PURE__ */ t(
|
|
67
|
-
"button",
|
|
68
|
-
{
|
|
69
|
-
onClick: () => {
|
|
70
|
-
r == null || r(null), u(!1);
|
|
71
|
-
},
|
|
72
|
-
className: "bear-w-full bear-mt-3 bear-py-1.5 bear-text-sm bear-text-zinc-400 hover:bear-text-white bear-border-t bear-border-zinc-700",
|
|
73
|
-
children: "Clear"
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
] });
|
|
77
|
-
}, O = { sm: "bear-py-1.5 bear-px-3 bear-text-sm", md: "bear-py-2 bear-px-4", lg: "bear-py-2.5 bear-px-5 bear-text-lg" }, C = {
|
|
38
|
+
const R = c(
|
|
39
|
+
(r) => {
|
|
40
|
+
e == null || e(r), s(!1);
|
|
41
|
+
},
|
|
42
|
+
[e]
|
|
43
|
+
), H = c(() => {
|
|
44
|
+
e == null || e(null), s(!1);
|
|
45
|
+
}, [e]), I = c((r) => {
|
|
46
|
+
E(r);
|
|
47
|
+
}, []), P = { sm: "bear-py-1.5 bear-px-3 bear-text-sm", md: "bear-py-2 bear-px-4", lg: "bear-py-2.5 bear-px-5 bear-text-lg" }, T = {
|
|
78
48
|
default: "bear-bg-zinc-800 bear-border-zinc-600",
|
|
79
49
|
filled: "bear-bg-zinc-700 bear-border-transparent",
|
|
80
50
|
outline: "bear-bg-transparent bear-border-zinc-500"
|
|
81
51
|
};
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ u("div", { ref: n, className: p("bear-relative", v), style: Object.keys(m).length ? m : void 0, children: [
|
|
53
|
+
o && /* @__PURE__ */ t("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5", children: o }),
|
|
54
|
+
/* @__PURE__ */ u(
|
|
85
55
|
"button",
|
|
86
56
|
{
|
|
87
57
|
type: "button",
|
|
88
|
-
onClick: () => !b &&
|
|
58
|
+
onClick: () => !b && s(!d),
|
|
89
59
|
disabled: b,
|
|
90
60
|
className: p(
|
|
91
61
|
"bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",
|
|
92
|
-
O
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
P[O],
|
|
63
|
+
T[Y],
|
|
64
|
+
l ? "bear-border-red-500" : "focus:bear-border-pink-500",
|
|
95
65
|
b && "bear-opacity-50 bear-cursor-not-allowed",
|
|
96
|
-
|
|
66
|
+
a ? "bear-text-white" : "bear-text-zinc-500"
|
|
97
67
|
),
|
|
98
68
|
children: [
|
|
99
|
-
/* @__PURE__ */ t("span", { children:
|
|
100
|
-
/* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5 bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
69
|
+
/* @__PURE__ */ t("span", { children: a ? J(a, y) : k }),
|
|
70
|
+
/* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5 bear-text-zinc-400 bear-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
101
71
|
]
|
|
102
72
|
}
|
|
103
73
|
),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
l && /* @__PURE__ */ t("p", { className: "bear-mt-1 bear-text-xs bear-text-red-400", children: l }),
|
|
75
|
+
i && !l && /* @__PURE__ */ t("p", { className: "bear-mt-1 bear-text-xs bear-text-zinc-500", children: i }),
|
|
76
|
+
d && /* @__PURE__ */ t(
|
|
77
|
+
F,
|
|
78
|
+
{
|
|
79
|
+
viewDate: B,
|
|
80
|
+
onViewChange: I,
|
|
81
|
+
value: a ?? null,
|
|
82
|
+
onSelect: R,
|
|
83
|
+
minDate: x,
|
|
84
|
+
maxDate: w,
|
|
85
|
+
disabledDates: V,
|
|
86
|
+
highlightedDates: h,
|
|
87
|
+
slots: j,
|
|
88
|
+
weekdayLabels: L,
|
|
89
|
+
firstDayOfWeek: M,
|
|
90
|
+
showWeekNumbers: S,
|
|
91
|
+
clearable: z,
|
|
92
|
+
onClear: H,
|
|
93
|
+
showTodayButton: !0,
|
|
94
|
+
onToday: () => {
|
|
95
|
+
e == null || e(/* @__PURE__ */ new Date()), s(!1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
)
|
|
107
99
|
] });
|
|
108
100
|
};
|
|
109
101
|
export {
|
|
110
|
-
|
|
102
|
+
$ as DatePicker
|
|
111
103
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { CalendarSlots } from '../Calendar/Calendar.types';
|
|
3
|
+
import { BisProp } from '../../types/bis.types';
|
|
2
4
|
export interface DatePickerProps {
|
|
3
5
|
value?: Date | null;
|
|
4
6
|
onChange?: (date: Date | null) => void;
|
|
@@ -16,9 +18,16 @@ export interface DatePickerProps {
|
|
|
16
18
|
rangeValue?: [Date | null, Date | null];
|
|
17
19
|
clearable?: boolean;
|
|
18
20
|
className?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
/** Bear Inner Style - sx-like overrides */
|
|
23
|
+
bis?: BisProp;
|
|
19
24
|
showWeekNumbers?: boolean;
|
|
20
25
|
disabledDates?: Date[];
|
|
21
26
|
highlightedDates?: Date[];
|
|
27
|
+
/** Customize calendar via slots (header, day, nav, etc.) */
|
|
28
|
+
slots?: CalendarSlots;
|
|
29
|
+
weekdayLabels?: string[];
|
|
30
|
+
firstDayOfWeek?: number;
|
|
22
31
|
size?: 'sm' | 'md' | 'lg';
|
|
23
32
|
variant?: 'default' | 'filled' | 'outline';
|
|
24
33
|
leftIcon?: ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a="MM/DD/YYYY";function c(t,e=a){if(!t)return"";const r=t.getDate().toString().padStart(2,"0"),o=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getFullYear().toString();return e.replace("DD",r).replace("MM",o).replace("YYYY",n)}exports.formatDate=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatDate(date: Date | null, format?: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const Y = "MM/DD/YYYY";
|
|
2
|
+
function a(t, r = Y) {
|
|
3
|
+
if (!t) return "";
|
|
4
|
+
const e = t.getDate().toString().padStart(2, "0"), n = (t.getMonth() + 1).toString().padStart(2, "0"), o = t.getFullYear().toString();
|
|
5
|
+
return r.replace("DD", e).replace("MM", n).replace("YYYY", o);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
a as formatDate
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),re=require("../Calendar/Calendar.cjs"),d=require("../../utils/cn.cjs"),te=require("../../hooks/useBearStyles.cjs"),D=require("./DateTimePicker.utils.cjs"),ae=({value:n,onChange:b,minDate:M,maxDate:S,disabled:m=!1,placeholder:C="Select date and time",label:j,error:u,helperText:y,dateFormat:H="MM/DD/YYYY",timeFormat:l="12h",minuteStep:g=5,clearable:P=!0,className:T,style:q,bis:A,slots:V,weekdayLabels:O,firstDayOfWeek:B=0,size:E="md",variant:L="default"})=>{const[f,x]=s.useState(!1),[R,N]=s.useState(n??new Date),[o,c]=s.useState(()=>n??new Date),h=s.useRef(null),v=te.useBearStyles(A,q);s.useEffect(()=>{const e=t=>{h.current&&!h.current.contains(t.target)&&x(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),s.useEffect(()=>{c(n?new Date(n):new Date)},[n,f]);const Y=s.useCallback(e=>{c(t=>{const a=new Date(e);return a.setHours(t.getHours(),t.getMinutes(),0,0),a})},[]),_=s.useCallback(()=>{b==null||b(o),x(!1)},[o,b]),$=s.useCallback(()=>{b==null||b(null),x(!1)},[b]),I=s.useCallback(()=>{const e=new Date;c(e),N(e)},[]),W=s.useCallback(e=>N(e),[]),G=l==="12h"?Array.from({length:12},(e,t)=>t+1):Array.from({length:24},(e,t)=>t),p=Array.from({length:60/g},(e,t)=>t*g),w=o.getHours(),k=o.getMinutes(),J=l==="12h"?w%12||12:w,K=p.includes(k)?k:p[0]??0,z=w>=12?"PM":"AM",Q=e=>{const t=l==="12h"?z==="PM"?e===12?12:e+12:e===12?0:e:e;c(a=>{const i=new Date(a);return i.setHours(t,a.getMinutes(),0,0),i})},U=e=>{c(t=>{const a=new Date(t);return a.setMinutes(e,0,0),a})},X=e=>{c(t=>{const a=new Date(t),i=a.getHours();return e==="PM"&&i<12?a.setHours(i+12):e==="AM"&&i>=12&&a.setHours(i-12),a})},Z={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4",lg:"bear-py-2.5 bear-px-5 bear-text-lg"},F={default:"bear-bg-zinc-800 bear-border-zinc-600",filled:"bear-bg-zinc-700 bear-border-transparent",outline:"bear-bg-transparent bear-border-zinc-500"},ee=n?`${D.formatDate(n,H)} ${D.formatTime(n,l)}`:"";return r.jsxs("div",{ref:h,className:d.cn("bear-relative",T),style:Object.keys(v).length?v:void 0,children:[j&&r.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5",children:j}),r.jsxs("button",{type:"button",onClick:()=>!m&&x(!f),disabled:m,className:d.cn("bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",Z[E],F[L],u?"bear-border-red-500":"focus:bear-border-pink-500",m&&"bear-opacity-50 bear-cursor-not-allowed",n?"bear-text-white":"bear-text-zinc-500"),children:[r.jsx("span",{children:ee||C}),r.jsx("svg",{className:"bear-w-5 bear-h-5 bear-text-zinc-400 bear-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})]}),u&&r.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-red-400",children:u}),y&&!u&&r.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-zinc-500",children:y}),f&&r.jsxs("div",{className:"bear-absolute bear-z-50 bear-mt-2 bear-left-0 bear-right-0 bear-bg-white bear-rounded-xl bear-shadow-xl bear-border bear-border-zinc-200 bear-overflow-hidden bear-w-full bear-max-w-sm",children:[r.jsx(re.Calendar,{inline:!0,viewDate:R,onViewChange:W,value:o,onSelect:Y,minDate:M,maxDate:S,slots:V,weekdayLabels:O,firstDayOfWeek:B,clearable:!1,showTodayButton:!1}),r.jsxs("div",{className:"bear-px-4 bear-pb-3 bear-pt-2 bear-border-t bear-border-zinc-200",children:[r.jsxs("div",{className:"bear-flex bear-gap-2 bear-mb-3",children:[r.jsxs("div",{className:"bear-flex-1",children:[r.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Hour"}),r.jsx("div",{className:"bear-h-24 bear-overflow-y-auto bear-space-y-0.5 bear-scrollbar-thin",children:G.map(e=>r.jsx("button",{type:"button",onClick:()=>Q(e),className:d.cn("bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",J===e?"bear-bg-bear-500 bear-text-white":"bear-text-zinc-700 hover:bear-bg-zinc-100"),children:e.toString().padStart(2,"0")},e))})]}),r.jsxs("div",{className:"bear-flex-1",children:[r.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Minute"}),r.jsx("div",{className:"bear-h-24 bear-overflow-y-auto bear-space-y-0.5 bear-scrollbar-thin",children:p.map(e=>r.jsx("button",{type:"button",onClick:()=>U(e),className:d.cn("bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",K===e?"bear-bg-bear-500 bear-text-white":"bear-text-zinc-700 hover:bear-bg-zinc-100"),children:e.toString().padStart(2,"0")},e))})]}),l==="12h"&&r.jsxs("div",{className:"bear-flex-1",children:[r.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Period"}),r.jsx("div",{className:"bear-space-y-0.5",children:["AM","PM"].map(e=>r.jsx("button",{type:"button",onClick:()=>X(e),className:d.cn("bear-w-full bear-py-2 bear-rounded bear-text-sm bear-transition-colors",z===e?"bear-bg-bear-500 bear-text-white":"bear-text-zinc-700 hover:bear-bg-zinc-100"),children:e},e))})]})]}),r.jsxs("div",{className:"bear-flex bear-gap-2 bear-justify-between",children:[P&&n?r.jsx("button",{type:"button",onClick:$,className:"bear-text-sm bear-text-zinc-500 hover:bear-text-zinc-700",children:"Clear"}):r.jsx("span",{}),r.jsxs("div",{className:"bear-flex bear-gap-2",children:[r.jsx("button",{type:"button",onClick:I,className:"bear-text-sm bear-text-bear-600 hover:bear-text-bear-700 bear-font-medium",children:"Today"}),r.jsx("button",{type:"button",onClick:_,className:"bear-text-sm bear-bg-bear-500 bear-text-white bear-px-3 bear-py-1 bear-rounded bear-font-medium hover:bear-bg-bear-600",children:"Confirm"})]})]})]})]})]})};exports.DateTimePicker=ae;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsxs as b, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as ae, useEffect as S, useCallback as d } from "react";
|
|
3
|
+
import { Calendar as ne } from "../Calendar/Calendar.js";
|
|
4
|
+
import { cn as u } from "../../utils/cn.js";
|
|
5
|
+
import { useBearStyles as be } from "../../hooks/useBearStyles.js";
|
|
6
|
+
import { formatDate as se, formatTime as oe } from "./DateTimePicker.utils.js";
|
|
7
|
+
const xe = ({
|
|
8
|
+
value: n,
|
|
9
|
+
onChange: s,
|
|
10
|
+
minDate: C,
|
|
11
|
+
maxDate: P,
|
|
12
|
+
disabled: f = !1,
|
|
13
|
+
placeholder: j = "Select date and time",
|
|
14
|
+
label: g,
|
|
15
|
+
error: m,
|
|
16
|
+
helperText: v,
|
|
17
|
+
dateFormat: A = "MM/DD/YYYY",
|
|
18
|
+
timeFormat: i = "12h",
|
|
19
|
+
minuteStep: z = 5,
|
|
20
|
+
clearable: V = !0,
|
|
21
|
+
className: L,
|
|
22
|
+
style: O,
|
|
23
|
+
bis: T,
|
|
24
|
+
slots: Y,
|
|
25
|
+
weekdayLabels: B,
|
|
26
|
+
firstDayOfWeek: E = 0,
|
|
27
|
+
size: _ = "md",
|
|
28
|
+
variant: R = "default"
|
|
29
|
+
}) => {
|
|
30
|
+
const [h, x] = N(!1), [$, k] = N(n ?? /* @__PURE__ */ new Date()), [l, o] = N(() => n ?? /* @__PURE__ */ new Date()), p = ae(null), M = be(T, O);
|
|
31
|
+
S(() => {
|
|
32
|
+
const e = (t) => {
|
|
33
|
+
p.current && !p.current.contains(t.target) && x(!1);
|
|
34
|
+
};
|
|
35
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
36
|
+
}, []), S(() => {
|
|
37
|
+
o(n ? new Date(n) : /* @__PURE__ */ new Date());
|
|
38
|
+
}, [n, h]);
|
|
39
|
+
const I = d((e) => {
|
|
40
|
+
o((t) => {
|
|
41
|
+
const a = new Date(e);
|
|
42
|
+
return a.setHours(t.getHours(), t.getMinutes(), 0, 0), a;
|
|
43
|
+
});
|
|
44
|
+
}, []), W = d(() => {
|
|
45
|
+
s == null || s(l), x(!1);
|
|
46
|
+
}, [l, s]), q = d(() => {
|
|
47
|
+
s == null || s(null), x(!1);
|
|
48
|
+
}, [s]), G = d(() => {
|
|
49
|
+
const e = /* @__PURE__ */ new Date();
|
|
50
|
+
o(e), k(e);
|
|
51
|
+
}, []), J = d((e) => k(e), []), K = i === "12h" ? Array.from({ length: 12 }, (e, t) => t + 1) : Array.from({ length: 24 }, (e, t) => t), w = Array.from({ length: 60 / z }, (e, t) => t * z), y = l.getHours(), D = l.getMinutes(), Q = i === "12h" ? y % 12 || 12 : y, U = w.includes(D) ? D : w[0] ?? 0, H = y >= 12 ? "PM" : "AM", X = (e) => {
|
|
52
|
+
const t = i === "12h" ? H === "PM" ? e === 12 ? 12 : e + 12 : e === 12 ? 0 : e : e;
|
|
53
|
+
o((a) => {
|
|
54
|
+
const c = new Date(a);
|
|
55
|
+
return c.setHours(t, a.getMinutes(), 0, 0), c;
|
|
56
|
+
});
|
|
57
|
+
}, Z = (e) => {
|
|
58
|
+
o((t) => {
|
|
59
|
+
const a = new Date(t);
|
|
60
|
+
return a.setMinutes(e, 0, 0), a;
|
|
61
|
+
});
|
|
62
|
+
}, F = (e) => {
|
|
63
|
+
o((t) => {
|
|
64
|
+
const a = new Date(t), c = a.getHours();
|
|
65
|
+
return e === "PM" && c < 12 ? a.setHours(c + 12) : e === "AM" && c >= 12 && a.setHours(c - 12), a;
|
|
66
|
+
});
|
|
67
|
+
}, ee = { sm: "bear-py-1.5 bear-px-3 bear-text-sm", md: "bear-py-2 bear-px-4", lg: "bear-py-2.5 bear-px-5 bear-text-lg" }, re = {
|
|
68
|
+
default: "bear-bg-zinc-800 bear-border-zinc-600",
|
|
69
|
+
filled: "bear-bg-zinc-700 bear-border-transparent",
|
|
70
|
+
outline: "bear-bg-transparent bear-border-zinc-500"
|
|
71
|
+
}, te = n ? `${se(n, A)} ${oe(n, i)}` : "";
|
|
72
|
+
return /* @__PURE__ */ b("div", { ref: p, className: u("bear-relative", L), style: Object.keys(M).length ? M : void 0, children: [
|
|
73
|
+
g && /* @__PURE__ */ r("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5", children: g }),
|
|
74
|
+
/* @__PURE__ */ b(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
type: "button",
|
|
78
|
+
onClick: () => !f && x(!h),
|
|
79
|
+
disabled: f,
|
|
80
|
+
className: u(
|
|
81
|
+
"bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",
|
|
82
|
+
ee[_],
|
|
83
|
+
re[R],
|
|
84
|
+
m ? "bear-border-red-500" : "focus:bear-border-pink-500",
|
|
85
|
+
f && "bear-opacity-50 bear-cursor-not-allowed",
|
|
86
|
+
n ? "bear-text-white" : "bear-text-zinc-500"
|
|
87
|
+
),
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ r("span", { children: te || j }),
|
|
90
|
+
/* @__PURE__ */ r("svg", { className: "bear-w-5 bear-h-5 bear-text-zinc-400 bear-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
m && /* @__PURE__ */ r("p", { className: "bear-mt-1 bear-text-xs bear-text-red-400", children: m }),
|
|
95
|
+
v && !m && /* @__PURE__ */ r("p", { className: "bear-mt-1 bear-text-xs bear-text-zinc-500", children: v }),
|
|
96
|
+
h && /* @__PURE__ */ b("div", { className: "bear-absolute bear-z-50 bear-mt-2 bear-left-0 bear-right-0 bear-bg-white bear-rounded-xl bear-shadow-xl bear-border bear-border-zinc-200 bear-overflow-hidden bear-w-full bear-max-w-sm", children: [
|
|
97
|
+
/* @__PURE__ */ r(
|
|
98
|
+
ne,
|
|
99
|
+
{
|
|
100
|
+
inline: !0,
|
|
101
|
+
viewDate: $,
|
|
102
|
+
onViewChange: J,
|
|
103
|
+
value: l,
|
|
104
|
+
onSelect: I,
|
|
105
|
+
minDate: C,
|
|
106
|
+
maxDate: P,
|
|
107
|
+
slots: Y,
|
|
108
|
+
weekdayLabels: B,
|
|
109
|
+
firstDayOfWeek: E,
|
|
110
|
+
clearable: !1,
|
|
111
|
+
showTodayButton: !1
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ b("div", { className: "bear-px-4 bear-pb-3 bear-pt-2 bear-border-t bear-border-zinc-200", children: [
|
|
115
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-gap-2 bear-mb-3", children: [
|
|
116
|
+
/* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
117
|
+
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Hour" }),
|
|
118
|
+
/* @__PURE__ */ r("div", { className: "bear-h-24 bear-overflow-y-auto bear-space-y-0.5 bear-scrollbar-thin", children: K.map((e) => /* @__PURE__ */ r(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: () => X(e),
|
|
123
|
+
className: u(
|
|
124
|
+
"bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",
|
|
125
|
+
Q === e ? "bear-bg-bear-500 bear-text-white" : "bear-text-zinc-700 hover:bear-bg-zinc-100"
|
|
126
|
+
),
|
|
127
|
+
children: e.toString().padStart(2, "0")
|
|
128
|
+
},
|
|
129
|
+
e
|
|
130
|
+
)) })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
133
|
+
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Minute" }),
|
|
134
|
+
/* @__PURE__ */ r("div", { className: "bear-h-24 bear-overflow-y-auto bear-space-y-0.5 bear-scrollbar-thin", children: w.map((e) => /* @__PURE__ */ r(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
type: "button",
|
|
138
|
+
onClick: () => Z(e),
|
|
139
|
+
className: u(
|
|
140
|
+
"bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",
|
|
141
|
+
U === e ? "bear-bg-bear-500 bear-text-white" : "bear-text-zinc-700 hover:bear-bg-zinc-100"
|
|
142
|
+
),
|
|
143
|
+
children: e.toString().padStart(2, "0")
|
|
144
|
+
},
|
|
145
|
+
e
|
|
146
|
+
)) })
|
|
147
|
+
] }),
|
|
148
|
+
i === "12h" && /* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
149
|
+
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Period" }),
|
|
150
|
+
/* @__PURE__ */ r("div", { className: "bear-space-y-0.5", children: ["AM", "PM"].map((e) => /* @__PURE__ */ r(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
onClick: () => F(e),
|
|
155
|
+
className: u(
|
|
156
|
+
"bear-w-full bear-py-2 bear-rounded bear-text-sm bear-transition-colors",
|
|
157
|
+
H === e ? "bear-bg-bear-500 bear-text-white" : "bear-text-zinc-700 hover:bear-bg-zinc-100"
|
|
158
|
+
),
|
|
159
|
+
children: e
|
|
160
|
+
},
|
|
161
|
+
e
|
|
162
|
+
)) })
|
|
163
|
+
] })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-gap-2 bear-justify-between", children: [
|
|
166
|
+
V && n ? /* @__PURE__ */ r("button", { type: "button", onClick: q, className: "bear-text-sm bear-text-zinc-500 hover:bear-text-zinc-700", children: "Clear" }) : /* @__PURE__ */ r("span", {}),
|
|
167
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-gap-2", children: [
|
|
168
|
+
/* @__PURE__ */ r("button", { type: "button", onClick: G, className: "bear-text-sm bear-text-bear-600 hover:bear-text-bear-700 bear-font-medium", children: "Today" }),
|
|
169
|
+
/* @__PURE__ */ r("button", { type: "button", onClick: W, className: "bear-text-sm bear-bg-bear-500 bear-text-white bear-px-3 bear-py-1 bear-rounded bear-font-medium hover:bear-bg-bear-600", children: "Confirm" })
|
|
170
|
+
] })
|
|
171
|
+
] })
|
|
172
|
+
] })
|
|
173
|
+
] })
|
|
174
|
+
] });
|
|
175
|
+
};
|
|
176
|
+
export {
|
|
177
|
+
xe as DateTimePicker
|
|
178
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CalendarSlots } from '../Calendar/Calendar.types';
|
|
2
|
+
import { BisProp } from '../../types/bis.types';
|
|
3
|
+
export interface DateTimePickerProps {
|
|
4
|
+
value?: Date | null;
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
minDate?: Date;
|
|
7
|
+
maxDate?: Date;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
helperText?: string;
|
|
13
|
+
dateFormat?: string;
|
|
14
|
+
timeFormat?: '12h' | '24h';
|
|
15
|
+
minuteStep?: number;
|
|
16
|
+
clearable?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
bis?: BisProp;
|
|
20
|
+
/** Calendar slot overrides */
|
|
21
|
+
slots?: CalendarSlots;
|
|
22
|
+
weekdayLabels?: string[];
|
|
23
|
+
firstDayOfWeek?: number;
|
|
24
|
+
size?: 'sm' | 'md' | 'lg';
|
|
25
|
+
variant?: 'default' | 'filled' | 'outline';
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a="MM/DD/YYYY";function i(t,n=a){if(!t)return"";const r=t.getDate().toString().padStart(2,"0"),e=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getFullYear().toString();return n.replace("DD",r).replace("MM",e).replace("YYYY",o)}function c(t,n){const r=t.getHours(),e=t.getMinutes();if(n==="24h")return`${r.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`;const o=r>=12?"PM":"AM";return`${(r%12||12).toString().padStart(2,"0")}:${e.toString().padStart(2,"0")} ${o}`}exports.formatDate=i;exports.formatTime=c;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const e = "MM/DD/YYYY";
|
|
2
|
+
function i(t, o = e) {
|
|
3
|
+
if (!t) return "";
|
|
4
|
+
const r = t.getDate().toString().padStart(2, "0"), n = (t.getMonth() + 1).toString().padStart(2, "0"), a = t.getFullYear().toString();
|
|
5
|
+
return o.replace("DD", r).replace("MM", n).replace("YYYY", a);
|
|
6
|
+
}
|
|
7
|
+
function S(t, o) {
|
|
8
|
+
const r = t.getHours(), n = t.getMinutes();
|
|
9
|
+
if (o === "24h") return `${r.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
|
|
10
|
+
const a = r >= 12 ? "PM" : "AM";
|
|
11
|
+
return `${(r % 12 || 12).toString().padStart(2, "0")}:${n.toString().padStart(2, "0")} ${a}`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
i as formatDate,
|
|
15
|
+
S as formatTime
|
|
16
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../../utils/cn.cjs"),l={solid:"bear-border-solid",dashed:"bear-border-dashed",dotted:"bear-border-dotted"},u={left:"before:bear-w-4 after:bear-flex-1",center:"before:bear-flex-1 after:bear-flex-1",right:"before:bear-flex-1 after:bear-w-4"},c=({children:i,orientation:n="horizontal",variant:b="solid",color:d,textAlign:x="center",thickness:r=1,spacing:a=4,className:s,testId:f,style:m,...h})=>{const e=n==="horizontal";return i?o.jsxs("div",{className:t.cn("bear-flex bear-items-center bear-gap-4",e?"bear-w-full":"bear-flex-col bear-h-full",u[x],s),role:"separator",style:{marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,...m},"data-testid":f,children:[o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}}),o.jsx("span",{className:"bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2",children:i}),o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}})]}):o.jsx("hr",{className:t.cn("bear-border-0",e?"bear-w-full":"bear-h-full bear-w-px",l[b],s),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb",marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,marginLeft:e?0:`${a*.25}rem`,marginRight:e?0:`${a*.25}rem`,...m},"data-testid":f,...h})};exports.Divider=c;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { cn as t } from "../../utils/cn.js";
|
|
3
3
|
const l = {
|
|
4
|
-
solid: "
|
|
5
|
-
dashed: "
|
|
6
|
-
dotted: "
|
|
4
|
+
solid: "bear-border-solid",
|
|
5
|
+
dashed: "bear-border-dashed",
|
|
6
|
+
dotted: "bear-border-dotted"
|
|
7
7
|
}, T = {
|
|
8
|
-
left: "before:
|
|
9
|
-
center: "before:
|
|
10
|
-
right: "before:
|
|
8
|
+
left: "before:bear-w-4 after:bear-flex-1",
|
|
9
|
+
center: "before:bear-flex-1 after:bear-flex-1",
|
|
10
|
+
right: "before:bear-flex-1 after:bear-w-4"
|
|
11
11
|
}, u = ({
|
|
12
|
-
children:
|
|
12
|
+
children: f,
|
|
13
13
|
orientation: x = "horizontal",
|
|
14
14
|
variant: b = "solid",
|
|
15
15
|
color: d,
|
|
16
16
|
textAlign: h = "center",
|
|
17
17
|
thickness: r = 1,
|
|
18
|
-
spacing:
|
|
19
|
-
className:
|
|
18
|
+
spacing: a = 4,
|
|
19
|
+
className: m,
|
|
20
20
|
testId: i,
|
|
21
21
|
style: s,
|
|
22
22
|
...n
|
|
23
23
|
}) => {
|
|
24
24
|
const e = x === "horizontal";
|
|
25
|
-
return
|
|
25
|
+
return f ? /* @__PURE__ */ p(
|
|
26
26
|
"div",
|
|
27
27
|
{
|
|
28
28
|
className: t(
|
|
29
|
-
"
|
|
30
|
-
e ? "
|
|
29
|
+
"bear-flex bear-items-center bear-gap-4",
|
|
30
|
+
e ? "bear-w-full" : "bear-flex-col bear-h-full",
|
|
31
31
|
T[h],
|
|
32
|
-
|
|
32
|
+
m
|
|
33
33
|
),
|
|
34
34
|
role: "separator",
|
|
35
35
|
style: {
|
|
36
|
-
marginTop: e ? `${
|
|
37
|
-
marginBottom: e ? `${
|
|
36
|
+
marginTop: e ? `${a * 0.25}rem` : 0,
|
|
37
|
+
marginBottom: e ? `${a * 0.25}rem` : 0,
|
|
38
38
|
...s
|
|
39
39
|
},
|
|
40
40
|
"data-testid": i,
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ o(
|
|
43
43
|
"span",
|
|
44
44
|
{
|
|
45
45
|
className: t(
|
|
46
|
-
"
|
|
46
|
+
"bear-flex-shrink-0",
|
|
47
47
|
l[b]
|
|
48
48
|
),
|
|
49
49
|
style: {
|
|
@@ -53,12 +53,12 @@ const l = {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ o("span", { className: "bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2", children: f }),
|
|
57
|
+
/* @__PURE__ */ o(
|
|
58
58
|
"span",
|
|
59
59
|
{
|
|
60
60
|
className: t(
|
|
61
|
-
"
|
|
61
|
+
"bear-flex-shrink-0",
|
|
62
62
|
l[b]
|
|
63
63
|
),
|
|
64
64
|
style: {
|
|
@@ -70,23 +70,23 @@ const l = {
|
|
|
70
70
|
)
|
|
71
71
|
]
|
|
72
72
|
}
|
|
73
|
-
) : /* @__PURE__ */
|
|
73
|
+
) : /* @__PURE__ */ o(
|
|
74
74
|
"hr",
|
|
75
75
|
{
|
|
76
76
|
className: t(
|
|
77
|
-
"
|
|
78
|
-
e ? "
|
|
77
|
+
"bear-border-0",
|
|
78
|
+
e ? "bear-w-full" : "bear-h-full bear-w-px",
|
|
79
79
|
l[b],
|
|
80
|
-
|
|
80
|
+
m
|
|
81
81
|
),
|
|
82
82
|
style: {
|
|
83
83
|
borderTopWidth: e ? r : 0,
|
|
84
84
|
borderLeftWidth: e ? 0 : r,
|
|
85
85
|
borderColor: d || "#e5e7eb",
|
|
86
|
-
marginTop: e ? `${
|
|
87
|
-
marginBottom: e ? `${
|
|
88
|
-
marginLeft: e ? 0 : `${
|
|
89
|
-
marginRight: e ? 0 : `${
|
|
86
|
+
marginTop: e ? `${a * 0.25}rem` : 0,
|
|
87
|
+
marginBottom: e ? `${a * 0.25}rem` : 0,
|
|
88
|
+
marginLeft: e ? 0 : `${a * 0.25}rem`,
|
|
89
|
+
marginRight: e ? 0 : `${a * 0.25}rem`,
|
|
90
90
|
...s
|
|
91
91
|
},
|
|
92
92
|
"data-testid": i,
|