figma-kit 1.0.0-beta.3 → 1.0.0-beta.31

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.
Files changed (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -25
  3. package/dist/components/alert-dialog/alert-dialog.d.ts +31 -0
  4. package/dist/components/alert-dialog/index.d.ts +1 -0
  5. package/dist/components/button/button.d.ts +15 -0
  6. package/dist/components/button/index.d.ts +1 -0
  7. package/dist/components/checkbox/checkbox.d.ts +12 -0
  8. package/dist/components/checkbox/index.d.ts +1 -0
  9. package/dist/components/collapsible/collapsible.d.ts +10 -0
  10. package/dist/components/collapsible/index.d.ts +1 -0
  11. package/dist/components/color-picker/color-picker-alpha.d.ts +4 -0
  12. package/dist/components/color-picker/color-picker-area.d.ts +5 -0
  13. package/dist/components/color-picker/color-picker-hue.d.ts +4 -0
  14. package/dist/components/color-picker/color-picker-input.d.ts +7 -0
  15. package/dist/components/color-picker/color-picker.d.ts +63 -0
  16. package/dist/components/color-picker/index.d.ts +5 -0
  17. package/dist/components/combobox/combobox.d.ts +51 -0
  18. package/dist/components/combobox/index.d.ts +1 -0
  19. package/dist/components/context-menu/context-menu.d.ts +36 -0
  20. package/dist/components/context-menu/index.d.ts +1 -0
  21. package/dist/components/dialog/dialog.d.ts +25 -0
  22. package/dist/components/dialog/index.d.ts +1 -0
  23. package/dist/components/dialog.base/dialog.base.d.ts +15 -0
  24. package/dist/components/dialog.base/index.d.ts +1 -0
  25. package/dist/components/dropdown-menu/dropdown-menu.d.ts +36 -0
  26. package/dist/components/dropdown-menu/index.d.ts +1 -0
  27. package/dist/components/flex/flex.d.ts +23 -0
  28. package/dist/components/flex/index.d.ts +1 -0
  29. package/dist/components/icon/icon.d.ts +16 -0
  30. package/dist/components/icon/index.d.ts +1 -0
  31. package/dist/components/icon-button/icon-button.d.ts +21 -0
  32. package/dist/components/icon-button/index.d.ts +1 -0
  33. package/dist/components/icons/actions.d.ts +3 -0
  34. package/dist/components/icons/align-bottom.d.ts +3 -0
  35. package/dist/components/icons/align-horizontal-center.d.ts +3 -0
  36. package/dist/components/icons/align-left.d.ts +3 -0
  37. package/dist/components/icons/align-right.d.ts +3 -0
  38. package/dist/components/icons/align-top.d.ts +3 -0
  39. package/dist/components/icons/align-vertical-center.d.ts +3 -0
  40. package/dist/components/icons/annotation.d.ts +3 -0
  41. package/dist/components/icons/aspect-ratio.d.ts +3 -0
  42. package/dist/components/icons/auto-height.d.ts +3 -0
  43. package/dist/components/icons/auto-width.d.ts +3 -0
  44. package/dist/components/icons/blend-mode.d.ts +3 -0
  45. package/dist/components/icons/boolean.d.ts +3 -0
  46. package/dist/components/icons/checkmark-indeterminate.d.ts +3 -0
  47. package/dist/components/icons/checkmark.d.ts +3 -0
  48. package/dist/components/icons/chevron-down.d.ts +3 -0
  49. package/dist/components/icons/chevron-left.d.ts +3 -0
  50. package/dist/components/icons/chevron-right.d.ts +3 -0
  51. package/dist/components/icons/chevron-up.d.ts +3 -0
  52. package/dist/components/icons/circle.d.ts +3 -0
  53. package/dist/components/icons/clear.d.ts +3 -0
  54. package/dist/components/icons/close.d.ts +3 -0
  55. package/dist/components/icons/code.d.ts +3 -0
  56. package/dist/components/icons/comment.d.ts +3 -0
  57. package/dist/components/icons/component.d.ts +3 -0
  58. package/dist/components/icons/constraint-left.d.ts +3 -0
  59. package/dist/components/icons/constraint-top.d.ts +3 -0
  60. package/dist/components/icons/corner-radius.d.ts +3 -0
  61. package/dist/components/icons/design.d.ts +3 -0
  62. package/dist/components/icons/draw.d.ts +3 -0
  63. package/dist/components/icons/ellipsis.d.ts +3 -0
  64. package/dist/components/icons/expand.d.ts +3 -0
  65. package/dist/components/icons/eye.d.ts +3 -0
  66. package/dist/components/icons/eyedropper.d.ts +3 -0
  67. package/dist/components/icons/figma.d.ts +3 -0
  68. package/dist/components/icons/fill-gradient.d.ts +3 -0
  69. package/dist/components/icons/fill-pattern.d.ts +3 -0
  70. package/dist/components/icons/fill-solid.d.ts +3 -0
  71. package/dist/components/icons/fixed-size.d.ts +3 -0
  72. package/dist/components/icons/flip-horizontal.d.ts +3 -0
  73. package/dist/components/icons/flip-vertical.d.ts +3 -0
  74. package/dist/components/icons/frame.d.ts +3 -0
  75. package/dist/components/icons/help.d.ts +3 -0
  76. package/dist/components/icons/image.d.ts +3 -0
  77. package/dist/components/icons/index.d.ts +84 -0
  78. package/dist/components/icons/layers-collapse.d.ts +3 -0
  79. package/dist/components/icons/letter-spacing.d.ts +3 -0
  80. package/dist/components/icons/line-height.d.ts +3 -0
  81. package/dist/components/icons/link.d.ts +3 -0
  82. package/dist/components/icons/minus.d.ts +3 -0
  83. package/dist/components/icons/move.d.ts +3 -0
  84. package/dist/components/icons/number.d.ts +3 -0
  85. package/dist/components/icons/opacity.d.ts +3 -0
  86. package/dist/components/icons/palette.d.ts +3 -0
  87. package/dist/components/icons/panel-left-close.d.ts +3 -0
  88. package/dist/components/icons/pen.d.ts +3 -0
  89. package/dist/components/icons/play.d.ts +3 -0
  90. package/dist/components/icons/plus.d.ts +3 -0
  91. package/dist/components/icons/rectangle.d.ts +3 -0
  92. package/dist/components/icons/rotate-clockwise.d.ts +3 -0
  93. package/dist/components/icons/rotation.d.ts +3 -0
  94. package/dist/components/icons/ruler.d.ts +3 -0
  95. package/dist/components/icons/search.d.ts +3 -0
  96. package/dist/components/icons/select-matching.d.ts +3 -0
  97. package/dist/components/icons/shadow-bottom-left.d.ts +3 -0
  98. package/dist/components/icons/shadow-bottom-right.d.ts +3 -0
  99. package/dist/components/icons/shadow-down.d.ts +3 -0
  100. package/dist/components/icons/shadow-left.d.ts +3 -0
  101. package/dist/components/icons/shadow-right.d.ts +3 -0
  102. package/dist/components/icons/shadow-top-left.d.ts +3 -0
  103. package/dist/components/icons/shadow-top-right.d.ts +3 -0
  104. package/dist/components/icons/shadow-up.d.ts +3 -0
  105. package/dist/components/icons/sliders.d.ts +3 -0
  106. package/dist/components/icons/string.d.ts +3 -0
  107. package/dist/components/icons/styles.d.ts +3 -0
  108. package/dist/components/icons/text-align-center.d.ts +3 -0
  109. package/dist/components/icons/text-align-left.d.ts +3 -0
  110. package/dist/components/icons/text-align-right.d.ts +3 -0
  111. package/dist/components/icons/text-vertical-align-bottom.d.ts +3 -0
  112. package/dist/components/icons/text-vertical-align-middle.d.ts +3 -0
  113. package/dist/components/icons/text-vertical-align-top.d.ts +3 -0
  114. package/dist/components/icons/text.d.ts +3 -0
  115. package/dist/components/icons/variable-mode.d.ts +3 -0
  116. package/dist/components/icons/variable.d.ts +3 -0
  117. package/dist/components/icons/video.d.ts +3 -0
  118. package/dist/components/input/index.d.ts +1 -0
  119. package/dist/components/input/input.d.ts +9 -0
  120. package/dist/components/popover/index.d.ts +1 -0
  121. package/dist/components/popover/popover.d.ts +20 -0
  122. package/dist/components/radio-group/index.d.ts +1 -0
  123. package/dist/components/radio-group/radio-group.d.ts +20 -0
  124. package/dist/components/segmented-control/index.d.ts +1 -0
  125. package/dist/components/segmented-control/segmented-control.d.ts +24 -0
  126. package/dist/components/select/index.d.ts +1 -0
  127. package/dist/components/select/select.d.ts +40 -0
  128. package/dist/components/slider/index.d.ts +1 -0
  129. package/dist/components/slider/slider.d.ts +24 -0
  130. package/dist/components/switch/index.d.ts +1 -0
  131. package/dist/components/switch/switch.d.ts +6 -0
  132. package/dist/components/tabs/index.d.ts +1 -0
  133. package/dist/components/tabs/tabs.d.ts +12 -0
  134. package/dist/components/text/index.d.ts +1 -0
  135. package/dist/components/text/text.d.ts +47 -0
  136. package/dist/components/textarea/index.d.ts +1 -0
  137. package/dist/components/textarea/textarea.d.ts +6 -0
  138. package/dist/components/tooltip/index.d.ts +1 -0
  139. package/dist/components/tooltip/tooltip.d.ts +18 -0
  140. package/dist/components/value-field/index.d.ts +10 -0
  141. package/dist/components/value-field/named-colors.d.ts +2 -0
  142. package/dist/components/value-field/types.d.ts +15 -0
  143. package/dist/components/value-field/value-field-base.d.ts +17 -0
  144. package/dist/components/value-field/value-field-elements.d.ts +31 -0
  145. package/dist/components/value-field/value-field-hex.d.ts +29 -0
  146. package/dist/components/value-field/value-field-numeric-select.d.ts +18 -0
  147. package/dist/components/value-field/value-field-numeric.d.ts +62 -0
  148. package/dist/components/value-field/value-field-scrubber.d.ts +20 -0
  149. package/dist/figma-development-theme.css +2 -3
  150. package/dist/index.cjs +1 -64
  151. package/dist/index.d.ts +39 -874
  152. package/dist/index.mjs +4155 -9797
  153. package/dist/lib/color.d.ts +40 -0
  154. package/dist/lib/constants.d.ts +2 -0
  155. package/dist/lib/dom/focus.d.ts +14 -0
  156. package/dist/lib/dom/set-input-value.d.ts +8 -0
  157. package/dist/lib/number/clamp.d.ts +1 -0
  158. package/dist/lib/number/normalize.d.ts +13 -0
  159. package/dist/lib/react/add-class-name.d.ts +4 -0
  160. package/dist/lib/react/create-context.d.ts +14 -0
  161. package/dist/lib/react/use-compose-refs.d.ts +19 -0
  162. package/dist/lib/react/use-controllable-state.d.ts +14 -0
  163. package/dist/lib/react/use-select-on-input-click.d.ts +9 -0
  164. package/dist/styles.css +656 -107
  165. package/dist/tailwind.css +2621 -0
  166. package/package.json +70 -33
  167. package/dist/tailwind.preset.js +0 -255
@@ -0,0 +1,40 @@
1
+ type WithAlpha<T> = T & {
2
+ a: number;
3
+ };
4
+ type RGB = {
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ };
9
+ type HSV = {
10
+ h: number;
11
+ s: number;
12
+ v: number;
13
+ };
14
+ type HSL = {
15
+ h: number;
16
+ s: number;
17
+ l: number;
18
+ };
19
+ type RGBA = WithAlpha<RGB>;
20
+ type HSVA = WithAlpha<HSV>;
21
+ type HSLA = WithAlpha<HSL>;
22
+ type HEX = string;
23
+ type P3String = `color(display-p3 ${number} ${number} ${number}${` / ${number}` | ''})`;
24
+ type RGBString = `rgb(${number} ${number} ${number}${` / ${number}` | ''})`;
25
+ declare function rgbaToHex({ r, g, b, a }: RGBA): HEX;
26
+ declare function hslaToHex(hsla: HSLA): HEX;
27
+ declare function hsvaToHex(hsla: HSVA): HEX;
28
+ declare function rgbaToHsva({ r, g, b, a }: RGBA): HSVA;
29
+ declare function hsvaToRgba({ h, s, v, a }: HSVA): RGBA;
30
+ declare function hslaToHsva({ h, s, l, a }: HSLA): HSVA;
31
+ declare function hsvaToHsla({ h, s, v, a }: HSVA): HSLA;
32
+ declare function hslaToRgba(hsla: HSLA): RGBA;
33
+ declare function rgbaToHsla(rgba: RGBA): HSLA;
34
+ declare function rgbaToP3String(color: RGBA): P3String;
35
+ declare function rgbaToCssString(color: RGBA): RGBString;
36
+ declare function blendWithWhite(color: RGBA): RGBA;
37
+ declare function roundHsva(hsva: HSVA): HSVA;
38
+ declare function roundHsla(hsla: HSLA): HSLA;
39
+ export type { RGB, HSV, HSL, RGBA, HSVA, HSLA, HEX, P3String, RGBString };
40
+ export { rgbaToHex, rgbaToHsva, hsvaToRgba, hslaToHsva, hsvaToHsla, hslaToRgba, rgbaToHsla, rgbaToP3String, rgbaToCssString, blendWithWhite, roundHsva, roundHsla, hslaToHex, hsvaToHex, };
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_SMALL_NUDGE = 1;
2
+ export declare const DEFAULT_BIG_NUDGE = 10;
@@ -0,0 +1,14 @@
1
+ type FocusableTarget = HTMLElement | {
2
+ focus(): void;
3
+ };
4
+ /**
5
+ * Focus a given element and optionally select its content if it is a selectable input.
6
+ *
7
+ * @param element - The element to focus. Optional.
8
+ * @param options
9
+ * @param options.select - Whether to select the content of the element if it is a selectable input (default: false).
10
+ */
11
+ export declare function focus(element?: FocusableTarget | null, { select }?: {
12
+ select?: boolean | undefined;
13
+ }): void;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set the value of an HTMLInputElement and optionally dispatch an input event.
3
+ *
4
+ * @param inputElement - The HTMLInputElement to set the value for.
5
+ * @param value - The value to set on the input element.
6
+ * @param dispatchEvent - Whether to dispatch an input event (default: true).
7
+ */
8
+ export declare const setInputElementValue: (inputElement: HTMLInputElement | null, value: string, dispatchEvent?: boolean) => void;
@@ -0,0 +1 @@
1
+ export declare function clamp(value: number, min: number, max?: number): number;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Map a value to a specified range.
3
+ * https://stats.stackexchange.com/a/281164
4
+ *
5
+ * @param sourceRange {[number, number]} - input range
6
+ * @param targetRange {[number, number]} - The target range to map the value to
7
+ * @return {function(number): number} A function that takes a number and maps it to the specified range
8
+ *
9
+ * @example:
10
+ * normalize([0, 1], [0, 100])(0.5) -> 50
11
+ * normalize([0, 1], [0, 255])(1) -> 255
12
+ */
13
+ export declare function normalize(sourceRange: [number, number], targetRange: [number, number]): (value: number) => number;
@@ -0,0 +1,4 @@
1
+ type ClassName<State> = string | ((state: State) => string | undefined) | undefined;
2
+ declare function addClassName<State>(className: ClassName<State>, value: string): ClassName<State>;
3
+ export type { ClassName };
4
+ export { addClassName };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ * Copyright (c) 2022 WorkOS
5
+ * https://github.com/radix-ui/primitives/blob/main/LICENSE
6
+ * */
7
+ import React from 'react';
8
+ declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
9
+ (props: ContextValueType & {
10
+ children: React.ReactNode;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ displayName: string;
13
+ }, (consumerName: string) => ContextValueType];
14
+ export { createContext };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ * Copyright (c) 2022 WorkOS
5
+ * https://github.com/radix-ui/primitives/blob/main/LICENSE
6
+ * */
7
+ import * as React from 'react';
8
+ type PossibleRef<T> = React.Ref<T> | undefined;
9
+ /**
10
+ * A utility to compose multiple refs together
11
+ * Accepts callback refs and RefObject(s)
12
+ */
13
+ declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
14
+ /**
15
+ * A custom hook that composes multiple refs
16
+ * Accepts callback refs and RefObject(s)
17
+ */
18
+ declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
19
+ export { composeRefs, useComposedRefs };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ * Copyright (c) 2022 WorkOS
5
+ * https://github.com/radix-ui/primitives/blob/main/LICENSE
6
+ * */
7
+ import * as React from 'react';
8
+ type UseControllableStateParams<T> = {
9
+ prop?: T | undefined;
10
+ defaultProp?: T | undefined;
11
+ onChange?: (state: T) => void;
12
+ };
13
+ declare function useControllableState<T>({ prop, defaultProp, onChange }: UseControllableStateParams<T>): readonly [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>];
14
+ export { useControllableState };
@@ -0,0 +1,9 @@
1
+ import type React from 'react';
2
+ /**
3
+ * Selects the target element's contents on click, unless the user is selecting manually.
4
+ * */
5
+ export declare function useSelectOnInputClick(): {
6
+ onMouseLeave: () => void;
7
+ onMouseUp: (event: React.MouseEvent<HTMLInputElement>) => void;
8
+ onFocus: () => void;
9
+ };