@salt-ds/lab 1.0.0-alpha.70 → 1.0.0-alpha.71
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/CHANGELOG.md +53 -0
- package/css/salt-lab.css +192 -302
- package/dist-cjs/app-header/AppHeader.css.js +1 -1
- package/dist-cjs/calendar/CalendarWeekHeader.css.js +1 -1
- package/dist-cjs/calendar/internal/CalendarDay.css.js +1 -1
- package/dist-cjs/calendar/internal/CalendarMonth.css.js +1 -1
- package/dist-cjs/cascading-menu/CascadingMenuItem.css.js +1 -1
- package/dist-cjs/color-chooser/ColorChooser.css.js +1 -1
- package/dist-cjs/color-chooser/ColorPicker.css.js +1 -1
- package/dist-cjs/color-chooser/HexInput.css.js +1 -1
- package/dist-cjs/color-chooser/RGBAInput.css.js +1 -1
- package/dist-cjs/color-chooser/Swatch.css.js +1 -1
- package/dist-cjs/combo-box/useCombobox.js.map +1 -1
- package/dist-cjs/common-hooks/selectionTypes.js.map +1 -1
- package/dist-cjs/common-hooks/useCollapsibleGroups.js.map +1 -1
- package/dist-cjs/common-hooks/useKeyboardNavigation.js.map +1 -1
- package/dist-cjs/common-hooks/useKeyboardNavigationPanel.js.map +1 -1
- package/dist-cjs/date-input/DateInput.css.js +1 -1
- package/dist-cjs/date-picker/DatePickerOverlay.css.js +1 -1
- package/dist-cjs/date-picker/DatePickerPanel.css.js +1 -1
- package/dist-cjs/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-cjs/form-field-legacy/FormLabel.css.js +1 -1
- package/dist-cjs/index.js +0 -8
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/input-legacy/InputLegacy.css.js +1 -1
- package/dist-cjs/list/List.css.js +1 -1
- package/dist-cjs/list/ListItem.css.js +1 -1
- package/dist-cjs/list/useList.js.map +1 -1
- package/dist-cjs/list-deprecated/List.css.js +1 -1
- package/dist-cjs/list-deprecated/ListItem.css.js +1 -1
- package/dist-cjs/list-next/ListItemNext.css.js +1 -1
- package/dist-cjs/list-next/ListNext.css.js +1 -1
- package/dist-cjs/logo/LogoSeparator.css.js +1 -1
- package/dist-cjs/number-input/NumberInput.css.js +1 -1
- package/dist-cjs/number-input/NumberInput.js +146 -79
- package/dist-cjs/number-input/NumberInput.js.map +1 -1
- package/dist-cjs/number-input/internal/useCaret.js +34 -0
- package/dist-cjs/number-input/internal/useCaret.js.map +1 -0
- package/dist-cjs/number-input/internal/utils.js +56 -14
- package/dist-cjs/number-input/internal/utils.js.map +1 -1
- package/dist-cjs/number-input/useNumberInput.js +34 -26
- package/dist-cjs/number-input/useNumberInput.js.map +1 -1
- package/dist-cjs/portal/Portal.js.map +1 -1
- package/dist-cjs/query-input/QueryInput.css.js +1 -1
- package/dist-cjs/responsive/OverflowReducer.js.map +1 -1
- package/dist-cjs/system-status/SystemStatus.css.js +1 -1
- package/dist-cjs/tabs/Tabstrip.css.js +1 -1
- package/dist-cjs/tabs/drag-drop/Draggable.css.js +1 -1
- package/dist-cjs/tabs-next/TabBar.css.js +1 -1
- package/dist-cjs/tabs-next/TabNext.css.js +1 -1
- package/dist-cjs/tabs-next/TabOverflowList.css.js +1 -1
- package/dist-cjs/tokenized-input/TokenizedInput.css.js +1 -1
- package/dist-cjs/tokenized-input-next/TokenizedInputNext.css.js +1 -1
- package/dist-cjs/toolbar/overflow-panel/OverflowPanel.css.js +1 -1
- package/dist-cjs/toolbar/overflow-panel/OverflowSeparator.css.js +1 -1
- package/dist-cjs/tree/useTree.js.map +1 -1
- package/dist-es/app-header/AppHeader.css.js +1 -1
- package/dist-es/calendar/CalendarWeekHeader.css.js +1 -1
- package/dist-es/calendar/internal/CalendarDay.css.js +1 -1
- package/dist-es/calendar/internal/CalendarMonth.css.js +1 -1
- package/dist-es/cascading-menu/CascadingMenuItem.css.js +1 -1
- package/dist-es/color-chooser/ColorChooser.css.js +1 -1
- package/dist-es/color-chooser/ColorPicker.css.js +1 -1
- package/dist-es/color-chooser/HexInput.css.js +1 -1
- package/dist-es/color-chooser/RGBAInput.css.js +1 -1
- package/dist-es/color-chooser/Swatch.css.js +1 -1
- package/dist-es/combo-box/useCombobox.js.map +1 -1
- package/dist-es/common-hooks/selectionTypes.js.map +1 -1
- package/dist-es/common-hooks/useCollapsibleGroups.js.map +1 -1
- package/dist-es/common-hooks/useKeyboardNavigation.js.map +1 -1
- package/dist-es/common-hooks/useKeyboardNavigationPanel.js.map +1 -1
- package/dist-es/date-input/DateInput.css.js +1 -1
- package/dist-es/date-picker/DatePickerOverlay.css.js +1 -1
- package/dist-es/date-picker/DatePickerPanel.css.js +1 -1
- package/dist-es/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-es/form-field-legacy/FormLabel.css.js +1 -1
- package/dist-es/index.js +0 -4
- package/dist-es/index.js.map +1 -1
- package/dist-es/input-legacy/InputLegacy.css.js +1 -1
- package/dist-es/list/List.css.js +1 -1
- package/dist-es/list/ListItem.css.js +1 -1
- package/dist-es/list/useList.js.map +1 -1
- package/dist-es/list-deprecated/List.css.js +1 -1
- package/dist-es/list-deprecated/ListItem.css.js +1 -1
- package/dist-es/list-next/ListItemNext.css.js +1 -1
- package/dist-es/list-next/ListNext.css.js +1 -1
- package/dist-es/logo/LogoSeparator.css.js +1 -1
- package/dist-es/number-input/NumberInput.css.js +1 -1
- package/dist-es/number-input/NumberInput.js +149 -82
- package/dist-es/number-input/NumberInput.js.map +1 -1
- package/dist-es/number-input/internal/useCaret.js +32 -0
- package/dist-es/number-input/internal/useCaret.js.map +1 -0
- package/dist-es/number-input/internal/utils.js +52 -10
- package/dist-es/number-input/internal/utils.js.map +1 -1
- package/dist-es/number-input/useNumberInput.js +35 -27
- package/dist-es/number-input/useNumberInput.js.map +1 -1
- package/dist-es/portal/Portal.js.map +1 -1
- package/dist-es/query-input/QueryInput.css.js +1 -1
- package/dist-es/responsive/OverflowReducer.js.map +1 -1
- package/dist-es/system-status/SystemStatus.css.js +1 -1
- package/dist-es/tabs/Tabstrip.css.js +1 -1
- package/dist-es/tabs/drag-drop/Draggable.css.js +1 -1
- package/dist-es/tabs-next/TabBar.css.js +1 -1
- package/dist-es/tabs-next/TabNext.css.js +1 -1
- package/dist-es/tabs-next/TabOverflowList.css.js +1 -1
- package/dist-es/tokenized-input/TokenizedInput.css.js +1 -1
- package/dist-es/tokenized-input-next/TokenizedInputNext.css.js +1 -1
- package/dist-es/toolbar/overflow-panel/OverflowPanel.css.js +1 -1
- package/dist-es/toolbar/overflow-panel/OverflowSeparator.css.js +1 -1
- package/dist-es/tree/useTree.js.map +1 -1
- package/dist-types/app-header/AppHeader.d.ts +1 -1
- package/dist-types/button-bar/ButtonBar.d.ts +3 -3
- package/dist-types/calendar/Calendar.d.ts +1 -1
- package/dist-types/calendar/CalendarWeekHeader.d.ts +1 -1
- package/dist-types/calendar/useCalendar.d.ts +1 -1
- package/dist-types/calendar/useCalendarDay.d.ts +2 -1
- package/dist-types/calendar/useCalendarSelection.d.ts +5 -5
- package/dist-types/cascading-menu/internal/CascadingMenuAction.d.ts +2 -2
- package/dist-types/cascading-menu/internal/menuPositioning.d.ts +1 -1
- package/dist-types/cascading-menu/internal/stateUtils.d.ts +2 -2
- package/dist-types/cascading-menu/internal/useClickAway.d.ts +1 -1
- package/dist-types/cascading-menu/internal/useRefsManager.d.ts +1 -1
- package/dist-types/cascading-menu/internal/useStateReducer.d.ts +2 -2
- package/dist-types/cascading-menu/stateChangeTypes.d.ts +1 -1
- package/dist-types/color-chooser/Color.d.ts +1 -1
- package/dist-types/color-chooser/DictTabs.d.ts +1 -1
- package/dist-types/color-chooser/color-utils.d.ts +1 -1
- package/dist-types/combo-box/ComboBox.d.ts +3 -3
- package/dist-types/combo-box/useCombobox.d.ts +1 -1
- package/dist-types/combo-box-deprecated/ComboBoxDeprecated.d.ts +3 -3
- package/dist-types/combo-box-deprecated/filterHelpers.d.ts +1 -1
- package/dist-types/combo-box-deprecated/internal/DefaultComboBox.d.ts +1 -1
- package/dist-types/combo-box-deprecated/internal/MultiSelectComboBox.d.ts +1 -1
- package/dist-types/combo-box-deprecated/internal/useComboBox.d.ts +98 -97
- package/dist-types/combo-box-deprecated/internal/useMultiSelectComboBox.d.ts +214 -212
- package/dist-types/combo-box-deprecated/internal/usePopperStatus.d.ts +3 -3
- package/dist-types/common-hooks/collectionTypes.d.ts +3 -3
- package/dist-types/common-hooks/itemToString.d.ts +1 -1
- package/dist-types/common-hooks/navigationTypes.d.ts +4 -4
- package/dist-types/common-hooks/selectionTypes.d.ts +10 -10
- package/dist-types/common-hooks/useKeyboardNavigation.d.ts +1 -1
- package/dist-types/common-hooks/useSelection.d.ts +2 -2
- package/dist-types/common-hooks/utils/collection-item-utils.d.ts +2 -2
- package/dist-types/common-hooks/utils/filter-utils.d.ts +2 -2
- package/dist-types/contact-details/ContactAction.d.ts +1 -1
- package/dist-types/contact-details/ContactAvatar.d.ts +1 -1
- package/dist-types/contact-details/ContactDetails.d.ts +1 -1
- package/dist-types/date-input/DateInputRange.d.ts +2 -2
- package/dist-types/date-input/DateInputSingle.d.ts +1 -1
- package/dist-types/date-picker/DatePicker.d.ts +1 -1
- package/dist-types/date-picker/DatePickerActions.d.ts +1 -1
- package/dist-types/date-picker/DatePickerContext.d.ts +1 -1
- package/dist-types/date-picker/DatePickerOverlayProvider.d.ts +1 -1
- package/dist-types/date-picker/DatePickerRangeGridPanel.d.ts +1 -1
- package/dist-types/date-picker/DatePickerSingleGridPanel.d.ts +1 -1
- package/dist-types/date-picker/DatePickerSinglePanel.d.ts +1 -1
- package/dist-types/date-picker/useDatePicker.d.ts +1 -1
- package/dist-types/deck-layout/DeckLayout.d.ts +3 -3
- package/dist-types/dropdown/Dropdown.d.ts +3 -3
- package/dist-types/dropdown/DropdownBase.d.ts +1 -1
- package/dist-types/dropdown/dropdownTypes.d.ts +1 -1
- package/dist-types/dropdown/useClickAway.d.ts +1 -1
- package/dist-types/dropdown/useDropdown.d.ts +1 -1
- package/dist-types/focus-manager/internal/findAllTabbableElements.d.ts +1 -1
- package/dist-types/form-field-legacy/FormFieldLegacy.d.ts +5 -5
- package/dist-types/form-field-legacy/NecessityIndicator.d.ts +1 -1
- package/dist-types/form-field-legacy/StatusIndicator.d.ts +1 -1
- package/dist-types/formatted-input/FormattedInput.d.ts +1 -1
- package/dist-types/index.d.ts +0 -1
- package/dist-types/input-legacy/StaticInputAdornment.d.ts +1 -1
- package/dist-types/layer-layout/LayerLayout.d.ts +1 -1
- package/dist-types/list/List.d.ts +3 -3
- package/dist-types/list/ListItem.d.ts +1 -1
- package/dist-types/list/VirtualizedList.d.ts +3 -3
- package/dist-types/list/listTypes.d.ts +2 -2
- package/dist-types/list/useList.d.ts +1 -1
- package/dist-types/list/useVirtualization.d.ts +1 -1
- package/dist-types/list-deprecated/List.d.ts +2 -2
- package/dist-types/list-deprecated/ListBase.d.ts +2 -2
- package/dist-types/list-deprecated/ListItem.d.ts +1 -1
- package/dist-types/list-deprecated/ListItemContext.d.ts +1 -1
- package/dist-types/list-deprecated/ListProps.d.ts +5 -5
- package/dist-types/list-deprecated/itemToString.d.ts +1 -1
- package/dist-types/list-deprecated/useListItem.d.ts +2 -2
- package/dist-types/localization-provider/LocalizationProvider.d.ts +3 -3
- package/dist-types/logo/Logo.d.ts +1 -1
- package/dist-types/logo/LogoSeparator.d.ts +1 -1
- package/dist-types/number-input/NumberInput.d.ts +49 -27
- package/dist-types/number-input/internal/useCaret.d.ts +5 -0
- package/dist-types/number-input/internal/useInterval.d.ts +1 -1
- package/dist-types/number-input/internal/utils.d.ts +5 -5
- package/dist-types/number-input/useNumberInput.d.ts +11 -6
- package/dist-types/query-input/useQueryInput.d.ts +1 -1
- package/dist-types/responsive/OverflowReducer.d.ts +4 -4
- package/dist-types/responsive/overflowTypes.d.ts +20 -20
- package/dist-types/responsive/overflowUtils.d.ts +3 -3
- package/dist-types/responsive/useOverflowCollectionItems.d.ts +1 -1
- package/dist-types/responsive/useOverflowLayout.d.ts +1 -1
- package/dist-types/responsive/useResizeObserver.d.ts +2 -2
- package/dist-types/responsive/utils.d.ts +3 -3
- package/dist-types/tabs/Tab.d.ts +20 -19
- package/dist-types/tabs/Tabs.d.ts +1 -1
- package/dist-types/tabs/TabsTypes.d.ts +7 -7
- package/dist-types/tabs/drag-drop/Draggable.d.ts +2 -2
- package/dist-types/tabs/drag-drop/DropIndicator.d.ts +1 -1
- package/dist-types/tabs/drag-drop/drag-utils.d.ts +26 -22
- package/dist-types/tabs/drag-drop/dragDropTypes.d.ts +5 -5
- package/dist-types/tabs/drag-drop/useDragSpacers.d.ts +1 -1
- package/dist-types/tabs/useActivationIndicator.d.ts +1 -1
- package/dist-types/tabs/useEditableItem.d.ts +1 -1
- package/dist-types/tabs/useKeyboardNavigation.d.ts +1 -1
- package/dist-types/tabs/useSelection.d.ts +3 -3
- package/dist-types/tabs-next/hooks/useCollection.d.ts +1 -1
- package/dist-types/tokenized-input/TokenizedInput.d.ts +2 -2
- package/dist-types/tokenized-input/TokenizedInputBase.d.ts +5 -5
- package/dist-types/tokenized-input/internal/InputPill.d.ts +1 -1
- package/dist-types/tokenized-input/internal/isPlainObject.d.ts +1 -1
- package/dist-types/tokenized-input/useTokenizedInput.d.ts +1 -1
- package/dist-types/tokenized-input-next/TokenizedInputNext.d.ts +2 -2
- package/dist-types/tokenized-input-next/internal/InputPill.d.ts +1 -1
- package/dist-types/toolbar/ToolbarButton.d.ts +3 -3
- package/dist-types/toolbar/ToolbarProps.d.ts +1 -1
- package/dist-types/toolbar/TooltrayProps.d.ts +2 -2
- package/dist-types/toolbar/internal/ToolbarButtonRefsContext.d.ts +1 -1
- package/dist-types/toolbar/internal/renderTrayTools.d.ts +1 -1
- package/dist-types/tree/useTree.d.ts +1 -1
- package/dist-types/utils/forwardCallbackProps.d.ts +1 -1
- package/dist-types/utils/isEmail.d.ts +1 -1
- package/dist-types/utils/useClickOutside.d.ts +1 -1
- package/dist-types/utils/useSlideSelection.d.ts +1 -1
- package/dist-types/window/ElectronWindow.d.ts +1 -1
- package/dist-types/window/WindowContext.d.ts +4 -4
- package/package.json +2 -2
- package/dist-cjs/carousel/Carousel.css.js +0 -6
- package/dist-cjs/carousel/Carousel.css.js.map +0 -1
- package/dist-cjs/carousel/Carousel.js +0 -62
- package/dist-cjs/carousel/Carousel.js.map +0 -1
- package/dist-cjs/carousel/CarouselContext.js +0 -62
- package/dist-cjs/carousel/CarouselContext.js.map +0 -1
- package/dist-cjs/carousel/CarouselControls.css.js +0 -6
- package/dist-cjs/carousel/CarouselControls.css.js.map +0 -1
- package/dist-cjs/carousel/CarouselControls.js +0 -122
- package/dist-cjs/carousel/CarouselControls.js.map +0 -1
- package/dist-cjs/carousel/CarouselReducer.js +0 -77
- package/dist-cjs/carousel/CarouselReducer.js.map +0 -1
- package/dist-cjs/carousel/CarouselSlide.css.js +0 -6
- package/dist-cjs/carousel/CarouselSlide.css.js.map +0 -1
- package/dist-cjs/carousel/CarouselSlide.js +0 -110
- package/dist-cjs/carousel/CarouselSlide.js.map +0 -1
- package/dist-cjs/carousel/CarouselSlider.css.js +0 -6
- package/dist-cjs/carousel/CarouselSlider.css.js.map +0 -1
- package/dist-cjs/carousel/CarouselSlider.js +0 -93
- package/dist-cjs/carousel/CarouselSlider.js.map +0 -1
- package/dist-es/carousel/Carousel.css.js +0 -4
- package/dist-es/carousel/Carousel.css.js.map +0 -1
- package/dist-es/carousel/Carousel.js +0 -60
- package/dist-es/carousel/Carousel.js.map +0 -1
- package/dist-es/carousel/CarouselContext.js +0 -58
- package/dist-es/carousel/CarouselContext.js.map +0 -1
- package/dist-es/carousel/CarouselControls.css.js +0 -4
- package/dist-es/carousel/CarouselControls.css.js.map +0 -1
- package/dist-es/carousel/CarouselControls.js +0 -120
- package/dist-es/carousel/CarouselControls.js.map +0 -1
- package/dist-es/carousel/CarouselReducer.js +0 -75
- package/dist-es/carousel/CarouselReducer.js.map +0 -1
- package/dist-es/carousel/CarouselSlide.css.js +0 -4
- package/dist-es/carousel/CarouselSlide.css.js.map +0 -1
- package/dist-es/carousel/CarouselSlide.js +0 -108
- package/dist-es/carousel/CarouselSlide.js.map +0 -1
- package/dist-es/carousel/CarouselSlider.css.js +0 -4
- package/dist-es/carousel/CarouselSlider.css.js.map +0 -1
- package/dist-es/carousel/CarouselSlider.js +0 -91
- package/dist-es/carousel/CarouselSlider.js.map +0 -1
- package/dist-types/carousel/Carousel.d.ts +0 -23
- package/dist-types/carousel/CarouselContext.d.ts +0 -11
- package/dist-types/carousel/CarouselControls.d.ts +0 -26
- package/dist-types/carousel/CarouselReducer.d.ts +0 -30
- package/dist-types/carousel/CarouselSlide.d.ts +0 -32
- package/dist-types/carousel/CarouselSlider.d.ts +0 -13
- package/dist-types/carousel/index.d.ts +0 -4
|
@@ -2,33 +2,40 @@ import { type ValidationStatus } from "@salt-ds/core";
|
|
|
2
2
|
import { type ComponentPropsWithoutRef, type InputHTMLAttributes, type ReactNode, type Ref, type SyntheticEvent } from "react";
|
|
3
3
|
export interface NumberInputProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange"> {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Styling variant with full border.
|
|
6
|
+
* @default false
|
|
6
7
|
*/
|
|
7
8
|
bordered?: boolean;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* A boolean that, when true, ensures the input value is clamped within the specified min and max range upon losing focus.
|
|
11
|
+
* @default false
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
clamp?: boolean;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The default value. Use when the component is uncontrolled.
|
|
14
16
|
*/
|
|
15
17
|
defaultValue?: number | string;
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
19
|
+
* Disable the `NumberInput`.
|
|
20
|
+
* @default false
|
|
18
21
|
*/
|
|
19
22
|
disabled?: boolean;
|
|
20
23
|
/**
|
|
21
24
|
* The marker to use in an empty read only Input.
|
|
22
|
-
* Use `''` to disable this feature.
|
|
23
|
-
* @default
|
|
25
|
+
* Use `''` to disable this feature.
|
|
26
|
+
* @default "—"
|
|
24
27
|
*/
|
|
25
28
|
emptyReadOnlyMarker?: string;
|
|
26
29
|
/**
|
|
27
|
-
* End adornment component
|
|
30
|
+
* End adornment component.
|
|
28
31
|
*/
|
|
29
32
|
endAdornment?: ReactNode;
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
34
|
+
* A callback to format the value of the `NumberInput`.
|
|
35
|
+
*/
|
|
36
|
+
format?: (value: number | string) => string | number;
|
|
37
|
+
/**
|
|
38
|
+
* Hide the number buttons.
|
|
32
39
|
* @default false
|
|
33
40
|
*/
|
|
34
41
|
hideButtons?: boolean;
|
|
@@ -37,49 +44,64 @@ export interface NumberInputProps extends Omit<ComponentPropsWithoutRef<"div">,
|
|
|
37
44
|
*/
|
|
38
45
|
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
39
46
|
/**
|
|
40
|
-
* Optional ref for the input component
|
|
47
|
+
* Optional ref for the input component.
|
|
41
48
|
*/
|
|
42
49
|
inputRef?: Ref<HTMLInputElement>;
|
|
43
50
|
/**
|
|
44
|
-
* The maximum value that can be selected.
|
|
51
|
+
* The maximum value that can be selected.
|
|
45
52
|
* @default Number.MAX_SAFE_INTEGER
|
|
46
53
|
*/
|
|
47
54
|
max?: number;
|
|
48
55
|
/**
|
|
49
|
-
* The minimum value that can be selected.
|
|
56
|
+
* The minimum value that can be selected.
|
|
50
57
|
* @default Number.MIN_SAFE_INTEGER
|
|
51
58
|
*/
|
|
52
59
|
min?: number;
|
|
53
60
|
/**
|
|
54
|
-
* Callback when
|
|
55
|
-
*
|
|
61
|
+
* Callback function that is triggered when the value of the `NumberInput` changes.
|
|
62
|
+
*
|
|
63
|
+
* @param event - The event that triggers the value change. This may be `undefined` during a long press on the increment or decrement buttons.
|
|
64
|
+
* @param value - The new value of the `NumberInput`, which can be a number or a string.
|
|
56
65
|
*/
|
|
57
66
|
onChange?: (event: SyntheticEvent | undefined, value: number | string) => void;
|
|
58
67
|
/**
|
|
59
|
-
*
|
|
68
|
+
*
|
|
69
|
+
* A callback to parse the value of the `NumberInput`. To be used alongside
|
|
70
|
+
* the `format` callback.
|
|
71
|
+
*/
|
|
72
|
+
parse?: (value: number | string) => string | number;
|
|
73
|
+
/**
|
|
74
|
+
* A string displayed in a dimmed color when the `NumberInput` value is empty.
|
|
75
|
+
*/
|
|
76
|
+
placeholder?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The number of decimal places allowed. Defaults to the decimal scale of either the initial value provided or the step, whichever is greater.
|
|
60
79
|
*/
|
|
61
|
-
|
|
80
|
+
decimalScale?: number;
|
|
62
81
|
/**
|
|
63
|
-
* A boolean
|
|
82
|
+
* A boolean property that controls the editability of the `NumberInput`.
|
|
83
|
+
* - When set to `true`, the `NumberInput` becomes read-only, preventing user edits.
|
|
84
|
+
* - When set to `false` or omitted, the `NumberInput` is editable by the user.
|
|
64
85
|
*/
|
|
65
86
|
readOnly?: boolean;
|
|
66
87
|
/**
|
|
67
|
-
* Start adornment component
|
|
88
|
+
* Start adornment component.
|
|
68
89
|
*/
|
|
69
90
|
startAdornment?: ReactNode;
|
|
70
91
|
/**
|
|
71
|
-
* The amount to increment or decrement the value by when using the
|
|
92
|
+
* The amount to increment or decrement the value by when using the `NumberInput` buttons or Up Arrow and Down Arrow keys.
|
|
72
93
|
* @default 1
|
|
73
94
|
*/
|
|
74
95
|
step?: number;
|
|
75
96
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @default
|
|
97
|
+
* Defines the factor by which the step value is multiplied to determine the maximum increment or decrement when the Shift key
|
|
98
|
+
* is held while pressing the Up Arrow or Down Arrow keys for faster adjustments of the value.
|
|
99
|
+
* @default 2
|
|
79
100
|
*/
|
|
80
|
-
|
|
101
|
+
stepMultiplier?: number;
|
|
81
102
|
/**
|
|
82
|
-
*
|
|
103
|
+
* Specifies the alignment of the text within the `NumberInput`.
|
|
104
|
+
*
|
|
83
105
|
* @default "left"
|
|
84
106
|
*/
|
|
85
107
|
textAlign?: "left" | "center" | "right";
|
|
@@ -88,13 +110,13 @@ export interface NumberInputProps extends Omit<ComponentPropsWithoutRef<"div">,
|
|
|
88
110
|
*/
|
|
89
111
|
validationStatus?: Extract<ValidationStatus, "error" | "warning" | "success">;
|
|
90
112
|
/**
|
|
91
|
-
* Styling variant.
|
|
113
|
+
* Styling variant.
|
|
92
114
|
* @default "primary"
|
|
93
115
|
*/
|
|
94
116
|
variant?: "primary" | "secondary";
|
|
95
117
|
/**
|
|
96
|
-
*
|
|
118
|
+
* Value of the `NumberInput`, to be used when in a controlled state.
|
|
97
119
|
*/
|
|
98
|
-
value?: number | string
|
|
120
|
+
value?: number | string;
|
|
99
121
|
}
|
|
100
122
|
export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const ACCEPT_INPUT: RegExp;
|
|
2
|
-
export declare const toFixedDecimalPlaces: (inputNumber: number, decimalPlaces: number) => string;
|
|
3
1
|
export declare const isAllowedNonNumeric: (inputCharacter: number | string) => boolean | undefined;
|
|
4
2
|
export declare const toFloat: (inputValue: number | string) => number;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const isAtMin: (value: number | string | undefined, min: number) => boolean;
|
|
3
|
+
export declare const isValidNumber: (num: string | number) => boolean;
|
|
4
|
+
export declare const sanitizeInput: (value: string | number) => string | number;
|
|
8
5
|
export declare const isOutOfRange: (value: number | string | undefined, min: number, max: number) => boolean;
|
|
6
|
+
export declare const clampToRange: (min: number, max: number, value: number) => number;
|
|
7
|
+
export declare const getNumberPrecision: (number: string | number) => number;
|
|
8
|
+
export declare const isEmpty: (value: number | string) => value is "";
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { type Dispatch, type MouseEvent, type MutableRefObject, type SetStateAction, type SyntheticEvent } from "react";
|
|
2
2
|
import type { NumberInputProps } from "./NumberInput";
|
|
3
|
+
export interface UseNumberInputProps extends Pick<NumberInputProps, "decimalScale" | "disabled" | "format" | "inputRef" | "max" | "min" | "onChange" | "parse" | "readOnly" | "step" | "stepMultiplier"> {
|
|
4
|
+
clampAndFix: (value: number) => string | number;
|
|
5
|
+
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
6
|
+
isAdjustingRef: MutableRefObject<boolean>;
|
|
7
|
+
setIsEditing: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
setValue: Dispatch<SetStateAction<string | number>>;
|
|
9
|
+
value: string | number;
|
|
10
|
+
}
|
|
3
11
|
/**
|
|
4
12
|
* Manages increment / decrement logic
|
|
5
13
|
*/
|
|
6
|
-
export declare const useNumberInput: ({
|
|
7
|
-
setValue: Dispatch<SetStateAction<string | number | undefined>>;
|
|
8
|
-
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
9
|
-
}) => {
|
|
14
|
+
export declare const useNumberInput: ({ clampAndFix, decimalScale, disabled, format, inputRef, isAdjustingRef, max, min, onChange, parse, readOnly, setIsEditing, setValue, step, stepMultiplier, value, }: UseNumberInputProps) => {
|
|
10
15
|
incrementButtonProps: {
|
|
11
16
|
"aria-label": string;
|
|
12
17
|
disabled: boolean;
|
|
@@ -23,6 +28,6 @@ export declare const useNumberInput: ({ decimalPlaces, disabled, inputRef, max,
|
|
|
23
28
|
tabIndex: number;
|
|
24
29
|
onMouseUp: () => void | undefined;
|
|
25
30
|
};
|
|
26
|
-
incrementValue: (event?: SyntheticEvent
|
|
27
|
-
decrementValue: (event?: SyntheticEvent
|
|
31
|
+
incrementValue: (event?: SyntheticEvent, block?: boolean) => void;
|
|
32
|
+
decrementValue: (event?: SyntheticEvent, block?: boolean) => void;
|
|
28
33
|
};
|
|
@@ -2,7 +2,7 @@ import { type FocusEventHandler, type ForwardedRef, type Ref } from "react";
|
|
|
2
2
|
import type { QueryInputProps } from "./QueryInput";
|
|
3
3
|
import type { QueryInputBodyProps } from "./internal/QueryInputBody";
|
|
4
4
|
import type { ValueSelectorProps } from "./internal/ValueSelector";
|
|
5
|
-
export
|
|
5
|
+
export type BooleanOperator = "or" | "and";
|
|
6
6
|
export interface UseQueryInputResult {
|
|
7
7
|
queryInputProps: {
|
|
8
8
|
onFocus: FocusEventHandler<HTMLDivElement>;
|
|
@@ -27,7 +27,7 @@ interface RemoveItemAction {
|
|
|
27
27
|
}
|
|
28
28
|
interface MultiItemAction {
|
|
29
29
|
type: "update-items" | "update-items-remove-overflow-indicator";
|
|
30
|
-
overflowItems: Partial<Omit<OverflowItem, "id">> & Pick<OverflowItem, "id">[];
|
|
30
|
+
overflowItems: (Partial<Omit<OverflowItem, "id">> & Pick<OverflowItem, "id">)[];
|
|
31
31
|
}
|
|
32
32
|
interface SingleItemAction {
|
|
33
33
|
type: "add-overflow-indicator" | "replace-item" | "collapsing-item" | "uncollapse-dynamic-item" | "collapse-instant-item";
|
|
@@ -46,9 +46,9 @@ interface DynamicCollapseAction extends Omit<SingleItemAction, "type"> {
|
|
|
46
46
|
collapsedSize: number;
|
|
47
47
|
minSize: number;
|
|
48
48
|
}
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
49
|
+
export type OverflowAction = AddChildAction | CombinedItemAction | DynamicCollapseAction | EmptyPayloadAction | InitAction | MultiItemAction | RemoveItemAction | SingleItemAction | SourceAction;
|
|
50
|
+
export type OverflowReducer = Reducer<OverflowItems, OverflowAction>;
|
|
51
|
+
export type OverflowReducerInitialisationProps = {
|
|
52
52
|
children?: ReactNode;
|
|
53
53
|
source?: OverflowSource[];
|
|
54
54
|
injectedItems?: any[];
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, RefObject } from "react";
|
|
2
2
|
import type { OverflowAction as overflowAction2 } from "./OverflowReducer";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type dimension = "width" | "height" | "scrollWidth" | "scrollHeight";
|
|
4
|
+
type dimensions = {
|
|
5
5
|
size: dimension;
|
|
6
6
|
depth: dimension;
|
|
7
7
|
scrollDepth: dimension;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type dimensionsType = {
|
|
10
10
|
horizontal: dimensions;
|
|
11
11
|
vertical: dimensions;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type orientationType = keyof dimensionsType;
|
|
14
|
+
export type collapsibleType = "instant" | "dynamic";
|
|
15
15
|
interface NonNullableRefObject<T> {
|
|
16
16
|
current: T;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export type FilterPredicate = (item: OverflowItem) => boolean;
|
|
19
|
+
export type ElementRef = RefObject<HTMLDivElement>;
|
|
20
20
|
export interface OverflowSource {
|
|
21
21
|
id?: string;
|
|
22
22
|
label: string;
|
|
@@ -25,15 +25,15 @@ export interface OverflowSource {
|
|
|
25
25
|
position?: number;
|
|
26
26
|
priority?: number;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type InjectedSourceItem = {
|
|
29
29
|
source: OverflowSource;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type InjectedChildItem = {
|
|
32
32
|
element: JSX.Element;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
34
|
+
export type InjectedItem = InjectedChildItem | InjectedSourceItem;
|
|
35
|
+
export type overflowItemType = "source" | "child";
|
|
36
|
+
export type OverflowItem<T extends overflowItemType = "child"> = {
|
|
37
37
|
collapsed?: boolean;
|
|
38
38
|
collapsible?: collapsibleType;
|
|
39
39
|
collapsing?: boolean;
|
|
@@ -57,24 +57,24 @@ export declare type OverflowItem<T extends overflowItemType = "child"> = {
|
|
|
57
57
|
editable?: boolean;
|
|
58
58
|
closeable?: boolean;
|
|
59
59
|
};
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
60
|
+
export type OverflowItems = OverflowItem<"source" | "child">[];
|
|
61
|
+
export type ManagedListRef = NonNullableRefObject<OverflowItem[]>;
|
|
62
|
+
export type overflowState = {
|
|
63
63
|
overflowIndicatorSize: number;
|
|
64
64
|
visibleItems: OverflowItem[];
|
|
65
65
|
};
|
|
66
|
-
export
|
|
66
|
+
export type overflowAction = {
|
|
67
67
|
type: string;
|
|
68
68
|
managedItems?: OverflowItem[];
|
|
69
69
|
managedItem?: OverflowItem;
|
|
70
70
|
};
|
|
71
|
-
export
|
|
72
|
-
export
|
|
71
|
+
export type overflowDispatch = (action: overflowAction2) => void;
|
|
72
|
+
export type OverflowCollectionOptions = {
|
|
73
73
|
closeable?: boolean;
|
|
74
74
|
editable?: boolean;
|
|
75
75
|
getPriority?: (item: any, index: number) => number | undefined;
|
|
76
76
|
};
|
|
77
|
-
export
|
|
77
|
+
export type OverflowCollectionHookProps = {
|
|
78
78
|
children?: ReactNode;
|
|
79
79
|
defaultSource?: OverflowSource[];
|
|
80
80
|
id: string;
|
|
@@ -84,7 +84,7 @@ export declare type OverflowCollectionHookProps = {
|
|
|
84
84
|
orientation: orientationType;
|
|
85
85
|
source?: OverflowSource[];
|
|
86
86
|
};
|
|
87
|
-
export
|
|
87
|
+
export type OverflowCollectionHookResult = {
|
|
88
88
|
data: OverflowItem[];
|
|
89
89
|
dispatch: (action: overflowAction2 | {
|
|
90
90
|
type: "reset";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementRef, OverflowItem, orientationType } from "./overflowTypes";
|
|
2
2
|
export declare const DropdownPlaceholder: () => null;
|
|
3
3
|
export declare const getDropdownPlaceholder: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export
|
|
4
|
+
export type heightOrWidth = "width" | "height";
|
|
5
5
|
export declare const NO_DATA: {};
|
|
6
6
|
export declare const allExceptOverflowIndicator: (sum: number, m: OverflowItem) => number;
|
|
7
7
|
export declare const isCollapsed: (item: OverflowItem) => boolean;
|
|
@@ -28,11 +28,11 @@ export declare const measureContainerOverflow: (ref: ElementRef, orientation?: o
|
|
|
28
28
|
**/
|
|
29
29
|
export declare function measureElementSize(element: HTMLElement, dimension?: heightOrWidth, includeAutoMargin?: boolean): number;
|
|
30
30
|
export declare const byDescendingPriority: (m1: OverflowItem, m2: OverflowItem) => number;
|
|
31
|
-
export declare const getOverflowIndicator: (managedItems: OverflowItem[]) => OverflowItem
|
|
31
|
+
export declare const getOverflowIndicator: (managedItems: OverflowItem[]) => OverflowItem | undefined;
|
|
32
32
|
export declare const popNextItemByPriority: (items: OverflowItem[]) => OverflowItem | null;
|
|
33
33
|
export declare const measureOverflowItems: (items: OverflowItem[], dimension: heightOrWidth) => OverflowItem[];
|
|
34
34
|
export declare const addAll: (sum: number, m: OverflowItem) => number;
|
|
35
35
|
export declare const getElementForItem: (ref: ElementRef, item: OverflowItem) => HTMLElement;
|
|
36
|
-
|
|
36
|
+
type dimension = "left" | "right" | "top" | "bottom";
|
|
37
37
|
export declare const getRuntimePadding: (el: HTMLElement, ...dimensions: dimension[]) => number[];
|
|
38
38
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { OverflowCollectionHookProps, OverflowCollectionHookResult } from "./overflowTypes";
|
|
2
|
-
|
|
2
|
+
type OverflowCollectionHook = (props: OverflowCollectionHookProps) => OverflowCollectionHookResult;
|
|
3
3
|
export declare const useOverflowCollectionItems: OverflowCollectionHook;
|
|
4
4
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ElementRef, OverflowItem, OverflowLayoutHookProps } from "./overflowTypes";
|
|
2
|
-
|
|
2
|
+
type overflowUpdate = (item1: OverflowItem, item2: OverflowItem) => void;
|
|
3
3
|
export declare const useOverflowLayout: ({ collectionHook, id, orientation, label, disableOverflow, }: OverflowLayoutHookProps) => [ElementRef, overflowUpdate];
|
|
4
4
|
export {};
|
|
@@ -2,11 +2,11 @@ import { type RefObject } from "react";
|
|
|
2
2
|
export declare const WidthHeight: string[];
|
|
3
3
|
export declare const HeightOnly: string[];
|
|
4
4
|
export declare const WidthOnly: string[];
|
|
5
|
-
export
|
|
5
|
+
export type measurements<T = string | number> = {
|
|
6
6
|
height?: T;
|
|
7
7
|
scrollHeight?: T;
|
|
8
8
|
scrollWidth?: T;
|
|
9
9
|
width?: T;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type ResizeHandler = (measurements: measurements<number>) => void;
|
|
12
12
|
export declare function useResizeObserver(ref: RefObject<Element | HTMLElement | null>, dimensions: string[], onResize: ResizeHandler, reportInitialSize?: boolean): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type dataPadDirection = "data-pad-start" | "data-pad-end";
|
|
2
2
|
export declare const isResponsiveAttribute: (propName: string) => boolean;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type AnyProps = Record<string, unknown>;
|
|
4
|
+
type ResponsivePropsTuple = [AnyProps, AnyProps];
|
|
5
5
|
/**
|
|
6
6
|
* data- attributes can be used to manage item overflow behaviour. Users may
|
|
7
7
|
* speficy these attributes directly on a Toolbar component, which ultimately
|
package/dist-types/tabs/Tab.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { type KeyboardEvent, type MouseEvent } from "react";
|
|
2
|
+
import { type EditableLabelProps } from "../editable-label";
|
|
2
3
|
export declare const Tab: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLElement>, "onKeyUp" | "onClick"> & {
|
|
3
|
-
ariaControls?:
|
|
4
|
-
closeable?: boolean
|
|
5
|
-
draggable?: boolean
|
|
6
|
-
dragging?: boolean
|
|
7
|
-
editable?: boolean
|
|
8
|
-
editing?:
|
|
9
|
-
focused?: boolean
|
|
10
|
-
focusVisible?: boolean
|
|
11
|
-
focusedChildIndex?: number
|
|
12
|
-
selected?: boolean
|
|
13
|
-
index?: number
|
|
14
|
-
label?:
|
|
15
|
-
onClick?: (
|
|
16
|
-
onClose?: (
|
|
17
|
-
onEnterEditMode?: (
|
|
18
|
-
onExitEditMode?: import("./TabsTypes").exitEditHandler
|
|
19
|
-
onKeyUp?: (
|
|
20
|
-
orientation?: "horizontal" | "vertical"
|
|
21
|
-
tabChildIndex?: number
|
|
4
|
+
ariaControls?: import("react").AriaAttributes["aria-controls"];
|
|
5
|
+
closeable?: boolean;
|
|
6
|
+
draggable?: boolean;
|
|
7
|
+
dragging?: boolean;
|
|
8
|
+
editable?: boolean;
|
|
9
|
+
editing?: EditableLabelProps["editing"];
|
|
10
|
+
focused?: boolean;
|
|
11
|
+
focusVisible?: boolean;
|
|
12
|
+
focusedChildIndex?: number;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
index?: number;
|
|
15
|
+
label?: EditableLabelProps["defaultValue"];
|
|
16
|
+
onClick?: (e: MouseEvent, index: number) => void;
|
|
17
|
+
onClose?: (index: number) => void;
|
|
18
|
+
onEnterEditMode?: () => void;
|
|
19
|
+
onExitEditMode?: import("./TabsTypes").exitEditHandler;
|
|
20
|
+
onKeyUp?: (e: KeyboardEvent, index: number) => void;
|
|
21
|
+
orientation?: "horizontal" | "vertical";
|
|
22
|
+
tabChildIndex?: number;
|
|
22
23
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FocusAPI, TabstripProps } from "./TabsTypes";
|
|
2
|
-
export
|
|
2
|
+
export type TabsProps = Omit<TabstripProps, "defaultSource">;
|
|
3
3
|
export declare const Tabs: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<FocusAPI>>;
|
|
@@ -8,10 +8,10 @@ export interface FocusAPI {
|
|
|
8
8
|
export interface TabDescriptor extends OverflowSource {
|
|
9
9
|
element?: JSX.Element;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
11
|
+
export type TabsSource = string[] | TabDescriptor[];
|
|
12
|
+
export type navigationProps = Pick<TabProps, "onFocus" | "onKeyDown">;
|
|
13
|
+
export type composableTabProps = navigationProps & Pick<TabProps, "onClick" | "onEnterEditMode" | "onExitEditMode" | "onMouseDown">;
|
|
14
|
+
export type TabstripVariant = "primary" | "tertiary";
|
|
15
15
|
export interface TabstripProps extends HTMLAttributes<HTMLDivElement> {
|
|
16
16
|
/**
|
|
17
17
|
* when true Tabs may be re-arranged by dragging individual Tabs to new position within Tabstrip.
|
|
@@ -64,13 +64,13 @@ export interface TabstripProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
64
64
|
*/
|
|
65
65
|
variant?: TabstripVariant;
|
|
66
66
|
}
|
|
67
|
-
export
|
|
67
|
+
export type exitEditHandler = (originalValue: string, editedValue: string, allowDeactivation: boolean, tabIndex: number) => void;
|
|
68
68
|
export interface responsiveDataAttributes {
|
|
69
69
|
"data-index": number;
|
|
70
70
|
"data-overflowed"?: boolean;
|
|
71
71
|
"data-priority": number;
|
|
72
72
|
}
|
|
73
|
-
export
|
|
73
|
+
export type TabProps = Omit<HTMLAttributes<HTMLElement>, "onClick" | "onKeyUp"> & {
|
|
74
74
|
ariaControls?: AriaAttributes["aria-controls"];
|
|
75
75
|
closeable?: boolean;
|
|
76
76
|
draggable?: boolean;
|
|
@@ -91,4 +91,4 @@ export declare type TabProps = Omit<HTMLAttributes<HTMLElement>, "onClick" | "on
|
|
|
91
91
|
orientation?: "horizontal" | "vertical";
|
|
92
92
|
tabChildIndex?: number;
|
|
93
93
|
};
|
|
94
|
-
export
|
|
94
|
+
export type TabElement = ReactElement<TabProps>;
|
|
@@ -4,6 +4,6 @@ export declare const Draggable: import("react").ForwardRefExoticComponent<{
|
|
|
4
4
|
wrapperClassName: string;
|
|
5
5
|
element: HTMLElement;
|
|
6
6
|
rect: Rect;
|
|
7
|
-
scale?: number
|
|
7
|
+
scale?: number;
|
|
8
8
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export declare const createDragSpacer: (transitioning?: MutableRefObject<boolean>
|
|
9
|
+
export declare const createDragSpacer: (transitioning?: MutableRefObject<boolean>) => HTMLElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { orientationType } from "../../responsive";
|
|
2
2
|
import { type Direction } from "./dragDropTypes";
|
|
3
|
-
export
|
|
3
|
+
export type MeasuredDropTarget = {
|
|
4
4
|
currentIndex: number;
|
|
5
5
|
dataIndex?: number;
|
|
6
6
|
element: HTMLElement;
|
|
@@ -12,37 +12,41 @@ export declare type MeasuredDropTarget = {
|
|
|
12
12
|
mid: number;
|
|
13
13
|
size: number;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type targetType = {
|
|
16
16
|
element: HTMLElement | null;
|
|
17
17
|
index: number;
|
|
18
18
|
isLast?: boolean;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type MousePosKey = keyof Pick<MouseEvent, "clientX" | "clientY">;
|
|
21
|
+
type DOMRectKey = keyof Omit<DOMRect, "toJSON">;
|
|
22
|
+
type DOMRectDimensionKey = keyof Pick<DOMRect, "width" | "height">;
|
|
23
|
+
type Dimension = keyof Pick<DOMRect, "width" | "height">;
|
|
24
|
+
type ElementDimension = keyof Pick<HTMLElement, "scrollHeight" | "scrollWidth" | "clientHeight" | "clientWidth" | "scrollTop" | "scrollLeft">;
|
|
21
25
|
export declare const measureElementSizeAndPosition: (element: HTMLElement, dimension?: Dimension, includeAutoMargin?: boolean) => number[];
|
|
22
26
|
export declare const dimensions: (orientation: orientationType) => {
|
|
23
|
-
CLIENT_SIZE:
|
|
24
|
-
CONTRA:
|
|
25
|
-
CONTRA_POS:
|
|
26
|
-
DIMENSION:
|
|
27
|
-
END:
|
|
28
|
-
POS:
|
|
29
|
-
SCROLL_POS:
|
|
30
|
-
SCROLL_SIZE:
|
|
31
|
-
START:
|
|
27
|
+
CLIENT_SIZE: ElementDimension;
|
|
28
|
+
CONTRA: DOMRectKey;
|
|
29
|
+
CONTRA_POS: MousePosKey;
|
|
30
|
+
DIMENSION: DOMRectDimensionKey;
|
|
31
|
+
END: DOMRectKey;
|
|
32
|
+
POS: MousePosKey;
|
|
33
|
+
SCROLL_POS: ElementDimension;
|
|
34
|
+
SCROLL_SIZE: ElementDimension;
|
|
35
|
+
START: DOMRectKey;
|
|
32
36
|
} | {
|
|
33
|
-
CLIENT_SIZE:
|
|
34
|
-
CONTRA:
|
|
35
|
-
CONTRA_POS:
|
|
36
|
-
DIMENSION:
|
|
37
|
-
END:
|
|
38
|
-
POS:
|
|
39
|
-
SCROLL_POS:
|
|
40
|
-
SCROLL_SIZE:
|
|
41
|
-
START:
|
|
37
|
+
CLIENT_SIZE: ElementDimension;
|
|
38
|
+
CONTRA: DOMRectKey;
|
|
39
|
+
CONTRA_POS: MousePosKey;
|
|
40
|
+
DIMENSION: DOMRectDimensionKey;
|
|
41
|
+
END: DOMRectKey;
|
|
42
|
+
POS: MousePosKey;
|
|
43
|
+
SCROLL_POS: ElementDimension;
|
|
44
|
+
SCROLL_SIZE: ElementDimension;
|
|
45
|
+
START: DOMRectKey;
|
|
42
46
|
};
|
|
43
47
|
export declare const getDraggedItem: (measuredItems: MeasuredDropTarget[]) => MeasuredDropTarget;
|
|
44
48
|
export declare const moveDragItem: (measuredItems: MeasuredDropTarget[], dropTarget: MeasuredDropTarget) => MeasuredDropTarget[];
|
|
45
49
|
export declare const isDraggedElement: (item: MeasuredDropTarget) => boolean;
|
|
46
|
-
export declare const measureDropTargets: (container: HTMLElement, orientation: orientationType, draggedItem: HTMLElement, itemQuery?: string
|
|
50
|
+
export declare const measureDropTargets: (container: HTMLElement, orientation: orientationType, draggedItem: HTMLElement, itemQuery?: string) => MeasuredDropTarget[];
|
|
47
51
|
export declare const getNextDropTarget: (dropTargets: MeasuredDropTarget[], pos: number, direction: Direction) => MeasuredDropTarget | null;
|
|
48
52
|
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { MouseEventHandler, RefObject } from "react";
|
|
2
2
|
import type { orientationType } from "../../responsive";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type dragStrategy = "drop-indicator" | "natural-movement";
|
|
4
|
+
export type Direction = "fwd" | "bwd";
|
|
5
5
|
export declare const FWD: Direction;
|
|
6
6
|
export declare const BWD: Direction;
|
|
7
|
-
export
|
|
7
|
+
export type Rect = {
|
|
8
8
|
height: number;
|
|
9
9
|
left: number;
|
|
10
10
|
top: number;
|
|
11
11
|
width: number;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type DragHookResult = {
|
|
14
14
|
draggable: JSX.Element | null;
|
|
15
15
|
dropIndicator: JSX.Element | null;
|
|
16
16
|
draggedItemIndex?: number;
|
|
@@ -18,7 +18,7 @@ export declare type DragHookResult = {
|
|
|
18
18
|
onMouseDown?: MouseEventHandler;
|
|
19
19
|
revealOverflowedItems: boolean;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type DragDropHook = (props: {
|
|
22
22
|
allowDragDrop?: boolean | dragStrategy;
|
|
23
23
|
extendedDropZone?: boolean;
|
|
24
24
|
onDrop: (fromIndex: number, toIndex: number) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MeasuredDropTarget } from "./drag-utils";
|
|
2
2
|
import type { Direction } from "./dragDropTypes";
|
|
3
3
|
export declare const useDragSpacers: () => {
|
|
4
|
-
displaceItem: (item: MeasuredDropTarget | null, size: number, useTransition?: boolean, direction?: Direction
|
|
4
|
+
displaceItem: (item: MeasuredDropTarget | null, size: number, useTransition?: boolean, direction?: Direction) => void;
|
|
5
5
|
displaceLastItem: (item: MeasuredDropTarget, size: number, useTransition?: boolean) => void;
|
|
6
6
|
clearSpacers: () => void;
|
|
7
7
|
};
|