@zonsh/ui 0.2.0 → 0.5.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/LICENSE +22 -0
- package/README.md +19 -13
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/ascii-field.d.ts +1 -1
- package/dist/components/ascii-field.js +2 -1
- package/dist/components/bottom-nav.d.ts +86 -0
- package/dist/components/bottom-nav.js +175 -0
- package/dist/components/breadcrumb.d.ts +9 -0
- package/dist/components/breadcrumb.js +6 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/calendar.js +18 -3
- package/dist/components/carousel.d.ts +22 -3
- package/dist/components/carousel.js +25 -7
- package/dist/components/chart.d.ts +20 -0
- package/dist/components/chart.js +52 -3
- package/dist/components/code-block.d.ts +20 -10
- package/dist/components/code-block.js +54 -12
- package/dist/components/collapsible.js +3 -3
- package/dist/components/color-picker.d.ts +30 -8
- package/dist/components/color-picker.js +48 -27
- package/dist/components/combobox.d.ts +21 -3
- package/dist/components/combobox.js +79 -7
- package/dist/components/command.d.ts +23 -3
- package/dist/components/command.js +63 -18
- package/dist/components/conversation.d.ts +10 -1
- package/dist/components/conversation.js +24 -7
- package/dist/components/copy-button.d.ts +15 -6
- package/dist/components/copy-button.js +27 -10
- package/dist/components/data-table.d.ts +66 -6
- package/dist/components/data-table.js +376 -23
- package/dist/components/date-picker.d.ts +73 -4
- package/dist/components/date-picker.js +138 -7
- package/dist/components/dialog.d.ts +10 -1
- package/dist/components/dialog.js +6 -3
- package/dist/components/drawer.d.ts +10 -1
- package/dist/components/drawer.js +6 -3
- package/dist/components/feature-list.js +2 -2
- package/dist/components/field.d.ts +27 -8
- package/dist/components/field.js +49 -4
- package/dist/components/file-drop.d.ts +26 -4
- package/dist/components/file-drop.js +125 -64
- package/dist/components/filter-bar.d.ts +50 -3
- package/dist/components/filter-bar.js +71 -33
- package/dist/components/form.d.ts +4 -2
- package/dist/components/form.js +24 -2
- package/dist/components/graph.d.ts +41 -0
- package/dist/components/graph.js +106 -50
- package/dist/components/illustration.js +51 -4
- package/dist/components/input-group.d.ts +18 -7
- package/dist/components/input-group.js +41 -19
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +8 -1
- package/dist/components/layout.d.ts +2 -1
- package/dist/components/layout.js +55 -11
- package/dist/components/lightbox.d.ts +100 -0
- package/dist/components/lightbox.js +457 -0
- package/dist/components/locale.d.ts +44 -0
- package/dist/components/locale.js +37 -0
- package/dist/components/logo.js +1 -1
- package/dist/components/menu.js +3 -1
- package/dist/components/menubar.js +60 -13
- package/dist/components/message.d.ts +3 -3
- package/dist/components/message.js +12 -8
- package/dist/components/meter.js +3 -1
- package/dist/components/money-input.d.ts +80 -0
- package/dist/components/money-input.js +253 -0
- package/dist/components/navigation-menu.js +4 -2
- package/dist/components/number-field.d.ts +21 -2
- package/dist/components/number-field.js +53 -28
- package/dist/components/otp-field.d.ts +14 -1
- package/dist/components/otp-field.js +10 -2
- package/dist/components/pagination.d.ts +13 -7
- package/dist/components/pagination.js +18 -7
- package/dist/components/pdf-viewer.d.ts +67 -2
- package/dist/components/pdf-viewer.js +88 -21
- package/dist/components/phone-input.d.ts +79 -0
- package/dist/components/phone-input.js +282 -0
- package/dist/components/popover.js +1 -1
- package/dist/components/progress.js +3 -1
- package/dist/components/prompt-input.d.ts +34 -9
- package/dist/components/prompt-input.js +37 -17
- package/dist/components/radio-group.js +7 -2
- package/dist/components/rating.d.ts +73 -0
- package/dist/components/rating.js +124 -0
- package/dist/components/reasoning.d.ts +16 -1
- package/dist/components/reasoning.js +10 -7
- package/dist/components/resizable.d.ts +10 -1
- package/dist/components/resizable.js +4 -1
- package/dist/components/response.d.ts +17 -5
- package/dist/components/response.js +58 -18
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/select.js +14 -3
- package/dist/components/separator.js +1 -1
- package/dist/components/sidebar.d.ts +20 -4
- package/dist/components/sidebar.js +70 -35
- package/dist/components/site-header.d.ts +46 -12
- package/dist/components/site-header.js +78 -19
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +3 -1
- package/dist/components/sortable.d.ts +178 -0
- package/dist/components/sortable.js +1282 -0
- package/dist/components/sources.d.ts +17 -2
- package/dist/components/sources.js +11 -4
- package/dist/components/spinner.d.ts +13 -1
- package/dist/components/spinner.js +5 -2
- package/dist/components/stat.d.ts +91 -0
- package/dist/components/stat.js +141 -0
- package/dist/components/stepper.d.ts +71 -0
- package/dist/components/stepper.js +101 -0
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +13 -3
- package/dist/components/table.js +231 -41
- package/dist/components/tabs.js +8 -4
- package/dist/components/tags-input.d.ts +18 -2
- package/dist/components/tags-input.js +66 -34
- package/dist/components/theme.d.ts +16 -2
- package/dist/components/theme.js +34 -8
- package/dist/components/time-field.d.ts +24 -4
- package/dist/components/time-field.js +32 -9
- package/dist/components/timeline.d.ts +18 -2
- package/dist/components/timeline.js +13 -4
- package/dist/components/tippy.d.ts +48 -0
- package/dist/components/tippy.js +648 -0
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +12 -3
- package/dist/components/toggle-group.js +1 -0
- package/dist/components/tool-call.d.ts +19 -8
- package/dist/components/tool-call.js +23 -7
- package/dist/components/toolbar.d.ts +1 -1
- package/dist/components/toolbar.js +10 -2
- package/dist/components/tooltip.d.ts +4 -2
- package/dist/components/tooltip.js +10 -4
- package/dist/components/tour.d.ts +127 -0
- package/dist/components/tour.js +673 -0
- package/dist/components/tree.js +45 -9
- package/dist/components/video-player.d.ts +10 -2
- package/dist/components/video-player.js +134 -38
- package/dist/illustration.d.ts +2 -0
- package/dist/illustration.js +7 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +11 -3
- package/dist/lib/code-highlight.d.ts +3 -16
- package/dist/lib/code-highlight.js +160 -10
- package/dist/lib/code-theme.js +3 -3
- package/dist/lib/digit-roll.js +8 -8
- package/dist/lib/field-errors.d.ts +28 -0
- package/dist/lib/field-errors.js +24 -0
- package/dist/lib/field-value.d.ts +13 -0
- package/dist/lib/field-value.js +44 -0
- package/dist/lib/glide.d.ts +5 -4
- package/dist/lib/glide.js +5 -4
- package/dist/lib/graph-layout.js +11 -2
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.js +343 -0
- package/dist/lib/phone-countries.d.ts +1 -0
- package/dist/lib/phone-countries.js +281 -0
- package/dist/lib/phone.d.ts +90 -0
- package/dist/lib/phone.js +286 -0
- package/dist/lib/platform.d.ts +8 -3
- package/dist/lib/platform.js +13 -6
- package/dist/lib/row-index.d.ts +15 -0
- package/dist/lib/row-index.js +136 -0
- package/dist/lib/table-fit.d.ts +3 -2
- package/dist/lib/table-fit.js +52 -23
- package/dist/lib/theme-script.d.ts +15 -2
- package/dist/lib/theme-script.js +23 -3
- package/dist/lib/tippy/pixels.d.ts +47 -0
- package/dist/lib/tippy/pixels.js +187 -0
- package/dist/lib/tippy/sprite.d.ts +86 -0
- package/dist/lib/tippy/sprite.js +753 -0
- package/dist/messages/de.d.ts +12 -0
- package/dist/messages/de.js +326 -0
- package/dist/styles/expressive.css +60 -26
- package/dist/styles/index.css +11 -2
- package/dist/styles/material.css +47 -23
- package/dist/styles/parts/ai.css +4 -2
- package/dist/styles/parts/controls.css +85 -32
- package/dist/styles/parts/data.css +33 -5
- package/dist/styles/parts/feedback.css +110 -13
- package/dist/styles/parts/foundations.css +1 -1
- package/dist/styles/parts/navigation.css +230 -5
- package/dist/styles/parts/overlays.css +98 -11
- package/dist/styles/parts/pdf.css +13 -7
- package/dist/styles/tokens.css +28 -4
- package/dist/vite.d.ts +0 -50
- package/dist/vite.js +0 -100
- package/package.json +28 -33
- package/dist/components/code-highlight.d.ts +0 -13
- package/dist/components/code-highlight.js +0 -107
- package/dist/components/whiteboard.d.ts +0 -80
- package/dist/components/whiteboard.js +0 -389
- package/dist/styles/parts/whiteboard.css +0 -855
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type ButtonProps } from "./button.js";
|
|
4
|
+
/** Where an item is, as it is read out: the list's label (when it has one), and its position. */
|
|
5
|
+
export interface SortableAnnouncedPlace {
|
|
6
|
+
/** The list's `label`, if it has one. */
|
|
7
|
+
list?: string;
|
|
8
|
+
/** 1-based. */
|
|
9
|
+
position: number;
|
|
10
|
+
/** Items in the list. */
|
|
11
|
+
count: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SortableMessages {
|
|
14
|
+
/** The handle's accessible name: "Move Chapter 3". */
|
|
15
|
+
handle: (item: string) => string;
|
|
16
|
+
/** The handle's description: how to move an item with the keyboard. */
|
|
17
|
+
instructions: string;
|
|
18
|
+
/** A pointer drag started. */
|
|
19
|
+
pickedUp: (item: string, place: SortableAnnouncedPlace) => string;
|
|
20
|
+
/** Picked up with the keyboard: also says which keys move it. */
|
|
21
|
+
pickedUpKeyboard: (item: string, place: SortableAnnouncedPlace) => string;
|
|
22
|
+
/** An arrow key moved it within its list. */
|
|
23
|
+
movedWithin: (item: string, place: SortableAnnouncedPlace) => string;
|
|
24
|
+
/** An arrow key moved it into another list. */
|
|
25
|
+
movedTo: (item: string, place: SortableAnnouncedPlace) => string;
|
|
26
|
+
/** Moved by `useSortable().move` — from a menu, say. */
|
|
27
|
+
moved: (item: string, place: SortableAnnouncedPlace) => string;
|
|
28
|
+
dropped: (item: string, place: SortableAnnouncedPlace) => string;
|
|
29
|
+
cancelled: (item: string, place: SortableAnnouncedPlace) => string;
|
|
30
|
+
/** An arrow key at the end of the list, or past the last list. */
|
|
31
|
+
cannotMove: (item: string, place: SortableAnnouncedPlace) => string;
|
|
32
|
+
}
|
|
33
|
+
declare module "./locale" {
|
|
34
|
+
interface Messages {
|
|
35
|
+
sortable: SortableMessages;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Several lists, by id, each an ordered list of item ids — the columns of a board. */
|
|
39
|
+
export type SortableLists = Record<string, string[]>;
|
|
40
|
+
/** One list (an array of item ids) or several (`SortableLists`). */
|
|
41
|
+
export type SortableValue = string[] | SortableLists;
|
|
42
|
+
/** A place in the lists: the list's id (`""` for a single list) and the index in it. */
|
|
43
|
+
export interface SortablePlace {
|
|
44
|
+
list: string;
|
|
45
|
+
index: number;
|
|
46
|
+
}
|
|
47
|
+
export interface SortableMoveDetails {
|
|
48
|
+
/** The item's id. */
|
|
49
|
+
item: string;
|
|
50
|
+
from: SortablePlace;
|
|
51
|
+
to: SortablePlace;
|
|
52
|
+
/** What moved it: a drag, a key, `useSortable().move`, or putting it back on a cancel. */
|
|
53
|
+
source: "pointer" | "keyboard" | "api" | "cancel";
|
|
54
|
+
}
|
|
55
|
+
export interface SortableMoveEndDetails {
|
|
56
|
+
item: string;
|
|
57
|
+
/** Where it was picked up. */
|
|
58
|
+
from: SortablePlace;
|
|
59
|
+
/** Where it was put down — `from` again when cancelled. */
|
|
60
|
+
to: SortablePlace;
|
|
61
|
+
cancelled: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Takes `item` out of wherever it is and puts it at `to` — the index in the target list without
|
|
65
|
+
* the item. Works on one list (`to.list` is ignored) and on several. The value is not changed; a
|
|
66
|
+
* new one is returned. Every way of moving an item should go through it.
|
|
67
|
+
*/
|
|
68
|
+
export declare function moveSortableItem<V extends SortableValue>(value: V, item: string, to: Partial<SortablePlace>): V;
|
|
69
|
+
interface ItemContextValue {
|
|
70
|
+
value: string;
|
|
71
|
+
label: string;
|
|
72
|
+
disabled: boolean;
|
|
73
|
+
dragging: boolean;
|
|
74
|
+
lifted: boolean;
|
|
75
|
+
overlay: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** The item a part is in: its value, and whether it is being dragged, lifted, or is the copy under the pointer. */
|
|
78
|
+
export declare function useSortableItem(): ItemContextValue;
|
|
79
|
+
export interface UseSortable {
|
|
80
|
+
/**
|
|
81
|
+
* Move an item without a drag — from a "Move to" menu, say — and announce it. `index` defaults
|
|
82
|
+
* to the end of the list. `focus` is a selector inside the item to focus after the move, as the
|
|
83
|
+
* item remounts in another list; by default focus is left alone.
|
|
84
|
+
*/
|
|
85
|
+
move: (item: string, to: Partial<SortablePlace>, options?: {
|
|
86
|
+
focus?: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
/** The item being dragged with the pointer, if any. */
|
|
89
|
+
dragging: string | null;
|
|
90
|
+
/** The item picked up with the keyboard, if any. */
|
|
91
|
+
lifted: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** The Sortable around a part: `move` an item from your own controls, and what is moving now. */
|
|
94
|
+
export declare function useSortable(): UseSortable;
|
|
95
|
+
export interface SortableProps<V extends SortableValue = SortableValue> extends Omit<useRender.ComponentProps<"div">, "defaultValue" | "onChange"> {
|
|
96
|
+
/** The order: an array of item ids for one list, or `{ [listId]: ids }` for several. */
|
|
97
|
+
value?: V;
|
|
98
|
+
/** The order to start from, uncontrolled. */
|
|
99
|
+
defaultValue?: V;
|
|
100
|
+
/**
|
|
101
|
+
* Called with the new order on every move — each arrow key while an item is lifted, a drop, a
|
|
102
|
+
* cancel that puts it back. Save on `onMoveEnd` instead if every step would be a request.
|
|
103
|
+
*/
|
|
104
|
+
onValueChange?: (value: V, details: SortableMoveDetails) => void;
|
|
105
|
+
/** Called once an item is put down, or put back. */
|
|
106
|
+
onMoveEnd?: (details: SortableMoveEndDetails) => void;
|
|
107
|
+
/**
|
|
108
|
+
* The copy that follows the pointer. By default it is a copy of the item's own element; return
|
|
109
|
+
* your own to draw it differently (`useSortableItem().overlay` is true inside it).
|
|
110
|
+
*/
|
|
111
|
+
overlay?: (item: string) => React.ReactNode;
|
|
112
|
+
/** Drag only from a `SortableHandle`, so text in the items can be selected. */
|
|
113
|
+
handleOnly?: boolean;
|
|
114
|
+
/** Announcements and the handle's name; a LocaleProvider sets them for every Sortable. */
|
|
115
|
+
labels?: Partial<SortableMessages>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Sortable — reorderable lists: one list, a row, a wrapping grid, or several lists that items
|
|
119
|
+
* move between, as the columns of a board.
|
|
120
|
+
*
|
|
121
|
+
* Drag an item with the mouse, a pen or — after a long press, so a swipe still scrolls — a finger:
|
|
122
|
+
* a copy follows the pointer, the other items slide aside to open a gap where it will land (in a
|
|
123
|
+
* grid, slot to slot across the row breaks), and on release the copy glides into the gap (or
|
|
124
|
+
* home, on a cancel), taking the size of its place. Over a list of narrower or wider items the
|
|
125
|
+
* copy takes their width. Edges scroll as it nears them.
|
|
126
|
+
* Every item has a `SortableHandle`: Space or Enter picks the item up, the arrows move it — the
|
|
127
|
+
* items slide into their new order — Space drops it and Escape puts it back. Every move is read
|
|
128
|
+
* out in a polite live region. No drag-and-drop library: measured once, moved by transforms.
|
|
129
|
+
*
|
|
130
|
+
* Compose `Sortable` → `SortableList` → `SortableItem` → `SortableHandle`. The rule people break:
|
|
131
|
+
* leaving out the handle. Without it there is no keyboard way to move an item.
|
|
132
|
+
*/
|
|
133
|
+
export declare function Sortable<V extends SortableValue = SortableValue>({ value: valueProp, defaultValue, onValueChange, onMoveEnd, overlay, handleOnly, labels, render, className, children, ref, ...props }: SortableProps<V>): React.JSX.Element;
|
|
134
|
+
export interface SortableListProps extends useRender.ComponentProps<"ol"> {
|
|
135
|
+
/** The list's key in a `Sortable` of several lists. Leave it out for a single list. */
|
|
136
|
+
id?: string;
|
|
137
|
+
/**
|
|
138
|
+
* `vertical` (default) stacks the items; `horizontal` lines them up in a row; `grid` lays them
|
|
139
|
+
* out in rows that wrap — Left and Right move an item by one, Up and Down by a row. Items that
|
|
140
|
+
* wrap move as a grid, by pointer and by key, whatever the orientation.
|
|
141
|
+
*/
|
|
142
|
+
orientation?: "vertical" | "horizontal" | "grid";
|
|
143
|
+
/**
|
|
144
|
+
* The list's name in announcements ("Moved to Qualified, position 2 of 4"); also its
|
|
145
|
+
* `aria-label` unless it has an `aria-label` or `aria-labelledby` of its own.
|
|
146
|
+
*/
|
|
147
|
+
label?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* One list of items, an `<ol>` by default. Items keep the order of `value`; render them in it.
|
|
151
|
+
* Lay it out yourself (`flex flex-col gap-2`, a row with `flex-row`, a `grid grid-cols-3`). While
|
|
152
|
+
* an item is dragged the others slide aside to open a gap of its size where it will land — in a
|
|
153
|
+
* grid each moves into the slot of its neighbour, across the row breaks.
|
|
154
|
+
*/
|
|
155
|
+
export declare function SortableList({ id, orientation, label, render, className, children, ref, ...props }: SortableListProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
156
|
+
export interface SortableItemProps extends useRender.ComponentProps<"li"> {
|
|
157
|
+
/** The item's id, as it is in `value`. */
|
|
158
|
+
value: string;
|
|
159
|
+
/** Its name in announcements and on its handle ("Move Chapter 3"). Defaults to `value`. */
|
|
160
|
+
label?: string;
|
|
161
|
+
/** Not moved by drag or keyboard; its handle is disabled. */
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* One item, an `<li>` by default. Dragged, it leaves its place (`data-dragging`, hidden) while a
|
|
166
|
+
* copy follows the pointer and the other items slide around the gap; picked up with the keyboard
|
|
167
|
+
* it has `data-lifted`, and it slides with the others as the arrows move it. Presses on buttons,
|
|
168
|
+
* links and fields inside it keep their own clicks.
|
|
169
|
+
*/
|
|
170
|
+
export declare function SortableItem({ value, label, disabled, render, className, children, onPointerDown, onContextMenu, ref, ...props }: SortableItemProps): React.JSX.Element;
|
|
171
|
+
export type SortableHandleProps = ButtonProps;
|
|
172
|
+
/**
|
|
173
|
+
* The grip that moves an item: drag it — at once, even on touch — or focus it and press Space.
|
|
174
|
+
* A ghost 30px icon button named "Move {label}", described by the keyboard instructions, with
|
|
175
|
+
* `aria-pressed` while the item is lifted. Without children it draws a grip in the list's direction.
|
|
176
|
+
*/
|
|
177
|
+
export declare function SortableHandle({ variant, size, className, children, onKeyDown, onBlur, ref, ...props }: SortableHandleProps): React.JSX.Element;
|
|
178
|
+
export {};
|