@graphty/compact-mantine 0.9.32 → 0.9.34
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/README.md +8 -8
- package/dist/index.cjs +835 -238
- package/dist/index.d.cts +1166 -80
- package/dist/index.d.ts +1166 -80
- package/dist/index.js +9962 -6896
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -18,6 +18,8 @@ import { MenuProps } from '@mantine/core';
|
|
|
18
18
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
19
19
|
import { MouseEventHandler } from 'react';
|
|
20
20
|
import { NotificationProps } from '@mantine/core';
|
|
21
|
+
import { PointerEvent as PointerEvent_2 } from 'react';
|
|
22
|
+
import { RangeSliderProps } from '@mantine/core';
|
|
21
23
|
import { ReactElement } from 'react';
|
|
22
24
|
import { ReactNode } from 'react';
|
|
23
25
|
import { ReactPortal } from 'react';
|
|
@@ -28,9 +30,11 @@ import { ScrollAreaCssVariables } from '@mantine/core';
|
|
|
28
30
|
import { ScrollAreaProps as ScrollAreaProps_2 } from '@mantine/core';
|
|
29
31
|
import { ScrollAreaStylesNames } from '@mantine/core';
|
|
30
32
|
import { SegmentedControl as SegmentedControl_2 } from '@mantine/core';
|
|
33
|
+
import { SliderProps } from '@mantine/core';
|
|
31
34
|
import { SyntheticEvent } from 'react';
|
|
32
35
|
import { TextInputProps } from '@mantine/core';
|
|
33
36
|
import { TooltipProps } from '@mantine/core';
|
|
37
|
+
import { TouchEvent as TouchEvent_2 } from 'react';
|
|
34
38
|
import { UnstyledButtonProps } from '@mantine/core';
|
|
35
39
|
import { VariantColorsResolver } from '@mantine/core';
|
|
36
40
|
|
|
@@ -468,6 +472,7 @@ export declare type ColorPickerPaintType = "solid" | "gradient";
|
|
|
468
472
|
* @param props.onChangeEnd - called once per finished edit: a settled drag, a step, a commit or a pick
|
|
469
473
|
* @param props.withAlpha - offer opacity
|
|
470
474
|
* @param props.swatches - the swatch set
|
|
475
|
+
* @param props.closeOnEnter - Enter in the value box closes the enclosing pop-out
|
|
471
476
|
* @param props.defaultFormat - the value row's first format
|
|
472
477
|
* @param props.gradient - gradient content for the paint-type bar
|
|
473
478
|
* @param props.paintType - the selected paint type
|
|
@@ -481,7 +486,7 @@ export declare type ColorPickerPaintType = "solid" | "gradient";
|
|
|
481
486
|
* </Popout.Panel>
|
|
482
487
|
* ```
|
|
483
488
|
*/
|
|
484
|
-
export declare function ColorPickerPanel({ value, onChange, onChangeEnd, withAlpha, swatches, defaultFormat, gradient, paintType, onPaintTypeChange, labels: labelOverrides, }: ColorPickerPanelProps): default_2.JSX.Element;
|
|
489
|
+
export declare function ColorPickerPanel({ value, onChange, onChangeEnd, withAlpha, swatches, closeOnEnter, defaultFormat, gradient, paintType, onPaintTypeChange, labels: labelOverrides, }: ColorPickerPanelProps): default_2.JSX.Element;
|
|
485
490
|
|
|
486
491
|
/** Every string ColorPickerPanel draws or announces, in English by default. */
|
|
487
492
|
export declare interface ColorPickerPanelLabels {
|
|
@@ -505,6 +510,23 @@ export declare interface ColorPickerPanelLabels {
|
|
|
505
510
|
gradient: string;
|
|
506
511
|
/** Name of the swatch list. */
|
|
507
512
|
swatches: string;
|
|
513
|
+
/** A color as a reader says it ("dark green"), for the swatches' names and tooltips. */
|
|
514
|
+
colorWord: (color: string) => string;
|
|
515
|
+
/**
|
|
516
|
+
* A swatch's name and tooltip: its color word and hex, and whether it is the color the field
|
|
517
|
+
* held when the picker opened (the color before this edit).
|
|
518
|
+
*/
|
|
519
|
+
swatch: (word: string, hex: string, start: boolean) => string;
|
|
520
|
+
/**
|
|
521
|
+
* Drawn under the value row, and spoken, after Enter on text that reads as no color in the
|
|
522
|
+
* format: what the box takes instead. The text stays in the box, marked, to be corrected.
|
|
523
|
+
*/
|
|
524
|
+
refused: (typed: string, format: ColorPickerFormat) => string;
|
|
525
|
+
/**
|
|
526
|
+
* Drawn and spoken when the reader leaves the value box holding text that reads as no color:
|
|
527
|
+
* the box went back to `kept`, the value it shows for the color in force.
|
|
528
|
+
*/
|
|
529
|
+
refusedKept: (typed: string, kept: string, format: ColorPickerFormat) => string;
|
|
508
530
|
}
|
|
509
531
|
|
|
510
532
|
/** Props for ColorPickerPanel. */
|
|
@@ -526,8 +548,20 @@ export declare interface ColorPickerPanelProps {
|
|
|
526
548
|
* @default true
|
|
527
549
|
*/
|
|
528
550
|
withAlpha?: boolean;
|
|
529
|
-
/**
|
|
551
|
+
/**
|
|
552
|
+
* The swatch set under the divider, as hex or hexa strings. Each is named by its color word
|
|
553
|
+
* and hex. The color the picker opened on is always one of them (first, when the set lacks
|
|
554
|
+
* it), marked as the color before this edit, so going back to it is one click. While the
|
|
555
|
+
* picker is open, a swatch the set drops keeps its place and one it gains joins the end, so a
|
|
556
|
+
* picked swatch never moves away from under the pointer.
|
|
557
|
+
*/
|
|
530
558
|
swatches?: readonly string[];
|
|
559
|
+
/**
|
|
560
|
+
* Enter in the value box applies the color and closes the pop-out the picker sits in, which
|
|
561
|
+
* gives focus back to what opened it.
|
|
562
|
+
* @default false
|
|
563
|
+
*/
|
|
564
|
+
closeOnEnter?: boolean;
|
|
531
565
|
/**
|
|
532
566
|
* The format the value row starts in.
|
|
533
567
|
* @default "hex"
|
|
@@ -563,6 +597,16 @@ export declare interface ColorStop {
|
|
|
563
597
|
color: string;
|
|
564
598
|
}
|
|
565
599
|
|
|
600
|
+
/**
|
|
601
|
+
* A color as a reader says it, in English: the CSS keyword, in words, when the color is exactly
|
|
602
|
+
* one ("purple" for 800080, "dark green" for 006400), else its hue band with "dark" or "light"
|
|
603
|
+
* ("orange", "dark indigo", "light gray"). For spoken names and tooltips beside a hex code, never
|
|
604
|
+
* in place of one.
|
|
605
|
+
* @param color - a hex color, 3 to 8 digits, with or without `#`
|
|
606
|
+
* @returns the color's word, or "" when the text is not a hex color
|
|
607
|
+
*/
|
|
608
|
+
export declare function colorWord(color: string): string;
|
|
609
|
+
|
|
566
610
|
declare const COLUMNS: readonly ["left", "center", "right"];
|
|
567
611
|
|
|
568
612
|
/**
|
|
@@ -573,7 +617,8 @@ declare const COLUMNS: readonly ["left", "center", "right"];
|
|
|
573
617
|
* Keyboard: typing edits the value and commits on Enter, Tab or blur; Control+ArrowDown (or
|
|
574
618
|
* Alt+ArrowDown) opens the list with the current value highlighted; ArrowUp / ArrowDown move,
|
|
575
619
|
* Home / End jump, Enter picks, Escape closes without a change and leaves focus in the field.
|
|
576
|
-
* With the list closed, ArrowUp / ArrowDown step a numeric value.
|
|
620
|
+
* With the list closed, ArrowUp / ArrowDown step a numeric value. A numeric field with no options
|
|
621
|
+
* is a spin button to assistive tech (its value and bounds are read out), not a combobox.
|
|
577
622
|
* @example
|
|
578
623
|
* ```tsx
|
|
579
624
|
* <ComboInput
|
|
@@ -636,8 +681,19 @@ export declare interface ComboInputProps {
|
|
|
636
681
|
width?: number | string;
|
|
637
682
|
/** The field cannot be used. */
|
|
638
683
|
disabled?: boolean;
|
|
639
|
-
/** Text shown in an empty field. */
|
|
684
|
+
/** Text shown in an empty field, in Figma's placeholder color. */
|
|
640
685
|
placeholder?: string;
|
|
686
|
+
/**
|
|
687
|
+
* The selection disagrees: the empty field reads "Mixed" in the value's ink, as Figma draws
|
|
688
|
+
* it, and typing a value replaces it.
|
|
689
|
+
*/
|
|
690
|
+
mixed?: boolean;
|
|
691
|
+
/**
|
|
692
|
+
* The field's surface: `"filled"`, Figma's gray number field, or `"outlined"`, the panel's
|
|
693
|
+
* background inside a 1px edge, as the select and the style fields draw it.
|
|
694
|
+
* @default "filled"
|
|
695
|
+
*/
|
|
696
|
+
variant?: "filled" | "outlined";
|
|
641
697
|
/** The chevron button's accessible name. @default "Open list" */
|
|
642
698
|
openLabel?: string;
|
|
643
699
|
/** Extra class on the field's outer element. */
|
|
@@ -697,18 +753,23 @@ export declare const compactBrandColors: MantineColorsTuple;
|
|
|
697
753
|
* (Shift for 10) and scrubs by dragging its "%".
|
|
698
754
|
*
|
|
699
755
|
* As in the other controls of this family, `undefined` means "the reader has chosen nothing
|
|
700
|
-
* here": the control shows the default
|
|
756
|
+
* here": the control shows the default as its value and offers no reset until something of the
|
|
701
757
|
* reader's own is set, and pressing the reset reports `undefined` again. Color and opacity are
|
|
702
758
|
* tracked separately, so either can be the reader's while the other is still the default.
|
|
703
759
|
* Typed opacity is read in the reader's own locale.
|
|
704
760
|
* @param props - Component props
|
|
705
761
|
* @param props.color - The color, when you drive the control from your own state
|
|
706
762
|
* @param props.defaultColor - The color shown while the reader has chosen none of their own
|
|
763
|
+
* @param props.emptyText - Words shown in the hex box in place of `defaultColor` while nothing is chosen
|
|
764
|
+
* @param props.emptySwatch - Whether no color is in force while none is chosen, so the swatch is drawn empty
|
|
765
|
+
* @param props.mixed - Whether the things the field stands for disagree, shown as "Mixed" while nothing is chosen
|
|
707
766
|
* @param props.opacity - The opacity as a percentage, when you drive the control from your own state
|
|
708
767
|
* @param props.defaultOpacity - The opacity shown while the reader has set none of their own
|
|
709
768
|
* @param props.onColorChange - Called with the new color, or with `undefined` when the control is reset
|
|
710
769
|
* @param props.onOpacityChange - Called with the new opacity, or with `undefined` when the control is reset
|
|
711
770
|
* @param props.onChange - Called once per gesture with both halves of the color, whichever of them moved
|
|
771
|
+
* @param props.onChangeEnd - Called once when a gesture settles, with both halves of the color
|
|
772
|
+
* @param props.swatches - The swatch set the picker offers
|
|
712
773
|
* @param props.label - The field's name, drawn above the control and used to name the group
|
|
713
774
|
* @param props.showOpacity - Whether to offer the opacity box
|
|
714
775
|
* @param props.disabled - Whether the control cannot be used at all
|
|
@@ -717,8 +778,10 @@ export declare const compactBrandColors: MantineColorsTuple;
|
|
|
717
778
|
* @param props.onBlur - Called when the hex box or the opacity box loses focus
|
|
718
779
|
* @param props.width - The field's width
|
|
719
780
|
* @param props.showReset - Whether to offer the reset button
|
|
781
|
+
* @param props."aria-label" - The field's name when nothing draws it, which names its controls
|
|
782
|
+
* @param props.variant - The whole paint field, or the swatch alone as a chip
|
|
783
|
+
* @param props.valueText - The color's spoken words: in the chip form in place of its state and hex, in the field form beside them
|
|
720
784
|
* @param props.hideLabel - Whether the label only names the controls and is not drawn
|
|
721
|
-
* @param props.swatches - The swatches the picker offers in place of the built-in set
|
|
722
785
|
* @returns The paint field, and its reset button when something has been set
|
|
723
786
|
* @example
|
|
724
787
|
* ```tsx
|
|
@@ -729,7 +792,7 @@ export declare const compactBrandColors: MantineColorsTuple;
|
|
|
729
792
|
* </PopoutManager>
|
|
730
793
|
* ```
|
|
731
794
|
*/
|
|
732
|
-
export declare function CompactColorInput({ color, defaultColor, opacity, defaultOpacity, onColorChange, onOpacityChange, onChange, label, showOpacity, disabled, disabledReason, onFocus, onBlur, width, showReset,
|
|
795
|
+
export declare function CompactColorInput({ color, defaultColor, emptyText, emptySwatch, mixed, opacity, defaultOpacity, onColorChange, onOpacityChange, onChange, onChangeEnd, swatches, label, showOpacity, disabled, disabledReason, onFocus, onBlur, width, showReset, "aria-label": ariaLabel, variant, valueText, hideLabel, }: Readonly<CompactColorInputProps>): default_2.JSX.Element;
|
|
733
796
|
|
|
734
797
|
/**
|
|
735
798
|
* Props for the CompactColorInput component.
|
|
@@ -742,8 +805,34 @@ export declare interface CompactColorInputProps {
|
|
|
742
805
|
* chosen none and the control is showing `defaultColor`.
|
|
743
806
|
*/
|
|
744
807
|
color?: string | undefined;
|
|
745
|
-
/** The color shown
|
|
808
|
+
/** The color shown while the reader has chosen none of their own. */
|
|
746
809
|
defaultColor: string;
|
|
810
|
+
/**
|
|
811
|
+
* Words shown in the hex box in place of `defaultColor` while the reader has chosen nothing,
|
|
812
|
+
* for a color whose default is another color rather than a value of its own -- "Line color"
|
|
813
|
+
* for an arrowhead that takes its edge's color. The hex box is then empty, with these words
|
|
814
|
+
* as its placeholder; the chit still shows `defaultColor`. As `StyleNumberInput`'s `emptyText`.
|
|
815
|
+
* In the chip form, which has no hex box, the chip is drawn empty instead -- no color is shown
|
|
816
|
+
* as if it were chosen -- and its name says "not set" with these words; pressing it opens the
|
|
817
|
+
* picker at `defaultColor`.
|
|
818
|
+
*/
|
|
819
|
+
emptyText?: string;
|
|
820
|
+
/**
|
|
821
|
+
* Whether no color is in force while the reader has chosen none: the field form then draws its
|
|
822
|
+
* swatch empty (an outline), as the chip form does with `emptyText`, so a swatch never shows a
|
|
823
|
+
* color that nothing draws -- a label background whose default is none. `defaultColor` is then
|
|
824
|
+
* only where the picker opens. Default false: the swatch shows `defaultColor`.
|
|
825
|
+
*/
|
|
826
|
+
emptySwatch?: boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Whether the things this field stands for disagree: several selected rows, or elements the
|
|
829
|
+
* layers beneath paint in different colors. While the reader has chosen nothing, the field
|
|
830
|
+
* draws the word "Mixed" (`labels.mixed`) and no swatch, since no one color is in force.
|
|
831
|
+
* Typing a color writes one color, as in any field. In the chip form, the chip draws a dash in
|
|
832
|
+
* place of a color and its name says "Mixed"; pressing it opens the picker.
|
|
833
|
+
* @default false
|
|
834
|
+
*/
|
|
835
|
+
mixed?: boolean;
|
|
747
836
|
/**
|
|
748
837
|
* The opacity as a percentage from 0 to 100, when you drive the control
|
|
749
838
|
* from your own state. `undefined` means the reader has set none and the
|
|
@@ -751,8 +840,7 @@ export declare interface CompactColorInputProps {
|
|
|
751
840
|
*/
|
|
752
841
|
opacity?: number | undefined;
|
|
753
842
|
/**
|
|
754
|
-
* The opacity shown
|
|
755
|
-
* own.
|
|
843
|
+
* The opacity shown while the reader has set none of their own.
|
|
756
844
|
* @default 100
|
|
757
845
|
*/
|
|
758
846
|
defaultOpacity?: number;
|
|
@@ -810,6 +898,25 @@ export declare interface CompactColorInputProps {
|
|
|
810
898
|
* ```
|
|
811
899
|
*/
|
|
812
900
|
onChange?: (color: string | undefined, opacity: number | undefined, event?: default_2.SyntheticEvent) => void;
|
|
901
|
+
/**
|
|
902
|
+
* Called once when a gesture settles, with both halves of the color, as
|
|
903
|
+
* `onChange` passes them.
|
|
904
|
+
*
|
|
905
|
+
* A drag in the picker calls `onChange` on every move and this once, on
|
|
906
|
+
* release; a typed hex, an opacity commit, a swatch pick and the reset
|
|
907
|
+
* each call both once. Write to an undo history or a slow store here, so
|
|
908
|
+
* a drag is one step.
|
|
909
|
+
*
|
|
910
|
+
* Called whichever of `onChange` or `onColorChange` / `onOpacityChange`
|
|
911
|
+
* you use.
|
|
912
|
+
*/
|
|
913
|
+
onChangeEnd?: (color: string | undefined, opacity: number | undefined, event?: default_2.SyntheticEvent) => void;
|
|
914
|
+
/**
|
|
915
|
+
* The swatch set the picker offers under its divider, as hex or hexa
|
|
916
|
+
* strings -- the colors already used in the document, for instance.
|
|
917
|
+
* @default SWATCH_COLORS_HEXA
|
|
918
|
+
*/
|
|
919
|
+
swatches?: readonly string[];
|
|
813
920
|
/**
|
|
814
921
|
* The field's name, drawn above the control and used to name the group the
|
|
815
922
|
* three controls sit in.
|
|
@@ -818,6 +925,20 @@ export declare interface CompactColorInputProps {
|
|
|
818
925
|
* such as one stop of a gradient.
|
|
819
926
|
*/
|
|
820
927
|
label?: string;
|
|
928
|
+
/**
|
|
929
|
+
* The field's name when nothing draws it: the swatch, the hex box and the opacity box are
|
|
930
|
+
* named from it as they are from `label` ("Pick node color", "Node color"), and no label is
|
|
931
|
+
* drawn. For a field whose name is drawn by what surrounds it in another form, such as a
|
|
932
|
+
* properties row that draws "Color" above two fields. Ignored when `label` is given.
|
|
933
|
+
*/
|
|
934
|
+
"aria-label"?: string;
|
|
935
|
+
/**
|
|
936
|
+
* Words a screen reader hears for the color in force ("teal"). In the chip form they replace
|
|
937
|
+
* its state and hex, for a row where the color is the value itself, such as a group's color in
|
|
938
|
+
* a palette, so the reader hears a name rather than "not set, #009E73". In the field form they
|
|
939
|
+
* join the hex box's name after its state ("Node color, set, teal"), beside the hex it holds.
|
|
940
|
+
*/
|
|
941
|
+
valueText?: string;
|
|
821
942
|
/**
|
|
822
943
|
* Whether to offer an opacity box beside the color.
|
|
823
944
|
* @default true
|
|
@@ -864,10 +985,20 @@ export declare interface CompactColorInputProps {
|
|
|
864
985
|
*/
|
|
865
986
|
width?: number | string;
|
|
866
987
|
/**
|
|
867
|
-
* Whether to offer the reset button once something is chosen.
|
|
988
|
+
* Whether to offer the reset button once something is chosen. Turn it off when the caller
|
|
989
|
+
* draws its own way back to "nothing chosen" beside the control, such as one Clear per row.
|
|
868
990
|
* @default true
|
|
869
991
|
*/
|
|
870
992
|
showReset?: boolean;
|
|
993
|
+
/**
|
|
994
|
+
* How the control is drawn. `"field"` is the whole paint field (swatch, hex and opacity).
|
|
995
|
+
* `"chip"` is the swatch alone, 24 px square, for a row that already names the color beside
|
|
996
|
+
* it (an effect, a category of a varied value): pressing it opens the picker. Its accessible
|
|
997
|
+
* name carries the field's name, its state and its color ("Group 3 color, set here,
|
|
998
|
+
* #E69F00"), and no label is drawn.
|
|
999
|
+
* @default "field"
|
|
1000
|
+
*/
|
|
1001
|
+
variant?: "field" | "chip";
|
|
871
1002
|
/**
|
|
872
1003
|
* Whether to use `label` only to name the controls, without drawing it above them or
|
|
873
1004
|
* grouping them under it. For a field whose name is already drawn beside it, such as the
|
|
@@ -875,17 +1006,11 @@ export declare interface CompactColorInputProps {
|
|
|
875
1006
|
* @default false
|
|
876
1007
|
*/
|
|
877
1008
|
hideLabel?: boolean;
|
|
878
|
-
/**
|
|
879
|
-
* The swatches the picker offers, as `#RRGGBB` or `#RRGGBBAA` strings, in place of the
|
|
880
|
-
* built-in set: the colors a document already uses, for example. An empty list offers none.
|
|
881
|
-
* @default the built-in swatch set
|
|
882
|
-
*/
|
|
883
|
-
swatches?: readonly string[];
|
|
884
1009
|
}
|
|
885
1010
|
|
|
886
1011
|
/**
|
|
887
1012
|
* Color configuration for the compact theme: every Mantine color, the neutral `dark` ramp, the
|
|
888
|
-
* `brand` accent and the `graphty` accent.
|
|
1013
|
+
* the `brand` accent and the `graphty` accent.
|
|
889
1014
|
*/
|
|
890
1015
|
export declare const compactColors: {
|
|
891
1016
|
dark: MantineColorsTuple;
|
|
@@ -911,6 +1036,7 @@ export declare const compactColors: {
|
|
|
911
1036
|
* surface in the dark scheme matches the panels around it.
|
|
912
1037
|
*
|
|
913
1038
|
* - 0: text (#fff)
|
|
1039
|
+
* - 2: Mantine's dimmed text (#8c8c8c); the AA option points dimmed text at its secondary ink
|
|
914
1040
|
* - 5: hover (#444)
|
|
915
1041
|
* - 6: default field (#383838)
|
|
916
1042
|
* - 7: body / panel (#2c2c2c)
|
|
@@ -1046,6 +1172,33 @@ export declare interface CompactMantineLabels {
|
|
|
1046
1172
|
* @returns The button's accessible name
|
|
1047
1173
|
*/
|
|
1048
1174
|
resetToDefault: (label: string) => string;
|
|
1175
|
+
/**
|
|
1176
|
+
* What a screen reader hears after a field's name while nothing is set on it, so the gray
|
|
1177
|
+
* placeholder is not the only sign: "Node color, not set, #3388FF".
|
|
1178
|
+
* @param beneath - What the field shows in its place (the value beneath), or "" for nothing
|
|
1179
|
+
* @returns The words joined to the field's name
|
|
1180
|
+
*/
|
|
1181
|
+
fieldNotSet: (beneath: string) => string;
|
|
1182
|
+
/**
|
|
1183
|
+
* What a screen reader hears after a field's name while a value is set on it: "Node color,
|
|
1184
|
+
* set here".
|
|
1185
|
+
*/
|
|
1186
|
+
fieldSet: string;
|
|
1187
|
+
/**
|
|
1188
|
+
* What a color field shows while nothing is set on it, said after `fieldNotSet`'s "not set"
|
|
1189
|
+
* so the color is heard as what the drawing shows, not as a value: "Node color, not set,
|
|
1190
|
+
* drawn #6366F1 indigo".
|
|
1191
|
+
* @param hex - The color drawn, as `#RRGGBB`
|
|
1192
|
+
* @param words - The color's name, when the field was given one
|
|
1193
|
+
* @returns The words
|
|
1194
|
+
*/
|
|
1195
|
+
colorDrawn?: (hex: string, words?: string) => string;
|
|
1196
|
+
/**
|
|
1197
|
+
* Tree: said in a live region after a row moves (Alt+Arrow, a drag, or a
|
|
1198
|
+
* row menu's move). `parent` is the name of the folder it now sits in, or
|
|
1199
|
+
* null at the top level; `position` and `count` are already formatted.
|
|
1200
|
+
*/
|
|
1201
|
+
treeMoved: (name: string, parent: string | null, position: string, count: string) => string;
|
|
1049
1202
|
/**
|
|
1050
1203
|
* Accessible name of the swatch button that opens the color picker, when
|
|
1051
1204
|
* the control has no label. With a label, `pickColor` names it instead.
|
|
@@ -1058,7 +1211,7 @@ export declare interface CompactMantineLabels {
|
|
|
1058
1211
|
colorHexValue: string;
|
|
1059
1212
|
/**
|
|
1060
1213
|
* Accessible name of the swatch button that opens the color picker, saying
|
|
1061
|
-
* what pressing it does: "Pick
|
|
1214
|
+
* what pressing it does: "Pick fill color", in sentence case.
|
|
1062
1215
|
* @param label - The control's own label, as drawn above it
|
|
1063
1216
|
* @returns The button's accessible name
|
|
1064
1217
|
*/
|
|
@@ -1071,6 +1224,40 @@ export declare interface CompactMantineLabels {
|
|
|
1071
1224
|
* @returns The text box's accessible name
|
|
1072
1225
|
*/
|
|
1073
1226
|
colorValue: (label: string) => string;
|
|
1227
|
+
/**
|
|
1228
|
+
* Title of the hex box while it holds words that name no color, after Enter: "blu is not a
|
|
1229
|
+
* color".
|
|
1230
|
+
* @param typed - What was typed
|
|
1231
|
+
* @returns The words
|
|
1232
|
+
*/
|
|
1233
|
+
notAColor: (typed: string) => string;
|
|
1234
|
+
/**
|
|
1235
|
+
* Message drawn under CompactColorInput, and read as the hex box's description, after Enter
|
|
1236
|
+
* on words that name no color: what the box takes instead.
|
|
1237
|
+
* @param typed - What was typed
|
|
1238
|
+
* @returns The words
|
|
1239
|
+
*/
|
|
1240
|
+
colorRefused: (typed: string) => string;
|
|
1241
|
+
/**
|
|
1242
|
+
* Message drawn under CompactColorInput, and announced, when the reader leaves the hex box
|
|
1243
|
+
* holding words that name no color: the box went back to what it held.
|
|
1244
|
+
* @param typed - What was typed
|
|
1245
|
+
* @param kept - What the box holds again: a hex code, or the words shown when nothing is set
|
|
1246
|
+
* @returns The words
|
|
1247
|
+
*/
|
|
1248
|
+
colorRefusedKept: (typed: string, kept: string) => string;
|
|
1249
|
+
/**
|
|
1250
|
+
* Announced when Escape takes back what was typed in CompactColorInput's hex box: the edit is
|
|
1251
|
+
* gone and the color it held stays.
|
|
1252
|
+
* @param kept - What the box holds again: a hex code, or the words shown when nothing is set
|
|
1253
|
+
* @returns The words
|
|
1254
|
+
*/
|
|
1255
|
+
colorEditDiscarded: (kept: string) => string;
|
|
1256
|
+
/**
|
|
1257
|
+
* A color as a reader says it, for the picker's swatch names and tooltips beside the hex:
|
|
1258
|
+
* "orange", "dark green". Replace it to name colors in another language.
|
|
1259
|
+
*/
|
|
1260
|
+
colorWord: (color: string) => string;
|
|
1074
1261
|
/**
|
|
1075
1262
|
* Accessible name of the number box holding the color's opacity
|
|
1076
1263
|
* percentage, when the control has a label: "Fill opacity".
|
|
@@ -1170,6 +1357,19 @@ export declare interface CompactMantineLabels {
|
|
|
1170
1357
|
* @returns The name, such as "Options for Degree"
|
|
1171
1358
|
*/
|
|
1172
1359
|
columnMenu?: (header: string) => string;
|
|
1360
|
+
/**
|
|
1361
|
+
* What a screen reader reads for a data table cell that holds no value. Optional, so a full
|
|
1362
|
+
* set of labels written before it existed still type-checks; left out, the English default
|
|
1363
|
+
* is used.
|
|
1364
|
+
*/
|
|
1365
|
+
emptyCell?: string;
|
|
1366
|
+
/**
|
|
1367
|
+
* Read after a sorted column's header, so the focused header says how it sorts. Optional;
|
|
1368
|
+
* left out, the English default is used.
|
|
1369
|
+
* @param descending - Whether the column sorts largest first
|
|
1370
|
+
* @returns The words, such as "sorted ascending"
|
|
1371
|
+
*/
|
|
1372
|
+
sortedBy?: (descending: boolean) => string;
|
|
1173
1373
|
/**
|
|
1174
1374
|
* How a cell holding true is written, when its column supplies no drawing
|
|
1175
1375
|
* of its own.
|
|
@@ -1220,6 +1420,21 @@ export declare interface CompactMantineLabels {
|
|
|
1220
1420
|
* @returns The number spelled as an ordinal
|
|
1221
1421
|
*/
|
|
1222
1422
|
ordinal: (value: string, rule: Intl.LDMLPluralRule) => string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Shown at the foot of a select's open list, and spoken, when the letters
|
|
1425
|
+
* typed ahead start no option's name; Enter then picks nothing.
|
|
1426
|
+
* @param typed - The letters typed, as typed
|
|
1427
|
+
* @returns The line, such as `No option starts with "cube"`
|
|
1428
|
+
*/
|
|
1429
|
+
listNoMatch?: (typed: string) => string;
|
|
1430
|
+
/** What a screen reader says before a node chip's count or name. Never drawn: the chip shows a circle. */
|
|
1431
|
+
entityNode: string;
|
|
1432
|
+
/** What a screen reader says before an edge chip's count or name. Never drawn: the chip shows a segment. */
|
|
1433
|
+
entityEdge: string;
|
|
1434
|
+
/** The text of `FileSource`'s button that opens the file picker, and the name of its upload icon button. */
|
|
1435
|
+
fileChoose: string;
|
|
1436
|
+
/** Placeholder and accessible name of `FileSource`'s web address field. */
|
|
1437
|
+
fileUrl: string;
|
|
1223
1438
|
}
|
|
1224
1439
|
|
|
1225
1440
|
/**
|
|
@@ -1636,11 +1851,13 @@ export declare interface CompoundSegment {
|
|
|
1636
1851
|
}
|
|
1637
1852
|
|
|
1638
1853
|
/**
|
|
1639
|
-
* A
|
|
1854
|
+
* A menu opened at the pointer by a right-click (design/figma-spec.md 8.2):
|
|
1640
1855
|
* its top-left corner 3px right of and 5px above the pointer, flipping and
|
|
1641
|
-
* shifting to stay on screen, with
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1856
|
+
* shifting to stay on screen, with no row highlighted until a key or the
|
|
1857
|
+
* pointer moves to one. On touch and pen, a press held still for half a second
|
|
1858
|
+
* opens it at the finger. It also opens from the keyboard (Shift+F10, the
|
|
1859
|
+
* ContextMenu key) at the focused element, with the first enabled row
|
|
1860
|
+
* highlighted so Enter acts on it at once. Escape, a click outside or choosing a
|
|
1644
1861
|
* row closes it and returns focus to where it was.
|
|
1645
1862
|
* @param props - Component props
|
|
1646
1863
|
* @param props.target - The element that opens the menu
|
|
@@ -1650,8 +1867,9 @@ export declare interface CompoundSegment {
|
|
|
1650
1867
|
* @example
|
|
1651
1868
|
* ```tsx
|
|
1652
1869
|
* <ContextMenu target={<div className="canvas" tabIndex={0} />}>
|
|
1653
|
-
* <Menu.Item
|
|
1654
|
-
*
|
|
1870
|
+
* <Menu.Item aria-keyshortcuts="Control+C" rightSection={<MenuShortcut>Ctrl+C</MenuShortcut>}>
|
|
1871
|
+
* Copy
|
|
1872
|
+
* </Menu.Item>
|
|
1655
1873
|
* <Menu.Divider />
|
|
1656
1874
|
* <Menu.Item color="red">Delete</Menu.Item>
|
|
1657
1875
|
* </ContextMenu>
|
|
@@ -1665,13 +1883,18 @@ export declare function ContextMenu({ target, children, onChange, ...menuProps }
|
|
|
1665
1883
|
*/
|
|
1666
1884
|
export declare interface ContextMenuProps extends Omit<MenuProps, "children" | "opened" | "defaultOpened" | "position" | "offset" | "trigger"> {
|
|
1667
1885
|
/**
|
|
1668
|
-
* The element that opens the menu when it is right-clicked
|
|
1669
|
-
* something inside it) has focus and Shift+F10 or the
|
|
1670
|
-
* pressed.
|
|
1886
|
+
* The element that opens the menu when it is right-clicked or touched and
|
|
1887
|
+
* held, or when it (or something inside it) has focus and Shift+F10 or the
|
|
1888
|
+
* ContextMenu key is pressed. A hold reaches the target's `onContextMenu`
|
|
1889
|
+
* as a `contextmenu` event from the pressed element, like a right-click.
|
|
1890
|
+
* One element that accepts `onContextMenu`, `onKeyDown` and the pointer handlers.
|
|
1671
1891
|
*/
|
|
1672
1892
|
target: ReactElement<{
|
|
1673
1893
|
onContextMenu?: (event: MouseEvent_2<HTMLElement>) => void;
|
|
1674
1894
|
onKeyDown?: (event: KeyboardEvent_2<HTMLElement>) => void;
|
|
1895
|
+
onPointerDown?: (event: PointerEvent_2<HTMLElement>) => void;
|
|
1896
|
+
onClickCapture?: (event: MouseEvent_2<HTMLElement>) => void;
|
|
1897
|
+
onTouchEnd?: (event: TouchEvent_2<HTMLElement>) => void;
|
|
1675
1898
|
}>;
|
|
1676
1899
|
/** The menu's rows: `Menu.Item`, `Menu.Label`, `Menu.Divider`, `Menu.Sub`, `MenuCheckItem`. */
|
|
1677
1900
|
children: ReactNode;
|
|
@@ -1787,6 +2010,7 @@ export declare interface ControlGroupProps {
|
|
|
1787
2010
|
* @param props.summary - One line saying what the section holds, shown after the name while it is collapsed
|
|
1788
2011
|
* @param props.children - The rows the section holds
|
|
1789
2012
|
* @param props.collapsible - Whether the section folds away behind a chevron, defaulting to true
|
|
2013
|
+
* @param props.wrapLabel - Whether a long label wraps onto more lines instead of being cut, defaulting to false
|
|
1790
2014
|
* @returns The section, its header and its rows
|
|
1791
2015
|
* @example
|
|
1792
2016
|
* ```tsx
|
|
@@ -1906,6 +2130,19 @@ export declare interface ControlSectionProps extends DisclosureProps {
|
|
|
1906
2130
|
* @default true
|
|
1907
2131
|
*/
|
|
1908
2132
|
collapsible?: boolean;
|
|
2133
|
+
/**
|
|
2134
|
+
* Whether a label too long for one line wraps onto more lines instead of being cut with an
|
|
2135
|
+
* ellipsis. For a label that is a sentence the reader must read whole, such as a count:
|
|
2136
|
+
* `"Medici and 11 connections within 2 hops"`. The header grows to hold it.
|
|
2137
|
+
* @default false
|
|
2138
|
+
*/
|
|
2139
|
+
wrapLabel?: boolean;
|
|
2140
|
+
/**
|
|
2141
|
+
* Makes the section's name a heading of this level, so a screen reader can move from
|
|
2142
|
+
* section to section by heading ("Nodes", "Edges"). Pick the level that follows the
|
|
2143
|
+
* headings around the panel. Without it the section is a named group and no heading.
|
|
2144
|
+
*/
|
|
2145
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
1909
2146
|
}
|
|
1910
2147
|
|
|
1911
2148
|
/**
|
|
@@ -1974,6 +2211,7 @@ export declare function createDefaultGradientStops(): ColorStop[];
|
|
|
1974
2211
|
* @param props.onFocus - Called when the row's body takes focus
|
|
1975
2212
|
* @param props.onBlur - Called when the row's body loses focus
|
|
1976
2213
|
* @param props.trailing - The row's occasional control, in the 24px slot at its trailing edge
|
|
2214
|
+
* @param props.description - What activating the row does, read after its name
|
|
1977
2215
|
* @returns The data row
|
|
1978
2216
|
* @example
|
|
1979
2217
|
* ```tsx
|
|
@@ -1989,7 +2227,7 @@ export declare function createDefaultGradientStops(): ColorStop[];
|
|
|
1989
2227
|
* ))}
|
|
1990
2228
|
* ```
|
|
1991
2229
|
*/
|
|
1992
|
-
export declare function DataRow({ name, value, stat, icon, selected, onClick, onFocus, onBlur, trailing, }: DataRowProps): default_2.JSX.Element;
|
|
2230
|
+
export declare function DataRow({ name, value, stat, icon, selected, onClick, onFocus, onBlur, trailing, description, }: DataRowProps): default_2.JSX.Element;
|
|
1993
2231
|
|
|
1994
2232
|
/**
|
|
1995
2233
|
* The 32px caption above a run of data rows (11/16 at 550), optionally sortable.
|
|
@@ -2111,6 +2349,9 @@ export declare interface DataRowProps {
|
|
|
2111
2349
|
* in the primary color at weight 500, because the reading is the half the
|
|
2112
2350
|
* reader came for. The pair is exposed as one `role="group"` named by the
|
|
2113
2351
|
* name, so a screen reader reads "Nodes, 1,000,000" as one unit (WCAG 1.3.1).
|
|
2352
|
+
* A reading too long for the row beside its name wraps onto more lines and
|
|
2353
|
+
* the row grows, and so does a name too long for its half, so a stat is
|
|
2354
|
+
* never cut short.
|
|
2114
2355
|
*
|
|
2115
2356
|
* Leave it off for a list of the reader's own strings -- datasets, files,
|
|
2116
2357
|
* nodes -- where the name is the thing being read.
|
|
@@ -2156,6 +2397,11 @@ export declare interface DataRowProps {
|
|
|
2156
2397
|
onBlur?: default_2.FocusEventHandler<HTMLElement>;
|
|
2157
2398
|
/** The row's occasional control, in the 24px slot at its trailing edge. Drawn only when there is something to put there. */
|
|
2158
2399
|
trailing?: default_2.ReactNode;
|
|
2400
|
+
/**
|
|
2401
|
+
* What activating the row does, read after its name (`aria-description`): "Select this node
|
|
2402
|
+
* and its neighbors". Pair it with a tooltip carrying the same words for the pointer.
|
|
2403
|
+
*/
|
|
2404
|
+
description?: string;
|
|
2159
2405
|
}
|
|
2160
2406
|
|
|
2161
2407
|
/**
|
|
@@ -2283,6 +2529,11 @@ export declare interface DataTableColumn<TRow extends object> {
|
|
|
2283
2529
|
cell?: (row: TRow) => default_2.ReactNode;
|
|
2284
2530
|
/** How wide the column is drawn, in pixels. Defaults to the width of one field in a property panel. */
|
|
2285
2531
|
width?: number;
|
|
2532
|
+
/**
|
|
2533
|
+
* With `columnSizing: "content"`, the narrowest the column is drawn, in pixels: room for what a
|
|
2534
|
+
* header carries beyond its name (icons, a badge). Ignored when `width` is set.
|
|
2535
|
+
*/
|
|
2536
|
+
minWidth?: number;
|
|
2286
2537
|
/** How the column's contents line up. Defaults to `"start"`; use `"end"` for numbers. */
|
|
2287
2538
|
align?: DataTableAlign;
|
|
2288
2539
|
/** Whether the column's header sorts the table. Defaults to `true`. */
|
|
@@ -2308,10 +2559,22 @@ export declare interface DataTableColumn<TRow extends object> {
|
|
|
2308
2559
|
*/
|
|
2309
2560
|
pinned?: "start";
|
|
2310
2561
|
/**
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
2562
|
+
* Whether this column's cells name their row (`role="rowheader"`): the key column, such as a
|
|
2563
|
+
* node's id, so a screen reader reads each cell with its row as well as its column. Defaults
|
|
2564
|
+
* to `false`.
|
|
2565
|
+
*/
|
|
2566
|
+
rowHeader?: boolean;
|
|
2567
|
+
/**
|
|
2568
|
+
* A small glyph drawn before the header's name, such as the column's data type. Without
|
|
2569
|
+
* `iconLabel` it is decoration: the header is named by `header` alone.
|
|
2313
2570
|
*/
|
|
2314
2571
|
icon?: default_2.ReactNode;
|
|
2572
|
+
/**
|
|
2573
|
+
* What `icon` says, for a screen reader, such as "number, joined". Given, the glyph is read
|
|
2574
|
+
* as an image with this name before the header's name; omitted, it is hidden from assistive
|
|
2575
|
+
* technology.
|
|
2576
|
+
*/
|
|
2577
|
+
iconLabel?: string;
|
|
2315
2578
|
/**
|
|
2316
2579
|
* A tooltip on the header, shown on hover and on keyboard focus and linked to the header
|
|
2317
2580
|
* as its description: the column's profile, such as "77 values, 1 to 36".
|
|
@@ -2323,6 +2586,19 @@ export declare interface DataTableColumn<TRow extends object> {
|
|
|
2323
2586
|
* the keyboard, Alt+ArrowDown, Shift+F10 or the context-menu key on the header opens it.
|
|
2324
2587
|
*/
|
|
2325
2588
|
menu?: default_2.ReactNode;
|
|
2589
|
+
/**
|
|
2590
|
+
* Controls at the end of the header, before the menu caret and outside the sort button, so a
|
|
2591
|
+
* click on them never sorts: a warning that opens its details on hover, a status badge. Keep
|
|
2592
|
+
* them small (about 20px); they are always shown. They take no tab stop of their own: the
|
|
2593
|
+
* grid has one, so whatever they offer must also be reachable from `menu`.
|
|
2594
|
+
*/
|
|
2595
|
+
headerEnd?: default_2.ReactNode;
|
|
2596
|
+
/**
|
|
2597
|
+
* A cell's tone: `"warning"` draws its text in the warning color, as a header's warning is
|
|
2598
|
+
* drawn, to mark a value that has a problem. Left out, or undefined for a row, the cell is
|
|
2599
|
+
* drawn as usual.
|
|
2600
|
+
*/
|
|
2601
|
+
cellTone?: (row: TRow) => "warning" | undefined;
|
|
2326
2602
|
}
|
|
2327
2603
|
|
|
2328
2604
|
/**
|
|
@@ -2375,7 +2651,7 @@ export declare interface DataTableHandle {
|
|
|
2375
2651
|
* functions, so a translation can order the pieces the way its own language
|
|
2376
2652
|
* needs, and numbers arrive already formatted for the active locale.
|
|
2377
2653
|
*/
|
|
2378
|
-
export declare type DataTableLabels = Pick<CompactMantineLabels, "clearSearch" | "columnMenu" | "dataTable" | "no" | "noMatchingRows" | "noRows" | "rowsSelected" | "rowsShown" | "search" | "searchPlaceholder" | "yes">;
|
|
2654
|
+
export declare type DataTableLabels = Pick<CompactMantineLabels, "clearSearch" | "columnMenu" | "dataTable" | "emptyCell" | "no" | "noMatchingRows" | "noRows" | "rowsSelected" | "rowsShown" | "search" | "searchPlaceholder" | "sortedBy" | "yes">;
|
|
2379
2655
|
|
|
2380
2656
|
/**
|
|
2381
2657
|
* Props for the DataTable component.
|
|
@@ -2429,6 +2705,13 @@ export declare interface DataTableProps<TRow extends object> {
|
|
|
2429
2705
|
* rather than the thing when the data changes underneath it.
|
|
2430
2706
|
*/
|
|
2431
2707
|
getRowId?: (row: TRow, index: number) => string;
|
|
2708
|
+
/**
|
|
2709
|
+
* A row's accessible name, read once when a screen reader moves onto the row, in place of
|
|
2710
|
+
* every cell's text joined. Supply it when the cells hold controls whose own names repeat
|
|
2711
|
+
* the row's subject ("Group 1 color", "Hide Group 1"), so a row reads each word once.
|
|
2712
|
+
* Left out, the row is read from its cells.
|
|
2713
|
+
*/
|
|
2714
|
+
rowLabel?: (row: TRow) => string;
|
|
2432
2715
|
/**
|
|
2433
2716
|
* The table's accessible name, such as "Nodes" or "Search results".
|
|
2434
2717
|
*
|
|
@@ -2463,9 +2746,9 @@ export declare interface DataTableProps<TRow extends object> {
|
|
|
2463
2746
|
* the thing virtualization exists to avoid.
|
|
2464
2747
|
*/
|
|
2465
2748
|
height?: number | string;
|
|
2466
|
-
/** How tall each row is drawn, in pixels. Defaults to
|
|
2749
|
+
/** How tall each row is drawn, in pixels. Defaults to 40, Figma's spreadsheet row (32 is its list row pitch, `PANEL_GRID.ROW_PITCH`). */
|
|
2467
2750
|
rowHeight?: number;
|
|
2468
|
-
/** How tall the header row is drawn, in pixels. Defaults to
|
|
2751
|
+
/** How tall the header row is drawn, in pixels. Defaults to 40, like a row. */
|
|
2469
2752
|
headerHeight?: number;
|
|
2470
2753
|
/**
|
|
2471
2754
|
* How many rows to draw beyond the ones on screen, above and below.
|
|
@@ -2585,6 +2868,33 @@ export declare interface DataTableProps<TRow extends object> {
|
|
|
2585
2868
|
* data at all, and a different one for a search that matched nothing.
|
|
2586
2869
|
*/
|
|
2587
2870
|
empty?: default_2.ReactNode;
|
|
2871
|
+
/**
|
|
2872
|
+
* How much room a cell leaves around its contents.
|
|
2873
|
+
*
|
|
2874
|
+
* - `"default"` is Figma's variables table: the first column padded 16 px each side, the
|
|
2875
|
+
* rest 12 and 8, for a table that has the width of a panel or more.
|
|
2876
|
+
* - `"compact"` pads every cell 4 px each side, for a short list in a popover or a narrow
|
|
2877
|
+
* panel, where the default padding would leave the columns no room for their contents.
|
|
2878
|
+
*/
|
|
2879
|
+
density?: "default" | "compact";
|
|
2880
|
+
/**
|
|
2881
|
+
* How wide a column without a `width` of its own is drawn.
|
|
2882
|
+
*
|
|
2883
|
+
* - `"fixed"` (the default) draws it one property-panel field wide.
|
|
2884
|
+
* - `"content"` draws it as wide as its header and the widest value among the rows the
|
|
2885
|
+
* table holds, between 48 and 320 pixels, so a short column is never cut while another
|
|
2886
|
+
* holds room to spare. A column only grows as wider rows arrive, so it does not jump while
|
|
2887
|
+
* the reader scrolls.
|
|
2888
|
+
*/
|
|
2889
|
+
columnSizing?: "fixed" | "content";
|
|
2890
|
+
/**
|
|
2891
|
+
* How a number cell is written, when the application writes the same values elsewhere and
|
|
2892
|
+
* they must read the same in both places (a score in a panel and in the table).
|
|
2893
|
+
*
|
|
2894
|
+
* Left out, numbers are formatted for the active locale with up to three fraction digits.
|
|
2895
|
+
* The search looks in the same text, and a column sized to its content measures it.
|
|
2896
|
+
*/
|
|
2897
|
+
formatNumber?: (value: number) => string;
|
|
2588
2898
|
}
|
|
2589
2899
|
|
|
2590
2900
|
/**
|
|
@@ -2680,6 +2990,45 @@ export declare interface DisclosureProps {
|
|
|
2680
2990
|
onOpenChange?: OpenChangeHandler;
|
|
2681
2991
|
}
|
|
2682
2992
|
|
|
2993
|
+
/**
|
|
2994
|
+
* A name that ellipsizes when its row is too narrow. While it is cut short, a pointer resting on
|
|
2995
|
+
* the row that holds it (the name, its count or value, anywhere but a control of its own) opens
|
|
2996
|
+
* the themed tooltip with the whole string; a name drawn whole has none, so a tooltip never
|
|
2997
|
+
* repeats what is already on the screen. The element's text stays the whole string, so the
|
|
2998
|
+
* accessible name never loses what the drawing cut.
|
|
2999
|
+
* @param props - Component props
|
|
3000
|
+
* @param props.name - The whole string
|
|
3001
|
+
* @param props.className - The class that draws and ellipsizes it
|
|
3002
|
+
* @param props.id - An id, for a row that names itself by this string
|
|
3003
|
+
* @param props.testId - A test id
|
|
3004
|
+
* @param props.self - Anchors the tooltip to the text itself rather than to its row
|
|
3005
|
+
* @param props.detail - The row's quiet text, which the tooltip carries after the name
|
|
3006
|
+
* @returns The name
|
|
3007
|
+
*/
|
|
3008
|
+
export declare function EllipsizedName({ name, className, id, testId, self, detail, }: Readonly<EllipsizedNameProps>): default_2.JSX.Element;
|
|
3009
|
+
|
|
3010
|
+
/** Props for EllipsizedName. */
|
|
3011
|
+
declare interface EllipsizedNameProps {
|
|
3012
|
+
/** The whole string, drawn and, while it is cut short, the tooltip. */
|
|
3013
|
+
name: default_2.ReactNode;
|
|
3014
|
+
/** The class that draws it, and ellipsizes it. */
|
|
3015
|
+
className: string;
|
|
3016
|
+
/** An id, for a row that names itself by this string. */
|
|
3017
|
+
id?: string;
|
|
3018
|
+
/** A test id. */
|
|
3019
|
+
testId?: string;
|
|
3020
|
+
/**
|
|
3021
|
+
* Anchors the tooltip to the text itself rather than to its row: for a second text in a row,
|
|
3022
|
+
* such as a long value, whose tooltip must not take the row from the name's.
|
|
3023
|
+
*/
|
|
3024
|
+
self?: boolean;
|
|
3025
|
+
/**
|
|
3026
|
+
* The row's quiet text, drawn by the row in an element marked `data-row-detail`. While the
|
|
3027
|
+
* name or that text is cut short, the tooltip shows both, so a cut row is read whole.
|
|
3028
|
+
*/
|
|
3029
|
+
detail?: default_2.ReactNode;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
2683
3032
|
/**
|
|
2684
3033
|
* Inject the stylesheet into `document.head` (once) and set `data-cm-contrast` on `<html>` to
|
|
2685
3034
|
* `"high"` or `"figma"`. Does nothing without a DOM.
|
|
@@ -2691,6 +3040,47 @@ export declare interface DisclosureProps {
|
|
|
2691
3040
|
*/
|
|
2692
3041
|
export declare function ensureCompactStyles(options?: CompactThemeOptions): void;
|
|
2693
3042
|
|
|
3043
|
+
/**
|
|
3044
|
+
* A node or edge chip: the kind's fixed color and icon, then a count or a name. Every place that
|
|
3045
|
+
* counts or names nodes or edges draws one, so a node always reads as the same blue circle and an
|
|
3046
|
+
* edge as the same orange segment, in both color schemes (tokens `--cm-entity-node` and
|
|
3047
|
+
* `--cm-entity-edge`, each at least 3:1 on the panel).
|
|
3048
|
+
*
|
|
3049
|
+
* The kind is spoken, not drawn: a screen reader hears "Node 60" or "Edge 120" (the `entityNode`
|
|
3050
|
+
* and `entityEdge` labels), while the eye reads the icon.
|
|
3051
|
+
* @param props - the kind, the content and an optional click handler
|
|
3052
|
+
* @param props.kind - node or edge
|
|
3053
|
+
* @param props.children - the count or the name
|
|
3054
|
+
* @param props.onClick - makes the chip a button
|
|
3055
|
+
* @param props.className - extra class
|
|
3056
|
+
* @param props.style - extra style
|
|
3057
|
+
* @returns the chip, a `span`, or a `button` with `onClick`
|
|
3058
|
+
* @example
|
|
3059
|
+
* ```tsx
|
|
3060
|
+
* <EntityChip kind="node">60</EntityChip>
|
|
3061
|
+
* <EntityChip kind="edge">TP53 - MDM2</EntityChip>
|
|
3062
|
+
* <EntityChip kind="node" onClick={openFilters}>140 of 900</EntityChip>
|
|
3063
|
+
* ```
|
|
3064
|
+
*/
|
|
3065
|
+
export declare function EntityChip({ kind, children, onClick, className, style, }: Readonly<EntityChipProps>): default_2.JSX.Element;
|
|
3066
|
+
|
|
3067
|
+
/** Props for EntityChip. */
|
|
3068
|
+
export declare interface EntityChipProps {
|
|
3069
|
+
/** Node or edge: decides the chip's color and icon, the same everywhere. */
|
|
3070
|
+
kind: EntityKind;
|
|
3071
|
+
/** The count or the name it shows ("60", "140 of 900", "TP53"). Format numbers first. */
|
|
3072
|
+
children: default_2.ReactNode;
|
|
3073
|
+
/** Makes the chip a button (a filter chip that opens its filters). */
|
|
3074
|
+
onClick?: ActivationHandler;
|
|
3075
|
+
/** Extra class on the chip. */
|
|
3076
|
+
className?: string;
|
|
3077
|
+
/** Extra style on the chip. */
|
|
3078
|
+
style?: default_2.CSSProperties;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
/** What an EntityChip counts or names. */
|
|
3082
|
+
export declare type EntityKind = "node" | "edge";
|
|
3083
|
+
|
|
2694
3084
|
/**
|
|
2695
3085
|
* Every glyph name in the closed field register, in register order.
|
|
2696
3086
|
*/
|
|
@@ -2832,6 +3222,63 @@ export declare interface FieldRowProps extends Omit<default_2.ComponentPropsWith
|
|
|
2832
3222
|
labelPosition?: "above" | "inline";
|
|
2833
3223
|
}
|
|
2834
3224
|
|
|
3225
|
+
/** What `useFileDrop` reports. */
|
|
3226
|
+
export declare interface FileDropState {
|
|
3227
|
+
/** Whether files are being dragged over the target now: draw the drop highlight while it is. */
|
|
3228
|
+
over: boolean;
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
/**
|
|
3232
|
+
* One way to get a file: a URL, a drop or the file picker, drawn to fit the space it has.
|
|
3233
|
+
*
|
|
3234
|
+
* Built from Mantine's TextInput, ActionIcon and Button at their compact sizes. The URL field is a
|
|
3235
|
+
* native `type="url"` field, checked when Enter is pressed: a valid address goes to `onUrl`, and
|
|
3236
|
+
* anything else marks the field invalid and calls nothing.
|
|
3237
|
+
* @example
|
|
3238
|
+
* ```tsx
|
|
3239
|
+
* <FileSource accept=".csv,.json" onFiles={([file]) => open(file)} onUrl={(url) => fetchFrom(url)} />
|
|
3240
|
+
* ```
|
|
3241
|
+
* @param props - see FileSourceProps.
|
|
3242
|
+
* @returns the file source.
|
|
3243
|
+
*/
|
|
3244
|
+
export declare function FileSource(props: Readonly<FileSourceProps>): default_2.JSX.Element;
|
|
3245
|
+
|
|
3246
|
+
/** Props for FileSource. */
|
|
3247
|
+
export declare interface FileSourceProps {
|
|
3248
|
+
/** How it is drawn. @default "auto" */
|
|
3249
|
+
variant?: FileSourceVariant;
|
|
3250
|
+
/** The files offered and taken, in the `accept` attribute's form (`.csv,.json`, `image/*`). */
|
|
3251
|
+
accept?: string;
|
|
3252
|
+
/** Whether more than one file may be chosen or dropped at once. @default false */
|
|
3253
|
+
multiple?: boolean;
|
|
3254
|
+
/** Whether to show the URL field (`row` and `drop`). @default true when `onUrl` is set */
|
|
3255
|
+
url?: boolean;
|
|
3256
|
+
/** Called with the chosen or dropped files (never empty). */
|
|
3257
|
+
onFiles: (files: File[]) => void;
|
|
3258
|
+
/** Called with the address typed into the URL field when Enter is pressed and it is a valid URL. */
|
|
3259
|
+
onUrl?: (url: string) => void;
|
|
3260
|
+
/**
|
|
3261
|
+
* The text of the button that opens the picker, and the name of the row's upload button.
|
|
3262
|
+
* Defaults to the `fileChoose` label ("Choose file").
|
|
3263
|
+
*/
|
|
3264
|
+
label?: string;
|
|
3265
|
+
/** The URL field's placeholder and accessible name. Defaults to the `fileUrl` label ("URL"). */
|
|
3266
|
+
placeholder?: string;
|
|
3267
|
+
/** Whether every control is off and drops are ignored. */
|
|
3268
|
+
disabled?: boolean;
|
|
3269
|
+
/** The address the URL field shows at first, and again whenever this value changes (the address in effect). */
|
|
3270
|
+
defaultValue?: string;
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
/**
|
|
3274
|
+
* How a `FileSource` is drawn:
|
|
3275
|
+
* - `row`: a URL field with an upload button at its end; the row takes a drop.
|
|
3276
|
+
* - `drop`: a dashed drop target with a "Choose file" button and, with `url`, a URL field.
|
|
3277
|
+
* - `button`: one "Choose file" button.
|
|
3278
|
+
* - `auto`: `row` while the space is narrower than 280px, else `drop`.
|
|
3279
|
+
*/
|
|
3280
|
+
export declare type FileSourceVariant = "row" | "drop" | "button" | "auto";
|
|
3281
|
+
|
|
2835
3282
|
/** One visible row. */
|
|
2836
3283
|
export declare interface FlatTreeRow {
|
|
2837
3284
|
node: TreeNodeData;
|
|
@@ -2845,6 +3292,15 @@ export declare interface FlatTreeRow {
|
|
|
2845
3292
|
expanded: boolean;
|
|
2846
3293
|
}
|
|
2847
3294
|
|
|
3295
|
+
/**
|
|
3296
|
+
* Move focus to a field the reader did not press -- the first field of a card a click elsewhere
|
|
3297
|
+
* opened -- and draw its focus ring there, as keyboard focus would. A select trigger rings on
|
|
3298
|
+
* keyboard focus only, so focus put on one after a click would land with no ring, and the reader
|
|
3299
|
+
* could not see where the next key goes. The next pointer press hides rings again as before.
|
|
3300
|
+
* @param element - the field to focus.
|
|
3301
|
+
*/
|
|
3302
|
+
export declare function focusWithRing(element: HTMLElement): void;
|
|
3303
|
+
|
|
2848
3304
|
/**
|
|
2849
3305
|
* Called repeatedly while a continuous gesture is in progress.
|
|
2850
3306
|
*
|
|
@@ -2894,10 +3350,9 @@ export declare type GestureStartHandler = (event: default_2.PointerEvent) => voi
|
|
|
2894
3350
|
/**
|
|
2895
3351
|
* Works out whether an activation came from a pointer or from the keyboard.
|
|
2896
3352
|
*
|
|
2897
|
-
* A keyboard activation is
|
|
2898
|
-
*
|
|
2899
|
-
*
|
|
2900
|
-
* from Enter or Space on a button.
|
|
3353
|
+
* A keyboard activation is either a keyboard event, or a click with a click
|
|
3354
|
+
* count of zero and no pointer type, which is how a browser reports the click it
|
|
3355
|
+
* synthesizes from Enter or Space on a button.
|
|
2901
3356
|
* @param event - The event that activated the control
|
|
2902
3357
|
* @returns The activation source, ready to hand to an {@link ActivationHandlerWithMeta}
|
|
2903
3358
|
*/
|
|
@@ -3043,7 +3498,7 @@ export declare interface GradientEditorProps {
|
|
|
3043
3498
|
/**
|
|
3044
3499
|
* Figma's floating help button: a 32 x 32 circle on `--cm-bg` with the 200 elevation and no hover
|
|
3045
3500
|
* change. Its tooltip shows and hides at once outside a Tooltip.Group; its focus ring (1px at -2px) fades in over 200ms.
|
|
3046
|
-
* It opens a
|
|
3501
|
+
* It opens a menu of the caller's items, 4px above and end-aligned.
|
|
3047
3502
|
* @param props - Component props
|
|
3048
3503
|
* @param props.label - Accessible name and tooltip
|
|
3049
3504
|
* @param props.children - The menu's items
|
|
@@ -3081,6 +3536,64 @@ export declare interface HistogramBin {
|
|
|
3081
3536
|
count: number;
|
|
3082
3537
|
/** Draws this bar in the accent color, for the bin the reader has selected or the one being explained. */
|
|
3083
3538
|
highlighted?: boolean;
|
|
3539
|
+
/**
|
|
3540
|
+
* A CSS color to paint this bar, such as what a color mapping gives the values in it, so the
|
|
3541
|
+
* chart is also a picture of the mapping. `highlighted` wins over it.
|
|
3542
|
+
*/
|
|
3543
|
+
paint?: string;
|
|
3544
|
+
/**
|
|
3545
|
+
* Draws this bar lighter, for a bin outside the range the reader chose: it differs from a
|
|
3546
|
+
* highlighted bar in lightness (3:1 or more), not in hue alone.
|
|
3547
|
+
*/
|
|
3548
|
+
dimmed?: boolean;
|
|
3549
|
+
/**
|
|
3550
|
+
* A second, larger count drawn as a pale bar behind this one, such as the whole data's count
|
|
3551
|
+
* behind what the other filters leave: the gap between them is what a filter took away.
|
|
3552
|
+
*/
|
|
3553
|
+
ghost?: number;
|
|
3554
|
+
/** Where this bin starts on the brush's scale. With a brush, bars are placed by it. */
|
|
3555
|
+
from?: number;
|
|
3556
|
+
/** Where this bin ends on the brush's scale. */
|
|
3557
|
+
to?: number;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
/**
|
|
3561
|
+
* A range brush on a histogram's horizontal scale: two thumbs (Mantine's RangeSlider) and a body
|
|
3562
|
+
* between them that moves both ends at once.
|
|
3563
|
+
*/
|
|
3564
|
+
export declare interface HistogramBrushProps {
|
|
3565
|
+
/** The scale's start: the left edge of the plot. */
|
|
3566
|
+
min: number;
|
|
3567
|
+
/** The scale's end: the right edge of the plot. */
|
|
3568
|
+
max: number;
|
|
3569
|
+
/** How far a thumb, the body or an arrow key moves at a time. */
|
|
3570
|
+
step: number;
|
|
3571
|
+
/** The range, `[start, end]`. */
|
|
3572
|
+
value: readonly [number, number];
|
|
3573
|
+
/** Every move while a thumb or the body is dragged. */
|
|
3574
|
+
onChange?: (value: [number, number]) => void;
|
|
3575
|
+
/** The move a gesture ends on: a release, a key, a click on a bar outside the range. */
|
|
3576
|
+
onChangeEnd?: (value: [number, number]) => void;
|
|
3577
|
+
/** Each thumb's value in words, its `aria-valuetext`. */
|
|
3578
|
+
valueText?: (value: number, thumb: 0 | 1) => string;
|
|
3579
|
+
/** The whole range in words, the body's `aria-valuetext`. */
|
|
3580
|
+
rangeText?: (value: readonly [number, number]) => string;
|
|
3581
|
+
/** What a thumb shows while it is focused, hovered or dragged, such as the bar under it. */
|
|
3582
|
+
thumbLabel?: (value: number, thumb: 0 | 1) => default_2.ReactNode;
|
|
3583
|
+
/** The start thumb's accessible name. */
|
|
3584
|
+
startLabel: string;
|
|
3585
|
+
/** The end thumb's accessible name. */
|
|
3586
|
+
endLabel: string;
|
|
3587
|
+
/** The body's accessible name. */
|
|
3588
|
+
bodyLabel: string;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
/** A line drawn over a histogram's bars, one value per bin, such as a selection's own activity. */
|
|
3592
|
+
export declare interface HistogramOverlay {
|
|
3593
|
+
/** The line's accessible name. */
|
|
3594
|
+
label: string;
|
|
3595
|
+
/** One value per bin, scaled over its own largest. */
|
|
3596
|
+
values: number[];
|
|
3084
3597
|
}
|
|
3085
3598
|
|
|
3086
3599
|
/**
|
|
@@ -3109,6 +3622,8 @@ export declare interface HistogramBin {
|
|
|
3109
3622
|
* @param props.busy - Whether the chart is still being worked out by something that finishes later
|
|
3110
3623
|
* @param props.live - How urgently a screen reader announces the chart when it changes on its own
|
|
3111
3624
|
* @param props.trailing - The 24px trailing slot: an advanced settings button, a reset control, or nothing
|
|
3625
|
+
* @param props.brush - A range brush on the bars' scale
|
|
3626
|
+
* @param props.overlay - A line over the bars, such as the selection's activity
|
|
3112
3627
|
* @returns The histogram row
|
|
3113
3628
|
* @example
|
|
3114
3629
|
* ```tsx
|
|
@@ -3124,7 +3639,7 @@ export declare interface HistogramBin {
|
|
|
3124
3639
|
* />
|
|
3125
3640
|
* ```
|
|
3126
3641
|
*/
|
|
3127
|
-
export declare function HistogramRow({ bins, label, minLabel, maxLabel, busy, live, trailing, }: HistogramRowProps): default_2.JSX.Element;
|
|
3642
|
+
export declare function HistogramRow({ bins, label, minLabel, maxLabel, busy, live, trailing, brush, overlay, }: HistogramRowProps): default_2.JSX.Element;
|
|
3128
3643
|
|
|
3129
3644
|
/**
|
|
3130
3645
|
* Props for the HistogramRow component.
|
|
@@ -3177,10 +3692,18 @@ export declare interface HistogramRowProps {
|
|
|
3177
3692
|
live?: LiveSetting;
|
|
3178
3693
|
/** The 24px trailing slot: an advanced settings button, a reset control, or nothing. */
|
|
3179
3694
|
trailing?: default_2.ReactNode;
|
|
3695
|
+
/**
|
|
3696
|
+
* A range brush on the bars' own scale: two thumbs under the plot and a body over it that
|
|
3697
|
+
* moves both ends. A click on a bar outside the range moves the range there. With a brush,
|
|
3698
|
+
* bins that give `from` and `to` are placed on its scale, so a thumb sits on its bin's edge.
|
|
3699
|
+
*/
|
|
3700
|
+
brush?: HistogramBrushProps;
|
|
3701
|
+
/** A line over the bars, such as the selection's activity, named for assistive technology. */
|
|
3702
|
+
overlay?: HistogramOverlay;
|
|
3180
3703
|
}
|
|
3181
3704
|
|
|
3182
3705
|
/**
|
|
3183
|
-
* A circled "i" that reveals an explanation on hover, on
|
|
3706
|
+
* A circled "i" that reveals an explanation on hover, on Enter or Space, or on tap.
|
|
3184
3707
|
*
|
|
3185
3708
|
* Use it where an explanation would otherwise become a sentence of its own on a
|
|
3186
3709
|
* dense panel: put it immediately after the name of the thing it explains. Give
|
|
@@ -3231,7 +3754,8 @@ export declare interface InfoCircleProps extends DisclosureProps {
|
|
|
3231
3754
|
* name while it is renamed (design/figma-spec.md 10.3).
|
|
3232
3755
|
*
|
|
3233
3756
|
* It opens focused with the whole name selected. Enter commits and Escape cancels, and both
|
|
3234
|
-
* hand focus back to
|
|
3757
|
+
* hand focus back to the row the field sits in (the nearest focusable element around it), or,
|
|
3758
|
+
* outside one, to whatever held it before the field opened. Leaving
|
|
3235
3759
|
* the field any other way (a click elsewhere, Tab) commits and lets focus go where it was sent.
|
|
3236
3760
|
* @param props - Component props
|
|
3237
3761
|
* @param props.value - The current name
|
|
@@ -3403,6 +3927,44 @@ export declare interface MenuCheckItemProps extends Omit<MenuItemProps, "leftSec
|
|
|
3403
3927
|
radio?: boolean;
|
|
3404
3928
|
}
|
|
3405
3929
|
|
|
3930
|
+
/**
|
|
3931
|
+
* A menu row's second line, under its label: why a disabled row cannot run ("Only in 3D"), or
|
|
3932
|
+
* what the row does. A row holding one grows from 24px to a 44px touch target and keeps both
|
|
3933
|
+
* lines whole; the line itself is the menu's secondary ink.
|
|
3934
|
+
* @param props - Component props
|
|
3935
|
+
* @param props.children - The line's text
|
|
3936
|
+
* @returns The line
|
|
3937
|
+
* @example
|
|
3938
|
+
* ```tsx
|
|
3939
|
+
* <Menu.Item aria-disabled data-disabled>
|
|
3940
|
+
* Camera views
|
|
3941
|
+
* <MenuItemDescription>Only in 3D</MenuItemDescription>
|
|
3942
|
+
* </Menu.Item>
|
|
3943
|
+
* ```
|
|
3944
|
+
*/
|
|
3945
|
+
export declare function MenuItemDescription({ children }: Readonly<{
|
|
3946
|
+
children: ReactNode;
|
|
3947
|
+
}>): JSX.Element;
|
|
3948
|
+
|
|
3949
|
+
/**
|
|
3950
|
+
* A menu row's shortcut, drawn at its right as Figma does ("F2", "Ctrl+D"). It is hidden from
|
|
3951
|
+
* assistive technology, so the row's name stays its label ("Rename", not "Rename F2"); give the
|
|
3952
|
+
* row `aria-keyshortcuts` with the same keys in ARIA's spelling ("Control+D", "Meta+D") so a
|
|
3953
|
+
* screen reader still says them.
|
|
3954
|
+
* @param props - Component props
|
|
3955
|
+
* @param props.children - The keys as the reader reads them
|
|
3956
|
+
* @returns The shortcut text
|
|
3957
|
+
* @example
|
|
3958
|
+
* ```tsx
|
|
3959
|
+
* <Menu.Item aria-keyshortcuts="Control+D" rightSection={<MenuShortcut>Ctrl+D</MenuShortcut>}>
|
|
3960
|
+
* Duplicate
|
|
3961
|
+
* </Menu.Item>
|
|
3962
|
+
* ```
|
|
3963
|
+
*/
|
|
3964
|
+
export declare function MenuShortcut({ children }: Readonly<{
|
|
3965
|
+
children: ReactNode;
|
|
3966
|
+
}>): JSX.Element;
|
|
3967
|
+
|
|
3406
3968
|
/**
|
|
3407
3969
|
* One reading, with a bar for where it falls in its distribution and a chip for
|
|
3408
3970
|
* its rank.
|
|
@@ -3429,7 +3991,7 @@ export declare interface MenuCheckItemProps extends Omit<MenuItemProps, "leftSec
|
|
|
3429
3991
|
* @param props.live - How urgently a screen reader announces the row when it changes on its own
|
|
3430
3992
|
* @param props.onClick - Called when the row is activated, with the event and whether it came from a pointer or the keyboard
|
|
3431
3993
|
* @param props.onDoubleClick - Called on a double click
|
|
3432
|
-
* @param props.onContextMenu - Called on a right click
|
|
3994
|
+
* @param props.onContextMenu - Called on a right click (a `contextmenu` event)
|
|
3433
3995
|
* @param props.onFocus - Called when the row takes focus
|
|
3434
3996
|
* @param props.onBlur - Called when the row loses focus
|
|
3435
3997
|
* @returns The metric row
|
|
@@ -3510,7 +4072,7 @@ export declare interface MetricRowProps {
|
|
|
3510
4072
|
onClick?: ActivationHandlerWithMeta;
|
|
3511
4073
|
/** Called on a double click, for opening the metric rather than selecting it. */
|
|
3512
4074
|
onDoubleClick?: default_2.MouseEventHandler<HTMLDivElement>;
|
|
3513
|
-
/** Called on a right click
|
|
4075
|
+
/** Called on a right click (a `contextmenu` event), for a context menu of your own. Wrap the row in ContextMenu to open one on a touch-and-hold too. */
|
|
3514
4076
|
onContextMenu?: default_2.MouseEventHandler<HTMLDivElement>;
|
|
3515
4077
|
/** Called when the row takes focus. Forwarded untouched. */
|
|
3516
4078
|
onFocus?: default_2.FocusEventHandler<HTMLDivElement>;
|
|
@@ -3637,7 +4199,8 @@ export declare type OpenChangeHandler = (opened: boolean, event?: default_2.Synt
|
|
|
3637
4199
|
* A page list (design/figma-spec.md 10.2): Figma's own accessible model, a one-column grid with
|
|
3638
4200
|
* one Tab stop. ArrowUp / ArrowDown / Home / End move focus without switching; Enter, Space or a
|
|
3639
4201
|
* click switches; F2 or a double-click renames when `onRename` is given. A row can carry a second
|
|
3640
|
-
* line, a trailing value and a row menu (see PageListItem); ArrowRight moves into the menu
|
|
4202
|
+
* line, a trailing value and a row menu (see PageListItem); ArrowRight moves into the menu, and
|
|
4203
|
+
* the menu key or Shift+F10 opens it. The
|
|
3641
4204
|
* menu's controls are taken out of the Tab order, so the list stays one Tab stop.
|
|
3642
4205
|
* @param props - Component props
|
|
3643
4206
|
* @param props.items - The items or pages
|
|
@@ -3688,7 +4251,7 @@ export declare interface PageListItem {
|
|
|
3688
4251
|
* The row's own control -- usually a "More" button opening a Menu -- drawn after the row in
|
|
3689
4252
|
* a cell of its own, so a click on it never switches to the page. Name the button after
|
|
3690
4253
|
* the row ("More for Les Miserables"). ArrowRight on a row moves into it and ArrowLeft
|
|
3691
|
-
* moves back.
|
|
4254
|
+
* moves back; the menu key or Shift+F10 presses it.
|
|
3692
4255
|
*/
|
|
3693
4256
|
menu?: default_2.ReactNode;
|
|
3694
4257
|
}
|
|
@@ -3830,7 +4393,7 @@ export declare const PANEL_GRID: {
|
|
|
3830
4393
|
export declare const PANEL_INK: {
|
|
3831
4394
|
/** primary text: a field's value, a row's name (#000000e5 / #fff) */
|
|
3832
4395
|
readonly VALUE: "var(--cm-text)";
|
|
3833
|
-
/** secondary text: glyph labels, unit suffixes, legends (#00000080 / #ffffffb2) */
|
|
4396
|
+
/** secondary text: glyph labels, unit suffixes, legends (#00000080 / #ffffffb2; #0000008c light in the AA mode) */
|
|
3834
4397
|
readonly CHROME: "var(--cm-text-secondary)";
|
|
3835
4398
|
/** reading prose (secondary text) */
|
|
3836
4399
|
readonly PROSE: "var(--cm-text-secondary)";
|
|
@@ -3864,11 +4427,11 @@ export declare const PANEL_INK: {
|
|
|
3864
4427
|
readonly ACCENT_GRAPHIC: "var(--cm-graphic-brand)";
|
|
3865
4428
|
/** the white label on the danger, success and inverse fills, which no accent changes */
|
|
3866
4429
|
readonly ON_SOLID: "var(--cm-text-onsolid)";
|
|
3867
|
-
/** warning (#ffcd29 / #f3c11b) */
|
|
4430
|
+
/** a warning fill, dot or glyph (#ffcd29 / #f3c11b); text uses WARNING_TEXT */
|
|
3868
4431
|
readonly WARNING: "var(--cm-bg-warning)";
|
|
3869
|
-
/** success (#14ae5c / #198f51) */
|
|
4432
|
+
/** a success fill or dot (#14ae5c / #198f51); text and glyphs use SUCCESS_TEXT */
|
|
3870
4433
|
readonly SUCCESS: "var(--cm-bg-success)";
|
|
3871
|
-
/** danger (#f24822 / #e03e1a) */
|
|
4434
|
+
/** a danger fill, dot or glyph (#f24822 / #e03e1a); text uses DANGER_TEXT */
|
|
3872
4435
|
readonly DANGER: "var(--cm-bg-danger)";
|
|
3873
4436
|
/** a row, tab or tool under the pointer (#f5f5f5 / #383838) */
|
|
3874
4437
|
readonly HOVER: "var(--cm-bg-hover)";
|
|
@@ -3882,6 +4445,12 @@ export declare const PANEL_INK: {
|
|
|
3882
4445
|
readonly SELECTED_HOVER: "var(--cm-bg-selected-hover)";
|
|
3883
4446
|
/** the children of a selected item (#f2f9ff / #32394d) */
|
|
3884
4447
|
readonly SELECTED_SECONDARY: "var(--cm-bg-selected-secondary)";
|
|
4448
|
+
/** danger text: an error message, a destructive verb (#dc3412 / #fca397; #c4381c light in the AA mode). DANGER is a fill */
|
|
4449
|
+
readonly DANGER_TEXT: "var(--cm-text-danger)";
|
|
4450
|
+
/** warning text (#b86200 / #f7d15f; #a65900 light in the AA mode). WARNING is a fill */
|
|
4451
|
+
readonly WARNING_TEXT: "var(--cm-text-warning)";
|
|
4452
|
+
/** success text and glyphs: a passed check's tick (#009951 / #7cd797; #008043 light in the AA mode). SUCCESS is a fill */
|
|
4453
|
+
readonly SUCCESS_TEXT: "var(--cm-text-success)";
|
|
3885
4454
|
/** links and brand text (#007be5 / #7cc4f8) */
|
|
3886
4455
|
readonly BRAND_TEXT: "var(--cm-text-brand)";
|
|
3887
4456
|
/** tertiary glyphs (#0000004d / #ffffff66) */
|
|
@@ -3892,11 +4461,11 @@ export declare const PANEL_INK: {
|
|
|
3892
4461
|
readonly TRANSLUCENT: "var(--cm-border-translucent)";
|
|
3893
4462
|
/** a stronger translucent edge: checkbox, switch track (#00000033 / #ffffff33) */
|
|
3894
4463
|
readonly TRANSLUCENT_STRONG: "var(--cm-border-translucent-strong)";
|
|
3895
|
-
/** the
|
|
4464
|
+
/** the menu surface: inside a menu it follows the page (#fff / #1e1e1e), elsewhere #1e1e1e */
|
|
3896
4465
|
readonly MENU: "var(--cm-bg-menu)";
|
|
3897
|
-
/** text on the menu
|
|
4466
|
+
/** text on the menu: inside a menu #000000e5 / #fff, elsewhere #fff */
|
|
3898
4467
|
readonly ON_MENU: "var(--cm-text-menu)";
|
|
3899
|
-
/** secondary text on the menu
|
|
4468
|
+
/** secondary text on the menu, shortcuts: inside a menu #00000080 / #ffffffb2 (#0000008c light in the AA mode), elsewhere #ffffffb2 */
|
|
3900
4469
|
readonly ON_MENU_SECONDARY: "var(--cm-text-menu-secondary)";
|
|
3901
4470
|
/** component (purple) text (#8638e5 / #d1a8ff) */
|
|
3902
4471
|
readonly COMPONENT: "var(--cm-text-component)";
|
|
@@ -4025,6 +4594,13 @@ export declare interface PanelFieldProps extends Omit<default_2.ComponentPropsWi
|
|
|
4025
4594
|
* choices you present yourself, and use `onClick` to open your own panel.
|
|
4026
4595
|
*/
|
|
4027
4596
|
data?: ComboboxData;
|
|
4597
|
+
/**
|
|
4598
|
+
* A small picture for each choice in `data`, keyed by the choice's value, drawn before its
|
|
4599
|
+
* name in the open list. A 16 x 16 drawing in `currentColor` fits best. It is decoration:
|
|
4600
|
+
* the choice is still named by its label. To show the chosen one in the closed field too,
|
|
4601
|
+
* pass it as `glyph`.
|
|
4602
|
+
*/
|
|
4603
|
+
optionGlyphs?: Readonly<Record<string, default_2.ReactNode>>;
|
|
4028
4604
|
/**
|
|
4029
4605
|
* A short unit shown after the value, in the secondary text color, at the
|
|
4030
4606
|
* end of the same box -- "%", "px" per second, a count of links.
|
|
@@ -4224,6 +4800,31 @@ export declare function parseHexaColor(hexa: string): {
|
|
|
4224
4800
|
*/
|
|
4225
4801
|
export declare function parseLocaleNumber(text: string, locale: string): number;
|
|
4226
4802
|
|
|
4803
|
+
/**
|
|
4804
|
+
* Opens the browser's file picker. Call it from a click or key handler: browsers open a picker
|
|
4805
|
+
* only in answer to the reader's own input.
|
|
4806
|
+
* @param options - which files, and whether more than one.
|
|
4807
|
+
* @param options.accept - the files offered, in the `accept` attribute's form.
|
|
4808
|
+
* @param options.multiple - whether the reader may choose more than one.
|
|
4809
|
+
* @returns the chosen files; empty when the reader cancels.
|
|
4810
|
+
* @example
|
|
4811
|
+
* ```ts
|
|
4812
|
+
* const [file] = await pickFiles({ accept: ".csv,.json" });
|
|
4813
|
+
* ```
|
|
4814
|
+
*/
|
|
4815
|
+
export declare function pickFiles({ accept, multiple }?: PickFilesOptions): Promise<File[]>;
|
|
4816
|
+
|
|
4817
|
+
/** Options for `pickFiles` and `useFileDrop`: which files are wanted. */
|
|
4818
|
+
export declare interface PickFilesOptions {
|
|
4819
|
+
/**
|
|
4820
|
+
* The files offered, in the `accept` attribute's form: extensions (`.csv`), MIME types
|
|
4821
|
+
* (`text/csv`) and wildcards (`image/*`), comma separated. Every file when unset.
|
|
4822
|
+
*/
|
|
4823
|
+
accept?: string;
|
|
4824
|
+
/** Whether the reader may choose more than one file. @default false */
|
|
4825
|
+
multiple?: boolean;
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4227
4828
|
export declare const Popout: typeof PopoutRoot & {
|
|
4228
4829
|
Trigger: typeof PopoutTrigger;
|
|
4229
4830
|
Panel: typeof PopoutPanel;
|
|
@@ -4614,6 +5215,8 @@ export declare interface PopoutManagerProps {
|
|
|
4614
5215
|
* @param props.gap - Gap between the panel and the anchor in pixels; negative values overlap them
|
|
4615
5216
|
* @param props.actions - Action buttons to display in the header
|
|
4616
5217
|
* @param props.manageFocus - Whether opening the panel moves focus into it and closing returns it
|
|
5218
|
+
* @param props.boundaryTop - The highest the panel's top may sit, in viewport pixels (below a header)
|
|
5219
|
+
* @param props.contained - Keep the panel across the Popout.Anchor around it, not only the window
|
|
4617
5220
|
* @param props.onDragStart - Called when the person starts dragging the panel
|
|
4618
5221
|
* @param props.onDrag - Called on every movement of a drag, with the offset from where the panel opened
|
|
4619
5222
|
* @param props.onDragEnd - Called when the drag finishes
|
|
@@ -4716,6 +5319,19 @@ export declare interface PopoutPanelProps {
|
|
|
4716
5319
|
* @default true
|
|
4717
5320
|
*/
|
|
4718
5321
|
manageFocus?: boolean;
|
|
5322
|
+
/**
|
|
5323
|
+
* The highest the panel's top may sit, in viewport pixels: pass the bottom of an app header
|
|
5324
|
+
* the panel must never cover. The panel is then never taller than the window below it.
|
|
5325
|
+
* @default 0
|
|
5326
|
+
*/
|
|
5327
|
+
boundaryTop?: number;
|
|
5328
|
+
/**
|
|
5329
|
+
* Keep the panel across the `Popout.Anchor` around it (a side panel), not only across the
|
|
5330
|
+
* window: a bubble opened from a row near the panel's edge then shifts back over the panel
|
|
5331
|
+
* instead of running past it. Without an anchor around it, the window bounds it as before.
|
|
5332
|
+
* @default false
|
|
5333
|
+
*/
|
|
5334
|
+
contained?: boolean;
|
|
4719
5335
|
/** Called when the person starts dragging the panel by its header. */
|
|
4720
5336
|
onDragStart?: GestureStartHandler;
|
|
4721
5337
|
/**
|
|
@@ -5067,7 +5683,10 @@ export declare interface QuickAction {
|
|
|
5067
5683
|
section?: string;
|
|
5068
5684
|
/** Extra words the default filter matches. */
|
|
5069
5685
|
keywords?: readonly string[];
|
|
5070
|
-
/**
|
|
5686
|
+
/**
|
|
5687
|
+
* Shown, but cannot be run. The arrow keys still reach it, so its `description` (why it
|
|
5688
|
+
* cannot be run) is read; it is never the first highlight.
|
|
5689
|
+
*/
|
|
5071
5690
|
disabled?: boolean;
|
|
5072
5691
|
/**
|
|
5073
5692
|
* A second, dimmed line under the name: why a disabled action cannot be run ("Holds
|
|
@@ -5076,6 +5695,10 @@ export declare interface QuickAction {
|
|
|
5076
5695
|
* headings).
|
|
5077
5696
|
*/
|
|
5078
5697
|
description?: string;
|
|
5698
|
+
/** `"component"` draws the name in the component tone (`--cm-text-component`, weight 600). */
|
|
5699
|
+
tone?: "component";
|
|
5700
|
+
/** The option's accessible name, when it is not `label` (a label set off by marks a reader should not hear). */
|
|
5701
|
+
"aria-label"?: string;
|
|
5079
5702
|
}
|
|
5080
5703
|
|
|
5081
5704
|
/**
|
|
@@ -5095,14 +5718,19 @@ export declare interface QuickAction {
|
|
|
5095
5718
|
* @param props.searchAction - A trailing action at the right end of the search field
|
|
5096
5719
|
* @param props.listId - The id of the result list, for a header control to name in `aria-controls`
|
|
5097
5720
|
* @param props.truncate - Cut a long name at the end or in the middle
|
|
5721
|
+
* @param props.descriptions - Each description under the name or at the end of its line
|
|
5722
|
+
* @param props.emptyText - What an empty list says before any search
|
|
5723
|
+
* @param props.highlight - The action highlighted when the list opens
|
|
5724
|
+
* @param props.activeOnOpen - Whether the first action or no row is active before a search
|
|
5098
5725
|
* @param props.placeholder - Placeholder of the search field
|
|
5099
5726
|
* @param props.width - Panel width
|
|
5100
5727
|
* @param props.height - Panel height
|
|
5101
5728
|
* @param props.className - Extra class on the panel
|
|
5102
5729
|
* @param props.style - Extra style on the panel
|
|
5730
|
+
* @param props.role - The panel's role: a dialog alone, a group inside a pop-out
|
|
5103
5731
|
* @returns The palette
|
|
5104
5732
|
*/
|
|
5105
|
-
export declare function QuickActions({ actions, onRun, onClose, query, onQueryChange, filter, header, searchAction, listId: listIdProp, truncate, placeholder, width, height, className, style, ...others }: QuickActionsProps): default_2.JSX.Element;
|
|
5733
|
+
export declare function QuickActions({ actions, onRun, onClose, query, onQueryChange, filter, header, searchAction, listId: listIdProp, truncate, descriptions, emptyText, highlight, activeOnOpen, placeholder, width, height, className, style, role, ...others }: QuickActionsProps): default_2.JSX.Element;
|
|
5106
5734
|
|
|
5107
5735
|
/**
|
|
5108
5736
|
* Props for the QuickActions component.
|
|
@@ -5140,6 +5768,12 @@ export declare interface QuickActionsProps {
|
|
|
5140
5768
|
listId?: string;
|
|
5141
5769
|
/** Accessible name of the dialog. Defaults to the "Quick actions" label. */
|
|
5142
5770
|
"aria-label"?: string;
|
|
5771
|
+
/**
|
|
5772
|
+
* The panel's role. `"dialog"` (the default) for a palette that stands alone; `"group"` for one
|
|
5773
|
+
* placed inside a pop-out, which is already the dialog and names it by its title.
|
|
5774
|
+
* @default "dialog"
|
|
5775
|
+
*/
|
|
5776
|
+
role?: "dialog" | "group";
|
|
5143
5777
|
/** Placeholder of the search field. Defaults to the "Search actions" label. */
|
|
5144
5778
|
placeholder?: string;
|
|
5145
5779
|
/**
|
|
@@ -5148,6 +5782,34 @@ export declare interface QuickActionsProps {
|
|
|
5148
5782
|
* the end. A middle-cut name carries the full name as its tooltip.
|
|
5149
5783
|
*/
|
|
5150
5784
|
truncate?: "end" | "middle";
|
|
5785
|
+
/**
|
|
5786
|
+
* Where each action's `description` goes: `"below"` (the default) on a dimmed second line
|
|
5787
|
+
* under the name, `"end"` dimmed at the end of the name's line, so every row stays one line
|
|
5788
|
+
* tall (a fact such as "1 to 36" beside a value's name).
|
|
5789
|
+
* @default "below"
|
|
5790
|
+
*/
|
|
5791
|
+
descriptions?: "below" | "end";
|
|
5792
|
+
/**
|
|
5793
|
+
* What the list says when there is nothing to list before any search: why it is empty and
|
|
5794
|
+
* where to go instead. Defaults to the "No results" label, which a search with no match
|
|
5795
|
+
* always says.
|
|
5796
|
+
*/
|
|
5797
|
+
emptyText?: string;
|
|
5798
|
+
/**
|
|
5799
|
+
* The action highlighted when the list opens, before anything is searched: the value in force,
|
|
5800
|
+
* so Enter keeps it and the arrows start from it. Defaults to the first action that can run.
|
|
5801
|
+
* It is the one row read as "selected": the highlight that moves with the arrows is the active
|
|
5802
|
+
* row (`aria-activedescendant`), never a choice already made.
|
|
5803
|
+
*/
|
|
5804
|
+
highlight?: string;
|
|
5805
|
+
/**
|
|
5806
|
+
* Which row is active when the list opens with no `highlight`, and again whenever the search is
|
|
5807
|
+
* emptied: `"first"` (the default) the first action that can run, as Figma's palette does;
|
|
5808
|
+
* `"none"` no row, as a combobox opens, so Enter runs nothing until the reader types or arrows.
|
|
5809
|
+
* Typing always makes the first action that can run active, never a disabled one.
|
|
5810
|
+
* @default "first"
|
|
5811
|
+
*/
|
|
5812
|
+
activeOnOpen?: "first" | "none";
|
|
5151
5813
|
/** Panel width. Default 529 (Figma's, the toolbar's width). */
|
|
5152
5814
|
width?: number;
|
|
5153
5815
|
/** Panel height. Default 354. */
|
|
@@ -5186,6 +5848,190 @@ export declare interface RailButtonProps extends Omit<UnstyledButtonProps, "chil
|
|
|
5186
5848
|
active?: boolean;
|
|
5187
5849
|
}
|
|
5188
5850
|
|
|
5851
|
+
/**
|
|
5852
|
+
* A mapping from a value to a look, edited on the value's own axis: the value's histogram with
|
|
5853
|
+
* each bar painted what its values get, handles under the bars for the domain's ends (and a
|
|
5854
|
+
* diverging ramp's midpoint), clamp brackets over the bars with each shaded tail counted, the cut
|
|
5855
|
+
* lines of a stepped ramp, a scale select, a palette select with Reverse, a chit for elements with
|
|
5856
|
+
* no value, and typed fields for the exact numbers.
|
|
5857
|
+
*
|
|
5858
|
+
* It computes nothing about the mapping: pass it the bins, paints, counts and steps of the thing
|
|
5859
|
+
* that will paint (graphty-element's `styles.preview` with `span: "data"`, so the axis stays the
|
|
5860
|
+
* data's extent while the domain moves inside it), and it reports the values the reader
|
|
5861
|
+
* picks. A dragged or arrowed handle lands on an edge between two bins; Home and End reach the
|
|
5862
|
+
* data's ends.
|
|
5863
|
+
* @param props - Component props
|
|
5864
|
+
* @param props.label - what the ramp maps
|
|
5865
|
+
* @param props.bins - the value axis
|
|
5866
|
+
* @param props.domain - the domain's two ends
|
|
5867
|
+
* @param props.onDomainChange - called with a new domain
|
|
5868
|
+
* @param props.midpoint - a diverging ramp's middle value
|
|
5869
|
+
* @param props.onMidpointChange - called with a new midpoint
|
|
5870
|
+
* @param props.clamp - the clamp and the counts beyond it
|
|
5871
|
+
* @param props.onClampChange - called with a new clamp
|
|
5872
|
+
* @param props.step - the smallest move of a handle, such as 1 for whole-number data
|
|
5873
|
+
* @param props.steps - a stepped ramp's cut values
|
|
5874
|
+
* @param props.describe - a handle's value in the reader's terms
|
|
5875
|
+
* @param props.formatValue - formats a value
|
|
5876
|
+
* @param props.scale - the scale set here
|
|
5877
|
+
* @param props.defaultScale - the scale in force when none is set
|
|
5878
|
+
* @param props.scales - the scales offered
|
|
5879
|
+
* @param props.onScaleChange - called with a new scale
|
|
5880
|
+
* @param props.palette - the palette set here
|
|
5881
|
+
* @param props.defaultPalette - the palette in force when none is set
|
|
5882
|
+
* @param props.palettes - the palettes offered
|
|
5883
|
+
* @param props.onPaletteChange - called with a new palette
|
|
5884
|
+
* @param props.unsetText - words an unset scale or palette select shows in place of its default
|
|
5885
|
+
* @param props.reverse - whether the palette runs high to low
|
|
5886
|
+
* @param props.onReverseChange - called with a new reverse
|
|
5887
|
+
* @param props.noValue - elements with no value
|
|
5888
|
+
* @param props.onNoValueChange - called to paint or skip them
|
|
5889
|
+
* @param props.labels - replacement words
|
|
5890
|
+
* @returns the ramp editor
|
|
5891
|
+
* @example
|
|
5892
|
+
* ```tsx
|
|
5893
|
+
* <RampEditor
|
|
5894
|
+
* label="Node color by degree"
|
|
5895
|
+
* bins={preview.bins.map((bin) => ({ from: bin.from, to: bin.to, count: bin.count, paint: bin.paints, label: `${bin.from} to ${bin.to}: ${bin.count}` }))}
|
|
5896
|
+
* domain={domain}
|
|
5897
|
+
* onDomainChange={setDomain}
|
|
5898
|
+
* describe={(handle, value) => `${handle === "domainLow" ? "Lowest" : "Highest"} color at degree ${value}`}
|
|
5899
|
+
* />
|
|
5900
|
+
* ```
|
|
5901
|
+
*/
|
|
5902
|
+
export declare function RampEditor({ label, bins, domain, onDomainChange, midpoint, onMidpointChange, clamp, onClampChange, step, steps, describe, formatValue, scale, defaultScale, scales, onScaleChange, palette, defaultPalette, palettes, onPaletteChange, unsetText, reverse, onReverseChange, noValue, onNoValueChange, labels: overrides, }: Readonly<RampEditorProps>): default_2.JSX.Element;
|
|
5903
|
+
|
|
5904
|
+
/** One bin of the value axis, lowest first; the bins are contiguous and drawn at equal width. */
|
|
5905
|
+
export declare interface RampEditorBin {
|
|
5906
|
+
/** The lower edge, in the data's units. */
|
|
5907
|
+
from: number;
|
|
5908
|
+
/** The upper edge, in the data's units. */
|
|
5909
|
+
to: number;
|
|
5910
|
+
/** How many elements fall in it. */
|
|
5911
|
+
count: number;
|
|
5912
|
+
/** What the values in it are painted, as a CSS color; the bar is drawn in it. */
|
|
5913
|
+
paint?: string;
|
|
5914
|
+
/** The bin in words for its tooltip and the table of values, such as `"3 to 4: 12 nodes"`. */
|
|
5915
|
+
label: string;
|
|
5916
|
+
}
|
|
5917
|
+
|
|
5918
|
+
/** Which handle a value or a description belongs to. */
|
|
5919
|
+
export declare type RampEditorHandle = "domainLow" | "domainHigh" | "midpoint" | "clampLow" | "clampHigh";
|
|
5920
|
+
|
|
5921
|
+
/** The words the editor draws or speaks; English by default. */
|
|
5922
|
+
export declare interface RampEditorLabels {
|
|
5923
|
+
/** Each handle's accessible name. */
|
|
5924
|
+
handles: Record<RampEditorHandle, string>;
|
|
5925
|
+
/** The typed fields' names, drawn above them: where the ramp starts and ends, in the data's units. */
|
|
5926
|
+
from: string;
|
|
5927
|
+
to: string;
|
|
5928
|
+
midpoint: string;
|
|
5929
|
+
/** The scale select's name. */
|
|
5930
|
+
scale: string;
|
|
5931
|
+
/** The palette select's name. */
|
|
5932
|
+
palette: string;
|
|
5933
|
+
/** The reverse toggle's name. */
|
|
5934
|
+
reverse: string;
|
|
5935
|
+
/** A clamp tail's count, such as "14 outside". */
|
|
5936
|
+
outside: (count: string) => string;
|
|
5937
|
+
/** The no-value chit, such as "No value: 3". */
|
|
5938
|
+
noValue: (count: string) => string;
|
|
5939
|
+
}
|
|
5940
|
+
|
|
5941
|
+
/** A palette offered in the palette select, drawn as a strip of its colors. */
|
|
5942
|
+
export declare interface RampEditorPalette {
|
|
5943
|
+
/** What is stored when it is picked. */
|
|
5944
|
+
value: string;
|
|
5945
|
+
/** Its name. */
|
|
5946
|
+
label: string;
|
|
5947
|
+
/** Its colors, lowest first, as CSS colors. */
|
|
5948
|
+
stops: string[];
|
|
5949
|
+
}
|
|
5950
|
+
|
|
5951
|
+
/** Props for the RampEditor component. */
|
|
5952
|
+
export declare interface RampEditorProps {
|
|
5953
|
+
/** What the ramp maps, such as `"Node color by degree"`: the histogram's accessible name. */
|
|
5954
|
+
label: string;
|
|
5955
|
+
/** The value axis: the data's bins, lowest first, spanning the data's ends. */
|
|
5956
|
+
bins: RampEditorBin[];
|
|
5957
|
+
/** The domain's two ends, in the data's units. */
|
|
5958
|
+
domain: [number, number];
|
|
5959
|
+
/** Called with the new domain when a domain handle moves or a domain field is typed. */
|
|
5960
|
+
onDomainChange?: (domain: [number, number]) => void;
|
|
5961
|
+
/** A diverging ramp's middle value; absent, no midpoint handle is drawn. */
|
|
5962
|
+
midpoint?: number;
|
|
5963
|
+
/** Called when the midpoint handle moves or its field is typed. */
|
|
5964
|
+
onMidpointChange?: (midpoint: number) => void;
|
|
5965
|
+
/**
|
|
5966
|
+
* The clamp: two values and how many elements lie beyond each. Absent, no brackets are drawn.
|
|
5967
|
+
*/
|
|
5968
|
+
clamp?: {
|
|
5969
|
+
low: number;
|
|
5970
|
+
high: number;
|
|
5971
|
+
below: number;
|
|
5972
|
+
above: number;
|
|
5973
|
+
};
|
|
5974
|
+
/** Called when a clamp bracket moves. */
|
|
5975
|
+
onClampChange?: (clamp: [number, number]) => void;
|
|
5976
|
+
/**
|
|
5977
|
+
* The smallest move of a handle, in the data's units: pass 1 for whole-number data (a count, a
|
|
5978
|
+
* rank), so the arrows move 1, 2, 3 and a drag lands on whole numbers. Absent, the arrows move
|
|
5979
|
+
* from one bin edge to the next. Page Up and Page Down move about a tenth of the data either way.
|
|
5980
|
+
*/
|
|
5981
|
+
step?: number;
|
|
5982
|
+
/** Where a stepped ramp changes step, in the data's units: drawn as cut lines on the bars. */
|
|
5983
|
+
steps?: number[];
|
|
5984
|
+
/**
|
|
5985
|
+
* A handle's value in the reader's terms, its `aria-valuetext`: "Lowest color at degree 3,
|
|
5986
|
+
* 12th percentile".
|
|
5987
|
+
*/
|
|
5988
|
+
describe: (handle: RampEditorHandle, value: number) => string;
|
|
5989
|
+
/** Formats a value for the axis ends and the typed fields. Defaults to the locale's numbers. */
|
|
5990
|
+
formatValue?: (value: number) => string;
|
|
5991
|
+
/**
|
|
5992
|
+
* The scale set here, or undefined when none is (the select then shows `defaultScale` and
|
|
5993
|
+
* offers no reset), and the scales offered (a glyph per scale draws its curve).
|
|
5994
|
+
*/
|
|
5995
|
+
scale?: string;
|
|
5996
|
+
/** The scale in force when none is set here. */
|
|
5997
|
+
defaultScale?: string;
|
|
5998
|
+
scales?: {
|
|
5999
|
+
value: string;
|
|
6000
|
+
label: string;
|
|
6001
|
+
glyph?: default_2.ReactNode;
|
|
6002
|
+
}[];
|
|
6003
|
+
/** Called with a picked scale, or undefined when the reader resets it. */
|
|
6004
|
+
onScaleChange?: (scale: string | undefined) => void;
|
|
6005
|
+
/** The palette set here (undefined: none is, as for `scale`), and the palettes offered. */
|
|
6006
|
+
palette?: string;
|
|
6007
|
+
/** The palette in force when none is set here. */
|
|
6008
|
+
defaultPalette?: string;
|
|
6009
|
+
palettes?: RampEditorPalette[];
|
|
6010
|
+
/** Called with a picked palette, or undefined when the reader resets it. */
|
|
6011
|
+
onPaletteChange?: (palette: string | undefined) => void;
|
|
6012
|
+
/**
|
|
6013
|
+
* Words the scale and palette selects show while neither is set here. Given, an unset select
|
|
6014
|
+
* is empty under these words instead of showing `defaultScale` or `defaultPalette` as if it
|
|
6015
|
+
* were chosen, and it is offered even with no default.
|
|
6016
|
+
*/
|
|
6017
|
+
unsetText?: string;
|
|
6018
|
+
/** Whether the palette runs high to low. Omit `onReverseChange` to hide the toggle. */
|
|
6019
|
+
reverse?: boolean;
|
|
6020
|
+
onReverseChange?: (reverse: boolean) => void;
|
|
6021
|
+
/**
|
|
6022
|
+
* Elements with no value: how many, and what they are painted (a CSS color), or null when they
|
|
6023
|
+
* are skipped. Absent, the chit is not drawn.
|
|
6024
|
+
*/
|
|
6025
|
+
noValue?: {
|
|
6026
|
+
count: number;
|
|
6027
|
+
paint: string | null;
|
|
6028
|
+
};
|
|
6029
|
+
/** Called with true to paint elements with no value, false to skip them. */
|
|
6030
|
+
onNoValueChange?: (paint: boolean) => void;
|
|
6031
|
+
/** Replace any of the English words. */
|
|
6032
|
+
labels?: Partial<RampEditorLabels>;
|
|
6033
|
+
}
|
|
6034
|
+
|
|
5189
6035
|
/**
|
|
5190
6036
|
* A row that draws a range: two values with the mapping between them drawn
|
|
5191
6037
|
* in-line, and no sentence anywhere.
|
|
@@ -5381,6 +6227,24 @@ export declare interface RampRowProps {
|
|
|
5381
6227
|
*/
|
|
5382
6228
|
declare type RampScale = "sqrt" | "linear" | "log";
|
|
5383
6229
|
|
|
6230
|
+
/**
|
|
6231
|
+
* Mantine's RangeSlider, with the `aria-valuetext` given through `thumbProps` on each thumb.
|
|
6232
|
+
* @param props - Mantine's RangeSlider props
|
|
6233
|
+
* @returns The range slider
|
|
6234
|
+
* @example
|
|
6235
|
+
* ```tsx
|
|
6236
|
+
* <RangeSlider
|
|
6237
|
+
* min={0}
|
|
6238
|
+
* max={100}
|
|
6239
|
+
* thumbProps={(index) => ({ "aria-valuetext": index === 0 ? "Jan 5" : "Feb 3" })}
|
|
6240
|
+
* />
|
|
6241
|
+
* ```
|
|
6242
|
+
*/
|
|
6243
|
+
export declare const RangeSlider: default_2.ForwardRefExoticComponent<Omit<RangeSliderProps & default_2.RefAttributes<HTMLDivElement> & {
|
|
6244
|
+
component?: any;
|
|
6245
|
+
renderRoot?: (props: Record<string, any>) => default_2.ReactNode;
|
|
6246
|
+
}, "ref"> & default_2.RefAttributes<HTMLDivElement>>;
|
|
6247
|
+
|
|
5384
6248
|
/**
|
|
5385
6249
|
* A small chip for a rank: `#6`, where a sentence used to say `Rank 6 of 318`.
|
|
5386
6250
|
*
|
|
@@ -5543,7 +6407,8 @@ export declare interface ResizeHandleProps extends Omit<default_2.ComponentProps
|
|
|
5543
6407
|
/**
|
|
5544
6408
|
* A find result (design/figma-spec.md 10.4): 240 x 52 with a path line, 34 without, padding
|
|
5545
6409
|
* 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
|
|
5546
|
-
* secondary color. The current result is blue; hover is gray.
|
|
6410
|
+
* secondary color. The current result is blue; hover is gray. A long name or path ends in "..."
|
|
6411
|
+
* and shows whole in a tooltip on hover; with `lines={2}` each first wraps to a second line.
|
|
5547
6412
|
*
|
|
5548
6413
|
* It is an `option`: put the rows in an element with `role="listbox"` and drive them from the
|
|
5549
6414
|
* search field with `aria-activedescendant` (give each row an `id`), so focus stays in the
|
|
@@ -5567,8 +6432,19 @@ export declare interface ResultRowProps extends Omit<default_2.HTMLAttributes<HT
|
|
|
5567
6432
|
icon?: default_2.ReactNode;
|
|
5568
6433
|
/** The current result (blue fill; `aria-selected`). */
|
|
5569
6434
|
current?: boolean;
|
|
6435
|
+
/**
|
|
6436
|
+
* For a list the reader picks several results from, one at a time: whether this result is
|
|
6437
|
+
* already picked. A picked row shows a check at its end and is `aria-selected` too; only the
|
|
6438
|
+
* current row is filled blue.
|
|
6439
|
+
*/
|
|
6440
|
+
picked?: boolean;
|
|
5570
6441
|
/** `"component"`: both lines and the glyph in the component (purple) color. */
|
|
5571
6442
|
tone?: "default" | "component";
|
|
6443
|
+
/**
|
|
6444
|
+
* How many lines the name and the path each take before they end in "...": 1 (the default)
|
|
6445
|
+
* or 2, for results whose words are read whole rather than scanned, such as a sentence.
|
|
6446
|
+
*/
|
|
6447
|
+
lines?: 1 | 2;
|
|
5572
6448
|
}
|
|
5573
6449
|
|
|
5574
6450
|
/** The rows and columns of the matrix, top to bottom and left to right. */
|
|
@@ -5600,8 +6476,8 @@ export declare interface ScrollAreaProps extends ScrollAreaProps_2 {
|
|
|
5600
6476
|
* button once there is text, and a focus ring drawn flush with the field that lingers 100ms after
|
|
5601
6477
|
* focus leaves.
|
|
5602
6478
|
*
|
|
5603
|
-
* Escape clears the text; with nothing to clear it is left
|
|
5604
|
-
* can close. `autoFocus` is off by default: Figma focuses its search fields when their panel
|
|
6479
|
+
* Escape clears the text, in the field or on its clear button; with nothing to clear it is left
|
|
6480
|
+
* to bubble, so an enclosing popover can close. `autoFocus` is off by default: Figma focuses its search fields when their panel
|
|
5605
6481
|
* opens, and whether that is right is the caller's decision.
|
|
5606
6482
|
* @example
|
|
5607
6483
|
* ```tsx
|
|
@@ -5704,7 +6580,8 @@ declare function SecondaryToolbarRoot({ flush, children, className, onKeyDown, o
|
|
|
5704
6580
|
* wrapper with only a description or an error leaves `aria-labelledby`
|
|
5705
6581
|
* pointing at no element. Browsers skip a missing id and fall back to any
|
|
5706
6582
|
* `aria-label`, so give the control one in that case.
|
|
5707
|
-
* @param props - Mantine's SegmentedControl props
|
|
6583
|
+
* @param props - Mantine's SegmentedControl props, and its name
|
|
6584
|
+
* @param props.label - The control's name, for a `FieldRow` caption and its accessible name
|
|
5708
6585
|
* @returns The segmented control
|
|
5709
6586
|
* @example
|
|
5710
6587
|
* ```tsx
|
|
@@ -5713,7 +6590,13 @@ declare function SecondaryToolbarRoot({ flush, children, className, onKeyDown, o
|
|
|
5713
6590
|
* </Input.Wrapper>
|
|
5714
6591
|
* ```
|
|
5715
6592
|
*/
|
|
5716
|
-
export declare function SegmentedControl(props: default_2.ComponentProps<typeof SegmentedControl_2>
|
|
6593
|
+
export declare function SegmentedControl({ label, ...props }: default_2.ComponentProps<typeof SegmentedControl_2> & {
|
|
6594
|
+
/**
|
|
6595
|
+
* The control's name: its accessible name outside an `Input.Wrapper`, and the caption a
|
|
6596
|
+
* `FieldRow` draws for it while labels are shown, as it does for a `PanelField`.
|
|
6597
|
+
*/
|
|
6598
|
+
label?: string;
|
|
6599
|
+
}): default_2.JSX.Element;
|
|
5717
6600
|
|
|
5718
6601
|
/** One shortcut: what it does and the keys that do it. */
|
|
5719
6602
|
export declare interface ShortcutEntry {
|
|
@@ -5793,6 +6676,16 @@ export declare interface ShortcutSheetTab {
|
|
|
5793
6676
|
caption?: default_2.ReactNode;
|
|
5794
6677
|
}
|
|
5795
6678
|
|
|
6679
|
+
/**
|
|
6680
|
+
* Mantine's Slider, with the `aria-valuetext` given through `thumbProps` on its thumb.
|
|
6681
|
+
* @param props - Mantine's Slider props
|
|
6682
|
+
* @returns The slider
|
|
6683
|
+
*/
|
|
6684
|
+
export declare const Slider: default_2.ForwardRefExoticComponent<Omit<SliderProps & default_2.RefAttributes<HTMLDivElement> & {
|
|
6685
|
+
component?: any;
|
|
6686
|
+
renderRoot?: (props: Record<string, any>) => default_2.ReactNode;
|
|
6687
|
+
}, "ref"> & default_2.RefAttributes<HTMLDivElement>>;
|
|
6688
|
+
|
|
5796
6689
|
/**
|
|
5797
6690
|
* The same chart at half the height, for a series rather than a distribution.
|
|
5798
6691
|
*
|
|
@@ -5920,6 +6813,29 @@ export declare interface SplitButtonProps extends BoxProps, ElementProps<"div",
|
|
|
5920
6813
|
menuProps?: Omit<MenuProps, "children">;
|
|
5921
6814
|
}
|
|
5922
6815
|
|
|
6816
|
+
/**
|
|
6817
|
+
* The editor's status bar: a 24px row along the bottom of the window, with a start and an end
|
|
6818
|
+
* slot, for state the reader reads but does not act on (saved, offline, counts).
|
|
6819
|
+
*
|
|
6820
|
+
* The bar is not a live region itself: a child whose changes should be announced carries its own
|
|
6821
|
+
* `role="status"`, so only that child is read out when it changes.
|
|
6822
|
+
* @example
|
|
6823
|
+
* ```tsx
|
|
6824
|
+
* <StatusBar left={<AutosaveChip />} right={<PrivacyChip />} />
|
|
6825
|
+
* ```
|
|
6826
|
+
* @param props - see StatusBarProps.
|
|
6827
|
+
* @returns the status bar.
|
|
6828
|
+
*/
|
|
6829
|
+
export declare function StatusBar(props: Readonly<StatusBarProps>): default_2.JSX.Element;
|
|
6830
|
+
|
|
6831
|
+
/** Props for StatusBar. Every other div attribute is passed to the bar. */
|
|
6832
|
+
export declare interface StatusBarProps extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
6833
|
+
/** What sits at the bar's start: status chips, counts. */
|
|
6834
|
+
left?: default_2.ReactNode;
|
|
6835
|
+
/** What sits at the bar's end. */
|
|
6836
|
+
right?: default_2.ReactNode;
|
|
6837
|
+
}
|
|
6838
|
+
|
|
5923
6839
|
/**
|
|
5924
6840
|
* Swatches with alpha channel for HEXA color pickers.
|
|
5925
6841
|
* Includes both fully opaque (FF) and semi-transparent (80) variants.
|
|
@@ -5938,6 +6854,7 @@ export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#6
|
|
|
5938
6854
|
* @param props.withCloseButton - Show the dismiss X
|
|
5939
6855
|
* @param props.onClose - Called when the dismiss X is pressed
|
|
5940
6856
|
* @param props.closeLabel - The dismiss button's accessible name
|
|
6857
|
+
* @param props.alert - Whether the message is its own alert
|
|
5941
6858
|
* @returns The toast
|
|
5942
6859
|
*/
|
|
5943
6860
|
export declare const Toast: ForwardRefExoticComponent<ToastProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -5988,6 +6905,12 @@ export declare interface ToastProps extends Omit<NotificationProps, "children" |
|
|
|
5988
6905
|
onClose?: () => void;
|
|
5989
6906
|
/** The dismiss button's accessible name. @default "Dismiss" */
|
|
5990
6907
|
closeLabel?: string;
|
|
6908
|
+
/**
|
|
6909
|
+
* Whether the message is its own alert. Set it to false when the caller speaks the message
|
|
6910
|
+
* itself, through a status line already on the page, so it is said once and politely.
|
|
6911
|
+
* @default true
|
|
6912
|
+
*/
|
|
6913
|
+
alert?: boolean;
|
|
5991
6914
|
}
|
|
5992
6915
|
|
|
5993
6916
|
/**
|
|
@@ -6052,8 +6975,14 @@ export declare interface ToggleIconButtonProps extends Omit<ActionIconProps, "va
|
|
|
6052
6975
|
defaultChecked?: boolean;
|
|
6053
6976
|
/** Called with the new state when the toggle flips. */
|
|
6054
6977
|
onChange?: (checked: boolean) => void;
|
|
6055
|
-
/** The accessible name, and the tooltip text. */
|
|
6978
|
+
/** The accessible name, and the tooltip text unless `tooltip` gives other words. */
|
|
6056
6979
|
label: string;
|
|
6980
|
+
/**
|
|
6981
|
+
* The tooltip's words when they differ from the accessible name: a row's eye can say "Turn
|
|
6982
|
+
* this layer off" while its name keeps the row's own name, so a list of eyes stays tellable
|
|
6983
|
+
* apart by a screen reader. @default label
|
|
6984
|
+
*/
|
|
6985
|
+
tooltip?: string;
|
|
6057
6986
|
/** The glyph. */
|
|
6058
6987
|
icon: ReactNode;
|
|
6059
6988
|
/** The glyph drawn while on, for a `swap` toggle (eye / eye closed). */
|
|
@@ -6469,6 +7398,13 @@ export declare interface ToolbarProps extends BoxProps, ElementProps<"div"> {
|
|
|
6469
7398
|
* to position the toolbar yourself.
|
|
6470
7399
|
*/
|
|
6471
7400
|
floating?: boolean;
|
|
7401
|
+
/**
|
|
7402
|
+
* Where Tab first lands in the toolbar: the selected tool ("pressed", the default, for a tool
|
|
7403
|
+
* palette whose pressed button is the current tool) or the first item ("first", for a bar of
|
|
7404
|
+
* commands and toggles, where a pressed toggle is not where the reader starts). After that,
|
|
7405
|
+
* Tab returns to the item that last had focus.
|
|
7406
|
+
*/
|
|
7407
|
+
startAt?: "pressed" | "first";
|
|
6472
7408
|
/** Tool groups, tool buttons, dividers and a mode switch. */
|
|
6473
7409
|
children?: default_2.ReactNode;
|
|
6474
7410
|
}
|
|
@@ -6478,10 +7414,11 @@ export declare interface ToolbarProps extends BoxProps, ElementProps<"div"> {
|
|
|
6478
7414
|
* 200 elevation, holding tool buttons, tool groups with flyouts, dividers and a
|
|
6479
7415
|
* `SegmentedControl variant="toolbar"` mode switch.
|
|
6480
7416
|
*
|
|
6481
|
-
* It is one Tab stop: focus lands on the selected tool
|
|
6482
|
-
* move between tools, chevrons and the mode radios.
|
|
7417
|
+
* It is one Tab stop: focus lands on the selected tool (or the first item, `startAt="first"`),
|
|
7418
|
+
* and ArrowLeft / ArrowRight / Home / End move between tools, chevrons and the mode radios.
|
|
6483
7419
|
* @param props - Component props
|
|
6484
7420
|
* @param props.floating - Pin the toolbar to the bottom center of the window
|
|
7421
|
+
* @param props.startAt - Where Tab first lands: the selected tool or the first item
|
|
6485
7422
|
* @param props.children - Tool groups, tool buttons, dividers and a mode switch
|
|
6486
7423
|
* @param props.className - Extra class on the root
|
|
6487
7424
|
* @param props.onKeyDown - Called before the roving-focus key handling
|
|
@@ -6496,7 +7433,7 @@ export declare interface ToolbarProps extends BoxProps, ElementProps<"div"> {
|
|
|
6496
7433
|
* </Toolbar>
|
|
6497
7434
|
* ```
|
|
6498
7435
|
*/
|
|
6499
|
-
declare function ToolbarRoot({ floating, children, className, onKeyDown, onFocus, ...others }: ToolbarProps): default_2.JSX.Element;
|
|
7436
|
+
declare function ToolbarRoot({ floating, startAt, children, className, onKeyDown, onFocus, ...others }: ToolbarProps): default_2.JSX.Element;
|
|
6500
7437
|
|
|
6501
7438
|
/**
|
|
6502
7439
|
* A 32 x 32 toolbar tool (Figma's toolbelt button): transparent at rest, `--cm-bg-hover` under the
|
|
@@ -6541,7 +7478,7 @@ export declare interface ToolButtonProps extends Omit<UnstyledButtonProps, "chil
|
|
|
6541
7478
|
|
|
6542
7479
|
/**
|
|
6543
7480
|
* A tool and its flyout (Figma's tool group): the face is the LAST tool picked from the flyout,
|
|
6544
|
-
* and a 16 x 32 chevron 1px after it opens a
|
|
7481
|
+
* and a 16 x 32 chevron 1px after it opens a menu 4px above, start-aligned to the chevron,
|
|
6545
7482
|
* whose rows are radios with a check on the current face. Picking a row selects the tool, makes
|
|
6546
7483
|
* it the face and closes the menu.
|
|
6547
7484
|
* @param props - Component props
|
|
@@ -6657,18 +7594,22 @@ export declare interface TrailingSlotProps {
|
|
|
6657
7594
|
* The tree renders; the caller owns the data. Selection and expansion are controlled or
|
|
6658
7595
|
* uncontrolled; renaming and moving are reported through `onRename` and `onMove`.
|
|
6659
7596
|
*
|
|
6660
|
-
* Keyboard (one Tab stop, roving focus): ArrowUp / ArrowDown move; ArrowRight opens a closed
|
|
7597
|
+
* Keyboard (one Tab stop, roving focus; a row's own toggles are not Tab stops): ArrowUp / ArrowDown move; ArrowRight opens a closed
|
|
6661
7598
|
* parent or moves to its first child; ArrowLeft closes an open parent or moves to the parent;
|
|
6662
7599
|
* Home / End; type-ahead; Enter or Space selects (Shift extends, Control / Command toggles); `*`
|
|
6663
7600
|
* opens every sibling; F2 renames; Alt+L closes everything; with `onMove`, Alt+ArrowUp /
|
|
6664
|
-
* Alt+ArrowDown move the focused item one place among its siblings
|
|
6665
|
-
*
|
|
7601
|
+
* Alt+ArrowDown move the focused item one place among its siblings or into the folder next to
|
|
7602
|
+
* it, and Alt+ArrowLeft moves it out of its folder. `onRowKeyDown` sees every key first and can
|
|
7603
|
+
* claim one with `preventDefault()`.
|
|
6666
7604
|
* Row toggles (`actions`) are out of the Tab order: ArrowRight on a row without children, or
|
|
6667
7605
|
* Alt+ArrowRight on any row, focuses the row's first toggle; there ArrowLeft / ArrowRight walk the
|
|
6668
7606
|
* toggles, Enter / Space press one, ArrowLeft on the first or Escape returns to the row, and
|
|
6669
7607
|
* ArrowUp / ArrowDown go to the row above or below.
|
|
6670
|
-
* Pointer: click selects (Shift range, Control / Command toggle);
|
|
6671
|
-
*
|
|
7608
|
+
* Pointer: click selects (Shift range, Control / Command toggle); a right-click on a row that is
|
|
7609
|
+
* not selected selects it alone before its menu opens; the caret opens one row;
|
|
7610
|
+
* double-click renames; drag a row to move it (a mouse or pen after 4px of movement, a finger
|
|
7611
|
+
* after holding the row half a second; a quicker swipe scrolls). Escape cancels a drag, and the
|
|
7612
|
+
* list scrolls when a drag nears its edge.
|
|
6672
7613
|
* @param props - Component props
|
|
6673
7614
|
* @param props.items - The items or pages
|
|
6674
7615
|
* @param props.label - The accessible name
|
|
@@ -6679,12 +7620,20 @@ export declare interface TrailingSlotProps {
|
|
|
6679
7620
|
* @param props.defaultExpanded - Expanded ids to start with
|
|
6680
7621
|
* @param props.onExpandedChange - Called with the expanded ids
|
|
6681
7622
|
* @param props.multiselect - Allow several selected rows
|
|
7623
|
+
* @param props.checkboxes - A checkbox per row, and plain clicks that add or take out a row
|
|
6682
7624
|
* @param props.onRename - Called with a new name; turns renaming on
|
|
7625
|
+
* @param props.renaming - The row being renamed (controlled)
|
|
7626
|
+
* @param props.onRenamingChange - Called when a rename opens or closes
|
|
6683
7627
|
* @param props.onMove - Called when a row is dropped somewhere new or moved from the keyboard
|
|
6684
7628
|
* @param props.stickyRoots - Pin expanded top-level rows while scrolling
|
|
7629
|
+
* @param props.revealSelected - Open the folders around a newly selected row and scroll it into view
|
|
7630
|
+
* @param props.restingId - The row in the Tab order while none is focused or selected
|
|
6685
7631
|
* @param props.height - The scrolling height when virtualized
|
|
6686
7632
|
* @param props.renameLabel - The rename field's accessible name
|
|
6687
7633
|
* @param props.onRowKeyDown - Called first for a key pressed on a focused row; preventDefault claims it
|
|
7634
|
+
* @param props.canDrop - Where an item may land
|
|
7635
|
+
* @param props.rowMenu - The row's context menu
|
|
7636
|
+
* @param props.childBand - Band a selected parent's children (default true)
|
|
6688
7637
|
* @returns The tree
|
|
6689
7638
|
* @example
|
|
6690
7639
|
* A row with a swatch, a count, a running line and its state in words, and a row shortcut.
|
|
@@ -6700,7 +7649,7 @@ export declare interface TrailingSlotProps {
|
|
|
6700
7649
|
* />
|
|
6701
7650
|
* ```
|
|
6702
7651
|
*/
|
|
6703
|
-
export declare function Tree({ items, label, selected, defaultSelected, onSelect, expanded, defaultExpanded, onExpandedChange, multiselect, onRename, onMove, stickyRoots, height, renameLabel, onRowKeyDown, }: TreeProps): default_2.JSX.Element;
|
|
7652
|
+
export declare function Tree({ items, label, selected, defaultSelected, onSelect, expanded, defaultExpanded, onExpandedChange, multiselect, checkboxes, onRename, renaming: renamingProp, onRenamingChange, onMove, stickyRoots, height, renameLabel, onRowKeyDown, canDrop, rowMenu, childBand, revealSelected, restingId, }: TreeProps): default_2.JSX.Element;
|
|
6704
7653
|
|
|
6705
7654
|
/**
|
|
6706
7655
|
* One row of a layer tree, as Figma draws it (design/figma-spec.md 10.1): 32 tall, a 16px caret
|
|
@@ -6741,7 +7690,8 @@ export declare interface TreeItemProps extends Omit<default_2.HTMLAttributes<HTM
|
|
|
6741
7690
|
strong?: boolean;
|
|
6742
7691
|
/**
|
|
6743
7692
|
* The trailing toggles, revealed on hover or focus. Inside a Tree they are out of the Tab
|
|
6744
|
-
* order and reached with ArrowRight (see Tree).
|
|
7693
|
+
* order and reached with ArrowRight (see Tree). A toggle marked `data-at-rest` is drawn on
|
|
7694
|
+
* every row at rest too (a layers panel's eye).
|
|
6745
7695
|
*/
|
|
6746
7696
|
actions?: default_2.ReactNode;
|
|
6747
7697
|
/** 1-based position among its siblings, for assistive technology. */
|
|
@@ -6756,8 +7706,14 @@ export declare interface TreeItemProps extends Omit<default_2.HTMLAttributes<HTM
|
|
|
6756
7706
|
progress?: number | "indeterminate";
|
|
6757
7707
|
/** The row's state in words, read after its name. See TreeNodeData.description. */
|
|
6758
7708
|
description?: string;
|
|
7709
|
+
/** Draw the description as a second line. See TreeNodeData.descriptionVisible. */
|
|
7710
|
+
descriptionVisible?: boolean;
|
|
6759
7711
|
/** Drawn in place of the name, e.g. an InlineRename. */
|
|
6760
7712
|
nameSlot?: default_2.ReactNode;
|
|
7713
|
+
/** Draw a checkbox that shows `selected`, before the glyph (the Tree's `checkboxes` mode). */
|
|
7714
|
+
checkbox?: boolean;
|
|
7715
|
+
/** The checkbox reads "some": a row inside this one is selected while this one is not. */
|
|
7716
|
+
partlySelected?: boolean;
|
|
6761
7717
|
/** Called when the caret is clicked. */
|
|
6762
7718
|
onExpandToggle?: (event: default_2.MouseEvent) => void;
|
|
6763
7719
|
}
|
|
@@ -6805,7 +7761,7 @@ export declare interface TreeNodeData {
|
|
|
6805
7761
|
/**
|
|
6806
7762
|
* The row's trailing toggles (lock, eye): the caller's own controls. They stay hidden until
|
|
6807
7763
|
* the row is hovered or focused; a control with `aria-pressed="true"`, `aria-checked="true"`
|
|
6808
|
-
* or `data-pinned` stays visible. A click on passive text here (nothing focusable) counts as a
|
|
7764
|
+
* or `data-pinned` or `data-at-rest` stays visible. A click on passive text here (nothing focusable) counts as a
|
|
6809
7765
|
* click on the row. Their focusable controls are out of the Tab order: the keyboard reaches
|
|
6810
7766
|
* them with ArrowRight on a row without children or Alt+ArrowRight on any row (see Tree).
|
|
6811
7767
|
*/
|
|
@@ -6818,6 +7774,9 @@ export declare interface TreeNodeData {
|
|
|
6818
7774
|
/**
|
|
6819
7775
|
* A count drawn before the toggles in the secondary ink, always visible (the toggles hide
|
|
6820
7776
|
* until hover). It joins the row's accessible description, so it is heard as well as seen.
|
|
7777
|
+
* Pass a row's quiet text here (a count, a fill, a filter's outcome): it stays whole until
|
|
7778
|
+
* it would take more than half the row, and while the name or the count is cut short, the
|
|
7779
|
+
* name's tooltip shows both.
|
|
6821
7780
|
*/
|
|
6822
7781
|
count?: default_2.ReactNode;
|
|
6823
7782
|
/**
|
|
@@ -6833,6 +7792,18 @@ export declare interface TreeNodeData {
|
|
|
6833
7792
|
* too.
|
|
6834
7793
|
*/
|
|
6835
7794
|
description?: string;
|
|
7795
|
+
/**
|
|
7796
|
+
* Draw `description` as a second line under the name, in the secondary ink, instead of only
|
|
7797
|
+
* reading it; the row grows from 32 to 44. For a state the reader must see beside a long
|
|
7798
|
+
* name (a filter step's "77 to 26 nodes", "off") where a count would cut the name. Default
|
|
7799
|
+
* false.
|
|
7800
|
+
*/
|
|
7801
|
+
descriptionVisible?: boolean;
|
|
7802
|
+
/**
|
|
7803
|
+
* Whether the item can be picked up and moved (a drag, Alt+ArrowUp / Alt+ArrowDown).
|
|
7804
|
+
* Default true. Where an item may land is `Tree`'s `canDrop`.
|
|
7805
|
+
*/
|
|
7806
|
+
movable?: boolean;
|
|
6836
7807
|
}
|
|
6837
7808
|
|
|
6838
7809
|
/**
|
|
@@ -6857,16 +7828,32 @@ export declare interface TreeProps {
|
|
|
6857
7828
|
onExpandedChange?: (ids: string[]) => void;
|
|
6858
7829
|
/** Allow several selected rows (Shift and Control/Command). Default true. */
|
|
6859
7830
|
multiselect?: boolean;
|
|
7831
|
+
/**
|
|
7832
|
+
* Draw a checkbox on every row, and let a plain click, Enter or Space add a row to the
|
|
7833
|
+
* selection or take it out, with no modifier key: the way to select several rows by touch.
|
|
7834
|
+
* Needs `multiselect`.
|
|
7835
|
+
*/
|
|
7836
|
+
checkboxes?: boolean;
|
|
6860
7837
|
/**
|
|
6861
7838
|
* Called with a new name. Giving it turns on renaming: F2 or a double-click opens an
|
|
6862
7839
|
* InlineRename in place of the name.
|
|
6863
7840
|
*/
|
|
6864
7841
|
onRename?: (id: string, name: string) => void;
|
|
6865
7842
|
/**
|
|
6866
|
-
*
|
|
6867
|
-
*
|
|
6868
|
-
|
|
6869
|
-
|
|
7843
|
+
* The id of the row whose name is being edited (controlled), or null. Lets a caller open the
|
|
7844
|
+
* rename from elsewhere -- a menu's Rename -- or refuse one for a row that cannot be renamed.
|
|
7845
|
+
*/
|
|
7846
|
+
renaming?: string | null;
|
|
7847
|
+
/** Called when a rename opens (F2, a double-click) or closes, with the row's id or null. */
|
|
7848
|
+
onRenamingChange?: (id: string | null) => void;
|
|
7849
|
+
/**
|
|
7850
|
+
* Called when a row is dropped somewhere new, moved from the keyboard, or moved by a row
|
|
7851
|
+
* menu's `moveTo`. Alt+ArrowUp / Alt+ArrowDown move the focused item one place among its
|
|
7852
|
+
* siblings, or into the neighboring folder (its last child going up, its first going down);
|
|
7853
|
+
* Alt+ArrowLeft moves it out of its folder to just after it. `index` counts the new parent's
|
|
7854
|
+
* children with the moved item already removed. Giving it makes rows draggable and turns on
|
|
7855
|
+
* the keyboard move; the tree never moves data itself, focus stays on the moved item once
|
|
7856
|
+
* the caller has moved it, and a live region says where it went (`labels.treeMoved`).
|
|
6870
7857
|
*/
|
|
6871
7858
|
onMove?: (move: TreeMove) => void;
|
|
6872
7859
|
/** Keep an expanded top-level row pinned while its children scroll (not while virtualized). */
|
|
@@ -6882,6 +7869,50 @@ export declare interface TreeProps {
|
|
|
6882
7869
|
* eye, Delete to delete the row.
|
|
6883
7870
|
*/
|
|
6884
7871
|
onRowKeyDown?: (id: string, event: default_2.KeyboardEvent<HTMLDivElement>) => void;
|
|
7872
|
+
/**
|
|
7873
|
+
* Where an item may land. Called with each move a drag or Alt+Arrow would report; a `false`
|
|
7874
|
+
* means no drop there (no drop line, no `onMove`). Pair it with `TreeNodeData.movable` for
|
|
7875
|
+
* items that never move at all.
|
|
7876
|
+
*/
|
|
7877
|
+
canDrop?: (move: TreeMove) => boolean;
|
|
7878
|
+
/**
|
|
7879
|
+
* The row's context menu: its `Menu.Item` rows (see ContextMenu), or null for a row with
|
|
7880
|
+
* none. It opens on a right-click, Shift+F10 or the ContextMenu key, and a touch held still
|
|
7881
|
+
* for half a second, always for the row it happened on. `actions.moveTo` moves the row, so a
|
|
7882
|
+
* menu can offer "Move to folder".
|
|
7883
|
+
*/
|
|
7884
|
+
rowMenu?: (node: TreeNodeData, actions: TreeRowActions) => default_2.ReactNode;
|
|
7885
|
+
/**
|
|
7886
|
+
* Draw a band behind a selected, expanded parent's children (Figma's look). Default true. Pass
|
|
7887
|
+
* false when selecting a parent never selects its children, so the band would read as a
|
|
7888
|
+
* selection: the parent then draws like any selected row and its children stay plain.
|
|
7889
|
+
*/
|
|
7890
|
+
childBand?: boolean;
|
|
7891
|
+
/**
|
|
7892
|
+
* When the selection changes from outside the tree (the caller opened a row from elsewhere),
|
|
7893
|
+
* open the folders around each selected row and scroll the first one into view, so the row
|
|
7894
|
+
* shown is the row marked. A folder the reader closes afterwards stays closed. Default false.
|
|
7895
|
+
*/
|
|
7896
|
+
revealSelected?: boolean;
|
|
7897
|
+
/**
|
|
7898
|
+
* The row in the Tab order while no row is focused or selected, so Tab into the tree lands
|
|
7899
|
+
* there. Default: the first row.
|
|
7900
|
+
*/
|
|
7901
|
+
restingId?: string;
|
|
7902
|
+
}
|
|
7903
|
+
|
|
7904
|
+
/**
|
|
7905
|
+
* What a row menu can ask the tree to do for its row (see `TreeProps.rowMenu`).
|
|
7906
|
+
*/
|
|
7907
|
+
export declare interface TreeRowActions {
|
|
7908
|
+
/**
|
|
7909
|
+
* Move the row into a folder (an item with a `children` array), or to the top level with
|
|
7910
|
+
* `null`, at `index` among that folder's children (default 0, the first). The tree checks the
|
|
7911
|
+
* move as it checks a drop (`movable`, `canDrop`, never into the row's own subtree), reports it
|
|
7912
|
+
* through `onMove`, opens the folder, keeps focus on the row and announces where it went.
|
|
7913
|
+
* Returns false, doing nothing, for a move it refuses.
|
|
7914
|
+
*/
|
|
7915
|
+
moveTo: (parentId: string | null, index?: number) => boolean;
|
|
6885
7916
|
}
|
|
6886
7917
|
|
|
6887
7918
|
/**
|
|
@@ -6915,7 +7946,7 @@ export declare function UiGlyph({ name, size }: UiGlyphProps): default_2.JSX.Ele
|
|
|
6915
7946
|
* Shared UI glyphs: the chevrons, the doors and the status marks the row types
|
|
6916
7947
|
* draw outside a field's slot.
|
|
6917
7948
|
*/
|
|
6918
|
-
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";
|
|
7949
|
+
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" | "upload";
|
|
6919
7950
|
|
|
6920
7951
|
/**
|
|
6921
7952
|
* Props for the UiGlyph component.
|
|
@@ -6968,6 +7999,35 @@ export declare function useCollator(options?: Intl.CollatorOptions): Intl.Collat
|
|
|
6968
7999
|
*/
|
|
6969
8000
|
export declare function useDirection(): Direction;
|
|
6970
8001
|
|
|
8002
|
+
/**
|
|
8003
|
+
* Takes files dropped on an element, or anywhere in the window.
|
|
8004
|
+
*
|
|
8005
|
+
* A drop on a nested target is taken by the innermost one: the hook marks the drop handled
|
|
8006
|
+
* (`preventDefault`) and every outer hook, including a `"window"` one, leaves a handled drop alone.
|
|
8007
|
+
* A drop with no accepted file still stops the browser from opening the file in the tab.
|
|
8008
|
+
* @param target - the element that takes the drop, or `"window"` for the whole page.
|
|
8009
|
+
* @param onFiles - called with the accepted files of each drop (never empty).
|
|
8010
|
+
* @param options - which files, and whether dropping is off.
|
|
8011
|
+
* @returns whether files are being dragged over the target.
|
|
8012
|
+
* @example
|
|
8013
|
+
* ```tsx
|
|
8014
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
8015
|
+
* const { over } = useFileDrop(ref, (files) => open(files), { accept: ".csv" });
|
|
8016
|
+
* <div ref={ref} data-over={over || undefined}>...</div>
|
|
8017
|
+
* ```
|
|
8018
|
+
*/
|
|
8019
|
+
export declare function useFileDrop(target: RefObject<HTMLElement | null> | "window", onFiles: (files: File[]) => void, options?: UseFileDropOptions): FileDropState;
|
|
8020
|
+
|
|
8021
|
+
/** Options for `useFileDrop`. */
|
|
8022
|
+
export declare interface UseFileDropOptions {
|
|
8023
|
+
/** The files taken, in the `accept` attribute's form (`.csv,text/*`). Every file when unset. */
|
|
8024
|
+
accept?: string;
|
|
8025
|
+
/** Whether only the first accepted file of a drop is taken. @default false (every file) */
|
|
8026
|
+
single?: boolean;
|
|
8027
|
+
/** Whether dropping is off. The browser then handles a drop as it would without the hook. */
|
|
8028
|
+
disabled?: boolean;
|
|
8029
|
+
}
|
|
8030
|
+
|
|
6971
8031
|
/**
|
|
6972
8032
|
* Reads this library's strings.
|
|
6973
8033
|
*
|
|
@@ -7081,7 +8141,8 @@ export declare function useToast(): ToastApi;
|
|
|
7081
8141
|
*
|
|
7082
8142
|
* In a number field the value becomes a 20px pill (`--cm-bg`, 1px `--cm-border`, radius 5) after
|
|
7083
8143
|
* the field's 24px glyph slot; hovering the pill shows the variable's name and value, and
|
|
7084
|
-
* hovering the field shows a 16px Detach button at its end.
|
|
8144
|
+
* hovering the field shows a 16px Detach button at its end. The tooltip opens above the field, so
|
|
8145
|
+
* a line under it (the values it reads, a message) stays in view. With `swatch` it is the bound fill
|
|
7085
8146
|
* row: one 156 x 24 button with a 14px chit and the name, which gains a 24px Detach button on
|
|
7086
8147
|
* hover. `kind="property"` draws the component-property chip.
|
|
7087
8148
|
*
|
|
@@ -7103,6 +8164,11 @@ export declare interface VariablePillProps {
|
|
|
7103
8164
|
name: string;
|
|
7104
8165
|
/** The variable's resolved value, shown in the pill and in its tooltip ("4"). */
|
|
7105
8166
|
value?: string;
|
|
8167
|
+
/**
|
|
8168
|
+
* The tooltip's words, when they are not the name and the value: a name set off by marks in
|
|
8169
|
+
* the pill reads without them here. Lines break at "\n". @default the name, then the value
|
|
8170
|
+
*/
|
|
8171
|
+
tooltip?: string;
|
|
7106
8172
|
/**
|
|
7107
8173
|
* Called by the Detach (broken link) button, which appears while the field is hovered or
|
|
7108
8174
|
* focused. Without it there is no Detach button.
|
|
@@ -7115,17 +8181,30 @@ export declare interface VariablePillProps {
|
|
|
7115
8181
|
* a 14px chit and the variable's name.
|
|
7116
8182
|
*/
|
|
7117
8183
|
swatch?: string;
|
|
8184
|
+
/**
|
|
8185
|
+
* The swatch's width in pixels, so a bound color can show its colors at rest: a ramp as a
|
|
8186
|
+
* strip, or several category colors side by side. @default 14, a square chit
|
|
8187
|
+
*/
|
|
8188
|
+
swatchWidth?: number;
|
|
7118
8189
|
/**
|
|
7119
8190
|
* `"variable"` (default) or `"property"`: a layer property bound to a component property,
|
|
7120
8191
|
* drawn as a chip on the component tint.
|
|
7121
8192
|
*/
|
|
7122
8193
|
kind?: "variable" | "property";
|
|
7123
|
-
/**
|
|
8194
|
+
/**
|
|
8195
|
+
* A 24px leading slot for the bound number field: the field's glyph or letter. Left out, the
|
|
8196
|
+
* pill starts at the field's edge.
|
|
8197
|
+
*/
|
|
7124
8198
|
glyph?: default_2.ReactNode;
|
|
7125
8199
|
/** The field's width. @default 88 for a number field, 156 for a fill row */
|
|
7126
8200
|
width?: number | string;
|
|
7127
8201
|
/** The Detach button's accessible name. @default "Detach variable" */
|
|
7128
8202
|
detachLabel?: string;
|
|
8203
|
+
/**
|
|
8204
|
+
* The pill's (or the fill row's) accessible name, when the field it sits in is not named by
|
|
8205
|
+
* anything else: "Node size: Degree rank, 1 to 3". Left out, it is the variable and its value.
|
|
8206
|
+
*/
|
|
8207
|
+
"aria-label"?: string;
|
|
7129
8208
|
/**
|
|
7130
8209
|
* Makes the rest of a bound number field editable, as in Figma: typing after the pill and
|
|
7131
8210
|
* pressing Enter (or leaving the field) reports the text, and the caller replaces the binding
|
|
@@ -7135,6 +8214,13 @@ export declare interface VariablePillProps {
|
|
|
7135
8214
|
onValueCommit?: ChangeHandler<string>;
|
|
7136
8215
|
/** The accessible name of the input after the pill. @default "Value" */
|
|
7137
8216
|
valueLabel?: string;
|
|
8217
|
+
/**
|
|
8218
|
+
* `"component"` draws the name in the component tone (`--cm-text-component`, weight 600), so
|
|
8219
|
+
* a name that is not a variable's ("from each layer") stands apart. @default the field's ink
|
|
8220
|
+
*/
|
|
8221
|
+
tone?: "component";
|
|
8222
|
+
/** The id of an element that describes the pill (or the fill row) further. */
|
|
8223
|
+
"aria-describedby"?: string;
|
|
7138
8224
|
/** Extra class on the outer element. */
|
|
7139
8225
|
className?: string;
|
|
7140
8226
|
/** Extra style on the outer element. */
|