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

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?: ({
@@ -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,24 @@ declare type HexProps = Omit<InputProps, 'value' | 'onChange'> & {
352
405
  ignoreAlpha?: boolean;
353
406
  };
354
407
 
408
+ declare type HSLA = {
409
+ h: number;
410
+ s: number;
411
+ l: number;
412
+ a: number;
413
+ };
414
+
415
+ declare type HSVA = {
416
+ h: number;
417
+ s: number;
418
+ v: number;
419
+ a: number;
420
+ };
421
+
422
+ declare const Hue: (props: HueProps) => JSX_2.Element;
423
+
424
+ declare type HueProps = React.ComponentPropsWithoutRef<'div'>;
425
+
355
426
  export declare const IconButton: default_2.ForwardRefExoticComponent<Omit<default_2.DetailedHTMLProps<default_2.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
356
427
  size?: "small" | "medium" | null | undefined;
357
428
  activeAppearance?: "subtle" | "solid" | null | undefined;
@@ -369,10 +440,17 @@ declare const Input_2: default_2.ForwardRefExoticComponent<Omit<default_2.Detail
369
440
  indeterminate?: boolean | undefined;
370
441
  } & default_2.RefAttributes<HTMLInputElement>>;
371
442
 
443
+ declare const Input_3: (props: InputProps_2) => JSX_2.Element;
444
+
372
445
  declare type InputProps = default_2.ComponentPropsWithoutRef<'input'> & {
373
446
  selectOnClick?: boolean;
374
447
  };
375
448
 
449
+ declare type InputProps_2 = {
450
+ className?: string;
451
+ style?: CSSProperties;
452
+ };
453
+
376
454
  declare const Item: default_2.ForwardRefExoticComponent<RadixToggleGroup.ToggleGroupItemProps & default_2.RefAttributes<HTMLButtonElement>>;
377
455
 
378
456
  declare const Item_2: default_2.ForwardRefExoticComponent<RadixRadioGroup.RadioGroupItemProps & default_2.RefAttributes<HTMLButtonElement>>;
@@ -606,7 +684,9 @@ declare const Root_11: default_2.ForwardRefExoticComponent<Omit<default_2.Detail
606
684
  disabled?: boolean | undefined;
607
685
  } & default_2.RefAttributes<HTMLLabelElement>>;
608
686
 
609
- declare const Root_12: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
687
+ declare const Root_12: (props: RootProps_11) => JSX_2.Element;
688
+
689
+ declare const Root_13: default_2.ForwardRefExoticComponent<RadixCollapsible.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
610
690
 
611
691
  declare const Root_2: default_2.ForwardRefExoticComponent<Omit<RadixToggleGroup.ToggleGroupSingleProps, "type"> & {
612
692
  fullWidth?: boolean | undefined;
@@ -632,7 +712,39 @@ declare type RootProps_10 = default_2.ComponentPropsWithoutRef<'label'> & {
632
712
  disabled?: boolean;
633
713
  };
634
714
 
635
- declare type RootProps_11 = RadixCollapsible.CollapsibleProps;
715
+ declare type RootProps_11 = {
716
+ /**
717
+ * Color space of the picker. Should match the color profile of the current Figma document.
718
+ * see: https://www.figma.com/plugin-docs/api/DocumentNode/#documentcolorprofile
719
+ * */
720
+ colorSpace: ColorSpace;
721
+ /**
722
+ * Default color model for the picker (uncontrolled mode). Determines the area box type and the initially displayed color input.
723
+ * */
724
+ defaultActiveModel?: ColorModel;
725
+ /**
726
+ * Color model for the picker (controlled mode). Determines the area box type and the initially displayed color input.
727
+ * When specified, you also need to specify 'onActiveModelChange' callback to handle changing the models.
728
+ * @default 'hex' or first item in 'models' if specified.
729
+ * */
730
+ activeModel?: ColorModel;
731
+ /** Callback to call upon model change */
732
+ onActiveModelChange?: (model: ColorModel) => void;
733
+ /**
734
+ * Color models the picker needs to display.
735
+ * @default ['hex', 'rgb', 'hsl', 'hsv']
736
+ * */
737
+ models?: ColorModel[];
738
+ /** Default color in Figma's normalized RGBA format (uncontrolled mode) */
739
+ defaultColor?: RGBA;
740
+ /** Color in Figma's normalized RGBA format (controlled mode) */
741
+ color?: RGBA;
742
+ /** Callback to call upon color change */
743
+ onColorChange?: (color: RGBA) => void;
744
+ children: React.ReactNode;
745
+ };
746
+
747
+ declare type RootProps_12 = RadixCollapsible.CollapsibleProps;
636
748
 
637
749
  declare type RootProps_2 = Omit<RadixToggleGroup.ToggleGroupSingleProps, 'type'> & {
638
750
  fullWidth?: boolean;
@@ -855,6 +967,17 @@ declare type TriggerProps_7 = Omit<RadixAlertDialog.AlertDialogTriggerProps, 'as
855
967
 
856
968
  declare type TriggerProps_8 = RadixCollapsible.CollapsibleTriggerProps;
857
969
 
970
+ declare const useColorPickerContext: (consumerName: string) => {
971
+ colorSpace: ColorSpace;
972
+ models: ColorModel[];
973
+ activeModel: ColorModel;
974
+ onActiveModelChange: (model: ColorModel) => void;
975
+ color: RGBA;
976
+ onColorChange: (params: ColorChangeParams) => void;
977
+ colorsByModel: ColorsByModel;
978
+ hue: number;
979
+ };
980
+
858
981
  declare namespace ValueField {
859
982
  export {
860
983
  Multi,