@stll/ui 0.59.1 → 0.60.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 (44) hide show
  1. package/README.md +120 -4
  2. package/dist/components/accordion.d.ts +17 -3
  3. package/dist/components/accordion.js +17 -3
  4. package/dist/components/button.d.ts +56 -5
  5. package/dist/components/button.js +97 -15
  6. package/dist/components/button.native-classes.d.ts +17 -0
  7. package/dist/components/button.native-classes.js +176 -0
  8. package/dist/components/button.native.d.ts +5 -2
  9. package/dist/components/button.native.js +17 -134
  10. package/dist/components/button.shared.d.ts +24 -2
  11. package/dist/components/button.shared.js +15 -1
  12. package/dist/components/combobox.d.ts +3 -1
  13. package/dist/components/combobox.js +3 -2
  14. package/dist/components/date-picker-popover.d.ts +2 -0
  15. package/dist/components/date-picker-popover.js +5 -3
  16. package/dist/components/details-grid.d.ts +21 -2
  17. package/dist/components/details-grid.js +75 -20
  18. package/dist/components/form.d.ts +9 -3
  19. package/dist/components/form.js +24 -3
  20. package/dist/components/input-control.d.ts +9 -0
  21. package/dist/components/input-control.js +10 -1
  22. package/dist/components/input.d.ts +7 -1
  23. package/dist/components/input.js +4 -4
  24. package/dist/components/label.d.ts +24 -2
  25. package/dist/components/label.js +21 -2
  26. package/dist/components/number-input.d.ts +9 -2
  27. package/dist/components/number-input.js +18 -6
  28. package/dist/components/textarea.d.ts +14 -1
  29. package/dist/components/textarea.js +11 -5
  30. package/dist/index.d.ts +10 -6
  31. package/dist/index.js +6 -3
  32. package/dist/kanban/index.d.ts +5 -2
  33. package/dist/kanban/index.js +4 -1
  34. package/dist/kanban/sortable-edge.d.ts +39 -0
  35. package/dist/kanban/sortable-edge.js +27 -0
  36. package/dist/kanban/sortable-interactions.d.ts +145 -0
  37. package/dist/kanban/sortable-interactions.js +503 -0
  38. package/dist/kanban/sortable-interactions.logic.d.ts +79 -0
  39. package/dist/kanban/sortable-interactions.logic.js +210 -0
  40. package/dist/kanban/subgroup-board.d.ts +27 -2
  41. package/dist/kanban/subgroup-board.js +26 -1
  42. package/dist/kanban/virtual-cell.d.ts +18 -1
  43. package/dist/kanban/virtual-cell.js +70 -17
  44. package/package.json +5 -1
@@ -0,0 +1,39 @@
1
+ import { ClientRect } from "@dnd-kit/core";
2
+ //#region src/kanban/sortable-edge.d.ts
3
+ export declare const KANBAN_HORIZONTAL_EDGES: {
4
+ readonly before: "before";
5
+ readonly after: "after";
6
+ };
7
+ export type KanbanHorizontalEdge = (typeof KANBAN_HORIZONTAL_EDGES)[keyof typeof KANBAN_HORIZONTAL_EDGES];
8
+ export declare const KANBAN_DIRECTIONS: {
9
+ readonly ltr: "ltr";
10
+ readonly rtl: "rtl";
11
+ };
12
+ export type KanbanDirection = (typeof KANBAN_DIRECTIONS)[keyof typeof KANBAN_DIRECTIONS];
13
+ type KanbanPointerHorizontalEdgeOptions = {
14
+ input: "pointer";
15
+ /** The drag's current viewport x coordinate for mouse or touch input. */
16
+ currentClientX: number;
17
+ overRect: ClientRect;
18
+ /** Maps physical mouse and touch positions to the board's logical order. */
19
+ direction?: KanbanDirection | undefined;
20
+ };
21
+ type KanbanKeyboardHorizontalEdgeOptions = {
22
+ input: "keyboard";
23
+ /** The source item's position in logical board order. */
24
+ sourceIndex: number;
25
+ /** The target item's position in logical board order. */
26
+ targetIndex: number;
27
+ };
28
+ export type KanbanHorizontalEdgeOptions = KanbanPointerHorizontalEdgeOptions | KanbanKeyboardHorizontalEdgeOptions;
29
+ /**
30
+ * Resolves a horizontal insertion edge without consulting application data.
31
+ *
32
+ * Mouse and touch callers pass their current viewport coordinate. Keyboard
33
+ * callers pass source and target indices, making every logical move
34
+ * unambiguous. This deliberately avoids drag deltas, which include scroll
35
+ * reconciliation and are not viewport coordinates.
36
+ */
37
+ export declare const getKanbanHorizontalEdge: ({ ...options }: KanbanHorizontalEdgeOptions) => KanbanHorizontalEdge;
38
+ //#endregion
39
+ export {};
@@ -0,0 +1,27 @@
1
+ //#region src/kanban/sortable-edge.ts
2
+ const KANBAN_HORIZONTAL_EDGES = {
3
+ before: "before",
4
+ after: "after"
5
+ };
6
+ const KANBAN_DIRECTIONS = {
7
+ ltr: "ltr",
8
+ rtl: "rtl"
9
+ };
10
+ /**
11
+ * Resolves a horizontal insertion edge without consulting application data.
12
+ *
13
+ * Mouse and touch callers pass their current viewport coordinate. Keyboard
14
+ * callers pass source and target indices, making every logical move
15
+ * unambiguous. This deliberately avoids drag deltas, which include scroll
16
+ * reconciliation and are not viewport coordinates.
17
+ */
18
+ const getKanbanHorizontalEdge = ({ ...options }) => {
19
+ if (options.input === "keyboard") return options.sourceIndex < options.targetIndex ? KANBAN_HORIZONTAL_EDGES.after : KANBAN_HORIZONTAL_EDGES.before;
20
+ const { currentClientX, direction = KANBAN_DIRECTIONS.ltr, overRect } = options;
21
+ const physicalEdge = currentClientX < getRectCenterX(overRect) ? KANBAN_HORIZONTAL_EDGES.before : KANBAN_HORIZONTAL_EDGES.after;
22
+ if (direction === KANBAN_DIRECTIONS.rtl) return physicalEdge === KANBAN_HORIZONTAL_EDGES.before ? KANBAN_HORIZONTAL_EDGES.after : KANBAN_HORIZONTAL_EDGES.before;
23
+ return physicalEdge;
24
+ };
25
+ const getRectCenterX = ({ left, width }) => left + width / 2;
26
+ //#endregion
27
+ export { KANBAN_DIRECTIONS, KANBAN_HORIZONTAL_EDGES, getKanbanHorizontalEdge };
@@ -0,0 +1,145 @@
1
+ import * as React$1 from "react";
2
+ import { AutoScrollActivator, AutoScrollOptions, CollisionDetection, DndContextProps, DragCancelEvent, DragEndEvent, DragOverEvent, DragOverlayProps, DragStartEvent, KeyboardCoordinateGetter, UniqueIdentifier } from "@dnd-kit/core";
3
+ import { Button } from "../components/button.js";
4
+ import { KANBAN_BOARD_COLLISION_DETECTION, KanbanCellVirtualNavigation, KanbanSortableCellPosition, KanbanVirtualScrollRequest, kanbanKeyboardCoordinates } from "./sortable-interactions.logic.js";
5
+ import { useSortable } from "@dnd-kit/sortable";
6
+ //#region src/kanban/sortable-interactions.d.ts
7
+ export declare const KANBAN_MOUSE_ACTIVATION_DISTANCE = 8;
8
+ /** Above sticky board chrome, below app-level floating surfaces. */
9
+ export declare const KANBAN_DRAG_OVERLAY_Z_INDEX = 75;
10
+ export declare const KANBAN_BOARD_AUTO_SCROLL_OPTIONS: {
11
+ readonly acceleration: 10;
12
+ readonly activator: AutoScrollActivator.Pointer;
13
+ readonly threshold: {
14
+ readonly x: 0.15;
15
+ readonly y: 0.15;
16
+ };
17
+ };
18
+ export declare const KANBAN_SORTABLE_ACTIVATION_MODES: {
19
+ readonly CARD: "card";
20
+ readonly HANDLE: "handle";
21
+ readonly ITEM: "item";
22
+ };
23
+ export declare const KANBAN_TOUCH_ACTIVATION_CONSTRAINT: {
24
+ readonly delay: 150;
25
+ readonly tolerance: 8;
26
+ };
27
+ export type KanbanDragCancelEvent = DragCancelEvent;
28
+ export type KanbanDragEndEvent = DragEndEvent;
29
+ export type KanbanDragOverEvent = DragOverEvent;
30
+ export type KanbanDragStartEvent = DragStartEvent;
31
+ export type KanbanSortableBoardProps = {
32
+ children: React$1.ReactNode;
33
+ onDragEnd: (event: KanbanDragEndEvent) => void;
34
+ /** Minimum pointer movement before a mouse drag activates. */
35
+ mouseActivationDistance?: number | undefined;
36
+ collisionDetection?: CollisionDetection | undefined;
37
+ keyboardCoordinates?: KeyboardCoordinateGetter | undefined;
38
+ autoScroll?: boolean | AutoScrollOptions | undefined;
39
+ /** Replaces the default mouse, touch, and keyboard sensors when supplied. */
40
+ sensors?: DndContextProps["sensors"] | undefined;
41
+ /** Overrides dnd-kit's screen-reader announcements when supplied. */
42
+ accessibility?: DndContextProps["accessibility"] | undefined;
43
+ /**
44
+ * Fires on drag start and on every drag end or cancel; a board over a
45
+ * `KanbanSubgroupBoard` combines the two into that board's `isDragging`
46
+ * (`true` here, `false` on `onDragEnd`/`onDragCancel`).
47
+ */
48
+ onDragStart?: ((event: KanbanDragStartEvent) => void) | undefined;
49
+ /**
50
+ * Fires whenever dnd-kit's collision detection changes the drop target
51
+ * the drag is over, `event.over` included when it becomes none. A board
52
+ * over a `KanbanSubgroupBoard` maps `event.over?.id ?? null` to a band id
53
+ * (via `KanbanSubgroupCellContext.band`, or a droppable registered for a
54
+ * folded band's slot) to drive that board's `dragOverBandId`.
55
+ */
56
+ onDragOver?: ((event: KanbanDragOverEvent) => void) | undefined;
57
+ onDragCancel?: ((event: KanbanDragCancelEvent) => void) | undefined;
58
+ /** Called once mounted child drop targets can safely receive input. */
59
+ onInteractionReady?: (() => void) | undefined;
60
+ /** Rendered in document.body while an item is active. */
61
+ overlay?: ((activeId: UniqueIdentifier | null) => React$1.ReactNode) | undefined;
62
+ overlayProps?: Omit<DragOverlayProps, "children"> | undefined;
63
+ };
64
+ export type UseKanbanDropTargetOptions = {
65
+ disabled?: boolean | undefined;
66
+ id: string;
67
+ itemIds: readonly UniqueIdentifier[];
68
+ navigation: KanbanCellVirtualNavigation;
69
+ position: KanbanSortableCellPosition;
70
+ };
71
+ /**
72
+ * Register a board-level drop target such as an empty cell or terminal lane.
73
+ *
74
+ * Board consumers should not need to couple their presentation code to the
75
+ * underlying drag-and-drop library just to receive an item from a sortable
76
+ * context.
77
+ */
78
+ export declare const useKanbanDropTarget: ({ disabled, id, itemIds, navigation, position }: UseKanbanDropTargetOptions) => {
79
+ isOver: boolean;
80
+ setNodeRef: (element: HTMLElement | null) => void;
81
+ };
82
+ /**
83
+ * Input-complete drag context for sortable boards.
84
+ *
85
+ * The consumer owns identifiers and the result of a drop; this component owns
86
+ * the sensor activation rules, keyboard navigation, auto-scroll configuration,
87
+ * and overlay lifecycle shared by sortable board UIs.
88
+ */
89
+ export declare const KanbanSortableBoard: ({ children, onDragEnd, mouseActivationDistance, collisionDetection, keyboardCoordinates, autoScroll, sensors, accessibility, onDragStart, onDragOver, onDragCancel, onInteractionReady, overlay, overlayProps }: KanbanSortableBoardProps) => React$1.JSX.Element;
90
+ export declare const useKanbanSortableSensors: (keyboardCoordinates?: KeyboardCoordinateGetter, mouseActivationDistance?: number) => import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
91
+ export type KanbanSortableBindings = Pick<ReturnType<typeof useSortable>, "attributes" | "listeners" | "setActivatorNodeRef">;
92
+ export type KanbanSortableActivationMode = {
93
+ type: "card";
94
+ } | {
95
+ type: "handle";
96
+ } | {
97
+ type: "item";
98
+ };
99
+ export type UseKanbanSortableOptions = {
100
+ activation: KanbanSortableActivationMode;
101
+ id: UniqueIdentifier;
102
+ disabled?: boolean | undefined;
103
+ };
104
+ type KanbanSortableActivator = {
105
+ bindings: KanbanSortableBindings;
106
+ type: typeof KANBAN_SORTABLE_ACTIVATION_MODES.HANDLE;
107
+ } | {
108
+ bindings: KanbanSortableBindings;
109
+ type: typeof KANBAN_SORTABLE_ACTIVATION_MODES.CARD;
110
+ } | {
111
+ attributes: ReturnType<typeof useSortable>["attributes"];
112
+ listeners: ReturnType<typeof useSortable>["listeners"];
113
+ type: typeof KANBAN_SORTABLE_ACTIVATION_MODES.ITEM;
114
+ };
115
+ /**
116
+ * Connect a sortable item and its separate drag handle without making the
117
+ * item's content a touch-none activation surface.
118
+ */
119
+ export declare const useKanbanSortable: ({ activation, id, disabled }: UseKanbanSortableOptions) => {
120
+ activator: KanbanSortableActivator;
121
+ isDragging: boolean;
122
+ setNodeRef: (element: HTMLElement | null) => void;
123
+ style: {
124
+ touchAction: string | undefined;
125
+ transform: string | undefined;
126
+ transition: string | undefined;
127
+ };
128
+ };
129
+ export type KanbanDragHandleProps = {
130
+ bindings: KanbanSortableBindings;
131
+ label: string;
132
+ } & Omit<React$1.ComponentProps<typeof Button>, "aria-label" | "children" | "ref" | "tooltip" | "type">;
133
+ /**
134
+ * A 44px keyboard-accessible drag activator. The handle is the only board
135
+ * surface that disables touch panning, leaving cards and scroll regions free
136
+ * for ordinary scrolling.
137
+ */
138
+ export declare const KanbanDragHandle: ({ bindings, label, className, ...props }: KanbanDragHandleProps) => React$1.JSX.Element;
139
+ export type KanbanCardDragSurfaceProps = {
140
+ bindings: KanbanSortableBindings;
141
+ } & Omit<React$1.ComponentProps<"div">, "ref">;
142
+ /** A whole-card drag activator that preserves descendant controls and scrolling. */
143
+ export declare const KanbanCardDragSurface: ({ bindings, className, ...props }: KanbanCardDragSurfaceProps) => React$1.JSX.Element;
144
+ //#endregion
145
+ export { KANBAN_BOARD_COLLISION_DETECTION, type KanbanCellVirtualNavigation, type KanbanSortableCellPosition, type KanbanVirtualScrollRequest, kanbanKeyboardCoordinates };