@danxbot/ui 2.8.0 → 2.9.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.
@@ -55,6 +55,57 @@ export interface DragDropItemProps {
55
55
  children?: ReactNode;
56
56
  }
57
57
  export declare function DragDropItem({ id, index, label, className, children, }: DragDropItemProps): import("react").JSX.Element;
58
+ export interface DragDropSurfaceProps {
59
+ /**
60
+ * Accessible name, used ONLY in the case where the surface has to become
61
+ * focusable itself — see the banner. Defaults to the item's label.
62
+ */
63
+ label?: string;
64
+ className?: string;
65
+ children?: ReactNode;
66
+ }
67
+ /**
68
+ * THE WHOLE ROW IS THE DRAG SOURCE. The alternative to `DragDropHandle`, and
69
+ * the right one wherever every row is draggable by definition.
70
+ *
71
+ * A GRIP IS A CHOICE ABOUT WHICH ROWS MOVE. On a list where some rows are fixed
72
+ * and some are not, the grip is the affordance that says which — and it is also
73
+ * the only way to keep a row full of buttons from starting a drag from every
74
+ * one of them. On a kanban board neither is true: every card moves, and the
75
+ * card's own job is to open a record. Reported, in the user's words: "I should
76
+ * be able to drag anywhere on the card and it should drag the card. Get rid of
77
+ * the drag handle entirely. Cards are just draggable. Click opens them, drag
78
+ * drags them."
79
+ *
80
+ * THE HARD PART IS NOT THE DRAG, IT IS THE CLICK. A card that is both a drag
81
+ * source and a link has to tell a press-that-moved from a press-that-did-not,
82
+ * and it has to do it without a threshold invented here — the engine already
83
+ * has one, tuned against real devices (`PointerActivation`: 5px for a mouse, a
84
+ * 250ms dwell for a finger). A press under that stays a click and opens the
85
+ * record; a press over it becomes a drag AND has its trailing `click`
86
+ * swallowed, in `sensors/gesture.ts`, because the browser fires one either way.
87
+ *
88
+ * THE KEYBOARD IS THE HALF THAT IS EASY TO LOSE, and losing it is not
89
+ * acceptable — a board that can only be reordered with a mouse is a board some
90
+ * people cannot reorder at all. Two things keep it:
91
+ *
92
+ * THE KEYS ARE SPLIT. Space picks the card up, Enter is left to whatever
93
+ * control has focus inside it. The keyboard sensor reads that off the event's
94
+ * target rather than from a flag here, so a grip (where the source IS the
95
+ * focused control) keeps both keys and a card gets the split, with nothing to
96
+ * configure and nothing to forget.
97
+ *
98
+ * THE INSTRUCTIONS FOLLOW THE FOCUS. A grip carried `aria-describedby`
99
+ * itself. A card's focus lands on the consumer's own control — a
100
+ * `RecordCard`'s button — which this component did not render and cannot pass
101
+ * props to, so the description is attached to that element directly and
102
+ * removed again on unmount. A card with NO focusable control of its own has
103
+ * nothing to describe and no way into a drag, so the surface becomes the
104
+ * focusable control instead. Both branches are measured by
105
+ * `probe-kanban.mjs`; without the second one, a board of plain cards would be
106
+ * keyboard-inaccessible with nothing to see and nothing to fail.
107
+ */
108
+ export declare function DragDropSurface({ label, className, children }: DragDropSurfaceProps): import("react").JSX.Element;
58
109
  export interface DragDropHandleProps {
59
110
  /** Accessible name. Defaults to `Reorder <the item's label>`. */
60
111
  label?: string;
@@ -1,4 +1,4 @@
1
- import type { ReactNode, Ref } from "react";
1
+ import { type ReactNode, type Ref } from "react";
2
2
  import { Select as BaseSelect } from "@base-ui/react/select";
3
3
  import { type VariantProps } from "tailwind-variants";
4
4
  declare const trigger: import("tailwind-variants").TVReturnType<{
@@ -28,7 +28,7 @@ export interface SelectProps<Value> extends Omit<BaseSelect.Root.Props<Value, bo
28
28
  children: ReactNode;
29
29
  ref?: Ref<HTMLButtonElement>;
30
30
  }
31
- export declare function Select<Value>({ size, placeholder, className, children, ref, "aria-label": ariaLabel, ...props }: SelectProps<Value>): import("react").JSX.Element;
31
+ export declare function Select<Value>({ size, placeholder, className, children, ref, items, "aria-label": ariaLabel, ...props }: SelectProps<Value>): import("react").JSX.Element;
32
32
  export interface SelectItemProps extends Omit<BaseSelect.Item.Props, "className"> {
33
33
  className?: string;
34
34
  ref?: Ref<HTMLDivElement>;
@@ -2,6 +2,11 @@ import type { ReactNode, Ref } from "react";
2
2
  import { type VariantProps } from "tailwind-variants";
3
3
  declare const stat: import("tailwind-variants").TVReturnType<{
4
4
  size: {
5
+ xs: {
6
+ label: string;
7
+ hint: string;
8
+ value: string;
9
+ };
5
10
  sm: {
6
11
  value: string;
7
12
  };
@@ -21,6 +26,11 @@ declare const stat: import("tailwind-variants").TVReturnType<{
21
26
  hint: string;
22
27
  }, undefined, {
23
28
  size: {
29
+ xs: {
30
+ label: string;
31
+ hint: string;
32
+ value: string;
33
+ };
24
34
  sm: {
25
35
  value: string;
26
36
  };
@@ -40,6 +50,11 @@ declare const stat: import("tailwind-variants").TVReturnType<{
40
50
  hint: string;
41
51
  }, import("tailwind-variants").TVReturnTypeLike<{
42
52
  size: {
53
+ xs: {
54
+ label: string;
55
+ hint: string;
56
+ value: string;
57
+ };
43
58
  sm: {
44
59
  value: string;
45
60
  };
@@ -1,4 +1,4 @@
1
- import type { ReactNode, Ref } from "react";
1
+ import { type ReactNode, type Ref } from "react";
2
2
  import { Tabs as BaseTabs } from "@base-ui/react/tabs";
3
3
  import { type VariantProps } from "tailwind-variants";
4
4
  declare const tabs: import("tailwind-variants").TVReturnType<{
@@ -6,6 +6,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
6
6
  marker: string;
7
7
  landing: string;
8
8
  handle: string;
9
+ surface: string;
9
10
  };
10
11
  x: {
11
12
  container: string;
@@ -13,6 +14,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
13
14
  marker: string;
14
15
  landing: string;
15
16
  handle: string;
17
+ surface: string;
16
18
  };
17
19
  };
18
20
  moving: {
@@ -36,6 +38,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
36
38
  shift: string;
37
39
  marker: string[];
38
40
  landing: string;
41
+ surface: string[];
39
42
  handle: string[];
40
43
  overlay: string[];
41
44
  }, undefined, {
@@ -46,6 +49,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
46
49
  marker: string;
47
50
  landing: string;
48
51
  handle: string;
52
+ surface: string;
49
53
  };
50
54
  x: {
51
55
  container: string;
@@ -53,6 +57,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
53
57
  marker: string;
54
58
  landing: string;
55
59
  handle: string;
60
+ surface: string;
56
61
  };
57
62
  };
58
63
  moving: {
@@ -76,6 +81,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
76
81
  shift: string;
77
82
  marker: string[];
78
83
  landing: string;
84
+ surface: string[];
79
85
  handle: string[];
80
86
  overlay: string[];
81
87
  }, import("tailwind-variants").TVReturnTypeLike<{
@@ -86,6 +92,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
86
92
  marker: string;
87
93
  landing: string;
88
94
  handle: string;
95
+ surface: string;
89
96
  };
90
97
  x: {
91
98
  container: string;
@@ -93,6 +100,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
93
100
  marker: string;
94
101
  landing: string;
95
102
  handle: string;
103
+ surface: string;
96
104
  };
97
105
  };
98
106
  moving: {
@@ -116,6 +124,7 @@ export declare const dnd: import("tailwind-variants").TVReturnType<{
116
124
  shift: string;
117
125
  marker: string[];
118
126
  landing: string;
127
+ surface: string[];
119
128
  handle: string[];
120
129
  overlay: string[];
121
130
  }>>;
@@ -12,8 +12,7 @@ export declare const kanban: import("tailwind-variants").TVReturnType<{
12
12
  laneLabel: string;
13
13
  laneHint: string;
14
14
  laneItems: string;
15
- card: string[];
16
- cardHandle: string;
15
+ card: string;
17
16
  laneEmpty: string;
18
17
  laneRefusal: string;
19
18
  }, undefined, {
@@ -30,8 +29,7 @@ export declare const kanban: import("tailwind-variants").TVReturnType<{
30
29
  laneLabel: string;
31
30
  laneHint: string;
32
31
  laneItems: string;
33
- card: string[];
34
- cardHandle: string;
32
+ card: string;
35
33
  laneEmpty: string;
36
34
  laneRefusal: string;
37
35
  }, import("tailwind-variants").TVReturnTypeLike<{
@@ -48,8 +46,7 @@ export declare const kanban: import("tailwind-variants").TVReturnType<{
48
46
  laneLabel: string;
49
47
  laneHint: string;
50
48
  laneItems: string;
51
- card: string[];
52
- cardHandle: string;
49
+ card: string;
53
50
  laneEmpty: string;
54
51
  laneRefusal: string;
55
52
  }>>;
@@ -69,7 +69,7 @@ export type { Command, Edit } from "./lib/markdown/commands";
69
69
  export { toggleBold, toggleItalic, toggleCode, toggleStrike, toggleInline, setHeading, adjustHeading, headingLevel, toggleList, toggleTask, indentLines, outdentLines, toggleQuote, toggleCodeBlock, fenceAround, insertRule, insertImage, insertLink, insertTable, insertRow, insertColumn, deleteRow, deleteColumn, deleteTable, alignColumn, tableAround, cellsOf, cellAt, tableTab, smartEnter, smartTab, smartShiftTab, } from "./lib/markdown/commands";
70
70
  export { tokenize, listLanguages, resolveLanguage, defineGrammar, registerGrammar, checkCoverage, type Token, type TokenType, type Grammar, type Rule, } from "./lib/syntax";
71
71
  export { parseMarkdown, MarkdownNodes, sanitizeHref, type MdNode, type MdInline, type MdCodeRenderer, } from "./lib/syntax/markdown";
72
- export { DragDrop, DragDropContainer, DragDropItem, DragDropHandle, type DragDropProps, type DragDropContainerProps, type DragDropItemProps, type DragDropHandleProps, } from "./components/DragDrop";
72
+ export { DragDrop, DragDropContainer, DragDropItem, DragDropHandle, DragDropSurface, type DragDropProps, type DragDropContainerProps, type DragDropItemProps, type DragDropHandleProps, type DragDropSurfaceProps, } from "./components/DragDrop";
73
73
  export { KanbanBoard, type KanbanBoardProps, type KanbanLane, type KanbanMove, type KanbanRefusal, } from "./components/kanban/KanbanBoard";
74
74
  export { DEFAULT_DRAG_STRINGS, DRAG_INSTRUCTIONS_ID, DragInstructions, DragLiveRegion, DragSession, DragSessionProvider, applyMove, attachAutoScroll, attachKeyboardSensor, attachPointerSensor, attachSessionWindowListeners, isNoOp, resolveTarget, sameTarget, scrollVelocity, useCreateDragSession, useDragAnnouncements, useDragSession, useDragState, useDraggable, useDropContainer, type ContainerId, type DragAxis, type DragCancelEvent, type DragEndEvent, type DragId, type DragMode, type DragPhase, type DragSessionCallbacks, type DragStartEvent, type DragState, type AutoScrollOptions, type DragAnnouncementContext, type DragAnnouncementOptions, type DragAnnouncements, type DragInstructionsProps, type DragLiveRegionProps, type DragStrings, type DropTarget, type KeyboardSensorOptions, type PointerActivation, } from "./lib/dnd";
75
75
  export type { MessageRole, MessagePart, MessagePartType, TextPart, CodePart, ReasoningPart, ToolPart, ToolStatus, FilePart, ComponentPart, ChatFile, ChatMessage, RenderContext, PartRenderer, PartRenderers, ChatComponentRenderer, ChatComponents, } from "./components/chat/types";
@@ -13,7 +13,11 @@ import type { DragAxis, DragId } from "../types";
13
13
  *
14
14
  * THE KEY MAP IS FIXED BY THE PROJECT CONTRACT, not by this file:
15
15
  *
16
- * Space / Enter pick up on a focused handle; drop when already carrying
16
+ * Space pick up; drop when already carrying
17
+ * Enter the same, but ONLY when the drag source is itself the
18
+ * focused control. On a whole-card source the key arrives by
19
+ * bubbling from the card's own button, and Enter is that
20
+ * button's — see the note at the check.
17
21
  * Escape cancel — handled by `attachSessionWindowListeners`, NOT here
18
22
  * Along the axis step the insertion point inside the current container
19
23
  * Across it move to the previous / next container
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The one reduced-motion answer, read from `--motion-scale`.
3
+ *
4
+ * WHY THE TOKEN AND NOT `matchMedia` DIRECTLY. `--motion-scale` is the single
5
+ * place where the OS media query and the app-level `data-motion` override are
6
+ * reconciled (see `styles/motion.css`). Reading the media query alone would
7
+ * ignore the in-app preference control, so a user who set "reduced" in the app
8
+ * on a machine with no OS setting would get full-speed motion — the exact case
9
+ * that control exists for. It is also why a raw `motion-reduce:` utility is the
10
+ * wrong tool for anything this system builds (see the note on `Choice`'s
11
+ * thumb): that variant reads the OS query alone and fires even for someone who
12
+ * has explicitly chosen `data-motion="full"`.
13
+ *
14
+ * ONLY THE COMPARISON IS EVER USED, never the value. Multiplying a SPEED by the
15
+ * scale would be backwards — a slower auto-scroll ramp holds the user at the
16
+ * edge longer and produces MORE motion overall — and a scroll has no "half"
17
+ * anyway: it is smooth or it is a jump.
18
+ *
19
+ * ITS OWN MODULE because two unrelated layers need it. The drag engine's edge
20
+ * auto-scroll had the only copy, and the tab strip's reveal-the-active-tab
21
+ * scroll needs exactly the same question answered exactly the same way. A
22
+ * second copy is a second place for the token name to go stale.
23
+ */
24
+ export declare function reducedMotion(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",
@@ -69,7 +69,7 @@
69
69
  "gates": "npm run shoot && npm run a11y && node scripts/shoot-overlays.mjs && npm run probe",
70
70
  "a11y": "node scripts/a11y-scan.mjs",
71
71
  "shoot": "node scripts/shoot.mjs",
72
- "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs",
72
+ "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs && node scripts/probe-tabs-overflow.mjs && node scripts/probe-stat-row.mjs",
73
73
  "sync": "node scripts/sync.mjs",
74
74
  "visual": "node scripts/visual-docker.mjs",
75
75
  "visual:update": "node scripts/visual-docker.mjs --update-snapshots",