@cognite/aura 0.3.1 → 0.3.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/DESIGN.md +1651 -7
- package/README.md +45 -3
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +58 -325
- package/dist/components/ui/core/accordion/accordion.js +79 -114
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
- package/dist/components/ui/core/alert/alert.js +158 -206
- package/dist/components/ui/core/avatar/avatar.js +64 -90
- package/dist/components/ui/core/badge/badge.js +73 -108
- package/dist/components/ui/core/banner/banner.js +146 -215
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
- package/dist/components/ui/core/button/button.js +47 -52
- package/dist/components/ui/core/button-group/button-group.js +40 -79
- package/dist/components/ui/core/card/card.js +102 -185
- package/dist/components/ui/core/chart/chart.js +116 -206
- package/dist/components/ui/core/chart/index.js +2 -8
- package/dist/components/ui/core/checkbox/checkbox.js +67 -132
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/code-block/code-block.js +179 -267
- package/dist/components/ui/core/collapsible/collapsible.js +29 -49
- package/dist/components/ui/core/combobox/combobox.js +41 -0
- package/dist/components/ui/core/command/command.js +85 -150
- package/dist/components/ui/core/count/count.js +21 -32
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -83
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -62
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -98
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -81
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -189
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -158
- package/dist/components/ui/core/date-time-pickers/index.d.ts +2 -0
- package/dist/components/ui/core/date-time-pickers/index.js +5 -8
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -39
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +79 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +42 -0
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
- package/dist/components/ui/core/dialog/dialog.js +82 -155
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +19 -17
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -250
- package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
- package/dist/components/ui/core/empty-state/empty-state.js +86 -138
- package/dist/components/ui/core/helper-text/helper-text.js +37 -65
- package/dist/components/ui/core/hover-card/hover-card.js +54 -80
- package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
- package/dist/components/ui/core/input/input.js +12 -27
- package/dist/components/ui/core/input-group/input-group.js +76 -173
- package/dist/components/ui/core/kbd/kbd.js +20 -36
- package/dist/components/ui/core/label/label.js +26 -43
- package/dist/components/ui/core/loader/loader.js +80 -117
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
- package/dist/components/ui/core/message/message.d.ts +2 -2
- package/dist/components/ui/core/message/message.js +316 -542
- package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
- package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination.js +231 -334
- package/dist/components/ui/core/popover/popover.js +90 -157
- package/dist/components/ui/core/progress/progress.js +36 -61
- package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
- package/dist/components/ui/core/radio-group/radio-group.js +58 -113
- package/dist/components/ui/core/reasoning/reasoning.js +55 -86
- package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
- package/dist/components/ui/core/search/search.js +77 -99
- package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
- package/dist/components/ui/core/select/select.js +168 -293
- package/dist/components/ui/core/separator/separator.js +13 -23
- package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
- package/dist/components/ui/core/shimmer/shimmer.js +40 -107
- package/dist/components/ui/core/skeleton/skeleton.js +13 -18
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
- package/dist/components/ui/core/sources/sources.d.ts +5 -1
- package/dist/components/ui/core/sources/sources.js +58 -79
- package/dist/components/ui/core/switch/switch.js +62 -0
- package/dist/components/ui/core/tabs/tabs.js +149 -223
- package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
- package/dist/components/ui/core/textarea/textarea.js +13 -27
- package/dist/components/ui/core/toggle/toggle.js +55 -74
- package/dist/components/ui/core/tool/tool.js +127 -163
- package/dist/components/ui/core/tooltip/tooltip.js +47 -86
- package/dist/components/ui/core/topbar/topbar.js +106 -190
- package/dist/eslint/index.js +5 -10
- package/dist/eslint/no-overriding-styles.js +178 -237
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.js +42 -0
- package/dist/lib/portal-container-context.js +8 -9
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/use-controllable-state.js +21 -30
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +32 -112
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +23 -0
- package/package.json +23 -7
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
|
@@ -1,161 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
1
|
+
import { usePopoverState as e } from "../shared/hooks/use-popover-state.js";
|
|
2
|
+
import { useTimeState as t } from "../shared/hooks/use-time-state.js";
|
|
3
|
+
import { useRangeDateState as n } from "../shared/hooks/use-range-date-state.js";
|
|
4
|
+
import { useRangeStepManager as r } from "../shared/hooks/use-range-step-manager.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
6
|
+
import s from "dayjs";
|
|
7
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.ts
|
|
8
|
+
function c(e) {
|
|
9
|
+
return e.hour(0).minute(0);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function l(e) {
|
|
12
|
+
return e.hour(23).minute(59);
|
|
13
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
r(de), o(!1);
|
|
106
|
-
}
|
|
107
|
-
}, [
|
|
108
|
-
u,
|
|
109
|
-
O,
|
|
110
|
-
l,
|
|
111
|
-
y,
|
|
112
|
-
p,
|
|
113
|
-
r,
|
|
114
|
-
o
|
|
115
|
-
]), ue = n(() => {
|
|
116
|
-
s(), o(!1);
|
|
117
|
-
}, [s, o]), ce = n(() => {
|
|
118
|
-
a(), c([u.current.tempStart, null]);
|
|
119
|
-
}, [a, c, u]), he = n(
|
|
120
|
-
(e) => {
|
|
121
|
-
const i = Array.isArray(e) ? e : [e, e];
|
|
122
|
-
r(i), o(!1);
|
|
123
|
-
},
|
|
124
|
-
[r, o]
|
|
125
|
-
);
|
|
126
|
-
return {
|
|
127
|
-
isOpen: h,
|
|
128
|
-
step: m,
|
|
129
|
-
displayedMonth: z,
|
|
130
|
-
tempStart: L,
|
|
131
|
-
tempEnd: q,
|
|
132
|
-
hoverDate: G,
|
|
133
|
-
tempStartHour: W,
|
|
134
|
-
tempStartMinute: l,
|
|
135
|
-
tempEndHour: ee,
|
|
136
|
-
tempEndMinute: p,
|
|
137
|
-
startAmPm: X,
|
|
138
|
-
endAmPm: te,
|
|
139
|
-
handleTogglePopover: ae,
|
|
140
|
-
handleSetStep: se,
|
|
141
|
-
handleDateClick: ie,
|
|
142
|
-
handleMonthChange: K,
|
|
143
|
-
handleDateHover: J,
|
|
144
|
-
handleStartHourChange: Z,
|
|
145
|
-
handleStartMinuteChange: $,
|
|
146
|
-
handleEndHourChange: ne,
|
|
147
|
-
handleEndMinuteChange: re,
|
|
148
|
-
handleStartAmPmChange: v,
|
|
149
|
-
handleEndAmPmChange: oe,
|
|
150
|
-
handleNext: d,
|
|
151
|
-
handleApply: me,
|
|
152
|
-
handleCancel: ue,
|
|
153
|
-
handleBack: ce,
|
|
154
|
-
handleApplyShortcut: he,
|
|
155
|
-
popoverRef: w,
|
|
156
|
-
inputRef: x
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
export {
|
|
160
|
-
Re as useDateTimeRangePicker
|
|
14
|
+
var u = ({ value: u, onChange: d, timeFormat: f = "24h", defaultDate: p = s() }) => {
|
|
15
|
+
let m = o(() => {}), { isOpen: h, setIsOpen: g, popoverRef: _, inputRef: v } = e({ onBackspace: i(() => m.current(), []) }), { step: y, handleNext: b, handleBack: x, resetStep: S } = r(), { tempStart: C, tempEnd: w, displayedMonth: T, hoverDate: E, stateRef: D, handleDateClick: O, handleDateHover: k, handleMonthChange: A, clearActiveSegment: j, resetDates: M } = n({
|
|
16
|
+
value: u,
|
|
17
|
+
defaultDate: p,
|
|
18
|
+
mapDate: (e, t) => t === "start" ? c(e) : l(e)
|
|
19
|
+
}), { hour: N, minute: P, amPm: F, hour24: I, handleHourChange: L, handleMinuteChange: R, handleAmPmChange: z, resetTime: B } = t({
|
|
20
|
+
initialHour: u[0]?.hour() ?? 0,
|
|
21
|
+
initialMinute: u[0]?.minute() ?? 0,
|
|
22
|
+
timeFormat: f
|
|
23
|
+
}), { hour: V, minute: H, amPm: U, hour24: W, handleHourChange: G, handleMinuteChange: K, handleAmPmChange: q, resetTime: J } = t({
|
|
24
|
+
initialHour: u[1]?.hour() ?? 23,
|
|
25
|
+
initialMinute: u[1]?.minute() ?? 59,
|
|
26
|
+
timeFormat: f
|
|
27
|
+
}), Y = i(() => {
|
|
28
|
+
M(u), S(), B(u[0]?.hour() ?? 0, u[0]?.minute() ?? 0), J(u[1]?.hour() ?? 23, u[1]?.minute() ?? 59);
|
|
29
|
+
}, [
|
|
30
|
+
u,
|
|
31
|
+
M,
|
|
32
|
+
S,
|
|
33
|
+
B,
|
|
34
|
+
J
|
|
35
|
+
]), X = i(() => {
|
|
36
|
+
let e = j(y);
|
|
37
|
+
e === null ? x() : e[0] === null && e[1] === null && d(e);
|
|
38
|
+
}, [
|
|
39
|
+
j,
|
|
40
|
+
y,
|
|
41
|
+
x,
|
|
42
|
+
d
|
|
43
|
+
]);
|
|
44
|
+
return a(() => {
|
|
45
|
+
m.current = X;
|
|
46
|
+
}, [X]), {
|
|
47
|
+
isOpen: h,
|
|
48
|
+
step: y,
|
|
49
|
+
displayedMonth: T,
|
|
50
|
+
tempStart: C,
|
|
51
|
+
tempEnd: w,
|
|
52
|
+
hoverDate: E,
|
|
53
|
+
tempStartHour: N,
|
|
54
|
+
tempStartMinute: P,
|
|
55
|
+
tempEndHour: V,
|
|
56
|
+
tempEndMinute: H,
|
|
57
|
+
startAmPm: F,
|
|
58
|
+
endAmPm: U,
|
|
59
|
+
handleOpenChange: (e) => {
|
|
60
|
+
Y(), g(e);
|
|
61
|
+
},
|
|
62
|
+
handleSetStep: i((e) => {
|
|
63
|
+
e === "start" ? x() : b();
|
|
64
|
+
}, [x, b]),
|
|
65
|
+
handleDateClick: i((e) => {
|
|
66
|
+
O(e, y);
|
|
67
|
+
}, [O, y]),
|
|
68
|
+
handleMonthChange: A,
|
|
69
|
+
handleDateHover: k,
|
|
70
|
+
handleStartHourChange: L,
|
|
71
|
+
handleStartMinuteChange: R,
|
|
72
|
+
handleEndHourChange: G,
|
|
73
|
+
handleEndMinuteChange: K,
|
|
74
|
+
handleStartAmPmChange: z,
|
|
75
|
+
handleEndAmPmChange: q,
|
|
76
|
+
handleNext: b,
|
|
77
|
+
handleApply: i(() => {
|
|
78
|
+
let { tempStart: e, tempEnd: t } = D.current;
|
|
79
|
+
if (e && t) {
|
|
80
|
+
let n = e.hour(I).minute(P).startOf("minute"), r = t.hour(W).minute(H).endOf("minute");
|
|
81
|
+
d(n.isAfter(r) ? [r, n] : [n, r]), g(!1);
|
|
82
|
+
}
|
|
83
|
+
}, [
|
|
84
|
+
D,
|
|
85
|
+
I,
|
|
86
|
+
P,
|
|
87
|
+
W,
|
|
88
|
+
H,
|
|
89
|
+
d,
|
|
90
|
+
g
|
|
91
|
+
]),
|
|
92
|
+
handleBack: i(() => {
|
|
93
|
+
x(), M([D.current.tempStart, null]);
|
|
94
|
+
}, [
|
|
95
|
+
x,
|
|
96
|
+
M,
|
|
97
|
+
D
|
|
98
|
+
]),
|
|
99
|
+
handleApplyShortcut: i((e) => {
|
|
100
|
+
d(Array.isArray(e) ? e : [e, e]), g(!1);
|
|
101
|
+
}, [d, g]),
|
|
102
|
+
popoverRef: _,
|
|
103
|
+
inputRef: v
|
|
104
|
+
};
|
|
161
105
|
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { u as useDateTimeRangePicker };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { DatePicker } from './date-picker';
|
|
2
2
|
export type { DatePickerProps } from './date-picker';
|
|
3
|
+
export { TimePicker } from './time-picker';
|
|
4
|
+
export type { TimePickerProps } from './time-picker';
|
|
3
5
|
export { DateRangePicker } from './date-range-picker';
|
|
4
6
|
export type { DateRangePickerProps } from './date-range-picker';
|
|
5
7
|
export { DateTimeRangePicker } from './date-time-range-picker';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { DatePicker as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
a as DateRangePicker,
|
|
7
|
-
m as DateTimeRangePicker
|
|
8
|
-
};
|
|
1
|
+
import { DatePicker as e } from "./date-picker/date-picker.js";
|
|
2
|
+
import { TimePicker as t } from "./time-picker/time-picker.js";
|
|
3
|
+
import { DateRangePicker as n } from "./date-range-picker/date-range-picker.js";
|
|
4
|
+
import { DateTimeRangePicker as r } from "./date-time-range-picker/date-time-range-picker.js";
|
|
5
|
+
export { e as DatePicker, n as DateRangePicker, r as DateTimeRangePicker, t as TimePicker };
|
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
t ? _ : C
|
|
42
|
-
),
|
|
43
|
-
onClick: () => c(o),
|
|
44
|
-
onKeyDown: (E) => f(E, o),
|
|
45
|
-
role: "option",
|
|
46
|
-
"aria-selected": t,
|
|
47
|
-
children: o
|
|
48
|
-
},
|
|
49
|
-
o
|
|
50
|
-
);
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
p as AmPmScroll
|
|
1
|
+
import { cn as e } from "../../../../../../lib/utils.js";
|
|
2
|
+
import { SCROLL_CONTAINER_CLASSES as t, SCROLL_ITEM_BASE_CLASSES as n, SCROLL_ITEM_SELECTED_CLASSES as r, SCROLL_ITEM_UNSELECTED_CLASSES as i } from "../scroll-cell-classes.js";
|
|
3
|
+
import { useEffect as a, useRef as o } from "react";
|
|
4
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.tsx
|
|
6
|
+
var c = ["AM", "PM"], l = ({ value: l, onChange: u, className: d }) => {
|
|
7
|
+
let f = o(null), p = o(null);
|
|
8
|
+
a(() => {
|
|
9
|
+
if (l !== null && p.current && f.current) {
|
|
10
|
+
let e = f.current, t = p.current;
|
|
11
|
+
e.scrollTo({
|
|
12
|
+
top: t.offsetTop - e.offsetHeight / 2 + t.offsetHeight / 2,
|
|
13
|
+
behavior: "smooth"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, [l]);
|
|
17
|
+
let m = (e, t) => {
|
|
18
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), u(t));
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ s("div", {
|
|
21
|
+
"data-slot": "am-pm-scroll",
|
|
22
|
+
ref: f,
|
|
23
|
+
role: "listbox",
|
|
24
|
+
"aria-label": "AM/PM",
|
|
25
|
+
"aria-orientation": "vertical",
|
|
26
|
+
className: e(t, d),
|
|
27
|
+
children: c.map((t) => {
|
|
28
|
+
let a = l !== null && t === l;
|
|
29
|
+
return /* @__PURE__ */ s("div", {
|
|
30
|
+
ref: a ? p : void 0,
|
|
31
|
+
tabIndex: 0,
|
|
32
|
+
className: e(n, a ? r : i),
|
|
33
|
+
onClick: () => u(t),
|
|
34
|
+
onKeyDown: (e) => m(e, t),
|
|
35
|
+
role: "option",
|
|
36
|
+
"aria-selected": a,
|
|
37
|
+
children: t
|
|
38
|
+
}, t);
|
|
39
|
+
})
|
|
40
|
+
});
|
|
57
41
|
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { l as AmPmScroll };
|
|
@@ -1,119 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
isSelected: t,
|
|
10
|
-
isToday: s,
|
|
11
|
-
isRangeStart: o,
|
|
12
|
-
isRangeEnd: c,
|
|
13
|
-
isInRange: a,
|
|
14
|
-
isInHoverRange: i
|
|
15
|
-
}) {
|
|
16
|
-
return b(
|
|
17
|
-
"w-9 h-9 flex items-center justify-center text-sm font-medium cursor-pointer select-none relative transition-colors",
|
|
18
|
-
"focus-visible:ring-2 focus-visible:ring-border focus-visible:outline-none",
|
|
19
|
-
// border-radius for range endpoints
|
|
20
|
-
o && c && "rounded-lg",
|
|
21
|
-
o && !c && "rounded-l-lg",
|
|
22
|
-
c && !o && "rounded-r-lg",
|
|
23
|
-
// selected day
|
|
24
|
-
t && "bg-primary-background text-foreground-on-primary hover:bg-primary-background",
|
|
25
|
-
// unselected text
|
|
26
|
-
!t && r && "text-muted-foreground/50",
|
|
27
|
-
!t && !r && (a || i) ? "text-foreground" : !t && !r && "text-secondary-foreground",
|
|
28
|
-
// range highlight
|
|
29
|
-
!t && (a || i) && "bg-accent-background",
|
|
30
|
-
!t && "hover:bg-accent-background hover:rounded-lg hover:text-foreground",
|
|
31
|
-
// today outline
|
|
32
|
-
s && !t && "border border-border rounded-lg"
|
|
33
|
-
);
|
|
1
|
+
import { cn as e } from "../../../../../../lib/utils.js";
|
|
2
|
+
import { getCalendarDays as t, getWeekNumbers as n, getWeekdayNames as r, isDateInRange as i, isOutsideMonth as a, isSameDay as o, isToday as s } from "../../utils/calendar-utils.js";
|
|
3
|
+
import { CalendarHeader as c } from "../calendar-header/calendar-header.js";
|
|
4
|
+
import l from "react";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/calendar/calendar.tsx
|
|
7
|
+
function f({ isOutsideMonth: t, isSelected: n, isToday: r, isRangeStart: i, isRangeEnd: a, isInRange: o, isInHoverRange: s }) {
|
|
8
|
+
return e("w-9 h-9 flex items-center justify-center text-sm font-medium cursor-pointer select-none relative transition-colors", "focus-visible:ring-2 focus-visible:ring-border focus-visible:outline-none", i && a && "rounded-lg", i && !a && "rounded-l-lg", a && !i && "rounded-r-lg", n && "bg-primary-background text-foreground-on-primary hover:bg-primary-background", !n && t && "text-muted-foreground/50", !n && !t && (o || s) ? "text-foreground" : !n && !t && "text-secondary-foreground", !n && (o || s) && "bg-accent-background", !n && "hover:bg-accent-background hover:rounded-lg hover:text-foreground", r && !n && "border border-border rounded-lg");
|
|
34
9
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
)),
|
|
92
|
-
h.map((e, d) => {
|
|
93
|
-
const u = w(e), g = Math.floor(d / p), I = o && d % p === 0, j = `day-${e.format("YYYY-MM-DD")}`;
|
|
94
|
-
return /* @__PURE__ */ x(C.Fragment, { children: [
|
|
95
|
-
I && /* @__PURE__ */ l("div", { className: "text-xs text-muted-foreground text-center flex items-center justify-center h-9", children: k[g] }),
|
|
96
|
-
/* @__PURE__ */ l(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
className: P(u),
|
|
100
|
-
onClick: () => c(e),
|
|
101
|
-
onMouseEnter: () => i?.(e),
|
|
102
|
-
onMouseLeave: () => i?.(null),
|
|
103
|
-
role: "gridcell",
|
|
104
|
-
tabIndex: 0,
|
|
105
|
-
"aria-label": e.format("DD MMMM YYYY"),
|
|
106
|
-
"aria-selected": u.isSelected,
|
|
107
|
-
children: e.date()
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
] }, j);
|
|
111
|
-
})
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] });
|
|
116
|
-
};
|
|
117
|
-
export {
|
|
118
|
-
W as Calendar
|
|
10
|
+
var p = ({ displayedMonth: p, selectedRange: m, hoverDate: h, displayWeekNumber: g = !1, onDateClick: _, onMonthChange: v, onDateHover: y, className: b }) => {
|
|
11
|
+
let [x, S] = m, C = t(p), w = r(), T = g ? n(C) : [], E = () => {
|
|
12
|
+
v(p.subtract(1, "month"));
|
|
13
|
+
}, D = () => {
|
|
14
|
+
v(p.add(1, "month"));
|
|
15
|
+
}, O = (e) => {
|
|
16
|
+
let t = {
|
|
17
|
+
isOutsideMonth: a(e, p),
|
|
18
|
+
isToday: s(e),
|
|
19
|
+
isSelected: o(e, x) || o(e, S),
|
|
20
|
+
isRangeStart: o(e, x),
|
|
21
|
+
isRangeEnd: o(e, S),
|
|
22
|
+
isInRange: i(e, x, S),
|
|
23
|
+
isInHoverRange: !1
|
|
24
|
+
};
|
|
25
|
+
return h && x && !S && (t.isInHoverRange = i(e, x.isBefore(h) ? x : h, x.isBefore(h) ? h : x)), t;
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ d("div", {
|
|
28
|
+
"data-slot": "calendar",
|
|
29
|
+
className: e("flex flex-col gap-4", b),
|
|
30
|
+
children: [/* @__PURE__ */ u(c, {
|
|
31
|
+
displayedMonth: p,
|
|
32
|
+
onPrevMonth: E,
|
|
33
|
+
onNextMonth: D,
|
|
34
|
+
onMonthChange: v
|
|
35
|
+
}), /* @__PURE__ */ d("div", {
|
|
36
|
+
className: e("grid gap-0", g ? "grid-cols-calendar-weeks" : "grid-cols-calendar"),
|
|
37
|
+
children: [
|
|
38
|
+
g && /* @__PURE__ */ u("div", {
|
|
39
|
+
className: "text-xs font-semibold text-muted-foreground text-center py-2 px-1",
|
|
40
|
+
children: "#"
|
|
41
|
+
}),
|
|
42
|
+
w.map((e) => /* @__PURE__ */ u("div", {
|
|
43
|
+
className: "text-xs font-medium text-muted-foreground text-center py-2 px-1 tracking-tighter",
|
|
44
|
+
children: e
|
|
45
|
+
}, e)),
|
|
46
|
+
C.map((e, t) => {
|
|
47
|
+
let n = O(e), r = Math.floor(t / 7), i = g && t % 7 == 0, a = `day-${e.format("YYYY-MM-DD")}`;
|
|
48
|
+
return /* @__PURE__ */ d(l.Fragment, { children: [i && /* @__PURE__ */ u("div", {
|
|
49
|
+
className: "text-xs text-muted-foreground text-center flex items-center justify-center h-9",
|
|
50
|
+
children: T[r]
|
|
51
|
+
}), /* @__PURE__ */ u("div", {
|
|
52
|
+
className: f(n),
|
|
53
|
+
onClick: () => _(e),
|
|
54
|
+
onMouseEnter: () => y?.(e),
|
|
55
|
+
onMouseLeave: () => y?.(null),
|
|
56
|
+
role: "gridcell",
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
"aria-label": e.format("DD MMMM YYYY"),
|
|
59
|
+
"aria-selected": n.isSelected,
|
|
60
|
+
children: e.date()
|
|
61
|
+
})] }, a);
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
119
66
|
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { p as Calendar };
|