dash-core-components 4.1.0 → 4.3.0
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/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +2 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +1 -0
- package/lib/components/Clipboard.react.js +220 -126
- package/lib/components/ConfirmDialog.react.js +62 -35
- package/lib/components/ConfirmDialogProvider.react.js +45 -22
- package/lib/components/Download.react.js +46 -24
- package/lib/components/Geolocation.react.js +92 -64
- package/lib/components/Graph.react.js +112 -75
- package/lib/components/Input.tsx +2 -2
- package/lib/components/Interval.react.js +88 -57
- package/lib/components/Link.react.js +16 -18
- package/lib/components/Location.react.js +127 -101
- package/lib/components/Markdown.react.js +43 -15
- package/lib/components/Store.react.js +177 -131
- package/lib/components/Upload.react.js +28 -8
- package/lib/components/css/dropdown.css +6 -0
- package/lib/components/css/sliders.css +1 -0
- package/lib/fragments/DatePickerRange.tsx +147 -148
- package/lib/fragments/DatePickerSingle.tsx +115 -116
- package/lib/fragments/Dropdown.tsx +42 -2
- package/lib/fragments/Graph.privateprops.js +9 -3
- package/lib/fragments/Graph.react.js +418 -322
- package/lib/fragments/Markdown.react.js +163 -112
- package/lib/fragments/Math.react.js +49 -24
- package/lib/fragments/Upload.react.js +344 -220
- package/lib/types.ts +7 -0
- package/lib/utils/LazyLoader/graph.js +3 -2
- package/lib/utils/LazyLoader/hljs.js +5 -2
- package/lib/utils/LazyLoader/markdown.js +3 -2
- package/lib/utils/LazyLoader/mathjax.js +5 -2
- package/lib/utils/LazyLoader/plotly.js +6 -7
- package/lib/utils/LazyLoader/upload.js +3 -2
- package/lib/utils/LoadingElement.js +5 -5
- package/lib/utils/MarkdownHighlighter.js +6 -5
- package/lib/utils/ResizeDetector.js +17 -14
- package/lib/utils/dropdownSearch.ts +32 -12
- package/lib/utils/optionRendering.tsx +3 -0
- package/package.json +3 -3
|
@@ -357,159 +357,158 @@ const DatePickerRange = ({
|
|
|
357
357
|
);
|
|
358
358
|
|
|
359
359
|
return (
|
|
360
|
-
<
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
>
|
|
382
|
-
<AutosizeInput
|
|
383
|
-
ref={startAutosizeRef}
|
|
384
|
-
inputRef={node => {
|
|
385
|
-
startInputRef.current = node;
|
|
386
|
-
}}
|
|
387
|
-
type="text"
|
|
388
|
-
id={start_date_id || accessibleId}
|
|
389
|
-
inputClassName="dash-datepicker-input dash-datepicker-start-date"
|
|
390
|
-
value={startInputValue}
|
|
391
|
-
onChange={e =>
|
|
392
|
-
setStartInputValue(e.target?.value)
|
|
393
|
-
}
|
|
394
|
-
onKeyDown={handleStartInputKeyDown}
|
|
395
|
-
onFocus={() => {
|
|
396
|
-
if (isCalendarOpen) {
|
|
397
|
-
sendStartInputAsDate();
|
|
398
|
-
}
|
|
399
|
-
}}
|
|
400
|
-
placeholder={start_date_placeholder_text}
|
|
401
|
-
disabled={disabled}
|
|
402
|
-
dir={direction}
|
|
403
|
-
aria-label={start_date_placeholder_text}
|
|
404
|
-
/>
|
|
405
|
-
<ArrowIcon className="dash-datepicker-range-arrow" />
|
|
406
|
-
<AutosizeInput
|
|
407
|
-
ref={endAutosizeRef}
|
|
408
|
-
inputRef={node => {
|
|
409
|
-
endInputRef.current = node;
|
|
410
|
-
}}
|
|
411
|
-
type="text"
|
|
412
|
-
id={end_date_id || accessibleId + '-end-date'}
|
|
413
|
-
inputClassName="dash-datepicker-input dash-datepicker-end-date"
|
|
414
|
-
value={endInputValue}
|
|
415
|
-
onChange={e =>
|
|
416
|
-
setEndInputValue(e.target?.value)
|
|
417
|
-
}
|
|
418
|
-
onKeyDown={handleEndInputKeyDown}
|
|
419
|
-
onFocus={() => {
|
|
420
|
-
if (isCalendarOpen) {
|
|
421
|
-
sendEndInputAsDate();
|
|
422
|
-
}
|
|
423
|
-
}}
|
|
424
|
-
placeholder={end_date_placeholder_text}
|
|
425
|
-
disabled={disabled}
|
|
426
|
-
dir={direction}
|
|
427
|
-
aria-label={end_date_placeholder_text}
|
|
428
|
-
/>
|
|
429
|
-
{clearable && !disabled && (
|
|
430
|
-
<a
|
|
431
|
-
className="dash-datepicker-clear"
|
|
432
|
-
onClick={clearSelection}
|
|
433
|
-
aria-label="Clear Dates"
|
|
434
|
-
>
|
|
435
|
-
<Cross1Icon />
|
|
436
|
-
</a>
|
|
437
|
-
)}
|
|
438
|
-
<CaretDownIcon className="dash-datepicker-caret-icon" />
|
|
439
|
-
</div>
|
|
440
|
-
</Popover.Trigger>
|
|
441
|
-
|
|
442
|
-
<Popover.Portal
|
|
443
|
-
container={hasPortal ? undefined : containerRef.current}
|
|
360
|
+
<div className="dash-datepicker" ref={containerRef}>
|
|
361
|
+
<ResizeDetector onResize={handleResize} targets={[containerRef]}/>
|
|
362
|
+
<Popover.Root
|
|
363
|
+
open={!disabled && isCalendarOpen}
|
|
364
|
+
onOpenChange={disabled ? undefined : setIsCalendarOpen}
|
|
365
|
+
>
|
|
366
|
+
<Popover.Trigger asChild disabled={disabled}>
|
|
367
|
+
<div
|
|
368
|
+
id={accessibleId + '-wrapper'}
|
|
369
|
+
className={classNames}
|
|
370
|
+
style={style}
|
|
371
|
+
aria-labelledby={`${accessibleId} ${accessibleId}-end-date ${start_date_id} ${end_date_id}`}
|
|
372
|
+
aria-haspopup="dialog"
|
|
373
|
+
aria-expanded={isCalendarOpen}
|
|
374
|
+
aria-disabled={disabled}
|
|
375
|
+
onClick={e => {
|
|
376
|
+
e.preventDefault();
|
|
377
|
+
if (!isCalendarOpen && !disabled) {
|
|
378
|
+
setIsCalendarOpen(true);
|
|
379
|
+
}
|
|
380
|
+
}}
|
|
444
381
|
>
|
|
445
|
-
<
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
avoidCollisions={!hasPortal}
|
|
457
|
-
onInteractOutside={
|
|
458
|
-
with_full_screen_portal
|
|
459
|
-
? e => e.preventDefault()
|
|
460
|
-
: undefined
|
|
382
|
+
<AutosizeInput
|
|
383
|
+
ref={startAutosizeRef}
|
|
384
|
+
inputRef={node => {
|
|
385
|
+
startInputRef.current = node;
|
|
386
|
+
}}
|
|
387
|
+
type="text"
|
|
388
|
+
id={start_date_id || accessibleId}
|
|
389
|
+
inputClassName="dash-datepicker-input dash-datepicker-start-date"
|
|
390
|
+
value={startInputValue}
|
|
391
|
+
onChange={e =>
|
|
392
|
+
setStartInputValue(e.target?.value)
|
|
461
393
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
const inputs: (Element | null)[] = [
|
|
467
|
-
startInputRef.current,
|
|
468
|
-
endInputRef.current,
|
|
469
|
-
];
|
|
470
|
-
if (inputs.includes(document.activeElement)) {
|
|
471
|
-
return;
|
|
394
|
+
onKeyDown={handleStartInputKeyDown}
|
|
395
|
+
onFocus={() => {
|
|
396
|
+
if (isCalendarOpen) {
|
|
397
|
+
sendStartInputAsDate();
|
|
472
398
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
399
|
+
}}
|
|
400
|
+
placeholder={start_date_placeholder_text}
|
|
401
|
+
disabled={disabled}
|
|
402
|
+
dir={direction}
|
|
403
|
+
aria-label={start_date_placeholder_text}
|
|
404
|
+
/>
|
|
405
|
+
<ArrowIcon className="dash-datepicker-range-arrow" />
|
|
406
|
+
<AutosizeInput
|
|
407
|
+
ref={endAutosizeRef}
|
|
408
|
+
inputRef={node => {
|
|
409
|
+
endInputRef.current = node;
|
|
410
|
+
}}
|
|
411
|
+
type="text"
|
|
412
|
+
id={end_date_id || accessibleId + '-end-date'}
|
|
413
|
+
inputClassName="dash-datepicker-input dash-datepicker-end-date"
|
|
414
|
+
value={endInputValue}
|
|
415
|
+
onChange={e =>
|
|
416
|
+
setEndInputValue(e.target?.value)
|
|
417
|
+
}
|
|
418
|
+
onKeyDown={handleEndInputKeyDown}
|
|
419
|
+
onFocus={() => {
|
|
420
|
+
if (isCalendarOpen) {
|
|
421
|
+
sendEndInputAsDate();
|
|
479
422
|
}
|
|
480
423
|
}}
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
424
|
+
placeholder={end_date_placeholder_text}
|
|
425
|
+
disabled={disabled}
|
|
426
|
+
dir={direction}
|
|
427
|
+
aria-label={end_date_placeholder_text}
|
|
428
|
+
/>
|
|
429
|
+
{clearable && !disabled && (
|
|
430
|
+
<a
|
|
431
|
+
className="dash-datepicker-clear"
|
|
432
|
+
onClick={clearSelection}
|
|
433
|
+
aria-label="Clear Dates"
|
|
434
|
+
>
|
|
435
|
+
<Cross1Icon />
|
|
436
|
+
</a>
|
|
437
|
+
)}
|
|
438
|
+
<CaretDownIcon className="dash-datepicker-caret-icon" />
|
|
439
|
+
</div>
|
|
440
|
+
</Popover.Trigger>
|
|
441
|
+
|
|
442
|
+
<Popover.Portal
|
|
443
|
+
container={hasPortal ? undefined : containerRef.current}
|
|
444
|
+
>
|
|
445
|
+
<Popover.Content
|
|
446
|
+
className={`dash-datepicker-content${
|
|
447
|
+
hasPortal ? ' dash-datepicker-portal' : ''
|
|
448
|
+
}${
|
|
449
|
+
with_full_screen_portal
|
|
450
|
+
? ' dash-datepicker-fullscreen'
|
|
451
|
+
: ''
|
|
452
|
+
}`}
|
|
453
|
+
style={portalStyle}
|
|
454
|
+
align={hasPortal ? 'center' : 'start'}
|
|
455
|
+
sideOffset={hasPortal ? 0 : 5}
|
|
456
|
+
avoidCollisions={!hasPortal}
|
|
457
|
+
onInteractOutside={
|
|
458
|
+
with_full_screen_portal
|
|
459
|
+
? e => e.preventDefault()
|
|
460
|
+
: undefined
|
|
461
|
+
}
|
|
462
|
+
onOpenAutoFocus={e => e.preventDefault()}
|
|
463
|
+
onCloseAutoFocus={e => {
|
|
464
|
+
e.preventDefault();
|
|
465
|
+
// Only focus if focus is not already on one of the inputs
|
|
466
|
+
const inputs: (Element | null)[] = [
|
|
467
|
+
startInputRef.current,
|
|
468
|
+
endInputRef.current,
|
|
469
|
+
];
|
|
470
|
+
if (inputs.includes(document.activeElement)) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Keeps focus on the component when the calendar closes
|
|
475
|
+
if (!startInputValue) {
|
|
476
|
+
startInputRef.current?.focus();
|
|
477
|
+
} else {
|
|
478
|
+
endInputRef.current?.focus();
|
|
479
|
+
}
|
|
480
|
+
}}
|
|
481
|
+
>
|
|
482
|
+
{with_full_screen_portal && (
|
|
483
|
+
<button
|
|
484
|
+
className="dash-datepicker-close-button"
|
|
485
|
+
onClick={() => setIsCalendarOpen(false)}
|
|
486
|
+
aria-label="Close calendar"
|
|
487
|
+
>
|
|
488
|
+
<Cross1Icon />
|
|
489
|
+
</button>
|
|
490
|
+
)}
|
|
491
|
+
<Calendar
|
|
492
|
+
ref={calendarRef}
|
|
493
|
+
initialVisibleDate={initialCalendarDate}
|
|
494
|
+
selectionStart={internalStartDate}
|
|
495
|
+
selectionEnd={internalEndDate}
|
|
496
|
+
minDateAllowed={minDate}
|
|
497
|
+
maxDateAllowed={maxDate}
|
|
498
|
+
disabledDates={disabledDates}
|
|
499
|
+
firstDayOfWeek={first_day_of_week}
|
|
500
|
+
showOutsideDays={show_outside_days}
|
|
501
|
+
monthFormat={month_format}
|
|
502
|
+
numberOfMonthsShown={number_of_months_shown}
|
|
503
|
+
calendarOrientation={calendar_orientation}
|
|
504
|
+
daySize={day_size}
|
|
505
|
+
direction={direction}
|
|
506
|
+
onSelectionChange={handleSelectionChange}
|
|
507
|
+
/>
|
|
508
|
+
</Popover.Content>
|
|
509
|
+
</Popover.Portal>
|
|
510
|
+
</Popover.Root>
|
|
511
|
+
</div>
|
|
513
512
|
);
|
|
514
513
|
};
|
|
515
514
|
|
|
@@ -167,128 +167,127 @@ const DatePickerSingle = ({
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
return (
|
|
170
|
-
<
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
170
|
+
<div className="dash-datepicker" ref={containerRef}>
|
|
171
|
+
<ResizeDetector onResize={handleResize} targets={[containerRef]}/>
|
|
172
|
+
<Popover.Root
|
|
173
|
+
open={!disabled && isCalendarOpen}
|
|
174
|
+
onOpenChange={disabled ? undefined : setIsCalendarOpen}
|
|
175
|
+
>
|
|
176
|
+
<Popover.Trigger asChild disabled={disabled}>
|
|
177
|
+
<div
|
|
178
|
+
id={accessibleId + '-wrapper'}
|
|
179
|
+
className={classNames}
|
|
180
|
+
style={style}
|
|
181
|
+
aria-labelledby={`${accessibleId}`}
|
|
182
|
+
aria-haspopup="dialog"
|
|
183
|
+
aria-expanded={isCalendarOpen}
|
|
184
|
+
aria-disabled={disabled}
|
|
185
|
+
onClick={e => {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
if (!isCalendarOpen && !disabled) {
|
|
188
|
+
setIsCalendarOpen(true);
|
|
189
|
+
}
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<AutosizeInput
|
|
193
|
+
ref={autosizeRef}
|
|
194
|
+
inputRef={node => {
|
|
195
|
+
inputRef.current = node;
|
|
190
196
|
}}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
aria-label=
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
onClick={clearSelection}
|
|
212
|
-
aria-label="Clear date"
|
|
213
|
-
>
|
|
214
|
-
<Cross1Icon />
|
|
215
|
-
</a>
|
|
216
|
-
)}
|
|
197
|
+
type="text"
|
|
198
|
+
id={accessibleId}
|
|
199
|
+
inputClassName="dash-datepicker-input dash-datepicker-end-date"
|
|
200
|
+
value={inputValue}
|
|
201
|
+
onChange={e => setInputValue(e.target?.value)}
|
|
202
|
+
onKeyDown={handleInputKeyDown}
|
|
203
|
+
placeholder={placeholder}
|
|
204
|
+
disabled={disabled}
|
|
205
|
+
dir={direction}
|
|
206
|
+
aria-label={placeholder}
|
|
207
|
+
/>
|
|
208
|
+
{clearable && !disabled && !!date && (
|
|
209
|
+
<a
|
|
210
|
+
className="dash-datepicker-clear"
|
|
211
|
+
onClick={clearSelection}
|
|
212
|
+
aria-label="Clear date"
|
|
213
|
+
>
|
|
214
|
+
<Cross1Icon />
|
|
215
|
+
</a>
|
|
216
|
+
)}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
<CaretDownIcon className="dash-datepicker-caret-icon" />
|
|
219
|
+
</div>
|
|
220
|
+
</Popover.Trigger>
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
222
|
+
<Popover.Portal
|
|
223
|
+
container={hasPortal ? undefined : containerRef.current}
|
|
224
|
+
>
|
|
225
|
+
<Popover.Content
|
|
226
|
+
className={`dash-datepicker-content${
|
|
227
|
+
hasPortal ? ' dash-datepicker-portal' : ''
|
|
228
|
+
}${
|
|
229
|
+
with_full_screen_portal
|
|
230
|
+
? ' dash-datepicker-fullscreen'
|
|
231
|
+
: ''
|
|
232
|
+
}`}
|
|
233
|
+
style={portalStyle}
|
|
234
|
+
align={hasPortal ? 'center' : 'start'}
|
|
235
|
+
sideOffset={hasPortal ? 0 : 5}
|
|
236
|
+
avoidCollisions={!hasPortal}
|
|
237
|
+
onInteractOutside={
|
|
238
|
+
with_full_screen_portal
|
|
239
|
+
? e => e.preventDefault()
|
|
240
|
+
: undefined
|
|
241
|
+
}
|
|
242
|
+
onOpenAutoFocus={e => e.preventDefault()}
|
|
243
|
+
onCloseAutoFocus={e => {
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
// Only focus if focus is not already on the input
|
|
246
|
+
if (
|
|
247
|
+
document.activeElement !== inputRef.current
|
|
248
|
+
) {
|
|
249
|
+
inputRef.current?.focus();
|
|
241
250
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
253
|
+
{with_full_screen_portal && (
|
|
254
|
+
<button
|
|
255
|
+
className="dash-datepicker-close-button"
|
|
256
|
+
onClick={() => setIsCalendarOpen(false)}
|
|
257
|
+
aria-label="Close calendar"
|
|
258
|
+
>
|
|
259
|
+
<Cross1Icon />
|
|
260
|
+
</button>
|
|
261
|
+
)}
|
|
262
|
+
<Calendar
|
|
263
|
+
ref={calendarRef}
|
|
264
|
+
initialVisibleDate={initialMonth}
|
|
265
|
+
selectionStart={internalDate}
|
|
266
|
+
selectionEnd={internalDate}
|
|
267
|
+
minDateAllowed={minDate}
|
|
268
|
+
maxDateAllowed={maxDate}
|
|
269
|
+
disabledDates={disabledDates}
|
|
270
|
+
firstDayOfWeek={first_day_of_week}
|
|
271
|
+
showOutsideDays={show_outside_days}
|
|
272
|
+
monthFormat={month_format}
|
|
273
|
+
numberOfMonthsShown={number_of_months_shown}
|
|
274
|
+
calendarOrientation={calendar_orientation}
|
|
275
|
+
daySize={day_size}
|
|
276
|
+
direction={direction}
|
|
277
|
+
onSelectionChange={(_, selection) => {
|
|
278
|
+
if (!selection) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
setInternalDate(selection);
|
|
282
|
+
if (!stay_open_on_select) {
|
|
283
|
+
setIsCalendarOpen(false);
|
|
250
284
|
}
|
|
251
285
|
}}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
aria-label="Close calendar"
|
|
258
|
-
>
|
|
259
|
-
<Cross1Icon />
|
|
260
|
-
</button>
|
|
261
|
-
)}
|
|
262
|
-
<Calendar
|
|
263
|
-
ref={calendarRef}
|
|
264
|
-
initialVisibleDate={initialMonth}
|
|
265
|
-
selectionStart={internalDate}
|
|
266
|
-
selectionEnd={internalDate}
|
|
267
|
-
minDateAllowed={minDate}
|
|
268
|
-
maxDateAllowed={maxDate}
|
|
269
|
-
disabledDates={disabledDates}
|
|
270
|
-
firstDayOfWeek={first_day_of_week}
|
|
271
|
-
showOutsideDays={show_outside_days}
|
|
272
|
-
monthFormat={month_format}
|
|
273
|
-
numberOfMonthsShown={number_of_months_shown}
|
|
274
|
-
calendarOrientation={calendar_orientation}
|
|
275
|
-
daySize={day_size}
|
|
276
|
-
direction={direction}
|
|
277
|
-
onSelectionChange={(_, selection) => {
|
|
278
|
-
if (!selection) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
setInternalDate(selection);
|
|
282
|
-
if (!stay_open_on_select) {
|
|
283
|
-
setIsCalendarOpen(false);
|
|
284
|
-
}
|
|
285
|
-
}}
|
|
286
|
-
/>
|
|
287
|
-
</Popover.Content>
|
|
288
|
-
</Popover.Portal>
|
|
289
|
-
</Popover.Root>
|
|
290
|
-
</div>
|
|
291
|
-
</ResizeDetector>
|
|
286
|
+
/>
|
|
287
|
+
</Popover.Content>
|
|
288
|
+
</Popover.Portal>
|
|
289
|
+
</Popover.Root>
|
|
290
|
+
</div>
|
|
292
291
|
);
|
|
293
292
|
};
|
|
294
293
|
|
|
@@ -41,6 +41,7 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
41
41
|
setProps,
|
|
42
42
|
searchable,
|
|
43
43
|
search_value,
|
|
44
|
+
search_order,
|
|
44
45
|
style,
|
|
45
46
|
value,
|
|
46
47
|
} = props;
|
|
@@ -81,9 +82,9 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
81
82
|
const filteredOptions = useMemo(
|
|
82
83
|
() =>
|
|
83
84
|
searchable
|
|
84
|
-
? filterOptions(sanitized, search_value)
|
|
85
|
+
? filterOptions(sanitized, search_value, search_order)
|
|
85
86
|
: sanitizedOptions,
|
|
86
|
-
[sanitized, searchable, search_value]
|
|
87
|
+
[sanitized, searchable, search_value, search_order]
|
|
87
88
|
);
|
|
88
89
|
|
|
89
90
|
const sanitizedValues: OptionValue[] = useMemo(() => {
|
|
@@ -312,6 +313,7 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
312
313
|
const relevantKeys = [
|
|
313
314
|
'ArrowDown',
|
|
314
315
|
'ArrowUp',
|
|
316
|
+
'Tab',
|
|
315
317
|
'PageDown',
|
|
316
318
|
'PageUp',
|
|
317
319
|
'Home',
|
|
@@ -341,6 +343,19 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
341
343
|
let nextIndex: number;
|
|
342
344
|
|
|
343
345
|
switch (e.key) {
|
|
346
|
+
case 'Tab': {
|
|
347
|
+
// Trap Tab inside the popover so Safari (which
|
|
348
|
+
// skips non-text inputs) can navigate options.
|
|
349
|
+
const next = current + (e.shiftKey ? -1 : 1);
|
|
350
|
+
if (next < minIndex) {
|
|
351
|
+
nextIndex = maxIndex;
|
|
352
|
+
} else if (next > maxIndex) {
|
|
353
|
+
nextIndex = minIndex;
|
|
354
|
+
} else {
|
|
355
|
+
nextIndex = next;
|
|
356
|
+
}
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
344
359
|
case 'ArrowDown':
|
|
345
360
|
nextIndex = current < maxIndex ? current + 1 : minIndex;
|
|
346
361
|
break;
|
|
@@ -407,12 +422,37 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
407
422
|
|
|
408
423
|
const popover = (
|
|
409
424
|
<Popover.Root open={isOpen} onOpenChange={handleOpenChange}>
|
|
425
|
+
{/* Safari skips <button> in the Tab order; this hidden
|
|
426
|
+
input receives Tab focus and delegates to the button. */}
|
|
427
|
+
<input
|
|
428
|
+
className="dash-dropdown-focus-target"
|
|
429
|
+
tabIndex={disabled ? -1 : 0}
|
|
430
|
+
readOnly
|
|
431
|
+
aria-hidden="true"
|
|
432
|
+
onFocus={e => {
|
|
433
|
+
if (e.relatedTarget !== dropdownContainerRef.current) {
|
|
434
|
+
e.currentTarget.tabIndex = -1;
|
|
435
|
+
dropdownContainerRef.current?.focus();
|
|
436
|
+
}
|
|
437
|
+
}}
|
|
438
|
+
onClick={() => {
|
|
439
|
+
dropdownContainerRef.current?.click();
|
|
440
|
+
}}
|
|
441
|
+
/>
|
|
410
442
|
<Popover.Trigger asChild>
|
|
411
443
|
<button
|
|
412
444
|
id={id}
|
|
413
445
|
ref={dropdownContainerRef}
|
|
414
446
|
disabled={disabled}
|
|
415
447
|
type="button"
|
|
448
|
+
tabIndex={-1}
|
|
449
|
+
onBlur={e => {
|
|
450
|
+
const dummyInput =
|
|
451
|
+
e.currentTarget.previousElementSibling;
|
|
452
|
+
if (dummyInput instanceof HTMLElement) {
|
|
453
|
+
dummyInput.tabIndex = 0;
|
|
454
|
+
}
|
|
455
|
+
}}
|
|
416
456
|
onKeyDown={e => {
|
|
417
457
|
if (['ArrowDown', 'Enter'].includes(e.key)) {
|
|
418
458
|
e.preventDefault();
|
|
@@ -12,7 +12,13 @@ var privatePropTypes = exports.privatePropTypes = {
|
|
|
12
12
|
_dashprivate_onFigureModified: _propTypes.default.func
|
|
13
13
|
};
|
|
14
14
|
var privateDefaultProps = exports.privateDefaultProps = {
|
|
15
|
-
_dashprivate_transformConfig: c
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
_dashprivate_transformConfig: function _dashprivate_transformConfig(c) {
|
|
16
|
+
return c;
|
|
17
|
+
},
|
|
18
|
+
_dashprivate_transformFigure: function _dashprivate_transformFigure(f) {
|
|
19
|
+
return f;
|
|
20
|
+
},
|
|
21
|
+
_dashprivate_onFigureModified: function _dashprivate_onFigureModified(f) {
|
|
22
|
+
return f;
|
|
23
|
+
}
|
|
18
24
|
};
|