@graphty/compact-mantine 0.8.18 → 0.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.
- package/LICENSE +1 -1
- package/README.md +521 -191
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/index.cjs +4044 -1
- package/dist/index.d.cts +2317 -953
- package/dist/index.d.ts +2317 -953
- package/dist/index.js +11938 -4704
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { ActionIconProps } from '@mantine/core';
|
|
2
|
+
import { BoxProps } from '@mantine/core';
|
|
2
3
|
import { ComboboxData } from '@mantine/core';
|
|
4
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
5
|
import { default as default_2 } from 'react';
|
|
4
6
|
import { ElementProps } from '@mantine/core';
|
|
5
7
|
import { ForwardRefExoticComponent } from 'react';
|
|
6
8
|
import { JSX } from 'react';
|
|
9
|
+
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
7
10
|
import { MantineColorShade } from '@mantine/core';
|
|
8
11
|
import { MantineColorsTuple } from '@mantine/core';
|
|
9
12
|
import { MantineRadius } from '@mantine/core';
|
|
10
13
|
import { MantineTheme } from '@mantine/core';
|
|
14
|
+
import { MantineThemeOverride } from '@mantine/core';
|
|
15
|
+
import { MenuItemProps } from '@mantine/core';
|
|
16
|
+
import { MenuProps } from '@mantine/core';
|
|
17
|
+
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
18
|
+
import { MouseEventHandler } from 'react';
|
|
19
|
+
import { NotificationProps } from '@mantine/core';
|
|
20
|
+
import { ReactElement } from 'react';
|
|
11
21
|
import { ReactNode } from 'react';
|
|
12
22
|
import { ReactPortal } from 'react';
|
|
13
23
|
import { RefAttributes } from 'react';
|
|
14
24
|
import { RefObject } from 'react';
|
|
25
|
+
import { SegmentedControl as SegmentedControl_2 } from '@mantine/core';
|
|
15
26
|
import { SyntheticEvent } from 'react';
|
|
27
|
+
import { TextInputProps } from '@mantine/core';
|
|
28
|
+
import { TooltipProps } from '@mantine/core';
|
|
29
|
+
import { UnstyledButtonProps } from '@mantine/core';
|
|
16
30
|
import { VariantColorsResolver } from '@mantine/core';
|
|
17
31
|
|
|
18
32
|
/**
|
|
@@ -20,16 +34,15 @@ import { VariantColorsResolver } from '@mantine/core';
|
|
|
20
34
|
* doing something about it: a reading at the leading edge, a cluster of
|
|
21
35
|
* controls at the trailing edge.
|
|
22
36
|
*
|
|
23
|
-
* **
|
|
24
|
-
* Recompute, Copy, a button that opens the advanced settings
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
37
|
+
* **Actions and resident actions.** `actions` are controls that *act* -- Run,
|
|
38
|
+
* Recompute, Copy, a button that opens the advanced settings. The resident
|
|
39
|
+
* ones *report a state* and are never hidden. On a property row Figma draws both
|
|
40
|
+
* always, which is the default here. `reveal="hover"` gives the layer-row
|
|
41
|
+
* behavior instead: the acting controls fade in (100ms) when the row is
|
|
42
|
+
* reached, while a state -- a crossed-out eye on a hidden layer -- stays
|
|
43
|
+
* visible with no hover at all.
|
|
30
44
|
*
|
|
31
|
-
*
|
|
32
|
-
* why this is a component instead of a CSS rule:
|
|
45
|
+
* When the actions are revealed on hover, three things keep that usable:
|
|
33
46
|
*
|
|
34
47
|
* - **A touch screen has no hover**, so where the pointer cannot hover every
|
|
35
48
|
* hidden control is drawn.
|
|
@@ -42,11 +55,12 @@ import { VariantColorsResolver } from '@mantine/core';
|
|
|
42
55
|
* destructive, anything ending in "anyway". Everything else is a 24px glyph
|
|
43
56
|
* carrying its word as its tooltip and its accessible name.
|
|
44
57
|
* @param props - Component props
|
|
45
|
-
* @param props.state - What the row reports, drawn at the leading edge in the secondary text
|
|
58
|
+
* @param props.state - What the row reports, drawn at the leading edge in the secondary text color
|
|
46
59
|
* @param props.stateTitle - The complete reading, for when `state` is markup or an abbreviation of what the row means
|
|
47
60
|
* @param props.busy - Whether the reading is still being worked out by something that finishes later
|
|
48
61
|
* @param props.live - How urgently a screen reader announces the reading when it changes on its own
|
|
49
|
-
* @param props.actions - Controls that act
|
|
62
|
+
* @param props.actions - Controls that act: always drawn by default, or revealed on hover and focus with `reveal="hover"`
|
|
63
|
+
* @param props.reveal - When the actions are drawn: "always" (the default) or "hover"
|
|
50
64
|
* @param props.residentActions - Controls that report a state, which are never hidden
|
|
51
65
|
* @param props.actionsVisible - Forces the hidden controls shown or hidden instead of letting hover and focus decide
|
|
52
66
|
* @param props.disabled - Whether the row cannot act, which draws its reading at the disabled ink and announces it as unavailable
|
|
@@ -74,7 +88,7 @@ export declare interface ActionRowProps {
|
|
|
74
88
|
/**
|
|
75
89
|
* What the row reports: a count, a status, a record of the last run.
|
|
76
90
|
*
|
|
77
|
-
* Always drawn, at the leading edge, in the secondary text
|
|
91
|
+
* Always drawn, at the leading edge, in the secondary text color, and
|
|
78
92
|
* truncated with an ellipsis rather than wrapped -- the row is 32px and
|
|
79
93
|
* stays 32px. Only the drawing is truncated: the text itself is complete in
|
|
80
94
|
* the document, so a screen reader reads all of it however little of it
|
|
@@ -126,12 +140,21 @@ export declare interface ActionRowProps {
|
|
|
126
140
|
* Controls that act: Run, Recompute, Copy, a button that opens the advanced
|
|
127
141
|
* settings.
|
|
128
142
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
143
|
+
* Always drawn by default, as Figma draws the actions of a property row.
|
|
144
|
+
* With `reveal="hover"` they are hidden until the row is hovered or
|
|
145
|
+
* something inside it is focused, and always drawn where the pointer cannot
|
|
146
|
+
* hover. Hidden means faded out over 100ms, not unmounted: they keep their
|
|
147
|
+
* accessible names and their place in the tab order, and any one of them
|
|
148
|
+
* reveals the whole cluster by taking focus.
|
|
133
149
|
*/
|
|
134
150
|
actions?: default_2.ReactNode;
|
|
151
|
+
/**
|
|
152
|
+
* When `actions` are drawn: `"always"` (Figma's property rows) or `"hover"`
|
|
153
|
+
* (Figma's layer rows: shown while the row is hovered or focused).
|
|
154
|
+
* `actionsVisible` overrides either.
|
|
155
|
+
* @default "always"
|
|
156
|
+
*/
|
|
157
|
+
reveal?: "always" | "hover";
|
|
135
158
|
/**
|
|
136
159
|
* Controls that report a state as well as changing it: the crossed-out eye
|
|
137
160
|
* on a hidden item, the pin on a pinned reading.
|
|
@@ -148,7 +171,7 @@ export declare interface ActionRowProps {
|
|
|
148
171
|
* rows below are "dimmed and disabled instead of tagged individually". The reading
|
|
149
172
|
* then takes the disabled ink -- a different token from the ordinary muted one --
|
|
150
173
|
* and the row is announced as unavailable, so nothing about the state depends on
|
|
151
|
-
* telling two
|
|
174
|
+
* telling two grays apart.
|
|
152
175
|
* @default false
|
|
153
176
|
*/
|
|
154
177
|
disabled?: boolean;
|
|
@@ -156,7 +179,7 @@ export declare interface ActionRowProps {
|
|
|
156
179
|
* Forces `actions` to be drawn, or forces them hidden, instead of letting
|
|
157
180
|
* the row decide from hover and focus.
|
|
158
181
|
*
|
|
159
|
-
* Leave it out for the usual
|
|
182
|
+
* Leave it out for the usual behavior. Set it to `true` while a menu or a
|
|
160
183
|
* pop-out opened from this row is still open, so that the control which
|
|
161
184
|
* opened it does not vanish the moment the pointer moves onto the thing it
|
|
162
185
|
* opened.
|
|
@@ -224,7 +247,7 @@ export declare type ActivationHandler = (event: ActivationEvent) => void;
|
|
|
224
247
|
* Called when a control is activated, with the activation source stated
|
|
225
248
|
* separately.
|
|
226
249
|
*
|
|
227
|
-
* Use this in place of {@link ActivationHandler} only where the
|
|
250
|
+
* Use this in place of {@link ActivationHandler} only where the behavior
|
|
228
251
|
* genuinely differs between a pointer and a key -- selectable list rows, where a
|
|
229
252
|
* click extends a selection and Enter does not. Everywhere else the plain event
|
|
230
253
|
* is enough, and a second parameter is noise.
|
|
@@ -298,7 +321,7 @@ export declare interface AdvancedButtonProps extends Omit<default_2.ButtonHTMLAt
|
|
|
298
321
|
* Names the settings the button opens, such as `"Image export options"`.
|
|
299
322
|
*
|
|
300
323
|
* It becomes both the button's tooltip and the name a screen reader
|
|
301
|
-
* announces, so write it as a phrase a person would
|
|
324
|
+
* announces, so write it as a phrase a person would recognize rather than
|
|
302
325
|
* as the word "settings". When `changed` is true the name also states that,
|
|
303
326
|
* so there is no need to spell the change into this string yourself.
|
|
304
327
|
*/
|
|
@@ -311,15 +334,15 @@ export declare interface AdvancedButtonProps extends Omit<default_2.ButtonHTMLAt
|
|
|
311
334
|
* state the panel behind the button edits; a button that forgets it tells
|
|
312
335
|
* the reader that a changed setting is unchanged.
|
|
313
336
|
*
|
|
314
|
-
* A changed button draws in the
|
|
315
|
-
*
|
|
316
|
-
* survives for a reader who cannot see the difference in
|
|
337
|
+
* A changed button draws its glyph in the brand ink instead of the
|
|
338
|
+
* ordinary icon ink, and says so in its accessible name as well, so the
|
|
339
|
+
* signal survives for a reader who cannot see the difference in color.
|
|
317
340
|
* @default false
|
|
318
341
|
*/
|
|
319
342
|
changed?: boolean;
|
|
320
343
|
/**
|
|
321
344
|
* The glyph drawn on the button.
|
|
322
|
-
* @default
|
|
345
|
+
* @default the settings glyph
|
|
323
346
|
*/
|
|
324
347
|
icon?: default_2.ReactNode;
|
|
325
348
|
/**
|
|
@@ -334,7 +357,7 @@ export declare interface AdvancedButtonProps extends Omit<default_2.ButtonHTMLAt
|
|
|
334
357
|
/**
|
|
335
358
|
* Whether the button cannot be used.
|
|
336
359
|
*
|
|
337
|
-
* A disabled button is drawn in the same dimmed
|
|
360
|
+
* A disabled button is drawn in the same dimmed color as any other
|
|
338
361
|
* disabled control, refuses activation, and is skipped by the Tab key.
|
|
339
362
|
* @default false
|
|
340
363
|
*/
|
|
@@ -350,6 +373,58 @@ export declare interface AdvancedButtonProps extends Omit<default_2.ButtonHTMLAt
|
|
|
350
373
|
loading?: boolean;
|
|
351
374
|
}
|
|
352
375
|
|
|
376
|
+
/** Every value, in reading order. */
|
|
377
|
+
export declare const ALIGNMENT_MATRIX_VALUES: readonly AlignmentMatrixValue[];
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* The 3 x 3 alignment picker of an auto layout frame: nine radios drawn as dots, with the chosen
|
|
381
|
+
* one drawn as the three bars of the alignment it sets.
|
|
382
|
+
* @param props - Component props
|
|
383
|
+
* @param props.value - The chosen cell, to drive the matrix from your own state
|
|
384
|
+
* @param props.defaultValue - The cell chosen before anything is picked
|
|
385
|
+
* @param props.onChange - Called with the newly chosen cell and the event
|
|
386
|
+
* @param props.direction - Which way the children run, and so how the bars are drawn
|
|
387
|
+
* @param props.label - The group's accessible name
|
|
388
|
+
* @param props.cellLabels - The name and tooltip of each cell
|
|
389
|
+
* @param props.disabled - Whether the matrix cannot be used
|
|
390
|
+
* @param props.name - The shared name of the radio inputs
|
|
391
|
+
* @returns the matrix
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* <AlignmentMatrix value={align} onChange={setAlign} direction="horizontal" />
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
export declare function AlignmentMatrix({ value, defaultValue, onChange, direction, label, cellLabels, disabled, name, }: AlignmentMatrixProps): default_2.JSX.Element;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Props for the AlignmentMatrix.
|
|
401
|
+
*/
|
|
402
|
+
export declare interface AlignmentMatrixProps {
|
|
403
|
+
/** The chosen cell. Supply it to drive the matrix from your own state. */
|
|
404
|
+
value?: AlignmentMatrixValue;
|
|
405
|
+
/** The cell chosen before anything is picked, when the matrix keeps its own state. @default "top-left" */
|
|
406
|
+
defaultValue?: AlignmentMatrixValue;
|
|
407
|
+
/** Called with the newly chosen cell and the event that chose it. */
|
|
408
|
+
onChange?: ChangeHandler<AlignmentMatrixValue>;
|
|
409
|
+
/**
|
|
410
|
+
* Which way the children run, which is how the bars are drawn: `"vertical"` stacks three
|
|
411
|
+
* horizontal bars, `"horizontal"` stands three vertical bars side by side.
|
|
412
|
+
* @default "vertical"
|
|
413
|
+
*/
|
|
414
|
+
direction?: "horizontal" | "vertical";
|
|
415
|
+
/** The group's accessible name. @default "Alignment" */
|
|
416
|
+
label?: string;
|
|
417
|
+
/** The name (and tooltip) of each cell, when the English defaults will not do. */
|
|
418
|
+
cellLabels?: Partial<Record<AlignmentMatrixValue, string>>;
|
|
419
|
+
/** Whether the matrix cannot be used. @default false */
|
|
420
|
+
disabled?: boolean;
|
|
421
|
+
/** The shared name of the radio inputs. One is generated when left out. */
|
|
422
|
+
name?: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** One cell of the matrix: `"top-left"` .. `"bottom-right"`. */
|
|
426
|
+
export declare type AlignmentMatrixValue = `${(typeof ROWS)[number]}-${(typeof COLUMNS)[number]}`;
|
|
427
|
+
|
|
353
428
|
/**
|
|
354
429
|
* Called when a component's value changes.
|
|
355
430
|
*
|
|
@@ -367,8 +442,104 @@ export declare interface AdvancedButtonProps extends Omit<default_2.ButtonHTMLAt
|
|
|
367
442
|
*/
|
|
368
443
|
export declare type ChangeHandler<T> = (value: T, event?: default_2.SyntheticEvent) => void;
|
|
369
444
|
|
|
445
|
+
/** The value formats the format select offers. */
|
|
446
|
+
export declare type ColorPickerFormat = "hex" | "rgb" | "hsl" | "hsb";
|
|
447
|
+
|
|
448
|
+
/** The paint types the paint-type bar can offer. */
|
|
449
|
+
export declare type ColorPickerPaintType = "solid" | "gradient";
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Figma's color picker body (design/figma-spec.md 7.3), for a 240-wide light popover: an
|
|
453
|
+
* optional paint-type bar, a 208 x 208 saturation / brightness field with a keyboard-operable
|
|
454
|
+
* reticle, the eyedropper (where the browser has one) beside the hue and opacity sliders, a
|
|
455
|
+
* format select and a joined value / opacity field, and the swatch set under a divider.
|
|
456
|
+
*
|
|
457
|
+
* It holds the color in HSV so that dragging through gray keeps its hue. Put it inside a
|
|
458
|
+
* `Popout.Panel` (CompactColorInput does), which supplies the header, the close button, Escape
|
|
459
|
+
* and one-popover-at-a-time.
|
|
460
|
+
* @param props - Component props
|
|
461
|
+
* @param props.value - the value
|
|
462
|
+
* @param props.onChange - called on every change
|
|
463
|
+
* @param props.onChangeEnd - called when a drag or step settles
|
|
464
|
+
* @param props.withAlpha - offer opacity
|
|
465
|
+
* @param props.swatches - the swatch set
|
|
466
|
+
* @param props.defaultFormat - the value row's first format
|
|
467
|
+
* @param props.gradient - gradient content for the paint-type bar
|
|
468
|
+
* @param props.paintType - the selected paint type
|
|
469
|
+
* @param props.onPaintTypeChange - called when the reader picks a paint type
|
|
470
|
+
* @param props.labels - English string overrides
|
|
471
|
+
* @returns the picker body
|
|
472
|
+
* @example
|
|
473
|
+
* ```tsx
|
|
474
|
+
* <Popout.Panel width={240} header={{ variant: "title", title: "Fill" }}>
|
|
475
|
+
* <ColorPickerPanel value={fill} onChange={setFill} swatches={SWATCH_COLORS_HEXA} />
|
|
476
|
+
* </Popout.Panel>
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
export declare function ColorPickerPanel({ value, onChange, onChangeEnd, withAlpha, swatches, defaultFormat, gradient, paintType, onPaintTypeChange, labels: labelOverrides, }: ColorPickerPanelProps): default_2.JSX.Element;
|
|
480
|
+
|
|
481
|
+
/** Every string ColorPickerPanel draws or announces, in English by default. */
|
|
482
|
+
export declare interface ColorPickerPanelLabels {
|
|
483
|
+
/** Name of the saturation and brightness field. */
|
|
484
|
+
saturation: string;
|
|
485
|
+
/** Name of the hue slider. */
|
|
486
|
+
hue: string;
|
|
487
|
+
/** Name of the opacity slider and the opacity box. */
|
|
488
|
+
opacity: string;
|
|
489
|
+
/** Name of the eyedropper button. */
|
|
490
|
+
eyedropper: string;
|
|
491
|
+
/** Name of the format select. */
|
|
492
|
+
format: string;
|
|
493
|
+
/** Name of the color value box (hex, or three numbers). */
|
|
494
|
+
value: string;
|
|
495
|
+
/** Name of the paint-type group. */
|
|
496
|
+
paintType: string;
|
|
497
|
+
/** The solid paint type. */
|
|
498
|
+
solid: string;
|
|
499
|
+
/** The gradient paint type. */
|
|
500
|
+
gradient: string;
|
|
501
|
+
/** Name of the swatch list. */
|
|
502
|
+
swatches: string;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** Props for ColorPickerPanel. */
|
|
506
|
+
export declare interface ColorPickerPanelProps {
|
|
507
|
+
/** The color, `#RRGGBB` or `#RRGGBBAA`. */
|
|
508
|
+
value: string;
|
|
509
|
+
/**
|
|
510
|
+
* Called on every change: live while dragging, once per typed commit, arrow key or swatch.
|
|
511
|
+
* Reports `#RRGGBBAA` (upper case) when `withAlpha`, `#RRGGBB` otherwise.
|
|
512
|
+
*/
|
|
513
|
+
onChange: (value: string) => void;
|
|
514
|
+
/** Called once when a drag in the field or a slider settles, with the settled color. */
|
|
515
|
+
onChangeEnd?: (value: string) => void;
|
|
516
|
+
/**
|
|
517
|
+
* Offer opacity: the opacity slider and box.
|
|
518
|
+
* @default true
|
|
519
|
+
*/
|
|
520
|
+
withAlpha?: boolean;
|
|
521
|
+
/** The swatch set under the divider, as hex or hexa strings. Each is named by its string. */
|
|
522
|
+
swatches?: readonly string[];
|
|
523
|
+
/**
|
|
524
|
+
* The format the value row starts in.
|
|
525
|
+
* @default "hex"
|
|
526
|
+
*/
|
|
527
|
+
defaultFormat?: ColorPickerFormat;
|
|
528
|
+
/**
|
|
529
|
+
* Gradient content (for instance a GradientEditor). When given, a paint-type bar offers
|
|
530
|
+
* Solid and Gradient, and this is shown instead of the solid controls while Gradient is on.
|
|
531
|
+
*/
|
|
532
|
+
gradient?: ReactNode;
|
|
533
|
+
/** The selected paint type, when you drive the bar. */
|
|
534
|
+
paintType?: ColorPickerPaintType;
|
|
535
|
+
/** Called when the reader picks a paint type. */
|
|
536
|
+
onPaintTypeChange?: (paintType: ColorPickerPaintType) => void;
|
|
537
|
+
/** Replace any of the English strings. */
|
|
538
|
+
labels?: Partial<ColorPickerPanelLabels>;
|
|
539
|
+
}
|
|
540
|
+
|
|
370
541
|
/**
|
|
371
|
-
* One stop of a gradient: a
|
|
542
|
+
* One stop of a gradient: a color, and where along the ramp it sits.
|
|
372
543
|
*
|
|
373
544
|
* Build these with `createColorStop` rather than writing the object by hand, so
|
|
374
545
|
* that the identifier is unique. The identifier is what React keys the stop by
|
|
@@ -380,10 +551,98 @@ export declare interface ColorStop {
|
|
|
380
551
|
id: string;
|
|
381
552
|
/** Where the stop sits along the ramp, from 0 at the start to 1 at the end. */
|
|
382
553
|
offset: number;
|
|
383
|
-
/** The stop's
|
|
554
|
+
/** The stop's color, as a hex string such as `#6366f1`. */
|
|
384
555
|
color: string;
|
|
385
556
|
}
|
|
386
557
|
|
|
558
|
+
declare const COLUMNS: readonly ["left", "center", "right"];
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* A combo field (design/figma-spec.md 6.3): a value you can type, with a chevron that opens a list
|
|
562
|
+
* of presets over the field, the current value sitting exactly on top of the field. Figma uses it
|
|
563
|
+
* for font size, auto-layout width and height ("Hug"), gap and export scale.
|
|
564
|
+
*
|
|
565
|
+
* Keyboard: typing edits the value and commits on Enter, Tab or blur; Control+ArrowDown (or
|
|
566
|
+
* Alt+ArrowDown) opens the list with the current value highlighted; ArrowUp / ArrowDown move,
|
|
567
|
+
* Home / End jump, Enter picks, Escape closes without a change and leaves focus in the field.
|
|
568
|
+
* With the list closed, ArrowUp / ArrowDown step a numeric value.
|
|
569
|
+
* @example
|
|
570
|
+
* ```tsx
|
|
571
|
+
* <ComboInput
|
|
572
|
+
* label="Font size"
|
|
573
|
+
* numeric
|
|
574
|
+
* value={size}
|
|
575
|
+
* onChange={(next) => { setSize(Number(next)); }}
|
|
576
|
+
* options={[10, 11, 12, 13, 14, 16, 24].map((n) => ({ value: String(n) }))}
|
|
577
|
+
* />
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
export declare const ComboInput: default_2.ForwardRefExoticComponent<ComboInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
581
|
+
|
|
582
|
+
/** An entry in a ComboInput's list. */
|
|
583
|
+
export declare type ComboInputItem = ComboInputOption | ComboInputSeparator;
|
|
584
|
+
|
|
585
|
+
/** One choice in a ComboInput's list. */
|
|
586
|
+
export declare interface ComboInputOption {
|
|
587
|
+
/** What is committed when the choice is picked. */
|
|
588
|
+
value: string;
|
|
589
|
+
/** What the list shows; the value when absent. */
|
|
590
|
+
label?: string;
|
|
591
|
+
/** Shown but not selectable. */
|
|
592
|
+
disabled?: boolean;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/** Props for ComboInput. */
|
|
596
|
+
export declare interface ComboInputProps {
|
|
597
|
+
/** The field's accessible name ("Font size"). */
|
|
598
|
+
label: string;
|
|
599
|
+
/** The value, when you drive the field from your own state. */
|
|
600
|
+
value?: string | number;
|
|
601
|
+
/** The value the field starts with when it keeps its own state. */
|
|
602
|
+
defaultValue?: string | number;
|
|
603
|
+
/**
|
|
604
|
+
* Called once per commit: a choice from the list, Enter, Tab or blur after typing, an arrow
|
|
605
|
+
* step or the end of a scrub. A numeric field reports a number, a text field a string.
|
|
606
|
+
*/
|
|
607
|
+
onChange?: ChangeHandler<string | number>;
|
|
608
|
+
/** The list's entries: choices and separators. */
|
|
609
|
+
options: ComboInputItem[];
|
|
610
|
+
/**
|
|
611
|
+
* Whether the value is a number: typing evaluates arithmetic (`12*2`), ArrowUp / ArrowDown
|
|
612
|
+
* step it while the list is closed (Shift: ten steps), and a `glyph` slot scrubs it.
|
|
613
|
+
*/
|
|
614
|
+
numeric?: boolean;
|
|
615
|
+
/** The smallest number a numeric field accepts. */
|
|
616
|
+
min?: number;
|
|
617
|
+
/** The largest number a numeric field accepts. */
|
|
618
|
+
max?: number;
|
|
619
|
+
/** One arrow step of a numeric field. @default 1 */
|
|
620
|
+
step?: number;
|
|
621
|
+
/** A mode word shown right-aligned before the chevron, in the secondary ink ("Hug"). */
|
|
622
|
+
suffix?: string;
|
|
623
|
+
/** A 24px leading slot: a glyph or a letter. On a numeric field it is the scrub handle. */
|
|
624
|
+
glyph?: default_2.ReactNode;
|
|
625
|
+
/** Draws the chevron slot 25 wide with a 1px divider in the panel color (the font-size field). */
|
|
626
|
+
divided?: boolean;
|
|
627
|
+
/** The field's width. @default 88 (PANEL_GRID.FIELD) */
|
|
628
|
+
width?: number | string;
|
|
629
|
+
/** The field cannot be used. */
|
|
630
|
+
disabled?: boolean;
|
|
631
|
+
/** Text shown in an empty field. */
|
|
632
|
+
placeholder?: string;
|
|
633
|
+
/** The chevron button's accessible name. @default "Open list" */
|
|
634
|
+
openLabel?: string;
|
|
635
|
+
/** Extra class on the field's outer element. */
|
|
636
|
+
className?: string;
|
|
637
|
+
/** Extra style on the field's outer element. */
|
|
638
|
+
style?: default_2.CSSProperties;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/** A line between groups of choices. */
|
|
642
|
+
export declare interface ComboInputSeparator {
|
|
643
|
+
separator: true;
|
|
644
|
+
}
|
|
645
|
+
|
|
387
646
|
/**
|
|
388
647
|
* Compact theme sizing constants.
|
|
389
648
|
* These values represent the standard sizing used throughout the compact theme
|
|
@@ -412,66 +671,65 @@ export declare const COMPACT_SIZING: {
|
|
|
412
671
|
};
|
|
413
672
|
|
|
414
673
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
674
|
+
* The accent palette, the theme's `primaryColor` (spec 3.3). Mantine reads shade 6 filled and
|
|
675
|
+
* 7 hover in light (#0d99ff / #007be5), 8 / 9 in dark (#0c8ce9 / #0a6dc2), and shade 4 as the
|
|
676
|
+
* dark-scheme anchor color (#7cc4f8, Figma's dark brand text).
|
|
677
|
+
*/
|
|
678
|
+
export declare const compactBrandColors: MantineColorsTuple;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* A color in one paint field: the chit, the hex value and the opacity.
|
|
421
682
|
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* either can be the reader's while the other is still the default.
|
|
683
|
+
* Pressing the chit opens the color picker in a pop-out (one at a time, docked to the start
|
|
684
|
+
* side of the panel); the hex box takes `RRGGBB` (or `RGB`) and commits on blur or Enter, and
|
|
685
|
+
* reverts on Escape; the opacity box commits on blur or Enter, steps with ArrowUp / ArrowDown
|
|
686
|
+
* (Shift for 10) and scrubs by dragging its "%".
|
|
427
687
|
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
688
|
+
* As in the other controls of this family, `undefined` means "the reader has chosen nothing
|
|
689
|
+
* here": the control shows the default in italics and offers no reset until something of the
|
|
690
|
+
* reader's own is set, and pressing the reset reports `undefined` again. Color and opacity are
|
|
691
|
+
* tracked separately, so either can be the reader's while the other is still the default.
|
|
692
|
+
* Typed opacity is read in the reader's own locale.
|
|
432
693
|
* @param props - Component props
|
|
433
|
-
* @param props.color - The
|
|
434
|
-
* @param props.defaultColor - The
|
|
694
|
+
* @param props.color - The color, when you drive the control from your own state
|
|
695
|
+
* @param props.defaultColor - The color shown while the reader has chosen none of their own
|
|
435
696
|
* @param props.opacity - The opacity as a percentage, when you drive the control from your own state
|
|
436
697
|
* @param props.defaultOpacity - The opacity shown while the reader has set none of their own
|
|
437
|
-
* @param props.onColorChange - Called with the new
|
|
698
|
+
* @param props.onColorChange - Called with the new color, or with `undefined` when the control is reset
|
|
438
699
|
* @param props.onOpacityChange - Called with the new opacity, or with `undefined` when the control is reset
|
|
439
|
-
* @param props.onChange - Called once per gesture with both halves of the
|
|
700
|
+
* @param props.onChange - Called once per gesture with both halves of the color, whichever of them moved
|
|
440
701
|
* @param props.label - The field's name, drawn above the control and used to name the group
|
|
441
|
-
* @param props.showOpacity - Whether to offer
|
|
702
|
+
* @param props.showOpacity - Whether to offer the opacity box
|
|
442
703
|
* @param props.disabled - Whether the control cannot be used at all
|
|
443
704
|
* @param props.disabledReason - One sentence saying why the control is off, drawn only while it is off
|
|
444
705
|
* @param props.onFocus - Called when the hex box or the opacity box takes focus
|
|
445
706
|
* @param props.onBlur - Called when the hex box or the opacity box loses focus
|
|
446
|
-
* @
|
|
707
|
+
* @param props.width - The field's width
|
|
708
|
+
* @param props.showReset - Whether to offer the reset button
|
|
709
|
+
* @returns The paint field, and its reset button when something has been set
|
|
447
710
|
* @example
|
|
448
711
|
* ```tsx
|
|
449
712
|
* const [fill, setFill] = useState<string | undefined>(undefined);
|
|
450
713
|
*
|
|
451
714
|
* <PopoutManager>
|
|
452
|
-
* <CompactColorInput
|
|
453
|
-
* label="Fill"
|
|
454
|
-
* color={fill}
|
|
455
|
-
* defaultColor="#5B8FF9"
|
|
456
|
-
* onColorChange={setFill}
|
|
457
|
-
* />
|
|
715
|
+
* <CompactColorInput label="Fill" color={fill} defaultColor="#5B8FF9" onColorChange={setFill} />
|
|
458
716
|
* </PopoutManager>
|
|
459
717
|
* ```
|
|
460
718
|
*/
|
|
461
|
-
export declare function CompactColorInput({ color, defaultColor, opacity, defaultOpacity, onColorChange, onOpacityChange, onChange, label, showOpacity, disabled, disabledReason, onFocus, onBlur, }: CompactColorInputProps): default_2.JSX.Element;
|
|
719
|
+
export declare function CompactColorInput({ color, defaultColor, opacity, defaultOpacity, onColorChange, onOpacityChange, onChange, label, showOpacity, disabled, disabledReason, onFocus, onBlur, width, showReset, }: CompactColorInputProps): default_2.JSX.Element;
|
|
462
720
|
|
|
463
721
|
/**
|
|
464
722
|
* Props for the CompactColorInput component.
|
|
465
723
|
*/
|
|
466
724
|
export declare interface CompactColorInputProps {
|
|
467
725
|
/**
|
|
468
|
-
* The
|
|
726
|
+
* The color, as `#RRGGBB`, when you drive the control from your own state.
|
|
469
727
|
*
|
|
470
|
-
* `undefined` does not mean "no
|
|
728
|
+
* `undefined` does not mean "no color" here: it means the reader has
|
|
471
729
|
* chosen none and the control is showing `defaultColor`.
|
|
472
730
|
*/
|
|
473
731
|
color?: string | undefined;
|
|
474
|
-
/** The
|
|
732
|
+
/** The color shown, in italics, while the reader has chosen none of their own. */
|
|
475
733
|
defaultColor: string;
|
|
476
734
|
/**
|
|
477
735
|
* The opacity as a percentage from 0 to 100, when you drive the control
|
|
@@ -486,12 +744,14 @@ export declare interface CompactColorInputProps {
|
|
|
486
744
|
*/
|
|
487
745
|
defaultOpacity?: number;
|
|
488
746
|
/**
|
|
489
|
-
* Called when the
|
|
747
|
+
* Called when the color changes, and with `undefined` when the control is
|
|
490
748
|
* reset to its default.
|
|
491
749
|
*
|
|
492
|
-
* The
|
|
750
|
+
* The color comes first, as `#RRGGBB` in upper case; the event that caused
|
|
493
751
|
* the change is second and is absent for a change made from the picker,
|
|
494
752
|
* which reports none.
|
|
753
|
+
*
|
|
754
|
+
* Not called when `onChange` is supplied.
|
|
495
755
|
*/
|
|
496
756
|
onColorChange?: ChangeHandler<string | undefined>;
|
|
497
757
|
/**
|
|
@@ -499,10 +759,12 @@ export declare interface CompactColorInputProps {
|
|
|
499
759
|
* reset to its default.
|
|
500
760
|
*
|
|
501
761
|
* The percentage comes first; the event that caused the change is second.
|
|
762
|
+
*
|
|
763
|
+
* Not called when `onChange` is supplied.
|
|
502
764
|
*/
|
|
503
765
|
onOpacityChange?: ChangeHandler<number | undefined>;
|
|
504
766
|
/**
|
|
505
|
-
* Called once per gesture with BOTH halves of the
|
|
767
|
+
* Called once per gesture with BOTH halves of the color, whichever of them
|
|
506
768
|
* moved.
|
|
507
769
|
*
|
|
508
770
|
* Reach for this one, alone, whenever you drive the control from your own
|
|
@@ -510,25 +772,19 @@ export declare interface CompactColorInputProps {
|
|
|
510
772
|
* already use them, but they cannot carry a gesture that moves both halves
|
|
511
773
|
* at once.
|
|
512
774
|
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* snapshot it has -- and both callbacks run against the SAME pre-gesture
|
|
518
|
-
* snapshot, so the second one writes a state rebuilt from a colour the
|
|
519
|
-
* first one had already replaced. A test in this package
|
|
520
|
-
* (tests/components/CompactColorInput.test.tsx, "the two separate callbacks
|
|
521
|
-
* cannot carry one gesture") drives a picker swatch and watches the second
|
|
522
|
-
* write arrive as `{opacity: 50}` with the new colour gone. The application
|
|
523
|
-
* had already forked this whole component to escape it.
|
|
775
|
+
* Why: a picker gesture can move the color and the opacity at once. With
|
|
776
|
+
* the two separate callbacks, both run against the same props, so a
|
|
777
|
+
* controlled consumer that rebuilds its state from those props in each one
|
|
778
|
+
* loses the color when the opacity write lands second.
|
|
524
779
|
*
|
|
525
780
|
* Both halves are always passed, so a consumer never has to remember which
|
|
526
781
|
* one moved -- the same shape `GradientEditor` already uses for its stops
|
|
527
782
|
* and its direction. `undefined` keeps its meaning from the props: the
|
|
528
783
|
* reader has chosen nothing for that half and the default is showing.
|
|
529
784
|
*
|
|
530
|
-
*
|
|
531
|
-
* gesture write
|
|
785
|
+
* When this is supplied, `onColorChange` and `onOpacityChange` are not
|
|
786
|
+
* called: one gesture makes one write. Passing both routes logs a
|
|
787
|
+
* development warning naming the conflict.
|
|
532
788
|
* @example
|
|
533
789
|
* ```tsx
|
|
534
790
|
* <CompactColorInput
|
|
@@ -545,12 +801,12 @@ export declare interface CompactColorInputProps {
|
|
|
545
801
|
* The field's name, drawn above the control and used to name the group the
|
|
546
802
|
* three controls sit in.
|
|
547
803
|
*
|
|
548
|
-
* Leave it out for a
|
|
804
|
+
* Leave it out for a color that is already named by what surrounds it,
|
|
549
805
|
* such as one stop of a gradient.
|
|
550
806
|
*/
|
|
551
807
|
label?: string;
|
|
552
808
|
/**
|
|
553
|
-
* Whether to offer an opacity box beside the
|
|
809
|
+
* Whether to offer an opacity box beside the color.
|
|
554
810
|
* @default true
|
|
555
811
|
*/
|
|
556
812
|
showOpacity?: boolean;
|
|
@@ -569,15 +825,13 @@ export declare interface CompactColorInputProps {
|
|
|
569
825
|
* is true.
|
|
570
826
|
*
|
|
571
827
|
* It is appended to the control's own name after a full stop and drawn as
|
|
572
|
-
* the tooltip -- "Glow
|
|
828
|
+
* the tooltip -- "Glow color. Glow is not drawn yet" -- and it also joins
|
|
573
829
|
* the accessible description of the swatch, the hex box and the opacity
|
|
574
830
|
* box, so the reason reaches a pointer user and a screen reader user alike.
|
|
575
831
|
* With no `label` to append to, the sentence stands on its own.
|
|
576
832
|
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
* learning why -- spec:6641 asks for the one reason to travel with the
|
|
580
|
-
* disabled ink, and until now this component had nowhere to put it.
|
|
833
|
+
* Write it as a whole sentence naming what would make the control usable
|
|
834
|
+
* again.
|
|
581
835
|
*/
|
|
582
836
|
disabledReason?: string;
|
|
583
837
|
/** Called when the hex box or the opacity box takes focus. Forwarded unchanged. */
|
|
@@ -589,14 +843,27 @@ export declare interface CompactColorInputProps {
|
|
|
589
843
|
* keep for this control inside the handler sees the new value.
|
|
590
844
|
*/
|
|
591
845
|
onBlur?: default_2.FocusEventHandler<HTMLInputElement>;
|
|
846
|
+
/**
|
|
847
|
+
* The field's width. Figma's paint field is 156 beside a row's eye and minus buttons and
|
|
848
|
+
* 184 on its own, which is the default here (the reset button sits in the trailing slot).
|
|
849
|
+
* Pass `"100%"` to fill a flex slot, as the gradient editor's stop rows do.
|
|
850
|
+
* @default 184
|
|
851
|
+
*/
|
|
852
|
+
width?: number | string;
|
|
853
|
+
/**
|
|
854
|
+
* Whether to offer the reset button once something is chosen.
|
|
855
|
+
* @default true
|
|
856
|
+
*/
|
|
857
|
+
showReset?: boolean;
|
|
592
858
|
}
|
|
593
859
|
|
|
594
860
|
/**
|
|
595
|
-
* Color configuration for the compact theme
|
|
596
|
-
*
|
|
861
|
+
* Color configuration for the compact theme: every Mantine color, the neutral `dark` ramp and
|
|
862
|
+
* the `brand` accent.
|
|
597
863
|
*/
|
|
598
864
|
export declare const compactColors: {
|
|
599
865
|
dark: MantineColorsTuple;
|
|
866
|
+
brand: MantineColorsTuple;
|
|
600
867
|
gray: MantineColorsTuple;
|
|
601
868
|
red: MantineColorsTuple;
|
|
602
869
|
pink: MantineColorsTuple;
|
|
@@ -613,16 +880,25 @@ export declare const compactColors: {
|
|
|
613
880
|
};
|
|
614
881
|
|
|
615
882
|
/**
|
|
616
|
-
*
|
|
883
|
+
* Mantine's `dark` ramp, re-pointed at Figma's neutral grays (spec 3.3), so an unthemed Mantine
|
|
884
|
+
* surface in the dark scheme matches the panels around it.
|
|
617
885
|
*
|
|
618
|
-
*
|
|
619
|
-
* -
|
|
620
|
-
* -
|
|
621
|
-
* -
|
|
622
|
-
* - 8
|
|
886
|
+
* - 0: text (#fff)
|
|
887
|
+
* - 5: hover (#444)
|
|
888
|
+
* - 6: default field (#383838)
|
|
889
|
+
* - 7: body / panel (#2c2c2c)
|
|
890
|
+
* - 8: menus and tooltips (#1e1e1e)
|
|
623
891
|
*/
|
|
624
892
|
export declare const compactDarkColors: MantineColorsTuple;
|
|
625
893
|
|
|
894
|
+
/**
|
|
895
|
+
* The whole stylesheet, for SSR or a shadow root. With `highContrast` the AA tokens are also
|
|
896
|
+
* applied unconditionally, so the result needs no `data-cm-contrast` attribute.
|
|
897
|
+
* @param options - the theme options
|
|
898
|
+
* @returns the CSS text
|
|
899
|
+
*/
|
|
900
|
+
export declare function compactGlobalCss(options?: CompactThemeOptions): string;
|
|
901
|
+
|
|
626
902
|
/**
|
|
627
903
|
* Every user-visible or assistive-technology-visible string this library
|
|
628
904
|
* produces.
|
|
@@ -732,13 +1008,13 @@ export declare interface CompactMantineLabels {
|
|
|
732
1008
|
* @returns The button's accessible name
|
|
733
1009
|
*/
|
|
734
1010
|
resetToDefault: (label: string) => string;
|
|
735
|
-
/** Accessible name of the swatch button that opens the
|
|
1011
|
+
/** Accessible name of the swatch button that opens the color picker. */
|
|
736
1012
|
colorSwatch: string;
|
|
737
|
-
/** Accessible name of the text box holding the
|
|
1013
|
+
/** Accessible name of the text box holding the color's hex value. */
|
|
738
1014
|
colorHexValue: string;
|
|
739
|
-
/** Accessible name of the number box holding the
|
|
1015
|
+
/** Accessible name of the number box holding the color's opacity percentage. */
|
|
740
1016
|
opacity: string;
|
|
741
|
-
/** Title of the
|
|
1017
|
+
/** Title of the color picker pop-out when the caller supplied no label. */
|
|
742
1018
|
colorPanelTitle: string;
|
|
743
1019
|
/**
|
|
744
1020
|
* Stands in for a missing control name inside a reset button's accessible
|
|
@@ -821,6 +1097,22 @@ export declare interface CompactMantineLabels {
|
|
|
821
1097
|
closePanel: string;
|
|
822
1098
|
/** Accessible name of a tabbed pop-out panel when its first tab has no label. */
|
|
823
1099
|
settings: string;
|
|
1100
|
+
/** Default accessible name of a `Toolbar` when the caller gives none. */
|
|
1101
|
+
toolbar: string;
|
|
1102
|
+
/** Default accessible name of a `NavRail`, the vertical navigation toolbar. */
|
|
1103
|
+
navigation: string;
|
|
1104
|
+
/** Accessible name and tooltip of the round `HelpButton`. */
|
|
1105
|
+
help: string;
|
|
1106
|
+
/** Accessible name of the `ShortcutSheet` and of its tab list. */
|
|
1107
|
+
keyboardShortcuts: string;
|
|
1108
|
+
/** Accessible name of the close button in the `ShortcutSheet`'s tab strip. */
|
|
1109
|
+
close: string;
|
|
1110
|
+
/** Accessible name of the `QuickActions` dialog. */
|
|
1111
|
+
quickActions: string;
|
|
1112
|
+
/** Placeholder and accessible name of the `QuickActions` search field. */
|
|
1113
|
+
searchActions: string;
|
|
1114
|
+
/** Shown in `QuickActions` when nothing matches the search. */
|
|
1115
|
+
noResults: string;
|
|
824
1116
|
/**
|
|
825
1117
|
* Accessible name of the eye button inside a password field that shows or
|
|
826
1118
|
* hides what was typed. One name in both states: the button reports whether
|
|
@@ -844,25 +1136,9 @@ export declare interface CompactMantineLabels {
|
|
|
844
1136
|
}
|
|
845
1137
|
|
|
846
1138
|
/**
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* This is a complete theme merged with DEFAULT_THEME, suitable for:
|
|
850
|
-
* - Direct use with MantineProvider
|
|
851
|
-
* - Merging with other themes using mergeMantineTheme()
|
|
852
|
-
*
|
|
853
|
-
* All components default to size="sm" automatically with compact styling:
|
|
854
|
-
* - Input height: 24px
|
|
855
|
-
* - Font size: 11px
|
|
856
|
-
* - Borderless at rest, with a visible focus indicator on keyboard focus
|
|
857
|
-
* - Semantic color backgrounds
|
|
858
|
-
*
|
|
859
|
-
* Global token overrides:
|
|
860
|
-
* - fontSizes: Smaller font sizes (xs: 10px, sm: 11px, md: 13px, lg: 14px, xl: 16px)
|
|
861
|
-
* - spacing: Tighter spacing (xs: 4px, sm: 6px, md: 8px, lg: 12px, xl: 16px)
|
|
862
|
-
* - radius: Compact corner radii (xs: 2px, sm: 4px, md: 6px, lg: 8px, xl: 12px)
|
|
1139
|
+
* The full Mantine theme at Figma defaults, merged with DEFAULT_THEME.
|
|
863
1140
|
* @example
|
|
864
1141
|
* ```tsx
|
|
865
|
-
* // Simple usage - direct with MantineProvider
|
|
866
1142
|
* import { MantineProvider } from '@mantine/core';
|
|
867
1143
|
* import { compactTheme } from '@graphty/compact-mantine';
|
|
868
1144
|
*
|
|
@@ -870,33 +1146,25 @@ export declare interface CompactMantineLabels {
|
|
|
870
1146
|
* <App />
|
|
871
1147
|
* </MantineProvider>
|
|
872
1148
|
* ```
|
|
873
|
-
* @example
|
|
874
|
-
* ```tsx
|
|
875
|
-
* // Extending the theme with mergeMantineTheme
|
|
876
|
-
* import { mergeMantineTheme, createTheme } from '@mantine/core';
|
|
877
|
-
* import { compactTheme } from '@graphty/compact-mantine';
|
|
878
|
-
*
|
|
879
|
-
* const myTheme = mergeMantineTheme(compactTheme, createTheme({
|
|
880
|
-
* primaryColor: 'teal',
|
|
881
|
-
* }));
|
|
882
|
-
*
|
|
883
|
-
* <MantineProvider theme={myTheme}>
|
|
884
|
-
* <App />
|
|
885
|
-
* </MantineProvider>
|
|
886
|
-
* ```
|
|
887
1149
|
*/
|
|
888
1150
|
export declare const compactTheme: MantineTheme;
|
|
889
1151
|
|
|
1152
|
+
/** The options the theme and its stylesheet take. */
|
|
1153
|
+
export declare interface CompactThemeOptions {
|
|
1154
|
+
/**
|
|
1155
|
+
* Apply the WCAG 2.2 AA token set (spec 2.9). Default false: exact Figma.
|
|
1156
|
+
*/
|
|
1157
|
+
highContrast?: boolean;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
890
1160
|
/**
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
* This is the raw theme override created with createTheme().
|
|
894
|
-
* Use this if you need to merge with other theme overrides using mergeThemeOverrides().
|
|
1161
|
+
* The compact theme override at Figma defaults: `createCompactTheme()`.
|
|
895
1162
|
*
|
|
896
|
-
*
|
|
1163
|
+
* Use this to merge with other overrides (`mergeThemeOverrides`); for most uses pass
|
|
1164
|
+
* `compactTheme` to `MantineProvider` instead.
|
|
897
1165
|
*/
|
|
898
1166
|
export declare const compactThemeOverride: {
|
|
899
|
-
focusRing?: "
|
|
1167
|
+
focusRing?: "never" | "auto" | "always" | undefined;
|
|
900
1168
|
scale?: number | undefined;
|
|
901
1169
|
fontSmoothing?: boolean | undefined;
|
|
902
1170
|
white?: string | undefined;
|
|
@@ -967,8 +1235,8 @@ export declare const compactThemeOverride: {
|
|
|
967
1235
|
} | undefined;
|
|
968
1236
|
radius?: {
|
|
969
1237
|
[x: string & {}]: string | undefined;
|
|
970
|
-
sm?: string | undefined;
|
|
971
1238
|
xs?: string | undefined;
|
|
1239
|
+
sm?: string | undefined;
|
|
972
1240
|
md?: string | undefined;
|
|
973
1241
|
lg?: string | undefined;
|
|
974
1242
|
xl?: string | undefined;
|
|
@@ -977,40 +1245,40 @@ export declare const compactThemeOverride: {
|
|
|
977
1245
|
spacing?: {
|
|
978
1246
|
[x: number]: string | undefined;
|
|
979
1247
|
[x: string & {}]: string | undefined;
|
|
980
|
-
sm?: string | undefined;
|
|
981
1248
|
xs?: string | undefined;
|
|
1249
|
+
sm?: string | undefined;
|
|
982
1250
|
md?: string | undefined;
|
|
983
1251
|
lg?: string | undefined;
|
|
984
1252
|
xl?: string | undefined;
|
|
985
1253
|
} | undefined;
|
|
986
1254
|
fontSizes?: {
|
|
987
1255
|
[x: string & {}]: string | undefined;
|
|
988
|
-
sm?: string | undefined;
|
|
989
1256
|
xs?: string | undefined;
|
|
1257
|
+
sm?: string | undefined;
|
|
990
1258
|
md?: string | undefined;
|
|
991
1259
|
lg?: string | undefined;
|
|
992
1260
|
xl?: string | undefined;
|
|
993
1261
|
} | undefined;
|
|
994
1262
|
lineHeights?: {
|
|
995
1263
|
[x: string & {}]: string | undefined;
|
|
996
|
-
sm?: string | undefined;
|
|
997
1264
|
xs?: string | undefined;
|
|
1265
|
+
sm?: string | undefined;
|
|
998
1266
|
md?: string | undefined;
|
|
999
1267
|
lg?: string | undefined;
|
|
1000
1268
|
xl?: string | undefined;
|
|
1001
1269
|
} | undefined;
|
|
1002
1270
|
breakpoints?: {
|
|
1003
1271
|
[x: string & {}]: string | undefined;
|
|
1004
|
-
sm?: string | undefined;
|
|
1005
1272
|
xs?: string | undefined;
|
|
1273
|
+
sm?: string | undefined;
|
|
1006
1274
|
md?: string | undefined;
|
|
1007
1275
|
lg?: string | undefined;
|
|
1008
1276
|
xl?: string | undefined;
|
|
1009
1277
|
} | undefined;
|
|
1010
1278
|
shadows?: {
|
|
1011
1279
|
[x: string & {}]: string | undefined;
|
|
1012
|
-
sm?: string | undefined;
|
|
1013
1280
|
xs?: string | undefined;
|
|
1281
|
+
sm?: string | undefined;
|
|
1014
1282
|
md?: string | undefined;
|
|
1015
1283
|
lg?: string | undefined;
|
|
1016
1284
|
xl?: string | undefined;
|
|
@@ -1035,30 +1303,38 @@ export declare const compactThemeOverride: {
|
|
|
1035
1303
|
other?: {
|
|
1036
1304
|
[x: string]: any;
|
|
1037
1305
|
panelGrid?: {
|
|
1038
|
-
readonly WIDTH?:
|
|
1306
|
+
readonly WIDTH?: 240 | undefined;
|
|
1039
1307
|
readonly PAD_LEFT?: 16 | undefined;
|
|
1040
1308
|
readonly PAD_RIGHT?: 8 | undefined;
|
|
1041
|
-
readonly CONTENT?:
|
|
1042
|
-
readonly BODY?:
|
|
1043
|
-
readonly FIELD?:
|
|
1309
|
+
readonly CONTENT?: 216 | undefined;
|
|
1310
|
+
readonly BODY?: 184 | undefined;
|
|
1311
|
+
readonly FIELD?: 88 | undefined;
|
|
1044
1312
|
readonly GUTTER?: 8 | undefined;
|
|
1045
1313
|
readonly TRAIL_GAP?: 8 | undefined;
|
|
1046
1314
|
readonly TRAIL?: 24 | undefined;
|
|
1047
|
-
readonly TRIPLE?:
|
|
1048
|
-
readonly TRIPLE_GAP?:
|
|
1315
|
+
readonly TRIPLE?: number | undefined;
|
|
1316
|
+
readonly TRIPLE_GAP?: 0 | undefined;
|
|
1049
1317
|
readonly CONTROL_HEIGHT?: 24 | undefined;
|
|
1050
1318
|
readonly ROW_PITCH?: 32 | undefined;
|
|
1051
|
-
readonly TOGGLE_PITCH?:
|
|
1052
|
-
readonly DATA_PITCH?:
|
|
1053
|
-
readonly SECTION_HEADER?:
|
|
1054
|
-
readonly SECTION_PAD_BOTTOM?:
|
|
1055
|
-
readonly GLYPH_SLOT?:
|
|
1056
|
-
readonly GLYPH?:
|
|
1057
|
-
readonly CHEVRON?:
|
|
1319
|
+
readonly TOGGLE_PITCH?: 32 | undefined;
|
|
1320
|
+
readonly DATA_PITCH?: 32 | undefined;
|
|
1321
|
+
readonly SECTION_HEADER?: 40 | undefined;
|
|
1322
|
+
readonly SECTION_PAD_BOTTOM?: 12 | undefined;
|
|
1323
|
+
readonly GLYPH_SLOT?: 24 | undefined;
|
|
1324
|
+
readonly GLYPH?: 12 | undefined;
|
|
1325
|
+
readonly CHEVRON?: 10 | undefined;
|
|
1058
1326
|
readonly VALUE_INSET?: 24 | undefined;
|
|
1059
1327
|
readonly SPARKLINE_HEIGHT?: 32 | undefined;
|
|
1060
1328
|
readonly HISTOGRAM_HEIGHT?: 64 | undefined;
|
|
1061
|
-
readonly LABEL_COLUMN?:
|
|
1329
|
+
readonly LABEL_COLUMN?: 72 | undefined;
|
|
1330
|
+
readonly FIELD_ROW?: 48 | undefined;
|
|
1331
|
+
readonly CAPTION_ROW?: 50 | undefined;
|
|
1332
|
+
readonly LEGEND?: 16 | undefined;
|
|
1333
|
+
readonly POPOVER_WIDTH?: 240 | undefined;
|
|
1334
|
+
readonly POPOVER_HEADER?: 40 | undefined;
|
|
1335
|
+
} | undefined;
|
|
1336
|
+
compact?: {
|
|
1337
|
+
highContrast?: boolean | undefined;
|
|
1062
1338
|
} | undefined;
|
|
1063
1339
|
} | undefined;
|
|
1064
1340
|
};
|
|
@@ -1067,14 +1343,14 @@ export declare const compactThemeOverride: {
|
|
|
1067
1343
|
* Two or three values that belong to one thing, in a single box divided by
|
|
1068
1344
|
* hairlines.
|
|
1069
1345
|
*
|
|
1070
|
-
* A
|
|
1071
|
-
* settings. Drawing them in one box, split by a one-pixel divider in the
|
|
1346
|
+
* A color and its opacity are one setting seen two ways rather than two
|
|
1347
|
+
* settings. Drawing them in one box, split by a one-pixel divider in the color
|
|
1072
1348
|
* of the panel behind it, says exactly that; drawing them in two boxes with a
|
|
1073
1349
|
* gap between them says the opposite. The divider is a hairline and not a
|
|
1074
1350
|
* gutter on purpose, because a gutter reads as two separate controls.
|
|
1075
1351
|
*
|
|
1076
1352
|
* **The rule people break.** Never put two unrelated values in one box. The
|
|
1077
|
-
* test is whether the box has one honest name: "Node
|
|
1353
|
+
* test is whether the box has one honest name: "Node color and opacity" is one
|
|
1078
1354
|
* thing seen two ways, so it belongs here; "Node size and edge width" is two
|
|
1079
1355
|
* things that happen to be adjacent, so it belongs in a `FieldRow` pair -- two
|
|
1080
1356
|
* fields, two boxes, two glyphs. A compound row is a claim about the data, and
|
|
@@ -1104,11 +1380,11 @@ export declare const compactThemeOverride: {
|
|
|
1104
1380
|
* When the "show labels on controls" preference is on -- see
|
|
1105
1381
|
* `PanelLabelsProvider` -- the row's one name moves out to a column of its own
|
|
1106
1382
|
* beside the box, and the box fills the rest of the row. The segments are never
|
|
1107
|
-
*
|
|
1383
|
+
* labeled individually, because they are not individually named things.
|
|
1108
1384
|
* @param props - Component props
|
|
1109
1385
|
* @param props.label - Names the one thing the segments belong to; becomes the box's tooltip and part of its accessible name
|
|
1110
1386
|
* @param props.segments - Two or three values that belong to one thing
|
|
1111
|
-
* @param props.width - The width of the box in pixels:
|
|
1387
|
+
* @param props.width - The width of the box in pixels: 184 to fill the row, 88 for half of one
|
|
1112
1388
|
* @param props.trailing - The 24px trailing control: an advanced settings button, a reset, or nothing
|
|
1113
1389
|
* @param props.busy - Whether the row's values are still being worked out by something that finishes later
|
|
1114
1390
|
* @param props.live - How urgently a screen reader announces the row when it changes on its own
|
|
@@ -1119,9 +1395,9 @@ export declare const compactThemeOverride: {
|
|
|
1119
1395
|
* @example
|
|
1120
1396
|
* ```tsx
|
|
1121
1397
|
* <CompoundRow
|
|
1122
|
-
* label="Node
|
|
1398
|
+
* label="Node color and opacity"
|
|
1123
1399
|
* segments={[
|
|
1124
|
-
* {glyph: <Swatch
|
|
1400
|
+
* {glyph: <Swatch color="#4a7ee8" />, value: "4A7EE8", mono: true, grow: true},
|
|
1125
1401
|
* {value: percentFormatter.format(1), unit: "%"},
|
|
1126
1402
|
* ]}
|
|
1127
1403
|
* onClick={() => { setEditorOpen(true); }}
|
|
@@ -1141,8 +1417,8 @@ export declare interface CompoundRowProps {
|
|
|
1141
1417
|
/**
|
|
1142
1418
|
* The width of the box in pixels.
|
|
1143
1419
|
*
|
|
1144
|
-
* `PANEL_GRID.BODY` (
|
|
1145
|
-
* trailing control; `PANEL_GRID.FIELD` (
|
|
1420
|
+
* `PANEL_GRID.BODY` (184) fills the row and still leaves room for the
|
|
1421
|
+
* trailing control; `PANEL_GRID.FIELD` (88) is half a row, for a box that
|
|
1146
1422
|
* sits beside another control. Ignored while the "show labels on controls"
|
|
1147
1423
|
* preference is on, when the box fills whatever the label column leaves.
|
|
1148
1424
|
*/
|
|
@@ -1190,9 +1466,9 @@ export declare interface CompoundRowProps {
|
|
|
1190
1466
|
* @example
|
|
1191
1467
|
* ```tsx
|
|
1192
1468
|
* <CompoundRow
|
|
1193
|
-
* label="Node
|
|
1469
|
+
* label="Node color and opacity"
|
|
1194
1470
|
* segments={segments}
|
|
1195
|
-
* onClick={(event) => {
|
|
1471
|
+
* onClick={(event) => { openColorEditor({addToSelection: event.shiftKey}); }}
|
|
1196
1472
|
* />
|
|
1197
1473
|
* ```
|
|
1198
1474
|
*/
|
|
@@ -1208,8 +1484,8 @@ export declare interface CompoundRowProps {
|
|
|
1208
1484
|
*/
|
|
1209
1485
|
export declare interface CompoundSegment {
|
|
1210
1486
|
/**
|
|
1211
|
-
* A glyph name, a single capital letter, or your own node -- a
|
|
1212
|
-
* swatch, say -- drawn in this segment's leading
|
|
1487
|
+
* A glyph name, a single capital letter, or your own node -- a color
|
|
1488
|
+
* swatch, say -- drawn in this segment's leading 24px slot.
|
|
1213
1489
|
*
|
|
1214
1490
|
* A plain string is deliberately not accepted: a loose word in the slot
|
|
1215
1491
|
* would be a label smuggled into a space meant for a drawing. A segment
|
|
@@ -1242,48 +1518,86 @@ export declare interface CompoundSegment {
|
|
|
1242
1518
|
fullValue?: string;
|
|
1243
1519
|
/** Dimmed suffix drawn immediately after the value, inside the same segment, such as a percent sign. */
|
|
1244
1520
|
unit?: string;
|
|
1245
|
-
/** Draw the value in the monospace face. For hex
|
|
1521
|
+
/** Draw the value in the monospace face. For hex colors, identifiers and anything read character by character. */
|
|
1246
1522
|
mono?: boolean;
|
|
1247
1523
|
/** This segment takes the box's remaining width. Exactly one segment should set it, and it should be the main value. */
|
|
1248
1524
|
grow?: boolean;
|
|
1249
1525
|
}
|
|
1250
1526
|
|
|
1251
1527
|
/**
|
|
1252
|
-
* A
|
|
1528
|
+
* A dark menu opened at the pointer by a right-click (design/figma-spec.md 8.2):
|
|
1529
|
+
* its top-left corner 3px right of and 5px above the pointer, flipping and
|
|
1530
|
+
* shifting to stay on screen, with the first enabled row highlighted so Enter
|
|
1531
|
+
* acts on it at once. It also opens from the keyboard (Shift+F10, the
|
|
1532
|
+
* ContextMenu key) at the focused element. Escape, a click outside or choosing a
|
|
1533
|
+
* row closes it and returns focus to where it was.
|
|
1534
|
+
* @param props - Component props
|
|
1535
|
+
* @param props.target - The element that opens the menu
|
|
1536
|
+
* @param props.children - The menu's rows
|
|
1537
|
+
* @param props.onChange - Called when the menu opens or closes
|
|
1538
|
+
* @returns The target, with the menu attached
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```tsx
|
|
1541
|
+
* <ContextMenu target={<div className="canvas" tabIndex={0} />}>
|
|
1542
|
+
* <Menu.Item rightSection="Ctrl+C">Copy</Menu.Item>
|
|
1543
|
+
* <Menu.Item rightSection="Ctrl+V">Paste here</Menu.Item>
|
|
1544
|
+
* <Menu.Divider />
|
|
1545
|
+
* <Menu.Item color="red">Delete</Menu.Item>
|
|
1546
|
+
* </ContextMenu>
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
export declare function ContextMenu({ target, children, onChange, ...menuProps }: ContextMenuProps): JSX.Element;
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* Props for ContextMenu: the target, the rows, and any Mantine `Menu` prop
|
|
1553
|
+
* except those that place and open it, which the context menu owns.
|
|
1554
|
+
*/
|
|
1555
|
+
export declare interface ContextMenuProps extends Omit<MenuProps, "children" | "opened" | "defaultOpened" | "position" | "offset" | "trigger"> {
|
|
1556
|
+
/**
|
|
1557
|
+
* The element that opens the menu when it is right-clicked, or when it (or
|
|
1558
|
+
* something inside it) has focus and Shift+F10 or the ContextMenu key is
|
|
1559
|
+
* pressed. One element that accepts `onContextMenu` and `onKeyDown`.
|
|
1560
|
+
*/
|
|
1561
|
+
target: ReactElement<{
|
|
1562
|
+
onContextMenu?: (event: MouseEvent_2<HTMLElement>) => void;
|
|
1563
|
+
onKeyDown?: (event: KeyboardEvent_2<HTMLElement>) => void;
|
|
1564
|
+
}>;
|
|
1565
|
+
/** The menu's rows: `Menu.Item`, `Menu.Label`, `Menu.Divider`, `Menu.Sub`, `MenuCheckItem`. */
|
|
1566
|
+
children: ReactNode;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* A labeled group of controls: a 16px legend band carrying the group's name
|
|
1571
|
+
* as a small caption, then the rows.
|
|
1253
1572
|
*
|
|
1254
|
-
* The group is always open
|
|
1255
|
-
*
|
|
1256
|
-
* the whole difference between this and `ControlSection`, and it is the
|
|
1257
|
-
* question to ask when choosing between them:
|
|
1573
|
+
* The group is always open. That is the whole difference between this and
|
|
1574
|
+
* `ControlSection`, and it is the question to ask when choosing between them:
|
|
1258
1575
|
*
|
|
1259
|
-
* - Reach for `ControlSection`
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1263
|
-
* - Reach for `ControlGroup` when the controls must stay visible, or when the
|
|
1264
|
-
* group is nested inside a container that already supplies its own padding.
|
|
1265
|
-
* `bleed` exists for exactly that case and `ControlSection` has no
|
|
1266
|
-
* equivalent.
|
|
1576
|
+
* - Reach for `ControlSection` for a subject of the panel, with a 40px header,
|
|
1577
|
+
* a rule below and, where it collapses, a chevron.
|
|
1578
|
+
* - Reach for `ControlGroup` for a named cluster of rows inside a section --
|
|
1579
|
+
* Figma's "Alignment" or "Position" legends -- or inside a pop-out.
|
|
1267
1580
|
*
|
|
1268
|
-
*
|
|
1269
|
-
*
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1581
|
+
* A field row under a legend comes out at Figma's 48px: the 16px band, then the
|
|
1582
|
+
* 32px row with its 24px control centered. The legend shortens with an ellipsis
|
|
1583
|
+
* when the container is narrow, header buttons stay pinned to its end, and
|
|
1584
|
+
* everything is laid out in inline terms so the group mirrors right to left.
|
|
1272
1585
|
* @param props - Component props
|
|
1273
1586
|
* @param props.label - The group's name, which is also its accessible name
|
|
1274
|
-
* @param props.actions - Buttons drawn at the end of the
|
|
1587
|
+
* @param props.actions - Buttons drawn at the end of the legend band
|
|
1275
1588
|
* @param props.children - The controls the group holds
|
|
1276
|
-
* @param props.bleed - Run the rule out to the edges of a padded container
|
|
1277
1589
|
* @returns The control group
|
|
1278
1590
|
* @example
|
|
1279
1591
|
* ```tsx
|
|
1280
|
-
* <ControlGroup label="
|
|
1281
|
-
* <
|
|
1282
|
-
*
|
|
1592
|
+
* <ControlGroup label="Position">
|
|
1593
|
+
* <FieldRow>
|
|
1594
|
+
* <PanelField label="X" glyph="X" value="100" />
|
|
1595
|
+
* <PanelField label="Y" glyph="Y" value="40" />
|
|
1596
|
+
* </FieldRow>
|
|
1283
1597
|
* </ControlGroup>
|
|
1284
1598
|
* ```
|
|
1285
1599
|
*/
|
|
1286
|
-
export declare function ControlGroup({ label, actions, children
|
|
1600
|
+
export declare function ControlGroup({ label, actions, children }: ControlGroupProps): default_2.JSX.Element;
|
|
1287
1601
|
|
|
1288
1602
|
/**
|
|
1289
1603
|
* Props for the ControlGroup component.
|
|
@@ -1306,14 +1620,10 @@ export declare interface ControlGroupProps {
|
|
|
1306
1620
|
/** The controls the group holds, stacked in the order you write them. */
|
|
1307
1621
|
children: default_2.ReactNode;
|
|
1308
1622
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1313
|
-
* padding -- a pop-out panel, or a sidebar -- and you want the rule to read
|
|
1314
|
-
* as a divider across the whole panel rather than as a line floating
|
|
1315
|
-
* inside it. It is drawn with a negative inline margin, so it follows the
|
|
1316
|
-
* text direction with no further work.
|
|
1623
|
+
* Kept so existing callers compile. The group no longer draws a rule (Figma
|
|
1624
|
+
* does not divide groups inside a section), so there is nothing to bleed and
|
|
1625
|
+
* the prop has no effect.
|
|
1626
|
+
* @deprecated no effect since the Figma restyle
|
|
1317
1627
|
*/
|
|
1318
1628
|
bleed?: boolean;
|
|
1319
1629
|
}
|
|
@@ -1321,33 +1631,35 @@ export declare interface ControlGroupProps {
|
|
|
1321
1631
|
/**
|
|
1322
1632
|
* A named, collapsible group of controls for a dense property panel.
|
|
1323
1633
|
*
|
|
1324
|
-
* A section is drawn as a
|
|
1325
|
-
*
|
|
1634
|
+
* A section is drawn as a 40px header carrying the section's name, the rows it
|
|
1635
|
+
* holds, 12px of padding beneath them, and a 1px rule below. Naming the group once in
|
|
1326
1636
|
* the header is what lets the rows inside it spend their width on values rather
|
|
1327
1637
|
* than on labels and buttons of their own.
|
|
1328
1638
|
*
|
|
1329
1639
|
* **A section always expands**, and three rules follow from that:
|
|
1330
1640
|
*
|
|
1331
1641
|
* 1. The chevron is drawn only when there is something to expand. An `empty`
|
|
1332
|
-
* section has no chevron at all
|
|
1333
|
-
*
|
|
1642
|
+
* section has no chevron at all and its trailing slot carries one "+".
|
|
1643
|
+
* Hovering its header brings the name, and the "+", up to the primary
|
|
1644
|
+
* ink; clicking the name adds, like the "+".
|
|
1334
1645
|
* 2. In development it warns when it is given neither children nor `empty`,
|
|
1335
1646
|
* because a header that opens onto nothing is a dead end for the reader.
|
|
1336
1647
|
* 3. There is no way to put the section's own content behind a pop-out. An
|
|
1337
1648
|
* advanced settings button belongs in `actions`, beside the rows rather than
|
|
1338
1649
|
* instead of them.
|
|
1339
1650
|
*
|
|
1340
|
-
* The name is drawn in the primary text
|
|
1341
|
-
* something and in the secondary
|
|
1651
|
+
* The name is drawn in the primary text color when the section holds
|
|
1652
|
+
* something and in the secondary color when it is `empty`. That dimming is the
|
|
1342
1653
|
* whole empty state -- no "Not set", no "None", no sentence -- so a column of
|
|
1343
1654
|
* dim section names reads as an inventory of what has not been set up yet. It
|
|
1344
1655
|
* is never the only signal: an empty section also loses its chevron and gains a
|
|
1345
|
-
* "+", so nothing about the state depends on telling two
|
|
1656
|
+
* "+", so nothing about the state depends on telling two grays apart.
|
|
1346
1657
|
*
|
|
1347
1658
|
* The section draws the panel's own horizontal padding, 16px at the leading
|
|
1348
|
-
* edge and 8px at the trailing edge, so a section dropped straight into a
|
|
1659
|
+
* edge and 8px at the trailing edge, so a section dropped straight into a 240px
|
|
1349
1660
|
* panel lands its header and its rows on the same grid the rows expect. The
|
|
1350
|
-
*
|
|
1661
|
+
* chevron sits in the 16px gutter before the name. The padding follows the
|
|
1662
|
+
* text direction, and so does the chevron -- a collapsed
|
|
1351
1663
|
* section points towards the left in a right-to-left interface -- so the
|
|
1352
1664
|
* section is correct in either direction with nothing to configure.
|
|
1353
1665
|
* @param props - Component props
|
|
@@ -1362,6 +1674,7 @@ export declare interface ControlGroupProps {
|
|
|
1362
1674
|
* @param props.info - An explanation, put behind a circled "i" and used as the section's accessible description
|
|
1363
1675
|
* @param props.actions - The section's own buttons, drawn at the end of the header
|
|
1364
1676
|
* @param props.children - The rows the section holds
|
|
1677
|
+
* @param props.collapsible - Whether the section folds away behind a chevron, defaulting to true
|
|
1365
1678
|
* @returns The section, its header and its rows
|
|
1366
1679
|
* @example
|
|
1367
1680
|
* ```tsx
|
|
@@ -1411,12 +1724,12 @@ export declare interface ControlSectionProps extends DisclosureProps {
|
|
|
1411
1724
|
* Whether the section is set up at all.
|
|
1412
1725
|
*
|
|
1413
1726
|
* An empty section is drawn as one 32px row: the name in the secondary text
|
|
1414
|
-
*
|
|
1727
|
+
* color, no chevron, and a single "+" in the trailing slot. It shows no
|
|
1415
1728
|
* content and no empty-state sentence, and its children are not rendered.
|
|
1416
1729
|
*
|
|
1417
1730
|
* The dimmed name is never the only thing that says so. The chevron is
|
|
1418
1731
|
* gone, the "+" is there, and the group holds nothing, so the state still
|
|
1419
|
-
* reads for someone who cannot tell the two text
|
|
1732
|
+
* reads for someone who cannot tell the two text colors apart. Give
|
|
1420
1733
|
* `onAdd` whenever a section can be empty: its "Add ..." button is what
|
|
1421
1734
|
* states the section is waiting to be set up, in words, to a screen reader.
|
|
1422
1735
|
*/
|
|
@@ -1454,23 +1767,30 @@ export declare interface ControlSectionProps extends DisclosureProps {
|
|
|
1454
1767
|
actions?: default_2.ReactNode;
|
|
1455
1768
|
/** The rows the section holds: the controls commonly adjusted for its subject. */
|
|
1456
1769
|
children?: default_2.ReactNode;
|
|
1770
|
+
/**
|
|
1771
|
+
* Whether the section folds away behind a chevron in the left gutter.
|
|
1772
|
+
*
|
|
1773
|
+
* Figma collapses only a few sections (Export, Styles); most are shown or hidden as a whole
|
|
1774
|
+
* by the app. Set it to false for a section that is always open: no chevron, no toggle
|
|
1775
|
+
* button, and its rows are always on screen.
|
|
1776
|
+
* @default true
|
|
1777
|
+
*/
|
|
1778
|
+
collapsible?: boolean;
|
|
1457
1779
|
}
|
|
1458
1780
|
|
|
1459
1781
|
/**
|
|
1460
1782
|
* A collapsible sub-group of controls, lighter than a section.
|
|
1461
1783
|
*
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1784
|
+
* Prefer an `AdvancedButton` that opens a pop-out: that is how Figma keeps rare
|
|
1785
|
+
* settings off the panel. Where a fold inside the section is still wanted, this
|
|
1786
|
+
* draws it the Figma way: a 32px row whose chevron hangs in the 16px gutter to
|
|
1787
|
+
* the left of the section's content edge, and a label in the secondary text
|
|
1788
|
+
* color that comes up to the primary one under the pointer. The content opens
|
|
1789
|
+
* in one frame, on the same grid as the rows around it.
|
|
1468
1790
|
*
|
|
1469
1791
|
* The header is one button carrying the open state, and the controls it reveals
|
|
1470
|
-
* are a
|
|
1471
|
-
*
|
|
1472
|
-
* while it is closed and animates open, and nothing inside a closed sub-group
|
|
1473
|
-
* can be reached by Tab.
|
|
1792
|
+
* are a labeled region that the button points at. Nothing inside a closed
|
|
1793
|
+
* sub-group can be reached by Tab.
|
|
1474
1794
|
*
|
|
1475
1795
|
* Drive it from your own state with `opened` and `onOpenChange`, or leave both
|
|
1476
1796
|
* out and let it remember its own with `defaultOpened`.
|
|
@@ -1521,6 +1841,23 @@ export declare interface ControlSubGroupProps extends DisclosureProps {
|
|
|
1521
1841
|
*/
|
|
1522
1842
|
export declare function createColorStop(offset: number, color: string): ColorStop;
|
|
1523
1843
|
|
|
1844
|
+
/**
|
|
1845
|
+
* Create the compact theme: Figma's editor look in both color schemes, or with
|
|
1846
|
+
* `highContrast: true` the WCAG 2.2 AA token set (design/figma-spec.md 2.9).
|
|
1847
|
+
*
|
|
1848
|
+
* Light and dark are Mantine's own color scheme (`defaultColorScheme`, `forceColorScheme`,
|
|
1849
|
+
* `useMantineColorScheme`); one theme object serves both.
|
|
1850
|
+
* @param options - `highContrast` switches on the AA tokens
|
|
1851
|
+
* @returns a theme override for `MantineProvider`
|
|
1852
|
+
* @example
|
|
1853
|
+
* ```tsx
|
|
1854
|
+
* <MantineProvider theme={createCompactTheme({ highContrast: true })}>
|
|
1855
|
+
* <App />
|
|
1856
|
+
* </MantineProvider>
|
|
1857
|
+
* ```
|
|
1858
|
+
*/
|
|
1859
|
+
export declare function createCompactTheme(options?: CompactThemeOptions): MantineThemeOverride;
|
|
1860
|
+
|
|
1524
1861
|
/**
|
|
1525
1862
|
* Creates default gradient stops for a new gradient configuration.
|
|
1526
1863
|
* @returns An array of two ColorStops (start and end)
|
|
@@ -1535,30 +1872,26 @@ export declare function createDefaultGradientStops(): ColorStop[];
|
|
|
1535
1872
|
* value, and the reason is worth stating because every other row type exists to
|
|
1536
1873
|
* replace that label with a glyph. An identifier, a node label, an attribute
|
|
1537
1874
|
* name or a filename is *data*, and data cannot be drawn: there is no picture of
|
|
1538
|
-
* `Mr_Whiskers`. So the string stays, at
|
|
1875
|
+
* `Mr_Whiskers`. So the string stays, at 11px in the primary text color, and
|
|
1539
1876
|
* the number that describes it rides at the trailing edge in the smaller
|
|
1540
|
-
* secondary
|
|
1877
|
+
* secondary color.
|
|
1541
1878
|
*
|
|
1542
1879
|
* The number is bare. A run of rows that all measure the same thing carries its
|
|
1543
1880
|
* unit word once, on a `DataRowHeader` above the column, rather than repeating
|
|
1544
1881
|
* it on every row -- "links" above the column and `4` on the rows. A rank is a
|
|
1545
1882
|
* `RankChip` reading `#6`, not the sentence "Rank 6 of 318".
|
|
1546
1883
|
*
|
|
1547
|
-
*
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
* is
|
|
1551
|
-
* a single selected row or, inside a listbox, as `aria-selected`.
|
|
1884
|
+
* A row is a reading, not an object in a list. Give it `onClick` to open what
|
|
1885
|
+
* the reading is about, and `selected` to mark the current row of a ranking
|
|
1886
|
+
* (reported as `aria-current`). A list the reader selects, renames or reorders
|
|
1887
|
+
* is a `Tree` (nested) or a `PageList` (flat); a find result is a `ResultRow`.
|
|
1552
1888
|
* @param props - Component props
|
|
1553
1889
|
* @param props.name - The reader's own string
|
|
1554
|
-
* @param props.value - The trailing value, bare and in the secondary text
|
|
1890
|
+
* @param props.value - The trailing value, bare and in the secondary text color; a number is formatted for the locale
|
|
1891
|
+
* @param props.stat - Draws the row as a stat: the name as the label, the value emphasized, the pair one group
|
|
1555
1892
|
* @param props.icon - A 16px leading icon, worth drawing only when the rows differ in type
|
|
1556
|
-
* @param props.selected - Whether this row is the
|
|
1557
|
-
* @param props.role - How the row reports being selected: `"button"` for one selected row, `"option"` inside a listbox
|
|
1558
|
-
* @param props.tabIndex - The row's position in the tab order, for a list that manages focus itself
|
|
1893
|
+
* @param props.selected - Whether this row is the current one, reported as `aria-current`
|
|
1559
1894
|
* @param props.onClick - Called when the row is activated, with the event and the activation source
|
|
1560
|
-
* @param props.onDoubleClick - Called when the row is double-clicked, anywhere along it
|
|
1561
|
-
* @param props.onContextMenu - Called when a context menu is asked for on the row, by pointer or from the keyboard
|
|
1562
1895
|
* @param props.onFocus - Called when the row's body takes focus
|
|
1563
1896
|
* @param props.onBlur - Called when the row's body loses focus
|
|
1564
1897
|
* @param props.trailing - The row's occasional control, in the 24px slot at its trailing edge
|
|
@@ -1570,17 +1903,17 @@ export declare function createDefaultGradientStops(): ColorStop[];
|
|
|
1570
1903
|
* <DataRow
|
|
1571
1904
|
* key={node.id}
|
|
1572
1905
|
* name={node.id}
|
|
1573
|
-
* value={
|
|
1906
|
+
* value={node.degree}
|
|
1574
1907
|
* selected={node.id === current}
|
|
1575
1908
|
* onClick={() => { setCurrent(node.id); }}
|
|
1576
1909
|
* />
|
|
1577
1910
|
* ))}
|
|
1578
1911
|
* ```
|
|
1579
1912
|
*/
|
|
1580
|
-
export declare function DataRow({ name, value, icon, selected,
|
|
1913
|
+
export declare function DataRow({ name, value, stat, icon, selected, onClick, onFocus, onBlur, trailing, }: DataRowProps): default_2.JSX.Element;
|
|
1581
1914
|
|
|
1582
1915
|
/**
|
|
1583
|
-
* The
|
|
1916
|
+
* The 32px caption above a run of data rows (11/16 at 550), optionally sortable.
|
|
1584
1917
|
*
|
|
1585
1918
|
* It exists to carry the one word the rows below must not repeat. Three or more
|
|
1586
1919
|
* rows measuring the same thing put their unit here once -- "links" above the
|
|
@@ -1588,9 +1921,9 @@ export declare function DataRow({ name, value, icon, selected, role, tabIndex, o
|
|
|
1588
1921
|
* trailing edge becomes a number a reader can compare down rather than a ragged
|
|
1589
1922
|
* phrase they have to re-read.
|
|
1590
1923
|
*
|
|
1591
|
-
* Both halves are drawn small in the secondary text
|
|
1924
|
+
* Both halves are drawn small in the secondary text color, because a caption is
|
|
1592
1925
|
* chrome rather than content. The name of the sorted column is drawn in the
|
|
1593
|
-
* primary
|
|
1926
|
+
* primary color instead, which is how a reader sees at a glance which column
|
|
1594
1927
|
* the list is in the order of.
|
|
1595
1928
|
*
|
|
1596
1929
|
* Give it `onSortChange` and the caption becomes a button that cycles between
|
|
@@ -1682,43 +2015,41 @@ export declare interface DataRowProps {
|
|
|
1682
2015
|
/** The reader's own string: an identifier, a node label, an attribute name, a filename. */
|
|
1683
2016
|
name: string;
|
|
1684
2017
|
/**
|
|
1685
|
-
* The trailing value, drawn small in the secondary text
|
|
2018
|
+
* The trailing value, drawn small in the secondary text color. Bare: the
|
|
1686
2019
|
* repeated unit word belongs on `DataRowHeader`.
|
|
1687
2020
|
*
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
2021
|
+
* Pass a number raw: the row formats it for the reader's locale, `1,284`
|
|
2022
|
+
* in en-US and `1.284` in de-DE, keeping every fraction digit it is given.
|
|
2023
|
+
* Anything else is drawn exactly as given, so pass a string when you have
|
|
2024
|
+
* rounded or formatted the value yourself.
|
|
1692
2025
|
*/
|
|
1693
2026
|
value?: default_2.ReactNode;
|
|
1694
|
-
/** A 16px leading icon, worth drawing only when the rows differ in type. */
|
|
1695
|
-
icon?: default_2.ReactNode;
|
|
1696
|
-
/** Whether this row is the selected one. Draws the accent tint and reports the selection to a screen reader. */
|
|
1697
|
-
selected?: boolean;
|
|
1698
2027
|
/**
|
|
1699
|
-
*
|
|
2028
|
+
* Draws the row as a stat: a label and its reading, such as "Nodes 1,000,000".
|
|
1700
2029
|
*
|
|
1701
|
-
*
|
|
1702
|
-
*
|
|
1703
|
-
*
|
|
2030
|
+
* The name is drawn in the secondary text color at weight 400 and the value
|
|
2031
|
+
* in the primary color at weight 500, because the reading is the half the
|
|
2032
|
+
* reader came for. The pair is exposed as one `role="group"` named by the
|
|
2033
|
+
* name, so a screen reader reads "Nodes, 1,000,000" as one unit (WCAG 1.3.1).
|
|
2034
|
+
*
|
|
2035
|
+
* Leave it off for a list of the reader's own strings -- datasets, files,
|
|
2036
|
+
* nodes -- where the name is the thing being read.
|
|
1704
2037
|
*/
|
|
1705
|
-
|
|
2038
|
+
stat?: boolean;
|
|
2039
|
+
/** A 16px leading icon, worth drawing only when the rows differ in type. */
|
|
2040
|
+
icon?: default_2.ReactNode;
|
|
1706
2041
|
/**
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
* one when you are managing focus yourself, as a listbox does when the arrow
|
|
1711
|
-
* keys move between rows and Tab enters and leaves the list.
|
|
2042
|
+
* Whether this row is the current one: the item on screen, or the current
|
|
2043
|
+
* entry of a ranking. Draws the accent tint and reports it to a screen
|
|
2044
|
+
* reader as `aria-current`.
|
|
1712
2045
|
*/
|
|
1713
|
-
|
|
2046
|
+
selected?: boolean;
|
|
1714
2047
|
/**
|
|
1715
2048
|
* Called when the row is activated, by a click or by Enter or Space.
|
|
1716
2049
|
*
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1719
|
-
*
|
|
1720
|
-
* keyboard, which is worth branching on because a keyboard activation
|
|
1721
|
-
* carries no click count and no modifiers to extend a range with.
|
|
2050
|
+
* Open what the reading is about: the node a ranking names, the file a
|
|
2051
|
+
* recent-files row names. The second argument says whether the row was
|
|
2052
|
+
* activated with a pointer or from the keyboard.
|
|
1722
2053
|
*
|
|
1723
2054
|
* Giving a row this handler makes its name and value a real button, so the
|
|
1724
2055
|
* row is reachable by Tab and answers Enter and Space. A row without one is
|
|
@@ -1727,46 +2058,18 @@ export declare interface DataRowProps {
|
|
|
1727
2058
|
* ```tsx
|
|
1728
2059
|
* <DataRow
|
|
1729
2060
|
* name={node.id}
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1733
|
-
* extendSelectionTo(node.id);
|
|
1734
|
-
* } else if (event.metaKey || event.ctrlKey) {
|
|
1735
|
-
* toggleSelection(node.id);
|
|
1736
|
-
* } else {
|
|
1737
|
-
* replaceSelectionWith(node.id);
|
|
1738
|
-
* }
|
|
1739
|
-
* }}
|
|
2061
|
+
* value={node.degree}
|
|
2062
|
+
* selected={node.id === current}
|
|
2063
|
+
* onClick={() => { setCurrent(node.id); }}
|
|
1740
2064
|
* />
|
|
1741
2065
|
* ```
|
|
1742
2066
|
*/
|
|
1743
2067
|
onClick?: ActivationHandlerWithMeta;
|
|
1744
|
-
/**
|
|
1745
|
-
* Called when the row is double-clicked, anywhere along it.
|
|
1746
|
-
*
|
|
1747
|
-
* Open the thing the row names, or start renaming it. The browser delivers
|
|
1748
|
-
* two `onClick` activations before this, which is how a double click is
|
|
1749
|
-
* defined rather than something this component adds; `event.detail` on
|
|
1750
|
-
* those clicks counts them, so a consumer that must act on a single click
|
|
1751
|
-
* alone can wait for the count to settle.
|
|
1752
|
-
*/
|
|
1753
|
-
onDoubleClick?: (event: default_2.MouseEvent) => void;
|
|
1754
|
-
/**
|
|
1755
|
-
* Called when a context menu is asked for on the row, anywhere along it.
|
|
1756
|
-
*
|
|
1757
|
-
* Call `preventDefault` on the event to replace the browser's own menu with
|
|
1758
|
-
* yours. The keyboard's context-menu key and Shift+F10 raise it as well as a
|
|
1759
|
-
* right click, so a menu opened from here is reachable without a pointer --
|
|
1760
|
-
* as long as the row can hold focus, which it can as soon as it has an
|
|
1761
|
-
* `onClick`, or when you give it a `tabIndex` of its own.
|
|
1762
|
-
*/
|
|
1763
|
-
onContextMenu?: (event: default_2.MouseEvent) => void;
|
|
1764
2068
|
/**
|
|
1765
2069
|
* Called when the row's body takes focus.
|
|
1766
2070
|
*
|
|
1767
|
-
* The
|
|
1768
|
-
* `<button
|
|
1769
|
-
* cannot.
|
|
2071
|
+
* The body takes focus only when the row has an `onClick`, which makes it a
|
|
2072
|
+
* `<button>`.
|
|
1770
2073
|
*/
|
|
1771
2074
|
onFocus?: default_2.FocusEventHandler<HTMLElement>;
|
|
1772
2075
|
/** Called when the row's body loses focus. */
|
|
@@ -1775,17 +2078,6 @@ export declare interface DataRowProps {
|
|
|
1775
2078
|
trailing?: default_2.ReactNode;
|
|
1776
2079
|
}
|
|
1777
2080
|
|
|
1778
|
-
/**
|
|
1779
|
-
* How a row reports being selected to a screen reader.
|
|
1780
|
-
*
|
|
1781
|
-
* - `"button"` marks the row `aria-current`, which is what a list with one
|
|
1782
|
-
* selected item means: this row is the one on screen.
|
|
1783
|
-
* - `"option"` gives the row the `option` role and `aria-selected`. Use it only
|
|
1784
|
-
* when the rows sit inside an element you have given `role="listbox"`, adding
|
|
1785
|
-
* `aria-multiselectable` there when more than one row can be selected at once.
|
|
1786
|
-
*/
|
|
1787
|
-
export declare type DataRowRole = "button" | "option";
|
|
1788
|
-
|
|
1789
2081
|
/**
|
|
1790
2082
|
* Which way a sorted column is ordered, in the spelling ARIA uses.
|
|
1791
2083
|
*
|
|
@@ -2069,9 +2361,9 @@ export declare interface DataTableProps<TRow extends object> {
|
|
|
2069
2361
|
* the thing virtualization exists to avoid.
|
|
2070
2362
|
*/
|
|
2071
2363
|
height?: number | string;
|
|
2072
|
-
/** How tall each row is drawn, in pixels. Defaults to
|
|
2364
|
+
/** How tall each row is drawn, in pixels. Defaults to 32, Figma's list row pitch (`PANEL_GRID.ROW_PITCH`). */
|
|
2073
2365
|
rowHeight?: number;
|
|
2074
|
-
/** How tall the header row is drawn, in pixels. Defaults to
|
|
2366
|
+
/** How tall the header row is drawn, in pixels. Defaults to 32, like a row. */
|
|
2075
2367
|
headerHeight?: number;
|
|
2076
2368
|
/**
|
|
2077
2369
|
* How many rows to draw beyond the ones on screen, above and below.
|
|
@@ -2286,6 +2578,17 @@ export declare interface DisclosureProps {
|
|
|
2286
2578
|
onOpenChange?: OpenChangeHandler;
|
|
2287
2579
|
}
|
|
2288
2580
|
|
|
2581
|
+
/**
|
|
2582
|
+
* Inject the stylesheet into `document.head` (once) and set `data-cm-contrast` on `<html>` to
|
|
2583
|
+
* `"high"` or `"figma"`. Does nothing without a DOM.
|
|
2584
|
+
*
|
|
2585
|
+
* ponytail: one contrast attribute per document, so the last theme rendered wins; two providers
|
|
2586
|
+
* with different `highContrast` on one page are not supported. Scope the attribute to the
|
|
2587
|
+
* provider's root if that is ever needed.
|
|
2588
|
+
* @param options - the theme options
|
|
2589
|
+
*/
|
|
2590
|
+
export declare function ensureCompactStyles(options?: CompactThemeOptions): void;
|
|
2591
|
+
|
|
2289
2592
|
/**
|
|
2290
2593
|
* Every glyph name in the closed field register, in register order.
|
|
2291
2594
|
*/
|
|
@@ -2297,21 +2600,21 @@ export declare const FIELD_GLYPH_NAMES: readonly FieldGlyphName[];
|
|
|
2297
2600
|
export declare const FIELD_LETTERS: readonly FieldLetter[];
|
|
2298
2601
|
|
|
2299
2602
|
/**
|
|
2300
|
-
* A glyph from the closed register, drawn in a field's
|
|
2603
|
+
* A glyph from the closed register, drawn in a field's 24px slot.
|
|
2301
2604
|
*
|
|
2302
2605
|
* The glyph is the field's label: it replaces the word that a label-above-field
|
|
2303
2606
|
* stack used to spend a line on. It is decorative to assistive technology --
|
|
2304
2607
|
* the field itself carries the word as its title and accessible name.
|
|
2305
2608
|
* @param props - Component props
|
|
2306
2609
|
* @param props.name - Which glyph of the closed field register to draw
|
|
2307
|
-
* @param props.filled - Draw the bound form: the glyph's closed shapes fill with the current
|
|
2308
|
-
* @param props.size - Drawn size in pixels, defaulting to the
|
|
2610
|
+
* @param props.filled - Draw the bound form: the glyph's closed shapes fill with the current color, which is how a field says its value comes from a data attribute rather than from a fixed literal
|
|
2611
|
+
* @param props.size - Drawn size in pixels, defaulting to the 12px nominal glyph size
|
|
2309
2612
|
* @returns The field glyph SVG
|
|
2310
2613
|
*/
|
|
2311
2614
|
export declare function FieldGlyph({ name, filled, size }: FieldGlyphProps): default_2.JSX.Element;
|
|
2312
2615
|
|
|
2313
2616
|
/**
|
|
2314
|
-
* The closed register of drawings allowed in a field's
|
|
2617
|
+
* The closed register of drawings allowed in a field's 24px slot.
|
|
2315
2618
|
*
|
|
2316
2619
|
* Nothing outside this list may be drawn there. The premise of the field is
|
|
2317
2620
|
* that a small drawing can replace a word, which only works if the drawings are
|
|
@@ -2328,7 +2631,7 @@ export declare interface FieldGlyphProps {
|
|
|
2328
2631
|
name: FieldGlyphName;
|
|
2329
2632
|
/** a bound glyph draws filled; a fixed literal draws hollow */
|
|
2330
2633
|
filled?: boolean;
|
|
2331
|
-
/** Drawn size in pixels. Defaults to the
|
|
2634
|
+
/** Drawn size in pixels. Defaults to the 12px nominal glyph size of the 24px slot. */
|
|
2332
2635
|
size?: number;
|
|
2333
2636
|
}
|
|
2334
2637
|
|
|
@@ -2341,40 +2644,34 @@ export declare type FieldLetter = "N" | "E" | "W" | "D" | "K";
|
|
|
2341
2644
|
/**
|
|
2342
2645
|
* A panel row holding one or two compact fields and a fixed trailing slot.
|
|
2343
2646
|
*
|
|
2344
|
-
* This is the row a dense property panel is mostly made of
|
|
2345
|
-
*
|
|
2346
|
-
*
|
|
2347
|
-
* out around half its usual height.
|
|
2647
|
+
* This is the row a dense property panel is mostly made of: 32px tall, a 24px
|
|
2648
|
+
* control centered in it. Each field carries a glyph inside its own box instead
|
|
2649
|
+
* of a caption above it.
|
|
2348
2650
|
*
|
|
2349
2651
|
* The row owns the widths and the gaps; each field owns everything inside its
|
|
2350
|
-
* own box. Three arrangements, all of them filling the same
|
|
2351
|
-
*
|
|
2652
|
+
* own box. Three arrangements, all of them filling the same 216px band of a
|
|
2653
|
+
* 240px panel:
|
|
2352
2654
|
*
|
|
2353
|
-
* - two fields side by side -- `
|
|
2354
|
-
* - one field beside a trailing control -- `
|
|
2355
|
-
* - one field alone -- `
|
|
2655
|
+
* - two fields side by side -- `88 + 8 + 88 + 8 + 24`
|
|
2656
|
+
* - one field beside a trailing control -- `184 + 8 + 24`
|
|
2657
|
+
* - one field alone -- `192 + 24`; with no control to be held apart from, the
|
|
2356
2658
|
* field takes the 8px gap for itself
|
|
2357
2659
|
*
|
|
2358
|
-
* The trailing slot is drawn whether or not it holds anything,
|
|
2359
|
-
*
|
|
2360
|
-
*
|
|
2361
|
-
* settings button that opens a pop-out, or a small reset. A select's chevron is
|
|
2362
|
-
* not one of those: it belongs inside the field's own box.
|
|
2660
|
+
* The trailing slot is drawn whether or not it holds anything, so every row in
|
|
2661
|
+
* a panel ends at the same place. Put the row's one rare control there -- an
|
|
2662
|
+
* advanced settings button that opens a pop-out, or a small reset.
|
|
2363
2663
|
*
|
|
2364
2664
|
* **Right-to-left.** All of the row's spacing is written in CSS logical
|
|
2365
2665
|
* properties, so the row lays itself out correctly under `dir="rtl"` with
|
|
2366
|
-
* nothing to configure
|
|
2367
|
-
* slot stays at the end of the row rather than jumping to its start, and the
|
|
2368
|
-
* three arrangements above still spend exactly 256px. The row writes the same
|
|
2369
|
-
* style in both directions; only the browser resolves it differently.
|
|
2666
|
+
* nothing to configure.
|
|
2370
2667
|
*
|
|
2371
2668
|
* **When control labels are switched on.** `PanelLabelsProvider` turns on a
|
|
2372
|
-
* preference that writes each control's word
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2669
|
+
* preference that writes each control's word. By default the row becomes
|
|
2670
|
+
* Figma's labeled row: a 9px caption in the secondary ink above each column
|
|
2671
|
+
* (4 above, 14 caption, 4 gap, 24 control, 4 below = 50px). With
|
|
2672
|
+
* `labelPosition="inline"` a pair instead splits into two rows, each with its
|
|
2673
|
+
* word in a 72px column beside the field. Either way the word is printed once:
|
|
2674
|
+
* the fields are handed a labels-off context so that they do not repeat it.
|
|
2378
2675
|
* @example
|
|
2379
2676
|
* ```tsx
|
|
2380
2677
|
* <FieldRow
|
|
@@ -2418,6 +2715,32 @@ export declare interface FieldRowProps extends Omit<default_2.ComponentPropsWith
|
|
|
2418
2715
|
* on the page, such as in the section header above the row.
|
|
2419
2716
|
*/
|
|
2420
2717
|
groupLabel?: string;
|
|
2718
|
+
/**
|
|
2719
|
+
* Where each field's label word goes while the "show labels on controls"
|
|
2720
|
+
* preference is on (see `PanelLabelsProvider`).
|
|
2721
|
+
*
|
|
2722
|
+
* - `"above"` (default): Figma's labeled two-column row. A 9px caption sits
|
|
2723
|
+
* above each column, and the row grows from 32px to 50px.
|
|
2724
|
+
* - `"inline"`: the earlier layout. A pair splits into two rows of one field
|
|
2725
|
+
* each, with the word in a 72px column beside the field.
|
|
2726
|
+
*
|
|
2727
|
+
* With the preference off the row draws no words and this has no effect.
|
|
2728
|
+
* @default "above"
|
|
2729
|
+
*/
|
|
2730
|
+
labelPosition?: "above" | "inline";
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
/** One visible row. */
|
|
2734
|
+
export declare interface FlatTreeRow {
|
|
2735
|
+
node: TreeNodeData;
|
|
2736
|
+
/** 1 for a top-level row. */
|
|
2737
|
+
level: number;
|
|
2738
|
+
parentId: string | null;
|
|
2739
|
+
/** 1-based position among its siblings. */
|
|
2740
|
+
posInSet: number;
|
|
2741
|
+
setSize: number;
|
|
2742
|
+
hasChildren: boolean;
|
|
2743
|
+
expanded: boolean;
|
|
2421
2744
|
}
|
|
2422
2745
|
|
|
2423
2746
|
/**
|
|
@@ -2431,7 +2754,7 @@ export declare type GestureChangeHandler<T = number> = (value: T, event: default
|
|
|
2431
2754
|
|
|
2432
2755
|
/**
|
|
2433
2756
|
* Called once when a continuous gesture finishes, including when it is
|
|
2434
|
-
*
|
|
2757
|
+
* canceled.
|
|
2435
2758
|
*/
|
|
2436
2759
|
export declare type GestureEndHandler = (event: default_2.PointerEvent) => void;
|
|
2437
2760
|
|
|
@@ -2456,7 +2779,7 @@ export declare interface GestureHandlers<T = number> {
|
|
|
2456
2779
|
onGestureStart?: GestureStartHandler;
|
|
2457
2780
|
/** Called repeatedly while the gesture is in progress. */
|
|
2458
2781
|
onGestureChange?: GestureChangeHandler<T>;
|
|
2459
|
-
/** Called when the gesture finishes or is
|
|
2782
|
+
/** Called when the gesture finishes or is canceled. Commit the undo transaction here. */
|
|
2460
2783
|
onGestureEnd?: GestureEndHandler;
|
|
2461
2784
|
}
|
|
2462
2785
|
|
|
@@ -2469,9 +2792,9 @@ export declare type GestureStartHandler = (event: default_2.PointerEvent) => voi
|
|
|
2469
2792
|
/**
|
|
2470
2793
|
* Works out whether an activation came from a pointer or from the keyboard.
|
|
2471
2794
|
*
|
|
2472
|
-
* A keyboard activation is
|
|
2795
|
+
* A keyboard activation is recognized three ways: the event is a keyboard event;
|
|
2473
2796
|
* or it is a pointer event with no pointer type; or it is a mouse event with a
|
|
2474
|
-
* click count of zero, which is how a browser reports the click it
|
|
2797
|
+
* click count of zero, which is how a browser reports the click it synthesizes
|
|
2475
2798
|
* from Enter or Space on a button.
|
|
2476
2799
|
* @param event - The event that activated the control
|
|
2477
2800
|
* @returns The activation source, ready to hand to an {@link ActivationHandlerWithMeta}
|
|
@@ -2479,39 +2802,38 @@ export declare type GestureStartHandler = (event: default_2.PointerEvent) => voi
|
|
|
2479
2802
|
export declare function getActivationMeta(event: ActivationEvent): ActivationMeta;
|
|
2480
2803
|
|
|
2481
2804
|
/**
|
|
2482
|
-
* An editor for a multi-stop linear gradient
|
|
2805
|
+
* An editor for a multi-stop linear gradient, laid out as Figma's: square stop handles over a
|
|
2806
|
+
* gradient bar, a color picker (ColorPickerPanel, without opacity) for the selected stop, a
|
|
2807
|
+
* "Stops" list of rows (position, chit and hex, remove), and an optional direction row (the
|
|
2808
|
+
* angle, flip and rotate).
|
|
2483
2809
|
*
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
2486
|
-
* adds a stop halfway between the last one and the end, and an optional slider
|
|
2487
|
-
* below sets the angle the gradient runs at.
|
|
2810
|
+
* One stop is selected at a time: its handle, its row's chit, or focus entering its row selects
|
|
2811
|
+
* it, and the picker edits its color. The row's hex box edits it too. Nothing opens a pop-out.
|
|
2488
2812
|
*
|
|
2489
|
-
*
|
|
2490
|
-
*
|
|
2491
|
-
*
|
|
2492
|
-
*
|
|
2493
|
-
* silently doing nothing.
|
|
2813
|
+
* Drag a handle to move its stop, click the bar to add a stop there (its color mixed from its
|
|
2814
|
+
* neighbors), and use the arrow keys on a focused handle to nudge it (Shift for 10%), Home /
|
|
2815
|
+
* End to send it to an end, and Delete or Backspace to remove it. The list is bounded by
|
|
2816
|
+
* `minStops` and `maxStops`; at either bound the button that would cross it is disabled.
|
|
2494
2817
|
*
|
|
2495
|
-
*
|
|
2496
|
-
*
|
|
2497
|
-
*
|
|
2498
|
-
* into one undo entry rather than one per pixel moved.
|
|
2818
|
+
* A drag -- of a handle, or in the picker -- reports `onChangeStart` once, `onChange` on every
|
|
2819
|
+
* step and `onChangeEnd` once, so a consumer can wrap the whole drag in one undo entry. A
|
|
2820
|
+
* keyboard step or a typed commit is one complete gesture of its own.
|
|
2499
2821
|
*
|
|
2500
|
-
* Every stop carries an `id`, which
|
|
2501
|
-
*
|
|
2502
|
-
* `createColorStop` rather than writing the object by hand, so the id is unique.
|
|
2822
|
+
* Every stop carries an `id`, which keeps the right controls attached to the right stop as stops
|
|
2823
|
+
* are added, removed and reordered. Build stops with `createColorStop`.
|
|
2503
2824
|
* @param props - Component props
|
|
2504
|
-
* @param props.stops - The gradient's
|
|
2825
|
+
* @param props.stops - The gradient's color stops, when you drive the editor from your own state
|
|
2505
2826
|
* @param props.defaultStops - The stops the editor starts with when it keeps its own state
|
|
2506
2827
|
* @param props.direction - The angle the gradient runs at, when you drive the editor from your own state
|
|
2507
2828
|
* @param props.defaultDirection - The angle the editor starts at when it keeps its own state
|
|
2508
|
-
* @param props.showDirection - Whether to offer the direction
|
|
2829
|
+
* @param props.showDirection - Whether to offer the direction row
|
|
2509
2830
|
* @param props.onChange - Called whenever the gradient changes, with both halves of it
|
|
2510
2831
|
* @param props.onChangeStart - Called once when a change to a position or to the direction begins
|
|
2511
2832
|
* @param props.onChangeEnd - Called once when such a change settles, with the gradient it settled on
|
|
2512
2833
|
* @param props.minStops - The fewest stops the reader can reduce the gradient to
|
|
2513
2834
|
* @param props.maxStops - The most stops the reader can build up to
|
|
2514
|
-
* @
|
|
2835
|
+
* @param props.labels - English names for the flip and rotate buttons
|
|
2836
|
+
* @returns The gradient editor
|
|
2515
2837
|
* @example
|
|
2516
2838
|
* ```tsx
|
|
2517
2839
|
* const [stops, setStops] = useState([createColorStop(0, "#6366F1"), createColorStop(1, "#06B6D4")]);
|
|
@@ -2524,19 +2846,25 @@ export declare function getActivationMeta(event: ActivationEvent): ActivationMet
|
|
|
2524
2846
|
* setStops(nextStops);
|
|
2525
2847
|
* setAngle(nextAngle);
|
|
2526
2848
|
* }}
|
|
2527
|
-
* onChangeStart={() => history.begin()}
|
|
2528
|
-
* onChangeEnd={() => history.commit()}
|
|
2529
2849
|
* />
|
|
2530
2850
|
* ```
|
|
2531
2851
|
*/
|
|
2532
|
-
export declare function GradientEditor({ stops, defaultStops, direction, defaultDirection, showDirection, onChange, onChangeStart, onChangeEnd, minStops, maxStops, }: GradientEditorProps): default_2.JSX.Element;
|
|
2852
|
+
export declare function GradientEditor({ stops, defaultStops, direction, defaultDirection, showDirection, onChange, onChangeStart, onChangeEnd, minStops, maxStops, labels: labelOverrides, }: GradientEditorProps): default_2.JSX.Element;
|
|
2853
|
+
|
|
2854
|
+
/** The English names of the buttons Figma adds; every other string comes from the labels. */
|
|
2855
|
+
export declare interface GradientEditorLabels {
|
|
2856
|
+
/** The button that reverses the stops. */
|
|
2857
|
+
flip: string;
|
|
2858
|
+
/** The button that turns the gradient 90 degrees. */
|
|
2859
|
+
rotate: string;
|
|
2860
|
+
}
|
|
2533
2861
|
|
|
2534
2862
|
/**
|
|
2535
2863
|
* Props for the GradientEditor component.
|
|
2536
2864
|
*/
|
|
2537
2865
|
export declare interface GradientEditorProps {
|
|
2538
2866
|
/**
|
|
2539
|
-
* The gradient's
|
|
2867
|
+
* The gradient's color stops, when you drive the editor from your own
|
|
2540
2868
|
* state. Order them by `offset`; the editor keeps them in order as it
|
|
2541
2869
|
* works.
|
|
2542
2870
|
*/
|
|
@@ -2557,19 +2885,19 @@ export declare interface GradientEditorProps {
|
|
|
2557
2885
|
*/
|
|
2558
2886
|
defaultDirection?: number;
|
|
2559
2887
|
/**
|
|
2560
|
-
* Whether to offer the direction
|
|
2888
|
+
* Whether to offer the direction row: the angle field, flip and rotate.
|
|
2561
2889
|
* @default true
|
|
2562
2890
|
*/
|
|
2563
2891
|
showDirection?: boolean;
|
|
2564
2892
|
/**
|
|
2565
|
-
* Called whenever the gradient changes: a
|
|
2893
|
+
* Called whenever the gradient changes: a color, a position, a stop added
|
|
2566
2894
|
* or a stop removed.
|
|
2567
2895
|
*
|
|
2568
2896
|
* Both halves of the gradient are passed on every change, so a consumer
|
|
2569
2897
|
* never has to remember which one moved. The event that caused the change
|
|
2570
|
-
* is third and optional -- a drag and the
|
|
2898
|
+
* is third and optional -- a drag and the color picker report none.
|
|
2571
2899
|
*
|
|
2572
|
-
* While a
|
|
2900
|
+
* While a stop handle is being dragged this is called on every step. Use
|
|
2573
2901
|
* `onChangeEnd` if you want the settled value only.
|
|
2574
2902
|
*/
|
|
2575
2903
|
onChange?: (stops: ColorStop[], direction: number, event?: default_2.SyntheticEvent) => void;
|
|
@@ -2606,6 +2934,33 @@ export declare interface GradientEditorProps {
|
|
|
2606
2934
|
* @default 5
|
|
2607
2935
|
*/
|
|
2608
2936
|
maxStops?: number;
|
|
2937
|
+
/** Replace the English names of the flip and rotate buttons. */
|
|
2938
|
+
labels?: Partial<GradientEditorLabels>;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
/**
|
|
2942
|
+
* Figma's floating help button: a 32 x 32 circle on `--cm-bg` with the 200 elevation and no hover
|
|
2943
|
+
* change. Its tooltip shows and hides at once outside a Tooltip.Group; its focus ring (1px at -2px) fades in over 200ms.
|
|
2944
|
+
* It opens a dark menu of the caller's items, 4px above and end-aligned.
|
|
2945
|
+
* @param props - Component props
|
|
2946
|
+
* @param props.label - Accessible name and tooltip
|
|
2947
|
+
* @param props.children - The menu's items
|
|
2948
|
+
* @param props.menuProps - Extra props for the Mantine `Menu`
|
|
2949
|
+
* @param props.className - Extra class on the root
|
|
2950
|
+
* @returns The help button
|
|
2951
|
+
*/
|
|
2952
|
+
export declare function HelpButton({ label, children, menuProps, className, ...others }: HelpButtonProps): default_2.JSX.Element;
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* Props for the HelpButton component.
|
|
2956
|
+
*/
|
|
2957
|
+
export declare interface HelpButtonProps extends Omit<UnstyledButtonProps, "children">, Omit<ElementProps<"button">, "children"> {
|
|
2958
|
+
/** Accessible name and tooltip. Defaults to the "Help" label. */
|
|
2959
|
+
label?: string;
|
|
2960
|
+
/** The menu's items (`Menu.Item`, `Menu.Divider`, ...). Without any, the button opens nothing. */
|
|
2961
|
+
children?: default_2.ReactNode;
|
|
2962
|
+
/** Extra props for the Mantine `Menu` (its `opened`, `onChange`, ...). */
|
|
2963
|
+
menuProps?: Omit<MenuProps, "children">;
|
|
2609
2964
|
}
|
|
2610
2965
|
|
|
2611
2966
|
/**
|
|
@@ -2622,12 +2977,12 @@ export declare interface HistogramBin {
|
|
|
2622
2977
|
label: string;
|
|
2623
2978
|
/** How many things fell in this bin. The bar's height is this over the tallest bin's. */
|
|
2624
2979
|
count: number;
|
|
2625
|
-
/** Draws this bar in the accent
|
|
2980
|
+
/** Draws this bar in the accent color, for the bin the reader has selected or the one being explained. */
|
|
2626
2981
|
highlighted?: boolean;
|
|
2627
2982
|
}
|
|
2628
2983
|
|
|
2629
2984
|
/**
|
|
2630
|
-
* A distribution drawn instead of the four numbers that
|
|
2985
|
+
* A distribution drawn instead of the four numbers that summarize it.
|
|
2631
2986
|
*
|
|
2632
2987
|
* `min 2, median 3, max 4, standard deviation 0.62` is four numbers standing in
|
|
2633
2988
|
* for a shape. A histogram draws the shape in the same space, and answers what
|
|
@@ -2723,252 +3078,90 @@ export declare interface HistogramRowProps {
|
|
|
2723
3078
|
}
|
|
2724
3079
|
|
|
2725
3080
|
/**
|
|
2726
|
-
*
|
|
2727
|
-
*
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
* A 14px inline SVG that takes its colour from its parent, so the drawing
|
|
2744
|
-
* changes colour with the selection. Mark it `aria-hidden` -- the word
|
|
2745
|
-
* beside it is what names the option.
|
|
2746
|
-
*/
|
|
2747
|
-
icon: default_2.ReactNode;
|
|
2748
|
-
/**
|
|
2749
|
-
* Whether this option cannot be chosen.
|
|
2750
|
-
*
|
|
2751
|
-
* A disabled option is drawn dimmer, is skipped by the arrow keys and is
|
|
2752
|
-
* announced as unavailable.
|
|
2753
|
-
* @default false
|
|
2754
|
-
*/
|
|
2755
|
-
disabled?: boolean;
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
/**
|
|
2759
|
-
* A row of two to six mutually exclusive options drawn as pictures, in one
|
|
2760
|
-
* segmented track.
|
|
2761
|
-
*
|
|
2762
|
-
* Reach for it in place of a select whose whole option list is short and can be
|
|
2763
|
-
* drawn: node shapes, edge routing, layouts, scale curves. It costs the same
|
|
2764
|
-
* single row as the select and spends it better, because every alternative is
|
|
2765
|
-
* visible at rest instead of hidden behind a chevron.
|
|
2766
|
-
*
|
|
2767
|
-
* Stay inside the range. One option is a statement rather than a choice and
|
|
2768
|
-
* belongs in a field; more than six stop reading as a set of drawings. So does
|
|
2769
|
-
* any set whose options differ conceptually rather than visually, however few
|
|
2770
|
-
* of them there are -- those belong in a select, and a legible checkbox is
|
|
2771
|
-
* never worth converting into a pair of pictures. Outside two to six the row
|
|
2772
|
-
* still renders, and says so once in the console during development.
|
|
2773
|
-
*
|
|
2774
|
-
* Every option carries the word it would have been called. The word is not
|
|
2775
|
-
* drawn unless you ask for it, but it is always the option's accessible name
|
|
2776
|
-
* and its tooltip, so the row is operable by someone who cannot see the
|
|
2777
|
-
* drawings. Two things ask for it to be drawn as well: `hybrid`, which names
|
|
2778
|
-
* the selected option only, and `PanelLabelsProvider`, the application-wide
|
|
2779
|
-
* preference that puts a word beside every control in the panel.
|
|
2780
|
-
*
|
|
2781
|
-
* The group is a set of radio buttons, so Tab reaches it in one stop and lands
|
|
2782
|
-
* on the current choice, the arrow keys move the selection and the focus
|
|
2783
|
-
* together and follow the direction the text runs, Home and End jump to the
|
|
2784
|
-
* ends, and Space selects.
|
|
3081
|
+
* A circled "i" that reveals an explanation on hover, on focus or on tap.
|
|
3082
|
+
*
|
|
3083
|
+
* Use it where an explanation would otherwise become a sentence of its own on a
|
|
3084
|
+
* dense panel: put it immediately after the name of the thing it explains. Give
|
|
3085
|
+
* `label` that name -- the button is announced as "About " and the name, and
|
|
3086
|
+
* the explanation becomes the button's accessible description, so a screen
|
|
3087
|
+
* reader reads the two together.
|
|
3088
|
+
*
|
|
3089
|
+
* The bubble closes when the pointer leaves, when focus moves away, on Escape,
|
|
3090
|
+
* on a second tap, and when something else on the page is clicked. It shares
|
|
3091
|
+
* the page's floating layer with every other pop-out (Escape closes the
|
|
3092
|
+
* innermost open thing), but as a hover bubble it neither closes an open panel
|
|
3093
|
+
* nor is closed by one opening; when there is no `PopoutManager` above it, it
|
|
3094
|
+
* supplies its own and works standalone.
|
|
3095
|
+
*
|
|
3096
|
+
* Leave `opened` out and the bubble keeps its own state. Supply it, with
|
|
3097
|
+
* `onOpenChange`, to drive it from yours.
|
|
2785
3098
|
* @param props - Component props
|
|
2786
|
-
* @param props.
|
|
2787
|
-
* @param props.
|
|
2788
|
-
* @param props.
|
|
2789
|
-
* @param props.
|
|
2790
|
-
* @param props.
|
|
2791
|
-
* @
|
|
2792
|
-
* @param props.name - The name shared by the group's radio inputs
|
|
2793
|
-
* @param props.disabled - Whether the whole group cannot be used
|
|
2794
|
-
* @param props.disabledReason - One sentence saying why the group is off, drawn only while it is off
|
|
2795
|
-
* @param props.hybrid - Draw the word beside the drawing on the selected option only
|
|
2796
|
-
* @param props.width - How wide the track is drawn, or `"fill"` to take the rest of the row
|
|
2797
|
-
* @param props.trailing - The row's 24px trailing slot
|
|
2798
|
-
* @param props.onFocus - Called when the focus enters the group
|
|
2799
|
-
* @param props.onBlur - Called when the focus leaves the group
|
|
2800
|
-
* @returns The icon group row
|
|
3099
|
+
* @param props.children - The explanation, which becomes the button's accessible description
|
|
3100
|
+
* @param props.label - Names what is being explained, for the accessible name of the button
|
|
3101
|
+
* @param props.opened - Whether the bubble is open, when driven from your own state
|
|
3102
|
+
* @param props.defaultOpened - Whether the bubble starts open, when it keeps its own state
|
|
3103
|
+
* @param props.onOpenChange - Called when the bubble opens or closes, with the new state first
|
|
3104
|
+
* @returns The info circle and its bubble
|
|
2801
3105
|
* @example
|
|
2802
3106
|
* ```tsx
|
|
2803
|
-
* <
|
|
2804
|
-
*
|
|
2805
|
-
*
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
* ]}
|
|
2810
|
-
* value={shape}
|
|
2811
|
-
* onChange={(next) => { setShape(next); }}
|
|
2812
|
-
* />
|
|
3107
|
+
* <Group gap={4}>
|
|
3108
|
+
* <Text>Resolution</Text>
|
|
3109
|
+
* <InfoCircle label="Resolution">
|
|
3110
|
+
* Higher resolution finds more, smaller communities.
|
|
3111
|
+
* </InfoCircle>
|
|
3112
|
+
* </Group>
|
|
2813
3113
|
* ```
|
|
2814
3114
|
*/
|
|
2815
|
-
export declare function
|
|
3115
|
+
export declare function InfoCircle({ children, label, opened, defaultOpened, onOpenChange, }: InfoCircleProps): default_2.JSX.Element;
|
|
2816
3116
|
|
|
2817
3117
|
/**
|
|
2818
|
-
* Props for the
|
|
3118
|
+
* Props for the InfoCircle component.
|
|
2819
3119
|
*/
|
|
2820
|
-
export declare interface
|
|
2821
|
-
/**
|
|
2822
|
-
|
|
2823
|
-
/**
|
|
2824
|
-
|
|
2825
|
-
/**
|
|
2826
|
-
* The value selected before anything is chosen, when the row keeps its own
|
|
2827
|
-
* state. Defaults to the first option.
|
|
2828
|
-
*/
|
|
2829
|
-
defaultValue?: string;
|
|
2830
|
-
/**
|
|
2831
|
-
* Called with the newly selected value, and with the event that selected it
|
|
2832
|
-
* when a person did the selecting.
|
|
2833
|
-
*
|
|
2834
|
-
* The event is second and optional so that a change made in code is
|
|
2835
|
-
* expressible as `onChange(next)`.
|
|
2836
|
-
*/
|
|
2837
|
-
onChange?: ChangeHandler<string>;
|
|
2838
|
-
/**
|
|
2839
|
-
* What the whole group is for, such as `"Node shape"`.
|
|
2840
|
-
*
|
|
2841
|
-
* A group of radio buttons needs a name of its own: without one a screen
|
|
2842
|
-
* reader announces the options but never says what is being chosen. The
|
|
2843
|
-
* word is not drawn on the row -- give it here when nothing else on the
|
|
2844
|
-
* screen names the group, or use `labelledBy` when something does.
|
|
2845
|
-
*/
|
|
2846
|
-
label?: string;
|
|
2847
|
-
/**
|
|
2848
|
-
* The `id` of the element that names the group, such as the heading of the
|
|
2849
|
-
* section it sits in.
|
|
2850
|
-
*
|
|
2851
|
-
* Prefer this to `label` whenever the name is already on the screen, so
|
|
2852
|
-
* that the drawn name and the announced one cannot drift apart. When both
|
|
2853
|
-
* are given, this one wins.
|
|
2854
|
-
*/
|
|
2855
|
-
labelledBy?: string;
|
|
2856
|
-
/**
|
|
2857
|
-
* The name shared by the group's radio inputs, as an HTML form would use.
|
|
2858
|
-
*
|
|
2859
|
-
* One is generated when you leave it out. Set it to submit the choice with
|
|
2860
|
-
* a form, or to keep it stable between renders in a test.
|
|
2861
|
-
*/
|
|
2862
|
-
name?: string;
|
|
2863
|
-
/**
|
|
2864
|
-
* Whether the whole group cannot be used.
|
|
2865
|
-
*
|
|
2866
|
-
* Every option is drawn dimmer, none can be chosen, and the group is
|
|
2867
|
-
* skipped by the Tab key. To disable one option rather than all of them,
|
|
2868
|
-
* set `disabled` on that option.
|
|
2869
|
-
* @default false
|
|
2870
|
-
*/
|
|
2871
|
-
disabled?: boolean;
|
|
2872
|
-
/**
|
|
2873
|
-
* One sentence saying why the whole group is off, shown only while
|
|
2874
|
-
* `disabled` is true.
|
|
2875
|
-
*
|
|
2876
|
-
* It is appended to the group's own name after a full stop and drawn as the
|
|
2877
|
-
* row's tooltip -- "Node shape. Load data first" -- and it joins the
|
|
2878
|
-
* group's accessible description, so the reason reaches a pointer user and
|
|
2879
|
-
* a screen reader user alike. With no `label` to append to, the sentence
|
|
2880
|
-
* stands on its own.
|
|
2881
|
-
*
|
|
2882
|
-
* It says nothing about one option: a single unavailable choice is
|
|
2883
|
-
* `disabled` on that option, and its own word still names it. THE DEFECT
|
|
2884
|
-
* THIS REPAIRS: a whole group drawn dimmed with no explanation reads as a
|
|
2885
|
-
* broken control, which is what spec:6641 forbids -- and until now this row
|
|
2886
|
-
* had nowhere to put the one reason.
|
|
2887
|
-
*/
|
|
2888
|
-
disabledReason?: string;
|
|
2889
|
-
/**
|
|
2890
|
-
* Draw the word beside the drawing on the selected option only.
|
|
2891
|
-
*
|
|
2892
|
-
* Some option sets have names the panel cannot afford to hide -- layout
|
|
2893
|
-
* names, scale names, method names -- and drawing every word costs a row
|
|
2894
|
-
* the panel does not have. This names the current choice, leaves the
|
|
2895
|
-
* alternatives to be learned by trying them, and still fits one row. It
|
|
2896
|
-
* wants the 224px track: on the 108px one the words squeeze the drawings
|
|
2897
|
-
* down to nothing.
|
|
2898
|
-
* @default false
|
|
2899
|
-
*/
|
|
2900
|
-
hybrid?: boolean;
|
|
2901
|
-
/**
|
|
2902
|
-
* How wide the track is drawn, in pixels, or `"fill"` to take whatever the
|
|
2903
|
-
* row has left over.
|
|
2904
|
-
*
|
|
2905
|
-
* Defaults to the width the option count asks for: 108px for up to three
|
|
2906
|
-
* options and 224px for four to six. Use `"fill"` inside a container that
|
|
2907
|
-
* is not the 280px panel this library measures for.
|
|
2908
|
-
*/
|
|
2909
|
-
width?: number | "fill";
|
|
2910
|
-
/**
|
|
2911
|
-
* The row's 24px trailing slot: an advanced settings button, a control that
|
|
2912
|
-
* resets the row, or nothing.
|
|
2913
|
-
*/
|
|
2914
|
-
trailing?: default_2.ReactNode;
|
|
2915
|
-
/** Called when the focus enters the group, with the option that took it. */
|
|
2916
|
-
onFocus?: default_2.FocusEventHandler<HTMLDivElement>;
|
|
2917
|
-
/** Called when the focus leaves the group. */
|
|
2918
|
-
onBlur?: default_2.FocusEventHandler<HTMLDivElement>;
|
|
3120
|
+
export declare interface InfoCircleProps extends DisclosureProps {
|
|
3121
|
+
/** The explanation. Becomes the accessible description of the info button. */
|
|
3122
|
+
children: default_2.ReactNode;
|
|
3123
|
+
/** Names what is being explained, for the accessible name of the button. */
|
|
3124
|
+
label: string;
|
|
2919
3125
|
}
|
|
2920
3126
|
|
|
2921
3127
|
/**
|
|
2922
|
-
* A
|
|
3128
|
+
* A name edited in place: the 24px outlined field that replaces a layer, page or collection
|
|
3129
|
+
* name while it is renamed (design/figma-spec.md 10.3).
|
|
2923
3130
|
*
|
|
2924
|
-
*
|
|
2925
|
-
*
|
|
2926
|
-
*
|
|
2927
|
-
* the explanation becomes the button's accessible description, so a screen
|
|
2928
|
-
* reader reads the two together.
|
|
2929
|
-
*
|
|
2930
|
-
* The bubble closes when the pointer leaves, when focus moves away, on Escape,
|
|
2931
|
-
* on a second tap, and when something else on the page is clicked. It shares
|
|
2932
|
-
* the page's floating layer with every other pop-out, so opening one closes
|
|
2933
|
-
* whatever else was open at the same level; when there is no `PopoutManager`
|
|
2934
|
-
* above it, it supplies its own and works standalone.
|
|
2935
|
-
*
|
|
2936
|
-
* Leave `opened` out and the bubble keeps its own state. Supply it, with
|
|
2937
|
-
* `onOpenChange`, to drive it from yours.
|
|
3131
|
+
* It opens focused with the whole name selected. Enter commits and Escape cancels, and both
|
|
3132
|
+
* hand focus back to whatever held it before the field opened -- the row it came from. Leaving
|
|
3133
|
+
* the field any other way (a click elsewhere, Tab) commits and lets focus go where it was sent.
|
|
2938
3134
|
* @param props - Component props
|
|
2939
|
-
* @param props.
|
|
2940
|
-
* @param props.
|
|
2941
|
-
* @param props.
|
|
2942
|
-
* @param props.
|
|
2943
|
-
* @param props.
|
|
2944
|
-
* @returns The
|
|
2945
|
-
* @example
|
|
2946
|
-
* ```tsx
|
|
2947
|
-
* <Group gap={4}>
|
|
2948
|
-
* <Text>Resolution</Text>
|
|
2949
|
-
* <InfoCircle label="Resolution">
|
|
2950
|
-
* Higher resolution finds more, smaller communities.
|
|
2951
|
-
* </InfoCircle>
|
|
2952
|
-
* </Group>
|
|
2953
|
-
* ```
|
|
3135
|
+
* @param props.value - The current name
|
|
3136
|
+
* @param props.onCommit - Called once with the new name
|
|
3137
|
+
* @param props.onCancel - Called when Escape abandons the edit
|
|
3138
|
+
* @param props.label - The field's accessible name
|
|
3139
|
+
* @param props.width - The field's width
|
|
3140
|
+
* @returns The rename field
|
|
2954
3141
|
*/
|
|
2955
|
-
export declare function
|
|
3142
|
+
export declare function InlineRename({ value, onCommit, onCancel, label, width, }: InlineRenameProps): default_2.JSX.Element;
|
|
2956
3143
|
|
|
2957
3144
|
/**
|
|
2958
|
-
* Props for the
|
|
3145
|
+
* Props for the InlineRename component.
|
|
2959
3146
|
*/
|
|
2960
|
-
export declare interface
|
|
2961
|
-
/** The
|
|
2962
|
-
|
|
2963
|
-
/**
|
|
2964
|
-
|
|
3147
|
+
export declare interface InlineRenameProps {
|
|
3148
|
+
/** The current name. The field opens holding it, wholly selected. */
|
|
3149
|
+
value: string;
|
|
3150
|
+
/** Called once with the new name, on Enter or when the field loses focus. */
|
|
3151
|
+
onCommit: (name: string) => void;
|
|
3152
|
+
/** Called when Escape abandons the edit. */
|
|
3153
|
+
onCancel?: () => void;
|
|
3154
|
+
/** The field's accessible name. Defaults to "Name". */
|
|
3155
|
+
label?: string;
|
|
3156
|
+
/** The field's width: a number of pixels or any CSS length. Defaults to filling its slot. */
|
|
3157
|
+
width?: number | string;
|
|
2965
3158
|
}
|
|
2966
3159
|
|
|
2967
3160
|
/**
|
|
2968
3161
|
* Whether a value names a glyph in the closed field register.
|
|
2969
3162
|
*
|
|
2970
3163
|
* A field's `glyph` prop takes a register name, one of the five capital
|
|
2971
|
-
* letters, or an arbitrary node such as a
|
|
3164
|
+
* letters, or an arbitrary node such as a color swatch; this is how a row type
|
|
2972
3165
|
* tells the first case from the third.
|
|
2973
3166
|
* @param value - The candidate glyph
|
|
2974
3167
|
* @returns True when the value is a name in the closed field register
|
|
@@ -2978,13 +3171,21 @@ export declare function isFieldGlyphName(value: unknown): value is FieldGlyphNam
|
|
|
2978
3171
|
/**
|
|
2979
3172
|
* Whether a value is one of the five capital letters allowed in a field slot.
|
|
2980
3173
|
*
|
|
2981
|
-
* A letter draws as an 11px capital in the secondary text
|
|
3174
|
+
* A letter draws as an 11px capital in the secondary text color instead of an
|
|
2982
3175
|
* SVG, for a concept no drawing stands for.
|
|
2983
3176
|
* @param value - The candidate glyph
|
|
2984
3177
|
* @returns True when the value is one of `N`, `E`, `W`, `D` or `K`
|
|
2985
3178
|
*/
|
|
2986
3179
|
export declare function isFieldLetter(value: unknown): value is FieldLetter;
|
|
2987
3180
|
|
|
3181
|
+
/**
|
|
3182
|
+
* Whether a color is light enough to need the swatch ring Figma draws on
|
|
3183
|
+
* near-white colors (every channel at or above 0xE0).
|
|
3184
|
+
* @param color - a hex color
|
|
3185
|
+
* @returns true for near-white colors
|
|
3186
|
+
*/
|
|
3187
|
+
export declare function isLightColor(color: string): boolean;
|
|
3188
|
+
|
|
2988
3189
|
/**
|
|
2989
3190
|
* Whether text runs right to left.
|
|
2990
3191
|
* @param direction - The text direction in force
|
|
@@ -3070,6 +3271,36 @@ export declare const MAX_ALPHA_HEX = 255;
|
|
|
3070
3271
|
/** Maximum opacity percentage value */
|
|
3071
3272
|
export declare const MAX_OPACITY_PERCENT = 100;
|
|
3072
3273
|
|
|
3274
|
+
/**
|
|
3275
|
+
* A menu row with Figma's 16 x 16 check column (design/figma-spec.md 8.1): the
|
|
3276
|
+
* white 9 x 8.5 check shows when `checked` and is invisible (but keeps its
|
|
3277
|
+
* space) when not, so the labels of a menu's rows stay aligned 32px from its
|
|
3278
|
+
* edge. Use it inside a Mantine `Menu.Dropdown` beside ordinary items.
|
|
3279
|
+
* @param props - Component props
|
|
3280
|
+
* @param props.checked - Whether the row is checked
|
|
3281
|
+
* @param props.radio - Whether the row is one of a set of radio rows
|
|
3282
|
+
* @returns The menu row
|
|
3283
|
+
* @example
|
|
3284
|
+
* ```tsx
|
|
3285
|
+
* <Menu.Dropdown>
|
|
3286
|
+
* <MenuCheckItem checked={rulers} onClick={toggleRulers}>Rulers</MenuCheckItem>
|
|
3287
|
+
* <MenuCheckItem checked={grid} onClick={toggleGrid}>Pixel grid</MenuCheckItem>
|
|
3288
|
+
* </Menu.Dropdown>
|
|
3289
|
+
* ```
|
|
3290
|
+
*/
|
|
3291
|
+
export declare function MenuCheckItem({ checked, radio, ...props }: MenuCheckItemProps): JSX.Element;
|
|
3292
|
+
|
|
3293
|
+
/**
|
|
3294
|
+
* Props for MenuCheckItem: every `Menu.Item` prop except the leading section,
|
|
3295
|
+
* which is the check column, plus the checked state.
|
|
3296
|
+
*/
|
|
3297
|
+
export declare interface MenuCheckItemProps extends Omit<MenuItemProps, "leftSection">, Omit<ComponentPropsWithoutRef<"button">, keyof MenuItemProps | "role"> {
|
|
3298
|
+
/** Whether the row is checked: the white check shows in the 16px column. */
|
|
3299
|
+
checked: boolean;
|
|
3300
|
+
/** Render a `menuitemradio` (one of a set) instead of a `menuitemcheckbox`. */
|
|
3301
|
+
radio?: boolean;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3073
3304
|
/**
|
|
3074
3305
|
* One reading, with a bar for where it falls in its distribution and a chip for
|
|
3075
3306
|
* its rank.
|
|
@@ -3111,7 +3342,7 @@ export declare function MetricRow({ name, percentile, value, rank, busy, live, o
|
|
|
3111
3342
|
* Props for the MetricRow component.
|
|
3112
3343
|
*/
|
|
3113
3344
|
export declare interface MetricRowProps {
|
|
3114
|
-
/** The metric's own name. Shown at
|
|
3345
|
+
/** The metric's own name. Shown at 11px, and shortened with an ellipsis when the row is too narrow for it. */
|
|
3115
3346
|
name: string;
|
|
3116
3347
|
/** Where the value falls in its distribution, from 0 to 100. Values outside that range are clamped rather than drawn off the end of the bar. */
|
|
3117
3348
|
percentile: number;
|
|
@@ -3158,7 +3389,7 @@ export declare interface MetricRowProps {
|
|
|
3158
3389
|
* The event comes first, so you can read modifier keys for a multiple
|
|
3159
3390
|
* selection and call `preventDefault`. The second argument states whether
|
|
3160
3391
|
* the activation came from a pointer or from the keyboard, which is the
|
|
3161
|
-
* distinction selection
|
|
3392
|
+
* distinction selection behavior usually turns on.
|
|
3162
3393
|
*
|
|
3163
3394
|
* Supplying it makes the row a real button: focusable, with a pointer
|
|
3164
3395
|
* cursor, and answering Enter and Space.
|
|
@@ -3185,6 +3416,102 @@ export declare interface MetricRowProps {
|
|
|
3185
3416
|
onBlur?: default_2.FocusEventHandler<HTMLDivElement>;
|
|
3186
3417
|
}
|
|
3187
3418
|
|
|
3419
|
+
/**
|
|
3420
|
+
* The color a fraction of the way between two hex colors, channel by channel.
|
|
3421
|
+
* Used when a click on a gradient bar adds a stop between two others.
|
|
3422
|
+
* @param from - the color at 0
|
|
3423
|
+
* @param to - the color at 1
|
|
3424
|
+
* @param t - how far along, 0 to 1
|
|
3425
|
+
* @returns `#RRGGBB`, upper case
|
|
3426
|
+
*/
|
|
3427
|
+
export declare function mixHex(from: string, to: string, t: number): string;
|
|
3428
|
+
|
|
3429
|
+
/**
|
|
3430
|
+
* The button bar at the bottom of a Modal (design/figma-spec.md 8.5): 40 tall
|
|
3431
|
+
* across the modal's full width, a 1px divider above it, padding 0 8 0 16, its
|
|
3432
|
+
* buttons end-aligned 8px apart. Put it last inside the Modal's children, with
|
|
3433
|
+
* the secondary action (Cancel) first and the primary or danger action last.
|
|
3434
|
+
* @param props - Box props and div attributes
|
|
3435
|
+
* @param props.className - Extra classes, merged with the footer's own
|
|
3436
|
+
* @returns The footer
|
|
3437
|
+
* @example
|
|
3438
|
+
* ```tsx
|
|
3439
|
+
* <Modal opened={opened} onClose={close} title="Save to version history">
|
|
3440
|
+
* <TextInput data-autofocus aria-label="Title" />
|
|
3441
|
+
* <ModalFooter>
|
|
3442
|
+
* <Button variant="default" onClick={close}>Cancel</Button>
|
|
3443
|
+
* <Button disabled={!valid}>Save</Button>
|
|
3444
|
+
* </ModalFooter>
|
|
3445
|
+
* </Modal>
|
|
3446
|
+
* ```
|
|
3447
|
+
*/
|
|
3448
|
+
export declare function ModalFooter({ className, ...props }: ModalFooterProps): JSX.Element;
|
|
3449
|
+
|
|
3450
|
+
/**
|
|
3451
|
+
* Props for ModalFooter: a Box and any div attribute.
|
|
3452
|
+
*/
|
|
3453
|
+
export declare interface ModalFooterProps extends BoxProps, Omit<ComponentPropsWithoutRef<"div">, keyof BoxProps> {
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
/**
|
|
3457
|
+
* Apply a move that `Tree`'s `onMove` reported: take the item out of the list and insert it at
|
|
3458
|
+
* `index` among `parentId`'s children (the top level when `parentId` is null). Works on your own
|
|
3459
|
+
* item type, so every other field comes through untouched. Returns a new list; an unknown id
|
|
3460
|
+
* returns a copy of the list unchanged.
|
|
3461
|
+
* @param items - the tree, top level first
|
|
3462
|
+
* @param move - the move `onMove` reported
|
|
3463
|
+
* @returns the moved tree
|
|
3464
|
+
* @example
|
|
3465
|
+
* ```tsx
|
|
3466
|
+
* <Tree items={items} label="Layers" onMove={(move) => setItems(moveTreeItem(items, move))} />
|
|
3467
|
+
* ```
|
|
3468
|
+
*/
|
|
3469
|
+
export declare function moveTreeItem<T extends TreeLike<T>>(items: readonly T[], move: TreeMove): T[];
|
|
3470
|
+
|
|
3471
|
+
/** The navigation rail, with `NavRail.Separator`. */
|
|
3472
|
+
export declare const NavRail: typeof NavRailRoot & {
|
|
3473
|
+
Separator: typeof NavRailSeparator;
|
|
3474
|
+
};
|
|
3475
|
+
|
|
3476
|
+
/**
|
|
3477
|
+
* Props for the NavRail component.
|
|
3478
|
+
*/
|
|
3479
|
+
export declare interface NavRailProps extends BoxProps, ElementProps<"div"> {
|
|
3480
|
+
/** Accessible name of the rail. Defaults to the "Navigation" label. */
|
|
3481
|
+
"aria-label"?: string;
|
|
3482
|
+
/** Buttons pinned to the rail's foot, 8px apart (a 32 icon button with a notification dot). */
|
|
3483
|
+
footer?: default_2.ReactNode;
|
|
3484
|
+
/** Rail buttons and separators, top to bottom. */
|
|
3485
|
+
children?: default_2.ReactNode;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
/**
|
|
3489
|
+
* The vertical navigation rail at the window's start edge (Figma's navigation bar): 56 wide plus
|
|
3490
|
+
* a 1px end border, padding 8 top and 16 bottom, full height. One Tab stop; ArrowUp / ArrowDown /
|
|
3491
|
+
* Home / End move between its buttons, Enter or Space activates.
|
|
3492
|
+
* @param props - Component props
|
|
3493
|
+
* @param props.footer - Buttons pinned to the rail's foot
|
|
3494
|
+
* @param props.children - Rail buttons and separators
|
|
3495
|
+
* @param props.className - Extra class on the root
|
|
3496
|
+
* @param props.onKeyDown - Called before the roving-focus key handling
|
|
3497
|
+
* @param props.onFocus - Called before the roving-focus bookkeeping
|
|
3498
|
+
* @returns The rail
|
|
3499
|
+
*/
|
|
3500
|
+
declare function NavRailRoot({ footer, children, className, onKeyDown, onFocus, ...others }: NavRailProps): default_2.JSX.Element;
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* The rail's 16 x 1 separator (8px above, 7px below).
|
|
3504
|
+
* @returns The separator
|
|
3505
|
+
*/
|
|
3506
|
+
declare function NavRailSeparator(): default_2.JSX.Element;
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* Expand a 3-, 4-, 6- or 8-digit hex color into `#RRGGBBAA`, upper case.
|
|
3510
|
+
* @param color - a hex color, with or without `#`
|
|
3511
|
+
* @returns the 8-digit form, or `undefined` when the text is not a hex color
|
|
3512
|
+
*/
|
|
3513
|
+
export declare function normalizeHexa(color: string): string | undefined;
|
|
3514
|
+
|
|
3188
3515
|
/**
|
|
3189
3516
|
* Converts an opacity percentage (0-100) to a hex alpha string (00-ff).
|
|
3190
3517
|
* @param opacity - Opacity as a percentage from 0 to 100
|
|
@@ -3204,238 +3531,222 @@ export declare function opacityToAlphaHex(opacity: number): string;
|
|
|
3204
3531
|
*/
|
|
3205
3532
|
export declare type OpenChangeHandler = (opened: boolean, event?: default_2.SyntheticEvent) => void;
|
|
3206
3533
|
|
|
3534
|
+
/**
|
|
3535
|
+
* A page list (design/figma-spec.md 10.2): Figma's own accessible model, a one-column grid with
|
|
3536
|
+
* one Tab stop. ArrowUp / ArrowDown / Home / End move focus without switching; Enter, Space or a
|
|
3537
|
+
* click switches; F2 or a double-click renames when `onRename` is given.
|
|
3538
|
+
* @param props - Component props
|
|
3539
|
+
* @param props.items - The items or pages
|
|
3540
|
+
* @param props.current - The current page (controlled)
|
|
3541
|
+
* @param props.defaultCurrent - The current page to start with
|
|
3542
|
+
* @param props.onCurrentChange - Called when a page is switched to
|
|
3543
|
+
* @param props.tone - Page or group look
|
|
3544
|
+
* @param props.label - The accessible name
|
|
3545
|
+
* @param props.onRename - Called with a new name; turns renaming on
|
|
3546
|
+
* @param props.renameLabel - The rename field's accessible name
|
|
3547
|
+
* @returns The list
|
|
3548
|
+
*/
|
|
3549
|
+
export declare function PageList({ items, current, defaultCurrent, onCurrentChange, tone, label, onRename, renameLabel, }: PageListProps): default_2.JSX.Element;
|
|
3550
|
+
|
|
3551
|
+
/** One entry of a PageList. */
|
|
3552
|
+
export declare interface PageListItem {
|
|
3553
|
+
id: string;
|
|
3554
|
+
name: string;
|
|
3555
|
+
/** A divider row: drawn as a line, skipped by the arrow keys. */
|
|
3556
|
+
divider?: boolean;
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
/**
|
|
3560
|
+
* Props for the PageList component.
|
|
3561
|
+
*/
|
|
3562
|
+
export declare interface PageListProps {
|
|
3563
|
+
/** The pages, in order. */
|
|
3564
|
+
items: readonly PageListItem[];
|
|
3565
|
+
/** The current page (controlled). */
|
|
3566
|
+
current?: string;
|
|
3567
|
+
/** The current page to start with (uncontrolled). */
|
|
3568
|
+
defaultCurrent?: string;
|
|
3569
|
+
/** Called when a page is switched to, by click, Enter or Space. */
|
|
3570
|
+
onCurrentChange?: (id: string, event?: default_2.SyntheticEvent) => void;
|
|
3571
|
+
/** `"group"` draws the collection-group look (selected blue, weight 600). Default `"page"`. */
|
|
3572
|
+
tone?: "page" | "group";
|
|
3573
|
+
/** The list's accessible name. Defaults to "Pages". */
|
|
3574
|
+
label?: string;
|
|
3575
|
+
/** Called with a new name. Giving it turns on renaming (F2 or a double-click). */
|
|
3576
|
+
onRename?: (id: string, name: string) => void;
|
|
3577
|
+
/** The accessible name of the rename field. Defaults to "Page name". */
|
|
3578
|
+
renameLabel?: string;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
/**
|
|
3582
|
+
* One row of a page list (design/figma-spec.md 10.2): a 240 x 32 grid cell (padding 4 8) around
|
|
3583
|
+
* a 224 x 24 pill, text 16px in at 11/24. Hover fills the pill; the current page is gray and
|
|
3584
|
+
* weight 550. The cell carries the focus ring (1px, radius 5, offset 0).
|
|
3585
|
+
* @param props - Component props
|
|
3586
|
+
* @returns The row
|
|
3587
|
+
*/
|
|
3588
|
+
export declare const PageRow: default_2.ForwardRefExoticComponent<PageRowProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
3589
|
+
|
|
3590
|
+
/**
|
|
3591
|
+
* Props for the PageRow component.
|
|
3592
|
+
*/
|
|
3593
|
+
export declare interface PageRowProps extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children" | "onSelect"> {
|
|
3594
|
+
/** The page's name. Ignored by a divider row. */
|
|
3595
|
+
name: string;
|
|
3596
|
+
/** This is the page on screen (gray fill, weight 550; `aria-current="page"`). */
|
|
3597
|
+
current?: boolean;
|
|
3598
|
+
/** `"group"`: a selectable group in a collection list (selected blue, weight 600). */
|
|
3599
|
+
tone?: "page" | "group";
|
|
3600
|
+
/** For `tone="group"`: whether the group is selected. */
|
|
3601
|
+
selected?: boolean;
|
|
3602
|
+
/** Draw a divider line instead of a name. */
|
|
3603
|
+
divider?: boolean;
|
|
3604
|
+
/** Drawn in place of the name, e.g. an InlineRename. */
|
|
3605
|
+
nameSlot?: default_2.ReactNode;
|
|
3606
|
+
/** The focusable cell's tab index (PageList manages it). Default 0. */
|
|
3607
|
+
tabIndex?: number;
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3207
3610
|
/**
|
|
3208
3611
|
* The pixel grid every panel row is measured against.
|
|
3209
3612
|
*
|
|
3210
|
-
* All members are pixels. Import them; a literal `24`, `
|
|
3211
|
-
*
|
|
3212
|
-
*
|
|
3613
|
+
* All members are pixels. Import them; a literal `24`, `88` or `32` written into a component is
|
|
3614
|
+
* a bug, because it hides the fact that the number is part of one identity that has to keep
|
|
3615
|
+
* adding up to 240.
|
|
3213
3616
|
*/
|
|
3214
3617
|
export declare const PANEL_GRID: {
|
|
3215
|
-
/** the width of the panel column every row is laid out in */
|
|
3216
|
-
readonly WIDTH:
|
|
3618
|
+
/** the width of the panel column every row is laid out in (241 with its 1px edge) */
|
|
3619
|
+
readonly WIDTH: 240;
|
|
3217
3620
|
/** left panel padding: where the content band begins */
|
|
3218
3621
|
readonly PAD_LEFT: 16;
|
|
3219
|
-
/** right panel padding
|
|
3622
|
+
/** right panel padding */
|
|
3220
3623
|
readonly PAD_RIGHT: 8;
|
|
3221
|
-
/** x 16 to x
|
|
3222
|
-
readonly CONTENT:
|
|
3223
|
-
/** a control that
|
|
3224
|
-
readonly BODY:
|
|
3624
|
+
/** x 16 to x 232 */
|
|
3625
|
+
readonly CONTENT: 216;
|
|
3626
|
+
/** a control that spans both fields and still leaves a trailing slot */
|
|
3627
|
+
readonly BODY: 184;
|
|
3225
3628
|
/** one of a pair */
|
|
3226
|
-
readonly FIELD:
|
|
3629
|
+
readonly FIELD: 88;
|
|
3227
3630
|
/** between the two fields of a pair */
|
|
3228
3631
|
readonly GUTTER: 8;
|
|
3229
3632
|
/** between the body and the trailing slot */
|
|
3230
3633
|
readonly TRAIL_GAP: 8;
|
|
3231
|
-
/** the fixed trailing slot at x
|
|
3634
|
+
/** the fixed trailing slot at x 208..232: an advanced settings button, a reset control, or nothing */
|
|
3232
3635
|
readonly TRAIL: 24;
|
|
3233
|
-
/** one of three
|
|
3234
|
-
readonly TRIPLE:
|
|
3235
|
-
/** between two
|
|
3236
|
-
readonly TRIPLE_GAP:
|
|
3636
|
+
/** one of three segments: the body shared three ways, no gaps */
|
|
3637
|
+
readonly TRIPLE: number;
|
|
3638
|
+
/** between two segments: joined */
|
|
3639
|
+
readonly TRIPLE_GAP: 0;
|
|
3237
3640
|
/** every field, button and icon button in a panel row */
|
|
3238
3641
|
readonly CONTROL_HEIGHT: 24;
|
|
3239
|
-
/** 24px control
|
|
3642
|
+
/** a single row: a 24px control in a 32px row */
|
|
3240
3643
|
readonly ROW_PITCH: 32;
|
|
3241
|
-
/**
|
|
3242
|
-
readonly TOGGLE_PITCH:
|
|
3243
|
-
/** a
|
|
3244
|
-
readonly DATA_PITCH:
|
|
3245
|
-
/** the section header row
|
|
3246
|
-
readonly SECTION_HEADER:
|
|
3644
|
+
/** a checkbox row in a panel (24 in dialogs) */
|
|
3645
|
+
readonly TOGGLE_PITCH: 32;
|
|
3646
|
+
/** list and tree rows: a 24 pill in a 32 row */
|
|
3647
|
+
readonly DATA_PITCH: 32;
|
|
3648
|
+
/** the section header row */
|
|
3649
|
+
readonly SECTION_HEADER: 40;
|
|
3247
3650
|
/** the pad below a section's last content row */
|
|
3248
|
-
readonly SECTION_PAD_BOTTOM:
|
|
3249
|
-
/**
|
|
3250
|
-
readonly GLYPH_SLOT:
|
|
3251
|
-
/** the drawn size of a glyph inside its slot */
|
|
3252
|
-
readonly GLYPH:
|
|
3253
|
-
/** the
|
|
3254
|
-
readonly CHEVRON:
|
|
3651
|
+
readonly SECTION_PAD_BOTTOM: 12;
|
|
3652
|
+
/** a field's leading slot, and the scrub handle */
|
|
3653
|
+
readonly GLYPH_SLOT: 24;
|
|
3654
|
+
/** the nominal drawn size of a glyph inside its slot (10-14 allowed) */
|
|
3655
|
+
readonly GLYPH: 12;
|
|
3656
|
+
/** the box of a chevron, an X and a reset; carets are drawn 5 x 3 inside it */
|
|
3657
|
+
readonly CHEVRON: 10;
|
|
3255
3658
|
/** the value text begins here, measured from the field's leading edge */
|
|
3256
3659
|
readonly VALUE_INSET: 24;
|
|
3257
3660
|
/** one row pitch of chart */
|
|
3258
3661
|
readonly SPARKLINE_HEIGHT: 32;
|
|
3259
3662
|
/** two row pitches of chart */
|
|
3260
3663
|
readonly HISTOGRAM_HEIGHT: 64;
|
|
3261
|
-
/** the label column
|
|
3262
|
-
readonly LABEL_COLUMN:
|
|
3664
|
+
/** the label column of a popover row (64-72) */
|
|
3665
|
+
readonly LABEL_COLUMN: 72;
|
|
3666
|
+
/** a field row with a legend: 16 legend + 4 + 24 control + 4 */
|
|
3667
|
+
readonly FIELD_ROW: 48;
|
|
3668
|
+
/** a 9/14 caption above each column + 3 + 24 */
|
|
3669
|
+
readonly CAPTION_ROW: 50;
|
|
3670
|
+
/** the legend band */
|
|
3671
|
+
readonly LEGEND: 16;
|
|
3672
|
+
/** a light popover's default width */
|
|
3673
|
+
readonly POPOVER_WIDTH: 240;
|
|
3674
|
+
/** a popover or modal header */
|
|
3675
|
+
readonly POPOVER_HEADER: 40;
|
|
3263
3676
|
};
|
|
3264
3677
|
|
|
3265
3678
|
/**
|
|
3266
|
-
* The panel ink map: one
|
|
3267
|
-
* paints.
|
|
3268
|
-
*
|
|
3269
|
-
* Every colour a row type paints comes from here, so the same component reads
|
|
3270
|
-
* correctly in the light scheme, in the dark scheme and under a consumer's own
|
|
3271
|
-
* primary colour. A raw hex written into a component is a defect that shows up
|
|
3272
|
-
* in only one of the two schemes.
|
|
3679
|
+
* The panel ink map: one `--cm-*` token per color role a panel row paints (spec 2.2).
|
|
3273
3680
|
*
|
|
3274
|
-
*
|
|
3275
|
-
*
|
|
3276
|
-
*
|
|
3277
|
-
* beside them.
|
|
3681
|
+
* Every value resolves per element from its `color-scheme`, so the same component reads
|
|
3682
|
+
* correctly in light, in dark, inside a dark-scoped menu, and in the AA mode. Light / dark hex
|
|
3683
|
+
* values are quoted in the notes.
|
|
3278
3684
|
*/
|
|
3279
3685
|
export declare const PANEL_INK: {
|
|
3280
|
-
/** primary text:
|
|
3281
|
-
readonly VALUE: "var(--
|
|
3282
|
-
/**
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
readonly
|
|
3292
|
-
/**
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
readonly
|
|
3312
|
-
/**
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
* token move.
|
|
3345
|
-
*/
|
|
3346
|
-
readonly SURFACE: "light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))";
|
|
3347
|
-
/** the panel itself, and therefore the hairline that divides a compound row (#1f2428) */
|
|
3348
|
-
readonly PANEL: "var(--mantine-color-body)";
|
|
3349
|
-
/**
|
|
3350
|
-
* the raised surface: the ground under a small chip's label, and the track
|
|
3351
|
-
* a bar's fill runs along (#374047).
|
|
3352
|
-
*
|
|
3353
|
-
* One step further from the panel than `SURFACE`, in the same direction.
|
|
3354
|
-
* Like `SURFACE` it flips between the schemes, which
|
|
3355
|
-
* `--mantine-color-default-hover` does not -- in the light scheme that
|
|
3356
|
-
* token is #f8f9fa and would be indistinguishable from the surface under
|
|
3357
|
-
* it.
|
|
3358
|
-
*
|
|
3359
|
-
* This is not the ground of a selected item; that is `SELECTED`. The two
|
|
3360
|
-
* pull in opposite directions and cannot be one value. A raised ground has
|
|
3361
|
-
* things drawn *on* it -- a chip's label, a bar's coloured fill -- so in
|
|
3362
|
-
* the dark scheme it has to stay dark enough for those to stay legible. A
|
|
3363
|
-
* selected item is the other way round: it has to separate from the track
|
|
3364
|
-
* around it, which in the dark scheme means going lighter. Lifting this
|
|
3365
|
-
* token to serve a selected item is what made a chip's label and a bar's
|
|
3366
|
-
* fill unreadable, so the two roles are two tokens.
|
|
3367
|
-
*
|
|
3368
|
-
* Two pairings on this token are still short of WCAG AA, and neither can
|
|
3369
|
-
* be fixed by moving it. A chip labelled in the secondary text colour
|
|
3370
|
-
* measures 4.43:1 in the dark scheme against the 4.5:1 for text; the same
|
|
3371
|
-
* chip labelled in the primary text colour measures 7.33:1. An accent fill
|
|
3372
|
-
* on this track measures 2.11:1 (dark) and 2.73:1 (light) against the 3:1
|
|
3373
|
-
* for a shape that carries meaning; the same fill on the panel measures
|
|
3374
|
-
* 3.12:1 and 3.56:1. Both are settled where they are drawn, by choosing
|
|
3375
|
-
* the ink or the ground, not by another value here.
|
|
3376
|
-
*/
|
|
3377
|
-
readonly RAISED: "light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5))";
|
|
3378
|
-
/**
|
|
3379
|
-
* the ground of the selected item in a group: the checked segment of a
|
|
3380
|
-
* segmented control, the current tile of an icon group, the active choice
|
|
3381
|
-
* in a set of buttons.
|
|
3382
|
-
*
|
|
3383
|
-
* It inverts -- light in the dark scheme, dark in the light scheme -- so a
|
|
3384
|
-
* selected item reads as a solid patch against its track rather than as a
|
|
3385
|
-
* slightly different shade of it. Against `SURFACE`, which is what a track
|
|
3386
|
-
* is painted with, it measures 5.59:1 in the dark scheme and 7.35:1 in the
|
|
3387
|
-
* light one, past the 3:1 that WCAG 2.2 (1.4.11) asks of the visual
|
|
3388
|
-
* boundary that distinguishes a control's state. Against the panel it
|
|
3389
|
-
* measures 6.56:1 and 8.18:1, so it also survives a selected item that
|
|
3390
|
-
* sits directly on the panel.
|
|
3391
|
-
*
|
|
3392
|
-
* Label it with `ON_SELECTED` rather than `VALUE`: a ground bright enough
|
|
3393
|
-
* to satisfy 1.4.11 against its track is too bright to carry the primary
|
|
3394
|
-
* text colour, which measures only 1.66:1 on it in the dark scheme.
|
|
3395
|
-
*
|
|
3396
|
-
* See `RAISED` for why the selected state and the raised surface are not
|
|
3397
|
-
* one token.
|
|
3398
|
-
*/
|
|
3399
|
-
readonly SELECTED: "light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1))";
|
|
3400
|
-
/**
|
|
3401
|
-
* the text and glyphs drawn on `SELECTED`.
|
|
3402
|
-
*
|
|
3403
|
-
* The panel's own colour, so the label of a selected item reads as a shape
|
|
3404
|
-
* punched out of a solid patch. It measures 6.56:1 against `SELECTED` in
|
|
3405
|
-
* the dark scheme and 8.18:1 in the light one, past the 4.5:1 WCAG AA
|
|
3406
|
-
* (1.4.3) requirement for text.
|
|
3407
|
-
*/
|
|
3408
|
-
readonly ON_SELECTED: "var(--mantine-color-body)";
|
|
3409
|
-
/**
|
|
3410
|
-
* borders, chart bars and the chart baseline.
|
|
3411
|
-
*
|
|
3412
|
-
* Lifted from the #48525c of the original palette, which measured 1.97:1
|
|
3413
|
-
* on the panel against the 3:1 WCAG AA requirement for meaningful non-text
|
|
3414
|
-
* such as a chart bar. This is the dimmest step of the palette that meets
|
|
3415
|
-
* 3:1 on the panel in both colour schemes.
|
|
3416
|
-
*/
|
|
3417
|
-
readonly BORDER: "light-dark(var(--mantine-color-gray-6), var(--mantine-color-dark-2))";
|
|
3418
|
-
/** the 1px rule above a section header, at the weight of `BORDER` */
|
|
3419
|
-
readonly DIVIDER: "light-dark(var(--mantine-color-gray-6), var(--mantine-color-dark-2))";
|
|
3420
|
-
/**
|
|
3421
|
-
* accent: a checked box, the highlighted bin, a filled micro-bar, the Run
|
|
3422
|
-
* button (#1971c2 in the dark scheme, #228be6 in the light one).
|
|
3423
|
-
*
|
|
3424
|
-
* This token and `ON_ACCENT` follow a consumer's own `primaryColor`;
|
|
3425
|
-
* `WARNING`, `SUCCESS` and `DANGER` are stock Mantine yellow, green and
|
|
3426
|
-
* red. The theme replaces only the `dark` ramp and sets no `primaryColor`,
|
|
3427
|
-
* so none of the five is overridden here, and a consumer who sets one gets
|
|
3428
|
-
* it throughout.
|
|
3429
|
-
*/
|
|
3430
|
-
readonly ACCENT: "var(--mantine-primary-color-filled)";
|
|
3431
|
-
/** text and glyphs drawn on the accent (#ffffff) */
|
|
3432
|
-
readonly ON_ACCENT: "var(--mantine-primary-color-contrast)";
|
|
3433
|
-
/** the warning glyph on a departure line (#fab005) */
|
|
3434
|
-
readonly WARNING: "var(--mantine-color-yellow-6)";
|
|
3435
|
-
/** success (#40c057) */
|
|
3436
|
-
readonly SUCCESS: "var(--mantine-color-green-6)";
|
|
3437
|
-
/** danger (#fa5252) */
|
|
3438
|
-
readonly DANGER: "var(--mantine-color-red-6)";
|
|
3686
|
+
/** primary text: a field's value, a row's name (#000000e5 / #fff) */
|
|
3687
|
+
readonly VALUE: "var(--cm-text)";
|
|
3688
|
+
/** secondary text: glyph labels, unit suffixes, legends (#00000080 / #ffffffb2) */
|
|
3689
|
+
readonly CHROME: "var(--cm-text-secondary)";
|
|
3690
|
+
/** reading prose (secondary text) */
|
|
3691
|
+
readonly PROSE: "var(--cm-text-secondary)";
|
|
3692
|
+
/** placeholder text (#0000004d / #ffffff66; darker in the AA mode) */
|
|
3693
|
+
readonly PLACEHOLDER: "var(--cm-text-tertiary)";
|
|
3694
|
+
/** the text and glyphs of a control that cannot be operated (exempt from contrast minimums) */
|
|
3695
|
+
readonly DISABLED: "var(--cm-text-disabled)";
|
|
3696
|
+
/** a field's fill, a segmented track (#f5f5f5 / #383838) */
|
|
3697
|
+
readonly SURFACE: "var(--cm-bg-secondary)";
|
|
3698
|
+
/** the panel itself (#fff / #2c2c2c) */
|
|
3699
|
+
readonly PANEL: "var(--cm-bg)";
|
|
3700
|
+
/** a raised or pressed ground: a chip's label ground, a bar's track (#e6e6e6 / #444) */
|
|
3701
|
+
readonly RAISED: "var(--cm-bg-pressed)";
|
|
3702
|
+
/** a selected item's ground (#e5f4ff / #394360) */
|
|
3703
|
+
readonly SELECTED: "var(--cm-bg-selected)";
|
|
3704
|
+
/** the glyph on a selected item (#007be5 / #7cc4f8) */
|
|
3705
|
+
readonly ON_SELECTED: "var(--cm-icon-brand)";
|
|
3706
|
+
/** borders, chart bars, the chart baseline (#e6e6e6 / #444) */
|
|
3707
|
+
readonly BORDER: "var(--cm-border)";
|
|
3708
|
+
/** the 1px divider (#e6e6e6 / #444) */
|
|
3709
|
+
readonly DIVIDER: "var(--cm-border)";
|
|
3710
|
+
/** a filled accent surface: primary button, checked box (#0d99ff / #0c8ce9) */
|
|
3711
|
+
readonly ACCENT: "var(--cm-bg-brand)";
|
|
3712
|
+
/** text and glyphs on the accent (#fff) */
|
|
3713
|
+
readonly ON_ACCENT: "var(--cm-text-onbrand)";
|
|
3714
|
+
/** warning (#ffcd29 / #f3c11b) */
|
|
3715
|
+
readonly WARNING: "var(--cm-bg-warning)";
|
|
3716
|
+
/** success (#14ae5c / #198f51) */
|
|
3717
|
+
readonly SUCCESS: "var(--cm-bg-success)";
|
|
3718
|
+
/** danger (#f24822 / #e03e1a) */
|
|
3719
|
+
readonly DANGER: "var(--cm-bg-danger)";
|
|
3720
|
+
/** a row, tab or tool under the pointer (#f5f5f5 / #383838) */
|
|
3721
|
+
readonly HOVER: "var(--cm-bg-hover)";
|
|
3722
|
+
/** pressed (#e6e6e6 / #444) */
|
|
3723
|
+
readonly PRESSED: "var(--cm-bg-pressed)";
|
|
3724
|
+
/** translucent hover over any ground (#0000000d / #ffffff0d) */
|
|
3725
|
+
readonly TRANSPARENT_HOVER: "var(--cm-bg-transparent-hover)";
|
|
3726
|
+
/** translucent pressed over any ground (#0000001a / #ffffff1a) */
|
|
3727
|
+
readonly TRANSPARENT_PRESSED: "var(--cm-bg-transparent-pressed)";
|
|
3728
|
+
/** a selected item under the pointer (#bde3ff / #4a5878) */
|
|
3729
|
+
readonly SELECTED_HOVER: "var(--cm-bg-selected-hover)";
|
|
3730
|
+
/** the children of a selected item (#f2f9ff / #32394d) */
|
|
3731
|
+
readonly SELECTED_SECONDARY: "var(--cm-bg-selected-secondary)";
|
|
3732
|
+
/** links and brand text (#007be5 / #7cc4f8) */
|
|
3733
|
+
readonly BRAND_TEXT: "var(--cm-text-brand)";
|
|
3734
|
+
/** tertiary glyphs (#0000004d / #ffffff66) */
|
|
3735
|
+
readonly TERTIARY: "var(--cm-icon-tertiary)";
|
|
3736
|
+
/** the focus ring (#0d99ff / #0c8ce9) */
|
|
3737
|
+
readonly FOCUS: "var(--cm-border-selected)";
|
|
3738
|
+
/** a translucent hairline: secondary button, panel edge (#0000001a / #ffffff1a) */
|
|
3739
|
+
readonly TRANSLUCENT: "var(--cm-border-translucent)";
|
|
3740
|
+
/** a stronger translucent edge: checkbox, switch track (#00000033 / #ffffff33) */
|
|
3741
|
+
readonly TRANSLUCENT_STRONG: "var(--cm-border-translucent-strong)";
|
|
3742
|
+
/** the dark menu surface, the same in both schemes (#1e1e1e) */
|
|
3743
|
+
readonly MENU: "var(--cm-bg-menu)";
|
|
3744
|
+
/** text on the menu (#fff) */
|
|
3745
|
+
readonly ON_MENU: "var(--cm-text-menu)";
|
|
3746
|
+
/** secondary text on the menu: shortcuts (#ffffffb2) */
|
|
3747
|
+
readonly ON_MENU_SECONDARY: "var(--cm-text-menu-secondary)";
|
|
3748
|
+
/** component (purple) text (#8638e5 / #d1a8ff) */
|
|
3749
|
+
readonly COMPONENT: "var(--cm-text-component)";
|
|
3439
3750
|
};
|
|
3440
3751
|
|
|
3441
3752
|
/**
|
|
@@ -3458,11 +3769,13 @@ export declare const PANEL_INK: {
|
|
|
3458
3769
|
* (`placeholder`), offer a list of choices (`kind="select"`), or have been set
|
|
3459
3770
|
* without taking effect yet (`pending`).
|
|
3460
3771
|
*
|
|
3461
|
-
* The glyph slot is also a drag handle.
|
|
3462
|
-
*
|
|
3463
|
-
*
|
|
3464
|
-
*
|
|
3465
|
-
*
|
|
3772
|
+
* The glyph slot is also a drag handle. A number field scrubs itself: dragging
|
|
3773
|
+
* the glyph sideways moves the value half a unit per pixel, with the page
|
|
3774
|
+
* cursor held at `ew-resize`, and commits once on release. Give any field
|
|
3775
|
+
* `onScrubStart`, `onScrub` and `onScrubEnd` and the drag reports how far the
|
|
3776
|
+
* pointer moved instead, with the start and end marking one interaction so a
|
|
3777
|
+
* drag becomes a single undo entry. Dragging is a shortcut, not the only way
|
|
3778
|
+
* in: the same value can always be typed.
|
|
3466
3779
|
* @example
|
|
3467
3780
|
* ```tsx
|
|
3468
3781
|
* const [size, setSize] = useState("1.0");
|
|
@@ -3485,12 +3798,17 @@ export declare const PanelField: default_2.ForwardRefExoticComponent<PanelFieldP
|
|
|
3485
3798
|
* What a field holds, and therefore which control it draws.
|
|
3486
3799
|
*
|
|
3487
3800
|
* - `"text"` -- a text box. The default.
|
|
3488
|
-
* - `"number"` --
|
|
3489
|
-
*
|
|
3490
|
-
*
|
|
3491
|
-
*
|
|
3492
|
-
*
|
|
3493
|
-
*
|
|
3801
|
+
* - `"number"` -- Figma's scrubbable number box. Typing applies nothing until
|
|
3802
|
+
* Enter, Tab or blur, and may be arithmetic (`40*2`); anything that does not
|
|
3803
|
+
* evaluate reverts. Up and down arrows step the value at once (Shift: ten
|
|
3804
|
+
* steps). Dragging the glyph slot scrubs the value at half a unit per pixel
|
|
3805
|
+
* and commits once on release. Digits and the decimal separator follow the
|
|
3806
|
+
* reader's locale.
|
|
3807
|
+
* - `"select"` -- a drop-down, drawn as Figma's outlined select trigger. Pass
|
|
3808
|
+
* `data` with the choices to get a real drop-down list, which opens over the
|
|
3809
|
+
* field with the current choice on top of it; with no `data` the field draws
|
|
3810
|
+
* the caret but opens nothing of its own, which is what you want when
|
|
3811
|
+
* `onClick` opens a panel you have built yourself.
|
|
3494
3812
|
*/
|
|
3495
3813
|
export declare type PanelFieldKind = "text" | "number" | "select";
|
|
3496
3814
|
|
|
@@ -3517,7 +3835,7 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3517
3835
|
*
|
|
3518
3836
|
* Pass the name of one of the built-in field glyphs, one of the five
|
|
3519
3837
|
* capital letters `N`, `E`, `W`, `D` or `K`, or your own node such as a
|
|
3520
|
-
*
|
|
3838
|
+
* color swatch. A bare string is deliberately not accepted: the slot holds
|
|
3521
3839
|
* a drawing, not a word.
|
|
3522
3840
|
*/
|
|
3523
3841
|
glyph?: FieldGlyphName | FieldLetter | Exclude<default_2.ReactNode, string>;
|
|
@@ -3541,9 +3859,9 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3541
3859
|
* Called when the value changes, with the new value first and the event that
|
|
3542
3860
|
* caused it second where there is one.
|
|
3543
3861
|
*
|
|
3544
|
-
* A text field and a drop-down
|
|
3545
|
-
*
|
|
3546
|
-
*
|
|
3862
|
+
* A text field reports every keystroke and a drop-down each choice, as a
|
|
3863
|
+
* string. A number field reports a number once per commit: Enter, Tab or
|
|
3864
|
+
* blur after typing, each arrow step, and the release of a scrub.
|
|
3547
3865
|
*/
|
|
3548
3866
|
onChange?: ChangeHandler<string | number>;
|
|
3549
3867
|
/**
|
|
@@ -3555,12 +3873,12 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3555
3873
|
*/
|
|
3556
3874
|
data?: ComboboxData;
|
|
3557
3875
|
/**
|
|
3558
|
-
* A short unit shown after the value, in the secondary text
|
|
3876
|
+
* A short unit shown after the value, in the secondary text color, at the
|
|
3559
3877
|
* end of the same box -- "%", "px" per second, a count of links.
|
|
3560
3878
|
*/
|
|
3561
3879
|
unit?: string;
|
|
3562
3880
|
/**
|
|
3563
|
-
* How wide the field is:
|
|
3881
|
+
* How wide the field is: 88 for one of a pair, 184 for a field that spans
|
|
3564
3882
|
* the body of a row, or `"fill"` to take whatever width its container gives
|
|
3565
3883
|
* it.
|
|
3566
3884
|
*/
|
|
@@ -3583,7 +3901,7 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3583
3901
|
*/
|
|
3584
3902
|
mixed?: boolean;
|
|
3585
3903
|
/**
|
|
3586
|
-
* The text shown in an empty field, in the placeholder
|
|
3904
|
+
* The text shown in an empty field, in the placeholder color.
|
|
3587
3905
|
*
|
|
3588
3906
|
* Passing `true` instead of a string is the older spelling: it moves
|
|
3589
3907
|
* whatever is in `value` into the placeholder, which is what a field
|
|
@@ -3602,8 +3920,14 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3602
3920
|
min?: number;
|
|
3603
3921
|
/** The largest value a number field accepts. */
|
|
3604
3922
|
max?: number;
|
|
3605
|
-
/** How much one press of an arrow key changes a number field. */
|
|
3923
|
+
/** How much one press of an arrow key changes a number field. Shift moves ten. */
|
|
3606
3924
|
step?: number;
|
|
3925
|
+
/**
|
|
3926
|
+
* What a number field says about its arrow keys, after its name and value,
|
|
3927
|
+
* as its `aria-description`. Pass an empty string to say nothing.
|
|
3928
|
+
* @default "Use arrow keys to change the value"
|
|
3929
|
+
*/
|
|
3930
|
+
stepHint?: string;
|
|
3607
3931
|
/**
|
|
3608
3932
|
* Called once when a drag of the glyph slot begins, on the first movement
|
|
3609
3933
|
* rather than on the press.
|
|
@@ -3620,9 +3944,13 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
3620
3944
|
* The distance is positive when the pointer moves in the direction the text
|
|
3621
3945
|
* runs -- to the right in English, to the left in Arabic or Hebrew -- so
|
|
3622
3946
|
* dragging forwards always raises the value.
|
|
3947
|
+
*
|
|
3948
|
+
* A number field scrubs on its own (half a unit per pixel, one `onChange`
|
|
3949
|
+
* on release). Pass `onScrub` to take the value over yourself: the field
|
|
3950
|
+
* then reports the distances and changes nothing.
|
|
3623
3951
|
*/
|
|
3624
3952
|
onScrub?: GestureChangeHandler;
|
|
3625
|
-
/** Called once when a drag of the glyph slot finishes or is
|
|
3953
|
+
/** Called once when a drag of the glyph slot finishes or is canceled. Close the undo transaction here. */
|
|
3626
3954
|
onScrubEnd?: GestureEndHandler;
|
|
3627
3955
|
/**
|
|
3628
3956
|
* Called when the field is activated by a click or by pressing Enter.
|
|
@@ -3737,17 +4065,19 @@ export declare const Popout: typeof PopoutRoot & {
|
|
|
3737
4065
|
|
|
3738
4066
|
/**
|
|
3739
4067
|
* Gap in pixels between trigger and panel for root-level popouts.
|
|
4068
|
+
*
|
|
4069
|
+
* Zero: Figma docks a light popover flush against the panel it opened from (its end edge on the
|
|
4070
|
+
* panel's start border), design/figma-spec.md 8.4.
|
|
3740
4071
|
*/
|
|
3741
|
-
export declare const POPOUT_GAP =
|
|
4072
|
+
export declare const POPOUT_GAP = 0;
|
|
3742
4073
|
|
|
3743
4074
|
/**
|
|
3744
4075
|
* Gap in pixels between a pop-out panel and the panel it opened from.
|
|
3745
4076
|
*
|
|
3746
|
-
*
|
|
3747
|
-
*
|
|
3748
|
-
* reads as a stack rather than as several panels that happen to overlap.
|
|
4077
|
+
* Zero: a child popout docks flush to the start of its parent, as Figma's create-style dialog
|
|
4078
|
+
* docks against the color picker (design/figma-spec.md 8.4).
|
|
3749
4079
|
*/
|
|
3750
|
-
export declare const POPOUT_NESTED_GAP =
|
|
4080
|
+
export declare const POPOUT_NESTED_GAP = 0;
|
|
3751
4081
|
|
|
3752
4082
|
/**
|
|
3753
4083
|
* Z-index base value for popout panels.
|
|
@@ -3760,7 +4090,7 @@ export declare const POPOUT_Z_INDEX_BASE = 1000;
|
|
|
3760
4090
|
*
|
|
3761
4091
|
* For a panel placed to the left or right, this is the vertical axis:
|
|
3762
4092
|
* - "start": the panel's top edge meets the top of what it aligns to
|
|
3763
|
-
* - "center": the panel is
|
|
4093
|
+
* - "center": the panel is centered on it
|
|
3764
4094
|
* - "end": the panel's bottom edge meets its bottom
|
|
3765
4095
|
*
|
|
3766
4096
|
* For a panel placed above or below, this is the horizontal axis, and "start"
|
|
@@ -3824,16 +4154,19 @@ export declare interface PopoutAnchorProps {
|
|
|
3824
4154
|
export declare type PopoutAnchorTarget = RefObject<HTMLElement | null> | "parent" | "panel" | "trigger";
|
|
3825
4155
|
|
|
3826
4156
|
/**
|
|
3827
|
-
* An icon button that opens a pop-out and
|
|
4157
|
+
* An icon button that opens a pop-out and shows that it is open.
|
|
3828
4158
|
*
|
|
3829
|
-
* It
|
|
3830
|
-
*
|
|
3831
|
-
*
|
|
4159
|
+
* It is Figma's 24px ghost icon button (design/figma-spec.md 4.3): transparent
|
|
4160
|
+
* at rest, and while its panel is up it takes the "open" look -- the selected
|
|
4161
|
+
* ground (#e5f4ff / #394360) with a brand-colored glyph -- which the theme
|
|
4162
|
+
* draws from the `aria-expanded="true"` that `Popout.Trigger` sets. A column of
|
|
4163
|
+
* them therefore says at a glance which panel is on screen. Give it an
|
|
4164
|
+
* `aria-label`: an icon on its own has no accessible name.
|
|
3832
4165
|
*
|
|
3833
|
-
* Use it inside `Popout.Trigger`, which supplies the open state
|
|
4166
|
+
* Use it inside `Popout.Trigger`, which supplies the open state.
|
|
3834
4167
|
* @param props - Component props
|
|
3835
4168
|
* @param props.icon - The drawing on the button
|
|
3836
|
-
* @param props.size - How big the button is, defaulting to
|
|
4169
|
+
* @param props.size - How big the button is, defaulting to Figma's 24px `"sm"`
|
|
3837
4170
|
* @returns The trigger button
|
|
3838
4171
|
* @example
|
|
3839
4172
|
* ```tsx
|
|
@@ -3841,7 +4174,7 @@ export declare type PopoutAnchorTarget = RefObject<HTMLElement | null> | "parent
|
|
|
3841
4174
|
* <Popout.Trigger>
|
|
3842
4175
|
* <PopoutButton icon={<UiGlyph name="gear" />} aria-label="Open settings" />
|
|
3843
4176
|
* </Popout.Trigger>
|
|
3844
|
-
* <Popout.Panel width={
|
|
4177
|
+
* <Popout.Panel width={240} header={{variant: "title", title: "Settings"}}>
|
|
3845
4178
|
* <Popout.Content>Content here</Popout.Content>
|
|
3846
4179
|
* </Popout.Panel>
|
|
3847
4180
|
* </Popout>
|
|
@@ -3855,7 +4188,7 @@ export declare const PopoutButton: ForwardRefExoticComponent<PopoutButtonProps &
|
|
|
3855
4188
|
* Every `ActionIcon` prop but `variant` and `children` is accepted as well and
|
|
3856
4189
|
* is forwarded to the underlying button, so `size`, `color`, `disabled`,
|
|
3857
4190
|
* `aria-label` and a `data-` attribute all work. The variant is the button's
|
|
3858
|
-
* own:
|
|
4191
|
+
* own: the ghost (`subtle`) button, whose open state the theme draws.
|
|
3859
4192
|
*/
|
|
3860
4193
|
export declare interface PopoutButtonProps extends Omit<ActionIconProps, "variant" | "children">, ElementProps<"button", "color" | keyof ActionIconProps> {
|
|
3861
4194
|
/**
|
|
@@ -3872,7 +4205,11 @@ export declare interface PopoutButtonProps extends Omit<ActionIconProps, "varian
|
|
|
3872
4205
|
*
|
|
3873
4206
|
* Wrap a panel's content in it for the padding every pop-out shares, or leave
|
|
3874
4207
|
* it out and lay the panel out yourself when the content has to reach the
|
|
3875
|
-
* panel's own edges -- a
|
|
4208
|
+
* panel's own edges -- a color picker, a list that scrolls.
|
|
4209
|
+
*
|
|
4210
|
+
* The padding is Figma's popover body (design/figma-spec.md 8.4): 16px at each
|
|
4211
|
+
* side and 12px above and below, so the 24px control of a first 32px row sits
|
|
4212
|
+
* 16px under the header's divider, and the last one 16px above the bottom.
|
|
3876
4213
|
* @param props - Component props
|
|
3877
4214
|
* @param props.children - What the panel shows, laid out inside the panel's own padding
|
|
3878
4215
|
* @returns The panel's padded content area
|
|
@@ -3921,12 +4258,17 @@ export declare interface PopoutContextValue {
|
|
|
3921
4258
|
/**
|
|
3922
4259
|
* The region this pop-out was opened in, or null when it sits in no region.
|
|
3923
4260
|
*
|
|
3924
|
-
*
|
|
3925
|
-
*
|
|
3926
|
-
* two opened in the same panel cannot. It is the opener's region, not the
|
|
3927
|
-
* panel's screen position.
|
|
4261
|
+
* Recorded for consumers that read it. It no longer separates pop-outs:
|
|
4262
|
+
* one root pop-out is open at a time across the whole page, as in Figma.
|
|
3928
4263
|
*/
|
|
3929
4264
|
region: string | null;
|
|
4265
|
+
/**
|
|
4266
|
+
* Whether opening this pop-out closes the other open root pop-out (and is
|
|
4267
|
+
* closed by the next one). False only for a hover bubble such as
|
|
4268
|
+
* `InfoCircle`, which explains a control without replacing the panel the
|
|
4269
|
+
* person is working in.
|
|
4270
|
+
*/
|
|
4271
|
+
exclusive?: boolean;
|
|
3930
4272
|
}
|
|
3931
4273
|
|
|
3932
4274
|
/**
|
|
@@ -3942,7 +4284,7 @@ declare interface PopoutHeaderAction {
|
|
|
3942
4284
|
*
|
|
3943
4285
|
* The button is icon-only, so this is its accessible name and there is no
|
|
3944
4286
|
* other text to fall back on. Write it as a phrase a person would
|
|
3945
|
-
*
|
|
4287
|
+
* recognize.
|
|
3946
4288
|
*/
|
|
3947
4289
|
label: string;
|
|
3948
4290
|
/**
|
|
@@ -3996,6 +4338,11 @@ export declare interface PopoutHeaderProps {
|
|
|
3996
4338
|
* `aria-labelledby` at.
|
|
3997
4339
|
*/
|
|
3998
4340
|
titleId?: string;
|
|
4341
|
+
/**
|
|
4342
|
+
* The base id of the tab strip, from which Mantine's Tabs derives each tab's
|
|
4343
|
+
* id and aria-controls. The panel gives its tab panel the matching id.
|
|
4344
|
+
*/
|
|
4345
|
+
tabsId?: string;
|
|
3999
4346
|
}
|
|
4000
4347
|
|
|
4001
4348
|
/**
|
|
@@ -4004,8 +4351,10 @@ export declare interface PopoutHeaderProps {
|
|
|
4004
4351
|
* Put one high in the tree, around anything that contains a pop-out. It owns
|
|
4005
4352
|
* the stacking order, the portal the panels render into, and the dismissal
|
|
4006
4353
|
* rules they all obey: Escape closes the innermost open panel, a click outside
|
|
4007
|
-
* closes them all, opening one panel closes the
|
|
4008
|
-
*
|
|
4354
|
+
* closes them all, opening one panel closes the one already open at its level
|
|
4355
|
+
* (one root pop-out on the whole page at a time, as in Figma; a panel opened
|
|
4356
|
+
* from inside an open one is its child and stays), and closing a panel closes
|
|
4357
|
+
* everything opened from it.
|
|
4009
4358
|
* @param props - Component props
|
|
4010
4359
|
* @param props.children - The part of the tree that may contain pop-outs
|
|
4011
4360
|
* @returns The provider that pop-outs inside it coordinate through
|
|
@@ -4025,7 +4374,7 @@ export declare interface PopoutManagerContextValue {
|
|
|
4025
4374
|
* Adds a pop-out to the layer, with the callback that closes it, the pop-out
|
|
4026
4375
|
* it was opened from, and the region it was opened in.
|
|
4027
4376
|
*/
|
|
4028
|
-
register: (id: string, closeCallback: () => void, parentId?: string | null, region?: string | null) => void;
|
|
4377
|
+
register: (id: string, closeCallback: () => void, parentId?: string | null, region?: string | null, exclusive?: boolean) => void;
|
|
4029
4378
|
/** Takes a pop-out out of the layer, when it leaves the page. */
|
|
4030
4379
|
unregister: (id: string) => void;
|
|
4031
4380
|
/** The stacking order a pop-out currently draws at. */
|
|
@@ -4175,9 +4524,8 @@ export declare interface PopoutPanelProps {
|
|
|
4175
4524
|
* Gap between the panel and the anchor, in pixels. Negative values overlap
|
|
4176
4525
|
* the two so their borders meet exactly.
|
|
4177
4526
|
*
|
|
4178
|
-
* Defaults to 0
|
|
4179
|
-
*
|
|
4180
|
-
* consistent step.
|
|
4527
|
+
* Defaults to 0: a panel docks flush against what it opened from, and a
|
|
4528
|
+
* nested panel flush against its parent (POPOUT_GAP, POPOUT_NESTED_GAP).
|
|
4181
4529
|
*/
|
|
4182
4530
|
gap?: number;
|
|
4183
4531
|
/**
|
|
@@ -4191,6 +4539,10 @@ export declare interface PopoutPanelProps {
|
|
|
4191
4539
|
* Whether opening the panel moves keyboard focus into it, and closing it
|
|
4192
4540
|
* returns focus to the trigger.
|
|
4193
4541
|
*
|
|
4542
|
+
* Focus lands on the panel itself, or on the first element inside it marked
|
|
4543
|
+
* `data-autofocus` (Mantine's convention) when there is one -- mark the
|
|
4544
|
+
* field a settings panel should start in.
|
|
4545
|
+
*
|
|
4194
4546
|
* Turn this off for a panel that opens on hover, where taking focus away
|
|
4195
4547
|
* from what the person is doing would be an interruption.
|
|
4196
4548
|
* @default true
|
|
@@ -4247,25 +4599,15 @@ export declare interface PopoutProps extends DisclosureProps {
|
|
|
4247
4599
|
* Which region the pop-outs beneath this point belong to.
|
|
4248
4600
|
*
|
|
4249
4601
|
* A shell is divided into regions -- a properties panel, an inspector, the
|
|
4250
|
-
* surface between them
|
|
4251
|
-
*
|
|
4252
|
-
*
|
|
4253
|
-
* region
|
|
4254
|
-
*
|
|
4255
|
-
*
|
|
4256
|
-
*
|
|
4257
|
-
*
|
|
4258
|
-
*
|
|
4259
|
-
* it is why the default -- no region at all -- keeps the older whole-page rule:
|
|
4260
|
-
* an application that never mentions regions is unaffected.
|
|
4261
|
-
*
|
|
4262
|
-
* The region is the OPENER's, not the surface's screen position. Wrap the
|
|
4263
|
-
* region's own markup, and a pop-out that slides out over neighbouring space
|
|
4264
|
-
* still counts against the region whose control opened it.
|
|
4265
|
-
*
|
|
4266
|
-
* Nesting is unaffected either way. A pop-out opened from another pop-out is
|
|
4267
|
-
* grouped by its parent, as it always was, and inherits this region only for
|
|
4268
|
-
* the benefit of anything it opens in turn.
|
|
4602
|
+
* surface between them -- and each pop-out records the region its trigger sits
|
|
4603
|
+
* in, readable through `usePopoutRegion`.
|
|
4604
|
+
*
|
|
4605
|
+
* The region no longer decides which pop-outs may be open together. Figma
|
|
4606
|
+
* keeps ONE light popover open at a time: opening another replaces it, in any
|
|
4607
|
+
* region (design/figma-spec.md 8.4). Before the Figma restyle a reader could
|
|
4608
|
+
* hold one pop-out open per region; that rule is gone, and this component is
|
|
4609
|
+
* kept so existing markup and `usePopoutRegion` keep working. A pop-out opened
|
|
4610
|
+
* from inside an open one is its child and stays allowed.
|
|
4269
4611
|
* @param props - Component props
|
|
4270
4612
|
* @param props.id - What to call this region
|
|
4271
4613
|
* @param props.children - The part of the tree whose pop-outs belong to it
|
|
@@ -4398,7 +4740,7 @@ declare interface PopoutTitleHeaderConfig {
|
|
|
4398
4740
|
* @param props - Component props
|
|
4399
4741
|
* @param props.children - The trigger element (typically a button or icon button)
|
|
4400
4742
|
* @param props.action - What activating the trigger does: toggle the panel, or only open it
|
|
4401
|
-
* @returns The trigger element with the pop-out's
|
|
4743
|
+
* @returns The trigger element with the pop-out's behavior attached
|
|
4402
4744
|
*/
|
|
4403
4745
|
declare function PopoutTrigger({ children, action }: PopoutTriggerProps): JSX.Element;
|
|
4404
4746
|
|
|
@@ -4543,6 +4885,118 @@ export declare interface ProseBlockProps {
|
|
|
4543
4885
|
live?: LiveSetting;
|
|
4544
4886
|
}
|
|
4545
4887
|
|
|
4888
|
+
/** One action of the palette. */
|
|
4889
|
+
export declare interface QuickAction {
|
|
4890
|
+
/** The action's identifier, handed to `onRun`. */
|
|
4891
|
+
value: string;
|
|
4892
|
+
/** The action's name. */
|
|
4893
|
+
label: string;
|
|
4894
|
+
/** A 24px glyph before the name. */
|
|
4895
|
+
icon?: default_2.ReactNode;
|
|
4896
|
+
/** The keyboard shortcut, shown right-aligned. */
|
|
4897
|
+
shortcut?: string;
|
|
4898
|
+
/** The section heading the action is listed under ("Recents", "Design tools"). */
|
|
4899
|
+
section?: string;
|
|
4900
|
+
/** Extra words the default filter matches. */
|
|
4901
|
+
keywords?: readonly string[];
|
|
4902
|
+
/** Shown, but cannot be run or highlighted. */
|
|
4903
|
+
disabled?: boolean;
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4906
|
+
/**
|
|
4907
|
+
* Figma's quick actions palette: a 529 x 354 panel (the caller positions it; Figma puts it 8px
|
|
4908
|
+
* above the toolbar) with a 32 tall search field, section headings and 32 tall rows. Typing
|
|
4909
|
+
* filters live, and the results are listed flat (no headings); ArrowUp / ArrowDown move the highlight while focus stays in the field (a
|
|
4910
|
+
* combobox with `aria-activedescendant` on a listbox); Enter runs; Escape closes. The first row
|
|
4911
|
+
* is highlighted on open and after every change of the search.
|
|
4912
|
+
* @param props - Component props
|
|
4913
|
+
* @param props.actions - Every action
|
|
4914
|
+
* @param props.onRun - Called with an action's value when it is run
|
|
4915
|
+
* @param props.onClose - Called by Escape
|
|
4916
|
+
* @param props.query - The search text (controlled)
|
|
4917
|
+
* @param props.onQueryChange - Called as the search text changes
|
|
4918
|
+
* @param props.filter - Which actions match the search
|
|
4919
|
+
* @param props.header - Rendered between the search field and the list
|
|
4920
|
+
* @param props.searchAction - A trailing action at the right end of the search field
|
|
4921
|
+
* @param props.placeholder - Placeholder of the search field
|
|
4922
|
+
* @param props.width - Panel width
|
|
4923
|
+
* @param props.height - Panel height
|
|
4924
|
+
* @param props.className - Extra class on the panel
|
|
4925
|
+
* @param props.style - Extra style on the panel
|
|
4926
|
+
* @returns The palette
|
|
4927
|
+
*/
|
|
4928
|
+
export declare function QuickActions({ actions, onRun, onClose, query, onQueryChange, filter, header, searchAction, placeholder, width, height, className, style, ...others }: QuickActionsProps): default_2.JSX.Element;
|
|
4929
|
+
|
|
4930
|
+
/**
|
|
4931
|
+
* Props for the QuickActions component.
|
|
4932
|
+
*/
|
|
4933
|
+
export declare interface QuickActionsProps {
|
|
4934
|
+
/** Every action. Sections appear in the order their first action does. */
|
|
4935
|
+
actions: readonly QuickAction[];
|
|
4936
|
+
/** Called with an action's value when it is run (Enter, or a click). */
|
|
4937
|
+
onRun: (value: string) => void;
|
|
4938
|
+
/** Called by Escape. */
|
|
4939
|
+
onClose?: () => void;
|
|
4940
|
+
/** The search text (controlled). */
|
|
4941
|
+
query?: string;
|
|
4942
|
+
/** Called as the search text changes. */
|
|
4943
|
+
onQueryChange?: (query: string) => void;
|
|
4944
|
+
/** Which actions match the search. Defaults to a case-insensitive substring of the name or a keyword. */
|
|
4945
|
+
filter?: (action: QuickAction, query: string) => boolean;
|
|
4946
|
+
/**
|
|
4947
|
+
* Rendered in a 32 tall row between the search field and the list, 8px in from the panel
|
|
4948
|
+
* edge: Figma's scope tabs (`<Tabs>` with the theme's pill tabs), for example.
|
|
4949
|
+
*/
|
|
4950
|
+
header?: default_2.ReactNode;
|
|
4951
|
+
/**
|
|
4952
|
+
* A trailing action at the right end of the search field, 6px in from its edge and 16px
|
|
4953
|
+
* after the text: pass an `<ActionIcon aria-label="...">` (the theme's 24px ghost icon
|
|
4954
|
+
* button), as Figma's visual-search button. While there is search text the palette shows its
|
|
4955
|
+
* own clear button in this place instead, as Figma does.
|
|
4956
|
+
*/
|
|
4957
|
+
searchAction?: default_2.ReactNode;
|
|
4958
|
+
/** Accessible name of the dialog. Defaults to the "Quick actions" label. */
|
|
4959
|
+
"aria-label"?: string;
|
|
4960
|
+
/** Placeholder of the search field. Defaults to the "Search actions" label. */
|
|
4961
|
+
placeholder?: string;
|
|
4962
|
+
/** Panel width. Default 529 (Figma's, the toolbar's width). */
|
|
4963
|
+
width?: number;
|
|
4964
|
+
/** Panel height. Default 354. */
|
|
4965
|
+
height?: number;
|
|
4966
|
+
className?: string;
|
|
4967
|
+
style?: default_2.CSSProperties;
|
|
4968
|
+
}
|
|
4969
|
+
|
|
4970
|
+
/**
|
|
4971
|
+
* A 56 x 56 rail button: a 32 x 32 pill (24 glyph) above a 9/14 caption. The pill turns
|
|
4972
|
+
* `--cm-bg-hover` under the pointer and `--cm-bg-selected` with a brand glyph when active; the
|
|
4973
|
+
* caption never changes. Tooltip to the end side after 500ms, none on the active button.
|
|
4974
|
+
* @param props - Component props
|
|
4975
|
+
* @param props.icon - The destination's glyph
|
|
4976
|
+
* @param props.label - The caption, accessible name and tooltip
|
|
4977
|
+
* @param props.shortcut - The keyboard shortcut shown in the tooltip
|
|
4978
|
+
* @param props.active - Whether the destination is open
|
|
4979
|
+
* @returns The rail button
|
|
4980
|
+
*/
|
|
4981
|
+
export declare const RailButton: default_2.ForwardRefExoticComponent<RailButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
4982
|
+
|
|
4983
|
+
/**
|
|
4984
|
+
* Props for the RailButton component.
|
|
4985
|
+
*/
|
|
4986
|
+
export declare interface RailButtonProps extends Omit<UnstyledButtonProps, "children">, Omit<ElementProps<"button">, "children"> {
|
|
4987
|
+
/** The destination's glyph, drawn in the 32 x 32 pill. */
|
|
4988
|
+
icon: default_2.ReactNode;
|
|
4989
|
+
/** The 9px caption under the pill, also the accessible name and the tooltip. */
|
|
4990
|
+
label: string;
|
|
4991
|
+
/** The keyboard shortcut shown in the tooltip. */
|
|
4992
|
+
shortcut?: string;
|
|
4993
|
+
/**
|
|
4994
|
+
* Whether the destination is open. `aria-expanded="true"` means the same thing, so a button
|
|
4995
|
+
* that opens a panel only needs that.
|
|
4996
|
+
*/
|
|
4997
|
+
active?: boolean;
|
|
4998
|
+
}
|
|
4999
|
+
|
|
4546
5000
|
/**
|
|
4547
5001
|
* A row that draws a range: two values with the mapping between them drawn
|
|
4548
5002
|
* in-line, and no sentence anywhere.
|
|
@@ -4576,8 +5030,8 @@ export declare interface ProseBlockProps {
|
|
|
4576
5030
|
* @param props.min - The value at the low end of the range
|
|
4577
5031
|
* @param props.max - The value at the high end of the range
|
|
4578
5032
|
* @param props.label - Names what the ramp maps; never drawn, and read first in the drawing's accessible name
|
|
4579
|
-
* @param props.variant - Which drawing the row makes of its range: a growing wedge or a
|
|
4580
|
-
* @param props.gradient - A CSS gradient for the
|
|
5033
|
+
* @param props.variant - Which drawing the row makes of its range: a growing wedge or a color bar
|
|
5034
|
+
* @param props.gradient - A CSS gradient for the color form, written as though text ran left to right
|
|
4581
5035
|
* @param props.scale - The transform between the two values, drawn as a small curve at the end of the row
|
|
4582
5036
|
* @param props.busy - Whether the values are still being worked out by something that finishes later
|
|
4583
5037
|
* @param props.live - How urgently a screen reader announces the drawing when it changes on its own
|
|
@@ -4589,7 +5043,7 @@ export declare interface ProseBlockProps {
|
|
|
4589
5043
|
* <RampRow label="Node size by age" min="45" max="68" scale="sqrt" />
|
|
4590
5044
|
* ```
|
|
4591
5045
|
* @example
|
|
4592
|
-
* A
|
|
5046
|
+
* A color ramp filled in by a background run, whose curve opens a chooser.
|
|
4593
5047
|
* ```tsx
|
|
4594
5048
|
* const format = useNumberFormatter({maximumFractionDigits: 2});
|
|
4595
5049
|
*
|
|
@@ -4646,7 +5100,7 @@ export declare interface RampRowProps {
|
|
|
4646
5100
|
* Which drawing the row makes of its range.
|
|
4647
5101
|
*
|
|
4648
5102
|
* - `"size"` -- a wedge that grows from the low value to the high one,
|
|
4649
|
-
* drawn in the secondary text
|
|
5103
|
+
* drawn in the secondary text color. Its two ends are the smallest and
|
|
4650
5104
|
* the largest size the mapping produces.
|
|
4651
5105
|
* - `"color"` -- a bar painted with `gradient`, so the ramp on the panel is
|
|
4652
5106
|
* the ramp on the picture it describes.
|
|
@@ -4654,7 +5108,7 @@ export declare interface RampRowProps {
|
|
|
4654
5108
|
*/
|
|
4655
5109
|
variant?: "size" | "color";
|
|
4656
5110
|
/**
|
|
4657
|
-
* A CSS gradient for the
|
|
5111
|
+
* A CSS gradient for the color form, such as
|
|
4658
5112
|
* `"linear-gradient(to right, #123, #abc)"`.
|
|
4659
5113
|
*
|
|
4660
5114
|
* Write it as though text ran left to right; the drawing is mirrored for
|
|
@@ -4743,11 +5197,9 @@ declare type RampScale = "sqrt" | "linear" | "log";
|
|
|
4743
5197
|
*
|
|
4744
5198
|
* The denominator is not information the reader is missing -- the panel above it
|
|
4745
5199
|
* already says how many nodes there are -- so the chip keeps the number that
|
|
4746
|
-
* changes and drops the words that do not. It
|
|
4747
|
-
*
|
|
4748
|
-
*
|
|
4749
|
-
* annotation of the row rather than as a second value competing with the row's
|
|
4750
|
-
* own.
|
|
5200
|
+
* changes and drops the words that do not. It draws Figma's "Beta" badge look
|
|
5201
|
+
* (design/figma-spec.md 9.8): 16 tall, radius 5, a 1px border-color outline drawn
|
|
5202
|
+
* inside, transparent, 11/16 in the primary text color (bottom-toolbar/mode-metronome-full #296).
|
|
4751
5203
|
* @param props - Component props
|
|
4752
5204
|
* @param props.children - The rank, already spelled the short way
|
|
4753
5205
|
* @returns The rank chip
|
|
@@ -4762,6 +5214,331 @@ export declare interface RankChipProps {
|
|
|
4762
5214
|
children: default_2.ReactNode;
|
|
4763
5215
|
}
|
|
4764
5216
|
|
|
5217
|
+
/**
|
|
5218
|
+
* Apply a rename that `Tree`'s `onRename` reported. Returns a new list.
|
|
5219
|
+
* @param items - the tree, top level first
|
|
5220
|
+
* @param id - the renamed item
|
|
5221
|
+
* @param name - its new name
|
|
5222
|
+
* @returns the renamed tree
|
|
5223
|
+
*/
|
|
5224
|
+
export declare function renameTreeItem<T extends TreeLike<T> & {
|
|
5225
|
+
name: string;
|
|
5226
|
+
}>(items: readonly T[], id: string, name: string): T[];
|
|
5227
|
+
|
|
5228
|
+
/**
|
|
5229
|
+
* A handle that resizes a panel by dragging, by the arrow keys, or back to its default size by
|
|
5230
|
+
* a double-click.
|
|
5231
|
+
*
|
|
5232
|
+
* Put it inside the panel it resizes, which must be `position: relative`; it places itself
|
|
5233
|
+
* across the named edge. It draws nothing until it has keyboard focus, like Figma's.
|
|
5234
|
+
*
|
|
5235
|
+
* - Drag: the size follows the pointer live (`onChange`) and settles on release (`onChangeEnd`).
|
|
5236
|
+
* - Keys: the arrows along the handle's axis change the size by 1px, in the direction the
|
|
5237
|
+
* edge moves (ArrowRight grows a leading-side panel); Shift moves 10px; Home and End jump to
|
|
5238
|
+
* `min` and `max`.
|
|
5239
|
+
* - Double-click resets to `defaultValue`.
|
|
5240
|
+
*
|
|
5241
|
+
* The cursor says which ways the edge can still move: `e-resize` or `w-resize` at the ends of
|
|
5242
|
+
* the range and `ew-resize` between them; `ns-resize` on a split.
|
|
5243
|
+
* @param props - Component props
|
|
5244
|
+
* @param props.edge - Which panel edge the handle straddles
|
|
5245
|
+
* @param props.value - The panel's size, when controlled
|
|
5246
|
+
* @param props.defaultValue - The starting size when uncontrolled, and the double-click reset size
|
|
5247
|
+
* @param props.min - The smallest size
|
|
5248
|
+
* @param props.max - The largest size
|
|
5249
|
+
* @param props.onChange - Called with every new size
|
|
5250
|
+
* @param props.onChangeEnd - Called once a size settles
|
|
5251
|
+
* @param props.label - The accessible name
|
|
5252
|
+
* @param props.valueText - How the size is read out
|
|
5253
|
+
* @returns The resize handle
|
|
5254
|
+
* @example
|
|
5255
|
+
* ```tsx
|
|
5256
|
+
* <Box pos="relative" w={width}>
|
|
5257
|
+
* <ResizeHandle edge="end" value={width} min={240} max={500} defaultValue={240} onChange={setWidth} />
|
|
5258
|
+
* </Box>
|
|
5259
|
+
* ```
|
|
5260
|
+
*/
|
|
5261
|
+
export declare const ResizeHandle: default_2.ForwardRefExoticComponent<ResizeHandleProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
5262
|
+
|
|
5263
|
+
/** The size range, handed to `valueText`. */
|
|
5264
|
+
export declare interface ResizeHandleBounds {
|
|
5265
|
+
min: number;
|
|
5266
|
+
max: number;
|
|
5267
|
+
}
|
|
5268
|
+
|
|
5269
|
+
/** Which edge of its panel the handle sits on. The panel must be positioned (relative). */
|
|
5270
|
+
export declare type ResizeHandleEdge = "start" | "end" | "top" | "bottom";
|
|
5271
|
+
|
|
5272
|
+
/**
|
|
5273
|
+
* Props for the ResizeHandle component. Every other `div` prop is forwarded.
|
|
5274
|
+
*/
|
|
5275
|
+
export declare interface ResizeHandleProps extends Omit<default_2.ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue" | "children"> {
|
|
5276
|
+
/**
|
|
5277
|
+
* The panel edge the handle straddles: `"end"` for a panel on the leading side of the
|
|
5278
|
+
* window (its trailing edge is dragged), `"start"` for a panel on the trailing side, `"top"`
|
|
5279
|
+
* or `"bottom"` for a vertical split. Start and end follow the text direction.
|
|
5280
|
+
* @default "end"
|
|
5281
|
+
*/
|
|
5282
|
+
edge?: ResizeHandleEdge;
|
|
5283
|
+
/** The panel's size in pixels, when you drive it from your own state. */
|
|
5284
|
+
value?: number;
|
|
5285
|
+
/**
|
|
5286
|
+
* The size it starts at when it keeps its own state, and the size a double-click resets
|
|
5287
|
+
* to. Defaults to `min`.
|
|
5288
|
+
*/
|
|
5289
|
+
defaultValue?: number;
|
|
5290
|
+
/** The smallest size, in pixels. */
|
|
5291
|
+
min: number;
|
|
5292
|
+
/** The largest size, in pixels. */
|
|
5293
|
+
max: number;
|
|
5294
|
+
/** Called with every new size, live while dragging and on each key press. */
|
|
5295
|
+
onChange?: (value: number) => void;
|
|
5296
|
+
/** Called once the size settles: on pointer release, after a key press, after a reset. */
|
|
5297
|
+
onChangeEnd?: (value: number) => void;
|
|
5298
|
+
/**
|
|
5299
|
+
* The handle's accessible name.
|
|
5300
|
+
* @default "Resize panel"
|
|
5301
|
+
*/
|
|
5302
|
+
label?: string;
|
|
5303
|
+
/**
|
|
5304
|
+
* How the size is read out. Defaults to `"240 pixels"`, with `" (min)"` or `" (max)"` at
|
|
5305
|
+
* the ends of the range.
|
|
5306
|
+
*/
|
|
5307
|
+
valueText?: (value: number, bounds: ResizeHandleBounds) => string;
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
/**
|
|
5311
|
+
* A find result (design/figma-spec.md 10.4): 240 x 52 with a path line, 34 without, padding
|
|
5312
|
+
* 8 8 8 16, a 16px glyph, the name at 11/16 with the match at 600 and the path at 10/16 in the
|
|
5313
|
+
* secondary color. The current result is blue; hover is gray.
|
|
5314
|
+
*
|
|
5315
|
+
* It is an `option`: put the rows in an element with `role="listbox"` and drive them from the
|
|
5316
|
+
* search field with `aria-activedescendant` (give each row an `id`), so focus stays in the
|
|
5317
|
+
* field. Pressing a row does not take focus from the field.
|
|
5318
|
+
* @param props - Component props
|
|
5319
|
+
* @returns The row
|
|
5320
|
+
*/
|
|
5321
|
+
export declare const ResultRow: default_2.ForwardRefExoticComponent<ResultRowProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
5322
|
+
|
|
5323
|
+
/**
|
|
5324
|
+
* Props for the ResultRow component.
|
|
5325
|
+
*/
|
|
5326
|
+
export declare interface ResultRowProps extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
5327
|
+
/** The result's name. */
|
|
5328
|
+
name: string;
|
|
5329
|
+
/** The search text: its first case-insensitive occurrence in the name is drawn at 600. */
|
|
5330
|
+
match?: string;
|
|
5331
|
+
/** The second line: where the result lives (a page, a parent path). */
|
|
5332
|
+
path?: default_2.ReactNode;
|
|
5333
|
+
/** The 16 x 16 type glyph. */
|
|
5334
|
+
icon?: default_2.ReactNode;
|
|
5335
|
+
/** The current result (blue fill; `aria-selected`). */
|
|
5336
|
+
current?: boolean;
|
|
5337
|
+
/** `"component"`: both lines and the glyph in the component (purple) color. */
|
|
5338
|
+
tone?: "default" | "component";
|
|
5339
|
+
}
|
|
5340
|
+
|
|
5341
|
+
/** The rows and columns of the matrix, top to bottom and left to right. */
|
|
5342
|
+
declare const ROWS: readonly ["top", "middle", "bottom"];
|
|
5343
|
+
|
|
5344
|
+
/**
|
|
5345
|
+
* A search field (design/figma-spec.md 6.2): a filled 24px field with a leading magnifier, a clear
|
|
5346
|
+
* button once there is text, and a focus ring drawn flush with the field that lingers 100ms after
|
|
5347
|
+
* focus leaves.
|
|
5348
|
+
*
|
|
5349
|
+
* Escape clears the text; with nothing to clear it is left to bubble, so an enclosing popover
|
|
5350
|
+
* can close. `autoFocus` is off by default: Figma focuses its search fields when their panel
|
|
5351
|
+
* opens, and whether that is right is the caller's decision.
|
|
5352
|
+
* @example
|
|
5353
|
+
* ```tsx
|
|
5354
|
+
* const [query, setQuery] = useState("");
|
|
5355
|
+
* <SearchInput value={query} onChange={setQuery} placeholder="Search layers" />
|
|
5356
|
+
* ```
|
|
5357
|
+
*/
|
|
5358
|
+
export declare const SearchInput: default_2.ForwardRefExoticComponent<SearchInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
5359
|
+
|
|
5360
|
+
/** Props for SearchInput. Every other TextInput prop is passed through. */
|
|
5361
|
+
export declare interface SearchInputProps extends Omit<TextInputProps, "value" | "defaultValue" | "onChange" | "size" | "leftSection" | "rightSection"> {
|
|
5362
|
+
/** The search text, when you drive the field from your own state. */
|
|
5363
|
+
value?: string;
|
|
5364
|
+
/** The text the field starts with when it keeps its own state. */
|
|
5365
|
+
defaultValue?: string;
|
|
5366
|
+
/** Called with the new text on every keystroke and on clear; the event is second when there is one. */
|
|
5367
|
+
onChange?: ChangeHandler<string>;
|
|
5368
|
+
/**
|
|
5369
|
+
* `"sm"`: the 24px panel field (default). `"lg"`: the 32px quick-actions field with 13/24 text.
|
|
5370
|
+
* @default "sm"
|
|
5371
|
+
*/
|
|
5372
|
+
size?: "sm" | "lg";
|
|
5373
|
+
/**
|
|
5374
|
+
* A 24 x 24 control joined to the field's end (Figma's Variables table filter button): the
|
|
5375
|
+
* field takes the `5px 0 0 5px` corners and the control `0 5px 5px 0`, 1px apart.
|
|
5376
|
+
*/
|
|
5377
|
+
rightSection?: default_2.ReactNode;
|
|
5378
|
+
/** The accessible name of the clear button. Defaults to the `clearSearch` label ("Clear search"). */
|
|
5379
|
+
clearLabel?: string;
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5382
|
+
/** The contextual secondary bar, with `SecondaryToolbar.Button` and `SecondaryToolbar.Divider`. */
|
|
5383
|
+
export declare const SecondaryToolbar: typeof SecondaryToolbarRoot & {
|
|
5384
|
+
Button: default_2.ForwardRefExoticComponent<SecondaryToolbarButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
5385
|
+
Divider: typeof SecondaryToolbarDivider;
|
|
5386
|
+
};
|
|
5387
|
+
|
|
5388
|
+
/**
|
|
5389
|
+
* Props for SecondaryToolbar.Button.
|
|
5390
|
+
*/
|
|
5391
|
+
export declare interface SecondaryToolbarButtonProps extends UnstyledButtonProps, ElementProps<"button"> {
|
|
5392
|
+
/** A 24px glyph before the label. */
|
|
5393
|
+
icon?: default_2.ReactNode;
|
|
5394
|
+
/** Whether this is the current mode (`aria-pressed`): brand fill, white content. */
|
|
5395
|
+
selected?: boolean;
|
|
5396
|
+
/**
|
|
5397
|
+
* The button opens a dropdown (Figma's "More"): a 16px chevron trails the label with 4px end
|
|
5398
|
+
* padding. Wrap the button in `Menu.Target` so `aria-expanded` draws the open state.
|
|
5399
|
+
*/
|
|
5400
|
+
dropdown?: boolean;
|
|
5401
|
+
/** The visible label. Without one the button is a 24 x 24 icon button and needs an `aria-label`. */
|
|
5402
|
+
children?: default_2.ReactNode;
|
|
5403
|
+
}
|
|
5404
|
+
|
|
5405
|
+
/**
|
|
5406
|
+
* The divider between groups of the secondary bar, full height.
|
|
5407
|
+
* @returns The divider
|
|
5408
|
+
*/
|
|
5409
|
+
declare function SecondaryToolbarDivider(): default_2.JSX.Element;
|
|
5410
|
+
|
|
5411
|
+
/**
|
|
5412
|
+
* Props for the SecondaryToolbar component.
|
|
5413
|
+
*/
|
|
5414
|
+
export declare interface SecondaryToolbarProps extends BoxProps, ElementProps<"div"> {
|
|
5415
|
+
/** Accessible name of the bar, such as "Vector editing". */
|
|
5416
|
+
"aria-label": string;
|
|
5417
|
+
/** Drop the 8px padding, for a crop-style bar whose items sit on its edges. */
|
|
5418
|
+
flush?: boolean;
|
|
5419
|
+
/** The bar's buttons and dividers. */
|
|
5420
|
+
children?: default_2.ReactNode;
|
|
5421
|
+
}
|
|
5422
|
+
|
|
5423
|
+
/**
|
|
5424
|
+
* The contextual bar that appears 8px above the main toolbar while a mode is active (Figma's
|
|
5425
|
+
* vector-edit and image bars): 40 tall, 13px corners, the 200 elevation, 1 x 40 dividers.
|
|
5426
|
+
* One Tab stop, ArrowLeft / ArrowRight between its items. The caller positions it.
|
|
5427
|
+
* @param props - Component props
|
|
5428
|
+
* @param props.flush - Drop the 8px padding
|
|
5429
|
+
* @param props.children - The bar's buttons and dividers
|
|
5430
|
+
* @param props.className - Extra class on the root
|
|
5431
|
+
* @param props.onKeyDown - Called before the roving-focus key handling
|
|
5432
|
+
* @param props.onFocus - Called before the roving-focus bookkeeping
|
|
5433
|
+
* @returns The bar
|
|
5434
|
+
*/
|
|
5435
|
+
declare function SecondaryToolbarRoot({ flush, children, className, onKeyDown, onFocus, ...others }: SecondaryToolbarProps): default_2.JSX.Element;
|
|
5436
|
+
|
|
5437
|
+
/**
|
|
5438
|
+
* Mantine's SegmentedControl, named by the `Input.Wrapper` around it.
|
|
5439
|
+
*
|
|
5440
|
+
* `Input.Wrapper` names its child with `<label for={id}>`, and only a control
|
|
5441
|
+
* that reads the wrapper's context takes that id. Mantine's SegmentedControl
|
|
5442
|
+
* does not, so inside a wrapper its radiogroup is announced with no name and
|
|
5443
|
+
* no description. This drop-in reads the wrapper's label and description ids
|
|
5444
|
+
* and puts them on the radiogroup as `aria-labelledby` and `aria-describedby`.
|
|
5445
|
+
* Either attribute passed by the caller wins. Outside a wrapper it is exactly
|
|
5446
|
+
* Mantine's control. A theme extension cannot do this, because a component's
|
|
5447
|
+
* theme defaults cannot read React context.
|
|
5448
|
+
*
|
|
5449
|
+
* Mantine's wrapper publishes a label id even when it renders no label, so a
|
|
5450
|
+
* wrapper with only a description or an error leaves `aria-labelledby`
|
|
5451
|
+
* pointing at no element. Browsers skip a missing id and fall back to any
|
|
5452
|
+
* `aria-label`, so give the control one in that case.
|
|
5453
|
+
* @param props - Mantine's SegmentedControl props
|
|
5454
|
+
* @returns The segmented control
|
|
5455
|
+
* @example
|
|
5456
|
+
* ```tsx
|
|
5457
|
+
* <Input.Wrapper label="Mode" description="How the graph is drawn">
|
|
5458
|
+
* <SegmentedControl data={["2D", "3D"]} />
|
|
5459
|
+
* </Input.Wrapper>
|
|
5460
|
+
* ```
|
|
5461
|
+
*/
|
|
5462
|
+
export declare function SegmentedControl(props: default_2.ComponentProps<typeof SegmentedControl_2>): default_2.JSX.Element;
|
|
5463
|
+
|
|
5464
|
+
/** One shortcut: what it does and the keys that do it. */
|
|
5465
|
+
export declare interface ShortcutEntry {
|
|
5466
|
+
/** What the shortcut does, such as "Frame tool". */
|
|
5467
|
+
label: default_2.ReactNode;
|
|
5468
|
+
/** The key caps, in order, such as `["Shift", "P"]`. */
|
|
5469
|
+
keys: readonly string[];
|
|
5470
|
+
/** A glyph before the label. */
|
|
5471
|
+
icon?: default_2.ReactNode;
|
|
5472
|
+
/** A 12/16 line under the label saying when to use it (the "essential" tab's rows). */
|
|
5473
|
+
description?: default_2.ReactNode;
|
|
5474
|
+
/** Draw the entry lit (#80caff): the shortcut the reader just pressed. */
|
|
5475
|
+
highlighted?: boolean;
|
|
5476
|
+
}
|
|
5477
|
+
|
|
5478
|
+
/** A column of shortcuts. */
|
|
5479
|
+
export declare interface ShortcutGroup {
|
|
5480
|
+
/** The column's heading. */
|
|
5481
|
+
title?: default_2.ReactNode;
|
|
5482
|
+
/** The column's rows. */
|
|
5483
|
+
shortcuts: readonly ShortcutEntry[];
|
|
5484
|
+
}
|
|
5485
|
+
|
|
5486
|
+
/**
|
|
5487
|
+
* Figma's keyboard shortcuts sheet: docked full width at the window's foot (the caller positions
|
|
5488
|
+
* it), #1e1e1e in both themes, a 38px folder-tab strip and columns of shortcuts with dark key caps.
|
|
5489
|
+
* Focus is not moved into it on open; ArrowLeft / ArrowRight / Home / End move between tabs and
|
|
5490
|
+
* open them (automatic activation); Escape closes it (Figma's does not).
|
|
5491
|
+
* @param props - Component props
|
|
5492
|
+
* @param props.tabs - The tabs, left to right
|
|
5493
|
+
* @param props.value - The open tab (controlled)
|
|
5494
|
+
* @param props.defaultValue - The tab open at first
|
|
5495
|
+
* @param props.onChange - Called with a tab's value when it opens
|
|
5496
|
+
* @param props.onClose - Called by the close button and by Escape
|
|
5497
|
+
* @param props.className - Extra class on the sheet
|
|
5498
|
+
* @param props.style - Extra style on the sheet
|
|
5499
|
+
* @returns The sheet
|
|
5500
|
+
*/
|
|
5501
|
+
export declare function ShortcutSheet({ tabs, value, defaultValue, onChange, onClose, className, style, ...others }: ShortcutSheetProps): default_2.JSX.Element;
|
|
5502
|
+
|
|
5503
|
+
/**
|
|
5504
|
+
* Props for the ShortcutSheet component.
|
|
5505
|
+
*/
|
|
5506
|
+
export declare interface ShortcutSheetProps {
|
|
5507
|
+
/** The tabs, left to right. */
|
|
5508
|
+
tabs: readonly ShortcutSheetTab[];
|
|
5509
|
+
/** The open tab (controlled). */
|
|
5510
|
+
value?: string;
|
|
5511
|
+
/** The tab open at first (uncontrolled). Defaults to the first. */
|
|
5512
|
+
defaultValue?: string;
|
|
5513
|
+
/** Called with a tab's value when it opens. */
|
|
5514
|
+
onChange?: (value: string) => void;
|
|
5515
|
+
/** Called by the close button and by Escape. Without it the sheet has no close button. */
|
|
5516
|
+
onClose?: () => void;
|
|
5517
|
+
/** Accessible name of the sheet. Defaults to the "Keyboard shortcuts" label. */
|
|
5518
|
+
"aria-label"?: string;
|
|
5519
|
+
className?: string;
|
|
5520
|
+
style?: default_2.CSSProperties;
|
|
5521
|
+
}
|
|
5522
|
+
|
|
5523
|
+
/** One tab of the sheet. */
|
|
5524
|
+
export declare interface ShortcutSheetTab {
|
|
5525
|
+
/** The tab's identifier. */
|
|
5526
|
+
value: string;
|
|
5527
|
+
/** The tab's text. */
|
|
5528
|
+
label: string;
|
|
5529
|
+
/** The tab's columns, laid out side by side and centered. */
|
|
5530
|
+
groups: readonly ShortcutGroup[];
|
|
5531
|
+
/**
|
|
5532
|
+
* `"list"` (the default) draws rows of 12px labels and small key caps. `"essential"` draws
|
|
5533
|
+
* Figma's first tab (ma/keyboard-shortcuts-essential): a caption above the columns, each
|
|
5534
|
+
* column numbered, 68px rows of 14/24 labels with their description under them, and the
|
|
5535
|
+
* 31-tall 14px key caps.
|
|
5536
|
+
*/
|
|
5537
|
+
variant?: "list" | "essential";
|
|
5538
|
+
/** The 14/24 line above the columns, such as "Essential keyboard shortcuts". */
|
|
5539
|
+
caption?: default_2.ReactNode;
|
|
5540
|
+
}
|
|
5541
|
+
|
|
4765
5542
|
/**
|
|
4766
5543
|
* The same chart at half the height, for a series rather than a distribution.
|
|
4767
5544
|
*
|
|
@@ -4771,7 +5548,7 @@ export declare interface RankChipProps {
|
|
|
4771
5548
|
* row pitch has no second line to put them on. They are still always drawn: a
|
|
4772
5549
|
* sparkline with no ends is a squiggle.
|
|
4773
5550
|
*
|
|
4774
|
-
* The series is
|
|
5551
|
+
* The series is normalized over its own extremes, so the line reports shape and
|
|
4775
5552
|
* the labels report magnitude. No legend, no title, no summary line.
|
|
4776
5553
|
*
|
|
4777
5554
|
* The line is drawn from the start of the axis to its end, following the text
|
|
@@ -4844,20 +5621,68 @@ export declare interface SparklineRowProps {
|
|
|
4844
5621
|
trailing?: default_2.ReactNode;
|
|
4845
5622
|
}
|
|
4846
5623
|
|
|
5624
|
+
/**
|
|
5625
|
+
* Two icon buttons joined into one control (design/figma-spec.md 4.5): a main action and a
|
|
5626
|
+
* chevron that opens a menu of related choices. Hovering either half lights both; the pressed half
|
|
5627
|
+
* darkens; the chevron shows the selected ground and a brand caret while its menu is open.
|
|
5628
|
+
* @param props - Component props
|
|
5629
|
+
* @param props.icon - The main half's glyph
|
|
5630
|
+
* @param props.label - The main half's accessible name and tooltip, and the group's name
|
|
5631
|
+
* @param props.onClick - Called when the main half is activated
|
|
5632
|
+
* @param props.menuLabel - The chevron's accessible name and tooltip
|
|
5633
|
+
* @param props.children - The menu the chevron opens
|
|
5634
|
+
* @param props.size - md (32 tall, the default) or sm (24 tall)
|
|
5635
|
+
* @param props.disabled - Disable both halves
|
|
5636
|
+
* @param props.menuProps - Passed to the Mantine Menu
|
|
5637
|
+
* @param props.className - Added to the group
|
|
5638
|
+
* @returns The split button
|
|
5639
|
+
* @example
|
|
5640
|
+
* ```tsx
|
|
5641
|
+
* <SplitButton icon={<PlayGlyph />} label="Present" menuLabel="Prototype view" onClick={present}>
|
|
5642
|
+
* <Menu.Item>Present</Menu.Item>
|
|
5643
|
+
* <Menu.Item>Preview</Menu.Item>
|
|
5644
|
+
* </SplitButton>
|
|
5645
|
+
* ```
|
|
5646
|
+
*/
|
|
5647
|
+
export declare function SplitButton({ icon, label, onClick, menuLabel, children, size, disabled, menuProps, className, ...rest }: SplitButtonProps): React.JSX.Element;
|
|
5648
|
+
|
|
5649
|
+
/** Props for SplitButton. */
|
|
5650
|
+
export declare interface SplitButtonProps extends BoxProps, ElementProps<"div", "onClick"> {
|
|
5651
|
+
/** The main half's glyph. */
|
|
5652
|
+
icon: ReactNode;
|
|
5653
|
+
/** The main half's accessible name and tooltip ("Present"). */
|
|
5654
|
+
label: string;
|
|
5655
|
+
/** Called when the main half is activated. */
|
|
5656
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
5657
|
+
/** The chevron half's accessible name and tooltip ("Prototype view"). */
|
|
5658
|
+
menuLabel: string;
|
|
5659
|
+
/** The menu the chevron opens: `Menu.Item`, `Menu.Label`, `Menu.Divider` ... */
|
|
5660
|
+
children: ReactNode;
|
|
5661
|
+
/** `md` (Figma's header size): a 32 x 32 main half and a 16 x 32 chevron. `sm`: 24 tall. @default "md" */
|
|
5662
|
+
size?: "sm" | "md";
|
|
5663
|
+
/** Disable both halves. */
|
|
5664
|
+
disabled?: boolean;
|
|
5665
|
+
/** Passed to the Mantine Menu (position, offset, opened / onChange ...). */
|
|
5666
|
+
menuProps?: Omit<MenuProps, "children">;
|
|
5667
|
+
}
|
|
5668
|
+
|
|
4847
5669
|
/**
|
|
4848
5670
|
* A number box that says whether the reader typed its value or inherited it.
|
|
4849
5671
|
*
|
|
4850
5672
|
* It is a Mantine `NumberInput` with one idea added: `undefined` means "nothing
|
|
4851
|
-
* has been entered here", so the control shows `defaultValue`
|
|
4852
|
-
*
|
|
4853
|
-
*
|
|
5673
|
+
* has been entered here", so the control shows `defaultValue` and offers no
|
|
5674
|
+
* reset. As soon as the reader commits a number of their own a reset button
|
|
5675
|
+
* appears beside it, and pressing that reset
|
|
4854
5676
|
* reports `undefined` again. A panel built from these reads at a glance as a
|
|
4855
|
-
* list of what has been
|
|
5677
|
+
* list of what has been customized and what has not.
|
|
4856
5678
|
*
|
|
4857
|
-
* The number is committed
|
|
4858
|
-
*
|
|
4859
|
-
* control never takes the caret away mid-word.
|
|
4860
|
-
*
|
|
5679
|
+
* The number is committed on Enter, Tab or blur, not on every keystroke, so
|
|
5680
|
+
* what the reader is part-way through typing is never sent anywhere and the
|
|
5681
|
+
* control never takes the caret away mid-word. What is typed may be arithmetic
|
|
5682
|
+
* (`40*2` commits 80); text that is not a number reverts. On commit the number
|
|
5683
|
+
* is pulled into `min`..`max` and the box is redrawn showing what was actually
|
|
5684
|
+
* kept. ArrowUp and ArrowDown step it at once (Shift: ten steps), Escape
|
|
5685
|
+
* abandons what was typed.
|
|
4861
5686
|
*
|
|
4862
5687
|
* What the reader types is read in their own locale, so `3,14` is 3.14 wherever
|
|
4863
5688
|
* the comma is the decimal separator, and the locale's own digits are numbers
|
|
@@ -4874,10 +5699,9 @@ export declare interface SparklineRowProps {
|
|
|
4874
5699
|
* @param props.onChange - Called with the committed number, or with `undefined` when the control is reset
|
|
4875
5700
|
* @param props.min - The smallest number accepted
|
|
4876
5701
|
* @param props.max - The largest number accepted
|
|
4877
|
-
* @param props.step - How far the
|
|
5702
|
+
* @param props.step - How far the arrow keys move the number
|
|
4878
5703
|
* @param props.decimalScale - How many digits after the decimal separator to keep
|
|
4879
5704
|
* @param props.suffix - A unit written after the number
|
|
4880
|
-
* @param props.hideControls - Whether to leave out the up and down steppers, which are left out by default
|
|
4881
5705
|
* @param props.disabled - Whether the control cannot be used at all
|
|
4882
5706
|
* @param props.disabledReason - One sentence saying why the control is off, drawn only while it is off
|
|
4883
5707
|
* @param props.onFocus - Called when the control takes focus
|
|
@@ -4898,7 +5722,7 @@ export declare interface SparklineRowProps {
|
|
|
4898
5722
|
* />
|
|
4899
5723
|
* ```
|
|
4900
5724
|
*/
|
|
4901
|
-
export declare function StyleNumberInput({ label, value, defaultValue, onChange, min, max, step, decimalScale, suffix,
|
|
5725
|
+
export declare function StyleNumberInput({ label, value, defaultValue, onChange, min, max, step, decimalScale, suffix, disabled, disabledReason, onFocus, onBlur, }: StyleNumberInputProps): default_2.JSX.Element;
|
|
4902
5726
|
|
|
4903
5727
|
/**
|
|
4904
5728
|
* Props for the StyleNumberInput component.
|
|
@@ -4913,7 +5737,7 @@ export declare interface StyleNumberInputProps {
|
|
|
4913
5737
|
* nothing and the control is showing `defaultValue`.
|
|
4914
5738
|
*/
|
|
4915
5739
|
value?: number | undefined;
|
|
4916
|
-
/** What is shown
|
|
5740
|
+
/** What is shown while the reader has entered nothing of their own. */
|
|
4917
5741
|
defaultValue: number;
|
|
4918
5742
|
/**
|
|
4919
5743
|
* Called when the reader commits a number, and with `undefined` when they
|
|
@@ -4928,18 +5752,18 @@ export declare interface StyleNumberInputProps {
|
|
|
4928
5752
|
min?: number;
|
|
4929
5753
|
/** The largest number accepted. Anything higher is pulled down to it on commit. */
|
|
4930
5754
|
max?: number;
|
|
4931
|
-
/** How far the
|
|
5755
|
+
/** How far the arrow keys move the number each time. Shift moves ten. */
|
|
4932
5756
|
step?: number;
|
|
4933
5757
|
/** How many digits after the decimal separator to keep. */
|
|
4934
5758
|
decimalScale?: number;
|
|
4935
5759
|
/** A unit written after the number, such as `"%"` or `"px"`. */
|
|
4936
5760
|
suffix?: string;
|
|
4937
5761
|
/**
|
|
4938
|
-
*
|
|
5762
|
+
* Kept so existing callers still compile; it no longer changes anything.
|
|
4939
5763
|
*
|
|
4940
|
-
*
|
|
4941
|
-
*
|
|
4942
|
-
* @
|
|
5764
|
+
* Figma's number fields never draw up and down steppers, so neither does
|
|
5765
|
+
* this one; the arrow keys step the number instead.
|
|
5766
|
+
* @deprecated The steppers are gone at either value.
|
|
4943
5767
|
*/
|
|
4944
5768
|
hideControls?: boolean;
|
|
4945
5769
|
/**
|
|
@@ -4962,10 +5786,7 @@ export declare interface StyleNumberInputProps {
|
|
|
4962
5786
|
* instead of announcing an unexplained unavailable control.
|
|
4963
5787
|
*
|
|
4964
5788
|
* Write it as a whole sentence naming what would make the control usable
|
|
4965
|
-
* again.
|
|
4966
|
-
* and silent, so a reader who could not type into it had no route at all to
|
|
4967
|
-
* learning why -- spec:6641 asks for the reason to travel with the ink, and
|
|
4968
|
-
* until now this component had nowhere to put it.
|
|
5789
|
+
* again.
|
|
4969
5790
|
*/
|
|
4970
5791
|
disabledReason?: string;
|
|
4971
5792
|
/** Called when the control takes focus. Forwarded unchanged. */
|
|
@@ -4982,12 +5803,15 @@ export declare interface StyleNumberInputProps {
|
|
|
4982
5803
|
/**
|
|
4983
5804
|
* A dropdown that says whether the reader chose its value or inherited it.
|
|
4984
5805
|
*
|
|
5806
|
+
* It is drawn as Figma's outlined select trigger (the theme's Select), and its
|
|
5807
|
+
* list is the dark listbox, opening over the trigger with the current choice
|
|
5808
|
+
* on top of it (design/figma-spec.md 6.4, 6.5).
|
|
5809
|
+
*
|
|
4985
5810
|
* It is a Mantine `Select` with one idea added: `undefined` means "nothing has
|
|
4986
|
-
* been chosen here", so the control shows `defaultValue`
|
|
4987
|
-
*
|
|
4988
|
-
* reset button appears beside it, and pressing that reset reports `undefined`
|
|
5811
|
+
* been chosen here", so the control shows `defaultValue` and offers no reset.
|
|
5812
|
+
* As soon as the reader picks something a reset button appears beside it, and pressing that reset reports `undefined`
|
|
4989
5813
|
* again. A panel built from these reads at a glance as a list of what has been
|
|
4990
|
-
*
|
|
5814
|
+
* customized and what has not.
|
|
4991
5815
|
*
|
|
4992
5816
|
* Reach for Mantine's own `Select` for an ordinary form. Reach for this one
|
|
4993
5817
|
* where a value has a sensible default that the reader is overriding rather
|
|
@@ -5044,7 +5868,7 @@ export declare interface StyleSelectProps {
|
|
|
5044
5868
|
* chosen anything and the control is showing `defaultValue`.
|
|
5045
5869
|
*/
|
|
5046
5870
|
value?: string | undefined;
|
|
5047
|
-
/** What is shown
|
|
5871
|
+
/** What is shown while the reader has chosen nothing of their own. */
|
|
5048
5872
|
defaultValue: string;
|
|
5049
5873
|
/** The choices offered, in the order they should be listed. */
|
|
5050
5874
|
options: StyleSelectOption[];
|
|
@@ -5076,11 +5900,7 @@ export declare interface StyleSelectProps {
|
|
|
5076
5900
|
* of announcing an unexplained unavailable control.
|
|
5077
5901
|
*
|
|
5078
5902
|
* Write it as a whole sentence naming what would make the control usable
|
|
5079
|
-
* again, not as a restatement that it is off.
|
|
5080
|
-
* disabled control here used to be dimmed and silent, so a reader who could
|
|
5081
|
-
* not press it had no route at all to learning why -- spec:6641 asks for
|
|
5082
|
-
* the reason to travel with the ink, and until now this component had
|
|
5083
|
-
* nowhere to put it.
|
|
5903
|
+
* again, not as a restatement that it is off.
|
|
5084
5904
|
*/
|
|
5085
5905
|
disabledReason?: string;
|
|
5086
5906
|
/** Called when the control takes focus. Forwarded unchanged. */
|
|
@@ -5096,6 +5916,147 @@ export declare interface StyleSelectProps {
|
|
|
5096
5916
|
*/
|
|
5097
5917
|
export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#61D095FF", "#F7B731FF", "#9B59B6FF", "#5B8FF980", "#FF6B6B80", "#61D09580", "#F7B73180", "#9B59B680"];
|
|
5098
5918
|
|
|
5919
|
+
/**
|
|
5920
|
+
* One toast: Figma's pill notification (design/figma-spec.md 8.6). Render it
|
|
5921
|
+
* yourself where it should sit, or let `ToastProvider` and `useToast` place,
|
|
5922
|
+
* time and replace it.
|
|
5923
|
+
* @param props - Component props
|
|
5924
|
+
* @param props.message - The message
|
|
5925
|
+
* @param props.icon - An optional 16px glyph before the message
|
|
5926
|
+
* @param props.action - An optional action button
|
|
5927
|
+
* @param props.withCloseButton - Show the dismiss X
|
|
5928
|
+
* @param props.onClose - Called when the dismiss X is pressed
|
|
5929
|
+
* @param props.closeLabel - The dismiss button's accessible name
|
|
5930
|
+
* @returns The toast
|
|
5931
|
+
*/
|
|
5932
|
+
export declare const Toast: ForwardRefExoticComponent<ToastProps & RefAttributes<HTMLDivElement>>;
|
|
5933
|
+
|
|
5934
|
+
/** A button in the toast that acts on what the message is about. */
|
|
5935
|
+
export declare interface ToastAction {
|
|
5936
|
+
/** The button's text, such as "Copy to clipboard". */
|
|
5937
|
+
label: string;
|
|
5938
|
+
/** What the button does. The toast stays up until it is dismissed. */
|
|
5939
|
+
onClick: (event: MouseEvent_2<HTMLButtonElement>) => void;
|
|
5940
|
+
}
|
|
5941
|
+
|
|
5942
|
+
/** The toast controls `useToast` returns. */
|
|
5943
|
+
export declare interface ToastApi {
|
|
5944
|
+
/** Show a toast, replacing the one on screen and restarting the timer. */
|
|
5945
|
+
show: (toast: ReactNode | ToastOptions) => void;
|
|
5946
|
+
/** Take the toast down. */
|
|
5947
|
+
hide: () => void;
|
|
5948
|
+
}
|
|
5949
|
+
|
|
5950
|
+
/** What `useToast().show` takes: a message, or a message with its extras. */
|
|
5951
|
+
export declare interface ToastOptions extends Omit<ToastProps, "onClose" | "message"> {
|
|
5952
|
+
/** The message. */
|
|
5953
|
+
message: ReactNode;
|
|
5954
|
+
/**
|
|
5955
|
+
* How long it stays, in ms; `null` keeps it until it is dismissed or
|
|
5956
|
+
* replaced. Defaults to Figma's rule: about 3 s for a message under 20
|
|
5957
|
+
* characters, about 6 s for a longer one, and never for a toast with an
|
|
5958
|
+
* action.
|
|
5959
|
+
*/
|
|
5960
|
+
duration?: number | null;
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
/**
|
|
5964
|
+
* Props for Toast: the message and its extras, plus any Mantine `Notification`
|
|
5965
|
+
* prop except the ones the toast owns.
|
|
5966
|
+
*/
|
|
5967
|
+
export declare interface ToastProps extends Omit<NotificationProps, "children" | "title" | "icon" | "onClose" | "withCloseButton" | "role"> {
|
|
5968
|
+
/** The message, such as "Zoom to selection". */
|
|
5969
|
+
message: ReactNode;
|
|
5970
|
+
/** An optional 16px glyph before the message. */
|
|
5971
|
+
icon?: ReactNode;
|
|
5972
|
+
/** An optional action button after the message. */
|
|
5973
|
+
action?: ToastAction;
|
|
5974
|
+
/** Show the dismiss X at the end. @default false */
|
|
5975
|
+
withCloseButton?: boolean;
|
|
5976
|
+
/** Called when the dismiss X is pressed. */
|
|
5977
|
+
onClose?: () => void;
|
|
5978
|
+
/** The dismiss button's accessible name. @default "Dismiss" */
|
|
5979
|
+
closeLabel?: string;
|
|
5980
|
+
}
|
|
5981
|
+
|
|
5982
|
+
/**
|
|
5983
|
+
* The one toast the page shows (design/figma-spec.md 8.6): centered
|
|
5984
|
+
* horizontally near the bottom of the window. Only one exists; a new one
|
|
5985
|
+
* replaces the text and restarts the timer. It appears and goes in one frame,
|
|
5986
|
+
* and hovering it does not pause the timer. Wrap the application once and call
|
|
5987
|
+
* `useToast()` anywhere inside.
|
|
5988
|
+
* @param props - Component props
|
|
5989
|
+
* @param props.children - The part of the tree that may show toasts
|
|
5990
|
+
* @param props.bottom - The distance from the window's bottom edge, in px
|
|
5991
|
+
* @param props.zIndex - The layer the toast draws at
|
|
5992
|
+
* @returns The provider and, while a toast is up, the toast
|
|
5993
|
+
* @example
|
|
5994
|
+
* ```tsx
|
|
5995
|
+
* <ToastProvider>
|
|
5996
|
+
* <App />
|
|
5997
|
+
* </ToastProvider>
|
|
5998
|
+
* // anywhere inside:
|
|
5999
|
+
* const toast = useToast();
|
|
6000
|
+
* toast.show("Zoom to selection");
|
|
6001
|
+
* ```
|
|
6002
|
+
*/
|
|
6003
|
+
export declare function ToastProvider({ children, bottom, zIndex }: ToastProviderProps): JSX.Element;
|
|
6004
|
+
|
|
6005
|
+
/** Props for ToastProvider. */
|
|
6006
|
+
export declare interface ToastProviderProps {
|
|
6007
|
+
/** The part of the tree that may show toasts. Usually the whole application. */
|
|
6008
|
+
children: ReactNode;
|
|
6009
|
+
/**
|
|
6010
|
+
* The distance from the window's bottom edge to the toast's, in px. Figma
|
|
6011
|
+
* keeps the toast 16px above its bottom toolbar; the default clears a
|
|
6012
|
+
* 60px toolbar the same way.
|
|
6013
|
+
* @default 76
|
|
6014
|
+
*/
|
|
6015
|
+
bottom?: number;
|
|
6016
|
+
/** The layer the toast draws at. @default 1300 */
|
|
6017
|
+
zIndex?: number;
|
|
6018
|
+
}
|
|
6019
|
+
|
|
6020
|
+
/**
|
|
6021
|
+
* A 24 x 24 icon toggle (design/figma-spec.md 4.4): lock aspect ratio, use as mask, visibility.
|
|
6022
|
+
* @param props - Component props
|
|
6023
|
+
* @returns The toggle
|
|
6024
|
+
* @example
|
|
6025
|
+
* ```tsx
|
|
6026
|
+
* <ToggleIconButton label="Lock aspect ratio" icon={<UiGlyph name="unlock" />} checkedIcon={<UiGlyph name="lock" />} />
|
|
6027
|
+
* ```
|
|
6028
|
+
*/
|
|
6029
|
+
export declare const ToggleIconButton: ForwardRefExoticComponent<ToggleIconButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
6030
|
+
|
|
6031
|
+
/**
|
|
6032
|
+
* Props for ToggleIconButton.
|
|
6033
|
+
*
|
|
6034
|
+
* Every ActionIcon prop but `variant`, `children` and `onChange` is accepted and reaches the
|
|
6035
|
+
* button (`size`, `disabled`, `className`, a `data-` attribute ...).
|
|
6036
|
+
*/
|
|
6037
|
+
export declare interface ToggleIconButtonProps extends Omit<ActionIconProps, "variant" | "children">, ElementProps<"button", "color" | "onChange" | keyof ActionIconProps> {
|
|
6038
|
+
/** Whether the toggle is on (controlled). */
|
|
6039
|
+
checked?: boolean;
|
|
6040
|
+
/** Whether the toggle starts on (uncontrolled). @default false */
|
|
6041
|
+
defaultChecked?: boolean;
|
|
6042
|
+
/** Called with the new state when the toggle flips. */
|
|
6043
|
+
onChange?: (checked: boolean) => void;
|
|
6044
|
+
/** The accessible name, and the tooltip text. */
|
|
6045
|
+
label: string;
|
|
6046
|
+
/** The glyph. */
|
|
6047
|
+
icon: ReactNode;
|
|
6048
|
+
/** The glyph drawn while on, for a `swap` toggle (eye / eye closed). */
|
|
6049
|
+
checkedIcon?: ReactNode;
|
|
6050
|
+
/**
|
|
6051
|
+
* `fill` (default): on is the selected ground with a brand glyph (lock aspect ratio, use as
|
|
6052
|
+
* mask). `swap`: never filled, on swaps the glyph (the visibility eye).
|
|
6053
|
+
* @default "fill"
|
|
6054
|
+
*/
|
|
6055
|
+
variant?: "fill" | "swap";
|
|
6056
|
+
/** Show the tooltip. @default true */
|
|
6057
|
+
withTooltip?: boolean;
|
|
6058
|
+
}
|
|
6059
|
+
|
|
5099
6060
|
/**
|
|
5100
6061
|
* A single boolean on a row of its own, packed tighter than every other row
|
|
5101
6062
|
* type.
|
|
@@ -5107,12 +6068,13 @@ export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#6
|
|
|
5107
6068
|
* 1. **The label is the only word on the row, and the verb is deleted from
|
|
5108
6069
|
* it.** `Show labels` is `Labels`; `Animate transitions` is `Transitions`.
|
|
5109
6070
|
* The checkbox already says "show", so the word is spent on what is shown.
|
|
5110
|
-
* 2. **
|
|
5111
|
-
* the
|
|
5112
|
-
*
|
|
6071
|
+
* 2. **It is Figma's checkbox row**: 32px tall like every other property row,
|
|
6072
|
+
* the neutral (panel) checkbox that stays gray when checked, and the word
|
|
6073
|
+
* 8px after the box (design/figma-spec.md 5.10).
|
|
5113
6074
|
*
|
|
5114
|
-
* The control is a Mantine `Checkbox` at 16px, or a
|
|
5115
|
-
* when the boolean is a live mode rather than an
|
|
6075
|
+
* The control is a Mantine `Checkbox` at 16px (`variant="neutral"`), or a
|
|
6076
|
+
* Mantine `Switch` at 32x16 when the boolean is a live mode rather than an
|
|
6077
|
+
* option. Both are real inputs,
|
|
5116
6078
|
* so Tab reaches them, Space toggles them, and a screen reader reads the state
|
|
5117
6079
|
* out; clicking the word works as well as clicking the box.
|
|
5118
6080
|
*
|
|
@@ -5123,7 +6085,7 @@ export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#6
|
|
|
5123
6085
|
* @param props.checked - Whether the toggle is on, when driven from your own state
|
|
5124
6086
|
* @param props.defaultChecked - Whether the toggle starts on, when the row keeps its own state
|
|
5125
6087
|
* @param props.onChange - Called with the new state first and the event that caused it second
|
|
5126
|
-
* @param props.control - Which control to draw: a 16px checkbox, or a
|
|
6088
|
+
* @param props.control - Which control to draw: a 16px checkbox, or a 32x16 switch for a live mode
|
|
5127
6089
|
* @param props.trailing - What to put in the fixed 24px slot at the end of the row
|
|
5128
6090
|
* @param props.disabled - Whether the toggle can be changed
|
|
5129
6091
|
* @param props.disabledReason - One sentence saying why the toggle is off, drawn only while it is off
|
|
@@ -5155,8 +6117,8 @@ export declare function ToggleRow({ label, checked, defaultChecked, onChange, co
|
|
|
5155
6117
|
* That is a rule about the design rather than about the runtime, so the group
|
|
5156
6118
|
* holds the line where the design is edited: it warns on the console in a
|
|
5157
6119
|
* development build when it is given fewer than two children, and renders them
|
|
5158
|
-
* anyway. The pitch needs no gap -- each row is exactly
|
|
5159
|
-
* column is already the
|
|
6120
|
+
* anyway. The pitch needs no gap -- each row is exactly 32px tall, so a plain
|
|
6121
|
+
* column is already the row pitch.
|
|
5160
6122
|
*
|
|
5161
6123
|
* The rows are wrapped in a group so a screen reader announces them as one set
|
|
5162
6124
|
* rather than as loose checkboxes. Name it: point `labelledBy` at the heading
|
|
@@ -5265,7 +6227,7 @@ export declare interface ToggleRowProps {
|
|
|
5265
6227
|
* Whether the toggle can be changed.
|
|
5266
6228
|
*
|
|
5267
6229
|
* A disabled row keeps its place and its word, drops to the dimmed text
|
|
5268
|
-
*
|
|
6230
|
+
* color that Mantine's own disabled controls use, and is announced as
|
|
5269
6231
|
* unavailable rather than merely looking it.
|
|
5270
6232
|
*/
|
|
5271
6233
|
disabled?: boolean;
|
|
@@ -5278,12 +6240,9 @@ export declare interface ToggleRowProps {
|
|
|
5278
6240
|
* control's accessible description, so the reason reaches a pointer user
|
|
5279
6241
|
* and a screen reader user alike.
|
|
5280
6242
|
*
|
|
5281
|
-
*
|
|
5282
|
-
*
|
|
5283
|
-
*
|
|
5284
|
-
* therefore dimmed and permanently unexplained, which is what spec:6641
|
|
5285
|
-
* forbids. The caller supplies the sentence; the library never invents one,
|
|
5286
|
-
* because only the call site knows what would turn the control back on.
|
|
6243
|
+
* Write it as a whole sentence naming what would make the toggle usable.
|
|
6244
|
+
* The library never invents one: only the caller knows what would turn the
|
|
6245
|
+
* control back on.
|
|
5287
6246
|
*/
|
|
5288
6247
|
disabledReason?: string;
|
|
5289
6248
|
/**
|
|
@@ -5293,10 +6252,7 @@ export declare interface ToggleRowProps {
|
|
|
5293
6252
|
* The row draws a filled attribute glyph beside its word -- the same filled
|
|
5294
6253
|
* glyph `PanelField` uses to say the same thing -- so a panel can say "this
|
|
5295
6254
|
* follows the data" without spending a row on a fixed-or-by-attribute
|
|
5296
|
-
* switch.
|
|
5297
|
-
* until now `PanelField` was the only control in the library able to say
|
|
5298
|
-
* so, which is why a bound boolean had to be drawn as a number field or not
|
|
5299
|
-
* drawn at all.
|
|
6255
|
+
* switch.
|
|
5300
6256
|
* @default false
|
|
5301
6257
|
*/
|
|
5302
6258
|
bound?: boolean;
|
|
@@ -5322,7 +6278,7 @@ export declare interface ToggleRowProps {
|
|
|
5322
6278
|
* it.
|
|
5323
6279
|
*
|
|
5324
6280
|
* Reach for it when a setting is a yes or no that brings its own settings with
|
|
5325
|
-
* it -- a glow with a radius and a
|
|
6281
|
+
* it -- a glow with a radius and a color, an outline with a width, a legend
|
|
5326
6282
|
* with a position. Turning the feature off takes its controls off the screen,
|
|
5327
6283
|
* so a panel shows only what is currently in play.
|
|
5328
6284
|
*
|
|
@@ -5398,7 +6354,7 @@ export declare interface ToggleWithContentProps {
|
|
|
5398
6354
|
* Whether the toggle can be changed.
|
|
5399
6355
|
*
|
|
5400
6356
|
* A disabled toggle keeps its place and its word, drops to the dimmed text
|
|
5401
|
-
*
|
|
6357
|
+
* color Mantine's own disabled controls use, and is announced as
|
|
5402
6358
|
* unavailable rather than merely looking it. Controls already revealed stay
|
|
5403
6359
|
* revealed; disable them yourself if they should not be touched either.
|
|
5404
6360
|
*/
|
|
@@ -5412,12 +6368,9 @@ export declare interface ToggleWithContentProps {
|
|
|
5412
6368
|
* accessible description, so the reason reaches a pointer user and a screen
|
|
5413
6369
|
* reader user alike.
|
|
5414
6370
|
*
|
|
5415
|
-
*
|
|
5416
|
-
*
|
|
5417
|
-
*
|
|
5418
|
-
* for the one reason to travel with the disabled ink; until now this
|
|
5419
|
-
* component had nowhere to put it. The caller supplies the sentence -- only
|
|
5420
|
-
* the call site knows what would turn the feature back on.
|
|
6371
|
+
* Write it as a whole sentence naming what would make the toggle usable.
|
|
6372
|
+
* The library never invents one: only the caller knows what would turn the
|
|
6373
|
+
* feature back on.
|
|
5421
6374
|
*/
|
|
5422
6375
|
disabledReason?: string;
|
|
5423
6376
|
/**
|
|
@@ -5427,9 +6380,7 @@ export declare interface ToggleWithContentProps {
|
|
|
5427
6380
|
* The toggle draws a filled attribute glyph beside its word -- the same
|
|
5428
6381
|
* filled glyph `PanelField` uses to say the same thing -- so a panel can
|
|
5429
6382
|
* say "this follows the data" without spending a row on a
|
|
5430
|
-
* fixed-or-by-attribute switch.
|
|
5431
|
-
* numeric one can, and until now `PanelField` was the only control in the
|
|
5432
|
-
* library able to say so.
|
|
6383
|
+
* fixed-or-by-attribute switch.
|
|
5433
6384
|
* @default false
|
|
5434
6385
|
*/
|
|
5435
6386
|
bound?: boolean;
|
|
@@ -5466,6 +6417,166 @@ export declare interface ToggleWithContentProps {
|
|
|
5466
6417
|
*/
|
|
5467
6418
|
export declare function toHexaColor(hex: string, opacity: number): string;
|
|
5468
6419
|
|
|
6420
|
+
/** The floating editor toolbar, with `Toolbar.Divider`. */
|
|
6421
|
+
export declare const Toolbar: typeof ToolbarRoot & {
|
|
6422
|
+
Divider: typeof ToolbarDivider;
|
|
6423
|
+
};
|
|
6424
|
+
|
|
6425
|
+
/**
|
|
6426
|
+
* The toolbar's 1px divider, full height (48).
|
|
6427
|
+
* @returns The divider
|
|
6428
|
+
*/
|
|
6429
|
+
declare function ToolbarDivider(): default_2.JSX.Element;
|
|
6430
|
+
|
|
6431
|
+
/**
|
|
6432
|
+
* Props for the Toolbar component.
|
|
6433
|
+
*/
|
|
6434
|
+
export declare interface ToolbarProps extends BoxProps, ElementProps<"div"> {
|
|
6435
|
+
/** Accessible name of the toolbar. Defaults to the "Tools" label. */
|
|
6436
|
+
"aria-label"?: string;
|
|
6437
|
+
/**
|
|
6438
|
+
* Pin the toolbar to the bottom center of the window, 12px up (Figma's position). Leave it off
|
|
6439
|
+
* to position the toolbar yourself.
|
|
6440
|
+
*/
|
|
6441
|
+
floating?: boolean;
|
|
6442
|
+
/** Tool groups, tool buttons, dividers and a mode switch. */
|
|
6443
|
+
children?: default_2.ReactNode;
|
|
6444
|
+
}
|
|
6445
|
+
|
|
6446
|
+
/**
|
|
6447
|
+
* The floating editor toolbar: a white (dark #2c2c2c) bar 48 tall with 13px corners and the
|
|
6448
|
+
* 200 elevation, holding tool buttons, tool groups with flyouts, dividers and a
|
|
6449
|
+
* `SegmentedControl variant="toolbar"` mode switch.
|
|
6450
|
+
*
|
|
6451
|
+
* It is one Tab stop: focus lands on the selected tool, and ArrowLeft / ArrowRight / Home / End
|
|
6452
|
+
* move between tools, chevrons and the mode radios.
|
|
6453
|
+
* @param props - Component props
|
|
6454
|
+
* @param props.floating - Pin the toolbar to the bottom center of the window
|
|
6455
|
+
* @param props.children - Tool groups, tool buttons, dividers and a mode switch
|
|
6456
|
+
* @param props.className - Extra class on the root
|
|
6457
|
+
* @param props.onKeyDown - Called before the roving-focus key handling
|
|
6458
|
+
* @param props.onFocus - Called before the roving-focus bookkeeping
|
|
6459
|
+
* @returns The toolbar
|
|
6460
|
+
* @example
|
|
6461
|
+
* ```tsx
|
|
6462
|
+
* <Toolbar aria-label="Editor" floating>
|
|
6463
|
+
* <ToolGroup label="Shape tools" tools={shapes} activeTool={tool} onToolChange={setTool} />
|
|
6464
|
+
* <Toolbar.Divider />
|
|
6465
|
+
* <SegmentedControl variant="toolbar" data={modes} />
|
|
6466
|
+
* </Toolbar>
|
|
6467
|
+
* ```
|
|
6468
|
+
*/
|
|
6469
|
+
declare function ToolbarRoot({ floating, children, className, onKeyDown, onFocus, ...others }: ToolbarProps): default_2.JSX.Element;
|
|
6470
|
+
|
|
6471
|
+
/**
|
|
6472
|
+
* A 32 x 32 toolbar tool (Figma's toolbelt button): transparent at rest, `--cm-bg-hover` under the
|
|
6473
|
+
* pointer, the brand fill when selected, a 1px inside focus ring (a double ring when selected).
|
|
6474
|
+
* The tooltip opens above with the shortcut after the name.
|
|
6475
|
+
* @param props - Component props
|
|
6476
|
+
* @param props.label - The tool's name
|
|
6477
|
+
* @param props.icon - The tool's glyph
|
|
6478
|
+
* @param props.shortcut - The keyboard shortcut shown in the tooltip
|
|
6479
|
+
* @param props.selected - Whether this is the current tool
|
|
6480
|
+
* @param props.tooltipPosition - Where the tooltip opens
|
|
6481
|
+
* @returns The tool button
|
|
6482
|
+
*/
|
|
6483
|
+
export declare const ToolButton: default_2.ForwardRefExoticComponent<ToolButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
6484
|
+
|
|
6485
|
+
/**
|
|
6486
|
+
* Props for the ToolButton component.
|
|
6487
|
+
*/
|
|
6488
|
+
export declare interface ToolButtonProps extends Omit<UnstyledButtonProps, "children">, Omit<ElementProps<"button">, "children"> {
|
|
6489
|
+
/** The tool's name: its accessible name and its tooltip. */
|
|
6490
|
+
label: string;
|
|
6491
|
+
/** The tool's glyph, drawn in a 24px box. */
|
|
6492
|
+
icon: default_2.ReactNode;
|
|
6493
|
+
/** The keyboard shortcut shown in the tooltip, such as `"F"`. */
|
|
6494
|
+
shortcut?: string;
|
|
6495
|
+
/**
|
|
6496
|
+
* Whether this is the current tool (`aria-pressed`): a brand fill with a white glyph. Leave it
|
|
6497
|
+
* undefined for a button that runs an action rather than picking a tool.
|
|
6498
|
+
*/
|
|
6499
|
+
selected?: boolean;
|
|
6500
|
+
/** Where the tooltip opens. Defaults to above, as on Figma's bottom toolbar. */
|
|
6501
|
+
tooltipPosition?: TooltipProps["position"];
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6504
|
+
/**
|
|
6505
|
+
* A tool and its flyout (Figma's tool group): the face is the LAST tool picked from the flyout,
|
|
6506
|
+
* and a 16 x 32 chevron 1px after it opens a dark menu 4px above, start-aligned to the chevron,
|
|
6507
|
+
* whose rows are radios with a check on the current face. Picking a row selects the tool, makes
|
|
6508
|
+
* it the face and closes the menu.
|
|
6509
|
+
* @param props - Component props
|
|
6510
|
+
* @param props.label - The chevron's name, such as "Shape tools"
|
|
6511
|
+
* @param props.tools - The tools of the group
|
|
6512
|
+
* @param props.activeTool - The toolbar's current tool
|
|
6513
|
+
* @param props.onToolChange - Called with a tool's value when it is picked
|
|
6514
|
+
* @param props.defaultFace - The tool the face shows until one is picked
|
|
6515
|
+
* @param props.chevronProps - Extra attributes for the chevron button
|
|
6516
|
+
* @returns The tool group
|
|
6517
|
+
*/
|
|
6518
|
+
export declare function ToolGroup({ label, tools, activeTool, onToolChange, defaultFace, chevronProps, }: ToolGroupProps): default_2.JSX.Element;
|
|
6519
|
+
|
|
6520
|
+
/**
|
|
6521
|
+
* Props for the ToolGroup component.
|
|
6522
|
+
*/
|
|
6523
|
+
export declare interface ToolGroupProps {
|
|
6524
|
+
/** The chevron's accessible name and tooltip, and the flyout's name, such as "Shape tools". */
|
|
6525
|
+
label: string;
|
|
6526
|
+
/** The tools of the group, in flyout order. */
|
|
6527
|
+
tools: readonly ToolItem[];
|
|
6528
|
+
/** The toolbar's current tool. When it is one of this group's tools, the face shows it selected. */
|
|
6529
|
+
activeTool?: string | null;
|
|
6530
|
+
/** Called with a tool's value when the face is clicked or a flyout row is picked. */
|
|
6531
|
+
onToolChange?: (value: string) => void;
|
|
6532
|
+
/** The tool the face shows until one is picked. Defaults to the first tool. */
|
|
6533
|
+
defaultFace?: string;
|
|
6534
|
+
/** Extra attributes for the chevron button, such as a `data-testid` or a forced `data-state`. */
|
|
6535
|
+
chevronProps?: default_2.ComponentPropsWithoutRef<"button"> & {
|
|
6536
|
+
[data: `data-${string}`]: string | undefined;
|
|
6537
|
+
};
|
|
6538
|
+
}
|
|
6539
|
+
|
|
6540
|
+
/** One tool of a group: what the face and the flyout row show. */
|
|
6541
|
+
export declare interface ToolItem {
|
|
6542
|
+
/** The tool's identifier, handed to `onToolChange`. */
|
|
6543
|
+
value: string;
|
|
6544
|
+
/** The tool's name. */
|
|
6545
|
+
label: string;
|
|
6546
|
+
/** The tool's glyph (drawn in a 24px box). */
|
|
6547
|
+
icon: default_2.ReactNode;
|
|
6548
|
+
/** The keyboard shortcut shown in the tooltip and the flyout, such as `"R"`. */
|
|
6549
|
+
shortcut?: string;
|
|
6550
|
+
}
|
|
6551
|
+
|
|
6552
|
+
/**
|
|
6553
|
+
* A tooltip label with its keyboard shortcut on the same line (design/figma-spec.md
|
|
6554
|
+
* 8.3): the shortcut sits 12px after the label in the tooltip's secondary text
|
|
6555
|
+
* color, as Figma's "Align left Alt+A". Pass it as a Tooltip's `label`. The
|
|
6556
|
+
* tooltip's `aria-describedby` reads both.
|
|
6557
|
+
* @param props - Component props
|
|
6558
|
+
* @param props.label - What the control does
|
|
6559
|
+
* @param props.shortcut - Its keyboard shortcut
|
|
6560
|
+
* @returns The label and shortcut
|
|
6561
|
+
* @example
|
|
6562
|
+
* ```tsx
|
|
6563
|
+
* <Tooltip label={<TooltipShortcut label="Align left" shortcut="Alt+A" />}>
|
|
6564
|
+
* <ActionIcon aria-label="Align left">...</ActionIcon>
|
|
6565
|
+
* </Tooltip>
|
|
6566
|
+
* ```
|
|
6567
|
+
*/
|
|
6568
|
+
export declare function TooltipShortcut({ label, shortcut }: TooltipShortcutProps): JSX.Element;
|
|
6569
|
+
|
|
6570
|
+
/**
|
|
6571
|
+
* Props for TooltipShortcut.
|
|
6572
|
+
*/
|
|
6573
|
+
export declare interface TooltipShortcutProps {
|
|
6574
|
+
/** What the control does, such as "Align left". */
|
|
6575
|
+
label: ReactNode;
|
|
6576
|
+
/** Its keyboard shortcut, such as "Alt+A". */
|
|
6577
|
+
shortcut: ReactNode;
|
|
6578
|
+
}
|
|
6579
|
+
|
|
5469
6580
|
/**
|
|
5470
6581
|
* The fixed 24px slot every panel row ends with.
|
|
5471
6582
|
*
|
|
@@ -5474,8 +6585,8 @@ export declare function toHexaColor(hex: string, opacity: number): string;
|
|
|
5474
6585
|
* and common: it is what makes a row with no extra control end level with a row
|
|
5475
6586
|
* that has one.
|
|
5476
6587
|
*
|
|
5477
|
-
* The panel this library lays out is
|
|
5478
|
-
* `16 +
|
|
6588
|
+
* The panel this library lays out is 240px wide and spends it as
|
|
6589
|
+
* `16 + 88 + 8 + 88 + 8 + 24 + 8`: leading padding, two fields with a gutter
|
|
5479
6590
|
* between them, a gap, this slot, and trailing padding. Dropping the slot when
|
|
5480
6591
|
* it is empty is what breaks that.
|
|
5481
6592
|
* @param props - Component props
|
|
@@ -5501,6 +6612,181 @@ export declare interface TrailingSlotProps {
|
|
|
5501
6612
|
children?: default_2.ReactNode;
|
|
5502
6613
|
}
|
|
5503
6614
|
|
|
6615
|
+
/**
|
|
6616
|
+
* A layer tree with Figma's rows and the WAI-ARIA tree-view keyboard model
|
|
6617
|
+
* (design/figma-spec.md 10.1).
|
|
6618
|
+
*
|
|
6619
|
+
* The tree renders; the caller owns the data. Selection and expansion are controlled or
|
|
6620
|
+
* uncontrolled; renaming and moving are reported through `onRename` and `onMove`.
|
|
6621
|
+
*
|
|
6622
|
+
* Keyboard (one Tab stop, roving focus): ArrowUp / ArrowDown move; ArrowRight opens a closed
|
|
6623
|
+
* parent or moves to its first child; ArrowLeft closes an open parent or moves to the parent;
|
|
6624
|
+
* Home / End; type-ahead; Enter or Space selects (Shift extends, Control / Command toggles); `*`
|
|
6625
|
+
* opens every sibling; F2 renames; Alt+L closes everything; with `onMove`, Alt+ArrowUp /
|
|
6626
|
+
* Alt+ArrowDown move the focused item one place among its siblings.
|
|
6627
|
+
* Pointer: click selects (Shift range, Control / Command toggle); the caret opens one row;
|
|
6628
|
+
* double-click renames; drag a row to move it.
|
|
6629
|
+
* @param props - Component props
|
|
6630
|
+
* @param props.items - The items or pages
|
|
6631
|
+
* @param props.label - The accessible name
|
|
6632
|
+
* @param props.selected - Selected ids (controlled)
|
|
6633
|
+
* @param props.defaultSelected - Selected ids to start with
|
|
6634
|
+
* @param props.onSelect - Called with the new selection
|
|
6635
|
+
* @param props.expanded - Expanded ids (controlled)
|
|
6636
|
+
* @param props.defaultExpanded - Expanded ids to start with
|
|
6637
|
+
* @param props.onExpandedChange - Called with the expanded ids
|
|
6638
|
+
* @param props.multiselect - Allow several selected rows
|
|
6639
|
+
* @param props.onRename - Called with a new name; turns renaming on
|
|
6640
|
+
* @param props.onMove - Called when a row is dropped somewhere new or moved from the keyboard
|
|
6641
|
+
* @param props.stickyRoots - Pin expanded top-level rows while scrolling
|
|
6642
|
+
* @param props.height - The scrolling height when virtualized
|
|
6643
|
+
* @param props.renameLabel - The rename field's accessible name
|
|
6644
|
+
* @returns The tree
|
|
6645
|
+
*/
|
|
6646
|
+
export declare function Tree({ items, label, selected, defaultSelected, onSelect, expanded, defaultExpanded, onExpandedChange, multiselect, onRename, onMove, stickyRoots, height, renameLabel, }: TreeProps): default_2.JSX.Element;
|
|
6647
|
+
|
|
6648
|
+
/**
|
|
6649
|
+
* One row of a layer tree, as Figma draws it (design/figma-spec.md 10.1): 32 tall, a 16px caret
|
|
6650
|
+
* slot and a 16px type glyph indented 24px per level, the name at 11/32, and the trailing
|
|
6651
|
+
* toggles. Hover, selection and the selected-parent band are pseudo-element fills behind the
|
|
6652
|
+
* content. It is a `treeitem`; `Tree` renders it with the keyboard model, but it can be drawn on
|
|
6653
|
+
* its own (a static preview, a story).
|
|
6654
|
+
* @param props - Component props
|
|
6655
|
+
* @returns The row
|
|
6656
|
+
*/
|
|
6657
|
+
export declare const TreeItem: default_2.ForwardRefExoticComponent<TreeItemProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
6658
|
+
|
|
6659
|
+
/**
|
|
6660
|
+
* Props for the TreeItem component: one row of a layer tree.
|
|
6661
|
+
*/
|
|
6662
|
+
export declare interface TreeItemProps extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
6663
|
+
/** The visible name. */
|
|
6664
|
+
name: string;
|
|
6665
|
+
/** The 16 x 16 type glyph. */
|
|
6666
|
+
icon?: default_2.ReactNode;
|
|
6667
|
+
/** Depth, 1 for a top-level row. Each level indents 24px. */
|
|
6668
|
+
level?: number;
|
|
6669
|
+
/** Whether the row has children (draws the caret). */
|
|
6670
|
+
hasChildren?: boolean;
|
|
6671
|
+
/** Whether its children are shown. */
|
|
6672
|
+
expanded?: boolean;
|
|
6673
|
+
/** Whether the row is selected. */
|
|
6674
|
+
selected?: boolean;
|
|
6675
|
+
/** The fill it draws; see Tree. Defaults to `selected` or `none`. */
|
|
6676
|
+
tint?: TreeRowTint;
|
|
6677
|
+
/** `"component"`: purple name and glyph. */
|
|
6678
|
+
tone?: "default" | "component";
|
|
6679
|
+
/** A hidden layer: tertiary name and glyph. */
|
|
6680
|
+
dimmed?: boolean;
|
|
6681
|
+
/** Weight 600 and a primary glyph. Defaults to true for a top-level row with children. */
|
|
6682
|
+
strong?: boolean;
|
|
6683
|
+
/** The trailing toggles, revealed on hover or focus. */
|
|
6684
|
+
actions?: default_2.ReactNode;
|
|
6685
|
+
/** 1-based position among its siblings, for assistive technology. */
|
|
6686
|
+
posInSet?: number;
|
|
6687
|
+
/** How many siblings it has, for assistive technology. */
|
|
6688
|
+
setSize?: number;
|
|
6689
|
+
/** Drawn in place of the name, e.g. an InlineRename. */
|
|
6690
|
+
nameSlot?: default_2.ReactNode;
|
|
6691
|
+
/** Called when the caret is clicked. */
|
|
6692
|
+
onExpandToggle?: (event: default_2.MouseEvent) => void;
|
|
6693
|
+
}
|
|
6694
|
+
|
|
6695
|
+
/** Anything a tree can hold: an id, and optionally children of the same shape. */
|
|
6696
|
+
declare interface TreeLike<T> {
|
|
6697
|
+
id: string;
|
|
6698
|
+
children?: readonly T[];
|
|
6699
|
+
}
|
|
6700
|
+
|
|
6701
|
+
/** Where a drop lands. `index` counts the parent's children with the moved item already removed. */
|
|
6702
|
+
export declare interface TreeMove {
|
|
6703
|
+
id: string;
|
|
6704
|
+
parentId: string | null;
|
|
6705
|
+
index: number;
|
|
6706
|
+
}
|
|
6707
|
+
|
|
6708
|
+
/** One item of a Tree. Nest items through `children`. */
|
|
6709
|
+
export declare interface TreeNodeData {
|
|
6710
|
+
/** Stable, unique across the whole tree. */
|
|
6711
|
+
id: string;
|
|
6712
|
+
/** The visible name; also the item's accessible name and its type-ahead key. */
|
|
6713
|
+
name: string;
|
|
6714
|
+
/** The 16 x 16 type glyph drawn before the name. */
|
|
6715
|
+
icon?: default_2.ReactNode;
|
|
6716
|
+
/**
|
|
6717
|
+
* The item's children. An item with a `children` array (even an empty one) is a container
|
|
6718
|
+
* that other items can be dropped into; one without is a leaf.
|
|
6719
|
+
*/
|
|
6720
|
+
children?: readonly TreeNodeData[];
|
|
6721
|
+
/** `"component"` draws the name and glyph in the component (purple) color. */
|
|
6722
|
+
tone?: "default" | "component";
|
|
6723
|
+
/** A hidden layer: the name and glyph draw in the tertiary color. */
|
|
6724
|
+
dimmed?: boolean;
|
|
6725
|
+
/**
|
|
6726
|
+
* Draw the name at weight 600 with a primary-color glyph. Defaults to true for a top-level
|
|
6727
|
+
* item with a `children` array, even an empty one (Figma's top-level frames), false otherwise.
|
|
6728
|
+
*/
|
|
6729
|
+
strong?: boolean;
|
|
6730
|
+
/**
|
|
6731
|
+
* The row's trailing toggles (lock, eye): the caller's own controls. They stay hidden until
|
|
6732
|
+
* the row is hovered or focused; a control with `aria-pressed="true"`, `aria-checked="true"`
|
|
6733
|
+
* or `data-pinned` stays visible.
|
|
6734
|
+
*/
|
|
6735
|
+
actions?: default_2.ReactNode;
|
|
6736
|
+
}
|
|
6737
|
+
|
|
6738
|
+
/**
|
|
6739
|
+
* Props for the Tree component.
|
|
6740
|
+
*/
|
|
6741
|
+
export declare interface TreeProps {
|
|
6742
|
+
/** The items, nested through `children`. */
|
|
6743
|
+
items: readonly TreeNodeData[];
|
|
6744
|
+
/** The tree's accessible name. Defaults to "Layers". */
|
|
6745
|
+
label?: string;
|
|
6746
|
+
/** Selected ids (controlled). */
|
|
6747
|
+
selected?: readonly string[];
|
|
6748
|
+
/** Selected ids to start with (uncontrolled). */
|
|
6749
|
+
defaultSelected?: readonly string[];
|
|
6750
|
+
/** Called with the new selection. */
|
|
6751
|
+
onSelect?: (ids: string[], event?: default_2.SyntheticEvent) => void;
|
|
6752
|
+
/** Expanded ids (controlled). */
|
|
6753
|
+
expanded?: readonly string[];
|
|
6754
|
+
/** Expanded ids to start with (uncontrolled). */
|
|
6755
|
+
defaultExpanded?: readonly string[];
|
|
6756
|
+
/** Called with the new set of expanded ids. */
|
|
6757
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
6758
|
+
/** Allow several selected rows (Shift and Control/Command). Default true. */
|
|
6759
|
+
multiselect?: boolean;
|
|
6760
|
+
/**
|
|
6761
|
+
* Called with a new name. Giving it turns on renaming: F2 or a double-click opens an
|
|
6762
|
+
* InlineRename in place of the name.
|
|
6763
|
+
*/
|
|
6764
|
+
onRename?: (id: string, name: string) => void;
|
|
6765
|
+
/**
|
|
6766
|
+
* Called when a row is dropped somewhere new, or moved one place among its siblings with
|
|
6767
|
+
* Alt+ArrowUp / Alt+ArrowDown. `index` counts the new parent's children with the moved item
|
|
6768
|
+
* already removed. Giving it makes rows draggable and turns on the keyboard move; the tree
|
|
6769
|
+
* never moves data itself, and focus stays on the moved item once the caller has moved it.
|
|
6770
|
+
*/
|
|
6771
|
+
onMove?: (move: TreeMove) => void;
|
|
6772
|
+
/** Keep an expanded top-level row pinned while its children scroll (not while virtualized). */
|
|
6773
|
+
stickyRoots?: boolean;
|
|
6774
|
+
/** The scrolling height. Needed for virtualization (over 200 visible rows); default 480. */
|
|
6775
|
+
height?: number | string;
|
|
6776
|
+
/** The accessible name of the rename field. Defaults to "Layer name". */
|
|
6777
|
+
renameLabel?: string;
|
|
6778
|
+
}
|
|
6779
|
+
|
|
6780
|
+
/**
|
|
6781
|
+
* The fill a row draws (design/figma-spec.md 10.1):
|
|
6782
|
+
* - `selected`: a lone selected row;
|
|
6783
|
+
* - `first` / `middle` / `last`: a run of adjacent selected rows, drawn as one block;
|
|
6784
|
+
* - `parent`: a selected, expanded parent (its pill runs into the band below);
|
|
6785
|
+
* - `child` / `child-last`: the band behind a selected parent's visible descendants;
|
|
6786
|
+
* - `none`.
|
|
6787
|
+
*/
|
|
6788
|
+
export declare type TreeRowTint = "none" | "selected" | "first" | "middle" | "last" | "parent" | "child" | "child-last";
|
|
6789
|
+
|
|
5504
6790
|
/**
|
|
5505
6791
|
* Every shared UI glyph name.
|
|
5506
6792
|
*/
|
|
@@ -5513,7 +6799,7 @@ export declare const UI_GLYPH_NAMES: readonly UiGlyphName[];
|
|
|
5513
6799
|
* title and the accessible name.
|
|
5514
6800
|
* @param props - Component props
|
|
5515
6801
|
* @param props.name - Which shared UI glyph to draw
|
|
5516
|
-
* @param props.size - Drawn size in pixels, defaulting to the
|
|
6802
|
+
* @param props.size - Drawn size in pixels, defaulting to the 12px nominal glyph size
|
|
5517
6803
|
* @returns The UI glyph SVG
|
|
5518
6804
|
*/
|
|
5519
6805
|
export declare function UiGlyph({ name, size }: UiGlyphProps): default_2.JSX.Element;
|
|
@@ -5522,7 +6808,7 @@ export declare function UiGlyph({ name, size }: UiGlyphProps): default_2.JSX.Ele
|
|
|
5522
6808
|
* Shared UI glyphs: the chevrons, the doors and the status marks the row types
|
|
5523
6809
|
* draw outside a field's slot.
|
|
5524
6810
|
*/
|
|
5525
|
-
export declare type UiGlyphName = "chevronDown" | "chevronRight" | "chevronLeft" | "close" | "plus" | "minus" | "gear" | "warning" | "check" | "eye" | "refresh" | "copy" | "pin" | "keepOpen" | "info" | "reset";
|
|
6811
|
+
export declare type UiGlyphName = "chevronDown" | "chevronRight" | "chevronLeft" | "close" | "plus" | "minus" | "gear" | "warning" | "check" | "eye" | "refresh" | "copy" | "pin" | "keepOpen" | "info" | "reset" | "caretDown" | "caretRight" | "dash" | "eyeClosed" | "lock" | "unlock" | "search" | "settings" | "link" | "unlink" | "eyedropper" | "rotate" | "flipHorizontal" | "flipVertical" | "alignLeft" | "alignCenterH" | "alignRight" | "alignTop" | "alignCenterV" | "alignBottom" | "more" | "help" | "frame" | "rectangle" | "ellipse" | "text" | "component" | "group";
|
|
5526
6812
|
|
|
5527
6813
|
/**
|
|
5528
6814
|
* Props for the UiGlyph component.
|
|
@@ -5530,7 +6816,7 @@ export declare type UiGlyphName = "chevronDown" | "chevronRight" | "chevronLeft"
|
|
|
5530
6816
|
export declare interface UiGlyphProps {
|
|
5531
6817
|
/** Which shared UI glyph to draw. */
|
|
5532
6818
|
name: UiGlyphName;
|
|
5533
|
-
/** Drawn size in pixels. Defaults to the
|
|
6819
|
+
/** Drawn size in pixels. Defaults to the 12px nominal glyph size. */
|
|
5534
6820
|
size?: number;
|
|
5535
6821
|
}
|
|
5536
6822
|
|
|
@@ -5556,7 +6842,7 @@ export declare function useActualColorScheme(fallback?: "light" | "dark"): "ligh
|
|
|
5556
6842
|
* after every unaccented one and sorts "item 10" before "item 9". A collator
|
|
5557
6843
|
* sorts the way a reader of that language expects.
|
|
5558
6844
|
* @param options - Collation options, passed straight to `Intl.Collator`; `{numeric: true}` is usually what a column of values wants
|
|
5559
|
-
* @returns A
|
|
6845
|
+
* @returns A memoized `Intl.Collator` for the active locale
|
|
5560
6846
|
* @example
|
|
5561
6847
|
* ```tsx
|
|
5562
6848
|
* const collator = useCollator({numeric: true});
|
|
@@ -5602,7 +6888,7 @@ export declare function useLocale(): string;
|
|
|
5602
6888
|
* there is none. The formatter is rebuilt only when the locale or the options
|
|
5603
6889
|
* change, so it is safe to call on every row of a long list.
|
|
5604
6890
|
* @param options - Formatting options, passed straight to `Intl.NumberFormat`
|
|
5605
|
-
* @returns A
|
|
6891
|
+
* @returns A memoized `Intl.NumberFormat` for the active locale
|
|
5606
6892
|
* @example
|
|
5607
6893
|
* ```tsx
|
|
5608
6894
|
* const formatter = useNumberFormatter({maximumFractionDigits: 2});
|
|
@@ -5676,6 +6962,78 @@ export declare function usePopoutManager(): Pick<PopoutManagerContextValue, "clo
|
|
|
5676
6962
|
*/
|
|
5677
6963
|
export declare function usePopoutRegion(): string | null;
|
|
5678
6964
|
|
|
6965
|
+
/**
|
|
6966
|
+
* The page's toast: `show` a message (it replaces any toast on screen) or
|
|
6967
|
+
* `hide` it. Call it inside a `ToastProvider`.
|
|
6968
|
+
* @returns The toast controls
|
|
6969
|
+
*/
|
|
6970
|
+
export declare function useToast(): ToastApi;
|
|
6971
|
+
|
|
6972
|
+
/**
|
|
6973
|
+
* A value bound to a design variable (design/figma-spec.md 6.6).
|
|
6974
|
+
*
|
|
6975
|
+
* In a number field the value becomes a 20px pill (`--cm-bg`, 1px `--cm-border`, radius 5) after
|
|
6976
|
+
* the field's 24px glyph slot; hovering the pill shows the variable's name and value, and
|
|
6977
|
+
* hovering the field shows a 16px Detach button at its end. With `swatch` it is the bound fill
|
|
6978
|
+
* row: one 156 x 24 button with a 14px chit and the name, which gains a 24px Detach button on
|
|
6979
|
+
* hover. `kind="property"` draws the component-property chip.
|
|
6980
|
+
*
|
|
6981
|
+
* With `onValueCommit` the rest of a bound number field is an input: typing a literal there and
|
|
6982
|
+
* pressing Enter reports it, so the caller can detach and apply it.
|
|
6983
|
+
* @param props - the variable, its handlers and the form to draw
|
|
6984
|
+
* @returns the bound field, fill row or property chip
|
|
6985
|
+
* @example
|
|
6986
|
+
* ```tsx
|
|
6987
|
+
* <VariablePill glyph="R" name="rsu/radius-sm" value="4" onDetach={detach} onClick={openPicker} />
|
|
6988
|
+
* <VariablePill swatch="#0d99ff" name="rsu/brand" onDetach={detach} onClick={openPicker} />
|
|
6989
|
+
* ```
|
|
6990
|
+
*/
|
|
6991
|
+
export declare function VariablePill(props: VariablePillProps): default_2.JSX.Element;
|
|
6992
|
+
|
|
6993
|
+
/** Props for VariablePill. */
|
|
6994
|
+
export declare interface VariablePillProps {
|
|
6995
|
+
/** The variable's name ("rsu/radius-sm"). */
|
|
6996
|
+
name: string;
|
|
6997
|
+
/** The variable's resolved value, shown in the pill and in its tooltip ("4"). */
|
|
6998
|
+
value?: string;
|
|
6999
|
+
/**
|
|
7000
|
+
* Called by the Detach (broken link) button, which appears while the field is hovered or
|
|
7001
|
+
* focused. Without it there is no Detach button.
|
|
7002
|
+
*/
|
|
7003
|
+
onDetach?: ActivationHandler;
|
|
7004
|
+
/** Called when the pill (or the fill row) is clicked: reopen the variable picker here. */
|
|
7005
|
+
onClick?: ActivationHandler;
|
|
7006
|
+
/**
|
|
7007
|
+
* A color: draws the bound FILL row instead of a number field -- one 156 x 24 button with
|
|
7008
|
+
* a 14px chit and the variable's name.
|
|
7009
|
+
*/
|
|
7010
|
+
swatch?: string;
|
|
7011
|
+
/**
|
|
7012
|
+
* `"variable"` (default) or `"property"`: a layer property bound to a component property,
|
|
7013
|
+
* drawn as a chip on the component tint.
|
|
7014
|
+
*/
|
|
7015
|
+
kind?: "variable" | "property";
|
|
7016
|
+
/** A 24px leading slot for the bound number field: the field's glyph or letter. */
|
|
7017
|
+
glyph?: default_2.ReactNode;
|
|
7018
|
+
/** The field's width. @default 88 for a number field, 156 for a fill row */
|
|
7019
|
+
width?: number | string;
|
|
7020
|
+
/** The Detach button's accessible name. @default "Detach variable" */
|
|
7021
|
+
detachLabel?: string;
|
|
7022
|
+
/**
|
|
7023
|
+
* Makes the rest of a bound number field editable, as in Figma: typing after the pill and
|
|
7024
|
+
* pressing Enter (or leaving the field) reports the text, and the caller replaces the binding
|
|
7025
|
+
* with that literal (detach, then apply). Escape abandons the text. Without it the field after
|
|
7026
|
+
* the pill is empty space.
|
|
7027
|
+
*/
|
|
7028
|
+
onValueCommit?: ChangeHandler<string>;
|
|
7029
|
+
/** The accessible name of the input after the pill. @default "Value" */
|
|
7030
|
+
valueLabel?: string;
|
|
7031
|
+
/** Extra class on the outer element. */
|
|
7032
|
+
className?: string;
|
|
7033
|
+
/** Extra style on the outer element. */
|
|
7034
|
+
style?: default_2.CSSProperties;
|
|
7035
|
+
}
|
|
7036
|
+
|
|
5679
7037
|
export { }
|
|
5680
7038
|
|
|
5681
7039
|
|
|
@@ -5684,17 +7042,20 @@ declare module "@mantine/core" {
|
|
|
5684
7042
|
* The values this package puts on `theme.other`.
|
|
5685
7043
|
*
|
|
5686
7044
|
* Everything here is optional: a consumer who writes their own
|
|
5687
|
-
* `createTheme({ other: {...} })` is not required to carry
|
|
5688
|
-
*
|
|
7045
|
+
* `createTheme({ other: {...} })` is not required to carry them, and reading
|
|
7046
|
+
* them is therefore a narrowed read.
|
|
5689
7047
|
*/
|
|
5690
7048
|
interface MantineThemeOther {
|
|
5691
7049
|
/**
|
|
5692
|
-
* The pixel grid every panel row is measured against,
|
|
5693
|
-
*
|
|
5694
|
-
*
|
|
5695
|
-
* theme instead of retyping it.
|
|
7050
|
+
* The pixel grid every panel row is measured against (the 240px panel, the 88px
|
|
7051
|
+
* field, the 24px trailing slot), published so a consumer reads the geometry from
|
|
7052
|
+
* the theme instead of retyping it.
|
|
5696
7053
|
*/
|
|
5697
7054
|
panelGrid?: typeof PANEL_GRID;
|
|
7055
|
+
/** The options this theme was created with, resolved. */
|
|
7056
|
+
compact?: {
|
|
7057
|
+
highContrast: boolean;
|
|
7058
|
+
};
|
|
5698
7059
|
}
|
|
5699
7060
|
}
|
|
5700
7061
|
|
|
@@ -5704,16 +7065,19 @@ declare module "@mantine/core" {
|
|
|
5704
7065
|
* The values this package puts on `theme.other`.
|
|
5705
7066
|
*
|
|
5706
7067
|
* Everything here is optional: a consumer who writes their own
|
|
5707
|
-
* `createTheme({ other: {...} })` is not required to carry
|
|
5708
|
-
*
|
|
7068
|
+
* `createTheme({ other: {...} })` is not required to carry them, and reading
|
|
7069
|
+
* them is therefore a narrowed read.
|
|
5709
7070
|
*/
|
|
5710
7071
|
interface MantineThemeOther {
|
|
5711
7072
|
/**
|
|
5712
|
-
* The pixel grid every panel row is measured against,
|
|
5713
|
-
*
|
|
5714
|
-
*
|
|
5715
|
-
* theme instead of retyping it.
|
|
7073
|
+
* The pixel grid every panel row is measured against (the 240px panel, the 88px
|
|
7074
|
+
* field, the 24px trailing slot), published so a consumer reads the geometry from
|
|
7075
|
+
* the theme instead of retyping it.
|
|
5716
7076
|
*/
|
|
5717
7077
|
panelGrid?: typeof PANEL_GRID;
|
|
7078
|
+
/** The options this theme was created with, resolved. */
|
|
7079
|
+
compact?: {
|
|
7080
|
+
highContrast: boolean;
|
|
7081
|
+
};
|
|
5718
7082
|
}
|
|
5719
7083
|
}
|