@proyecto-viviana/solid-stately 0.2.4 → 0.3.0

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 (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -283
  3. package/dist/autocomplete/createAutocompleteState.d.ts +3 -2
  4. package/dist/autocomplete/index.d.ts +1 -1
  5. package/dist/calendar/createCalendarState.d.ts +22 -7
  6. package/dist/calendar/createDateFieldState.d.ts +30 -7
  7. package/dist/calendar/createDatePickerState.d.ts +60 -0
  8. package/dist/calendar/createRangeCalendarState.d.ts +27 -8
  9. package/dist/calendar/createTimeFieldState.d.ts +34 -7
  10. package/dist/calendar/index.d.ts +7 -6
  11. package/dist/checkbox/createCheckboxGroupState.d.ts +12 -3
  12. package/dist/checkbox/index.d.ts +1 -1
  13. package/dist/collections/ListCollection.d.ts +1 -1
  14. package/dist/collections/createListState.d.ts +8 -8
  15. package/dist/collections/createMenuState.d.ts +7 -7
  16. package/dist/collections/createSelectionState.d.ts +5 -5
  17. package/dist/collections/index.d.ts +5 -5
  18. package/dist/collections/types.d.ts +23 -12
  19. package/dist/color/Color.d.ts +1 -1
  20. package/dist/color/createColorAreaState.d.ts +4 -2
  21. package/dist/color/createColorFieldState.d.ts +38 -12
  22. package/dist/color/createColorSliderState.d.ts +9 -2
  23. package/dist/color/createColorWheelState.d.ts +13 -2
  24. package/dist/color/getColorChannels.d.ts +20 -0
  25. package/dist/color/index.d.ts +6 -6
  26. package/dist/color/types.d.ts +4 -4
  27. package/dist/combobox/createComboBoxState.d.ts +27 -13
  28. package/dist/combobox/index.d.ts +1 -1
  29. package/dist/data/createAsyncList.d.ts +111 -0
  30. package/dist/data/createListData.d.ts +65 -0
  31. package/dist/data/createTreeData.d.ts +65 -0
  32. package/dist/data/index.d.ts +3 -0
  33. package/dist/datepicker/index.d.ts +8 -0
  34. package/dist/disclosure/createDisclosureState.d.ts +2 -2
  35. package/dist/disclosure/index.d.ts +1 -1
  36. package/dist/dnd/createDragState.d.ts +2 -2
  37. package/dist/dnd/createDraggableCollectionState.d.ts +2 -2
  38. package/dist/dnd/createDropState.d.ts +2 -2
  39. package/dist/dnd/createDroppableCollectionState.d.ts +3 -3
  40. package/dist/dnd/index.d.ts +5 -5
  41. package/dist/dnd/types.d.ts +16 -16
  42. package/dist/form/createFormValidationState.d.ts +3 -3
  43. package/dist/form/index.d.ts +1 -1
  44. package/dist/grid/createGridState.d.ts +2 -2
  45. package/dist/grid/index.d.ts +2 -2
  46. package/dist/grid/types.d.ts +17 -11
  47. package/dist/index.d.ts +31 -25
  48. package/dist/index.js +7990 -6264
  49. package/dist/index.js.map +1 -7
  50. package/dist/menu/index.d.ts +8 -0
  51. package/dist/numberfield/createNumberFieldState.d.ts +2 -2
  52. package/dist/numberfield/index.d.ts +1 -1
  53. package/dist/overlays/createOverlayTriggerState.d.ts +2 -2
  54. package/dist/overlays/index.d.ts +1 -1
  55. package/dist/radio/createRadioGroupState.d.ts +13 -4
  56. package/dist/radio/index.d.ts +1 -1
  57. package/dist/searchfield/createSearchFieldState.d.ts +2 -2
  58. package/dist/searchfield/index.d.ts +2 -2
  59. package/dist/select/createSelectState.d.ts +20 -3
  60. package/dist/select/index.d.ts +1 -1
  61. package/dist/selection/index.d.ts +11 -0
  62. package/dist/slider/createSliderState.d.ts +3 -3
  63. package/dist/slider/index.d.ts +2 -2
  64. package/dist/steplist/createStepListState.d.ts +48 -0
  65. package/dist/steplist/index.d.ts +1 -0
  66. package/dist/table/TableCollection.d.ts +3 -3
  67. package/dist/table/createTableColumnResizeState.d.ts +54 -0
  68. package/dist/table/createTableState.d.ts +2 -2
  69. package/dist/table/index.d.ts +5 -3
  70. package/dist/table/types.d.ts +10 -10
  71. package/dist/tabs/createTabListState.d.ts +5 -5
  72. package/dist/tabs/index.d.ts +1 -1
  73. package/dist/textfield/createTextFieldState.d.ts +2 -2
  74. package/dist/textfield/index.d.ts +1 -1
  75. package/dist/toast/createToastState.d.ts +15 -3
  76. package/dist/toast/index.d.ts +1 -1
  77. package/dist/toggle/createToggleGroupState.d.ts +45 -0
  78. package/dist/toggle/createToggleState.d.ts +2 -2
  79. package/dist/toggle/index.d.ts +2 -1
  80. package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
  81. package/dist/tooltip/index.d.ts +1 -1
  82. package/dist/tree/TreeCollection.d.ts +5 -4
  83. package/dist/tree/createTreeState.d.ts +2 -2
  84. package/dist/tree/index.d.ts +3 -3
  85. package/dist/tree/types.d.ts +19 -13
  86. package/dist/utils/index.d.ts +1 -1
  87. package/dist/utils/reactivity.d.ts +1 -1
  88. package/package.json +30 -30
  89. package/src/autocomplete/createAutocompleteState.d.ts +19 -17
  90. package/src/autocomplete/createAutocompleteState.ts +25 -32
  91. package/src/autocomplete/index.d.ts +6 -2
  92. package/src/autocomplete/index.ts +1 -1
  93. package/src/calendar/createCalendarState.d.ts +139 -117
  94. package/src/calendar/createCalendarState.ts +221 -74
  95. package/src/calendar/createDateFieldState.d.ts +130 -95
  96. package/src/calendar/createDateFieldState.ts +286 -151
  97. package/src/calendar/createDatePickerState.ts +347 -0
  98. package/src/calendar/createRangeCalendarState.d.ts +154 -129
  99. package/src/calendar/createRangeCalendarState.ts +293 -79
  100. package/src/calendar/createTimeFieldState.d.ts +81 -79
  101. package/src/calendar/createTimeFieldState.ts +187 -108
  102. package/src/calendar/index.d.ts +80 -7
  103. package/src/calendar/index.ts +21 -12
  104. package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
  105. package/src/checkbox/createCheckboxGroupState.ts +57 -30
  106. package/src/checkbox/index.d.ts +6 -2
  107. package/src/checkbox/index.ts +1 -1
  108. package/src/collections/ListCollection.d.ts +25 -22
  109. package/src/collections/ListCollection.ts +152 -146
  110. package/src/collections/createListState.d.ts +73 -58
  111. package/src/collections/createListState.ts +267 -264
  112. package/src/collections/createMenuState.d.ts +36 -31
  113. package/src/collections/createMenuState.ts +112 -106
  114. package/src/collections/createSelectionState.d.ts +78 -65
  115. package/src/collections/createSelectionState.ts +340 -336
  116. package/src/collections/index.d.ts +38 -6
  117. package/src/collections/index.ts +41 -46
  118. package/src/collections/types.d.ts +101 -101
  119. package/src/collections/types.ts +181 -169
  120. package/src/color/Color.d.ts +20 -5
  121. package/src/color/Color.ts +1054 -951
  122. package/src/color/createColorAreaState.d.ts +67 -65
  123. package/src/color/createColorAreaState.ts +301 -293
  124. package/src/color/createColorFieldState.d.ts +46 -44
  125. package/src/color/createColorFieldState.ts +428 -292
  126. package/src/color/createColorSliderState.d.ts +58 -56
  127. package/src/color/createColorSliderState.ts +272 -241
  128. package/src/color/createColorWheelState.d.ts +42 -40
  129. package/src/color/createColorWheelState.ts +248 -211
  130. package/src/color/getColorChannels.ts +36 -0
  131. package/src/color/index.d.ts +36 -7
  132. package/src/color/index.ts +44 -47
  133. package/src/color/types.d.ts +68 -63
  134. package/src/color/types.ts +119 -127
  135. package/src/combobox/createComboBoxState.d.ts +107 -105
  136. package/src/combobox/createComboBoxState.ts +790 -703
  137. package/src/combobox/index.d.ts +10 -2
  138. package/src/combobox/index.ts +13 -13
  139. package/src/data/createAsyncList.ts +403 -0
  140. package/src/data/createListData.ts +298 -0
  141. package/src/data/createTreeData.ts +646 -0
  142. package/src/data/index.ts +25 -0
  143. package/src/datepicker/index.ts +32 -0
  144. package/src/disclosure/createDisclosureState.d.ts +47 -43
  145. package/src/disclosure/createDisclosureState.ts +9 -23
  146. package/src/disclosure/index.d.ts +10 -2
  147. package/src/disclosure/index.ts +1 -1
  148. package/src/dnd/createDragState.d.ts +51 -42
  149. package/src/dnd/createDragState.ts +151 -153
  150. package/src/dnd/createDraggableCollectionState.d.ts +52 -41
  151. package/src/dnd/createDraggableCollectionState.ts +158 -165
  152. package/src/dnd/createDropState.d.ts +64 -45
  153. package/src/dnd/createDropState.ts +202 -212
  154. package/src/dnd/createDroppableCollectionState.d.ts +88 -59
  155. package/src/dnd/createDroppableCollectionState.ts +354 -357
  156. package/src/dnd/index.d.ts +54 -6
  157. package/src/dnd/index.ts +63 -76
  158. package/src/dnd/types.d.ts +167 -156
  159. package/src/dnd/types.ts +316 -317
  160. package/src/form/createFormValidationState.d.ts +47 -45
  161. package/src/form/createFormValidationState.ts +356 -389
  162. package/src/form/index.d.ts +16 -2
  163. package/src/form/index.ts +15 -15
  164. package/src/grid/createGridState.d.ts +7 -4
  165. package/src/grid/createGridState.ts +44 -51
  166. package/src/grid/index.d.ts +3 -3
  167. package/src/grid/index.ts +2 -8
  168. package/src/grid/types.d.ts +136 -129
  169. package/src/grid/types.ts +24 -17
  170. package/src/index.d.ts +310 -26
  171. package/src/index.ts +87 -79
  172. package/src/menu/index.ts +17 -0
  173. package/src/numberfield/createNumberFieldState.d.ts +56 -54
  174. package/src/numberfield/createNumberFieldState.ts +422 -383
  175. package/src/numberfield/index.d.ts +6 -2
  176. package/src/numberfield/index.ts +5 -5
  177. package/src/overlays/createOverlayTriggerState.d.ts +22 -20
  178. package/src/overlays/createOverlayTriggerState.ts +66 -67
  179. package/src/overlays/index.d.ts +6 -2
  180. package/src/overlays/index.ts +5 -5
  181. package/src/radio/createRadioGroupState.d.ts +54 -52
  182. package/src/radio/createRadioGroupState.ts +66 -30
  183. package/src/radio/index.d.ts +7 -2
  184. package/src/radio/index.ts +1 -1
  185. package/src/searchfield/createSearchFieldState.d.ts +16 -14
  186. package/src/searchfield/createSearchFieldState.ts +56 -62
  187. package/src/searchfield/index.d.ts +3 -3
  188. package/src/searchfield/index.ts +2 -5
  189. package/src/select/createSelectState.d.ts +63 -61
  190. package/src/select/createSelectState.ts +290 -181
  191. package/src/select/index.d.ts +2 -2
  192. package/src/select/index.ts +1 -5
  193. package/src/selection/index.ts +27 -0
  194. package/src/slider/createSliderState.d.ts +60 -60
  195. package/src/slider/createSliderState.ts +233 -211
  196. package/src/slider/index.d.ts +3 -3
  197. package/src/slider/index.ts +2 -6
  198. package/src/ssr/index.d.ts +1 -1
  199. package/src/ssr/index.ts +2 -2
  200. package/src/steplist/createStepListState.ts +191 -0
  201. package/src/steplist/index.ts +5 -0
  202. package/src/table/TableCollection.d.ts +42 -40
  203. package/src/table/TableCollection.ts +61 -64
  204. package/src/table/createTableColumnResizeState.ts +242 -0
  205. package/src/table/createTableState.d.ts +7 -4
  206. package/src/table/createTableState.ts +10 -7
  207. package/src/table/index.d.ts +14 -4
  208. package/src/table/index.ts +10 -3
  209. package/src/table/types.d.ts +98 -92
  210. package/src/table/types.ts +17 -13
  211. package/src/tabs/createTabListState.d.ts +59 -57
  212. package/src/tabs/createTabListState.ts +58 -39
  213. package/src/tabs/index.d.ts +8 -2
  214. package/src/tabs/index.ts +1 -1
  215. package/src/textfield/createTextFieldState.d.ts +16 -14
  216. package/src/textfield/createTextFieldState.ts +7 -18
  217. package/src/textfield/index.d.ts +6 -2
  218. package/src/textfield/index.ts +1 -1
  219. package/src/toast/createToastState.d.ts +92 -81
  220. package/src/toast/createToastState.ts +56 -44
  221. package/src/toast/index.d.ts +12 -2
  222. package/src/toast/index.ts +1 -1
  223. package/src/toggle/createToggleGroupState.ts +117 -0
  224. package/src/toggle/createToggleState.d.ts +19 -19
  225. package/src/toggle/createToggleState.ts +2 -16
  226. package/src/toggle/index.d.ts +2 -2
  227. package/src/toggle/index.ts +6 -4
  228. package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
  229. package/src/tooltip/createTooltipTriggerState.ts +184 -183
  230. package/src/tooltip/index.d.ts +7 -2
  231. package/src/tooltip/index.ts +6 -6
  232. package/src/tree/TreeCollection.d.ts +26 -23
  233. package/src/tree/TreeCollection.ts +215 -175
  234. package/src/tree/createTreeState.d.ts +7 -4
  235. package/src/tree/createTreeState.ts +390 -392
  236. package/src/tree/index.d.ts +10 -4
  237. package/src/tree/index.ts +13 -13
  238. package/src/tree/types.d.ts +131 -126
  239. package/src/tree/types.ts +183 -174
  240. package/src/utils/index.d.ts +2 -2
  241. package/src/utils/index.ts +1 -1
  242. package/src/utils/reactivity.d.ts +2 -2
  243. package/src/utils/reactivity.ts +3 -3
@@ -1,47 +1,44 @@
1
- /**
2
- * Color state management exports.
3
- */
4
-
5
- // Types
6
- export type {
7
- Color,
8
- ColorFormat,
9
- ColorSpace,
10
- ColorChannel,
11
- ColorChannelRange,
12
- ColorAxes,
13
- } from './types';
14
-
15
- // Color class and utilities
16
- export {
17
- parseColor,
18
- normalizeColor,
19
- createRGBColor,
20
- createHSLColor,
21
- createHSBColor,
22
- } from './Color';
23
-
24
- // State hooks
25
- export {
26
- createColorSliderState,
27
- type ColorSliderStateOptions,
28
- type ColorSliderState,
29
- } from './createColorSliderState';
30
-
31
- export {
32
- createColorAreaState,
33
- type ColorAreaStateOptions,
34
- type ColorAreaState,
35
- } from './createColorAreaState';
36
-
37
- export {
38
- createColorWheelState,
39
- type ColorWheelStateOptions,
40
- type ColorWheelState,
41
- } from './createColorWheelState';
42
-
43
- export {
44
- createColorFieldState,
45
- type ColorFieldStateOptions,
46
- type ColorFieldState,
47
- } from './createColorFieldState';
1
+ /**
2
+ * Color state management exports.
3
+ */
4
+
5
+ export type {
6
+ Color,
7
+ ColorFormat,
8
+ ColorSpace,
9
+ ColorChannel,
10
+ ColorChannelRange,
11
+ ColorAxes,
12
+ } from "./types";
13
+
14
+ export {
15
+ parseColor,
16
+ normalizeColor,
17
+ createRGBColor,
18
+ createHSLColor,
19
+ createHSBColor,
20
+ } from "./Color";
21
+
22
+ export {
23
+ createColorSliderState,
24
+ type ColorSliderStateOptions,
25
+ type ColorSliderState,
26
+ } from "./createColorSliderState";
27
+
28
+ export {
29
+ createColorAreaState,
30
+ type ColorAreaStateOptions,
31
+ type ColorAreaState,
32
+ } from "./createColorAreaState";
33
+
34
+ export {
35
+ createColorWheelState,
36
+ type ColorWheelStateOptions,
37
+ type ColorWheelState,
38
+ } from "./createColorWheelState";
39
+
40
+ export {
41
+ createColorFieldState,
42
+ type ColorFieldStateOptions,
43
+ type ColorFieldState,
44
+ } from "./createColorFieldState";
@@ -5,102 +5,107 @@
5
5
  /**
6
6
  * Supported color formats.
7
7
  */
8
- export type ColorFormat = 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hsb' | 'hsba';
8
+ export type ColorFormat = "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba";
9
9
  /**
10
10
  * Color spaces.
11
11
  */
12
- export type ColorSpace = 'rgb' | 'hsl' | 'hsb';
12
+ export type ColorSpace = "rgb" | "hsl" | "hsb";
13
13
  /**
14
14
  * Color channels.
15
15
  */
16
- export type ColorChannel = 'hue' | 'saturation' | 'brightness' | 'lightness' | 'red' | 'green' | 'blue' | 'alpha';
16
+ export type ColorChannel =
17
+ | "hue"
18
+ | "saturation"
19
+ | "brightness"
20
+ | "lightness"
21
+ | "red"
22
+ | "green"
23
+ | "blue"
24
+ | "alpha";
17
25
  /**
18
26
  * Range for a color channel.
19
27
  */
20
28
  export interface ColorChannelRange {
21
- /** Minimum value. */
22
- minValue: number;
23
- /** Maximum value. */
24
- maxValue: number;
25
- /** Step for keyboard increment. */
26
- step: number;
27
- /** Page step for larger increments. */
28
- pageSize: number;
29
+ /** Minimum value. */
30
+ minValue: number;
31
+ /** Maximum value. */
32
+ maxValue: number;
33
+ /** Step for keyboard increment. */
34
+ step: number;
35
+ /** Page step for larger increments. */
36
+ pageSize: number;
29
37
  }
30
38
  /**
31
39
  * Color axes for a color space.
32
40
  */
33
41
  export interface ColorAxes {
34
- /** X-axis channel. */
35
- xChannel: ColorChannel;
36
- /** Y-axis channel. */
37
- yChannel: ColorChannel;
38
- /** Z-axis channel (the one not on x or y). */
39
- zChannel: ColorChannel;
42
+ /** X-axis channel. */
43
+ xChannel: ColorChannel;
44
+ /** Y-axis channel. */
45
+ yChannel: ColorChannel;
46
+ /** Z-axis channel (the one not on x or y). */
47
+ zChannel: ColorChannel;
40
48
  }
41
49
  /**
42
50
  * Color interface representing a color value.
43
51
  */
44
52
  export interface Color {
45
- /** Convert to a different format. */
46
- toFormat(format: ColorFormat): Color;
47
- /** Convert to a CSS string. */
48
- toString(format?: ColorFormat | 'css'): string;
49
- /** Clone this color. */
50
- clone(): Color;
51
- /** Get the hex value as an integer. */
52
- toHexInt(): number;
53
- /** Get the value of a specific channel. */
54
- getChannelValue(channel: ColorChannel): number;
55
- /** Create a new color with a channel value changed. */
56
- withChannelValue(channel: ColorChannel, value: number): Color;
57
- /** Get the range for a channel. */
58
- getChannelRange(channel: ColorChannel): ColorChannelRange;
59
- /** Get the localized name of a channel. */
60
- getChannelName(channel: ColorChannel, locale: string): string;
61
- /** Get the format options for a channel. */
62
- getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
63
- /** Format the value of a channel. */
64
- formatChannelValue(channel: ColorChannel, locale: string): string;
65
- /** Get the color space. */
66
- getColorSpace(): ColorSpace;
67
- /** Get the axes for a color space. */
68
- getColorSpaceAxes(xyChannels?: {
69
- xChannel?: ColorChannel;
70
- yChannel?: ColorChannel;
71
- }): ColorAxes;
72
- /** Get all channels for this color space. */
73
- getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
74
- /** Get a human-readable color name. */
75
- getColorName(locale: string): string;
76
- /** Get the hue name (e.g., "red", "blue"). */
77
- getHueName(locale: string): string;
53
+ /** Convert to a different format. */
54
+ toFormat(format: ColorFormat): Color;
55
+ /** Convert to a CSS string. */
56
+ toString(format?: ColorFormat | "css"): string;
57
+ /** Clone this color. */
58
+ clone(): Color;
59
+ /** Get the hex value as an integer. */
60
+ toHexInt(): number;
61
+ /** Get the value of a specific channel. */
62
+ getChannelValue(channel: ColorChannel): number;
63
+ /** Create a new color with a channel value changed. */
64
+ withChannelValue(channel: ColorChannel, value: number): Color;
65
+ /** Get the range for a channel. */
66
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
67
+ /** Get the localized name of a channel. */
68
+ getChannelName(channel: ColorChannel, locale: string): string;
69
+ /** Get the format options for a channel. */
70
+ getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
71
+ /** Format the value of a channel. */
72
+ formatChannelValue(channel: ColorChannel, locale: string): string;
73
+ /** Get the color space. */
74
+ getColorSpace(): ColorSpace;
75
+ /** Get the axes for a color space. */
76
+ getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes;
77
+ /** Get all channels for this color space. */
78
+ getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
79
+ /** Get a human-readable color name. */
80
+ getColorName(locale: string): string;
81
+ /** Get the hue name (e.g., "red", "blue"). */
82
+ getHueName(locale: string): string;
78
83
  }
79
84
  /**
80
85
  * RGB color value.
81
86
  */
82
87
  export interface RGBColor {
83
- red: number;
84
- green: number;
85
- blue: number;
86
- alpha: number;
88
+ red: number;
89
+ green: number;
90
+ blue: number;
91
+ alpha: number;
87
92
  }
88
93
  /**
89
94
  * HSL color value.
90
95
  */
91
96
  export interface HSLColor {
92
- hue: number;
93
- saturation: number;
94
- lightness: number;
95
- alpha: number;
97
+ hue: number;
98
+ saturation: number;
99
+ lightness: number;
100
+ alpha: number;
96
101
  }
97
102
  /**
98
103
  * HSB color value.
99
104
  */
100
105
  export interface HSBColor {
101
- hue: number;
102
- saturation: number;
103
- brightness: number;
104
- alpha: number;
106
+ hue: number;
107
+ saturation: number;
108
+ brightness: number;
109
+ alpha: number;
105
110
  }
106
- //# sourceMappingURL=types.d.ts.map
111
+ //# sourceMappingURL=types.d.ts.map
@@ -1,127 +1,119 @@
1
- /**
2
- * Color types for color picker components.
3
- * Based on @react-stately/color.
4
- */
5
-
6
- /**
7
- * Supported color formats.
8
- */
9
- export type ColorFormat =
10
- | 'hex'
11
- | 'hexa'
12
- | 'rgb'
13
- | 'rgba'
14
- | 'hsl'
15
- | 'hsla'
16
- | 'hsb'
17
- | 'hsba';
18
-
19
- /**
20
- * Color spaces.
21
- */
22
- export type ColorSpace = 'rgb' | 'hsl' | 'hsb';
23
-
24
- /**
25
- * Color channels.
26
- */
27
- export type ColorChannel =
28
- | 'hue'
29
- | 'saturation'
30
- | 'brightness'
31
- | 'lightness'
32
- | 'red'
33
- | 'green'
34
- | 'blue'
35
- | 'alpha';
36
-
37
- /**
38
- * Range for a color channel.
39
- */
40
- export interface ColorChannelRange {
41
- /** Minimum value. */
42
- minValue: number;
43
- /** Maximum value. */
44
- maxValue: number;
45
- /** Step for keyboard increment. */
46
- step: number;
47
- /** Page step for larger increments. */
48
- pageSize: number;
49
- }
50
-
51
- /**
52
- * Color axes for a color space.
53
- */
54
- export interface ColorAxes {
55
- /** X-axis channel. */
56
- xChannel: ColorChannel;
57
- /** Y-axis channel. */
58
- yChannel: ColorChannel;
59
- /** Z-axis channel (the one not on x or y). */
60
- zChannel: ColorChannel;
61
- }
62
-
63
- /**
64
- * Color interface representing a color value.
65
- */
66
- export interface Color {
67
- /** Convert to a different format. */
68
- toFormat(format: ColorFormat): Color;
69
- /** Convert to a CSS string. */
70
- toString(format?: ColorFormat | 'css'): string;
71
- /** Clone this color. */
72
- clone(): Color;
73
- /** Get the hex value as an integer. */
74
- toHexInt(): number;
75
- /** Get the value of a specific channel. */
76
- getChannelValue(channel: ColorChannel): number;
77
- /** Create a new color with a channel value changed. */
78
- withChannelValue(channel: ColorChannel, value: number): Color;
79
- /** Get the range for a channel. */
80
- getChannelRange(channel: ColorChannel): ColorChannelRange;
81
- /** Get the localized name of a channel. */
82
- getChannelName(channel: ColorChannel, locale: string): string;
83
- /** Get the format options for a channel. */
84
- getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
85
- /** Format the value of a channel. */
86
- formatChannelValue(channel: ColorChannel, locale: string): string;
87
- /** Get the color space. */
88
- getColorSpace(): ColorSpace;
89
- /** Get the axes for a color space. */
90
- getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes;
91
- /** Get all channels for this color space. */
92
- getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
93
- /** Get a human-readable color name. */
94
- getColorName(locale: string): string;
95
- /** Get the hue name (e.g., "red", "blue"). */
96
- getHueName(locale: string): string;
97
- }
98
-
99
- /**
100
- * RGB color value.
101
- */
102
- export interface RGBColor {
103
- red: number;
104
- green: number;
105
- blue: number;
106
- alpha: number;
107
- }
108
-
109
- /**
110
- * HSL color value.
111
- */
112
- export interface HSLColor {
113
- hue: number;
114
- saturation: number;
115
- lightness: number;
116
- alpha: number;
117
- }
118
-
119
- /**
120
- * HSB color value.
121
- */
122
- export interface HSBColor {
123
- hue: number;
124
- saturation: number;
125
- brightness: number;
126
- alpha: number;
127
- }
1
+ /**
2
+ * Color types for color picker components.
3
+ * Based on @react-stately/color.
4
+ */
5
+
6
+ /**
7
+ * Supported color formats.
8
+ */
9
+ export type ColorFormat = "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba";
10
+
11
+ /**
12
+ * Color spaces.
13
+ */
14
+ export type ColorSpace = "rgb" | "hsl" | "hsb";
15
+
16
+ /**
17
+ * Color channels.
18
+ */
19
+ export type ColorChannel =
20
+ | "hue"
21
+ | "saturation"
22
+ | "brightness"
23
+ | "lightness"
24
+ | "red"
25
+ | "green"
26
+ | "blue"
27
+ | "alpha";
28
+
29
+ /**
30
+ * Range for a color channel.
31
+ */
32
+ export interface ColorChannelRange {
33
+ /** Minimum value. */
34
+ minValue: number;
35
+ /** Maximum value. */
36
+ maxValue: number;
37
+ /** Step for keyboard increment. */
38
+ step: number;
39
+ /** Page step for larger increments. */
40
+ pageSize: number;
41
+ }
42
+
43
+ /**
44
+ * Color axes for a color space.
45
+ */
46
+ export interface ColorAxes {
47
+ /** X-axis channel. */
48
+ xChannel: ColorChannel;
49
+ /** Y-axis channel. */
50
+ yChannel: ColorChannel;
51
+ /** Z-axis channel (the one not on x or y). */
52
+ zChannel: ColorChannel;
53
+ }
54
+
55
+ /**
56
+ * Color interface representing a color value.
57
+ */
58
+ export interface Color {
59
+ /** Convert to a different format. */
60
+ toFormat(format: ColorFormat): Color;
61
+ /** Convert to a CSS string. */
62
+ toString(format?: ColorFormat | "css"): string;
63
+ /** Clone this color. */
64
+ clone(): Color;
65
+ /** Get the hex value as an integer. */
66
+ toHexInt(): number;
67
+ /** Get the value of a specific channel. */
68
+ getChannelValue(channel: ColorChannel): number;
69
+ /** Create a new color with a channel value changed. */
70
+ withChannelValue(channel: ColorChannel, value: number): Color;
71
+ /** Get the range for a channel. */
72
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
73
+ /** Get the localized name of a channel. */
74
+ getChannelName(channel: ColorChannel, locale: string): string;
75
+ /** Get the format options for a channel. */
76
+ getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
77
+ /** Format the value of a channel. */
78
+ formatChannelValue(channel: ColorChannel, locale: string): string;
79
+ /** Get the color space. */
80
+ getColorSpace(): ColorSpace;
81
+ /** Get the axes for a color space. */
82
+ getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes;
83
+ /** Get all channels for this color space. */
84
+ getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
85
+ /** Get a human-readable color name. */
86
+ getColorName(locale: string): string;
87
+ /** Get the hue name (e.g., "red", "blue"). */
88
+ getHueName(locale: string): string;
89
+ }
90
+
91
+ /**
92
+ * RGB color value.
93
+ */
94
+ export interface RGBColor {
95
+ red: number;
96
+ green: number;
97
+ blue: number;
98
+ alpha: number;
99
+ }
100
+
101
+ /**
102
+ * HSL color value.
103
+ */
104
+ export interface HSLColor {
105
+ hue: number;
106
+ saturation: number;
107
+ lightness: number;
108
+ alpha: number;
109
+ }
110
+
111
+ /**
112
+ * HSB color value.
113
+ */
114
+ export interface HSBColor {
115
+ hue: number;
116
+ saturation: number;
117
+ brightness: number;
118
+ alpha: number;
119
+ }