@forgedevstack/bear 1.0.5 → 1.0.7
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/BottomSheet/BottomSheet.cjs +1 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +3 -0
- package/dist/components/BottomSheet/BottomSheet.js +102 -0
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +13 -0
- package/dist/components/BottomSheet/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.js +40 -38
- package/dist/components/Button/Button.types.d.ts +4 -0
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.const.cjs +1 -1
- package/dist/components/Calendar/Calendar.const.d.ts +1 -0
- package/dist/components/Calendar/Calendar.const.js +6 -5
- package/dist/components/Calendar/Calendar.helpers.cjs +1 -1
- package/dist/components/Calendar/Calendar.helpers.js +4 -4
- package/dist/components/Calendar/Calendar.js +128 -128
- package/dist/components/Cascader/Cascader.cjs +1 -0
- package/dist/components/Cascader/Cascader.const.cjs +1 -0
- package/dist/components/Cascader/Cascader.const.d.ts +33 -0
- package/dist/components/Cascader/Cascader.const.js +21 -0
- package/dist/components/Cascader/Cascader.d.ts +17 -0
- package/dist/components/Cascader/Cascader.js +227 -0
- package/dist/components/Cascader/Cascader.types.d.ts +94 -0
- package/dist/components/Cascader/index.d.ts +2 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.const.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.const.d.ts +25 -0
- package/dist/components/CommandPalette/CommandPalette.const.js +13 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +18 -0
- package/dist/components/CommandPalette/CommandPalette.js +190 -0
- package/dist/components/CommandPalette/CommandPalette.types.d.ts +90 -0
- package/dist/components/CommandPalette/CommandPalette.utils.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.utils.d.ts +17 -0
- package/dist/components/CommandPalette/CommandPalette.utils.js +63 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/CreditInput/CreditInput.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.const.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.const.d.ts +37 -0
- package/dist/components/CreditInput/CreditInput.const.js +66 -0
- package/dist/components/CreditInput/CreditInput.d.ts +15 -0
- package/dist/components/CreditInput/CreditInput.js +214 -0
- package/dist/components/CreditInput/CreditInput.types.d.ts +93 -0
- package/dist/components/CreditInput/CreditInput.utils.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.utils.d.ts +48 -0
- package/dist/components/CreditInput/CreditInput.utils.js +79 -0
- package/dist/components/CreditInput/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +108 -84
- package/dist/components/DatePicker/DatePicker.types.d.ts +2 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +75 -44
- package/dist/components/EmojiPicker/EmojiPicker.cjs +1 -0
- package/dist/components/EmojiPicker/EmojiPicker.const.cjs +1 -0
- package/dist/components/EmojiPicker/EmojiPicker.const.d.ts +5 -0
- package/dist/components/EmojiPicker/EmojiPicker.const.js +10 -0
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +3 -0
- package/dist/components/EmojiPicker/EmojiPicker.js +63 -0
- package/dist/components/EmojiPicker/EmojiPicker.types.d.ts +6 -0
- package/dist/components/EmojiPicker/index.d.ts +3 -0
- package/dist/components/Form/Form.cjs +1 -0
- package/dist/components/Form/Form.const.cjs +1 -0
- package/dist/components/Form/Form.const.d.ts +33 -0
- package/dist/components/Form/Form.const.js +27 -0
- package/dist/components/Form/Form.context.cjs +1 -0
- package/dist/components/Form/Form.context.d.ts +13 -0
- package/dist/components/Form/Form.context.js +12 -0
- package/dist/components/Form/Form.d.ts +18 -0
- package/dist/components/Form/Form.js +230 -0
- package/dist/components/Form/Form.types.d.ts +166 -0
- package/dist/components/Form/Form.utils.cjs +1 -0
- package/dist/components/Form/Form.utils.d.ts +17 -0
- package/dist/components/Form/Form.utils.js +31 -0
- package/dist/components/Form/index.d.ts +3 -0
- package/dist/components/Kanban/Kanban.cjs +1 -0
- package/dist/components/Kanban/Kanban.d.ts +3 -0
- package/dist/components/Kanban/Kanban.js +90 -0
- package/dist/components/Kanban/Kanban.types.d.ts +21 -0
- package/dist/components/Kanban/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.d.ts +3 -0
- package/dist/components/MentionsInput/MentionsInput.js +140 -0
- package/dist/components/MentionsInput/MentionsInput.types.d.ts +21 -0
- package/dist/components/MentionsInput/index.d.ts +2 -0
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +25 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.js +28 -0
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +15 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +223 -0
- package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +117 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.d.ts +11 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.js +19 -0
- package/dist/components/NotificationCenter/index.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +33 -0
- package/dist/components/PhoneInput/PhoneInput.const.js +82 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +16 -0
- package/dist/components/PhoneInput/PhoneInput.js +194 -0
- package/dist/components/PhoneInput/PhoneInput.types.d.ts +108 -0
- package/dist/components/PhoneInput/PhoneInput.utils.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.utils.d.ts +25 -0
- package/dist/components/PhoneInput/PhoneInput.utils.js +39 -0
- package/dist/components/PhoneInput/index.d.ts +2 -0
- package/dist/components/RichEditor/RichEditor.cjs +1 -1
- package/dist/components/RichEditor/RichEditor.const.cjs +2 -2
- package/dist/components/RichEditor/RichEditor.const.d.ts +4 -1
- package/dist/components/RichEditor/RichEditor.const.js +51 -18
- package/dist/components/RichEditor/RichEditor.js +106 -105
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +105 -95
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.d.ts +2 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +47 -29
- package/dist/components/SegmentedControl/SegmentedControl.cjs +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +58 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +16 -0
- package/dist/components/SegmentedControl/index.d.ts +2 -0
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +94 -86
- package/dist/components/SliderRange/SliderRange.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.d.ts +3 -0
- package/dist/components/SliderRange/SliderRange.js +142 -0
- package/dist/components/SliderRange/SliderRange.types.d.ts +17 -0
- package/dist/components/SliderRange/index.d.ts +2 -0
- package/dist/components/TagsInput/TagsInput.cjs +1 -0
- package/dist/components/TagsInput/TagsInput.d.ts +3 -0
- package/dist/components/TagsInput/TagsInput.js +100 -0
- package/dist/components/TagsInput/TagsInput.types.d.ts +16 -0
- package/dist/components/TagsInput/index.d.ts +2 -0
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.d.ts +22 -1
- package/dist/components/TimePicker/TimePicker.constants.js +36 -19
- package/dist/components/TimePicker/TimePicker.js +97 -131
- package/dist/components/TimePicker/TimePicker.types.d.ts +47 -6
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.d.ts +3 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +81 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/index.d.ts +1 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.d.ts +3 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +84 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/index.d.ts +1 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +18 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +67 -0
- package/dist/components/TimePicker/helpers/index.d.ts +2 -0
- package/dist/components/TimePicker/index.d.ts +1 -1
- package/dist/components/VirtualList/VirtualList.cjs +1 -0
- package/dist/components/VirtualList/VirtualList.d.ts +3 -0
- package/dist/components/VirtualList/VirtualList.js +68 -0
- package/dist/components/VirtualList/VirtualList.types.d.ts +10 -0
- package/dist/components/VirtualList/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +28 -2
- package/dist/components/index.js +177 -146
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +36 -32
- package/dist/hooks/useDragDrop/index.d.ts +2 -0
- package/dist/hooks/useDragDrop/useDragDrop.cjs +1 -0
- package/dist/hooks/useDragDrop/useDragDrop.d.ts +22 -0
- package/dist/hooks/useDragDrop/useDragDrop.js +56 -0
- package/dist/hooks/useDragDrop/useDragDrop.types.d.ts +55 -0
- package/dist/hooks/useLazyLoad/index.d.ts +2 -0
- package/dist/hooks/useLazyLoad/useLazyLoad.cjs +1 -0
- package/dist/hooks/useLazyLoad/useLazyLoad.d.ts +26 -0
- package/dist/hooks/useLazyLoad/useLazyLoad.js +27 -0
- package/dist/hooks/useLazyLoad/useLazyLoad.types.d.ts +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +290 -255
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.cjs +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -3
- package/dist/components/DateTimePicker/DateTimePicker.js +0 -178
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +0 -26
- package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +0 -2
- package/dist/components/DateTimePicker/DateTimePicker.utils.js +0 -16
- package/dist/components/DateTimePicker/index.d.ts +0 -2
|
@@ -1,146 +1,112 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { formatTime as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
import { jsx as a, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useRef as g, useEffect as z, useCallback as _, useMemo as ee } from "react";
|
|
3
|
+
import { cn as B } from "../../utils/cn.js";
|
|
4
|
+
import { useMediaQuery as te } from "../../hooks/useMediaQuery.js";
|
|
5
|
+
import { formatTime as re } from "./TimePicker.utils.js";
|
|
6
|
+
import { TIMEPICKER_DEFAULT_BREAKPOINT as ae, TIMEPICKER_VARIANT_COLUMNS as R, TIMEPICKER_FORMAT_12H as E, TIMEPICKER_HOURS_12H as oe, TIMEPICKER_HOURS_24H as ne, TIMEPICKER_MINUTES_DIVISOR as se, TIMEPICKER_VARIANT_DIAL as S, TIMEPICKER_LABEL_CLASSES as le, variantClasses as de, sizeClasses as ie, TIMEPICKER_BUTTON_CLASSES as ce, TIMEPICKER_ERROR_CLASSES as me, TIMEPICKER_HELPER_CLASSES as ue, TIMEPICKER_ROOT_CLASSES as Ee, TIMEPICKER_FORMAT_24H as fe, TIMEPICKER_VARIANT_AUTO as Ie } from "./TimePicker.constants.js";
|
|
7
|
+
import { TimePickerColumnsDropdown as pe } from "./components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js";
|
|
8
|
+
import { TimePickerDialDropdown as Ce } from "./components/TimePickerDialDropdown/TimePickerDialDropdown.js";
|
|
9
|
+
const Te = /* @__PURE__ */ a("svg", { className: "bear-w-5 bear-h-5 bear-text-gray-400 dark:bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }), ke = (e) => {
|
|
10
|
+
const F = {
|
|
11
|
+
value: e.value,
|
|
12
|
+
onChange: e.onChange,
|
|
13
|
+
disabled: e.disabled ?? !1,
|
|
14
|
+
placeholder: e.placeholder ?? "Select time",
|
|
15
|
+
label: e.label,
|
|
16
|
+
error: e.error,
|
|
17
|
+
helperText: e.helperText,
|
|
18
|
+
format: e.format ?? E,
|
|
19
|
+
minuteStep: e.minuteStep ?? 5,
|
|
20
|
+
clearable: e.clearable ?? !0,
|
|
21
|
+
className: e.className,
|
|
22
|
+
size: e.size ?? "md",
|
|
23
|
+
variant: e.variant ?? "default",
|
|
24
|
+
dropdownVariant: e.dropdownVariant ?? R,
|
|
25
|
+
dropdownVariantBreakpoint: e.dropdownVariantBreakpoint ?? ae,
|
|
26
|
+
icon: e.icon,
|
|
27
|
+
translations: e.translations
|
|
28
|
+
}, {
|
|
29
|
+
value: P,
|
|
30
|
+
onChange: n,
|
|
31
|
+
disabled: f,
|
|
32
|
+
placeholder: j,
|
|
33
|
+
label: b,
|
|
34
|
+
error: l,
|
|
35
|
+
helperText: h,
|
|
36
|
+
format: s,
|
|
37
|
+
minuteStep: I,
|
|
38
|
+
clearable: M,
|
|
39
|
+
className: W,
|
|
40
|
+
size: Q,
|
|
41
|
+
variant: $,
|
|
42
|
+
dropdownVariant: A,
|
|
43
|
+
dropdownVariantBreakpoint: q,
|
|
44
|
+
icon: G,
|
|
45
|
+
translations: N
|
|
46
|
+
} = F, J = te(`(min-width: ${q}px)`), k = A === Ie ? J ? S : R : A, v = k === S && s === fe ? R : k, r = P, [p, d] = u(!1), [i, w] = u(12), [c, L] = u(0), [m, O] = u("AM"), C = g(null);
|
|
47
|
+
z(() => {
|
|
48
|
+
if (r && typeof r == "string") {
|
|
49
|
+
const [o, t] = r.split(" "), [Y, Z] = o.split(":").map(Number);
|
|
50
|
+
w(Y), L(Z), t && O(t);
|
|
49
51
|
}
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
C.current && !C.current.contains(
|
|
52
|
+
}, [r]), z(() => {
|
|
53
|
+
const o = (t) => {
|
|
54
|
+
C.current && !C.current.contains(t.target) && d(!1);
|
|
53
55
|
};
|
|
54
|
-
return document.addEventListener("mousedown",
|
|
56
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
55
57
|
}, []);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
{ length:
|
|
60
|
-
(
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
const K = _(() => {
|
|
59
|
+
n == null || n(re(i, c, m, s ?? E)), d(!1);
|
|
60
|
+
}, [n, i, c, m, s]), x = s === E ? Array.from({ length: oe }, (o, t) => t + 1) : Array.from({ length: ne }, (o, t) => t), V = Array.from(
|
|
61
|
+
{ length: se / (I ?? 5) },
|
|
62
|
+
(o, t) => t * (I ?? 5)
|
|
63
|
+
), y = _(() => d(!1), []), H = s ?? E, D = I ?? 5, T = ee(
|
|
64
|
+
() => ({
|
|
65
|
+
selectedHour: i,
|
|
66
|
+
setSelectedHour: w,
|
|
67
|
+
selectedMinute: c,
|
|
68
|
+
setSelectedMinute: L,
|
|
69
|
+
period: m,
|
|
70
|
+
setPeriod: O,
|
|
71
|
+
format: H,
|
|
72
|
+
hours: x,
|
|
73
|
+
minutes: V,
|
|
74
|
+
timeValue: r,
|
|
75
|
+
clearable: M ?? !0,
|
|
76
|
+
onChange: n,
|
|
77
|
+
onConfirm: K,
|
|
78
|
+
onClose: y,
|
|
79
|
+
translations: N
|
|
80
|
+
}),
|
|
81
|
+
[i, c, m, H, x, V, r, M, n, K, y, N]
|
|
82
|
+
), X = _(() => p ? v === S ? /* @__PURE__ */ a(Ce, { ...T, minuteStep: D }) : /* @__PURE__ */ a(pe, { ...T }) : null, [p, v, T, D]);
|
|
83
|
+
return /* @__PURE__ */ U("div", { ref: C, className: B(Ee, W), children: [
|
|
84
|
+
b && /* @__PURE__ */ a("label", { className: le, children: b }),
|
|
85
|
+
/* @__PURE__ */ U(
|
|
65
86
|
"button",
|
|
66
87
|
{
|
|
67
88
|
type: "button",
|
|
68
|
-
onClick: () => !
|
|
69
|
-
disabled:
|
|
70
|
-
className:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
89
|
+
onClick: () => !f && d(!p),
|
|
90
|
+
disabled: f,
|
|
91
|
+
className: B(
|
|
92
|
+
ce,
|
|
93
|
+
ie[Q ?? "md"],
|
|
94
|
+
de[$ ?? "default"],
|
|
95
|
+
l ? "bear-border-red-500" : "focus:bear-border-pink-500",
|
|
96
|
+
f && "bear-opacity-50 bear-cursor-not-allowed",
|
|
97
|
+
r ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-400 dark:bear-text-zinc-500"
|
|
77
98
|
),
|
|
78
99
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
100
|
+
/* @__PURE__ */ a("span", { children: r || j }),
|
|
101
|
+
G ?? Te
|
|
81
102
|
]
|
|
82
103
|
}
|
|
83
104
|
),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/* @__PURE__ */ i("div", { className: "bear-flex bear-gap-2 bear-mb-3", children: [
|
|
88
|
-
/* @__PURE__ */ i("div", { className: "bear-flex-1", children: [
|
|
89
|
-
/* @__PURE__ */ t("div", { className: u, children: "Hour" }),
|
|
90
|
-
/* @__PURE__ */ t("div", { className: y, children: D.map((e) => /* @__PURE__ */ t(
|
|
91
|
-
"button",
|
|
92
|
-
{
|
|
93
|
-
onClick: () => p(e),
|
|
94
|
-
className: l(
|
|
95
|
-
R,
|
|
96
|
-
L === e ? N : f
|
|
97
|
-
),
|
|
98
|
-
children: e.toString().padStart(2, "0")
|
|
99
|
-
},
|
|
100
|
-
e
|
|
101
|
-
)) })
|
|
102
|
-
] }),
|
|
103
|
-
/* @__PURE__ */ i("div", { className: "bear-flex-1", children: [
|
|
104
|
-
/* @__PURE__ */ t("div", { className: u, children: "Minute" }),
|
|
105
|
-
/* @__PURE__ */ t("div", { className: y, children: B.map((e) => /* @__PURE__ */ t(
|
|
106
|
-
"button",
|
|
107
|
-
{
|
|
108
|
-
onClick: () => v(e),
|
|
109
|
-
className: l(
|
|
110
|
-
R,
|
|
111
|
-
h === e ? N : f
|
|
112
|
-
),
|
|
113
|
-
children: e.toString().padStart(2, "0")
|
|
114
|
-
},
|
|
115
|
-
e
|
|
116
|
-
)) })
|
|
117
|
-
] }),
|
|
118
|
-
o === "12h" && /* @__PURE__ */ i("div", { className: "bear-flex-1", children: [
|
|
119
|
-
/* @__PURE__ */ t("div", { className: u, children: "Period" }),
|
|
120
|
-
/* @__PURE__ */ t("div", { className: "bear-space-y-1", children: ["AM", "PM"].map((e) => /* @__PURE__ */ t(
|
|
121
|
-
"button",
|
|
122
|
-
{
|
|
123
|
-
onClick: () => K(e),
|
|
124
|
-
className: l(
|
|
125
|
-
R,
|
|
126
|
-
"bear-py-2",
|
|
127
|
-
k === e ? N : f
|
|
128
|
-
),
|
|
129
|
-
children: e
|
|
130
|
-
},
|
|
131
|
-
e
|
|
132
|
-
)) })
|
|
133
|
-
] })
|
|
134
|
-
] }),
|
|
135
|
-
/* @__PURE__ */ i("div", { className: te, children: [
|
|
136
|
-
M && a && /* @__PURE__ */ t("button", { onClick: () => {
|
|
137
|
-
s == null || s(""), d(!1);
|
|
138
|
-
}, className: re, children: "Clear" }),
|
|
139
|
-
/* @__PURE__ */ t("button", { onClick: w, className: se, children: "Confirm" })
|
|
140
|
-
] })
|
|
141
|
-
] })
|
|
105
|
+
l && /* @__PURE__ */ a("p", { className: me, children: l }),
|
|
106
|
+
h && !l && /* @__PURE__ */ a("p", { className: ue, children: h }),
|
|
107
|
+
X()
|
|
142
108
|
] });
|
|
143
109
|
};
|
|
144
110
|
export {
|
|
145
|
-
|
|
111
|
+
ke as TimePicker
|
|
146
112
|
};
|
|
@@ -1,15 +1,48 @@
|
|
|
1
|
+
/** Dropdown variant: columns (scrollable lists), dial (clock face), auto (responsive). */
|
|
2
|
+
export type TimePickerDropdownVariant = 'columns' | 'dial' | 'auto';
|
|
3
|
+
/** Time format: 12-hour with AM/PM or 24-hour. */
|
|
4
|
+
export type TimePickerFormat = '12h' | '24h';
|
|
5
|
+
/** Translation keys for replaceable strings. */
|
|
6
|
+
export interface TimePickerTranslations {
|
|
7
|
+
selectTime?: string;
|
|
8
|
+
hour?: string;
|
|
9
|
+
minute?: string;
|
|
10
|
+
period?: string;
|
|
11
|
+
cancel?: string;
|
|
12
|
+
ok?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Props for TimePickerColumnsDropdown sub-component. */
|
|
15
|
+
export interface TimePickerColumnsProps {
|
|
16
|
+
selectedHour: number;
|
|
17
|
+
setSelectedHour: (h: number) => void;
|
|
18
|
+
selectedMinute: number;
|
|
19
|
+
setSelectedMinute: (m: number) => void;
|
|
20
|
+
period: 'AM' | 'PM';
|
|
21
|
+
setPeriod: (p: 'AM' | 'PM') => void;
|
|
22
|
+
format: TimePickerFormat;
|
|
23
|
+
hours: number[];
|
|
24
|
+
minutes: number[];
|
|
25
|
+
timeValue?: string;
|
|
26
|
+
clearable: boolean;
|
|
27
|
+
onChange?: (time: string | null) => void;
|
|
28
|
+
onConfirm: () => void;
|
|
29
|
+
onClose: () => void;
|
|
30
|
+
translations?: TimePickerTranslations;
|
|
31
|
+
}
|
|
32
|
+
/** Props for TimePickerDialDropdown sub-component. */
|
|
33
|
+
export interface TimePickerDialProps extends TimePickerColumnsProps {
|
|
34
|
+
minuteStep: number;
|
|
35
|
+
}
|
|
1
36
|
export interface TimePickerProps {
|
|
2
|
-
/** Time
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value?: string | Date | null;
|
|
6
|
-
onChange?: (time: string | Date | null) => void;
|
|
37
|
+
/** Time string (e.g. "02:30 PM") */
|
|
38
|
+
value?: string | null;
|
|
39
|
+
onChange?: (time: string | null) => void;
|
|
7
40
|
disabled?: boolean;
|
|
8
41
|
placeholder?: string;
|
|
9
42
|
label?: string;
|
|
10
43
|
error?: string;
|
|
11
44
|
helperText?: string;
|
|
12
|
-
format?:
|
|
45
|
+
format?: TimePickerFormat;
|
|
13
46
|
minuteStep?: number;
|
|
14
47
|
minTime?: string;
|
|
15
48
|
maxTime?: string;
|
|
@@ -17,4 +50,12 @@ export interface TimePickerProps {
|
|
|
17
50
|
className?: string;
|
|
18
51
|
size?: 'sm' | 'md' | 'lg';
|
|
19
52
|
variant?: 'default' | 'filled' | 'outline';
|
|
53
|
+
/** Dropdown variant: columns (scrollable lists), dial (clock face), auto (responsive by breakpoint). */
|
|
54
|
+
dropdownVariant?: TimePickerDropdownVariant;
|
|
55
|
+
/** Breakpoint (px) for auto: use dial above, columns below. Default 768. */
|
|
56
|
+
dropdownVariantBreakpoint?: number;
|
|
57
|
+
/** Custom icon to replace the default clock icon (ReactNode). */
|
|
58
|
+
icon?: React.ReactNode;
|
|
59
|
+
/** Translation overrides for selectTime, hour, minute, period, cancel, ok. */
|
|
60
|
+
translations?: TimePickerTranslations;
|
|
20
61
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("../../../../utils/cn.cjs"),e=require("../../TimePicker.constants.cjs"),O=({selectedHour:I,setSelectedHour:_,selectedMinute:r,setSelectedMinute:a,period:l,setPeriod:C,format:T,hours:n,minutes:N,timeValue:P,clearable:d,onChange:S,onConfirm:t,onClose:m,translations:A})=>{const c={...e.TIMEPICKER_DEFAULT_TRANSLATIONS,...A};return s.jsxs("div",{className:e.TIMEPICKER_DROPDOWN_CLASSES,children:[s.jsxs("div",{className:"Bear-TimePicker__columns bear-flex bear-gap-2 bear-mb-3",children:[s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.hour}),s.jsx("div",{className:e.TIMEPICKER_COLUMN_CLASSES,children:n.map(E=>s.jsx("button",{onClick:()=>_(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,I===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E.toString().padStart(2,"0")},E))})]}),s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.minute}),s.jsx("div",{className:e.TIMEPICKER_COLUMN_CLASSES,children:N.map(E=>s.jsx("button",{onClick:()=>a(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,r===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E.toString().padStart(2,"0")},E))})]}),T==="12h"&&s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.period}),s.jsx("div",{className:"bear-space-y-1",children:["AM","PM"].map(E=>s.jsx("button",{onClick:()=>C(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,"bear-py-2",l===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E},E))})]})]}),s.jsxs("div",{className:e.TIMEPICKER_FOOTER_CLASSES,children:[d&&P&&s.jsx("button",{onClick:()=>{S==null||S(null),m()},className:e.TIMEPICKER_CLEAR_BUTTON_CLASSES,children:c.cancel}),s.jsx("button",{onClick:t,className:e.TIMEPICKER_CONFIRM_BUTTON_CLASSES,children:c.ok})]})]})};exports.TimePickerColumnsDropdown=O;
|
package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as a, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { cn as r } from "../../../../utils/cn.js";
|
|
3
|
+
import { TIMEPICKER_DROPDOWN_CLASSES as u, TIMEPICKER_DEFAULT_TRANSLATIONS as L, TIMEPICKER_COLUMN_HEADER_CLASSES as s, TIMEPICKER_COLUMN_CLASSES as d, TIMEPICKER_OPTION_ACTIVE_CLASSES as E, TIMEPICKER_OPTION_INACTIVE_CLASSES as m, TIMEPICKER_OPTION_CLASSES as n, TIMEPICKER_FOOTER_CLASSES as h, TIMEPICKER_CLEAR_BUTTON_CLASSES as v, TIMEPICKER_CONFIRM_BUTTON_CLASSES as k } from "../../TimePicker.constants.js";
|
|
4
|
+
const x = ({
|
|
5
|
+
selectedHour: S,
|
|
6
|
+
setSelectedHour: _,
|
|
7
|
+
selectedMinute: N,
|
|
8
|
+
setSelectedMinute: I,
|
|
9
|
+
period: T,
|
|
10
|
+
setPeriod: o,
|
|
11
|
+
format: t,
|
|
12
|
+
hours: C,
|
|
13
|
+
minutes: P,
|
|
14
|
+
timeValue: A,
|
|
15
|
+
clearable: O,
|
|
16
|
+
onChange: l,
|
|
17
|
+
onConfirm: R,
|
|
18
|
+
onClose: M,
|
|
19
|
+
translations: b
|
|
20
|
+
}) => {
|
|
21
|
+
const i = { ...L, ...b };
|
|
22
|
+
return /* @__PURE__ */ a("div", { className: u, children: [
|
|
23
|
+
/* @__PURE__ */ a("div", { className: "Bear-TimePicker__columns bear-flex bear-gap-2 bear-mb-3", children: [
|
|
24
|
+
/* @__PURE__ */ a("div", { className: "Bear-TimePicker__column bear-flex-1", children: [
|
|
25
|
+
/* @__PURE__ */ c("div", { className: s, children: i.hour }),
|
|
26
|
+
/* @__PURE__ */ c("div", { className: d, children: C.map((e) => /* @__PURE__ */ c(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
onClick: () => _(e),
|
|
30
|
+
className: r(
|
|
31
|
+
n,
|
|
32
|
+
S === e ? E : m
|
|
33
|
+
),
|
|
34
|
+
children: e.toString().padStart(2, "0")
|
|
35
|
+
},
|
|
36
|
+
e
|
|
37
|
+
)) })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ a("div", { className: "Bear-TimePicker__column bear-flex-1", children: [
|
|
40
|
+
/* @__PURE__ */ c("div", { className: s, children: i.minute }),
|
|
41
|
+
/* @__PURE__ */ c("div", { className: d, children: P.map((e) => /* @__PURE__ */ c(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
onClick: () => I(e),
|
|
45
|
+
className: r(
|
|
46
|
+
n,
|
|
47
|
+
N === e ? E : m
|
|
48
|
+
),
|
|
49
|
+
children: e.toString().padStart(2, "0")
|
|
50
|
+
},
|
|
51
|
+
e
|
|
52
|
+
)) })
|
|
53
|
+
] }),
|
|
54
|
+
t === "12h" && /* @__PURE__ */ a("div", { className: "Bear-TimePicker__column bear-flex-1", children: [
|
|
55
|
+
/* @__PURE__ */ c("div", { className: s, children: i.period }),
|
|
56
|
+
/* @__PURE__ */ c("div", { className: "bear-space-y-1", children: ["AM", "PM"].map((e) => /* @__PURE__ */ c(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
onClick: () => o(e),
|
|
60
|
+
className: r(
|
|
61
|
+
n,
|
|
62
|
+
"bear-py-2",
|
|
63
|
+
T === e ? E : m
|
|
64
|
+
),
|
|
65
|
+
children: e
|
|
66
|
+
},
|
|
67
|
+
e
|
|
68
|
+
)) })
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ a("div", { className: h, children: [
|
|
72
|
+
O && A && /* @__PURE__ */ c("button", { onClick: () => {
|
|
73
|
+
l == null || l(null), M();
|
|
74
|
+
}, className: v, children: i.cancel }),
|
|
75
|
+
/* @__PURE__ */ c("button", { onClick: R, className: k, children: i.ok })
|
|
76
|
+
] })
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
x as TimePickerColumnsDropdown
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TimePickerColumnsDropdown } from './TimePickerColumnsDropdown';
|
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("react"),b=require("../../../../utils/cn.cjs"),a=require("../../TimePicker.constants.cjs"),B=require("../../helpers/ClockFaceSvg.cjs"),R=({selectedHour:i,setSelectedHour:d,selectedMinute:n,setSelectedMinute:m,period:x,setPeriod:u,format:t,hours:k,minutes:_,timeValue:h,clearable:T,onChange:s,onConfirm:p,onClose:S,translations:j})=>{const[N,l]=M.useState("hour"),c={...a.TIMEPICKER_DEFAULT_TRANSLATIONS,...j},P=t==="12h"?i===12?12:i%12:i,v=n,g=`${P.toString().padStart(2,"0")}:${v.toString().padStart(2,"0")}`,y=t==="12h"?[...a.CLOCK_HOURS_12]:k,o=N==="hour",C=o?y:_,E=o?r=>d(t==="12h"&&r===0?12:r):m;return e.jsxs("div",{className:b.cn(a.TIMEPICKER_DROPDOWN_CLASSES,"Bear-TimePicker__dial bear-w-72"),children:[e.jsx("div",{className:"Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2",children:c.selectTime}),e.jsxs("div",{className:"Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-3 bear-mb-4",children:[e.jsx("span",{className:"Bear-TimePicker__dial-time bear-text-2xl bear-font-bold bear-text-gray-900 dark:bear-text-white",children:g}),t==="12h"&&e.jsx("div",{className:"Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5",children:["AM","PM"].map(r=>e.jsx("button",{onClick:()=>u(r),className:b.cn("Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",x===r?"bear-text-blue-600 dark:bear-text-blue-400 bear-font-medium":"bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"),children:r},r))})]}),e.jsxs("div",{className:"Bear-TimePicker__dial-mode bear-flex bear-items-center bear-justify-center bear-gap-2 bear-mb-2",children:[e.jsx("button",{type:"button",onClick:()=>l("hour"),className:"Bear-TimePicker__dial-mode-btn bear-p-1 bear-rounded bear-text-gray-500 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700","aria-label":"Hour mode",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsx("button",{type:"button",onClick:()=>l("minute"),className:"Bear-TimePicker__dial-mode-btn bear-p-1 bear-rounded bear-text-gray-500 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700","aria-label":"Minute mode",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsx("div",{className:"Bear-TimePicker__dial-face bear-relative bear-w-48 bear-h-48 bear-mx-auto bear-mb-4",children:e.jsx(B.ClockFaceSvg,{values:C,isHourMode:o,format:t,selectedHour:i,selectedMinute:n,onSelect:E})}),e.jsxs("div",{className:a.TIMEPICKER_FOOTER_CLASSES,children:[T&&h&&e.jsx("button",{onClick:()=>{s==null||s(null),S()},className:a.TIMEPICKER_CLEAR_BUTTON_CLASSES,children:c.cancel}),e.jsx("button",{onClick:p,className:a.TIMEPICKER_CONFIRM_BUTTON_CLASSES,children:c.ok})]})]})};exports.TimePickerDialDropdown=R;
|
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as M } from "react";
|
|
3
|
+
import { cn as s } from "../../../../utils/cn.js";
|
|
4
|
+
import { TIMEPICKER_DEFAULT_TRANSLATIONS as f, CLOCK_HOURS_12 as I, TIMEPICKER_FOOTER_CLASSES as L, TIMEPICKER_CLEAR_BUTTON_CLASSES as R, TIMEPICKER_CONFIRM_BUTTON_CLASSES as O, TIMEPICKER_DROPDOWN_CLASSES as A } from "../../TimePicker.constants.js";
|
|
5
|
+
import { ClockFaceSvg as w } from "../../helpers/ClockFaceSvg.js";
|
|
6
|
+
const U = ({
|
|
7
|
+
selectedHour: t,
|
|
8
|
+
setSelectedHour: d,
|
|
9
|
+
selectedMinute: b,
|
|
10
|
+
setSelectedMinute: m,
|
|
11
|
+
period: k,
|
|
12
|
+
setPeriod: _,
|
|
13
|
+
format: a,
|
|
14
|
+
hours: u,
|
|
15
|
+
minutes: h,
|
|
16
|
+
timeValue: p,
|
|
17
|
+
clearable: x,
|
|
18
|
+
onChange: o,
|
|
19
|
+
onConfirm: T,
|
|
20
|
+
onClose: S,
|
|
21
|
+
translations: N
|
|
22
|
+
}) => {
|
|
23
|
+
const [v, n] = M("hour"), c = { ...f, ...N }, C = a === "12h" ? t === 12 ? 12 : t % 12 : t, P = b, y = `${C.toString().padStart(2, "0")}:${P.toString().padStart(2, "0")}`, E = a === "12h" ? [...I] : u, l = v === "hour", g = l ? E : h, B = l ? (r) => d(a === "12h" && r === 0 ? 12 : r) : m;
|
|
24
|
+
return /* @__PURE__ */ i("div", { className: s(A, "Bear-TimePicker__dial bear-w-72"), children: [
|
|
25
|
+
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children: c.selectTime }),
|
|
26
|
+
/* @__PURE__ */ i("div", { className: "Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-3 bear-mb-4", children: [
|
|
27
|
+
/* @__PURE__ */ e("span", { className: "Bear-TimePicker__dial-time bear-text-2xl bear-font-bold bear-text-gray-900 dark:bear-text-white", children: y }),
|
|
28
|
+
a === "12h" && /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5", children: ["AM", "PM"].map((r) => /* @__PURE__ */ e(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
onClick: () => _(r),
|
|
32
|
+
className: s(
|
|
33
|
+
"Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",
|
|
34
|
+
k === r ? "bear-text-blue-600 dark:bear-text-blue-400 bear-font-medium" : "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"
|
|
35
|
+
),
|
|
36
|
+
children: r
|
|
37
|
+
},
|
|
38
|
+
r
|
|
39
|
+
)) })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ i("div", { className: "Bear-TimePicker__dial-mode bear-flex bear-items-center bear-justify-center bear-gap-2 bear-mb-2", children: [
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: () => n("hour"),
|
|
47
|
+
className: "Bear-TimePicker__dial-mode-btn bear-p-1 bear-rounded bear-text-gray-500 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
|
|
48
|
+
"aria-label": "Hour mode",
|
|
49
|
+
children: /* @__PURE__ */ e("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
onClick: () => n("minute"),
|
|
57
|
+
className: "Bear-TimePicker__dial-mode-btn bear-p-1 bear-rounded bear-text-gray-500 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
|
|
58
|
+
"aria-label": "Minute mode",
|
|
59
|
+
children: /* @__PURE__ */ e("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-face bear-relative bear-w-48 bear-h-48 bear-mx-auto bear-mb-4", children: /* @__PURE__ */ e(
|
|
64
|
+
w,
|
|
65
|
+
{
|
|
66
|
+
values: g,
|
|
67
|
+
isHourMode: l,
|
|
68
|
+
format: a,
|
|
69
|
+
selectedHour: t,
|
|
70
|
+
selectedMinute: b,
|
|
71
|
+
onSelect: B
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
/* @__PURE__ */ i("div", { className: L, children: [
|
|
75
|
+
x && p && /* @__PURE__ */ e("button", { onClick: () => {
|
|
76
|
+
o == null || o(null), S();
|
|
77
|
+
}, className: R, children: c.cancel }),
|
|
78
|
+
/* @__PURE__ */ e("button", { onClick: T, className: O, children: c.ok })
|
|
79
|
+
] })
|
|
80
|
+
] });
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
U as TimePickerDialDropdown
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TimePickerDialDropdown } from './TimePickerDialDropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs"),e=require("../TimePicker.constants.cjs"),E=({values:t,isHourMode:n,format:i,selectedHour:a,selectedMinute:l,onSelect:b,className:h})=>{const f=c=>n?(c*30-90)*(Math.PI/180):(c*(360/t.length)-90)*(Math.PI/180),s=(n?(i==="12h"?a===12?0:a%12:a)*30-90:l*6-90)*Math.PI/180;return r.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",h),children:[r.jsx("circle",{cx:e.CLOCK_CENTER,cy:e.CLOCK_CENTER,r:e.CLOCK_RADIUS,className:"Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"}),t.map((c,x)=>{const C=f(x),o=e.CLOCK_CENTER+e.CLOCK_RADIUS*.85*Math.cos(C),_=e.CLOCK_CENTER+e.CLOCK_RADIUS*.85*Math.sin(C),k=n?i==="12h"?c===12?a===12:a%12===c:a===c:l===c;return r.jsxs("g",{onClick:()=>b(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[k&&r.jsx("circle",{cx:o,cy:_,r:14,className:"Bear-TimePicker__clock-face-dot bear-fill-blue-500"}),r.jsx("text",{x:o,y:_,textAnchor:"middle",dominantBaseline:"middle",className:m.cn("Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",k?"bear-fill-white":"bear-fill-gray-700 dark:bear-fill-zinc-300"),children:typeof c=="number"?c.toString().padStart(2,"0"):c})]},c)}),r.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*.6*Math.cos(s),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*.6*Math.sin(s),className:"Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=E;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface ClockFaceSvgProps {
|
|
3
|
+
/** Clock face values (hours or minutes) */
|
|
4
|
+
values: readonly number[] | number[];
|
|
5
|
+
/** Whether in hour mode (different angle calc) */
|
|
6
|
+
isHourMode: boolean;
|
|
7
|
+
/** Format: 12h or 24h */
|
|
8
|
+
format: '12h' | '24h';
|
|
9
|
+
/** Current selected hour (for hour mode) */
|
|
10
|
+
selectedHour: number;
|
|
11
|
+
/** Current selected minute (for minute mode) */
|
|
12
|
+
selectedMinute: number;
|
|
13
|
+
/** Callback when value is clicked */
|
|
14
|
+
onSelect: (v: number) => void;
|
|
15
|
+
/** Optional class name */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const ClockFaceSvg: FC<ClockFaceSvgProps>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cn as _ } from "../../../utils/cn.js";
|
|
3
|
+
import { CLOCK_RADIUS as c, CLOCK_CENTER as a } from "../TimePicker.constants.js";
|
|
4
|
+
const N = ({
|
|
5
|
+
values: i,
|
|
6
|
+
isHourMode: t,
|
|
7
|
+
format: l,
|
|
8
|
+
selectedHour: r,
|
|
9
|
+
selectedMinute: o,
|
|
10
|
+
onSelect: g,
|
|
11
|
+
className: x
|
|
12
|
+
}) => {
|
|
13
|
+
const d = (e) => t ? (e * 30 - 90) * (Math.PI / 180) : (e * (360 / i.length) - 90) * (Math.PI / 180), s = (t ? (l === "12h" ? r === 12 ? 0 : r % 12 : r) * 30 - 90 : o * 6 - 90) * Math.PI / 180;
|
|
14
|
+
return /* @__PURE__ */ f("svg", { viewBox: "0 0 200 200", className: _("Bear-TimePicker__clock-face bear-w-full bear-h-full", x), children: [
|
|
15
|
+
/* @__PURE__ */ n(
|
|
16
|
+
"circle",
|
|
17
|
+
{
|
|
18
|
+
cx: a,
|
|
19
|
+
cy: a,
|
|
20
|
+
r: c,
|
|
21
|
+
className: "Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
i.map((e, p) => {
|
|
25
|
+
const m = d(p), k = a + c * 0.85 * Math.cos(m), h = a + c * 0.85 * Math.sin(m), b = t ? l === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : o === e;
|
|
26
|
+
return /* @__PURE__ */ f(
|
|
27
|
+
"g",
|
|
28
|
+
{
|
|
29
|
+
onClick: () => g(e),
|
|
30
|
+
className: "Bear-TimePicker__clock-face-item bear-cursor-pointer",
|
|
31
|
+
children: [
|
|
32
|
+
b && /* @__PURE__ */ n("circle", { cx: k, cy: h, r: 14, className: "Bear-TimePicker__clock-face-dot bear-fill-blue-500" }),
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
"text",
|
|
35
|
+
{
|
|
36
|
+
x: k,
|
|
37
|
+
y: h,
|
|
38
|
+
textAnchor: "middle",
|
|
39
|
+
dominantBaseline: "middle",
|
|
40
|
+
className: _(
|
|
41
|
+
"Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",
|
|
42
|
+
b ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
|
|
43
|
+
),
|
|
44
|
+
children: typeof e == "number" ? e.toString().padStart(2, "0") : e
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
e
|
|
50
|
+
);
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ n(
|
|
53
|
+
"line",
|
|
54
|
+
{
|
|
55
|
+
x1: a,
|
|
56
|
+
y1: a,
|
|
57
|
+
x2: a + c * 0.6 * Math.cos(s),
|
|
58
|
+
y2: a + c * 0.6 * Math.sin(s),
|
|
59
|
+
className: "Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",
|
|
60
|
+
strokeLinecap: "round"
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
N as ClockFaceSvg
|
|
67
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TimePicker } from './TimePicker';
|
|
2
|
-
export type { TimePickerProps } from './TimePicker.types';
|
|
2
|
+
export type { TimePickerProps, TimePickerColumnsProps, TimePickerDialProps, TimePickerTranslations, TimePickerFormat, TimePickerDropdownVariant, } from './TimePicker.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),$=require("../../utils/cn.cjs");function g({items:l,itemHeight:t,overscan:f=3,height:e,renderItem:d,keyExtractor:x=(u,i)=>i,className:p}){const[u,i]=s.useState(0),[v,y]=s.useState(typeof e=="number"?e:300),o=s.useRef(null),S=l.length*t,b=Math.max(0,Math.floor(u/t)-f),h=Math.min(l.length-1,Math.ceil((u+v)/t)+f),j=l.slice(b,h+1),m=b*t,R=s.useCallback(()=>{o.current&&i(o.current.scrollTop)},[]);return s.useEffect(()=>{const r=o.current;if(r&&typeof e=="string"){const n=new ResizeObserver(a=>{for(const M of a)y(M.contentRect.height)});return n.observe(r),()=>n.disconnect()}},[e]),c.jsx("div",{ref:o,className:$.cn("Bear-VirtualList bear-overflow-auto bear-bg-white dark:bear-bg-zinc-900 bear-rounded-lg",p),style:{height:typeof e=="number"?`${e}px`:e},onScroll:R,children:c.jsx("div",{className:"bear-relative",style:{height:`${S}px`},children:c.jsx("div",{className:"bear-absolute bear-inset-x-0 bear-top-0",style:{transform:`translateY(${m}px)`},children:j.map((r,n)=>{const a=b+n;return c.jsx("div",{className:"bear-absolute bear-inset-x-0 bear-top-0",style:{height:`${t}px`,transform:`translateY(${n*t}px)`},children:d(r,a)},x(r,a))})})})})}exports.VirtualList=g;
|