dash-core-components 4.0.0-rc3 → 4.0.0-rc5
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-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 +44 -9
- package/lib/components/Button.tsx +48 -0
- package/lib/components/Input.tsx +13 -234
- package/lib/components/RadioItems.tsx +3 -1
- package/lib/components/Tooltip.tsx +1 -0
- package/lib/components/Upload.react.js +13 -1
- package/lib/components/css/button.css +50 -0
- package/lib/components/css/calendar.css +24 -6
- package/lib/components/css/datepickers.css +43 -43
- package/lib/components/css/dcc.css +1 -1
- package/lib/components/css/dropdown.css +36 -8
- package/lib/components/css/input.css +8 -2
- package/lib/components/css/optionslist.css +2 -1
- package/lib/components/css/sliders.css +31 -5
- package/lib/components/css/tabs.css +3 -3
- package/lib/components/css/textarea.css +10 -0
- package/lib/components/css/tooltip.css +1 -1
- package/lib/fragments/DatePickerRange.tsx +37 -47
- package/lib/fragments/DatePickerSingle.tsx +9 -8
- package/lib/fragments/Dropdown.tsx +53 -18
- package/lib/fragments/RangeSlider.tsx +21 -66
- package/lib/fragments/Upload.react.js +243 -1
- package/lib/index.ts +2 -0
- package/lib/types.ts +307 -1
- package/lib/utils/calendar/Calendar.tsx +64 -34
- package/lib/utils/optionRendering.tsx +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
outline: none;
|
|
9
9
|
width: 100%;
|
|
10
10
|
font-size: inherit;
|
|
11
|
-
|
|
11
|
+
position: relative;
|
|
12
12
|
accent-color: var(--Dash-Fill-Interactive-Strong);
|
|
13
13
|
outline-color: var(--Dash-Fill-Interactive-Strong);
|
|
14
14
|
}
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
align-items: center;
|
|
21
21
|
gap: calc(var(--Dash-Spacing) * 2);
|
|
22
22
|
box-sizing: border-box;
|
|
23
|
-
padding: 0
|
|
23
|
+
padding: 0 12px;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.dash-datepicker-input-wrapper:has(:nth-child(
|
|
27
|
-
grid-template-columns:
|
|
26
|
+
.dash-datepicker-input-wrapper:has(> :nth-child(2)) {
|
|
27
|
+
grid-template-columns: 1fr auto;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.dash-datepicker-input-wrapper:has(:nth-child(
|
|
31
|
-
grid-template-columns:
|
|
30
|
+
.dash-datepicker-input-wrapper:has(> :nth-child(3)) {
|
|
31
|
+
grid-template-columns: 1fr auto auto;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.dash-datepicker-input-wrapper:has(:nth-child(
|
|
35
|
-
grid-template-columns: auto auto
|
|
34
|
+
.dash-datepicker-input-wrapper:has(> :nth-child(4)) {
|
|
35
|
+
grid-template-columns: auto auto 1fr auto;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.dash-datepicker-input-wrapper:has(:nth-child(
|
|
39
|
-
grid-template-columns: auto auto
|
|
38
|
+
.dash-datepicker-input-wrapper:has(> :nth-child(5)) {
|
|
39
|
+
grid-template-columns: auto auto 1fr auto auto;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.dash-datepicker-input-wrapper,
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
border-radius: 4px;
|
|
56
56
|
padding: 0;
|
|
57
57
|
background-color: inherit;
|
|
58
|
+
color: inherit;
|
|
59
|
+
font-family: inherit;
|
|
60
|
+
font-size: inherit;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
.dash-datepicker-input::selection,
|
|
@@ -67,6 +70,10 @@
|
|
|
67
70
|
border: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
.dash-datepicker-input-wrapper:has(:focus-visible) {
|
|
74
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
.dash-datepicker-input-wrapper-disabled {
|
|
71
78
|
opacity: 0.6;
|
|
72
79
|
cursor: not-allowed;
|
|
@@ -84,33 +91,6 @@
|
|
|
84
91
|
color: var(--Dash-Text-Disabled);
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
.dash-datepicker-trigger-button {
|
|
88
|
-
padding: var(--Dash-Spacing);
|
|
89
|
-
background: transparent;
|
|
90
|
-
border: none;
|
|
91
|
-
border-radius: 4px;
|
|
92
|
-
color: var(--Dash-Text-Strong);
|
|
93
|
-
cursor: pointer;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.dash-datepicker-trigger-button:hover {
|
|
97
|
-
background: var(--Dash-Fill-Weak);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.dash-datepicker-trigger-button:focus-visible {
|
|
101
|
-
outline: 2px solid var(--Dash-Fill-Interactive-Strong);
|
|
102
|
-
outline-offset: 2px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.dash-datepicker-trigger-button[aria-expanded='true'] {
|
|
106
|
-
background: var(--Dash-Fill-Weak);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.dash-datepicker-trigger-icon {
|
|
110
|
-
width: 16px;
|
|
111
|
-
height: 16px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
94
|
.dash-datepicker-caret-icon {
|
|
115
95
|
color: var(--Dash-Text-Strong);
|
|
116
96
|
fill: var(--Dash-Text-Strong);
|
|
@@ -119,6 +99,12 @@
|
|
|
119
99
|
transition: transform 0.15s;
|
|
120
100
|
}
|
|
121
101
|
|
|
102
|
+
.dash-datepicker-range-arrow {
|
|
103
|
+
color: var(--Dash-Text-Strong);
|
|
104
|
+
width: 1em;
|
|
105
|
+
height: 1em;
|
|
106
|
+
}
|
|
107
|
+
|
|
122
108
|
.dash-datepicker-input-wrapper[aria-expanded='true']
|
|
123
109
|
.dash-datepicker-caret-icon {
|
|
124
110
|
transform: rotate(180deg);
|
|
@@ -175,22 +161,32 @@
|
|
|
175
161
|
display: flex;
|
|
176
162
|
align-items: center;
|
|
177
163
|
justify-content: center;
|
|
178
|
-
gap: var(--Dash-Spacing);
|
|
164
|
+
gap: calc(var(--Dash-Spacing) * 2);
|
|
179
165
|
margin-bottom: calc(var(--Dash-Spacing) * 2);
|
|
180
|
-
font-size:
|
|
166
|
+
font-size: inherit;
|
|
181
167
|
}
|
|
182
168
|
|
|
183
169
|
.dash-datepicker-controls .dash-dropdown {
|
|
184
170
|
flex: 0 0 auto;
|
|
185
|
-
min-width: 122px;
|
|
186
|
-
width: auto;
|
|
187
171
|
margin: 0;
|
|
188
172
|
}
|
|
189
173
|
|
|
174
|
+
.dash-datepicker-month-sizer {
|
|
175
|
+
height: 0;
|
|
176
|
+
grid-area: 1 / 1;
|
|
177
|
+
visibility: hidden;
|
|
178
|
+
pointer-events: none;
|
|
179
|
+
white-space: nowrap;
|
|
180
|
+
padding: 0 24px;
|
|
181
|
+
font-family: inherit;
|
|
182
|
+
font-size: inherit;
|
|
183
|
+
}
|
|
184
|
+
|
|
190
185
|
.dash-datepicker-controls .dash-input {
|
|
191
186
|
flex-shrink: 0;
|
|
192
187
|
flex-grow: 0;
|
|
193
|
-
width: 102px;
|
|
188
|
+
min-width: 102px;
|
|
189
|
+
width: calc(5ch + 40px);
|
|
194
190
|
}
|
|
195
191
|
|
|
196
192
|
.dash-datepicker-controls .dash-input-stepper {
|
|
@@ -219,7 +215,6 @@
|
|
|
219
215
|
|
|
220
216
|
.dash-datepicker-month-nav:focus-visible {
|
|
221
217
|
outline: 2px solid var(--Dash-Fill-Interactive-Strong);
|
|
222
|
-
outline-offset: 2px;
|
|
223
218
|
}
|
|
224
219
|
|
|
225
220
|
.dash-datepicker-month-nav:disabled {
|
|
@@ -231,3 +226,8 @@
|
|
|
231
226
|
width: 20px;
|
|
232
227
|
height: 20px;
|
|
233
228
|
}
|
|
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
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--Dash-Text-Primary: rgba(0, 18, 77, 0.87);
|
|
9
9
|
--Dash-Text-Strong: rgba(0, 9, 38, 0.9);
|
|
10
10
|
--Dash-Text-Weak: rgba(0, 12, 51, 0.65);
|
|
11
|
-
--Dash-Text-Disabled: rgba(0, 21, 89, 0.
|
|
11
|
+
--Dash-Text-Disabled: rgba(0, 21, 89, 0.6);
|
|
12
12
|
--Dash-Fill-Primary-Hover: rgba(0, 18, 77, 0.04);
|
|
13
13
|
--Dash-Fill-Primary-Active: rgba(0, 18, 77, 0.08);
|
|
14
14
|
--Dash-Fill-Disabled: rgba(0, 24, 102, 0.1);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
outline: none;
|
|
9
9
|
width: 100%;
|
|
10
10
|
cursor: pointer;
|
|
11
|
+
font-family: inherit;
|
|
11
12
|
font-size: inherit;
|
|
12
13
|
overflow: hidden;
|
|
13
14
|
accent-color: var(--Dash-Fill-Interactive-Strong);
|
|
@@ -19,14 +20,14 @@
|
|
|
19
20
|
grid-template-columns: auto 1fr;
|
|
20
21
|
justify-items: start;
|
|
21
22
|
align-items: center;
|
|
22
|
-
gap:
|
|
23
|
+
gap: calc(var(--Dash-Spacing) * 2);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
.dash-dropdown-grid-container:has(:nth-child(3)) {
|
|
26
|
+
.dash-dropdown-grid-container:has(> :nth-child(3)) {
|
|
26
27
|
grid-template-columns: auto 1fr auto;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
.dash-dropdown-grid-container:has(:nth-child(4)) {
|
|
30
|
+
.dash-dropdown-grid-container:has(> :nth-child(4)) {
|
|
30
31
|
grid-template-columns: auto 1fr auto auto;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
|
|
47
48
|
.dash-dropdown:focus {
|
|
48
49
|
border: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
50
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
.dash-dropdown:disabled {
|
|
@@ -102,8 +104,11 @@
|
|
|
102
104
|
|
|
103
105
|
.dash-dropdown-value-count {
|
|
104
106
|
line-height: 18px;
|
|
105
|
-
padding:
|
|
107
|
+
padding: 4px;
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
color: var(--Dash-Text-Weak);
|
|
106
110
|
background: var(--Dash-Fill-Weak);
|
|
111
|
+
font-size: 0.875em;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
.dash-dropdown-search-container {
|
|
@@ -118,12 +123,13 @@
|
|
|
118
123
|
|
|
119
124
|
.dash-dropdown-search-container:focus-within {
|
|
120
125
|
border-color: var(--Dash-Fill-Interactive-Strong);
|
|
126
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
.dash-dropdown-search-icon,
|
|
124
130
|
.dash-dropdown-clear {
|
|
125
|
-
width:
|
|
126
|
-
height:
|
|
131
|
+
width: 1em;
|
|
132
|
+
height: 1em;
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
.dash-dropdown-search-container:focus-within .dash-dropdown-search-icon {
|
|
@@ -160,6 +166,8 @@
|
|
|
160
166
|
color: var(--Dash-Text-Strong);
|
|
161
167
|
outline: none;
|
|
162
168
|
padding: 0;
|
|
169
|
+
font-family: inherit;
|
|
170
|
+
font-size: inherit;
|
|
163
171
|
|
|
164
172
|
/* Hide the "x" clear button in search inputs */
|
|
165
173
|
&::-webkit-search-cancel-button {
|
|
@@ -186,11 +194,12 @@
|
|
|
186
194
|
background: none;
|
|
187
195
|
border: none;
|
|
188
196
|
cursor: pointer;
|
|
189
|
-
font-
|
|
197
|
+
font-family: inherit;
|
|
198
|
+
font-size: 0.875em;
|
|
190
199
|
font-weight: 600;
|
|
191
200
|
padding: 0;
|
|
192
201
|
text-decoration: none;
|
|
193
|
-
color: var(--Dash-Text-
|
|
202
|
+
color: var(--Dash-Text-Weak);
|
|
194
203
|
white-space: nowrap;
|
|
195
204
|
accent-color: var(--Dash-Fill-Interactive-Strong);
|
|
196
205
|
outline-color: var(--Dash-Fill-Interactive-Strong);
|
|
@@ -212,3 +221,22 @@
|
|
|
212
221
|
padding: calc(var(--Dash-Spacing) * 2) calc(var(--Dash-Spacing) * 3);
|
|
213
222
|
box-shadow: 0 -1px 0 0 var(--Dash-Fill-Disabled) inset;
|
|
214
223
|
}
|
|
224
|
+
|
|
225
|
+
.dash-dropdown-option
|
|
226
|
+
.dash-options-list-option-wrapper:has(input[type='radio']) {
|
|
227
|
+
/* radio buttons are used in single-select dropdowns to aid keyboard
|
|
228
|
+
* selection and screen readers, but visually, they are hidden
|
|
229
|
+
*/
|
|
230
|
+
width: 0;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Positioning container for the dropdown */
|
|
235
|
+
.dash-dropdown-wrapper {
|
|
236
|
+
position: relative;
|
|
237
|
+
}
|
|
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
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-flex;
|
|
5
5
|
align-items: center;
|
|
6
|
-
width:
|
|
6
|
+
width: 100%;
|
|
7
7
|
height: 34px;
|
|
8
8
|
background: var(--Dash-Fill-Inverse-Strong);
|
|
9
9
|
border-radius: var(--Dash-Spacing);
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
border: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.dash-input-container:has(:focus-visible) {
|
|
23
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
.dash-input-container:has(.dash-input-element:disabled) {
|
|
23
27
|
opacity: 0.6;
|
|
24
28
|
cursor: not-allowed;
|
|
@@ -46,6 +50,8 @@
|
|
|
46
50
|
z-index: 1;
|
|
47
51
|
order: 2;
|
|
48
52
|
accent-color: var(--Dash-Fill-Interactive-Strong);
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
font-size: inherit;
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
.dash-input-element::selection,
|
|
@@ -139,5 +145,5 @@
|
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
input.dash-input-element:invalid {
|
|
142
|
-
|
|
148
|
+
color: red;
|
|
143
149
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
color: var(--Dash-Text-Strong);
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
display: flex;
|
|
7
|
-
align-items:
|
|
7
|
+
align-items: baseline;
|
|
8
8
|
user-select: none;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
cursor: not-allowed;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.dash-options-list-option-wrapper,
|
|
22
23
|
.dash-options-list-option-text {
|
|
23
24
|
display: flex;
|
|
24
25
|
align-items: center;
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
touch-action: none;
|
|
8
8
|
width: 100%;
|
|
9
9
|
height: 14px;
|
|
10
|
-
padding:
|
|
10
|
+
padding: 17px 0 17px 0;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
/* Override Radix's default margin/padding behavior */
|
|
13
13
|
--radix-slider-thumb-width: 16px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.dash-slider-root.has-marks {
|
|
17
|
-
padding:
|
|
17
|
+
padding: 6px 0 28px 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.dash-slider-root[data-orientation='vertical'].has-marks {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.dash-slider-thumb:focus {
|
|
78
|
-
outline:
|
|
78
|
+
outline: 2px solid var(--Dash-Fill-Interactive-Strong);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.dash-slider-thumb:focus .dash-slider-tooltip,
|
|
@@ -185,6 +185,7 @@
|
|
|
185
185
|
align-items: center;
|
|
186
186
|
gap: 16px;
|
|
187
187
|
width: 100%;
|
|
188
|
+
container-type: inline-size;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
.dash-slider-wrapper {
|
|
@@ -208,11 +209,20 @@
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
.dash-range-slider-input {
|
|
211
|
-
width:
|
|
212
|
+
min-width: 5cqw; /* 5% of container width */
|
|
213
|
+
max-width: 25cqw; /* 25% of container width */
|
|
212
214
|
text-align: center;
|
|
213
215
|
-webkit-appearance: textfield;
|
|
214
216
|
-moz-appearance: textfield;
|
|
215
217
|
appearance: textfield;
|
|
218
|
+
font-family: inherit;
|
|
219
|
+
font-size: inherit;
|
|
220
|
+
box-sizing: content-box;
|
|
221
|
+
height: 30px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.dash-range-slider-input:only-of-type {
|
|
225
|
+
max-width: 33cqw;
|
|
216
226
|
}
|
|
217
227
|
|
|
218
228
|
.dash-range-slider-input::selection,
|
|
@@ -222,7 +232,7 @@
|
|
|
222
232
|
}
|
|
223
233
|
|
|
224
234
|
.dash-range-slider-input:focus {
|
|
225
|
-
outline:
|
|
235
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
226
236
|
}
|
|
227
237
|
|
|
228
238
|
/* Hide the number input spinners */
|
|
@@ -231,3 +241,19 @@
|
|
|
231
241
|
-webkit-appearance: none;
|
|
232
242
|
margin: 0;
|
|
233
243
|
}
|
|
244
|
+
|
|
245
|
+
/* Hide inputs on small containers using container queries */
|
|
246
|
+
/* single slider input */
|
|
247
|
+
@container (max-width: 200px) {
|
|
248
|
+
.dash-slider-container .dash-range-slider-input:only-of-type {
|
|
249
|
+
display: none;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* range slider inputs */
|
|
254
|
+
@container (max-width: 300px) {
|
|
255
|
+
.dash-slider-container .dash-range-slider-min-input,
|
|
256
|
+
.dash-slider-container .dash-range-slider-max-input {
|
|
257
|
+
display: none;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
/* Tab selected state */
|
|
33
33
|
.tab--selected {
|
|
34
34
|
border-top: 2px solid var(--tabs-primary);
|
|
35
|
-
color:
|
|
36
|
-
background-color:
|
|
35
|
+
color: var(--Dash-Text-Primary);
|
|
36
|
+
background-color: var(--Dash-Fill-Inverse-Strong);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.tab--selected:hover {
|
|
40
|
-
background-color:
|
|
40
|
+
background-color: var(--Dash-Fill-Inverse-Strong);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/* Tab disabled state */
|
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
accent-color: var(--Dash-Fill-Interactive-Strong);
|
|
11
11
|
outline-color: var(--Dash-Fill-Interactive-Strong);
|
|
12
|
+
font-family: inherit;
|
|
13
|
+
font-size: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dash-textarea:focus-within {
|
|
17
|
+
border: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dash-textarea:focus-visible {
|
|
21
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
.dash-textarea:disabled {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
background: var(--Dash-Tooltip-Background-Color);
|
|
33
33
|
white-space: nowrap;
|
|
34
34
|
z-index: var(--Dash-Tooltip-ZIndex);
|
|
35
|
-
pointer-events:
|
|
35
|
+
pointer-events: var(--Dash-Tooltip-PointerEvents);
|
|
36
36
|
box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
|
|
37
37
|
0px 10px 20px -15px var(--Dash-Shading-Weak);
|
|
38
38
|
}
|
|
@@ -3,7 +3,6 @@ import * as Popover from '@radix-ui/react-popover';
|
|
|
3
3
|
import {
|
|
4
4
|
ArrowLeftIcon,
|
|
5
5
|
ArrowRightIcon,
|
|
6
|
-
CalendarIcon,
|
|
7
6
|
CaretDownIcon,
|
|
8
7
|
Cross1Icon,
|
|
9
8
|
} from '@radix-ui/react-icons';
|
|
@@ -136,6 +135,12 @@ const DatePickerRange = ({
|
|
|
136
135
|
start_date: dateAsStr(internalStartDate),
|
|
137
136
|
end_date: dateAsStr(internalEndDate),
|
|
138
137
|
});
|
|
138
|
+
} else if (!internalStartDate && !internalEndDate) {
|
|
139
|
+
// Both dates cleared - send undefined for both
|
|
140
|
+
setProps({
|
|
141
|
+
start_date: dateAsStr(internalStartDate),
|
|
142
|
+
end_date: dateAsStr(internalEndDate),
|
|
143
|
+
});
|
|
139
144
|
} else if (updatemode === 'singledate' && internalStartDate) {
|
|
140
145
|
// Only start changed - send just that one
|
|
141
146
|
setProps({start_date: dateAsStr(internalStartDate)});
|
|
@@ -145,17 +150,23 @@ const DatePickerRange = ({
|
|
|
145
150
|
}
|
|
146
151
|
}, [internalStartDate, internalEndDate, updatemode]);
|
|
147
152
|
|
|
153
|
+
const isDateAllowed = useCallback(
|
|
154
|
+
(date?: Date): date is Date => {
|
|
155
|
+
return (
|
|
156
|
+
!!date && !isDateDisabled(date, minDate, maxDate, disabledDates)
|
|
157
|
+
);
|
|
158
|
+
},
|
|
159
|
+
[minDate, maxDate, disabledDates]
|
|
160
|
+
);
|
|
161
|
+
|
|
148
162
|
const sendStartInputAsDate = useCallback(
|
|
149
163
|
(focusCalendar = false) => {
|
|
150
164
|
if (startInputValue) {
|
|
151
165
|
setInternalStartDate(undefined);
|
|
152
166
|
}
|
|
153
167
|
const parsed = strAsDate(startInputValue, display_format);
|
|
154
|
-
const isValid =
|
|
155
|
-
parsed &&
|
|
156
|
-
!isDateDisabled(parsed, minDate, maxDate, disabledDates);
|
|
157
168
|
|
|
158
|
-
if (
|
|
169
|
+
if (isDateAllowed(parsed)) {
|
|
159
170
|
setInternalStartDate(parsed);
|
|
160
171
|
if (focusCalendar) {
|
|
161
172
|
calendarRef.current?.focusDate(parsed);
|
|
@@ -173,14 +184,7 @@ const DatePickerRange = ({
|
|
|
173
184
|
}
|
|
174
185
|
}
|
|
175
186
|
},
|
|
176
|
-
[
|
|
177
|
-
startInputValue,
|
|
178
|
-
display_format,
|
|
179
|
-
start_date,
|
|
180
|
-
minDate,
|
|
181
|
-
maxDate,
|
|
182
|
-
disabledDates,
|
|
183
|
-
]
|
|
187
|
+
[startInputValue, display_format, start_date, isDateAllowed]
|
|
184
188
|
);
|
|
185
189
|
|
|
186
190
|
const sendEndInputAsDate = useCallback(
|
|
@@ -189,11 +193,8 @@ const DatePickerRange = ({
|
|
|
189
193
|
setInternalEndDate(undefined);
|
|
190
194
|
}
|
|
191
195
|
const parsed = strAsDate(endInputValue, display_format);
|
|
192
|
-
const isValid =
|
|
193
|
-
parsed &&
|
|
194
|
-
!isDateDisabled(parsed, minDate, maxDate, disabledDates);
|
|
195
196
|
|
|
196
|
-
if (
|
|
197
|
+
if (isDateAllowed(parsed)) {
|
|
197
198
|
setInternalEndDate(parsed);
|
|
198
199
|
if (focusCalendar) {
|
|
199
200
|
calendarRef.current?.focusDate(parsed);
|
|
@@ -211,14 +212,7 @@ const DatePickerRange = ({
|
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
},
|
|
214
|
-
[
|
|
215
|
-
endInputValue,
|
|
216
|
-
display_format,
|
|
217
|
-
end_date,
|
|
218
|
-
minDate,
|
|
219
|
-
maxDate,
|
|
220
|
-
disabledDates,
|
|
221
|
-
]
|
|
215
|
+
[endInputValue, display_format, end_date, isDateAllowed]
|
|
222
216
|
);
|
|
223
217
|
|
|
224
218
|
const clearSelection = useCallback(
|
|
@@ -237,15 +231,14 @@ const DatePickerRange = ({
|
|
|
237
231
|
|
|
238
232
|
const handleStartInputKeyDown = useCallback(
|
|
239
233
|
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
240
|
-
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
234
|
+
if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
|
|
241
235
|
e.preventDefault();
|
|
242
|
-
sendStartInputAsDate(true);
|
|
243
236
|
if (!isCalendarOpen) {
|
|
244
|
-
|
|
245
|
-
// it opens with the correct date showing
|
|
246
|
-
setTimeout(() => setIsCalendarOpen(true), 0);
|
|
237
|
+
setIsCalendarOpen(true);
|
|
247
238
|
}
|
|
248
|
-
|
|
239
|
+
// Wait for calendar to mount before focusing
|
|
240
|
+
requestAnimationFrame(() => sendStartInputAsDate(true));
|
|
241
|
+
} else if (e.key === 'Tab') {
|
|
249
242
|
sendStartInputAsDate();
|
|
250
243
|
}
|
|
251
244
|
},
|
|
@@ -254,15 +247,14 @@ const DatePickerRange = ({
|
|
|
254
247
|
|
|
255
248
|
const handleEndInputKeyDown = useCallback(
|
|
256
249
|
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
257
|
-
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
250
|
+
if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
|
|
258
251
|
e.preventDefault();
|
|
259
|
-
sendEndInputAsDate(true);
|
|
260
252
|
if (!isCalendarOpen) {
|
|
261
|
-
|
|
262
|
-
// it opens with the correct date showing
|
|
263
|
-
setTimeout(() => setIsCalendarOpen(true), 0);
|
|
253
|
+
setIsCalendarOpen(true);
|
|
264
254
|
}
|
|
265
|
-
|
|
255
|
+
// Wait for calendar to mount before focusing
|
|
256
|
+
requestAnimationFrame(() => sendEndInputAsDate(true));
|
|
257
|
+
} else if (e.key === 'Tab') {
|
|
266
258
|
sendEndInputAsDate();
|
|
267
259
|
}
|
|
268
260
|
},
|
|
@@ -333,7 +325,6 @@ const DatePickerRange = ({
|
|
|
333
325
|
}
|
|
334
326
|
}}
|
|
335
327
|
>
|
|
336
|
-
<CalendarIcon className="dash-datepicker-trigger-icon" />
|
|
337
328
|
<AutosizeInput
|
|
338
329
|
inputRef={node => {
|
|
339
330
|
startInputRef.current = node;
|
|
@@ -345,10 +336,8 @@ const DatePickerRange = ({
|
|
|
345
336
|
onChange={e => setStartInputValue(e.target.value)}
|
|
346
337
|
onKeyDown={handleStartInputKeyDown}
|
|
347
338
|
onFocus={() => {
|
|
348
|
-
if (
|
|
349
|
-
|
|
350
|
-
internalStartDate
|
|
351
|
-
);
|
|
339
|
+
if (isCalendarOpen) {
|
|
340
|
+
sendStartInputAsDate();
|
|
352
341
|
}
|
|
353
342
|
}}
|
|
354
343
|
placeholder={start_date_placeholder_text}
|
|
@@ -356,7 +345,7 @@ const DatePickerRange = ({
|
|
|
356
345
|
dir={direction}
|
|
357
346
|
aria-label={start_date_placeholder_text}
|
|
358
347
|
/>
|
|
359
|
-
<ArrowIcon />
|
|
348
|
+
<ArrowIcon className="dash-datepicker-range-arrow" />
|
|
360
349
|
<AutosizeInput
|
|
361
350
|
inputRef={node => {
|
|
362
351
|
endInputRef.current = node;
|
|
@@ -368,10 +357,8 @@ const DatePickerRange = ({
|
|
|
368
357
|
onChange={e => setEndInputValue(e.target.value)}
|
|
369
358
|
onKeyDown={handleEndInputKeyDown}
|
|
370
359
|
onFocus={() => {
|
|
371
|
-
if (
|
|
372
|
-
|
|
373
|
-
internalEndDate
|
|
374
|
-
);
|
|
360
|
+
if (isCalendarOpen) {
|
|
361
|
+
sendEndInputAsDate();
|
|
375
362
|
}
|
|
376
363
|
}}
|
|
377
364
|
placeholder={end_date_placeholder_text}
|
|
@@ -397,6 +384,9 @@ const DatePickerRange = ({
|
|
|
397
384
|
className="dash-datepicker-content"
|
|
398
385
|
align="start"
|
|
399
386
|
sideOffset={5}
|
|
387
|
+
collisionBoundary={containerRef.current?.closest(
|
|
388
|
+
'#_dash-app-content'
|
|
389
|
+
)}
|
|
400
390
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
401
391
|
onCloseAutoFocus={e => {
|
|
402
392
|
e.preventDefault();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
2
2
|
import * as Popover from '@radix-ui/react-popover';
|
|
3
|
-
import {
|
|
3
|
+
import {CaretDownIcon, Cross1Icon} from '@radix-ui/react-icons';
|
|
4
4
|
import AutosizeInput from 'react-input-autosize';
|
|
5
5
|
import uuid from 'uniqid';
|
|
6
6
|
|
|
@@ -124,15 +124,14 @@ const DatePickerSingle = ({
|
|
|
124
124
|
|
|
125
125
|
const handleInputKeyDown = useCallback(
|
|
126
126
|
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
127
|
-
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
127
|
+
if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
|
|
128
128
|
e.preventDefault();
|
|
129
|
-
parseUserInput(true);
|
|
130
129
|
if (!isCalendarOpen) {
|
|
131
|
-
|
|
132
|
-
// it opens with the correct date showing
|
|
133
|
-
setTimeout(() => setIsCalendarOpen(true), 0);
|
|
130
|
+
setIsCalendarOpen(true);
|
|
134
131
|
}
|
|
135
|
-
|
|
132
|
+
// Wait for calendar to mount before focusing
|
|
133
|
+
requestAnimationFrame(() => parseUserInput(true));
|
|
134
|
+
} else if (e.key === 'Tab') {
|
|
136
135
|
parseUserInput();
|
|
137
136
|
}
|
|
138
137
|
},
|
|
@@ -170,7 +169,6 @@ const DatePickerSingle = ({
|
|
|
170
169
|
}
|
|
171
170
|
}}
|
|
172
171
|
>
|
|
173
|
-
<CalendarIcon className="dash-datepicker-trigger-icon" />
|
|
174
172
|
<AutosizeInput
|
|
175
173
|
inputRef={node => {
|
|
176
174
|
inputRef.current = node;
|
|
@@ -205,6 +203,9 @@ const DatePickerSingle = ({
|
|
|
205
203
|
className="dash-datepicker-content"
|
|
206
204
|
align="start"
|
|
207
205
|
sideOffset={5}
|
|
206
|
+
collisionBoundary={containerRef.current?.closest(
|
|
207
|
+
'#_dash-app-content'
|
|
208
|
+
)}
|
|
208
209
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
209
210
|
onCloseAutoFocus={e => {
|
|
210
211
|
e.preventDefault();
|