@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.
@@ -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='no_shrink h_item gap_sm bd_b_1 bd_b_bd'
54
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 6, paddingBottom: 6 }}
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='bg_secondary'
58
- size='sm'
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='button'
67
- className='av_sm h_center'
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='arrow-left' />
77
+ <Icon name="arrow-left" />
73
78
  </button>
74
79
 
75
80
  <button
76
- type='button'
77
- className='av_sm h_center'
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='arrow-right' />
87
+ <Icon name="arrow-right" />
83
88
  </button>
84
89
 
85
- <span className={cn('f ellip ft_md ft_bold')}>{title}</span>
90
+ <span className="f ellip ft_md ft_bold">{title}</span>
86
91
 
87
- <label className='h_item gap_sm pointer unsel no_shrink'>
92
+ <label className="h_item gap_sm pointer unsel no_shrink">
88
93
  <ToggleSwitch
89
- size='sm'
94
+ size="sm"
90
95
  checked={mineOnly}
91
96
  onChange={(event) => onToggleMineOnly(event.currentTarget.checked)}
92
97
  />
93
- <span className='ft_tn cl_md'>{mineOnlyText}</span>
98
+ <span className="ft_xxs cl_md">{mineOnlyText}</span>
94
99
  </label>
95
100
 
96
- <SegmentedControl
97
- className='no_shrink ft_sm'
98
- heightClassName='h_30'
99
- borderRadiusClassName='r_df'
100
- selectedBorderRadiusClassName='r_smw'
101
- gapSize={3}
102
- options={viewOptions}
103
- selectedValue={selectedView}
104
- onClickItem={(_event, value) => onSelectView(value)}
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>