figma-kit 1.0.0-beta.2 → 1.0.0-beta.22

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,10 +56,20 @@ 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
 
64
75
  export declare const Button: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
@@ -104,16 +115,56 @@ declare type CloseProps_2 = Omit<RadixDialog.DialogCloseProps, 'asChild'>;
104
115
 
105
116
  declare namespace Collapsible {
106
117
  export {
107
- RootProps_11 as RootProps,
118
+ RootProps_12 as RootProps,
108
119
  ContentProps_8 as ContentProps,
109
120
  TriggerProps_8 as TriggerProps,
110
- Root_12 as Root,
121
+ Root_13 as Root,
111
122
  Content_8 as Content,
112
123
  Trigger_8 as Trigger
113
124
  }
114
125
  }
115
126
  export { Collapsible }
116
127
 
128
+ declare type ColorChangeParams = {
129
+ mode: 'hsv';
130
+ value: HSVA;
131
+ } | {
132
+ mode: 'hsl';
133
+ value: HSLA;
134
+ } | {
135
+ mode: 'rgb';
136
+ value: RGBA;
137
+ };
138
+
139
+ declare type ColorModel = 'hex' | 'rgb' | 'hsl' | 'hsv';
140
+
141
+ declare namespace ColorPicker {
142
+ export {
143
+ RootProps_11 as RootProps,
144
+ ColorModel,
145
+ ColorSpace,
146
+ ColorsByModel,
147
+ Root_12 as Root,
148
+ useColorPickerContext,
149
+ HueProps,
150
+ Hue,
151
+ AlphaProps,
152
+ Alpha,
153
+ Area,
154
+ Input_3 as Input
155
+ }
156
+ }
157
+ export { ColorPicker }
158
+
159
+ declare type ColorsByModel = {
160
+ hex: HEX;
161
+ rgb: RGBA;
162
+ hsl: HSLA;
163
+ hsv: HSVA;
164
+ };
165
+
166
+ declare type ColorSpace = 'srgb' | 'display-p3';
167
+
117
168
  declare const Content: default_2.ForwardRefExoticComponent<RadixTabs.TabsContentProps & default_2.RefAttributes<HTMLDivElement>>;
118
169
 
119
170
  declare const content: (props?: ({
@@ -305,9 +356,9 @@ export declare const Flex: default_2.ForwardRefExoticComponent<Omit<default_2.De
305
356
  align?: "center" | "end" | "start" | "baseline" | "stretch" | null | undefined;
306
357
  justify?: "center" | "end" | "start" | "between" | null | undefined;
307
358
  wrap?: "wrap" | "nowrap" | "wrapReverse" | null | undefined;
308
- gap?: "px" | "0" | "1" | "2" | "3" | "6" | "2_5" | "3_5" | "4" | "5" | "7" | "8" | "9" | "10" | "0_5" | "1_5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
309
- columnGap?: "px" | "0" | "1" | "2" | "3" | "6" | "2_5" | "3_5" | "4" | "5" | "7" | "8" | "9" | "10" | "0_5" | "1_5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
310
- rowGap?: "px" | "0" | "1" | "2" | "3" | "6" | "2_5" | "3_5" | "4" | "5" | "7" | "8" | "9" | "10" | "0_5" | "1_5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
359
+ gap?: "px" | "0" | "1" | "2" | "3" | "6" | "4" | "5" | "7" | "8" | "9" | "10" | "0.5" | "1.5" | "2.5" | "3.5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
360
+ columnGap?: "px" | "0" | "1" | "2" | "3" | "6" | "4" | "5" | "7" | "8" | "9" | "10" | "0.5" | "1.5" | "2.5" | "3.5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
361
+ rowGap?: "px" | "0" | "1" | "2" | "3" | "6" | "4" | "5" | "7" | "8" | "9" | "10" | "0.5" | "1.5" | "2.5" | "3.5" | "11" | "12" | "13" | "14" | "15" | "16" | null | undefined;
311
362
  } & ClassProp) | undefined) => string> & default_2.RefAttributes<HTMLDivElement>>;
312
363
 
313
364
  declare const Group: default_2.ForwardRefExoticComponent<RadixSelect.SelectGroupProps & default_2.RefAttributes<HTMLDivElement>>;
@@ -326,8 +377,10 @@ declare const Header: default_2.ForwardRefExoticComponent<Omit<default_2.Detaile
326
377
 
327
378
  declare type HeaderProps = default_2.ComponentPropsWithoutRef<'header'>;
328
379
 
380
+ declare type HEX = string;
381
+
329
382
  declare const Hex: default_2.ForwardRefExoticComponent<Omit<InputProps, "onChange" | "value"> & {
330
- /** Color in Figma's RGBA format */
383
+ /** Color in Figma's normalized RGBA format */
331
384
  value: RGBA;
332
385
  /** Callback to call upon submission. */
333
386
  onChange: (value: RGBA) => void;
@@ -340,7 +393,7 @@ declare const Hex: default_2.ForwardRefExoticComponent<Omit<InputProps, "onChang
340
393
  } & default_2.RefAttributes<HTMLInputElement>>;
341
394
 
342
395
  declare type HexProps = Omit<InputProps, 'value' | 'onChange'> & {
343
- /** Color in Figma's RGBA format */
396
+ /** Color in Figma's normalized RGBA format */
344
397
  value: RGBA;
345
398
  /** Callback to call upon submission. */
346
399
  onChange: (value: RGBA) => void;
@@ -352,6 +405,26 @@ declare type HexProps = Omit<InputProps, 'value' | 'onChange'> & {
352
405
  ignoreAlpha?: boolean;
353
406
  };
354
407
 
408
+ declare type HSL = {
409
+ h: number;
410
+ s: number;
411
+ l: number;
412
+ };
413
+
414
+ declare type HSLA = WithAlpha<HSL>;
415
+
416
+ declare type HSV = {
417
+ h: number;
418
+ s: number;
419
+ v: number;
420
+ };
421
+
422
+ declare type HSVA = WithAlpha<HSV>;
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>>;
@@ -591,13 +671,14 @@ declare type RadioItemProps = RadixMenu.DropdownMenuRadioItemProps;
591
671
 
592
672
  declare type RadioItemProps_2 = RadixMenu_2.ContextMenuRadioItemProps;
593
673
 
594
- declare type RGBA = {
674
+ declare type RGB = {
595
675
  r: number;
596
676
  g: number;
597
677
  b: number;
598
- a: number;
599
678
  };
600
679
 
680
+ declare type RGBA = WithAlpha<RGB>;
681
+
601
682
  declare const Root: default_2.ForwardRefExoticComponent<RadixTabs.TabsProps & default_2.RefAttributes<HTMLDivElement>>;
602
683
 
603
684
  declare const Root_10: default_2.FC<RadixAlertDialog.AlertDialogProps>;
@@ -606,7 +687,9 @@ declare const Root_11: default_2.ForwardRefExoticComponent<Omit<default_2.Detail
606
687
  disabled?: boolean | undefined;
607
688
  } & default_2.RefAttributes<HTMLLabelElement>>;
608
689
 
609
- declare const Root_12: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
690
+ declare const Root_12: (props: RootProps_11) => JSX_2.Element;
691
+
692
+ declare const Root_13: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
610
693
 
611
694
  declare const Root_2: default_2.ForwardRefExoticComponent<Omit<RadixToggleGroup.ToggleGroupSingleProps, "type"> & {
612
695
  fullWidth?: boolean | undefined;
@@ -632,7 +715,39 @@ declare type RootProps_10 = default_2.ComponentPropsWithoutRef<'label'> & {
632
715
  disabled?: boolean;
633
716
  };
634
717
 
635
- declare type RootProps_11 = RadixCollapsible.CollapsibleProps;
718
+ declare type RootProps_11 = {
719
+ /**
720
+ * Color space of the picker. Should match the color profile of the current Figma document.
721
+ * see: https://www.figma.com/plugin-docs/api/DocumentNode/#documentcolorprofile
722
+ * */
723
+ colorSpace: ColorSpace;
724
+ /**
725
+ * Default color model for the picker (uncontrolled mode). Determines the area box type and the initially displayed color input.
726
+ * */
727
+ defaultActiveModel?: ColorModel;
728
+ /**
729
+ * Color model for the picker (controlled mode). Determines the area box type and the initially displayed color input.
730
+ * When specified, you also need to specify 'onActiveModelChange' callback to handle changing the models.
731
+ * @default 'hex' or first item in 'models' if specified.
732
+ * */
733
+ activeModel?: ColorModel;
734
+ /** Callback to call upon model change */
735
+ onActiveModelChange?: (model: ColorModel) => void;
736
+ /**
737
+ * Color models the picker needs to display.
738
+ * @default ['hex', 'rgb', 'hsl', 'hsv']
739
+ * */
740
+ models?: ColorModel[];
741
+ /** Default color in Figma's normalized RGBA format (uncontrolled mode) */
742
+ defaultColor?: RGBA;
743
+ /** Color in Figma's normalized RGBA format (controlled mode) */
744
+ color?: RGBA;
745
+ /** Callback to call upon color change */
746
+ onColorChange?: (color: RGBA) => void;
747
+ children: React.ReactNode;
748
+ };
749
+
750
+ declare type RootProps_12 = RadixCollapsible.CollapsibleProps;
636
751
 
637
752
  declare type RootProps_2 = Omit<RadixToggleGroup.ToggleGroupSingleProps, 'type'> & {
638
753
  fullWidth?: boolean;
@@ -855,6 +970,17 @@ declare type TriggerProps_7 = Omit<RadixAlertDialog.AlertDialogTriggerProps, 'as
855
970
 
856
971
  declare type TriggerProps_8 = RadixCollapsible.CollapsibleTriggerProps;
857
972
 
973
+ declare const useColorPickerContext: (consumerName: string) => {
974
+ colorSpace: ColorSpace;
975
+ models: ColorModel[];
976
+ activeModel: ColorModel;
977
+ onActiveModelChange: (model: ColorModel) => void;
978
+ color: RGBA;
979
+ onColorChange: (params: ColorChangeParams) => void;
980
+ colorsByModel: ColorsByModel;
981
+ hue: number;
982
+ };
983
+
858
984
  declare namespace ValueField {
859
985
  export {
860
986
  Multi,
@@ -871,4 +997,8 @@ declare namespace ValueField {
871
997
  }
872
998
  export { ValueField }
873
999
 
1000
+ declare type WithAlpha<T> = T & {
1001
+ a: number;
1002
+ };
1003
+
874
1004
  export { }