@salilvnair/dui 1.0.8 → 1.0.9
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/assets/{DuiShowcase-C18KoqHP.css → DuiShowcase-BOtwgwbq.css} +1 -1
- package/dist/assets/{DuiShowcase-DwihGCxO.js → DuiShowcase-Bl4Oi2Vw.js} +937 -937
- package/dist/assets/index-Dylj6yGs.css +10 -0
- package/dist/assets/{index-D9rPjVPP.js → index-ROymQLGX.js} +2 -2
- package/dist/chunks/{doc-path-D2_JUEIe.js → doc-path-CS9-ZNht.js} +36 -35
- package/dist/chunks/doc-path-CS9-ZNht.js.map +1 -0
- package/dist/index.html +2 -2
- package/dist/index.js +7501 -6745
- package/dist/index.js.map +1 -1
- package/dist/lib/components/display/BadgeChipView.d.ts +29 -3
- package/dist/lib/components/display/LoadingStateView.d.ts +61 -0
- package/dist/lib/components/display/badge-chip-skins.d.ts +496 -0
- package/dist/lib/components/display/badge-chip.test.d.ts +1 -0
- package/dist/lib/components/input/SearchFieldView.d.ts +40 -1
- package/dist/lib/components/input/markdown-serialise.d.ts +16 -0
- package/dist/lib/components/input/markdown-serialise.test.d.ts +1 -0
- package/dist/lib/core/DuiContext.d.ts +4 -2
- package/dist/lib/core/DuiTypes.d.ts +8 -0
- package/dist/lib/core/IconSize.d.ts +8 -0
- package/dist/lib/index.d.ts +7 -2
- package/dist/monaco-setup.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/assets/index-kr_HUJjf.css +0 -10
- package/dist/chunks/doc-path-D2_JUEIe.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { BadgeChipVariant, ChipSkin } from './badge-chip-skins';
|
|
2
3
|
export type BadgeChipSize = '2xs' | 'xs' | 'sm' | 'md';
|
|
4
|
+
export type { BadgeChipVariant };
|
|
3
5
|
export interface BadgeChipViewProps {
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
/**
|
|
@@ -11,15 +13,39 @@ export interface BadgeChipViewProps {
|
|
|
11
13
|
*/
|
|
12
14
|
tone?: string;
|
|
13
15
|
size?: BadgeChipSize;
|
|
16
|
+
/**
|
|
17
|
+
* Which of the fifty looks. Falls back to the provider's `chipVariant`, then
|
|
18
|
+
* to the original raised one.
|
|
19
|
+
*/
|
|
20
|
+
variant?: BadgeChipVariant;
|
|
14
21
|
/**
|
|
15
22
|
* Drop the tint and the border, keeping only the text.
|
|
16
23
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
24
|
+
* Kept for the callers that already say it. It is the `text` skin by another
|
|
25
|
+
* name, and it wins over `variant` when both are given.
|
|
19
26
|
*/
|
|
20
27
|
plain?: boolean;
|
|
21
28
|
title?: string;
|
|
22
29
|
className?: string;
|
|
23
30
|
style?: CSSProperties;
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
/** The style of the box, given a skin and a size. Exported for the gallery. */
|
|
33
|
+
export declare function chipBoxStyle(skin: ChipSkin, tone: string, size: BadgeChipSize): CSSProperties;
|
|
34
|
+
/** The dot's own box, when a skin has one. Exported for the gallery. */
|
|
35
|
+
export declare function chipDotStyle(tone: string, size: BadgeChipSize): CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* What to put on the span holding the glyphs.
|
|
38
|
+
*
|
|
39
|
+
* It is a flex row, and that is not decoration. The children used to sit
|
|
40
|
+
* directly in the chip's own flex box, so a caller passing an icon and a word
|
|
41
|
+
* got them side by side. Wrapping them in a span to carry the corrections
|
|
42
|
+
* below turned that into inline flow — and an `<svg>` is `display: block`
|
|
43
|
+
* under a Tailwind reset, which breaks the line. The performance badge in the
|
|
44
|
+
* REST status bar became a gauge on one line and "5.6σ slow" on the next.
|
|
45
|
+
*
|
|
46
|
+
* Then the two corrections, both sub-pixel and both real: the trailing
|
|
47
|
+
* letter-space taken back out of the centring, and the measured vertical nudge
|
|
48
|
+
* for caps. Exported so the gallery draws exactly what the component draws.
|
|
49
|
+
*/
|
|
50
|
+
export declare function chipTextStyle(skin: ChipSkin, size: BadgeChipSize): CSSProperties;
|
|
51
|
+
export declare function BadgeChipView({ children, tone, size, variant, plain, title, className, style, }: BadgeChipViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
export interface LoadingStateViewProps {
|
|
3
|
+
/**
|
|
4
|
+
* The thing being waited for, drawn large.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately the subject rather than a generic spinner: a reader glancing
|
|
7
|
+
* at the screen learns what is happening from the icon before they read a
|
|
8
|
+
* word of it.
|
|
9
|
+
*/
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
title: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
accentColor?: string;
|
|
14
|
+
/** Matches EmptyStateView, so the two swap without the layout moving. */
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The medallion's box, in px.
|
|
18
|
+
*
|
|
19
|
+
* Defaulted from `compact`, and worth overriding in one case: a state that
|
|
20
|
+
* owns a whole panel rather than sitting inside a list. 54px centred in an
|
|
21
|
+
* empty tab reads as something that failed to load rather than as the
|
|
22
|
+
* subject of the screen. Pair it with a larger icon — `IconSize.hero`.
|
|
23
|
+
*/
|
|
24
|
+
medallionSize?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Seconds after which the wait stops being ordinary.
|
|
27
|
+
*
|
|
28
|
+
* A cluster on the other side of the world, behind a VPN, answers in seconds
|
|
29
|
+
* rather than milliseconds — and the reader cannot tell that from a hang. At
|
|
30
|
+
* this point the component says so itself instead of leaving them to guess.
|
|
31
|
+
* 0 disables it.
|
|
32
|
+
*/
|
|
33
|
+
slowAfterSeconds?: number;
|
|
34
|
+
/** What to say once it has been slow. Replaces `message`. */
|
|
35
|
+
slowMessage?: string;
|
|
36
|
+
/** Offered only once the wait has gone long — Cancel, Try again, Go back. */
|
|
37
|
+
action?: {
|
|
38
|
+
label: string;
|
|
39
|
+
onClick: () => void;
|
|
40
|
+
};
|
|
41
|
+
/** Shown under the message: what is being fetched, step by step. */
|
|
42
|
+
hints?: {
|
|
43
|
+
key: ReactNode;
|
|
44
|
+
text: string;
|
|
45
|
+
}[];
|
|
46
|
+
className?: string;
|
|
47
|
+
style?: CSSProperties;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Waiting, said properly.
|
|
51
|
+
*
|
|
52
|
+
* The shape of EmptyStateView with a pulse and a clock. It exists because the
|
|
53
|
+
* alternative everywhere was a line of grey text — "Loading pods…", "Loading
|
|
54
|
+
* namespaces…" — which says nothing about what is being waited for, nothing
|
|
55
|
+
* about how long it has been, and looks identical whether the answer is a
|
|
56
|
+
* hundred milliseconds away or never coming.
|
|
57
|
+
*
|
|
58
|
+
* Three things it does that a spinner cannot: it names the subject, it changes
|
|
59
|
+
* its mind after a while, and it eventually offers a way out.
|
|
60
|
+
*/
|
|
61
|
+
export declare function LoadingStateView({ icon, title, message, accentColor, compact, medallionSize, slowAfterSeconds, slowMessage, action, hints, className, style, }: LoadingStateViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fifty ways to draw the same chip.
|
|
3
|
+
*
|
|
4
|
+
* The chip started as one look — a raised face with a light top edge, a dark
|
|
5
|
+
* inner bottom edge and a drop shadow. That reads well alone in a dense
|
|
6
|
+
* monospace row and badly in a line of five, where every chip looks like a
|
|
7
|
+
* button you could press and none of them are. Rather than argue the point
|
|
8
|
+
* once and bake in a second opinion, the look is a value.
|
|
9
|
+
*
|
|
10
|
+
* Each entry here is DATA, not a style function, and that is deliberate: the
|
|
11
|
+
* same table drives the component and the gallery that photographs it, so the
|
|
12
|
+
* sheet you choose from cannot drift from what the app renders.
|
|
13
|
+
*
|
|
14
|
+
* ── What a skin may and may not decide ──
|
|
15
|
+
*
|
|
16
|
+
* It decides the surface: fill, border, corner, depth, and how the text is set
|
|
17
|
+
* — caps or not, mono or not, weight, tracking. It does NOT decide the chip's
|
|
18
|
+
* height or font size; those come from `size`, so a row of chips in different
|
|
19
|
+
* skins still lines up on one baseline. A skin that wanted to be taller would
|
|
20
|
+
* be a different size, not a different skin.
|
|
21
|
+
*
|
|
22
|
+
* ── Where they come from ──
|
|
23
|
+
*
|
|
24
|
+
* Several are modelled on chips people already know from the web — Material's
|
|
25
|
+
* assist and filter chips, MUI's filled and outlined, Ant's tag, a GitHub
|
|
26
|
+
* label, a Tailwind badge with its inset ring, an Atlassian lozenge. They are
|
|
27
|
+
* named for what they look like rather than who ships them, with the lineage
|
|
28
|
+
* in the note, because the point is to recognise the shape, not to clone a
|
|
29
|
+
* product.
|
|
30
|
+
*/
|
|
31
|
+
/** Where the fill comes from, when it is not a percentage of the tone. */
|
|
32
|
+
export type ChipFill = number | 'neutral' | 'surface' | 'sunken';
|
|
33
|
+
export interface ChipSkin {
|
|
34
|
+
id: string;
|
|
35
|
+
/** What to call it in a picker. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** One line: what it is, and where the shape is from. */
|
|
38
|
+
note: string;
|
|
39
|
+
fill?: ChipFill;
|
|
40
|
+
/** Border strength as a percentage of the tone. */
|
|
41
|
+
border?: number;
|
|
42
|
+
borderWidth?: number;
|
|
43
|
+
borderStyle?: 'solid' | 'dashed';
|
|
44
|
+
/**
|
|
45
|
+
* A saturated fill, as a percentage of the tone, with ink on top instead of
|
|
46
|
+
* the tone in the text. `ink` says which way the text goes.
|
|
47
|
+
*/
|
|
48
|
+
solid?: number;
|
|
49
|
+
ink?: 'dark' | 'light';
|
|
50
|
+
/** An inset ring, the Tailwind badge trick: a border that costs no layout. */
|
|
51
|
+
ring?: number;
|
|
52
|
+
/** Corner. A number is px; `pill` is fully round; omitted takes the size's. */
|
|
53
|
+
radius?: number | 'pill';
|
|
54
|
+
/** Raised like the original, or sunk into the surface. */
|
|
55
|
+
depth?: 'raised' | 'inset' | 'lift';
|
|
56
|
+
/** Uppercase, and mono. Both default true — a label, not a sentence. */
|
|
57
|
+
caps?: boolean;
|
|
58
|
+
mono?: boolean;
|
|
59
|
+
weight?: number;
|
|
60
|
+
/** Letter-spacing in em. */
|
|
61
|
+
tracking?: number;
|
|
62
|
+
/** Added to the size's horizontal padding. */
|
|
63
|
+
padX?: number;
|
|
64
|
+
/** A tone-coloured dot before the text. */
|
|
65
|
+
dot?: boolean;
|
|
66
|
+
/** Square brackets around the text, which is the box. */
|
|
67
|
+
brackets?: boolean;
|
|
68
|
+
/** A rule under the text instead of a box around it. */
|
|
69
|
+
underline?: boolean;
|
|
70
|
+
/** A 2px tone edge on the left, square corners. */
|
|
71
|
+
rail?: boolean;
|
|
72
|
+
/** No box at all: the colour carries it. */
|
|
73
|
+
bare?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export declare const BADGE_CHIP_SKINS: readonly [{
|
|
76
|
+
readonly id: "embossed";
|
|
77
|
+
readonly label: "Embossed";
|
|
78
|
+
readonly note: "The original: lit top edge, dark inner bottom, drop shadow.";
|
|
79
|
+
readonly fill: 20;
|
|
80
|
+
readonly border: 42;
|
|
81
|
+
readonly depth: "raised";
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "flat";
|
|
84
|
+
readonly label: "Flat tint";
|
|
85
|
+
readonly note: "Fill and text, nothing else.";
|
|
86
|
+
readonly fill: 22;
|
|
87
|
+
}, {
|
|
88
|
+
readonly id: "soft";
|
|
89
|
+
readonly label: "Soft";
|
|
90
|
+
readonly note: "A lighter tint, still boxed.";
|
|
91
|
+
readonly fill: 14;
|
|
92
|
+
readonly radius: 6;
|
|
93
|
+
}, {
|
|
94
|
+
readonly id: "quiet";
|
|
95
|
+
readonly label: "Quiet";
|
|
96
|
+
readonly note: "Soft fill with a soft hairline. No depth.";
|
|
97
|
+
readonly fill: 12;
|
|
98
|
+
readonly border: 28;
|
|
99
|
+
}, {
|
|
100
|
+
readonly id: "tint-strong";
|
|
101
|
+
readonly label: "Strong tint";
|
|
102
|
+
readonly note: "The tint turned up, no border.";
|
|
103
|
+
readonly fill: 34;
|
|
104
|
+
}, {
|
|
105
|
+
readonly id: "ghost";
|
|
106
|
+
readonly label: "Ghost";
|
|
107
|
+
readonly note: "A neutral wash; the tone lives in the text.";
|
|
108
|
+
readonly fill: "neutral";
|
|
109
|
+
}, {
|
|
110
|
+
readonly id: "surface";
|
|
111
|
+
readonly label: "Surface";
|
|
112
|
+
readonly note: "The panel surface with a hairline, like a small card.";
|
|
113
|
+
readonly fill: "surface";
|
|
114
|
+
readonly border: 22;
|
|
115
|
+
}, {
|
|
116
|
+
readonly id: "recessed";
|
|
117
|
+
readonly label: "Recessed";
|
|
118
|
+
readonly note: "A well in the surface rather than a raised face.";
|
|
119
|
+
readonly fill: "sunken";
|
|
120
|
+
readonly depth: "inset";
|
|
121
|
+
}, {
|
|
122
|
+
readonly id: "solid";
|
|
123
|
+
readonly label: "Solid";
|
|
124
|
+
readonly note: "Full tone with dark ink. The loudest of them.";
|
|
125
|
+
readonly solid: 100;
|
|
126
|
+
readonly ink: "dark";
|
|
127
|
+
}, {
|
|
128
|
+
readonly id: "solid-soft";
|
|
129
|
+
readonly label: "Solid, softened";
|
|
130
|
+
readonly note: "The tone at three quarters.";
|
|
131
|
+
readonly solid: 74;
|
|
132
|
+
readonly ink: "dark";
|
|
133
|
+
}, {
|
|
134
|
+
readonly id: "solid-muted";
|
|
135
|
+
readonly label: "Solid, muted";
|
|
136
|
+
readonly note: "Half tone with light text.";
|
|
137
|
+
readonly solid: 52;
|
|
138
|
+
readonly ink: "light";
|
|
139
|
+
}, {
|
|
140
|
+
readonly id: "solid-pill";
|
|
141
|
+
readonly label: "Solid pill";
|
|
142
|
+
readonly note: "Full tone, fully round.";
|
|
143
|
+
readonly solid: 100;
|
|
144
|
+
readonly ink: "dark";
|
|
145
|
+
readonly radius: "pill";
|
|
146
|
+
}, {
|
|
147
|
+
readonly id: "hairline";
|
|
148
|
+
readonly label: "Hairline";
|
|
149
|
+
readonly note: "Outline only, no fill.";
|
|
150
|
+
readonly border: 48;
|
|
151
|
+
}, {
|
|
152
|
+
readonly id: "outline-strong";
|
|
153
|
+
readonly label: "Strong outline";
|
|
154
|
+
readonly note: "A heavier rule, still hollow.";
|
|
155
|
+
readonly border: 62;
|
|
156
|
+
readonly borderWidth: 1.5;
|
|
157
|
+
}, {
|
|
158
|
+
readonly id: "outline-dashed";
|
|
159
|
+
readonly label: "Dashed outline";
|
|
160
|
+
readonly note: "Hollow and provisional — good for a draft state.";
|
|
161
|
+
readonly border: 55;
|
|
162
|
+
readonly borderStyle: "dashed";
|
|
163
|
+
}, {
|
|
164
|
+
readonly id: "outline-tinted";
|
|
165
|
+
readonly label: "Tinted outline";
|
|
166
|
+
readonly note: "A hairline over a faint wash.";
|
|
167
|
+
readonly fill: 9;
|
|
168
|
+
readonly border: 44;
|
|
169
|
+
}, {
|
|
170
|
+
readonly id: "ring";
|
|
171
|
+
readonly label: "Inset ring";
|
|
172
|
+
readonly note: "The border drawn inside, so the box never grows.";
|
|
173
|
+
readonly fill: 10;
|
|
174
|
+
readonly ring: 26;
|
|
175
|
+
readonly radius: 6;
|
|
176
|
+
}, {
|
|
177
|
+
readonly id: "rect";
|
|
178
|
+
readonly label: "Square";
|
|
179
|
+
readonly note: "No corner at all.";
|
|
180
|
+
readonly fill: 16;
|
|
181
|
+
readonly border: 30;
|
|
182
|
+
readonly radius: 0;
|
|
183
|
+
}, {
|
|
184
|
+
readonly id: "tag";
|
|
185
|
+
readonly label: "Tag";
|
|
186
|
+
readonly note: "Two-pixel corners. Terminal-ish.";
|
|
187
|
+
readonly fill: 16;
|
|
188
|
+
readonly border: 34;
|
|
189
|
+
readonly radius: 2;
|
|
190
|
+
}, {
|
|
191
|
+
readonly id: "rounded";
|
|
192
|
+
readonly label: "Rounded";
|
|
193
|
+
readonly note: "Six-pixel corners, the web default.";
|
|
194
|
+
readonly fill: 16;
|
|
195
|
+
readonly border: 30;
|
|
196
|
+
readonly radius: 6;
|
|
197
|
+
}, {
|
|
198
|
+
readonly id: "rounded-lg";
|
|
199
|
+
readonly label: "Rounded, large";
|
|
200
|
+
readonly note: "Ten pixels: a rounded rectangle, clearly.";
|
|
201
|
+
readonly fill: 16;
|
|
202
|
+
readonly border: 30;
|
|
203
|
+
readonly radius: 10;
|
|
204
|
+
}, {
|
|
205
|
+
readonly id: "pill";
|
|
206
|
+
readonly label: "Pill";
|
|
207
|
+
readonly note: "Fully round, tinted.";
|
|
208
|
+
readonly fill: 18;
|
|
209
|
+
readonly radius: "pill";
|
|
210
|
+
readonly padX: 2;
|
|
211
|
+
}, {
|
|
212
|
+
readonly id: "pill-outline";
|
|
213
|
+
readonly label: "Pill, outlined";
|
|
214
|
+
readonly note: "Fully round and hollow.";
|
|
215
|
+
readonly border: 46;
|
|
216
|
+
readonly radius: "pill";
|
|
217
|
+
readonly padX: 2;
|
|
218
|
+
}, {
|
|
219
|
+
readonly id: "pill-quiet";
|
|
220
|
+
readonly label: "Pill, quiet";
|
|
221
|
+
readonly note: "Round, faint fill, faint edge.";
|
|
222
|
+
readonly fill: 11;
|
|
223
|
+
readonly border: 26;
|
|
224
|
+
readonly radius: "pill";
|
|
225
|
+
readonly padX: 2;
|
|
226
|
+
}, {
|
|
227
|
+
readonly id: "mui-filled";
|
|
228
|
+
readonly label: "Filled, sentence case";
|
|
229
|
+
readonly note: "MUI’s filled chip: round, tinted, not shouted.";
|
|
230
|
+
readonly fill: 16;
|
|
231
|
+
readonly radius: "pill";
|
|
232
|
+
readonly padX: 3;
|
|
233
|
+
readonly caps: false;
|
|
234
|
+
readonly mono: false;
|
|
235
|
+
readonly weight: 500;
|
|
236
|
+
readonly tracking: 0;
|
|
237
|
+
}, {
|
|
238
|
+
readonly id: "mui-outlined";
|
|
239
|
+
readonly label: "Outlined, sentence case";
|
|
240
|
+
readonly note: "MUI’s outlined chip.";
|
|
241
|
+
readonly border: 40;
|
|
242
|
+
readonly radius: "pill";
|
|
243
|
+
readonly padX: 3;
|
|
244
|
+
readonly caps: false;
|
|
245
|
+
readonly mono: false;
|
|
246
|
+
readonly weight: 500;
|
|
247
|
+
readonly tracking: 0;
|
|
248
|
+
}, {
|
|
249
|
+
readonly id: "mui-solid";
|
|
250
|
+
readonly label: "Filled solid, sentence case";
|
|
251
|
+
readonly note: "MUI’s coloured chip, ink on tone.";
|
|
252
|
+
readonly solid: 100;
|
|
253
|
+
readonly ink: "dark";
|
|
254
|
+
readonly radius: "pill";
|
|
255
|
+
readonly padX: 3;
|
|
256
|
+
readonly caps: false;
|
|
257
|
+
readonly mono: false;
|
|
258
|
+
readonly weight: 500;
|
|
259
|
+
readonly tracking: 0;
|
|
260
|
+
}, {
|
|
261
|
+
readonly id: "m3-assist";
|
|
262
|
+
readonly label: "Assist";
|
|
263
|
+
readonly note: "Material 3 assist chip: 8px corner, surface, thin outline.";
|
|
264
|
+
readonly fill: "surface";
|
|
265
|
+
readonly border: 26;
|
|
266
|
+
readonly radius: 8;
|
|
267
|
+
readonly padX: 2;
|
|
268
|
+
readonly caps: false;
|
|
269
|
+
readonly mono: false;
|
|
270
|
+
readonly weight: 500;
|
|
271
|
+
readonly tracking: 0;
|
|
272
|
+
}, {
|
|
273
|
+
readonly id: "m3-filter";
|
|
274
|
+
readonly label: "Filter";
|
|
275
|
+
readonly note: "Material 3 filter chip: 8px corner, tinted, no outline.";
|
|
276
|
+
readonly fill: 20;
|
|
277
|
+
readonly radius: 8;
|
|
278
|
+
readonly padX: 2;
|
|
279
|
+
readonly caps: false;
|
|
280
|
+
readonly mono: false;
|
|
281
|
+
readonly weight: 500;
|
|
282
|
+
readonly tracking: 0;
|
|
283
|
+
}, {
|
|
284
|
+
readonly id: "m3-input";
|
|
285
|
+
readonly label: "Input";
|
|
286
|
+
readonly note: "Material 3 input chip: outlined over a faint wash.";
|
|
287
|
+
readonly fill: 8;
|
|
288
|
+
readonly border: 34;
|
|
289
|
+
readonly radius: 8;
|
|
290
|
+
readonly padX: 2;
|
|
291
|
+
readonly caps: false;
|
|
292
|
+
readonly mono: false;
|
|
293
|
+
readonly weight: 500;
|
|
294
|
+
readonly tracking: 0;
|
|
295
|
+
}, {
|
|
296
|
+
readonly id: "m3-elevated";
|
|
297
|
+
readonly label: "Elevated";
|
|
298
|
+
readonly note: "Material 3 elevated chip: a card shadow, no outline.";
|
|
299
|
+
readonly fill: "surface";
|
|
300
|
+
readonly radius: 8;
|
|
301
|
+
readonly depth: "lift";
|
|
302
|
+
readonly padX: 2;
|
|
303
|
+
readonly caps: false;
|
|
304
|
+
readonly mono: false;
|
|
305
|
+
readonly weight: 500;
|
|
306
|
+
readonly tracking: 0;
|
|
307
|
+
}, {
|
|
308
|
+
readonly id: "ant-tag";
|
|
309
|
+
readonly label: "Tag, light";
|
|
310
|
+
readonly note: "Ant Design’s tag: 2px corner, pale fill, tone border.";
|
|
311
|
+
readonly fill: 10;
|
|
312
|
+
readonly border: 38;
|
|
313
|
+
readonly radius: 2;
|
|
314
|
+
readonly caps: false;
|
|
315
|
+
readonly mono: false;
|
|
316
|
+
readonly weight: 400;
|
|
317
|
+
readonly tracking: 0;
|
|
318
|
+
}, {
|
|
319
|
+
readonly id: "github-label";
|
|
320
|
+
readonly label: "Issue label";
|
|
321
|
+
readonly note: "A GitHub label: round, tinted, tone border.";
|
|
322
|
+
readonly fill: 18;
|
|
323
|
+
readonly border: 30;
|
|
324
|
+
readonly radius: "pill";
|
|
325
|
+
readonly padX: 2;
|
|
326
|
+
readonly caps: false;
|
|
327
|
+
readonly mono: false;
|
|
328
|
+
readonly weight: 500;
|
|
329
|
+
readonly tracking: 0;
|
|
330
|
+
}, {
|
|
331
|
+
readonly id: "stripe-badge";
|
|
332
|
+
readonly label: "Dashboard badge";
|
|
333
|
+
readonly note: "Stripe’s badge: 4px corner, pale, quiet weight.";
|
|
334
|
+
readonly fill: 13;
|
|
335
|
+
readonly radius: 4;
|
|
336
|
+
readonly caps: false;
|
|
337
|
+
readonly mono: false;
|
|
338
|
+
readonly weight: 500;
|
|
339
|
+
readonly tracking: 0;
|
|
340
|
+
}, {
|
|
341
|
+
readonly id: "linear-badge";
|
|
342
|
+
readonly label: "Tracker badge";
|
|
343
|
+
readonly note: "Linear’s: surface fill, neutral edge, tone text.";
|
|
344
|
+
readonly fill: "surface";
|
|
345
|
+
readonly border: 18;
|
|
346
|
+
readonly radius: 4;
|
|
347
|
+
readonly caps: false;
|
|
348
|
+
readonly mono: false;
|
|
349
|
+
readonly weight: 500;
|
|
350
|
+
readonly tracking: 0;
|
|
351
|
+
}, {
|
|
352
|
+
readonly id: "shadcn-outline";
|
|
353
|
+
readonly label: "Outline, round";
|
|
354
|
+
readonly note: "shadcn’s outline badge.";
|
|
355
|
+
readonly border: 42;
|
|
356
|
+
readonly radius: "pill";
|
|
357
|
+
readonly padX: 2;
|
|
358
|
+
readonly caps: false;
|
|
359
|
+
readonly mono: false;
|
|
360
|
+
readonly weight: 500;
|
|
361
|
+
readonly tracking: 0;
|
|
362
|
+
}, {
|
|
363
|
+
readonly id: "shadcn-solid";
|
|
364
|
+
readonly label: "Default, round";
|
|
365
|
+
readonly note: "shadcn’s default badge, ink on tone.";
|
|
366
|
+
readonly solid: 100;
|
|
367
|
+
readonly ink: "dark";
|
|
368
|
+
readonly radius: "pill";
|
|
369
|
+
readonly padX: 2;
|
|
370
|
+
readonly caps: false;
|
|
371
|
+
readonly mono: false;
|
|
372
|
+
readonly weight: 500;
|
|
373
|
+
readonly tracking: 0;
|
|
374
|
+
}, {
|
|
375
|
+
readonly id: "bootstrap";
|
|
376
|
+
readonly label: "Badge, square-ish";
|
|
377
|
+
readonly note: "Bootstrap’s badge: 4px corner, solid.";
|
|
378
|
+
readonly solid: 92;
|
|
379
|
+
readonly ink: "dark";
|
|
380
|
+
readonly radius: 4;
|
|
381
|
+
readonly caps: false;
|
|
382
|
+
readonly mono: false;
|
|
383
|
+
readonly weight: 600;
|
|
384
|
+
readonly tracking: 0;
|
|
385
|
+
}, {
|
|
386
|
+
readonly id: "bootstrap-pill";
|
|
387
|
+
readonly label: "Badge, pill";
|
|
388
|
+
readonly note: "Bootstrap’s rounded-pill badge.";
|
|
389
|
+
readonly solid: 92;
|
|
390
|
+
readonly ink: "dark";
|
|
391
|
+
readonly radius: "pill";
|
|
392
|
+
readonly padX: 2;
|
|
393
|
+
readonly caps: false;
|
|
394
|
+
readonly mono: false;
|
|
395
|
+
readonly weight: 600;
|
|
396
|
+
readonly tracking: 0;
|
|
397
|
+
}, {
|
|
398
|
+
readonly id: "lozenge";
|
|
399
|
+
readonly label: "Lozenge";
|
|
400
|
+
readonly note: "Atlassian’s: tiny, bold, uppercase, 3px corner.";
|
|
401
|
+
readonly fill: 26;
|
|
402
|
+
readonly radius: 3;
|
|
403
|
+
readonly weight: 700;
|
|
404
|
+
readonly tracking: 0.06;
|
|
405
|
+
}, {
|
|
406
|
+
readonly id: "tailwind-badge";
|
|
407
|
+
readonly label: "Ring badge";
|
|
408
|
+
readonly note: "A Tailwind badge: pale fill, inset ring, 6px corner.";
|
|
409
|
+
readonly fill: 11;
|
|
410
|
+
readonly ring: 22;
|
|
411
|
+
readonly radius: 6;
|
|
412
|
+
readonly caps: false;
|
|
413
|
+
readonly mono: false;
|
|
414
|
+
readonly weight: 500;
|
|
415
|
+
readonly tracking: 0;
|
|
416
|
+
}, {
|
|
417
|
+
readonly id: "chakra-subtle";
|
|
418
|
+
readonly label: "Subtle";
|
|
419
|
+
readonly note: "Chakra’s subtle tag: 6px corner, tinted, sentence case.";
|
|
420
|
+
readonly fill: 18;
|
|
421
|
+
readonly radius: 6;
|
|
422
|
+
readonly caps: false;
|
|
423
|
+
readonly mono: false;
|
|
424
|
+
readonly weight: 500;
|
|
425
|
+
readonly tracking: 0;
|
|
426
|
+
}, {
|
|
427
|
+
readonly id: "notion-pill";
|
|
428
|
+
readonly label: "Property pill";
|
|
429
|
+
readonly note: "A Notion property: round, flat tint, no edge.";
|
|
430
|
+
readonly fill: 24;
|
|
431
|
+
readonly radius: "pill";
|
|
432
|
+
readonly padX: 2;
|
|
433
|
+
readonly caps: false;
|
|
434
|
+
readonly mono: false;
|
|
435
|
+
readonly weight: 400;
|
|
436
|
+
readonly tracking: 0;
|
|
437
|
+
}, {
|
|
438
|
+
readonly id: "dot";
|
|
439
|
+
readonly label: "Dot and text";
|
|
440
|
+
readonly note: "A state mark, then the word. No box.";
|
|
441
|
+
readonly bare: true;
|
|
442
|
+
readonly dot: true;
|
|
443
|
+
readonly weight: 600;
|
|
444
|
+
readonly tracking: 0.05;
|
|
445
|
+
}, {
|
|
446
|
+
readonly id: "dot-pill";
|
|
447
|
+
readonly label: "Dot in a pill";
|
|
448
|
+
readonly note: "The mark inside a neutral round box.";
|
|
449
|
+
readonly fill: "neutral";
|
|
450
|
+
readonly radius: "pill";
|
|
451
|
+
readonly padX: 3;
|
|
452
|
+
readonly dot: true;
|
|
453
|
+
readonly caps: false;
|
|
454
|
+
readonly mono: false;
|
|
455
|
+
readonly weight: 500;
|
|
456
|
+
readonly tracking: 0;
|
|
457
|
+
}, {
|
|
458
|
+
readonly id: "dot-outline";
|
|
459
|
+
readonly label: "Dot, outlined";
|
|
460
|
+
readonly note: "The mark inside a hollow round box.";
|
|
461
|
+
readonly border: 34;
|
|
462
|
+
readonly radius: "pill";
|
|
463
|
+
readonly padX: 3;
|
|
464
|
+
readonly dot: true;
|
|
465
|
+
readonly caps: false;
|
|
466
|
+
readonly mono: false;
|
|
467
|
+
readonly weight: 500;
|
|
468
|
+
readonly tracking: 0;
|
|
469
|
+
}, {
|
|
470
|
+
readonly id: "rail";
|
|
471
|
+
readonly label: "Left rail";
|
|
472
|
+
readonly note: "Square, with the tone as an edge down the left.";
|
|
473
|
+
readonly fill: 13;
|
|
474
|
+
readonly rail: true;
|
|
475
|
+
}, {
|
|
476
|
+
readonly id: "underline";
|
|
477
|
+
readonly label: "Underline";
|
|
478
|
+
readonly note: "A rule under the word instead of a box.";
|
|
479
|
+
readonly bare: true;
|
|
480
|
+
readonly underline: true;
|
|
481
|
+
}, {
|
|
482
|
+
readonly id: "bracketed";
|
|
483
|
+
readonly label: "Bracketed";
|
|
484
|
+
readonly note: "No box; the brackets are the box.";
|
|
485
|
+
readonly bare: true;
|
|
486
|
+
readonly brackets: true;
|
|
487
|
+
}, {
|
|
488
|
+
readonly id: "text";
|
|
489
|
+
readonly label: "Text only";
|
|
490
|
+
readonly note: "The colour, and nothing else.";
|
|
491
|
+
readonly bare: true;
|
|
492
|
+
}];
|
|
493
|
+
export type BadgeChipVariant = (typeof BADGE_CHIP_SKINS)[number]['id'];
|
|
494
|
+
/** Looked up by id, for the component and for anything that lists them. */
|
|
495
|
+
export declare const CHIP_SKIN_BY_ID: Record<string, ChipSkin>;
|
|
496
|
+
export declare const DEFAULT_CHIP_VARIANT: BadgeChipVariant;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { DuiSize } from '../../core/DuiTypes';
|
|
3
|
+
/**
|
|
4
|
+
* One offered search.
|
|
5
|
+
*
|
|
6
|
+
* `meta` is the right-hand detail — what the entry meant beyond its text: how
|
|
7
|
+
* many things it was run against, when, how many it found. A bare string is
|
|
8
|
+
* accepted too, and means an entry with nothing to add.
|
|
9
|
+
*/
|
|
10
|
+
export interface SearchSuggestion {
|
|
11
|
+
value: string;
|
|
12
|
+
meta?: string;
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
}
|
|
3
15
|
export interface SearchFieldViewProps {
|
|
4
16
|
/**
|
|
5
17
|
* A stable hook for tests and automation.
|
|
@@ -29,5 +41,32 @@ export interface SearchFieldViewProps {
|
|
|
29
41
|
/** Sits between the text and the clear button — a count, a spinner. */
|
|
30
42
|
trailing?: ReactNode;
|
|
31
43
|
autoFocus?: boolean;
|
|
44
|
+
/** Offered under the box on focus. Strings are entries with no detail. */
|
|
45
|
+
suggestions?: (string | SearchSuggestion)[];
|
|
46
|
+
/** The heading over them. What they ARE, in a word or two. */
|
|
47
|
+
suggestionsLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Picking one.
|
|
50
|
+
*
|
|
51
|
+
* Defaults to putting it in the box and running it, which is what a history
|
|
52
|
+
* entry is for. Callers that restore more than the text — the things the
|
|
53
|
+
* search was run against — do it here.
|
|
54
|
+
*/
|
|
55
|
+
onPick?: (value: string) => void;
|
|
56
|
+
/** Given, each row gets an X that drops that entry. */
|
|
57
|
+
onForget?: (value: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Given, the heading gets a control that drops the lot.
|
|
60
|
+
*
|
|
61
|
+
* Worth having once the list is long enough to be a list: forgetting twelve
|
|
62
|
+
* entries one X at a time is twelve gestures to reach an empty box, and the
|
|
63
|
+
* reason to do it — a screen someone else is about to look at — is usually
|
|
64
|
+
* the reason there is no time for twelve.
|
|
65
|
+
*/
|
|
66
|
+
onClearAll?: () => void;
|
|
67
|
+
/** Most to offer at once. Beyond this the list stops being a shortcut. */
|
|
68
|
+
maxSuggestions?: number;
|
|
69
|
+
/** Above modals by default, which is where this is usually used. */
|
|
70
|
+
suggestionZIndex?: number;
|
|
32
71
|
}
|
|
33
|
-
export declare function SearchFieldView({ testId, value, onChange, onSearch, onClear, placeholder, size, width, accentColor, trailing, autoFocus, }: SearchFieldViewProps): import("react").JSX.Element;
|
|
72
|
+
export declare function SearchFieldView({ testId, value, onChange, onSearch, onClear, placeholder, size, width, accentColor, trailing, autoFocus, suggestions, suggestionsLabel, onPick, onForget, onClearAll, maxSuggestions, suggestionZIndex, }: SearchFieldViewProps): import("react").JSX.Element;
|
|
@@ -13,6 +13,22 @@
|
|
|
13
13
|
* reduced to its text, because silently emitting HTML into a Markdown document
|
|
14
14
|
* makes the next round trip worse, not better.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Characters that would otherwise turn plain text into markup.
|
|
18
|
+
*
|
|
19
|
+
* Escaped only where they would ACTUALLY be markup, which is narrower than
|
|
20
|
+
* "at the start of a line" and the difference matters.
|
|
21
|
+
*
|
|
22
|
+
* CommonMark needs a space after the marker: `# Title` is a heading, `#14` is
|
|
23
|
+
* the text `#14`. Escaping the second produced `\#14`, which renders as `#14`
|
|
24
|
+
* and so looked right — while GitHub quietly stopped linking it to issue 14. A
|
|
25
|
+
* reference typed into a comment box arrived dead on github.com and dead in
|
|
26
|
+
* dkgh, for a heading nobody was writing.
|
|
27
|
+
*
|
|
28
|
+
* Same rule for the list markers: `- item` is a bullet, `-5` is a number.
|
|
29
|
+
* `>` is the exception — a blockquote needs no space, so it always escapes.
|
|
30
|
+
*/
|
|
31
|
+
export declare function escapeText(text: string): string;
|
|
16
32
|
/**
|
|
17
33
|
* Turn a contenteditable's HTML into Markdown.
|
|
18
34
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|