@powered-by-array/ui 1.108.0 → 1.110.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/components/DragDrop/DragDropList/DragDropItem/DragDropItem.d.ts +14 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/DragDropItem.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/DragDropItem.js +51 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/DragDropItem.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/index.d.ts +2 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/index.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/index.js +2 -0
- package/dist/components/DragDrop/DragDropList/DragDropItem/index.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.d.ts +12 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.js +18 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.types.d.ts +47 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.types.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.types.js +2 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.types.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.utils.d.ts +8 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.utils.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.utils.js +22 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.utils.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.variants.d.ts +15 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.variants.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.variants.js +31 -0
- package/dist/components/DragDrop/DragDropList/DragDropList.variants.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/hooks/useDragDropList.d.ts +21 -0
- package/dist/components/DragDrop/DragDropList/hooks/useDragDropList.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/hooks/useDragDropList.js +51 -0
- package/dist/components/DragDrop/DragDropList/hooks/useDragDropList.js.map +1 -0
- package/dist/components/DragDrop/DragDropList/index.d.ts +4 -0
- package/dist/components/DragDrop/DragDropList/index.d.ts.map +1 -0
- package/dist/components/DragDrop/DragDropList/index.js +3 -0
- package/dist/components/DragDrop/DragDropList/index.js.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.d.ts +9 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.d.ts.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.js +14 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.js.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.types.d.ts +14 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.types.d.ts.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.types.js +2 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.types.js.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.variants.d.ts +15 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.variants.d.ts.map +1 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.variants.js +27 -0
- package/dist/components/DragDrop/QuestionItem/QuestionItem.variants.js.map +1 -0
- package/dist/components/DragDrop/QuestionItem/index.d.ts +3 -0
- package/dist/components/DragDrop/QuestionItem/index.d.ts.map +1 -0
- package/dist/components/DragDrop/QuestionItem/index.js +2 -0
- package/dist/components/DragDrop/QuestionItem/index.js.map +1 -0
- package/dist/components/DragDrop/index.d.ts +5 -0
- package/dist/components/DragDrop/index.d.ts.map +1 -0
- package/dist/components/DragDrop/index.js +3 -0
- package/dist/components/DragDrop/index.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.constants.d.ts +6 -0
- package/dist/components/Sidebar/Sidebar.constants.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.constants.js +8 -0
- package/dist/components/Sidebar/Sidebar.constants.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.js +12 -5
- package/dist/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +6 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.variants.d.ts +6 -0
- package/dist/components/Sidebar/Sidebar.variants.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.variants.js +11 -0
- package/dist/components/Sidebar/Sidebar.variants.js.map +1 -1
- package/dist/components/Sidebar/SidebarProvider.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarProvider.js +33 -6
- package/dist/components/Sidebar/SidebarProvider.js.map +1 -1
- package/dist/components/Sidebar/hooks/useSidebarResize.d.ts +17 -0
- package/dist/components/Sidebar/hooks/useSidebarResize.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useSidebarResize.js +50 -0
- package/dist/components/Sidebar/hooks/useSidebarResize.js.map +1 -0
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +1 -0
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DragDropItemProps } from "../DragDropList.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A single reorderable row: the card surface, the grip handle, and the
|
|
4
|
+
* consumer-supplied content.
|
|
5
|
+
*
|
|
6
|
+
* The handle — not the row — carries `draggable`, so selecting text in the row
|
|
7
|
+
* body never starts a drag and Chrome sees the attribute at mousedown time
|
|
8
|
+
* (making the row draggable only on pointer-down races the browser and the drag
|
|
9
|
+
* never begins). Drag events bubble from the handle to the row, which owns the
|
|
10
|
+
* drop targeting. The handle is a real button, so keyboard users reorder with
|
|
11
|
+
* ArrowUp/ArrowDown and Home/End.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DragDropItem({ label, position, count, isDragging, isDropTarget, disabled, onDragStart, onDragEnter, onDragEnd, onDrop, onMove, onMoveToEdge, children, }: DragDropItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=DragDropItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/DragDropItem/DragDropItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,YAAY,EACZ,QAAQ,GACT,EAAE,iBAAiB,2CA2EnB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { GripVertical } from "lucide-react";
|
|
4
|
+
import { dragDropItemClasses } from "../DragDropList.variants.js";
|
|
5
|
+
/**
|
|
6
|
+
* A single reorderable row: the card surface, the grip handle, and the
|
|
7
|
+
* consumer-supplied content.
|
|
8
|
+
*
|
|
9
|
+
* The handle — not the row — carries `draggable`, so selecting text in the row
|
|
10
|
+
* body never starts a drag and Chrome sees the attribute at mousedown time
|
|
11
|
+
* (making the row draggable only on pointer-down races the browser and the drag
|
|
12
|
+
* never begins). Drag events bubble from the handle to the row, which owns the
|
|
13
|
+
* drop targeting. The handle is a real button, so keyboard users reorder with
|
|
14
|
+
* ArrowUp/ArrowDown and Home/End.
|
|
15
|
+
*/
|
|
16
|
+
export function DragDropItem({ label, position, count, isDragging, isDropTarget, disabled, onDragStart, onDragEnter, onDragEnd, onDrop, onMove, onMoveToEdge, children, }) {
|
|
17
|
+
const rowRef = React.useRef(null);
|
|
18
|
+
function handleKeyDown(event) {
|
|
19
|
+
if (disabled)
|
|
20
|
+
return;
|
|
21
|
+
const actions = {
|
|
22
|
+
ArrowUp: () => onMove(-1),
|
|
23
|
+
ArrowDown: () => onMove(1),
|
|
24
|
+
Home: () => onMoveToEdge("first"),
|
|
25
|
+
End: () => onMoveToEdge("last"),
|
|
26
|
+
};
|
|
27
|
+
const action = actions[event.key];
|
|
28
|
+
if (!action)
|
|
29
|
+
return;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
action();
|
|
32
|
+
}
|
|
33
|
+
function handleDragStart(event) {
|
|
34
|
+
// Firefox refuses to start a drag without any transfer data.
|
|
35
|
+
event.dataTransfer.setData("text/plain", label);
|
|
36
|
+
event.dataTransfer.effectAllowed = "move";
|
|
37
|
+
// Drag the whole row, not just the handle glyph.
|
|
38
|
+
if (rowRef.current) {
|
|
39
|
+
event.dataTransfer.setDragImage(rowRef.current, 16, 16);
|
|
40
|
+
}
|
|
41
|
+
onDragStart();
|
|
42
|
+
}
|
|
43
|
+
return (_jsxs("li", { ref: rowRef, "data-slot": "drag-drop-item", "data-dragging": isDragging, className: dragDropItemClasses.root, onDragEnter: onDragEnter, onDragOver: (event) => {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.dataTransfer.dropEffect = "move";
|
|
46
|
+
}, onDragEnd: onDragEnd, onDrop: (event) => {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
onDrop();
|
|
49
|
+
}, children: [isDropTarget && !isDragging ? (_jsx("span", { "data-slot": "drag-drop-item-indicator", "aria-hidden": "true", className: dragDropItemClasses.dropIndicator })) : null, _jsx("button", { type: "button", "data-slot": "drag-drop-item-handle", className: dragDropItemClasses.handle, disabled: disabled, draggable: !disabled, "aria-label": `Reorder ${label}, position ${position} of ${count}`, "aria-roledescription": "Drag handle", onDragStart: handleDragStart, onKeyDown: handleKeyDown, children: _jsx(GripVertical, {}) }), _jsx("div", { "data-slot": "drag-drop-item-content", className: dragDropItemClasses.content, children: children })] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=DragDropItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropItem.js","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/DragDropItem/DragDropItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,YAAY,EACZ,QAAQ,GACU;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEjD,SAAS,aAAa,CAAC,KAA6C;QAClE,IAAI,QAAQ;YAAE,OAAO;QAErB,MAAM,OAAO,GAA+B;YAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1B,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;YACjC,GAAG,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;SAChC,CAAC;QAEF,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,EAAE,CAAC;IACX,CAAC;IAED,SAAS,eAAe,CAAC,KAAyC;QAChE,6DAA6D;QAC7D,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAChD,KAAK,CAAC,YAAY,CAAC,aAAa,GAAG,MAAM,CAAC;QAE1C,iDAAiD;QACjD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,CACL,cACE,GAAG,EAAE,MAAM,eACD,gBAAgB,mBACX,UAAU,EACzB,SAAS,EAAE,mBAAmB,CAAC,IAAI,EACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;QACzC,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,EAAE,CAAC;QACX,CAAC,aAEA,YAAY,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAC7B,4BACY,0BAA0B,iBACxB,MAAM,EAClB,SAAS,EAAE,mBAAmB,CAAC,aAAa,GAC5C,CACH,CAAC,CAAC,CAAC,IAAI,EACR,iBACE,IAAI,EAAC,QAAQ,eACH,uBAAuB,EACjC,SAAS,EAAE,mBAAmB,CAAC,MAAM,EACrC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,CAAC,QAAQ,gBACR,WAAW,KAAK,cAAc,QAAQ,OAAO,KAAK,EAAE,0BAC3C,aAAa,EAClC,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,aAAa,YAExB,KAAC,YAAY,KAAG,GACT,EACT,2BAAe,wBAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,OAAO,YAC3E,QAAQ,GACL,IACH,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/DragDropItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/DragDropItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DragDropListProps } from "./DragDropList.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reorderable list built on native HTML5 drag events — no drag-and-drop
|
|
4
|
+
* dependency. The list owns the row card and the grip handle; `children`
|
|
5
|
+
* renders each row's content (Figma node 5700:15127 pairs it with
|
|
6
|
+
* `QuestionItem`).
|
|
7
|
+
*
|
|
8
|
+
* State stays with the consumer: `DragDropList` never mutates `items`, it emits
|
|
9
|
+
* the reordered array through `onReorder`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DragDropList<TItem>({ items, getItemId, onReorder, children, getItemLabel, disabled, "aria-label": ariaLabel, }: DragDropListProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=DragDropList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,EAClC,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EAAE,SAAS,GACxB,EAAE,iBAAiB,CAAC,KAAK,CAAC,2CAwC1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DragDropItem } from "./DragDropItem/index.js";
|
|
3
|
+
import { useDragDropList } from "./hooks/useDragDropList.js";
|
|
4
|
+
import { dragDropListClasses } from "./DragDropList.variants.js";
|
|
5
|
+
/**
|
|
6
|
+
* Reorderable list built on native HTML5 drag events — no drag-and-drop
|
|
7
|
+
* dependency. The list owns the row card and the grip handle; `children`
|
|
8
|
+
* renders each row's content (Figma node 5700:15127 pairs it with
|
|
9
|
+
* `QuestionItem`).
|
|
10
|
+
*
|
|
11
|
+
* State stays with the consumer: `DragDropList` never mutates `items`, it emits
|
|
12
|
+
* the reordered array through `onReorder`.
|
|
13
|
+
*/
|
|
14
|
+
export function DragDropList({ items, getItemId, onReorder, children, getItemLabel, disabled, "aria-label": ariaLabel, }) {
|
|
15
|
+
const { draggingIndex, dropIndex, commit, handleDragStart, handleDragEnter, handleDragEnd, handleDrop, } = useDragDropList({ items, onReorder });
|
|
16
|
+
return (_jsx("ul", { "data-slot": "drag-drop-list", className: dragDropListClasses.root, "aria-label": ariaLabel, children: items.map((item, index) => (_jsx(DragDropItem, { label: getItemLabel?.(item, index) ?? `Item ${index + 1}`, position: index + 1, count: items.length, isDragging: draggingIndex === index, isDropTarget: dropIndex === index && draggingIndex !== null, disabled: disabled, onDragStart: () => handleDragStart(index), onDragEnter: () => handleDragEnter(index), onDragEnd: handleDragEnd, onDrop: () => handleDrop(index), onMove: (offset) => commit(index, index + offset), onMoveToEdge: (edge) => commit(index, edge === "first" ? 0 : items.length - 1), children: children(item, index) }, getItemId(item)))) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DragDropList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAQ,EAClC,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EAAE,SAAS,GACE;IACzB,MAAM,EACJ,aAAa,EACb,SAAS,EACT,MAAM,EACN,eAAe,EACf,eAAe,EACf,aAAa,EACb,UAAU,GACX,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAE1C,OAAO,CACL,0BACY,gBAAgB,EAC1B,SAAS,EAAE,mBAAmB,CAAC,IAAI,gBACvB,SAAS,YAEpB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,KAAC,YAAY,IAEX,KAAK,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC,EAAE,EACzD,QAAQ,EAAE,KAAK,GAAG,CAAC,EACnB,KAAK,EAAE,KAAK,CAAC,MAAM,EACnB,UAAU,EAAE,aAAa,KAAK,KAAK,EACnC,YAAY,EAAE,SAAS,KAAK,KAAK,IAAI,aAAa,KAAK,IAAI,EAC3D,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EACzC,WAAW,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EACzC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,EACjD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CACrB,MAAM,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,YAGvD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAhBjB,SAAS,CAAC,IAAI,CAAC,CAiBP,CAChB,CAAC,GACC,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Where an item moved from and to, both zero-based indices into the item array. */
|
|
3
|
+
export type DragDropReorder = {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
};
|
|
7
|
+
export type DragDropListProps<TItem> = {
|
|
8
|
+
/** The ordered items. `DragDropList` never mutates this — it emits `onReorder`. */
|
|
9
|
+
items: TItem[];
|
|
10
|
+
/** Stable identity for an item; used as the React key and the drag payload. */
|
|
11
|
+
getItemId: (item: TItem) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Called with the reordered array (already applied) plus the indices that moved.
|
|
14
|
+
* The consumer owns the state and passes the new array back in as `items`.
|
|
15
|
+
*/
|
|
16
|
+
onReorder: (items: TItem[], change: DragDropReorder) => void;
|
|
17
|
+
/** Renders the row content. The drag handle and row card are owned by the list. */
|
|
18
|
+
children: (item: TItem, index: number) => ReactNode;
|
|
19
|
+
/** Accessible name announced on the item's drag handle. Defaults to "Item <n>". */
|
|
20
|
+
getItemLabel?: (item: TItem, index: number) => string;
|
|
21
|
+
/** Renders every row non-draggable and disables the handles. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Accessible name for the list itself. */
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
};
|
|
26
|
+
export type DragDropItemProps = {
|
|
27
|
+
/** Accessible name for the handle, e.g. the question text. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Position of this row, used in the handle's screen-reader announcement. */
|
|
30
|
+
position: number;
|
|
31
|
+
/** Total row count, used in the handle's screen-reader announcement. */
|
|
32
|
+
count: number;
|
|
33
|
+
isDragging: boolean;
|
|
34
|
+
/** True while a dragged row hovers this one — draws the drop indicator. */
|
|
35
|
+
isDropTarget: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
onDragStart: () => void;
|
|
38
|
+
onDragEnter: () => void;
|
|
39
|
+
onDragEnd: () => void;
|
|
40
|
+
onDrop: () => void;
|
|
41
|
+
/** Keyboard reordering: move this row by `offset` positions (negative = up). */
|
|
42
|
+
onMove: (offset: number) => void;
|
|
43
|
+
/** Keyboard reordering: send this row to the first or last position. */
|
|
44
|
+
onMoveToEdge: (edge: "first" | "last") => void;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=DragDropList.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,oFAAoF;AACpF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI;IACrC,mFAAmF;IACnF,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,+EAA+E;IAC/E,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC;;;OAGG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7D,mFAAmF;IACnF,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACpD,mFAAmF;IACnF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,2EAA2E;IAC3E,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gFAAgF;IAChF,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,wEAAwE;IACxE,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.types.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new array with the item at `from` moved to `to`. Out-of-range or
|
|
3
|
+
* no-op moves return the original array so callers can skip emitting a change.
|
|
4
|
+
*/
|
|
5
|
+
export declare function moveItem<TItem>(items: TItem[], from: number, to: number): TItem[];
|
|
6
|
+
/** Clamps `index` into the bounds of a list of `length` items. */
|
|
7
|
+
export declare function clampIndex(index: number, length: number): number;
|
|
8
|
+
//# sourceMappingURL=DragDropList.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAC5B,KAAK,EAAE,KAAK,EAAE,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,KAAK,EAAE,CAgBT;AAED,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new array with the item at `from` moved to `to`. Out-of-range or
|
|
3
|
+
* no-op moves return the original array so callers can skip emitting a change.
|
|
4
|
+
*/
|
|
5
|
+
export function moveItem(items, from, to) {
|
|
6
|
+
if (from === to ||
|
|
7
|
+
from < 0 ||
|
|
8
|
+
to < 0 ||
|
|
9
|
+
from >= items.length ||
|
|
10
|
+
to >= items.length) {
|
|
11
|
+
return items;
|
|
12
|
+
}
|
|
13
|
+
const next = [...items];
|
|
14
|
+
const [moved] = next.splice(from, 1);
|
|
15
|
+
next.splice(to, 0, moved);
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
18
|
+
/** Clamps `index` into the bounds of a list of `length` items. */
|
|
19
|
+
export function clampIndex(index, length) {
|
|
20
|
+
return Math.min(Math.max(index, 0), Math.max(length - 1, 0));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=DragDropList.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.utils.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAc,EACd,IAAY,EACZ,EAAU;IAEV,IACE,IAAI,KAAK,EAAE;QACX,IAAI,GAAG,CAAC;QACR,EAAE,GAAG,CAAC;QACN,IAAI,IAAI,KAAK,CAAC,MAAM;QACpB,EAAE,IAAI,KAAK,CAAC,MAAM,EAClB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAc;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style constants for `DragDropList` (Figma node 5700:15127). The row card owns
|
|
3
|
+
* the surface, radius and padding; the content it wraps is supplied by the
|
|
4
|
+
* consumer (typically `QuestionItem`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const dragDropListClasses: {
|
|
7
|
+
readonly root: "flex w-full list-none flex-col gap-4 p-0";
|
|
8
|
+
};
|
|
9
|
+
export declare const dragDropItemClasses: {
|
|
10
|
+
readonly root: string;
|
|
11
|
+
readonly handle: string;
|
|
12
|
+
readonly content: "flex min-w-0 flex-1 items-start";
|
|
13
|
+
readonly dropIndicator: "pointer-events-none absolute inset-x-0 -top-2 h-0.5 rounded-full bg-[var(--color-semantic-drag-drop-drop-indicator)]";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=DragDropList.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.variants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;CAEtB,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;CAsBtB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style constants for `DragDropList` (Figma node 5700:15127). The row card owns
|
|
3
|
+
* the surface, radius and padding; the content it wraps is supplied by the
|
|
4
|
+
* consumer (typically `QuestionItem`).
|
|
5
|
+
*/
|
|
6
|
+
export const dragDropListClasses = {
|
|
7
|
+
root: "flex w-full list-none flex-col gap-4 p-0",
|
|
8
|
+
};
|
|
9
|
+
export const dragDropItemClasses = {
|
|
10
|
+
root: [
|
|
11
|
+
"relative flex items-start gap-3 rounded-[10px] px-4 py-3",
|
|
12
|
+
"bg-[var(--color-semantic-drag-drop-item-bg)]",
|
|
13
|
+
"transition-colors",
|
|
14
|
+
"hover:bg-[var(--color-semantic-drag-drop-item-bg-hover)]",
|
|
15
|
+
"data-[dragging=true]:bg-[var(--color-semantic-drag-drop-item-bg-dragging)]",
|
|
16
|
+
"data-[dragging=true]:opacity-60",
|
|
17
|
+
].join(" "),
|
|
18
|
+
handle: [
|
|
19
|
+
"flex h-6 shrink-0 cursor-grab items-center justify-center rounded-sm",
|
|
20
|
+
"text-[var(--color-semantic-drag-drop-handle-fg)]",
|
|
21
|
+
"transition-colors",
|
|
22
|
+
"hover:text-[var(--color-semantic-drag-drop-handle-fg-hover)]",
|
|
23
|
+
"focus-visible:ring-[var(--color-semantic-action-branded-focus)] focus-visible:ring-[3px] focus-visible:outline-none",
|
|
24
|
+
"active:cursor-grabbing",
|
|
25
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
26
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
27
|
+
].join(" "),
|
|
28
|
+
content: "flex min-w-0 flex-1 items-start",
|
|
29
|
+
dropIndicator: "pointer-events-none absolute inset-x-0 -top-2 h-0.5 rounded-full bg-[var(--color-semantic-drag-drop-drop-indicator)]",
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=DragDropList.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.variants.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/DragDropList.variants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,0CAA0C;CACxC,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE;QACJ,0DAA0D;QAC1D,8CAA8C;QAC9C,mBAAmB;QACnB,0DAA0D;QAC1D,4EAA4E;QAC5E,iCAAiC;KAClC,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,MAAM,EAAE;QACN,sEAAsE;QACtE,kDAAkD;QAClD,mBAAmB;QACnB,8DAA8D;QAC9D,qHAAqH;QACrH,wBAAwB;QACxB,iDAAiD;QACjD,mFAAmF;KACpF,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,OAAO,EAAE,iCAAiC;IAC1C,aAAa,EACX,sHAAsH;CAChH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DragDropReorder } from "../DragDropList.types.js";
|
|
2
|
+
type UseDragDropListOptions<TItem> = {
|
|
3
|
+
items: TItem[];
|
|
4
|
+
onReorder: (items: TItem[], change: DragDropReorder) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Tracks which row is being dragged and which row is currently under the
|
|
8
|
+
* pointer, and commits reorders (from pointer drop or from keyboard) through
|
|
9
|
+
* `onReorder`. The item array itself stays owned by the consumer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDragDropList<TItem>({ items, onReorder, }: UseDragDropListOptions<TItem>): {
|
|
12
|
+
draggingIndex: number | null;
|
|
13
|
+
dropIndex: number | null;
|
|
14
|
+
commit: (from: number, to: number) => void;
|
|
15
|
+
handleDragStart: (index: number) => void;
|
|
16
|
+
handleDragEnter: (index: number) => void;
|
|
17
|
+
handleDragEnd: () => void;
|
|
18
|
+
handleDrop: (index: number) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=useDragDropList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragDropList.d.ts","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/hooks/useDragDropList.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,KAAK,sBAAsB,CAAC,KAAK,IAAI;IACnC,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,SAAS,GACV,EAAE,sBAAsB,CAAC,KAAK,CAAC;;;mBASrB,MAAM,MAAM,MAAM;6BAUuB,MAAM;6BAMN,MAAM;;wBAW9C,MAAM;EAmBjB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { clampIndex, moveItem } from "../DragDropList.utils.js";
|
|
3
|
+
/**
|
|
4
|
+
* Tracks which row is being dragged and which row is currently under the
|
|
5
|
+
* pointer, and commits reorders (from pointer drop or from keyboard) through
|
|
6
|
+
* `onReorder`. The item array itself stays owned by the consumer.
|
|
7
|
+
*/
|
|
8
|
+
export function useDragDropList({ items, onReorder, }) {
|
|
9
|
+
const [draggingIndex, setDraggingIndex] = React.useState(null);
|
|
10
|
+
const [dropIndex, setDropIndex] = React.useState(null);
|
|
11
|
+
// Mirrors `draggingIndex` so `drop` can read it synchronously — a drop that
|
|
12
|
+
// lands in the same tick as `dragstart` would otherwise see stale state.
|
|
13
|
+
const draggingIndexRef = React.useRef(null);
|
|
14
|
+
const commit = React.useCallback((from, to) => {
|
|
15
|
+
const target = clampIndex(to, items.length);
|
|
16
|
+
const next = moveItem(items, from, target);
|
|
17
|
+
if (next !== items) {
|
|
18
|
+
onReorder(next, { from, to: target });
|
|
19
|
+
}
|
|
20
|
+
}, [items, onReorder]);
|
|
21
|
+
const handleDragStart = React.useCallback((index) => {
|
|
22
|
+
draggingIndexRef.current = index;
|
|
23
|
+
setDraggingIndex(index);
|
|
24
|
+
setDropIndex(index);
|
|
25
|
+
}, []);
|
|
26
|
+
const handleDragEnter = React.useCallback((index) => {
|
|
27
|
+
setDropIndex(index);
|
|
28
|
+
}, []);
|
|
29
|
+
const handleDragEnd = React.useCallback(() => {
|
|
30
|
+
draggingIndexRef.current = null;
|
|
31
|
+
setDraggingIndex(null);
|
|
32
|
+
setDropIndex(null);
|
|
33
|
+
}, []);
|
|
34
|
+
const handleDrop = React.useCallback((index) => {
|
|
35
|
+
const from = draggingIndexRef.current;
|
|
36
|
+
if (from !== null) {
|
|
37
|
+
commit(from, index);
|
|
38
|
+
}
|
|
39
|
+
handleDragEnd();
|
|
40
|
+
}, [commit, handleDragEnd]);
|
|
41
|
+
return {
|
|
42
|
+
draggingIndex,
|
|
43
|
+
dropIndex,
|
|
44
|
+
commit,
|
|
45
|
+
handleDragStart,
|
|
46
|
+
handleDragEnter,
|
|
47
|
+
handleDragEnd,
|
|
48
|
+
handleDrop,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=useDragDropList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragDropList.js","sourceRoot":"","sources":["../../../../../src/components/DragDrop/DragDropList/hooks/useDragDropList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQhE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAQ,EACrC,KAAK,EACL,SAAS,GACqB;IAC9B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC9E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAEtE,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,EACD,CAAC,KAAK,EAAE,SAAS,CAAC,CACnB,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAa,EAAE,EAAE;QAC1D,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC;QACjC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACxB,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAa,EAAE,EAAE;QAC1D,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;QAChC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACvB,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,KAAa,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC;QACtC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,aAAa,EAAE,CAAC;IAClB,CAAC,EACD,CAAC,MAAM,EAAE,aAAa,CAAC,CACxB,CAAC;IAEF,OAAO;QACL,aAAa;QACb,SAAS;QACT,MAAM;QACN,eAAe;QACf,eAAe;QACf,aAAa;QACb,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { QuestionItemProps } from "./QuestionItem.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A screening question row: numbered badge, the question, the target response,
|
|
4
|
+
* and an optional remove control (Figma node 5700:15138). Designed to be the
|
|
5
|
+
* content of a `DragDropList` row, which supplies the card surface and the grip
|
|
6
|
+
* handle — but it renders standalone too.
|
|
7
|
+
*/
|
|
8
|
+
export declare function QuestionItem({ index, question, targetResponse, onRemove, }: QuestionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=QuestionItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,cAAc,EACd,QAAQ,GACT,EAAE,iBAAiB,2CA+CnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { questionItemClasses } from "./QuestionItem.variants.js";
|
|
4
|
+
/**
|
|
5
|
+
* A screening question row: numbered badge, the question, the target response,
|
|
6
|
+
* and an optional remove control (Figma node 5700:15138). Designed to be the
|
|
7
|
+
* content of a `DragDropList` row, which supplies the card surface and the grip
|
|
8
|
+
* handle — but it renders standalone too.
|
|
9
|
+
*/
|
|
10
|
+
export function QuestionItem({ index, question, targetResponse, onRemove, }) {
|
|
11
|
+
const number = index + 1;
|
|
12
|
+
return (_jsxs("div", { "data-slot": "question-item", className: questionItemClasses.root, children: [_jsx("span", { "data-slot": "question-item-badge", className: questionItemClasses.badge, children: number }), _jsxs("div", { "data-slot": "question-item-body", className: questionItemClasses.body, children: [_jsx("p", { "data-slot": "question-item-question", className: questionItemClasses.question, children: question }), _jsxs("p", { "data-slot": "question-item-target", className: questionItemClasses.targetLabel, children: ["Target Response: ", _jsx("span", { className: questionItemClasses.targetValue, children: targetResponse })] })] }), onRemove ? (_jsx("button", { type: "button", "data-slot": "question-item-remove", className: questionItemClasses.remove, "aria-label": `Remove question ${number}`, onClick: onRemove, children: _jsx(X, {}) })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=QuestionItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,cAAc,EACd,QAAQ,GACU;IAClB,MAAM,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;IAEzB,OAAO,CACL,4BACY,eAAe,EACzB,SAAS,EAAE,mBAAmB,CAAC,IAAI,aAEnC,4BACY,qBAAqB,EAC/B,SAAS,EAAE,mBAAmB,CAAC,KAAK,YAEnC,MAAM,GACF,EACP,4BACY,oBAAoB,EAC9B,SAAS,EAAE,mBAAmB,CAAC,IAAI,aAEnC,yBACY,wBAAwB,EAClC,SAAS,EAAE,mBAAmB,CAAC,QAAQ,YAEtC,QAAQ,GACP,EACJ,0BACY,sBAAsB,EAChC,SAAS,EAAE,mBAAmB,CAAC,WAAW,aAEzC,mBAAmB,EACpB,eAAM,SAAS,EAAE,mBAAmB,CAAC,WAAW,YAC7C,cAAc,GACV,IACL,IACA,EACL,QAAQ,CAAC,CAAC,CAAC,CACV,iBACE,IAAI,EAAC,QAAQ,eACH,sBAAsB,EAChC,SAAS,EAAE,mBAAmB,CAAC,MAAM,gBACzB,mBAAmB,MAAM,EAAE,EACvC,OAAO,EAAE,QAAQ,YAEjB,KAAC,CAAC,KAAG,GACE,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type QuestionItemProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Zero-based position in the list. The numbered badge is derived from it
|
|
4
|
+
* (`index + 1`) — never pass the display number directly.
|
|
5
|
+
*/
|
|
6
|
+
index: number;
|
|
7
|
+
/** The screening question shown to the candidate. */
|
|
8
|
+
question: string;
|
|
9
|
+
/** The answer the recruiter is screening for, e.g. "Yes" or "A specific date". */
|
|
10
|
+
targetResponse: string;
|
|
11
|
+
/** Omit to render the row without a remove control. */
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=QuestionItem.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,cAAc,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.types.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style constants for `QuestionItem` (Figma node 5700:15138). The row
|
|
3
|
+
* surface, radius and grip handle belong to `DragDropList`; this component owns
|
|
4
|
+
* the numbered badge, the question copy and the remove control.
|
|
5
|
+
*/
|
|
6
|
+
export declare const questionItemClasses: {
|
|
7
|
+
readonly root: "flex min-w-0 flex-1 items-start gap-3";
|
|
8
|
+
readonly badge: string;
|
|
9
|
+
readonly body: "flex min-w-0 flex-1 flex-col gap-3";
|
|
10
|
+
readonly question: "text-sm leading-[1.45] font-medium break-words text-[var(--color-semantic-question-item-question-fg)]";
|
|
11
|
+
readonly targetLabel: "text-xs font-normal text-[var(--color-semantic-question-item-target-label-fg)]";
|
|
12
|
+
readonly targetValue: "text-xs font-semibold text-[var(--color-semantic-question-item-target-value-fg)]";
|
|
13
|
+
readonly remove: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=QuestionItem.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.variants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;CAuBtB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style constants for `QuestionItem` (Figma node 5700:15138). The row
|
|
3
|
+
* surface, radius and grip handle belong to `DragDropList`; this component owns
|
|
4
|
+
* the numbered badge, the question copy and the remove control.
|
|
5
|
+
*/
|
|
6
|
+
export const questionItemClasses = {
|
|
7
|
+
root: "flex min-w-0 flex-1 items-start gap-3",
|
|
8
|
+
badge: [
|
|
9
|
+
"flex size-6 shrink-0 items-center justify-center rounded-full",
|
|
10
|
+
"bg-[var(--color-semantic-question-item-badge-bg)]",
|
|
11
|
+
"text-[11px] font-medium",
|
|
12
|
+
"text-[var(--color-semantic-question-item-badge-fg)]",
|
|
13
|
+
].join(" "),
|
|
14
|
+
body: "flex min-w-0 flex-1 flex-col gap-3",
|
|
15
|
+
question: "text-sm leading-[1.45] font-medium break-words text-[var(--color-semantic-question-item-question-fg)]",
|
|
16
|
+
targetLabel: "text-xs font-normal text-[var(--color-semantic-question-item-target-label-fg)]",
|
|
17
|
+
targetValue: "text-xs font-semibold text-[var(--color-semantic-question-item-target-value-fg)]",
|
|
18
|
+
remove: [
|
|
19
|
+
"flex size-5 shrink-0 items-center justify-center rounded-sm",
|
|
20
|
+
"text-[var(--color-semantic-question-item-remove-fg)]",
|
|
21
|
+
"transition-colors",
|
|
22
|
+
"hover:text-[var(--color-semantic-question-item-remove-fg-hover)]",
|
|
23
|
+
"focus-visible:ring-[var(--color-semantic-action-branded-focus)] focus-visible:ring-[3px] focus-visible:outline-none",
|
|
24
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-3.5 [&_svg]:shrink-0",
|
|
25
|
+
].join(" "),
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=QuestionItem.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionItem.variants.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/QuestionItem.variants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,uCAAuC;IAC7C,KAAK,EAAE;QACL,+DAA+D;QAC/D,mDAAmD;QACnD,yBAAyB;QACzB,qDAAqD;KACtD,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,IAAI,EAAE,oCAAoC;IAC1C,QAAQ,EACN,uGAAuG;IACzG,WAAW,EACT,gFAAgF;IAClF,WAAW,EACT,kFAAkF;IACpF,MAAM,EAAE;QACN,6DAA6D;QAC7D,sDAAsD;QACtD,mBAAmB;QACnB,kEAAkE;QAClE,qHAAqH;QACrH,qFAAqF;KACtF,CAAC,IAAI,CAAC,GAAG,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/QuestionItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DragDropItem, DragDropList } from "./DragDropList/index.js";
|
|
2
|
+
export type { DragDropItemProps, DragDropListProps, DragDropReorder, } from "./DragDropList/index.js";
|
|
3
|
+
export { QuestionItem } from "./QuestionItem/index.js";
|
|
4
|
+
export type { QuestionItemProps } from "./QuestionItem/index.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const SIDEBAR_WIDTH_DEFAULT_PX = 240;
|
|
2
|
+
export declare const SIDEBAR_WIDTH_COLLAPSED_PX = 60;
|
|
3
|
+
export declare const SIDEBAR_WIDTH_MIN_PX = 240;
|
|
4
|
+
export declare const SIDEBAR_WIDTH_MAX_PX = 400;
|
|
5
|
+
export declare function clampSidebarWidthPx(px: number): number;
|
|
6
|
+
//# sourceMappingURL=Sidebar.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.constants.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,oBAAoB,MAA2B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SIDEBAR_WIDTH_DEFAULT_PX = 240;
|
|
2
|
+
export const SIDEBAR_WIDTH_COLLAPSED_PX = 60;
|
|
3
|
+
export const SIDEBAR_WIDTH_MIN_PX = SIDEBAR_WIDTH_DEFAULT_PX;
|
|
4
|
+
export const SIDEBAR_WIDTH_MAX_PX = 400;
|
|
5
|
+
export function clampSidebarWidthPx(px) {
|
|
6
|
+
return Math.min(Math.max(px, SIDEBAR_WIDTH_MIN_PX), SIDEBAR_WIDTH_MAX_PX);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Sidebar.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.constants.js","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { SidebarContextValue, SidebarGroupLabelProps, SidebarMenuButtonProps, SidebarMenuSubButtonProps, SidebarProps } from "./Sidebar.types.js";
|
|
3
3
|
export declare const SidebarContext: React.Context<SidebarContextValue | null>;
|
|
4
|
-
export declare function Sidebar({ side, variant, collapsible, className, children, ...props }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function Sidebar({ side, variant, collapsible, className, style, children, ...props }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function SidebarGroupLabel({ className, asChild, ...props }: SidebarGroupLabelProps): import("react/jsx-runtime").JSX.Element;
|