@jsb188/calendar 1.1.10 → 1.1.11

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.
@@ -58,16 +58,19 @@ export interface CalendarEventDetailUIProps {
58
58
  * with no location leaves no empty line behind.
59
59
  */
60
60
 
61
- function CalendarEventDetailRow(p: { iconName: string; children: React.ReactNode }) {
61
+ function CalendarEventDetailRow(p: {
62
+ iconName: string;
63
+ children: React.ReactNode;
64
+ }) {
62
65
  const { iconName, children } = p;
63
66
 
64
67
  return (
65
- <div className='h_item gap_sm' style={{ paddingTop: 3, paddingBottom: 3 }}>
66
- <span className='no_shrink cl_lt h_center' style={{ width: 18 }}>
68
+ <div className="h_item gap_sm" style={{ paddingTop: 3, paddingBottom: 3 }}>
69
+ <span className="no_shrink cl_lt h_center" style={{ width: 18 }}>
67
70
  <Icon name={iconName} />
68
71
  </span>
69
72
 
70
- <span className='f ft_sm cl_df'>{children}</span>
73
+ <span className="f ft_sm cl_df">{children}</span>
71
74
  </div>
72
75
  );
73
76
  }
@@ -103,8 +106,13 @@ export const CalendarEventDetailUI = memo((p: CalendarEventDetailUIProps) => {
103
106
  return (
104
107
  <div className={cn('bg bd_1 bd_bd r_df of', className)}>
105
108
  <div
106
- className='h_item gap_sm bd_b_1 bd_b_bd'
107
- style={{ paddingLeft: 12, paddingRight: 8, paddingTop: 8, paddingBottom: 8 }}
109
+ className="h_item gap_sm bd_b_1 bd_b_bd"
110
+ style={{
111
+ paddingLeft: 12,
112
+ paddingRight: 8,
113
+ paddingTop: 8,
114
+ paddingBottom: 8,
115
+ }}
108
116
  >
109
117
  <span
110
118
  className={cn(
@@ -116,8 +124,8 @@ export const CalendarEventDetailUI = memo((p: CalendarEventDetailUIProps) => {
116
124
  </span>
117
125
 
118
126
  <SimpleLabel
119
- className='no_shrink'
120
- preset='outline'
127
+ className="no_shrink"
128
+ preset="outline"
121
129
  color={statusColor || 'medium'}
122
130
  text={statusText}
123
131
  />
@@ -125,136 +133,133 @@ export const CalendarEventDetailUI = memo((p: CalendarEventDetailUIProps) => {
125
133
  {/* No IconButton exists in the kit, so this is the documented raw
126
134
  pattern: a bare button wrapping an Icon */}
127
135
  <button
128
- type='button'
129
- className='av_sm h_center no_shrink cl_lt'
136
+ type="button"
137
+ className="av_sm h_center no_shrink cl_lt"
130
138
  aria-label={closeText}
131
139
  title={closeText}
132
140
  onClick={onClose}
133
141
  >
134
- <Icon name='x' />
142
+ <Icon name="x" />
135
143
  </button>
136
144
  </div>
137
145
 
138
- <div style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}>
139
- <CalendarEventDetailRow iconName='clock-hour-4'>
140
- <span className={cn(status === 'DRAFT' ? CALENDAR_DRAFT_PATTERN_CLASS_NAME : '')}>
146
+ <div
147
+ style={{
148
+ paddingLeft: 12,
149
+ paddingRight: 12,
150
+ paddingTop: 8,
151
+ paddingBottom: 8,
152
+ }}
153
+ >
154
+ <CalendarEventDetailRow iconName="clock-hour-4">
155
+ <span
156
+ className={cn(
157
+ status === 'DRAFT' ? CALENDAR_DRAFT_PATTERN_CLASS_NAME : '',
158
+ )}
159
+ >
141
160
  {timeRangeText}
142
161
  </span>
143
162
  </CalendarEventDetailRow>
144
163
 
145
- {location
146
- ? (
147
- <CalendarEventDetailRow iconName='pin-location-1'>
148
- {location}
149
- </CalendarEventDetailRow>
150
- )
151
- : null}
164
+ {location ? (
165
+ <CalendarEventDetailRow iconName="pin-location-1">
166
+ {location}
167
+ </CalendarEventDetailRow>
168
+ ) : null}
152
169
 
153
- {assigneeNames.length
154
- ? (
155
- <CalendarEventDetailRow iconName='multiple-neutral-circle'>
156
- {/* Wrapping is structural here: the chip count is data, so the
170
+ {assigneeNames.length ? (
171
+ <CalendarEventDetailRow iconName="multiple-neutral-circle">
172
+ {/* Wrapping is structural here: the chip count is data, so the
157
173
  row has to be able to run onto a second line */}
158
- <span className='h_item gap_sm' style={{ flexWrap: 'wrap' }}>
159
- {assigneeNames.map((name) => (
160
- <span key={name} className='h_item gap_xs no_shrink'>
161
- <AvatarImg size='tiny' displayName={name} />
162
- <span className='ellip'>{name}</span>
163
- </span>
164
- ))}
165
- </span>
166
- </CalendarEventDetailRow>
167
- )
168
- : null}
174
+ <span className="h_item gap_sm" style={{ flexWrap: 'wrap' }}>
175
+ {assigneeNames.map((name) => (
176
+ <span key={name} className="h_item gap_xs no_shrink">
177
+ <AvatarImg size="tiny" displayName={name} />
178
+ <span className="ellip">{name}</span>
179
+ </span>
180
+ ))}
181
+ </span>
182
+ </CalendarEventDetailRow>
183
+ ) : null}
169
184
 
170
- {openCountText
171
- ? (
172
- <CalendarEventDetailRow iconName='single-neutral-actions-add'>
173
- <span className='cl_md'>{openCountText}</span>
174
- </CalendarEventDetailRow>
175
- )
176
- : null}
185
+ {openCountText ? (
186
+ <CalendarEventDetailRow iconName="single-neutral-actions-add">
187
+ <span className="cl_md">{openCountText}</span>
188
+ </CalendarEventDetailRow>
189
+ ) : null}
177
190
 
178
- {note
179
- ? (
180
- <CalendarEventDetailRow iconName='notes-paper-text'>
181
- <span className='cl_md'>{note}</span>
182
- </CalendarEventDetailRow>
183
- )
184
- : null}
191
+ {note ? (
192
+ <CalendarEventDetailRow iconName="notes-paper-text">
193
+ <span className="cl_md">{note}</span>
194
+ </CalendarEventDetailRow>
195
+ ) : null}
185
196
  </div>
186
197
 
187
- {errorText
188
- ? (
189
- <div
190
- className='ft_xs cl_err'
191
- style={{ paddingLeft: 12, paddingRight: 12, paddingBottom: 8 }}
192
- >
193
- {errorText}
194
- </div>
195
- )
196
- : null}
198
+ {errorText ? (
199
+ <div
200
+ className="ft_xs cl_err"
201
+ style={{ paddingLeft: 12, paddingRight: 12, paddingBottom: 8 }}
202
+ >
203
+ {errorText}
204
+ </div>
205
+ ) : null}
197
206
 
198
- {hasActions
199
- ? (
200
- <div
201
- className='h_item gap_sm bd_t_1 bd_t_bd'
202
- style={{ paddingLeft: 8, paddingRight: 8, paddingTop: 8, paddingBottom: 8, flexWrap: 'wrap' }}
203
- >
204
- {onEdit
205
- ? (
206
- <Button
207
- preset='bg_secondary'
208
- size='sm'
209
- disabled={busy}
210
- leftIconName='pencil-write-2'
211
- text={editText}
212
- onClick={onEdit}
213
- />
214
- )
215
- : null}
207
+ {hasActions ? (
208
+ <div
209
+ className="h_item gap_sm bd_t_1 bd_t_bd"
210
+ style={{
211
+ paddingLeft: 8,
212
+ paddingRight: 8,
213
+ paddingTop: 8,
214
+ paddingBottom: 8,
215
+ flexWrap: 'wrap',
216
+ }}
217
+ >
218
+ {onEdit ? (
219
+ <Button
220
+ preset="bg_secondary"
221
+ size="sm"
222
+ disabled={busy}
223
+ leftIconName="pencil-write-2"
224
+ text={editText}
225
+ onClick={onEdit}
226
+ />
227
+ ) : null}
216
228
 
217
- {onRelease
218
- ? (
219
- <Button
220
- preset='bg'
221
- size='sm'
222
- disabled={busy}
223
- leftIconName='switch-account-1'
224
- text={releaseText}
225
- onClick={onRelease}
226
- />
227
- )
228
- : null}
229
+ {onRelease ? (
230
+ <Button
231
+ preset="bg"
232
+ size="sm"
233
+ disabled={busy}
234
+ leftIconName="switch-account-1"
235
+ text={releaseText}
236
+ onClick={onRelease}
237
+ />
238
+ ) : null}
229
239
 
230
- {onCancelOccurrence
231
- ? (
232
- <Button
233
- preset='outline_subtle'
234
- size='sm'
235
- disabled={busy}
236
- leftIconName='cancel'
237
- text={cancelOccurrenceText}
238
- onClick={onCancelOccurrence}
239
- />
240
- )
241
- : null}
240
+ {onCancelOccurrence ? (
241
+ <Button
242
+ preset="outline_subtle"
243
+ size="sm"
244
+ disabled={busy}
245
+ leftIconName="cancel"
246
+ text={cancelOccurrenceText}
247
+ onClick={onCancelOccurrence}
248
+ />
249
+ ) : null}
242
250
 
243
- {onDelete
244
- ? (
245
- <Button
246
- preset='cl_err'
247
- size='sm'
248
- disabled={busy}
249
- leftIconName='bin'
250
- text={deleteText}
251
- onClick={onDelete}
252
- />
253
- )
254
- : null}
255
- </div>
256
- )
257
- : null}
251
+ {onDelete ? (
252
+ <Button
253
+ preset="cl_err"
254
+ size="sm"
255
+ disabled={busy}
256
+ leftIconName="bin"
257
+ text={deleteText}
258
+ onClick={onDelete}
259
+ />
260
+ ) : null}
261
+ </div>
262
+ ) : null}
258
263
  </div>
259
264
  );
260
265
  });
@@ -58,7 +58,10 @@ export interface CalendarEventFormUIProps {
58
58
  // Lets the caller veto a save the form cannot see is wrong — an end before
59
59
  // its start, a slot that violates a rule
60
60
  disableSave?: boolean;
61
- onChangeValue: (field: CalendarEventFormFieldEnum, value: string | boolean) => void;
61
+ onChangeValue: (
62
+ field: CalendarEventFormFieldEnum,
63
+ value: string | boolean,
64
+ ) => void;
62
65
  onSubmit: () => void;
63
66
  onCancel: () => void;
64
67
  }
@@ -95,21 +98,31 @@ export const CalendarEventFormUI = memo((p: CalendarEventFormUIProps) => {
95
98
  return (
96
99
  <div className={cn('v_stretch of', className)}>
97
100
  <div
98
- className='no_shrink ft_md ft_bold bd_b_1 bd_b_bd'
99
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
101
+ className="no_shrink ft_md ft_bold bd_b_1 bd_b_bd"
102
+ style={{
103
+ paddingLeft: 12,
104
+ paddingRight: 12,
105
+ paddingTop: 8,
106
+ paddingBottom: 8,
107
+ }}
100
108
  >
101
109
  {headingText}
102
110
  </div>
103
111
 
104
112
  <div
105
- className='f h_0 app_scr auto_y'
106
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
113
+ className="f h_0 app_scr auto_y"
114
+ style={{
115
+ paddingLeft: 12,
116
+ paddingRight: 12,
117
+ paddingTop: 8,
118
+ paddingBottom: 8,
119
+ }}
107
120
  >
108
121
  <Input
109
122
  fullWidth
110
123
  autoFocus
111
- preset='fill'
112
- name='title'
124
+ preset="fill"
125
+ name="title"
113
126
  label={titleLabel}
114
127
  placeholder={titlePlaceholder}
115
128
  disabled={saving}
@@ -117,80 +130,87 @@ export const CalendarEventFormUI = memo((p: CalendarEventFormUIProps) => {
117
130
  onChange={(e) => onChangeValue('title', e.currentTarget.value)}
118
131
  />
119
132
 
120
- <label className='h_item gap_sm pointer unsel' style={{ paddingTop: 10, paddingBottom: 6 }}>
133
+ <label
134
+ className="h_item gap_sm pointer unsel"
135
+ style={{ paddingTop: 10, paddingBottom: 6 }}
136
+ >
121
137
  <ToggleSwitch
122
- size='sm'
138
+ size="sm"
123
139
  disabled={saving}
124
140
  checked={values.allDay}
125
141
  onChange={(e) => onChangeValue('allDay', e.currentTarget.checked)}
126
142
  />
127
- <span className='ft_sm'>{allDayText}</span>
143
+ <span className="ft_sm">{allDayText}</span>
128
144
  </label>
129
145
 
130
146
  {/* The kit has no datetime control, so a row is a native date input
131
147
  plus a native time input; the time half disappears for an all-day
132
148
  entry rather than being disabled, because there is no time to edit */}
133
- <div className='h_item gap_sm' style={{ paddingTop: 4, paddingBottom: 4 }}>
149
+ <div
150
+ className="h_item gap_sm"
151
+ style={{ paddingTop: 4, paddingBottom: 4 }}
152
+ >
134
153
  <Input
135
154
  fullWidth
136
- className='f'
137
- preset='fill'
138
- type='date'
139
- name='startDate'
155
+ className="f"
156
+ preset="fill"
157
+ type="date"
158
+ name="startDate"
140
159
  label={startLabel}
141
160
  disabled={saving}
142
161
  value={values.startDate}
143
162
  onChange={(e) => onChangeValue('startDate', e.currentTarget.value)}
144
163
  />
145
164
 
146
- {values.allDay
147
- ? null
148
- : (
149
- <Input
150
- className='no_shrink'
151
- preset='fill'
152
- type='time'
153
- name='startTime'
154
- disabled={saving}
155
- value={values.startTime}
156
- onChange={(e) => onChangeValue('startTime', e.currentTarget.value)}
157
- />
158
- )}
165
+ {values.allDay ? null : (
166
+ <Input
167
+ className="no_shrink"
168
+ preset="fill"
169
+ type="time"
170
+ name="startTime"
171
+ disabled={saving}
172
+ value={values.startTime}
173
+ onChange={(e) =>
174
+ onChangeValue('startTime', e.currentTarget.value)
175
+ }
176
+ />
177
+ )}
159
178
  </div>
160
179
 
161
- <div className='h_item gap_sm' style={{ paddingTop: 4, paddingBottom: 4 }}>
180
+ <div
181
+ className="h_item gap_sm"
182
+ style={{ paddingTop: 4, paddingBottom: 4 }}
183
+ >
162
184
  <Input
163
185
  fullWidth
164
- className='f'
165
- preset='fill'
166
- type='date'
167
- name='endDate'
186
+ className="f"
187
+ preset="fill"
188
+ type="date"
189
+ name="endDate"
168
190
  label={endLabel}
169
191
  disabled={saving}
170
192
  value={values.endDate}
171
193
  onChange={(e) => onChangeValue('endDate', e.currentTarget.value)}
172
194
  />
173
195
 
174
- {values.allDay
175
- ? null
176
- : (
177
- <Input
178
- className='no_shrink'
179
- preset='fill'
180
- type='time'
181
- name='endTime'
182
- disabled={saving}
183
- value={values.endTime}
184
- onChange={(e) => onChangeValue('endTime', e.currentTarget.value)}
185
- />
186
- )}
196
+ {values.allDay ? null : (
197
+ <Input
198
+ className="no_shrink"
199
+ preset="fill"
200
+ type="time"
201
+ name="endTime"
202
+ disabled={saving}
203
+ value={values.endTime}
204
+ onChange={(e) => onChangeValue('endTime', e.currentTarget.value)}
205
+ />
206
+ )}
187
207
  </div>
188
208
 
189
209
  <Input
190
210
  fullWidth
191
- className='mt_xs'
192
- preset='fill'
193
- name='location'
211
+ className="mt_xs"
212
+ preset="fill"
213
+ name="location"
194
214
  label={locationLabel}
195
215
  placeholder={locationPlaceholder}
196
216
  disabled={saving}
@@ -200,9 +220,9 @@ export const CalendarEventFormUI = memo((p: CalendarEventFormUIProps) => {
200
220
 
201
221
  <Textarea
202
222
  fullWidth
203
- className='mt_xs'
204
- preset='fill'
205
- name='note'
223
+ className="mt_xs"
224
+ preset="fill"
225
+ name="note"
206
226
  label={noteLabel}
207
227
  placeholder={notePlaceholder}
208
228
  minHeight={80}
@@ -211,24 +231,31 @@ export const CalendarEventFormUI = memo((p: CalendarEventFormUIProps) => {
211
231
  onChange={(e) => onChangeValue('note', e.currentTarget.value)}
212
232
  />
213
233
 
214
- {errorText ? <div className='ft_xs cl_err mt_xs'>{errorText}</div> : null}
234
+ {errorText ? (
235
+ <div className="ft_xs cl_err mt_xs">{errorText}</div>
236
+ ) : null}
215
237
  </div>
216
238
 
217
239
  <div
218
- className='no_shrink h_right gap_sm bd_t_1 bd_t_bd'
219
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
240
+ className="no_shrink h_right gap_sm bd_t_1 bd_t_bd"
241
+ style={{
242
+ paddingLeft: 12,
243
+ paddingRight: 12,
244
+ paddingTop: 8,
245
+ paddingBottom: 8,
246
+ }}
220
247
  >
221
248
  <Button
222
- preset='bg'
223
- size='sm'
249
+ preset="bg"
250
+ size="sm"
224
251
  disabled={saving}
225
252
  text={cancelText}
226
253
  onClick={onCancel}
227
254
  />
228
255
 
229
256
  <Button
230
- preset='bg_secondary'
231
- size='sm'
257
+ preset="bg_secondary"
258
+ size="sm"
232
259
  disabled={saveDisabled}
233
260
  text={saving && savingText ? savingText : saveText}
234
261
  onClick={onSubmit}
@@ -42,20 +42,24 @@ export const CalendarMonthUI = memo((p: CalendarMonthUIProps) => {
42
42
  } = p;
43
43
 
44
44
  return (
45
- <div className='v_stretch h_f w_f of'>
46
- <div className='no_shrink h_stretch bd_b_1 bd_b_bd'>
45
+ <div className="v_stretch h_f w_f of">
46
+ <div className="no_shrink h_stretch bd_b_1 bd_b_bd">
47
47
  {weekdayLabels.map((label) => (
48
- <div key={label} className='f a_c ft_tn cl_lt' style={{ paddingTop: 4, paddingBottom: 4 }}>
48
+ <div
49
+ key={label}
50
+ className="f a_c ft_tn cl_lt"
51
+ style={{ paddingTop: 4, paddingBottom: 4 }}
52
+ >
49
53
  {label}
50
54
  </div>
51
55
  ))}
52
56
  </div>
53
57
 
54
- <div className='f h_0 app_scr auto_y'>
58
+ <div className="f h_0 app_scr auto_y">
55
59
  {/* Six rows of seven; the grid is the layout, so the cells need no
56
60
  per-row wrapper */}
57
61
  <div
58
- className='h_f'
62
+ className="h_f"
59
63
  style={{
60
64
  display: 'grid',
61
65
  gridTemplateColumns: 'repeat(7, minmax(0, 1fr))',
@@ -71,8 +75,8 @@ export const CalendarMonthUI = memo((p: CalendarMonthUIProps) => {
71
75
  )}
72
76
  >
73
77
  <button
74
- type='button'
75
- className='w_f a_l'
78
+ type="button"
79
+ className="w_f a_l"
76
80
  style={{ paddingLeft: 4, paddingRight: 4, paddingTop: 2 }}
77
81
  onClick={() => onSelectDay(cell.day.dateKey)}
78
82
  >
@@ -93,10 +97,12 @@ export const CalendarMonthUI = memo((p: CalendarMonthUIProps) => {
93
97
  {cell.events.map((event) => (
94
98
  <button
95
99
  key={event.id}
96
- type='button'
100
+ type="button"
97
101
  className={cn(
98
102
  'w_f a_l ellip ft_tn r_xs rel of',
99
- event.status === 'DRAFT' ? CALENDAR_DRAFT_PATTERN_CLASS_NAME : '',
103
+ event.status === 'DRAFT'
104
+ ? CALENDAR_DRAFT_PATTERN_CLASS_NAME
105
+ : '',
100
106
  event.status === 'CANCELED' ? 'strikethrough' : '',
101
107
  event.isMine ? 'bg_active' : 'bg_alt',
102
108
  selectedEventId === event.id ? 'bd_1 bd_bd' : '',
@@ -108,18 +114,16 @@ export const CalendarMonthUI = memo((p: CalendarMonthUIProps) => {
108
114
  </button>
109
115
  ))}
110
116
 
111
- {cell.overflowCount > 0
112
- ? (
113
- <button
114
- type='button'
115
- className='w_f a_l ellip ft_tn cl_lt'
116
- style={{ paddingLeft: 3, paddingRight: 3 }}
117
- onClick={() => onSelectOverflow(cell.day.dateKey)}
118
- >
119
- {moreLabel(cell.overflowCount)}
120
- </button>
121
- )
122
- : null}
117
+ {cell.overflowCount > 0 ? (
118
+ <button
119
+ type="button"
120
+ className="w_f a_l ellip ft_tn cl_lt"
121
+ style={{ paddingLeft: 3, paddingRight: 3 }}
122
+ onClick={() => onSelectOverflow(cell.day.dateKey)}
123
+ >
124
+ {moreLabel(cell.overflowCount)}
125
+ </button>
126
+ ) : null}
123
127
  </div>
124
128
  </div>
125
129
  ))}