@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.
- package/LICENSE +73 -0
- package/README.md +142 -0
- package/lib/assets/icons.js +67 -0
- package/lib/components/AccountOverview/AccountOverview.js +122 -0
- package/lib/components/AdminPanel.js +58 -0
- package/lib/components/AssetExchange/AssetExchange.js +189 -0
- package/lib/components/AuthenticationFlow.js +216 -0
- package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
- package/lib/components/DevFooter.js +38 -0
- package/lib/components/DevMenu.js +35 -0
- package/lib/components/DevSidebar.js +28 -0
- package/lib/components/DigitalDisplay.js +83 -0
- package/lib/components/Footer.js +45 -0
- package/lib/components/HeroContainer.js +10 -0
- package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
- package/lib/components/Logo.js +259 -0
- package/lib/components/MenuBar.js +56 -0
- package/lib/components/NetworkSettings.js +223 -0
- package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
- package/lib/components/RisingSun.js +122 -0
- package/lib/components/Symbol.js +226 -0
- package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
- package/lib/components/TransactionConfirmation.js +184 -0
- package/lib/components/WalletMenu.js +33 -0
- package/lib/components/console/code/CodeBlock.js +150 -0
- package/lib/components/console/code/index.js +9 -0
- package/lib/components/console/data/DataTable.js +245 -0
- package/lib/components/console/data/MetricCard.js +79 -0
- package/lib/components/console/data/index.js +11 -0
- package/lib/components/console/documentation/index.js +10 -0
- package/lib/components/console/forms/APIKeyGenerator.js +261 -0
- package/lib/components/console/forms/SearchBar.js +210 -0
- package/lib/components/console/forms/index.js +10 -0
- package/lib/components/console/index.js +29 -0
- package/lib/components/console/layout/ConsoleCard.js +82 -0
- package/lib/components/console/layout/ConsoleLayout.js +86 -0
- package/lib/components/console/layout/index.js +10 -0
- package/lib/components/console/monitoring/StatusIndicator.js +128 -0
- package/lib/components/console/monitoring/index.js +9 -0
- package/lib/components/console/navigation/DevFooter.js +38 -0
- package/lib/components/console/navigation/DevMenu.js +35 -0
- package/lib/components/console/navigation/DevSidebar.js +28 -0
- package/lib/components/console/navigation/index.js +11 -0
- package/lib/components/console/settings/index.js +10 -0
- package/lib/components/index.js +12 -0
- package/lib/design/ColorPicker.stories.js +9 -0
- package/lib/design/HSLTool-V1.js +345 -0
- package/lib/design/HSLTool-V2.js +475 -0
- package/lib/design/HSLTool-V3.js +543 -0
- package/lib/design/HSLTool-V4.js +1139 -0
- package/lib/design/HSLTool.js +374 -0
- package/lib/design/OKLCHColorPicker.stories.js +24 -0
- package/lib/design/OKLCHTool.js +1014 -0
- package/lib/index.js +4 -0
- package/lib/shared/components/Avatar/Avatar.js +18 -0
- package/lib/shared/components/Avatar/index.js +1 -0
- package/lib/shared/components/Badge/Badge.js +34 -0
- package/lib/shared/components/Badge/index.js +1 -0
- package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
- package/lib/shared/components/Breadcrumb/index.js +1 -0
- package/lib/shared/components/Button/Button.js +184 -0
- package/lib/shared/components/Button/index.js +1 -0
- package/lib/shared/components/Calendar/Calendar.js +155 -0
- package/lib/shared/components/Calendar/CalendarDay.js +251 -0
- package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
- package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
- package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
- package/lib/shared/components/Calendar/constants.js +73 -0
- package/lib/shared/components/Calendar/index.js +3 -0
- package/lib/shared/components/Calendar/types.d.js +0 -0
- package/lib/shared/components/Cartel/Cartel.js +44 -0
- package/lib/shared/components/Cartel/index.js +1 -0
- package/lib/shared/components/Cell/Cell.js +105 -0
- package/lib/shared/components/Cell/index.js +1 -0
- package/lib/shared/components/Checkbox/Checkbox.js +27 -0
- package/lib/shared/components/Checkbox/index.js +1 -0
- package/lib/shared/components/Clock/Clock.js +6 -0
- package/lib/shared/components/Clock/index.js +1 -0
- package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
- package/lib/shared/components/ColorChecker/index.js +2 -0
- package/lib/shared/components/ColorChecker/utils.js +159 -0
- package/lib/shared/components/Command/Command.js +95 -0
- package/lib/shared/components/Command/index.js +1 -0
- package/lib/shared/components/Container/Container.js +18 -0
- package/lib/shared/components/Container/index.js +1 -0
- package/lib/shared/components/Cover/Cover.js +17 -0
- package/lib/shared/components/Cover/index.js +1 -0
- package/lib/shared/components/DatePicker/DatePicker.js +52 -0
- package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
- package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
- package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
- package/lib/shared/components/DatePicker/components/index.js +2 -0
- package/lib/shared/components/DatePicker/index.js +1 -0
- package/lib/shared/components/DateTime/DateTime.js +51 -0
- package/lib/shared/components/DateTime/index.js +1 -0
- package/lib/shared/components/Debug/Debug.js +12 -0
- package/lib/shared/components/Debug/index.js +1 -0
- package/lib/shared/components/Disclosure/Disclosure.js +31 -0
- package/lib/shared/components/Disclosure/index.js +1 -0
- package/lib/shared/components/Dropdown/Dropdown.js +91 -0
- package/lib/shared/components/Dropdown/index.js +1 -0
- package/lib/shared/components/EmptyState/EmptyState.js +40 -0
- package/lib/shared/components/EmptyState/index.js +1 -0
- package/lib/shared/components/Form/Form.js +41 -0
- package/lib/shared/components/Form/components/DynamicForm.js +66 -0
- package/lib/shared/components/Form/components/StepperForm.js +266 -0
- package/lib/shared/components/Form/components/index.js +2 -0
- package/lib/shared/components/Form/context/Form.js +164 -0
- package/lib/shared/components/Form/context/index.js +1 -0
- package/lib/shared/components/Form/index.js +1 -0
- package/lib/shared/components/Form/types.d.js +1 -0
- package/lib/shared/components/Form/utils/index.js +31 -0
- package/lib/shared/components/GroupItems/GroupItems.js +17 -0
- package/lib/shared/components/GroupItems/index.js +1 -0
- package/lib/shared/components/Header/Header.js +26 -0
- package/lib/shared/components/Header/index.js +1 -0
- package/lib/shared/components/Heading/Heading.js +5 -0
- package/lib/shared/components/Heading/index.js +1 -0
- package/lib/shared/components/Icon/Icon.js +28 -0
- package/lib/shared/components/Icon/index.js +1 -0
- package/lib/shared/components/Identicons/Identicons.js +6 -0
- package/lib/shared/components/Identicons/index.d.js +0 -0
- package/lib/shared/components/Identicons/index.js +1 -0
- package/lib/shared/components/Image/Image.js +22 -0
- package/lib/shared/components/Image/index.js +1 -0
- package/lib/shared/components/Input/Input.js +201 -0
- package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
- package/lib/shared/components/Input/components/DateInput.js +89 -0
- package/lib/shared/components/Input/components/DefaultInput.js +102 -0
- package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
- package/lib/shared/components/Input/components/NumberInput.js +141 -0
- package/lib/shared/components/Input/components/PickerInput.js +122 -0
- package/lib/shared/components/Input/components/RCInput.js +112 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
- package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
- package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
- package/lib/shared/components/Input/components/SelectInput.js +70 -0
- package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
- package/lib/shared/components/Input/components/TextInput.js +139 -0
- package/lib/shared/components/Input/components/TimeInput.js +37 -0
- package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
- package/lib/shared/components/Input/components/index.js +13 -0
- package/lib/shared/components/Input/components/types.d.js +0 -0
- package/lib/shared/components/Input/index.js +1 -0
- package/lib/shared/components/Input/types.d.js +0 -0
- package/lib/shared/components/Layout/Layout.js +13 -0
- package/lib/shared/components/Layout/index.js +1 -0
- package/lib/shared/components/List/List.js +30 -0
- package/lib/shared/components/List/index.js +1 -0
- package/lib/shared/components/Loader/Loader.js +27 -0
- package/lib/shared/components/Loader/index.js +1 -0
- package/lib/shared/components/Modal/Modal.js +102 -0
- package/lib/shared/components/Modal/index.js +1 -0
- package/lib/shared/components/Notification/Notification.js +39 -0
- package/lib/shared/components/Notification/index.js +1 -0
- package/lib/shared/components/Person/Person.js +81 -0
- package/lib/shared/components/Person/index.js +1 -0
- package/lib/shared/components/Popover/Popover.js +39 -0
- package/lib/shared/components/Popover/index.js +1 -0
- package/lib/shared/components/QRCode/QRCode.js +329 -0
- package/lib/shared/components/QRCode/index.js +1 -0
- package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
- package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
- package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
- package/lib/shared/components/RadioGroup/components/index.js +2 -0
- package/lib/shared/components/RadioGroup/index.js +1 -0
- package/lib/shared/components/Search/Search.js +12 -0
- package/lib/shared/components/Search/index.js +1 -0
- package/lib/shared/components/Select/Select.js +90 -0
- package/lib/shared/components/Select/index.js +1 -0
- package/lib/shared/components/Sidebar/Sidebar.js +42 -0
- package/lib/shared/components/Sidebar/index.js +1 -0
- package/lib/shared/components/SlideOver/SlideOver.js +81 -0
- package/lib/shared/components/SlideOver/index.js +1 -0
- package/lib/shared/components/Slider/Slider.js +80 -0
- package/lib/shared/components/Slider/index.js +1 -0
- package/lib/shared/components/Stepper/Stepper.js +32 -0
- package/lib/shared/components/Stepper/index.js +1 -0
- package/lib/shared/components/Steps/Steps.js +53 -0
- package/lib/shared/components/Steps/index.js +1 -0
- package/lib/shared/components/Switch/Switch.js +26 -0
- package/lib/shared/components/Switch/index.js +1 -0
- package/lib/shared/components/Tab/Tab.js +59 -0
- package/lib/shared/components/Tab/index.js +1 -0
- package/lib/shared/components/Table/Table.js +47 -0
- package/lib/shared/components/Table/index.js +1 -0
- package/lib/shared/components/Text/Text.js +11 -0
- package/lib/shared/components/Text/index.js +1 -0
- package/lib/shared/components/TextList/TextList.js +15 -0
- package/lib/shared/components/TextList/index.js +1 -0
- package/lib/shared/components/TimePicker/TimePicker.js +161 -0
- package/lib/shared/components/TimePicker/index.js +1 -0
- package/lib/shared/components/Tooltip/Tooltip.js +13 -0
- package/lib/shared/components/Tooltip/index.js +1 -0
- package/lib/shared/components/Uploader/Uploader.js +63 -0
- package/lib/shared/components/Uploader/index.js +1 -0
- package/lib/shared/components/Video/Video.js +20 -0
- package/lib/shared/components/Video/index.js +1 -0
- package/lib/shared/components/index.d.js +0 -0
- package/lib/shared/components/index.js +50 -0
- package/lib/shared/elements/Color/ColorPallet.js +20 -0
- package/lib/shared/elements/Color/index.js +1 -0
- package/lib/shared/elements/Text.js +37 -0
- package/lib/shared/elements/index.js +1 -0
- package/lib/shared/helpers/FakeLink.js +8 -0
- package/lib/shared/helpers/constants.js +359 -0
- package/lib/shared/helpers/index.js +2 -0
- package/lib/shared/helpers/isEqual.js +56 -0
- package/lib/shared/index.d.js +0 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/stories/components/Avatar.stories.js +17 -0
- package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
- package/lib/shared/stories/components/Button.stories.js +553 -0
- package/lib/shared/stories/components/Calendar.stories.js +62 -0
- package/lib/shared/stories/components/Cartel.stories.js +32 -0
- package/lib/shared/stories/components/Checkbox.stories.js +15 -0
- package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
- package/lib/shared/stories/components/DateTime.stories.js +27 -0
- package/lib/shared/stories/components/Disclosure.stories.js +30 -0
- package/lib/shared/stories/components/Dropdown.stories.js +39 -0
- package/lib/shared/stories/components/Form/Default.stories.js +201 -0
- package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
- package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
- package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
- package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
- package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
- package/lib/shared/stories/components/GroupItems.stories.js +23 -0
- package/lib/shared/stories/components/Header.stories.js +29 -0
- package/lib/shared/stories/components/Heading.stories.js +27 -0
- package/lib/shared/stories/components/Icon.stories.js +22 -0
- package/lib/shared/stories/components/Image.stories.js +23 -0
- package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
- package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
- package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
- package/lib/shared/stories/components/Input/Number.stories.js +24 -0
- package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
- package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
- package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
- package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
- package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
- package/lib/shared/stories/components/List.stories.js +34 -0
- package/lib/shared/stories/components/Loader.stories.js +15 -0
- package/lib/shared/stories/components/Modal.stories.js +50 -0
- package/lib/shared/stories/components/Notification.stories.js +22 -0
- package/lib/shared/stories/components/Person.stories.js +41 -0
- package/lib/shared/stories/components/Picker.stories.js +15 -0
- package/lib/shared/stories/components/Popover.stories.js +36 -0
- package/lib/shared/stories/components/QRCode.stories.js +20 -0
- package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
- package/lib/shared/stories/components/Select.stories.js +50 -0
- package/lib/shared/stories/components/Sidebar.stories.js +35 -0
- package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
- package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
- package/lib/shared/stories/components/Steps.stories.js +15 -0
- package/lib/shared/stories/components/Switch.stories.js +15 -0
- package/lib/shared/stories/components/Tab.stories.js +15 -0
- package/lib/shared/stories/components/Table.stories.js +95 -0
- package/lib/shared/stories/components/TextList.stories.js +23 -0
- package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
- package/lib/shared/stories/elements/Color.stories.js +269 -0
- package/lib/shared/stories/elements/Text.stories.js +45 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
- package/lib/stories/Foundation/Logo.stories.js +19 -0
- package/lib/stories/Foundation/RisingSun.stories.js +16 -0
- package/lib/stories/Foundation/Shadows.stories.js +601 -0
- package/lib/stories/Foundation/Symbol.stories.js +18 -0
- package/lib/stories/HeroContainer.stories.js +18 -0
- package/lib/styles/accessibilityTokens.js +72 -0
- package/lib/styles/borderWidth.js +10 -0
- package/lib/styles/colors.js +303 -0
- package/lib/styles/elevation.js +240 -0
- package/lib/styles/icons.js +218 -0
- package/lib/styles/index.js +29 -0
- package/lib/styles/motion.js +668 -0
- package/lib/styles/opacity.js +10 -0
- package/lib/styles/radius.js +11 -0
- package/lib/styles/sizing.js +35 -0
- package/lib/styles/space.js +24 -0
- package/lib/styles/theme/darkTheme.js +471 -0
- package/lib/styles/theme/index.js +44 -0
- package/lib/styles/theme/lightTheme.js +480 -0
- package/lib/styles/theme/themeTypes.js +1 -0
- package/lib/styles/theme/themeUtils.js +63 -0
- package/lib/styles/typography-advanced.js +510 -0
- package/lib/styles/typography.js +1419 -0
- package/lib/styles/zIndex.js +19 -0
- package/lib/tokens/borders.js +161 -0
- package/lib/tokens/colors.js +426 -0
- package/lib/tokens/components.js +499 -0
- package/lib/tokens/index.js +84 -0
- package/lib/tokens/lighting.js +384 -0
- package/lib/tokens/motion.js +284 -0
- package/lib/tokens/semantic.js +367 -0
- package/lib/tokens/shadows.js +114 -0
- package/lib/tokens/spacing.js +189 -0
- package/lib/tokens/typography.js +268 -0
- package/package.json +176 -0
- package/styles/generated-tokens.css +677 -0
- package/styles/index.css +2 -0
- package/styles/main.css +610 -0
- package/tailwind.config.js +64 -0
|
@@ -0,0 +1,1014 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
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); }
|
|
6
|
+
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); }); }; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
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); }
|
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
|
+
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."); }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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; } }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
21
|
+
import { Icon } from "../shared/elements/Icon";
|
|
22
|
+
import { RangeSlider } from "../shared/components/forms/RangeSlider";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* OKLCH COLOR TOOL
|
|
26
|
+
*
|
|
27
|
+
* A modern color palette generator using the OKLCH color space, which provides
|
|
28
|
+
* perceptually uniform lightness across all hues. This is a significant improvement
|
|
29
|
+
* over HSL, which has non-uniform brightness perception.
|
|
30
|
+
*
|
|
31
|
+
* FEATURES:
|
|
32
|
+
* - OKLCH color space (perceptually uniform)
|
|
33
|
+
* - Gentle chroma compensation for extreme lightness values
|
|
34
|
+
* - Overlay/tint feature to unify color palettes
|
|
35
|
+
* - Multi-hue palette support
|
|
36
|
+
* - Palette collection system
|
|
37
|
+
* - Multiple export formats
|
|
38
|
+
*
|
|
39
|
+
* COLOR SPACE: OKLCH
|
|
40
|
+
* - L (Lightness): 0-1 (0 = black, 1 = white) - perceptually uniform
|
|
41
|
+
* - C (Chroma): 0-0.4 (0 = grayscale, 0.4 = maximum saturation)
|
|
42
|
+
* - H (Hue): 0-360 degrees (same as HSL)
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
var OKLCHTool = function OKLCHTool() {
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// STATE MANAGEMENT
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
// Base color properties
|
|
51
|
+
var _useState = useState(240),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
baseHue = _useState2[0],
|
|
54
|
+
setBaseHue = _useState2[1]; // 0-360 degrees
|
|
55
|
+
var _useState3 = useState(0.2),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
baseChroma = _useState4[0],
|
|
58
|
+
setBaseChroma = _useState4[1]; // 0-0.4 (OKLCH uses smaller values)
|
|
59
|
+
var _useState5 = useState(0.6),
|
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
+
baseLightness = _useState6[0],
|
|
62
|
+
setBaseLightness = _useState6[1]; // 0-1 (reference point)
|
|
63
|
+
|
|
64
|
+
// Palette configuration
|
|
65
|
+
var _useState7 = useState('primary'),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
paletteName = _useState8[0],
|
|
68
|
+
setPaletteName = _useState8[1];
|
|
69
|
+
var _useState9 = useState(27),
|
|
70
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
71
|
+
outputCount = _useState0[0],
|
|
72
|
+
setOutputCount = _useState0[1]; // 9, 18, or 27 colors
|
|
73
|
+
|
|
74
|
+
// Overlay/tint feature (your trick!)
|
|
75
|
+
var _useState1 = useState(false),
|
|
76
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
77
|
+
overlayEnabled = _useState10[0],
|
|
78
|
+
setOverlayEnabled = _useState10[1];
|
|
79
|
+
var _useState11 = useState({
|
|
80
|
+
l: 0.8,
|
|
81
|
+
c: 0.05,
|
|
82
|
+
h: 60
|
|
83
|
+
}),
|
|
84
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
85
|
+
overlayColor = _useState12[0],
|
|
86
|
+
setOverlayColor = _useState12[1];
|
|
87
|
+
var _useState13 = useState(0.15),
|
|
88
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
89
|
+
overlayOpacity = _useState14[0],
|
|
90
|
+
setOverlayOpacity = _useState14[1]; // 0-1
|
|
91
|
+
|
|
92
|
+
// Export settings
|
|
93
|
+
var _useState15 = useState('hex'),
|
|
94
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
95
|
+
exportFormat = _useState16[0],
|
|
96
|
+
setExportFormat = _useState16[1];
|
|
97
|
+
var _useState17 = useState(false),
|
|
98
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
99
|
+
showExportPanel = _useState18[0],
|
|
100
|
+
setShowExportPanel = _useState18[1];
|
|
101
|
+
|
|
102
|
+
// Palette collection
|
|
103
|
+
var _useState19 = useState([]),
|
|
104
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
105
|
+
paletteCollection = _useState20[0],
|
|
106
|
+
setPaletteCollection = _useState20[1];
|
|
107
|
+
|
|
108
|
+
// Chroma compensation algorithm selection
|
|
109
|
+
var _useState21 = useState(true),
|
|
110
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
111
|
+
useChromaCompensation = _useState22[0],
|
|
112
|
+
setUseChromaCompensation = _useState22[1];
|
|
113
|
+
|
|
114
|
+
// Palette purpose: determines chroma behavior at extreme lightness
|
|
115
|
+
var _useState23 = useState('colored'),
|
|
116
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
117
|
+
palettePurpose = _useState24[0],
|
|
118
|
+
setPalettePurpose = _useState24[1]; // 'colored': 'neutral', 'subtle'
|
|
119
|
+
|
|
120
|
+
// ============================================================================
|
|
121
|
+
// OKLCH ↔ RGB CONVERSION FUNCTIONS
|
|
122
|
+
// ============================================================================
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Converts OKLCH to RGB
|
|
126
|
+
* Chain: OKLCH → OKLab → XYZ → Linear RGB → sRGB
|
|
127
|
+
*/
|
|
128
|
+
var oklchToRgb = useCallback(function (l, c, h) {
|
|
129
|
+
// Step 1: OKLCH → OKLab (cylindrical to cartesian)
|
|
130
|
+
var hRad = h * Math.PI / 180;
|
|
131
|
+
var a = c * Math.cos(hRad);
|
|
132
|
+
var b = c * Math.sin(hRad);
|
|
133
|
+
|
|
134
|
+
// Step 2: OKLab → Linear RGB
|
|
135
|
+
var l_ = l + 0.3963377774 * a + 0.2158037573 * b;
|
|
136
|
+
var m_ = l - 0.1055613458 * a - 0.0638541728 * b;
|
|
137
|
+
var s_ = l - 0.0894841775 * a - 1.2914855480 * b;
|
|
138
|
+
var l3 = l_ * l_ * l_;
|
|
139
|
+
var m3 = m_ * m_ * m_;
|
|
140
|
+
var s3 = s_ * s_ * s_;
|
|
141
|
+
var r = +4.0767416621 * l3 - 3.3077115913 * m3 + 0.2309699292 * s3;
|
|
142
|
+
var g = -1.2684380046 * l3 + 2.6097574011 * m3 - 0.3413193965 * s3;
|
|
143
|
+
var b_ = -0.0041960863 * l3 - 0.7034186147 * m3 + 1.7076147010 * s3;
|
|
144
|
+
|
|
145
|
+
// Step 3: Linear RGB → sRGB (gamma correction)
|
|
146
|
+
var gammaCorrect = function gammaCorrect(val) {
|
|
147
|
+
if (val <= 0.0031308) {
|
|
148
|
+
return 12.92 * val;
|
|
149
|
+
}
|
|
150
|
+
return 1.055 * Math.pow(val, 1 / 2.4) - 0.055;
|
|
151
|
+
};
|
|
152
|
+
r = gammaCorrect(r);
|
|
153
|
+
g = gammaCorrect(g);
|
|
154
|
+
b_ = gammaCorrect(b_);
|
|
155
|
+
|
|
156
|
+
// Clamp and convert to 0-255 range
|
|
157
|
+
r = Math.max(0, Math.min(1, r)) * 255;
|
|
158
|
+
g = Math.max(0, Math.min(1, g)) * 255;
|
|
159
|
+
b_ = Math.max(0, Math.min(1, b_)) * 255;
|
|
160
|
+
return [Math.round(r), Math.round(g), Math.round(b_)];
|
|
161
|
+
}, []);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Converts RGB to hex color code
|
|
165
|
+
*/
|
|
166
|
+
var rgbToHex = useCallback(function (r, g, b) {
|
|
167
|
+
return "#" + [r, g, b].map(function (x) {
|
|
168
|
+
var hex = x.toString(16);
|
|
169
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
170
|
+
}).join("");
|
|
171
|
+
}, []);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Applies overlay/tint to a color
|
|
175
|
+
* This is your trick! Blends a semi-transparent overlay color on top.
|
|
176
|
+
*/
|
|
177
|
+
var applyOverlay = useCallback(function (baseRgb, overlayRgb, opacity) {
|
|
178
|
+
if (!overlayEnabled || opacity === 0) return baseRgb;
|
|
179
|
+
var _baseRgb = _slicedToArray(baseRgb, 3),
|
|
180
|
+
br = _baseRgb[0],
|
|
181
|
+
bg = _baseRgb[1],
|
|
182
|
+
bb = _baseRgb[2];
|
|
183
|
+
var _overlayRgb = _slicedToArray(overlayRgb, 3),
|
|
184
|
+
or = _overlayRgb[0],
|
|
185
|
+
og = _overlayRgb[1],
|
|
186
|
+
ob = _overlayRgb[2];
|
|
187
|
+
|
|
188
|
+
// Alpha blending
|
|
189
|
+
var r = Math.round(or * opacity + br * (1 - opacity));
|
|
190
|
+
var g = Math.round(og * opacity + bg * (1 - opacity));
|
|
191
|
+
var b = Math.round(ob * opacity + bb * (1 - opacity));
|
|
192
|
+
return [r, g, b];
|
|
193
|
+
}, [overlayEnabled]);
|
|
194
|
+
|
|
195
|
+
// ============================================================================
|
|
196
|
+
// CHROMA COMPENSATION ALGORITHM
|
|
197
|
+
// ============================================================================
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Calculates adjusted chroma for extreme lightness values
|
|
201
|
+
*
|
|
202
|
+
* OKLCH already has perceptually uniform lightness, but chroma still
|
|
203
|
+
* appears to wash out at extremes (though less severely than HSL).
|
|
204
|
+
*
|
|
205
|
+
* This algorithm adjusts chroma based on the palette purpose:
|
|
206
|
+
*
|
|
207
|
+
* COLORED MODE: For UI elements (buttons, badges, links)
|
|
208
|
+
* - Maintains strong color presence at all lightness levels
|
|
209
|
+
* - Gently boosts chroma at extremes
|
|
210
|
+
*
|
|
211
|
+
* NEUTRAL MODE: For backgrounds and surfaces
|
|
212
|
+
* - Reduces chroma dramatically at high lightness (90%+)
|
|
213
|
+
* - Creates near-grayscale backgrounds
|
|
214
|
+
* - Perfect for cards, panels, app backgrounds
|
|
215
|
+
*
|
|
216
|
+
* SUBTLE MODE: Hybrid approach
|
|
217
|
+
* - Gentle chroma reduction at high lightness
|
|
218
|
+
* - Still maintains some color character
|
|
219
|
+
*/
|
|
220
|
+
var calculateAdjustedChroma = useCallback(function (originalChroma, originalLight, targetLight) {
|
|
221
|
+
// NEUTRAL MODE: Reduce chroma for backgrounds
|
|
222
|
+
if (palettePurpose === 'neutral') {
|
|
223
|
+
// At high lightness, dramatically reduce chroma
|
|
224
|
+
if (targetLight > 0.7) {
|
|
225
|
+
// Exponential reduction for light values
|
|
226
|
+
var reductionFactor = Math.pow(1 - targetLight, 2) * 5;
|
|
227
|
+
var reducedChroma = originalChroma * reductionFactor;
|
|
228
|
+
return Math.max(0.005, reducedChroma); // Keep minimum chroma
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// At low lightness, also reduce but less dramatically
|
|
232
|
+
if (targetLight < 0.3) {
|
|
233
|
+
var _reductionFactor = Math.pow(targetLight, 1.5) * 2;
|
|
234
|
+
var _reducedChroma = originalChroma * _reductionFactor;
|
|
235
|
+
return Math.max(0.01, _reducedChroma);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Mid-tones keep more chroma
|
|
239
|
+
return originalChroma * 0.8;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// SUBTLE MODE: Gentle chroma reduction
|
|
243
|
+
if (palettePurpose === 'subtle') {
|
|
244
|
+
if (targetLight > 0.8) {
|
|
245
|
+
// Reduce chroma gently at very high lightness
|
|
246
|
+
var _reductionFactor2 = (1 - targetLight) * 2;
|
|
247
|
+
return originalChroma * Math.max(0.3, _reductionFactor2);
|
|
248
|
+
}
|
|
249
|
+
if (targetLight < 0.2) {
|
|
250
|
+
// Slight reduction at very dark values
|
|
251
|
+
var _reductionFactor3 = targetLight * 3;
|
|
252
|
+
return originalChroma * Math.max(0.5, _reductionFactor3);
|
|
253
|
+
}
|
|
254
|
+
return originalChroma * 0.95;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// COLORED MODE: Original behavior - maintain strong color
|
|
258
|
+
if (!useChromaCompensation) {
|
|
259
|
+
return originalChroma;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// GENTLE COMPENSATION: OKLCH needs less adjustment than HSL
|
|
263
|
+
// Calculate distance from base lightness
|
|
264
|
+
var distance = Math.abs(targetLight - originalLight);
|
|
265
|
+
|
|
266
|
+
// Gentle boost: only 0.3x multiplier (vs 0.8x for HSL)
|
|
267
|
+
// Cap at 0.1 (vs 40% for HSL)
|
|
268
|
+
var chromaBoost = Math.min(distance * 0.3, 0.1);
|
|
269
|
+
|
|
270
|
+
// Keep chroma within valid OKLCH range (0-0.4)
|
|
271
|
+
return Math.min(0.4, originalChroma + chromaBoost);
|
|
272
|
+
}, [useChromaCompensation, palettePurpose]);
|
|
273
|
+
|
|
274
|
+
// ============================================================================
|
|
275
|
+
// LIGHTNESS PROGRESSION PATTERNS
|
|
276
|
+
// ============================================================================
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Gets the lightness progression pattern for the specified output count
|
|
280
|
+
* Same patterns as HSL Tool for consistency, but converted to 0-1 range
|
|
281
|
+
*/
|
|
282
|
+
var getProgressionPattern = useCallback(function (count) {
|
|
283
|
+
var pattern;
|
|
284
|
+
switch (count) {
|
|
285
|
+
case 9:
|
|
286
|
+
pattern = [8, 18, 32, 45, 58, 70, 82, 91, 96];
|
|
287
|
+
break;
|
|
288
|
+
case 18:
|
|
289
|
+
pattern = [2, 8, 15, 22, 30, 38, 45, 52, 58, 65, 70, 75, 82, 87, 91, 94, 97, 99];
|
|
290
|
+
break;
|
|
291
|
+
case 27:
|
|
292
|
+
default:
|
|
293
|
+
pattern = [2, 6, 10, 14, 19, 24, 29, 34, 39, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 87, 90, 92, 94, 96, 97, 98];
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Convert from 0-100 range to 0-1 range for OKLCH
|
|
298
|
+
return pattern.map(function (v) {
|
|
299
|
+
return v / 100;
|
|
300
|
+
});
|
|
301
|
+
}, []);
|
|
302
|
+
|
|
303
|
+
// ============================================================================
|
|
304
|
+
// COLOR SWATCH GENERATION
|
|
305
|
+
// ============================================================================
|
|
306
|
+
|
|
307
|
+
var colorSwatches = useMemo(function () {
|
|
308
|
+
var swatches = [];
|
|
309
|
+
var lightnessValues = getProgressionPattern(outputCount);
|
|
310
|
+
var overlayRgb = oklchToRgb(overlayColor.l, overlayColor.c, overlayColor.h);
|
|
311
|
+
lightnessValues.forEach(function (lightness) {
|
|
312
|
+
// Standard OKLCH: Fixed chroma
|
|
313
|
+
var standardRgb = oklchToRgb(lightness, baseChroma, baseHue);
|
|
314
|
+
|
|
315
|
+
// Adjusted OKLCH: Compensated chroma
|
|
316
|
+
var adjustedChroma = calculateAdjustedChroma(baseChroma, baseLightness, lightness);
|
|
317
|
+
var adjustedRgb = oklchToRgb(lightness, adjustedChroma, baseHue);
|
|
318
|
+
|
|
319
|
+
// With overlay applied
|
|
320
|
+
var standardWithOverlay = applyOverlay(standardRgb, overlayRgb, overlayOpacity);
|
|
321
|
+
var adjustedWithOverlay = applyOverlay(adjustedRgb, overlayRgb, overlayOpacity);
|
|
322
|
+
swatches.push({
|
|
323
|
+
lightness: lightness,
|
|
324
|
+
standard: {
|
|
325
|
+
rgb: standardRgb,
|
|
326
|
+
oklch: {
|
|
327
|
+
l: lightness,
|
|
328
|
+
c: baseChroma,
|
|
329
|
+
h: baseHue
|
|
330
|
+
},
|
|
331
|
+
chroma: baseChroma,
|
|
332
|
+
hex: rgbToHex.apply(void 0, _toConsumableArray(standardRgb)),
|
|
333
|
+
withOverlay: standardWithOverlay,
|
|
334
|
+
hexWithOverlay: rgbToHex.apply(void 0, _toConsumableArray(standardWithOverlay))
|
|
335
|
+
},
|
|
336
|
+
adjusted: {
|
|
337
|
+
rgb: adjustedRgb,
|
|
338
|
+
oklch: {
|
|
339
|
+
l: lightness,
|
|
340
|
+
c: adjustedChroma,
|
|
341
|
+
h: baseHue
|
|
342
|
+
},
|
|
343
|
+
chroma: adjustedChroma,
|
|
344
|
+
hex: rgbToHex.apply(void 0, _toConsumableArray(adjustedRgb)),
|
|
345
|
+
withOverlay: adjustedWithOverlay,
|
|
346
|
+
hexWithOverlay: rgbToHex.apply(void 0, _toConsumableArray(adjustedWithOverlay))
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
return swatches;
|
|
351
|
+
}, [baseHue, baseChroma, baseLightness, outputCount, overlayEnabled, overlayColor, overlayOpacity, getProgressionPattern, oklchToRgb, calculateAdjustedChroma, applyOverlay, rgbToHex]);
|
|
352
|
+
|
|
353
|
+
// ============================================================================
|
|
354
|
+
// EXPORT FUNCTIONS
|
|
355
|
+
// ============================================================================
|
|
356
|
+
|
|
357
|
+
var generateExportData = useCallback(function () {
|
|
358
|
+
var useOverlay = overlayEnabled;
|
|
359
|
+
var paletteData = colorSwatches.map(function (swatch, index) {
|
|
360
|
+
return {
|
|
361
|
+
name: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0')),
|
|
362
|
+
lightness: swatch.lightness,
|
|
363
|
+
hex: useOverlay ? swatch.adjusted.hexWithOverlay : swatch.adjusted.hex,
|
|
364
|
+
rgb: useOverlay ? swatch.adjusted.withOverlay : swatch.adjusted.rgb,
|
|
365
|
+
oklch: swatch.adjusted.oklch
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
switch (exportFormat) {
|
|
369
|
+
case 'hex':
|
|
370
|
+
return paletteData.map(function (color) {
|
|
371
|
+
return "".concat(color.name, ": ").concat(color.hex);
|
|
372
|
+
}).join(': ');
|
|
373
|
+
case 'json':
|
|
374
|
+
var jsonData = {
|
|
375
|
+
name: "".concat(paletteName, " Color Palette"),
|
|
376
|
+
description: "Generated using OKLCH color space (".concat(palettePurpose, " mode)").concat(useOverlay ? ' with overlay tint' : ''),
|
|
377
|
+
purpose: palettePurpose,
|
|
378
|
+
baseColor: {
|
|
379
|
+
hue: baseHue,
|
|
380
|
+
chroma: baseChroma,
|
|
381
|
+
lightness: baseLightness
|
|
382
|
+
},
|
|
383
|
+
overlay: useOverlay ? {
|
|
384
|
+
enabled: true,
|
|
385
|
+
color: overlayColor,
|
|
386
|
+
opacity: overlayOpacity
|
|
387
|
+
} : null,
|
|
388
|
+
colors: paletteData.reduce(function (acc, color) {
|
|
389
|
+
acc[color.name] = {
|
|
390
|
+
hex: color.hex,
|
|
391
|
+
rgb: "rgb(".concat(color.rgb.join(': '), ")"),
|
|
392
|
+
oklch: "oklch(".concat((color.oklch.l * 100).toFixed(1), "% ").concat(color.oklch.c.toFixed(3), " ").concat(Math.round(color.oklch.h), ")"),
|
|
393
|
+
lightness: color.lightness
|
|
394
|
+
};
|
|
395
|
+
return acc;
|
|
396
|
+
}, {})
|
|
397
|
+
};
|
|
398
|
+
return JSON.stringify(jsonData, null, 2);
|
|
399
|
+
case 'css':
|
|
400
|
+
var cssVars = paletteData.map(function (color) {
|
|
401
|
+
return " --color-".concat(color.name, ": ").concat(color.hex, ";");
|
|
402
|
+
}).join(': ');
|
|
403
|
+
return ":root {\n".concat(cssVars, "\n}\n\n/* OKLCH Color Palette: ").concat(paletteName, " */");
|
|
404
|
+
case 'scss':
|
|
405
|
+
var scssVars = paletteData.map(function (color) {
|
|
406
|
+
return "$color-".concat(color.name, ": ").concat(color.hex, ";");
|
|
407
|
+
}).join(': ');
|
|
408
|
+
return scssVars;
|
|
409
|
+
case 'tailwind':
|
|
410
|
+
var tailwindColors = paletteData.reduce(function (acc, color) {
|
|
411
|
+
var key = color.name.split('-').pop();
|
|
412
|
+
acc[key] = color.hex;
|
|
413
|
+
return acc;
|
|
414
|
+
}, {});
|
|
415
|
+
var tailwindConfig = {
|
|
416
|
+
theme: {
|
|
417
|
+
extend: {
|
|
418
|
+
colors: _defineProperty({}, paletteName, tailwindColors)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
return "// tailwind.config.js\nmodule.exports = ".concat(JSON.stringify(tailwindConfig, null, 2));
|
|
423
|
+
default:
|
|
424
|
+
return '';
|
|
425
|
+
}
|
|
426
|
+
}, [colorSwatches, paletteName, exportFormat, baseHue, baseChroma, baseLightness, palettePurpose, overlayEnabled, overlayColor, overlayOpacity]);
|
|
427
|
+
var copyToClipboard = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
429
|
+
while (1) switch (_context.prev = _context.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
_context.prev = 0;
|
|
432
|
+
_context.next = 3;
|
|
433
|
+
return navigator.clipboard.writeText(generateExportData());
|
|
434
|
+
case 3:
|
|
435
|
+
console.log('Copied to clipboard!');
|
|
436
|
+
_context.next = 9;
|
|
437
|
+
break;
|
|
438
|
+
case 6:
|
|
439
|
+
_context.prev = 6;
|
|
440
|
+
_context.t0 = _context["catch"](0);
|
|
441
|
+
console.error('Failed to copy: ', _context.t0);
|
|
442
|
+
case 9:
|
|
443
|
+
case "end":
|
|
444
|
+
return _context.stop();
|
|
445
|
+
}
|
|
446
|
+
}, _callee, null, [[0, 6]]);
|
|
447
|
+
})), [generateExportData]);
|
|
448
|
+
var downloadPalette = useCallback(function () {
|
|
449
|
+
var data = generateExportData();
|
|
450
|
+
var extension = exportFormat === 'json' ? 'json' : exportFormat === 'css' ? 'css' : exportFormat === 'scss' ? 'scss' : exportFormat === 'tailwind' ? ': ' : 'txt';
|
|
451
|
+
var blob = new Blob([data], {
|
|
452
|
+
type: 'text/plain'
|
|
453
|
+
});
|
|
454
|
+
var url = URL.createObjectURL(blob);
|
|
455
|
+
var a = document.createElement('a');
|
|
456
|
+
a.href = url;
|
|
457
|
+
a.download = "".concat(paletteName, "-oklch-palette-").concat(outputCount, ".").concat(extension);
|
|
458
|
+
document.body.appendChild(a);
|
|
459
|
+
a.click();
|
|
460
|
+
document.body.removeChild(a);
|
|
461
|
+
URL.revokeObjectURL(url);
|
|
462
|
+
}, [generateExportData, paletteName, exportFormat, outputCount]);
|
|
463
|
+
|
|
464
|
+
// ============================================================================
|
|
465
|
+
// PALETTE COLLECTION MANAGEMENT
|
|
466
|
+
// ============================================================================
|
|
467
|
+
|
|
468
|
+
var addPaletteToCollection = useCallback(function () {
|
|
469
|
+
var newPalette = {
|
|
470
|
+
id: Date.now(),
|
|
471
|
+
name: paletteName,
|
|
472
|
+
timestamp: new Date().toISOString(),
|
|
473
|
+
config: {
|
|
474
|
+
baseHue: baseHue,
|
|
475
|
+
baseChroma: baseChroma,
|
|
476
|
+
baseLightness: baseLightness,
|
|
477
|
+
outputCount: outputCount,
|
|
478
|
+
palettePurpose: palettePurpose,
|
|
479
|
+
useChromaCompensation: useChromaCompensation,
|
|
480
|
+
overlayEnabled: overlayEnabled,
|
|
481
|
+
overlayColor: overlayEnabled ? overlayColor : null,
|
|
482
|
+
overlayOpacity: overlayEnabled ? overlayOpacity : null
|
|
483
|
+
},
|
|
484
|
+
colors: colorSwatches.map(function (swatch, index) {
|
|
485
|
+
return {
|
|
486
|
+
index: index + 1,
|
|
487
|
+
name: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0')),
|
|
488
|
+
lightness: swatch.lightness,
|
|
489
|
+
hex: overlayEnabled ? swatch.adjusted.hexWithOverlay : swatch.adjusted.hex,
|
|
490
|
+
rgb: overlayEnabled ? swatch.adjusted.withOverlay : swatch.adjusted.rgb,
|
|
491
|
+
oklch: swatch.adjusted.oklch,
|
|
492
|
+
chroma: swatch.adjusted.chroma
|
|
493
|
+
};
|
|
494
|
+
})
|
|
495
|
+
};
|
|
496
|
+
setPaletteCollection(function (prev) {
|
|
497
|
+
return [].concat(_toConsumableArray(prev), [newPalette]);
|
|
498
|
+
});
|
|
499
|
+
console.log('Palette added to collection:', newPalette.name);
|
|
500
|
+
}, [paletteName, baseHue, baseChroma, baseLightness, outputCount, palettePurpose, useChromaCompensation, overlayEnabled, overlayColor, overlayOpacity, colorSwatches]);
|
|
501
|
+
var removePaletteFromCollection = useCallback(function (paletteId) {
|
|
502
|
+
setPaletteCollection(function (prev) {
|
|
503
|
+
return prev.filter(function (palette) {
|
|
504
|
+
return palette.id !== paletteId;
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
}, []);
|
|
508
|
+
var exportCollection = useCallback(function () {
|
|
509
|
+
var collectionData = {
|
|
510
|
+
name: 'OKLCH Palette Collection',
|
|
511
|
+
created: new Date().toISOString(),
|
|
512
|
+
colorSpace: 'OKLCH',
|
|
513
|
+
palettes: paletteCollection,
|
|
514
|
+
count: paletteCollection.length
|
|
515
|
+
};
|
|
516
|
+
var data = JSON.stringify(collectionData, null, 2);
|
|
517
|
+
var blob = new Blob([data], {
|
|
518
|
+
type: 'application/json'
|
|
519
|
+
});
|
|
520
|
+
var url = URL.createObjectURL(blob);
|
|
521
|
+
var a = document.createElement('a');
|
|
522
|
+
a.href = url;
|
|
523
|
+
a.download = "oklch-palette-collection-".concat(Date.now(), ".json");
|
|
524
|
+
document.body.appendChild(a);
|
|
525
|
+
a.click();
|
|
526
|
+
document.body.removeChild(a);
|
|
527
|
+
URL.revokeObjectURL(url);
|
|
528
|
+
}, [paletteCollection]);
|
|
529
|
+
|
|
530
|
+
// ============================================================================
|
|
531
|
+
// HELPER FUNCTIONS FOR DISPLAY
|
|
532
|
+
// ============================================================================
|
|
533
|
+
|
|
534
|
+
var formatRgb = function formatRgb(rgb) {
|
|
535
|
+
return "rgb(".concat(rgb[0], ", ").concat(rgb[1], ", ").concat(rgb[2], ")");
|
|
536
|
+
};
|
|
537
|
+
var formatOklch = function formatOklch(l, c, h) {
|
|
538
|
+
return "oklch(".concat((l * 100).toFixed(1), "% ").concat(c.toFixed(3), " ").concat(Math.round(h), ")");
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
// ============================================================================
|
|
542
|
+
// RENDER
|
|
543
|
+
// ============================================================================
|
|
544
|
+
|
|
545
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
546
|
+
className: "max-w-6xl mx-auto p-6 bg-white"
|
|
547
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
548
|
+
className: "mb-8"
|
|
549
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
550
|
+
className: "text-3xl font-bold text-gray-900 mb-4"
|
|
551
|
+
}, "OKLCH Color Palette Generator"), /*#__PURE__*/React.createElement("div", {
|
|
552
|
+
className: "mb-6"
|
|
553
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
554
|
+
className: "text-gray-600 mb-4"
|
|
555
|
+
}, "Create perceptually uniform color palettes using the modern OKLCH color space. OKLCH provides consistent brightness across all hues, unlike HSL."), /*#__PURE__*/React.createElement("div", {
|
|
556
|
+
className: "bg-gradient-to-r from-purple-50 to-blue-50 p-4 rounded-lg border-2 border-purple-200"
|
|
557
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
558
|
+
className: "text-sm text-purple-900"
|
|
559
|
+
}, /*#__PURE__*/React.createElement("strong", null, "\u2728 What's New:"), " OKLCH has perceptually uniform lightness (no hue shift!), gentle chroma compensation, and includes your overlay/tint trick for unified palettes!"))), /*#__PURE__*/React.createElement("div", {
|
|
560
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4 mb-6"
|
|
561
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
562
|
+
className: "bg-blue-50 p-4 rounded-lg"
|
|
563
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
564
|
+
className: "font-semibold text-blue-900 mb-2"
|
|
565
|
+
}, "\uD83C\uDFA8 OKLCH Color Space"), /*#__PURE__*/React.createElement("p", {
|
|
566
|
+
className: "text-sm text-blue-700"
|
|
567
|
+
}, "Perceptually uniform lightness means L=50% looks equally bright for red, green, and blue!")), /*#__PURE__*/React.createElement("div", {
|
|
568
|
+
className: "bg-green-50 p-4 rounded-lg"
|
|
569
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
570
|
+
className: "font-semibold text-green-900 mb-2"
|
|
571
|
+
}, "\uD83C\uDFAD Overlay/Tint Feature"), /*#__PURE__*/React.createElement("p", {
|
|
572
|
+
className: "text-sm text-green-700"
|
|
573
|
+
}, "Apply a semi-transparent wash to unify your palette - like color grading in film!")), /*#__PURE__*/React.createElement("div", {
|
|
574
|
+
className: "bg-amber-50 p-4 rounded-lg"
|
|
575
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
576
|
+
className: "font-semibold text-amber-900 mb-2"
|
|
577
|
+
}, "\uD83D\uDD27 Gentle Compensation"), /*#__PURE__*/React.createElement("p", {
|
|
578
|
+
className: "text-sm text-amber-700"
|
|
579
|
+
}, "OKLCH needs much less adjustment than HSL, preserving color accuracy.")))), /*#__PURE__*/React.createElement("div", {
|
|
580
|
+
className: "mb-8 bg-purple-50 p-6 rounded-lg"
|
|
581
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
582
|
+
className: "text-xl font-semibold text-purple-900 mb-4 flex items-center gap-2"
|
|
583
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
584
|
+
name: "Collections",
|
|
585
|
+
size: "large",
|
|
586
|
+
customCss: "text-purple-700"
|
|
587
|
+
}), "Palette Configuration & Export"), /*#__PURE__*/React.createElement("div", {
|
|
588
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-6 mb-4"
|
|
589
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
590
|
+
className: "block text-sm font-medium text-purple-800 mb-2"
|
|
591
|
+
}, "Palette Name"), /*#__PURE__*/React.createElement("input", {
|
|
592
|
+
type: "text",
|
|
593
|
+
value: paletteName,
|
|
594
|
+
onChange: function onChange(e) {
|
|
595
|
+
return setPaletteName(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ''));
|
|
596
|
+
},
|
|
597
|
+
placeholder: "primary",
|
|
598
|
+
className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
|
|
599
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
600
|
+
className: "block text-sm font-medium text-purple-800 mb-2"
|
|
601
|
+
}, "Number of Colors"), /*#__PURE__*/React.createElement("select", {
|
|
602
|
+
value: outputCount,
|
|
603
|
+
onChange: function onChange(e) {
|
|
604
|
+
return setOutputCount(Number(e.target.value));
|
|
605
|
+
},
|
|
606
|
+
className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
|
|
607
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
608
|
+
value: 9
|
|
609
|
+
}, "9 Colors (Essential)"), /*#__PURE__*/React.createElement("option", {
|
|
610
|
+
value: 18
|
|
611
|
+
}, "18 Colors (Balanced)"), /*#__PURE__*/React.createElement("option", {
|
|
612
|
+
value: 27
|
|
613
|
+
}, "27 Colors (Comprehensive)"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
614
|
+
className: "block text-sm font-medium text-purple-800 mb-2"
|
|
615
|
+
}, "Export Format"), /*#__PURE__*/React.createElement("select", {
|
|
616
|
+
value: exportFormat,
|
|
617
|
+
onChange: function onChange(e) {
|
|
618
|
+
return setExportFormat(e.target.value);
|
|
619
|
+
},
|
|
620
|
+
className: "w-full px-3 py-2 border border-purple-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500"
|
|
621
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
622
|
+
value: "hex"
|
|
623
|
+
}, "Hex Values"), /*#__PURE__*/React.createElement("option", {
|
|
624
|
+
value: "json"
|
|
625
|
+
}, "JSON"), /*#__PURE__*/React.createElement("option", {
|
|
626
|
+
value: "css"
|
|
627
|
+
}, "CSS Variables"), /*#__PURE__*/React.createElement("option", {
|
|
628
|
+
value: "scss"
|
|
629
|
+
}, "SCSS Variables"), /*#__PURE__*/React.createElement("option", {
|
|
630
|
+
value: "tailwind"
|
|
631
|
+
}, "Tailwind Config")))), /*#__PURE__*/React.createElement("div", {
|
|
632
|
+
className: "mb-4"
|
|
633
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
634
|
+
onClick: addPaletteToCollection,
|
|
635
|
+
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"
|
|
636
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
637
|
+
name: "Add",
|
|
638
|
+
size: "medium",
|
|
639
|
+
customCss: "text-white"
|
|
640
|
+
}), "Add \"", paletteName, "\" to Collection (", paletteCollection.length, " saved)")), /*#__PURE__*/React.createElement("button", {
|
|
641
|
+
onClick: function onClick() {
|
|
642
|
+
return setShowExportPanel(!showExportPanel);
|
|
643
|
+
},
|
|
644
|
+
className: "w-full px-4 py-2 bg-purple-100 text-purple-700 rounded-lg hover:bg-purple-200 transition-colors mb-4"
|
|
645
|
+
}, showExportPanel ? 'Hide Export Code' : 'Show Export Code'), showExportPanel && /*#__PURE__*/React.createElement("div", {
|
|
646
|
+
className: "bg-white p-4 rounded-lg border border-purple-200"
|
|
647
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
648
|
+
className: "flex items-center justify-between mb-3"
|
|
649
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
650
|
+
className: "font-medium text-gray-700"
|
|
651
|
+
}, "Generated ", exportFormat.toUpperCase(), " Output"), /*#__PURE__*/React.createElement("div", {
|
|
652
|
+
className: "flex gap-2"
|
|
653
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
654
|
+
onClick: copyToClipboard,
|
|
655
|
+
className: "px-3 py-1 bg-gray-100 text-gray-700 rounded hover:bg-gray-200 transition-colors text-sm"
|
|
656
|
+
}, "Copy"), /*#__PURE__*/React.createElement("button", {
|
|
657
|
+
onClick: downloadPalette,
|
|
658
|
+
className: "px-3 py-1 bg-purple-600 text-white rounded hover:bg-purple-700 transition-colors text-sm"
|
|
659
|
+
}, "Download"))), /*#__PURE__*/React.createElement("pre", {
|
|
660
|
+
className: "bg-gray-50 p-3 rounded text-xs overflow-x-auto max-h-60 overflow-y-auto border"
|
|
661
|
+
}, /*#__PURE__*/React.createElement("code", null, generateExportData())))), /*#__PURE__*/React.createElement("div", {
|
|
662
|
+
className: "mb-8 grid grid-cols-1 lg:grid-cols-2 gap-6"
|
|
663
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
664
|
+
className: "bg-blue-50 p-6 rounded-lg"
|
|
665
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
666
|
+
className: "text-lg font-semibold text-blue-900 mb-4"
|
|
667
|
+
}, "Base Color (OKLCH)"), /*#__PURE__*/React.createElement("div", {
|
|
668
|
+
className: "space-y-6"
|
|
669
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
670
|
+
className: "block text-sm font-medium text-blue-800 mb-2"
|
|
671
|
+
}, "Hue: ", baseHue, "\xB0"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
672
|
+
value: [baseHue],
|
|
673
|
+
onValueChange: function onValueChange(_ref2) {
|
|
674
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
675
|
+
value = _ref3[0];
|
|
676
|
+
return setBaseHue(value);
|
|
677
|
+
},
|
|
678
|
+
min: 0,
|
|
679
|
+
max: 360,
|
|
680
|
+
step: 1,
|
|
681
|
+
className: "w-full"
|
|
682
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
683
|
+
className: "text-xs text-blue-600 mt-1"
|
|
684
|
+
}, "0\xB0 = Red, 120\xB0 = Green, 240\xB0 = Blue")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
685
|
+
className: "block text-sm font-medium text-blue-800 mb-2"
|
|
686
|
+
}, "Chroma: ", baseChroma.toFixed(3), " (Saturation)"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
687
|
+
value: [baseChroma * 100],
|
|
688
|
+
onValueChange: function onValueChange(_ref4) {
|
|
689
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
690
|
+
value = _ref5[0];
|
|
691
|
+
return setBaseChroma(value / 100);
|
|
692
|
+
},
|
|
693
|
+
min: 0,
|
|
694
|
+
max: 40,
|
|
695
|
+
step: 0.5,
|
|
696
|
+
className: "w-full"
|
|
697
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
698
|
+
className: "text-xs text-blue-600 mt-1"
|
|
699
|
+
}, "0 = Grayscale, 0.4 = Maximum intensity")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
700
|
+
className: "block text-sm font-medium text-blue-800 mb-2"
|
|
701
|
+
}, "Lightness: ", (baseLightness * 100).toFixed(0), "%"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
702
|
+
value: [baseLightness * 100],
|
|
703
|
+
onValueChange: function onValueChange(_ref6) {
|
|
704
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
705
|
+
value = _ref7[0];
|
|
706
|
+
return setBaseLightness(value / 100);
|
|
707
|
+
},
|
|
708
|
+
min: 0,
|
|
709
|
+
max: 100,
|
|
710
|
+
step: 1,
|
|
711
|
+
className: "w-full"
|
|
712
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
713
|
+
className: "text-xs text-blue-600 mt-1"
|
|
714
|
+
}, "Reference point where chroma stays at base value")), /*#__PURE__*/React.createElement("div", {
|
|
715
|
+
className: "bg-blue-100 p-4 rounded-lg"
|
|
716
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
717
|
+
className: "block text-sm font-medium text-blue-900 mb-3"
|
|
718
|
+
}, "\uD83C\uDFAF Palette Purpose"), /*#__PURE__*/React.createElement("div", {
|
|
719
|
+
className: "space-y-2"
|
|
720
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
721
|
+
className: "flex items-start space-x-3 cursor-pointer"
|
|
722
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
723
|
+
type: "radio",
|
|
724
|
+
name: "purpose",
|
|
725
|
+
value: "colored",
|
|
726
|
+
checked: palettePurpose === 'colored',
|
|
727
|
+
onChange: function onChange(e) {
|
|
728
|
+
return setPalettePurpose(e.target.value);
|
|
729
|
+
},
|
|
730
|
+
className: "mt-1"
|
|
731
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
732
|
+
className: "text-sm font-semibold text-blue-900"
|
|
733
|
+
}, "Colored"), /*#__PURE__*/React.createElement("p", {
|
|
734
|
+
className: "text-xs text-blue-700"
|
|
735
|
+
}, "For UI elements: buttons, badges, links. Maintains strong color at all lightness levels."))), /*#__PURE__*/React.createElement("label", {
|
|
736
|
+
className: "flex items-start space-x-3 cursor-pointer"
|
|
737
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
738
|
+
type: "radio",
|
|
739
|
+
name: "purpose",
|
|
740
|
+
value: "neutral",
|
|
741
|
+
checked: palettePurpose === 'neutral',
|
|
742
|
+
onChange: function onChange(e) {
|
|
743
|
+
return setPalettePurpose(e.target.value);
|
|
744
|
+
},
|
|
745
|
+
className: "mt-1"
|
|
746
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
747
|
+
className: "text-sm font-semibold text-blue-900"
|
|
748
|
+
}, "Neutral"), /*#__PURE__*/React.createElement("p", {
|
|
749
|
+
className: "text-xs text-blue-700"
|
|
750
|
+
}, "For backgrounds & surfaces: cards, panels, app backgrounds. Near-grayscale at high lightness (90%+)."))), /*#__PURE__*/React.createElement("label", {
|
|
751
|
+
className: "flex items-start space-x-3 cursor-pointer"
|
|
752
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
753
|
+
type: "radio",
|
|
754
|
+
name: "purpose",
|
|
755
|
+
value: "subtle",
|
|
756
|
+
checked: palettePurpose === 'subtle',
|
|
757
|
+
onChange: function onChange(e) {
|
|
758
|
+
return setPalettePurpose(e.target.value);
|
|
759
|
+
},
|
|
760
|
+
className: "mt-1"
|
|
761
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
762
|
+
className: "text-sm font-semibold text-blue-900"
|
|
763
|
+
}, "Subtle Colored"), /*#__PURE__*/React.createElement("p", {
|
|
764
|
+
className: "text-xs text-blue-700"
|
|
765
|
+
}, "Hybrid: gentle chroma reduction. Still maintains some color character at extremes."))))), palettePurpose === 'colored' && /*#__PURE__*/React.createElement("div", {
|
|
766
|
+
className: "bg-blue-100 p-3 rounded"
|
|
767
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
768
|
+
className: "flex items-start space-x-3"
|
|
769
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
770
|
+
type: "checkbox",
|
|
771
|
+
checked: useChromaCompensation,
|
|
772
|
+
onChange: function onChange(e) {
|
|
773
|
+
return setUseChromaCompensation(e.target.checked);
|
|
774
|
+
},
|
|
775
|
+
className: "rounded border-blue-300 mt-1"
|
|
776
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
777
|
+
className: "text-sm font-medium text-blue-900"
|
|
778
|
+
}, "Enable Chroma Compensation"), /*#__PURE__*/React.createElement("p", {
|
|
779
|
+
className: "text-xs text-blue-700 mt-1"
|
|
780
|
+
}, "Gently boost chroma at extreme lightness values")))))), /*#__PURE__*/React.createElement("div", {
|
|
781
|
+
className: "bg-green-50 p-6 rounded-lg"
|
|
782
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
783
|
+
className: "text-lg font-semibold text-green-900 mb-4"
|
|
784
|
+
}, "\uD83C\uDFAD Overlay/Tint (Your Trick!)"), /*#__PURE__*/React.createElement("div", {
|
|
785
|
+
className: "mb-4"
|
|
786
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
787
|
+
className: "flex items-start space-x-3 bg-green-100 p-3 rounded"
|
|
788
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
789
|
+
type: "checkbox",
|
|
790
|
+
checked: overlayEnabled,
|
|
791
|
+
onChange: function onChange(e) {
|
|
792
|
+
return setOverlayEnabled(e.target.checked);
|
|
793
|
+
},
|
|
794
|
+
className: "rounded border-green-300 mt-1"
|
|
795
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
796
|
+
className: "text-sm font-medium text-green-900"
|
|
797
|
+
}, "Enable Overlay/Tint"), /*#__PURE__*/React.createElement("p", {
|
|
798
|
+
className: "text-xs text-green-700 mt-1"
|
|
799
|
+
}, "Apply a semi-transparent wash to unify your palette")))), overlayEnabled && /*#__PURE__*/React.createElement("div", {
|
|
800
|
+
className: "space-y-6"
|
|
801
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
802
|
+
className: "block text-sm font-medium text-green-800 mb-2"
|
|
803
|
+
}, "Overlay Hue: ", overlayColor.h, "\xB0"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
804
|
+
value: [overlayColor.h],
|
|
805
|
+
onValueChange: function onValueChange(_ref8) {
|
|
806
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
807
|
+
value = _ref9[0];
|
|
808
|
+
return setOverlayColor(function (prev) {
|
|
809
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
810
|
+
h: value
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
},
|
|
814
|
+
min: 0,
|
|
815
|
+
max: 360,
|
|
816
|
+
step: 1,
|
|
817
|
+
className: "w-full"
|
|
818
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
819
|
+
className: "block text-sm font-medium text-green-800 mb-2"
|
|
820
|
+
}, "Overlay Lightness: ", (overlayColor.l * 100).toFixed(0), "%"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
821
|
+
value: [overlayColor.l * 100],
|
|
822
|
+
onValueChange: function onValueChange(_ref0) {
|
|
823
|
+
var _ref1 = _slicedToArray(_ref0, 1),
|
|
824
|
+
value = _ref1[0];
|
|
825
|
+
return setOverlayColor(function (prev) {
|
|
826
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
827
|
+
l: value / 100
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
},
|
|
831
|
+
min: 0,
|
|
832
|
+
max: 100,
|
|
833
|
+
step: 1,
|
|
834
|
+
className: "w-full"
|
|
835
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
836
|
+
className: "block text-sm font-medium text-green-800 mb-2"
|
|
837
|
+
}, "Overlay Opacity: ", (overlayOpacity * 100).toFixed(0), "%"), /*#__PURE__*/React.createElement(RangeSlider, {
|
|
838
|
+
value: [overlayOpacity * 100],
|
|
839
|
+
onValueChange: function onValueChange(_ref10) {
|
|
840
|
+
var _ref11 = _slicedToArray(_ref10, 1),
|
|
841
|
+
value = _ref11[0];
|
|
842
|
+
return setOverlayOpacity(value / 100);
|
|
843
|
+
},
|
|
844
|
+
min: 0,
|
|
845
|
+
max: 50,
|
|
846
|
+
step: 1,
|
|
847
|
+
className: "w-full"
|
|
848
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
849
|
+
className: "text-xs text-green-600 mt-1"
|
|
850
|
+
}, "Subtle overlay (5-15%) works best for color grading")), /*#__PURE__*/React.createElement("div", {
|
|
851
|
+
className: "bg-white p-3 rounded border border-green-200"
|
|
852
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
853
|
+
className: "text-xs font-medium text-green-800 mb-2"
|
|
854
|
+
}, "Overlay Preview:"), /*#__PURE__*/React.createElement("div", {
|
|
855
|
+
className: "w-full h-12 rounded border-2 border-green-300",
|
|
856
|
+
style: {
|
|
857
|
+
backgroundColor: formatRgb(oklchToRgb(overlayColor.l, overlayColor.c, overlayColor.h))
|
|
858
|
+
}
|
|
859
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
860
|
+
className: "mb-8"
|
|
861
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
862
|
+
className: "text-xl font-semibold text-gray-900 mb-4"
|
|
863
|
+
}, "Complete ", outputCount, "-Shade OKLCH Scale"), /*#__PURE__*/React.createElement("div", {
|
|
864
|
+
className: "space-y-6"
|
|
865
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
|
|
866
|
+
className: "font-medium text-gray-700 mb-3"
|
|
867
|
+
}, "Standard OKLCH (Fixed Chroma)"), /*#__PURE__*/React.createElement("div", {
|
|
868
|
+
className: "grid gap-2 ".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')
|
|
869
|
+
}, colorSwatches.map(function (swatch, index) {
|
|
870
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
871
|
+
key: "standard-".concat(index),
|
|
872
|
+
className: "flex flex-col items-center"
|
|
873
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
874
|
+
className: "w-full aspect-square border border-gray-200 rounded-sm",
|
|
875
|
+
style: {
|
|
876
|
+
backgroundColor: formatRgb(overlayEnabled ? swatch.standard.withOverlay : swatch.standard.rgb)
|
|
877
|
+
},
|
|
878
|
+
title: "L=".concat((swatch.lightness * 100).toFixed(0), "%, C=").concat(swatch.standard.chroma.toFixed(3))
|
|
879
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
880
|
+
className: "text-xs text-center mt-1 text-gray-500"
|
|
881
|
+
}, (swatch.lightness * 100).toFixed(0)));
|
|
882
|
+
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
|
|
883
|
+
className: "font-medium text-gray-700 mb-3"
|
|
884
|
+
}, "Adjusted OKLCH (Compensated Chroma", overlayEnabled ? ' + Overlay' : '', ")"), /*#__PURE__*/React.createElement("div", {
|
|
885
|
+
className: "grid gap-2 ".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')
|
|
886
|
+
}, colorSwatches.map(function (swatch, index) {
|
|
887
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
888
|
+
key: "adjusted-".concat(index),
|
|
889
|
+
className: "flex flex-col items-center"
|
|
890
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
891
|
+
className: "w-full aspect-square border border-gray-200 rounded-sm",
|
|
892
|
+
style: {
|
|
893
|
+
backgroundColor: formatRgb(overlayEnabled ? swatch.adjusted.withOverlay : swatch.adjusted.rgb)
|
|
894
|
+
},
|
|
895
|
+
title: "".concat(paletteName, "-").concat(String(index + 1).padStart(2, '0'), ": ").concat(overlayEnabled ? swatch.adjusted.hexWithOverlay : swatch.adjusted.hex)
|
|
896
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
897
|
+
className: "text-xs text-center mt-1 text-gray-500"
|
|
898
|
+
}, String(index + 1).padStart(2, '0')));
|
|
899
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
900
|
+
className: "bg-gray-50 p-6 rounded-lg mb-8"
|
|
901
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
902
|
+
className: "text-xl font-semibold text-gray-900 mb-4"
|
|
903
|
+
}, "\uD83D\uDCDA About OKLCH Color Space"), /*#__PURE__*/React.createElement("div", {
|
|
904
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-6"
|
|
905
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
|
|
906
|
+
className: "font-medium text-gray-700 mb-2"
|
|
907
|
+
}, "Why OKLCH is Better"), /*#__PURE__*/React.createElement("ul", {
|
|
908
|
+
className: "text-sm text-gray-600 space-y-2"
|
|
909
|
+
}, /*#__PURE__*/React.createElement("li", null, "\u2705 ", /*#__PURE__*/React.createElement("strong", null, "Perceptually uniform lightness:"), " L=50% looks equally bright for all hues"), /*#__PURE__*/React.createElement("li", null, "\u2705 ", /*#__PURE__*/React.createElement("strong", null, "No hue shifts:"), " Unlike HSL, colors don't shift hue at extremes"), /*#__PURE__*/React.createElement("li", null, "\u2705 ", /*#__PURE__*/React.createElement("strong", null, "Modern standard:"), " Based on human vision research"), /*#__PURE__*/React.createElement("li", null, "\u2705 ", /*#__PURE__*/React.createElement("strong", null, "Wide gamut:"), " Can represent more colors than sRGB"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
|
|
910
|
+
className: "font-medium text-gray-700 mb-2"
|
|
911
|
+
}, "OKLCH vs HSL"), /*#__PURE__*/React.createElement("div", {
|
|
912
|
+
className: "bg-white p-3 rounded text-sm space-y-2"
|
|
913
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", {
|
|
914
|
+
className: "text-blue-600"
|
|
915
|
+
}, "HSL(240, 100%, 50%)"), " = Blue", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", {
|
|
916
|
+
className: "text-green-600"
|
|
917
|
+
}, "HSL(120, 100%, 50%)"), " = Green (looks brighter!)"), /*#__PURE__*/React.createElement("div", {
|
|
918
|
+
className: "border-t pt-2 mt-2"
|
|
919
|
+
}, /*#__PURE__*/React.createElement("strong", {
|
|
920
|
+
className: "text-blue-600"
|
|
921
|
+
}, "OKLCH(0.5, 0.2, 240)"), " = Blue", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", {
|
|
922
|
+
className: "text-green-600"
|
|
923
|
+
}, "OKLCH(0.5, 0.2, 120)"), " = Green (same brightness!)")))), /*#__PURE__*/React.createElement("div", {
|
|
924
|
+
className: "mt-6 p-4 bg-purple-50 rounded"
|
|
925
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
926
|
+
className: "font-medium text-purple-800 mb-2"
|
|
927
|
+
}, "Current Configuration"), /*#__PURE__*/React.createElement("div", {
|
|
928
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm text-purple-700"
|
|
929
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Base Color: ", formatOklch(baseLightness, baseChroma, baseHue)), /*#__PURE__*/React.createElement("p", null, "Purpose: ", /*#__PURE__*/React.createElement("strong", {
|
|
930
|
+
className: "capitalize"
|
|
931
|
+
}, palettePurpose), " ", palettePurpose === 'colored' ? ': ' : palettePurpose === 'neutral' ? '⬜' : ': ')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Overlay: ", overlayEnabled ? "Enabled (".concat((overlayOpacity * 100).toFixed(0), "%)") : 'Disabled'), /*#__PURE__*/React.createElement("p", null, "Colors: ", outputCount, " shades")))), /*#__PURE__*/React.createElement("div", {
|
|
932
|
+
className: "mt-6 p-4 bg-amber-50 rounded border-2 border-amber-200"
|
|
933
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
934
|
+
className: "font-medium text-amber-900 mb-3"
|
|
935
|
+
}, "\uD83D\uDCA1 Palette Purpose Modes Explained"), /*#__PURE__*/React.createElement("div", {
|
|
936
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4 text-sm"
|
|
937
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
|
|
938
|
+
className: "font-semibold text-amber-800 mb-1"
|
|
939
|
+
}, "\uD83C\uDFA8 Colored"), /*#__PURE__*/React.createElement("p", {
|
|
940
|
+
className: "text-amber-700 text-xs"
|
|
941
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Use for:"), " Buttons, badges, links, accent UI elements", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Behavior:"), " Maintains strong color at all lightness levels")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
|
|
942
|
+
className: "font-semibold text-amber-800 mb-1"
|
|
943
|
+
}, "\u2B1C Neutral"), /*#__PURE__*/React.createElement("p", {
|
|
944
|
+
className: "text-amber-700 text-xs"
|
|
945
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Use for:"), " Backgrounds, cards, panels, surfaces", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Behavior:"), " Nearly grayscale at high lightness (90%+)")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h5", {
|
|
946
|
+
className: "font-semibold text-amber-800 mb-1"
|
|
947
|
+
}, "\uD83C\uDFAD Subtle"), /*#__PURE__*/React.createElement("p", {
|
|
948
|
+
className: "text-amber-700 text-xs"
|
|
949
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Use for:"), " Hover states, borders, dividers", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Behavior:"), " Gentle reduction, keeps some color"))))), paletteCollection.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
950
|
+
className: "mt-12 pt-8 border-t-4 border-purple-300"
|
|
951
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
952
|
+
className: "flex items-center justify-between mb-6"
|
|
953
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", {
|
|
954
|
+
className: "text-2xl font-bold text-gray-900 flex items-center gap-2"
|
|
955
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
956
|
+
name: "Collections",
|
|
957
|
+
size: "large",
|
|
958
|
+
customCss: "text-purple-600"
|
|
959
|
+
}), "Your OKLCH Palette Collection"), /*#__PURE__*/React.createElement("p", {
|
|
960
|
+
className: "text-sm text-gray-600 mt-1"
|
|
961
|
+
}, paletteCollection.length, " ", paletteCollection.length === 1 ? 'palette' : 'palettes', " saved")), /*#__PURE__*/React.createElement("button", {
|
|
962
|
+
onClick: exportCollection,
|
|
963
|
+
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"
|
|
964
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
965
|
+
name: "Download",
|
|
966
|
+
size: "medium",
|
|
967
|
+
customCss: "text-white"
|
|
968
|
+
}), "Export All as JSON")), /*#__PURE__*/React.createElement("div", {
|
|
969
|
+
className: "space-y-6"
|
|
970
|
+
}, paletteCollection.map(function (palette) {
|
|
971
|
+
var _palette$colors;
|
|
972
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
973
|
+
key: palette.id,
|
|
974
|
+
className: "bg-white border-2 border-gray-200 rounded-xl p-6 shadow-lg"
|
|
975
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
976
|
+
className: "flex items-start justify-between mb-4"
|
|
977
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
978
|
+
className: "flex-1"
|
|
979
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
980
|
+
className: "text-xl font-bold text-gray-900 mb-1"
|
|
981
|
+
}, palette.name), /*#__PURE__*/React.createElement("div", {
|
|
982
|
+
className: "flex flex-wrap gap-3 text-xs text-gray-600"
|
|
983
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
984
|
+
className: "font-medium text-purple-700"
|
|
985
|
+
}, palette.config.palettePurpose === 'colored' ? '🎨 Colored' : palette.config.palettePurpose === 'neutral' ? '⬜ Neutral' : '🎭 Subtle'), /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, palette.config.outputCount, " shades"), /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, "H:", palette.config.baseHue, "\xB0 C:", palette.config.baseChroma.toFixed(3), " L:", (palette.config.baseLightness * 100).toFixed(0), "%"), palette.config.overlayEnabled && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u2022"), /*#__PURE__*/React.createElement("span", null, "With overlay (", (palette.config.overlayOpacity * 100).toFixed(0), "%)")))), /*#__PURE__*/React.createElement("button", {
|
|
986
|
+
onClick: function onClick() {
|
|
987
|
+
return removePaletteFromCollection(palette.id);
|
|
988
|
+
},
|
|
989
|
+
className: "ml-4 p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors"
|
|
990
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
991
|
+
name: "Delete",
|
|
992
|
+
size: "medium",
|
|
993
|
+
customCss: "text-red-600"
|
|
994
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
995
|
+
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')
|
|
996
|
+
}, (_palette$colors = palette.colors) === null || _palette$colors === void 0 ? void 0 : _palette$colors.map(function (color) {
|
|
997
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
998
|
+
key: color.name,
|
|
999
|
+
className: "group relative"
|
|
1000
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1001
|
+
className: "w-full aspect-square rounded-lg border-2 border-gray-200 hover:scale-110 transition-transform cursor-pointer",
|
|
1002
|
+
style: {
|
|
1003
|
+
backgroundColor: color.hex
|
|
1004
|
+
},
|
|
1005
|
+
title: color.name
|
|
1006
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1007
|
+
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"
|
|
1008
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1009
|
+
className: "font-bold"
|
|
1010
|
+
}, color.name), /*#__PURE__*/React.createElement("div", null, color.hex)));
|
|
1011
|
+
})));
|
|
1012
|
+
}))));
|
|
1013
|
+
};
|
|
1014
|
+
export { OKLCHTool };
|