dash-core-components 4.0.0-rc6 → 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.
- 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-mathjax.js +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 +1 -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 +2 -0
- package/lib/components/Clipboard.react.js +17 -8
- package/lib/components/RangeSlider.tsx +2 -0
- package/lib/components/Slider.tsx +2 -0
- package/lib/components/css/calendar.css +20 -3
- package/lib/components/css/datepickers.css +4 -2
- package/lib/components/css/optionslist.css +0 -1
- package/lib/fragments/DatePickerRange.tsx +10 -1
- package/lib/fragments/DatePickerSingle.tsx +10 -1
- package/lib/fragments/RangeSlider.tsx +2 -0
- package/lib/types.ts +12 -0
- package/lib/utils/calendar/cssVariables.ts +41 -0
- 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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var
|
|
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
|
-
},
|
|
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
|
|
240
|
+
* The number of times Clipboard button was clicked
|
|
232
241
|
*/
|
|
233
242
|
n_clicks: _propTypes.default.number,
|
|
234
243
|
/**
|
|
@@ -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}
|
|
@@ -41,17 +41,34 @@
|
|
|
41
41
|
position: relative;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
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
|
+
) {
|
|
45
49
|
background-color: var(--Dash-Fill-Interactive-Weak);
|
|
46
50
|
color: var(--Dash-Fill-Interactive-Strong);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
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 {
|
|
56
|
+
background-color: var(--Dash-Fill-Interactive-Weak);
|
|
57
|
+
color: var(--Dash-Fill-Interactive-Strong);
|
|
58
|
+
}
|
|
59
|
+
|
|
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
|
-
|
|
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 {
|
|
@@ -146,8 +149,7 @@
|
|
|
146
149
|
overscroll-behavior: contain;
|
|
147
150
|
}
|
|
148
151
|
|
|
149
|
-
.dash-datepicker
|
|
150
|
-
[data-radix-popper-content-wrapper]:has(.dash-datepicker-portal) {
|
|
152
|
+
[data-radix-popper-content-wrapper]:has(.dash-datepicker-portal) {
|
|
151
153
|
transform: none !important;
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -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]) {
|
|
@@ -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 = ({
|
|
@@ -106,6 +107,11 @@ const DatePickerRange = ({
|
|
|
106
107
|
const calendarRef = useRef<CalendarHandle>(null);
|
|
107
108
|
const hasPortal = with_portal || with_full_screen_portal;
|
|
108
109
|
|
|
110
|
+
// Capture CSS variables for portal mode
|
|
111
|
+
const portalStyle = useMemo(() => {
|
|
112
|
+
return hasPortal ? captureCSSForPortal(containerRef) : undefined;
|
|
113
|
+
}, [hasPortal, isCalendarOpen]);
|
|
114
|
+
|
|
109
115
|
useEffect(() => {
|
|
110
116
|
setInternalStartDate(strAsDate(start_date));
|
|
111
117
|
}, [start_date]);
|
|
@@ -382,7 +388,9 @@ const DatePickerRange = ({
|
|
|
382
388
|
</div>
|
|
383
389
|
</Popover.Trigger>
|
|
384
390
|
|
|
385
|
-
<Popover.Portal
|
|
391
|
+
<Popover.Portal
|
|
392
|
+
container={hasPortal ? undefined : containerRef.current}
|
|
393
|
+
>
|
|
386
394
|
<Popover.Content
|
|
387
395
|
className={`dash-datepicker-content${
|
|
388
396
|
hasPortal ? ' dash-datepicker-portal' : ''
|
|
@@ -391,6 +399,7 @@ const DatePickerRange = ({
|
|
|
391
399
|
? ' dash-datepicker-fullscreen'
|
|
392
400
|
: ''
|
|
393
401
|
}`}
|
|
402
|
+
style={portalStyle}
|
|
394
403
|
align={hasPortal ? 'center' : 'start'}
|
|
395
404
|
sideOffset={hasPortal ? 0 : 5}
|
|
396
405
|
avoidCollisions={!hasPortal}
|
|
@@ -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 = ({
|
|
@@ -65,6 +66,11 @@ const DatePickerSingle = ({
|
|
|
65
66
|
const calendarRef = useRef<CalendarHandle>(null);
|
|
66
67
|
const hasPortal = with_portal || with_full_screen_portal;
|
|
67
68
|
|
|
69
|
+
// Capture CSS variables for portal mode
|
|
70
|
+
const portalStyle = useMemo(() => {
|
|
71
|
+
return hasPortal ? captureCSSForPortal(containerRef) : undefined;
|
|
72
|
+
}, [hasPortal, isCalendarOpen]);
|
|
73
|
+
|
|
68
74
|
useEffect(() => {
|
|
69
75
|
setInternalDate(strAsDate(date));
|
|
70
76
|
}, [date]);
|
|
@@ -201,7 +207,9 @@ const DatePickerSingle = ({
|
|
|
201
207
|
</div>
|
|
202
208
|
</Popover.Trigger>
|
|
203
209
|
|
|
204
|
-
<Popover.Portal
|
|
210
|
+
<Popover.Portal
|
|
211
|
+
container={hasPortal ? undefined : containerRef.current}
|
|
212
|
+
>
|
|
205
213
|
<Popover.Content
|
|
206
214
|
className={`dash-datepicker-content${
|
|
207
215
|
hasPortal ? ' dash-datepicker-portal' : ''
|
|
@@ -210,6 +218,7 @@ const DatePickerSingle = ({
|
|
|
210
218
|
? ' dash-datepicker-fullscreen'
|
|
211
219
|
: ''
|
|
212
220
|
}`}
|
|
221
|
+
style={portalStyle}
|
|
213
222
|
align={hasPortal ? 'center' : 'start'}
|
|
214
223
|
sideOffset={hasPortal ? 0 : 5}
|
|
215
224
|
avoidCollisions={!hasPortal}
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash-core-components",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Core component suite for Dash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"uniqid": "^5.4.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@babel/cli": "^7.28.
|
|
71
|
-
"@babel/core": "^7.28.
|
|
72
|
-
"@babel/eslint-parser": "^7.28.
|
|
70
|
+
"@babel/cli": "^7.28.6",
|
|
71
|
+
"@babel/core": "^7.28.6",
|
|
72
|
+
"@babel/eslint-parser": "^7.28.6",
|
|
73
73
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
74
|
-
"@babel/preset-env": "^7.28.
|
|
74
|
+
"@babel/preset-env": "^7.28.6",
|
|
75
75
|
"@babel/preset-react": "^7.28.5",
|
|
76
76
|
"@babel/preset-typescript": "^7.28.5",
|
|
77
77
|
"@plotly/dash-component-plugins": "^1.2.3",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"styled-jsx": "^5.1.7",
|
|
111
111
|
"ts-jest": "^29.1.0",
|
|
112
112
|
"typescript": "^5.8.3",
|
|
113
|
-
"webpack": "^5.
|
|
113
|
+
"webpack": "^5.104.1",
|
|
114
114
|
"webpack-cli": "^5.1.4"
|
|
115
115
|
},
|
|
116
116
|
"optionalDependencies": {
|