@fab1o978/react-ui 0.1.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/README.md +73 -0
- package/dist/components/Badge/index.cjs +47 -0
- package/dist/components/Badge/index.cjs.map +1 -0
- package/dist/components/Badge/index.css +112 -0
- package/dist/components/Badge/index.css.map +1 -0
- package/dist/components/Badge/index.d.cts +14 -0
- package/dist/components/Badge/index.d.ts +14 -0
- package/dist/components/Badge/index.js +45 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Button/index.cjs +64 -0
- package/dist/components/Button/index.cjs.map +1 -0
- package/dist/components/Button/index.css +159 -0
- package/dist/components/Button/index.css.map +1 -0
- package/dist/components/Button/index.d.cts +13 -0
- package/dist/components/Button/index.d.ts +13 -0
- package/dist/components/Button/index.js +58 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/ColorPicker/index.cjs +523 -0
- package/dist/components/ColorPicker/index.cjs.map +1 -0
- package/dist/components/ColorPicker/index.css +308 -0
- package/dist/components/ColorPicker/index.css.map +1 -0
- package/dist/components/ColorPicker/index.d.cts +35 -0
- package/dist/components/ColorPicker/index.d.ts +35 -0
- package/dist/components/ColorPicker/index.js +521 -0
- package/dist/components/ColorPicker/index.js.map +1 -0
- package/dist/components/Input/index.cjs +86 -0
- package/dist/components/Input/index.cjs.map +1 -0
- package/dist/components/Input/index.css +170 -0
- package/dist/components/Input/index.css.map +1 -0
- package/dist/components/Input/index.d.cts +15 -0
- package/dist/components/Input/index.d.ts +15 -0
- package/dist/components/Input/index.js +80 -0
- package/dist/components/Input/index.js.map +1 -0
- package/dist/components/RainCanvas/index.cjs +227 -0
- package/dist/components/RainCanvas/index.cjs.map +1 -0
- package/dist/components/RainCanvas/index.css +32 -0
- package/dist/components/RainCanvas/index.css.map +1 -0
- package/dist/components/RainCanvas/index.d.cts +12 -0
- package/dist/components/RainCanvas/index.d.ts +12 -0
- package/dist/components/RainCanvas/index.js +225 -0
- package/dist/components/RainCanvas/index.js.map +1 -0
- package/dist/components/Timeline/index.cjs +169 -0
- package/dist/components/Timeline/index.cjs.map +1 -0
- package/dist/components/Timeline/index.css +247 -0
- package/dist/components/Timeline/index.css.map +1 -0
- package/dist/components/Timeline/index.d.cts +22 -0
- package/dist/components/Timeline/index.d.ts +22 -0
- package/dist/components/Timeline/index.js +167 -0
- package/dist/components/Timeline/index.js.map +1 -0
- package/dist/index.cjs +993 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1019 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +982 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/styles/tokens.scss","../../../src/components/Button/Button.module.scss"],"sourcesContent":["@use \"sass:color\";\n\n@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap\");\n\n// Accent di default — cambia qui per aggiornare tutta la libreria\n$accent: #3b82f6;\n\n:root {\n // Accent scale — derivata da $accent a compile time\n --accent: #{$accent};\n --accent-dot: #{color.scale($accent, $lightness: 12%)};\n --accent-track: #{$accent};\n --accent-ring: #{$accent};\n --accent-glow: #{color.change($accent, $alpha: 0.3)};\n --accent-light: #{color.scale($accent, $lightness: 45%, $saturation: -20%)};\n\n // Primary scale (mantenuta per retrocompatibilità con Button, Badge, Input)\n --color-primary-50: #{color.scale($accent, $lightness: 49%, $saturation: -30%)};\n --color-primary-100: #{color.scale($accent, $lightness: 42%, $saturation: -15%)};\n --color-primary-400: #{color.scale($accent, $lightness: 12%)};\n --color-primary-500: #{$accent};\n --color-primary-600: #{color.scale($accent, $lightness: -10%)};\n --color-primary-700: #{color.scale($accent, $lightness: -20%)};\n\n // Neutral\n --color-neutral-0: #ffffff;\n --color-neutral-100: #f3f4f6;\n --color-neutral-200: #e5e7eb;\n --color-neutral-400: #9ca3af;\n --color-neutral-600: #4b5563;\n --color-neutral-900: #111827;\n\n // Semantic\n --color-success-500: #22c55e;\n --color-success-600: #16a34a;\n --color-danger-500: #ef4444;\n --color-danger-600: #dc2626;\n --color-warning-500: #f59e0b;\n --color-warning-600: #d97706;\n\n // Typography\n --font-family-base: \"Inter\", system-ui, -apple-system, sans-serif;\n --font-size-xs: 0.75rem;\n --font-size-sm: 0.875rem;\n --font-size-md: 1rem;\n --font-size-lg: 1.125rem;\n\n // Spacing\n --spacing-1: 0.25rem;\n --spacing-2: 0.5rem;\n --spacing-3: 0.75rem;\n --spacing-4: 1rem;\n\n // Radius\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-full: 9999px;\n\n // Shadows\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n\n // Transitions\n --transition-fast: 150ms ease;\n\n // Surface (background di card/panel)\n --color-surface: #ffffff;\n --color-surface-elevated: #ffffff;\n}\n\n// ─── Dark theme ────────────────────────────────────────────────────────────────\n// Applicato via data-theme=\"dark\" sull'elemento root (gestito da Storybook decorator\n// e dall'app consumer). I componenti non devono fare nulla di speciale: basta che\n// usino i token var() e riceveranno automaticamente i valori dark.\n\n[data-theme=\"dark\"] {\n // Neutral (scala invertita)\n --color-neutral-0: #0f172a;\n --color-neutral-100: #1e293b;\n --color-neutral-200: #334155;\n --color-neutral-400: #94a3b8;\n --color-neutral-600: #cbd5e1;\n --color-neutral-900: #f8fafc;\n\n // Surface\n --color-surface: #1e293b;\n --color-surface-elevated: #273549;\n\n // Primary scale dark (per il default accent blu — le sfumature chiare diventano scure)\n --color-primary-50: #172554;\n --color-primary-100: #1e3a8a;\n // 400 / 500 / 600 / 700 rimangono invariati (abbastanza saturi su bg scuro)\n\n // Accent light: variante scura\n --accent-light: #172554;\n\n // Shadows (più forti su bg scuro)\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);\n}\n","@import \"../../styles/tokens.scss\";\n\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-2);\n font-family: var(--font-family-base);\n font-weight: 500;\n letter-spacing: -0.01em;\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n cursor: pointer;\n transition: background-color var(--transition-fast),\n border-color var(--transition-fast), color var(--transition-fast),\n box-shadow var(--transition-fast);\n white-space: nowrap;\n text-decoration: none;\n outline-offset: 2px;\n}\n\n.button:focus-visible {\n outline: 2px solid var(--color-primary-500);\n}\n\n.button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Variants */\n.primary {\n background-color: var(--color-primary-600);\n color: var(--color-neutral-0);\n}\n.primary:hover:not(:disabled) {\n background-color: var(--color-primary-700);\n}\n\n.secondary {\n background-color: var(--color-neutral-0);\n color: var(--color-neutral-900);\n border-color: var(--color-neutral-200);\n box-shadow: var(--shadow-sm);\n}\n.secondary:hover:not(:disabled) {\n background-color: var(--color-neutral-100);\n}\n\n.danger {\n background-color: var(--color-danger-500);\n color: var(--color-neutral-0);\n}\n.danger:hover:not(:disabled) {\n background-color: var(--color-danger-600);\n}\n\n.ghost {\n background-color: transparent;\n color: var(--color-neutral-600);\n}\n.ghost:hover:not(:disabled) {\n background-color: var(--color-neutral-100);\n color: var(--color-neutral-900);\n}\n\n/* Sizes */\n.sm {\n font-size: var(--font-size-xs);\n padding: var(--spacing-1) var(--spacing-3);\n height: 2rem;\n}\n\n.md {\n font-size: var(--font-size-sm);\n padding: var(--spacing-2) var(--spacing-4);\n height: 2.5rem;\n}\n\n.lg {\n font-size: var(--font-size-md);\n padding: var(--spacing-3) var(--spacing-4);\n height: 3rem;\n}\n\n.fullWidth {\n width: 100%;\n}\n\n/* Loading */\n.loading {\n position: relative;\n}\n\n.spinner {\n width: 1em;\n height: 1em;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: var(--radius-full);\n animation: spin 0.6s linear infinite;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n"],"mappings":";;;AAOA;AAEE,YAAA;AACA,gBAAA,IAAA,KAAA,EAAA,GAAA,EAAA;AACA,kBAAA;AACA,iBAAA;AACA,iBAAA,KAAA,EAAA,EAAA,GAAA,EAAA,GAAA,EAAA;AACA,kBAAA,IAAA,OAAA,EAAA,OAAA,EAAA;AAGA,sBAAA,IAAA,QAAA,EAAA,QAAA,EAAA;AACA,uBAAA,IAAA,QAAA,EAAA,QAAA,EAAA;AACA,uBAAA,IAAA,KAAA,EAAA,GAAA,EAAA;AACA,uBAAA;AACA,uBAAA,IAAA,aAAA,EAAA,cAAA,EAAA;AACA,uBAAA,IAAA,YAAA,EAAA,aAAA,EAAA;AAGA,qBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AAGA,uBAAA;AACA,uBAAA;AACA,sBAAA;AACA,sBAAA;AACA,uBAAA;AACA,uBAAA;AAGA;IAAA,OAAA;IAAA,SAAA;IAAA,aAAA;IAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AAGA,eAAA;AACA,eAAA;AACA,eAAA;AACA,eAAA;AAGA,eAAA;AACA,eAAA;AACA,eAAA;AACA,iBAAA;AAGA,eAAA,EAAA,IAAA,IAAA,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA;AACA,eAAA,EAAA,IAAA,IAAA,KAAA,IAAA,EAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,IAAA,IAAA,KAAA,IAAA,EAAA,EAAA,EAAA,EAAA;AAGA,qBAAA,MAAA;AAGA,mBAAA;AACA,4BAAA;;AAQF,CAAA;AAEE,qBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AACA,uBAAA;AAGA,mBAAA;AACA,4BAAA;AA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ACE,aAAA,IAAA;AACA,WAAA,IAAA,aAAA,IAAA;AACA,UAAA;;AAGF,CAAAC;AACE,SAAA;;AAIF,CAAAC;AACE,YAAA;;AAGF,CAAAC;AACE,SAAA;AACA,UAAA;AACA,UAAA,IAAA,MAAA;AACA,oBAAA;AACA,iBAAA,IAAA;AACA,aAAA,oBAAA,KAAA,OAAA;;AAGF,WAHEC;AAIA;AACE,eAAA,OAAA;;;","names":["button","primary","secondary","danger","ghost","sm","md","lg","fullWidth","loading","spinner","spin"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "danger" | "ghost";
|
|
4
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
5
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
|
|
13
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "danger" | "ghost";
|
|
4
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
5
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
|
|
13
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/Button/Button.tsx
|
|
5
|
+
|
|
6
|
+
// src/components/Button/Button.module.scss
|
|
7
|
+
var Button_module_default = {
|
|
8
|
+
button: "Button_module_button2",
|
|
9
|
+
primary: "Button_module_primary2",
|
|
10
|
+
secondary: "Button_module_secondary2",
|
|
11
|
+
danger: "Button_module_danger2",
|
|
12
|
+
ghost: "Button_module_ghost2",
|
|
13
|
+
sm: "Button_module_sm2",
|
|
14
|
+
md: "Button_module_md2",
|
|
15
|
+
lg: "Button_module_lg2",
|
|
16
|
+
fullWidth: "Button_module_fullWidth2",
|
|
17
|
+
loading: "Button_module_loading2",
|
|
18
|
+
spinner: "Button_module_spinner2",
|
|
19
|
+
spin: "Button_module_spin2"
|
|
20
|
+
};
|
|
21
|
+
var Button = React.forwardRef(
|
|
22
|
+
({
|
|
23
|
+
variant = "primary",
|
|
24
|
+
size = "md",
|
|
25
|
+
loading = false,
|
|
26
|
+
fullWidth = false,
|
|
27
|
+
disabled,
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}, ref) => {
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
disabled: disabled || loading,
|
|
37
|
+
className: [
|
|
38
|
+
Button_module_default.button,
|
|
39
|
+
Button_module_default[variant],
|
|
40
|
+
Button_module_default[size],
|
|
41
|
+
fullWidth ? Button_module_default.fullWidth : "",
|
|
42
|
+
loading ? Button_module_default.loading : "",
|
|
43
|
+
className ?? ""
|
|
44
|
+
].filter(Boolean).join(" "),
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
loading && /* @__PURE__ */ jsx("span", { className: Button_module_default.spinner, "aria-hidden": "true" }),
|
|
48
|
+
children
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
Button.displayName = "Button";
|
|
55
|
+
|
|
56
|
+
export { Button };
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Button/Button.module.scss","../../../src/components/Button/Button.tsx"],"names":["button","primary","secondary","danger","ghost","sm","md","lg","fullWidth","loading","spinner","spin"],"mappings":";;;;;;AAAA,IAAA,qBAAA,GAAA;AAAA,EA8DC,MAAA,EAAAA,uBAAAA;AAAA,EA2BA,OAAA,EAAAC,wBAAAA;AAAA,EASA,SAAA,EAAAC,0BAAAA;AAAA,EAWA,MAAA,EAAAC,uBAAAA;AAAA,EASA,KAAA,EAAAC,sBAAAA;AAAA,EAWA,EAAA,EAAAC,mBAAAA;AAAA,EAMA,EAAA,EAAAC,mBAAAA;AAAA,EAMA,EAAA,EAAAC,mBAAAA;AAAA,EAMA,SAAA,EAAAC,0BAAAA;AAAA,EAKA,OAAA,EAAAC,wBAAAA;AAAA,EAIA,OAAA,EAAAC,wBAAAA;AAAA,EAMY,IAAA,EAAAC;AAAA,CAAA;ACpJN,IAAM,SAAS,KAAA,CAAM,UAAA;AAAA,EAC1B,CACE;AAAA,IACE,OAAA,GAAU,SAAA;AAAA,IACV,IAAA,GAAO,IAAA;AAAA,IACP,OAAA,GAAU,KAAA;AAAA,IACV,SAAA,GAAY,KAAA;AAAA,IACZ,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,uBACE,IAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,UAAU,QAAA,IAAY,OAAA;AAAA,QACtB,SAAA,EAAW;AAAA,UACT,qBAAA,CAAO,MAAA;AAAA,UACP,sBAAO,OAAO,CAAA;AAAA,UACd,sBAAO,IAAI,CAAA;AAAA,UACX,SAAA,GAAY,sBAAO,SAAA,GAAY,EAAA;AAAA,UAC/B,OAAA,GAAU,sBAAO,OAAA,GAAU,EAAA;AAAA,UAC3B,SAAA,IAAa;AAAA,SACf,CACG,MAAA,CAAO,OAAO,CAAA,CACd,KAAK,GAAG,CAAA;AAAA,QACV,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,MAAA,EAAA,EAAK,SAAA,EAAW,qBAAA,CAAO,OAAA,EAAS,eAAY,MAAA,EAAO,CAAA;AAAA,UAC/D;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"index.js","sourcesContent":["@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap\");\n:root {\n --accent: #3b82f6;\n --accent-dot: rgb(82.52, 145, 247.08);\n --accent-track: #3b82f6;\n --accent-ring: #3b82f6;\n --accent-glow: rgba(59, 130, 246, 0.3);\n --accent-light: rgb(157.485, 188.725, 239.765);\n --color-primary-50: rgb(169.3455, 194.6925, 236.1045);\n --color-primary-100: rgb(149.4545, 184.4575, 241.6455);\n --color-primary-400: rgb(82.52, 145, 247.08);\n --color-primary-500: #3b82f6;\n --color-primary-600: rgb(29.8390243902, 111.4024390244, 244.6609756098);\n --color-primary-700: rgb(10.712195122, 95.2195121951, 233.287804878);\n --color-neutral-0: #ffffff;\n --color-neutral-100: #f3f4f6;\n --color-neutral-200: #e5e7eb;\n --color-neutral-400: #9ca3af;\n --color-neutral-600: #4b5563;\n --color-neutral-900: #111827;\n --color-success-500: #22c55e;\n --color-success-600: #16a34a;\n --color-danger-500: #ef4444;\n --color-danger-600: #dc2626;\n --color-warning-500: #f59e0b;\n --color-warning-600: #d97706;\n --font-family-base: \"Inter\", system-ui, -apple-system, sans-serif;\n --font-size-xs: 0.75rem;\n --font-size-sm: 0.875rem;\n --font-size-md: 1rem;\n --font-size-lg: 1.125rem;\n --spacing-1: 0.25rem;\n --spacing-2: 0.5rem;\n --spacing-3: 0.75rem;\n --spacing-4: 1rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-full: 9999px;\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --transition-fast: 150ms ease;\n --color-surface: #ffffff;\n --color-surface-elevated: #ffffff;\n}\n\n[data-theme=dark] {\n --color-neutral-0: #0f172a;\n --color-neutral-100: #1e293b;\n --color-neutral-200: #334155;\n --color-neutral-400: #94a3b8;\n --color-neutral-600: #cbd5e1;\n --color-neutral-900: #f8fafc;\n --color-surface: #1e293b;\n --color-surface-elevated: #273549;\n --color-primary-50: #172554;\n --color-primary-100: #1e3a8a;\n --accent-light: #172554;\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);\n}\n\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-2);\n font-family: var(--font-family-base);\n font-weight: 500;\n letter-spacing: -0.01em;\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n cursor: pointer;\n transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);\n white-space: nowrap;\n text-decoration: none;\n outline-offset: 2px;\n}\n\n.button:focus-visible {\n outline: 2px solid var(--color-primary-500);\n}\n\n.button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Variants */\n.primary {\n background-color: var(--color-primary-600);\n color: var(--color-neutral-0);\n}\n\n.primary:hover:not(:disabled) {\n background-color: var(--color-primary-700);\n}\n\n.secondary {\n background-color: var(--color-neutral-0);\n color: var(--color-neutral-900);\n border-color: var(--color-neutral-200);\n box-shadow: var(--shadow-sm);\n}\n\n.secondary:hover:not(:disabled) {\n background-color: var(--color-neutral-100);\n}\n\n.danger {\n background-color: var(--color-danger-500);\n color: var(--color-neutral-0);\n}\n\n.danger:hover:not(:disabled) {\n background-color: var(--color-danger-600);\n}\n\n.ghost {\n background-color: transparent;\n color: var(--color-neutral-600);\n}\n\n.ghost:hover:not(:disabled) {\n background-color: var(--color-neutral-100);\n color: var(--color-neutral-900);\n}\n\n/* Sizes */\n.sm {\n font-size: var(--font-size-xs);\n padding: var(--spacing-1) var(--spacing-3);\n height: 2rem;\n}\n\n.md {\n font-size: var(--font-size-sm);\n padding: var(--spacing-2) var(--spacing-4);\n height: 2.5rem;\n}\n\n.lg {\n font-size: var(--font-size-md);\n padding: var(--spacing-3) var(--spacing-4);\n height: 3rem;\n}\n\n.fullWidth {\n width: 100%;\n}\n\n/* Loading */\n.loading {\n position: relative;\n}\n\n.spinner {\n width: 1em;\n height: 1em;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: var(--radius-full);\n animation: spin 0.6s linear infinite;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3N0eWxlcy90b2tlbnMuc2NzcyIsIkJ1dHRvbi5tb2R1bGUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFUTtBQUtSO0VBRUU7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBR0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBR0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBR0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBR0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUdBO0VBQ0E7RUFDQTtFQUNBO0VBR0E7RUFDQTtFQUNBO0VBQ0E7RUFHQTtFQUNBO0VBR0E7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ldXRyYWwtOTAwKTtcbn1cblxuLyogU2l6ZXMgKi9cbi5zbSB7XG4gIGZvbnQtc2l6ZTogdmFyKC0tZm9udC1zaXplLXhzKTtcbiAgcGFkZGluZzogdmFyKC0tc3BhY2luZy0xKSB2YXIoLS1zcGFjaW5nLTMpO1xuICBoZWlnaHQ6IDJyZW07XG59XG5cbi5tZCB7XG4gIGZvbnQtc2l6ZTogdmFyKC0tZm9udC1zaXplLXNtKTtcbiAgcGFkZGluZzogdmFyKC0tc3BhY2luZy0yKSB2YXIoLS1zcGFjaW5nLTQpO1xuICBoZWlnaHQ6IDIuNXJlbTtcbn1cblxuLmxnIHtcbiAgZm9udC1zaXplOiB2YXIoLS1mb250LXNpemUtbWQpO1xuICBwYWRkaW5nOiB2YXIoLS1zcGFjaW5nLTMpIHZhcigtLXNwYWNpbmctNCk7XG4gIGhlaWdodDogM3JlbTtcbn1cblxuLmZ1bGxXaWR0aCB7XG4gIHdpZHRoOiAxMDAlO1xufVxuXG4vKiBMb2FkaW5nICovXG4ubG9hZGluZyB7XG4gIHBvc2l0aW9uOiByZWxhdGl2ZTtcbn1cblxuLnNwaW5uZXIge1xuICB3aWR0aDogMWVtO1xuICBoZWlnaHQ6IDFlbTtcbiAgYm9yZGVyOiAycHggc29saWQgY3VycmVudENvbG9yO1xuICBib3JkZXItdG9wLWNvbG9yOiB0cmFuc3BhcmVudDtcbiAgYm9yZGVyLXJhZGl1czogdmFyKC0tcmFkaXVzLWZ1bGwpO1xuICBhbmltYXRpb246IHNwaW4gMC42cyBsaW5lYXIgaW5maW5pdGU7XG59XG5cbkBrZXlmcmFtZXMgc3BpbiB7XG4gIHRvIHtcbiAgICB0cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpO1xuICB9XG59XG4iXX0= */","import React from \"react\";\nimport styles from \"./Button.module.scss\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\" | \"ghost\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n loading?: boolean;\n fullWidth?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"primary\",\n size = \"md\",\n loading = false,\n fullWidth = false,\n disabled,\n children,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <button\n ref={ref}\n disabled={disabled || loading}\n className={[\n styles.button,\n styles[variant],\n styles[size],\n fullWidth ? styles.fullWidth : \"\",\n loading ? styles.loading : \"\",\n className ?? \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n {...props}\n >\n {loading && <span className={styles.spinner} aria-hidden=\"true\" />}\n {children}\n </button>\n );\n }\n);\n\nButton.displayName = \"Button\";\n"]}
|
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// src/components/ColorPicker/ColorPicker.tsx
|
|
7
|
+
|
|
8
|
+
// src/components/ColorPicker/ColorPicker.module.scss
|
|
9
|
+
var ColorPicker_module_default = {
|
|
10
|
+
colorPicker: "ColorPicker_module_colorPicker2",
|
|
11
|
+
topRow: "ColorPicker_module_topRow2",
|
|
12
|
+
discWrapper: "ColorPicker_module_discWrapper2",
|
|
13
|
+
disc: "ColorPicker_module_disc2",
|
|
14
|
+
dot: "ColorPicker_module_dot2",
|
|
15
|
+
lSlider: "ColorPicker_module_lSlider2",
|
|
16
|
+
lThumb: "ColorPicker_module_lThumb2",
|
|
17
|
+
alphaSlider: "ColorPicker_module_alphaSlider2",
|
|
18
|
+
alphaThumb: "ColorPicker_module_alphaThumb2",
|
|
19
|
+
previewSwatch: "ColorPicker_module_previewSwatch2",
|
|
20
|
+
eyedropperBtn: "ColorPicker_module_eyedropperBtn2",
|
|
21
|
+
inputSection: "ColorPicker_module_inputSection2",
|
|
22
|
+
tabs: "ColorPicker_module_tabs2",
|
|
23
|
+
tab: "ColorPicker_module_tab2",
|
|
24
|
+
tabActive: "ColorPicker_module_tabActive2",
|
|
25
|
+
inputWrapper: "ColorPicker_module_inputWrapper2",
|
|
26
|
+
inputAddon: "ColorPicker_module_inputAddon2",
|
|
27
|
+
input: "ColorPicker_module_input2",
|
|
28
|
+
inputCopyBtn: "ColorPicker_module_inputCopyBtn2",
|
|
29
|
+
recents: "ColorPicker_module_recents2",
|
|
30
|
+
recentsLabel: "ColorPicker_module_recentsLabel2",
|
|
31
|
+
swatches: "ColorPicker_module_swatches2",
|
|
32
|
+
recentSwatch: "ColorPicker_module_recentSwatch2"
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/utils/color.ts
|
|
36
|
+
function hexToHsl(hex) {
|
|
37
|
+
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
38
|
+
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
39
|
+
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
40
|
+
const max = Math.max(r, g, b);
|
|
41
|
+
const min = Math.min(r, g, b);
|
|
42
|
+
const l = (max + min) / 2;
|
|
43
|
+
let h = 0;
|
|
44
|
+
let s = 0;
|
|
45
|
+
if (max !== min) {
|
|
46
|
+
const d = max - min;
|
|
47
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
48
|
+
switch (max) {
|
|
49
|
+
case r:
|
|
50
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
51
|
+
break;
|
|
52
|
+
case g:
|
|
53
|
+
h = ((b - r) / d + 2) / 6;
|
|
54
|
+
break;
|
|
55
|
+
case b:
|
|
56
|
+
h = ((r - g) / d + 4) / 6;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [h * 360, s * 100, l * 100];
|
|
61
|
+
}
|
|
62
|
+
function hslToHex(h, s, l) {
|
|
63
|
+
const sl = s / 100;
|
|
64
|
+
const ll = l / 100;
|
|
65
|
+
const a = sl * Math.min(ll, 1 - ll);
|
|
66
|
+
const f = (n) => {
|
|
67
|
+
const k = (n + h / 30) % 12;
|
|
68
|
+
const color = ll - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
69
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
70
|
+
};
|
|
71
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
72
|
+
}
|
|
73
|
+
function hslToRgb(h, s, l) {
|
|
74
|
+
const sl = s / 100;
|
|
75
|
+
const ll = l / 100;
|
|
76
|
+
const a = sl * Math.min(ll, 1 - ll);
|
|
77
|
+
const f = (n) => {
|
|
78
|
+
const k = (n + h / 30) % 12;
|
|
79
|
+
return Math.round(255 * (ll - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)));
|
|
80
|
+
};
|
|
81
|
+
return { r: f(0), g: f(8), b: f(4) };
|
|
82
|
+
}
|
|
83
|
+
function rgbToHsl(r, g, b) {
|
|
84
|
+
const rr = r / 255, gg = g / 255, bb = b / 255;
|
|
85
|
+
const max = Math.max(rr, gg, bb);
|
|
86
|
+
const min = Math.min(rr, gg, bb);
|
|
87
|
+
const l = (max + min) / 2;
|
|
88
|
+
let h = 0, s = 0;
|
|
89
|
+
if (max !== min) {
|
|
90
|
+
const d = max - min;
|
|
91
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
92
|
+
switch (max) {
|
|
93
|
+
case rr:
|
|
94
|
+
h = ((gg - bb) / d + (gg < bb ? 6 : 0)) / 6;
|
|
95
|
+
break;
|
|
96
|
+
case gg:
|
|
97
|
+
h = ((bb - rr) / d + 2) / 6;
|
|
98
|
+
break;
|
|
99
|
+
case bb:
|
|
100
|
+
h = ((rr - gg) / d + 4) / 6;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return [h * 360, s * 100, l * 100];
|
|
105
|
+
}
|
|
106
|
+
function hslToRgba(h, s, l, alpha) {
|
|
107
|
+
const { r, g, b } = hslToRgb(h, s, l);
|
|
108
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
109
|
+
}
|
|
110
|
+
function buildColorValue(h, s, l, a) {
|
|
111
|
+
const { r, g, b } = hslToRgb(h, s, l);
|
|
112
|
+
const hex = hslToHex(h, s, l);
|
|
113
|
+
const alphaHex = Math.round(a * 255).toString(16).padStart(2, "0");
|
|
114
|
+
const hR = Math.round(h), sR = Math.round(s), lR = Math.round(l);
|
|
115
|
+
const aR = Math.round(a * 100) / 100;
|
|
116
|
+
return {
|
|
117
|
+
hex,
|
|
118
|
+
hexa: `${hex}${alphaHex}`,
|
|
119
|
+
hsl: `hsl(${hR}, ${sR}%, ${lR}%)`,
|
|
120
|
+
hsla: `hsla(${hR}, ${sR}%, ${lR}%, ${aR})`,
|
|
121
|
+
rgb: `rgb(${r}, ${g}, ${b})`,
|
|
122
|
+
rgba: `rgba(${r}, ${g}, ${b}, ${aR})`,
|
|
123
|
+
h,
|
|
124
|
+
s,
|
|
125
|
+
l,
|
|
126
|
+
a
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function deriveAccent(hex) {
|
|
130
|
+
const [h, s, l] = hexToHsl(hex);
|
|
131
|
+
return {
|
|
132
|
+
base: hex,
|
|
133
|
+
dot: hslToHex(h, s, Math.min(l + 12, 95)),
|
|
134
|
+
track: hex,
|
|
135
|
+
ring: hex,
|
|
136
|
+
glow: hslToRgba(h, s, l, 0.3),
|
|
137
|
+
light: hslToHex(h, Math.max(s - 20, 0), Math.min(l + 45, 96))
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function accentToCssVars(tokens, prefix) {
|
|
141
|
+
return {
|
|
142
|
+
[`--${prefix}-accent`]: tokens.base,
|
|
143
|
+
[`--${prefix}-accent-dot`]: tokens.dot,
|
|
144
|
+
[`--${prefix}-accent-track`]: tokens.track,
|
|
145
|
+
[`--${prefix}-accent-ring`]: tokens.ring,
|
|
146
|
+
[`--${prefix}-accent-glow`]: tokens.glow,
|
|
147
|
+
[`--${prefix}-accent-light`]: tokens.light
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
var DISC = 200;
|
|
151
|
+
var CopyIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: [
|
|
152
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "5", y: "5", width: "7", height: "7", rx: "1.5", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 9V2.5A.5.5 0 0 1 2.5 2H9", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" })
|
|
154
|
+
] });
|
|
155
|
+
var CheckIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5 7L5.5 10L11.5 4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
156
|
+
var EyedropperIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: [
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.5 2.5L11.5 4.5L6 10L3 11L4 8L9.5 2.5Z", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }),
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 4L10 6", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }),
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "2.5", cy: "11.5", r: "1", fill: "currentColor" })
|
|
160
|
+
] });
|
|
161
|
+
function formatValue(mode, h, s, l, r, g, b, hex) {
|
|
162
|
+
if (mode === "hex") return hex.replace("#", "");
|
|
163
|
+
if (mode === "hsl") return `${Math.round(h)} ${Math.round(s)} ${Math.round(l)}`;
|
|
164
|
+
return `${r} ${g} ${b}`;
|
|
165
|
+
}
|
|
166
|
+
function parseValue(mode, raw) {
|
|
167
|
+
if (mode === "hex") {
|
|
168
|
+
const clean = raw.replace(/^#/, "");
|
|
169
|
+
if (!/^[0-9a-fA-F]{6}$/.test(clean)) return null;
|
|
170
|
+
const [h, s, l] = hexToHsl(`#${clean}`);
|
|
171
|
+
return [h, s, l];
|
|
172
|
+
}
|
|
173
|
+
const parts = raw.trim().split(/[\s,]+/).map(Number);
|
|
174
|
+
if (parts.length !== 3 || parts.some(isNaN)) return null;
|
|
175
|
+
if (mode === "hsl") {
|
|
176
|
+
const [h, s, l] = parts;
|
|
177
|
+
if (h < 0 || h > 360 || s < 0 || s > 100 || l < 0 || l > 100) return null;
|
|
178
|
+
return [h, s, l];
|
|
179
|
+
}
|
|
180
|
+
const [r, g, b] = parts;
|
|
181
|
+
if ([r, g, b].some((v) => v < 0 || v > 255)) return null;
|
|
182
|
+
return rgbToHsl(r, g, b);
|
|
183
|
+
}
|
|
184
|
+
var ColorInput = ({ mode, h, s, l, r, g, b, hex, onChange, onCopy, copied }) => {
|
|
185
|
+
const [draft, setDraft] = react.useState(() => formatValue(mode, h, s, l, r, g, b, hex));
|
|
186
|
+
const [focused, setFocused] = react.useState(false);
|
|
187
|
+
react.useEffect(() => {
|
|
188
|
+
if (!focused) setDraft(formatValue(mode, h, s, l, r, g, b, hex));
|
|
189
|
+
}, [focused, mode, h, s, l, r, g, b, hex]);
|
|
190
|
+
const placeholder = mode === "hex" ? "3b82f6" : mode === "hsl" ? "217 91 60" : "59 130 246";
|
|
191
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorPicker_module_default.inputWrapper, children: [
|
|
192
|
+
mode === "hex" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: ColorPicker_module_default.inputAddon, children: "#" }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
"input",
|
|
195
|
+
{
|
|
196
|
+
className: ColorPicker_module_default.input,
|
|
197
|
+
value: draft,
|
|
198
|
+
placeholder,
|
|
199
|
+
spellCheck: false,
|
|
200
|
+
onFocus: () => setFocused(true),
|
|
201
|
+
onBlur: () => setFocused(false),
|
|
202
|
+
onChange: (e) => {
|
|
203
|
+
const raw = e.target.value;
|
|
204
|
+
setDraft(raw);
|
|
205
|
+
const result = parseValue(mode, raw);
|
|
206
|
+
if (result) onChange(...result);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: ColorPicker_module_default.inputCopyBtn, onClick: onCopy, tabIndex: -1, title: "Copia", children: copied ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, {}) })
|
|
211
|
+
] });
|
|
212
|
+
};
|
|
213
|
+
function parseInitial(value) {
|
|
214
|
+
if (value?.startsWith("#")) {
|
|
215
|
+
const [h, s, l] = hexToHsl(value);
|
|
216
|
+
return [h, s, l, 1];
|
|
217
|
+
}
|
|
218
|
+
return [217, 91, 60, 1];
|
|
219
|
+
}
|
|
220
|
+
var ColorPicker = ({
|
|
221
|
+
value,
|
|
222
|
+
onChange,
|
|
223
|
+
showAlpha = true,
|
|
224
|
+
recentColors = [],
|
|
225
|
+
accent,
|
|
226
|
+
className
|
|
227
|
+
}) => {
|
|
228
|
+
const init = parseInitial(value);
|
|
229
|
+
const [h, setH] = react.useState(init[0]);
|
|
230
|
+
const [s, setS] = react.useState(init[1]);
|
|
231
|
+
const [l, setL] = react.useState(init[2]);
|
|
232
|
+
const [a, setA] = react.useState(init[3]);
|
|
233
|
+
const [mode, setMode] = react.useState("hex");
|
|
234
|
+
const [copied, setCopied] = react.useState(false);
|
|
235
|
+
const [hasEyeDropper, setHasEyeDropper] = react.useState(false);
|
|
236
|
+
const canvasRef = react.useRef(null);
|
|
237
|
+
react.useEffect(() => {
|
|
238
|
+
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
239
|
+
}, []);
|
|
240
|
+
react.useEffect(() => {
|
|
241
|
+
if (value?.startsWith("#")) {
|
|
242
|
+
const [nh, ns, nl] = hexToHsl(value);
|
|
243
|
+
setH(nh);
|
|
244
|
+
setS(ns);
|
|
245
|
+
setL(nl);
|
|
246
|
+
}
|
|
247
|
+
}, [value]);
|
|
248
|
+
react.useEffect(() => {
|
|
249
|
+
const canvas = canvasRef.current;
|
|
250
|
+
if (!canvas) return;
|
|
251
|
+
const ctx = canvas.getContext("2d");
|
|
252
|
+
if (!ctx) return;
|
|
253
|
+
const img = ctx.createImageData(DISC, DISC);
|
|
254
|
+
const data = img.data;
|
|
255
|
+
const cx = DISC / 2;
|
|
256
|
+
const cy = DISC / 2;
|
|
257
|
+
const radius = DISC / 2;
|
|
258
|
+
for (let py = 0; py < DISC; py++) {
|
|
259
|
+
for (let px = 0; px < DISC; px++) {
|
|
260
|
+
const dx = px - cx;
|
|
261
|
+
const dy = py - cy;
|
|
262
|
+
const r = Math.sqrt(dx * dx + dy * dy);
|
|
263
|
+
const idx = (py * DISC + px) * 4;
|
|
264
|
+
if (r > radius) {
|
|
265
|
+
data[idx + 3] = 0;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const theta = Math.atan2(dy, dx) * 180 / Math.PI;
|
|
269
|
+
const hue = (theta + 360) % 360;
|
|
270
|
+
const sat = r / radius * 100;
|
|
271
|
+
const { r: rr2, g: gg2, b: bb2 } = hslToRgb(hue, sat, l);
|
|
272
|
+
data[idx] = rr2;
|
|
273
|
+
data[idx + 1] = gg2;
|
|
274
|
+
data[idx + 2] = bb2;
|
|
275
|
+
data[idx + 3] = r > radius - 1 ? Math.round(255 * (radius - r)) : 255;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
ctx.putImageData(img, 0, 0);
|
|
279
|
+
}, [l]);
|
|
280
|
+
const notify = react.useCallback(
|
|
281
|
+
(nh, ns, nl, na) => {
|
|
282
|
+
onChange?.(buildColorValue(nh, ns, nl, na));
|
|
283
|
+
},
|
|
284
|
+
[onChange]
|
|
285
|
+
);
|
|
286
|
+
const updateDisc = react.useCallback(
|
|
287
|
+
(clientX, clientY, rect) => {
|
|
288
|
+
const cx = rect.left + rect.width / 2;
|
|
289
|
+
const cy = rect.top + rect.height / 2;
|
|
290
|
+
const dx = clientX - cx;
|
|
291
|
+
const dy = clientY - cy;
|
|
292
|
+
const r = Math.sqrt(dx * dx + dy * dy);
|
|
293
|
+
const radius = rect.width / 2;
|
|
294
|
+
const clampedR = Math.min(r, radius);
|
|
295
|
+
const theta = Math.atan2(dy, dx) * 180 / Math.PI;
|
|
296
|
+
const nh = (theta + 360) % 360;
|
|
297
|
+
const ns = clampedR / radius * 100;
|
|
298
|
+
setH(nh);
|
|
299
|
+
setS(ns);
|
|
300
|
+
notify(nh, ns, l, a);
|
|
301
|
+
},
|
|
302
|
+
[l, a, notify]
|
|
303
|
+
);
|
|
304
|
+
const handleDiscPointerDown = react.useCallback(
|
|
305
|
+
(e) => {
|
|
306
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
307
|
+
updateDisc(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
|
|
308
|
+
},
|
|
309
|
+
[updateDisc]
|
|
310
|
+
);
|
|
311
|
+
const handleDiscPointerMove = react.useCallback(
|
|
312
|
+
(e) => {
|
|
313
|
+
if (e.buttons === 0) return;
|
|
314
|
+
updateDisc(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
|
|
315
|
+
},
|
|
316
|
+
[updateDisc]
|
|
317
|
+
);
|
|
318
|
+
const updateL = react.useCallback(
|
|
319
|
+
(clientX, rect) => {
|
|
320
|
+
const nl = Math.max(0, Math.min(100, (clientX - rect.left) / rect.width * 100));
|
|
321
|
+
setL(nl);
|
|
322
|
+
notify(h, s, nl, a);
|
|
323
|
+
},
|
|
324
|
+
[h, s, a, notify]
|
|
325
|
+
);
|
|
326
|
+
const handleLPointerDown = react.useCallback(
|
|
327
|
+
(e) => {
|
|
328
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
329
|
+
updateL(e.clientX, e.currentTarget.getBoundingClientRect());
|
|
330
|
+
},
|
|
331
|
+
[updateL]
|
|
332
|
+
);
|
|
333
|
+
const handleLPointerMove = react.useCallback(
|
|
334
|
+
(e) => {
|
|
335
|
+
if (e.buttons === 0) return;
|
|
336
|
+
updateL(e.clientX, e.currentTarget.getBoundingClientRect());
|
|
337
|
+
},
|
|
338
|
+
[updateL]
|
|
339
|
+
);
|
|
340
|
+
const updateA = react.useCallback(
|
|
341
|
+
(clientX, rect) => {
|
|
342
|
+
const na = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
|
|
343
|
+
setA(na);
|
|
344
|
+
notify(h, s, l, na);
|
|
345
|
+
},
|
|
346
|
+
[h, s, l, notify]
|
|
347
|
+
);
|
|
348
|
+
const handleAPointerDown = react.useCallback(
|
|
349
|
+
(e) => {
|
|
350
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
351
|
+
updateA(e.clientX, e.currentTarget.getBoundingClientRect());
|
|
352
|
+
},
|
|
353
|
+
[updateA]
|
|
354
|
+
);
|
|
355
|
+
const handleAPointerMove = react.useCallback(
|
|
356
|
+
(e) => {
|
|
357
|
+
if (e.buttons === 0) return;
|
|
358
|
+
updateA(e.clientX, e.currentTarget.getBoundingClientRect());
|
|
359
|
+
},
|
|
360
|
+
[updateA]
|
|
361
|
+
);
|
|
362
|
+
const { r: rr, g: gg, b: bb } = hslToRgb(h, s, l);
|
|
363
|
+
const hexStr = hslToHex(h, s, l);
|
|
364
|
+
const rgbStr = `rgb(${rr}, ${gg}, ${bb})`;
|
|
365
|
+
const colorValue = buildColorValue(h, s, l, a);
|
|
366
|
+
const dotX = DISC / 2 + s / 100 * (DISC / 2) * Math.cos(h * Math.PI / 180);
|
|
367
|
+
const dotY = DISC / 2 + s / 100 * (DISC / 2) * Math.sin(h * Math.PI / 180);
|
|
368
|
+
const lGradient = `linear-gradient(to right,
|
|
369
|
+
hsl(${h}, ${s}%, 5%),
|
|
370
|
+
hsl(${h}, ${s}%, 50%),
|
|
371
|
+
hsl(${h}, ${s}%, 95%))`;
|
|
372
|
+
const alphaGradient = `linear-gradient(to right, transparent, ${rgbStr})`;
|
|
373
|
+
const handleEyeDropper = async () => {
|
|
374
|
+
if (!window.EyeDropper) return;
|
|
375
|
+
try {
|
|
376
|
+
const result = await new window.EyeDropper().open();
|
|
377
|
+
const [nh, ns, nl] = hexToHsl(result.sRGBHex);
|
|
378
|
+
setH(nh);
|
|
379
|
+
setS(ns);
|
|
380
|
+
setL(nl);
|
|
381
|
+
notify(nh, ns, nl, a);
|
|
382
|
+
} catch {
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const handleCopy = () => {
|
|
386
|
+
const text = mode === "hex" ? colorValue.hexa : mode === "hsl" ? colorValue.hsla : colorValue.rgba;
|
|
387
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
388
|
+
setCopied(true);
|
|
389
|
+
setTimeout(() => setCopied(false), 1500);
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
const handleSwatch = (color) => {
|
|
393
|
+
const [nh, ns, nl] = hexToHsl(color);
|
|
394
|
+
setH(nh);
|
|
395
|
+
setS(ns);
|
|
396
|
+
setL(nl);
|
|
397
|
+
notify(nh, ns, nl, a);
|
|
398
|
+
};
|
|
399
|
+
const accentVars = accent ? accentToCssVars(deriveAccent(accent), "colorpicker") : {};
|
|
400
|
+
mode === "hex" ? colorValue.hexa : mode === "hsl" ? colorValue.hsla : colorValue.rgba;
|
|
401
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
402
|
+
"div",
|
|
403
|
+
{
|
|
404
|
+
className: [ColorPicker_module_default.colorPicker, className ?? ""].filter(Boolean).join(" "),
|
|
405
|
+
style: accentVars,
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: ColorPicker_module_default.topRow, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorPicker_module_default.discWrapper, children: [
|
|
408
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
409
|
+
"canvas",
|
|
410
|
+
{
|
|
411
|
+
ref: canvasRef,
|
|
412
|
+
width: DISC,
|
|
413
|
+
height: DISC,
|
|
414
|
+
className: ColorPicker_module_default.disc,
|
|
415
|
+
onPointerDown: handleDiscPointerDown,
|
|
416
|
+
onPointerMove: handleDiscPointerMove
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
"div",
|
|
421
|
+
{
|
|
422
|
+
className: ColorPicker_module_default.dot,
|
|
423
|
+
style: {
|
|
424
|
+
left: dotX,
|
|
425
|
+
top: dotY,
|
|
426
|
+
borderColor: l > 55 ? "rgba(0,0,0,0.5)" : "rgba(255,255,255,0.85)"
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] }) }),
|
|
431
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
className: ColorPicker_module_default.lSlider,
|
|
435
|
+
style: { backgroundImage: lGradient },
|
|
436
|
+
onPointerDown: handleLPointerDown,
|
|
437
|
+
onPointerMove: handleLPointerMove,
|
|
438
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: ColorPicker_module_default.lThumb,
|
|
442
|
+
style: { left: `${l}%` }
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
),
|
|
447
|
+
showAlpha && /* @__PURE__ */ jsxRuntime.jsx(
|
|
448
|
+
"div",
|
|
449
|
+
{
|
|
450
|
+
className: ColorPicker_module_default.alphaSlider,
|
|
451
|
+
style: { backgroundImage: alphaGradient },
|
|
452
|
+
onPointerDown: handleAPointerDown,
|
|
453
|
+
onPointerMove: handleAPointerMove,
|
|
454
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
className: ColorPicker_module_default.alphaThumb,
|
|
458
|
+
style: { left: `${a * 100}%` }
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
464
|
+
"div",
|
|
465
|
+
{
|
|
466
|
+
className: ColorPicker_module_default.previewSwatch,
|
|
467
|
+
style: { background: showAlpha ? colorValue.rgba : hexStr },
|
|
468
|
+
children: hasEyeDropper && /* @__PURE__ */ jsxRuntime.jsx("button", { className: ColorPicker_module_default.eyedropperBtn, onClick: handleEyeDropper, title: "Pick color", children: /* @__PURE__ */ jsxRuntime.jsx(EyedropperIcon, {}) })
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorPicker_module_default.inputSection, children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: ColorPicker_module_default.tabs, children: ["hex", "hsl", "rgb"].map((m) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
"button",
|
|
474
|
+
{
|
|
475
|
+
className: [ColorPicker_module_default.tab, mode === m ? ColorPicker_module_default.tabActive : ""].filter(Boolean).join(" "),
|
|
476
|
+
onClick: () => setMode(m),
|
|
477
|
+
children: m.toUpperCase()
|
|
478
|
+
},
|
|
479
|
+
m
|
|
480
|
+
)) }),
|
|
481
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
482
|
+
ColorInput,
|
|
483
|
+
{
|
|
484
|
+
mode,
|
|
485
|
+
h,
|
|
486
|
+
s,
|
|
487
|
+
l,
|
|
488
|
+
r: rr,
|
|
489
|
+
g: gg,
|
|
490
|
+
b: bb,
|
|
491
|
+
hex: hexStr,
|
|
492
|
+
onChange: (nh, ns, nl) => {
|
|
493
|
+
setH(nh);
|
|
494
|
+
setS(ns);
|
|
495
|
+
setL(nl);
|
|
496
|
+
notify(nh, ns, nl, a);
|
|
497
|
+
},
|
|
498
|
+
onCopy: handleCopy,
|
|
499
|
+
copied
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] }),
|
|
503
|
+
recentColors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorPicker_module_default.recents, children: [
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: ColorPicker_module_default.recentsLabel, children: "Recent" }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: ColorPicker_module_default.swatches, children: recentColors.slice(0, 8).map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
+
"button",
|
|
507
|
+
{
|
|
508
|
+
className: ColorPicker_module_default.recentSwatch,
|
|
509
|
+
style: { background: c },
|
|
510
|
+
onClick: () => handleSwatch(c),
|
|
511
|
+
title: c
|
|
512
|
+
},
|
|
513
|
+
i
|
|
514
|
+
)) })
|
|
515
|
+
] })
|
|
516
|
+
]
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
exports.ColorPicker = ColorPicker;
|
|
522
|
+
//# sourceMappingURL=index.cjs.map
|
|
523
|
+
//# sourceMappingURL=index.cjs.map
|