@react-stately/color 3.0.0-beta.1 → 3.0.0-beta.10

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