@jsb188/calendar 1.1.10 → 1.1.12
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/package.json +16 -15
- package/src/constants/calendar.ts +17 -3
- package/src/libs/calendar-geometry.ts +165 -91
- package/src/libs/calendar-gesture.ts +58 -15
- package/src/libs/calendar-now.ts +39 -0
- package/src/libs/calendar-range.ts +88 -27
- package/src/libs/calendar-state.ts +21 -156
- package/src/libs/calendar-url.ts +55 -8
- package/src/libs/roster-layout.ts +388 -0
- package/src/main.ts +3 -0
- package/src/modules/Calendar.tsx +375 -287
- package/src/modules/MiniCalendar.tsx +376 -0
- package/src/types/calendar.d.ts +7 -1
- package/src/types/shift-form.d.ts +19 -0
- package/src/ui/CalendarAgendaUI.tsx +43 -14
- package/src/ui/CalendarMonthUI.tsx +38 -26
- package/src/ui/CalendarToolbarUI.tsx +50 -27
- package/src/ui/CalendarUI.tsx +280 -226
- package/src/ui/CalendarYearUI.tsx +36 -50
- package/src/ui/RosterUI.tsx +273 -0
- package/src/ui/ShiftFormUI.tsx +333 -0
- package/tests/calendar-geometry.test.ts +230 -84
- package/tests/calendar-gesture.test.ts +43 -12
- package/tests/calendar-range.test.ts +159 -33
- package/tests/calendar-url.test.ts +77 -12
- package/tests/roster-layout.test.ts +210 -0
- package/src/ui/CalendarCoverageUI.tsx +0 -199
- package/src/ui/CalendarEventDetailUI.tsx +0 -260
- package/src/ui/CalendarEventFormUI.tsx +0 -239
- package/src/ui/CalendarRailUI.tsx +0 -282
- package/src/ui/CalendarRequestUI.tsx +0 -537
- package/src/ui/CalendarViolationUI.tsx +0 -207
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { cn } from '@jsb188/app/utils/string.ts';
|
|
2
|
-
import { Button, SegmentedControl, type SegmentedControlOption } from '@jsb188/react-web/ui/Button';
|
|
3
|
-
import { ToggleSwitch } from '@jsb188/react-web/ui/Form';
|
|
4
1
|
import { Icon } from '@jsb188/react-web/svgs/Icon';
|
|
2
|
+
import { Button, SegmentedControl, type SegmentedControlOption } from '@jsb188/react-web/ui/Button';
|
|
3
|
+
import { ToggleSwitch } from '@jsb188/form/ui/Form';
|
|
5
4
|
import { memo } from 'react';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -14,6 +13,7 @@ import { memo } from 'react';
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
export interface CalendarToolbarUIProps {
|
|
16
|
+
compact?: boolean;
|
|
17
17
|
// The range heading, e.g. "Jul 19 – 25, 2026"
|
|
18
18
|
title: string;
|
|
19
19
|
viewOptions: SegmentedControlOption[];
|
|
@@ -50,12 +50,17 @@ export const CalendarToolbarUI = memo((p: CalendarToolbarUIProps) => {
|
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
52
|
<div
|
|
53
|
-
className=
|
|
54
|
-
style={{
|
|
53
|
+
className="no_shrink h_item f_wrap gap_sm bd_b_1 bd_b_bd"
|
|
54
|
+
style={{
|
|
55
|
+
paddingLeft: 12,
|
|
56
|
+
paddingRight: 12,
|
|
57
|
+
paddingTop: 6,
|
|
58
|
+
paddingBottom: 6,
|
|
59
|
+
}}
|
|
55
60
|
>
|
|
56
61
|
<Button
|
|
57
|
-
preset=
|
|
58
|
-
size=
|
|
62
|
+
preset="bg_secondary"
|
|
63
|
+
size="sm"
|
|
59
64
|
text={todayText}
|
|
60
65
|
onClick={onToday}
|
|
61
66
|
/>
|
|
@@ -63,46 +68,64 @@ export const CalendarToolbarUI = memo((p: CalendarToolbarUIProps) => {
|
|
|
63
68
|
{/* No IconButton exists in the kit, so these are the documented raw
|
|
64
69
|
pattern: a bare button wrapping an Icon */}
|
|
65
70
|
<button
|
|
66
|
-
type=
|
|
67
|
-
className=
|
|
71
|
+
type="button"
|
|
72
|
+
className="av_sm h_center"
|
|
68
73
|
aria-label={previousText}
|
|
69
74
|
title={previousText}
|
|
70
75
|
onClick={() => onStep(-1)}
|
|
71
76
|
>
|
|
72
|
-
<Icon name=
|
|
77
|
+
<Icon name="arrow-left" />
|
|
73
78
|
</button>
|
|
74
79
|
|
|
75
80
|
<button
|
|
76
|
-
type=
|
|
77
|
-
className=
|
|
81
|
+
type="button"
|
|
82
|
+
className="av_sm h_center"
|
|
78
83
|
aria-label={nextText}
|
|
79
84
|
title={nextText}
|
|
80
85
|
onClick={() => onStep(1)}
|
|
81
86
|
>
|
|
82
|
-
<Icon name=
|
|
87
|
+
<Icon name="arrow-right" />
|
|
83
88
|
</button>
|
|
84
89
|
|
|
85
|
-
<span className=
|
|
90
|
+
<span className="f ellip ft_md ft_bold">{title}</span>
|
|
86
91
|
|
|
87
|
-
<label className=
|
|
92
|
+
<label className="h_item gap_sm pointer unsel no_shrink">
|
|
88
93
|
<ToggleSwitch
|
|
89
|
-
size=
|
|
94
|
+
size="sm"
|
|
90
95
|
checked={mineOnly}
|
|
91
96
|
onChange={(event) => onToggleMineOnly(event.currentTarget.checked)}
|
|
92
97
|
/>
|
|
93
|
-
<span className=
|
|
98
|
+
<span className="ft_xxs cl_md">{mineOnlyText}</span>
|
|
94
99
|
</label>
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
{p.compact ? (
|
|
102
|
+
<select
|
|
103
|
+
className="p_8 bd_1 bd_bd r_sm"
|
|
104
|
+
aria-label={p.title}
|
|
105
|
+
value={selectedView}
|
|
106
|
+
onChange={(event) => onSelectView(event.target.value)}
|
|
107
|
+
>
|
|
108
|
+
{viewOptions.map((option) => (
|
|
109
|
+
<option
|
|
110
|
+
key={option.value}
|
|
111
|
+
value={option.value}
|
|
112
|
+
>
|
|
113
|
+
{option.text}
|
|
114
|
+
</option>
|
|
115
|
+
))}
|
|
116
|
+
</select>
|
|
117
|
+
) : (
|
|
118
|
+
<SegmentedControl
|
|
119
|
+
className="no_shrink ft_sm"
|
|
120
|
+
heightClassName="h_30"
|
|
121
|
+
borderRadiusClassName="r_df"
|
|
122
|
+
selectedBorderRadiusClassName="r_smw"
|
|
123
|
+
gapSize={3}
|
|
124
|
+
options={viewOptions}
|
|
125
|
+
selectedValue={selectedView}
|
|
126
|
+
onClickItem={(_event, value) => onSelectView(value)}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
106
129
|
|
|
107
130
|
{RightComponent}
|
|
108
131
|
</div>
|