@vuu-ui/vuu-ui-controls 4.0.0-alpha.9 → 4.0.0-beta.1
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/package.json +16 -14
- package/src/context-panel-provider/ContextPanelProvider.js +40 -28
- package/src/drag-drop/Draggable.css.js +2 -2
- package/src/expando-input/ExpandoInput.css.js +1 -1
- package/src/icon-button/Icon.js +0 -1
- package/src/icon-button/IconButton.js +1 -1
- package/src/icon-button/ToggleIconButton.css.js +1 -1
- package/src/index.js +1 -1
- package/src/instrument-picker/useTablePicker.js +2 -3
- package/src/item-picker/ItemPicker.css.js +1 -1
- package/src/item-picker/ItemPicker.js +53 -79
- package/src/price-ticker/PriceTicker.css.js +4 -4
- package/src/split-pane/SplitPane.css.js +82 -0
- package/src/split-pane/SplitPane.js +60 -0
- package/src/split-pane/Splitter.js +82 -0
- package/src/split-pane/index.js +1 -0
- package/src/split-pane/useSplitPane.js +101 -0
- package/src/tabstrip/Tab.css.js +3 -3
- package/src/tabstrip/Tabstrip.css.js +2 -2
- package/src/tabstrip/Tabstrip.js +1 -1
- package/src/time-input/MaskedInput.js +176 -156
- package/src/time-input/TimeInput.css.js +41 -18
- package/src/time-input/TimeInput.js +25 -14
- package/src/time-input/useTimeInput.js +57 -47
- package/src/toolbar/Toolbar.css.js +1 -1
- package/src/vuu-date-picker/VuuDatePicker.js +46 -52
- package/src/vuu-time-picker/VuuTimePicker.js +6 -5
- package/types/context-panel-provider/ContextPanelProvider.d.ts +7 -4
- package/types/drag-drop/DragDropProvider.d.ts +1 -1
- package/types/hover-overlay/HoverOverlay.d.ts +1 -1
- package/types/icon-button/Icon.d.ts +2 -2
- package/types/icon-button/IconButton.d.ts +1 -1
- package/types/icon-button/ToggleIconButton.d.ts +1 -1
- package/types/index.d.ts +4 -3
- package/types/instrument-picker/SearchCell.d.ts +1 -1
- package/types/instrument-picker/TablePicker.d.ts +1 -1
- package/types/instrument-picker/useTablePicker.d.ts +1 -1
- package/types/item-picker/ItemPicker.d.ts +5 -26
- package/types/item-picker/useItemPicker.d.ts +3 -4
- package/types/modal-provider/ModalProvider.d.ts +1 -1
- package/types/price-ticker/PriceTicker.d.ts +1 -1
- package/types/prompt/Prompt.d.ts +1 -1
- package/types/sortable-list/SortableList.d.ts +2 -2
- package/types/split-button/useSplitButton.d.ts +12 -12
- package/types/split-pane/SplitPane.d.ts +44 -0
- package/types/split-pane/Splitter.d.ts +10 -0
- package/types/split-pane/index.d.ts +2 -0
- package/types/split-pane/useSplitPane.d.ts +18 -0
- package/types/table-search/SearchCell.d.ts +1 -1
- package/types/table-search/TableSearch.d.ts +1 -1
- package/types/tabstrip/TabMenu.d.ts +1 -1
- package/types/tabstrip/Tabstrip.d.ts +2 -3
- package/types/time-input/MaskedInput.d.ts +60 -10
- package/types/time-input/TimeInput.d.ts +4 -3
- package/types/time-input/useTimeInput.d.ts +24 -5
- package/types/toolbar/Toolbar.d.ts +1 -2
- package/types/vuu-date-picker/VuuDatePicker.d.ts +19 -3
- package/types/vuu-time-picker/VuuTimePicker.d.ts +8 -6
- package/types/vuu-typeahead-input/VuuTypeaheadInput.d.ts +1 -1
- package/types/src/calendar/Calendar.d.ts +0 -13
- package/types/src/calendar/index.d.ts +0 -4
- package/types/src/calendar/internal/CalendarCarousel.d.ts +0 -3
- package/types/src/calendar/internal/CalendarContext.d.ts +0 -8
- package/types/src/calendar/internal/CalendarDay.d.ts +0 -14
- package/types/src/calendar/internal/CalendarMonth.d.ts +0 -10
- package/types/src/calendar/internal/CalendarNavigation.d.ts +0 -16
- package/types/src/calendar/internal/CalendarWeekHeader.d.ts +0 -3
- package/types/src/calendar/internal/useFocusManagement.d.ts +0 -9
- package/types/src/calendar/internal/utils.d.ts +0 -15
- package/types/src/calendar/useCalendar.d.ts +0 -54
- package/types/src/calendar/useCalendarDay.d.ts +0 -22
- package/types/src/calendar/useSelection.d.ts +0 -78
- package/types/src/column-picker/ColumnPicker.d.ts +0 -7
- package/types/src/column-picker/ColumnSearch.d.ts +0 -12
- package/types/src/column-picker/index.d.ts +0 -2
- package/types/src/column-picker/moving-window.d.ts +0 -14
- package/types/src/common-hooks/index.d.ts +0 -3
- package/types/src/common-hooks/selectionTypes.d.ts +0 -70
- package/types/src/common-hooks/use-resize-observer.d.ts +0 -16
- package/types/src/common-hooks/useControlled.d.ts +0 -24
- package/types/src/context-panel-provider/ContextPanelProvider.d.ts +0 -17
- package/types/src/cycle-state-button/CycleStateButton.d.ts +0 -11
- package/types/src/cycle-state-button/index.d.ts +0 -1
- package/types/src/date-input/DateInput.d.ts +0 -60
- package/types/src/date-input/index.d.ts +0 -1
- package/types/src/date-picker/DatePicker.d.ts +0 -66
- package/types/src/date-picker/DatePickerContext.d.ts +0 -19
- package/types/src/date-picker/DatePickerPanel.d.ts +0 -10
- package/types/src/date-picker/index.d.ts +0 -1
- package/types/src/drag-drop/DragDropProvider.d.ts +0 -38
- package/types/src/drag-drop/DragDropState.d.ts +0 -15
- package/types/src/drag-drop/Draggable.d.ts +0 -13
- package/types/src/drag-drop/DropIndicator.d.ts +0 -5
- package/types/src/drag-drop/dragDropTypes.d.ts +0 -100
- package/types/src/drag-drop/drop-target-utils.d.ts +0 -82
- package/types/src/drag-drop/index.d.ts +0 -6
- package/types/src/drag-drop/useAutoScroll.d.ts +0 -11
- package/types/src/drag-drop/useDragDisplacers.d.ts +0 -17
- package/types/src/drag-drop/useDragDrop.d.ts +0 -2
- package/types/src/drag-drop/useDragDropCopy.d.ts +0 -6
- package/types/src/drag-drop/useDragDropIndicator.d.ts +0 -2
- package/types/src/drag-drop/useDragDropNaturalMovement.d.ts +0 -2
- package/types/src/drag-drop/useDropIndicator.d.ts +0 -8
- package/types/src/drag-drop/useGlobalDragDrop.d.ts +0 -11
- package/types/src/drag-drop/useTransition.d.ts +0 -3
- package/types/src/editable/index.d.ts +0 -1
- package/types/src/editable/useEditableText.d.ts +0 -21
- package/types/src/editable-label/EditableLabel.d.ts +0 -19
- package/types/src/editable-label/index.d.ts +0 -1
- package/types/src/expando-input/ExpandoInput.d.ts +0 -6
- package/types/src/expando-input/index.d.ts +0 -1
- package/types/src/highlighter/Highlighter.d.ts +0 -6
- package/types/src/highlighter/index.d.ts +0 -1
- package/types/src/hover-overlay/HoverOverlay.d.ts +0 -8
- package/types/src/icon-button/Icon.d.ts +0 -6
- package/types/src/icon-button/IconButton.d.ts +0 -6
- package/types/src/icon-button/ToggleIconButton.d.ts +0 -5
- package/types/src/icon-button/index.d.ts +0 -3
- package/types/src/index.d.ts +0 -33
- package/types/src/instrument-picker/SearchCell.d.ts +0 -2
- package/types/src/instrument-picker/TablePicker.d.ts +0 -11
- package/types/src/instrument-picker/index.d.ts +0 -1
- package/types/src/instrument-picker/moving-window.d.ts +0 -14
- package/types/src/instrument-picker/useDataSource.d.ts +0 -6
- package/types/src/instrument-picker/useTablePicker.d.ts +0 -47
- package/types/src/item-picker/ItemPicker.d.ts +0 -14
- package/types/src/item-picker/useItemPicker.d.ts +0 -35
- package/types/src/measured-container/MeasuredContainer.d.ts +0 -16
- package/types/src/measured-container/index.d.ts +0 -2
- package/types/src/measured-container/useMeasuredContainer.d.ts +0 -23
- package/types/src/modal-provider/ModalProvider.d.ts +0 -13
- package/types/src/overflow-container/OverflowContainer.d.ts +0 -15
- package/types/src/overflow-container/index.d.ts +0 -2
- package/types/src/overflow-container/overflow-utils.d.ts +0 -48
- package/types/src/overflow-container/useOverflowContainer.d.ts +0 -19
- package/types/src/price-ticker/PriceTicker.d.ts +0 -7
- package/types/src/price-ticker/index.d.ts +0 -1
- package/types/src/prompt/Prompt.d.ts +0 -53
- package/types/src/sortable-list/SortableList.d.ts +0 -8
- package/types/src/split-button/SplitButton.d.ts +0 -11
- package/types/src/split-button/SplitStateButton.d.ts +0 -5
- package/types/src/split-button/index.d.ts +0 -2
- package/types/src/split-button/useSplitButton.d.ts +0 -311
- package/types/src/table-search/SearchCell.d.ts +0 -2
- package/types/src/table-search/TableSearch.d.ts +0 -9
- package/types/src/table-search/index.d.ts +0 -1
- package/types/src/table-search/moving-window.d.ts +0 -14
- package/types/src/table-search/useTableSearch.d.ts +0 -15
- package/types/src/tabs-next/TabBar.d.ts +0 -12
- package/types/src/tabs-next/TabListNext.d.ts +0 -12
- package/types/src/tabs-next/TabNext.d.ts +0 -12
- package/types/src/tabs-next/TabNextAction.d.ts +0 -5
- package/types/src/tabs-next/TabNextContext.d.ts +0 -12
- package/types/src/tabs-next/TabNextPanel.d.ts +0 -8
- package/types/src/tabs-next/TabNextTrigger.d.ts +0 -5
- package/types/src/tabs-next/TabOverflowList.d.ts +0 -11
- package/types/src/tabs-next/TabsNext.d.ts +0 -17
- package/types/src/tabs-next/TabsNextContext.d.ts +0 -21
- package/types/src/tabs-next/hooks/useCollection.d.ts +0 -18
- package/types/src/tabs-next/hooks/useFocusOutside.d.ts +0 -2
- package/types/src/tabs-next/hooks/useOverflow.d.ts +0 -11
- package/types/src/tabs-next/index.d.ts +0 -7
- package/types/src/tabstrip/Tab.d.ts +0 -27
- package/types/src/tabstrip/TabMenu.d.ts +0 -23
- package/types/src/tabstrip/TabMenuOptions.d.ts +0 -10
- package/types/src/tabstrip/TabsTypes.d.ts +0 -127
- package/types/src/tabstrip/Tabstrip.d.ts +0 -3
- package/types/src/tabstrip/index.d.ts +0 -5
- package/types/src/tabstrip/tabstrip-dom-utils.d.ts +0 -2
- package/types/src/tabstrip/useAnimatedSelectionThumb.d.ts +0 -7
- package/types/src/tabstrip/useKeyboardNavigation.d.ts +0 -29
- package/types/src/tabstrip/useSelection.d.ts +0 -13
- package/types/src/tabstrip/useTabstrip.d.ts +0 -55
- package/types/src/time-input/MaskedInput.d.ts +0 -49
- package/types/src/time-input/TimeInput.d.ts +0 -5
- package/types/src/time-input/useTimeInput.d.ts +0 -21
- package/types/src/toolbar/Toolbar.d.ts +0 -20
- package/types/src/toolbar/index.d.ts +0 -1
- package/types/src/toolbar/toolbar-dom-utils.d.ts +0 -3
- package/types/src/toolbar/useKeyboardNavigation.d.ts +0 -32
- package/types/src/toolbar/useSelection.d.ts +0 -22
- package/types/src/toolbar/useToolbar.d.ts +0 -28
- package/types/src/utils/deprecated-types.d.ts +0 -2
- package/types/src/utils/escapeRegExp.d.ts +0 -1
- package/types/src/utils/forwardCallbackProps.d.ts +0 -3
- package/types/src/utils/index.d.ts +0 -5
- package/types/src/utils/isOverflowElement.d.ts +0 -1
- package/types/src/utils/isPlainObject.d.ts +0 -1
- package/types/src/vuu-date-picker/VuuDatePicker.d.ts +0 -7
- package/types/src/vuu-date-picker/index.d.ts +0 -1
- package/types/src/vuu-input/VuuInput.d.ts +0 -18
- package/types/src/vuu-input/index.d.ts +0 -1
- package/types/src/vuu-time-picker/TimeRangePicker.d.ts +0 -0
- package/types/src/vuu-time-picker/VuuTimePicker.d.ts +0 -7
- package/types/src/vuu-typeahead-input/VuuTypeaheadInput.d.ts +0 -6
- package/types/src/vuu-typeahead-input/index.d.ts +0 -1
- package/types/src/vuu-typeahead-input/useVuuTypeaheadInput.d.ts +0 -49
|
@@ -1,75 +1,85 @@
|
|
|
1
|
-
import { isValidTimeString } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { useCallback,
|
|
1
|
+
import { isValidTimeString, isValidTimeStringMillis } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
3
3
|
import { MaskedInput } from "./MaskedInput.js";
|
|
4
4
|
const isDigit = (char)=>1 === char.length && /[0-9]/.test(char);
|
|
5
|
-
const useTimeInput = ({ defaultValue, onChange, onCommit, value })=>{
|
|
5
|
+
const useTimeInput = ({ defaultValue, milliseconds = false, onChange, onCommit: onCommitProp, value })=>{
|
|
6
|
+
const onCommit = onCommitProp;
|
|
6
7
|
const mousedDownRef = useRef(false);
|
|
8
|
+
const onChangeRef = useRef(onChange);
|
|
9
|
+
onChangeRef.current = onChange;
|
|
7
10
|
const maskedInputRef = useRef(void 0);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
if (void 0 === maskedInputRef.current || maskedInputRef.current.milliseconds !== milliseconds) {
|
|
12
|
+
maskedInputRef.current = new MaskedInput(value ?? maskedInputRef.current?.value ?? defaultValue, null, {
|
|
13
|
+
milliseconds
|
|
14
|
+
});
|
|
15
|
+
maskedInputRef.current.on("change", (e)=>{
|
|
16
|
+
onChangeRef.current?.(e);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const maskedInput = maskedInputRef.current;
|
|
20
|
+
if (void 0 !== value) maskedInput.value = value;
|
|
21
|
+
const setInputEl = useCallback((el)=>{
|
|
22
|
+
maskedInput.input = el;
|
|
16
23
|
}, [
|
|
17
|
-
|
|
18
|
-
onChange,
|
|
19
|
-
value
|
|
24
|
+
maskedInput
|
|
20
25
|
]);
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (isValidTimeString(value)) onCommit(evt, value, "text-input");
|
|
27
|
-
else if ("hh:mm:ss" === value) console.log("no value set");
|
|
28
|
-
else console.log("value is not valid");
|
|
26
|
+
const commitValue = useCallback((evt)=>{
|
|
27
|
+
if ("" !== evt.currentTarget.value) {
|
|
28
|
+
const { value } = maskedInput;
|
|
29
|
+
if (milliseconds ? isValidTimeStringMillis(value) : isValidTimeString(value)) onCommit(evt, value, "text-input");
|
|
30
|
+
}
|
|
29
31
|
}, [
|
|
32
|
+
maskedInput,
|
|
33
|
+
milliseconds,
|
|
30
34
|
onCommit
|
|
31
35
|
]);
|
|
32
36
|
const handleKeyDown = useCallback((e)=>{
|
|
33
|
-
|
|
34
|
-
if (maskedInput)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else if ("Tab" === e.key) return;
|
|
45
|
-
else if ("Enter" === e.key) commitValue(e, maskedInput.value);
|
|
46
|
-
}
|
|
37
|
+
if (e.ctrlKey || e.metaKey || e.altKey || "Tab" === e.key) return;
|
|
38
|
+
if ("Backspace" === e.key) maskedInput.backspace();
|
|
39
|
+
else if (isDigit(e.key)) maskedInput.update(e.key);
|
|
40
|
+
else if ("ArrowLeft" === e.key) maskedInput.moveFocus("left");
|
|
41
|
+
else if ("ArrowRight" === e.key) maskedInput.moveFocus("right");
|
|
42
|
+
else if ("ArrowUp" === e.key) maskedInput.incrementValue();
|
|
43
|
+
else if ("ArrowDown" === e.key) maskedInput.decrementValue();
|
|
44
|
+
else if ("Home" === e.key) maskedInput.selectFirst();
|
|
45
|
+
else if ("End" === e.key) maskedInput.selectLast();
|
|
46
|
+
else if ("Enter" === e.key) commitValue(e);
|
|
47
|
+
else if ("Escape" === e.key) return;
|
|
47
48
|
e.preventDefault();
|
|
48
49
|
}, [
|
|
49
|
-
commitValue
|
|
50
|
+
commitValue,
|
|
51
|
+
maskedInput
|
|
50
52
|
]);
|
|
51
53
|
const handleDoubleClick = useCallback(()=>{
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
+
maskedInput.doubleClick();
|
|
55
|
+
}, [
|
|
56
|
+
maskedInput
|
|
57
|
+
]);
|
|
54
58
|
const handlePaste = useCallback((e)=>{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, [
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
maskedInput.pasteValue(e.clipboardData.getData("text"));
|
|
61
|
+
}, [
|
|
62
|
+
maskedInput
|
|
63
|
+
]);
|
|
58
64
|
const handleFocus = useCallback(()=>{
|
|
59
65
|
if (mousedDownRef.current) mousedDownRef.current = false;
|
|
60
|
-
else
|
|
61
|
-
}, [
|
|
66
|
+
else maskedInput.focus();
|
|
67
|
+
}, [
|
|
68
|
+
maskedInput
|
|
69
|
+
]);
|
|
62
70
|
const handleMouseDown = useCallback(()=>{
|
|
63
71
|
mousedDownRef.current = true;
|
|
64
72
|
}, []);
|
|
65
73
|
const handleMouseUp = useCallback((e)=>{
|
|
66
74
|
e.preventDefault();
|
|
67
|
-
|
|
68
|
-
}, [
|
|
75
|
+
maskedInput.click();
|
|
76
|
+
}, [
|
|
77
|
+
maskedInput
|
|
78
|
+
]);
|
|
69
79
|
return {
|
|
70
80
|
inputRef: setInputEl,
|
|
71
81
|
eventHandlers: {
|
|
72
|
-
onBlur:
|
|
82
|
+
onBlur: maskedInput.blur,
|
|
73
83
|
onDoubleClick: handleDoubleClick,
|
|
74
84
|
onFocus: handleFocus,
|
|
75
85
|
onKeyDown: handleKeyDown,
|
|
@@ -35,7 +35,7 @@ const css = `
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.vuuToolbarItem:focus, .vuuToolbarItem:focus-visible {
|
|
38
|
-
outline-color: var(--vuuToolbarItem-outlineColor, var(--vuu-color-purple
|
|
38
|
+
outline-color: var(--vuuToolbarItem-outlineColor, var(--vuu-color-purple));
|
|
39
39
|
outline-offset: 0px;
|
|
40
40
|
outline-width: 1px;
|
|
41
41
|
outline-style: dashed;
|
|
@@ -1,84 +1,78 @@
|
|
|
1
|
-
import { createElement, useCallback, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import { createElement, useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { EpochTimestamp, fromDateTimeFields } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { CalendarDate } from "@internationalized/date";
|
|
3
4
|
import clsx from "clsx";
|
|
4
5
|
import { DatePicker } from "../date-picker/index.js";
|
|
5
6
|
const classBase = "VuuDatePicker";
|
|
6
|
-
const isSameDate = (d1, d2)=>void 0 !== d2 && isSameDay(d1, d2) && isSameMonth(d1, d2) && isSameYear(d1, d2);
|
|
7
7
|
const datePattern = /^\d{1,2} [a-z]{3} \d{4}$/i;
|
|
8
|
-
const isValidDate = (value)=>void 0 !== value && value
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
datePickerKey: "uncontrolled",
|
|
19
|
-
defaultDate: void 0,
|
|
20
|
-
selectedDate
|
|
21
|
-
};
|
|
8
|
+
const isValidDate = (value)=>void 0 !== value && null !== value.match(datePattern) && !Number.isNaN(new Date(value).getDay());
|
|
9
|
+
const isSameDate = (d1, d2)=>void 0 !== d2 && 0 === d1.compare(d2);
|
|
10
|
+
const toCalendarDateInTimeZone = (value, timeZone)=>{
|
|
11
|
+
const timestamp = value instanceof EpochTimestamp ? value : EpochTimestamp.fromWire(value, "epochMillis");
|
|
12
|
+
if (timestamp) {
|
|
13
|
+
const { year, month, day } = timestamp.getFields(timeZone);
|
|
14
|
+
return new CalendarDate(year, month, day);
|
|
15
|
+
}
|
|
22
16
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const startOfDateInTimeZone = (date, timeZone)=>fromDateTimeFields({
|
|
18
|
+
year: date.year,
|
|
19
|
+
month: date.month,
|
|
20
|
+
day: date.day,
|
|
21
|
+
hour: 0,
|
|
22
|
+
minute: 0,
|
|
23
|
+
second: 0,
|
|
24
|
+
millisecond: 0
|
|
25
|
+
}, timeZone);
|
|
26
|
+
const VuuDatePicker = ({ className, onSelectionChange, onCommit, preserveFocusOnSelect, selectedDate: selectedDateProp, timeZone, value, ...props })=>{
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const inputValueRef = useRef("");
|
|
26
29
|
const datePickerRef = useRef(null);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const controlledDate = useMemo(()=>selectedDateProp ?? toCalendarDateInTimeZone(value, timeZone), [
|
|
31
|
+
selectedDateProp,
|
|
32
|
+
timeZone,
|
|
33
|
+
value
|
|
34
|
+
]);
|
|
35
|
+
const [selectedDate, setSelectedDate] = useState(controlledDate);
|
|
36
|
+
const controlledDateRef = useRef(controlledDate);
|
|
37
|
+
if (void 0 !== controlledDate && (void 0 === controlledDateRef.current || 0 !== controlledDate.compare(controlledDateRef.current))) {
|
|
38
|
+
controlledDateRef.current = controlledDate;
|
|
39
|
+
if (!isSameDate(controlledDate, selectedDate)) setSelectedDate(controlledDate);
|
|
40
|
+
}
|
|
32
41
|
const commitDateChange = useCallback((e, date)=>{
|
|
33
42
|
onSelectionChange?.(e, date);
|
|
34
43
|
setOpen(false);
|
|
35
|
-
onCommit?.(e,
|
|
44
|
+
onCommit?.(e, startOfDateInTimeZone(date, timeZone));
|
|
36
45
|
if (preserveFocusOnSelect) requestAnimationFrame(()=>{
|
|
37
46
|
datePickerRef.current?.querySelector("input")?.focus();
|
|
38
47
|
});
|
|
39
48
|
}, [
|
|
40
49
|
onCommit,
|
|
41
50
|
onSelectionChange,
|
|
42
|
-
preserveFocusOnSelect
|
|
51
|
+
preserveFocusOnSelect,
|
|
52
|
+
timeZone
|
|
43
53
|
]);
|
|
44
54
|
const handleSelectionChange = useCallback((e, date)=>{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
dateState.current = getDates(date);
|
|
49
|
-
commitDateChange(e, date);
|
|
50
|
-
} else if (!isSameDate(date, selectedDate)) {
|
|
51
|
-
dateState.current.selectedDate = date;
|
|
52
|
-
commitDateChange(e, date);
|
|
53
|
-
}
|
|
55
|
+
if (date && !isSameDate(date, selectedDate)) {
|
|
56
|
+
setSelectedDate(date);
|
|
57
|
+
commitDateChange(e, date);
|
|
54
58
|
}
|
|
55
59
|
}, [
|
|
56
|
-
commitDateChange
|
|
60
|
+
commitDateChange,
|
|
61
|
+
selectedDate
|
|
57
62
|
]);
|
|
58
|
-
const handleChange = (
|
|
59
|
-
|
|
60
|
-
evt,
|
|
61
|
-
value
|
|
62
|
-
});
|
|
63
|
-
valueRef.current = value;
|
|
64
|
-
console.log(`is '${value}' a valid date ? ${isValidDate(value)}`);
|
|
63
|
+
const handleChange = (_evt, value = "")=>{
|
|
64
|
+
inputValueRef.current = value;
|
|
65
65
|
};
|
|
66
66
|
const handleKeyDown = (e)=>{
|
|
67
67
|
if ("ArrowDown" === e.key) setOpen(true);
|
|
68
68
|
};
|
|
69
69
|
const handleKeyDownCapture = (e)=>{
|
|
70
|
-
if ("Enter" === e.key
|
|
71
|
-
else {
|
|
72
|
-
console.log(`nice try cowboy, but '${valueRef.current}' is nota valid date`);
|
|
73
|
-
e.stopPropagation();
|
|
74
|
-
}
|
|
70
|
+
if ("Enter" === e.key && "" !== inputValueRef.current && !isValidDate(inputValueRef.current)) e.stopPropagation();
|
|
75
71
|
};
|
|
76
|
-
const { datePickerKey, defaultDate, selectedDate } = dateState.current;
|
|
77
72
|
return /*#__PURE__*/ createElement(DatePicker, {
|
|
78
73
|
...props,
|
|
79
74
|
className: clsx(classBase, className),
|
|
80
|
-
|
|
81
|
-
key: datePickerKey,
|
|
75
|
+
key: selectedDate ? "controlled" : "uncontrolled",
|
|
82
76
|
open: open,
|
|
83
77
|
onChange: handleChange,
|
|
84
78
|
onKeyDown: handleKeyDown,
|
|
@@ -5,7 +5,7 @@ import clsx from "clsx";
|
|
|
5
5
|
import { TimeInput } from "../time-input/TimeInput.js";
|
|
6
6
|
import VuuTimePicker from "./VuuTimePicker.css";
|
|
7
7
|
const classBase = "vuuTimePicker";
|
|
8
|
-
const VuuTimePicker_VuuTimePicker = ({ className, defaultValue, onChange, onCommit, value, ...htmlAttributes })=>{
|
|
8
|
+
const VuuTimePicker_VuuTimePicker = ({ className, defaultValue, milliseconds, onChange, onCommit, value, ...htmlAttributes })=>{
|
|
9
9
|
const targetWindow = useWindow();
|
|
10
10
|
useComponentCssInjection({
|
|
11
11
|
testId: "vuu-time-picker",
|
|
@@ -16,10 +16,11 @@ const VuuTimePicker_VuuTimePicker = ({ className, defaultValue, onChange, onComm
|
|
|
16
16
|
...htmlAttributes,
|
|
17
17
|
className: clsx(classBase, className),
|
|
18
18
|
children: /*#__PURE__*/ jsx(TimeInput, {
|
|
19
|
-
defaultValue
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
defaultValue,
|
|
20
|
+
milliseconds,
|
|
21
|
+
onChange,
|
|
22
|
+
onCommit,
|
|
23
|
+
value
|
|
23
24
|
})
|
|
24
25
|
});
|
|
25
26
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* If component is a string, the component will be read from the
|
|
4
|
+
* comoponent registry. In that case, componentProps can be used
|
|
5
|
+
* to pass props to the component.
|
|
6
|
+
*/
|
|
2
7
|
export type ShowContextPanel = (component: string | ReactElement, title: string, componentProps?: unknown) => void;
|
|
3
8
|
export interface ContextPanelProps {
|
|
4
9
|
hideContextPanel?: () => void;
|
|
5
10
|
showContextPanel: ShowContextPanel;
|
|
6
11
|
}
|
|
7
|
-
export type ResolveContextPanelComponent = (component: string, componentProps?: unknown) => ReactElement;
|
|
8
12
|
export declare const ContextPanelContext: import("react").Context<ContextPanelProps>;
|
|
9
|
-
export declare const ContextPanelProvider: ({ children, hideContextPanel: hideContextPanelProp,
|
|
13
|
+
export declare const ContextPanelProvider: ({ children, hideContextPanel: hideContextPanelProp, showContextPanel: showContextPanelProp, }: Partial<ContextPanelProps> & {
|
|
10
14
|
children: ReactNode;
|
|
11
|
-
|
|
12
|
-
}) => import("react").JSX.Element;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
export declare function useContextPanel(): ShowContextPanel;
|
|
14
17
|
export declare function useHideContextPanel(): (() => void) | undefined;
|
|
@@ -27,7 +27,7 @@ export type MeasuredTarget = {
|
|
|
27
27
|
right: number;
|
|
28
28
|
top: number;
|
|
29
29
|
};
|
|
30
|
-
export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => import("react").JSX.Element;
|
|
30
|
+
export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export interface DragDropProviderResult {
|
|
32
32
|
isDragSource?: boolean;
|
|
33
33
|
isDropTarget?: boolean;
|
|
@@ -5,4 +5,4 @@ export interface HoverOverlayProps extends Pick<OverlayProps, "placement" | "onO
|
|
|
5
5
|
open?: boolean;
|
|
6
6
|
trigger: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const HoverOverlay: ({ children, open: openProp, onOpenChange, placement, trigger, }: HoverOverlayProps) => import("react").JSX.Element;
|
|
8
|
+
export declare const HoverOverlay: ({ children, open: openProp, onOpenChange, placement, trigger, }: HoverOverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
3
|
name: string;
|
|
4
4
|
size?: number;
|
|
5
5
|
}
|
|
6
|
-
export declare const Icon: ({ className, name, size, style: styleProp, ...htmlAttributes }: IconProps) => import("react").JSX.Element;
|
|
6
|
+
export declare const Icon: ({ className, name, size, style: styleProp, ...htmlAttributes }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,4 @@ import { IconButtonProps } from "./IconButton";
|
|
|
2
2
|
export interface ToggleIconButtonProps extends Omit<IconButtonProps, "icon"> {
|
|
3
3
|
isExpanded: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare const ToggleIconButton: ({ className, isExpanded, size, ...props }: ToggleIconButtonProps) => import("react").JSX.Element;
|
|
5
|
+
export declare const ToggleIconButton: ({ className, isExpanded, size, ...props }: ToggleIconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { HoverOverlay } from "./hover-overlay/HoverOverlay";
|
|
|
13
13
|
export * from "./icon-button";
|
|
14
14
|
export * from "./instrument-picker";
|
|
15
15
|
export { ItemPicker, type ItemPickerProps } from "./item-picker/ItemPicker";
|
|
16
|
-
export { type ItemDescriptor
|
|
16
|
+
export { type ItemDescriptor } from "./item-picker/useItemPicker";
|
|
17
17
|
export * from "./measured-container";
|
|
18
18
|
export { ModalProvider, useModal } from "./modal-provider/ModalProvider";
|
|
19
19
|
export * from "./overflow-container";
|
|
@@ -21,13 +21,14 @@ export * from "./price-ticker";
|
|
|
21
21
|
export { Prompt, type PromptProps } from "./prompt/Prompt";
|
|
22
22
|
export { SortableList, SortableOption } from "./sortable-list/SortableList";
|
|
23
23
|
export * from "./split-button";
|
|
24
|
+
export * from "./split-pane";
|
|
24
25
|
export * from "./table-search";
|
|
25
26
|
export * from "./tabs-next";
|
|
26
27
|
export * from "./tabstrip";
|
|
27
|
-
export { TimeInput, type TimeInputProps } from "./time-input/TimeInput";
|
|
28
|
+
export { TimeInput, type TimeInputMillisecondsProps, type TimeInputProps, type TimeInputSecondsProps, } from "./time-input/TimeInput";
|
|
28
29
|
export * from "./toolbar";
|
|
29
30
|
export * from "./utils";
|
|
30
31
|
export * from "./vuu-date-picker";
|
|
31
32
|
export * from "./vuu-input";
|
|
32
|
-
export { VuuTimePicker, type VuuTimePickerProps, } from "./vuu-time-picker/VuuTimePicker";
|
|
33
|
+
export { VuuTimePicker, type VuuTimePickerMillisecondsProps, type VuuTimePickerProps, type VuuTimePickerSecondsProps, } from "./vuu-time-picker/VuuTimePicker";
|
|
33
34
|
export * from "./vuu-typeahead-input";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
|
|
2
|
-
export declare const SearchCell: ({ column, dataRow }: TableCellRendererProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const SearchCell: ({ column, dataRow }: TableCellRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,4 +8,4 @@ export interface TablePickerProps extends Omit<HTMLAttributes<HTMLElement>, "onS
|
|
|
8
8
|
schema: TableSchema;
|
|
9
9
|
searchColumns?: string[];
|
|
10
10
|
}
|
|
11
|
-
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChangeEvent, KeyboardEventHandler, RefCallback } from "react";
|
|
1
2
|
import type { TableConfig, TableRowSelectHandler } from "@vuu-ui/vuu-table-types";
|
|
2
|
-
import { type ChangeEvent, type KeyboardEventHandler, type RefCallback } from "react";
|
|
3
3
|
import type { TablePickerProps } from "./TablePicker";
|
|
4
4
|
export interface TablePickerHookProps extends Pick<TablePickerProps, "TableProps" | "onSelect" | "rowToString" | "schema" | "searchColumns"> {
|
|
5
5
|
defaultIsOpen?: boolean;
|
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ListBoxProps } from "@salt-ds/core";
|
|
2
|
+
import { ItemTypeName } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
import { ItemDescriptor, ItemPickerHookProps } from "./useItemPicker";
|
|
5
5
|
export declare const classBaseListItem = "vuuItemPickerListItem";
|
|
6
|
-
export type ItemPickerLayout = 'v-available-selected' | 'v-selected-available';
|
|
7
6
|
export interface ItemPickerProps extends ItemPickerHookProps, HTMLAttributes<HTMLDivElement>, Pick<ListBoxProps<ItemDescriptor>, "selected" | "onSelectionChange"> {
|
|
8
|
-
|
|
9
|
-
SelectedListItem?: ComponentType<SelectedListItemProps>;
|
|
10
|
-
itemTypeName?: ItemTypeName;
|
|
11
|
-
/**
|
|
12
|
-
* Display order of SelectedItems List / AvailableItems List
|
|
13
|
-
*/
|
|
14
|
-
layout?: ItemPickerLayout;
|
|
15
|
-
searchForm?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface SelectedListItemProps extends OptionProps {
|
|
18
|
-
index: number;
|
|
19
|
-
item: ItemDescriptor;
|
|
20
|
-
onRemove: MouseEventHandler<HTMLButtonElement>;
|
|
21
|
-
searchPattern?: Lowercase<string>;
|
|
22
|
-
}
|
|
23
|
-
interface AvailableListItemProps extends OptionProps {
|
|
24
|
-
index: number;
|
|
25
|
-
item: ItemDescriptor;
|
|
26
|
-
onAdd: MouseEventHandler<HTMLButtonElement>;
|
|
27
|
-
searchPattern?: Lowercase<string>;
|
|
7
|
+
itemTypeName: ItemTypeName;
|
|
28
8
|
}
|
|
29
9
|
/** Generic controlled component that displays items in a 'picker' that are available to search, select, reorder or deselect.
|
|
30
10
|
* As input props, all available items, currently selected items, search text and callback functions for changes in selected items and search text
|
|
31
11
|
* must be supplied by the client.
|
|
32
12
|
*/
|
|
33
13
|
export declare const ItemPicker: import("react").ForwardRefExoticComponent<ItemPickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
-
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type SelectedItemsChangeHandler = (newSelectedItems: readonly ItemDescriptor[]) => void;
|
|
1
|
+
import { FormEventHandler, MouseEventHandler } from "react";
|
|
3
2
|
/** This is a public description of an Item that can be displayed in the ItemPicker component, defining all the
|
|
4
3
|
* mandatory and option attributes that can be defined by the client. */
|
|
5
4
|
export interface ItemDescriptor {
|
|
@@ -16,7 +15,7 @@ export interface ItemPickerHookProps {
|
|
|
16
15
|
allItems: ItemDescriptor[];
|
|
17
16
|
selectedItems: ItemDescriptor[];
|
|
18
17
|
maxSelections?: number;
|
|
19
|
-
onSelectedItemsChange:
|
|
18
|
+
onSelectedItemsChange: (newSelectedItems: readonly ItemDescriptor[]) => void;
|
|
20
19
|
}
|
|
21
20
|
export declare const getItemLabel: (item: ItemDescriptor) => string;
|
|
22
21
|
export declare const useItemPicker: ({ allItems, selectedItems, maxSelections, onSelectedItemsChange, }: ItemPickerHookProps) => {
|
|
@@ -25,7 +24,7 @@ export declare const useItemPicker: ({ allItems, selectedItems, maxSelections, o
|
|
|
25
24
|
selectedItemsFiltered: readonly ItemDescriptor[];
|
|
26
25
|
availableItemsFiltered: ItemDescriptor[];
|
|
27
26
|
searchText: string;
|
|
28
|
-
onChangeSearchInput:
|
|
27
|
+
onChangeSearchInput: FormEventHandler;
|
|
29
28
|
onAddItemToSelectedList: MouseEventHandler<HTMLButtonElement>;
|
|
30
29
|
onRemoveItemFromSelectedList: MouseEventHandler<HTMLButtonElement>;
|
|
31
30
|
onReorderSelectedItems: (orderedItemNames: string[]) => void;
|
|
@@ -4,7 +4,7 @@ export type ShowDialog = (dialogContent: ReactElement, title: string, dialogActi
|
|
|
4
4
|
export type ShowPrompt = (promptContent: ReactElement, promptProps: PromptProps) => void;
|
|
5
5
|
export declare const ModalProvider: ({ children }: {
|
|
6
6
|
children: ReactNode;
|
|
7
|
-
}) => import("react").JSX.Element;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const useModal: () => {
|
|
9
9
|
showDialog: ShowDialog;
|
|
10
10
|
closeDialog: () => void;
|
|
@@ -4,4 +4,4 @@ export interface PriceTickerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
price?: number;
|
|
5
5
|
showArrow?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const PriceTicker: import("react").MemoExoticComponent<({ className, decimals, price, showArrow, ...htmlAttributes }: PriceTickerProps) => import("react").JSX.Element>;
|
|
7
|
+
export declare const PriceTicker: import("react").MemoExoticComponent<({ className, decimals, price, showArrow, ...htmlAttributes }: PriceTickerProps) => import("react/jsx-runtime").JSX.Element>;
|
package/types/prompt/Prompt.d.ts
CHANGED
|
@@ -50,4 +50,4 @@ export interface PromptProps extends Pick<DialogProps, "disableDismiss" | "onOpe
|
|
|
50
50
|
showConfirmButton?: boolean;
|
|
51
51
|
title: string;
|
|
52
52
|
}
|
|
53
|
-
export declare const Prompt: ({ children, className, cancelButtonLabel, cancelButtonProps, confirmButtonLabel, confirmButtonProps, customAction, disableDismiss, disableAccent, headerTag, icon, initialFocusedItem, onCancel, onClose, onConfirm, onOpenChange, open, showCancelButton, showCloseButton, showConfirmButton, status, title, ...htmlAttributes }: PromptProps) => import("react").JSX.Element;
|
|
53
|
+
export declare const Prompt: ({ children, className, cancelButtonLabel, cancelButtonProps, confirmButtonLabel, confirmButtonProps, customAction, disableDismiss, disableAccent, headerTag, icon, initialFocusedItem, onCancel, onClose, onConfirm, onOpenChange, open, showCancelButton, showCloseButton, showConfirmButton, status, title, ...htmlAttributes }: PromptProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { ListBoxProps, OptionProps } from "@salt-ds/core";
|
|
|
2
2
|
export declare const SortableOption: ({ id, index, value, ...optionProps }: OptionProps & {
|
|
3
3
|
id: string;
|
|
4
4
|
index: number;
|
|
5
|
-
}) => import("react").JSX.Element;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const SortableList: ({ children, onReorderListItems, ...listBoxProps }: ListBoxProps & {
|
|
7
7
|
onReorderListItems?: (listItems: unknown[]) => void;
|
|
8
|
-
}) => import("react").JSX.Element;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,18 +27,18 @@ export declare const useSplitButton: ({ ButtonProps: ButtonPropsProp, PopupMenuP
|
|
|
27
27
|
onFocusCapture?: FocusEventHandler<HTMLButtonElement> | undefined;
|
|
28
28
|
onBlur?: FocusEventHandler<HTMLButtonElement> | undefined;
|
|
29
29
|
onBlurCapture?: FocusEventHandler<HTMLButtonElement> | undefined;
|
|
30
|
-
onChange?: import("react").
|
|
31
|
-
onChangeCapture?: import("react").
|
|
30
|
+
onChange?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
31
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
32
32
|
onBeforeInput?: import("react").InputEventHandler<HTMLButtonElement> | undefined;
|
|
33
|
-
onBeforeInputCapture?: import("react").
|
|
34
|
-
onInput?: import("react").
|
|
35
|
-
onInputCapture?: import("react").
|
|
36
|
-
onReset?: import("react").
|
|
37
|
-
onResetCapture?: import("react").
|
|
38
|
-
onSubmit?: import("react").
|
|
39
|
-
onSubmitCapture?: import("react").
|
|
40
|
-
onInvalid?: import("react").
|
|
41
|
-
onInvalidCapture?: import("react").
|
|
33
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
34
|
+
onInput?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
35
|
+
onInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
36
|
+
onReset?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
37
|
+
onResetCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
38
|
+
onSubmit?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
39
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
40
|
+
onInvalid?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
41
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
|
|
42
42
|
onLoad?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
|
|
43
43
|
onLoadCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
|
|
44
44
|
onError?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
|
|
@@ -277,7 +277,7 @@ export declare const useSplitButton: ({ ButtonProps: ButtonPropsProp, PopupMenuP
|
|
|
277
277
|
results?: number | undefined;
|
|
278
278
|
security?: string | undefined;
|
|
279
279
|
unselectable?: "on" | "off" | undefined;
|
|
280
|
-
popover?: "" | "auto" | "manual" |
|
|
280
|
+
popover?: "" | "auto" | "manual" | undefined;
|
|
281
281
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
282
282
|
popoverTarget?: string | undefined;
|
|
283
283
|
inert?: boolean | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type FlexAlignment, type FlexContentAlignment, type ResponsiveProp } from "@salt-ds/core";
|
|
2
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
|
|
3
|
+
import { type SplitPaneDirection, type SplitterMovedHandler } from "./useSplitPane";
|
|
4
|
+
export interface SplitPaneProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
5
|
+
/**
|
|
6
|
+
* Defines the default behavior for how flex items are laid out along the cross axis, default is "stretch".
|
|
7
|
+
*/
|
|
8
|
+
align?: FlexAlignment | "stretch" | "baseline";
|
|
9
|
+
/**
|
|
10
|
+
* Exactly two children, typically Salt `FlexItem` components. A Splitter
|
|
11
|
+
* will be rendered between them. A single child is also accepted (e.g. when
|
|
12
|
+
* one pane is conditionally rendered), in which case no Splitter is rendered.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactElement | [ReactNode, ReactNode];
|
|
15
|
+
/**
|
|
16
|
+
* Establishes the main-axis, defining the direction children are placed. Default is "row".
|
|
17
|
+
*/
|
|
18
|
+
direction?: ResponsiveProp<SplitPaneDirection>;
|
|
19
|
+
/**
|
|
20
|
+
* Controls the space between each item and the Splitter, default is 0.
|
|
21
|
+
*/
|
|
22
|
+
gap?: ResponsiveProp<number | string>;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the alignment along the main axis, default is "start".
|
|
25
|
+
*/
|
|
26
|
+
justify?: FlexContentAlignment;
|
|
27
|
+
/**
|
|
28
|
+
* Defines the margin around the component. It can be specified as a number (which acts as a multiplier) or a string representing the margin value. Default is `0`.
|
|
29
|
+
*/
|
|
30
|
+
margin?: ResponsiveProp<number | string>;
|
|
31
|
+
/**
|
|
32
|
+
* Invoked when user has finished moving the Splitter, receives the new sizes (px) of both panes.
|
|
33
|
+
*/
|
|
34
|
+
onSplitterMoved?: SplitterMovedHandler;
|
|
35
|
+
/**
|
|
36
|
+
* Defines the padding within the component. It can be specified as a number (which acts as a multiplier) or a string representing the padding value. Default is `0`.
|
|
37
|
+
*/
|
|
38
|
+
padding?: ResponsiveProp<number | string>;
|
|
39
|
+
/**
|
|
40
|
+
* Size (thickness) of the Splitter, in px. Default is 3.
|
|
41
|
+
*/
|
|
42
|
+
splitterSize?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const SplitPane: import("react").ForwardRefExoticComponent<SplitPaneProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import type { SplitPaneDirection } from "./useSplitPane";
|
|
3
|
+
export interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElement>, "onResize"> {
|
|
4
|
+
direction: SplitPaneDirection;
|
|
5
|
+
onResizeStart: () => boolean;
|
|
6
|
+
onResize: (distance: number) => void;
|
|
7
|
+
onResizeEnd: () => void;
|
|
8
|
+
position?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const Splitter: ({ className, direction, onResize, onResizeEnd, onResizeStart, position, ...htmlAttributes }: SplitterProps) => import("react/jsx-runtime").JSX.Element;
|