dash-core-components 4.0.0-rc5 → 4.0.0-rc6
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/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/lib/components/Input.tsx +12 -2
- package/lib/components/Tabs.tsx +1 -1
- package/lib/components/css/calendar.css +1 -1
- package/lib/components/css/datepickers.css +71 -6
- package/lib/components/css/dcc.css +1 -1
- package/lib/components/css/dropdown.css +2 -6
- package/lib/components/css/input.css +1 -1
- package/lib/components/css/sliders.css +2 -1
- package/lib/fragments/DatePickerRange.tsx +29 -8
- package/lib/fragments/DatePickerSingle.tsx +28 -7
- package/lib/fragments/Dropdown.tsx +5 -5
- package/package.json +1 -1
package/lib/components/Input.tsx
CHANGED
|
@@ -176,6 +176,11 @@ function Input({
|
|
|
176
176
|
(direction: 'increment' | 'decrement') => {
|
|
177
177
|
const currentValue = parseFloat(input.current.value) || 0;
|
|
178
178
|
const stepAsNum = parseFloat(step as string) || 1;
|
|
179
|
+
|
|
180
|
+
// Count decimal places to avoid floating point precision issues
|
|
181
|
+
const decimalPlaces = (stepAsNum.toString().split('.')[1] || '')
|
|
182
|
+
.length;
|
|
183
|
+
|
|
179
184
|
const newValue =
|
|
180
185
|
direction === 'increment'
|
|
181
186
|
? currentValue + stepAsNum
|
|
@@ -196,8 +201,13 @@ function Input({
|
|
|
196
201
|
);
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
// Round to the step's decimal precision
|
|
205
|
+
const roundedValue = parseFloat(
|
|
206
|
+
constrainedValue.toFixed(decimalPlaces)
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
input.current.value = roundedValue.toString();
|
|
210
|
+
setValue(roundedValue.toString());
|
|
201
211
|
onEvent();
|
|
202
212
|
},
|
|
203
213
|
[step, props.min, props.max, onEvent]
|
package/lib/components/Tabs.tsx
CHANGED
|
@@ -102,7 +102,7 @@ function Tabs({
|
|
|
102
102
|
colors = {
|
|
103
103
|
border: 'var(--Dash-Stroke-Weak)',
|
|
104
104
|
primary: 'var(--Dash-Fill-Interactive-Strong)',
|
|
105
|
-
background: 'var(--Dash-Fill-Weak)',
|
|
105
|
+
background: 'var(--Dash-Fill-Interactive-Weak)',
|
|
106
106
|
},
|
|
107
107
|
vertical = false,
|
|
108
108
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -143,6 +143,75 @@
|
|
|
143
143
|
z-index: 500;
|
|
144
144
|
box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
|
|
145
145
|
0px 10px 20px -15px var(--Dash-Shading-Weak);
|
|
146
|
+
overscroll-behavior: contain;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.dash-datepicker
|
|
150
|
+
[data-radix-popper-content-wrapper]:has(.dash-datepicker-portal) {
|
|
151
|
+
transform: none !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.dash-datepicker-portal {
|
|
155
|
+
position: fixed;
|
|
156
|
+
inset: 0;
|
|
157
|
+
width: 100vw;
|
|
158
|
+
height: 100vh;
|
|
159
|
+
max-width: 100vw;
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
background: var(--Dash-Shading-Strong);
|
|
164
|
+
border: none;
|
|
165
|
+
box-shadow: none;
|
|
166
|
+
overflow: visible;
|
|
167
|
+
padding: 0;
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.dash-datepicker-portal .dash-datepicker-calendar-wrapper {
|
|
172
|
+
background: var(--Dash-Fill-Inverse-Strong);
|
|
173
|
+
border-radius: var(--Dash-Spacing);
|
|
174
|
+
border: 1px solid var(--Dash-Stroke-Strong);
|
|
175
|
+
padding: 16px;
|
|
176
|
+
box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
|
|
177
|
+
0px 10px 20px -15px var(--Dash-Shading-Weak);
|
|
178
|
+
z-index: 1;
|
|
179
|
+
pointer-events: auto;
|
|
180
|
+
width: fit-content;
|
|
181
|
+
max-width: 95vw;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.dash-datepicker-fullscreen {
|
|
185
|
+
pointer-events: auto;
|
|
186
|
+
background: var(--Dash-Fill-Inverse-Strong);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.dash-datepicker-close-button {
|
|
190
|
+
position: fixed;
|
|
191
|
+
top: calc(var(--Dash-Spacing) * 2);
|
|
192
|
+
right: calc(var(--Dash-Spacing) * 2);
|
|
193
|
+
width: 24px;
|
|
194
|
+
height: 24px;
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
background: var(--Dash-Fill-Inverse-Strong);
|
|
199
|
+
border: none;
|
|
200
|
+
border-radius: var(--Dash-Spacing);
|
|
201
|
+
color: var(--Dash-Text-Strong);
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
z-index: 501;
|
|
204
|
+
pointer-events: auto;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dash-datepicker-close-button:hover {
|
|
208
|
+
background: var(--Dash-Fill-Interactive-Weak);
|
|
209
|
+
color: var(--Dash-Fill-Interactive-Strong);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.dash-datepicker-close-button:focus {
|
|
213
|
+
outline: 2px solid var(--Dash-Fill-Interactive-Strong);
|
|
214
|
+
outline-offset: 2px;
|
|
146
215
|
}
|
|
147
216
|
|
|
148
217
|
.dash-datepicker-calendar-wrapper {
|
|
@@ -155,6 +224,7 @@
|
|
|
155
224
|
display: flex;
|
|
156
225
|
align-items: flex-start;
|
|
157
226
|
gap: calc(var(--Dash-Spacing) * 4);
|
|
227
|
+
flex-wrap: wrap;
|
|
158
228
|
}
|
|
159
229
|
|
|
160
230
|
.dash-datepicker-controls {
|
|
@@ -210,7 +280,7 @@
|
|
|
210
280
|
}
|
|
211
281
|
|
|
212
282
|
.dash-datepicker-month-nav:hover:not(:disabled) {
|
|
213
|
-
background: var(--Dash-Fill-Weak);
|
|
283
|
+
background: var(--Dash-Fill-Interactive-Weak);
|
|
214
284
|
}
|
|
215
285
|
|
|
216
286
|
.dash-datepicker-month-nav:focus-visible {
|
|
@@ -226,8 +296,3 @@
|
|
|
226
296
|
width: 20px;
|
|
227
297
|
height: 20px;
|
|
228
298
|
}
|
|
229
|
-
|
|
230
|
-
/* Override Radix's position: fixed to use position: absolute when using custom container */
|
|
231
|
-
div[data-radix-popper-content-wrapper]:has(.dash-datepicker-content) {
|
|
232
|
-
position: absolute !important;
|
|
233
|
-
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
--Dash-Stroke-Strong: rgba(0, 18, 77, 0.45);
|
|
4
4
|
--Dash-Stroke-Weak: rgba(0, 24, 102, 0.1);
|
|
5
5
|
--Dash-Fill-Interactive-Strong: #7f4bc4;
|
|
6
|
-
--Dash-Fill-Weak: rgba(0, 30, 128, 0.04);
|
|
6
|
+
--Dash-Fill-Interactive-Weak: rgba(0, 30, 128, 0.04);
|
|
7
7
|
--Dash-Fill-Inverse-Strong: #fff;
|
|
8
8
|
--Dash-Text-Primary: rgba(0, 18, 77, 0.87);
|
|
9
9
|
--Dash-Text-Strong: rgba(0, 9, 38, 0.9);
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
z-index: 500;
|
|
85
85
|
box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
|
|
86
86
|
0px 10px 20px -15px var(--Dash-Shading-Weak);
|
|
87
|
+
overscroll-behavior: contain;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
.dash-dropdown-value-count,
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
padding: 4px;
|
|
108
109
|
border-radius: 4px;
|
|
109
110
|
color: var(--Dash-Text-Weak);
|
|
110
|
-
background: var(--Dash-Fill-Weak);
|
|
111
|
+
background: var(--Dash-Fill-Interactive-Weak);
|
|
111
112
|
font-size: 0.875em;
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -235,8 +236,3 @@
|
|
|
235
236
|
.dash-dropdown-wrapper {
|
|
236
237
|
position: relative;
|
|
237
238
|
}
|
|
238
|
-
|
|
239
|
-
/* Override Radix's position: fixed to use position: absolute when using custom container */
|
|
240
|
-
div[data-radix-popper-content-wrapper]:has(.dash-dropdown-content) {
|
|
241
|
-
position: absolute !important;
|
|
242
|
-
}
|
|
@@ -51,6 +51,8 @@ const DatePickerRange = ({
|
|
|
51
51
|
end_date_id,
|
|
52
52
|
start_date_placeholder_text = 'Start Date',
|
|
53
53
|
end_date_placeholder_text = 'End Date',
|
|
54
|
+
with_portal = false,
|
|
55
|
+
with_full_screen_portal = false,
|
|
54
56
|
}: DatePickerRangeProps) => {
|
|
55
57
|
const [internalStartDate, setInternalStartDate] = useState(
|
|
56
58
|
strAsDate(start_date)
|
|
@@ -102,6 +104,7 @@ const DatePickerRange = ({
|
|
|
102
104
|
const startInputRef = useRef<HTMLInputElement | null>(null);
|
|
103
105
|
const endInputRef = useRef<HTMLInputElement | null>(null);
|
|
104
106
|
const calendarRef = useRef<CalendarHandle>(null);
|
|
107
|
+
const hasPortal = with_portal || with_full_screen_portal;
|
|
105
108
|
|
|
106
109
|
useEffect(() => {
|
|
107
110
|
setInternalStartDate(strAsDate(start_date));
|
|
@@ -333,7 +336,7 @@ const DatePickerRange = ({
|
|
|
333
336
|
id={start_date_id || accessibleId}
|
|
334
337
|
inputClassName="dash-datepicker-input dash-datepicker-start-date"
|
|
335
338
|
value={startInputValue}
|
|
336
|
-
onChange={e => setStartInputValue(e.target
|
|
339
|
+
onChange={e => setStartInputValue(e.target?.value)}
|
|
337
340
|
onKeyDown={handleStartInputKeyDown}
|
|
338
341
|
onFocus={() => {
|
|
339
342
|
if (isCalendarOpen) {
|
|
@@ -354,7 +357,7 @@ const DatePickerRange = ({
|
|
|
354
357
|
id={end_date_id || accessibleId + '-end-date'}
|
|
355
358
|
inputClassName="dash-datepicker-input dash-datepicker-end-date"
|
|
356
359
|
value={endInputValue}
|
|
357
|
-
onChange={e => setEndInputValue(e.target
|
|
360
|
+
onChange={e => setEndInputValue(e.target?.value)}
|
|
358
361
|
onKeyDown={handleEndInputKeyDown}
|
|
359
362
|
onFocus={() => {
|
|
360
363
|
if (isCalendarOpen) {
|
|
@@ -381,12 +384,21 @@ const DatePickerRange = ({
|
|
|
381
384
|
|
|
382
385
|
<Popover.Portal container={containerRef.current}>
|
|
383
386
|
<Popover.Content
|
|
384
|
-
className=
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
className={`dash-datepicker-content${
|
|
388
|
+
hasPortal ? ' dash-datepicker-portal' : ''
|
|
389
|
+
}${
|
|
390
|
+
with_full_screen_portal
|
|
391
|
+
? ' dash-datepicker-fullscreen'
|
|
392
|
+
: ''
|
|
393
|
+
}`}
|
|
394
|
+
align={hasPortal ? 'center' : 'start'}
|
|
395
|
+
sideOffset={hasPortal ? 0 : 5}
|
|
396
|
+
avoidCollisions={!hasPortal}
|
|
397
|
+
onInteractOutside={
|
|
398
|
+
with_full_screen_portal
|
|
399
|
+
? e => e.preventDefault()
|
|
400
|
+
: undefined
|
|
401
|
+
}
|
|
390
402
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
391
403
|
onCloseAutoFocus={e => {
|
|
392
404
|
e.preventDefault();
|
|
@@ -407,6 +419,15 @@ const DatePickerRange = ({
|
|
|
407
419
|
}
|
|
408
420
|
}}
|
|
409
421
|
>
|
|
422
|
+
{with_full_screen_portal && (
|
|
423
|
+
<button
|
|
424
|
+
className="dash-datepicker-close-button"
|
|
425
|
+
onClick={() => setIsCalendarOpen(false)}
|
|
426
|
+
aria-label="Close calendar"
|
|
427
|
+
>
|
|
428
|
+
<Cross1Icon />
|
|
429
|
+
</button>
|
|
430
|
+
)}
|
|
410
431
|
<Calendar
|
|
411
432
|
ref={calendarRef}
|
|
412
433
|
initialVisibleDate={initialCalendarDate}
|
|
@@ -39,6 +39,8 @@ const DatePickerSingle = ({
|
|
|
39
39
|
day_size = 34,
|
|
40
40
|
number_of_months_shown = 1,
|
|
41
41
|
calendar_orientation,
|
|
42
|
+
with_portal = false,
|
|
43
|
+
with_full_screen_portal = false,
|
|
42
44
|
}: DatePickerSingleProps) => {
|
|
43
45
|
const [internalDate, setInternalDate] = useState(strAsDate(date));
|
|
44
46
|
const direction = is_RTL
|
|
@@ -61,6 +63,7 @@ const DatePickerSingle = ({
|
|
|
61
63
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
62
64
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
63
65
|
const calendarRef = useRef<CalendarHandle>(null);
|
|
66
|
+
const hasPortal = with_portal || with_full_screen_portal;
|
|
64
67
|
|
|
65
68
|
useEffect(() => {
|
|
66
69
|
setInternalDate(strAsDate(date));
|
|
@@ -177,7 +180,7 @@ const DatePickerSingle = ({
|
|
|
177
180
|
id={accessibleId}
|
|
178
181
|
inputClassName="dash-datepicker-input dash-datepicker-end-date"
|
|
179
182
|
value={inputValue}
|
|
180
|
-
onChange={e => setInputValue(e.target
|
|
183
|
+
onChange={e => setInputValue(e.target?.value)}
|
|
181
184
|
onKeyDown={handleInputKeyDown}
|
|
182
185
|
placeholder={placeholder}
|
|
183
186
|
disabled={disabled}
|
|
@@ -200,12 +203,21 @@ const DatePickerSingle = ({
|
|
|
200
203
|
|
|
201
204
|
<Popover.Portal container={containerRef.current}>
|
|
202
205
|
<Popover.Content
|
|
203
|
-
className=
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
className={`dash-datepicker-content${
|
|
207
|
+
hasPortal ? ' dash-datepicker-portal' : ''
|
|
208
|
+
}${
|
|
209
|
+
with_full_screen_portal
|
|
210
|
+
? ' dash-datepicker-fullscreen'
|
|
211
|
+
: ''
|
|
212
|
+
}`}
|
|
213
|
+
align={hasPortal ? 'center' : 'start'}
|
|
214
|
+
sideOffset={hasPortal ? 0 : 5}
|
|
215
|
+
avoidCollisions={!hasPortal}
|
|
216
|
+
onInteractOutside={
|
|
217
|
+
with_full_screen_portal
|
|
218
|
+
? e => e.preventDefault()
|
|
219
|
+
: undefined
|
|
220
|
+
}
|
|
209
221
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
210
222
|
onCloseAutoFocus={e => {
|
|
211
223
|
e.preventDefault();
|
|
@@ -215,6 +227,15 @@ const DatePickerSingle = ({
|
|
|
215
227
|
}
|
|
216
228
|
}}
|
|
217
229
|
>
|
|
230
|
+
{with_full_screen_portal && (
|
|
231
|
+
<button
|
|
232
|
+
className="dash-datepicker-close-button"
|
|
233
|
+
onClick={() => setIsCalendarOpen(false)}
|
|
234
|
+
aria-label="Close calendar"
|
|
235
|
+
>
|
|
236
|
+
<Cross1Icon />
|
|
237
|
+
</button>
|
|
238
|
+
)}
|
|
218
239
|
<Calendar
|
|
219
240
|
ref={calendarRef}
|
|
220
241
|
initialVisibleDate={initialMonth}
|
|
@@ -394,7 +394,6 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
394
394
|
}
|
|
395
395
|
}}
|
|
396
396
|
className={`dash-dropdown ${className ?? ''}`}
|
|
397
|
-
style={style}
|
|
398
397
|
aria-labelledby={`${accessibleId}-value-count ${accessibleId}-value`}
|
|
399
398
|
aria-haspopup="listbox"
|
|
400
399
|
aria-expanded={isOpen}
|
|
@@ -458,9 +457,6 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
458
457
|
className="dash-dropdown-content"
|
|
459
458
|
align="start"
|
|
460
459
|
sideOffset={5}
|
|
461
|
-
collisionBoundary={positioningContainerRef.current?.closest(
|
|
462
|
-
'#_dash-app-content'
|
|
463
|
-
)}
|
|
464
460
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
465
461
|
onKeyDown={handleKeyDown}
|
|
466
462
|
style={{
|
|
@@ -543,7 +539,11 @@ const Dropdown = (props: DropdownProps) => {
|
|
|
543
539
|
);
|
|
544
540
|
|
|
545
541
|
return (
|
|
546
|
-
<div
|
|
542
|
+
<div
|
|
543
|
+
ref={positioningContainerRef}
|
|
544
|
+
className="dash-dropdown-wrapper"
|
|
545
|
+
style={style}
|
|
546
|
+
>
|
|
547
547
|
{popover}
|
|
548
548
|
</div>
|
|
549
549
|
);
|