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.
@@ -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 {CalendarIcon, CaretDownIcon, Cross1Icon} from '@radix-ui/react-icons';
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
 
@@ -170,7 +170,6 @@ const DatePickerSingle = ({
170
170
  }
171
171
  }}
172
172
  >
173
- <CalendarIcon className="dash-datepicker-trigger-icon" />
174
173
  <AutosizeInput
175
174
  inputRef={node => {
176
175
  inputRef.current = node;
@@ -47,6 +47,7 @@ const Dropdown = (props: DropdownProps) => {
47
47
  const dropdownContentRef = useRef<HTMLDivElement>(
48
48
  document.createElement('div')
49
49
  );
50
+ const searchInputRef = useRef<HTMLInputElement>(null);
50
51
 
51
52
  const ctx = window.dash_component_api.useDashContext();
52
53
  const loading = ctx.useLoading();
@@ -234,25 +235,36 @@ const Dropdown = (props: DropdownProps) => {
234
235
  }
235
236
  }, [filteredOptions, isOpen]);
236
237
 
237
- // Focus (and scroll) the first selected item when dropdown opens
238
+ // Focus first selected item or search input when dropdown opens
238
239
  useEffect(() => {
239
- if (!isOpen || multi || search_value) {
240
+ if (!isOpen || search_value) {
240
241
  return;
241
242
  }
242
243
 
243
244
  // waiting for the DOM to be ready after the dropdown renders
244
245
  requestAnimationFrame(() => {
245
- const selectedValue = sanitizedValues[0];
246
-
247
- const selectedElement = dropdownContentRef.current.querySelector(
248
- `.dash-options-list-option-checkbox[value="${selectedValue}"]`
249
- );
246
+ // Try to focus the first selected item (for single-select)
247
+ if (!multi) {
248
+ const selectedValue = sanitizedValues[0];
249
+ if (selectedValue) {
250
+ const selectedElement =
251
+ dropdownContentRef.current.querySelector(
252
+ `.dash-options-list-option-checkbox[value="${selectedValue}"]`
253
+ );
254
+
255
+ if (selectedElement instanceof HTMLElement) {
256
+ selectedElement.focus();
257
+ return;
258
+ }
259
+ }
260
+ }
250
261
 
251
- if (selectedElement instanceof HTMLElement) {
252
- selectedElement?.focus();
262
+ // Fallback: focus search input if available and no selected item was focused
263
+ if (searchable && searchInputRef.current) {
264
+ searchInputRef.current.focus();
253
265
  }
254
266
  });
255
- }, [isOpen, multi, displayOptions, sanitizedValues]);
267
+ }, [isOpen, multi, displayOptions]);
256
268
 
257
269
  // Handle keyboard navigation in popover
258
270
  const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
@@ -277,7 +289,7 @@ const Dropdown = (props: DropdownProps) => {
277
289
  }
278
290
 
279
291
  const focusableElements = e.currentTarget.querySelectorAll(
280
- 'input[type="search"], input[type="checkbox"]:not([disabled])'
292
+ 'input[type="search"], input:not([disabled])'
281
293
  ) as NodeListOf<HTMLElement>;
282
294
 
283
295
  // Don't interfere with the event if there aren't any options that the user can interact with
@@ -335,7 +347,7 @@ const Dropdown = (props: DropdownProps) => {
335
347
  } else {
336
348
  focusableElements[nextIndex].scrollIntoView({
337
349
  behavior: 'auto',
338
- block: 'center',
350
+ block: 'nearest',
339
351
  });
340
352
  }
341
353
  }
@@ -354,8 +366,9 @@ const Dropdown = (props: DropdownProps) => {
354
366
  );
355
367
 
356
368
  const accessibleId = id ?? uuid();
369
+ const positioningContainerRef = useRef<HTMLDivElement>(null);
357
370
 
358
- return (
371
+ const popover = (
359
372
  <Popover.Root open={isOpen} onOpenChange={handleOpenChange}>
360
373
  <Popover.Trigger asChild>
361
374
  <button
@@ -365,6 +378,7 @@ const Dropdown = (props: DropdownProps) => {
365
378
  type="button"
366
379
  onKeyDown={e => {
367
380
  if (e.key === 'ArrowDown') {
381
+ e.preventDefault();
368
382
  setIsOpen(true);
369
383
  }
370
384
  }}
@@ -426,7 +440,7 @@ const Dropdown = (props: DropdownProps) => {
426
440
  // container is required otherwise popover will be rendered
427
441
  // at document root, which may be outside of the Dash app (i.e.
428
442
  // an embedded app)
429
- container={dropdownContainerRef.current?.parentElement}
443
+ container={positioningContainerRef.current}
430
444
  >
431
445
  <Popover.Content
432
446
  ref={dropdownContentRef}
@@ -451,7 +465,7 @@ const Dropdown = (props: DropdownProps) => {
451
465
  value={search_value || ''}
452
466
  autoComplete="off"
453
467
  onChange={e => onInputChange(e.target.value)}
454
- autoFocus
468
+ ref={searchInputRef}
455
469
  />
456
470
  {search_value && (
457
471
  <button
@@ -491,6 +505,7 @@ const Dropdown = (props: DropdownProps) => {
491
505
  options={displayOptions}
492
506
  selected={sanitizedValues}
493
507
  onSelectionChange={updateSelection}
508
+ inputType={multi ? 'checkbox' : 'radio'}
494
509
  className="dash-dropdown-options"
495
510
  optionClassName="dash-dropdown-option"
496
511
  optionStyle={{
@@ -512,6 +527,12 @@ const Dropdown = (props: DropdownProps) => {
512
527
  </Popover.Portal>
513
528
  </Popover.Root>
514
529
  );
530
+
531
+ return (
532
+ <div ref={positioningContainerRef} className="dash-dropdown-wrapper">
533
+ {popover}
534
+ </div>
535
+ );
515
536
  };
516
537
 
517
538
  export default Dropdown;
@@ -45,9 +45,8 @@ export default function RangeSlider(props: RangeSliderProps) {
45
45
  // For range slider, we expect an array of values
46
46
  const [value, setValue] = useState<number[]>(propValue || []);
47
47
 
48
- // Track slider dimension (width for horizontal, height for vertical) for conditional input rendering
48
+ // Track slider dimension (width for horizontal, height for vertical) for marks rendering
49
49
  const [sliderWidth, setSliderWidth] = useState<number | null>(null);
50
- const [showInputs, setShowInputs] = useState<boolean>(value.length === 2);
51
50
 
52
51
  const sliderRef = useRef<HTMLDivElement>(null);
53
52
  const inputRef = useRef<HTMLInputElement>(null);
@@ -64,25 +63,12 @@ export default function RangeSlider(props: RangeSliderProps) {
64
63
  }
65
64
  }, []);
66
65
 
67
- // Dynamic dimension detection using ResizeObserver (width for horizontal, height for vertical)
66
+ // Dynamic dimension detection using ResizeObserver for marks rendering
68
67
  useEffect(() => {
69
68
  if (!sliderRef.current) {
70
69
  return;
71
70
  }
72
71
 
73
- if (step === null) {
74
- // If the user has explicitly disabled stepping (step=None), then
75
- // the slider values are constrained to the given marks and user
76
- // cannot enter arbitrary values via the input element
77
- setShowInputs(false);
78
- return;
79
- }
80
-
81
- if (!value || value.length > 2) {
82
- setShowInputs(false);
83
- return;
84
- }
85
-
86
72
  const measureWidth = () => {
87
73
  if (sliderRef.current) {
88
74
  const rect = sliderRef.current.getBoundingClientRect();
@@ -90,16 +76,6 @@ export default function RangeSlider(props: RangeSliderProps) {
90
76
  const dimension = vertical ? rect.height : rect.width;
91
77
  if (dimension > 0) {
92
78
  setSliderWidth(dimension);
93
-
94
- // eslint-disable-next-line no-magic-numbers
95
- const HIDE_AT_WIDTH = value.length === 1 ? 200 : 250;
96
- // eslint-disable-next-line no-magic-numbers
97
- const SHOW_AT_WIDTH = value.length === 1 ? 300 : 450;
98
- if (showInputs && dimension < HIDE_AT_WIDTH) {
99
- setShowInputs(false);
100
- } else if (!showInputs && dimension >= SHOW_AT_WIDTH) {
101
- setShowInputs(true);
102
- }
103
79
  }
104
80
  }
105
81
  };
@@ -119,7 +95,7 @@ export default function RangeSlider(props: RangeSliderProps) {
119
95
  return () => {
120
96
  resizeObserver.disconnect();
121
97
  };
122
- }, [showInputs, vertical, step, value]);
98
+ }, [vertical]);
123
99
 
124
100
  // Handle prop value changes - equivalent to componentWillReceiveProps
125
101
  useEffect(() => {
@@ -168,49 +144,23 @@ export default function RangeSlider(props: RangeSliderProps) {
168
144
  });
169
145
  }, [min, max, processedMarks, step, sliderWidth]);
170
146
 
171
- // Calculate dynamic input width based on digits needed and container size
147
+ // Calculate dynamic input width based on min/max values
172
148
  const inputWidth = useMemo(() => {
173
- if (!sliderWidth) {
174
- return '64px'; // fallback to current width
175
- }
176
-
177
- // Count digits needed for min and max values
178
- const maxDigits = Math.max(
179
- String(Math.floor(Math.abs(minMaxValues.max_mark))).length,
180
- String(Math.floor(Math.abs(minMaxValues.min_mark))).length
149
+ const maxIntegerChars = Math.max(
150
+ String(Math.floor(minMaxValues.max_mark)).length,
151
+ String(Math.floor(minMaxValues.min_mark)).length
181
152
  );
182
153
 
183
- // Add 1 for minus sign if min is negative
184
- const totalChars = maxDigits + (minMaxValues.min_mark < 0 ? 1 : 0);
185
-
186
- // Calculate width as percentage of container (5% min, 15% max)
187
- /* eslint-disable no-magic-numbers */
188
- const minWidth = sliderWidth * 0.05;
189
- const maxWidth = sliderWidth * 0.15;
190
- const charBasedWidth = totalChars * 12; // approx 12px per character
191
- /* eslint-enable no-magic-numbers */
192
-
193
- const calculatedWidth = Math.max(
194
- minWidth,
195
- Math.min(maxWidth, charBasedWidth)
154
+ const maxDecimalChars = Math.min(
155
+ (String(stepValue).split('.')[1]?.length ?? -1) + 1,
156
+ 3
196
157
  );
197
158
 
198
- // Add padding if box-sizing is border-box
199
- let inputPadding = 0;
200
- if (inputRef.current) {
201
- const computedStyle = window.getComputedStyle(inputRef.current);
202
- if (computedStyle.boxSizing === 'border-box') {
203
- const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
204
- const paddingRight =
205
- parseFloat(computedStyle.paddingRight) || 0;
206
- inputPadding = paddingLeft + paddingRight;
207
- }
208
- }
209
-
210
- const totalWidth = calculatedWidth + inputPadding;
159
+ const totalChars = maxIntegerChars + maxDecimalChars;
160
+ const charWidth = 12;
211
161
 
212
- return `${totalWidth}px`;
213
- }, [sliderWidth, minMaxValues.min_mark, minMaxValues.max_mark]);
162
+ return `${totalChars * charWidth}px`;
163
+ }, [minMaxValues.min_mark, minMaxValues.max_mark, stepValue]);
214
164
 
215
165
  const valueIsValid = (val: number): boolean => {
216
166
  // Check if value is within min/max bounds
@@ -312,11 +262,17 @@ export default function RangeSlider(props: RangeSliderProps) {
312
262
 
313
263
  const classNames = ['dash-slider-container', className].filter(Boolean);
314
264
 
265
+ // Determine if inputs should be rendered at all (CSS will handle responsive visibility)
266
+ const shouldShowInputs =
267
+ step !== null && // Not disabled by step=None
268
+ value.length <= 2 && // Only for single or range sliders
269
+ !vertical; // Only for horizontal sliders
270
+
315
271
  return (
316
272
  <LoadingElement>
317
273
  {loadingProps => (
318
274
  <div id={id} className={classNames.join(' ')} {...loadingProps}>
319
- {showInputs && value.length === 2 && !vertical && (
275
+ {shouldShowInputs && value.length === 2 && (
320
276
  <input
321
277
  type="number"
322
278
  className="dash-input-container dash-range-slider-input dash-range-slider-min-input"
@@ -381,7 +337,7 @@ export default function RangeSlider(props: RangeSliderProps) {
381
337
  disabled={disabled}
382
338
  />
383
339
  )}
384
- {showInputs && !vertical && (
340
+ {shouldShowInputs && (
385
341
  <input
386
342
  ref={inputRef}
387
343
  type="number"
package/lib/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
+ import Button from './components/Button';
2
3
  import Checklist from './components/Checklist';
3
4
  import Clipboard from './components/Clipboard.react';
4
5
  import ConfirmDialog from './components/ConfirmDialog.react';
@@ -28,6 +29,7 @@ import Upload from './components/Upload.react';
28
29
  import './components/css/dcc.css';
29
30
 
30
31
  export {
32
+ Button,
31
33
  Checklist,
32
34
  Clipboard,
33
35
  ConfirmDialog,
package/lib/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, {ButtonHTMLAttributes, DetailedHTMLProps} from 'react';
2
2
  import {BaseDashProps, DashComponent} from '@dash-renderer/types';
3
3
 
4
4
  export enum PersistenceTypes {
@@ -52,6 +52,312 @@ export interface BaseDccProps<T>
52
52
  persistence_type?: PersistenceTypes;
53
53
  }
54
54
 
55
+ export type ButtonProps = BaseDccProps<ButtonProps> & {
56
+ /**
57
+ * The children of this component.
58
+ */
59
+ children?: React.ReactNode;
60
+ /**
61
+ * Defines the type of the element.
62
+ */
63
+ type?: 'submit' | 'reset' | 'button';
64
+ /**
65
+ * The element should be automatically focused after the page loaded.
66
+ */
67
+ autoFocus?: boolean;
68
+ /**
69
+ * Indicates whether the user can interact with the element.
70
+ */
71
+ disabled?: boolean;
72
+ /**
73
+ * Indicates the form that is the owner of the element.
74
+ */
75
+ form?: string;
76
+ /**
77
+ * Indicates the action of the element, overriding the action defined in the <form>.
78
+ */
79
+ formAction?: string;
80
+ /**
81
+ * If the button/input is a submit button (type="submit"), this attribute sets the encoding type to use during form submission. If this attribute is specified, it overrides the enctype attribute of the button's form owner.
82
+ */
83
+ formEncType?: string;
84
+ /**
85
+ * If the button/input is a submit button (type="submit"), this attribute sets the submission method to use during form submission (GET, POST, etc.). If this attribute is specified, it overrides the method attribute of the button's form owner.
86
+ */
87
+ formMethod?: string;
88
+ /**
89
+ * If the button/input is a submit button (type="submit"), this boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner.
90
+ */
91
+ formNoValidate?: boolean;
92
+ /**
93
+ * If the button/input is a submit button (type="submit"), this attribute specifies the browsing context (for example, tab, window, or inline frame) in which to display the response that is received after submitting the form. If this attribute is specified, it overrides the target attribute of the button's form owner.
94
+ */
95
+ formTarget?: string;
96
+ /**
97
+ * Name of the element. For example used by the server to identify the fields in form submits.
98
+ */
99
+ name?: string;
100
+ /**
101
+ * Defines a default value which will be displayed in the element on page load.
102
+ */
103
+ value?: string | string[] | number;
104
+ /**
105
+ * Keyboard shortcut to activate or add focus to the element.
106
+ */
107
+ accessKey?: string;
108
+ /**
109
+ * Indicates whether the element's content is editable.
110
+ */
111
+ contentEditable?: boolean | 'true' | 'false' | 'inherit';
112
+ /**
113
+ * Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left).
114
+ */
115
+ dir?: string;
116
+ /**
117
+ * Defines whether the element can be dragged.
118
+ */
119
+ draggable?: boolean;
120
+ /**
121
+ * Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
122
+ */
123
+ hidden?: boolean;
124
+ /**
125
+ * Defines the language used in the element.
126
+ */
127
+ lang?: string;
128
+ /**
129
+ * Defines the role of an element in the context of accessibility.
130
+ */
131
+ role?: string;
132
+ /**
133
+ * Indicates whether spell checking is allowed for the element.
134
+ */
135
+ spellCheck?: boolean;
136
+ /**
137
+ * Defines CSS styles which will override styles previously set.
138
+ */
139
+ style?: React.CSSProperties;
140
+ /**
141
+ * Overrides the browser's default tab order and follows the one specified instead.
142
+ */
143
+ tabIndex?: number;
144
+ /**
145
+ * Text to be displayed in a tooltip when hovering over the element.
146
+ */
147
+ title?: string;
148
+ /**
149
+ * Number of times the button lost focus.
150
+ */
151
+ n_blur?: number;
152
+ /**
153
+ * Last time the button lost focus.
154
+ */
155
+ n_blur_timestamp?: number;
156
+ /**
157
+ * Number of times the button has been clicked.
158
+ */
159
+ n_clicks?: number;
160
+ /**
161
+ * Last time the button was clicked.
162
+ */
163
+ n_clicks_timestamp?: number;
164
+ };
165
+
166
+ export enum HTMLInputTypes {
167
+ // Only allowing the input types with wide browser compatibility
168
+ 'text' = 'text',
169
+ 'number' = 'number',
170
+ 'password' = 'password',
171
+ 'email' = 'email',
172
+ 'range' = 'range',
173
+ 'search' = 'search',
174
+ 'tel' = 'tel',
175
+ 'url' = 'url',
176
+ 'hidden' = 'hidden',
177
+ }
178
+
179
+ export interface InputProps extends BaseDccProps<InputProps> {
180
+ /**
181
+ * The value of the input
182
+ */
183
+ value?: string | number;
184
+ /**
185
+ * The type of control to render.
186
+ */
187
+ type?: HTMLInputTypes;
188
+ /**
189
+ * If true, changes to input will be sent back to the Dash server only on enter or when losing focus.
190
+ * If it's false, it will send the value back on every change.
191
+ * If a number, it will not send anything back to the Dash server until the user has stopped
192
+ * typing for that number of seconds.
193
+ */
194
+ debounce?: boolean | number;
195
+ /**
196
+ * 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.
197
+ */
198
+ placeholder?: string | number;
199
+ /**
200
+ * Number of times the `Enter` key was pressed while the input had focus.
201
+ */
202
+ n_submit?: number;
203
+ /**
204
+ * Last time that `Enter` was pressed.
205
+ */
206
+ n_submit_timestamp?: number;
207
+ /**
208
+ * Provides a hint to the browser as to the type of data that might be
209
+ * entered by the user while editing the element or its contents.
210
+ */
211
+ inputMode?: /**
212
+ * Alphanumeric, non-prose content such as usernames and passwords.
213
+ */
214
+ | 'verbatim'
215
+ /**
216
+ * 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.
217
+ */
218
+ | 'latin'
219
+ /**
220
+ * As latin, but for human names.
221
+ */
222
+ | 'latin-name'
223
+ /**
224
+ * As latin, but with more aggressive typing aids. For human-to-human communication such as instant messaging or email.
225
+ */
226
+ | 'latin-prose'
227
+ /**
228
+ * As latin-prose, but for the user's secondary languages.
229
+ */
230
+ | 'full-width-latin'
231
+ /**
232
+ * Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
233
+ */
234
+ | 'kana'
235
+ /**
236
+ * Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
237
+ */
238
+ | 'katakana'
239
+ /**
240
+ * 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"
241
+ */
242
+ | 'numeric'
243
+ /**
244
+ * Telephone input, including asterisk and pound key. Use type="tel" if possible instead.
245
+ */
246
+ | 'tel'
247
+ /**
248
+ * Email input. Use type="email" if possible instead.
249
+ */
250
+ | 'email'
251
+ /**
252
+ * URL input. Use type="url" if possible instead.
253
+ */
254
+ | 'url';
255
+ /**
256
+ * This attribute indicates whether the value of the control can be automatically completed by the browser.
257
+ */
258
+ autoComplete?: string;
259
+ /**
260
+ * 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).
261
+ * readOnly is an HTML boolean attribute - it is enabled by a boolean or
262
+ * 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
263
+ * are also acccepted.
264
+ */
265
+ readOnly?: boolean | 'readOnly' | 'readonly' | 'READONLY';
266
+ /**
267
+ * 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.
268
+ * required is an HTML boolean attribute - it is enabled by a boolean or
269
+ * 'required'. Alternative capitalizations `REQUIRED`
270
+ * are also acccepted.
271
+ */
272
+ required?: boolean | 'required' | 'REQUIRED';
273
+ /**
274
+ * The element should be automatically focused after the page loaded.
275
+ * autoFocus is an HTML boolean attribute - it is enabled by a boolean or
276
+ * 'autoFocus'. Alternative capitalizations `autofocus` & `AUTOFOCUS`
277
+ * are also acccepted.
278
+ */
279
+ autoFocus?: boolean | 'autoFocus' | 'autofocus' | 'AUTOFOCUS';
280
+ /**
281
+ * If true, the input is disabled and can't be clicked on.
282
+ * disabled is an HTML boolean attribute - it is enabled by a boolean or
283
+ * 'disabled'. Alternative capitalizations `DISABLED`
284
+ */
285
+ disabled?: boolean | 'disabled' | 'DISABLED';
286
+ /**
287
+ * Identifies a list of pre-defined options to suggest to the user.
288
+ * The value must be the id of a <datalist> element in the same document.
289
+ * The browser displays only options that are valid values for this
290
+ * input element.
291
+ * This attribute is ignored when the type attribute's value is
292
+ * hidden, checkbox, radio, file, or a button type.
293
+ */
294
+ list?: string;
295
+ /**
296
+ * 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.
297
+ */
298
+ multiple?: boolean;
299
+ /**
300
+ * 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.
301
+ */
302
+ spellCheck?: boolean | 'true' | 'false';
303
+ /**
304
+ * The name of the control, which is submitted with the form data.
305
+ */
306
+ name?: string;
307
+ /**
308
+ * The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
309
+ */
310
+ min?: string | number;
311
+ /**
312
+ * The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
313
+ */
314
+ max?: string | number;
315
+ /**
316
+ * 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.
317
+ */
318
+ step?: string | number;
319
+ /**
320
+ * 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.
321
+ */
322
+ minLength?: string | number;
323
+ /**
324
+ * 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.
325
+ */
326
+ maxLength?: string | number;
327
+ /**
328
+ * 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.
329
+ */
330
+ pattern?: string;
331
+ /**
332
+ * 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).
333
+ */
334
+ selectionStart?: string;
335
+ /**
336
+ * 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).
337
+ */
338
+ selectionEnd?: string;
339
+ /**
340
+ * 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.
341
+ */
342
+ selectionDirection?: string;
343
+ /**
344
+ * Number of times the input lost focus.
345
+ */
346
+ n_blur?: number;
347
+ /**
348
+ * Last time the input lost focus.
349
+ */
350
+ n_blur_timestamp?: number;
351
+ /**
352
+ * 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.
353
+ */
354
+ size?: string;
355
+ /**
356
+ * The input's inline styles
357
+ */
358
+ style?: React.CSSProperties;
359
+ }
360
+
55
361
  export type SliderMarks = {
56
362
  [key: number]: string | {label: string; style?: React.CSSProperties};
57
363
  };
@@ -14,9 +14,9 @@ import {
14
14
  ArrowLeftIcon,
15
15
  ArrowRightIcon,
16
16
  } from '@radix-ui/react-icons';
17
- import Input, {HTMLInputTypes} from '../../components/Input';
17
+ import Input from '../../components/Input';
18
18
  import Dropdown from '../../components/Dropdown';
19
- import {DayOfWeek, CalendarDirection} from '../../types';
19
+ import {DayOfWeek, CalendarDirection, HTMLInputTypes} from '../../types';
20
20
  import {CalendarMonth} from './CalendarMonth';
21
21
  import {
22
22
  getMonthOptions,
@@ -105,7 +105,7 @@ export const Option: React.FC<OptionProps> = ({
105
105
  disabled={!!option.disabled}
106
106
  onChange={() => onChange(option)}
107
107
  onKeyUp={e => {
108
- if (e.key === 'Enter' && inputType === 'checkbox') {
108
+ if (e.key === 'Enter') {
109
109
  onChange(option);
110
110
  }
111
111
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-core-components",
3
- "version": "4.0.0-rc3",
3
+ "version": "4.0.0-rc4",
4
4
  "description": "Core component suite for Dash",
5
5
  "repository": {
6
6
  "type": "git",