@nobak/design-system 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +142 -0
  3. package/lib/assets/icons.js +67 -0
  4. package/lib/components/AccountOverview/AccountOverview.js +122 -0
  5. package/lib/components/AdminPanel.js +58 -0
  6. package/lib/components/AssetExchange/AssetExchange.js +189 -0
  7. package/lib/components/AuthenticationFlow.js +216 -0
  8. package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
  9. package/lib/components/DevFooter.js +38 -0
  10. package/lib/components/DevMenu.js +35 -0
  11. package/lib/components/DevSidebar.js +28 -0
  12. package/lib/components/DigitalDisplay.js +83 -0
  13. package/lib/components/Footer.js +45 -0
  14. package/lib/components/HeroContainer.js +10 -0
  15. package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
  16. package/lib/components/Logo.js +259 -0
  17. package/lib/components/MenuBar.js +56 -0
  18. package/lib/components/NetworkSettings.js +223 -0
  19. package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
  20. package/lib/components/RisingSun.js +122 -0
  21. package/lib/components/Symbol.js +226 -0
  22. package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
  23. package/lib/components/TransactionConfirmation.js +184 -0
  24. package/lib/components/WalletMenu.js +33 -0
  25. package/lib/components/console/code/CodeBlock.js +150 -0
  26. package/lib/components/console/code/index.js +9 -0
  27. package/lib/components/console/data/DataTable.js +245 -0
  28. package/lib/components/console/data/MetricCard.js +79 -0
  29. package/lib/components/console/data/index.js +11 -0
  30. package/lib/components/console/documentation/index.js +10 -0
  31. package/lib/components/console/forms/APIKeyGenerator.js +261 -0
  32. package/lib/components/console/forms/SearchBar.js +210 -0
  33. package/lib/components/console/forms/index.js +10 -0
  34. package/lib/components/console/index.js +29 -0
  35. package/lib/components/console/layout/ConsoleCard.js +82 -0
  36. package/lib/components/console/layout/ConsoleLayout.js +86 -0
  37. package/lib/components/console/layout/index.js +10 -0
  38. package/lib/components/console/monitoring/StatusIndicator.js +128 -0
  39. package/lib/components/console/monitoring/index.js +9 -0
  40. package/lib/components/console/navigation/DevFooter.js +38 -0
  41. package/lib/components/console/navigation/DevMenu.js +35 -0
  42. package/lib/components/console/navigation/DevSidebar.js +28 -0
  43. package/lib/components/console/navigation/index.js +11 -0
  44. package/lib/components/console/settings/index.js +10 -0
  45. package/lib/components/index.js +12 -0
  46. package/lib/design/ColorPicker.stories.js +9 -0
  47. package/lib/design/HSLTool-V1.js +345 -0
  48. package/lib/design/HSLTool-V2.js +475 -0
  49. package/lib/design/HSLTool-V3.js +543 -0
  50. package/lib/design/HSLTool-V4.js +1139 -0
  51. package/lib/design/HSLTool.js +374 -0
  52. package/lib/design/OKLCHColorPicker.stories.js +24 -0
  53. package/lib/design/OKLCHTool.js +1014 -0
  54. package/lib/index.js +4 -0
  55. package/lib/shared/components/Avatar/Avatar.js +18 -0
  56. package/lib/shared/components/Avatar/index.js +1 -0
  57. package/lib/shared/components/Badge/Badge.js +34 -0
  58. package/lib/shared/components/Badge/index.js +1 -0
  59. package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
  60. package/lib/shared/components/Breadcrumb/index.js +1 -0
  61. package/lib/shared/components/Button/Button.js +184 -0
  62. package/lib/shared/components/Button/index.js +1 -0
  63. package/lib/shared/components/Calendar/Calendar.js +155 -0
  64. package/lib/shared/components/Calendar/CalendarDay.js +251 -0
  65. package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
  66. package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
  67. package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
  68. package/lib/shared/components/Calendar/constants.js +73 -0
  69. package/lib/shared/components/Calendar/index.js +3 -0
  70. package/lib/shared/components/Calendar/types.d.js +0 -0
  71. package/lib/shared/components/Cartel/Cartel.js +44 -0
  72. package/lib/shared/components/Cartel/index.js +1 -0
  73. package/lib/shared/components/Cell/Cell.js +105 -0
  74. package/lib/shared/components/Cell/index.js +1 -0
  75. package/lib/shared/components/Checkbox/Checkbox.js +27 -0
  76. package/lib/shared/components/Checkbox/index.js +1 -0
  77. package/lib/shared/components/Clock/Clock.js +6 -0
  78. package/lib/shared/components/Clock/index.js +1 -0
  79. package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
  80. package/lib/shared/components/ColorChecker/index.js +2 -0
  81. package/lib/shared/components/ColorChecker/utils.js +159 -0
  82. package/lib/shared/components/Command/Command.js +95 -0
  83. package/lib/shared/components/Command/index.js +1 -0
  84. package/lib/shared/components/Container/Container.js +18 -0
  85. package/lib/shared/components/Container/index.js +1 -0
  86. package/lib/shared/components/Cover/Cover.js +17 -0
  87. package/lib/shared/components/Cover/index.js +1 -0
  88. package/lib/shared/components/DatePicker/DatePicker.js +52 -0
  89. package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
  90. package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
  91. package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
  92. package/lib/shared/components/DatePicker/components/index.js +2 -0
  93. package/lib/shared/components/DatePicker/index.js +1 -0
  94. package/lib/shared/components/DateTime/DateTime.js +51 -0
  95. package/lib/shared/components/DateTime/index.js +1 -0
  96. package/lib/shared/components/Debug/Debug.js +12 -0
  97. package/lib/shared/components/Debug/index.js +1 -0
  98. package/lib/shared/components/Disclosure/Disclosure.js +31 -0
  99. package/lib/shared/components/Disclosure/index.js +1 -0
  100. package/lib/shared/components/Dropdown/Dropdown.js +91 -0
  101. package/lib/shared/components/Dropdown/index.js +1 -0
  102. package/lib/shared/components/EmptyState/EmptyState.js +40 -0
  103. package/lib/shared/components/EmptyState/index.js +1 -0
  104. package/lib/shared/components/Form/Form.js +41 -0
  105. package/lib/shared/components/Form/components/DynamicForm.js +66 -0
  106. package/lib/shared/components/Form/components/StepperForm.js +266 -0
  107. package/lib/shared/components/Form/components/index.js +2 -0
  108. package/lib/shared/components/Form/context/Form.js +164 -0
  109. package/lib/shared/components/Form/context/index.js +1 -0
  110. package/lib/shared/components/Form/index.js +1 -0
  111. package/lib/shared/components/Form/types.d.js +1 -0
  112. package/lib/shared/components/Form/utils/index.js +31 -0
  113. package/lib/shared/components/GroupItems/GroupItems.js +17 -0
  114. package/lib/shared/components/GroupItems/index.js +1 -0
  115. package/lib/shared/components/Header/Header.js +26 -0
  116. package/lib/shared/components/Header/index.js +1 -0
  117. package/lib/shared/components/Heading/Heading.js +5 -0
  118. package/lib/shared/components/Heading/index.js +1 -0
  119. package/lib/shared/components/Icon/Icon.js +28 -0
  120. package/lib/shared/components/Icon/index.js +1 -0
  121. package/lib/shared/components/Identicons/Identicons.js +6 -0
  122. package/lib/shared/components/Identicons/index.d.js +0 -0
  123. package/lib/shared/components/Identicons/index.js +1 -0
  124. package/lib/shared/components/Image/Image.js +22 -0
  125. package/lib/shared/components/Image/index.js +1 -0
  126. package/lib/shared/components/Input/Input.js +201 -0
  127. package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
  128. package/lib/shared/components/Input/components/DateInput.js +89 -0
  129. package/lib/shared/components/Input/components/DefaultInput.js +102 -0
  130. package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
  131. package/lib/shared/components/Input/components/NumberInput.js +141 -0
  132. package/lib/shared/components/Input/components/PickerInput.js +122 -0
  133. package/lib/shared/components/Input/components/RCInput.js +112 -0
  134. package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
  135. package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
  136. package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
  137. package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
  138. package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
  139. package/lib/shared/components/Input/components/SelectInput.js +70 -0
  140. package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
  141. package/lib/shared/components/Input/components/TextInput.js +139 -0
  142. package/lib/shared/components/Input/components/TimeInput.js +37 -0
  143. package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
  144. package/lib/shared/components/Input/components/index.js +13 -0
  145. package/lib/shared/components/Input/components/types.d.js +0 -0
  146. package/lib/shared/components/Input/index.js +1 -0
  147. package/lib/shared/components/Input/types.d.js +0 -0
  148. package/lib/shared/components/Layout/Layout.js +13 -0
  149. package/lib/shared/components/Layout/index.js +1 -0
  150. package/lib/shared/components/List/List.js +30 -0
  151. package/lib/shared/components/List/index.js +1 -0
  152. package/lib/shared/components/Loader/Loader.js +27 -0
  153. package/lib/shared/components/Loader/index.js +1 -0
  154. package/lib/shared/components/Modal/Modal.js +102 -0
  155. package/lib/shared/components/Modal/index.js +1 -0
  156. package/lib/shared/components/Notification/Notification.js +39 -0
  157. package/lib/shared/components/Notification/index.js +1 -0
  158. package/lib/shared/components/Person/Person.js +81 -0
  159. package/lib/shared/components/Person/index.js +1 -0
  160. package/lib/shared/components/Popover/Popover.js +39 -0
  161. package/lib/shared/components/Popover/index.js +1 -0
  162. package/lib/shared/components/QRCode/QRCode.js +329 -0
  163. package/lib/shared/components/QRCode/index.js +1 -0
  164. package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
  165. package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
  166. package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
  167. package/lib/shared/components/RadioGroup/components/index.js +2 -0
  168. package/lib/shared/components/RadioGroup/index.js +1 -0
  169. package/lib/shared/components/Search/Search.js +12 -0
  170. package/lib/shared/components/Search/index.js +1 -0
  171. package/lib/shared/components/Select/Select.js +90 -0
  172. package/lib/shared/components/Select/index.js +1 -0
  173. package/lib/shared/components/Sidebar/Sidebar.js +42 -0
  174. package/lib/shared/components/Sidebar/index.js +1 -0
  175. package/lib/shared/components/SlideOver/SlideOver.js +81 -0
  176. package/lib/shared/components/SlideOver/index.js +1 -0
  177. package/lib/shared/components/Slider/Slider.js +80 -0
  178. package/lib/shared/components/Slider/index.js +1 -0
  179. package/lib/shared/components/Stepper/Stepper.js +32 -0
  180. package/lib/shared/components/Stepper/index.js +1 -0
  181. package/lib/shared/components/Steps/Steps.js +53 -0
  182. package/lib/shared/components/Steps/index.js +1 -0
  183. package/lib/shared/components/Switch/Switch.js +26 -0
  184. package/lib/shared/components/Switch/index.js +1 -0
  185. package/lib/shared/components/Tab/Tab.js +59 -0
  186. package/lib/shared/components/Tab/index.js +1 -0
  187. package/lib/shared/components/Table/Table.js +47 -0
  188. package/lib/shared/components/Table/index.js +1 -0
  189. package/lib/shared/components/Text/Text.js +11 -0
  190. package/lib/shared/components/Text/index.js +1 -0
  191. package/lib/shared/components/TextList/TextList.js +15 -0
  192. package/lib/shared/components/TextList/index.js +1 -0
  193. package/lib/shared/components/TimePicker/TimePicker.js +161 -0
  194. package/lib/shared/components/TimePicker/index.js +1 -0
  195. package/lib/shared/components/Tooltip/Tooltip.js +13 -0
  196. package/lib/shared/components/Tooltip/index.js +1 -0
  197. package/lib/shared/components/Uploader/Uploader.js +63 -0
  198. package/lib/shared/components/Uploader/index.js +1 -0
  199. package/lib/shared/components/Video/Video.js +20 -0
  200. package/lib/shared/components/Video/index.js +1 -0
  201. package/lib/shared/components/index.d.js +0 -0
  202. package/lib/shared/components/index.js +50 -0
  203. package/lib/shared/elements/Color/ColorPallet.js +20 -0
  204. package/lib/shared/elements/Color/index.js +1 -0
  205. package/lib/shared/elements/Text.js +37 -0
  206. package/lib/shared/elements/index.js +1 -0
  207. package/lib/shared/helpers/FakeLink.js +8 -0
  208. package/lib/shared/helpers/constants.js +359 -0
  209. package/lib/shared/helpers/index.js +2 -0
  210. package/lib/shared/helpers/isEqual.js +56 -0
  211. package/lib/shared/index.d.js +0 -0
  212. package/lib/shared/index.js +1 -0
  213. package/lib/shared/stories/components/Avatar.stories.js +17 -0
  214. package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
  215. package/lib/shared/stories/components/Button.stories.js +553 -0
  216. package/lib/shared/stories/components/Calendar.stories.js +62 -0
  217. package/lib/shared/stories/components/Cartel.stories.js +32 -0
  218. package/lib/shared/stories/components/Checkbox.stories.js +15 -0
  219. package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
  220. package/lib/shared/stories/components/DateTime.stories.js +27 -0
  221. package/lib/shared/stories/components/Disclosure.stories.js +30 -0
  222. package/lib/shared/stories/components/Dropdown.stories.js +39 -0
  223. package/lib/shared/stories/components/Form/Default.stories.js +201 -0
  224. package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
  225. package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
  226. package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
  227. package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
  228. package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
  229. package/lib/shared/stories/components/GroupItems.stories.js +23 -0
  230. package/lib/shared/stories/components/Header.stories.js +29 -0
  231. package/lib/shared/stories/components/Heading.stories.js +27 -0
  232. package/lib/shared/stories/components/Icon.stories.js +22 -0
  233. package/lib/shared/stories/components/Image.stories.js +23 -0
  234. package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
  235. package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
  236. package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
  237. package/lib/shared/stories/components/Input/Number.stories.js +24 -0
  238. package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
  239. package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
  240. package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
  241. package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
  242. package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
  243. package/lib/shared/stories/components/List.stories.js +34 -0
  244. package/lib/shared/stories/components/Loader.stories.js +15 -0
  245. package/lib/shared/stories/components/Modal.stories.js +50 -0
  246. package/lib/shared/stories/components/Notification.stories.js +22 -0
  247. package/lib/shared/stories/components/Person.stories.js +41 -0
  248. package/lib/shared/stories/components/Picker.stories.js +15 -0
  249. package/lib/shared/stories/components/Popover.stories.js +36 -0
  250. package/lib/shared/stories/components/QRCode.stories.js +20 -0
  251. package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
  252. package/lib/shared/stories/components/Select.stories.js +50 -0
  253. package/lib/shared/stories/components/Sidebar.stories.js +35 -0
  254. package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
  255. package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
  256. package/lib/shared/stories/components/Steps.stories.js +15 -0
  257. package/lib/shared/stories/components/Switch.stories.js +15 -0
  258. package/lib/shared/stories/components/Tab.stories.js +15 -0
  259. package/lib/shared/stories/components/Table.stories.js +95 -0
  260. package/lib/shared/stories/components/TextList.stories.js +23 -0
  261. package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
  262. package/lib/shared/stories/elements/Color.stories.js +269 -0
  263. package/lib/shared/stories/elements/Text.stories.js +45 -0
  264. package/lib/shared/types/index.js +1 -0
  265. package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
  266. package/lib/stories/Foundation/Logo.stories.js +19 -0
  267. package/lib/stories/Foundation/RisingSun.stories.js +16 -0
  268. package/lib/stories/Foundation/Shadows.stories.js +601 -0
  269. package/lib/stories/Foundation/Symbol.stories.js +18 -0
  270. package/lib/stories/HeroContainer.stories.js +18 -0
  271. package/lib/styles/accessibilityTokens.js +72 -0
  272. package/lib/styles/borderWidth.js +10 -0
  273. package/lib/styles/colors.js +303 -0
  274. package/lib/styles/elevation.js +240 -0
  275. package/lib/styles/icons.js +218 -0
  276. package/lib/styles/index.js +29 -0
  277. package/lib/styles/motion.js +668 -0
  278. package/lib/styles/opacity.js +10 -0
  279. package/lib/styles/radius.js +11 -0
  280. package/lib/styles/sizing.js +35 -0
  281. package/lib/styles/space.js +24 -0
  282. package/lib/styles/theme/darkTheme.js +471 -0
  283. package/lib/styles/theme/index.js +44 -0
  284. package/lib/styles/theme/lightTheme.js +480 -0
  285. package/lib/styles/theme/themeTypes.js +1 -0
  286. package/lib/styles/theme/themeUtils.js +63 -0
  287. package/lib/styles/typography-advanced.js +510 -0
  288. package/lib/styles/typography.js +1419 -0
  289. package/lib/styles/zIndex.js +19 -0
  290. package/lib/tokens/borders.js +161 -0
  291. package/lib/tokens/colors.js +426 -0
  292. package/lib/tokens/components.js +499 -0
  293. package/lib/tokens/index.js +84 -0
  294. package/lib/tokens/lighting.js +384 -0
  295. package/lib/tokens/motion.js +284 -0
  296. package/lib/tokens/semantic.js +367 -0
  297. package/lib/tokens/shadows.js +114 -0
  298. package/lib/tokens/spacing.js +189 -0
  299. package/lib/tokens/typography.js +268 -0
  300. package/package.json +176 -0
  301. package/styles/generated-tokens.css +677 -0
  302. package/styles/index.css +2 -0
  303. package/styles/main.css +610 -0
  304. package/tailwind.config.js +64 -0
@@ -0,0 +1,1139 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
+ import React, { useState, useCallback, useMemo } from 'react';
19
+ import { Icon } from "../shared/elements/Icon";
20
+ import { RangeSlider } from "../shared/components/forms/RangeSlider";
21
+ var HSLTool = function HSLTool() {
22
+ // STATE MANAGEMENT
23
+ // Base color properties that define the starting point for our color scale
24
+ var _useState = useState(240),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ baseHue = _useState2[0],
27
+ setBaseHue = _useState2[1]; // 0-360 degrees on color wheel
28
+ var _useState3 = useState(100),
29
+ _useState4 = _slicedToArray(_useState3, 2),
30
+ baseSaturation = _useState4[0],
31
+ setBaseSaturation = _useState4[1]; // 0-100% color intensity
32
+ var _useState5 = useState(50),
33
+ _useState6 = _slicedToArray(_useState5, 2),
34
+ baseLightness = _useState6[0],
35
+ setBaseLightness = _useState6[1]; // 0-100% lightness (middle = 50%)
36
+
37
+ // Target lightness for comparison - shows the effect of adjustment at a specific value
38
+ var _useState7 = useState(75),
39
+ _useState8 = _slicedToArray(_useState7, 2),
40
+ targetLightness = _useState8[0],
41
+ setTargetLightness = _useState8[1];
42
+
43
+ // Algorithm selection: simple distance-based vs. perceived brightness compensation
44
+ var _useState9 = useState(false),
45
+ _useState0 = _slicedToArray(_useState9, 2),
46
+ usePerceivedBrightness = _useState0[0],
47
+ setUsePerceivedBrightness = _useState0[1];
48
+
49
+ // NEW: Palette naming, export options, and output count selection
50
+ var _useState1 = useState('primary'),
51
+ _useState10 = _slicedToArray(_useState1, 2),
52
+ paletteName = _useState10[0],
53
+ setPaletteName = _useState10[1];
54
+ var _useState11 = useState('hex'),
55
+ _useState12 = _slicedToArray(_useState11, 2),
56
+ exportFormat = _useState12[0],
57
+ setExportFormat = _useState12[1];
58
+ var _useState13 = useState(false),
59
+ _useState14 = _slicedToArray(_useState13, 2),
60
+ showExportPanel = _useState14[0],
61
+ setShowExportPanel = _useState14[1];
62
+ var _useState15 = useState(27),
63
+ _useState16 = _slicedToArray(_useState15, 2),
64
+ outputCount = _useState16[0],
65
+ setOutputCount = _useState16[1]; // 9, 18, or 27 colors
66
+
67
+ // PALETTE COLLECTION: Store multiple saved palettes
68
+ var _useState17 = useState([]),
69
+ _useState18 = _slicedToArray(_useState17, 2),
70
+ paletteCollection = _useState18[0],
71
+ setPaletteCollection = _useState18[1];
72
+
73
+ /**
74
+ * PERCEIVED BRIGHTNESS CALCULATION
75
+ *
76
+ * Calculates how bright a color appears to human vision using the luminance formula.
77
+ * This accounts for the fact that humans perceive green as brighter than blue,
78
+ * and blue as brighter than red, at the same RGB values.
79
+ *
80
+ * Formula: √(0.299×r² + 0.587×g² + 0.114×b²) / 255
81
+ *
82
+ * The coefficients (0.299, 0.587, 0.114) represent how sensitive human vision
83
+ * is to red, green, and blue respectively. Green has the highest coefficient
84
+ * because human eyes are most sensitive to green light.
85
+ *
86
+ * @param {number} r - Red component (0-255)
87
+ * @param {number} g - Green component (0-255)
88
+ * @param {number} b - Blue component (0-255)
89
+ * @returns {number} - Perceived brightness value (0-1)
90
+ */
91
+ var calculatePerceivedBrightness = useCallback(function (r, g, b) {
92
+ // Normalize RGB values to 0-1 range
93
+ var rNorm = r / 255;
94
+ var gNorm = g / 255;
95
+ var bNorm = b / 255;
96
+
97
+ // Apply luminance formula with human vision sensitivity coefficients
98
+ return Math.sqrt(0.299 * rNorm * rNorm + 0.587 * gNorm * gNorm + 0.114 * bNorm * bNorm);
99
+ }, []);
100
+
101
+ /**
102
+ * HSL TO RGB CONVERSION
103
+ *
104
+ * Converts HSL color values to RGB for display and brightness calculations.
105
+ * HSL is more intuitive for color manipulation, but RGB is needed for:
106
+ * - CSS color values
107
+ * - Perceived brightness calculations
108
+ * - Final color display
109
+ *
110
+ * Algorithm uses the standard HSL->RGB conversion with hue wheel mathematics.
111
+ *
112
+ * @param {number} h - Hue (0-360 degrees)
113
+ * @param {number} s - Saturation (0-100 percent)
114
+ * @param {number} l - Lightness (0-100 percent)
115
+ * @returns {Array<number>} - [r, g, b] values (0-255)
116
+ */
117
+ var hslToRgb = useCallback(function (h, s, l) {
118
+ // Normalize inputs to 0-1 range
119
+ h = h / 360;
120
+ s = s / 100;
121
+ l = l / 100;
122
+
123
+ /**
124
+ * Helper function for hue-to-RGB conversion
125
+ * Handles the mathematics of converting a hue angle to RGB components
126
+ */
127
+ var hue2rgb = function hue2rgb(p, q, t) {
128
+ if (t < 0) t += 1;
129
+ if (t > 1) t -= 1;
130
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
131
+ if (t < 1 / 2) return q;
132
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
133
+ return p;
134
+ };
135
+
136
+ // Handle achromatic colors (no saturation = grayscale)
137
+ if (s === 0) {
138
+ return [l * 255, l * 255, l * 255];
139
+ }
140
+
141
+ // Calculate intermediate values for color conversion
142
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
143
+ var p = 2 * l - q;
144
+
145
+ // Convert hue to RGB components
146
+ var r = hue2rgb(p, q, h + 1 / 3);
147
+ var g = hue2rgb(p, q, h);
148
+ var b = hue2rgb(p, q, h - 1 / 3);
149
+
150
+ // Return RGB values in 0-255 range
151
+ return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
152
+ }, []);
153
+
154
+ /**
155
+ * RGB TO HEX CONVERSION
156
+ *
157
+ * Converts RGB values to hexadecimal color codes for CSS and design tool usage.
158
+ *
159
+ * @param {number} r - Red component (0-255)
160
+ * @param {number} g - Green component (0-255)
161
+ * @param {number} b - Blue component (0-255)
162
+ * @returns {string} - Hex color code (e.g., "#ff0000")
163
+ */
164
+ var rgbToHex = useCallback(function (r, g, b) {
165
+ return "#" + [r, g, b].map(function (x) {
166
+ var hex = x.toString(16);
167
+ return hex.length === 1 ? "0" + hex : hex;
168
+ }).join("");
169
+ }, []);
170
+
171
+ /**
172
+ * SATURATION ADJUSTMENT ALGORITHM
173
+ *
174
+ * Core function that calculates the adjusted saturation needed to maintain
175
+ * visual color intensity at different lightness levels.
176
+ *
177
+ * TWO METHODS:
178
+ *
179
+ * 1. SIMPLE METHOD:
180
+ * - Increases saturation based on distance from 50% lightness
181
+ * - Formula: original_saturation + (|target_lightness - 50| × 0.8)
182
+ * - Fast and intuitive, good for most use cases
183
+ *
184
+ * 2. PERCEIVED BRIGHTNESS METHOD:
185
+ * - Uses luminance calculations to maintain consistent perceived intensity
186
+ * - More mathematically accurate but computationally intensive
187
+ * - Uses binary search to find optimal saturation value
188
+ *
189
+ * @param {number} hue - Color hue (0-360)
190
+ * @param {number} originalSat - Original saturation (0-100)
191
+ * @param {number} originalLight - Original lightness (0-100)
192
+ * @param {number} targetLight - Target lightness (0-100)
193
+ * @returns {number} - Adjusted saturation value (0-100)
194
+ */
195
+ var calculateAdjustedSaturation = useCallback(function (hue, originalSat, originalLight, targetLight) {
196
+ if (!usePerceivedBrightness) {
197
+ // SIMPLE METHOD: Distance-based saturation boost
198
+ // Works well for most design system applications
199
+ // Uses baseLightness (originalLight) as the reference point
200
+ var distance = Math.abs(targetLight - originalLight);
201
+ var saturationBoost = Math.min(distance * 0.8, 40); // Cap boost at 40%
202
+ return Math.min(100, originalSat + saturationBoost);
203
+ }
204
+
205
+ // PERCEIVED BRIGHTNESS METHOD: Luminance-based compensation
206
+ // Calculate the perceived brightness of the original color
207
+ var _hslToRgb = hslToRgb(hue, originalSat, originalLight),
208
+ _hslToRgb2 = _slicedToArray(_hslToRgb, 3),
209
+ originalR = _hslToRgb2[0],
210
+ originalG = _hslToRgb2[1],
211
+ originalB = _hslToRgb2[2];
212
+ var originalPerceivedBrightness = calculatePerceivedBrightness(originalR, originalG, originalB);
213
+
214
+ // Binary search to find saturation that maintains perceived brightness
215
+ // This iterative approach finds the optimal saturation value
216
+ var lowSat = 0;
217
+ var highSat = 100;
218
+ var bestSat = originalSat;
219
+ var bestDiff = Infinity;
220
+
221
+ // 20 iterations provides sufficient precision for color matching
222
+ for (var i = 0; i < 20; i++) {
223
+ var testSat = (lowSat + highSat) / 2;
224
+ var _hslToRgb3 = hslToRgb(hue, testSat, targetLight),
225
+ _hslToRgb4 = _slicedToArray(_hslToRgb3, 3),
226
+ testR = _hslToRgb4[0],
227
+ testG = _hslToRgb4[1],
228
+ testB = _hslToRgb4[2];
229
+ var testPerceivedBrightness = calculatePerceivedBrightness(testR, testG, testB);
230
+ var diff = Math.abs(testPerceivedBrightness - originalPerceivedBrightness);
231
+
232
+ // Track the closest match
233
+ if (diff < bestDiff) {
234
+ bestDiff = diff;
235
+ bestSat = testSat;
236
+ }
237
+
238
+ // Adjust search range based on brightness comparison
239
+ if (testPerceivedBrightness < originalPerceivedBrightness) {
240
+ lowSat = testSat;
241
+ } else {
242
+ highSat = testSat;
243
+ }
244
+ }
245
+
246
+ // Ensure result stays within valid saturation range
247
+ return Math.max(0, Math.min(100, bestSat));
248
+ }, [usePerceivedBrightness, hslToRgb, calculatePerceivedBrightness]);
249
+
250
+ /**
251
+ * COLOR PROGRESSION PATTERNS
252
+ *
253
+ * Defines different lightness progression patterns optimized for various design system needs.
254
+ * Each pattern strategically distributes values where they're most useful.
255
+ *
256
+ * 9 SHADES: Essential colors for minimal design systems
257
+ * - Focus on key UI states: dark text, medium backgrounds, light accents
258
+ * - Perfect for simple applications or component libraries
259
+ *
260
+ * 18 SHADES: Balanced approach for most design systems
261
+ * - Good coverage across the lightness spectrum
262
+ * - Sufficient granularity for complex interfaces
263
+ *
264
+ * 27 SHADES: Maximum granularity for complex design systems
265
+ * - Highest density in mid-tones (40-80%) where most UI elements exist
266
+ * - Professional-grade scales matching industry standards
267
+ */
268
+ var getProgressionPattern = useCallback(function (count) {
269
+ switch (count) {
270
+ case 9:
271
+ // 9 ESSENTIAL SHADES: Core values for minimal design systems
272
+ // Distribution: 2 dark + 2 medium-dark + 1 middle + 2 medium-light + 2 light
273
+ return [8, 18, 32, 45, 58, 70, 82, 91, 96];
274
+ case 18:
275
+ // 18 BALANCED SHADES: Good coverage for most design systems
276
+ // More even distribution with focus on usable ranges
277
+ return [2, 8, 15, 22, 30, 38, 45, 52, 58, 65, 70, 75, 82, 87, 91, 94, 97, 99];
278
+ case 27:
279
+ default:
280
+ // 27 COMPREHENSIVE SHADES: Maximum granularity
281
+ // Balanced distribution with emphasis on UI range (40-80%) while avoiding compression at extremes
282
+ return [
283
+ // VERY DARK ZONE (5 values): backgrounds, borders, deep contrast
284
+ 2, 6, 10, 14, 19,
285
+ // DARK ZONE (5 values): text, icons, readable contrast
286
+ 24, 29, 34, 39, 44,
287
+ // MID-TONE ZONE (7 values): HIGHEST DENSITY - most UI elements
288
+ // This range gets the most values because it's where buttons, cards,
289
+ // navigation elements, and interactive components typically live
290
+ 48, 52, 56, 60, 64, 68, 72,
291
+ // LIGHT ZONE (5 values): UI backgrounds, interactive states
292
+ 76, 80, 84, 87, 90,
293
+ // VERY LIGHT ZONE (5 values): subtle backgrounds, minimal contrast
294
+ // More evenly spaced to avoid compression at 100%
295
+ 92, 94, 96, 97, 98];
296
+ }
297
+ }, []);
298
+
299
+ /**
300
+ * COLOR SWATCH GENERATION
301
+ *
302
+ * Generates the complete color scale using a design-system-optimized
303
+ * progression pattern that concentrates values where they're most useful.
304
+ *
305
+ * PROGRESSION STRATEGY:
306
+ * Instead of linear spacing (every 10%), this uses strategic distribution:
307
+ * - More density in mid-tones (40-80%) where most UI elements exist
308
+ * - Fewer extreme values (near 0% and 100%) since they're rarely used
309
+ * - Specific values chosen based on design system best practices
310
+ *
311
+ * Each swatch contains:
312
+ * - Standard HSL version (shows the problem)
313
+ * - Adjusted HSL version (shows the solution)
314
+ * - RGB values for display
315
+ * - Hex values for export
316
+ * - Metadata for analysis
317
+ */
318
+ var colorSwatches = useMemo(function () {
319
+ var swatches = [];
320
+ var lightnessValues = getProgressionPattern(outputCount);
321
+
322
+ // Generate both standard and adjusted versions for each lightness value
323
+ lightnessValues.forEach(function (lightness) {
324
+ // STANDARD HSL: Fixed saturation (demonstrates the problem)
325
+ var standardColor = hslToRgb(baseHue, baseSaturation, lightness);
326
+
327
+ // ADJUSTED HSL: Compensated saturation (demonstrates the solution)
328
+ var adjustedSaturation = calculateAdjustedSaturation(baseHue, baseSaturation, baseLightness, lightness);
329
+ var adjustedColor = hslToRgb(baseHue, adjustedSaturation, lightness);
330
+
331
+ // Store complete data for each swatch
332
+ swatches.push({
333
+ lightness: lightness,
334
+ standard: {
335
+ rgb: standardColor,
336
+ hsl: [baseHue, baseSaturation, lightness],
337
+ saturation: baseSaturation,
338
+ hex: rgbToHex.apply(void 0, _toConsumableArray(standardColor))
339
+ },
340
+ adjusted: {
341
+ rgb: adjustedColor,
342
+ hsl: [baseHue, adjustedSaturation, lightness],
343
+ saturation: adjustedSaturation,
344
+ hex: rgbToHex.apply(void 0, _toConsumableArray(adjustedColor))
345
+ }
346
+ });
347
+ });
348
+ return swatches;
349
+ }, [baseHue, baseSaturation, baseLightness, outputCount, getProgressionPattern, hslToRgb, calculateAdjustedSaturation, rgbToHex]);
350
+
351
+ // EXPORT FUNCTIONS
352
+ /**
353
+ * EXPORT DATA GENERATION
354
+ *
355
+ * Generates color palette data in various formats suitable for different development workflows.
356
+ * Each format is optimized for its target use case while maintaining consistent naming conventions.
357
+ *
358
+ * SUPPORTED FORMATS:
359
+ * - hex: Simple list format for quick reference
360
+ * - json: Complete data structure with metadata
361
+ * - css: CSS custom properties (CSS variables)
362
+ * - scss: Sass variables and color maps
363
+ * - tailwind: Tailwind CSS configuration format
364
+ *
365
+ * NAMING CONVENTION:
366
+ * Colors are named as {paletteName}-{index} where index is zero-padded:
367
+ * - 9 colors: 01-09
368
+ * - 18 colors: 01-18
369
+ * - 27 colors: 01-27
370
+ */
371
+ var generateExportData = useCallback(function () {
372
+ var paletteData = colorSwatches.map(function (swatch, index) {
373
+ return {
374
+ name: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0')),
375
+ lightness: swatch.lightness,
376
+ hex: swatch.adjusted.hex,
377
+ rgb: swatch.adjusted.rgb,
378
+ hsl: swatch.adjusted.hsl
379
+ };
380
+ });
381
+ switch (exportFormat) {
382
+ case 'hex':
383
+ return paletteData.map(function (color) {
384
+ return "".concat(color.name, ": ").concat(color.hex);
385
+ }).join(': ');
386
+ case 'json':
387
+ var jsonData = {
388
+ name: "".concat(paletteName, " Color Palette"),
389
+ description: "Generated using HSL Saturation Preservation (".concat(usePerceivedBrightness ? 'Perceived Brightness' : 'Simple', " method)"),
390
+ baseColor: {
391
+ hue: baseHue,
392
+ saturation: baseSaturation,
393
+ lightness: baseLightness
394
+ },
395
+ colors: paletteData.reduce(function (acc, color) {
396
+ acc[color.name] = {
397
+ hex: color.hex,
398
+ rgb: "rgb(".concat(color.rgb.join(': '), ")"),
399
+ hsl: "hsl(".concat(Math.round(color.hsl[0]), ", ").concat(Math.round(color.hsl[1]), "%, ").concat(Math.round(color.hsl[2]), "%)"),
400
+ lightness: color.lightness
401
+ };
402
+ return acc;
403
+ }, {})
404
+ };
405
+ return JSON.stringify(jsonData, null, 2);
406
+ case 'css':
407
+ var cssVars = paletteData.map(function (color) {
408
+ return " --color-".concat(color.name, ": ").concat(color.hex, ";");
409
+ }).join(': ');
410
+ return ":root {\n".concat(cssVars, "\n}\n\n/* Usage examples:\n * background-color: var(--color-").concat(paletteName, "-01);\n * color: var(--color-").concat(paletteName, "-15);\n */");
411
+ case 'scss':
412
+ var scssVars = paletteData.map(function (color) {
413
+ return "$color-".concat(color.name, ": ").concat(color.hex, ";");
414
+ }).join(': ');
415
+ var scssMap = "$".concat(paletteName, "-palette: (\n").concat(paletteData.map(function (color) {
416
+ return " '".concat(color.name.split('-').pop(), "': ").concat(color.hex);
417
+ }).join(',\n'), "\n);");
418
+ return "".concat(scssVars, "\n\n").concat(scssMap, "\n\n// Usage examples:\n// background-color: $color-").concat(paletteName, "-01;\n// color: map-get($").concat(paletteName, "-palette, ': ');");
419
+ case 'tailwind':
420
+ var tailwindColors = paletteData.reduce(function (acc, color) {
421
+ var key = color.name.split('-').pop();
422
+ acc[key] = color.hex;
423
+ return acc;
424
+ }, {});
425
+ var tailwindConfig = {
426
+ theme: {
427
+ extend: {
428
+ colors: _defineProperty({}, paletteName, tailwindColors)
429
+ }
430
+ }
431
+ };
432
+ return "// tailwind.config.js\n// ".concat(paletteName, " Color Palette (").concat(outputCount, " shades)\n// Generated using HSL Saturation Preservation\n// Method: ").concat(usePerceivedBrightness ? 'Perceived Brightness' : 'Simple Distance-based', "\n\nmodule.exports = ").concat(JSON.stringify(tailwindConfig, null, 2), "\n\n// Usage examples:\n// bg-").concat(paletteName, "-01\n// text-").concat(paletteName, "-").concat(String(Math.ceil(outputCount / 2)).padStart(2, '0'), "\n// border-").concat(paletteName, "-").concat(String(outputCount).padStart(2, '0'));
433
+ default:
434
+ return '';
435
+ }
436
+ }, [colorSwatches, paletteName, exportFormat, baseHue, baseSaturation, baseLightness, usePerceivedBrightness, outputCount]);
437
+
438
+ /**
439
+ * CLIPBOARD FUNCTIONALITY
440
+ *
441
+ * Copies the generated palette data to the user's clipboard for easy sharing
442
+ * and integration into development workflows.
443
+ */
444
+ var copyToClipboard = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
445
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
446
+ while (1) switch (_context.prev = _context.next) {
447
+ case 0:
448
+ _context.prev = 0;
449
+ _context.next = 3;
450
+ return navigator.clipboard.writeText(generateExportData());
451
+ case 3:
452
+ // You could add a toast notification here
453
+ console.log('Copied to clipboard!');
454
+ _context.next = 9;
455
+ break;
456
+ case 6:
457
+ _context.prev = 6;
458
+ _context.t0 = _context["catch"](0);
459
+ console.error('Failed to copy: ', _context.t0);
460
+ case 9:
461
+ case "end":
462
+ return _context.stop();
463
+ }
464
+ }, _callee, null, [[0, 6]]);
465
+ })), [generateExportData]);
466
+
467
+ /**
468
+ * FILE DOWNLOAD FUNCTIONALITY
469
+ *
470
+ * Generates and downloads a file containing the palette data with appropriate
471
+ * file extension based on the selected export format.
472
+ */
473
+ var downloadPalette = useCallback(function () {
474
+ var data = generateExportData();
475
+ var extension = exportFormat === 'json' ? 'json' : exportFormat === 'css' ? 'css' : exportFormat === 'scss' ? 'scss' : exportFormat === 'tailwind' ? ': ' : 'txt';
476
+ var blob = new Blob([data], {
477
+ type: 'text/plain'
478
+ });
479
+ var url = URL.createObjectURL(blob);
480
+ var a = document.createElement('a');
481
+ a.href = url;
482
+ a.download = "".concat(paletteName, "-palette-").concat(outputCount, ".").concat(extension);
483
+ document.body.appendChild(a);
484
+ a.click();
485
+ document.body.removeChild(a);
486
+ URL.revokeObjectURL(url);
487
+ }, [generateExportData, paletteName, exportFormat, outputCount]);
488
+
489
+ /**
490
+ * SAVE PALETTE TO COLLECTION
491
+ *
492
+ * Saves the current palette configuration and colors to the palette collection.
493
+ * Each saved palette includes all configuration settings and generated colors.
494
+ */
495
+ var addPaletteToCollection = useCallback(function () {
496
+ var newPalette = {
497
+ id: Date.now(),
498
+ // Unique identifier
499
+ name: paletteName,
500
+ timestamp: new Date().toISOString(),
501
+ config: {
502
+ baseHue: baseHue,
503
+ baseSaturation: baseSaturation,
504
+ baseLightness: baseLightness,
505
+ outputCount: outputCount,
506
+ usePerceivedBrightness: usePerceivedBrightness
507
+ },
508
+ colors: colorSwatches.map(function (swatch, index) {
509
+ return {
510
+ index: index + 1,
511
+ name: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0')),
512
+ lightness: swatch.lightness,
513
+ hex: swatch.adjusted.hex,
514
+ rgb: swatch.adjusted.rgb,
515
+ hsl: swatch.adjusted.hsl,
516
+ saturation: swatch.adjusted.saturation
517
+ };
518
+ })
519
+ };
520
+ setPaletteCollection(function (prev) {
521
+ return [].concat(_toConsumableArray(prev), [newPalette]);
522
+ });
523
+ console.log('Palette added to collection:', newPalette.name);
524
+ }, [paletteName, baseHue, baseSaturation, baseLightness, outputCount, usePerceivedBrightness, colorSwatches]);
525
+
526
+ /**
527
+ * REMOVE PALETTE FROM COLLECTION
528
+ *
529
+ * Removes a specific palette from the collection by its ID.
530
+ */
531
+ var removePaletteFromCollection = useCallback(function (paletteId) {
532
+ setPaletteCollection(function (prev) {
533
+ return prev.filter(function (palette) {
534
+ return palette.id !== paletteId;
535
+ });
536
+ });
537
+ }, []);
538
+
539
+ /**
540
+ * EXPORT ENTIRE COLLECTION
541
+ *
542
+ * Exports all saved palettes as a single JSON file.
543
+ */
544
+ var exportCollection = useCallback(function () {
545
+ var collectionData = {
546
+ name: 'HSL Palette Collection',
547
+ created: new Date().toISOString(),
548
+ palettes: paletteCollection,
549
+ count: paletteCollection.length
550
+ };
551
+ var data = JSON.stringify(collectionData, null, 2);
552
+ var blob = new Blob([data], {
553
+ type: 'application/json'
554
+ });
555
+ var url = URL.createObjectURL(blob);
556
+ var a = document.createElement('a');
557
+ a.href = url;
558
+ a.download = "palette-collection-".concat(Date.now(), ".json");
559
+ document.body.appendChild(a);
560
+ a.click();
561
+ document.body.removeChild(a);
562
+ URL.revokeObjectURL(url);
563
+ }, [paletteCollection]);
564
+
565
+ // DERIVED VALUES FOR COMPARISON DISPLAY
566
+ // Calculate specific examples for the comparison section
567
+ var adjustedSaturation = calculateAdjustedSaturation(baseHue, baseSaturation, baseLightness, targetLightness);
568
+ var baseColor = hslToRgb(baseHue, baseSaturation, baseLightness);
569
+ var standardTargetColor = hslToRgb(baseHue, baseSaturation, targetLightness);
570
+ var adjustedTargetColor = hslToRgb(baseHue, adjustedSaturation, targetLightness);
571
+
572
+ // UTILITY FUNCTIONS FOR DISPLAY
573
+
574
+ /**
575
+ * Formats RGB array as CSS color string
576
+ * @param {Array<number>} rgb - [r, g, b] values
577
+ * @returns {string} - CSS rgb() string
578
+ */
579
+ var formatRgb = function formatRgb(rgb) {
580
+ return "rgb(".concat(rgb[0], ", ").concat(rgb[1], ", ").concat(rgb[2], ")");
581
+ };
582
+
583
+ /**
584
+ * Formats HSL values as CSS color string
585
+ * @param {number} h - Hue (0-360)
586
+ * @param {number} s - Saturation (0-100)
587
+ * @param {number} l - Lightness (0-100)
588
+ * @returns {string} - CSS hsl() string
589
+ */
590
+ var formatHsl = function formatHsl(h, s, l) {
591
+ return "hsl(".concat(Math.round(h), ", ").concat(Math.round(s), "%, ").concat(Math.round(l), "%)");
592
+ };
593
+ return /*#__PURE__*/React.createElement("div", {
594
+ className: "max-w-6xl mx-auto p-6 bg-white"
595
+ }, /*#__PURE__*/React.createElement("div", {
596
+ className: "mb-8"
597
+ }, /*#__PURE__*/React.createElement("h1", {
598
+ className: "text-3xl font-bold text-gray-900 mb-4"
599
+ }, "HSL Saturation Preservation Tool"), /*#__PURE__*/React.createElement("div", {
600
+ className: "mb-6"
601
+ }, /*#__PURE__*/React.createElement("p", {
602
+ className: "text-gray-600 mb-4"
603
+ }, "This tool demonstrates how to maintain color saturation when adjusting lightness in HSL color space. Traditional HSL loses saturation at extreme lightness values, making colors appear washed out."), /*#__PURE__*/React.createElement("div", {
604
+ className: "bg-blue-50 p-4 rounded-lg"
605
+ }, /*#__PURE__*/React.createElement("p", {
606
+ className: "text-sm text-blue-800"
607
+ }, /*#__PURE__*/React.createElement("strong", null, "The Problem:"), " In HSL, as lightness approaches 0% or 100%, saturation appears to decrease even when the S value stays constant. This tool compensates by increasing saturation to maintain visual intensity."))), /*#__PURE__*/React.createElement("div", {
608
+ className: "grid grid-cols-1 md:grid-cols-2 gap-6 mb-6"
609
+ }, /*#__PURE__*/React.createElement("div", {
610
+ className: "bg-gray-50 p-4 rounded-lg"
611
+ }, /*#__PURE__*/React.createElement("h3", {
612
+ className: "font-semibold text-gray-900 mb-2"
613
+ }, "\uD83C\uDFAF What This Tool Does"), /*#__PURE__*/React.createElement("ul", {
614
+ className: "text-sm text-gray-700 space-y-1"
615
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 Generates 9, 18, or 27 strategically distributed color shades"), /*#__PURE__*/React.createElement("li", null, "\u2022 Maintains visual saturation across all lightness levels"), /*#__PURE__*/React.createElement("li", null, "\u2022 Provides two compensation algorithms (simple & advanced)"), /*#__PURE__*/React.createElement("li", null, "\u2022 Creates professional design system color scales"))), /*#__PURE__*/React.createElement("div", {
616
+ className: "bg-purple-50 p-4 rounded-lg"
617
+ }, /*#__PURE__*/React.createElement("h3", {
618
+ className: "font-semibold text-purple-900 mb-2"
619
+ }, "\uD83D\uDD2C How It Works"), /*#__PURE__*/React.createElement("ul", {
620
+ className: "text-sm text-purple-700 space-y-1"
621
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Simple Method:"), " Distance-based saturation boost"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Advanced Method:"), " Perceived brightness preservation"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Binary Search:"), " Finds optimal saturation values"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Luminance Formula:"), " \u221A(0.299r\xB2 + 0.587g\xB2 + 0.114b\xB2)")))), /*#__PURE__*/React.createElement("div", {
622
+ className: "bg-green-50 p-4 rounded-lg"
623
+ }, /*#__PURE__*/React.createElement("h3", {
624
+ className: "font-semibold text-green-900 mb-2"
625
+ }, "\u2728 Design System Benefits"), /*#__PURE__*/React.createElement("div", {
626
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4"
627
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", {
628
+ className: "font-medium text-green-800 mb-1"
629
+ }, "Color Scale Optimization"), /*#__PURE__*/React.createElement("p", {
630
+ className: "text-sm text-green-700"
631
+ }, "Multiple shade options (9/18/27) with strategic distribution - more values where designers need them most.")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", {
632
+ className: "font-medium text-green-800 mb-1"
633
+ }, "Visual Consistency"), /*#__PURE__*/React.createElement("p", {
634
+ className: "text-sm text-green-700"
635
+ }, "Colors maintain their intensity and don't appear washed out, creating trustworthy fintech interfaces."))))), /*#__PURE__*/React.createElement("div", {
636
+ className: "mb-8 bg-purple-50 p-6 rounded-lg"
637
+ }, /*#__PURE__*/React.createElement("div", {
638
+ className: "flex items-center justify-between mb-4"
639
+ }, /*#__PURE__*/React.createElement("h2", {
640
+ className: "text-xl font-semibold text-purple-900 flex items-center gap-2"
641
+ }, /*#__PURE__*/React.createElement(Icon, {
642
+ name: "Collections",
643
+ size: "large",
644
+ customCss: "text-gray-700"
645
+ }), "Palette Export"), /*#__PURE__*/React.createElement("button", {
646
+ onClick: function onClick() {
647
+ return setShowExportPanel(!showExportPanel);
648
+ },
649
+ className: "px-4 py-2 bg-purple-100 text-purple-700 rounded-lg hover:bg-purple-200 transition-colors"
650
+ }, showExportPanel ? 'Hide Export' : 'Show Export Options')), /*#__PURE__*/React.createElement("div", {
651
+ className: "grid grid-cols-1 md:grid-cols-3 gap-6 mb-4"
652
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
653
+ className: "block text-sm font-medium text-purple-800 mb-2"
654
+ }, "Palette Name"), /*#__PURE__*/React.createElement("input", {
655
+ type: "text",
656
+ value: paletteName,
657
+ onChange: function onChange(e) {
658
+ return setPaletteName(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ''));
659
+ },
660
+ placeholder: "primary",
661
+ className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
662
+ }), /*#__PURE__*/React.createElement("p", {
663
+ className: "text-xs text-purple-600 mt-1"
664
+ }, "Used for variable names (e.g., ", paletteName, "-01, ", paletteName, "-", String(outputCount).padStart(2, '0'), ")")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
665
+ className: "block text-sm font-medium text-purple-800 mb-2"
666
+ }, "Number of Colors"), /*#__PURE__*/React.createElement("select", {
667
+ value: outputCount,
668
+ onChange: function onChange(e) {
669
+ return setOutputCount(Number(e.target.value));
670
+ },
671
+ className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
672
+ }, /*#__PURE__*/React.createElement("option", {
673
+ value: 9
674
+ }, "9 Colors (Essential)"), /*#__PURE__*/React.createElement("option", {
675
+ value: 18
676
+ }, "18 Colors (Balanced)"), /*#__PURE__*/React.createElement("option", {
677
+ value: 27
678
+ }, "27 Colors (Comprehensive)")), /*#__PURE__*/React.createElement("p", {
679
+ className: "text-xs text-purple-600 mt-1"
680
+ }, outputCount === 9 && 'Minimal palette for simple designs', outputCount === 18 && 'Balanced coverage for most use cases', outputCount === 27 && 'Maximum granularity for complex systems')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
681
+ className: "block text-sm font-medium text-purple-800 mb-2"
682
+ }, "Export Format"), /*#__PURE__*/React.createElement("select", {
683
+ value: exportFormat,
684
+ onChange: function onChange(e) {
685
+ return setExportFormat(e.target.value);
686
+ },
687
+ className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
688
+ }, /*#__PURE__*/React.createElement("option", {
689
+ value: "hex"
690
+ }, "Hex Values"), /*#__PURE__*/React.createElement("option", {
691
+ value: "json"
692
+ }, "JSON"), /*#__PURE__*/React.createElement("option", {
693
+ value: "css"
694
+ }, "CSS Variables"), /*#__PURE__*/React.createElement("option", {
695
+ value: "scss"
696
+ }, "SCSS Variables"), /*#__PURE__*/React.createElement("option", {
697
+ value: "tailwind"
698
+ }, "Tailwind Config")))), /*#__PURE__*/React.createElement("div", {
699
+ className: "mb-4"
700
+ }, /*#__PURE__*/React.createElement("button", {
701
+ onClick: addPaletteToCollection,
702
+ className: "w-full flex items-center justify-center gap-2 px-4 py-3 bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-lg hover:from-purple-700 hover:to-blue-700 transition-all shadow-md hover:shadow-lg font-medium"
703
+ }, /*#__PURE__*/React.createElement(Icon, {
704
+ name: "Add",
705
+ size: "medium",
706
+ customCss: "text-white"
707
+ }), "Add \"", paletteName, "\" to Collection (", paletteCollection.length, " saved)"), /*#__PURE__*/React.createElement("p", {
708
+ className: "text-xs text-purple-600 mt-2 text-center"
709
+ }, "Save this palette to your collection. You can create multiple palettes and view them all below.")), showExportPanel && /*#__PURE__*/React.createElement("div", {
710
+ className: "bg-white p-4 rounded-lg border border-purple-200"
711
+ }, /*#__PURE__*/React.createElement("div", {
712
+ className: "flex items-center justify-between mb-3"
713
+ }, /*#__PURE__*/React.createElement("h3", {
714
+ className: "font-medium text-gray-700"
715
+ }, "Generated ", exportFormat.toUpperCase(), " Output"), /*#__PURE__*/React.createElement("div", {
716
+ className: "flex gap-2"
717
+ }, /*#__PURE__*/React.createElement("button", {
718
+ onClick: copyToClipboard,
719
+ className: "flex items-center gap-1 px-3 py-1 bg-gray-100 text-gray-700 rounded hover:bg-gray-200 transition-colors text-sm"
720
+ }, "Copy"), /*#__PURE__*/React.createElement("button", {
721
+ onClick: downloadPalette,
722
+ className: "flex items-center gap-1 px-3 py-1 bg-purple-600 text-white rounded hover:bg-purple-700 transition-colors text-sm"
723
+ }, "Download"))), /*#__PURE__*/React.createElement("pre", {
724
+ className: "bg-gray-50 p-3 rounded text-xs overflow-x-auto max-h-60 overflow-y-auto border"
725
+ }, /*#__PURE__*/React.createElement("code", null, generateExportData())))), /*#__PURE__*/React.createElement("div", {
726
+ className: "mb-8"
727
+ }, /*#__PURE__*/React.createElement("h2", {
728
+ className: "text-xl font-semibold text-gray-900 mb-4"
729
+ }, "\uD83C\uDF9B\uFE0F Interactive Controls"), /*#__PURE__*/React.createElement("div", {
730
+ className: "bg-amber-50 p-3 rounded-lg mb-4"
731
+ }, /*#__PURE__*/React.createElement("p", {
732
+ className: "text-sm text-amber-800"
733
+ }, /*#__PURE__*/React.createElement("strong", null, "Try this:"), " Set a bright color (high saturation), then adjust the target lightness to see how the algorithm compensates to maintain visual intensity. Compare different output counts to find the right granularity.")), /*#__PURE__*/React.createElement("div", {
734
+ className: "grid grid-cols-1 md:grid-cols-2 gap-6"
735
+ }, /*#__PURE__*/React.createElement("div", {
736
+ className: "space-y-6"
737
+ }, /*#__PURE__*/React.createElement("h3", {
738
+ className: "font-medium text-gray-700 border-b pb-2"
739
+ }, "Base Color Definition"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
740
+ className: "block text-sm font-medium text-gray-700 mb-2"
741
+ }, "Base Hue: ", baseHue, "\xB0 ", /*#__PURE__*/React.createElement("span", {
742
+ className: "text-xs text-gray-500"
743
+ }, "(Color wheel position)")), /*#__PURE__*/React.createElement(RangeSlider, {
744
+ value: [baseHue],
745
+ onValueChange: function onValueChange(_ref2) {
746
+ var _ref3 = _slicedToArray(_ref2, 1),
747
+ value = _ref3[0];
748
+ return setBaseHue(value);
749
+ },
750
+ min: 0,
751
+ max: 360,
752
+ step: 1,
753
+ className: "w-full"
754
+ }), /*#__PURE__*/React.createElement("p", {
755
+ className: "text-xs text-gray-500 mt-1"
756
+ }, "0\xB0 = Red, 120\xB0 = Green, 240\xB0 = Blue, 360\xB0 = Red again")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
757
+ className: "block text-sm font-medium text-gray-700 mb-2"
758
+ }, "Base Saturation: ", baseSaturation, "% ", /*#__PURE__*/React.createElement("span", {
759
+ className: "text-xs text-gray-500"
760
+ }, "(Color intensity)")), /*#__PURE__*/React.createElement(RangeSlider, {
761
+ value: [baseSaturation],
762
+ onValueChange: function onValueChange(_ref4) {
763
+ var _ref5 = _slicedToArray(_ref4, 1),
764
+ value = _ref5[0];
765
+ return setBaseSaturation(value);
766
+ },
767
+ min: 0,
768
+ max: 100,
769
+ step: 1,
770
+ className: "w-full"
771
+ }), /*#__PURE__*/React.createElement("p", {
772
+ className: "text-xs text-gray-500 mt-1"
773
+ }, "0% = Grayscale, 100% = Maximum color intensity")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
774
+ className: "block text-sm font-medium text-gray-700 mb-2"
775
+ }, "Base Lightness: ", baseLightness, "% ", /*#__PURE__*/React.createElement("span", {
776
+ className: "text-xs text-gray-500"
777
+ }, "(Reference point)")), /*#__PURE__*/React.createElement(RangeSlider, {
778
+ value: [baseLightness],
779
+ onValueChange: function onValueChange(_ref6) {
780
+ var _ref7 = _slicedToArray(_ref6, 1),
781
+ value = _ref7[0];
782
+ return setBaseLightness(value);
783
+ },
784
+ min: 0,
785
+ max: 100,
786
+ step: 1,
787
+ className: "w-full"
788
+ }), /*#__PURE__*/React.createElement("p", {
789
+ className: "text-xs text-gray-500 mt-1"
790
+ }, "This is the lightness where saturation stays at Base Saturation value. Colors further from this value get more saturation boost."))), /*#__PURE__*/React.createElement("div", {
791
+ className: "space-y-6"
792
+ }, /*#__PURE__*/React.createElement("h3", {
793
+ className: "font-medium text-gray-700 border-b pb-2"
794
+ }, "Algorithm Settings"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
795
+ className: "block text-sm font-medium text-gray-700 mb-2"
796
+ }, "Target Lightness: ", targetLightness, "% ", /*#__PURE__*/React.createElement("span", {
797
+ className: "text-xs text-gray-500"
798
+ }, "(Comparison point)")), /*#__PURE__*/React.createElement(RangeSlider, {
799
+ value: [targetLightness],
800
+ onValueChange: function onValueChange(_ref8) {
801
+ var _ref9 = _slicedToArray(_ref8, 1),
802
+ value = _ref9[0];
803
+ return setTargetLightness(value);
804
+ },
805
+ min: 0,
806
+ max: 100,
807
+ step: 1,
808
+ className: "w-full"
809
+ }), /*#__PURE__*/React.createElement("p", {
810
+ className: "text-xs text-gray-500 mt-1"
811
+ }, "Adjust to see how the algorithm compensates at different lightness levels")), /*#__PURE__*/React.createElement("div", {
812
+ className: "bg-gray-50 p-4 rounded-lg"
813
+ }, /*#__PURE__*/React.createElement("label", {
814
+ className: "flex items-start space-x-3"
815
+ }, /*#__PURE__*/React.createElement("input", {
816
+ type: "checkbox",
817
+ checked: usePerceivedBrightness,
818
+ onChange: function onChange(e) {
819
+ return setUsePerceivedBrightness(e.target.checked);
820
+ },
821
+ className: "rounded border-gray-300 mt-1"
822
+ }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
823
+ className: "text-sm font-medium text-gray-700"
824
+ }, "Use Perceived Brightness Algorithm"), /*#__PURE__*/React.createElement("p", {
825
+ className: "text-xs text-gray-500 mt-1"
826
+ }, /*#__PURE__*/React.createElement("strong", null, "Advanced:"), " Uses luminance formula \u221A(0.299r\xB2 + 0.587g\xB2 + 0.114b\xB2) / 255 to maintain consistent perceived brightness across lightness levels."), /*#__PURE__*/React.createElement("p", {
827
+ className: "text-xs text-gray-500 mt-1"
828
+ }, /*#__PURE__*/React.createElement("strong", null, "Simple (unchecked):"), " Uses distance-based compensation for faster calculation.")))), /*#__PURE__*/React.createElement("div", {
829
+ className: "bg-blue-50 p-3 rounded"
830
+ }, /*#__PURE__*/React.createElement("h4", {
831
+ className: "text-sm font-medium text-blue-800 mb-1"
832
+ }, "Algorithm Comparison"), /*#__PURE__*/React.createElement("div", {
833
+ className: "text-xs text-blue-700 space-y-1"
834
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("strong", null, "Simple Method:"), " Fast, intuitive, good for most design systems"), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("strong", null, "Perceived Brightness:"), " Mathematically accurate, matches human vision")))))), /*#__PURE__*/React.createElement("div", {
835
+ className: "mb-8"
836
+ }, /*#__PURE__*/React.createElement("h2", {
837
+ className: "text-xl font-semibold text-gray-900 mb-4"
838
+ }, "\uD83C\uDFA8 Color Comparison"), /*#__PURE__*/React.createElement("div", {
839
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4"
840
+ }, /*#__PURE__*/React.createElement("div", {
841
+ className: "text-center"
842
+ }, /*#__PURE__*/React.createElement("div", {
843
+ className: "w-full h-24 rounded-lg mb-2 border shadow-sm",
844
+ style: {
845
+ backgroundColor: formatRgb(baseColor)
846
+ }
847
+ }), /*#__PURE__*/React.createElement("h3", {
848
+ className: "font-medium text-gray-900"
849
+ }, "\uD83C\uDFAF Base Color"), /*#__PURE__*/React.createElement("p", {
850
+ className: "text-sm text-gray-600 font-mono"
851
+ }, formatHsl(baseHue, baseSaturation, baseLightness)), /*#__PURE__*/React.createElement("p", {
852
+ className: "text-xs text-gray-500 font-mono"
853
+ }, rgbToHex.apply(void 0, _toConsumableArray(baseColor)))), /*#__PURE__*/React.createElement("div", {
854
+ className: "text-center"
855
+ }, /*#__PURE__*/React.createElement("div", {
856
+ className: "w-full h-24 rounded-lg mb-2 border shadow-sm",
857
+ style: {
858
+ backgroundColor: formatRgb(standardTargetColor)
859
+ }
860
+ }), /*#__PURE__*/React.createElement("h3", {
861
+ className: "font-medium text-gray-900"
862
+ }, "\u274C Standard HSL"), /*#__PURE__*/React.createElement("p", {
863
+ className: "text-sm text-gray-600 font-mono"
864
+ }, formatHsl(baseHue, baseSaturation, targetLightness)), /*#__PURE__*/React.createElement("p", {
865
+ className: "text-xs text-gray-500 font-mono"
866
+ }, rgbToHex.apply(void 0, _toConsumableArray(standardTargetColor))), /*#__PURE__*/React.createElement("p", {
867
+ className: "text-xs text-red-600 mt-1"
868
+ }, /*#__PURE__*/React.createElement("strong", null, "Problem:"), " Saturation appears washed out")), /*#__PURE__*/React.createElement("div", {
869
+ className: "text-center"
870
+ }, /*#__PURE__*/React.createElement("div", {
871
+ className: "w-full h-24 rounded-lg mb-2 border shadow-sm",
872
+ style: {
873
+ backgroundColor: formatRgb(adjustedTargetColor)
874
+ }
875
+ }), /*#__PURE__*/React.createElement("h3", {
876
+ className: "font-medium text-gray-900"
877
+ }, "\u2705 Adjusted HSL"), /*#__PURE__*/React.createElement("p", {
878
+ className: "text-sm text-gray-600 font-mono"
879
+ }, formatHsl(baseHue, adjustedSaturation, targetLightness)), /*#__PURE__*/React.createElement("p", {
880
+ className: "text-xs text-gray-500 font-mono"
881
+ }, rgbToHex.apply(void 0, _toConsumableArray(adjustedTargetColor))), /*#__PURE__*/React.createElement("p", {
882
+ className: "text-xs text-green-600 mt-1"
883
+ }, /*#__PURE__*/React.createElement("strong", null, "Solution:"), " Saturation boosted to ", Math.round(adjustedSaturation), "%"))), /*#__PURE__*/React.createElement("div", {
884
+ className: "mt-4 p-4 bg-blue-50 rounded-lg"
885
+ }, /*#__PURE__*/React.createElement("h4", {
886
+ className: "font-medium text-blue-800 mb-2"
887
+ }, "\uD83D\uDD27 How the Adjustment Works"), /*#__PURE__*/React.createElement("p", {
888
+ className: "text-sm text-blue-700 mb-2"
889
+ }, "The algorithm uses ", /*#__PURE__*/React.createElement("strong", null, "Base Lightness (", baseLightness, "%)"), " as a reference point where saturation remains at ", /*#__PURE__*/React.createElement("strong", null, baseSaturation, "%"), ". For the target lightness of ", /*#__PURE__*/React.createElement("strong", null, targetLightness, "%"), ", it increased saturation to ", /*#__PURE__*/React.createElement("strong", null, Math.round(adjustedSaturation), "%"), "(a boost of ", /*#__PURE__*/React.createElement("strong", null, "+", Math.round(adjustedSaturation - baseSaturation), "%"), ") to maintain visual color intensity."), /*#__PURE__*/React.createElement("p", {
890
+ className: "text-xs text-blue-600"
891
+ }, "\uD83D\uDCA1 ", /*#__PURE__*/React.createElement("strong", null, "Tip:"), " Colors closer to Base Lightness need less adjustment. Colors far from Base Lightness get more saturation boost."))), /*#__PURE__*/React.createElement("div", {
892
+ className: "mb-8"
893
+ }, /*#__PURE__*/React.createElement("div", {
894
+ className: "flex items-center justify-between mb-4"
895
+ }, /*#__PURE__*/React.createElement("h2", {
896
+ className: "text-xl font-semibold text-gray-900"
897
+ }, "Complete ", outputCount, "-Shade Lightness Scale"), /*#__PURE__*/React.createElement("div", {
898
+ className: "text-sm text-gray-600"
899
+ }, "Palette: \"", paletteName, "\" \u2022 ", outputCount, " colors \u2022 Format: ", exportFormat.toUpperCase())), /*#__PURE__*/React.createElement("div", {
900
+ className: "space-y-6"
901
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
902
+ className: "font-medium text-gray-700 mb-3"
903
+ }, "Standard HSL (Fixed Saturation)"), /*#__PURE__*/React.createElement("div", {
904
+ className: "grid gap-1 ".concat(outputCount === 9 ? 'grid-cols-9' : outputCount === 18 ? 'grid-cols-6 sm:grid-cols-9 md:grid-cols-12 lg:grid-cols-18' : 'grid-cols-9 sm:grid-cols-13 md:grid-cols-17 lg:grid-cols-27')
905
+ }, colorSwatches.map(function (swatch, index) {
906
+ return /*#__PURE__*/React.createElement("div", {
907
+ key: "standard-".concat(swatch.lightness, "-").concat(index),
908
+ className: "flex flex-col items-center"
909
+ }, /*#__PURE__*/React.createElement("div", {
910
+ className: "w-full aspect-square border border-gray-200 rounded-sm",
911
+ style: {
912
+ backgroundColor: formatRgb(swatch.standard.rgb)
913
+ },
914
+ title: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0'), ": L=").concat(swatch.lightness, "%, S=").concat(Math.round(swatch.standard.saturation), "%")
915
+ }), /*#__PURE__*/React.createElement("p", {
916
+ className: "text-xs text-center mt-1 text-gray-500"
917
+ }, Math.round(swatch.lightness)));
918
+ })), /*#__PURE__*/React.createElement("div", {
919
+ className: "mt-2 text-xs text-gray-500"
920
+ }, "Notice how colors become washed out at extreme lightness values")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
921
+ className: "font-medium text-gray-700 mb-3"
922
+ }, "Adjusted HSL (Compensated Saturation)"), /*#__PURE__*/React.createElement("div", {
923
+ className: "grid gap-1 ".concat(outputCount === 9 ? 'grid-cols-9' : outputCount === 18 ? 'grid-cols-6 sm:grid-cols-9 md:grid-cols-12 lg:grid-cols-18' : 'grid-cols-9 sm:grid-cols-13 md:grid-cols-17 lg:grid-cols-27')
924
+ }, colorSwatches.map(function (swatch, index) {
925
+ return /*#__PURE__*/React.createElement("div", {
926
+ key: "adjusted-".concat(swatch.lightness, "-").concat(index),
927
+ className: "flex flex-col items-center"
928
+ }, /*#__PURE__*/React.createElement("div", {
929
+ className: "w-full aspect-square border border-gray-200 rounded-sm",
930
+ style: {
931
+ backgroundColor: formatRgb(swatch.adjusted.rgb)
932
+ },
933
+ title: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0'), ": ").concat(swatch.adjusted.hex, " (L=").concat(swatch.lightness, "%, S=").concat(Math.round(swatch.adjusted.saturation), "%)")
934
+ }), /*#__PURE__*/React.createElement("p", {
935
+ className: "text-xs text-center mt-1 text-gray-500"
936
+ }, String(index + 1).padStart(2, '0')));
937
+ })), /*#__PURE__*/React.createElement("div", {
938
+ className: "mt-2 text-xs text-gray-500"
939
+ }, "Hover over swatches to see variable names and hex values. Numbers below represent the shade index.")))), /*#__PURE__*/React.createElement("div", {
940
+ className: "mb-6"
941
+ }, /*#__PURE__*/React.createElement("h3", {
942
+ className: "text-lg font-semibold text-gray-900 mb-3"
943
+ }, "\uD83D\uDCCA ", outputCount, "-Shade Progression Strategy"), /*#__PURE__*/React.createElement("div", {
944
+ className: "grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4"
945
+ }, /*#__PURE__*/React.createElement("div", {
946
+ className: "bg-gray-50 p-4 rounded-lg"
947
+ }, /*#__PURE__*/React.createElement("h4", {
948
+ className: "font-medium text-gray-700 mb-2"
949
+ }, "\uD83C\uDFAF ", outputCount === 9 ? 'Essential' : outputCount === 18 ? 'Balanced' : 'Comprehensive', " Pattern"), /*#__PURE__*/React.createElement("p", {
950
+ className: "text-sm text-gray-600 mb-2"
951
+ }, outputCount === 9 && 'Core colors for minimal design systems with focus on essential UI states.', outputCount === 18 && 'Balanced distribution providing good coverage across the lightness spectrum.', outputCount === 27 && 'Strategic distribution with higher density in the 40-80% range where most UI colors are used.'), /*#__PURE__*/React.createElement("div", {
952
+ className: "text-xs font-mono bg-white p-2 rounded overflow-x-auto"
953
+ }, "[", getProgressionPattern(outputCount).join('../..'), "]")), /*#__PURE__*/React.createElement("div", {
954
+ className: "bg-blue-50 p-4 rounded-lg"
955
+ }, /*#__PURE__*/React.createElement("h4", {
956
+ className: "font-medium text-blue-800 mb-2"
957
+ }, "\uD83C\uDFA8 Usage Distribution"), outputCount === 9 && /*#__PURE__*/React.createElement("ul", {
958
+ className: "text-sm text-blue-700 space-y-1"
959
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "2 dark"), " (8-18%): Text, strong contrast"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "3 medium"), " (32-58%): Interactive elements"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "4 light"), " (70-96%): Backgrounds, subtle states")), outputCount === 18 && /*#__PURE__*/React.createElement("ul", {
960
+ className: "text-sm text-blue-700 space-y-1"
961
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "4 dark"), " (2-30%): Text, borders, contrast"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "6 medium"), " (38-70%): Buttons, interactive UI"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "8 light"), " (75-99%): Backgrounds, hover states")), outputCount === 27 && /*#__PURE__*/React.createElement("ul", {
962
+ className: "text-sm text-blue-700 space-y-1"
963
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "5 very dark"), " (2-19%): Backgrounds, borders"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "5 dark"), " (24-44%): Text, icons, contrast"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "7 mid-tones"), " (48-72%): Most UI elements"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "5 light"), " (76-90%): UI backgrounds, interactive states"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "5 very light"), " (92-98%): Subtle backgrounds, minimal contrast"))), /*#__PURE__*/React.createElement("div", {
964
+ className: "bg-green-50 p-4 rounded-lg"
965
+ }, /*#__PURE__*/React.createElement("h4", {
966
+ className: "font-medium text-green-800 mb-2"
967
+ }, "\u2728 Why This Works"), /*#__PURE__*/React.createElement("ul", {
968
+ className: "text-sm text-green-700 space-y-1"
969
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Perceptually aware:"), " More values where designers need them"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Professional grade:"), " Matches industry standards"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Practical:"), " Avoids wasted extreme values"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Scalable:"), " Works for ", outputCount === 9 ? 'simple' : outputCount === 18 ? 'moderate' : 'complex', " design systems")))), /*#__PURE__*/React.createElement("div", {
970
+ className: "bg-amber-50 p-4 rounded-lg"
971
+ }, /*#__PURE__*/React.createElement("h4", {
972
+ className: "font-medium text-amber-800 mb-2"
973
+ }, "\uD83D\uDCC8 Pattern Comparison"), /*#__PURE__*/React.createElement("div", {
974
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4 text-sm"
975
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
976
+ className: "font-medium text-amber-700 mb-1"
977
+ }, "9 Shades (Essential):"), /*#__PURE__*/React.createElement("ul", {
978
+ className: "text-amber-700 space-y-1"
979
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 Perfect for minimal design systems"), /*#__PURE__*/React.createElement("li", null, "\u2022 Core functionality covered"), /*#__PURE__*/React.createElement("li", null, "\u2022 Fast implementation"), /*#__PURE__*/React.createElement("li", null, "\u2022 Reduced decision fatigue"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
980
+ className: "font-medium text-amber-700 mb-1"
981
+ }, "18 Shades (Balanced):"), /*#__PURE__*/React.createElement("ul", {
982
+ className: "text-amber-700 space-y-1"
983
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 Good for most applications"), /*#__PURE__*/React.createElement("li", null, "\u2022 Balanced granularity"), /*#__PURE__*/React.createElement("li", null, "\u2022 Flexible design options"), /*#__PURE__*/React.createElement("li", null, "\u2022 Manageable complexity"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
984
+ className: "font-medium text-amber-700 mb-1"
985
+ }, "27 Shades (Comprehensive):"), /*#__PURE__*/React.createElement("ul", {
986
+ className: "text-amber-700 space-y-1"
987
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 Enterprise-grade systems"), /*#__PURE__*/React.createElement("li", null, "\u2022 Maximum flexibility"), /*#__PURE__*/React.createElement("li", null, "\u2022 Fine-grained control"), /*#__PURE__*/React.createElement("li", null, "\u2022 Professional polish")))))), /*#__PURE__*/React.createElement("div", {
988
+ className: "bg-gray-50 p-6 rounded-lg"
989
+ }, /*#__PURE__*/React.createElement("h2", {
990
+ className: "text-xl font-semibold text-gray-900 mb-4"
991
+ }, "\uD83D\uDD2C Mathematical Implementation"), /*#__PURE__*/React.createElement("div", {
992
+ className: "space-y-6"
993
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
994
+ className: "font-medium text-gray-700 mb-2"
995
+ }, "Simple Method"), /*#__PURE__*/React.createElement("p", {
996
+ className: "text-sm text-gray-600 mb-2"
997
+ }, "Increases saturation based on distance from Base Lightness:"), /*#__PURE__*/React.createElement("code", {
998
+ className: "bg-white p-3 rounded text-sm block font-mono"
999
+ }, "adjusted_saturation = original_saturation + (|target_lightness - base_lightness| \xD7 0.8)"), /*#__PURE__*/React.createElement("p", {
1000
+ className: "text-xs text-gray-500 mt-2"
1001
+ }, "Capped at 40% boost to prevent over-saturation. Fast and intuitive for most design systems. Base Lightness (", baseLightness, "%) is the reference point where saturation stays at ", baseSaturation, "%.")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
1002
+ className: "font-medium text-gray-700 mb-2"
1003
+ }, "Perceived Brightness Method"), /*#__PURE__*/React.createElement("p", {
1004
+ className: "text-sm text-gray-600 mb-2"
1005
+ }, "Uses the luminance formula to maintain consistent perceived brightness:"), /*#__PURE__*/React.createElement("code", {
1006
+ className: "bg-white p-3 rounded text-sm block font-mono"
1007
+ }, "perceived_brightness = \u221A(0.299\xD7r\xB2 + 0.587\xD7g\xB2 + 0.114\xD7b\xB2) / 255"), /*#__PURE__*/React.createElement("p", {
1008
+ className: "text-xs text-gray-500 mt-2"
1009
+ }, "The algorithm uses binary search (20 iterations) to find the saturation value that keeps this luminance constant across different lightness levels. Coefficients represent human eye sensitivity to RGB channels.")), /*#__PURE__*/React.createElement("div", {
1010
+ className: "mt-6 grid grid-cols-1 md:grid-cols-2 gap-6"
1011
+ }, /*#__PURE__*/React.createElement("div", {
1012
+ className: "p-4 bg-green-50 rounded"
1013
+ }, /*#__PURE__*/React.createElement("h4", {
1014
+ className: "font-medium text-green-800 mb-2"
1015
+ }, "Design System Benefits"), /*#__PURE__*/React.createElement("ul", {
1016
+ className: "text-sm text-green-700 space-y-1"
1017
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, outputCount, " shades"), " provide ", outputCount === 9 ? 'essential' : outputCount === 18 ? 'balanced' : 'comprehensive', " granularity"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Perceptual consistency"), " across all lightness levels"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Professional scales"), " matching industry standards"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Multiple export formats"), " for any tech stack"))), /*#__PURE__*/React.createElement("div", {
1018
+ className: "p-4 bg-blue-50 rounded"
1019
+ }, /*#__PURE__*/React.createElement("h4", {
1020
+ className: "font-medium text-blue-800 mb-2"
1021
+ }, "Export Format Examples"), /*#__PURE__*/React.createElement("div", {
1022
+ className: "space-y-2 text-sm"
1023
+ }, /*#__PURE__*/React.createElement("div", {
1024
+ className: "bg-white p-2 rounded"
1025
+ }, /*#__PURE__*/React.createElement("strong", null, "CSS:"), " ", /*#__PURE__*/React.createElement("code", null, "var(--color-", paletteName, "-", String(Math.ceil(outputCount / 2)).padStart(2, '0'), ")")), /*#__PURE__*/React.createElement("div", {
1026
+ className: "bg-white p-2 rounded"
1027
+ }, /*#__PURE__*/React.createElement("strong", null, "SCSS:"), " ", /*#__PURE__*/React.createElement("code", null, "$color-", paletteName, "-", String(Math.ceil(outputCount / 2)).padStart(2, '0'))), /*#__PURE__*/React.createElement("div", {
1028
+ className: "bg-white p-2 rounded"
1029
+ }, /*#__PURE__*/React.createElement("strong", null, "Tailwind:"), " ", /*#__PURE__*/React.createElement("code", null, "bg-", paletteName, "-", String(Math.ceil(outputCount / 2)).padStart(2, '0')))))), /*#__PURE__*/React.createElement("div", {
1030
+ className: "mt-6 p-4 bg-purple-50 rounded"
1031
+ }, /*#__PURE__*/React.createElement("h4", {
1032
+ className: "font-medium text-purple-800 mb-2"
1033
+ }, "Current Configuration"), /*#__PURE__*/React.createElement("div", {
1034
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm"
1035
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("ul", {
1036
+ className: "text-purple-700 space-y-1"
1037
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Palette:"), " \"", paletteName, "\" (", outputCount, " colors)"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Base Color:"), " HSL(", baseHue, "\xB0, ", baseSaturation, "%, ", baseLightness, "%)"), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Algorithm:"), " ", usePerceivedBrightness ? 'Perceived Brightness' : 'Simple Distance-based'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("ul", {
1038
+ className: "text-purple-700 space-y-1"
1039
+ }, /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Export Format:"), " ", exportFormat.toUpperCase()), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Progression:"), " ", outputCount === 9 ? 'Essential' : outputCount === 18 ? 'Balanced' : 'Comprehensive'), /*#__PURE__*/React.createElement("li", null, "\u2022 ", /*#__PURE__*/React.createElement("strong", null, "Range:"), " ", Math.min.apply(Math, _toConsumableArray(getProgressionPattern(outputCount))), "% - ", Math.max.apply(Math, _toConsumableArray(getProgressionPattern(outputCount))), "%"))))))), paletteCollection.length > 0 && /*#__PURE__*/React.createElement("div", {
1040
+ className: "mt-12 pt-8 border-t-4 border-purple-300"
1041
+ }, /*#__PURE__*/React.createElement("div", {
1042
+ className: "flex items-center justify-between mb-6"
1043
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", {
1044
+ className: "text-2xl font-bold text-gray-900 flex items-center gap-2"
1045
+ }, /*#__PURE__*/React.createElement(Icon, {
1046
+ name: "Collections",
1047
+ size: "large",
1048
+ customCss: "text-purple-600"
1049
+ }), "Your Palette Collection"), /*#__PURE__*/React.createElement("p", {
1050
+ className: "text-sm text-gray-600 mt-1"
1051
+ }, paletteCollection.length, " ", paletteCollection.length === 1 ? 'palette' : 'palettes', " saved")), /*#__PURE__*/React.createElement("button", {
1052
+ onClick: exportCollection,
1053
+ className: "flex items-center gap-2 px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors shadow-md"
1054
+ }, /*#__PURE__*/React.createElement(Icon, {
1055
+ name: "Download",
1056
+ size: "medium",
1057
+ customCss: "text-white"
1058
+ }), "Export All as JSON")), /*#__PURE__*/React.createElement("div", {
1059
+ className: "space-y-6"
1060
+ }, paletteCollection.map(function (palette) {
1061
+ var _palette$colors, _palette$colors2, _palette$colors3;
1062
+ return /*#__PURE__*/React.createElement("div", {
1063
+ key: palette.id,
1064
+ className: "bg-white border-2 border-gray-200 rounded-xl p-6 shadow-lg hover:shadow-xl transition-shadow"
1065
+ }, /*#__PURE__*/React.createElement("div", {
1066
+ className: "flex items-start justify-between mb-4"
1067
+ }, /*#__PURE__*/React.createElement("div", {
1068
+ className: "flex-1"
1069
+ }, /*#__PURE__*/React.createElement("h3", {
1070
+ className: "text-xl font-bold text-gray-900 mb-1"
1071
+ }, palette.name), /*#__PURE__*/React.createElement("div", {
1072
+ className: "flex flex-wrap gap-3 text-xs text-gray-600"
1073
+ }, /*#__PURE__*/React.createElement("span", {
1074
+ className: "flex items-center gap-1"
1075
+ }, /*#__PURE__*/React.createElement(Icon, {
1076
+ name: "Palette",
1077
+ size: "small",
1078
+ customCss: "text-gray-500"
1079
+ }), palette.config.outputCount, " shades"), /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, "HSL(", palette.config.baseHue, "\xB0, ", palette.config.baseSaturation, "%, ", palette.config.baseLightness, "%)"), /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, palette.config.usePerceivedBrightness ? 'Perceived Brightness' : 'Simple', " Algorithm"), /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, new Date(palette.timestamp).toLocaleString()))), /*#__PURE__*/React.createElement("button", {
1080
+ onClick: function onClick() {
1081
+ return removePaletteFromCollection(palette.id);
1082
+ },
1083
+ className: "ml-4 p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",
1084
+ title: "Remove palette"
1085
+ }, /*#__PURE__*/React.createElement(Icon, {
1086
+ name: "Delete",
1087
+ size: "medium",
1088
+ customCss: "text-red-600"
1089
+ }))), /*#__PURE__*/React.createElement("div", {
1090
+ className: "grid gap-2 ".concat(palette.config.outputCount === 9 ? 'grid-cols-9' : palette.config.outputCount === 18 ? 'grid-cols-6 sm:grid-cols-9 md:grid-cols-12 lg:grid-cols-18' : 'grid-cols-9 sm:grid-cols-13 md:grid-cols-17 lg:grid-cols-27')
1091
+ }, (_palette$colors = palette.colors) === null || _palette$colors === void 0 ? void 0 : _palette$colors.map(function (color) {
1092
+ return /*#__PURE__*/React.createElement("div", {
1093
+ key: color.name,
1094
+ className: "group relative"
1095
+ }, /*#__PURE__*/React.createElement("div", {
1096
+ className: "w-full aspect-square rounded-lg border-2 border-gray-200 shadow-sm hover:shadow-md transition-all cursor-pointer hover:scale-110",
1097
+ style: {
1098
+ backgroundColor: color.hex
1099
+ },
1100
+ title: "".concat(color.name, "\n").concat(color.hex, "\nHSL(").concat(Math.round(color.hsl[0]), ", ").concat(Math.round(color.hsl[1]), "%, ").concat(Math.round(color.hsl[2]), "%)\nLightness: ").concat(color.lightness, "%")
1101
+ }), /*#__PURE__*/React.createElement("div", {
1102
+ className: "absolute hidden group-hover:flex flex-col items-center justify-center inset-0 bg-black bg-opacity-75 rounded-lg text-white text-xs font-mono p-1"
1103
+ }, /*#__PURE__*/React.createElement("div", {
1104
+ className: "font-bold"
1105
+ }, color.name), /*#__PURE__*/React.createElement("div", null, color.hex), /*#__PURE__*/React.createElement("div", {
1106
+ className: "text-[10px]"
1107
+ }, "L:", Math.round(color.lightness), "%")));
1108
+ })), /*#__PURE__*/React.createElement("details", {
1109
+ className: "mt-4"
1110
+ }, /*#__PURE__*/React.createElement("summary", {
1111
+ className: "cursor-pointer text-sm font-medium text-purple-700 hover:text-purple-900"
1112
+ }, "Show Color Details (", ((_palette$colors2 = palette.colors) === null || _palette$colors2 === void 0 ? void 0 : _palette$colors2.length) || 0, " colors)"), /*#__PURE__*/React.createElement("div", {
1113
+ className: "mt-3 bg-gray-50 rounded-lg p-4 max-h-60 overflow-y-auto"
1114
+ }, /*#__PURE__*/React.createElement("div", {
1115
+ className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 text-xs font-mono"
1116
+ }, (_palette$colors3 = palette.colors) === null || _palette$colors3 === void 0 ? void 0 : _palette$colors3.map(function (color) {
1117
+ return /*#__PURE__*/React.createElement("div", {
1118
+ key: color.name,
1119
+ className: "bg-white p-2 rounded border border-gray-200 hover:border-purple-300 transition-colors"
1120
+ }, /*#__PURE__*/React.createElement("div", {
1121
+ className: "flex items-center gap-2 mb-1"
1122
+ }, /*#__PURE__*/React.createElement("div", {
1123
+ className: "w-6 h-6 rounded border border-gray-300",
1124
+ style: {
1125
+ backgroundColor: color.hex
1126
+ }
1127
+ }), /*#__PURE__*/React.createElement("span", {
1128
+ className: "font-bold text-gray-900"
1129
+ }, color.name)), /*#__PURE__*/React.createElement("div", {
1130
+ className: "text-gray-700"
1131
+ }, color.hex), /*#__PURE__*/React.createElement("div", {
1132
+ className: "text-gray-500 text-[10px]"
1133
+ }, "RGB(", color.rgb[0], ", ", color.rgb[1], ", ", color.rgb[2], ")"), /*#__PURE__*/React.createElement("div", {
1134
+ className: "text-gray-500 text-[10px]"
1135
+ }, "HSL(", Math.round(color.hsl[0]), ", ", Math.round(color.hsl[1]), "%, ", Math.round(color.hsl[2]), "%)"));
1136
+ })))));
1137
+ }))));
1138
+ };
1139
+ export { HSLTool };