@cmdniels/uikit 2.0.1 → 2.1.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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/data-variants.css +61 -0
  3. package/out/components/dialog/DialogContent.js +1 -1
  4. package/out/components/dialog/DialogContent.js.map +1 -1
  5. package/out/components/input-group/InputGroupAddon.d.ts +1 -1
  6. package/out/components/input-group/InputGroupAddon.d.ts.map +1 -1
  7. package/out/components/input-group/InputGroupAddon.js +2 -2
  8. package/out/components/input-group/InputGroupAddon.js.map +1 -1
  9. package/out/index.d.ts +0 -5
  10. package/out/index.d.ts.map +1 -1
  11. package/out/index.js +0 -6
  12. package/out/index.js.map +1 -1
  13. package/package.json +12 -10
  14. package/superellipse.css +1194 -0
  15. package/tailwind.css +4 -193
  16. package/out/components/sortable/Sortable.d.ts +0 -55
  17. package/out/components/sortable/Sortable.d.ts.map +0 -1
  18. package/out/components/sortable/Sortable.js +0 -149
  19. package/out/components/sortable/Sortable.js.map +0 -1
  20. package/out/components/sortable/SortableContent.d.ts +0 -9
  21. package/out/components/sortable/SortableContent.d.ts.map +0 -1
  22. package/out/components/sortable/SortableContent.js +0 -17
  23. package/out/components/sortable/SortableContent.js.map +0 -1
  24. package/out/components/sortable/SortableContentContext.d.ts +0 -3
  25. package/out/components/sortable/SortableContentContext.d.ts.map +0 -1
  26. package/out/components/sortable/SortableContentContext.js +0 -4
  27. package/out/components/sortable/SortableContentContext.js.map +0 -1
  28. package/out/components/sortable/SortableItem.d.ts +0 -18
  29. package/out/components/sortable/SortableItem.d.ts.map +0 -1
  30. package/out/components/sortable/SortableItem.js +0 -71
  31. package/out/components/sortable/SortableItem.js.map +0 -1
  32. package/out/components/sortable/SortableItemHandle.d.ts +0 -5
  33. package/out/components/sortable/SortableItemHandle.d.ts.map +0 -1
  34. package/out/components/sortable/SortableItemHandle.js +0 -33
  35. package/out/components/sortable/SortableItemHandle.js.map +0 -1
  36. package/out/components/sortable/SortableOverlay.d.ts +0 -9
  37. package/out/components/sortable/SortableOverlay.d.ts.map +0 -1
  38. package/out/components/sortable/SortableOverlay.js +0 -32
  39. package/out/components/sortable/SortableOverlay.js.map +0 -1
  40. package/out/components/sortable/SortableOverlayContext.d.ts +0 -3
  41. package/out/components/sortable/SortableOverlayContext.d.ts.map +0 -1
  42. package/out/components/sortable/SortableOverlayContext.js +0 -4
  43. package/out/components/sortable/SortableOverlayContext.js.map +0 -1
  44. package/out/components/sortable/SortableRootContext.d.ts +0 -4
  45. package/out/components/sortable/SortableRootContext.d.ts.map +0 -1
  46. package/out/components/sortable/SortableRootContext.js +0 -4
  47. package/out/components/sortable/SortableRootContext.js.map +0 -1
  48. package/out/components/sortable/useSortableContext.d.ts +0 -2
  49. package/out/components/sortable/useSortableContext.d.ts.map +0 -1
  50. package/out/components/sortable/useSortableContext.js +0 -10
  51. package/out/components/sortable/useSortableContext.js.map +0 -1
  52. package/out/components/sortable/useSortableItemContext.d.ts +0 -2
  53. package/out/components/sortable/useSortableItemContext.d.ts.map +0 -1
  54. package/out/components/sortable/useSortableItemContext.js +0 -10
  55. package/out/components/sortable/useSortableItemContext.js.map +0 -1
package/tailwind.css CHANGED
@@ -1,7 +1,7 @@
1
1
  @import "tailwindcss";
2
2
  @import "tw-animate-css";
3
-
4
- @custom-variant dark (&:is(.dark *));
3
+ @import "./data-variants.css";
4
+ @import "./superellipse.css";
5
5
 
6
6
  @theme inline {
7
7
  --color-background: var(--background);
@@ -21,13 +21,6 @@
21
21
  --color-primary: var(--primary);
22
22
  --color-card-foreground: var(--card-foreground);
23
23
  --color-card: var(--card);
24
- --radius-sm: calc(var(--radius) * var(--corner-shape-scale) - 4px);
25
- --radius-md: calc(var(--radius) * var(--corner-shape-scale) - 2px);
26
- --radius-lg: calc(var(--radius) * var(--corner-shape-scale));
27
- --radius-xl: calc(var(--radius) * var(--corner-shape-scale) + 4px);
28
- --radius-2xl: calc(var(--radius) * var(--corner-shape-scale) + 8px);
29
- --radius-3xl: calc(var(--radius) * var(--corner-shape-scale) + 12px);
30
- --radius-4xl: calc(var(--radius) * var(--corner-shape-scale) + 16px);
31
24
 
32
25
  @keyframes accordion-down {
33
26
  from {
@@ -49,193 +42,11 @@
49
42
  }
50
43
 
51
44
  @layer base {
52
- *,
53
- ::before,
54
- ::after {
55
- corner-shape: superellipse(1.5);
56
- }
57
-
58
- .rounded-full {
59
- corner-shape: round;
45
+ html {
46
+ @apply bg-background text-foreground overflow-y-scroll scrollbar-thumb-accent scrollbar-track-card;
60
47
  }
61
48
 
62
49
  * {
63
50
  @apply border-border outline-ring/50;
64
51
  }
65
- body {
66
- @apply bg-background text-foreground;
67
- }
68
- }
69
-
70
- :root {
71
- --corner-shape-scale: 1;
72
- }
73
-
74
- @supports (corner-shape: superellipse(1.5)) {
75
- :root {
76
- --corner-shape-scale: 1.4;
77
- }
78
- }
79
-
80
- /* Shadcn Classes */
81
- @custom-variant data-open {
82
- &:where([data-state="open"]),
83
- &:where([data-open]:not([data-open="false"])) {
84
- @slot;
85
- }
86
- }
87
-
88
- @custom-variant data-closed {
89
- &:where([data-state="closed"]),
90
- &:where([data-closed]:not([data-closed="false"])) {
91
- @slot;
92
- }
93
- }
94
-
95
- @custom-variant data-checked {
96
- &:where([data-state="checked"]),
97
- &:where([data-checked]:not([data-checked="false"])) {
98
- @slot;
99
- }
100
- }
101
-
102
- @custom-variant data-unchecked {
103
- &:where([data-state="unchecked"]),
104
- &:where([data-unchecked]:not([data-unchecked="false"])) {
105
- @slot;
106
- }
107
- }
108
-
109
- @custom-variant data-selected {
110
- &:where([data-selected="true"]) {
111
- @slot;
112
- }
113
- }
114
-
115
- @custom-variant data-disabled {
116
- &:where([data-disabled="true"]),
117
- &:where([data-disabled]:not([data-disabled="false"])) {
118
- @slot;
119
- }
120
- }
121
-
122
- @custom-variant data-active {
123
- &:where([data-state="active"]),
124
- &:where([data-active]:not([data-active="false"])) {
125
- @slot;
126
- }
127
- }
128
-
129
- @custom-variant data-horizontal {
130
- &:where([data-orientation="horizontal"]) {
131
- @slot;
132
- }
133
- }
134
-
135
- @custom-variant data-vertical {
136
- &:where([data-orientation="vertical"]) {
137
- @slot;
138
- }
139
- }
140
-
141
- /* Scrollbar Classes */
142
- @theme {
143
- --scrollbar-thumb-color: var(--color-border);
144
- --scrollbar-track-color: var(--color-background);
145
- --scrollbar-gutter-modifier: "";
146
- }
147
-
148
- @utility scrollbar-none {
149
- scrollbar-width: none;
150
- &::-webkit-scrollbar {
151
- display: none;
152
- }
153
- }
154
-
155
- @utility scrollbar {
156
- scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
157
- &::-webkit-scrollbar-thumb {
158
- background-color: var(--scrollbar-thumb-color);
159
- }
160
- &::-webkit-scrollbar-track {
161
- background-color: var(--scrollbar-track-color);
162
- }
163
- }
164
-
165
- @utility scrollbar-stable {
166
- scrollbar-gutter: stable var(--scrollbar-gutter-modifier);
167
- }
168
-
169
- @utility scrollbar-both-edges {
170
- --scrollbar-gutter-modifier: both-edges;
171
- }
172
-
173
- @utility scrollbar-thumb-* {
174
- --scrollbar-thumb-color: --value(--color-*);
175
-
176
- scrollbar-arrow-color: var(--scrollbar-thumb-color);
177
- &::-webkit-scrollbar-thumb {
178
- background-color: var(--scrollbar-thumb-color);
179
- }
180
- &::-webkit-scrollbar-thumb:hover {
181
- background-color: var(--scrollbar-thumb-color);
182
- }
183
- &::-webkit-scrollbar-thumb:active {
184
- background-color: var(--scrollbar-thumb-color);
185
- }
186
- }
187
-
188
- @utility scrollbar-track-* {
189
- --scrollbar-track-color: --value(--color-*);
190
-
191
- scrollbar-track-color: var(--scrollbar-track-color);
192
- scrollbar-darkshadow-color: var(--scrollbar-track-color);
193
- &::-webkit-scrollbar-track {
194
- background-color: var(--scrollbar-track-color);
195
- }
196
- &::-webkit-scrollbar-track:hover {
197
- background-color: var(--scrollbar-track-color);
198
- }
199
- &::-webkit-scrollbar-track:active {
200
- background-color: var(--scrollbar-track-color);
201
- }
202
- }
203
-
204
- html {
205
- overflow-y: scroll;
206
- }
207
-
208
- /* Firefox ONLY — this kills webkit pseudo-elements in Chrome 121+ if applied globally */
209
- @supports not selector(::-webkit-scrollbar) {
210
- * {
211
- scrollbar-width: auto;
212
- scrollbar-color: rgba(128, 128, 128, 0.4) transparent;
213
- }
214
- }
215
-
216
- /* WebKit / Chromium — only runs where ::-webkit-scrollbar is supported */
217
- ::-webkit-scrollbar {
218
- width: 8px;
219
- height: 8px;
220
- }
221
-
222
- ::-webkit-scrollbar-track {
223
- background: transparent;
224
- }
225
-
226
- ::-webkit-scrollbar-thumb {
227
- background: rgba(128, 128, 128, 0.4);
228
- border-radius: 4px;
229
- }
230
-
231
- ::-webkit-scrollbar-thumb:hover {
232
- background: rgba(128, 128, 128, 0.6);
233
- }
234
-
235
- ::-webkit-scrollbar-button {
236
- display: none;
237
- }
238
-
239
- ::-webkit-scrollbar-corner {
240
- background: transparent;
241
52
  }
@@ -1,55 +0,0 @@
1
- import { type DndContextProps, type DragEndEvent, type UniqueIdentifier } from "@dnd-kit/core";
2
- import { type SortableContextProps } from "@dnd-kit/sortable";
3
- export declare const orientationConfig: {
4
- vertical: {
5
- modifiers: import("@dnd-kit/core").Modifier[];
6
- strategy: import("@dnd-kit/sortable").SortingStrategy;
7
- collisionDetection: import("@dnd-kit/core").CollisionDetection;
8
- };
9
- horizontal: {
10
- modifiers: import("@dnd-kit/core").Modifier[];
11
- strategy: import("@dnd-kit/sortable").SortingStrategy;
12
- collisionDetection: import("@dnd-kit/core").CollisionDetection;
13
- };
14
- mixed: {
15
- modifiers: import("@dnd-kit/core").Modifier[];
16
- strategy: undefined;
17
- collisionDetection: import("@dnd-kit/core").CollisionDetection;
18
- };
19
- };
20
- export interface SortableRootContextValue<T> {
21
- id: string;
22
- items: UniqueIdentifier[];
23
- modifiers: DndContextProps["modifiers"];
24
- strategy: SortableContextProps["strategy"];
25
- activeId: UniqueIdentifier | null;
26
- setActiveId: (id: UniqueIdentifier | null) => void;
27
- getItemValue: (item: T) => UniqueIdentifier;
28
- flatCursor: boolean;
29
- disabled: boolean;
30
- }
31
- export default function Sortable<T>(props: DndContextProps & (T extends object ? {
32
- /**
33
- * Callback that returns a unique identifier for each sortable item. Required for array of objects.
34
- * @example getItemValue={(item) => item.id}
35
- */
36
- getItemValue: (item: T) => UniqueIdentifier;
37
- } : {
38
- /**
39
- * Callback that returns a unique identifier for each sortable item. Required for array of objects.
40
- * @example getItemValue={(item) => item.id}
41
- */
42
- getItemValue?: (item: T) => UniqueIdentifier;
43
- }) & {
44
- value: T[];
45
- onValueChange?: (items: T[]) => void;
46
- onMove?: (event: DragEndEvent & {
47
- activeIndex: number;
48
- overIndex: number;
49
- }) => void;
50
- strategy?: SortableContextProps["strategy"];
51
- orientation?: "vertical" | "horizontal" | "mixed";
52
- flatCursor?: boolean;
53
- disabled?: boolean;
54
- }): import("react/jsx-runtime").JSX.Element;
55
- //# sourceMappingURL=Sortable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sortable.d.ts","sourceRoot":"","sources":["../../../components/sortable/Sortable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,eAAe,EACpB,KAAK,YAAY,EAMjB,KAAK,gBAAgB,EAGrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAGN,KAAK,oBAAoB,EAGzB,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;CAgB7B,CAAC;AAEF,MAAM,WAAW,wBAAwB,CAAC,CAAC;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACxC,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC3C,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,gBAAgB,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EACjC,KAAK,EAAE,eAAe,GACrB,CAAC,CAAC,SAAS,MAAM,GACd;IACA;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,gBAAgB,CAAC;CAC5C,GACA;IACA;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,gBAAgB,CAAC;CAC7C,CAAC,GAAG;IACN,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACpF,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAAC;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,2CAqMF"}
@@ -1,149 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { closestCenter, closestCorners, DndContext, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, } from "@dnd-kit/core";
3
- import { restrictToHorizontalAxis, restrictToParentElement, restrictToVerticalAxis } from "@dnd-kit/modifiers";
4
- import { arrayMove, horizontalListSortingStrategy, sortableKeyboardCoordinates, verticalListSortingStrategy, } from "@dnd-kit/sortable";
5
- import { useCallback, useId, useMemo, useState } from "react";
6
- import SortableRootContext from "./SortableRootContext";
7
- export const orientationConfig = {
8
- vertical: {
9
- modifiers: [restrictToVerticalAxis, restrictToParentElement],
10
- strategy: verticalListSortingStrategy,
11
- collisionDetection: closestCenter,
12
- },
13
- horizontal: {
14
- modifiers: [restrictToHorizontalAxis, restrictToParentElement],
15
- strategy: horizontalListSortingStrategy,
16
- collisionDetection: closestCenter,
17
- },
18
- mixed: {
19
- modifiers: [restrictToParentElement],
20
- strategy: undefined,
21
- collisionDetection: closestCorners,
22
- },
23
- };
24
- export default function Sortable(props) {
25
- const { value, onValueChange, collisionDetection, modifiers, strategy, onMove, orientation = "vertical", flatCursor = false, disabled = false, getItemValue: getItemValueProp, accessibility, onDragStart: onDragStartProp, onDragEnd: onDragEndProp, onDragCancel: onDragCancelProp, ...sortableProps } = props;
26
- const id = useId();
27
- const [activeId, setActiveId] = useState(null);
28
- const sensors = useSensors(useSensor(MouseSensor, {
29
- activationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,
30
- }), useSensor(TouchSensor, {
31
- activationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,
32
- }), useSensor(KeyboardSensor, {
33
- coordinateGetter: sortableKeyboardCoordinates,
34
- }));
35
- const config = useMemo(() => orientationConfig[orientation], [orientation]);
36
- const getItemValue = useCallback((item) => {
37
- if (typeof item === "object" && !getItemValueProp) {
38
- throw new Error("`getItemValue` is required when using array of objects");
39
- }
40
- return getItemValueProp ? getItemValueProp(item) : item;
41
- }, [getItemValueProp]);
42
- const items = useMemo(() => value.map((item) => getItemValue(item)), [value, getItemValue]);
43
- const onDragStart = useCallback((event) => {
44
- onDragStartProp?.(event);
45
- if (event.activatorEvent.defaultPrevented) {
46
- return;
47
- }
48
- setActiveId(event.active.id);
49
- }, [onDragStartProp]);
50
- const onDragEnd = useCallback((event) => {
51
- onDragEndProp?.(event);
52
- if (event.activatorEvent.defaultPrevented) {
53
- return;
54
- }
55
- const { active, over } = event;
56
- if (over && active.id !== over?.id) {
57
- const activeIndex = value.findIndex((item) => getItemValue(item) === active.id);
58
- const overIndex = value.findIndex((item) => getItemValue(item) === over.id);
59
- if (onMove) {
60
- onMove({ ...event, activeIndex, overIndex });
61
- }
62
- else {
63
- onValueChange?.(arrayMove(value, activeIndex, overIndex));
64
- }
65
- }
66
- setActiveId(null);
67
- }, [value, onValueChange, onMove, getItemValue, onDragEndProp]);
68
- const onDragCancel = useCallback((event) => {
69
- onDragCancelProp?.(event);
70
- if (event.activatorEvent.defaultPrevented) {
71
- return;
72
- }
73
- setActiveId(null);
74
- }, [onDragCancelProp]);
75
- const announcements = useMemo(() => ({
76
- onDragStart({ active }) {
77
- const activeValue = active.id.toString();
78
- return `Grabbed sortable item "${activeValue}". Current position is ${active.data.current?.sortable.index + 1} of ${value.length}. Use arrow keys to move, space to drop.`;
79
- },
80
- onDragOver({ active, over }) {
81
- if (over) {
82
- const overIndex = over.data.current?.sortable.index ?? 0;
83
- const activeIndex = active.data.current?.sortable.index ?? 0;
84
- const moveDirection = overIndex > activeIndex ? "down" : "up";
85
- const activeValue = active.id.toString();
86
- return `Sortable item "${activeValue}" moved ${moveDirection} to position ${overIndex + 1} of ${value.length}.`;
87
- }
88
- return "Sortable item is no longer over a droppable area. Press escape to cancel.";
89
- },
90
- onDragEnd({ active, over }) {
91
- const activeValue = active.id.toString();
92
- if (over) {
93
- const overIndex = over.data.current?.sortable.index ?? 0;
94
- return `Sortable item "${activeValue}" dropped at position ${overIndex + 1} of ${value.length}.`;
95
- }
96
- return `Sortable item "${activeValue}" dropped. No changes were made.`;
97
- },
98
- onDragCancel({ active }) {
99
- const activeIndex = active.data.current?.sortable.index ?? 0;
100
- const activeValue = active.id.toString();
101
- return `Sorting cancelled. Sortable item "${activeValue}" returned to position ${activeIndex + 1} of ${value.length}.`;
102
- },
103
- onDragMove({ active, over }) {
104
- if (over) {
105
- const overIndex = over.data.current?.sortable.index ?? 0;
106
- const activeIndex = active.data.current?.sortable.index ?? 0;
107
- const moveDirection = overIndex > activeIndex ? "down" : "up";
108
- const activeValue = active.id.toString();
109
- return `Sortable item "${activeValue}" is moving ${moveDirection} to position ${overIndex + 1} of ${value.length}.`;
110
- }
111
- return "Sortable item is no longer over a droppable area. Press escape to cancel.";
112
- },
113
- }), [value]);
114
- const screenReaderInstructions = useMemo(() => ({
115
- draggable: `
116
- To pick up a sortable item, press space or enter.
117
- While dragging, use the ${orientation === "vertical" ? "up and down" : orientation === "horizontal" ? "left and right" : "arrow"} keys to move the item.
118
- Press space or enter again to drop the item in its new position, or press escape to cancel.
119
- `,
120
- }), [orientation]);
121
- const contextValue = useMemo(() => ({
122
- id,
123
- items,
124
- modifiers: modifiers ?? config.modifiers,
125
- strategy: strategy ?? config.strategy,
126
- activeId,
127
- setActiveId,
128
- getItemValue,
129
- flatCursor,
130
- disabled,
131
- }), [
132
- id,
133
- items,
134
- modifiers,
135
- strategy,
136
- config.modifiers,
137
- config.strategy,
138
- activeId,
139
- getItemValue,
140
- flatCursor,
141
- disabled,
142
- ]);
143
- return (_jsx(SortableRootContext.Provider, { value: contextValue, children: _jsx(DndContext, { collisionDetection: collisionDetection ?? config.collisionDetection, modifiers: modifiers ?? config.modifiers, sensors: sensors, ...sortableProps, id: id, onDragStart: onDragStart, onDragEnd: onDragEnd, onDragCancel: onDragCancel, accessibility: {
144
- announcements,
145
- screenReaderInstructions,
146
- ...accessibility,
147
- } }) }));
148
- }
149
- //# sourceMappingURL=Sortable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sortable.js","sourceRoot":"","sources":["../../../components/sortable/Sortable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EACb,cAAc,EACd,UAAU,EAIV,cAAc,EACd,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,UAAU,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EACN,SAAS,EACT,6BAA6B,EAE7B,2BAA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,CAAC,OAAO;;OAEjI;KACJ,CAAC,EACF,CAAC,WAAW,CAAC,CACb,CAAC;IAEF,MAAM,YAAY,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;QACN,EAAE;QACF,KAAK;QACL,SAAS,EAAE,SAAS,IAAI,MAAM,CAAC,SAAS;QACxC,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ;QACrC,QAAQ;QACR,WAAW;QACX,YAAY;QACZ,UAAU;QACV,QAAQ;KACR,CAAC,EACF;QACC,EAAE;QACF,KAAK;QACL,SAAS;QACT,QAAQ;QACR,MAAM,CAAC,SAAS;QAChB,MAAM,CAAC,QAAQ;QACf,QAAQ;QACR,YAAY;QACZ,UAAU;QACV,QAAQ;KACR,CACD,CAAC;IAEF,OAAO,CACN,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAiD,YACrF,KAAC,UAAU,IACV,kBAAkB,EAAE,kBAAkB,IAAI,MAAM,CAAC,kBAAkB,EACnE,SAAS,EAAE,SAAS,IAAI,MAAM,CAAC,SAAS,EACxC,OAAO,EAAE,OAAO,KACZ,aAAa,EACjB,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE;gBACd,aAAa;gBACb,wBAAwB;gBACxB,GAAG,aAAa;aAChB,GACA,GAC4B,CAC/B,CAAC;AACH,CAAC","sourcesContent":["import {\n\ttype Announcements,\n\tclosestCenter,\n\tclosestCorners,\n\tDndContext,\n\ttype DndContextProps,\n\ttype DragEndEvent,\n\ttype DragStartEvent,\n\tKeyboardSensor,\n\tMouseSensor,\n\ttype ScreenReaderInstructions,\n\tTouchSensor,\n\ttype UniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from \"@dnd-kit/core\";\nimport { restrictToHorizontalAxis, restrictToParentElement, restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\nimport {\n\tarrayMove,\n\thorizontalListSortingStrategy,\n\ttype SortableContextProps,\n\tsortableKeyboardCoordinates,\n\tverticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { useCallback, useId, useMemo, useState } from \"react\";\n\nimport SortableRootContext from \"./SortableRootContext\";\n\nexport const orientationConfig = {\n\tvertical: {\n\t\tmodifiers: [restrictToVerticalAxis, restrictToParentElement],\n\t\tstrategy: verticalListSortingStrategy,\n\t\tcollisionDetection: closestCenter,\n\t},\n\thorizontal: {\n\t\tmodifiers: [restrictToHorizontalAxis, restrictToParentElement],\n\t\tstrategy: horizontalListSortingStrategy,\n\t\tcollisionDetection: closestCenter,\n\t},\n\tmixed: {\n\t\tmodifiers: [restrictToParentElement],\n\t\tstrategy: undefined,\n\t\tcollisionDetection: closestCorners,\n\t},\n};\n\nexport interface SortableRootContextValue<T> {\n\tid: string;\n\titems: UniqueIdentifier[];\n\tmodifiers: DndContextProps[\"modifiers\"];\n\tstrategy: SortableContextProps[\"strategy\"];\n\tactiveId: UniqueIdentifier | null;\n\tsetActiveId: (id: UniqueIdentifier | null) => void;\n\tgetItemValue: (item: T) => UniqueIdentifier;\n\tflatCursor: boolean;\n\tdisabled: boolean;\n}\n\nexport default function Sortable<T>(\n\tprops: DndContextProps &\n\t\t(T extends object\n\t\t\t? {\n\t\t\t\t\t/**\n\t\t\t\t\t * Callback that returns a unique identifier for each sortable item. Required for array of objects.\n\t\t\t\t\t * @example getItemValue={(item) => item.id}\n\t\t\t\t\t */\n\t\t\t\t\tgetItemValue: (item: T) => UniqueIdentifier;\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\t/**\n\t\t\t\t\t * Callback that returns a unique identifier for each sortable item. Required for array of objects.\n\t\t\t\t\t * @example getItemValue={(item) => item.id}\n\t\t\t\t\t */\n\t\t\t\t\tgetItemValue?: (item: T) => UniqueIdentifier;\n\t\t\t\t}) & {\n\t\t\tvalue: T[];\n\t\t\tonValueChange?: (items: T[]) => void;\n\t\t\tonMove?: (event: DragEndEvent & { activeIndex: number; overIndex: number }) => void;\n\t\t\tstrategy?: SortableContextProps[\"strategy\"];\n\t\t\torientation?: \"vertical\" | \"horizontal\" | \"mixed\";\n\t\t\tflatCursor?: boolean;\n\t\t\tdisabled?: boolean;\n\t\t}\n) {\n\tconst {\n\t\tvalue,\n\t\tonValueChange,\n\t\tcollisionDetection,\n\t\tmodifiers,\n\t\tstrategy,\n\t\tonMove,\n\t\torientation = \"vertical\",\n\t\tflatCursor = false,\n\t\tdisabled = false,\n\t\tgetItemValue: getItemValueProp,\n\t\taccessibility,\n\t\tonDragStart: onDragStartProp,\n\t\tonDragEnd: onDragEndProp,\n\t\tonDragCancel: onDragCancelProp,\n\t\t...sortableProps\n\t} = props;\n\n\tconst id = useId();\n\tconst [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);\n\n\tconst sensors = useSensors(\n\t\tuseSensor(MouseSensor, {\n\t\t\tactivationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,\n\t\t}),\n\t\tuseSensor(TouchSensor, {\n\t\t\tactivationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,\n\t\t}),\n\t\tuseSensor(KeyboardSensor, {\n\t\t\tcoordinateGetter: sortableKeyboardCoordinates,\n\t\t})\n\t);\n\tconst config = useMemo(() => orientationConfig[orientation], [orientation]);\n\n\tconst getItemValue = useCallback(\n\t\t(item: T): UniqueIdentifier => {\n\t\t\tif (typeof item === \"object\" && !getItemValueProp) {\n\t\t\t\tthrow new Error(\"`getItemValue` is required when using array of objects\");\n\t\t\t}\n\t\t\treturn getItemValueProp ? getItemValueProp(item) : (item as UniqueIdentifier);\n\t\t},\n\t\t[getItemValueProp]\n\t);\n\n\tconst items = useMemo(() => value.map((item) => getItemValue(item)), [value, getItemValue]);\n\n\tconst onDragStart = useCallback(\n\t\t(event: DragStartEvent) => {\n\t\t\tonDragStartProp?.(event);\n\n\t\t\tif (event.activatorEvent.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetActiveId(event.active.id);\n\t\t},\n\t\t[onDragStartProp]\n\t);\n\n\tconst onDragEnd = useCallback(\n\t\t(event: DragEndEvent) => {\n\t\t\tonDragEndProp?.(event);\n\n\t\t\tif (event.activatorEvent.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { active, over } = event;\n\t\t\tif (over && active.id !== over?.id) {\n\t\t\t\tconst activeIndex = value.findIndex((item) => getItemValue(item) === active.id);\n\t\t\t\tconst overIndex = value.findIndex((item) => getItemValue(item) === over.id);\n\n\t\t\t\tif (onMove) {\n\t\t\t\t\tonMove({ ...event, activeIndex, overIndex });\n\t\t\t\t} else {\n\t\t\t\t\tonValueChange?.(arrayMove(value, activeIndex, overIndex));\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetActiveId(null);\n\t\t},\n\t\t[value, onValueChange, onMove, getItemValue, onDragEndProp]\n\t);\n\n\tconst onDragCancel = useCallback(\n\t\t(event: DragEndEvent) => {\n\t\t\tonDragCancelProp?.(event);\n\n\t\t\tif (event.activatorEvent.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetActiveId(null);\n\t\t},\n\t\t[onDragCancelProp]\n\t);\n\n\tconst announcements: Announcements = useMemo(\n\t\t() => ({\n\t\t\tonDragStart({ active }) {\n\t\t\t\tconst activeValue = active.id.toString();\n\t\t\t\treturn `Grabbed sortable item \"${activeValue}\". Current position is ${active.data.current?.sortable.index + 1} of ${value.length}. Use arrow keys to move, space to drop.`;\n\t\t\t},\n\t\t\tonDragOver({ active, over }) {\n\t\t\t\tif (over) {\n\t\t\t\t\tconst overIndex = over.data.current?.sortable.index ?? 0;\n\t\t\t\t\tconst activeIndex = active.data.current?.sortable.index ?? 0;\n\t\t\t\t\tconst moveDirection = overIndex > activeIndex ? \"down\" : \"up\";\n\t\t\t\t\tconst activeValue = active.id.toString();\n\t\t\t\t\treturn `Sortable item \"${activeValue}\" moved ${moveDirection} to position ${overIndex + 1} of ${value.length}.`;\n\t\t\t\t}\n\t\t\t\treturn \"Sortable item is no longer over a droppable area. Press escape to cancel.\";\n\t\t\t},\n\t\t\tonDragEnd({ active, over }) {\n\t\t\t\tconst activeValue = active.id.toString();\n\t\t\t\tif (over) {\n\t\t\t\t\tconst overIndex = over.data.current?.sortable.index ?? 0;\n\t\t\t\t\treturn `Sortable item \"${activeValue}\" dropped at position ${overIndex + 1} of ${value.length}.`;\n\t\t\t\t}\n\t\t\t\treturn `Sortable item \"${activeValue}\" dropped. No changes were made.`;\n\t\t\t},\n\t\t\tonDragCancel({ active }) {\n\t\t\t\tconst activeIndex = active.data.current?.sortable.index ?? 0;\n\t\t\t\tconst activeValue = active.id.toString();\n\t\t\t\treturn `Sorting cancelled. Sortable item \"${activeValue}\" returned to position ${activeIndex + 1} of ${value.length}.`;\n\t\t\t},\n\t\t\tonDragMove({ active, over }) {\n\t\t\t\tif (over) {\n\t\t\t\t\tconst overIndex = over.data.current?.sortable.index ?? 0;\n\t\t\t\t\tconst activeIndex = active.data.current?.sortable.index ?? 0;\n\t\t\t\t\tconst moveDirection = overIndex > activeIndex ? \"down\" : \"up\";\n\t\t\t\t\tconst activeValue = active.id.toString();\n\t\t\t\t\treturn `Sortable item \"${activeValue}\" is moving ${moveDirection} to position ${overIndex + 1} of ${value.length}.`;\n\t\t\t\t}\n\t\t\t\treturn \"Sortable item is no longer over a droppable area. Press escape to cancel.\";\n\t\t\t},\n\t\t}),\n\t\t[value]\n\t);\n\n\tconst screenReaderInstructions: ScreenReaderInstructions = useMemo(\n\t\t() => ({\n\t\t\tdraggable: `\n To pick up a sortable item, press space or enter.\n While dragging, use the ${orientation === \"vertical\" ? \"up and down\" : orientation === \"horizontal\" ? \"left and right\" : \"arrow\"} keys to move the item.\n Press space or enter again to drop the item in its new position, or press escape to cancel.\n `,\n\t\t}),\n\t\t[orientation]\n\t);\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tid,\n\t\t\titems,\n\t\t\tmodifiers: modifiers ?? config.modifiers,\n\t\t\tstrategy: strategy ?? config.strategy,\n\t\t\tactiveId,\n\t\t\tsetActiveId,\n\t\t\tgetItemValue,\n\t\t\tflatCursor,\n\t\t\tdisabled,\n\t\t}),\n\t\t[\n\t\t\tid,\n\t\t\titems,\n\t\t\tmodifiers,\n\t\t\tstrategy,\n\t\t\tconfig.modifiers,\n\t\t\tconfig.strategy,\n\t\t\tactiveId,\n\t\t\tgetItemValue,\n\t\t\tflatCursor,\n\t\t\tdisabled,\n\t\t]\n\t);\n\n\treturn (\n\t\t<SortableRootContext.Provider value={contextValue as SortableRootContextValue<unknown>}>\n\t\t\t<DndContext\n\t\t\t\tcollisionDetection={collisionDetection ?? config.collisionDetection}\n\t\t\t\tmodifiers={modifiers ?? config.modifiers}\n\t\t\t\tsensors={sensors}\n\t\t\t\t{...sortableProps}\n\t\t\t\tid={id}\n\t\t\t\tonDragStart={onDragStart}\n\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\tonDragCancel={onDragCancel}\n\t\t\t\taccessibility={{\n\t\t\t\t\tannouncements,\n\t\t\t\t\tscreenReaderInstructions,\n\t\t\t\t\t...accessibility,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</SortableRootContext.Provider>\n\t);\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { type SortableContextProps } from "@dnd-kit/sortable";
2
- import { type ComponentPropsWithRef, type ElementType, type ReactElement, type ReactNode } from "react";
3
- export default function SortableContent<T extends ElementType = "div">(props: {
4
- strategy?: SortableContextProps["strategy"];
5
- children: ReactNode;
6
- render?: ReactElement<T>;
7
- withoutSlot?: boolean;
8
- } & ComponentPropsWithRef<T>): import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=SortableContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableContent.d.ts","sourceRoot":"","sources":["../../../components/sortable/SortableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAgB,MAAM,OAAO,CAAC;AAKtH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EACpE,KAAK,EAAE;IACN,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5C,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,qBAAqB,CAAC,CAAC,CAAC,2CA0B5B"}
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { SortableContext } from "@dnd-kit/sortable";
3
- import { cloneElement } from "react";
4
- import SortableContentContext from "./SortableContentContext";
5
- import useSortableContext from "./useSortableContext";
6
- export default function SortableContent(props) {
7
- const { strategy: strategyProp, render, withoutSlot, children, ...contentProps } = props;
8
- const context = useSortableContext();
9
- const element = render ? (cloneElement(render, {
10
- ...contentProps,
11
- ...render.props,
12
- children,
13
- "data-slot": "sortable-content",
14
- })) : (_jsx("div", { "data-slot": "sortable-content", ...contentProps, children: children }));
15
- return (_jsx(SortableContentContext.Provider, { value: true, children: _jsx(SortableContext, { items: context.items, strategy: strategyProp ?? context.strategy, children: withoutSlot ? children : element }) }));
16
- }
17
- //# sourceMappingURL=SortableContent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableContent.js","sourceRoot":"","sources":["../../../components/sortable/SortableContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAA6B,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAmF,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtH,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,eAAe,CACtC,KAK4B;IAE5B,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAEzF,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CACxB,YAAY,CAAC,MAAM,EAAE;QACpB,GAAG,YAAY;QACf,GAAG,MAAM,CAAC,KAAK;QACf,QAAQ;QACR,WAAW,EAAE,kBAAkB;KAC/B,CAAC,CACF,CAAC,CAAC,CAAC,CACH,2BAAe,kBAAkB,KAAK,YAAY,YAChD,QAAQ,GACJ,CACN,CAAC;IAEF,OAAO,CACN,KAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAC3C,KAAC,eAAe,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,IAAI,OAAO,CAAC,QAAQ,YAC/E,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,GAChB,GACe,CAClC,CAAC;AACH,CAAC","sourcesContent":["import { SortableContext, type SortableContextProps } from \"@dnd-kit/sortable\";\nimport { type ComponentPropsWithRef, type ElementType, type ReactElement, type ReactNode, cloneElement } from \"react\";\n\nimport SortableContentContext from \"./SortableContentContext\";\nimport useSortableContext from \"./useSortableContext\";\n\nexport default function SortableContent<T extends ElementType = \"div\">(\n\tprops: {\n\t\tstrategy?: SortableContextProps[\"strategy\"];\n\t\tchildren: ReactNode;\n\t\trender?: ReactElement<T>;\n\t\twithoutSlot?: boolean;\n\t} & ComponentPropsWithRef<T>\n) {\n\tconst { strategy: strategyProp, render, withoutSlot, children, ...contentProps } = props;\n\n\tconst context = useSortableContext();\n\n\tconst element = render ? (\n\t\tcloneElement(render, {\n\t\t\t...contentProps,\n\t\t\t...render.props,\n\t\t\tchildren,\n\t\t\t\"data-slot\": \"sortable-content\",\n\t\t})\n\t) : (\n\t\t<div data-slot=\"sortable-content\" {...contentProps}>\n\t\t\t{children}\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<SortableContentContext.Provider value={true}>\n\t\t\t<SortableContext items={context.items} strategy={strategyProp ?? context.strategy}>\n\t\t\t\t{withoutSlot ? children : element}\n\t\t\t</SortableContext>\n\t\t</SortableContentContext.Provider>\n\t);\n}\n"]}
@@ -1,3 +0,0 @@
1
- declare const SortableContentContext: import("react").Context<boolean>;
2
- export default SortableContentContext;
3
- //# sourceMappingURL=SortableContentContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableContentContext.d.ts","sourceRoot":"","sources":["../../../components/sortable/SortableContentContext.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,sBAAsB,kCAAgC,CAAC;AAE7D,eAAe,sBAAsB,CAAC"}
@@ -1,4 +0,0 @@
1
- import { createContext } from "react";
2
- const SortableContentContext = createContext(false);
3
- export default SortableContentContext;
4
- //# sourceMappingURL=SortableContentContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableContentContext.js","sourceRoot":"","sources":["../../../components/sortable/SortableContentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,sBAAsB,GAAG,aAAa,CAAU,KAAK,CAAC,CAAC;AAE7D,eAAe,sBAAsB,CAAC","sourcesContent":["import { createContext } from \"react\";\n\nconst SortableContentContext = createContext<boolean>(false);\n\nexport default SortableContentContext;\n"]}
@@ -1,18 +0,0 @@
1
- import { type UniqueIdentifier, type DraggableAttributes, type DraggableSyntheticListeners } from "@dnd-kit/core";
2
- import { type ComponentPropsWithRef, type ElementType, type ReactElement } from "react";
3
- export interface SortableItemContextValue {
4
- id: string;
5
- attributes: DraggableAttributes;
6
- listeners: DraggableSyntheticListeners | undefined;
7
- setActivatorNodeRef: (node: HTMLElement | null) => void;
8
- isDragging?: boolean;
9
- disabled?: boolean;
10
- }
11
- export declare const SortableItemContext: import("react").Context<SortableItemContextValue | null>;
12
- export default function SortableItem<T extends ElementType = "div">(props: {
13
- value: UniqueIdentifier;
14
- asHandle?: boolean;
15
- render?: ReactElement<T>;
16
- disabled?: boolean;
17
- } & ComponentPropsWithRef<T>): import("react/jsx-runtime").JSX.Element;
18
- //# sourceMappingURL=SortableItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableItem.d.ts","sourceRoot":"","sources":["../../../components/sortable/SortableItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAIlH,OAAO,EACN,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAChB,KAAK,YAAY,EAMjB,MAAM,OAAO,CAAC;AAQf,MAAM,WAAW,wBAAwB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,mBAAmB,CAAC;IAChC,SAAS,EAAE,2BAA2B,GAAG,SAAS,CAAC;IACnD,mBAAmB,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,0DAAuD,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EACjE,KAAK,EAAE;IACN,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,qBAAqB,CAAC,CAAC,CAAC,2CAgF5B"}
@@ -1,71 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useSortable } from "@dnd-kit/sortable";
3
- import { CSS } from "@dnd-kit/utilities";
4
- import { useComposedRefs } from "motion/react";
5
- import { cloneElement, createContext, useContext, useId, useMemo, } from "react";
6
- import cn from "../../cn";
7
- import SortableContentContext from "./SortableContentContext";
8
- import SortableOverlayContext from "./SortableOverlayContext";
9
- import useSortableContext from "./useSortableContext";
10
- export const SortableItemContext = createContext(null);
11
- export default function SortableItem(props) {
12
- const { value, style, asHandle, render, disabled, className, ref, ...itemProps } = props;
13
- const inSortableContent = useContext(SortableContentContext);
14
- const inSortableOverlay = useContext(SortableOverlayContext);
15
- if (!inSortableContent && !inSortableOverlay) {
16
- throw new Error("`SortableItem` must be used within `SortableContent` or `SortableOverlay`");
17
- }
18
- if (value === "") {
19
- throw new Error("`SortableItem` value cannot be an empty string");
20
- }
21
- const context = useSortableContext();
22
- const id = useId();
23
- const isDisabled = disabled ?? context.disabled;
24
- const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
25
- id: value,
26
- disabled: isDisabled,
27
- });
28
- const composedRef = useComposedRefs(ref, (node) => {
29
- if (isDisabled) {
30
- return;
31
- }
32
- setNodeRef(node);
33
- if (asHandle) {
34
- setActivatorNodeRef(node);
35
- }
36
- });
37
- const composedStyle = useMemo(() => ({
38
- transform: CSS.Translate.toString(transform),
39
- transition,
40
- ...style,
41
- }), [transform, transition, style]);
42
- const itemContext = useMemo(() => ({
43
- id,
44
- attributes,
45
- listeners,
46
- setActivatorNodeRef,
47
- isDragging,
48
- disabled: isDisabled,
49
- }), [id, attributes, listeners, setActivatorNodeRef, isDragging, isDisabled]);
50
- const mergedProps = {
51
- id,
52
- "data-disabled": isDisabled,
53
- "data-dragging": isDragging ? "" : undefined,
54
- "data-slot": "sortable-item",
55
- ...itemProps,
56
- ...(asHandle && !isDisabled ? attributes : {}),
57
- ...(asHandle && !isDisabled ? listeners : {}),
58
- ref: composedRef,
59
- style: composedStyle,
60
- className: cn("focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:ring-offset-1 focus-visible:outline-hidden dark:focus-visible:ring-neutral-300", {
61
- "touch-none select-none": asHandle && !isDisabled,
62
- "cursor-default": context.flatCursor || isDisabled,
63
- "data-dragging:cursor-grabbing": !context.flatCursor && !isDisabled,
64
- "cursor-grab": !isDragging && asHandle && !context.flatCursor && !isDisabled,
65
- "opacity-50": isDragging,
66
- }, className),
67
- };
68
- const element = render ? cloneElement(render, mergedProps) : _jsx("div", { ...mergedProps });
69
- return _jsx(SortableItemContext.Provider, { value: itemContext, children: element });
70
- }
71
- //# sourceMappingURL=SortableItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableItem.js","sourceRoot":"","sources":["../../../components/sortable/SortableItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAKN,YAAY,EACZ,aAAa,EACb,UAAU,EACV,KAAK,EACL,OAAO,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAWtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAkC,IAAI,CAAC,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,YAAY,CACnC,KAK4B;IAE5B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEzF,MAAM,iBAAiB,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC7D,MAAM,iBAAiB,GAAG,UAAU,CAAC,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AC,EACF,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,UAAU,CAAC,CACxE,CAAC;IAEF,MAAM,WAAW,GAAG;QACnB,EAAE;QACF,eAAe,EAAE,UAAU;QAC3B,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5C,WAAW,EAAE,eAAe;QAC5B,GAAG,SAAS;QACZ,GAAG,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,GAAG,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,aAAa;QACpB,SAAS,EAAE,EAAE,CACZ,kJAAkJ,EAClJ;YACC,wBAAwB,EAAE,QAAQ,IAAI,CAAC,UAAU;YACjD,gBAAgB,EAAE,OAAO,CAAC,UAAU,IAAI,UAAU;YAClD,+BAA+B,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,UAAU;YACnE,aAAa,EAAE,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,UAAU;YAC5E,YAAY,EAAE,UAAU;SACxB,EACD,SAAS,CACT;KACD,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,iBAAS,WAAW,GAAI,CAAC;IAEtF,OAAO,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,OAAO,GAAgC,CAAC;AACnG,CAAC","sourcesContent":["import { type UniqueIdentifier, type DraggableAttributes, type DraggableSyntheticListeners } from \"@dnd-kit/core\";\nimport { useSortable } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { useComposedRefs } from \"motion/react\";\nimport {\n\ttype ComponentPropsWithRef,\n\ttype CSSProperties,\n\ttype ElementType,\n\ttype ReactElement,\n\tcloneElement,\n\tcreateContext,\n\tuseContext,\n\tuseId,\n\tuseMemo,\n} from \"react\";\n\nimport cn from \"@/cn\";\n\nimport SortableContentContext from \"./SortableContentContext\";\nimport SortableOverlayContext from \"./SortableOverlayContext\";\nimport useSortableContext from \"./useSortableContext\";\n\nexport interface SortableItemContextValue {\n\tid: string;\n\tattributes: DraggableAttributes;\n\tlisteners: DraggableSyntheticListeners | undefined;\n\tsetActivatorNodeRef: (node: HTMLElement | null) => void;\n\tisDragging?: boolean;\n\tdisabled?: boolean;\n}\n\nexport const SortableItemContext = createContext<SortableItemContextValue | null>(null);\n\nexport default function SortableItem<T extends ElementType = \"div\">(\n\tprops: {\n\t\tvalue: UniqueIdentifier;\n\t\tasHandle?: boolean;\n\t\trender?: ReactElement<T>;\n\t\tdisabled?: boolean;\n\t} & ComponentPropsWithRef<T>\n) {\n\tconst { value, style, asHandle, render, disabled, className, ref, ...itemProps } = props;\n\n\tconst inSortableContent = useContext(SortableContentContext);\n\tconst inSortableOverlay = useContext(SortableOverlayContext);\n\n\tif (!inSortableContent && !inSortableOverlay) {\n\t\tthrow new Error(\"`SortableItem` must be used within `SortableContent` or `SortableOverlay`\");\n\t}\n\n\tif (value === \"\") {\n\t\tthrow new Error(\"`SortableItem` value cannot be an empty string\");\n\t}\n\n\tconst context = useSortableContext();\n\tconst id = useId();\n\tconst isDisabled = disabled ?? context.disabled;\n\tconst { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({\n\t\tid: value,\n\t\tdisabled: isDisabled,\n\t});\n\n\tconst composedRef = useComposedRefs(ref, (node: HTMLElement | null) => {\n\t\tif (isDisabled) {\n\t\t\treturn;\n\t\t}\n\t\tsetNodeRef(node);\n\t\tif (asHandle) {\n\t\t\tsetActivatorNodeRef(node);\n\t\t}\n\t});\n\n\tconst composedStyle = useMemo<CSSProperties>(\n\t\t() => ({\n\t\t\ttransform: CSS.Translate.toString(transform),\n\t\t\ttransition,\n\t\t\t...style,\n\t\t}),\n\t\t[transform, transition, style]\n\t);\n\n\tconst itemContext = useMemo<SortableItemContextValue>(\n\t\t() => ({\n\t\t\tid,\n\t\t\tattributes,\n\t\t\tlisteners,\n\t\t\tsetActivatorNodeRef,\n\t\t\tisDragging,\n\t\t\tdisabled: isDisabled,\n\t\t}),\n\t\t[id, attributes, listeners, setActivatorNodeRef, isDragging, isDisabled]\n\t);\n\n\tconst mergedProps = {\n\t\tid,\n\t\t\"data-disabled\": isDisabled,\n\t\t\"data-dragging\": isDragging ? \"\" : undefined,\n\t\t\"data-slot\": \"sortable-item\",\n\t\t...itemProps,\n\t\t...(asHandle && !isDisabled ? attributes : {}),\n\t\t...(asHandle && !isDisabled ? listeners : {}),\n\t\tref: composedRef,\n\t\tstyle: composedStyle,\n\t\tclassName: cn(\n\t\t\t\"focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:ring-offset-1 focus-visible:outline-hidden dark:focus-visible:ring-neutral-300\",\n\t\t\t{\n\t\t\t\t\"touch-none select-none\": asHandle && !isDisabled,\n\t\t\t\t\"cursor-default\": context.flatCursor || isDisabled,\n\t\t\t\t\"data-dragging:cursor-grabbing\": !context.flatCursor && !isDisabled,\n\t\t\t\t\"cursor-grab\": !isDragging && asHandle && !context.flatCursor && !isDisabled,\n\t\t\t\t\"opacity-50\": isDragging,\n\t\t\t},\n\t\t\tclassName\n\t\t),\n\t};\n\n\tconst element = render ? cloneElement(render, mergedProps) : <div {...mergedProps} />;\n\n\treturn <SortableItemContext.Provider value={itemContext}>{element}</SortableItemContext.Provider>;\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { type ComponentPropsWithRef, type ElementType, type ReactElement } from "react";
2
- export default function SortableItemHandle<T extends ElementType = "button">(props: {
3
- render?: ReactElement<T>;
4
- } & ComponentPropsWithRef<T>): import("react/jsx-runtime").JSX.Element;
5
- //# sourceMappingURL=SortableItemHandle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableItemHandle.d.ts","sourceRoot":"","sources":["../../../components/sortable/SortableItemHandle.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAOtG,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EAC1E,KAAK,EAAE;IACN,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CACzB,GAAG,qBAAqB,CAAC,CAAC,CAAC,2CAmC5B"}