@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,543 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import React, { useState, useRef, useCallback } from 'react';
|
|
8
|
+
import { rgbToHex } from "../shared/components/ColorChecker/utils";
|
|
9
|
+
|
|
10
|
+
// Helper: Convert HSL to RGB
|
|
11
|
+
function hslToRgb(h, s, l) {
|
|
12
|
+
// Clamp lightness to 0-100 before conversion
|
|
13
|
+
l = Math.max(0, Math.min(100, l));
|
|
14
|
+
s /= 100;
|
|
15
|
+
l /= 100;
|
|
16
|
+
var c = (1 - Math.abs(2 * l - 1)) * s;
|
|
17
|
+
var x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
18
|
+
var m = l - c / 2;
|
|
19
|
+
var r = 0,
|
|
20
|
+
g = 0,
|
|
21
|
+
b = 0;
|
|
22
|
+
if (0 <= h && h < 60) {
|
|
23
|
+
r = c;
|
|
24
|
+
g = x;
|
|
25
|
+
b = 0;
|
|
26
|
+
} else if (60 <= h && h < 120) {
|
|
27
|
+
r = x;
|
|
28
|
+
g = c;
|
|
29
|
+
b = 0;
|
|
30
|
+
} else if (120 <= h && h < 180) {
|
|
31
|
+
r = 0;
|
|
32
|
+
g = c;
|
|
33
|
+
b = x;
|
|
34
|
+
} else if (180 <= h && h < 240) {
|
|
35
|
+
r = 0;
|
|
36
|
+
g = x;
|
|
37
|
+
b = c;
|
|
38
|
+
} else if (240 <= h && h < 300) {
|
|
39
|
+
r = x;
|
|
40
|
+
g = 0;
|
|
41
|
+
b = c;
|
|
42
|
+
} else if (300 <= h && h < 360) {
|
|
43
|
+
r = c;
|
|
44
|
+
g = 0;
|
|
45
|
+
b = x;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
r: Math.round((r + m) * 255),
|
|
49
|
+
g: Math.round((g + m) * 255),
|
|
50
|
+
b: Math.round((b + m) * 255)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Helper: Cubic Bezier interpolation
|
|
55
|
+
function cubicBezier(t, p0, c1, c2, p3) {
|
|
56
|
+
var x = Math.pow(1 - t, 3) * p0[0] + 3 * Math.pow(1 - t, 2) * t * c1[0] + 3 * (1 - t) * Math.pow(t, 2) * c2[0] + Math.pow(t, 3) * p3[0];
|
|
57
|
+
var y = Math.pow(1 - t, 3) * p0[1] + 3 * Math.pow(1 - t, 2) * t * c1[1] + 3 * (1 - t) * Math.pow(t, 2) * c2[1] + Math.pow(t, 3) * p3[1];
|
|
58
|
+
return [x, y];
|
|
59
|
+
}
|
|
60
|
+
export var HSLTool = function HSLTool() {
|
|
61
|
+
var width = 1200;
|
|
62
|
+
var height = 480;
|
|
63
|
+
var lightnessRange = 70; // +/- 35 from baseLightness
|
|
64
|
+
var maxTotalPoints = 99;
|
|
65
|
+
var gradientStops = 20; // Number of stops for the gradient
|
|
66
|
+
|
|
67
|
+
// State
|
|
68
|
+
var _useState = useState(220),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
hue = _useState2[0],
|
|
71
|
+
setHue = _useState2[1];
|
|
72
|
+
var _useState3 = useState(80),
|
|
73
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
74
|
+
sat = _useState4[0],
|
|
75
|
+
setSat = _useState4[1];
|
|
76
|
+
var _useState5 = useState(50),
|
|
77
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
78
|
+
baseLightness = _useState6[0],
|
|
79
|
+
setBaseLightness = _useState6[1]; // Base Lightness
|
|
80
|
+
var _useState7 = useState(5),
|
|
81
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
82
|
+
baseColorCount = _useState8[0],
|
|
83
|
+
setBaseColorCount = _useState8[1]; // Base colors (3, 5, or 7)
|
|
84
|
+
var _useState9 = useState(1),
|
|
85
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
86
|
+
multiplier = _useState0[0],
|
|
87
|
+
setMultiplier = _useState0[1]; // Multiplier (1x, 2x, 3x, 4x)
|
|
88
|
+
var grad = "linear-gradient(to top, hsl(".concat(hue, ",").concat(sat, "%,20%), hsl(").concat(hue, ",").concat(sat, "%,95%))");
|
|
89
|
+
|
|
90
|
+
// Curve control points (A, C, and Handles for Cubic Bezier) - Default to half-circle shape
|
|
91
|
+
var _useState1 = useState([0, height]),
|
|
92
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
93
|
+
start = _useState10[0],
|
|
94
|
+
setStart = _useState10[1]; // A (P0) - Bottom Left
|
|
95
|
+
var _useState11 = useState([width, height]),
|
|
96
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
97
|
+
end = _useState12[0],
|
|
98
|
+
setEnd = _useState12[1]; // C (P3) - Bottom Right
|
|
99
|
+
var _useState13 = useState([width * 0.3, 0]),
|
|
100
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
101
|
+
handle1 = _useState14[0],
|
|
102
|
+
setHandle1 = _useState14[1]; // C1 - Pulls up near A
|
|
103
|
+
var _useState15 = useState([width * 0.7, 0]),
|
|
104
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
105
|
+
handle2 = _useState16[0],
|
|
106
|
+
setHandle2 = _useState16[1]; // C2 - Pulls up near C
|
|
107
|
+
|
|
108
|
+
// Drag state
|
|
109
|
+
var dragRef = useRef({
|
|
110
|
+
point: null
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Clipboard feedback state
|
|
114
|
+
var _useState17 = useState(null),
|
|
115
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
116
|
+
copiedHex = _useState18[0],
|
|
117
|
+
setCopiedHex = _useState18[1];
|
|
118
|
+
var copyTimeoutRef = useRef(null);
|
|
119
|
+
|
|
120
|
+
// Derived Calculations
|
|
121
|
+
var calculatedTotalPoints = baseColorCount * multiplier;
|
|
122
|
+
var totalPoints = Math.max(3, Math.min(maxTotalPoints, calculatedTotalPoints)); // Ensure at least 3 points, max 99
|
|
123
|
+
var pointsT = Array.from({
|
|
124
|
+
length: totalPoints
|
|
125
|
+
}, function (_, i) {
|
|
126
|
+
return i / (totalPoints - 1);
|
|
127
|
+
}); // Parameter t for each point
|
|
128
|
+
|
|
129
|
+
// Find middle index for the single primary ascendant color
|
|
130
|
+
var middleIndex = Math.floor(totalPoints / 2);
|
|
131
|
+
// Find the offset for secondary middle points within each base group
|
|
132
|
+
var baseMiddleOffset = Math.ceil(baseColorCount / 2);
|
|
133
|
+
|
|
134
|
+
// --- START: SVG Path and Gradient Calculation ---
|
|
135
|
+
// Generate points for the SVG path and gradient stops
|
|
136
|
+
var pathPoints = Array.from({
|
|
137
|
+
length: 101
|
|
138
|
+
}, function (_, i) {
|
|
139
|
+
var t = i / 100;
|
|
140
|
+
return cubicBezier(t, start, handle1, handle2, end);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Create the SVG path data string
|
|
144
|
+
var pathData = "M ".concat(pathPoints[0][0], " ").concat(pathPoints[0][1], " C ").concat(handle1[0], " ").concat(handle1[1], ", ").concat(handle2[0], " ").concat(handle2[1], ", ").concat(end[0], " ").concat(end[1]);
|
|
145
|
+
|
|
146
|
+
// Generate gradient stops
|
|
147
|
+
var gradientStopData = Array.from({
|
|
148
|
+
length: gradientStops
|
|
149
|
+
}, function (_, i) {
|
|
150
|
+
var t = i / (gradientStops - 1);
|
|
151
|
+
var _cubicBezier = cubicBezier(t, start, handle1, handle2, end),
|
|
152
|
+
_cubicBezier2 = _slicedToArray(_cubicBezier, 2),
|
|
153
|
+
py = _cubicBezier2[1];
|
|
154
|
+
var clampedPy = Math.max(0, Math.min(height, py));
|
|
155
|
+
var l = baseLightness + (0.5 - clampedPy / height) * lightnessRange;
|
|
156
|
+
var _hslToRgb = hslToRgb(hue, sat, l),
|
|
157
|
+
r = _hslToRgb.r,
|
|
158
|
+
g = _hslToRgb.g,
|
|
159
|
+
b = _hslToRgb.b;
|
|
160
|
+
return {
|
|
161
|
+
offset: "".concat((t * 100).toFixed(1), "%"),
|
|
162
|
+
color: "rgb(".concat(r, ",").concat(g, ",").concat(b, ")")
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
// --- END: SVG Path and Gradient Calculation ---
|
|
166
|
+
|
|
167
|
+
// Generate color swatches data
|
|
168
|
+
var colorSwatches = pointsT.map(function (t, i) {
|
|
169
|
+
var _cubicBezier3 = cubicBezier(t, start, handle1, handle2, end),
|
|
170
|
+
_cubicBezier4 = _slicedToArray(_cubicBezier3, 2),
|
|
171
|
+
px = _cubicBezier4[0],
|
|
172
|
+
py = _cubicBezier4[1];
|
|
173
|
+
var clampedPy = Math.max(0, Math.min(height, py)); // Clamp y within bounds
|
|
174
|
+
// Calculate lightness based on curve position, centered around baseLightness
|
|
175
|
+
var l = baseLightness + (0.5 - clampedPy / height) * lightnessRange;
|
|
176
|
+
var finalL = Math.max(0, Math.min(100, l)); // Clamp lightness 0-100
|
|
177
|
+
|
|
178
|
+
var rgb = hslToRgb(hue, sat, finalL); // Use current H, S, and calculated L
|
|
179
|
+
var hex = rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
180
|
+
|
|
181
|
+
// Determine border status
|
|
182
|
+
var isPrimaryMiddle = i === middleIndex;
|
|
183
|
+
// Check if it's a secondary middle *and not* the primary middle
|
|
184
|
+
var isSecondaryMiddle = (i + 1) % baseColorCount === baseMiddleOffset && !isPrimaryMiddle;
|
|
185
|
+
return {
|
|
186
|
+
t: t,
|
|
187
|
+
hex: hex,
|
|
188
|
+
l: finalL,
|
|
189
|
+
isPrimaryMiddle: isPrimaryMiddle,
|
|
190
|
+
isSecondaryMiddle: isSecondaryMiddle
|
|
191
|
+
}; // Include t for stable keys
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// --- Drag Handlers (useCallback for performance) ---
|
|
195
|
+
var svgRef = useRef(null);
|
|
196
|
+
var getMousePosition = useCallback(function (event) {
|
|
197
|
+
var svg = svgRef.current;
|
|
198
|
+
if (!svg) return [0, 0];
|
|
199
|
+
var CTM = svg.getScreenCTM();
|
|
200
|
+
if (!CTM) return [0, 0];
|
|
201
|
+
var clientX;
|
|
202
|
+
var clientY;
|
|
203
|
+
if ('touches' in event) {
|
|
204
|
+
// Touch event
|
|
205
|
+
clientX = event.touches[0].clientX;
|
|
206
|
+
clientY = event.touches[0].clientY;
|
|
207
|
+
} else {
|
|
208
|
+
// Mouse event
|
|
209
|
+
clientX = event.clientX;
|
|
210
|
+
clientY = event.clientY;
|
|
211
|
+
}
|
|
212
|
+
var pt = svg.createSVGPoint();
|
|
213
|
+
pt.x = clientX;
|
|
214
|
+
pt.y = clientY;
|
|
215
|
+
pt = pt.matrixTransform(CTM.inverse());
|
|
216
|
+
var x = pt.x;
|
|
217
|
+
var y = pt.y;
|
|
218
|
+
|
|
219
|
+
// Clamp to bounds (allow Y to go slightly outside for handles)
|
|
220
|
+
x = Math.max(0, Math.min(width, x));
|
|
221
|
+
y = Math.max(-32, Math.min(height + 32, y)); // Allow handles to go slightly above/below
|
|
222
|
+
|
|
223
|
+
return [x, y];
|
|
224
|
+
}, [width, height]);
|
|
225
|
+
var handleDragStart = useCallback(function (point, e) {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
e.stopPropagation();
|
|
228
|
+
dragRef.current.point = point;
|
|
229
|
+
document.body.style.cursor = 'grabbing';
|
|
230
|
+
}, []);
|
|
231
|
+
var handleDrag = useCallback(function (e) {
|
|
232
|
+
if (!dragRef.current.point) return;
|
|
233
|
+
|
|
234
|
+
// Prevent default scroll behavior on touch devices
|
|
235
|
+
if ('touches' in e) {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
}
|
|
238
|
+
var _getMousePosition = getMousePosition(e),
|
|
239
|
+
_getMousePosition2 = _slicedToArray(_getMousePosition, 2),
|
|
240
|
+
x = _getMousePosition2[0],
|
|
241
|
+
y = _getMousePosition2[1];
|
|
242
|
+
switch (dragRef.current.point) {
|
|
243
|
+
case 'A':
|
|
244
|
+
setStart([x, y]);
|
|
245
|
+
break;
|
|
246
|
+
case 'C':
|
|
247
|
+
setEnd([x, y]);
|
|
248
|
+
break;
|
|
249
|
+
case 'HANDLE1':
|
|
250
|
+
setHandle1([x, y]);
|
|
251
|
+
break;
|
|
252
|
+
// Update Handle 1
|
|
253
|
+
case 'HANDLE2':
|
|
254
|
+
setHandle2([x, y]);
|
|
255
|
+
break;
|
|
256
|
+
// Update Handle 2
|
|
257
|
+
}
|
|
258
|
+
}, [getMousePosition]);
|
|
259
|
+
var handleDragEnd = useCallback(function () {
|
|
260
|
+
if (dragRef.current.point) {
|
|
261
|
+
dragRef.current.point = null;
|
|
262
|
+
document.body.style.cursor = '';
|
|
263
|
+
}
|
|
264
|
+
}, []);
|
|
265
|
+
|
|
266
|
+
// Copy to clipboard handler
|
|
267
|
+
var handleCopyHex = useCallback(function (hex) {
|
|
268
|
+
navigator.clipboard.writeText(hex).then(function () {
|
|
269
|
+
setCopiedHex(hex);
|
|
270
|
+
if (copyTimeoutRef.current) {
|
|
271
|
+
clearTimeout(copyTimeoutRef.current);
|
|
272
|
+
}
|
|
273
|
+
copyTimeoutRef.current = setTimeout(function () {
|
|
274
|
+
setCopiedHex(null);
|
|
275
|
+
copyTimeoutRef.current = null;
|
|
276
|
+
}, 1500);
|
|
277
|
+
})["catch"](function (err) {
|
|
278
|
+
console.error('Failed to copy hex:', err);
|
|
279
|
+
});
|
|
280
|
+
}, []);
|
|
281
|
+
|
|
282
|
+
// Cleanup timeout on unmount
|
|
283
|
+
React.useEffect(function () {
|
|
284
|
+
return function () {
|
|
285
|
+
if (copyTimeoutRef.current) {
|
|
286
|
+
clearTimeout(copyTimeoutRef.current);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}, []);
|
|
290
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: "p-4"
|
|
292
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: "flex flex-wrap justify-center items-center gap-x-6 gap-y-3 mb-4"
|
|
294
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
295
|
+
className: "flex items-center gap-1"
|
|
296
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
297
|
+
className: "text-sm font-medium w-10"
|
|
298
|
+
}, "Hue:"), /*#__PURE__*/React.createElement("input", {
|
|
299
|
+
type: "range",
|
|
300
|
+
min: "0",
|
|
301
|
+
max: "360",
|
|
302
|
+
value: hue,
|
|
303
|
+
onChange: function onChange(e) {
|
|
304
|
+
return setHue(Number(e.target.value));
|
|
305
|
+
},
|
|
306
|
+
className: "w-32"
|
|
307
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
308
|
+
className: "text-sm w-8 text-right"
|
|
309
|
+
}, hue, "\xB0")), /*#__PURE__*/React.createElement("label", {
|
|
310
|
+
className: "flex items-center gap-1"
|
|
311
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
312
|
+
className: "text-sm font-medium w-10"
|
|
313
|
+
}, "Sat:"), /*#__PURE__*/React.createElement("input", {
|
|
314
|
+
type: "range",
|
|
315
|
+
min: "0",
|
|
316
|
+
max: "100",
|
|
317
|
+
value: sat,
|
|
318
|
+
onChange: function onChange(e) {
|
|
319
|
+
return setSat(Number(e.target.value));
|
|
320
|
+
},
|
|
321
|
+
className: "w-24"
|
|
322
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
323
|
+
className: "text-sm w-8 text-right"
|
|
324
|
+
}, sat, "%")), /*#__PURE__*/React.createElement("label", {
|
|
325
|
+
className: "flex items-center gap-1"
|
|
326
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
327
|
+
className: "text-sm font-medium w-10"
|
|
328
|
+
}, "Light:"), /*#__PURE__*/React.createElement("input", {
|
|
329
|
+
type: "range",
|
|
330
|
+
min: "0",
|
|
331
|
+
max: "100",
|
|
332
|
+
value: baseLightness,
|
|
333
|
+
onChange: function onChange(e) {
|
|
334
|
+
return setBaseLightness(Number(e.target.value));
|
|
335
|
+
},
|
|
336
|
+
className: "w-24"
|
|
337
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
338
|
+
className: "text-sm w-8 text-right"
|
|
339
|
+
}, baseLightness, "%")), /*#__PURE__*/React.createElement("div", {
|
|
340
|
+
className: "flex items-center gap-2"
|
|
341
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
342
|
+
className: "text-sm font-medium"
|
|
343
|
+
}, "Base Colors:"), [3, 5, 7].map(function (numCols) {
|
|
344
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
345
|
+
key: numCols,
|
|
346
|
+
className: "flex items-center gap-1 cursor-pointer"
|
|
347
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
348
|
+
type: "radio",
|
|
349
|
+
name: "baseColorCount",
|
|
350
|
+
value: numCols,
|
|
351
|
+
checked: baseColorCount === numCols,
|
|
352
|
+
onChange: function onChange() {
|
|
353
|
+
return setBaseColorCount(numCols);
|
|
354
|
+
}
|
|
355
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
356
|
+
className: "text-sm ".concat(baseColorCount === numCols ? 'font-semibold' : '')
|
|
357
|
+
}, numCols));
|
|
358
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
359
|
+
className: "flex items-center gap-2"
|
|
360
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
361
|
+
className: "text-sm font-medium"
|
|
362
|
+
}, "Multiplier:"), [1, 2, 3, 4].map(function (multi) {
|
|
363
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
364
|
+
key: multi,
|
|
365
|
+
className: "flex items-center gap-1 cursor-pointer"
|
|
366
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
367
|
+
type: "radio",
|
|
368
|
+
name: "multiplier",
|
|
369
|
+
value: multi,
|
|
370
|
+
checked: multiplier === multi,
|
|
371
|
+
onChange: function onChange() {
|
|
372
|
+
return setMultiplier(multi);
|
|
373
|
+
}
|
|
374
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
375
|
+
className: "text-sm ".concat(multiplier === multi ? 'font-semibold' : '')
|
|
376
|
+
}, multi, "x"));
|
|
377
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
378
|
+
className: "text-sm font-medium text-gray-600"
|
|
379
|
+
}, "Total Points: ", totalPoints)), /*#__PURE__*/React.createElement("div", {
|
|
380
|
+
className: "flex justify-center mb-4",
|
|
381
|
+
style: {
|
|
382
|
+
background: grad
|
|
383
|
+
}
|
|
384
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
385
|
+
ref: svgRef,
|
|
386
|
+
width: width,
|
|
387
|
+
height: height,
|
|
388
|
+
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
389
|
+
style: {
|
|
390
|
+
display: 'block',
|
|
391
|
+
overflow: 'visible',
|
|
392
|
+
border: '1px solid #ccc',
|
|
393
|
+
userSelect: 'none'
|
|
394
|
+
},
|
|
395
|
+
onMouseMove: handleDrag,
|
|
396
|
+
onMouseUp: handleDragEnd,
|
|
397
|
+
onMouseLeave: handleDragEnd,
|
|
398
|
+
onTouchMove: handleDrag,
|
|
399
|
+
onTouchEnd: handleDragEnd
|
|
400
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
401
|
+
id: "spectrumGradient",
|
|
402
|
+
x1: ": ",
|
|
403
|
+
y1: ", ",
|
|
404
|
+
x2: "100%",
|
|
405
|
+
y2: ": "
|
|
406
|
+
}, gradientStopData.map(function (stop) {
|
|
407
|
+
return /*#__PURE__*/React.createElement("stop", {
|
|
408
|
+
key: stop.offset,
|
|
409
|
+
offset: stop.offset,
|
|
410
|
+
stopColor: stop.color
|
|
411
|
+
});
|
|
412
|
+
}))), /*#__PURE__*/React.createElement("path", {
|
|
413
|
+
d: pathData,
|
|
414
|
+
fill: "none",
|
|
415
|
+
stroke: "url(#spectrumGradient)" // Apply the gradient here
|
|
416
|
+
,
|
|
417
|
+
strokeWidth: 10 // Increased stroke width for visibility
|
|
418
|
+
,
|
|
419
|
+
strokeLinecap: "round"
|
|
420
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
421
|
+
x1: start[0],
|
|
422
|
+
y1: start[1],
|
|
423
|
+
x2: handle1[0],
|
|
424
|
+
y2: handle1[1],
|
|
425
|
+
stroke: "#a0a0a0",
|
|
426
|
+
strokeWidth: "1",
|
|
427
|
+
strokeDasharray: "4 2"
|
|
428
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
429
|
+
x1: end[0],
|
|
430
|
+
y1: end[1],
|
|
431
|
+
x2: handle2[0],
|
|
432
|
+
y2: handle2[1],
|
|
433
|
+
stroke: "#a0a0a0",
|
|
434
|
+
strokeWidth: "1",
|
|
435
|
+
strokeDasharray: "4 2"
|
|
436
|
+
}), pointsT.map(function (t, i) {
|
|
437
|
+
var _cubicBezier5 = cubicBezier(t, start, handle1, handle2, end),
|
|
438
|
+
_cubicBezier6 = _slicedToArray(_cubicBezier5, 2),
|
|
439
|
+
px = _cubicBezier6[0],
|
|
440
|
+
py = _cubicBezier6[1];
|
|
441
|
+
//const clampedPy = Math.max(0, Math.min(height, py)); // Already calculated for swatches
|
|
442
|
+
//const l = baseLightness + (0.5 - clampedPy / height) * lightnessRange;
|
|
443
|
+
//const { r, g, b } = hslToRgb(hue, sat, l);
|
|
444
|
+
var isAscendant = i === middleIndex;
|
|
445
|
+
var isSecondary = isAscendant ? false : i % baseMiddleOffset === Math.floor(baseMiddleOffset / 2) && Math.floor(i / baseMiddleOffset) * baseColorCount < totalPoints;
|
|
446
|
+
return /*#__PURE__*/React.createElement("circle", {
|
|
447
|
+
key: i,
|
|
448
|
+
cx: px,
|
|
449
|
+
cy: py // Render circle at actual curve position
|
|
450
|
+
,
|
|
451
|
+
r: isAscendant ? 6 : isSecondary ? 4 : 3 // Keep indicators, make non-ascendant smaller
|
|
452
|
+
,
|
|
453
|
+
fill: isAscendant ? "gold" : "rgba(255,255,255,0.7)" // Fill points for visibility against gradient
|
|
454
|
+
,
|
|
455
|
+
stroke: isAscendant ? "black" : "rgba(0,0,0,0.5)" // Outline for clarity
|
|
456
|
+
,
|
|
457
|
+
strokeWidth: 1
|
|
458
|
+
});
|
|
459
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
460
|
+
cx: start[0],
|
|
461
|
+
cy: start[1],
|
|
462
|
+
r: 12,
|
|
463
|
+
fill: "#fff",
|
|
464
|
+
stroke: "#3498db",
|
|
465
|
+
strokeWidth: 3,
|
|
466
|
+
style: {
|
|
467
|
+
cursor: 'grab'
|
|
468
|
+
},
|
|
469
|
+
onMouseDown: function onMouseDown(e) {
|
|
470
|
+
return handleDragStart('A', e);
|
|
471
|
+
}
|
|
472
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
473
|
+
cx: end[0],
|
|
474
|
+
cy: end[1],
|
|
475
|
+
r: 12,
|
|
476
|
+
fill: "#fff",
|
|
477
|
+
stroke: "#e74c3c",
|
|
478
|
+
strokeWidth: 3,
|
|
479
|
+
style: {
|
|
480
|
+
cursor: 'grab'
|
|
481
|
+
},
|
|
482
|
+
onMouseDown: function onMouseDown(e) {
|
|
483
|
+
return handleDragStart('C', e);
|
|
484
|
+
}
|
|
485
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
486
|
+
cx: handle1[0],
|
|
487
|
+
cy: handle1[1],
|
|
488
|
+
r: 9,
|
|
489
|
+
fill: "#f9e7c0",
|
|
490
|
+
stroke: "#f39c12",
|
|
491
|
+
strokeWidth: 2,
|
|
492
|
+
style: {
|
|
493
|
+
cursor: 'grab'
|
|
494
|
+
},
|
|
495
|
+
onMouseDown: function onMouseDown(e) {
|
|
496
|
+
return handleDragStart('HANDLE1', e);
|
|
497
|
+
}
|
|
498
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
499
|
+
cx: handle2[0],
|
|
500
|
+
cy: handle2[1],
|
|
501
|
+
r: 9,
|
|
502
|
+
fill: "#f9e7c0",
|
|
503
|
+
stroke: "#f39c12",
|
|
504
|
+
strokeWidth: 2,
|
|
505
|
+
style: {
|
|
506
|
+
cursor: 'grab'
|
|
507
|
+
},
|
|
508
|
+
onMouseDown: function onMouseDown(e) {
|
|
509
|
+
return handleDragStart('HANDLE2', e);
|
|
510
|
+
}
|
|
511
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
512
|
+
className: "flex justify-center flex-wrap gap-1 mt-4"
|
|
513
|
+
}, colorSwatches.map(function (_ref, i) {
|
|
514
|
+
var t = _ref.t,
|
|
515
|
+
hex = _ref.hex,
|
|
516
|
+
l = _ref.l,
|
|
517
|
+
isPrimaryMiddle = _ref.isPrimaryMiddle,
|
|
518
|
+
isSecondaryMiddle = _ref.isSecondaryMiddle;
|
|
519
|
+
var borderColorClass = isPrimaryMiddle ? 'border-2 border-black shadow-md' // Primary middle border
|
|
520
|
+
: isSecondaryMiddle ? 'border border-gray-500' // Secondary middle border
|
|
521
|
+
: 'border border-transparent'; // No special border
|
|
522
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
523
|
+
key: t // Use t for key stability if totalPoints changes
|
|
524
|
+
,
|
|
525
|
+
className: "relative w-10 h-16 rounded overflow-hidden cursor-pointer ".concat(borderColorClass),
|
|
526
|
+
title: "L: ".concat(l.toFixed(1), "%\nClick to copy ").concat(hex),
|
|
527
|
+
onClick: function onClick() {
|
|
528
|
+
return handleCopyHex(hex);
|
|
529
|
+
}
|
|
530
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
531
|
+
className: "absolute inset-0",
|
|
532
|
+
style: {
|
|
533
|
+
backgroundColor: "#".concat(hex)
|
|
534
|
+
}
|
|
535
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
536
|
+
className: "absolute bottom-0 left-0 right-0 bg-black bg-opacity-50 text-white text-[10px] text-center py-0.5"
|
|
537
|
+
}, hex), copiedHex === hex && /*#__PURE__*/React.createElement("div", {
|
|
538
|
+
className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center text-xs font-bold text-green-600"
|
|
539
|
+
}, "Copied!"));
|
|
540
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
541
|
+
className: "mt-6 text-sm text-gray-600 text-center"
|
|
542
|
+
}, /*#__PURE__*/React.createElement("b", null, "How it works:"), " Adjust H, S, L. Set Base Colors & Multiplier (1x-4x, max ", maxTotalPoints, " total). Drag handles (A, C, Yellow) to shape lightness curve. Middle point gets black border, secondary middles get gray border. Click hex to copy."));
|
|
543
|
+
};
|