@dreamtree-org/twreact-ui 1.3.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -6
- package/ai-skills/dreamtree-ui.md +58 -15
- package/codemods/v2.cjs +198 -0
- package/dist/ai-schema.json +745 -53
- package/dist/charts/index.js +195 -66
- package/dist/components/blocks/AppShell.d.ts.map +1 -1
- package/dist/components/blocks/BottomActionBar.d.ts +6 -0
- package/dist/components/blocks/BottomActionBar.d.ts.map +1 -0
- package/dist/components/blocks/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/blocks/PageHeader.d.ts.map +1 -1
- package/dist/components/charts/CartesianChart.d.ts.map +1 -1
- package/dist/components/charts/ChartFrame.d.ts.map +1 -1
- package/dist/components/charts/useChartLayout.d.ts +25 -0
- package/dist/components/charts/useChartLayout.d.ts.map +1 -0
- package/dist/components/core/Button.d.ts.map +1 -1
- package/dist/components/core/Checkbox.d.ts.map +1 -1
- package/dist/components/core/ColorPicker.d.ts.map +1 -1
- package/dist/components/core/DatePicker.d.ts.map +1 -1
- package/dist/components/core/DateRangePicker.d.ts.map +1 -1
- package/dist/components/core/Form.d.ts.map +1 -1
- package/dist/components/core/Input.d.ts.map +1 -1
- package/dist/components/core/Loader.d.ts.map +1 -1
- package/dist/components/core/LocationPicker.d.ts.map +1 -1
- package/dist/components/core/Popover.d.ts.map +1 -1
- package/dist/components/core/ProgressBar.d.ts.map +1 -1
- package/dist/components/core/Radio.d.ts.map +1 -1
- package/dist/components/core/Rate.d.ts.map +1 -1
- package/dist/components/core/RoundedTag.d.ts.map +1 -1
- package/dist/components/core/SearchField.d.ts +9 -0
- package/dist/components/core/SearchField.d.ts.map +1 -0
- package/dist/components/core/SegmentedControl.d.ts +8 -0
- package/dist/components/core/SegmentedControl.d.ts.map +1 -0
- package/dist/components/core/Select.d.ts.map +1 -1
- package/dist/components/core/Skeleton.d.ts.map +1 -1
- package/dist/components/core/Slider.d.ts.map +1 -1
- package/dist/components/core/SpeechToText.d.ts.map +1 -1
- package/dist/components/core/SwipeableListItem.d.ts +4 -0
- package/dist/components/core/SwipeableListItem.d.ts.map +1 -0
- package/dist/components/core/SwipeableListItemGesture.d.ts +58 -0
- package/dist/components/core/SwipeableListItemGesture.d.ts.map +1 -0
- package/dist/components/core/Switch.d.ts.map +1 -1
- package/dist/components/core/Table/ActionMenu.d.ts +10 -3
- package/dist/components/core/Table/ActionMenu.d.ts.map +1 -1
- package/dist/components/core/Table/MobileCard.d.ts +10 -1
- package/dist/components/core/Table/MobileCard.d.ts.map +1 -1
- package/dist/components/core/Table/MobileFilters.d.ts +8 -2
- package/dist/components/core/Table/MobileFilters.d.ts.map +1 -1
- package/dist/components/core/Table/Table.d.ts.map +1 -1
- package/dist/components/core/Table/TableRow.d.ts +2 -1
- package/dist/components/core/Table/TableRow.d.ts.map +1 -1
- package/dist/components/core/Tabs.d.ts +5 -8
- package/dist/components/core/Tabs.d.ts.map +1 -1
- package/dist/components/core/Textarea.d.ts.map +1 -1
- package/dist/components/core/ThreeDotPopover.d.ts +10 -22
- package/dist/components/core/ThreeDotPopover.d.ts.map +1 -1
- package/dist/components/core/Tooltip.d.ts +2 -1
- package/dist/components/core/Tooltip.d.ts.map +1 -1
- package/dist/components/core/internal/Calendar.d.ts +77 -0
- package/dist/components/core/internal/Calendar.d.ts.map +1 -0
- package/dist/components/core/menu/ActionMenuSurface.d.ts +42 -0
- package/dist/components/core/menu/ActionMenuSurface.d.ts.map +1 -0
- package/dist/components/core/menu/ActionSheetMenu.d.ts +17 -0
- package/dist/components/core/menu/ActionSheetMenu.d.ts.map +1 -0
- package/dist/components/core/menu/MenuPopover.d.ts +21 -0
- package/dist/components/core/menu/MenuPopover.d.ts.map +1 -0
- package/dist/components/core/menu/menuItems.d.ts +21 -0
- package/dist/components/core/menu/menuItems.d.ts.map +1 -0
- package/dist/components/core/menu/menuKeyboard.d.ts +16 -0
- package/dist/components/core/menu/menuKeyboard.d.ts.map +1 -0
- package/dist/components/feedback/ActionSheet.d.ts +4 -0
- package/dist/components/feedback/ActionSheet.d.ts.map +1 -0
- package/dist/components/feedback/Alert.d.ts.map +1 -1
- package/dist/components/feedback/Dialog.d.ts.map +1 -1
- package/dist/components/feedback/Drawer.d.ts.map +1 -1
- package/dist/components/feedback/Sheet.d.ts +4 -0
- package/dist/components/feedback/Sheet.d.ts.map +1 -0
- package/dist/components/feedback/Toast.d.ts +4 -3
- package/dist/components/feedback/Toast.d.ts.map +1 -1
- package/dist/components/feedback/ToastItem.d.ts +47 -0
- package/dist/components/feedback/ToastItem.d.ts.map +1 -0
- package/dist/components/feedback/ToastStack.d.ts +20 -0
- package/dist/components/feedback/ToastStack.d.ts.map +1 -0
- package/dist/components/feedback/ToastSwipe.d.ts +22 -0
- package/dist/components/feedback/ToastSwipe.d.ts.map +1 -0
- package/dist/components/feedback/Tour.d.ts.map +1 -1
- package/dist/components/feedback/sheetCore.d.ts +30 -0
- package/dist/components/feedback/sheetCore.d.ts.map +1 -0
- package/dist/components/navigation/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/navigation/FootNav.d.ts.map +1 -1
- package/dist/components/navigation/Navbar.d.ts.map +1 -1
- package/dist/components/navigation/Sidebar.d.ts +6 -0
- package/dist/components/navigation/Sidebar.d.ts.map +1 -1
- package/dist/components/rich-text/RichTextEditor.d.ts.map +1 -1
- package/dist/components/rich-text/RichTextToolbar.d.ts +6 -2
- package/dist/components/rich-text/RichTextToolbar.d.ts.map +1 -1
- package/dist/components/utility/Avatar.d.ts +8 -0
- package/dist/components/utility/Avatar.d.ts.map +1 -1
- package/dist/components/utility/AvatarGroup.d.ts +4 -0
- package/dist/components/utility/AvatarGroup.d.ts.map +1 -0
- package/dist/components/utility/Badge.d.ts.map +1 -1
- package/dist/components/utility/Card.d.ts.map +1 -1
- package/dist/components/utility/Carousel.d.ts.map +1 -1
- package/dist/components/utility/FileUpload.d.ts.map +1 -1
- package/dist/components/utility/Pagination.d.ts.map +1 -1
- package/dist/components/utility/PullToRefresh.d.ts +5 -0
- package/dist/components/utility/PullToRefresh.d.ts.map +1 -0
- package/dist/components/utility/Sortable.d.ts.map +1 -1
- package/dist/components/utility/Stepper.d.ts.map +1 -1
- package/dist/esm/components/blocks/AppShell.js +97 -90
- package/dist/esm/components/blocks/BottomActionBar.js +132 -0
- package/dist/esm/components/blocks/ConfirmDialog.js +40 -4
- package/dist/esm/components/blocks/EmptyState.js +1 -1
- package/dist/esm/components/blocks/ErrorState.js +1 -1
- package/dist/esm/components/blocks/LoadingState.js +4 -4
- package/dist/esm/components/blocks/PageHeader.js +16 -3
- package/dist/esm/components/blocks/StatCard.js +6 -6
- package/dist/esm/components/blocks/StatusPill.js +5 -8
- package/dist/esm/components/charts/CartesianChart.js +85 -62
- package/dist/esm/components/charts/ChartFrame.js +12 -5
- package/dist/esm/components/charts/useChartLayout.js +105 -0
- package/dist/esm/components/core/Button.js +49 -25
- package/dist/esm/components/core/Checkbox.js +72 -57
- package/dist/esm/components/core/ColorPicker.js +31 -42
- package/dist/esm/components/core/DatePicker.js +117 -304
- package/dist/esm/components/core/DateRangePicker.js +260 -308
- package/dist/esm/components/core/Form.js +11 -2
- package/dist/esm/components/core/Input.js +100 -38
- package/dist/esm/components/core/Loader.js +30 -44
- package/dist/esm/components/core/LocationPicker.js +82 -16
- package/dist/esm/components/core/Popover.js +59 -48
- package/dist/esm/components/core/ProgressBar.js +40 -72
- package/dist/esm/components/core/Radio.js +10 -12
- package/dist/esm/components/core/Rate.js +77 -14
- package/dist/esm/components/core/RoundedTag.js +5 -5
- package/dist/esm/components/core/SearchField.js +311 -0
- package/dist/esm/components/core/SegmentedControl.js +189 -0
- package/dist/esm/components/core/Select.js +185 -190
- package/dist/esm/components/core/Skeleton.js +13 -14
- package/dist/esm/components/core/Slider.js +24 -6
- package/dist/esm/components/core/SpeechToText.js +68 -16
- package/dist/esm/components/core/SwipeableListItem.js +286 -0
- package/dist/esm/components/core/SwipeableListItemGesture.js +219 -0
- package/dist/esm/components/core/Switch.js +98 -28
- package/dist/esm/components/core/Table/ActionMenu.js +45 -231
- package/dist/esm/components/core/Table/ColumnMenu.js +1 -1
- package/dist/esm/components/core/Table/MobileCard.js +66 -16
- package/dist/esm/components/core/Table/MobileFilters.js +181 -10
- package/dist/esm/components/core/Table/Table.js +149 -102
- package/dist/esm/components/core/Table/TableRow.js +10 -2
- package/dist/esm/components/core/Tabs.js +186 -39
- package/dist/esm/components/core/Textarea.js +10 -2
- package/dist/esm/components/core/ThreeDotPopover.js +93 -99
- package/dist/esm/components/core/Tooltip.js +138 -145
- package/dist/esm/components/core/internal/Calendar.js +381 -0
- package/dist/esm/components/core/menu/ActionMenuSurface.js +110 -0
- package/dist/esm/components/core/menu/ActionSheetMenu.js +140 -0
- package/dist/esm/components/core/menu/MenuPopover.js +177 -0
- package/dist/esm/components/core/menu/menuItems.js +61 -0
- package/dist/esm/components/core/menu/menuKeyboard.js +54 -0
- package/dist/esm/components/feedback/ActionSheet.js +55 -0
- package/dist/esm/components/feedback/Alert.js +63 -53
- package/dist/esm/components/feedback/Dialog.js +141 -53
- package/dist/esm/components/feedback/Drawer.js +130 -132
- package/dist/esm/components/feedback/Sheet.js +125 -0
- package/dist/esm/components/feedback/Toast.js +21 -291
- package/dist/esm/components/feedback/ToastItem.js +348 -0
- package/dist/esm/components/feedback/ToastStack.js +130 -0
- package/dist/esm/components/feedback/ToastSwipe.js +52 -0
- package/dist/esm/components/feedback/Tour.js +107 -30
- package/dist/esm/components/feedback/sheetCore.js +494 -0
- package/dist/esm/components/navigation/Breadcrumbs.js +97 -35
- package/dist/esm/components/navigation/Dropdown.js +1 -1
- package/dist/esm/components/navigation/FootNav.js +102 -13
- package/dist/esm/components/navigation/Navbar.js +172 -37
- package/dist/esm/components/navigation/Sidebar.js +263 -111
- package/dist/esm/components/rich-text/RichTextEditor.js +9 -3
- package/dist/esm/components/rich-text/RichTextToolbar.js +29 -9
- package/dist/esm/components/utility/Avatar.js +14 -12
- package/dist/esm/components/utility/AvatarGroup.js +56 -0
- package/dist/esm/components/utility/Badge.js +43 -23
- package/dist/esm/components/utility/Card.js +32 -8
- package/dist/esm/components/utility/Carousel.js +139 -29
- package/dist/esm/components/utility/FileUpload.js +106 -31
- package/dist/esm/components/utility/Pagination.js +31 -13
- package/dist/esm/components/utility/Portal.js +31 -0
- package/dist/esm/components/utility/PullToRefresh.js +229 -0
- package/dist/esm/components/utility/Sortable.js +6 -2
- package/dist/esm/components/utility/Stepper.js +110 -47
- package/dist/esm/hooks/useFloatingPosition.js +82 -0
- package/dist/esm/hooks/useHaptics.js +65 -0
- package/dist/esm/hooks/usePresence.js +58 -0
- package/dist/esm/hooks/usePresentation.js +21 -0
- package/dist/esm/hooks/useSheetDrag.js +220 -0
- package/dist/esm/hooks/useSliderValues.js +8 -2
- package/dist/esm/hooks/useSortable.js +107 -5
- package/dist/esm/index.js +14 -2
- package/dist/esm/utils/position.js +10 -63
- package/dist/esm/utils/touchTarget.js +4 -1
- package/dist/hooks/useFloatingPosition.d.ts +8 -4
- package/dist/hooks/useFloatingPosition.d.ts.map +1 -1
- package/dist/hooks/useHaptics.d.ts +19 -0
- package/dist/hooks/useHaptics.d.ts.map +1 -0
- package/dist/hooks/useSheetDrag.d.ts +31 -0
- package/dist/hooks/useSheetDrag.d.ts.map +1 -0
- package/dist/hooks/useSliderValues.d.ts +6 -2
- package/dist/hooks/useSliderValues.d.ts.map +1 -1
- package/dist/hooks/useSortable.d.ts +11 -1
- package/dist/hooks/useSortable.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +10645 -3842
- package/dist/index.js +10657 -3845
- package/dist/rich-text/index.js +41 -11
- package/dist/types/blocks.d.ts +32 -2
- package/dist/types/blocks.d.ts.map +1 -1
- package/dist/types/charts.d.ts +3 -1
- package/dist/types/charts.d.ts.map +1 -1
- package/dist/types/index.d.ts +409 -26
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rich-text.d.ts +5 -0
- package/dist/types/rich-text.d.ts.map +1 -1
- package/dist/utils/position.d.ts +0 -15
- package/dist/utils/position.d.ts.map +1 -1
- package/doc/README.md +16 -0
- package/mcp/catalog.snapshot.json +1540 -407
- package/package.json +7 -2
- package/dist/esm/hooks/useSwipeToClose.js +0 -66
- package/dist/hooks/useSwipeToClose.d.ts +0 -24
- package/dist/hooks/useSwipeToClose.d.ts.map +0 -1
|
@@ -91,13 +91,17 @@ function useSliderValues(_ref3) {
|
|
|
91
91
|
setThumb: setThumb
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Pointer drag on the track: picks the nearest thumb and follows the pointer.
|
|
96
|
+
* `onActiveChange(index | null)` reports which thumb is being dragged.
|
|
97
|
+
*/
|
|
95
98
|
function useSliderPointer(_ref4) {
|
|
96
99
|
var trackRef = _ref4.trackRef,
|
|
97
100
|
values = _ref4.values,
|
|
98
101
|
setThumb = _ref4.setThumb,
|
|
99
102
|
bounds = _ref4.bounds,
|
|
100
|
-
disabled = _ref4.disabled
|
|
103
|
+
disabled = _ref4.disabled,
|
|
104
|
+
onActiveChange = _ref4.onActiveChange;
|
|
101
105
|
var active = useRef(null);
|
|
102
106
|
var toValue = function toValue(clientX) {
|
|
103
107
|
var rect = trackRef.current.getBoundingClientRect();
|
|
@@ -112,6 +116,7 @@ function useSliderPointer(_ref4) {
|
|
|
112
116
|
return Math.abs(v - raw) < Math.abs(values[best] - raw) || v === values[best] && raw > v ? i : best;
|
|
113
117
|
}, 0);
|
|
114
118
|
active.current = nearest;
|
|
119
|
+
onActiveChange === null || onActiveChange === void 0 || onActiveChange(nearest);
|
|
115
120
|
(_e$currentTarget$setP = (_e$currentTarget = e.currentTarget).setPointerCapture) === null || _e$currentTarget$setP === void 0 || _e$currentTarget$setP.call(_e$currentTarget, e.pointerId);
|
|
116
121
|
setThumb(nearest, raw);
|
|
117
122
|
(_e$currentTarget$quer = e.currentTarget.querySelectorAll('[role="slider"]')[nearest]) === null || _e$currentTarget$quer === void 0 || _e$currentTarget$quer.focus();
|
|
@@ -123,6 +128,7 @@ function useSliderPointer(_ref4) {
|
|
|
123
128
|
if (active.current === null) return;
|
|
124
129
|
setThumb(active.current, toValue(e.clientX), true);
|
|
125
130
|
active.current = null;
|
|
131
|
+
onActiveChange === null || onActiveChange === void 0 || onActiveChange(null);
|
|
126
132
|
};
|
|
127
133
|
return {
|
|
128
134
|
onPointerDown: onPointerDown,
|
|
@@ -91,7 +91,45 @@ function useSortableKeyboard(_ref) {
|
|
|
91
91
|
cancel: cancel
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
+
// Mouse / pen: a drag starts once the pointer has moved this far, so clicks inside
|
|
95
|
+
// items still work.
|
|
94
96
|
var DRAG_THRESHOLD = 4;
|
|
97
|
+
// Touch: a drag starts after holding still this long, so a swipe over the list
|
|
98
|
+
// still scrolls the page. Moving further than LONG_PRESS_TOLERANCE first cancels it.
|
|
99
|
+
var LONG_PRESS_DELAY = 250;
|
|
100
|
+
var LONG_PRESS_TOLERANCE = 8;
|
|
101
|
+
// While dragging within this many px of a scroll container's (or the viewport's)
|
|
102
|
+
// edge, the container scrolls; speed grows toward the edge up to AUTO_SCROLL_MAX px/frame.
|
|
103
|
+
var AUTO_SCROLL_EDGE = 40;
|
|
104
|
+
var AUTO_SCROLL_MAX = 16;
|
|
105
|
+
var isScrollable = function isScrollable(el, axis) {
|
|
106
|
+
var style = window.getComputedStyle(el);
|
|
107
|
+
var overflow = axis === "horizontal" ? style.overflowX : style.overflowY;
|
|
108
|
+
if (!/(auto|scroll|overlay)/.test(overflow)) return false;
|
|
109
|
+
return axis === "horizontal" ? el.scrollWidth > el.clientWidth : el.scrollHeight > el.clientHeight;
|
|
110
|
+
};
|
|
111
|
+
/** Nearest scrollable ancestor along `axis`, or `null` for the window. */
|
|
112
|
+
function getScrollParent(node, axis) {
|
|
113
|
+
var el = node === null || node === void 0 ? void 0 : node.parentElement;
|
|
114
|
+
while (el && el !== document.body && el !== document.documentElement) {
|
|
115
|
+
if (isScrollable(el, axis)) return el;
|
|
116
|
+
el = el.parentElement;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/** Scroll speed (px/frame, signed) for a coordinate near the [start, end] edges. */
|
|
121
|
+
function edgeSpeed(pos, start, end) {
|
|
122
|
+
var edge = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : AUTO_SCROLL_EDGE;
|
|
123
|
+
if (pos < start + edge) return -Math.ceil(AUTO_SCROLL_MAX * Math.min(1, (start + edge - pos) / edge));
|
|
124
|
+
if (pos > end - edge) return Math.ceil(AUTO_SCROLL_MAX * Math.min(1, (pos - (end - edge)) / edge));
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
var raf = function raf(cb) {
|
|
128
|
+
return typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(cb) : setTimeout(cb, 16);
|
|
129
|
+
};
|
|
130
|
+
var caf = function caf(id) {
|
|
131
|
+
return typeof window.cancelAnimationFrame === "function" ? window.cancelAnimationFrame(id) : clearTimeout(id);
|
|
132
|
+
};
|
|
95
133
|
function useSortablePointer(_ref2) {
|
|
96
134
|
var keys = _ref2.keys,
|
|
97
135
|
setDraft = _ref2.setDraft,
|
|
@@ -134,7 +172,12 @@ function useSortablePointer(_ref2) {
|
|
|
134
172
|
});
|
|
135
173
|
return index === -1 ? others.length : index;
|
|
136
174
|
};
|
|
175
|
+
// `longPress`: on touch, wait LONG_PRESS_DELAY before picking the item up (used
|
|
176
|
+
// when the whole item is the drag source, so the list still scrolls on swipe).
|
|
137
177
|
var startFor = function startFor(key) {
|
|
178
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
179
|
+
_ref3$longPress = _ref3.longPress,
|
|
180
|
+
longPress = _ref3$longPress === void 0 ? false : _ref3$longPress;
|
|
138
181
|
return function (e) {
|
|
139
182
|
if (disabled || e.button > 0) return;
|
|
140
183
|
var start = {
|
|
@@ -142,18 +185,59 @@ function useSortablePointer(_ref2) {
|
|
|
142
185
|
y: e.clientY
|
|
143
186
|
};
|
|
144
187
|
var from = latest.current.keys.indexOf(key);
|
|
188
|
+
var waitForPress = longPress && e.pointerType === "touch";
|
|
145
189
|
var active = false;
|
|
190
|
+
var point = start;
|
|
191
|
+
var pressTimer = null;
|
|
192
|
+
var frame = null;
|
|
193
|
+
var scrollTarget = function scrollTarget() {
|
|
194
|
+
return getScrollParent(latest.current.nodeFor(key), latest.current.orientation);
|
|
195
|
+
};
|
|
196
|
+
var _autoScroll = function autoScroll() {
|
|
197
|
+
frame = null;
|
|
198
|
+
if (!active) return;
|
|
199
|
+
var axis = latest.current.orientation;
|
|
200
|
+
var container = scrollTarget();
|
|
201
|
+
var rect = container ? container.getBoundingClientRect() : {
|
|
202
|
+
top: 0,
|
|
203
|
+
left: 0,
|
|
204
|
+
bottom: window.innerHeight,
|
|
205
|
+
right: window.innerWidth
|
|
206
|
+
};
|
|
207
|
+
var speed = axis === "horizontal" ? edgeSpeed(point.x, rect.left, rect.right) : edgeSpeed(point.y, rect.top, rect.bottom);
|
|
208
|
+
if (!speed) return;
|
|
209
|
+
var dx = axis === "horizontal" ? speed : 0;
|
|
210
|
+
var dy = axis === "horizontal" ? 0 : speed;
|
|
211
|
+
if (container) {
|
|
212
|
+
container.scrollLeft += dx;
|
|
213
|
+
container.scrollTop += dy;
|
|
214
|
+
} else if (typeof window.scrollBy === "function") {
|
|
215
|
+
window.scrollBy(dx, dy);
|
|
216
|
+
}
|
|
217
|
+
setDraft(moveKey(latest.current.keys, key, targetIndex(point, key)));
|
|
218
|
+
frame = raf(_autoScroll);
|
|
219
|
+
};
|
|
220
|
+
var activate = function activate() {
|
|
221
|
+
active = true;
|
|
222
|
+
setDragging(key);
|
|
223
|
+
};
|
|
146
224
|
var onMove = function onMove(ev) {
|
|
147
|
-
|
|
225
|
+
point = {
|
|
148
226
|
x: ev.clientX,
|
|
149
227
|
y: ev.clientY
|
|
150
228
|
};
|
|
151
|
-
|
|
229
|
+
var distance = Math.hypot(point.x - start.x, point.y - start.y);
|
|
152
230
|
if (!active) {
|
|
153
|
-
|
|
154
|
-
|
|
231
|
+
if (waitForPress) {
|
|
232
|
+
// Finger moved before the long-press fired: it's a scroll, not a drag.
|
|
233
|
+
if (distance > LONG_PRESS_TOLERANCE) end();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (distance < DRAG_THRESHOLD) return;
|
|
237
|
+
activate();
|
|
155
238
|
}
|
|
156
239
|
setDraft(moveKey(latest.current.keys, key, targetIndex(point, key)));
|
|
240
|
+
if (frame === null) frame = raf(_autoScroll);
|
|
157
241
|
};
|
|
158
242
|
var onUp = function onUp() {
|
|
159
243
|
end();
|
|
@@ -163,18 +247,36 @@ function useSortablePointer(_ref2) {
|
|
|
163
247
|
};
|
|
164
248
|
var onCancel = function onCancel() {
|
|
165
249
|
end();
|
|
250
|
+
if (!active) return;
|
|
166
251
|
setDragging(null);
|
|
167
252
|
setDraft(null);
|
|
168
253
|
};
|
|
254
|
+
// Once a touch drag is live, stop the browser from scrolling (and from firing
|
|
255
|
+
// pointercancel); before that, let the page scroll normally.
|
|
256
|
+
var onTouchMove = function onTouchMove(ev) {
|
|
257
|
+
if (active && ev.cancelable) ev.preventDefault();
|
|
258
|
+
};
|
|
259
|
+
var onContextMenu = function onContextMenu(ev) {
|
|
260
|
+
if (waitForPress) ev.preventDefault();
|
|
261
|
+
};
|
|
169
262
|
end();
|
|
263
|
+
if (waitForPress) pressTimer = setTimeout(activate, LONG_PRESS_DELAY);
|
|
170
264
|
window.addEventListener("pointermove", onMove);
|
|
171
265
|
window.addEventListener("pointerup", onUp);
|
|
172
266
|
window.addEventListener("pointercancel", onCancel);
|
|
267
|
+
window.addEventListener("touchmove", onTouchMove, {
|
|
268
|
+
passive: false
|
|
269
|
+
});
|
|
270
|
+
window.addEventListener("contextmenu", onContextMenu);
|
|
173
271
|
session.current = {
|
|
174
272
|
detach: function detach() {
|
|
273
|
+
if (pressTimer !== null) clearTimeout(pressTimer);
|
|
274
|
+
if (frame !== null) caf(frame);
|
|
175
275
|
window.removeEventListener("pointermove", onMove);
|
|
176
276
|
window.removeEventListener("pointerup", onUp);
|
|
177
277
|
window.removeEventListener("pointercancel", onCancel);
|
|
278
|
+
window.removeEventListener("touchmove", onTouchMove);
|
|
279
|
+
window.removeEventListener("contextmenu", onContextMenu);
|
|
178
280
|
}
|
|
179
281
|
};
|
|
180
282
|
};
|
|
@@ -185,4 +287,4 @@ function useSortablePointer(_ref2) {
|
|
|
185
287
|
};
|
|
186
288
|
}
|
|
187
289
|
|
|
188
|
-
export { DEFAULT_SORTABLE_MESSAGES, moveKey, useSortableKeyboard, useSortablePointer };
|
|
290
|
+
export { AUTO_SCROLL_EDGE, DEFAULT_SORTABLE_MESSAGES, DRAG_THRESHOLD, LONG_PRESS_DELAY, LONG_PRESS_TOLERANCE, edgeSpeed, getScrollParent, moveKey, useSortableKeyboard, useSortablePointer };
|
package/dist/esm/index.js
CHANGED
|
@@ -4,9 +4,13 @@ export { default as Select } from './components/core/Select.js';
|
|
|
4
4
|
export { default as Table } from './components/core/Table/Table.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
6
6
|
import 'react';
|
|
7
|
-
import 'react-dom';
|
|
8
7
|
export { cn } from './utils/cn.js';
|
|
8
|
+
import 'react-dom';
|
|
9
|
+
import '@floating-ui/react-dom';
|
|
10
|
+
import './components/core/menu/ActionSheetMenu.js';
|
|
9
11
|
import 'lucide-react';
|
|
12
|
+
export { default as SwipeableListItem } from './components/core/SwipeableListItem.js';
|
|
13
|
+
export { default as Sheet } from './components/feedback/Sheet.js';
|
|
10
14
|
import './components/core/Table/constants.js';
|
|
11
15
|
export { default as Form } from './components/core/Form.js';
|
|
12
16
|
export { default as Accordion } from './components/core/Accordion.js';
|
|
@@ -31,17 +35,21 @@ export { default as TextToSpeech } from './components/core/TextToSpeech.js';
|
|
|
31
35
|
export { default as Textarea } from './components/core/Textarea.js';
|
|
32
36
|
export { default as Slider } from './components/core/Slider.js';
|
|
33
37
|
export { default as Popover } from './components/core/Popover.js';
|
|
38
|
+
export { default as SegmentedControl } from './components/core/SegmentedControl.js';
|
|
39
|
+
export { default as SearchField } from './components/core/SearchField.js';
|
|
34
40
|
export { default as Sidebar } from './components/navigation/Sidebar.js';
|
|
35
41
|
export { Navbar } from './components/navigation/Navbar.js';
|
|
36
42
|
export { default as FootNav } from './components/navigation/FootNav.js';
|
|
37
43
|
export { default as Breadcrumbs } from './components/navigation/Breadcrumbs.js';
|
|
38
44
|
export { default as Dialog } from './components/feedback/Dialog.js';
|
|
39
|
-
export {
|
|
45
|
+
export { ToastContainer, ToastProvider, useToast } from './components/feedback/Toast.js';
|
|
40
46
|
export { default as Alert } from './components/feedback/Alert.js';
|
|
41
47
|
export { default as Drawer } from './components/feedback/Drawer.js';
|
|
48
|
+
export { default as ActionSheet } from './components/feedback/ActionSheet.js';
|
|
42
49
|
export { default as Tour } from './components/feedback/Tour.js';
|
|
43
50
|
export { default as Badge } from './components/utility/Badge.js';
|
|
44
51
|
export { default as Avatar } from './components/utility/Avatar.js';
|
|
52
|
+
export { default as AvatarGroup } from './components/utility/AvatarGroup.js';
|
|
45
53
|
export { default as Card } from './components/utility/Card.js';
|
|
46
54
|
export { default as Pagination } from './components/utility/Pagination.js';
|
|
47
55
|
export { default as Stepper } from './components/utility/Stepper.js';
|
|
@@ -49,6 +57,7 @@ export { default as FileUpload } from './components/utility/FileUpload.js';
|
|
|
49
57
|
export { Condition } from './components/utility/Condition.js';
|
|
50
58
|
export { Carousel } from './components/utility/Carousel.js';
|
|
51
59
|
export { default as Sortable } from './components/utility/Sortable.js';
|
|
60
|
+
export { default as PullToRefresh } from './components/utility/PullToRefresh.js';
|
|
52
61
|
export { default as AppShell } from './components/blocks/AppShell.js';
|
|
53
62
|
export { default as PageHeader } from './components/blocks/PageHeader.js';
|
|
54
63
|
export { default as StatCard } from './components/blocks/StatCard.js';
|
|
@@ -57,9 +66,12 @@ export { default as EmptyState } from './components/blocks/EmptyState.js';
|
|
|
57
66
|
export { default as ErrorState } from './components/blocks/ErrorState.js';
|
|
58
67
|
export { default as LoadingState } from './components/blocks/LoadingState.js';
|
|
59
68
|
export { default as ConfirmDialog } from './components/blocks/ConfirmDialog.js';
|
|
69
|
+
export { default as BottomActionBar } from './components/blocks/BottomActionBar.js';
|
|
60
70
|
export { ThemeProvider, useTheme } from './hooks/useTheme.js';
|
|
61
71
|
export { useMixins } from './hooks/useMixins.js';
|
|
62
72
|
export { useApi } from './hooks/useApi.js';
|
|
73
|
+
export { useHaptics } from './hooks/useHaptics.js';
|
|
63
74
|
export { StoreProvider } from './store/index.js';
|
|
64
75
|
export { Helpers } from './utils/helpers.js';
|
|
65
76
|
export { EmitterClass as Emitter } from './utils/emitter.js';
|
|
77
|
+
export { default as Toast } from './components/feedback/ToastItem.js';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Internal (not exported from `src/index.js`). Small DOM helpers shared by
|
|
5
|
+
* overlays: `setRefs`, `revealElement`, `prefersReducedMotion` and
|
|
6
|
+
* `parsePlacement` stay in use.
|
|
7
|
+
*
|
|
8
|
+
* Positioning is no longer done here: every anchored overlay (Popover, Select,
|
|
9
|
+
* DatePicker, DateRangePicker, Tooltip, Tour, the menu primitives) uses
|
|
10
|
+
* `useFloatingPosition` (src/hooks/useFloatingPosition.js, built on
|
|
11
|
+
* @floating-ui/react-dom). The old `computePosition` helper was removed in
|
|
12
|
+
* 2.0.0 (DTUI-65).
|
|
8
13
|
*/
|
|
9
|
-
// Internal (not exported). Viewport-space positioning shared by Popover and Tour.
|
|
10
|
-
// All rects are getBoundingClientRect() values, so the result is for
|
|
11
|
-
// `position: fixed`.
|
|
12
14
|
var OPPOSITE = {
|
|
13
15
|
top: "bottom",
|
|
14
16
|
bottom: "top",
|
|
@@ -28,61 +30,6 @@ function parsePlacement() {
|
|
|
28
30
|
align: align
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
|
-
function roomOn(side, anchor, viewport) {
|
|
32
|
-
if (side === "top") return anchor.top;
|
|
33
|
-
if (side === "bottom") return viewport.height - anchor.bottom;
|
|
34
|
-
if (side === "left") return anchor.left;
|
|
35
|
-
return viewport.width - anchor.right;
|
|
36
|
-
}
|
|
37
|
-
function chooseSide(side, anchor, size, offset, viewport) {
|
|
38
|
-
var needed = (side === "top" || side === "bottom" ? size.height : size.width) + offset;
|
|
39
|
-
if (roomOn(side, anchor, viewport) >= needed) return side;
|
|
40
|
-
var flipped = OPPOSITE[side];
|
|
41
|
-
return roomOn(flipped, anchor, viewport) > roomOn(side, anchor, viewport) ? flipped : side;
|
|
42
|
-
}
|
|
43
|
-
function alignAxis(align, start, length, size) {
|
|
44
|
-
if (align === "start") return start;
|
|
45
|
-
if (align === "end") return start + length - size;
|
|
46
|
-
return start + length / 2 - size / 2;
|
|
47
|
-
}
|
|
48
|
-
var clamp = function clamp(value, min, max) {
|
|
49
|
-
return Math.max(min, Math.min(value, Math.max(min, max)));
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Places a floating box of `size` next to `anchor`. Flips to the opposite side
|
|
53
|
-
* when the requested side lacks room, then clamps into the viewport.
|
|
54
|
-
* Returns `{ top, left, side }`.
|
|
55
|
-
*/
|
|
56
|
-
function computePosition(anchor, size, _ref) {
|
|
57
|
-
var placement = _ref.placement,
|
|
58
|
-
_ref$offset = _ref.offset,
|
|
59
|
-
offset = _ref$offset === void 0 ? 8 : _ref$offset,
|
|
60
|
-
_ref$padding = _ref.padding,
|
|
61
|
-
padding = _ref$padding === void 0 ? 8 : _ref$padding,
|
|
62
|
-
viewport = _ref.viewport;
|
|
63
|
-
var vp = viewport || {
|
|
64
|
-
width: window.innerWidth,
|
|
65
|
-
height: window.innerHeight
|
|
66
|
-
};
|
|
67
|
-
var _parsePlacement = parsePlacement(placement),
|
|
68
|
-
wanted = _parsePlacement.side,
|
|
69
|
-
align = _parsePlacement.align;
|
|
70
|
-
var side = chooseSide(wanted, anchor, size, offset, vp);
|
|
71
|
-
var top;
|
|
72
|
-
var left;
|
|
73
|
-
if (side === "top" || side === "bottom") {
|
|
74
|
-
top = side === "top" ? anchor.top - size.height - offset : anchor.bottom + offset;
|
|
75
|
-
left = alignAxis(align, anchor.left, anchor.width, size.width);
|
|
76
|
-
} else {
|
|
77
|
-
left = side === "left" ? anchor.left - size.width - offset : anchor.right + offset;
|
|
78
|
-
top = alignAxis(align, anchor.top, anchor.height, size.height);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
top: Math.round(clamp(top, padding, vp.height - size.height - padding)),
|
|
82
|
-
left: Math.round(clamp(left, padding, vp.width - size.width - padding)),
|
|
83
|
-
side: side
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
33
|
/** `true` when the user asked the OS for reduced motion. */
|
|
87
34
|
function prefersReducedMotion() {
|
|
88
35
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
|
|
@@ -137,4 +84,4 @@ function setRefs(node) {
|
|
|
137
84
|
});
|
|
138
85
|
}
|
|
139
86
|
|
|
140
|
-
export {
|
|
87
|
+
export { parsePlacement, prefersReducedMotion, revealElement, setRefs };
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
// touch target (WCAG 2.5.5, Apple HIG) on coarse pointers only, so desktop
|
|
3
3
|
// layouts keep their compact size. Pair with inline-flex centering.
|
|
4
4
|
var TOUCH_TARGET = "[@media(pointer:coarse)]:min-h-11 [@media(pointer:coarse)]:min-w-11";
|
|
5
|
+
// Internal (not exported). Native-feeling press: a slight shrink while pressed,
|
|
6
|
+
// off under prefers-reduced-motion. Add to pressables (buttons, tiles, tab items).
|
|
7
|
+
var PRESS_FEEDBACK = "active:scale-[0.97] motion-reduce:active:scale-100 transition-transform duration-fast";
|
|
5
8
|
|
|
6
|
-
export { TOUCH_TARGET };
|
|
9
|
+
export { PRESS_FEEDBACK, TOUCH_TARGET };
|
|
@@ -6,19 +6,23 @@
|
|
|
6
6
|
* @param {number} [options.offset=4] - gap in px between reference and floating.
|
|
7
7
|
* @param {boolean} [options.flip=true] - flip to the opposite side when out of room.
|
|
8
8
|
* @param {boolean} [options.shift=true] - slide along the axis to stay in view (8px padding).
|
|
9
|
-
* @param {boolean} [options.matchWidth=false] -
|
|
10
|
-
* min-width to the reference's width (listboxes, comboboxes)
|
|
9
|
+
* @param {boolean|'exact'} [options.matchWidth=false] - `true` sets the floating
|
|
10
|
+
* element's min-width to the reference's width (listboxes, comboboxes);
|
|
11
|
+
* `'exact'` sets its width too.
|
|
12
|
+
* @param {number} [options.maxHeight] - px cap on the floating element's
|
|
13
|
+
* height; it also shrinks to the space left on its side (min 80px).
|
|
11
14
|
* @param {'fixed'|'absolute'} [options.strategy='fixed']
|
|
12
15
|
* @param {boolean} [options.open] - while false, auto-updates are paused.
|
|
13
16
|
* @returns {{ refs: { setReference: Function, setFloating: Function, reference: object, floating: object },
|
|
14
17
|
* floatingStyles: object, placement: string, isPositioned: boolean, update: () => void }}
|
|
15
18
|
*/
|
|
16
|
-
export function useFloatingPosition({ placement, offset, flip, shift, matchWidth, strategy, open, }?: {
|
|
19
|
+
export function useFloatingPosition({ placement, offset, flip, shift, matchWidth, maxHeight, strategy, open, }?: {
|
|
17
20
|
placement?: import("@floating-ui/utils").Placement | undefined;
|
|
18
21
|
offset?: number | undefined;
|
|
19
22
|
flip?: boolean | undefined;
|
|
20
23
|
shift?: boolean | undefined;
|
|
21
|
-
matchWidth?: boolean | undefined;
|
|
24
|
+
matchWidth?: boolean | "exact" | undefined;
|
|
25
|
+
maxHeight?: number | undefined;
|
|
22
26
|
strategy?: "fixed" | "absolute" | undefined;
|
|
23
27
|
open?: boolean | undefined;
|
|
24
28
|
}): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingPosition.d.ts","sourceRoot":"","sources":["../../src/hooks/useFloatingPosition.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFloatingPosition.d.ts","sourceRoot":"","sources":["../../src/hooks/useFloatingPosition.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;GAiBG;AACH,iHAdG;IAA6D,SAAS;IAC7C,MAAM;IACL,IAAI;IACJ,KAAK;IACG,UAAU;IAGnB,SAAS;IAEG,QAAQ;IACnB,IAAI;CAC9B,GAAU;IAAE,IAAI,EAAE;QAAE,YAAY,WAAW;QAAC,WAAW,WAAW;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACvG,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CA+C1F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HapticPatternName, UseHapticsOptions, UseHapticsReturn } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Named vibration patterns (milliseconds; arrays alternate vibrate / pause).
|
|
4
|
+
* Kept short: haptics confirm an action, they never carry information alone.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HAPTIC_PATTERNS: Readonly<Record<HapticPatternName, number | number[]>>;
|
|
7
|
+
/**
|
|
8
|
+
* Thin, opt-in wrapper around `navigator.vibrate` with named patterns.
|
|
9
|
+
*
|
|
10
|
+
* `trigger` is a no-op (returns `false`) when the Vibration API is missing
|
|
11
|
+
* (iOS Safari, desktop Safari, the server), when the user asks for reduced
|
|
12
|
+
* motion, when `enabled` is `false`, or for an unknown pattern name.
|
|
13
|
+
*
|
|
14
|
+
* @param options - `enabled` (default `true`) gates every trigger.
|
|
15
|
+
* @returns `{ trigger, supported, reducedMotion }`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useHaptics({ enabled }?: UseHapticsOptions): UseHapticsReturn;
|
|
18
|
+
export default useHaptics;
|
|
19
|
+
//# sourceMappingURL=useHaptics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHaptics.d.ts","sourceRoot":"","sources":["../../src/hooks/useHaptics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtG;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAKjF,CAAC;AAgBH;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAc,EAAE,GAAE,iBAAsB,GAAG,gBAAgB,CAoBvF;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* iOS-style rubber band: the further past a limit, the less the sheet follows.
|
|
3
|
+
* Returns a value in [0, dimension) for `distance` >= 0.
|
|
4
|
+
*/
|
|
5
|
+
export function rubberBand(distance: any, dimension: any): number;
|
|
6
|
+
/**
|
|
7
|
+
* @param {{
|
|
8
|
+
* edge?: 'bottom'|'top'|'left'|'right',
|
|
9
|
+
* enabled?: boolean,
|
|
10
|
+
* onRelease?: (r: { delta: number, velocity: number }) => void,
|
|
11
|
+
* bodyEl?: HTMLElement | null,
|
|
12
|
+
* }} options
|
|
13
|
+
* @returns {{ delta: number, dragging: boolean, dragProps: object, bodyDragProps: object }}
|
|
14
|
+
*/
|
|
15
|
+
export function useSheetDrag({ edge, enabled, onRelease, bodyEl }?: {
|
|
16
|
+
edge?: "bottom" | "top" | "left" | "right";
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
onRelease?: (r: {
|
|
19
|
+
delta: number;
|
|
20
|
+
velocity: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
bodyEl?: HTMLElement | null;
|
|
23
|
+
}): {
|
|
24
|
+
delta: number;
|
|
25
|
+
dragging: boolean;
|
|
26
|
+
dragProps: object;
|
|
27
|
+
bodyDragProps: object;
|
|
28
|
+
};
|
|
29
|
+
export const FLICK_VELOCITY: 0.5;
|
|
30
|
+
export default useSheetDrag;
|
|
31
|
+
//# sourceMappingURL=useSheetDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSheetDrag.d.ts","sourceRoot":"","sources":["../../src/hooks/useSheetDrag.js"],"names":[],"mappings":"AA6BA;;;GAGG;AACH,kEAGC;AAYD;;;;;;;;GAQG;AACH,oEARW;IACN,IAAI,CAAC,EAAE,QAAQ,GAAC,KAAK,GAAC,MAAM,GAAC,OAAO,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7D,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B,GACS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAoH1F;AAzJD,6BAA8B,GAAG,CAAC"}
|
|
@@ -26,13 +26,17 @@ export function useSliderValues({ value, defaultValue, onChange, onChangeEnd, bo
|
|
|
26
26
|
isRange: boolean;
|
|
27
27
|
setThumb: (index: any, raw: any, commit?: boolean) => void;
|
|
28
28
|
};
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Pointer drag on the track: picks the nearest thumb and follows the pointer.
|
|
31
|
+
* `onActiveChange(index | null)` reports which thumb is being dragged.
|
|
32
|
+
*/
|
|
33
|
+
export function useSliderPointer({ trackRef, values, setThumb, bounds, disabled, onActiveChange }: {
|
|
31
34
|
trackRef: any;
|
|
32
35
|
values: any;
|
|
33
36
|
setThumb: any;
|
|
34
37
|
bounds: any;
|
|
35
38
|
disabled: any;
|
|
39
|
+
onActiveChange: any;
|
|
36
40
|
}): {
|
|
37
41
|
onPointerDown: (e: any) => void;
|
|
38
42
|
onPointerMove: (e: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSliderValues.d.ts","sourceRoot":"","sources":["../../src/hooks/useSliderValues.js"],"names":[],"mappings":"AAQA;;;;WAGC;AAID,kFAAkF;AAClF;;;;;QAmBC;AAED;;;;GAIG;AACH;;;;;;;;;;EAqBC;AAED
|
|
1
|
+
{"version":3,"file":"useSliderValues.d.ts","sourceRoot":"","sources":["../../src/hooks/useSliderValues.js"],"names":[],"mappings":"AAQA;;;;WAGC;AAID,kFAAkF;AAClF;;;;;QAmBC;AAED;;;;GAIG;AACH;;;;;;;;;;EAqBC;AAED;;;GAGG;AACH;;;;;;;;;;;;EAgCC;AAxFM,8DAAsF"}
|
|
@@ -11,6 +11,10 @@ export function useSortableKeyboard({ keys, setDraft, commit, announce, labelFor
|
|
|
11
11
|
keyDownFor: (key: any) => (e: any) => void;
|
|
12
12
|
cancel: () => void;
|
|
13
13
|
};
|
|
14
|
+
/** Nearest scrollable ancestor along `axis`, or `null` for the window. */
|
|
15
|
+
export function getScrollParent(node: any, axis: any): any;
|
|
16
|
+
/** Scroll speed (px/frame, signed) for a coordinate near the [start, end] edges. */
|
|
17
|
+
export function edgeSpeed(pos: any, start: any, end: any, edge?: number): number;
|
|
14
18
|
export function useSortablePointer({ keys, setDraft, commit, nodeFor, orientation, disabled }: {
|
|
15
19
|
keys: any;
|
|
16
20
|
setDraft: any;
|
|
@@ -20,7 +24,9 @@ export function useSortablePointer({ keys, setDraft, commit, nodeFor, orientatio
|
|
|
20
24
|
disabled: any;
|
|
21
25
|
}): {
|
|
22
26
|
dragging: null;
|
|
23
|
-
startFor: (key: any
|
|
27
|
+
startFor: (key: any, { longPress }?: {
|
|
28
|
+
longPress?: boolean | undefined;
|
|
29
|
+
}) => (e: any) => void;
|
|
24
30
|
};
|
|
25
31
|
export namespace DEFAULT_SORTABLE_MESSAGES {
|
|
26
32
|
let instructions: string;
|
|
@@ -29,4 +35,8 @@ export namespace DEFAULT_SORTABLE_MESSAGES {
|
|
|
29
35
|
function dropped(label: any, position: any, total: any): string;
|
|
30
36
|
function cancelled(label: any, position: any): string;
|
|
31
37
|
}
|
|
38
|
+
export const DRAG_THRESHOLD: 4;
|
|
39
|
+
export const LONG_PRESS_DELAY: 250;
|
|
40
|
+
export const LONG_PRESS_TOLERANCE: 8;
|
|
41
|
+
export const AUTO_SCROLL_EDGE: 40;
|
|
32
42
|
//# sourceMappingURL=useSortable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSortable.d.ts","sourceRoot":"","sources":["../../src/hooks/useSortable.js"],"names":[],"mappings":"AAOA,gEAIC;AAcD;;;;;;;;;+BAK+B,MAAC;;EAqC/B;
|
|
1
|
+
{"version":3,"file":"useSortable.d.ts","sourceRoot":"","sources":["../../src/hooks/useSortable.js"],"names":[],"mappings":"AAOA,gEAIC;AAcD;;;;;;;;;+BAK+B,MAAC;;EAqC/B;AAqBD,0EAA0E;AAC1E,2DAOC;AAED,oFAAoF;AACpF,iFAIC;AAOD;;;;;;;;;;;WAwByD,MAAC;EAgGzD;;;IAtNU,gEAAmF;IACrF,8DAAiF;IAC/E,gEAAmF;IACjF,sDAAoF;;AAoDjG,6BAA8B,CAAC,CAAC;AAGhC,+BAAgC,GAAG,CAAC;AACpC,mCAAoC,CAAC,CAAC;AAGtC,+BAAgC,EAAE,CAAC"}
|