@chayns-components/color-picker 5.0.0-beta.547 → 5.0.0-beta.550

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.
@@ -1,7 +1,7 @@
1
1
  import { hslToRgb255 } from '@chayns/colors';
2
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { convertColorToHsl, splitRgb } from '../../utils/color';
4
- import { StyledHueSlider, StyledHueSliderInput } from './HueSlider.styles';
4
+ import { StyledHueSlider, StyledHueSliderInput, StyledHueSliderThumb } from './HueSlider.styles';
5
5
  const HueSlider = _ref => {
6
6
  let {
7
7
  onChange,
@@ -9,6 +9,8 @@ const HueSlider = _ref => {
9
9
  } = _ref;
10
10
  const [editedValue, setEditedValue] = useState(0);
11
11
  const [hslColor, setHslColor] = useState('hsl(0, 0, 100)');
12
+ const sliderThumbRef = useRef(null);
13
+ const sliderRef = useRef(null);
12
14
  useEffect(() => {
13
15
  if (color) {
14
16
  const rgb = splitRgb(color);
@@ -47,14 +49,25 @@ const HueSlider = _ref => {
47
49
  onChange(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${1})`);
48
50
  }
49
51
  }, [onChange]);
52
+ const sliderThumbPosition = useMemo(() => {
53
+ if (sliderRef.current && sliderThumbRef.current) {
54
+ return editedValue / 360 * (sliderRef.current.offsetWidth - sliderThumbRef.current.offsetWidth / 2);
55
+ }
56
+ return 0;
57
+ }, [editedValue]);
50
58
  return useMemo(() => /*#__PURE__*/React.createElement(StyledHueSlider, null, /*#__PURE__*/React.createElement(StyledHueSliderInput, {
59
+ ref: sliderRef,
51
60
  $color: hslColor,
52
61
  type: "range",
53
62
  min: 0,
54
63
  max: 360,
55
64
  value: editedValue,
56
65
  onChange: handleInputChange
57
- })), [editedValue, handleInputChange, hslColor]);
66
+ }), /*#__PURE__*/React.createElement(StyledHueSliderThumb, {
67
+ ref: sliderThumbRef,
68
+ $position: sliderThumbPosition,
69
+ $color: hslColor
70
+ })), [editedValue, handleInputChange, hslColor, sliderThumbPosition]);
58
71
  };
59
72
  HueSlider.displayName = 'HueSlider';
60
73
  export default HueSlider;
@@ -1 +1 @@
1
- {"version":3,"file":"HueSlider.js","names":["hslToRgb255","React","useCallback","useEffect","useMemo","useState","convertColorToHsl","splitRgb","StyledHueSlider","StyledHueSliderInput","HueSlider","_ref","onChange","color","editedValue","setEditedValue","hslColor","setHslColor","rgb","hsl","r","g","b","match","toString","parseInt","handleInputChange","event","Number","target","value","percentage","hue","saturation","lightness","h","s","l","createElement","$color","type","min","max","displayName"],"sources":["../../../src/components/hue-slider/HueSlider.tsx"],"sourcesContent":["import { hslToRgb255 } from '@chayns/colors';\nimport React, {\n ChangeEvent,\n CSSProperties,\n FC,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { convertColorToHsl, splitRgb } from '../../utils/color';\nimport { StyledHueSlider, StyledHueSliderInput } from './HueSlider.styles';\n\nexport type HueSliderProps = {\n /**\n * The color that should be selected.\n */\n color?: CSSProperties['color'];\n /**\n * Function that will be executed when the color is changed.\n */\n onChange?: (color: CSSProperties['color']) => void;\n};\n\nconst HueSlider: FC<HueSliderProps> = ({ onChange, color = 'rgba(255, 0, 0, 1)' }) => {\n const [editedValue, setEditedValue] = useState(0);\n const [hslColor, setHslColor] = useState<CSSProperties['color']>('hsl(0, 0, 100)');\n\n useEffect(() => {\n if (color) {\n const rgb = splitRgb(color);\n\n if (!rgb) {\n return;\n }\n\n const hsl = convertColorToHsl(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1)`);\n const match = hsl?.toString().match(/hsl\\((\\d+),\\s*([\\d.]+)%,\\s*([\\d.]+)%\\)/);\n\n if (!match || !match[1]) {\n return;\n }\n\n setHslColor(`hsl(${match[1]}, 100%, 50%)`);\n setEditedValue(parseInt(match[1], 10));\n\n if (typeof onChange === 'function') {\n onChange(hsl);\n }\n }\n }, [color, onChange]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setEditedValue(Number(event.target.value));\n\n const percentage = (Number(event.target.value) / 360) * 100;\n const hue = (percentage / 100) * 360;\n const saturation = 100;\n const lightness = 50;\n\n const hsl = `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n setHslColor(hsl);\n\n if (typeof onChange === 'function') {\n const rgb = hslToRgb255({ h: hue, s: 1, l: 0.5 });\n\n if (!rgb) {\n return;\n }\n\n onChange(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${1})`);\n }\n },\n [onChange],\n );\n\n return useMemo(\n () => (\n <StyledHueSlider>\n <StyledHueSliderInput\n $color={hslColor}\n type=\"range\"\n min={0}\n max={360}\n value={editedValue}\n onChange={handleInputChange}\n />\n </StyledHueSlider>\n ),\n [editedValue, handleInputChange, hslColor],\n );\n};\n\nHueSlider.displayName = 'HueSlider';\n\nexport default HueSlider;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,mBAAmB;AAC/D,SAASC,eAAe,EAAEC,oBAAoB,QAAQ,oBAAoB;AAa1E,MAAMC,SAA6B,GAAGC,IAAA,IAAgD;EAAA,IAA/C;IAAEC,QAAQ;IAAEC,KAAK,GAAG;EAAqB,CAAC,GAAAF,IAAA;EAC7E,MAAM,CAACG,WAAW,EAAEC,cAAc,CAAC,GAAGV,QAAQ,CAAC,CAAC,CAAC;EACjD,MAAM,CAACW,QAAQ,EAAEC,WAAW,CAAC,GAAGZ,QAAQ,CAAyB,gBAAgB,CAAC;EAElFF,SAAS,CAAC,MAAM;IACZ,IAAIU,KAAK,EAAE;MACP,MAAMK,GAAG,GAAGX,QAAQ,CAACM,KAAK,CAAC;MAE3B,IAAI,CAACK,GAAG,EAAE;QACN;MACJ;MAEA,MAAMC,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,EAAE;QACN;MACJ;MAEAN,QAAQ,CAAE,QAAOM,GAAG,CAACE,CAAE,KAAIF,GAAG,CAACG,CAAE,KAAIH,GAAG,CAACI,CAAE,KAAI,CAAE,GAAE,CAAC;IACxD;EACJ,CAAC,EACD,CAACV,QAAQ,CACb,CAAC;EAED,OAAOR,OAAO,CACV,mBACIH,KAAA,CAAAqC,aAAA,CAAC9B,eAAe,qBACZP,KAAA,CAAAqC,aAAA,CAAC7B,oBAAoB;IACjB8B,MAAM,EAAEvB,QAAS;IACjBwB,IAAI,EAAC,OAAO;IACZC,GAAG,EAAE,CAAE;IACPC,GAAG,EAAE,GAAI;IACTZ,KAAK,EAAEhB,WAAY;IACnBF,QAAQ,EAAEc;EAAkB,CAC/B,CACY,CACpB,EACD,CAACZ,WAAW,EAAEY,iBAAiB,EAAEV,QAAQ,CAC7C,CAAC;AACL,CAAC;AAEDN,SAAS,CAACiC,WAAW,GAAG,WAAW;AAEnC,eAAejC,SAAS"}
1
+ {"version":3,"file":"HueSlider.js","names":["hslToRgb255","React","useCallback","useEffect","useMemo","useRef","useState","convertColorToHsl","splitRgb","StyledHueSlider","StyledHueSliderInput","StyledHueSliderThumb","HueSlider","_ref","onChange","color","editedValue","setEditedValue","hslColor","setHslColor","sliderThumbRef","sliderRef","rgb","hsl","r","g","b","match","toString","parseInt","handleInputChange","event","Number","target","value","percentage","hue","saturation","lightness","h","s","l","sliderThumbPosition","current","offsetWidth","createElement","ref","$color","type","min","max","$position","displayName"],"sources":["../../../src/components/hue-slider/HueSlider.tsx"],"sourcesContent":["import { hslToRgb255 } from '@chayns/colors';\nimport React, {\n ChangeEvent,\n CSSProperties,\n FC,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { convertColorToHsl, splitRgb } from '../../utils/color';\nimport { StyledHueSlider, StyledHueSliderInput, StyledHueSliderThumb } from './HueSlider.styles';\n\nexport type HueSliderProps = {\n /**\n * The color that should be selected.\n */\n color?: CSSProperties['color'];\n /**\n * Function that will be executed when the color is changed.\n */\n onChange?: (color: CSSProperties['color']) => void;\n};\n\nconst HueSlider: FC<HueSliderProps> = ({ onChange, color = 'rgba(255, 0, 0, 1)' }) => {\n const [editedValue, setEditedValue] = useState(0);\n const [hslColor, setHslColor] = useState<CSSProperties['color']>('hsl(0, 0, 100)');\n\n const sliderThumbRef = useRef<HTMLDivElement>(null);\n const sliderRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (color) {\n const rgb = splitRgb(color);\n\n if (!rgb) {\n return;\n }\n\n const hsl = convertColorToHsl(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1)`);\n const match = hsl?.toString().match(/hsl\\((\\d+),\\s*([\\d.]+)%,\\s*([\\d.]+)%\\)/);\n\n if (!match || !match[1]) {\n return;\n }\n\n setHslColor(`hsl(${match[1]}, 100%, 50%)`);\n setEditedValue(parseInt(match[1], 10));\n\n if (typeof onChange === 'function') {\n onChange(hsl);\n }\n }\n }, [color, onChange]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setEditedValue(Number(event.target.value));\n\n const percentage = (Number(event.target.value) / 360) * 100;\n const hue = (percentage / 100) * 360;\n const saturation = 100;\n const lightness = 50;\n\n const hsl = `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n setHslColor(hsl);\n\n if (typeof onChange === 'function') {\n const rgb = hslToRgb255({ h: hue, s: 1, l: 0.5 });\n\n if (!rgb) {\n return;\n }\n\n onChange(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${1})`);\n }\n },\n [onChange],\n );\n\n const sliderThumbPosition = useMemo(() => {\n if (sliderRef.current && sliderThumbRef.current) {\n return (\n (editedValue / 360) *\n (sliderRef.current.offsetWidth - sliderThumbRef.current.offsetWidth / 2)\n );\n }\n return 0;\n }, [editedValue]);\n\n return useMemo(\n () => (\n <StyledHueSlider>\n <StyledHueSliderInput\n ref={sliderRef}\n $color={hslColor}\n type=\"range\"\n min={0}\n max={360}\n value={editedValue}\n onChange={handleInputChange}\n />\n <StyledHueSliderThumb\n ref={sliderThumbRef}\n $position={sliderThumbPosition}\n $color={hslColor}\n />\n </StyledHueSlider>\n ),\n [editedValue, handleInputChange, hslColor, sliderThumbPosition],\n );\n};\n\nHueSlider.displayName = 'HueSlider';\n\nexport default HueSlider;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,mBAAmB;AAC/D,SAASC,eAAe,EAAEC,oBAAoB,EAAEC,oBAAoB,QAAQ,oBAAoB;AAahG,MAAMC,SAA6B,GAAGC,IAAA,IAAgD;EAAA,IAA/C;IAAEC,QAAQ;IAAEC,KAAK,GAAG;EAAqB,CAAC,GAAAF,IAAA;EAC7E,MAAM,CAACG,WAAW,EAAEC,cAAc,CAAC,GAAGX,QAAQ,CAAC,CAAC,CAAC;EACjD,MAAM,CAACY,QAAQ,EAAEC,WAAW,CAAC,GAAGb,QAAQ,CAAyB,gBAAgB,CAAC;EAElF,MAAMc,cAAc,GAAGf,MAAM,CAAiB,IAAI,CAAC;EACnD,MAAMgB,SAAS,GAAGhB,MAAM,CAAmB,IAAI,CAAC;EAEhDF,SAAS,CAAC,MAAM;IACZ,IAAIY,KAAK,EAAE;MACP,MAAMO,GAAG,GAAGd,QAAQ,CAACO,KAAK,CAAC;MAE3B,IAAI,CAACO,GAAG,EAAE;QACN;MACJ;MAEA,MAAMC,GAAG,GAAGhB,iBAAiB,CAAE,QAAOe,GAAG,CAACE,CAAE,KAAIF,GAAG,CAACG,CAAE,KAAIH,GAAG,CAACI,CAAE,MAAK,CAAC;MACtE,MAAMC,KAAK,GAAGJ,GAAG,EAAEK,QAAQ,CAAC,CAAC,CAACD,KAAK,CAAC,wCAAwC,CAAC;MAE7E,IAAI,CAACA,KAAK,IAAI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IACtC,IAAIiB,SAAS,CAACsB,OAAO,IAAIvB,cAAc,CAACuB,OAAO,EAAE;MAC7C,OACK3B,WAAW,GAAG,GAAG,IACjBK,SAAS,CAACsB,OAAO,CAACC,WAAW,GAAGxB,cAAc,CAACuB,OAAO,CAACC,WAAW,GAAG,CAAC,CAAC;IAEhF;IACA,OAAO,CAAC;EACZ,CAAC,EAAE,CAAC5B,WAAW,CAAC,CAAC;EAEjB,OAAOZ,OAAO,CACV,mBACIH,KAAA,CAAA4C,aAAA,CAACpC,eAAe,qBACZR,KAAA,CAAA4C,aAAA,CAACnC,oBAAoB;IACjBoC,GAAG,EAAEzB,SAAU;IACf0B,MAAM,EAAE7B,QAAS;IACjB8B,IAAI,EAAC,OAAO;IACZC,GAAG,EAAE,CAAE;IACPC,GAAG,EAAE,GAAI;IACThB,KAAK,EAAElB,WAAY;IACnBF,QAAQ,EAAEgB;EAAkB,CAC/B,CAAC,eACF7B,KAAA,CAAA4C,aAAA,CAAClC,oBAAoB;IACjBmC,GAAG,EAAE1B,cAAe;IACpB+B,SAAS,EAAET,mBAAoB;IAC/BK,MAAM,EAAE7B;EAAS,CACpB,CACY,CACpB,EACD,CAACF,WAAW,EAAEc,iBAAiB,EAAEZ,QAAQ,EAAEwB,mBAAmB,CAClE,CAAC;AACL,CAAC;AAED9B,SAAS,CAACwC,WAAW,GAAG,WAAW;AAEnC,eAAexC,SAAS"}
@@ -5,4 +5,11 @@ type StyledHueSliderInputProps = WithTheme<{
5
5
  $color: CSSProperties['color'];
6
6
  }>;
7
7
  export declare const StyledHueSliderInput: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, StyledHueSliderInputProps>>;
8
+ type StyledHueSliderThumbProps = WithTheme<{
9
+ $position: number;
10
+ $color: CSSProperties['color'];
11
+ }>;
12
+ export declare const StyledHueSliderThumb: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
+ }>, StyledHueSliderThumbProps>, never>>;
8
15
  export {};
@@ -1,7 +1,11 @@
1
1
  import styled from 'styled-components';
2
2
  export const StyledHueSlider = styled.div`
3
3
  width: 100%;
4
+ height: 30px;
4
5
  cursor: pointer;
6
+ position: relative;
7
+ display: flex;
8
+ align-items: center;
5
9
  `;
6
10
  export const StyledHueSliderInput = styled.input`
7
11
  width: 100%;
@@ -35,30 +39,42 @@ export const StyledHueSliderInput = styled.input`
35
39
  appearance: none;
36
40
  width: 20px;
37
41
  height: 20px;
38
- background-color: ${_ref => {
39
- let {
40
- $color
41
- } = _ref;
42
- return $color;
43
- }};
44
42
  cursor: pointer;
45
43
  border-radius: 50%;
46
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
47
44
  }
48
45
 
49
46
  // slider thumb for firefox
50
47
  &::-moz-range-thumb {
51
48
  width: 20px;
52
49
  height: 20px;
53
- background-color: ${_ref2 => {
54
- let {
55
- $color
56
- } = _ref2;
57
- return $color;
58
- }};
59
50
  cursor: pointer;
60
51
  border-radius: 50%;
61
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
62
52
  }
63
53
  `;
54
+ export const StyledHueSliderThumb = styled.div.attrs(_ref => {
55
+ let {
56
+ $position,
57
+ $color
58
+ } = _ref;
59
+ return {
60
+ style: {
61
+ left: `${$position}px`,
62
+ backgroundColor: $color
63
+ }
64
+ };
65
+ })`
66
+ min-width: 20px;
67
+ height: 20px;
68
+ cursor: pointer;
69
+ border-radius: 100px;
70
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
71
+ pointer-events: none;
72
+ z-index: 3;
73
+ position: absolute;
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ padding: 0 8px;
78
+ white-space: nowrap;
79
+ `;
64
80
  //# sourceMappingURL=HueSlider.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HueSlider.styles.js","names":["styled","StyledHueSlider","div","StyledHueSliderInput","input","_ref","$color","_ref2"],"sources":["../../../src/components/hue-slider/HueSlider.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport type { CSSProperties } from 'react';\nimport styled from 'styled-components';\n\nexport const StyledHueSlider = styled.div`\n width: 100%;\n cursor: pointer;\n`;\n\ntype StyledHueSliderInputProps = WithTheme<{\n $color: CSSProperties['color'];\n}>;\n\nexport const StyledHueSliderInput = styled.input<StyledHueSliderInputProps>`\n width: 100%;\n border-radius: 100px;\n -webkit-appearance: none;\n height: 10px;\n background: linear-gradient(\n to right,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n );\n outline: none;\n opacity: 0.7;\n -webkit-transition: 0.2s;\n transition: opacity 0.2s;\n\n // Slider thumb for chrome\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background-color: ${({ $color }) => $color};\n cursor: pointer;\n border-radius: 50%;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);\n }\n\n // slider thumb for firefox\n &::-moz-range-thumb {\n width: 20px;\n height: 20px;\n background-color: ${({ $color }) => $color};\n cursor: pointer;\n border-radius: 50%;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);\n }\n`;\n"],"mappings":"AAEA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,eAAe,GAAGD,MAAM,CAACE,GAAI;AAC1C;AACA;AACA,CAAC;AAMD,OAAO,MAAMC,oBAAoB,GAAGH,MAAM,CAACI,KAAiC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4BC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4BC,KAAA;EAAA,IAAC;IAAED;EAAO,CAAC,GAAAC,KAAA;EAAA,OAAKD,MAAM;AAAA,CAAC;AACnD;AACA;AACA;AACA;AACA,CAAC"}
1
+ {"version":3,"file":"HueSlider.styles.js","names":["styled","StyledHueSlider","div","StyledHueSliderInput","input","StyledHueSliderThumb","attrs","_ref","$position","$color","style","left","backgroundColor"],"sources":["../../../src/components/hue-slider/HueSlider.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport type { CSSProperties } from 'react';\nimport styled from 'styled-components';\n\nexport const StyledHueSlider = styled.div`\n width: 100%;\n height: 30px;\n cursor: pointer;\n position: relative;\n display: flex;\n align-items: center;\n`;\n\ntype StyledHueSliderInputProps = WithTheme<{\n $color: CSSProperties['color'];\n}>;\n\nexport const StyledHueSliderInput = styled.input<StyledHueSliderInputProps>`\n width: 100%;\n border-radius: 100px;\n -webkit-appearance: none;\n height: 10px;\n background: linear-gradient(\n to right,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n );\n outline: none;\n opacity: 0.7;\n -webkit-transition: 0.2s;\n transition: opacity 0.2s;\n\n // Slider thumb for chrome\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n border-radius: 50%;\n }\n\n // slider thumb for firefox\n &::-moz-range-thumb {\n width: 20px;\n height: 20px;\n cursor: pointer;\n border-radius: 50%;\n }\n`;\n\ntype StyledHueSliderThumbProps = WithTheme<{ $position: number; $color: CSSProperties['color'] }>;\n\nexport const StyledHueSliderThumb = styled.div.attrs<StyledHueSliderThumbProps>(\n ({ $position, $color }) => ({\n style: {\n left: `${$position}px`,\n backgroundColor: $color,\n },\n }),\n)`\n min-width: 20px;\n height: 20px;\n cursor: pointer;\n border-radius: 100px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);\n pointer-events: none;\n z-index: 3;\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 8px;\n white-space: nowrap;\n`;\n"],"mappings":"AAEA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,eAAe,GAAGD,MAAM,CAACE,GAAI;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAMC,oBAAoB,GAAGH,MAAM,CAACI,KAAiC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMC,oBAAoB,GAAGL,MAAM,CAACE,GAAG,CAACI,KAAK,CAChDC,IAAA;EAAA,IAAC;IAAEC,SAAS;IAAEC;EAAO,CAAC,GAAAF,IAAA;EAAA,OAAM;IACxBG,KAAK,EAAE;MACHC,IAAI,EAAG,GAAEH,SAAU,IAAG;MACtBI,eAAe,EAAEH;IACrB;EACJ,CAAC;AAAA,CACL,CAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/color-picker",
3
- "version": "5.0.0-beta.547",
3
+ "version": "5.0.0-beta.550",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -57,7 +57,7 @@
57
57
  "typescript": "^5.3.3"
58
58
  },
59
59
  "dependencies": {
60
- "@chayns-components/core": "^5.0.0-beta.547",
60
+ "@chayns-components/core": "^5.0.0-beta.550",
61
61
  "@chayns/colors": "^2.0.0"
62
62
  },
63
63
  "peerDependencies": {
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "d3df4725be2d6cb23d7a88d2f684b450a9c0ca3c"
73
+ "gitHead": "75602c020e5deeca53560abbc1b8ef5069804e81"
74
74
  }