figma-kit 1.0.0-beta.10 → 1.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ClassProp } from 'class-variance-authority/types';
2
2
  import { CSSProperties } from 'react';
3
3
  import { default as default_2 } from 'react';
4
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
4
5
  import * as RadixAlertDialog from '@radix-ui/react-alert-dialog';
5
6
  import * as RadixCollapsible from '@radix-ui/react-collapsible';
6
7
  import * as RadixDialog from '@radix-ui/react-dialog';
@@ -55,12 +56,24 @@ declare namespace AlertDialog {
55
56
  }
56
57
  export { AlertDialog }
57
58
 
59
+ declare const Alpha: (props: AlphaProps) => JSX_2.Element;
60
+
61
+ declare type AlphaProps = React.ComponentPropsWithoutRef<'div'>;
62
+
58
63
  declare const Anchor: default_2.ForwardRefExoticComponent<RadixPopover.PopoverAnchorProps & default_2.RefAttributes<HTMLDivElement>>;
59
64
 
60
65
  declare type AnchorProps = RadixPopover.PopoverAnchorProps;
61
66
 
67
+ declare const Area: (props: AreaProps) => JSX_2.Element;
68
+
69
+ declare type AreaProps = {
70
+ size?: number;
71
+ };
72
+
62
73
  declare const Arrow: default_2.ForwardRefExoticComponent<RadixSelect.SelectArrowProps & default_2.RefAttributes<SVGSVGElement>>;
63
74
 
75
+ export declare function blendWithWhite(color: RGBA): RGBA;
76
+
64
77
  export declare const Button: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
65
78
  variant?: "text" | "primary" | "secondary" | "inverse" | "destructive" | "success" | null | undefined;
66
79
  size?: "small" | "medium" | null | undefined;
@@ -104,16 +117,56 @@ declare type CloseProps_2 = Omit<RadixDialog.DialogCloseProps, 'asChild'>;
104
117
 
105
118
  declare namespace Collapsible {
106
119
  export {
107
- RootProps_11 as RootProps,
120
+ RootProps_12 as RootProps,
108
121
  ContentProps_8 as ContentProps,
109
122
  TriggerProps_8 as TriggerProps,
110
- Root_12 as Root,
123
+ Root_13 as Root,
111
124
  Content_8 as Content,
112
125
  Trigger_8 as Trigger
113
126
  }
114
127
  }
115
128
  export { Collapsible }
116
129
 
130
+ declare type ColorChangeParams = {
131
+ mode: 'hsv';
132
+ value: HSVA;
133
+ } | {
134
+ mode: 'hsl';
135
+ value: HSLA;
136
+ } | {
137
+ mode: 'rgb';
138
+ value: RGBA;
139
+ };
140
+
141
+ declare type ColorModel = 'hex' | 'rgb' | 'hsl' | 'hsv';
142
+
143
+ declare namespace ColorPicker {
144
+ export {
145
+ RootProps_11 as RootProps,
146
+ ColorModel,
147
+ ColorSpace,
148
+ ColorsByModel,
149
+ Root_12 as Root,
150
+ useColorPickerContext,
151
+ HueProps,
152
+ Hue,
153
+ AlphaProps,
154
+ Alpha,
155
+ Area,
156
+ Input_3 as Input
157
+ }
158
+ }
159
+ export { ColorPicker }
160
+
161
+ declare type ColorsByModel = {
162
+ hex: HEX;
163
+ rgb: RGBA;
164
+ hsl: HSLA;
165
+ hsv: HSVA;
166
+ };
167
+
168
+ declare type ColorSpace = 'srgb' | 'display-p3';
169
+
117
170
  declare const Content: default_2.ForwardRefExoticComponent<RadixTabs.TabsContentProps & default_2.RefAttributes<HTMLDivElement>>;
118
171
 
119
172
  declare const content: (props?: ({
@@ -326,8 +379,10 @@ declare const Header: default_2.ForwardRefExoticComponent<Omit<default_2.Detaile
326
379
 
327
380
  declare type HeaderProps = default_2.ComponentPropsWithoutRef<'header'>;
328
381
 
382
+ declare type HEX = string;
383
+
329
384
  declare const Hex: default_2.ForwardRefExoticComponent<Omit<InputProps, "onChange" | "value"> & {
330
- /** Color in Figma's RGBA format */
385
+ /** Color in Figma's normalized RGBA format */
331
386
  value: RGBA;
332
387
  /** Callback to call upon submission. */
333
388
  onChange: (value: RGBA) => void;
@@ -340,7 +395,7 @@ declare const Hex: default_2.ForwardRefExoticComponent<Omit<InputProps, "onChang
340
395
  } & default_2.RefAttributes<HTMLInputElement>>;
341
396
 
342
397
  declare type HexProps = Omit<InputProps, 'value' | 'onChange'> & {
343
- /** Color in Figma's RGBA format */
398
+ /** Color in Figma's normalized RGBA format */
344
399
  value: RGBA;
345
400
  /** Callback to call upon submission. */
346
401
  onChange: (value: RGBA) => void;
@@ -352,6 +407,24 @@ declare type HexProps = Omit<InputProps, 'value' | 'onChange'> & {
352
407
  ignoreAlpha?: boolean;
353
408
  };
354
409
 
410
+ declare type HSLA = {
411
+ h: number;
412
+ s: number;
413
+ l: number;
414
+ a: number;
415
+ };
416
+
417
+ declare type HSVA = {
418
+ h: number;
419
+ s: number;
420
+ v: number;
421
+ a: number;
422
+ };
423
+
424
+ declare const Hue: (props: HueProps) => JSX_2.Element;
425
+
426
+ declare type HueProps = React.ComponentPropsWithoutRef<'div'>;
427
+
355
428
  export declare const IconButton: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
356
429
  size?: "small" | "medium" | null | undefined;
357
430
  activeAppearance?: "subtle" | "solid" | null | undefined;
@@ -369,10 +442,17 @@ declare const Input_2: default_2.ForwardRefExoticComponent<Omit<default_2.Detail
369
442
  indeterminate?: boolean | undefined;
370
443
  } & default_2.RefAttributes<HTMLInputElement>>;
371
444
 
445
+ declare const Input_3: (props: InputProps_2) => JSX_2.Element;
446
+
372
447
  declare type InputProps = default_2.ComponentPropsWithoutRef<'input'> & {
373
448
  selectOnClick?: boolean;
374
449
  };
375
450
 
451
+ declare type InputProps_2 = {
452
+ className?: string;
453
+ style?: CSSProperties;
454
+ };
455
+
376
456
  declare const Item: default_2.ForwardRefExoticComponent<RadixToggleGroup.ToggleGroupItemProps & default_2.RefAttributes<HTMLButtonElement>>;
377
457
 
378
458
  declare const Item_2: default_2.ForwardRefExoticComponent<RadixRadioGroup.RadioGroupItemProps & default_2.RefAttributes<HTMLButtonElement>>;
@@ -518,6 +598,8 @@ declare type OverlayProps = Omit<RadixDialog.DialogOverlayProps, 'asChild'>;
518
598
 
519
599
  declare type OverlayProps_2 = Omit<RadixAlertDialog.AlertDialogOverlayProps, 'asChild'>;
520
600
 
601
+ declare type P3String = `color(display-p3 ${number} ${number} ${number}${` / ${number}` | ''})`;
602
+
521
603
  export declare const Paragraph: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & VariantProps<(props?: ({
522
604
  size?: "small" | "medium" | "large" | null | undefined;
523
605
  weight?: "strong" | "default" | null | undefined;
@@ -598,6 +680,12 @@ declare type RGBA = {
598
680
  a: number;
599
681
  };
600
682
 
683
+ export declare function rgbaToCssString(color: RGBA): RGBString;
684
+
685
+ export declare function rgbaToP3String(color: RGBA): P3String;
686
+
687
+ declare type RGBString = `rgb(${number} ${number} ${number}${` / ${number}` | ''})`;
688
+
601
689
  declare const Root: default_2.ForwardRefExoticComponent<RadixTabs.TabsProps & default_2.RefAttributes<HTMLDivElement>>;
602
690
 
603
691
  declare const Root_10: default_2.FC<RadixAlertDialog.AlertDialogProps>;
@@ -606,7 +694,9 @@ declare const Root_11: default_2.ForwardRefExoticComponent<Omit<default_2.Detail
606
694
  disabled?: boolean | undefined;
607
695
  } & default_2.RefAttributes<HTMLLabelElement>>;
608
696
 
609
- declare const Root_12: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
697
+ declare const Root_12: (props: RootProps_11) => JSX_2.Element;
698
+
699
+ declare const Root_13: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
610
700
 
611
701
  declare const Root_2: default_2.ForwardRefExoticComponent<Omit<RadixToggleGroup.ToggleGroupSingleProps, "type"> & {
612
702
  fullWidth?: boolean | undefined;
@@ -632,7 +722,39 @@ declare type RootProps_10 = default_2.ComponentPropsWithoutRef<'label'> & {
632
722
  disabled?: boolean;
633
723
  };
634
724
 
635
- declare type RootProps_11 = RadixCollapsible.CollapsibleProps;
725
+ declare type RootProps_11 = {
726
+ /**
727
+ * Color space of the picker. Should match the color profile of the current Figma document.
728
+ * see: https://www.figma.com/plugin-docs/api/DocumentNode/#documentcolorprofile
729
+ * */
730
+ colorSpace: ColorSpace;
731
+ /**
732
+ * Default color model for the picker (uncontrolled mode). Determines the area box type and the initially displayed color input.
733
+ * */
734
+ defaultActiveModel?: ColorModel;
735
+ /**
736
+ * Color model for the picker (controlled mode). Determines the area box type and the initially displayed color input.
737
+ * When specified, you also need to specify 'onActiveModelChange' callback to handle changing the models.
738
+ * @default 'hex' or first item in 'models' if specified.
739
+ * */
740
+ activeModel?: ColorModel;
741
+ /** Callback to call upon model change */
742
+ onActiveModelChange?: (model: ColorModel) => void;
743
+ /**
744
+ * Color models the picker needs to display.
745
+ * @default ['hex', 'rgb', 'hsl', 'hsv']
746
+ * */
747
+ models?: ColorModel[];
748
+ /** Default color in Figma's normalized RGBA format (uncontrolled mode) */
749
+ defaultColor?: RGBA;
750
+ /** Color in Figma's normalized RGBA format (controlled mode) */
751
+ color?: RGBA;
752
+ /** Callback to call upon color change */
753
+ onColorChange?: (color: RGBA) => void;
754
+ children: React.ReactNode;
755
+ };
756
+
757
+ declare type RootProps_12 = RadixCollapsible.CollapsibleProps;
636
758
 
637
759
  declare type RootProps_2 = Omit<RadixToggleGroup.ToggleGroupSingleProps, 'type'> & {
638
760
  fullWidth?: boolean;
@@ -855,6 +977,17 @@ declare type TriggerProps_7 = Omit<RadixAlertDialog.AlertDialogTriggerProps, 'as
855
977
 
856
978
  declare type TriggerProps_8 = RadixCollapsible.CollapsibleTriggerProps;
857
979
 
980
+ declare const useColorPickerContext: (consumerName: string) => {
981
+ colorSpace: ColorSpace;
982
+ models: ColorModel[];
983
+ activeModel: ColorModel;
984
+ onActiveModelChange: (model: ColorModel) => void;
985
+ color: RGBA;
986
+ onColorChange: (params: ColorChangeParams) => void;
987
+ colorsByModel: ColorsByModel;
988
+ hue: number;
989
+ };
990
+
858
991
  declare namespace ValueField {
859
992
  export {
860
993
  Multi,