@react-stately/color 3.0.0-beta.3 → 3.0.0-beta.7

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/module.js CHANGED
@@ -1,1005 +1,974 @@
1
- import { useRef, useState, useMemo, useEffect } from "react";
2
- import { useControlledState } from "@react-stately/utils";
3
- import { useSliderState } from "@react-stately/slider";
4
- import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
6
- import { NumberFormatter } from "@internationalized/number";
7
- import { MessageDictionary } from "@internationalized/message";
8
- import { clamp } from "@react-aria/utils";
9
- import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault";
10
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ar-AE.json
11
- var $b2cd9264f0b716f5f6077988ebeb8d5$exports = {};
12
- $b2cd9264f0b716f5f6077988ebeb8d5$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
13
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/bg-BG.json
14
- var $cdad99d1d4c78a097fa29797f20e3ec$exports = {};
15
- $cdad99d1d4c78a097fa29797f20e3ec$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
16
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/cs-CZ.json
17
- var $f9cd6479f5235258a90316a784221e3b$exports = {};
18
- $f9cd6479f5235258a90316a784221e3b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
19
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/da-DK.json
20
- var $d9a48d423b3cf4f2d44abe3c990b$exports = {};
21
- $d9a48d423b3cf4f2d44abe3c990b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
22
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/de-DE.json
23
- var $c98aec81a0d1f104658866432f$exports = {};
24
- $c98aec81a0d1f104658866432f$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
25
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/el-GR.json
26
- var $d448bd8618b5533ccc4a8cc128b5f05a$exports = {};
27
- $d448bd8618b5533ccc4a8cc128b5f05a$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
28
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/en-US.json
29
- var $eaffba4fd6d2bfdbccc895c90029fc1b$exports = {};
30
- $eaffba4fd6d2bfdbccc895c90029fc1b$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
31
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/es-ES.json
32
- var $ba4a9d986c77d6b793c00d1e2392bade$exports = {};
33
- $ba4a9d986c77d6b793c00d1e2392bade$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
34
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/et-EE.json
35
- var $eea6c1402487c18ea84576423346b15$exports = {};
36
- $eea6c1402487c18ea84576423346b15$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
37
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fi-FI.json
38
- var $a74db7b52c67c25bc7440950d823b$exports = {};
39
- $a74db7b52c67c25bc7440950d823b$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
40
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fr-FR.json
41
- var $fe5ec5953266844aed13956bf74a814$exports = {};
42
- $fe5ec5953266844aed13956bf74a814$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
43
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/he-IL.json
44
- var $c8b18e3105ca2bd3791c8ba8d5c080e9$exports = {};
45
- $c8b18e3105ca2bd3791c8ba8d5c080e9$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
46
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hr-HR.json
47
- var $b91aba8d136e0d182ab14d$exports = {};
48
- $b91aba8d136e0d182ab14d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
49
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hu-HU.json
50
- var $e4a95e1cff41940abe4abd86d$exports = {};
51
- $e4a95e1cff41940abe4abd86d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
52
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/it-IT.json
53
- var $cc9b471008e063931f187b9f17ea84$exports = {};
54
- $cc9b471008e063931f187b9f17ea84$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
55
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ja-JP.json
56
- var $b3ba4812949b99f64ae9c5343cef182$exports = {};
57
- $b3ba4812949b99f64ae9c5343cef182$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
58
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ko-KR.json
59
- var $a0635388d1896feed826078018e61cc3$exports = {};
60
- $a0635388d1896feed826078018e61cc3$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
61
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lt-LT.json
62
- var $b723c6ed4b6433c464915f350d7b37d$exports = {};
63
- $b723c6ed4b6433c464915f350d7b37d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
64
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lv-LV.json
65
- var $de160269d06dd11d79a46ad67519$exports = {};
66
- $de160269d06dd11d79a46ad67519$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
67
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nb-NO.json
68
- var $df7f70de921632c10878ba1ec274be$exports = {};
69
- $df7f70de921632c10878ba1ec274be$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
70
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nl-NL.json
71
- var $f815b3f638134acc513a2b0c77d8dce0$exports = {};
72
- $f815b3f638134acc513a2b0c77d8dce0$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
73
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pl-PL.json
74
- var $aee27b855fc838cae4ebd8dfbbb95e33$exports = {};
75
- $aee27b855fc838cae4ebd8dfbbb95e33$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
76
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-BR.json
77
- var $b361c9c44348e09361feb2ebb7e33$exports = {};
78
- $b361c9c44348e09361feb2ebb7e33$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
79
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-PT.json
80
- var $d6cb1234c3b503df17397aae027f5d6f$exports = {};
81
- $d6cb1234c3b503df17397aae027f5d6f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
82
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ro-RO.json
83
- var $b8d88afd8f44c22874b7fe6f22d03d1$exports = {};
84
- $b8d88afd8f44c22874b7fe6f22d03d1$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
85
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ru-RU.json
86
- var $c188a27cabc6e80207754236eb1fec$exports = {};
87
- $c188a27cabc6e80207754236eb1fec$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
88
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sk-SK.json
89
- var $c40950a3513f1cbbb70121cc402a156f$exports = {};
90
- $c40950a3513f1cbbb70121cc402a156f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
91
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sl-SI.json
92
- var $d6ba833b474990359bcaf23ae4062a5a$exports = {};
93
- $d6ba833b474990359bcaf23ae4062a5a$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
94
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sr-SP.json
95
- var $b540c0afbb8586393249300b9d058750$exports = {};
96
- $b540c0afbb8586393249300b9d058750$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
97
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sv-SE.json
98
- var $f6f532bfe6495593ae520210aedcf6ee$exports = {};
99
- $f6f532bfe6495593ae520210aedcf6ee$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
100
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/tr-TR.json
101
- var $b002567dfed5d0563037184fe514$exports = {};
102
- $b002567dfed5d0563037184fe514$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
103
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/uk-UA.json
104
- var $e3caa848bb758a1d3e6ca0f18ece7f4$exports = {};
105
- $e3caa848bb758a1d3e6ca0f18ece7f4$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
106
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-CN.json
107
- var $d24ec9fef3a39ede5b3f154080d42$exports = {};
108
- $d24ec9fef3a39ede5b3f154080d42$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
109
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-TW.json
110
- var $a1e968ea81ccd941358c63d78a093ff0$exports = {};
111
- $a1e968ea81ccd941358c63d78a093ff0$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
112
- // @ts-ignore
113
- const $db5f3c2f048bca5be854d051d3f2729$var$intlMessages = {
114
- "ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($b2cd9264f0b716f5f6077988ebeb8d5$exports).default,
115
- "bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($cdad99d1d4c78a097fa29797f20e3ec$exports).default,
116
- "cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($f9cd6479f5235258a90316a784221e3b$exports).default,
117
- "da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($d9a48d423b3cf4f2d44abe3c990b$exports).default,
118
- "de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($c98aec81a0d1f104658866432f$exports).default,
119
- "el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($d448bd8618b5533ccc4a8cc128b5f05a$exports).default,
120
- "en-US": _babelRuntimeHelpersEsmInteropRequireDefault($eaffba4fd6d2bfdbccc895c90029fc1b$exports).default,
121
- "es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($ba4a9d986c77d6b793c00d1e2392bade$exports).default,
122
- "et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($eea6c1402487c18ea84576423346b15$exports).default,
123
- "fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($a74db7b52c67c25bc7440950d823b$exports).default,
124
- "fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($fe5ec5953266844aed13956bf74a814$exports).default,
125
- "he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($c8b18e3105ca2bd3791c8ba8d5c080e9$exports).default,
126
- "hr-HR": _babelRuntimeHelpersEsmInteropRequireDefault($b91aba8d136e0d182ab14d$exports).default,
127
- "hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($e4a95e1cff41940abe4abd86d$exports).default,
128
- "it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($cc9b471008e063931f187b9f17ea84$exports).default,
129
- "ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($b3ba4812949b99f64ae9c5343cef182$exports).default,
130
- "ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($a0635388d1896feed826078018e61cc3$exports).default,
131
- "lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($b723c6ed4b6433c464915f350d7b37d$exports).default,
132
- "lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($de160269d06dd11d79a46ad67519$exports).default,
133
- "nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($df7f70de921632c10878ba1ec274be$exports).default,
134
- "nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($f815b3f638134acc513a2b0c77d8dce0$exports).default,
135
- "pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($aee27b855fc838cae4ebd8dfbbb95e33$exports).default,
136
- "pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($b361c9c44348e09361feb2ebb7e33$exports).default,
137
- "pt-PT": _babelRuntimeHelpersEsmInteropRequireDefault($d6cb1234c3b503df17397aae027f5d6f$exports).default,
138
- "ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($b8d88afd8f44c22874b7fe6f22d03d1$exports).default,
139
- "ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($c188a27cabc6e80207754236eb1fec$exports).default,
140
- "sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($c40950a3513f1cbbb70121cc402a156f$exports).default,
141
- "sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($d6ba833b474990359bcaf23ae4062a5a$exports).default,
142
- "sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($b540c0afbb8586393249300b9d058750$exports).default,
143
- "sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($f6f532bfe6495593ae520210aedcf6ee$exports).default,
144
- "tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($b002567dfed5d0563037184fe514$exports).default,
145
- "uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($e3caa848bb758a1d3e6ca0f18ece7f4$exports).default,
146
- "zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($d24ec9fef3a39ede5b3f154080d42$exports).default,
147
- "zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($a1e968ea81ccd941358c63d78a093ff0$exports).default
148
- };
149
- const $db5f3c2f048bca5be854d051d3f2729$var$messages = new MessageDictionary($db5f3c2f048bca5be854d051d3f2729$var$intlMessages);
150
- /** Parses a color from a string value. Throws an error if the string could not be parsed. */
1
+ import {clamp as $8sEfR$clamp, toFixedNumber as $8sEfR$toFixedNumber, useControlledState as $8sEfR$useControlledState} from "@react-stately/utils";
2
+ import {MessageDictionary as $8sEfR$MessageDictionary} from "@internationalized/message";
3
+ import {NumberFormatter as $8sEfR$NumberFormatter} from "@internationalized/number";
4
+ import {useSliderState as $8sEfR$useSliderState} from "@react-stately/slider";
5
+ import {useRef as $8sEfR$useRef, useState as $8sEfR$useState, useEffect as $8sEfR$useEffect, useMemo as $8sEfR$useMemo} from "react";
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+ var $ed27c69866ff45f2$exports = {};
151
14
 
152
- export function parseColor(value) {
153
- let res = $db5f3c2f048bca5be854d051d3f2729$var$RGBColor.parse(value) || $db5f3c2f048bca5be854d051d3f2729$var$HSBColor.parse(value) || $db5f3c2f048bca5be854d051d3f2729$var$HSLColor.parse(value);
15
+ $parcel$export($ed27c69866ff45f2$exports, "parseColor", () => $ed27c69866ff45f2$export$6e865ea70d7724f);
154
16
 
155
- if (res) {
156
- return res;
157
- }
17
+ var $0374a82a32e1c8c8$exports = {};
18
+ var $f79cd856a93a8555$exports = {};
19
+ $f79cd856a93a8555$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
158
20
 
159
- throw new Error('Invalid color value: ' + value);
160
- }
161
21
 
162
- class $db5f3c2f048bca5be854d051d3f2729$var$Color {
163
- toHexInt() {
164
- return this.toFormat('rgb').toHexInt();
165
- }
22
+ var $0392c206ed1a088c$exports = {};
23
+ $0392c206ed1a088c$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
166
24
 
167
- getChannelValue(channel) {
168
- if (channel in this) {
169
- return this[channel];
170
- }
171
25
 
172
- throw new Error('Unsupported color channel: ' + channel);
173
- }
26
+ var $7d0d490f8015f125$exports = {};
27
+ $7d0d490f8015f125$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
174
28
 
175
- withChannelValue(channel, value) {
176
- if (channel in this) {
177
- let x = this.clone();
178
- x[channel] = value;
179
- return x;
180
- }
181
29
 
182
- throw new Error('Unsupported color channel: ' + channel);
183
- }
30
+ var $d10fb5e7ed22c57f$exports = {};
31
+ $d10fb5e7ed22c57f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
184
32
 
185
- getChannelName(channel, locale) {
186
- return $db5f3c2f048bca5be854d051d3f2729$var$messages.getStringForLocale(channel, locale);
187
- }
188
33
 
189
- }
34
+ var $d66a4b557c1b4b94$exports = {};
35
+ $d66a4b557c1b4b94$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
190
36
 
191
- const $db5f3c2f048bca5be854d051d3f2729$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i; // X = <negative/positive number with/without decimal places>
192
- // before/after a comma, 0 or more whitespaces are allowed
193
- // - rgb(X, X, X)
194
- // - rgba(X, X, X, X)
195
37
 
196
- const $db5f3c2f048bca5be854d051d3f2729$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
197
-
198
- class $db5f3c2f048bca5be854d051d3f2729$var$RGBColor extends $db5f3c2f048bca5be854d051d3f2729$var$Color {
199
- constructor(red, green, blue, alpha) {
200
- super();
201
- this.red = red;
202
- this.green = green;
203
- this.blue = blue;
204
- this.alpha = alpha;
205
- }
206
-
207
- static parse(value) {
208
- let m;
209
-
210
- if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HEX_REGEX)) {
211
- if (m[1]) {
212
- let r = parseInt(m[1][0] + m[1][0], 16);
213
- let g = parseInt(m[1][1] + m[1][1], 16);
214
- let b = parseInt(m[1][2] + m[1][2], 16);
215
- return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(r, g, b, 1);
216
- } else if (m[2]) {
217
- let r = parseInt(m[2][0] + m[2][1], 16);
218
- let g = parseInt(m[2][2] + m[2][3], 16);
219
- let b = parseInt(m[2][4] + m[2][5], 16);
220
- return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(r, g, b, 1);
221
- }
222
- }
223
-
224
- if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$RGB_REGEX)) {
225
- var _m$;
226
-
227
- const [r, g, b, a] = ((_m$ = m[1]) != null ? _m$ : m[2]).split(',').map(n => Number(n.trim()));
228
- return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a != null ? a : 1, 0, 1));
229
- }
230
- }
231
-
232
- toString(format) {
233
- switch (format) {
234
- case 'hex':
235
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
236
-
237
- case 'hexa':
238
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
239
-
240
- case 'rgb':
241
- return "rgb(" + this.red + ", " + this.green + ", " + this.blue + ")";
242
-
243
- case 'css':
244
- case 'rgba':
245
- return "rgba(" + this.red + ", " + this.green + ", " + this.blue + ", " + this.alpha + ")";
246
-
247
- default:
248
- return this.toFormat(format).toString(format);
249
- }
250
- }
251
-
252
- toFormat(format) {
253
- switch (format) {
254
- case 'hex':
255
- case 'hexa':
256
- case 'rgb':
257
- case 'rgba':
258
- return this;
259
-
260
- default:
261
- throw new Error('Unsupported color conversion: rgb -> ' + format);
262
- }
263
- }
264
-
265
- toHexInt() {
266
- return this.red << 16 | this.green << 8 | this.blue;
267
- }
268
-
269
- clone() {
270
- return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(this.red, this.green, this.blue, this.alpha);
271
- }
272
-
273
- getChannelRange(channel) {
274
- switch (channel) {
275
- case 'red':
276
- case 'green':
277
- case 'blue':
278
- return {
279
- minValue: 0,
280
- maxValue: 255,
281
- step: 1
282
- };
283
-
284
- case 'alpha':
285
- return {
286
- minValue: 0,
287
- maxValue: 1,
288
- step: 0.01
289
- };
290
-
291
- default:
292
- throw new Error('Unknown color channel: ' + channel);
293
- }
294
- }
295
-
296
- formatChannelValue(channel, locale) {
297
- let options;
298
- let value = this.getChannelValue(channel);
299
-
300
- switch (channel) {
301
- case 'red':
302
- case 'green':
303
- case 'blue':
304
- options = {
305
- style: 'decimal'
306
- };
307
- break;
308
-
309
- case 'alpha':
310
- options = {
311
- style: 'percent'
312
- };
313
- break;
314
-
315
- default:
316
- throw new Error('Unknown color channel: ' + channel);
317
- }
38
+ var $9b0efe1614275e13$exports = {};
39
+ $9b0efe1614275e13$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
318
40
 
319
- return new NumberFormatter(locale, options).format(value);
320
- }
321
41
 
322
- } // X = <negative/positive number with/without decimal places>
323
- // before/after a comma, 0 or more whitespaces are allowed
324
- // - hsb(X, X%, X%)
325
- // - hsba(X, X%, X%, X)
42
+ var $c150b1de62e68b51$exports = {};
43
+ $c150b1de62e68b51$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
326
44
 
327
45
 
328
- const $db5f3c2f048bca5be854d051d3f2729$var$HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
46
+ var $92da1a3ab873f3f3$exports = {};
47
+ $92da1a3ab873f3f3$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
329
48
 
330
- class $db5f3c2f048bca5be854d051d3f2729$var$HSBColor extends $db5f3c2f048bca5be854d051d3f2729$var$Color {
331
- constructor(hue, saturation, brightness, alpha) {
332
- super();
333
- this.hue = hue;
334
- this.saturation = saturation;
335
- this.brightness = brightness;
336
- this.alpha = alpha;
337
- }
338
49
 
339
- static parse(value) {
340
- let m;
50
+ var $e39eccb2d120b0b3$exports = {};
51
+ $e39eccb2d120b0b3$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
341
52
 
342
- if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HSB_REGEX)) {
343
- var _m$2;
344
53
 
345
- const [h, s, b, a] = ((_m$2 = m[1]) != null ? _m$2 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
346
- return new $db5f3c2f048bca5be854d051d3f2729$var$HSBColor($db5f3c2f048bca5be854d051d3f2729$var$mod(h, 360), clamp(s, 0, 100), clamp(b, 0, 100), clamp(a != null ? a : 1, 0, 1));
347
- }
348
- }
54
+ var $56489bc0134adb6a$exports = {};
55
+ $56489bc0134adb6a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
349
56
 
350
- toString(format) {
351
- switch (format) {
352
- case 'css':
353
- return this.toHSL().toString('css');
354
-
355
- case 'hsb':
356
- return "hsb(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%)";
357
-
358
- case 'hsba':
359
- return "hsba(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%, " + this.alpha + ")";
360
57
 
361
- default:
362
- return this.toFormat(format).toString(format);
363
- }
364
- }
58
+ var $aa6a5ed9d5efeb69$exports = {};
59
+ $aa6a5ed9d5efeb69$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
365
60
 
366
- toFormat(format) {
367
- switch (format) {
368
- case 'hsb':
369
- case 'hsba':
370
- return this;
371
61
 
372
- case 'hsl':
373
- case 'hsla':
374
- return this.toHSL();
62
+ var $51bf015ed0c73b08$exports = {};
63
+ $51bf015ed0c73b08$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
375
64
 
376
- default:
377
- throw new Error('Unsupported color conversion: hsb -> ' + format);
378
- }
379
- }
380
65
 
381
- toHSL() {
382
- // determine the lightness in the range [0,100]
383
- var l = (2 - this.saturation / 100) * this.brightness / 2; // store the HSL components
66
+ var $861b4dcde21e078b$exports = {};
67
+ $861b4dcde21e078b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
384
68
 
385
- let hue = this.hue;
386
- let saturation = this.saturation * this.brightness / (l < 50 ? l * 2 : 200 - l * 2);
387
- let lightness = l; // correct a division-by-zero error
388
69
 
389
- if (isNaN(saturation)) {
390
- saturation = 0;
391
- }
70
+ var $8b004b0c6d72513e$exports = {};
71
+ $8b004b0c6d72513e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
392
72
 
393
- return new $db5f3c2f048bca5be854d051d3f2729$var$HSLColor(hue, saturation, lightness, this.alpha);
394
- }
395
73
 
396
- clone() {
397
- return new $db5f3c2f048bca5be854d051d3f2729$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
398
- }
74
+ var $3eb66eb9579408ce$exports = {};
75
+ $3eb66eb9579408ce$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
399
76
 
400
- getChannelRange(channel) {
401
- switch (channel) {
402
- case 'hue':
403
- return {
404
- minValue: 0,
405
- maxValue: 360,
406
- step: 1
407
- };
408
77
 
409
- case 'saturation':
410
- case 'brightness':
411
- return {
412
- minValue: 0,
413
- maxValue: 100,
414
- step: 1
415
- };
78
+ var $e8a554e99056d6bd$exports = {};
79
+ $e8a554e99056d6bd$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
416
80
 
417
- case 'alpha':
418
- return {
419
- minValue: 0,
420
- maxValue: 1,
421
- step: 0.01
422
- };
423
81
 
424
- default:
425
- throw new Error('Unknown color channel: ' + channel);
426
- }
427
- }
428
-
429
- formatChannelValue(channel, locale) {
430
- let options;
431
- let value = this.getChannelValue(channel);
432
-
433
- switch (channel) {
434
- case 'hue':
435
- options = {
436
- style: 'unit',
437
- unit: 'degree',
438
- unitDisplay: 'narrow'
439
- };
440
- break;
82
+ var $c63f256bb8c038c2$exports = {};
83
+ $c63f256bb8c038c2$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
441
84
 
442
- case 'saturation':
443
- case 'brightness':
444
- options = {
445
- style: 'percent'
446
- };
447
- value /= 100;
448
- break;
449
85
 
450
- case 'alpha':
451
- options = {
452
- style: 'percent'
453
- };
454
- break;
455
-
456
- default:
457
- throw new Error('Unknown color channel: ' + channel);
458
- }
459
-
460
- return new NumberFormatter(locale, options).format(value);
461
- }
462
-
463
- } // X = <negative/positive number with/without decimal places>
464
- // before/after a comma, 0 or more whitespaces are allowed
465
- // - hsl(X, X%, X%)
466
- // - hsla(X, X%, X%, X)
86
+ var $68505ef47b1ac6a7$exports = {};
87
+ $68505ef47b1ac6a7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
467
88
 
468
89
 
469
- const $db5f3c2f048bca5be854d051d3f2729$var$HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
470
-
471
- function $db5f3c2f048bca5be854d051d3f2729$var$mod(n, m) {
472
- return (n % m + m) % m;
473
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
+ var $24cb133f20e85c27$exports = {};
91
+ $24cb133f20e85c27$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
474
92
 
475
93
 
476
- class $db5f3c2f048bca5be854d051d3f2729$var$HSLColor extends $db5f3c2f048bca5be854d051d3f2729$var$Color {
477
- constructor(hue, saturation, lightness, alpha) {
478
- super();
479
- this.hue = hue;
480
- this.saturation = saturation;
481
- this.lightness = lightness;
482
- this.alpha = alpha;
483
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
+ var $64f2745d4ddb954d$exports = {};
95
+ $64f2745d4ddb954d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
484
96
 
485
97
 
486
- static parse(value) {
487
- let m;
98
+ var $dcb8f13db15acdb8$exports = {};
99
+ $dcb8f13db15acdb8$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
488
100
 
489
- if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HSL_REGEX)) {
490
- var _m$3;
491
101
 
492
- const [h, s, l, a] = ((_m$3 = m[1]) != null ? _m$3 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
493
- return new $db5f3c2f048bca5be854d051d3f2729$var$HSLColor($db5f3c2f048bca5be854d051d3f2729$var$mod(h, 360), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a != null ? a : 1, 0, 1));
494
- }
495
- }
102
+ var $0ef596f59415b4bb$exports = {};
103
+ $0ef596f59415b4bb$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
496
104
 
497
- toString(format) {
498
- switch (format) {
499
- case 'hsl':
500
- return "hsl(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%)";
501
105
 
502
- case 'css':
503
- case 'hsla':
504
- return "hsla(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%, " + this.alpha + ")";
106
+ var $bbb5b83ca182b9e7$exports = {};
107
+ $bbb5b83ca182b9e7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
505
108
 
506
- default:
507
- return this.toFormat(format).toString(format);
508
- }
509
- }
510
109
 
511
- toFormat(format) {
512
- switch (format) {
513
- case 'hsl':
514
- case 'hsla':
515
- return this;
110
+ var $564e95b406d0dc84$exports = {};
111
+ $564e95b406d0dc84$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
516
112
 
517
- default:
518
- throw new Error('Unsupported color conversion: hsl -> ' + format);
519
- }
520
- }
521
113
 
522
- clone() {
523
- return new $db5f3c2f048bca5be854d051d3f2729$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
524
- }
114
+ var $7eb3ecd9dc0320ab$exports = {};
115
+ $7eb3ecd9dc0320ab$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
525
116
 
526
- getChannelRange(channel) {
527
- switch (channel) {
528
- case 'hue':
529
- return {
530
- minValue: 0,
531
- maxValue: 360,
532
- step: 1
533
- };
534
117
 
535
- case 'saturation':
536
- case 'lightness':
537
- return {
538
- minValue: 0,
539
- maxValue: 100,
540
- step: 1
541
- };
118
+ var $6752101738952fdb$exports = {};
119
+ $6752101738952fdb$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
542
120
 
543
- case 'alpha':
544
- return {
545
- minValue: 0,
546
- maxValue: 1,
547
- step: 0.01
548
- };
549
121
 
550
- default:
551
- throw new Error('Unknown color channel: ' + channel);
552
- }
553
- }
122
+ var $27ed00b951516a4d$exports = {};
123
+ $27ed00b951516a4d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
554
124
 
555
- formatChannelValue(channel, locale) {
556
- let options;
557
- let value = this.getChannelValue(channel);
558
125
 
559
- switch (channel) {
560
- case 'hue':
561
- options = {
562
- style: 'unit',
563
- unit: 'degree',
564
- unitDisplay: 'narrow'
565
- };
566
- break;
126
+ var $c0aa93444ae4b0ca$exports = {};
127
+ $c0aa93444ae4b0ca$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
567
128
 
568
- case 'saturation':
569
- case 'lightness':
570
- options = {
571
- style: 'percent'
572
- };
573
- value /= 100;
574
- break;
575
-
576
- case 'alpha':
577
- options = {
578
- style: 'percent'
579
- };
580
- break;
581
-
582
- default:
583
- throw new Error('Unknown color channel: ' + channel);
584
- }
585
-
586
- return new NumberFormatter(locale, options).format(value);
587
- }
588
129
 
589
- }
130
+ var $6809c66d997aaacf$exports = {};
131
+ $6809c66d997aaacf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
590
132
 
591
- function $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(v) {
592
- if (typeof v === 'string') {
593
- return parseColor(v);
594
- } else {
595
- return v;
596
- }
597
- }
598
- /**
599
- * Provides state management for a color slider component.
600
- * Color sliders allow users to adjust an individual channel of a color value.
601
- */
602
-
603
-
604
- export function useColorSliderState(props) {
605
- let {
606
- channel,
607
- value,
608
- defaultValue,
609
- onChange,
610
- locale
611
- } = props,
612
- otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["channel", "value", "defaultValue", "onChange", "locale"]);
613
-
614
- if (value == null && defaultValue == null) {
615
- throw new Error('useColorSliderState requires a value or defaultValue');
616
- }
617
-
618
- let [color, setColor] = useControlledState(value && $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(value), defaultValue && $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(defaultValue), onChange);
619
- let sliderState = useSliderState(_babelRuntimeHelpersEsmExtends({}, color.getChannelRange(channel), otherProps, {
620
- // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
621
- numberFormatter: null,
622
- value: [color.getChannelValue(channel)],
623
-
624
- onChange(_ref) {
625
- let [v] = _ref;
626
- setColor(color.withChannelValue(channel, v));
627
- },
628
-
629
- onChangeEnd(_ref2) {
630
- let [v] = _ref2;
631
-
632
- // onChange will have already been called with the right value, this is just to trigger onChangEnd
633
- if (props.onChangeEnd) {
634
- props.onChangeEnd(color.withChannelValue(channel, v));
635
- }
636
- }
637
-
638
- }));
639
- return _babelRuntimeHelpersEsmExtends({}, sliderState, {
640
- value: color,
641
-
642
- setValue(value) {
643
- setColor($dfa319d4be3239bcd232b84e0e071$var$normalizeColor(value));
644
- },
645
-
646
- getDisplayColor() {
647
- switch (channel) {
648
- case 'hue':
649
- return parseColor("hsl(" + color.getChannelValue('hue') + ", 100%, 50%)");
650
-
651
- case 'lightness':
652
- case 'brightness':
653
- case 'saturation':
654
- case 'red':
655
- case 'green':
656
- case 'blue':
657
- return color.withChannelValue('alpha', 1);
658
-
659
- case 'alpha':
660
- {
661
- return color;
662
- }
663
-
664
- default:
665
- throw new Error('Unknown color channel: ' + channel);
666
- }
667
- },
668
-
669
- getThumbValueLabel() {
670
- return color.formatChannelValue(channel, locale);
671
- }
672
-
673
- });
674
- }
675
133
 
676
- function $a54bad0097d5f20f12ac194ac13764$var$normalizeColor(v) {
677
- if (typeof v === 'string') {
678
- return parseColor(v);
679
- } else {
680
- return v;
681
- }
682
- }
134
+ var $77839a6d0a465311$exports = {};
135
+ $77839a6d0a465311$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
683
136
 
684
- const $a54bad0097d5f20f12ac194ac13764$var$DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');
685
137
 
686
- function $a54bad0097d5f20f12ac194ac13764$var$roundToStep(value, step) {
687
- return Math.round(value / step) * step;
688
- }
138
+ var $5eb08cf4653400f5$exports = {};
139
+ $5eb08cf4653400f5$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
689
140
 
690
- function $a54bad0097d5f20f12ac194ac13764$var$mod(n, m) {
691
- return (n % m + m) % m;
692
- }
693
141
 
694
- function $a54bad0097d5f20f12ac194ac13764$var$roundDown(v) {
695
- let r = Math.floor(v);
142
+ var $96079736d8339dc2$exports = {};
143
+ $96079736d8339dc2$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
696
144
 
697
- if (r === v) {
698
- return v - 1;
699
- } else {
700
- return r;
701
- }
702
- }
703
145
 
704
- function $a54bad0097d5f20f12ac194ac13764$var$degToRad(deg) {
705
- return deg * Math.PI / 180;
706
- }
146
+ var $a1df1831dafc647a$exports = {};
147
+ $a1df1831dafc647a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
707
148
 
708
- function $a54bad0097d5f20f12ac194ac13764$var$radToDeg(rad) {
709
- return rad * 180 / Math.PI;
710
- } // 0deg = 3 o'clock. increases clockwise
711
149
 
150
+ var $28a02b1bdcc0138a$exports = {};
151
+ $28a02b1bdcc0138a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
712
152
 
713
- function $a54bad0097d5f20f12ac194ac13764$var$angleToCartesian(angle, radius) {
714
- let rad = $a54bad0097d5f20f12ac194ac13764$var$degToRad(360 - angle + 90);
715
- let x = Math.sin(rad) * radius;
716
- let y = Math.cos(rad) * radius;
717
- return {
718
- x,
719
- y
720
- };
721
- }
722
153
 
723
- function $a54bad0097d5f20f12ac194ac13764$var$cartesianToAngle(x, y, radius) {
724
- let deg = $a54bad0097d5f20f12ac194ac13764$var$radToDeg(Math.atan2(y / radius, x / radius));
725
- return (deg + 360) % 360;
726
- }
727
- /**
728
- * Provides state management for a color wheel component.
729
- * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
730
- */
731
-
732
-
733
- export function useColorWheelState(props) {
734
- let {
735
- defaultValue,
736
- onChange,
737
- onChangeEnd,
738
- step = 1
739
- } = props;
740
-
741
- if (!props.value && !defaultValue) {
742
- defaultValue = $a54bad0097d5f20f12ac194ac13764$var$DEFAULT_COLOR;
743
- }
744
-
745
- let [value, setValue] = useControlledState($a54bad0097d5f20f12ac194ac13764$var$normalizeColor(props.value), $a54bad0097d5f20f12ac194ac13764$var$normalizeColor(defaultValue), onChange);
746
- let valueRef = useRef(value);
747
- valueRef.current = value;
748
- let [isDragging, setDragging] = useState(false);
749
- let hue = value.getChannelValue('hue');
750
-
751
- function setHue(v) {
752
- if (v > 360) {
753
- // Make sure you can always get back to 0.
754
- v = 0;
755
- }
756
-
757
- v = $a54bad0097d5f20f12ac194ac13764$var$roundToStep($a54bad0097d5f20f12ac194ac13764$var$mod(v, 360), step);
758
-
759
- if (hue !== v) {
760
- setValue(value.withChannelValue('hue', v));
761
- }
762
- }
763
-
764
- return {
765
- value,
766
-
767
- setValue(v) {
768
- let color = $a54bad0097d5f20f12ac194ac13764$var$normalizeColor(v);
769
- valueRef.current = color;
770
- setValue(color);
771
- },
772
-
773
- hue,
774
- setHue,
775
-
776
- setHueFromPoint(x, y, radius) {
777
- setHue($a54bad0097d5f20f12ac194ac13764$var$cartesianToAngle(x, y, radius));
778
- },
779
-
780
- getThumbPosition(radius) {
781
- return $a54bad0097d5f20f12ac194ac13764$var$angleToCartesian(value.getChannelValue('hue'), radius);
782
- },
783
-
784
- increment(minStepSize) {
785
- if (minStepSize === void 0) {
786
- minStepSize = 0;
787
- }
788
-
789
- let newValue = hue + Math.max(minStepSize, step);
790
-
791
- if (newValue > 360) {
792
- // Make sure you can always get back to 0.
793
- newValue = 0;
794
- }
795
-
796
- setHue(newValue);
797
- },
798
-
799
- decrement(minStepSize) {
800
- if (minStepSize === void 0) {
801
- minStepSize = 0;
802
- }
803
-
804
- let s = Math.max(minStepSize, step);
805
-
806
- if (hue === 0) {
807
- // We can't just subtract step because this might be the case:
808
- // |(previous step) - 0| < step size
809
- setHue($a54bad0097d5f20f12ac194ac13764$var$roundDown(360 / s) * s);
810
- } else {
811
- setHue(hue - s);
812
- }
813
- },
814
-
815
- setDragging(isDragging) {
816
- setDragging(wasDragging => {
817
- if (onChangeEnd && !isDragging && wasDragging) {
818
- onChangeEnd(valueRef.current);
819
- }
154
+ $0374a82a32e1c8c8$exports = {
155
+ "ar-AE": $f79cd856a93a8555$exports,
156
+ "bg-BG": $0392c206ed1a088c$exports,
157
+ "cs-CZ": $7d0d490f8015f125$exports,
158
+ "da-DK": $d10fb5e7ed22c57f$exports,
159
+ "de-DE": $d66a4b557c1b4b94$exports,
160
+ "el-GR": $9b0efe1614275e13$exports,
161
+ "en-US": $c150b1de62e68b51$exports,
162
+ "es-ES": $92da1a3ab873f3f3$exports,
163
+ "et-EE": $e39eccb2d120b0b3$exports,
164
+ "fi-FI": $56489bc0134adb6a$exports,
165
+ "fr-FR": $aa6a5ed9d5efeb69$exports,
166
+ "he-IL": $51bf015ed0c73b08$exports,
167
+ "hr-HR": $861b4dcde21e078b$exports,
168
+ "hu-HU": $8b004b0c6d72513e$exports,
169
+ "it-IT": $3eb66eb9579408ce$exports,
170
+ "ja-JP": $e8a554e99056d6bd$exports,
171
+ "ko-KR": $c63f256bb8c038c2$exports,
172
+ "lt-LT": $68505ef47b1ac6a7$exports,
173
+ "lv-LV": $24cb133f20e85c27$exports,
174
+ "nb-NO": $64f2745d4ddb954d$exports,
175
+ "nl-NL": $dcb8f13db15acdb8$exports,
176
+ "pl-PL": $0ef596f59415b4bb$exports,
177
+ "pt-BR": $bbb5b83ca182b9e7$exports,
178
+ "pt-PT": $564e95b406d0dc84$exports,
179
+ "ro-RO": $7eb3ecd9dc0320ab$exports,
180
+ "ru-RU": $6752101738952fdb$exports,
181
+ "sk-SK": $27ed00b951516a4d$exports,
182
+ "sl-SI": $c0aa93444ae4b0ca$exports,
183
+ "sr-SP": $6809c66d997aaacf$exports,
184
+ "sv-SE": $77839a6d0a465311$exports,
185
+ "tr-TR": $5eb08cf4653400f5$exports,
186
+ "uk-UA": $96079736d8339dc2$exports,
187
+ "zh-CN": $a1df1831dafc647a$exports,
188
+ "zh-TW": $28a02b1bdcc0138a$exports
189
+ };
820
190
 
821
- return isDragging;
822
- });
823
- },
824
191
 
825
- isDragging,
826
192
 
827
- getDisplayColor() {
828
- return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
829
- }
830
193
 
831
- };
194
+ const $ed27c69866ff45f2$var$messages = new $8sEfR$MessageDictionary((/*@__PURE__*/$parcel$interopDefault($0374a82a32e1c8c8$exports)));
195
+ function $ed27c69866ff45f2$export$6e865ea70d7724f(value) {
196
+ let res = $ed27c69866ff45f2$var$RGBColor.parse(value) || $ed27c69866ff45f2$var$HSBColor.parse(value) || $ed27c69866ff45f2$var$HSLColor.parse(value);
197
+ if (res) return res;
198
+ throw new Error('Invalid color value: ' + value);
832
199
  }
833
-
834
- function $a8b4ca293b41af7f07c8a5216dae5f3$export$useColor(value) {
835
- return useMemo(() => {
836
- if (typeof value === 'string') {
837
- try {
838
- return parseColor(value);
839
- } catch (err) {
840
- return undefined;
841
- }
200
+ class $ed27c69866ff45f2$var$Color {
201
+ toHexInt() {
202
+ return this.toFormat('rgb').toHexInt();
203
+ }
204
+ getChannelValue(channel) {
205
+ if (channel in this) return this[channel];
206
+ throw new Error('Unsupported color channel: ' + channel);
207
+ }
208
+ withChannelValue(channel, value) {
209
+ if (channel in this) {
210
+ let x = this.clone();
211
+ x[channel] = value;
212
+ return x;
213
+ }
214
+ throw new Error('Unsupported color channel: ' + channel);
215
+ }
216
+ getChannelName(channel, locale) {
217
+ return $ed27c69866ff45f2$var$messages.getStringForLocale(channel, locale);
842
218
  }
843
-
844
- return value;
845
- }, [value]);
846
219
  }
847
-
848
- const $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR = parseColor('#000000');
849
- const $f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR = parseColor('#FFFFFF');
850
- const $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR_INT = $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR.toHexInt();
851
- const $f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR_INT = $f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR.toHexInt();
852
- /**
853
- * Provides state management for a color field component. Color fields allow
854
- * users to enter and adjust a hex color value.
855
- */
856
-
857
- export function useColorFieldState(props) {
858
- let {
859
- step = 1,
860
- value,
861
- defaultValue,
862
- onChange
863
- } = props;
864
- let initialValue = $a8b4ca293b41af7f07c8a5216dae5f3$export$useColor(value);
865
- let initialDefaultValue = $a8b4ca293b41af7f07c8a5216dae5f3$export$useColor(defaultValue);
866
- let [colorValue, setColorValue] = useControlledState(initialValue, initialDefaultValue, onChange);
867
- let [inputValue, setInputValue] = useState(() => (value || defaultValue) && colorValue ? colorValue.toString('hex') : '');
868
-
869
- let safelySetColorValue = newColor => {
870
- if (typeof newColor === 'function') {
871
- setColorValue(prev => {
872
- let resolved = newColor(prev);
873
-
874
- if (!prev || !resolved) {
875
- return resolved;
220
+ const $ed27c69866ff45f2$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
221
+ // X = <negative/positive number with/without decimal places>
222
+ // before/after a comma, 0 or more whitespaces are allowed
223
+ // - rgb(X, X, X)
224
+ // - rgba(X, X, X, X)
225
+ const $ed27c69866ff45f2$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
226
+ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
227
+ static parse(value) {
228
+ let m;
229
+ if (m = value.match($ed27c69866ff45f2$var$HEX_REGEX)) {
230
+ if (m[1]) {
231
+ let r = parseInt(m[1][0] + m[1][0], 16);
232
+ let g = parseInt(m[1][1] + m[1][1], 16);
233
+ let b = parseInt(m[1][2] + m[1][2], 16);
234
+ return new $ed27c69866ff45f2$var$RGBColor(r, g, b, 1);
235
+ } else if (m[2]) {
236
+ let r = parseInt(m[2][0] + m[2][1], 16);
237
+ let g = parseInt(m[2][2] + m[2][3], 16);
238
+ let b = parseInt(m[2][4] + m[2][5], 16);
239
+ return new $ed27c69866ff45f2$var$RGBColor(r, g, b, 1);
240
+ }
876
241
  }
877
-
878
- if (resolved.toHexInt() !== prev.toHexInt()) {
879
- return resolved;
242
+ if (m = value.match($ed27c69866ff45f2$var$RGB_REGEX)) {
243
+ var ref;
244
+ const [r, g, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim())
245
+ );
246
+ return new $ed27c69866ff45f2$var$RGBColor($8sEfR$clamp(r, 0, 255), $8sEfR$clamp(g, 0, 255), $8sEfR$clamp(b, 0, 255), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
880
247
  }
881
-
882
- return prev;
883
- });
884
- return;
885
248
  }
886
-
887
- if (!colorValue || !newColor) {
888
- setColorValue(newColor);
889
- return;
249
+ toString(format) {
250
+ switch(format){
251
+ case 'hex':
252
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
253
+ case 'hexa':
254
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
255
+ case 'rgb':
256
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
257
+ case 'css':
258
+ case 'rgba':
259
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
260
+ default:
261
+ return this.toFormat(format).toString(format);
262
+ }
890
263
  }
891
-
892
- if (newColor.toHexInt() !== colorValue.toHexInt()) {
893
- setColorValue(newColor);
894
- return;
264
+ toFormat(format) {
265
+ switch(format){
266
+ case 'hex':
267
+ case 'hexa':
268
+ case 'rgb':
269
+ case 'rgba':
270
+ return this;
271
+ case 'hsb':
272
+ case 'hsba':
273
+ return this.toHSB();
274
+ case 'hsl':
275
+ case 'hsla':
276
+ return this.toHSL();
277
+ default:
278
+ throw new Error('Unsupported color conversion: rgb -> ' + format);
279
+ }
280
+ }
281
+ toHexInt() {
282
+ return this.red << 16 | this.green << 8 | this.blue;
283
+ }
284
+ /**
285
+ * Converts an RGB color value to HSB.
286
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
287
+ * @returns An HSBColor object.
288
+ */ toHSB() {
289
+ const red = this.red / 255;
290
+ const green = this.green / 255;
291
+ const blue = this.blue / 255;
292
+ const min = Math.min(red, green, blue);
293
+ const brightness = Math.max(red, green, blue);
294
+ const chroma = brightness - min;
295
+ const saturation = brightness === 0 ? 0 : chroma / brightness;
296
+ let hue = 0; // achromatic
297
+ if (chroma !== 0) {
298
+ switch(brightness){
299
+ case red:
300
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
301
+ break;
302
+ case green:
303
+ hue = (blue - red) / chroma + 2;
304
+ break;
305
+ case blue:
306
+ hue = (red - green) / chroma + 4;
307
+ break;
308
+ }
309
+ hue /= 6;
310
+ }
311
+ return new $ed27c69866ff45f2$var$HSBColor($8sEfR$toFixedNumber(hue * 360, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(brightness * 100, 2), this.alpha);
312
+ }
313
+ /**
314
+ * Converts an RGB color value to HSL.
315
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
316
+ * @returns An HSLColor object.
317
+ */ toHSL() {
318
+ const red = this.red / 255;
319
+ const green = this.green / 255;
320
+ const blue = this.blue / 255;
321
+ const min = Math.min(red, green, blue);
322
+ const max = Math.max(red, green, blue);
323
+ const lightness = (max + min) / 2;
324
+ const chroma = max - min;
325
+ let hue;
326
+ let saturation;
327
+ if (chroma === 0) hue = saturation = 0; // achromatic
328
+ else {
329
+ saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
330
+ switch(max){
331
+ case red:
332
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
333
+ break;
334
+ case green:
335
+ hue = (blue - red) / chroma + 2;
336
+ break;
337
+ case blue:
338
+ hue = (red - green) / chroma + 4;
339
+ break;
340
+ }
341
+ hue /= 6;
342
+ }
343
+ return new $ed27c69866ff45f2$var$HSLColor($8sEfR$toFixedNumber(hue * 360, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(lightness * 100, 2), this.alpha);
344
+ }
345
+ clone() {
346
+ return new $ed27c69866ff45f2$var$RGBColor(this.red, this.green, this.blue, this.alpha);
347
+ }
348
+ getChannelRange(channel) {
349
+ switch(channel){
350
+ case 'red':
351
+ case 'green':
352
+ case 'blue':
353
+ return {
354
+ minValue: 0,
355
+ maxValue: 255,
356
+ step: 1
357
+ };
358
+ case 'alpha':
359
+ return {
360
+ minValue: 0,
361
+ maxValue: 1,
362
+ step: 0.01
363
+ };
364
+ default:
365
+ throw new Error('Unknown color channel: ' + channel);
366
+ }
367
+ }
368
+ formatChannelValue(channel, locale) {
369
+ let options;
370
+ let value = this.getChannelValue(channel);
371
+ switch(channel){
372
+ case 'red':
373
+ case 'green':
374
+ case 'blue':
375
+ options = {
376
+ style: 'decimal'
377
+ };
378
+ break;
379
+ case 'alpha':
380
+ options = {
381
+ style: 'percent'
382
+ };
383
+ break;
384
+ default:
385
+ throw new Error('Unknown color channel: ' + channel);
386
+ }
387
+ return new $8sEfR$NumberFormatter(locale, options).format(value);
388
+ }
389
+ getColorSpace() {
390
+ return 'rgb';
391
+ }
392
+ constructor(red, green, blue, alpha){
393
+ super();
394
+ this.red = red;
395
+ this.green = green;
396
+ this.blue = blue;
397
+ this.alpha = alpha;
398
+ }
399
+ }
400
+ // X = <negative/positive number with/without decimal places>
401
+ // before/after a comma, 0 or more whitespaces are allowed
402
+ // - hsb(X, X%, X%)
403
+ // - hsba(X, X%, X%, X)
404
+ const $ed27c69866ff45f2$var$HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
405
+ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
406
+ static parse(value) {
407
+ let m;
408
+ if (m = value.match($ed27c69866ff45f2$var$HSB_REGEX)) {
409
+ var ref;
410
+ const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
411
+ );
412
+ return new $ed27c69866ff45f2$var$HSBColor($ed27c69866ff45f2$var$mod(h, 360), $8sEfR$clamp(s, 0, 100), $8sEfR$clamp(b, 0, 100), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
413
+ }
414
+ }
415
+ toString(format) {
416
+ switch(format){
417
+ case 'css':
418
+ return this.toHSL().toString('css');
419
+ case 'hex':
420
+ return this.toRGB().toString('hex');
421
+ case 'hexa':
422
+ return this.toRGB().toString('hexa');
423
+ case 'hsb':
424
+ return `hsb(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.brightness, 2)}%)`;
425
+ case 'hsba':
426
+ return `hsba(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
427
+ default:
428
+ return this.toFormat(format).toString(format);
429
+ }
430
+ }
431
+ toFormat(format) {
432
+ switch(format){
433
+ case 'hsb':
434
+ case 'hsba':
435
+ return this;
436
+ case 'hsl':
437
+ case 'hsla':
438
+ return this.toHSL();
439
+ case 'rgb':
440
+ case 'rgba':
441
+ return this.toRGB();
442
+ default:
443
+ throw new Error('Unsupported color conversion: hsb -> ' + format);
444
+ }
445
+ }
446
+ /**
447
+ * Converts a HSB color to HSL.
448
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
449
+ * @returns An HSLColor object.
450
+ */ toHSL() {
451
+ let saturation = this.saturation / 100;
452
+ let brightness = this.brightness / 100;
453
+ let lightness = brightness * (1 - saturation / 2);
454
+ saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
455
+ return new $ed27c69866ff45f2$var$HSLColor($8sEfR$toFixedNumber(this.hue, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(lightness * 100, 2), this.alpha);
456
+ }
457
+ /**
458
+ * Converts a HSV color value to RGB.
459
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
460
+ * @returns An RGBColor object.
461
+ */ toRGB() {
462
+ let hue = this.hue;
463
+ let saturation = this.saturation / 100;
464
+ let brightness = this.brightness / 100;
465
+ let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
466
+ ;
467
+ return new $ed27c69866ff45f2$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
468
+ }
469
+ clone() {
470
+ return new $ed27c69866ff45f2$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
471
+ }
472
+ getChannelRange(channel) {
473
+ switch(channel){
474
+ case 'hue':
475
+ return {
476
+ minValue: 0,
477
+ maxValue: 360,
478
+ step: 1
479
+ };
480
+ case 'saturation':
481
+ case 'brightness':
482
+ return {
483
+ minValue: 0,
484
+ maxValue: 100,
485
+ step: 1
486
+ };
487
+ case 'alpha':
488
+ return {
489
+ minValue: 0,
490
+ maxValue: 1,
491
+ step: 0.01
492
+ };
493
+ default:
494
+ throw new Error('Unknown color channel: ' + channel);
495
+ }
496
+ }
497
+ formatChannelValue(channel, locale) {
498
+ let options;
499
+ let value = this.getChannelValue(channel);
500
+ switch(channel){
501
+ case 'hue':
502
+ options = {
503
+ style: 'unit',
504
+ unit: 'degree',
505
+ unitDisplay: 'narrow'
506
+ };
507
+ break;
508
+ case 'saturation':
509
+ case 'brightness':
510
+ options = {
511
+ style: 'percent'
512
+ };
513
+ value /= 100;
514
+ break;
515
+ case 'alpha':
516
+ options = {
517
+ style: 'percent'
518
+ };
519
+ break;
520
+ default:
521
+ throw new Error('Unknown color channel: ' + channel);
522
+ }
523
+ return new $8sEfR$NumberFormatter(locale, options).format(value);
524
+ }
525
+ getColorSpace() {
526
+ return 'hsb';
527
+ }
528
+ constructor(hue, saturation, brightness, alpha){
529
+ super();
530
+ this.hue = hue;
531
+ this.saturation = saturation;
532
+ this.brightness = brightness;
533
+ this.alpha = alpha;
534
+ }
535
+ }
536
+ // X = <negative/positive number with/without decimal places>
537
+ // before/after a comma, 0 or more whitespaces are allowed
538
+ // - hsl(X, X%, X%)
539
+ // - hsla(X, X%, X%, X)
540
+ const $ed27c69866ff45f2$var$HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
541
+ function $ed27c69866ff45f2$var$mod(n, m) {
542
+ return (n % m + m) % m;
543
+ }
544
+ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
545
+ static parse(value) {
546
+ let m;
547
+ if (m = value.match($ed27c69866ff45f2$var$HSL_REGEX)) {
548
+ var ref;
549
+ const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
550
+ );
551
+ return new $ed27c69866ff45f2$var$HSLColor($ed27c69866ff45f2$var$mod(h, 360), $8sEfR$clamp(s, 0, 100), $8sEfR$clamp(l, 0, 100), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
552
+ }
553
+ }
554
+ toString(format) {
555
+ switch(format){
556
+ case 'hex':
557
+ return this.toRGB().toString('hex');
558
+ case 'hexa':
559
+ return this.toRGB().toString('hexa');
560
+ case 'hsl':
561
+ return `hsl(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.lightness, 2)}%)`;
562
+ case 'css':
563
+ case 'hsla':
564
+ return `hsla(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
565
+ default:
566
+ return this.toFormat(format).toString(format);
567
+ }
568
+ }
569
+ toFormat(format) {
570
+ switch(format){
571
+ case 'hsl':
572
+ case 'hsla':
573
+ return this;
574
+ case 'hsb':
575
+ case 'hsba':
576
+ return this.toHSB();
577
+ case 'rgb':
578
+ case 'rgba':
579
+ return this.toRGB();
580
+ default:
581
+ throw new Error('Unsupported color conversion: hsl -> ' + format);
582
+ }
583
+ }
584
+ /**
585
+ * Converts a HSL color to HSB.
586
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
587
+ * @returns An HSBColor object.
588
+ */ toHSB() {
589
+ let saturation = this.saturation / 100;
590
+ let lightness = this.lightness / 100;
591
+ let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
592
+ saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
593
+ return new $ed27c69866ff45f2$var$HSBColor($8sEfR$toFixedNumber(this.hue, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(brightness * 100, 2), this.alpha);
594
+ }
595
+ /**
596
+ * Converts a HSL color to RGB.
597
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
598
+ * @returns An RGBColor object.
599
+ */ toRGB() {
600
+ let hue = this.hue;
601
+ let saturation = this.saturation / 100;
602
+ let lightness = this.lightness / 100;
603
+ let a = saturation * Math.min(lightness, 1 - lightness);
604
+ let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
605
+ ;
606
+ return new $ed27c69866ff45f2$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
607
+ }
608
+ clone() {
609
+ return new $ed27c69866ff45f2$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
610
+ }
611
+ getChannelRange(channel) {
612
+ switch(channel){
613
+ case 'hue':
614
+ return {
615
+ minValue: 0,
616
+ maxValue: 360,
617
+ step: 1
618
+ };
619
+ case 'saturation':
620
+ case 'lightness':
621
+ return {
622
+ minValue: 0,
623
+ maxValue: 100,
624
+ step: 1
625
+ };
626
+ case 'alpha':
627
+ return {
628
+ minValue: 0,
629
+ maxValue: 1,
630
+ step: 0.01
631
+ };
632
+ default:
633
+ throw new Error('Unknown color channel: ' + channel);
634
+ }
635
+ }
636
+ formatChannelValue(channel, locale) {
637
+ let options;
638
+ let value = this.getChannelValue(channel);
639
+ switch(channel){
640
+ case 'hue':
641
+ options = {
642
+ style: 'unit',
643
+ unit: 'degree',
644
+ unitDisplay: 'narrow'
645
+ };
646
+ break;
647
+ case 'saturation':
648
+ case 'lightness':
649
+ options = {
650
+ style: 'percent'
651
+ };
652
+ value /= 100;
653
+ break;
654
+ case 'alpha':
655
+ options = {
656
+ style: 'percent'
657
+ };
658
+ break;
659
+ default:
660
+ throw new Error('Unknown color channel: ' + channel);
661
+ }
662
+ return new $8sEfR$NumberFormatter(locale, options).format(value);
663
+ }
664
+ getColorSpace() {
665
+ return 'hsl';
666
+ }
667
+ constructor(hue, saturation, lightness, alpha){
668
+ super();
669
+ this.hue = hue;
670
+ this.saturation = saturation;
671
+ this.lightness = lightness;
672
+ this.alpha = alpha;
895
673
  }
896
- };
674
+ }
897
675
 
898
- useEffect(() => {
899
- setInputValue(colorValue ? colorValue.toString('hex') : '');
900
- }, [colorValue, setInputValue]);
901
- let parsedValue = useMemo(() => {
902
- let color;
903
676
 
904
- try {
905
- color = parseColor(inputValue.startsWith('#') ? inputValue : "#" + inputValue);
906
- } catch (err) {
907
- color = null;
908
- }
677
+ var $3d60b153dd2f1b1b$exports = {};
909
678
 
910
- return color;
911
- }, [parseColor, inputValue]);
912
- let parsed = useRef(null);
913
- parsed.current = parsedValue;
679
+ $parcel$export($3d60b153dd2f1b1b$exports, "useColorSliderState", () => $3d60b153dd2f1b1b$export$57bc203e1c9c6d44);
914
680
 
915
- let commit = () => {
916
- // Set to empty state if input value is empty
917
- if (!inputValue.length) {
918
- safelySetColorValue(null);
919
- setInputValue(value === undefined ? '' : colorValue.toString('hex'));
920
- return;
921
- } // if it failed to parse, then reset input to formatted version of current number
922
681
 
923
682
 
924
- if (parsed.current == null) {
925
- setInputValue(colorValue ? colorValue.toString('hex') : '');
926
- return;
927
- }
683
+ function $3d60b153dd2f1b1b$var$normalizeColor(v) {
684
+ if (typeof v === 'string') return $ed27c69866ff45f2$export$6e865ea70d7724f(v);
685
+ else return v;
686
+ }
687
+ function $3d60b153dd2f1b1b$export$57bc203e1c9c6d44(props) {
688
+ let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
689
+ if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
690
+ let [color, setColor] = $8sEfR$useControlledState(value1 && $3d60b153dd2f1b1b$var$normalizeColor(value1), defaultValue && $3d60b153dd2f1b1b$var$normalizeColor(defaultValue), onChange);
691
+ let sliderState = $8sEfR$useSliderState({
692
+ ...color.getChannelRange(channel),
693
+ ...otherProps,
694
+ // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
695
+ numberFormatter: null,
696
+ value: [
697
+ color.getChannelValue(channel)
698
+ ],
699
+ onChange ([v]) {
700
+ setColor(color.withChannelValue(channel, v));
701
+ },
702
+ onChangeEnd ([v]) {
703
+ // onChange will have already been called with the right value, this is just to trigger onChangEnd
704
+ if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
705
+ }
706
+ });
707
+ return {
708
+ ...sliderState,
709
+ value: color,
710
+ setValue (value) {
711
+ setColor($3d60b153dd2f1b1b$var$normalizeColor(value));
712
+ },
713
+ getDisplayColor () {
714
+ switch(channel){
715
+ case 'hue':
716
+ return $ed27c69866ff45f2$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
717
+ case 'lightness':
718
+ case 'brightness':
719
+ case 'saturation':
720
+ case 'red':
721
+ case 'green':
722
+ case 'blue':
723
+ return color.withChannelValue('alpha', 1);
724
+ case 'alpha':
725
+ return color;
726
+ default:
727
+ throw new Error('Unknown color channel: ' + channel);
728
+ }
729
+ },
730
+ getThumbValueLabel () {
731
+ return color.formatChannelValue(channel, locale);
732
+ }
733
+ };
734
+ }
928
735
 
929
- safelySetColorValue(parsed.current); // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
930
736
 
931
- let newColorValue = '';
737
+ var $2b492d761166c9cc$exports = {};
932
738
 
933
- if (colorValue) {
934
- newColorValue = colorValue.toString('hex');
935
- }
739
+ $parcel$export($2b492d761166c9cc$exports, "useColorWheelState", () => $2b492d761166c9cc$export$f4301076d9336137);
936
740
 
937
- setInputValue(newColorValue);
938
- };
939
741
 
940
- let increment = () => {
941
- safelySetColorValue(prevColor => {
942
- let newValue = $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(parsed.current, step); // if we've arrived at the same value that was previously in the state, the
943
- // input value should be updated to match
944
- // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
945
- // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
946
742
 
947
- if (newValue === prevColor) {
948
- setInputValue(newValue.toString('hex'));
949
- }
743
+ function $2b492d761166c9cc$var$normalizeColor(v) {
744
+ if (typeof v === 'string') return $ed27c69866ff45f2$export$6e865ea70d7724f(v);
745
+ else return v;
746
+ }
747
+ const $2b492d761166c9cc$var$DEFAULT_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
748
+ function $2b492d761166c9cc$var$roundToStep(value, step) {
749
+ return Math.round(value / step) * step;
750
+ }
751
+ function $2b492d761166c9cc$var$mod(n, m) {
752
+ return (n % m + m) % m;
753
+ }
754
+ function $2b492d761166c9cc$var$roundDown(v) {
755
+ let r = Math.floor(v);
756
+ if (r === v) return v - 1;
757
+ else return r;
758
+ }
759
+ function $2b492d761166c9cc$var$degToRad(deg) {
760
+ return deg * Math.PI / 180;
761
+ }
762
+ function $2b492d761166c9cc$var$radToDeg(rad) {
763
+ return rad * 180 / Math.PI;
764
+ }
765
+ // 0deg = 3 o'clock. increases clockwise
766
+ function $2b492d761166c9cc$var$angleToCartesian(angle, radius) {
767
+ let rad = $2b492d761166c9cc$var$degToRad(360 - angle + 90);
768
+ let x = Math.sin(rad) * radius;
769
+ let y = Math.cos(rad) * radius;
770
+ return {
771
+ x: x,
772
+ y: y
773
+ };
774
+ }
775
+ function $2b492d761166c9cc$var$cartesianToAngle(x, y, radius) {
776
+ let deg = $2b492d761166c9cc$var$radToDeg(Math.atan2(y / radius, x / radius));
777
+ return (deg + 360) % 360;
778
+ }
779
+ function $2b492d761166c9cc$export$f4301076d9336137(props) {
780
+ let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd , step: step = 1 } = props;
781
+ if (!props.value && !defaultValue) defaultValue = $2b492d761166c9cc$var$DEFAULT_COLOR;
782
+ let [value, setValue] = $8sEfR$useControlledState($2b492d761166c9cc$var$normalizeColor(props.value), $2b492d761166c9cc$var$normalizeColor(defaultValue), onChange);
783
+ let valueRef = $8sEfR$useRef(value);
784
+ valueRef.current = value;
785
+ let [isDragging1, setDragging] = $8sEfR$useState(false);
786
+ let isDraggingRef = $8sEfR$useRef(false).current;
787
+ let hue = value.getChannelValue('hue');
788
+ function setHue(v) {
789
+ if (v > 360) // Make sure you can always get back to 0.
790
+ v = 0;
791
+ v = $2b492d761166c9cc$var$roundToStep($2b492d761166c9cc$var$mod(v, 360), step);
792
+ if (hue !== v) {
793
+ let color = value.withChannelValue('hue', v);
794
+ valueRef.current = color;
795
+ setValue(color);
796
+ }
797
+ }
798
+ return {
799
+ value: value,
800
+ setValue (v) {
801
+ let color = $2b492d761166c9cc$var$normalizeColor(v);
802
+ valueRef.current = color;
803
+ setValue(color);
804
+ },
805
+ hue: hue,
806
+ setHue: setHue,
807
+ setHueFromPoint (x, y, radius) {
808
+ setHue($2b492d761166c9cc$var$cartesianToAngle(x, y, radius));
809
+ },
810
+ getThumbPosition (radius) {
811
+ return $2b492d761166c9cc$var$angleToCartesian(value.getChannelValue('hue'), radius);
812
+ },
813
+ increment (minStepSize = 0) {
814
+ let newValue = hue + Math.max(minStepSize, step);
815
+ if (newValue > 360) // Make sure you can always get back to 0.
816
+ newValue = 0;
817
+ setHue(newValue);
818
+ },
819
+ decrement (minStepSize = 0) {
820
+ let s = Math.max(minStepSize, step);
821
+ if (hue === 0) // We can't just subtract step because this might be the case:
822
+ // |(previous step) - 0| < step size
823
+ setHue($2b492d761166c9cc$var$roundDown(360 / s) * s);
824
+ else setHue(hue - s);
825
+ },
826
+ setDragging (isDragging) {
827
+ let wasDragging = isDraggingRef;
828
+ isDraggingRef = isDragging;
829
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
830
+ setDragging(isDragging);
831
+ },
832
+ isDragging: isDragging1,
833
+ getDisplayColor () {
834
+ return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
835
+ }
836
+ };
837
+ }
950
838
 
951
- return newValue;
952
- });
953
- };
954
839
 
955
- let decrement = () => {
956
- safelySetColorValue(prevColor => {
957
- let newValue = $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(parsed.current, -step); // if we've arrived at the same value that was previously in the state, the
958
- // input value should be updated to match
959
- // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
960
- // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
840
+ var $8c33114d2dc9460c$exports = {};
961
841
 
962
- if (newValue === prevColor) {
963
- setInputValue(newValue.toString('hex'));
964
- }
842
+ $parcel$export($8c33114d2dc9460c$exports, "useColorFieldState", () => $8c33114d2dc9460c$export$d52a01683abdfcd6);
965
843
 
966
- return newValue;
967
- });
968
- };
969
844
 
970
- let incrementToMax = () => safelySetColorValue($f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR);
971
845
 
972
- let decrementToMin = () => safelySetColorValue($f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR);
846
+ function $9de9e313fa61a4b6$export$5aadd9c0606af5c2(value) {
847
+ return $8sEfR$useMemo(()=>{
848
+ if (typeof value === 'string') try {
849
+ return $ed27c69866ff45f2$export$6e865ea70d7724f(value);
850
+ } catch (err) {
851
+ return undefined;
852
+ }
853
+ return value;
854
+ }, [
855
+ value
856
+ ]);
857
+ }
973
858
 
974
- let validate = value => {
975
- var _value$match;
976
859
 
977
- return value === '' || !!((_value$match = value.match(/^#?[0-9a-f]{0,6}$/i)) != null && _value$match[0]);
978
- };
979
860
 
980
- return {
981
- validate,
982
- colorValue,
983
- inputValue,
984
- setInputValue,
985
- commit,
986
- increment,
987
- incrementToMax,
988
- decrement,
989
- decrementToMin
990
- };
861
+
862
+ const $8c33114d2dc9460c$var$MIN_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('#000000');
863
+ const $8c33114d2dc9460c$var$MAX_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('#FFFFFF');
864
+ const $8c33114d2dc9460c$var$MIN_COLOR_INT = $8c33114d2dc9460c$var$MIN_COLOR.toHexInt();
865
+ const $8c33114d2dc9460c$var$MAX_COLOR_INT = $8c33114d2dc9460c$var$MAX_COLOR.toHexInt();
866
+ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
867
+ let { step: step = 1 , value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
868
+ let initialValue = $9de9e313fa61a4b6$export$5aadd9c0606af5c2(value1);
869
+ let initialDefaultValue = $9de9e313fa61a4b6$export$5aadd9c0606af5c2(defaultValue);
870
+ let [colorValue, setColorValue] = $8sEfR$useControlledState(initialValue, initialDefaultValue, onChange);
871
+ let [inputValue, setInputValue] = $8sEfR$useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
872
+ );
873
+ let safelySetColorValue = (newColor)=>{
874
+ if (!colorValue || !newColor) {
875
+ setColorValue(newColor);
876
+ return;
877
+ }
878
+ if (newColor.toHexInt() !== colorValue.toHexInt()) {
879
+ setColorValue(newColor);
880
+ return;
881
+ }
882
+ };
883
+ $8sEfR$useEffect(()=>{
884
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
885
+ }, [
886
+ colorValue,
887
+ setInputValue
888
+ ]);
889
+ let parsedValue = $8sEfR$useMemo(()=>{
890
+ let color;
891
+ try {
892
+ color = $ed27c69866ff45f2$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
893
+ } catch (err) {
894
+ color = null;
895
+ }
896
+ return color;
897
+ }, [
898
+ $ed27c69866ff45f2$export$6e865ea70d7724f,
899
+ inputValue
900
+ ]);
901
+ let parsed = $8sEfR$useRef(null);
902
+ parsed.current = parsedValue;
903
+ let commit = ()=>{
904
+ // Set to empty state if input value is empty
905
+ if (!inputValue.length) {
906
+ safelySetColorValue(null);
907
+ setInputValue(value1 === undefined ? '' : colorValue.toString('hex'));
908
+ return;
909
+ }
910
+ // if it failed to parse, then reset input to formatted version of current number
911
+ if (parsed.current == null) {
912
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
913
+ return;
914
+ }
915
+ safelySetColorValue(parsed.current);
916
+ // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
917
+ let newColorValue = '';
918
+ if (colorValue) newColorValue = colorValue.toString('hex');
919
+ setInputValue(newColorValue);
920
+ };
921
+ let increment = ()=>{
922
+ let newValue = $8c33114d2dc9460c$var$addColorValue(parsed.current, step);
923
+ // if we've arrived at the same value that was previously in the state, the
924
+ // input value should be updated to match
925
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
926
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
927
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
928
+ safelySetColorValue(newValue);
929
+ };
930
+ let decrement = ()=>{
931
+ let newValue = $8c33114d2dc9460c$var$addColorValue(parsed.current, -step);
932
+ // if we've arrived at the same value that was previously in the state, the
933
+ // input value should be updated to match
934
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
935
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
936
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
937
+ safelySetColorValue(newValue);
938
+ };
939
+ let incrementToMax = ()=>safelySetColorValue($8c33114d2dc9460c$var$MAX_COLOR)
940
+ ;
941
+ let decrementToMin = ()=>safelySetColorValue($8c33114d2dc9460c$var$MIN_COLOR)
942
+ ;
943
+ let validate = (value)=>{
944
+ var ref;
945
+ return value === '' || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
946
+ };
947
+ return {
948
+ validate: validate,
949
+ colorValue: colorValue,
950
+ inputValue: inputValue,
951
+ setInputValue: setInputValue,
952
+ commit: commit,
953
+ increment: increment,
954
+ incrementToMax: incrementToMax,
955
+ decrement: decrement,
956
+ decrementToMin: decrementToMin
957
+ };
958
+ }
959
+ function $8c33114d2dc9460c$var$addColorValue(color, step) {
960
+ let newColor = color ? color : $8c33114d2dc9460c$var$MIN_COLOR;
961
+ let colorInt = newColor.toHexInt();
962
+ let clampInt = Math.min(Math.max(colorInt + step, $8c33114d2dc9460c$var$MIN_COLOR_INT), $8c33114d2dc9460c$var$MAX_COLOR_INT);
963
+ if (clampInt !== colorInt) {
964
+ let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
965
+ newColor = $ed27c69866ff45f2$export$6e865ea70d7724f(newColorString);
966
+ }
967
+ return newColor;
991
968
  }
992
969
 
993
- function $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(color, step) {
994
- let newColor = color ? color : $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR;
995
- let colorInt = newColor.toHexInt();
996
- let clampInt = Math.min(Math.max(colorInt + step, $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR_INT), $f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR_INT);
997
970
 
998
- if (clampInt !== colorInt) {
999
- let newColorString = "#" + clampInt.toString(16).padStart(6, '0').toUpperCase();
1000
- newColor = parseColor(newColorString);
1001
- }
1002
971
 
1003
- return newColor;
1004
- }
972
+
973
+ export {$ed27c69866ff45f2$export$6e865ea70d7724f as parseColor, $3d60b153dd2f1b1b$export$57bc203e1c9c6d44 as useColorSliderState, $2b492d761166c9cc$export$f4301076d9336137 as useColorWheelState, $8c33114d2dc9460c$export$d52a01683abdfcd6 as useColorFieldState};
1005
974
  //# sourceMappingURL=module.js.map