dash-core-components 4.0.0-rc3 → 4.0.0-rc4

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.
@@ -3,6 +3,40 @@
3
3
  var pt = window.PropTypes;
4
4
  var pk = window['dash_core_components'];
5
5
 
6
+ pk.Button.propTypes = {className:pt.oneOfType([pt.string]),
7
+ setProps:pt.any,
8
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
9
+ persisted_props:pt.any,
10
+ persistence_type:pt.oneOf(['local','session','memory']),
11
+ id:pt.oneOfType([pt.string]),
12
+ componentPath:pt.any,
13
+ children:pt.node,
14
+ type:pt.oneOf(['submit','reset','button']),
15
+ autoFocus:pt.oneOfType([pt.bool]),
16
+ disabled:pt.oneOfType([pt.bool]),
17
+ form:pt.oneOfType([pt.string]),
18
+ formAction:pt.oneOfType([pt.string]),
19
+ formEncType:pt.oneOfType([pt.string]),
20
+ formMethod:pt.oneOfType([pt.string]),
21
+ formNoValidate:pt.oneOfType([pt.bool]),
22
+ formTarget:pt.oneOfType([pt.string]),
23
+ name:pt.oneOfType([pt.string]),
24
+ value:pt.oneOfType([pt.string,pt.number,pt.arrayOf(pt.string)]),
25
+ accessKey:pt.oneOfType([pt.string]),
26
+ contentEditable:pt.oneOfType([pt.bool,pt.oneOf(["true"]),pt.oneOf(["false"]),pt.oneOf(["inherit"])]),
27
+ dir:pt.oneOfType([pt.string]),
28
+ draggable:pt.oneOfType([pt.bool]),
29
+ hidden:pt.oneOfType([pt.bool]),
30
+ lang:pt.oneOfType([pt.string]),
31
+ role:pt.oneOfType([pt.string]),
32
+ spellCheck:pt.oneOfType([pt.bool]),
33
+ style:pt.any,
34
+ tabIndex:pt.oneOfType([pt.number]),
35
+ title:pt.oneOfType([pt.string]),
36
+ n_blur:pt.oneOfType([pt.number]),
37
+ n_blur_timestamp:pt.oneOfType([pt.number]),
38
+ n_clicks:pt.oneOfType([pt.number]),
39
+ n_clicks_timestamp:pt.oneOfType([pt.number])};
6
40
  pk.Checklist.propTypes = {options:pt.any,
7
41
  value:pt.oneOfType([pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
8
42
  inline:pt.oneOfType([pt.bool]),
@@ -29,6 +63,12 @@ pk.DatePickerRange.propTypes = {start_date:pt.any,
29
63
  setProps:pt.any,
30
64
  id:pt.oneOfType([pt.string]),
31
65
  componentPath:pt.any,
66
+ className:pt.oneOfType([pt.string]),
67
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
68
+ persisted_props:pt.any,
69
+ persistence_type:pt.oneOf(['local','session','memory']),
70
+ disabled:pt.oneOfType([pt.bool]),
71
+ style:pt.any,
32
72
  min_date_allowed:pt.oneOfType([pt.string]),
33
73
  max_date_allowed:pt.oneOfType([pt.string]),
34
74
  disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
@@ -46,13 +86,7 @@ pk.DatePickerRange.propTypes = {start_date:pt.any,
46
86
  with_portal:pt.oneOfType([pt.bool]),
47
87
  with_full_screen_portal:pt.oneOfType([pt.bool]),
48
88
  day_size:pt.oneOfType([pt.number]),
49
- is_RTL:pt.oneOfType([pt.bool]),
50
- disabled:pt.oneOfType([pt.bool]),
51
- style:pt.any,
52
- className:pt.oneOfType([pt.string]),
53
- persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
54
- persisted_props:pt.any,
55
- persistence_type:pt.oneOf(['local','session','memory'])};
89
+ is_RTL:pt.oneOfType([pt.bool])};
56
90
  pk.DatePickerSingle.propTypes = {date:pt.any,
57
91
  min_date_allowed:pt.oneOfType([pt.string]),
58
92
  max_date_allowed:pt.oneOfType([pt.string]),
@@ -102,6 +136,7 @@ pk.Dropdown.propTypes = {options:pt.any,
102
136
  id:pt.oneOfType([pt.string]),
103
137
  componentPath:pt.any};
104
138
  pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
139
+ type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden']),
105
140
  debounce:pt.oneOfType([pt.number,pt.bool]),
106
141
  placeholder:pt.oneOfType([pt.string,pt.number]),
107
142
  n_submit:pt.oneOfType([pt.number]),
@@ -130,12 +165,12 @@ pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
130
165
  size:pt.oneOfType([pt.string]),
131
166
  style:pt.any,
132
167
  className:pt.oneOfType([pt.string]),
133
- id:pt.oneOfType([pt.string]),
134
168
  setProps:pt.any,
135
169
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
136
170
  persisted_props:pt.any,
137
171
  persistence_type:pt.oneOf(['local','session','memory']),
138
- type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden'])};
172
+ id:pt.oneOfType([pt.string]),
173
+ componentPath:pt.any};
139
174
  pk.Loading.propTypes = {children:pt.node,
140
175
  type:pt.oneOf(['graph','cube','circle','dot','default']),
141
176
  fullscreen:pt.oneOfType([pt.bool]),
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import {ButtonProps} from '../types';
3
+ import './css/button.css';
4
+
5
+ /**
6
+ * Similar to dash.html.Button, but with theming and styles applied.
7
+ */
8
+ const Button = ({
9
+ setProps,
10
+ n_blur = 0,
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ n_blur_timestamp = -1,
13
+ n_clicks = 0,
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ n_clicks_timestamp = -1,
16
+ type = 'button',
17
+ className,
18
+ children,
19
+ ...props
20
+ }: ButtonProps) => {
21
+ const ctx = window.dash_component_api.useDashContext();
22
+ const isLoading = ctx.useLoading();
23
+
24
+ return (
25
+ <button
26
+ data-dash-is-loading={isLoading || undefined}
27
+ className={'dash-button ' + (className ?? '')}
28
+ onBlur={() => {
29
+ setProps({
30
+ n_blur: n_blur + 1,
31
+ n_blur_timestamp: Date.now(),
32
+ });
33
+ }}
34
+ onClick={() => {
35
+ setProps({
36
+ n_clicks: n_clicks + 1,
37
+ n_clicks_timestamp: Date.now(),
38
+ });
39
+ }}
40
+ type={type}
41
+ {...props}
42
+ >
43
+ {children}
44
+ </button>
45
+ );
46
+ };
47
+
48
+ export default Button;
@@ -11,7 +11,12 @@ import React, {
11
11
  import uniqid from 'uniqid';
12
12
  import fastIsNumeric from 'fast-isnumeric';
13
13
  import LoadingElement from '../utils/_LoadingElement';
14
- import {PersistedProps, PersistenceTypes} from '../types';
14
+ import {
15
+ HTMLInputTypes,
16
+ InputProps,
17
+ PersistedProps,
18
+ PersistenceTypes,
19
+ } from '../types';
15
20
  import './css/input.css';
16
21
 
17
22
  const isNumeric = (val: unknown): val is number => fastIsNumeric(val);
@@ -20,238 +25,6 @@ const convert = (val: unknown) => (isNumeric(val) ? +val : NaN);
20
25
  const isEquivalent = (v1: number, v2: number) =>
21
26
  v1 === v2 || (isNaN(v1) && isNaN(v2));
22
27
 
23
- export enum HTMLInputTypes {
24
- // Only allowing the input types with wide browser compatibility
25
- 'text' = 'text',
26
- 'number' = 'number',
27
- 'password' = 'password',
28
- 'email' = 'email',
29
- 'range' = 'range',
30
- 'search' = 'search',
31
- 'tel' = 'tel',
32
- 'url' = 'url',
33
- 'hidden' = 'hidden',
34
- }
35
-
36
- type InputProps = {
37
- /**
38
- * The value of the input
39
- */
40
- value?: string | number;
41
- /**
42
- * If true, changes to input will be sent back to the Dash server only on enter or when losing focus.
43
- * If it's false, it will send the value back on every change.
44
- * If a number, it will not send anything back to the Dash server until the user has stopped
45
- * typing for that number of seconds.
46
- */
47
- debounce?: boolean | number;
48
- /**
49
- * A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. Note: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.
50
- */
51
- placeholder?: string | number;
52
- /**
53
- * Number of times the `Enter` key was pressed while the input had focus.
54
- */
55
- n_submit?: number;
56
- /**
57
- * Last time that `Enter` was pressed.
58
- */
59
- n_submit_timestamp?: number;
60
- /**
61
- * Provides a hint to the browser as to the type of data that might be
62
- * entered by the user while editing the element or its contents.
63
- */
64
- inputMode?: /**
65
- * Alphanumeric, non-prose content such as usernames and passwords.
66
- */
67
- | 'verbatim'
68
- /**
69
- * Latin-script input in the user's preferred language with typing aids such as text prediction enabled. For human-to-computer communication such as search boxes.
70
- */
71
- | 'latin'
72
- /**
73
- * As latin, but for human names.
74
- */
75
- | 'latin-name'
76
- /**
77
- * As latin, but with more aggressive typing aids. For human-to-human communication such as instant messaging or email.
78
- */
79
- | 'latin-prose'
80
- /**
81
- * As latin-prose, but for the user's secondary languages.
82
- */
83
- | 'full-width-latin'
84
- /**
85
- * Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
86
- */
87
- | 'kana'
88
- /**
89
- * Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
90
- */
91
- | 'katakana'
92
- /**
93
- * Numeric input, including keys for the digits 0 to 9, the user's preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes (e.g. credit card numbers). For actual numbers, prefer using type="number"
94
- */
95
- | 'numeric'
96
- /**
97
- * Telephone input, including asterisk and pound key. Use type="tel" if possible instead.
98
- */
99
- | 'tel'
100
- /**
101
- * Email input. Use type="email" if possible instead.
102
- */
103
- | 'email'
104
- /**
105
- * URL input. Use type="url" if possible instead.
106
- */
107
- | 'url';
108
- /**
109
- * This attribute indicates whether the value of the control can be automatically completed by the browser.
110
- */
111
- autoComplete?: string;
112
- /**
113
- * This attribute indicates that the user cannot modify the value of the control. The value of the attribute is irrelevant. If you need read-write access to the input value, do not add the "readonly" attribute. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type (such as button or submit).
114
- * readOnly is an HTML boolean attribute - it is enabled by a boolean or
115
- * 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
116
- * are also acccepted.
117
- */
118
- readOnly?: boolean | 'readOnly' | 'readonly' | 'READONLY';
119
- /**
120
- * This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
121
- * required is an HTML boolean attribute - it is enabled by a boolean or
122
- * 'required'. Alternative capitalizations `REQUIRED`
123
- * are also acccepted.
124
- */
125
- required?: boolean | 'required' | 'REQUIRED';
126
- /**
127
- * The element should be automatically focused after the page loaded.
128
- * autoFocus is an HTML boolean attribute - it is enabled by a boolean or
129
- * 'autoFocus'. Alternative capitalizations `autofocus` & `AUTOFOCUS`
130
- * are also acccepted.
131
- */
132
- autoFocus?: boolean | 'autoFocus' | 'autofocus' | 'AUTOFOCUS';
133
- /**
134
- * If true, the input is disabled and can't be clicked on.
135
- * disabled is an HTML boolean attribute - it is enabled by a boolean or
136
- * 'disabled'. Alternative capitalizations `DISABLED`
137
- */
138
- disabled?: boolean | 'disabled' | 'DISABLED';
139
- /**
140
- * Identifies a list of pre-defined options to suggest to the user.
141
- * The value must be the id of a <datalist> element in the same document.
142
- * The browser displays only options that are valid values for this
143
- * input element.
144
- * This attribute is ignored when the type attribute's value is
145
- * hidden, checkbox, radio, file, or a button type.
146
- */
147
- list?: string;
148
- /**
149
- * This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file, otherwise it is ignored.
150
- */
151
- multiple?: boolean;
152
- /**
153
- * Setting the value of this attribute to true indicates that the element needs to have its spelling and grammar checked. The value default indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. The value false indicates that the element should not be checked.
154
- */
155
- spellCheck?: boolean | 'true' | 'false';
156
- /**
157
- * The name of the control, which is submitted with the form data.
158
- */
159
- name?: string;
160
- /**
161
- * The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
162
- */
163
- min?: string | number;
164
- /**
165
- * The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
166
- */
167
- max?: string | number;
168
- /**
169
- * Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
170
- */
171
- step?: string | number;
172
- /**
173
- * If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter. For other control types, it is ignored.
174
- */
175
- minLength?: string | number;
176
- /**
177
- * If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters (in UTF-16 code units) that the user can enter. For other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior (i.e. the user can enter an unlimited number of characters). The constraint is evaluated only when the value of the attribute has been changed.
178
- */
179
- maxLength?: string | number;
180
- /**
181
- * A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url, email, or password, otherwise it is ignored. The regular expression language is the same as JavaScript RegExp algorithm, with the 'u' parameter that makes it treat the pattern as a sequence of unicode code points. The pattern is not surrounded by forward slashes.
182
- */
183
- pattern?: string;
184
- /**
185
- * The offset into the element's text content of the first selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
186
- */
187
- selectionStart?: string;
188
- /**
189
- * The offset into the element's text content of the last selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
190
- */
191
- selectionEnd?: string;
192
- /**
193
- * The direction in which selection occurred. This is "forward" if the selection was made from left-to-right in an LTR locale or right-to-left in an RTL locale, or "backward" if the selection was made in the opposite direction. On platforms on which it's possible this value isn't known, the value can be "none"; for example, on macOS, the default direction is "none", then as the user begins to modify the selection using the keyboard, this will change to reflect the direction in which the selection is expanding.
194
- */
195
- selectionDirection?: string;
196
- /**
197
- * Number of times the input lost focus.
198
- */
199
- n_blur?: number;
200
- /**
201
- * Last time the input lost focus.
202
- */
203
- n_blur_timestamp?: number;
204
- /**
205
- * The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case it is an integer number of characters. Starting in, this attribute applies only when the type attribute is set to text, search, tel, url, email, or password, otherwise it is ignored. In addition, the size must be greater than zero. If you do not specify a size, a default value of 20 is used.' simply states "the user agent should ensure that at least that many characters are visible", but different characters can have different widths in certain fonts. In some browsers, a certain string with x characters will not be entirely visible even if size is defined to at least x.
206
- */
207
- size?: string;
208
- /**
209
- * The input's inline styles
210
- */
211
- style?: React.CSSProperties;
212
- /**
213
- * The class of the input element
214
- */
215
- className?: string;
216
- /**
217
- * The ID of this component, used to identify dash components
218
- * in callbacks. The ID needs to be unique across all of the
219
- * components in an app.
220
- */
221
- id?: string;
222
- /**
223
- * Dash-assigned callback that gets fired when the value changes.
224
- */
225
- setProps: (props: Partial<InputProps>) => void;
226
- /**
227
- * Used to allow user interactions in this component to be persisted when
228
- * the component - or the page - is refreshed. If `persisted` is truthy and
229
- * hasn't changed from its previous value, a `value` that the user has
230
- * changed while using the app will keep that change, as long as
231
- * the new `value` also matches what was given originally.
232
- * Used in conjunction with `persistence_type`.
233
- */
234
- persistence?: boolean | string | number;
235
- /**
236
- * Properties whose user interactions will persist after refreshing the
237
- * component or the page. Since only `value` is allowed this prop can
238
- * normally be ignored.
239
- */
240
- persisted_props?: PersistedProps[];
241
- /**
242
- * Where persisted user changes will be stored:
243
- * memory: only kept in memory, reset on page refresh.
244
- * local: window.localStorage, data is kept after the browser quit.
245
- * session: window.sessionStorage, data is cleared once the browser quit.
246
- */
247
- persistence_type?: PersistenceTypes;
248
-
249
- /**
250
- * The type of control to render.
251
- */
252
- type?: HTMLInputTypes;
253
- };
254
-
255
28
  const inputProps = [
256
29
  'type',
257
30
  'placeholder',
@@ -289,12 +62,17 @@ function Input({
289
62
  type = HTMLInputTypes.text,
290
63
  inputMode = 'verbatim',
291
64
  n_blur = 0,
65
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
292
66
  n_blur_timestamp = -1,
293
67
  n_submit = 0,
68
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
294
69
  n_submit_timestamp = -1,
295
70
  debounce = false,
296
71
  step = 'any',
72
+ autoComplete = 'off',
73
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
297
74
  persisted_props = [PersistedProps.value],
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
298
76
  persistence_type = PersistenceTypes.local,
299
77
  disabled,
300
78
  ...props
@@ -470,6 +248,7 @@ function Input({
470
248
  type,
471
249
  inputMode,
472
250
  step,
251
+ autoComplete,
473
252
  disabled: disabledAsBool,
474
253
  }) as Pick<InputHTMLAttributes<HTMLInputElement>, HTMLInputProps>;
475
254
 
@@ -54,7 +54,9 @@ export default function RadioItems({
54
54
  options={sanitizedOptions}
55
55
  selected={isNil(value) ? [] : [value]}
56
56
  onSelectionChange={selection => {
57
- setProps({value: selection[selection.length - 1]});
57
+ if (selection.length) {
58
+ setProps({value: selection[selection.length - 1]});
59
+ }
58
60
  }}
59
61
  {...stylingProps}
60
62
  />
@@ -0,0 +1,55 @@
1
+ .dash-button {
2
+ line-height: 32px;
3
+ background: color-mix(
4
+ in srgb,
5
+ var(--Dash-Fill-Interactive-Strong) 5%,
6
+ transparent
7
+ );
8
+ color: var(--Dash-Fill-Interactive-Strong);
9
+ padding: 0 calc(var(--Dash-Spacing) * 2);
10
+ border-radius: 4px;
11
+ border: 1px solid var(--Dash-Fill-Interactive-Strong);
12
+ box-sizing: border-box;
13
+ vertical-align: middle;
14
+ }
15
+
16
+ /* Hover state - stronger background */
17
+ .dash-button:hover {
18
+ cursor: pointer;
19
+ background: var(--Dash-Fill-Inverse-Strong);
20
+ color: var(--Dash-Fill-Interactive-Strong);
21
+ }
22
+
23
+ /* Active state (clicking) - inverted colors */
24
+ .dash-button:active {
25
+ background: var(--Dash-Fill-Interactive-Strong);
26
+ color: var(--Dash-Fill-Inverse-Strong);
27
+ }
28
+
29
+ /* Keyboard focus - inverted colors */
30
+ .dash-button:focus-visible {
31
+ outline: none;
32
+ background: var(--Dash-Fill-Interactive-Strong);
33
+ color: var(--Dash-Fill-Inverse-Strong);
34
+ }
35
+
36
+ /* Hover after keyboard focus - keep inverted but acknowledge hover */
37
+ .dash-button:focus-visible:hover {
38
+ background: var(--Dash-Fill-Interactive-Strong);
39
+ color: var(--Dash-Fill-Inverse-Strong);
40
+ }
41
+
42
+ /* Active state after keyboard focus - inverted colors */
43
+ .dash-button:focus-visible:active {
44
+ background: var(--Dash-Fill-Interactive-Strong);
45
+ color: var(--Dash-Fill-Inverse-Strong);
46
+ }
47
+
48
+ /* Disabled state */
49
+ .dash-button:disabled {
50
+ opacity: 0.6;
51
+ cursor: not-allowed;
52
+ background: var(--Dash-Fill-Disabled);
53
+ color: var(--Dash-Text-Strong);
54
+ border-color: var(--Dash-Stroke-Weak);
55
+ }
@@ -8,7 +8,7 @@
8
8
  outline: none;
9
9
  width: 100%;
10
10
  font-size: inherit;
11
- overflow: hidden;
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 calc(var(--Dash-Spacing) * 2);
23
+ padding: 0 12px;
24
24
  }
25
25
 
26
- .dash-datepicker-input-wrapper:has(:nth-child(3)) {
27
- grid-template-columns: auto 1fr auto;
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(4)) {
31
- grid-template-columns: auto 1fr auto auto;
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(5)) {
35
- grid-template-columns: auto auto auto 1fr 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(6)) {
39
- grid-template-columns: auto auto auto 1fr 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,7 @@
55
55
  border-radius: 4px;
56
56
  padding: 0;
57
57
  background-color: inherit;
58
+ color: inherit;
58
59
  }
59
60
 
60
61
  .dash-datepicker-input::selection,
@@ -231,3 +232,8 @@
231
232
  width: 20px;
232
233
  height: 20px;
233
234
  }
235
+
236
+ /* Override Radix's position: fixed to use position: absolute when using custom container */
237
+ div[data-radix-popper-content-wrapper]:has(.dash-datepicker-content) {
238
+ position: absolute !important;
239
+ }
@@ -19,14 +19,14 @@
19
19
  grid-template-columns: auto 1fr;
20
20
  justify-items: start;
21
21
  align-items: center;
22
- gap: 8px;
22
+ gap: calc(var(--Dash-Spacing) * 2);
23
23
  }
24
24
 
25
- .dash-dropdown-grid-container:has(:nth-child(3)) {
25
+ .dash-dropdown-grid-container:has(> :nth-child(3)) {
26
26
  grid-template-columns: auto 1fr auto;
27
27
  }
28
28
 
29
- .dash-dropdown-grid-container:has(:nth-child(4)) {
29
+ .dash-dropdown-grid-container:has(> :nth-child(4)) {
30
30
  grid-template-columns: auto 1fr auto auto;
31
31
  }
32
32
 
@@ -212,3 +212,13 @@
212
212
  padding: calc(var(--Dash-Spacing) * 2) calc(var(--Dash-Spacing) * 3);
213
213
  box-shadow: 0 -1px 0 0 var(--Dash-Fill-Disabled) inset;
214
214
  }
215
+
216
+ /* Positioning container for the dropdown */
217
+ .dash-dropdown-wrapper {
218
+ position: relative;
219
+ }
220
+
221
+ /* Override Radix's position: fixed to use position: absolute when using custom container */
222
+ div[data-radix-popper-content-wrapper]:has(.dash-dropdown-content) {
223
+ position: absolute !important;
224
+ }
@@ -3,7 +3,7 @@
3
3
  position: relative;
4
4
  display: inline-flex;
5
5
  align-items: center;
6
- width: 170px; /* default input width */
6
+ width: 100%;
7
7
  height: 34px;
8
8
  background: var(--Dash-Fill-Inverse-Strong);
9
9
  border-radius: var(--Dash-Spacing);
@@ -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,7 +209,8 @@
208
209
  }
209
210
 
210
211
  .dash-range-slider-input {
211
- width: 64px;
212
+ min-width: 5cqw; /* 5% of container width */
213
+ max-width: 15cqw; /* 15% of container width */
212
214
  text-align: center;
213
215
  -webkit-appearance: textfield;
214
216
  -moz-appearance: textfield;
@@ -231,3 +233,19 @@
231
233
  -webkit-appearance: none;
232
234
  margin: 0;
233
235
  }
236
+
237
+ /* Hide inputs on small containers using container queries */
238
+ /* single slider input */
239
+ @container (max-width: 200px) {
240
+ .dash-slider-container .dash-range-slider-input:only-of-type {
241
+ display: none;
242
+ }
243
+ }
244
+
245
+ /* range slider inputs */
246
+ @container (max-width: 300px) {
247
+ .dash-slider-container .dash-range-slider-min-input,
248
+ .dash-slider-container .dash-range-slider-max-input {
249
+ display: none;
250
+ }
251
+ }
@@ -32,12 +32,12 @@
32
32
  /* Tab selected state */
33
33
  .tab--selected {
34
34
  border-top: 2px solid var(--tabs-primary);
35
- color: black;
36
- background-color: white;
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: white;
40
+ background-color: var(--Dash-Fill-Inverse-Strong);
41
41
  }
42
42
 
43
43
  /* Tab disabled state */
@@ -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)});
@@ -333,7 +338,6 @@ const DatePickerRange = ({
333
338
  }
334
339
  }}
335
340
  >
336
- <CalendarIcon className="dash-datepicker-trigger-icon" />
337
341
  <AutosizeInput
338
342
  inputRef={node => {
339
343
  startInputRef.current = node;