dash-core-components 4.0.0-rc5 → 4.0.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.
Files changed (39) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-highlight.js +1 -1
  8. package/dash_core_components/async-highlight.js.map +1 -1
  9. package/dash_core_components/async-markdown.js +1 -1
  10. package/dash_core_components/async-markdown.js.map +1 -1
  11. package/dash_core_components/async-mathjax.js +1 -1
  12. package/dash_core_components/async-slider.js +1 -1
  13. package/dash_core_components/async-slider.js.map +1 -1
  14. package/dash_core_components/async-upload.js +1 -1
  15. package/dash_core_components/async-upload.js.map +1 -1
  16. package/dash_core_components/dash_core_components-shared.js +1 -1
  17. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  18. package/dash_core_components/dash_core_components.js +1 -1
  19. package/dash_core_components/dash_core_components.js.map +1 -1
  20. package/dash_core_components/proptypes.js +2 -0
  21. package/lib/components/Clipboard.react.js +17 -8
  22. package/lib/components/Input.tsx +12 -2
  23. package/lib/components/RangeSlider.tsx +2 -0
  24. package/lib/components/Slider.tsx +2 -0
  25. package/lib/components/Tabs.tsx +1 -1
  26. package/lib/components/css/calendar.css +21 -4
  27. package/lib/components/css/datepickers.css +73 -6
  28. package/lib/components/css/dcc.css +1 -1
  29. package/lib/components/css/dropdown.css +2 -6
  30. package/lib/components/css/input.css +1 -1
  31. package/lib/components/css/optionslist.css +0 -1
  32. package/lib/components/css/sliders.css +2 -1
  33. package/lib/fragments/DatePickerRange.tsx +39 -9
  34. package/lib/fragments/DatePickerSingle.tsx +38 -8
  35. package/lib/fragments/Dropdown.tsx +5 -5
  36. package/lib/fragments/RangeSlider.tsx +2 -0
  37. package/lib/types.ts +12 -0
  38. package/lib/utils/calendar/cssVariables.ts +41 -0
  39. package/package.json +6 -6
@@ -225,6 +225,7 @@ pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
225
225
  updatemode:pt.oneOf(['mouseup','drag']),
226
226
  vertical:pt.oneOfType([pt.bool]),
227
227
  verticalHeight:pt.oneOfType([pt.number]),
228
+ allow_direct_input:pt.oneOfType([pt.bool]),
228
229
  className:pt.oneOfType([pt.string]),
229
230
  setProps:pt.any,
230
231
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
@@ -246,6 +247,7 @@ pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
246
247
  updatemode:pt.oneOf(['mouseup','drag']),
247
248
  vertical:pt.oneOfType([pt.bool]),
248
249
  verticalHeight:pt.oneOfType([pt.number]),
250
+ allow_direct_input:pt.oneOfType([pt.bool]),
249
251
  className:pt.oneOfType([pt.string]),
250
252
  setProps:pt.any,
251
253
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
@@ -187,21 +187,22 @@ class Clipboard extends _react.default.Component {
187
187
  id = _this$props.id,
188
188
  title = _this$props.title,
189
189
  className = _this$props.className,
190
- style = _this$props.style;
191
- var copyIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
192
- icon: _freeRegularSvgIcons.faCopy
193
- });
194
- var copiedIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
190
+ style = _this$props.style,
191
+ children = _this$props.children,
192
+ copied_children = _this$props.copied_children;
193
+ var isCopied = this.state.copied;
194
+ var button_children = isCopied ? copied_children !== null && copied_children !== void 0 ? copied_children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
195
195
  icon: _freeRegularSvgIcons.faCheckCircle
196
+ }) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
197
+ icon: _freeRegularSvgIcons.faCopy
196
198
  });
197
- var btnIcon = this.state.copied ? copiedIcon : copyIcon;
198
199
  return clipboardAPI ? /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
199
200
  id: id,
200
201
  title: title,
201
202
  style: style,
202
203
  className: className,
203
204
  onClick: this.onClickHandler
204
- }, /*#__PURE__*/_react.default.createElement("i", null, " ", btnIcon)) : null;
205
+ }, button_children) : null;
205
206
  }
206
207
  }
207
208
  exports.default = Clipboard;
@@ -217,6 +218,14 @@ Clipboard.propTypes = {
217
218
  * The ID used to identify this component.
218
219
  */
219
220
  id: _propTypes.default.string,
221
+ /**
222
+ * Children rendered inside the Clipboard button before copying. By default, a copy icon.
223
+ */
224
+ children: _propTypes.default.node,
225
+ /**
226
+ * Children rendered inside the Clipboard button after the value has been copied. By default, a check icon.
227
+ */
228
+ copied_children: _propTypes.default.node,
220
229
  /**
221
230
  * The id of target component containing text to copy to the clipboard.
222
231
  * The inner text of the `children` prop will be copied to the clipboard. If none, then the text from the
@@ -228,7 +237,7 @@ Clipboard.propTypes = {
228
237
  */
229
238
  content: _propTypes.default.string,
230
239
  /**
231
- * The number of times copy button was clicked
240
+ * The number of times Clipboard button was clicked
232
241
  */
233
242
  n_clicks: _propTypes.default.number,
234
243
  /**
@@ -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
- input.current.value = constrainedValue.toString();
200
- setValue(constrainedValue.toString());
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]
@@ -19,6 +19,7 @@ export default function RangeSlider({
19
19
  // eslint-disable-next-line no-magic-numbers
20
20
  verticalHeight = 400,
21
21
  step = undefined,
22
+ allow_direct_input = true,
22
23
  ...props
23
24
  }: RangeSliderProps) {
24
25
  // Some considerations for the default value of `step`:
@@ -38,6 +39,7 @@ export default function RangeSlider({
38
39
  updatemode={updatemode}
39
40
  verticalHeight={verticalHeight}
40
41
  step={step}
42
+ allow_direct_input={allow_direct_input}
41
43
  {...props}
42
44
  />
43
45
  </Suspense>
@@ -23,6 +23,7 @@ export default function Slider({
23
23
  // eslint-disable-next-line no-magic-numbers
24
24
  verticalHeight = 400,
25
25
  step = undefined,
26
+ allow_direct_input = true,
26
27
  setProps,
27
28
  value,
28
29
  drag_value,
@@ -77,6 +78,7 @@ export default function Slider({
77
78
  updatemode={updatemode}
78
79
  verticalHeight={verticalHeight}
79
80
  step={step}
81
+ allow_direct_input={allow_direct_input}
80
82
  value={mappedValue}
81
83
  drag_value={mappedDragValue}
82
84
  setProps={mappedSetProps}
@@ -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
@@ -30,7 +30,7 @@
30
30
 
31
31
  .dash-datepicker-calendar td:hover {
32
32
  cursor: pointer;
33
- background-color: var(--Dash-Fill-Weak);
33
+ background-color: var(--Dash-Fill-Interactive-Weak);
34
34
  }
35
35
 
36
36
  .dash-datepicker-calendar td:focus {
@@ -41,17 +41,34 @@
41
41
  position: relative;
42
42
  }
43
43
 
44
- .dash-datepicker-calendar td.dash-datepicker-calendar-date-highlighted {
44
+ /* Highlighted dates (i.e. dates within a selected range) get highlight colours */
45
+ .dash-datepicker-calendar
46
+ td.dash-datepicker-calendar-date-highlighted:not(
47
+ .dash-datepicker-calendar-date-outside
48
+ ) {
49
+ background-color: var(--Dash-Fill-Interactive-Weak);
50
+ color: var(--Dash-Fill-Interactive-Strong);
51
+ }
52
+
53
+ /* Outside days get highlighted colours only on hover */
54
+ .dash-datepicker-calendar
55
+ td.dash-datepicker-calendar-date-highlighted.dash-datepicker-calendar-date-outside:hover {
45
56
  background-color: var(--Dash-Fill-Interactive-Weak);
46
57
  color: var(--Dash-Fill-Interactive-Strong);
47
58
  }
48
59
 
49
- .dash-datepicker-calendar td.dash-datepicker-calendar-date-selected {
60
+ /* Selected dates (start & end) get accented colours */
61
+ .dash-datepicker-calendar
62
+ td.dash-datepicker-calendar-date-selected:not(
63
+ .dash-datepicker-calendar-date-outside
64
+ ) {
50
65
  background-color: var(--Dash-Fill-Interactive-Strong);
51
66
  color: var(--Dash-Fill-Inverse-Strong);
52
67
  }
53
68
 
54
- .dash-datepicker-calendar td.dash-datepicker-calendar-date-selected {
69
+ /* Outside days, when selected, get accented colours only when active (being clicked) */
70
+ .dash-datepicker-calendar
71
+ td.dash-datepicker-calendar-date-outside.dash-datepicker-calendar-date-selected:active {
55
72
  background-color: var(--Dash-Fill-Interactive-Strong);
56
73
  color: var(--Dash-Fill-Inverse-Strong);
57
74
  }
@@ -11,6 +11,9 @@
11
11
  position: relative;
12
12
  accent-color: var(--Dash-Fill-Interactive-Strong);
13
13
  outline-color: var(--Dash-Fill-Interactive-Strong);
14
+ font-family: inherit;
15
+ font-size: inherit;
16
+ color: inherit;
14
17
  }
15
18
 
16
19
  .dash-datepicker-input-wrapper {
@@ -143,6 +146,74 @@
143
146
  z-index: 500;
144
147
  box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
145
148
  0px 10px 20px -15px var(--Dash-Shading-Weak);
149
+ overscroll-behavior: contain;
150
+ }
151
+
152
+ [data-radix-popper-content-wrapper]:has(.dash-datepicker-portal) {
153
+ transform: none !important;
154
+ }
155
+
156
+ .dash-datepicker-portal {
157
+ position: fixed;
158
+ inset: 0;
159
+ width: 100vw;
160
+ height: 100vh;
161
+ max-width: 100vw;
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ background: var(--Dash-Shading-Strong);
166
+ border: none;
167
+ box-shadow: none;
168
+ overflow: visible;
169
+ padding: 0;
170
+ pointer-events: none;
171
+ }
172
+
173
+ .dash-datepicker-portal .dash-datepicker-calendar-wrapper {
174
+ background: var(--Dash-Fill-Inverse-Strong);
175
+ border-radius: var(--Dash-Spacing);
176
+ border: 1px solid var(--Dash-Stroke-Strong);
177
+ padding: 16px;
178
+ box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
179
+ 0px 10px 20px -15px var(--Dash-Shading-Weak);
180
+ z-index: 1;
181
+ pointer-events: auto;
182
+ width: fit-content;
183
+ max-width: 95vw;
184
+ }
185
+
186
+ .dash-datepicker-fullscreen {
187
+ pointer-events: auto;
188
+ background: var(--Dash-Fill-Inverse-Strong);
189
+ }
190
+
191
+ .dash-datepicker-close-button {
192
+ position: fixed;
193
+ top: calc(var(--Dash-Spacing) * 2);
194
+ right: calc(var(--Dash-Spacing) * 2);
195
+ width: 24px;
196
+ height: 24px;
197
+ display: flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ background: var(--Dash-Fill-Inverse-Strong);
201
+ border: none;
202
+ border-radius: var(--Dash-Spacing);
203
+ color: var(--Dash-Text-Strong);
204
+ cursor: pointer;
205
+ z-index: 501;
206
+ pointer-events: auto;
207
+ }
208
+
209
+ .dash-datepicker-close-button:hover {
210
+ background: var(--Dash-Fill-Interactive-Weak);
211
+ color: var(--Dash-Fill-Interactive-Strong);
212
+ }
213
+
214
+ .dash-datepicker-close-button:focus {
215
+ outline: 2px solid var(--Dash-Fill-Interactive-Strong);
216
+ outline-offset: 2px;
146
217
  }
147
218
 
148
219
  .dash-datepicker-calendar-wrapper {
@@ -155,6 +226,7 @@
155
226
  display: flex;
156
227
  align-items: flex-start;
157
228
  gap: calc(var(--Dash-Spacing) * 4);
229
+ flex-wrap: wrap;
158
230
  }
159
231
 
160
232
  .dash-datepicker-controls {
@@ -210,7 +282,7 @@
210
282
  }
211
283
 
212
284
  .dash-datepicker-month-nav:hover:not(:disabled) {
213
- background: var(--Dash-Fill-Weak);
285
+ background: var(--Dash-Fill-Interactive-Weak);
214
286
  }
215
287
 
216
288
  .dash-datepicker-month-nav:focus-visible {
@@ -226,8 +298,3 @@
226
298
  width: 20px;
227
299
  height: 20px;
228
300
  }
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
- }
@@ -101,7 +101,7 @@
101
101
  cursor: pointer;
102
102
  font-size: 16px;
103
103
  font-weight: bold;
104
- color: var(--Dash -Text-Primary);
104
+ color: var(--Dash-Text-Primary);
105
105
  }
106
106
 
107
107
  .dash-input-stepper:hover,
@@ -11,7 +11,6 @@
11
11
  .dash-options-list-option:not(:has(input[disabled])):hover,
12
12
  .dash-options-list-option:not(:has(input[disabled])):focus-within {
13
13
  color: var(--Dash-Fill-Interactive-Strong);
14
- background: var(--Dash-Fill-Interactive-Weak);
15
14
  }
16
15
 
17
16
  .dash-options-list-option:has(input[disabled]) {
@@ -83,7 +83,8 @@
83
83
  display: block;
84
84
  }
85
85
 
86
- .dash-slider-thumb[data-disabled] {
86
+ .dash-slider-thumb[data-disabled],
87
+ .dash-range-slider-input:disabled {
87
88
  cursor: not-allowed;
88
89
  opacity: 0.5;
89
90
  }
@@ -19,6 +19,7 @@ import {
19
19
  isSameDay,
20
20
  strAsDate,
21
21
  } from '../utils/calendar/helpers';
22
+ import {captureCSSForPortal} from '../utils/calendar/cssVariables';
22
23
  import '../components/css/datepickers.css';
23
24
 
24
25
  const DatePickerRange = ({
@@ -51,6 +52,8 @@ const DatePickerRange = ({
51
52
  end_date_id,
52
53
  start_date_placeholder_text = 'Start Date',
53
54
  end_date_placeholder_text = 'End Date',
55
+ with_portal = false,
56
+ with_full_screen_portal = false,
54
57
  }: DatePickerRangeProps) => {
55
58
  const [internalStartDate, setInternalStartDate] = useState(
56
59
  strAsDate(start_date)
@@ -102,6 +105,12 @@ const DatePickerRange = ({
102
105
  const startInputRef = useRef<HTMLInputElement | null>(null);
103
106
  const endInputRef = useRef<HTMLInputElement | null>(null);
104
107
  const calendarRef = useRef<CalendarHandle>(null);
108
+ const hasPortal = with_portal || with_full_screen_portal;
109
+
110
+ // Capture CSS variables for portal mode
111
+ const portalStyle = useMemo(() => {
112
+ return hasPortal ? captureCSSForPortal(containerRef) : undefined;
113
+ }, [hasPortal, isCalendarOpen]);
105
114
 
106
115
  useEffect(() => {
107
116
  setInternalStartDate(strAsDate(start_date));
@@ -333,7 +342,7 @@ const DatePickerRange = ({
333
342
  id={start_date_id || accessibleId}
334
343
  inputClassName="dash-datepicker-input dash-datepicker-start-date"
335
344
  value={startInputValue}
336
- onChange={e => setStartInputValue(e.target.value)}
345
+ onChange={e => setStartInputValue(e.target?.value)}
337
346
  onKeyDown={handleStartInputKeyDown}
338
347
  onFocus={() => {
339
348
  if (isCalendarOpen) {
@@ -354,7 +363,7 @@ const DatePickerRange = ({
354
363
  id={end_date_id || accessibleId + '-end-date'}
355
364
  inputClassName="dash-datepicker-input dash-datepicker-end-date"
356
365
  value={endInputValue}
357
- onChange={e => setEndInputValue(e.target.value)}
366
+ onChange={e => setEndInputValue(e.target?.value)}
358
367
  onKeyDown={handleEndInputKeyDown}
359
368
  onFocus={() => {
360
369
  if (isCalendarOpen) {
@@ -379,14 +388,26 @@ const DatePickerRange = ({
379
388
  </div>
380
389
  </Popover.Trigger>
381
390
 
382
- <Popover.Portal container={containerRef.current}>
391
+ <Popover.Portal
392
+ container={hasPortal ? undefined : containerRef.current}
393
+ >
383
394
  <Popover.Content
384
- className="dash-datepicker-content"
385
- align="start"
386
- sideOffset={5}
387
- collisionBoundary={containerRef.current?.closest(
388
- '#_dash-app-content'
389
- )}
395
+ className={`dash-datepicker-content${
396
+ hasPortal ? ' dash-datepicker-portal' : ''
397
+ }${
398
+ with_full_screen_portal
399
+ ? ' dash-datepicker-fullscreen'
400
+ : ''
401
+ }`}
402
+ style={portalStyle}
403
+ align={hasPortal ? 'center' : 'start'}
404
+ sideOffset={hasPortal ? 0 : 5}
405
+ avoidCollisions={!hasPortal}
406
+ onInteractOutside={
407
+ with_full_screen_portal
408
+ ? e => e.preventDefault()
409
+ : undefined
410
+ }
390
411
  onOpenAutoFocus={e => e.preventDefault()}
391
412
  onCloseAutoFocus={e => {
392
413
  e.preventDefault();
@@ -407,6 +428,15 @@ const DatePickerRange = ({
407
428
  }
408
429
  }}
409
430
  >
431
+ {with_full_screen_portal && (
432
+ <button
433
+ className="dash-datepicker-close-button"
434
+ onClick={() => setIsCalendarOpen(false)}
435
+ aria-label="Close calendar"
436
+ >
437
+ <Cross1Icon />
438
+ </button>
439
+ )}
410
440
  <Calendar
411
441
  ref={calendarRef}
412
442
  initialVisibleDate={initialCalendarDate}
@@ -13,6 +13,7 @@ import {
13
13
  isSameDay,
14
14
  strAsDate,
15
15
  } from '../utils/calendar/helpers';
16
+ import {captureCSSForPortal} from '../utils/calendar/cssVariables';
16
17
  import '../components/css/datepickers.css';
17
18
 
18
19
  const DatePickerSingle = ({
@@ -39,6 +40,8 @@ const DatePickerSingle = ({
39
40
  day_size = 34,
40
41
  number_of_months_shown = 1,
41
42
  calendar_orientation,
43
+ with_portal = false,
44
+ with_full_screen_portal = false,
42
45
  }: DatePickerSingleProps) => {
43
46
  const [internalDate, setInternalDate] = useState(strAsDate(date));
44
47
  const direction = is_RTL
@@ -61,6 +64,12 @@ const DatePickerSingle = ({
61
64
  const containerRef = useRef<HTMLDivElement>(null);
62
65
  const inputRef = useRef<HTMLInputElement | null>(null);
63
66
  const calendarRef = useRef<CalendarHandle>(null);
67
+ const hasPortal = with_portal || with_full_screen_portal;
68
+
69
+ // Capture CSS variables for portal mode
70
+ const portalStyle = useMemo(() => {
71
+ return hasPortal ? captureCSSForPortal(containerRef) : undefined;
72
+ }, [hasPortal, isCalendarOpen]);
64
73
 
65
74
  useEffect(() => {
66
75
  setInternalDate(strAsDate(date));
@@ -177,7 +186,7 @@ const DatePickerSingle = ({
177
186
  id={accessibleId}
178
187
  inputClassName="dash-datepicker-input dash-datepicker-end-date"
179
188
  value={inputValue}
180
- onChange={e => setInputValue(e.target.value)}
189
+ onChange={e => setInputValue(e.target?.value)}
181
190
  onKeyDown={handleInputKeyDown}
182
191
  placeholder={placeholder}
183
192
  disabled={disabled}
@@ -198,14 +207,26 @@ const DatePickerSingle = ({
198
207
  </div>
199
208
  </Popover.Trigger>
200
209
 
201
- <Popover.Portal container={containerRef.current}>
210
+ <Popover.Portal
211
+ container={hasPortal ? undefined : containerRef.current}
212
+ >
202
213
  <Popover.Content
203
- className="dash-datepicker-content"
204
- align="start"
205
- sideOffset={5}
206
- collisionBoundary={containerRef.current?.closest(
207
- '#_dash-app-content'
208
- )}
214
+ className={`dash-datepicker-content${
215
+ hasPortal ? ' dash-datepicker-portal' : ''
216
+ }${
217
+ with_full_screen_portal
218
+ ? ' dash-datepicker-fullscreen'
219
+ : ''
220
+ }`}
221
+ style={portalStyle}
222
+ align={hasPortal ? 'center' : 'start'}
223
+ sideOffset={hasPortal ? 0 : 5}
224
+ avoidCollisions={!hasPortal}
225
+ onInteractOutside={
226
+ with_full_screen_portal
227
+ ? e => e.preventDefault()
228
+ : undefined
229
+ }
209
230
  onOpenAutoFocus={e => e.preventDefault()}
210
231
  onCloseAutoFocus={e => {
211
232
  e.preventDefault();
@@ -215,6 +236,15 @@ const DatePickerSingle = ({
215
236
  }
216
237
  }}
217
238
  >
239
+ {with_full_screen_portal && (
240
+ <button
241
+ className="dash-datepicker-close-button"
242
+ onClick={() => setIsCalendarOpen(false)}
243
+ aria-label="Close calendar"
244
+ >
245
+ <Cross1Icon />
246
+ </button>
247
+ )}
218
248
  <Calendar
219
249
  ref={calendarRef}
220
250
  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 ref={positioningContainerRef} className="dash-dropdown-wrapper">
542
+ <div
543
+ ref={positioningContainerRef}
544
+ className="dash-dropdown-wrapper"
545
+ style={style}
546
+ >
547
547
  {popover}
548
548
  </div>
549
549
  );
@@ -40,6 +40,7 @@ export default function RangeSlider(props: RangeSliderProps) {
40
40
  pushable,
41
41
  count,
42
42
  reverse,
43
+ allow_direct_input = true,
43
44
  } = props;
44
45
 
45
46
  // For range slider, we expect an array of values
@@ -263,6 +264,7 @@ export default function RangeSlider(props: RangeSliderProps) {
263
264
 
264
265
  // Determine if inputs should be rendered at all (CSS will handle responsive visibility)
265
266
  const shouldShowInputs =
267
+ allow_direct_input !== false && // Not disabled by allow_direct_input
266
268
  step !== null && // Not disabled by step=None
267
269
  value.length <= 2 && // Only for single or range sliders
268
270
  !vertical; // Only for horizontal sliders
package/lib/types.ts CHANGED
@@ -499,6 +499,12 @@ export interface SliderProps extends BaseDccProps<SliderProps> {
499
499
  * The height, in px, of the slider if it is vertical.
500
500
  */
501
501
  verticalHeight?: number;
502
+
503
+ /**
504
+ * If false, the input elements for directly entering values will be hidden.
505
+ * Only the slider will be visible and it will occupy 100% width of the container.
506
+ */
507
+ allow_direct_input?: boolean;
502
508
  }
503
509
 
504
510
  export interface RangeSliderProps extends BaseDccProps<RangeSliderProps> {
@@ -604,6 +610,12 @@ export interface RangeSliderProps extends BaseDccProps<RangeSliderProps> {
604
610
  * The height, in px, of the slider if it is vertical.
605
611
  */
606
612
  verticalHeight?: number;
613
+
614
+ /**
615
+ * If false, the input elements for directly entering values will be hidden.
616
+ * Only the slider will be visible and it will occupy 100% width of the container.
617
+ */
618
+ allow_direct_input?: boolean;
607
619
  }
608
620
 
609
621
  export type OptionValue = string | number | boolean;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Captures CSS variables and key inherited properties from a container element for use in portaled content.
3
+ * When content is portaled outside its normal DOM hierarchy (e.g., to document.body),
4
+ * it loses access to CSS variables defined on parent elements and inherited properties.
5
+ * This function extracts those so they can be applied as inline styles.
6
+ */
7
+ export function captureCSSForPortal(
8
+ containerRef: React.RefObject<HTMLElement>,
9
+ prefix = '--Dash-'
10
+ ): Record<string, string> {
11
+ if (typeof window === 'undefined') {
12
+ return {};
13
+ }
14
+
15
+ const element = containerRef.current || document.documentElement;
16
+ const computedStyle = window.getComputedStyle(element);
17
+ const styles: Record<string, string> = {};
18
+
19
+ // Capture CSS variables (custom properties starting with prefix)
20
+ for (let i = 0; i < computedStyle.length; i++) {
21
+ const prop = computedStyle[i];
22
+ if (prop.startsWith(prefix)) {
23
+ styles[prop] = computedStyle.getPropertyValue(prop);
24
+ }
25
+ }
26
+
27
+ // Capture key inherited properties
28
+ const inheritedProps = ['font-family', 'font-size', 'color'];
29
+ inheritedProps.forEach(prop => {
30
+ const value = computedStyle.getPropertyValue(prop);
31
+ if (value) {
32
+ // Convert hyphenated CSS property names to camelCase for React
33
+ const camelCaseProp = prop.replace(/-([a-z])/g, (_, letter) =>
34
+ letter.toUpperCase()
35
+ );
36
+ styles[camelCaseProp] = value;
37
+ }
38
+ });
39
+
40
+ return styles;
41
+ }