@newtone-dev/ui-react-web 0.48.0 → 0.50.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/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/node-map/node-map.css +13 -0
- package/dist/node-map/node-map.d.ts +5 -0
- package/dist/node-map/node-map.d.ts.map +1 -1
- package/dist/node-map/node-map.js +12 -3
- package/dist/node-map/node-map.js.map +1 -1
- package/dist/outline/index.d.ts +3 -0
- package/dist/outline/index.d.ts.map +1 -0
- package/dist/outline/index.js +2 -0
- package/dist/outline/index.js.map +1 -0
- package/dist/outline/outline.css +348 -0
- package/dist/outline/outline.d.ts +154 -0
- package/dist/outline/outline.d.ts.map +1 -0
- package/dist/outline/outline.js +773 -0
- package/dist/outline/outline.js.map +1 -0
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +4 -1
- package/dist/select/select.js.map +1 -1
- package/dist/when-field/index.d.ts +5 -0
- package/dist/when-field/index.d.ts.map +1 -0
- package/dist/when-field/index.js +3 -0
- package/dist/when-field/index.js.map +1 -0
- package/dist/when-field/period.d.ts +41 -0
- package/dist/when-field/period.d.ts.map +1 -0
- package/dist/when-field/period.js +230 -0
- package/dist/when-field/period.js.map +1 -0
- package/dist/when-field/when-field.css +70 -0
- package/dist/when-field/when-field.d.ts +35 -0
- package/dist/when-field/when-field.d.ts.map +1 -0
- package/dist/when-field/when-field.js +138 -0
- package/dist/when-field/when-field.js.map +1 -0
- package/package.json +11 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type PopMenuItem } from '../pop-menu/index.js';
|
|
3
|
+
/** A row: a thing with a name, and the rows it holds (`children`), in order. */
|
|
4
|
+
export interface OutlineItem {
|
|
5
|
+
id: string;
|
|
6
|
+
/** Its name: the row's words, changed in place. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Its glyph, an `Icon` name. */
|
|
9
|
+
icon: string;
|
|
10
|
+
/** The rows it holds, in order. With one or more, the row folds. */
|
|
11
|
+
children?: OutlineItem[];
|
|
12
|
+
/** Shown folded: the rows it holds are not drawn. */
|
|
13
|
+
folded?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* What stands in each column's cell, by the column's `id`: words, or a small control (`Outline.Tick`). A column
|
|
16
|
+
* left out is an empty cell.
|
|
17
|
+
*/
|
|
18
|
+
cells?: Record<string, ReactNode>;
|
|
19
|
+
/** It does not move (the person may not change it): not dragged, no Alt with an arrow, no move up or down. */
|
|
20
|
+
stays?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A quiet mark at the end of its name's cell (2026-11-22): what it means is the consumer's (Planner: it waits for
|
|
23
|
+
* an item). Its `label` is said with the row's name and shown on hover.
|
|
24
|
+
*/
|
|
25
|
+
mark?: OutlineMark;
|
|
26
|
+
}
|
|
27
|
+
/** A quiet mark on a row (2026-11-22): a glyph, and its words, said and shown on hover. */
|
|
28
|
+
export interface OutlineMark {
|
|
29
|
+
/** An `Icon` name. */
|
|
30
|
+
icon: string;
|
|
31
|
+
/** Its words: said as part of the row's header, and its hover text (*Waits for Design review*). */
|
|
32
|
+
label: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A row of a row's ⋯ menu (2026-11-22): Newtone's menu row (`label`, `icon`, `disabled`, `divided`, `tone: 'danger'`).
|
|
36
|
+
* With `move`, it is the outline's: picked, it tells `onMove` the move Alt with that arrow tells, and it is disabled
|
|
37
|
+
* wherever there is none (first, last, `stays`, a lone child, no `onMove`); `onPick` is not told.
|
|
38
|
+
*/
|
|
39
|
+
export interface OutlineMenuItem extends PopMenuItem {
|
|
40
|
+
move?: 'up' | 'down';
|
|
41
|
+
}
|
|
42
|
+
/** A ⋯ menu on every row (2026-11-22): its words, its rows for a row, and what was picked. */
|
|
43
|
+
export interface OutlineMenu {
|
|
44
|
+
/** Names the ⋯ and its menu for a row, from the row's name (*More: Launch*); also the ⋯'s hover text. */
|
|
45
|
+
label: (name: string) => string;
|
|
46
|
+
/** The menu's rows for the row `id`, in order; asked each time it opens. */
|
|
47
|
+
items: (id: string) => OutlineMenuItem[];
|
|
48
|
+
/** A row of the menu picked for the row `id` (never a `move` row, which the outline tells as a move). */
|
|
49
|
+
onPick: (id: string, action: string) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Where a moved row would stand (2026-11-22): by the row that would hold it and its neighbours there, so a consumer that
|
|
53
|
+
* keeps places between neighbours needs nothing more. Among its siblings, `holder` is the one it has; dropped onto a
|
|
54
|
+
* row that may hold it (`canHold`), `holder` is that row, and it would stand last there.
|
|
55
|
+
*/
|
|
56
|
+
export interface OutlineMove {
|
|
57
|
+
/** The row that would hold it: the one it has, or the row it is dropped into; null at the top. */
|
|
58
|
+
holder: string | null;
|
|
59
|
+
/** The sibling it would stand right after; null, first. */
|
|
60
|
+
after: string | null;
|
|
61
|
+
/** The sibling it would stand right before; null, last. */
|
|
62
|
+
before: string | null;
|
|
63
|
+
}
|
|
64
|
+
/** A column after the name: its heading, and how its cells stand. */
|
|
65
|
+
export interface OutlineColumn {
|
|
66
|
+
/** Names the column to each item's `cells`. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Its heading, over the cells. */
|
|
69
|
+
label: string;
|
|
70
|
+
/** How wide it is, a CSS length. Left out, 7rem: a day as words. A column of ticks is 36px. */
|
|
71
|
+
width?: string;
|
|
72
|
+
/** Where its heading and its cells stand in it: `start` (the default), `center` (a tick) or `end`. */
|
|
73
|
+
align?: 'start' | 'center' | 'end';
|
|
74
|
+
/** Shown only where the outline is wider than 40rem: narrower, the column goes. The name always stays. */
|
|
75
|
+
wideOnly?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface OutlineProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
78
|
+
/** Names the outline. */
|
|
79
|
+
label: string;
|
|
80
|
+
/** The name column's heading; the fold's two names; the name of the field a row's name is changed in. */
|
|
81
|
+
labels: {
|
|
82
|
+
name: string;
|
|
83
|
+
fold: string;
|
|
84
|
+
unfold: string;
|
|
85
|
+
rename: string;
|
|
86
|
+
/**
|
|
87
|
+
* The words said once a moved row stands in its new place (*Moved Launch: 2 of 5*): its name, its place among
|
|
88
|
+
* its siblings counted from 1, and how many they are. Left out, a move is not said.
|
|
89
|
+
*/
|
|
90
|
+
moved?: (name: string, place: number, of: number) => string;
|
|
91
|
+
};
|
|
92
|
+
items: OutlineItem[];
|
|
93
|
+
/** The columns after the name, in order. With none, the rows are names alone and there is no head. */
|
|
94
|
+
columns?: OutlineColumn[];
|
|
95
|
+
/** The id of the one row chosen, or null. */
|
|
96
|
+
chosen: string | null;
|
|
97
|
+
/** A press on a row, or the keys moving to it. */
|
|
98
|
+
onChoose?: (id: string) => void;
|
|
99
|
+
/** A name changed in place. Left out, no row is renamed. */
|
|
100
|
+
onRename?: (id: string, name: string) => void;
|
|
101
|
+
/** A row folded or unfolded. The consumer keeps what is folded. */
|
|
102
|
+
onFold?: (id: string, folded: boolean) => void;
|
|
103
|
+
/**
|
|
104
|
+
* A row moved among its siblings, by a drag or Alt with Up or Down: where it would stand. The outline moves nothing
|
|
105
|
+
* itself; the consumer draws it there, or does not. Left out, no row moves.
|
|
106
|
+
*/
|
|
107
|
+
onMove?: (id: string, to: OutlineMove) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the row `id` may go inside the row `holder` (2026-11-22, a move into another holder). Given, a drag over
|
|
110
|
+
* the middle of such a row lands inside it, and `onMove` is told that row as `holder`. Left out, a row moves only
|
|
111
|
+
* among its siblings. The consumer offers a way without dragging (a panel's *In*).
|
|
112
|
+
*/
|
|
113
|
+
canHold?: (holder: string, id: string) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* A ⋯ menu on every row (2026-11-22): opened by its ⋯, Shift+F10 or the menu key on the focused row, a mouse's
|
|
116
|
+
* secondary press, or a finger held still on the row half a second and lifted. Opening it chooses its row.
|
|
117
|
+
*/
|
|
118
|
+
menu?: OutlineMenu;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* What a host needs for Move up and Move down (a row's menu): the move one place up and one place down among the row's
|
|
122
|
+
* siblings, each to pass to `onMove`'s handler, or null where the row is first, last, `stays`, or no item has it. The
|
|
123
|
+
* same answer Alt with Up or Down acts on.
|
|
124
|
+
*/
|
|
125
|
+
export declare function outlineMoves(items: OutlineItem[], id: string): {
|
|
126
|
+
up: OutlineMove | null;
|
|
127
|
+
down: OutlineMove | null;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Rows as a tree: one row per thing, each under the row of the thing that holds it, with a fold, a glyph, a name
|
|
131
|
+
* changed in place, and cells at its end under the columns' headings. One row is chosen. The consumer keeps the tree
|
|
132
|
+
* and is told each change. Blueprint components/outline.md; contracts/outline.md.
|
|
133
|
+
*/
|
|
134
|
+
declare function OutlineRoot({ label, labels, items, columns, chosen, onChoose, onRename, onFold, onMove, canHold, menu, className, onPointerMove, onPointerUp, onPointerCancel, ...rest }: OutlineProps): import("react").JSX.Element;
|
|
135
|
+
export interface OutlineTickProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'children' | 'type' | 'role' | 'disabled'> {
|
|
136
|
+
/** Its name, said with its state: what it marks, and for which row (*Done: Untitled project*). */
|
|
137
|
+
label: string;
|
|
138
|
+
checked: boolean;
|
|
139
|
+
/** A press: told what it would become. */
|
|
140
|
+
onChange?: (checked: boolean) => void;
|
|
141
|
+
/** Shown, not pressed: said to be unavailable, keeping its place in the Tab order. Never natively disabled. */
|
|
142
|
+
disabled?: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A tick in a row's cell: on or off, pressed (`Outline.Tick`). Newtone's own box and mark, never the platform's
|
|
146
|
+
* checkbox. In a row it is a Tab stop only while its row holds the outline's.
|
|
147
|
+
*/
|
|
148
|
+
declare function OutlineTick({ label, checked, onChange, disabled, className, onClick, onMouseDown, ...rest }: OutlineTickProps): import("react").JSX.Element;
|
|
149
|
+
export declare const Outline: typeof OutlineRoot & {
|
|
150
|
+
Tick: typeof OutlineTick;
|
|
151
|
+
moves: typeof outlineMoves;
|
|
152
|
+
};
|
|
153
|
+
export {};
|
|
154
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/outline/outline.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAInB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAA;AAEd,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGhF,gFAAgF;AAChF,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACjC,8GAA8G;IAC9G,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IACxB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAA;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CACvB;AAED,8FAA8F;AAC9F,MAAM,WAAW,WAAW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