@szum-tech/design-system 3.14.0 → 3.16.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/dist/{chunk-K5QSMTKJ.js → chunk-3DP3VMPN.js} +1 -1
- package/dist/{chunk-XJIUGEPN.js → chunk-A72LE53B.js} +1 -1
- package/dist/chunk-BUJO4FB6.js +252 -0
- package/dist/chunk-CL2C6STG.cjs +278 -0
- package/dist/{chunk-UIOBJSKZ.cjs → chunk-DUAM4RTP.cjs} +1 -1
- package/dist/{chunk-XY3ZNUWR.cjs → chunk-F7NFSDOD.cjs} +17 -4
- package/dist/{chunk-GAZLMZBH.cjs → chunk-HPICKLBZ.cjs} +2 -2
- package/dist/chunk-KTAIBRTH.cjs +10 -0
- package/dist/{chunk-KGGCA634.js → chunk-L2TRMQNN.js} +1 -1
- package/dist/{chunk-EZCWHR56.cjs → chunk-MFTNHVPZ.cjs} +557 -6
- package/dist/chunk-NXEZE7LG.js +15 -0
- package/dist/{chunk-VL3TPVSB.js → chunk-OIM2X2NK.js} +532 -6
- package/dist/chunk-OXZQGDTR.js +208 -0
- package/dist/{chunk-4IGU5SVP.js → chunk-P4IL77YC.js} +16 -4
- package/dist/{chunk-CAIAZGSW.cjs → chunk-RKFU4DS3.cjs} +2 -2
- package/dist/chunk-SHPJGB2L.cjs +19 -0
- package/dist/{chunk-CFJ44JVK.cjs → chunk-UNOMGKAZ.cjs} +2 -2
- package/dist/{chunk-Q2MJKFIE.js → chunk-WCQ5WKCQ.js} +1 -1
- package/dist/chunk-X7WREEFD.js +8 -0
- package/dist/chunk-YBFG2IRJ.cjs +225 -0
- package/dist/components/badge-overflow/index.cjs +2 -2
- package/dist/components/badge-overflow/index.js +1 -1
- package/dist/components/button/index.cjs +21 -17
- package/dist/components/button/index.js +20 -16
- package/dist/components/carousel/index.cjs +22 -18
- package/dist/components/carousel/index.js +20 -16
- package/dist/components/collapsible/index.cjs +18 -0
- package/dist/components/collapsible/index.d.cts +12 -0
- package/dist/components/collapsible/index.d.ts +12 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/color-picker/index.cjs +31 -27
- package/dist/components/color-picker/index.js +20 -16
- package/dist/components/dropdown-menu/index.cjs +71 -0
- package/dist/components/dropdown-menu/index.d.cts +67 -0
- package/dist/components/dropdown-menu/index.d.ts +67 -0
- package/dist/components/dropdown-menu/index.js +2 -0
- package/dist/components/field/index.cjs +12 -12
- package/dist/components/field/index.js +2 -2
- package/dist/components/index.cjs +384 -180
- package/dist/components/index.d.cts +8 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +20 -16
- package/dist/components/item/index.cjs +12 -12
- package/dist/components/item/index.js +2 -2
- package/dist/components/masonry/index.cjs +4 -4
- package/dist/components/masonry/index.js +2 -2
- package/dist/components/separator/index.cjs +2 -2
- package/dist/components/separator/index.js +1 -1
- package/dist/components/sidebar/index.cjs +148 -0
- package/dist/components/sidebar/index.d.cts +135 -0
- package/dist/components/sidebar/index.d.ts +135 -0
- package/dist/components/sidebar/index.js +43 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +7 -0
- package/dist/components/skeleton/index.d.ts +7 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/sortable/index.cjs +27 -0
- package/dist/components/sortable/index.d.cts +50 -0
- package/dist/components/sortable/index.d.ts +50 -0
- package/dist/components/sortable/index.js +2 -0
- package/dist/components/stepper/index.cjs +39 -35
- package/dist/components/stepper/index.js +20 -16
- package/dist/components/timeline/index.cjs +1 -1
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/toaster/index.cjs +22 -18
- package/dist/components/toaster/index.js +20 -16
- package/dist/components/tooltip/index.d.cts +2 -4
- package/dist/components/tooltip/index.d.ts +2 -4
- package/dist/hooks/index.cjs +8 -4
- package/dist/hooks/index.d.cts +3 -1
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.js +1 -1
- package/dist/tooltip-content-DqtogPBq.d.cts +8 -0
- package/dist/tooltip-content-DqtogPBq.d.ts +8 -0
- package/package.json +4 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Separator } from './chunk-A72LE53B.js';
|
|
1
2
|
import { Label } from './chunk-I3RSTJP6.js';
|
|
2
|
-
import { Separator } from './chunk-XJIUGEPN.js';
|
|
3
3
|
import { cn } from './chunk-ZD2QRAOX.js';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -10,7 +10,7 @@ function Separator({ className, orientation = "horizontal", decorative = false,
|
|
|
10
10
|
decorative,
|
|
11
11
|
orientation,
|
|
12
12
|
className: cn(
|
|
13
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:
|
|
13
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
14
14
|
className
|
|
15
15
|
),
|
|
16
16
|
...props
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { cn } from './chunk-ZD2QRAOX.js';
|
|
2
|
+
import * as React2 from 'react';
|
|
3
|
+
import { Slot } from 'radix-ui';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { defaultDropAnimationSideEffects, useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy, DragOverlay } from '@dnd-kit/core';
|
|
6
|
+
import { sortableKeyboardCoordinates, arrayMove, SortableContext, useSortable, verticalListSortingStrategy, rectSortingStrategy, defaultAnimateLayoutChanges } from '@dnd-kit/sortable';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
9
|
+
|
|
10
|
+
var SORTABLE_ROOT_NAME = "Sortable";
|
|
11
|
+
var SORTABLE_ITEM_NAME = "SortableItem";
|
|
12
|
+
var SORTABLE_ITEM_HANDLE_NAME = "SortableItemHandle";
|
|
13
|
+
var SORTABLE_OVERLAY_NAME = "SortableOverlay";
|
|
14
|
+
var animateLayoutChanges = (args) => defaultAnimateLayoutChanges({ ...args, wasDragging: true });
|
|
15
|
+
var dropAnimationConfig = {
|
|
16
|
+
sideEffects: defaultDropAnimationSideEffects({
|
|
17
|
+
styles: {
|
|
18
|
+
active: {
|
|
19
|
+
opacity: "0.4"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
var SortableItemContext = React2.createContext(null);
|
|
25
|
+
function useSortableItemContext(consumerName) {
|
|
26
|
+
const context = React2.useContext(SortableItemContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error(`\`${consumerName}\` must be used within \`${SORTABLE_ITEM_NAME}\``);
|
|
29
|
+
}
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
var IsOverlayContext = React2.createContext(false);
|
|
33
|
+
var SortableInternalContext = React2.createContext(null);
|
|
34
|
+
function useSortableInternalContext(consumerName) {
|
|
35
|
+
const context = React2.useContext(SortableInternalContext);
|
|
36
|
+
if (!context) {
|
|
37
|
+
throw new Error(`\`${consumerName}\` must be used within \`${SORTABLE_ROOT_NAME}\``);
|
|
38
|
+
}
|
|
39
|
+
return context;
|
|
40
|
+
}
|
|
41
|
+
function Sortable({
|
|
42
|
+
value,
|
|
43
|
+
onValueChange,
|
|
44
|
+
getItemValue,
|
|
45
|
+
className,
|
|
46
|
+
asChild = false,
|
|
47
|
+
onMove,
|
|
48
|
+
strategy = "vertical",
|
|
49
|
+
onDragStart,
|
|
50
|
+
onDragEnd,
|
|
51
|
+
modifiers,
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}) {
|
|
55
|
+
const [activeId, setActiveId] = React2.useState(null);
|
|
56
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
57
|
+
React2.useLayoutEffect(() => setMounted(true), []);
|
|
58
|
+
const sensors = useSensors(
|
|
59
|
+
useSensor(MouseSensor, {
|
|
60
|
+
activationConstraint: {
|
|
61
|
+
distance: 10
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
useSensor(TouchSensor, {
|
|
65
|
+
activationConstraint: {
|
|
66
|
+
delay: 250,
|
|
67
|
+
tolerance: 5
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
useSensor(KeyboardSensor, {
|
|
71
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
const handleDragStart = React2.useCallback(
|
|
75
|
+
(event) => {
|
|
76
|
+
setActiveId(event.active.id);
|
|
77
|
+
onDragStart?.(event);
|
|
78
|
+
},
|
|
79
|
+
[onDragStart]
|
|
80
|
+
);
|
|
81
|
+
const handleDragEnd = React2.useCallback(
|
|
82
|
+
(event) => {
|
|
83
|
+
const { active, over } = event;
|
|
84
|
+
setActiveId(null);
|
|
85
|
+
onDragEnd?.(event);
|
|
86
|
+
if (!over) return;
|
|
87
|
+
const activeIndex = value.findIndex((item) => getItemValue(item) === active.id);
|
|
88
|
+
const overIndex = value.findIndex((item) => getItemValue(item) === over.id);
|
|
89
|
+
if (activeIndex !== overIndex) {
|
|
90
|
+
if (onMove) {
|
|
91
|
+
onMove({ event, activeIndex, overIndex });
|
|
92
|
+
} else {
|
|
93
|
+
const newValue = arrayMove(value, activeIndex, overIndex);
|
|
94
|
+
onValueChange(newValue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[value, getItemValue, onValueChange, onMove, onDragEnd]
|
|
99
|
+
);
|
|
100
|
+
const handleDragCancel = React2.useCallback(() => {
|
|
101
|
+
setActiveId(null);
|
|
102
|
+
}, []);
|
|
103
|
+
const getStrategy = () => {
|
|
104
|
+
switch (strategy) {
|
|
105
|
+
case "horizontal":
|
|
106
|
+
return rectSortingStrategy;
|
|
107
|
+
case "grid":
|
|
108
|
+
return rectSortingStrategy;
|
|
109
|
+
case "vertical":
|
|
110
|
+
default:
|
|
111
|
+
return verticalListSortingStrategy;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const itemIds = React2.useMemo(() => value.map(getItemValue), [value, getItemValue]);
|
|
115
|
+
const contextValue = React2.useMemo(() => ({ activeId, modifiers }), [activeId, modifiers]);
|
|
116
|
+
const overlayContent = React2.useMemo(() => {
|
|
117
|
+
if (!activeId) return null;
|
|
118
|
+
let result = null;
|
|
119
|
+
React2.Children.forEach(children, (child) => {
|
|
120
|
+
if (React2.isValidElement(child) && child.props.value === activeId) {
|
|
121
|
+
result = React2.cloneElement(child, {
|
|
122
|
+
...child.props,
|
|
123
|
+
className: cn(child.props.className, "z-50")
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return result;
|
|
128
|
+
}, [activeId, children]);
|
|
129
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
130
|
+
return /* @__PURE__ */ jsx(SortableInternalContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
131
|
+
DndContext,
|
|
132
|
+
{
|
|
133
|
+
sensors,
|
|
134
|
+
modifiers,
|
|
135
|
+
measuring: {
|
|
136
|
+
droppable: {
|
|
137
|
+
strategy: MeasuringStrategy.Always
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
onDragStart: handleDragStart,
|
|
141
|
+
onDragEnd: handleDragEnd,
|
|
142
|
+
onDragCancel: handleDragCancel,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: getStrategy(), children: /* @__PURE__ */ jsx(
|
|
145
|
+
Comp,
|
|
146
|
+
{
|
|
147
|
+
"data-slot": "sortable",
|
|
148
|
+
"data-dragging": activeId !== null,
|
|
149
|
+
className: cn(activeId !== null && "cursor-grabbing!", className),
|
|
150
|
+
...props,
|
|
151
|
+
children
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
mounted && createPortal(
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
DragOverlay,
|
|
157
|
+
{
|
|
158
|
+
dropAnimation: dropAnimationConfig,
|
|
159
|
+
modifiers,
|
|
160
|
+
className: cn("z-50", activeId && "cursor-grabbing"),
|
|
161
|
+
children: /* @__PURE__ */ jsx(IsOverlayContext.Provider, { value: true, children: overlayContent })
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
document.body
|
|
165
|
+
)
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
) });
|
|
169
|
+
}
|
|
170
|
+
function SortableItem({ value, className, asChild = false, disabled, children, ...props }) {
|
|
171
|
+
const isOverlay = React2.useContext(IsOverlayContext);
|
|
172
|
+
const {
|
|
173
|
+
setNodeRef,
|
|
174
|
+
transform,
|
|
175
|
+
transition,
|
|
176
|
+
attributes,
|
|
177
|
+
listeners,
|
|
178
|
+
isDragging: isSortableDragging
|
|
179
|
+
} = useSortable({
|
|
180
|
+
id: value,
|
|
181
|
+
disabled: disabled || isOverlay,
|
|
182
|
+
animateLayoutChanges
|
|
183
|
+
});
|
|
184
|
+
if (isOverlay) {
|
|
185
|
+
const Comp2 = asChild ? Slot.Root : "div";
|
|
186
|
+
return /* @__PURE__ */ jsx(SortableItemContext.Provider, { value: { listeners: void 0, isDragging: true, disabled: false }, children: /* @__PURE__ */ jsx(Comp2, { "data-slot": "sortable-item", "data-value": value, "data-dragging": true, className: cn(className), ...props, children }) });
|
|
187
|
+
}
|
|
188
|
+
const style = {
|
|
189
|
+
transition,
|
|
190
|
+
transform: CSS.Transform.toString(transform)
|
|
191
|
+
};
|
|
192
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
193
|
+
return /* @__PURE__ */ jsx(SortableItemContext.Provider, { value: { listeners, isDragging: isSortableDragging, disabled }, children: /* @__PURE__ */ jsx(
|
|
194
|
+
Comp,
|
|
195
|
+
{
|
|
196
|
+
"data-slot": "sortable-item",
|
|
197
|
+
"data-value": value,
|
|
198
|
+
"data-dragging": isSortableDragging,
|
|
199
|
+
"data-disabled": disabled,
|
|
200
|
+
ref: setNodeRef,
|
|
201
|
+
style,
|
|
202
|
+
...attributes,
|
|
203
|
+
className: cn(isSortableDragging && "z-50 opacity-50", disabled && "opacity-50", className),
|
|
204
|
+
...props,
|
|
205
|
+
children
|
|
206
|
+
}
|
|
207
|
+
) });
|
|
208
|
+
}
|
|
209
|
+
function SortableItemHandle({
|
|
210
|
+
className,
|
|
211
|
+
asChild = false,
|
|
212
|
+
cursor = true,
|
|
213
|
+
children,
|
|
214
|
+
...props
|
|
215
|
+
}) {
|
|
216
|
+
const { listeners, isDragging, disabled } = useSortableItemContext(SORTABLE_ITEM_HANDLE_NAME);
|
|
217
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
218
|
+
return /* @__PURE__ */ jsx(
|
|
219
|
+
Comp,
|
|
220
|
+
{
|
|
221
|
+
"data-slot": "sortable-item-handle",
|
|
222
|
+
"data-dragging": isDragging,
|
|
223
|
+
"data-disabled": disabled,
|
|
224
|
+
...listeners,
|
|
225
|
+
className: cn(cursor && (isDragging ? "cursor-grabbing!" : "cursor-grab!"), className),
|
|
226
|
+
...props,
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function SortableOverlay({ children, className, ...props }) {
|
|
232
|
+
const { activeId, modifiers } = useSortableInternalContext(SORTABLE_OVERLAY_NAME);
|
|
233
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
234
|
+
React2.useLayoutEffect(() => setMounted(true), []);
|
|
235
|
+
const content = activeId && children ? typeof children === "function" ? children({ value: activeId }) : children : null;
|
|
236
|
+
if (!mounted) return null;
|
|
237
|
+
return createPortal(
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
239
|
+
DragOverlay,
|
|
240
|
+
{
|
|
241
|
+
dropAnimation: dropAnimationConfig,
|
|
242
|
+
modifiers,
|
|
243
|
+
className: cn("z-50", activeId && "cursor-grabbing", className),
|
|
244
|
+
...props,
|
|
245
|
+
children: /* @__PURE__ */ jsx(IsOverlayContext.Provider, { value: true, children: content })
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
document.body
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export { Sortable, SortableItem, SortableItemHandle, SortableOverlay, useSortableItemContext };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var React2 = require('react');
|
|
5
|
+
var radixUi = require('radix-ui');
|
|
6
|
+
var reactDom = require('react-dom');
|
|
7
|
+
var core = require('@dnd-kit/core');
|
|
8
|
+
var sortable = require('@dnd-kit/sortable');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var utilities = require('@dnd-kit/utilities');
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
31
|
+
|
|
32
|
+
var SORTABLE_ROOT_NAME = "Sortable";
|
|
33
|
+
var SORTABLE_ITEM_NAME = "SortableItem";
|
|
34
|
+
var SORTABLE_ITEM_HANDLE_NAME = "SortableItemHandle";
|
|
35
|
+
var SORTABLE_OVERLAY_NAME = "SortableOverlay";
|
|
36
|
+
var animateLayoutChanges = (args) => sortable.defaultAnimateLayoutChanges({ ...args, wasDragging: true });
|
|
37
|
+
var dropAnimationConfig = {
|
|
38
|
+
sideEffects: core.defaultDropAnimationSideEffects({
|
|
39
|
+
styles: {
|
|
40
|
+
active: {
|
|
41
|
+
opacity: "0.4"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
var SortableItemContext = React2__namespace.createContext(null);
|
|
47
|
+
function useSortableItemContext(consumerName) {
|
|
48
|
+
const context = React2__namespace.useContext(SortableItemContext);
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error(`\`${consumerName}\` must be used within \`${SORTABLE_ITEM_NAME}\``);
|
|
51
|
+
}
|
|
52
|
+
return context;
|
|
53
|
+
}
|
|
54
|
+
var IsOverlayContext = React2__namespace.createContext(false);
|
|
55
|
+
var SortableInternalContext = React2__namespace.createContext(null);
|
|
56
|
+
function useSortableInternalContext(consumerName) {
|
|
57
|
+
const context = React2__namespace.useContext(SortableInternalContext);
|
|
58
|
+
if (!context) {
|
|
59
|
+
throw new Error(`\`${consumerName}\` must be used within \`${SORTABLE_ROOT_NAME}\``);
|
|
60
|
+
}
|
|
61
|
+
return context;
|
|
62
|
+
}
|
|
63
|
+
function Sortable({
|
|
64
|
+
value,
|
|
65
|
+
onValueChange,
|
|
66
|
+
getItemValue,
|
|
67
|
+
className,
|
|
68
|
+
asChild = false,
|
|
69
|
+
onMove,
|
|
70
|
+
strategy = "vertical",
|
|
71
|
+
onDragStart,
|
|
72
|
+
onDragEnd,
|
|
73
|
+
modifiers,
|
|
74
|
+
children,
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
const [activeId, setActiveId] = React2__namespace.useState(null);
|
|
78
|
+
const [mounted, setMounted] = React2__namespace.useState(false);
|
|
79
|
+
React2__namespace.useLayoutEffect(() => setMounted(true), []);
|
|
80
|
+
const sensors = core.useSensors(
|
|
81
|
+
core.useSensor(core.MouseSensor, {
|
|
82
|
+
activationConstraint: {
|
|
83
|
+
distance: 10
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
core.useSensor(core.TouchSensor, {
|
|
87
|
+
activationConstraint: {
|
|
88
|
+
delay: 250,
|
|
89
|
+
tolerance: 5
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
core.useSensor(core.KeyboardSensor, {
|
|
93
|
+
coordinateGetter: sortable.sortableKeyboardCoordinates
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
const handleDragStart = React2__namespace.useCallback(
|
|
97
|
+
(event) => {
|
|
98
|
+
setActiveId(event.active.id);
|
|
99
|
+
onDragStart?.(event);
|
|
100
|
+
},
|
|
101
|
+
[onDragStart]
|
|
102
|
+
);
|
|
103
|
+
const handleDragEnd = React2__namespace.useCallback(
|
|
104
|
+
(event) => {
|
|
105
|
+
const { active, over } = event;
|
|
106
|
+
setActiveId(null);
|
|
107
|
+
onDragEnd?.(event);
|
|
108
|
+
if (!over) return;
|
|
109
|
+
const activeIndex = value.findIndex((item) => getItemValue(item) === active.id);
|
|
110
|
+
const overIndex = value.findIndex((item) => getItemValue(item) === over.id);
|
|
111
|
+
if (activeIndex !== overIndex) {
|
|
112
|
+
if (onMove) {
|
|
113
|
+
onMove({ event, activeIndex, overIndex });
|
|
114
|
+
} else {
|
|
115
|
+
const newValue = sortable.arrayMove(value, activeIndex, overIndex);
|
|
116
|
+
onValueChange(newValue);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
[value, getItemValue, onValueChange, onMove, onDragEnd]
|
|
121
|
+
);
|
|
122
|
+
const handleDragCancel = React2__namespace.useCallback(() => {
|
|
123
|
+
setActiveId(null);
|
|
124
|
+
}, []);
|
|
125
|
+
const getStrategy = () => {
|
|
126
|
+
switch (strategy) {
|
|
127
|
+
case "horizontal":
|
|
128
|
+
return sortable.rectSortingStrategy;
|
|
129
|
+
case "grid":
|
|
130
|
+
return sortable.rectSortingStrategy;
|
|
131
|
+
case "vertical":
|
|
132
|
+
default:
|
|
133
|
+
return sortable.verticalListSortingStrategy;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const itemIds = React2__namespace.useMemo(() => value.map(getItemValue), [value, getItemValue]);
|
|
137
|
+
const contextValue = React2__namespace.useMemo(() => ({ activeId, modifiers }), [activeId, modifiers]);
|
|
138
|
+
const overlayContent = React2__namespace.useMemo(() => {
|
|
139
|
+
if (!activeId) return null;
|
|
140
|
+
let result = null;
|
|
141
|
+
React2__namespace.Children.forEach(children, (child) => {
|
|
142
|
+
if (React2__namespace.isValidElement(child) && child.props.value === activeId) {
|
|
143
|
+
result = React2__namespace.cloneElement(child, {
|
|
144
|
+
...child.props,
|
|
145
|
+
className: chunkH2BWO3SI_cjs.cn(child.props.className, "z-50")
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return result;
|
|
150
|
+
}, [activeId, children]);
|
|
151
|
+
const Comp = asChild ? radixUi.Slot.Root : "div";
|
|
152
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SortableInternalContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
153
|
+
core.DndContext,
|
|
154
|
+
{
|
|
155
|
+
sensors,
|
|
156
|
+
modifiers,
|
|
157
|
+
measuring: {
|
|
158
|
+
droppable: {
|
|
159
|
+
strategy: core.MeasuringStrategy.Always
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
onDragStart: handleDragStart,
|
|
163
|
+
onDragEnd: handleDragEnd,
|
|
164
|
+
onDragCancel: handleDragCancel,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy: getStrategy(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
Comp,
|
|
168
|
+
{
|
|
169
|
+
"data-slot": "sortable",
|
|
170
|
+
"data-dragging": activeId !== null,
|
|
171
|
+
className: chunkH2BWO3SI_cjs.cn(activeId !== null && "cursor-grabbing!", className),
|
|
172
|
+
...props,
|
|
173
|
+
children
|
|
174
|
+
}
|
|
175
|
+
) }),
|
|
176
|
+
mounted && reactDom.createPortal(
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
core.DragOverlay,
|
|
179
|
+
{
|
|
180
|
+
dropAnimation: dropAnimationConfig,
|
|
181
|
+
modifiers,
|
|
182
|
+
className: chunkH2BWO3SI_cjs.cn("z-50", activeId && "cursor-grabbing"),
|
|
183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IsOverlayContext.Provider, { value: true, children: overlayContent })
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
document.body
|
|
187
|
+
)
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
) });
|
|
191
|
+
}
|
|
192
|
+
function SortableItem({ value, className, asChild = false, disabled, children, ...props }) {
|
|
193
|
+
const isOverlay = React2__namespace.useContext(IsOverlayContext);
|
|
194
|
+
const {
|
|
195
|
+
setNodeRef,
|
|
196
|
+
transform,
|
|
197
|
+
transition,
|
|
198
|
+
attributes,
|
|
199
|
+
listeners,
|
|
200
|
+
isDragging: isSortableDragging
|
|
201
|
+
} = sortable.useSortable({
|
|
202
|
+
id: value,
|
|
203
|
+
disabled: disabled || isOverlay,
|
|
204
|
+
animateLayoutChanges
|
|
205
|
+
});
|
|
206
|
+
if (isOverlay) {
|
|
207
|
+
const Comp2 = asChild ? radixUi.Slot.Root : "div";
|
|
208
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SortableItemContext.Provider, { value: { listeners: void 0, isDragging: true, disabled: false }, children: /* @__PURE__ */ jsxRuntime.jsx(Comp2, { "data-slot": "sortable-item", "data-value": value, "data-dragging": true, className: chunkH2BWO3SI_cjs.cn(className), ...props, children }) });
|
|
209
|
+
}
|
|
210
|
+
const style = {
|
|
211
|
+
transition,
|
|
212
|
+
transform: utilities.CSS.Transform.toString(transform)
|
|
213
|
+
};
|
|
214
|
+
const Comp = asChild ? radixUi.Slot.Root : "div";
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SortableItemContext.Provider, { value: { listeners, isDragging: isSortableDragging, disabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
Comp,
|
|
217
|
+
{
|
|
218
|
+
"data-slot": "sortable-item",
|
|
219
|
+
"data-value": value,
|
|
220
|
+
"data-dragging": isSortableDragging,
|
|
221
|
+
"data-disabled": disabled,
|
|
222
|
+
ref: setNodeRef,
|
|
223
|
+
style,
|
|
224
|
+
...attributes,
|
|
225
|
+
className: chunkH2BWO3SI_cjs.cn(isSortableDragging && "z-50 opacity-50", disabled && "opacity-50", className),
|
|
226
|
+
...props,
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
) });
|
|
230
|
+
}
|
|
231
|
+
function SortableItemHandle({
|
|
232
|
+
className,
|
|
233
|
+
asChild = false,
|
|
234
|
+
cursor = true,
|
|
235
|
+
children,
|
|
236
|
+
...props
|
|
237
|
+
}) {
|
|
238
|
+
const { listeners, isDragging, disabled } = useSortableItemContext(SORTABLE_ITEM_HANDLE_NAME);
|
|
239
|
+
const Comp = asChild ? radixUi.Slot.Root : "div";
|
|
240
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
+
Comp,
|
|
242
|
+
{
|
|
243
|
+
"data-slot": "sortable-item-handle",
|
|
244
|
+
"data-dragging": isDragging,
|
|
245
|
+
"data-disabled": disabled,
|
|
246
|
+
...listeners,
|
|
247
|
+
className: chunkH2BWO3SI_cjs.cn(cursor && (isDragging ? "cursor-grabbing!" : "cursor-grab!"), className),
|
|
248
|
+
...props,
|
|
249
|
+
children
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
function SortableOverlay({ children, className, ...props }) {
|
|
254
|
+
const { activeId, modifiers } = useSortableInternalContext(SORTABLE_OVERLAY_NAME);
|
|
255
|
+
const [mounted, setMounted] = React2__namespace.useState(false);
|
|
256
|
+
React2__namespace.useLayoutEffect(() => setMounted(true), []);
|
|
257
|
+
const content = activeId && children ? typeof children === "function" ? children({ value: activeId }) : children : null;
|
|
258
|
+
if (!mounted) return null;
|
|
259
|
+
return reactDom.createPortal(
|
|
260
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
261
|
+
core.DragOverlay,
|
|
262
|
+
{
|
|
263
|
+
dropAnimation: dropAnimationConfig,
|
|
264
|
+
modifiers,
|
|
265
|
+
className: chunkH2BWO3SI_cjs.cn("z-50", activeId && "cursor-grabbing", className),
|
|
266
|
+
...props,
|
|
267
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IsOverlayContext.Provider, { value: true, children: content })
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
document.body
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
exports.Sortable = Sortable;
|
|
275
|
+
exports.SortableItem = SortableItem;
|
|
276
|
+
exports.SortableItemHandle = SortableItemHandle;
|
|
277
|
+
exports.SortableOverlay = SortableOverlay;
|
|
278
|
+
exports.useSortableItemContext = useSortableItemContext;
|
|
@@ -12,7 +12,7 @@ function Separator({ className, orientation = "horizontal", decorative = false,
|
|
|
12
12
|
decorative,
|
|
13
13
|
orientation,
|
|
14
14
|
className: chunkH2BWO3SI_cjs.cn(
|
|
15
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:
|
|
15
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
16
16
|
className
|
|
17
17
|
),
|
|
18
18
|
...props
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React3 = require('react');
|
|
4
4
|
|
|
5
5
|
function _interopNamespace(e) {
|
|
6
6
|
if (e && e.__esModule) return e;
|
|
@@ -20,11 +20,11 @@ function _interopNamespace(e) {
|
|
|
20
20
|
return Object.freeze(n);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
24
24
|
|
|
25
25
|
// src/hooks/use-validation-log.tsx
|
|
26
26
|
function useValidationLog({ check, scope, message }) {
|
|
27
|
-
|
|
27
|
+
React3__namespace.useEffect(() => {
|
|
28
28
|
if (!check) {
|
|
29
29
|
console.error(
|
|
30
30
|
`%c[Szum Tech-Design System]%c
|
|
@@ -70,9 +70,22 @@ function composeRefs(...refs) {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
function useComposedRefs(...refs) {
|
|
73
|
-
return
|
|
73
|
+
return React3__namespace.useCallback(composeRefs(...refs), refs);
|
|
74
|
+
}
|
|
75
|
+
var MOBILE_BREAKPOINT = 768;
|
|
76
|
+
function useIsMobile() {
|
|
77
|
+
const [isMobile, setIsMobile] = React3__namespace.useState(void 0);
|
|
78
|
+
React3__namespace.useEffect(() => {
|
|
79
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
80
|
+
const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
81
|
+
mql.addEventListener("change", onChange);
|
|
82
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
83
|
+
return () => mql.removeEventListener("change", onChange);
|
|
84
|
+
}, []);
|
|
85
|
+
return !!isMobile;
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
exports.composeRefs = composeRefs;
|
|
77
89
|
exports.useComposedRefs = useComposedRefs;
|
|
90
|
+
exports.useIsMobile = useIsMobile;
|
|
78
91
|
exports.useValidationLog = useValidationLog;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkDUAM4RTP_cjs = require('./chunk-DUAM4RTP.cjs');
|
|
3
4
|
var chunkS3ANEJJ7_cjs = require('./chunk-S3ANEJJ7.cjs');
|
|
4
|
-
var chunkUIOBJSKZ_cjs = require('./chunk-UIOBJSKZ.cjs');
|
|
5
5
|
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
6
6
|
var classVarianceAuthority = require('class-variance-authority');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -151,7 +151,7 @@ function FieldSeparator({ children, className, ...props }) {
|
|
|
151
151
|
className: chunkH2BWO3SI_cjs.cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
152
152
|
...props,
|
|
153
153
|
children: [
|
|
154
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkDUAM4RTP_cjs.Separator, { className: "absolute inset-0 top-1/2" }),
|
|
155
155
|
children ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
156
|
"span",
|
|
157
157
|
{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
function Skeleton({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "skeleton", className: chunkH2BWO3SI_cjs.cn("bg-muted animate-pulse rounded-md", className), ...props });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.Skeleton = Skeleton;
|