@yoopta/ui 6.0.0-beta.14 → 6.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/element-options/context/element-options-context.d.ts +1 -1
  2. package/dist/element-options.js +5 -18
  3. package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -1
  4. package/dist/floating-toolbar.js +1 -1
  5. package/dist/highlight-color-picker/highlight-color-picker.d.ts +1 -0
  6. package/dist/highlight-color-picker/highlight-color-picker.d.ts.map +1 -1
  7. package/dist/highlight-color-picker/index.d.ts +0 -1
  8. package/dist/highlight-color-picker/index.d.ts.map +1 -1
  9. package/dist/highlight-color-picker.js +1 -1
  10. package/dist/index.js +1 -1
  11. package/package.json +3 -4
  12. package/dist/action-menu-list.js.map +0 -1
  13. package/dist/block-dnd.js.map +0 -1
  14. package/dist/block-options.js.map +0 -1
  15. package/dist/chunks/_tslib-8f8de673.js +0 -36
  16. package/dist/chunks/_tslib-8f8de673.js.map +0 -1
  17. package/dist/chunks/floating-ui.react-727e4287.js +0 -5
  18. package/dist/chunks/floating-ui.react-d2303b03.js +0 -4506
  19. package/dist/chunks/floating-ui.react-d2303b03.js.map +0 -1
  20. package/dist/chunks/floating-ui.react-feaab622.js +0 -4506
  21. package/dist/chunks/floating-ui.react-feaab622.js.map +0 -1
  22. package/dist/chunks/highlight-color-picker-027fa4b4.js +0 -93
  23. package/dist/chunks/highlight-color-picker-027fa4b4.js.map +0 -1
  24. package/dist/chunks/highlight-color-picker-a1a292a9.js +0 -1
  25. package/dist/chunks/highlight-color-picker-a979e7a3.js +0 -93
  26. package/dist/chunks/highlight-color-picker-a979e7a3.js.map +0 -1
  27. package/dist/chunks/highlight-color-picker-ce0b19ac.js +0 -1
  28. package/dist/chunks/index-bfd2e7c4.js +0 -6
  29. package/dist/chunks/index-bfd2e7c4.js.map +0 -1
  30. package/dist/chunks/style-inject.es-746bb8ed.js +0 -29
  31. package/dist/chunks/style-inject.es-746bb8ed.js.map +0 -1
  32. package/dist/chunks/throttle-278836f4.js +0 -45
  33. package/dist/chunks/throttle-278836f4.js.map +0 -1
  34. package/dist/element-options.js.map +0 -1
  35. package/dist/floating-block-actions.js.map +0 -1
  36. package/dist/floating-toolbar.js.map +0 -1
  37. package/dist/highlight-color-picker.js.map +0 -1
  38. package/dist/index.js.map +0 -1
  39. package/dist/overlay.js.map +0 -1
  40. package/dist/portal.js.map +0 -1
  41. package/dist/selection-box.js.map +0 -1
  42. package/dist/slash-command-menu.js.map +0 -1
@@ -1,93 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useEffect, cloneElement } from 'react';
3
- import { u as useFloating, o as offset, f as flip, s as shift, a as autoUpdate } from './floating-ui.react-d2303b03.js';
4
- import { Z, O as Oe } from './index-bfd2e7c4.js';
5
-
6
- const DEFAULT_PRESETS = [
7
- '#FFFF00',
8
- '#FFE066',
9
- '#FFCC99',
10
- '#FF9999',
11
- '#99CCFF',
12
- '#99FF99',
13
- '#FF99FF',
14
- '#CC99FF',
15
- ];
16
- const HighlightColorPicker = forwardRef(({ value = { backgroundColor: '#FFFF00' }, onChange, presets = DEFAULT_PRESETS, showInput = true, className, children, placement = 'bottom', offset: offsetValue = 8, }, ref) => {
17
- const [isOpen, setIsOpen] = useState(false);
18
- const [mode, setMode] = useState('backgroundColor');
19
- const [color, setColor] = useState(value.backgroundColor);
20
- const [textColor, setTextColor] = useState(value.color);
21
- const { refs, floatingStyles } = useFloating({
22
- open: isOpen,
23
- onOpenChange: setIsOpen,
24
- placement,
25
- middleware: [offset(offsetValue), flip(), shift()],
26
- whileElementsMounted: autoUpdate,
27
- });
28
- useEffect(() => {
29
- if (value.backgroundColor) {
30
- setColor(value.backgroundColor);
31
- }
32
- if (value.color) {
33
- setTextColor(value.color);
34
- }
35
- }, [value]);
36
- // Close on outside click
37
- useEffect(() => {
38
- if (!isOpen)
39
- return;
40
- const handleClickOutside = (event) => {
41
- const target = event.target;
42
- const referenceEl = refs.reference.current;
43
- const floatingEl = refs.floating.current;
44
- // `referenceEl` may be a VirtualElement (no `contains`)
45
- if (referenceEl && referenceEl instanceof Element && referenceEl.contains(target))
46
- return;
47
- if (floatingEl === null || floatingEl === void 0 ? void 0 : floatingEl.contains(target))
48
- return;
49
- setIsOpen(false);
50
- };
51
- document.addEventListener('mousedown', handleClickOutside);
52
- return () => document.removeEventListener('mousedown', handleClickOutside);
53
- }, [isOpen, refs.floating, refs.reference]);
54
- const handleColorChange = (newColor) => {
55
- if (mode === 'backgroundColor') {
56
- setColor(newColor);
57
- onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign(Object.assign({}, value), { backgroundColor: newColor }));
58
- }
59
- else {
60
- setTextColor(newColor);
61
- onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign(Object.assign({}, value), { color: newColor }));
62
- }
63
- };
64
- const currentColor = mode === 'backgroundColor' ? color : textColor;
65
- const trigger = cloneElement(children, {
66
- ref: refs.setReference,
67
- onClick: (e) => {
68
- var _a, _b;
69
- e.stopPropagation();
70
- setIsOpen((v) => !v);
71
- (_b = (_a = children.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
72
- },
73
- });
74
- const setFloatingRef = (node) => {
75
- refs.setFloating(node);
76
- if (!ref)
77
- return;
78
- if (typeof ref === 'function')
79
- ref(node);
80
- else {
81
- // eslint-disable-next-line no-param-reassign
82
- ref.current = node;
83
- }
84
- };
85
- return (jsxs(Fragment, { children: [trigger, isOpen && (jsxs("div", Object.assign({ ref: setFloatingRef, style: floatingStyles, className: `yoopta-highlight-color-picker ${className !== null && className !== void 0 ? className : ''}`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation() }, { children: [jsxs("div", Object.assign({ className: "yoopta-highlight-color-picker__mode-toggle" }, { children: [jsx("button", Object.assign({ type: "button", className: "yoopta-highlight-color-picker__mode-btn", "data-active": mode === 'backgroundColor', onClick: () => setMode('backgroundColor'), "aria-label": "Background color" }, { children: "Background" })), jsx("button", Object.assign({ type: "button", className: "yoopta-highlight-color-picker__mode-btn", "data-active": mode === 'color', onClick: () => setMode('color'), "aria-label": "Text color" }, { children: "Text" }))] })), jsx("div", Object.assign({ className: "yoopta-highlight-color-picker__picker" }, { children: jsx(Z, { color: currentColor, onChange: handleColorChange, className: "yoopta-highlight-color-picker__react-colorful" }) })), presets.length > 0 && (jsx("div", Object.assign({ className: "yoopta-highlight-color-picker__presets" }, { children: presets.map((presetColor) => {
86
- const isSelected = (currentColor === null || currentColor === void 0 ? void 0 : currentColor.toLowerCase()) === presetColor.toLowerCase();
87
- return (jsx("button", { type: "button", className: "yoopta-highlight-color-picker__preset", "data-selected": isSelected, style: { backgroundColor: presetColor }, onClick: () => handleColorChange(presetColor), "aria-label": `Select color ${presetColor}` }, presetColor));
88
- }) }))), showInput && (jsxs("div", Object.assign({ className: "yoopta-highlight-color-picker__hex-row" }, { children: [jsx("div", { className: "yoopta-highlight-color-picker__swatch", style: { backgroundColor: currentColor } }), jsx(Oe, { color: currentColor, onChange: handleColorChange, className: "yoopta-highlight-color-picker__hex-input", prefixed: true })] })))] })))] }));
89
- });
90
- HighlightColorPicker.displayName = 'HighlightColorPicker';
91
-
92
- export { HighlightColorPicker as H };
93
- //# sourceMappingURL=highlight-color-picker-027fa4b4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"highlight-color-picker-027fa4b4.js","sources":["../../src/highlight-color-picker/highlight-color-picker.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { cloneElement, forwardRef, useEffect, useState } from 'react';\nimport { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/react';\nimport { HexColorInput, HexColorPicker } from 'react-colorful';\n\nexport type HighlightColorPickerProps = {\n /** Current color values (hex format) */\n value?: {\n color?: string;\n backgroundColor?: string;\n };\n /** Callback when color changes */\n onChange?: (values: { color?: string; backgroundColor?: string }) => void;\n /** Preset colors to display */\n presets?: string[];\n /** Show hex input field */\n showInput?: boolean;\n /** Custom className */\n className?: string;\n /** Trigger element */\n children: ReactElement;\n /** Placement of the popover */\n placement?: 'top' | 'bottom' | 'left' | 'right';\n /** Offset from trigger */\n offset?: number;\n};\n\nconst DEFAULT_PRESETS = [\n '#FFFF00',\n '#FFE066',\n '#FFCC99',\n '#FF9999',\n '#99CCFF',\n '#99FF99',\n '#FF99FF',\n '#CC99FF',\n];\n\nexport const HighlightColorPicker = forwardRef<HTMLDivElement, HighlightColorPickerProps>(\n (\n {\n value = { backgroundColor: '#FFFF00' },\n onChange,\n presets = DEFAULT_PRESETS,\n showInput = true,\n className,\n children,\n placement = 'bottom',\n offset: offsetValue = 8,\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const [mode, setMode] = useState<'color' | 'backgroundColor'>('backgroundColor');\n const [color, setColor] = useState(value.backgroundColor);\n const [textColor, setTextColor] = useState(value.color);\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n placement,\n middleware: [offset(offsetValue), flip(), shift()],\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (value.backgroundColor) {\n setColor(value.backgroundColor);\n }\n if (value.color) {\n setTextColor(value.color);\n }\n }, [value]);\n\n // Close on outside click\n useEffect(() => {\n if (!isOpen) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n const referenceEl = refs.reference.current;\n const floatingEl = refs.floating.current;\n\n // `referenceEl` may be a VirtualElement (no `contains`)\n if (referenceEl && referenceEl instanceof Element && referenceEl.contains(target)) return;\n if (floatingEl?.contains(target)) return;\n\n setIsOpen(false);\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, refs.floating, refs.reference]);\n\n const handleColorChange = (newColor: string) => {\n if (mode === 'backgroundColor') {\n setColor(newColor);\n onChange?.({ ...value, backgroundColor: newColor });\n } else {\n setTextColor(newColor);\n onChange?.({ ...value, color: newColor });\n }\n };\n\n const currentColor = mode === 'backgroundColor' ? color : textColor;\n\n const trigger = cloneElement(children, {\n ref: refs.setReference,\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n setIsOpen((v) => !v);\n children.props.onClick?.(e);\n },\n });\n\n const setFloatingRef = (node: HTMLDivElement | null) => {\n refs.setFloating(node);\n if (!ref) return;\n if (typeof ref === 'function') ref(node);\n else {\n // eslint-disable-next-line no-param-reassign\n ref.current = node;\n }\n };\n\n return (\n <>\n {trigger}\n {isOpen && (\n <div\n ref={setFloatingRef}\n style={floatingStyles}\n className={`yoopta-highlight-color-picker ${className ?? ''}`}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}>\n {/* Mode Toggle */}\n <div className=\"yoopta-highlight-color-picker__mode-toggle\">\n <button\n type=\"button\"\n className=\"yoopta-highlight-color-picker__mode-btn\"\n data-active={mode === 'backgroundColor'}\n onClick={() => setMode('backgroundColor')}\n aria-label=\"Background color\">\n Background\n </button>\n <button\n type=\"button\"\n className=\"yoopta-highlight-color-picker__mode-btn\"\n data-active={mode === 'color'}\n onClick={() => setMode('color')}\n aria-label=\"Text color\">\n Text\n </button>\n </div>\n\n <div className=\"yoopta-highlight-color-picker__picker\">\n <HexColorPicker\n color={currentColor}\n onChange={handleColorChange}\n className=\"yoopta-highlight-color-picker__react-colorful\"\n />\n </div>\n\n {presets.length > 0 && (\n <div className=\"yoopta-highlight-color-picker__presets\">\n {presets.map((presetColor) => {\n const isSelected = currentColor?.toLowerCase() === presetColor.toLowerCase();\n return (\n <button\n key={presetColor}\n type=\"button\"\n className=\"yoopta-highlight-color-picker__preset\"\n data-selected={isSelected}\n style={{ backgroundColor: presetColor }}\n onClick={() => handleColorChange(presetColor)}\n aria-label={`Select color ${presetColor}`}\n />\n );\n })}\n </div>\n )}\n\n {showInput && (\n <div className=\"yoopta-highlight-color-picker__hex-row\">\n <div\n className=\"yoopta-highlight-color-picker__swatch\"\n style={{ backgroundColor: currentColor }}\n />\n <HexColorInput\n color={currentColor}\n onChange={handleColorChange}\n className=\"yoopta-highlight-color-picker__hex-input\"\n prefixed\n />\n </div>\n )}\n </div>\n )}\n </>\n );\n },\n);\n\nHighlightColorPicker.displayName = 'HighlightColorPicker';\n\n"],"names":["_jsxs","_Fragment","_jsx","HexColorPicker","HexColorInput"],"mappings":";;;;;AA2BA,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEW,MAAA,oBAAoB,GAAG,UAAU,CAC5C,CACE,EACE,KAAK,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EACtC,QAAQ,EACR,OAAO,GAAG,eAAe,EACzB,SAAS,GAAG,IAAI,EAChB,SAAS,EACT,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,MAAM,EAAE,WAAW,GAAG,CAAC,GACxB,EACD,GAAG,KACD;IACF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAA8B,iBAAiB,CAAC,CAAC;AACjF,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAC1D,IAAA,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAExD,IAAA,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,WAAW,CAAC;AAC3C,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,YAAY,EAAE,SAAS;QACvB,SAAS;AACT,QAAA,UAAU,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC;AAClD,QAAA,oBAAoB,EAAE,UAAU;AACjC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AA,CAAA,CACP,CACA,EAAA,CAAA,EACH;AACJ,CAAC,EACD;AAEF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;;;"}
@@ -1 +0,0 @@
1
- import{jsxs as o,Fragment as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useEffect as c,cloneElement as l}from"react";import{u as n,o as i,f as s,s as g,a as h}from"./floating-ui.react-b048728e.js";import{Z as p,O as d}from"./index-e0185864.js";const u=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],m=r(({value:r={backgroundColor:"#FFFF00"},onChange:m,presets:b=u,showInput:k=!0,className:C,children:F,placement:f="bottom",offset:y=8},_)=>{const[v,j]=a(!1),[N,O]=a("backgroundColor"),[w,x]=a(r.backgroundColor),[E,L]=a(r.color),{refs:P,floatingStyles:B}=n({open:v,onOpenChange:j,placement:f,middleware:[i(y),s(),g()],whileElementsMounted:h});c(()=>{r.backgroundColor&&x(r.backgroundColor),r.color&&L(r.color)},[r]),c(()=>{if(!v)return;const o=o=>{const e=o.target,t=P.reference.current,r=P.floating.current;t&&t instanceof Element&&t.contains(e)||(null==r?void 0:r.contains(e))||j(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[v,P.floating,P.reference]);const H=o=>{"backgroundColor"===N?(x(o),null==m||m(Object.assign(Object.assign({},r),{backgroundColor:o}))):(L(o),null==m||m(Object.assign(Object.assign({},r),{color:o})))},M="backgroundColor"===N?w:E,S=l(F,{ref:P.setReference,onClick:o=>{var e,t;o.stopPropagation(),j(o=>!o),null===(t=(e=F.props).onClick)||void 0===t||t.call(e,o)}});return o(e,{children:[S,v&&o("div",Object.assign({ref:o=>{P.setFloating(o),_&&("function"==typeof _?_(o):_.current=o)},style:B,className:`yoopta-highlight-color-picker ${null!=C?C:""}`,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},{children:[o("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===N,onClick:()=>O("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===N,onClick:()=>O("color"),"aria-label":"Text color"},{children:"Text"}))]})),t("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:t(p,{color:M,onChange:H,className:"yoopta-highlight-color-picker__react-colorful"})})),b.length>0&&t("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:b.map(o=>{const e=(null==M?void 0:M.toLowerCase())===o.toLowerCase();return t("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":e,style:{backgroundColor:o},onClick:()=>H(o),"aria-label":`Select color ${o}`},o)})})),k&&o("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[t("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:M}}),t(d,{color:M,onChange:H,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});m.displayName="HighlightColorPicker";export{m as H};
@@ -1,93 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useEffect, cloneElement } from 'react';
3
- import { u as useFloating, o as offset, f as flip, s as shift, a as autoUpdate } from './floating-ui.react-feaab622.js';
4
- import { Z, O as Oe } from './index-bfd2e7c4.js';
5
-
6
- const DEFAULT_PRESETS = [
7
- '#FFFF00',
8
- '#FFE066',
9
- '#FFCC99',
10
- '#FF9999',
11
- '#99CCFF',
12
- '#99FF99',
13
- '#FF99FF',
14
- '#CC99FF',
15
- ];
16
- const HighlightColorPicker = forwardRef(({ value = { backgroundColor: '#FFFF00' }, onChange, presets = DEFAULT_PRESETS, showInput = true, className, children, placement = 'bottom', offset: offsetValue = 8, }, ref) => {
17
- const [isOpen, setIsOpen] = useState(false);
18
- const [mode, setMode] = useState('backgroundColor');
19
- const [color, setColor] = useState(value.backgroundColor);
20
- const [textColor, setTextColor] = useState(value.color);
21
- const { refs, floatingStyles } = useFloating({
22
- open: isOpen,
23
- onOpenChange: setIsOpen,
24
- placement,
25
- middleware: [offset(offsetValue), flip(), shift()],
26
- whileElementsMounted: autoUpdate,
27
- });
28
- useEffect(() => {
29
- if (value.backgroundColor) {
30
- setColor(value.backgroundColor);
31
- }
32
- if (value.color) {
33
- setTextColor(value.color);
34
- }
35
- }, [value]);
36
- // Close on outside click
37
- useEffect(() => {
38
- if (!isOpen)
39
- return;
40
- const handleClickOutside = (event) => {
41
- const target = event.target;
42
- const referenceEl = refs.reference.current;
43
- const floatingEl = refs.floating.current;
44
- // `referenceEl` may be a VirtualElement (no `contains`)
45
- if (referenceEl && referenceEl instanceof Element && referenceEl.contains(target))
46
- return;
47
- if (floatingEl === null || floatingEl === void 0 ? void 0 : floatingEl.contains(target))
48
- return;
49
- setIsOpen(false);
50
- };
51
- document.addEventListener('mousedown', handleClickOutside);
52
- return () => document.removeEventListener('mousedown', handleClickOutside);
53
- }, [isOpen, refs.floating, refs.reference]);
54
- const handleColorChange = (newColor) => {
55
- if (mode === 'backgroundColor') {
56
- setColor(newColor);
57
- onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign(Object.assign({}, value), { backgroundColor: newColor }));
58
- }
59
- else {
60
- setTextColor(newColor);
61
- onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign(Object.assign({}, value), { color: newColor }));
62
- }
63
- };
64
- const currentColor = mode === 'backgroundColor' ? color : textColor;
65
- const trigger = cloneElement(children, {
66
- ref: refs.setReference,
67
- onClick: (e) => {
68
- var _a, _b;
69
- e.stopPropagation();
70
- setIsOpen((v) => !v);
71
- (_b = (_a = children.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
72
- },
73
- });
74
- const setFloatingRef = (node) => {
75
- refs.setFloating(node);
76
- if (!ref)
77
- return;
78
- if (typeof ref === 'function')
79
- ref(node);
80
- else {
81
- // eslint-disable-next-line no-param-reassign
82
- ref.current = node;
83
- }
84
- };
85
- return (jsxs(Fragment, { children: [trigger, isOpen && (jsxs("div", Object.assign({ ref: setFloatingRef, style: floatingStyles, className: `yoopta-highlight-color-picker ${className !== null && className !== void 0 ? className : ''}`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation() }, { children: [jsxs("div", Object.assign({ className: "yoopta-highlight-color-picker__mode-toggle" }, { children: [jsx("button", Object.assign({ type: "button", className: "yoopta-highlight-color-picker__mode-btn", "data-active": mode === 'backgroundColor', onClick: () => setMode('backgroundColor'), "aria-label": "Background color" }, { children: "Background" })), jsx("button", Object.assign({ type: "button", className: "yoopta-highlight-color-picker__mode-btn", "data-active": mode === 'color', onClick: () => setMode('color'), "aria-label": "Text color" }, { children: "Text" }))] })), jsx("div", Object.assign({ className: "yoopta-highlight-color-picker__picker" }, { children: jsx(Z, { color: currentColor, onChange: handleColorChange, className: "yoopta-highlight-color-picker__react-colorful" }) })), presets.length > 0 && (jsx("div", Object.assign({ className: "yoopta-highlight-color-picker__presets" }, { children: presets.map((presetColor) => {
86
- const isSelected = (currentColor === null || currentColor === void 0 ? void 0 : currentColor.toLowerCase()) === presetColor.toLowerCase();
87
- return (jsx("button", { type: "button", className: "yoopta-highlight-color-picker__preset", "data-selected": isSelected, style: { backgroundColor: presetColor }, onClick: () => handleColorChange(presetColor), "aria-label": `Select color ${presetColor}` }, presetColor));
88
- }) }))), showInput && (jsxs("div", Object.assign({ className: "yoopta-highlight-color-picker__hex-row" }, { children: [jsx("div", { className: "yoopta-highlight-color-picker__swatch", style: { backgroundColor: currentColor } }), jsx(Oe, { color: currentColor, onChange: handleColorChange, className: "yoopta-highlight-color-picker__hex-input", prefixed: true })] })))] })))] }));
89
- });
90
- HighlightColorPicker.displayName = 'HighlightColorPicker';
91
-
92
- export { HighlightColorPicker as H };
93
- //# sourceMappingURL=highlight-color-picker-a979e7a3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"highlight-color-picker-a979e7a3.js","sources":["../../src/highlight-color-picker/highlight-color-picker.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { cloneElement, forwardRef, useEffect, useState } from 'react';\nimport { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/react';\nimport { HexColorInput, HexColorPicker } from 'react-colorful';\n\nexport type HighlightColorPickerProps = {\n /** Current color values (hex format) */\n value?: {\n color?: string;\n backgroundColor?: string;\n };\n /** Callback when color changes */\n onChange?: (values: { color?: string; backgroundColor?: string }) => void;\n /** Preset colors to display */\n presets?: string[];\n /** Show hex input field */\n showInput?: boolean;\n /** Custom className */\n className?: string;\n /** Trigger element */\n children: ReactElement;\n /** Placement of the popover */\n placement?: 'top' | 'bottom' | 'left' | 'right';\n /** Offset from trigger */\n offset?: number;\n};\n\nconst DEFAULT_PRESETS = [\n '#FFFF00',\n '#FFE066',\n '#FFCC99',\n '#FF9999',\n '#99CCFF',\n '#99FF99',\n '#FF99FF',\n '#CC99FF',\n];\n\nexport const HighlightColorPicker = forwardRef<HTMLDivElement, HighlightColorPickerProps>(\n (\n {\n value = { backgroundColor: '#FFFF00' },\n onChange,\n presets = DEFAULT_PRESETS,\n showInput = true,\n className,\n children,\n placement = 'bottom',\n offset: offsetValue = 8,\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const [mode, setMode] = useState<'color' | 'backgroundColor'>('backgroundColor');\n const [color, setColor] = useState(value.backgroundColor);\n const [textColor, setTextColor] = useState(value.color);\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n placement,\n middleware: [offset(offsetValue), flip(), shift()],\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (value.backgroundColor) {\n setColor(value.backgroundColor);\n }\n if (value.color) {\n setTextColor(value.color);\n }\n }, [value]);\n\n // Close on outside click\n useEffect(() => {\n if (!isOpen) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n const referenceEl = refs.reference.current;\n const floatingEl = refs.floating.current;\n\n // `referenceEl` may be a VirtualElement (no `contains`)\n if (referenceEl && referenceEl instanceof Element && referenceEl.contains(target)) return;\n if (floatingEl?.contains(target)) return;\n\n setIsOpen(false);\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, refs.floating, refs.reference]);\n\n const handleColorChange = (newColor: string) => {\n if (mode === 'backgroundColor') {\n setColor(newColor);\n onChange?.({ ...value, backgroundColor: newColor });\n } else {\n setTextColor(newColor);\n onChange?.({ ...value, color: newColor });\n }\n };\n\n const currentColor = mode === 'backgroundColor' ? color : textColor;\n\n const trigger = cloneElement(children, {\n ref: refs.setReference,\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n setIsOpen((v) => !v);\n children.props.onClick?.(e);\n },\n });\n\n const setFloatingRef = (node: HTMLDivElement | null) => {\n refs.setFloating(node);\n if (!ref) return;\n if (typeof ref === 'function') ref(node);\n else {\n // eslint-disable-next-line no-param-reassign\n ref.current = node;\n }\n };\n\n return (\n <>\n {trigger}\n {isOpen && (\n <div\n ref={setFloatingRef}\n style={floatingStyles}\n className={`yoopta-highlight-color-picker ${className ?? ''}`}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}>\n {/* Mode Toggle */}\n <div className=\"yoopta-highlight-color-picker__mode-toggle\">\n <button\n type=\"button\"\n className=\"yoopta-highlight-color-picker__mode-btn\"\n data-active={mode === 'backgroundColor'}\n onClick={() => setMode('backgroundColor')}\n aria-label=\"Background color\">\n Background\n </button>\n <button\n type=\"button\"\n className=\"yoopta-highlight-color-picker__mode-btn\"\n data-active={mode === 'color'}\n onClick={() => setMode('color')}\n aria-label=\"Text color\">\n Text\n </button>\n </div>\n\n <div className=\"yoopta-highlight-color-picker__picker\">\n <HexColorPicker\n color={currentColor}\n onChange={handleColorChange}\n className=\"yoopta-highlight-color-picker__react-colorful\"\n />\n </div>\n\n {presets.length > 0 && (\n <div className=\"yoopta-highlight-color-picker__presets\">\n {presets.map((presetColor) => {\n const isSelected = currentColor?.toLowerCase() === presetColor.toLowerCase();\n return (\n <button\n key={presetColor}\n type=\"button\"\n className=\"yoopta-highlight-color-picker__preset\"\n data-selected={isSelected}\n style={{ backgroundColor: presetColor }}\n onClick={() => handleColorChange(presetColor)}\n aria-label={`Select color ${presetColor}`}\n />\n );\n })}\n </div>\n )}\n\n {showInput && (\n <div className=\"yoopta-highlight-color-picker__hex-row\">\n <div\n className=\"yoopta-highlight-color-picker__swatch\"\n style={{ backgroundColor: currentColor }}\n />\n <HexColorInput\n color={currentColor}\n onChange={handleColorChange}\n className=\"yoopta-highlight-color-picker__hex-input\"\n prefixed\n />\n </div>\n )}\n </div>\n )}\n </>\n );\n },\n);\n\nHighlightColorPicker.displayName = 'HighlightColorPicker';\n\n"],"names":["_jsxs","_Fragment","_jsx","HexColorPicker","HexColorInput"],"mappings":";;;;;AA2BA,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEW,MAAA,oBAAoB,GAAG,UAAU,CAC5C,CACE,EACE,KAAK,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EACtC,QAAQ,EACR,OAAO,GAAG,eAAe,EACzB,SAAS,GAAG,IAAI,EAChB,SAAS,EACT,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,MAAM,EAAE,WAAW,GAAG,CAAC,GACxB,EACD,GAAG,KACD;IACF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAA8B,iBAAiB,CAAC,CAAC;AACjF,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAC1D,IAAA,MAAM,CAAC,SAAS,EA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MAAA,CAAA,EAAA,SAAS,EAAC,wCAAwC,iBACrDE,GACE,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,uCAAuC,EACjD,KAAK,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,GACxC,EACFA,GAAA,CAACE,EAAa,EACZ,EAAA,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAC,0CAA0C,EACpD,QAAQ,EACR,IAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CACE,CACP,CACG,EAAA,CAAA,CAAA,CACP,CACA,EAAA,CAAA,EACH;AACJ,CAAC,EACD;AAEF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;;;"}
@@ -1 +0,0 @@
1
- import{jsxs as o,Fragment as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useEffect as c,cloneElement as l}from"react";import{u as n,o as i,f as s,s as g,a as h}from"./floating-ui.react-727e4287.js";import{Z as p,O as d}from"./index-e0185864.js";const u=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],m=r(({value:r={backgroundColor:"#FFFF00"},onChange:m,presets:b=u,showInput:k=!0,className:C,children:F,placement:f="bottom",offset:y=8},_)=>{const[v,j]=a(!1),[N,O]=a("backgroundColor"),[w,x]=a(r.backgroundColor),[E,L]=a(r.color),{refs:P,floatingStyles:B}=n({open:v,onOpenChange:j,placement:f,middleware:[i(y),s(),g()],whileElementsMounted:h});c(()=>{r.backgroundColor&&x(r.backgroundColor),r.color&&L(r.color)},[r]),c(()=>{if(!v)return;const o=o=>{const e=o.target,t=P.reference.current,r=P.floating.current;t&&t instanceof Element&&t.contains(e)||(null==r?void 0:r.contains(e))||j(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[v,P.floating,P.reference]);const H=o=>{"backgroundColor"===N?(x(o),null==m||m(Object.assign(Object.assign({},r),{backgroundColor:o}))):(L(o),null==m||m(Object.assign(Object.assign({},r),{color:o})))},M="backgroundColor"===N?w:E,S=l(F,{ref:P.setReference,onClick:o=>{var e,t;o.stopPropagation(),j(o=>!o),null===(t=(e=F.props).onClick)||void 0===t||t.call(e,o)}});return o(e,{children:[S,v&&o("div",Object.assign({ref:o=>{P.setFloating(o),_&&("function"==typeof _?_(o):_.current=o)},style:B,className:`yoopta-highlight-color-picker ${null!=C?C:""}`,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},{children:[o("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===N,onClick:()=>O("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===N,onClick:()=>O("color"),"aria-label":"Text color"},{children:"Text"}))]})),t("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:t(p,{color:M,onChange:H,className:"yoopta-highlight-color-picker__react-colorful"})})),b.length>0&&t("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:b.map(o=>{const e=(null==M?void 0:M.toLowerCase())===o.toLowerCase();return t("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":e,style:{backgroundColor:o},onClick:()=>H(o),"aria-label":`Select color ${o}`},o)})})),k&&o("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[t("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:M}}),t(d,{color:M,onChange:H,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});m.displayName="HighlightColorPicker";export{m as H};
@@ -1,6 +0,0 @@
1
- import React__default, { useRef, useMemo, useEffect, useCallback, useState, useLayoutEffect } from 'react';
2
-
3
- function u(){return (u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);}return e}).apply(this,arguments)}function c(e,r){if(null==e)return {};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function i(e){var t=useRef(e),n=useRef(function(e){t.current&&t.current(e);});return t.current=e,n.current}var s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},f=function(e){return "touches"in e},v=function(e){return e&&e.ownerDocument.defaultView||self},d=function(e,r,t){var n=e.getBoundingClientRect(),o=f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return {left:s((o.pageX-(n.left+v(e).pageXOffset))/n.width),top:s((o.pageY-(n.top+v(e).pageYOffset))/n.height)}},h=function(e){!f(e)&&e.preventDefault();},m=React__default.memo(function(o){var a=o.onMove,l=o.onKey,s=c(o,["onMove","onKey"]),m=useRef(null),g=i(a),p=i(l),b=useRef(null),_=useRef(!1),x=useMemo(function(){var e=function(e){h(e),(f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(d(m.current,e,b.current)):t(!1);},r=function(){return t(!1)};function t(t){var n=_.current,o=v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r);}return [function(e){var r=e.nativeEvent,n=m.current;if(n&&(h(r),!function(e,r){return r&&!f(e)}(r,_.current)&&n)){if(f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier);}n.focus(),g(d(n,r,b.current)),t(!0);}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}));},t]},[p,g]),C=x[0],E=x[1],H=x[2];return useEffect(function(){return H},[H]),React__default.createElement("div",u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),g=function(e){return e.filter(Boolean).join(" ")},p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=g(["react-colorful__pointer",r.className]);return React__default.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},React__default.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},x=function(e){return L(C(e))},C=function(e){return "#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?b(parseInt(e.substring(6,8),16)/255,2):1}},w=function(e){return K(I(e))},y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return {h:b(e.h),s:b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:b(o/2),a:b(n,2)}},q=function(e){var r=y(e);return "hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return {r:b(255*[n,u,l,l,c,n][i]),g:b(255*[c,n,n,u,l,l][i]),b:b(255*[l,l,c,n,n,u][i]),a:b(o,2)}},D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(b(255*o)):"";return "#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return {h:b(60*(u<0?u+6:u)),s:b(a?l/a*100:0),v:b(a/255*100),a:o}},S=React__default.memo(function(r){var t=r.hue,n=r.onChange,o=g(["react-colorful__hue",r.className]);return React__default.createElement("div",{className:o},React__default.createElement(m,{onMove:function(e){n({h:360*e.left});},onKey:function(e){n({h:s(t+360*e.left,0,360)});},"aria-label":"Hue","aria-valuenow":b(t),"aria-valuemax":"360","aria-valuemin":"0"},React__default.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=React__default.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return React__default.createElement("div",{className:"react-colorful__saturation",style:o},React__default.createElement(m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top});},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)});},"aria-label":"Color","aria-valuetext":"Saturation "+b(t.s)+"%, Brightness "+b(t.v)+"%"},React__default.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return !0;for(var t in e)if(e[t]!==r[t])return !1;return !0},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=i(l),c=useState(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=useRef({color:t,hsva:s});useEffect(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r);}},[t,e]),useEffect(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r));},[s,e,u]);var d=useCallback(function(e){f(function(r){return Object.assign({},r,e)});},[]);return [s,d]}var V="undefined"!=typeof window?useLayoutEffect:useEffect,$=function(){return ("undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0)},J=new Map,Q=function(e){V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=$();n&&t.setAttribute("nonce",n),r.head.appendChild(t);}},[]);},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=c(t,["className","colorModel","color","onChange"]),f=useRef(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=g(["react-colorful",n]);return React__default.createElement("div",u({},s,{ref:f,className:m}),React__default.createElement(T,{hsva:d,onChange:h}),React__default.createElement(S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:x,fromHsva:function(e){return w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return React__default.createElement(U,u({},r,{colorModel:W}))},qe=/^#?([0-9A-F]{3,8})$/i,ke=function(r){var t=r.color,l=void 0===t?"":t,s=r.onChange,f=r.onBlur,v=r.escape,d=r.validate,h=r.format,m=r.process,g=c(r,["color","onChange","onBlur","escape","validate","format","process"]),p=useState(function(){return v(l)}),b=p[0],_=p[1],x=i(s),C=i(f),E=useCallback(function(e){var r=v(e.target.value);_(r),d(r)&&x(m?m(r):r);},[v,m,d,x]),H=useCallback(function(e){d(e.target.value)||_(v(l)),C(e);},[l,v,d,C]);return useEffect(function(){_(v(l));},[l,v]),React__default.createElement("input",u({},g,{value:h?h(b):b,spellCheck:"false",onChange:E,onBlur:H}))},Ie=function(e){return "#"+e},Oe=function(r){var t=r.prefixed,n=r.alpha,o=c(r,["prefixed","alpha"]),l=useCallback(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),i=useCallback(function(e){return function(e,r){var t=qe.exec(e),n=t?t[1].length:0;return 3===n||6===n||!!r&&4===n||!!r&&8===n}(e,n)},[n]);return React__default.createElement(ke,u({},o,{escape:l,format:t?Ie:void 0,process:Ie,validate:i}))};
4
-
5
- export { Oe as O, Z };
6
- //# sourceMappingURL=index-bfd2e7c4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-bfd2e7c4.js","sources":["../../../../../node_modules/react-colorful/src/hooks/useEventCallback.ts","../../../../../node_modules/react-colorful/src/utils/clamp.ts","../../../../../node_modules/react-colorful/src/components/common/Interactive.tsx","../../../../../node_modules/react-colorful/src/utils/format.ts","../../../../../node_modules/react-colorful/src/components/common/Pointer.tsx","../../../../../node_modules/react-colorful/src/utils/round.ts","../../../../../node_modules/react-colorful/src/utils/convert.ts","../../../../../node_modules/react-colorful/src/components/common/Hue.tsx","../../../../../node_modules/react-colorful/src/components/common/Saturation.tsx","../../../../../node_modules/react-colorful/src/utils/compare.ts","../../../../../node_modules/react-colorful/src/hooks/useColorManipulation.ts","../../../../../node_modules/react-colorful/src/hooks/useIsomorphicLayoutEffect.ts","../../../../../node_modules/react-colorful/src/utils/nonce.ts","../../../../../node_modules/react-colorful/src/hooks/useStyleSheet.ts","../../../../../node_modules/react-colorful/src/components/common/ColorPicker.tsx","../../../../../node_modules/react-colorful/src/components/HexColorPicker.tsx","../../../../../node_modules/react-colorful/src/components/common/Alpha.tsx","../../../../../node_modules/react-colorful/src/utils/validate.ts","../../../../../node_modules/react-colorful/src/components/common/ColorInput.tsx","../../../../../node_modules/react-colorful/src/components/HexColorInput.tsx"],"sourcesContent":["import { useRef } from \"react\";\n\n// Saves incoming handler to the ref in order to avoid \"useCallback hell\"\nexport function useEventCallback<T>(handler?: (value: T) => void): (value: T) => void {\n const callbackRef = useRef(handler);\n const fn = useRef((value: T) => {\n callbackRef.current && callbackRef.current(value);\n });\n callbackRef.current = handler;\n\n return fn.current;\n}\n","// Clamps a value between an upper and lower bound.\n// We use ternary operators because it makes the minified code\n// 2 times shorter then `Math.min(Math.max(a,b),c)`\nexport const clamp = (number: number, min = 0, max = 1): number => {\n return number > max ? max : number < min ? min : number;\n};\n","import React, { useRef, useMemo, useEffect } from \"react\";\n\nimport { useEventCallback } from \"../../hooks/useEventCallback\";\nimport { clamp } from \"../../utils/clamp\";\n\nexport interface Interaction {\n left: number;\n top: number;\n}\n\n// Check if an event was triggered by touch\nconst isTouch = (event: MouseEvent | TouchEvent): event is TouchEvent => \"touches\" in event;\n\n// Finds a proper touch point by its identifier\nconst getTouchPoint = (touches: TouchList, touchId: null | number): Touch => {\n for (let i = 0; i < touches.length; i++) {\n if (touches[i].identifier === touchId) return touches[i];\n }\n return touches[0];\n};\n\n// Finds the proper window object to fix iframe embedding issues\nconst getParentWindow = (node?: HTMLDivElement | null): Window => {\n return (node && node.ownerDocument.defaultView) || self;\n};\n\n// Returns a relative position of the pointer inside the node's bounding box\nconst getRelativePosition = (\n node: HTMLDivElement,\n event: MouseEvent | TouchEvent,\n touchId: null | number\n): Interaction => {\n const rect = node.getBoundingClientRect();\n\n // Get user's pointer position from `touches` array if it's a `TouchEvent`\n const pointer = isTouch(event) ? getTouchPoint(event.touches, touchId) : (event as MouseEvent);\n\n return {\n left: clamp((pointer.pageX - (rect.left + getParentWindow(node).pageXOffset)) / rect.width),\n top: clamp((pointer.pageY - (rect.top + getParentWindow(node).pageYOffset)) / rect.height),\n };\n};\n\n// Browsers introduced an intervention, making touch events passive by default.\n// This workaround removes `preventDefault` call from the touch handlers.\n// https://github.com/facebook/react/issues/19651\nconst preventDefaultMove = (event: MouseEvent | TouchEvent): void => {\n !isTouch(event) && event.preventDefault();\n};\n\n// Prevent mobile browsers from handling mouse events (conflicting with touch ones).\n// If we detected a touch interaction before, we prefer reacting to touch events only.\nconst isInvalid = (event: MouseEvent | TouchEvent, hasTouch: boolean): boolean => {\n return hasTouch && !isTouch(event);\n};\n\ninterface Props {\n onMove: (interaction: Interaction) => void;\n onKey: (offset: Interaction) => void;\n children: React.ReactNode;\n}\n\nconst InteractiveBase = ({ onMove, onKey, ...rest }: Props) => {\n const container = useRef<HTMLDivElement>(null);\n const onMoveCallback = useEventCallback<Interaction>(onMove);\n const onKeyCallback = useEventCallback<Interaction>(onKey);\n const touchId = useRef<null | number>(null);\n const hasTouch = useRef(false);\n\n const [handleMoveStart, handleKeyDown, toggleDocumentEvents] = useMemo(() => {\n const handleMoveStart = ({ nativeEvent }: React.MouseEvent | React.TouchEvent) => {\n const el = container.current;\n if (!el) return;\n\n // Prevent text selection\n preventDefaultMove(nativeEvent);\n\n if (isInvalid(nativeEvent, hasTouch.current) || !el) return;\n\n if (isTouch(nativeEvent)) {\n hasTouch.current = true;\n const changedTouches = nativeEvent.changedTouches || [];\n if (changedTouches.length) touchId.current = changedTouches[0].identifier;\n }\n\n el.focus();\n onMoveCallback(getRelativePosition(el, nativeEvent, touchId.current));\n toggleDocumentEvents(true);\n };\n\n const handleMove = (event: MouseEvent | TouchEvent) => {\n // Prevent text selection\n preventDefaultMove(event);\n\n // If user moves the pointer outside of the window or iframe bounds and release it there,\n // `mouseup`/`touchend` won't be fired. In order to stop the picker from following the cursor\n // after the user has moved the mouse/finger back to the document, we check `event.buttons`\n // and `event.touches`. It allows us to detect that the user is just moving his pointer\n // without pressing it down\n const isDown = isTouch(event) ? event.touches.length > 0 : event.buttons > 0;\n\n if (isDown && container.current) {\n onMoveCallback(getRelativePosition(container.current, event, touchId.current));\n } else {\n toggleDocumentEvents(false);\n }\n };\n\n const handleMoveEnd = () => toggleDocumentEvents(false);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n const keyCode = event.which || event.keyCode;\n\n // Ignore all keys except arrow ones\n if (keyCode < 37 || keyCode > 40) return;\n // Do not scroll page by arrow keys when document is focused on the element\n event.preventDefault();\n // Send relative offset to the parent component.\n // We use codes (37←, 38↑, 39→, 40↓) instead of keys ('ArrowRight', 'ArrowDown', etc)\n // to reduce the size of the library\n onKeyCallback({\n left: keyCode === 39 ? 0.05 : keyCode === 37 ? -0.05 : 0,\n top: keyCode === 40 ? 0.05 : keyCode === 38 ? -0.05 : 0,\n });\n };\n\n function toggleDocumentEvents(state?: boolean) {\n const touch = hasTouch.current;\n const el = container.current;\n const parentWindow = getParentWindow(el);\n\n // Add or remove additional pointer event listeners\n const toggleEvent = state ? parentWindow.addEventListener : parentWindow.removeEventListener;\n toggleEvent(touch ? \"touchmove\" : \"mousemove\", handleMove);\n toggleEvent(touch ? \"touchend\" : \"mouseup\", handleMoveEnd);\n }\n\n return [handleMoveStart, handleKeyDown, toggleDocumentEvents];\n }, [onKeyCallback, onMoveCallback]);\n\n // Remove window event listeners before unmounting\n useEffect(() => toggleDocumentEvents, [toggleDocumentEvents]);\n\n return (\n <div\n {...rest}\n onTouchStart={handleMoveStart}\n onMouseDown={handleMoveStart}\n className=\"react-colorful__interactive\"\n ref={container}\n onKeyDown={handleKeyDown}\n tabIndex={0}\n role=\"slider\"\n />\n );\n};\n\nexport const Interactive = React.memo(InteractiveBase);\n","export const formatClassName = (names: unknown[]): string => names.filter(Boolean).join(\" \");\n","import React from \"react\";\nimport { formatClassName } from \"../../utils/format\";\n\ninterface Props {\n className?: string;\n top?: number;\n left: number;\n color: string;\n}\n\nexport const Pointer = ({ className, color, left, top = 0.5 }: Props): JSX.Element => {\n const nodeClassName = formatClassName([\"react-colorful__pointer\", className]);\n\n const style = {\n top: `${top * 100}%`,\n left: `${left * 100}%`,\n };\n\n return (\n <div className={nodeClassName} style={style}>\n <div className=\"react-colorful__pointer-fill\" style={{ backgroundColor: color }} />\n </div>\n );\n};\n","export const round = (number: number, digits = 0, base = Math.pow(10, digits)): number => {\n return Math.round(base * number) / base;\n};\n","import { round } from \"./round\";\nimport { RgbaColor, RgbColor, HslaColor, HslColor, HsvaColor, HsvColor } from \"../types\";\n\n/**\n * Valid CSS <angle> units.\n * https://developer.mozilla.org/en-US/docs/Web/CSS/angle\n */\nconst angleUnits: Record<string, number> = {\n grad: 360 / 400,\n turn: 360,\n rad: 360 / (Math.PI * 2),\n};\n\nexport const hexToHsva = (hex: string): HsvaColor => rgbaToHsva(hexToRgba(hex));\n\nexport const hexToRgba = (hex: string): RgbaColor => {\n if (hex[0] === \"#\") hex = hex.substring(1);\n\n if (hex.length < 6) {\n return {\n r: parseInt(hex[0] + hex[0], 16),\n g: parseInt(hex[1] + hex[1], 16),\n b: parseInt(hex[2] + hex[2], 16),\n a: hex.length === 4 ? round(parseInt(hex[3] + hex[3], 16) / 255, 2) : 1,\n };\n }\n\n return {\n r: parseInt(hex.substring(0, 2), 16),\n g: parseInt(hex.substring(2, 4), 16),\n b: parseInt(hex.substring(4, 6), 16),\n a: hex.length === 8 ? round(parseInt(hex.substring(6, 8), 16) / 255, 2) : 1,\n };\n};\n\nexport const parseHue = (value: string, unit = \"deg\"): number => {\n return Number(value) * (angleUnits[unit] || 1);\n};\n\nexport const hslaStringToHsva = (hslString: string): HsvaColor => {\n const matcher = /hsla?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(hslString);\n\n if (!match) return { h: 0, s: 0, v: 0, a: 1 };\n\n return hslaToHsva({\n h: parseHue(match[1], match[2]),\n s: Number(match[3]),\n l: Number(match[4]),\n a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1),\n });\n};\n\nexport const hslStringToHsva = hslaStringToHsva;\n\nexport const hslaToHsva = ({ h, s, l, a }: HslaColor): HsvaColor => {\n s *= (l < 50 ? l : 100 - l) / 100;\n\n return {\n h: h,\n s: s > 0 ? ((2 * s) / (l + s)) * 100 : 0,\n v: l + s,\n a,\n };\n};\n\nexport const hsvaToHex = (hsva: HsvaColor): string => rgbaToHex(hsvaToRgba(hsva));\n\nexport const hsvaToHsla = ({ h, s, v, a }: HsvaColor): HslaColor => {\n const hh = ((200 - s) * v) / 100;\n\n return {\n h: round(h),\n s: round(hh > 0 && hh < 200 ? ((s * v) / 100 / (hh <= 100 ? hh : 200 - hh)) * 100 : 0),\n l: round(hh / 2),\n a: round(a, 2),\n };\n};\n\nexport const hsvaToHslString = (hsva: HsvaColor): string => {\n const { h, s, l } = hsvaToHsla(hsva);\n return `hsl(${h}, ${s}%, ${l}%)`;\n};\n\nexport const hsvaToHsvString = (hsva: HsvaColor): string => {\n const { h, s, v } = roundHsva(hsva);\n return `hsv(${h}, ${s}%, ${v}%)`;\n};\n\nexport const hsvaToHsvaString = (hsva: HsvaColor): string => {\n const { h, s, v, a } = roundHsva(hsva);\n return `hsva(${h}, ${s}%, ${v}%, ${a})`;\n};\n\nexport const hsvaToHslaString = (hsva: HsvaColor): string => {\n const { h, s, l, a } = hsvaToHsla(hsva);\n return `hsla(${h}, ${s}%, ${l}%, ${a})`;\n};\n\nexport const hsvaToRgba = ({ h, s, v, a }: HsvaColor): RgbaColor => {\n h = (h / 360) * 6;\n s = s / 100;\n v = v / 100;\n\n const hh = Math.floor(h),\n b = v * (1 - s),\n c = v * (1 - (h - hh) * s),\n d = v * (1 - (1 - h + hh) * s),\n module = hh % 6;\n\n return {\n r: round([v, c, b, b, d, v][module] * 255),\n g: round([d, v, v, c, b, b][module] * 255),\n b: round([b, b, d, v, v, c][module] * 255),\n a: round(a, 2),\n };\n};\n\nexport const hsvaToRgbString = (hsva: HsvaColor): string => {\n const { r, g, b } = hsvaToRgba(hsva);\n return `rgb(${r}, ${g}, ${b})`;\n};\n\nexport const hsvaToRgbaString = (hsva: HsvaColor): string => {\n const { r, g, b, a } = hsvaToRgba(hsva);\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n};\n\nexport const hsvaStringToHsva = (hsvString: string): HsvaColor => {\n const matcher = /hsva?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(hsvString);\n\n if (!match) return { h: 0, s: 0, v: 0, a: 1 };\n\n return roundHsva({\n h: parseHue(match[1], match[2]),\n s: Number(match[3]),\n v: Number(match[4]),\n a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1),\n });\n};\n\nexport const hsvStringToHsva = hsvaStringToHsva;\n\nexport const rgbaStringToHsva = (rgbaString: string): HsvaColor => {\n const matcher = /rgba?\\(?\\s*(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(rgbaString);\n\n if (!match) return { h: 0, s: 0, v: 0, a: 1 };\n\n return rgbaToHsva({\n r: Number(match[1]) / (match[2] ? 100 / 255 : 1),\n g: Number(match[3]) / (match[4] ? 100 / 255 : 1),\n b: Number(match[5]) / (match[6] ? 100 / 255 : 1),\n a: match[7] === undefined ? 1 : Number(match[7]) / (match[8] ? 100 : 1),\n });\n};\n\nexport const rgbStringToHsva = rgbaStringToHsva;\n\nconst format = (number: number) => {\n const hex = number.toString(16);\n return hex.length < 2 ? \"0\" + hex : hex;\n};\n\nexport const rgbaToHex = ({ r, g, b, a }: RgbaColor): string => {\n const alphaHex = a < 1 ? format(round(a * 255)) : \"\";\n return \"#\" + format(r) + format(g) + format(b) + alphaHex;\n};\n\nexport const rgbaToHsva = ({ r, g, b, a }: RgbaColor): HsvaColor => {\n const max = Math.max(r, g, b);\n const delta = max - Math.min(r, g, b);\n\n // prettier-ignore\n const hh = delta\n ? max === r\n ? (g - b) / delta\n : max === g\n ? 2 + (b - r) / delta\n : 4 + (r - g) / delta\n : 0;\n\n return {\n h: round(60 * (hh < 0 ? hh + 6 : hh)),\n s: round(max ? (delta / max) * 100 : 0),\n v: round((max / 255) * 100),\n a,\n };\n};\n\nexport const roundHsva = (hsva: HsvaColor): HsvaColor => ({\n h: round(hsva.h),\n s: round(hsva.s),\n v: round(hsva.v),\n a: round(hsva.a, 2),\n});\n\nexport const rgbaToRgb = ({ r, g, b }: RgbaColor): RgbColor => ({ r, g, b });\n\nexport const hslaToHsl = ({ h, s, l }: HslaColor): HslColor => ({ h, s, l });\n\nexport const hsvaToHsv = (hsva: HsvaColor): HsvColor => {\n const { h, s, v } = roundHsva(hsva);\n return { h, s, v };\n};\n","import React from \"react\";\n\nimport { Interactive, Interaction } from \"./Interactive\";\nimport { Pointer } from \"./Pointer\";\n\nimport { hsvaToHslString } from \"../../utils/convert\";\nimport { formatClassName } from \"../../utils/format\";\nimport { clamp } from \"../../utils/clamp\";\nimport { round } from \"../../utils/round\";\n\ninterface Props {\n className?: string;\n hue: number;\n onChange: (newHue: { h: number }) => void;\n}\n\nconst HueBase = ({ className, hue, onChange }: Props) => {\n const handleMove = (interaction: Interaction) => {\n onChange({ h: 360 * interaction.left });\n };\n\n const handleKey = (offset: Interaction) => {\n // Hue measured in degrees of the color circle ranging from 0 to 360\n onChange({\n h: clamp(hue + offset.left * 360, 0, 360),\n });\n };\n\n const nodeClassName = formatClassName([\"react-colorful__hue\", className]);\n\n return (\n <div className={nodeClassName}>\n <Interactive\n onMove={handleMove}\n onKey={handleKey}\n aria-label=\"Hue\"\n aria-valuenow={round(hue)}\n aria-valuemax=\"360\"\n aria-valuemin=\"0\"\n >\n <Pointer\n className=\"react-colorful__hue-pointer\"\n left={hue / 360}\n color={hsvaToHslString({ h: hue, s: 100, v: 100, a: 1 })}\n />\n </Interactive>\n </div>\n );\n};\n\nexport const Hue = React.memo(HueBase);\n","import React from \"react\";\nimport { Interactive, Interaction } from \"./Interactive\";\nimport { Pointer } from \"./Pointer\";\nimport { HsvaColor } from \"../../types\";\nimport { hsvaToHslString } from \"../../utils/convert\";\nimport { clamp } from \"../../utils/clamp\";\nimport { round } from \"../../utils/round\";\n\ninterface Props {\n hsva: HsvaColor;\n onChange: (newColor: { s: number; v: number }) => void;\n}\n\nconst SaturationBase = ({ hsva, onChange }: Props) => {\n const handleMove = (interaction: Interaction) => {\n onChange({\n s: interaction.left * 100,\n v: 100 - interaction.top * 100,\n });\n };\n\n const handleKey = (offset: Interaction) => {\n // Saturation and brightness always fit into [0, 100] range\n onChange({\n s: clamp(hsva.s + offset.left * 100, 0, 100),\n v: clamp(hsva.v - offset.top * 100, 0, 100),\n });\n };\n\n const containerStyle = {\n backgroundColor: hsvaToHslString({ h: hsva.h, s: 100, v: 100, a: 1 }),\n };\n\n return (\n <div className=\"react-colorful__saturation\" style={containerStyle}>\n <Interactive\n onMove={handleMove}\n onKey={handleKey}\n aria-label=\"Color\"\n aria-valuetext={`Saturation ${round(hsva.s)}%, Brightness ${round(hsva.v)}%`}\n >\n <Pointer\n className=\"react-colorful__saturation-pointer\"\n top={1 - hsva.v / 100}\n left={hsva.s / 100}\n color={hsvaToHslString(hsva)}\n />\n </Interactive>\n </div>\n );\n};\n\nexport const Saturation = React.memo(SaturationBase);\n","import { hexToRgba } from \"./convert\";\nimport { ObjectColor } from \"../types\";\n\nexport const equalColorObjects = (first: ObjectColor, second: ObjectColor): boolean => {\n if (first === second) return true;\n\n for (const prop in first) {\n // The following allows for a type-safe calling of this function (first & second have to be HSL, HSV, or RGB)\n // with type-unsafe iterating over object keys. TS does not allow this without an index (`[key: string]: number`)\n // on an object to define how iteration is normally done. To ensure extra keys are not allowed on our types,\n // we must cast our object to unknown (as RGB demands `r` be a key, while `Record<string, x>` does not care if\n // there is or not), and then as a type TS can iterate over.\n if (\n ((first as unknown) as Record<string, number>)[prop] !==\n ((second as unknown) as Record<string, number>)[prop]\n )\n return false;\n }\n\n return true;\n};\n\nexport const equalColorString = (first: string, second: string): boolean => {\n return first.replace(/\\s/g, \"\") === second.replace(/\\s/g, \"\");\n};\n\nexport const equalHex = (first: string, second: string): boolean => {\n if (first.toLowerCase() === second.toLowerCase()) return true;\n\n // To compare colors like `#FFF` and `ffffff` we convert them into RGB objects\n return equalColorObjects(hexToRgba(first), hexToRgba(second));\n};\n","import { useState, useEffect, useCallback, useRef } from \"react\";\nimport { ColorModel, AnyColor, HsvaColor } from \"../types\";\nimport { equalColorObjects } from \"../utils/compare\";\nimport { useEventCallback } from \"./useEventCallback\";\n\nexport function useColorManipulation<T extends AnyColor>(\n colorModel: ColorModel<T>,\n color: T,\n onChange?: (color: T) => void\n): [HsvaColor, (color: Partial<HsvaColor>) => void] {\n // Save onChange callback in the ref for avoiding \"useCallback hell\"\n const onChangeCallback = useEventCallback<T>(onChange);\n\n // No matter which color model is used (HEX, RGB(A) or HSL(A)),\n // all internal calculations are based on HSVA model\n const [hsva, updateHsva] = useState<HsvaColor>(() => colorModel.toHsva(color));\n\n // By using this ref we're able to prevent extra updates\n // and the effects recursion during the color conversion\n const cache = useRef({ color, hsva });\n\n // Update local HSVA-value if `color` property value is changed,\n // but only if that's not the same color that we just sent to the parent\n useEffect(() => {\n if (!colorModel.equal(color, cache.current.color)) {\n const newHsva = colorModel.toHsva(color);\n cache.current = { hsva: newHsva, color };\n updateHsva(newHsva);\n }\n }, [color, colorModel]);\n\n // Trigger `onChange` callback only if an updated color is different from cached one;\n // save the new color to the ref to prevent unnecessary updates\n useEffect(() => {\n let newColor;\n if (\n !equalColorObjects(hsva, cache.current.hsva) &&\n !colorModel.equal((newColor = colorModel.fromHsva(hsva)), cache.current.color)\n ) {\n cache.current = { hsva, color: newColor };\n onChangeCallback(newColor);\n }\n }, [hsva, colorModel, onChangeCallback]);\n\n // Merge the current HSVA color object with updated params.\n // For example, when a child component sends `h` or `s` only\n const handleChange = useCallback((params: Partial<HsvaColor>) => {\n updateHsva((current) => Object.assign({}, current, params));\n }, []);\n\n return [hsva, handleChange];\n}\n","import { useLayoutEffect, useEffect } from \"react\";\n\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","declare const __webpack_nonce__: string | undefined;\nlet nonce: string | undefined;\n\n/**\n * Returns a nonce hash included by Webpack or the one defined manually by developer.\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce\n * https://webpack.js.org/guides/csp/\n */\nexport const getNonce = (): string | undefined => {\n if (nonce) return nonce;\n if (typeof __webpack_nonce__ !== \"undefined\") return __webpack_nonce__;\n return undefined;\n};\n\n/**\n * Signs the style tag with a base64-encoded string (nonce) to conforms to Content Security Policies.\n * This function has to be invoked before any picker is rendered if you aren't using Webpack for CSP.\n */\nexport const setNonce = (hash: string): void => {\n nonce = hash;\n};\n","import { RefObject } from \"react\";\n\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\nimport { getNonce } from \"../utils/nonce\";\n\n// Bundler is configured to load this as a processed minified CSS-string\nimport styles from \"../css/styles.css\";\n\nconst styleElementMap: Map<Document, HTMLStyleElement> = new Map();\n\n/**\n * Injects CSS code into the document's <head>\n */\nexport const useStyleSheet = (nodeRef: RefObject<HTMLDivElement>): void => {\n useIsomorphicLayoutEffect(() => {\n const parentDocument = nodeRef.current ? nodeRef.current.ownerDocument : document;\n\n if (typeof parentDocument !== \"undefined\" && !styleElementMap.has(parentDocument)) {\n const styleElement = parentDocument.createElement(\"style\");\n styleElement.innerHTML = styles;\n styleElementMap.set(parentDocument, styleElement);\n\n // Conform to CSP rules by setting `nonce` attribute to the inline styles\n const nonce = getNonce();\n if (nonce) styleElement.setAttribute(\"nonce\", nonce);\n\n parentDocument.head.appendChild(styleElement);\n }\n }, []);\n};\n","import React, { useRef } from \"react\";\n\nimport { Hue } from \"./Hue\";\nimport { Saturation } from \"./Saturation\";\n\nimport { ColorModel, ColorPickerBaseProps, AnyColor } from \"../../types\";\nimport { useColorManipulation } from \"../../hooks/useColorManipulation\";\nimport { useStyleSheet } from \"../../hooks/useStyleSheet\";\nimport { formatClassName } from \"../../utils/format\";\n\ninterface Props<T extends AnyColor> extends Partial<ColorPickerBaseProps<T>> {\n colorModel: ColorModel<T>;\n}\n\nexport const ColorPicker = <T extends AnyColor>({\n className,\n colorModel,\n color = colorModel.defaultColor,\n onChange,\n ...rest\n}: Props<T>): JSX.Element => {\n const nodeRef = useRef<HTMLDivElement>(null);\n useStyleSheet(nodeRef);\n\n const [hsva, updateHsva] = useColorManipulation<T>(colorModel, color, onChange);\n\n const nodeClassName = formatClassName([\"react-colorful\", className]);\n\n return (\n <div {...rest} ref={nodeRef} className={nodeClassName}>\n <Saturation hsva={hsva} onChange={updateHsva} />\n <Hue hue={hsva.h} onChange={updateHsva} className=\"react-colorful__last-control\" />\n </div>\n );\n};\n","import React from \"react\";\n\nimport { ColorPicker } from \"./common/ColorPicker\";\nimport { ColorModel, ColorPickerBaseProps } from \"../types\";\nimport { equalHex } from \"../utils/compare\";\nimport { hexToHsva, hsvaToHex } from \"../utils/convert\";\n\nconst colorModel: ColorModel<string> = {\n defaultColor: \"000\",\n toHsva: hexToHsva,\n fromHsva: ({ h, s, v }) => hsvaToHex({ h, s, v, a: 1 }),\n equal: equalHex,\n};\n\nexport const HexColorPicker = (props: Partial<ColorPickerBaseProps<string>>): JSX.Element => (\n <ColorPicker {...props} colorModel={colorModel} />\n);\n","import React from \"react\";\n\nimport { Interactive, Interaction } from \"./Interactive\";\nimport { Pointer } from \"./Pointer\";\n\nimport { hsvaToHslaString } from \"../../utils/convert\";\nimport { formatClassName } from \"../../utils/format\";\nimport { clamp } from \"../../utils/clamp\";\nimport { round } from \"../../utils/round\";\nimport { HsvaColor } from \"../../types\";\n\ninterface Props {\n className?: string;\n hsva: HsvaColor;\n onChange: (newAlpha: { a: number }) => void;\n}\n\nexport const Alpha = ({ className, hsva, onChange }: Props): JSX.Element => {\n const handleMove = (interaction: Interaction) => {\n onChange({ a: interaction.left });\n };\n\n const handleKey = (offset: Interaction) => {\n // Alpha always fit into [0, 1] range\n onChange({ a: clamp(hsva.a + offset.left) });\n };\n\n // We use `Object.assign` instead of the spread operator\n // to prevent adding the polyfill (about 150 bytes gzipped)\n const colorFrom = hsvaToHslaString(Object.assign({}, hsva, { a: 0 }));\n const colorTo = hsvaToHslaString(Object.assign({}, hsva, { a: 1 }));\n\n const gradientStyle = {\n backgroundImage: `linear-gradient(90deg, ${colorFrom}, ${colorTo})`,\n };\n\n const nodeClassName = formatClassName([\"react-colorful__alpha\", className]);\n const ariaValue = round(hsva.a * 100);\n\n return (\n <div className={nodeClassName}>\n <div className=\"react-colorful__alpha-gradient\" style={gradientStyle} />\n <Interactive\n onMove={handleMove}\n onKey={handleKey}\n aria-label=\"Alpha\"\n aria-valuetext={`${ariaValue}%`}\n aria-valuenow={ariaValue}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n >\n <Pointer\n className=\"react-colorful__alpha-pointer\"\n left={hsva.a}\n color={hsvaToHslaString(hsva)}\n />\n </Interactive>\n </div>\n );\n};\n","const matcher = /^#?([0-9A-F]{3,8})$/i;\n\nexport const validHex = (value: string, alpha?: boolean): boolean => {\n const match = matcher.exec(value);\n const length = match ? match[1].length : 0;\n\n return (\n length === 3 || // '#rgb' format\n length === 6 || // '#rrggbb' format\n (!!alpha && length === 4) || // '#rgba' format\n (!!alpha && length === 8) // '#rrggbbaa' format\n );\n};\n","import React, { useState, useEffect, useCallback } from \"react\";\n\nimport { useEventCallback } from \"../../hooks/useEventCallback\";\nimport { ColorInputBaseProps } from \"../../types\";\n\ninterface Props extends ColorInputBaseProps {\n /** Blocks typing invalid characters and limits string length */\n escape: (value: string) => string;\n /** Checks that value is valid color string */\n validate: (value: string) => boolean;\n /** Processes value before displaying it in the input */\n format?: (value: string) => string;\n /** Processes value before sending it in `onChange` */\n process?: (value: string) => string;\n}\n\nexport const ColorInput = (props: Props): JSX.Element => {\n const { color = \"\", onChange, onBlur, escape, validate, format, process, ...rest } = props;\n const [value, setValue] = useState(() => escape(color));\n const onChangeCallback = useEventCallback<string>(onChange);\n const onBlurCallback = useEventCallback<React.FocusEvent<HTMLInputElement>>(onBlur);\n\n // Trigger `onChange` handler only if the input value is a valid color\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = escape(e.target.value);\n setValue(inputValue);\n if (validate(inputValue)) onChangeCallback(process ? process(inputValue) : inputValue);\n },\n [escape, process, validate, onChangeCallback]\n );\n\n // Take the color from props if the last typed color (in local state) is not valid\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (!validate(e.target.value)) setValue(escape(color));\n onBlurCallback(e);\n },\n [color, escape, validate, onBlurCallback]\n );\n\n // Update the local state when `color` property value is changed\n useEffect(() => {\n setValue(escape(color));\n }, [color, escape]);\n\n return (\n <input\n {...rest}\n value={format ? format(value) : value}\n spellCheck=\"false\" // the element should not be checked for spelling errors\n onChange={handleChange}\n onBlur={handleBlur}\n />\n );\n};\n","import React, { useCallback } from \"react\";\nimport { ColorInputBaseProps } from \"../types\";\n\nimport { validHex } from \"../utils/validate\";\nimport { ColorInput } from \"./common/ColorInput\";\n\ninterface HexColorInputProps extends ColorInputBaseProps {\n /** Enables `#` prefix displaying */\n prefixed?: boolean;\n /** Allows `#rgba` and `#rrggbbaa` color formats */\n alpha?: boolean;\n}\n\n/** Adds \"#\" symbol to the beginning of the string */\nconst prefix = (value: string) => \"#\" + value;\n\nexport const HexColorInput = (props: HexColorInputProps): JSX.Element => {\n const { prefixed, alpha, ...rest } = props;\n\n /** Escapes all non-hexadecimal characters including \"#\" */\n const escape = useCallback(\n (value: string) => value.replace(/([^0-9A-F]+)/gi, \"\").substring(0, alpha ? 8 : 6),\n [alpha]\n );\n\n /** Validates hexadecimal strings */\n const validate = useCallback((value: string) => validHex(value, alpha), [alpha]);\n\n return (\n <ColorInput\n {...rest}\n escape={escape}\n format={prefixed ? prefix : undefined}\n process={prefix}\n validate={validate}\n />\n );\n};\n"],"names":["useEventCallback","handler","callbackRef","useRef","fn","value","current","clamp","number","min","max","isTouch","event","getParentWindow","node","ownerDocument","defaultView","self","getRelativePosition","touchId","rect","getBoundingClientRect","pointer","touches","i","length","identifier","getTouchPoint","left","pageX","pageXOffset","width","top","pageY","pageYOffset","height","preventDefaultMove","preventDefault","Interactive","React","memo","onMove","onKey","rest","container","onMoveCallback","onKeyCallback","hasTouch","useMemo","handleMove","buttons","toggleDocumentEvents","handleMoveEnd","state","touch","parentWindow","toggleEvent","addEventListener","removeEventListener","nativeEvent","el","isInvalid","changedTouches","focus","keyCode","which","handleMoveStart","handleKeyDown","useEffect","onTouchStart","onMouseDown","className","ref","onKeyDown","tabIndex","role","formatClassName","names","filter","Boolean","join","Pointer","color","nodeClassName","style","backgroundColor","round","digits","base","Math","pow","angleUnits","hexToHsva","hex","rgbaToHsva","hexToRgba","substring","r","parseInt","g","b","a","parseHue","hsvaToHex","hsva","rgbaToHex","hsvaToRgba","hsvaToHsla","s","v","hh","h","l","hsvaToHslString","hsvaToHslaString","floor","c","d","module","format","toString","alphaHex","delta","Hue","hue","onChange","interaction","offset","aria-label","aria-valuenow","aria-valuemax","aria-valuemin","Saturation","containerStyle","aria-valuetext","equalColorObjects","first","second","prop","equalColorString","equalHex","toLowerCase","useColorManipulation","colorModel","onChangeCallback","useState","toHsva","updateHsva","cache","equal","newHsva","newColor","fromHsva","handleChange","useCallback","params","Object","assign","useIsomorphicLayoutEffect","window","useLayoutEffect","getNonce","nonce","__webpack_nonce__","styleElementMap","Map","useStyleSheet","nodeRef","parentDocument","document","has","styleElement","createElement","innerHTML","set","setAttribute","head","appendChild","ColorPicker","defaultColor","HexColorPicker","props","Alpha","matcher","ColorInput","onBlur","escape","validate","process","setValue","onBlurCallback","e","inputValue","target","handleBlur","spellCheck","prefix","HexColorInput","prefixed","alpha","replace","match","exec","validHex","undefined"],"mappings":";;AAGgBA,SAAAA,CAAAA,EAAAA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,MAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,IAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,CAAAA,MAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,IAAAA,CAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,IAAAA,CAAAA,IAAAA,CAAAA,CAAAA,MAAAA,CAAAA,SAAAA,CAAAA,cAAAA,CAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,OAAAA,CAAAA,CAAAA,EAAAA,KAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,IAAAA,EAAAA,CAAAA,CAAAA,OAAAA,EAAAA,CAAAA,IAAAA,CAAAA,CAAAA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AA,CAAQA,CACRnE,CAAAA,MAAAA,CAAQ+E,CAAWF,CAAAA,EAAAA,CAAAA,KAASQ,CAC5BhB,CAAAA,OAAAA,CAASQ,GACTT,QAAUA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;;;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]}
@@ -1,29 +0,0 @@
1
- function styleInject(css, ref) {
2
- if ( ref === void 0 ) ref = {};
3
- var insertAt = ref.insertAt;
4
-
5
- if (!css || typeof document === 'undefined') { return; }
6
-
7
- var head = document.head || document.getElementsByTagName('head')[0];
8
- var style = document.createElement('style');
9
- style.type = 'text/css';
10
-
11
- if (insertAt === 'top') {
12
- if (head.firstChild) {
13
- head.insertBefore(style, head.firstChild);
14
- } else {
15
- head.appendChild(style);
16
- }
17
- } else {
18
- head.appendChild(style);
19
- }
20
-
21
- if (style.styleSheet) {
22
- style.styleSheet.cssText = css;
23
- } else {
24
- style.appendChild(document.createTextNode(css));
25
- }
26
- }
27
-
28
- export { styleInject as s };
29
- //# sourceMappingURL=style-inject.es-746bb8ed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style-inject.es-746bb8ed.js","sources":["../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;","x_google_ignoreList":[0]}
@@ -1,45 +0,0 @@
1
- function throttle(func, wait, { leading = true, trailing = true } = {}) {
2
- let lastCallTime = 0;
3
- let timeout = null;
4
- let lastArgs = null;
5
- const invokeFunc = (time) => {
6
- func(...lastArgs);
7
- lastCallTime = time;
8
- lastArgs = null;
9
- };
10
- const throttled = (...args) => {
11
- const now = Date.now();
12
- if (!lastCallTime && !leading) {
13
- lastCallTime = now;
14
- }
15
- const remainingTime = wait - (now - lastCallTime);
16
- lastArgs = args;
17
- if (remainingTime <= 0 || remainingTime > wait) {
18
- if (timeout) {
19
- clearTimeout(timeout);
20
- timeout = null;
21
- }
22
- invokeFunc(now);
23
- }
24
- else if (!timeout && trailing) {
25
- timeout = setTimeout(() => {
26
- timeout = null;
27
- if (trailing && lastArgs) {
28
- invokeFunc(Date.now());
29
- }
30
- }, remainingTime);
31
- }
32
- };
33
- throttled.cancel = () => {
34
- if (timeout) {
35
- clearTimeout(timeout);
36
- timeout = null;
37
- }
38
- lastArgs = null;
39
- lastCallTime = 0;
40
- };
41
- return throttled;
42
- }
43
-
44
- export { throttle as t };
45
- //# sourceMappingURL=throttle-278836f4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"throttle-278836f4.js","sources":["../../src/utils/throttle.ts"],"sourcesContent":["export type ThrottleOptions = {\n leading?: boolean;\n trailing?: boolean;\n};\n\nexport function throttle<T extends (...args: any[]) => any>(\n func: T,\n wait: number,\n { leading = true, trailing = true }: ThrottleOptions = {},\n): T & { cancel: () => void } {\n let lastCallTime = 0;\n let timeout: NodeJS.Timeout | null = null;\n let lastArgs: Parameters<T> | null = null;\n\n const invokeFunc = (time: number) => {\n func(...(lastArgs as Parameters<T>));\n lastCallTime = time;\n lastArgs = null;\n };\n\n const throttled = (...args: Parameters<T>) => {\n const now = Date.now();\n\n if (!lastCallTime && !leading) {\n lastCallTime = now;\n }\n\n const remainingTime = wait - (now - lastCallTime);\n lastArgs = args;\n\n if (remainingTime <= 0 || remainingTime > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n invokeFunc(now);\n } else if (!timeout && trailing) {\n timeout = setTimeout(() => {\n timeout = null;\n if (trailing && lastArgs) {\n invokeFunc(Date.now());\n }\n }, remainingTime);\n }\n };\n\n throttled.cancel = () => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n lastArgs = null;\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