@chayns-components/color-picker 5.0.0-beta.764 → 5.0.0-beta.765
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/color-picker/color-picker-wrapper/ColorPickerWrapper.js +1 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/ColorPickerWrapper.js.map +1 -1
- package/lib/cjs/components/color-picker-popup/ColorPickerPopup.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/ColorPickerPopup.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.js +2 -2
- package/lib/cjs/components/color-picker-popup/color-area/ColorArea.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/color-area/ColorArea.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.js +2 -2
- package/lib/cjs/components/color-picker-popup/more-options/MoreOptions.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/more-options/MoreOptions.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.js +3 -3
- package/lib/cjs/components/color-picker-popup/preset-colors/PresetColors.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/preset-colors/PresetColors.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.js +1 -1
- package/lib/cjs/components/color-picker-popup/preset-colors/preset-button/PresetButton.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/preset-colors/preset-button/PresetButton.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.js +1 -1
- package/lib/cjs/components/color-picker-popup/preset-colors/preset-color/PresetColor.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/preset-colors/preset-color/PresetColor.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.js +4 -4
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.js.map +1 -1
- package/lib/cjs/components/color-picker-popup/sliders/Sliders.styles.js.map +1 -0
- package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.js +1 -1
- package/lib/cjs/components/color-picker-popup/sliders/color-preview/ColorPreview.js.map +1 -0
- package/lib/cjs/components/color-picker-popup/sliders/color-preview/ColorPreview.styles.js.map +1 -0
- package/lib/esm/components/color-picker/color-picker-wrapper/ColorPickerWrapper.js +1 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/ColorPickerWrapper.js.map +1 -1
- package/lib/esm/components/color-picker-popup/ColorPickerPopup.js.map +1 -0
- package/lib/esm/components/color-picker-popup/ColorPickerPopup.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.js +2 -2
- package/lib/esm/components/color-picker-popup/color-area/ColorArea.js.map +1 -0
- package/lib/esm/components/color-picker-popup/color-area/ColorArea.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.js +2 -2
- package/lib/esm/components/color-picker-popup/more-options/MoreOptions.js.map +1 -0
- package/lib/esm/components/color-picker-popup/more-options/MoreOptions.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.js +3 -3
- package/lib/esm/components/color-picker-popup/preset-colors/PresetColors.js.map +1 -0
- package/lib/esm/components/color-picker-popup/preset-colors/PresetColors.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.js +1 -1
- package/lib/esm/components/color-picker-popup/preset-colors/preset-button/PresetButton.js.map +1 -0
- package/lib/esm/components/color-picker-popup/preset-colors/preset-button/PresetButton.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.js +1 -1
- package/lib/esm/components/color-picker-popup/preset-colors/preset-color/PresetColor.js.map +1 -0
- package/lib/esm/components/color-picker-popup/preset-colors/preset-color/PresetColor.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.js +4 -4
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.js.map +1 -1
- package/lib/esm/components/color-picker-popup/sliders/Sliders.styles.js.map +1 -0
- package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.js +1 -1
- package/lib/esm/components/color-picker-popup/sliders/color-preview/ColorPreview.js.map +1 -0
- package/lib/esm/components/color-picker-popup/sliders/color-preview/ColorPreview.styles.js.map +1 -0
- package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.d.ts +1 -1
- package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.d.ts +1 -1
- package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.d.ts +1 -1
- package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.d.ts +1 -1
- package/package.json +2 -2
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/ColorPickerPopup.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/ColorPickerPopup.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/color-area/ColorArea.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/color-area/ColorArea.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/more-options/MoreOptions.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/more-options/MoreOptions.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/PresetColors.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/PresetColors.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-button/PresetButton.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-button/PresetButton.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-color/PresetColor.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-color/PresetColor.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/Sliders.styles.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/color-preview/ColorPreview.js.map +0 -1
- package/lib/cjs/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/color-preview/ColorPreview.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/ColorPickerPopup.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/ColorPickerPopup.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/color-area/ColorArea.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/color-area/ColorArea.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/more-options/MoreOptions.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/more-options/MoreOptions.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/PresetColors.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/PresetColors.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-button/PresetButton.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-button/PresetButton.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-color/PresetColor.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/preset-colors/preset-color/PresetColor.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/Sliders.styles.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/color-preview/ColorPreview.js.map +0 -1
- package/lib/esm/components/color-picker/color-picker-wrapper/color-picker-popup/sliders/color-preview/ColorPreview.styles.js.map +0 -1
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.styles.js +0 -0
- /package/lib/cjs/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.styles.js +0 -0
- /package/lib/esm/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.styles.js +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/ColorPickerPopup.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/color-area/ColorArea.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/more-options/MoreOptions.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/PresetColors.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-button/PresetButton.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/preset-colors/preset-color/PresetColor.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/Sliders.styles.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.d.ts +0 -0
- /package/lib/types/components/{color-picker/color-picker-wrapper/color-picker-popup → color-picker-popup}/sliders/color-preview/ColorPreview.styles.d.ts +0 -0
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _core = require("@chayns-components/core");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ColorPickerPopup = _interopRequireDefault(require("../../color-picker-popup/ColorPickerPopup"));
|
|
9
10
|
var _ColorPickerProvider = require("../../ColorPickerProvider");
|
|
10
|
-
var _ColorPickerPopup = _interopRequireDefault(require("./color-picker-popup/ColorPickerPopup"));
|
|
11
11
|
var _ColorPickerWrapper = require("./ColorPickerWrapper.styles");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerWrapper.js","names":["_core","require","_react","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"file":"ColorPickerWrapper.js","names":["_core","require","_react","_interopRequireWildcard","_ColorPickerPopup","_interopRequireDefault","_ColorPickerProvider","_ColorPickerWrapper","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorPickerWrapper","presetColors","onPresetColorRemove","onPresetColorAdd","shouldShowPresetColors","shouldShowAsPopup","shouldShowTransparencySlider","shouldShowMoreOptions","shouldShowRoundPreviewColor","shouldShowPreviewColorString","selectedColor","useContext","ColorPickerContext","content","useMemo","createElement","StyledColorPickerWrapper","Popup","StyledColorPickerWrapperInfo","StyledColorPickerWrapperInfoColorWrapper","$shouldShowRoundPreviewColor","StyledColorPickerWrapperInfoColorBackground","StyledColorPickerWrapperInfoColor","$color","StyledColorPickerWrapperInfoText","displayName","_default","exports"],"sources":["../../../../../src/components/color-picker/color-picker-wrapper/ColorPickerWrapper.tsx"],"sourcesContent":["import { Popup } from '@chayns-components/core';\nimport React, { useContext, useMemo } from 'react';\nimport type { IPresetColor } from '../../../types/colorPicker';\nimport ColorPickerPopup from '../../color-picker-popup/ColorPickerPopup';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport {\n StyledColorPickerWrapper,\n StyledColorPickerWrapperInfo,\n StyledColorPickerWrapperInfoColor,\n StyledColorPickerWrapperInfoColorBackground,\n StyledColorPickerWrapperInfoColorWrapper,\n StyledColorPickerWrapperInfoText,\n} from './ColorPickerWrapper.styles';\n\ninterface ColorPickerWrapperProps {\n presetColors?: IPresetColor[];\n shouldShowPresetColors: boolean;\n onPresetColorAdd?: (presetColor: IPresetColor) => void;\n onPresetColorRemove?: (presetColorId: IPresetColor['id']) => void;\n shouldShowTransparencySlider: boolean;\n shouldShowMoreOptions: boolean;\n shouldShowAsPopup: boolean;\n shouldShowPreviewColorString: boolean;\n shouldShowRoundPreviewColor: boolean;\n}\n\nconst ColorPickerWrapper = ({\n presetColors,\n onPresetColorRemove,\n onPresetColorAdd,\n shouldShowPresetColors,\n shouldShowAsPopup,\n shouldShowTransparencySlider,\n shouldShowMoreOptions,\n shouldShowRoundPreviewColor,\n shouldShowPreviewColorString,\n}: ColorPickerWrapperProps) => {\n const { selectedColor } = useContext(ColorPickerContext);\n\n const content = useMemo(\n () => (\n <ColorPickerPopup\n shouldShowPresetColors={shouldShowPresetColors}\n onPresetColorRemove={onPresetColorRemove}\n onPresetColorAdd={onPresetColorAdd}\n presetColors={presetColors}\n shouldShowMoreOptions={shouldShowMoreOptions}\n shouldShowTransparencySlider={shouldShowTransparencySlider}\n />\n ),\n [\n onPresetColorAdd,\n onPresetColorRemove,\n presetColors,\n shouldShowMoreOptions,\n shouldShowPresetColors,\n shouldShowTransparencySlider,\n ],\n );\n\n return (\n <StyledColorPickerWrapper>\n {shouldShowAsPopup ? (\n <Popup content={content}>\n <StyledColorPickerWrapperInfo>\n <StyledColorPickerWrapperInfoColorWrapper\n $shouldShowRoundPreviewColor={shouldShowRoundPreviewColor}\n >\n <StyledColorPickerWrapperInfoColorBackground />\n <StyledColorPickerWrapperInfoColor $color={selectedColor} />\n </StyledColorPickerWrapperInfoColorWrapper>\n\n {shouldShowPreviewColorString && (\n <StyledColorPickerWrapperInfoText>\n {selectedColor}\n </StyledColorPickerWrapperInfoText>\n )}\n </StyledColorPickerWrapperInfo>\n </Popup>\n ) : (\n content\n )}\n </StyledColorPickerWrapper>\n );\n};\n\nColorPickerWrapper.displayName = 'ColorPickerWrapper';\n\nexport default ColorPickerWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAOqC,SAAAI,uBAAAG,CAAA,W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AAiC,aAAA,CAACpC,mBAAA,CAAA6C,gCAAgC,QAC5Bd,aAC6B,CAEZ,CAC3B,CAAC,GAERG,OAEkB,CAAC;AAEnC,CAAC;AAEDb,kBAAkB,CAACyB,WAAW,GAAG,oBAAoB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7C,OAAA,GAEvCkB,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup.js","names":["_react","_interopRequireDefault","require","_ColorArea","_ColorPickerPopup","_MoreOptions","_PresetColors","_Sliders","e","__esModule","default","ColorPickerPopup","presetColors","onPresetColorRemove","onPresetColorAdd","shouldShowPresetColors","shouldShowTransparencySlider","shouldShowMoreOptions","createElement","StyledColorPickerPopup","displayName","_default","exports"],"sources":["../../../../src/components/color-picker-popup/ColorPickerPopup.tsx"],"sourcesContent":["import React from 'react';\nimport type { IPresetColor } from '../../types/colorPicker';\nimport ColorArea from './color-area/ColorArea';\nimport { StyledColorPickerPopup } from './ColorPickerPopup.styles';\nimport MoreOptions from './more-options/MoreOptions';\nimport PresetColors from './preset-colors/PresetColors';\nimport Sliders from './sliders/Sliders';\n\ninterface ColorPickerPopupProps {\n presetColors?: IPresetColor[];\n shouldShowPresetColors: boolean;\n onPresetColorAdd?: (presetColor: IPresetColor) => void;\n onPresetColorRemove?: (presetColorId: IPresetColor['id']) => void;\n shouldShowTransparencySlider: boolean;\n shouldShowMoreOptions: boolean;\n}\n\nconst ColorPickerPopup = ({\n presetColors,\n onPresetColorRemove,\n onPresetColorAdd,\n shouldShowPresetColors,\n shouldShowTransparencySlider,\n shouldShowMoreOptions,\n}: ColorPickerPopupProps) => (\n <StyledColorPickerPopup>\n <ColorArea />\n <Sliders shouldShowTransparencySlider={shouldShowTransparencySlider} />\n {shouldShowPresetColors && (\n <PresetColors\n presetColors={presetColors}\n onPresetColorAdd={onPresetColorAdd}\n onPresetColorRemove={onPresetColorRemove}\n />\n )}\n {shouldShowMoreO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,CAAAZ,OAAA,GAEnCC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledColorPickerPopup","exports","styled","div"],"sources":["../../../../src/components/color-picker-popup/ColorPickerPopup.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledColorPickerPopup = styled.div`\n width: 320px;\n padding: 11px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAGE,yBAAM,CAACC,GAAG;AAChD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -9,8 +9,8 @@ var _ColorArea = require("./ColorArea.styles");
|
|
|
9
9
|
var _colors = require("@chayns/colors");
|
|
10
10
|
var _chaynsApi = require("chayns-api");
|
|
11
11
|
var _framerMotion = require("framer-motion");
|
|
12
|
-
var _color = require("
|
|
13
|
-
var _ColorPickerProvider = require("
|
|
12
|
+
var _color = require("../../../utils/color");
|
|
13
|
+
var _ColorPickerProvider = require("../../ColorPickerProvider");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const ColorArea = () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorArea.js","names":["_react","_interopRequireWildcard","require","_ColorArea","_colors","_chaynsApi","_framerMotion","_color","_ColorPickerProvider","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorArea","selectedColor","updateSelectedColor","updateIsPresetColor","isPresetColor","shouldGetCoordinates","updateShouldGetCoordinates","updateShouldCallOnSelect","hueColor","useContext","ColorPickerContext","opacity","setOpacity","useState","scale","setScale","scaleX","scaleY","isPresetColorRef","useRef","shouldGetCoordinatesRef","canDrag","canvasRef","pseudoRef","dragControls","useDragControls","x","useMotionValue","y","useEffect","current","extractRgbValues","canvas","rect","getBoundingClientRect","width","height","setColor","useCallback","xCord","yCord","color","getColorFromCoordinates","coordinates","_canvasRef$current","ctx","getContext","hsv","rgbToHsv","hex","hsvToHex","h","s","v","colorGradiant","createLinearGradient","addColorStop","fillStyle","fillRect","transparentGradiant","handleStartDrag","cords","getCoordinatesFromColor","tolerance","handleDrag","handleClick","event","left","top","target","clientX","clientY","handlePointerUp","setRefreshScrollEnabled","move","xCords","yCords","newXCords","newYCords","handleMouseMove","handleTouchMove","preventDefault","changedTouches","pageX","pageY","window","addEventListener","removeEventListener","useMemo","createElement","StyledColorArea","StyledColorAreaCanvas","ref","StyledColorAreaPseudo","onPointerDown","onClick","StyledMotionColorAreaPointer","drag","dragConstraints","style","dragElastic","dragMomentum","onDrag","displayName","_default","exports"],"sources":["../../../../../src/components/color-picker-popup/color-area/ColorArea.tsx"],"sourcesContent":["import React, {\n MouseEvent,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n StyledColorArea,\n StyledColorAreaCanvas,\n StyledColorAreaPseudo,\n StyledMotionColorAreaPointer,\n} from './ColorArea.styles';\n\nimport { hsvToHex } from '@chayns/colors';\nimport { setRefreshScrollEnabled } from 'chayns-api';\nimport { useDragControls, useMotionValue } from 'framer-motion';\nimport type { Scale } from '../../../types/colorPicker';\nimport {\n extractRgbValues,\n getColorFromCoordinates,\n getCoordinatesFromColor,\n rgbToHsv,\n} from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\n\nconst ColorArea = () => {\n const {\n selectedColor,\n updateSelectedColor,\n updateIsPresetColor,\n isPresetColor,\n shouldGetCoordinates,\n updateShouldGetCoordinates,\n updateShouldCallOnSelect,\n hueColor,\n } = useContext(ColorPickerContext);\n\n const [opacity, setOpacity] = useState<number>(1);\n const [scale, setScale] = useState<Scale>({ scaleX: 0, scaleY: 0 });\n\n const isPresetColorRef = useRef(false);\n const shouldGetCoordinatesRef = useRef(false);\n const canDrag = useRef(false);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n\n const dragControls = useDragControls();\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n useEffect(() => {\n isPresetColorRef.current = isPresetColor ?? false;\n }, [isPresetColor]);\n\n useEffect(() => {\n shouldGetCoordinatesRef.current = shouldGetCoordinates ?? true;\n }, [shouldGetCoordinates]);\n\n useEffect(() => {\n if (selectedColor) {\n const { a } = extractRgbValues(selectedColor);\n\n setOpacity(a);\n }\n }, [selectedColor]);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n\n if (!canvas) {\n return;\n }\n\n const rect = canvas.getBoundingClientRect();\n\n const scaleX = canvas.width / rect.width;\n const scaleY = canvas.height / rect.height;\n\n setScale({ scaleX, scaleY });\n }, []);\n\n const setColor = useCallback(() => {\n const xCord = x.get();\n const yCord = y.get();\n\n if (typeof updateSelectedColor === 'function') {\n const color = getColorFromCoordinates({\n coordinates: {\n x: xCord,\n y: yCord,\n },\n canvas: canvasRef,\n opacity,\n scale,\n });\n\n if (color === 'transparent') {\n return;\n }\n\n updateSelectedColor(color);\n }\n }, [opacity, scale, updateSelectedColor, x, y]);\n\n useEffect(() => {\n const ctx = canvasRef.current?.getContext('2d');\n\n if (!ctx) {\n return;\n }\n\n const hsv = rgbToHsv(hueColor);\n\n const hex = hsvToHex({ h: hsv?.h ?? 1, s: 1, v: 1 });\n\n const colorGradiant = ctx.createLinearGradient(0, 0, 300, 0);\n colorGradiant.addColorStop(0, '#fff');\n colorGradiant.addColorStop(1, hex ?? 'red');\n\n ctx.fillStyle = colorGradiant;\n ctx.fillRect(0, 0, 300, 150);\n\n const transparentGradiant = ctx.createLinearGradient(0, 0, 0, 150);\n\n transparentGradiant.addColorStop(0, 'transparent');\n transparentGradiant.addColorStop(1, '#000');\n\n ctx.fillStyle = transparentGradiant;\n ctx.fillRect(0, 0, 300, 150);\n\n if (isPresetColorRef.current) {\n if (typeof updateIsPresetColor === 'function') {\n updateIsPresetColor(false);\n }\n\n return;\n }\n\n setColor();\n }, [hueColor, setColor, updateIsPresetColor]);\n\n const handleStartDrag = useCallback(() => {\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(false);\n }\n\n canDrag.current = true;\n }, [updateShouldGetCoordinates]);\n\n useEffect(() => {\n if (selectedColor && shouldGetCoordinatesRef.current) {\n const cords = getCoordinatesFromColor({\n color: selectedColor,\n canvas: canvasRef,\n tolerance: 10,\n });\n\n if (cords) {\n x.set(cords.x);\n y.set(cords.y);\n }\n }\n }, [selectedColor, x, y]);\n\n const handleDrag = useCallback(() => {\n setColor();\n }, [setColor]);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(false);\n }\n\n const { left, top } = (event.target as HTMLDivElement).getBoundingClientRect();\n\n x.set(event.clientX - left - 10);\n y.set(event.clientY - top - 10);\n\n setColor();\n },\n [setColor, updateShouldGetCoordinates, x, y],\n );\n\n const handlePointerUp = useCallback(() => {\n canDrag.current = false;\n\n void setRefreshScrollEnabled(true);\n\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(true);\n }\n\n if (typeof updateShouldCallOnSelect === 'function') {\n updateShouldCallOnSelect(true);\n }\n }, [updateShouldCallOnSelect, updateShouldGetCoordinates]);\n\n const move = useCallback(\n (xCords: number, yCords: number) => {\n let newXCords = xCords;\n let newYCords = yCords;\n\n switch (true) {\n case xCords > 300:\n newXCords = 300;\n break;\n case xCords < 0:\n newXCords = 0;\n break;\n default:\n break;\n }\n\n switch (true) {\n case yCords > 150:\n newYCords = 150;\n break;\n case yCords < 0:\n newYCords = 0;\n break;\n default:\n break;\n }\n\n x.set(newXCords);\n y.set(newYCords);\n\n setColor();\n },\n [setColor, x, y],\n );\n\n const handleMouseMove = useCallback(\n (event: MouseEvent) => {\n if (canDrag.current && pseudoRef.current) {\n const { left, top } = pseudoRef.current.getBoundingClientRect();\n\n const xCords = event.clientX - left - 10;\n const yCords = event.clientY - top - 10;\n\n move(xCords, yCords);\n }\n },\n [move],\n );\n\n const handleTouchMove = useCallback(\n (event: TouchEvent) => {\n if (canDrag.current && pseudoRef.current) {\n event.preventDefault();\n\n void setRefreshScrollEnabled(false);\n\n const { left, top } = pseudoRef.current.getBoundingClientRect();\n\n const xCords = event.changedTouches[0]\n ? event.changedTouches[0].clientX - left - 10\n : (event as unknown as { pageX: number }).pageX;\n const yCords = event.changedTouches[0]\n ? event.changedTouches[0].clientY - top - 10\n : (event as unknown as { pageY: number }).pageY;\n\n move(xCords, yCords);\n }\n },\n [move],\n );\n\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('pointerup', handlePointerUp);\n window.addEventListener('touchmove', handleTouchMove);\n window.addEventListener('touchend', handlePointerUp);\n\n return () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('pointerup', handlePointerUp);\n window.removeEventListener('touchmove', handleTouchMove);\n window.removeEventListener('touchend', handlePointerUp);\n };\n }, [handleMouseMove, handlePointerUp, handleTouchMove]);\n\n return useMemo(\n () => (\n <StyledColorArea>\n <StyledColorAreaCanvas ref={canvasRef} />\n <StyledColorAreaPseudo\n ref={pseudoRef}\n onPointerDown={handleStartDrag}\n onClick={handleClick}\n >\n <StyledMotionColorAreaPointer\n drag\n dragConstraints={pseudoRef}\n style={{ x, y }}\n dragElastic={false}\n dragMomentum={false}\n dragControls={dragControls}\n onDrag={handleDrag}\n />\n </StyledColorAreaPseudo>\n </StyledColorArea>\n ),\n [dragControls, handleClick, handleDrag, handleStartDrag, x, y],\n );\n};\n\nColorArea.displayName = 'ColorArea';\n\nexport default ColorArea;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,UAAA,GAAAD,OAAA;AAOA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAMA,IAAAM,oBAAA,GAAAN,OAAA;AAA+D,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CA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EAEvD,OAAO,IAAAQ,cAAO,EACV,mBACIrH,MAAA,CAAAe,OAAA,CAAAuG,aAAA,CAACnH,UAAA,CAAAoH,eAAe,qBACZvH,MAAA,CAAAe,OAAA,CAAAuG,aAAA,CAACnH,UAAA,CAAAqH,qBAAqB;IAACC,GAAG,EAAEtE;EAAU,CAAE,CAAC,eACzCnD,MAAA,CAAAe,OAAA,CAAAuG,aAAA,CAACnH,UAAA,CAAAuH,qBAAqB;IAClBD,GAAG,EAAErE,SAAU;IACfuE,aAAa,EAAElC,eAAgB;IAC/BmC,OAAO,EAAE9B;EAAY,gBAErB9F,MAAA,CAAAe,OAAA,CAAAuG,aAAA,CAACnH,UAAA,CAAA0H,4BAA4B;IACzBC,IAAI;IACJC,eAAe,EAAE3E,SAAU;IAC3B4E,KAAK,EAAE;MAAEzE,CAAC;MAAEE;IAAE,CAAE;IAChBwE,WAAW,EAAE,KAAM;IACnBC,YAAY,EAAE,KAAM;IACpB7E,YAAY,EAAEA,YAAa;IAC3B8E,MAAM,EAAEtC;EAAW,CACtB,CACkB,CACV,CACpB,EACD,CAACxC,YAAY,EAAEyC,WAAW,EAAED,UAAU,EAAEJ,eAAe,EAAElC,CAAC,EAAEE,CAAC,CACjE,CAAC;AACL,CAAC;AAED5B,SAAS,CAACuG,WAAW,GAAG,WAAW;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvH,OAAA,GAErBc,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorArea.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledColorArea","exports","styled","div","StyledColorAreaCanvas","canvas","StyledColorAreaPseudo","StyledMotionColorAreaPointer","motion"],"sources":["../../../../../src/components/color-picker-popup/color-area/ColorArea.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledColorArea = styled.div`\n height: 150px;\n width: 300px;\n position: relative;\n user-select: none;\n overflow: hidden;\n cursor: crosshair;\n`;\n\nexport const StyledColorAreaCanvas = styled.canvas`\n user-select: none;\n`;\n\nexport const StyledColorAreaPseudo = styled.div`\n position: absolute;\n top: -10px;\n left: -10px;\n touch-action: none;\n user-select: none;\n\n height: 170px;\n width: 320px;\n`;\n\nexport const StyledMotionColorAreaPointer = styled(motion.div)`\n position: absolute;\n border-radius: 100%;\n border: 2px solid white;\n width: 20px;\n height: 20px;\n box-shadow:\n 0 0 5px 0 rgba(0, 0, 0, 0.5),\n 0 0 3px 0 rgba(0, 0, 0, 0.5) inset;\n pointer-events: none;\n user-select: none;\n top: 0;\n left: 0;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,yBAAM,CAACC,GAAG;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,GAAGF,yBAAM,CAACG,MAAM;AAClD;AACA,CAAC;AAEM,MAAMC,qBAAqB,GAAAL,OAAA,CAAAK,qBAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMI,4BAA4B,GAAAN,OAAA,CAAAM,4BAAA,GAAG,IAAAL,yBAAM,EAACM,oBAAM,CAACL,GAAG,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -7,8 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _core = require("@chayns-components/core");
|
|
8
8
|
var _colors = require("@chayns/colors");
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _color = require("
|
|
11
|
-
var _ColorPickerProvider = require("
|
|
10
|
+
var _color = require("../../../utils/color");
|
|
11
|
+
var _ColorPickerProvider = require("../../ColorPickerProvider");
|
|
12
12
|
var _MoreOptions = require("./MoreOptions.styles");
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoreOptions.js","names":["_core","require","_colors","_react","_interopRequireWildcard","_color","_ColorPickerProvider","_MoreOptions","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MoreOptions","selectedColor","updateSelectedColor","updateShouldCallOnSelect","useContext","ColorPickerContext","areaProvider","AreaContext","tmpHexValue","setTmpHexValue","useState","tmpRgbValue","setTmpRgbValue","isHexInvalid","setIsHexInvalid","isRgbInvalid","setIsRgbInvalid","shouldChangeColor","useMemo","handleHexChange","event","target","value","isValid","isHex","g","b","hexToRgb","handleRgbChange","isValidRGBA","useEffect","rgbToHex","extractRgbValues","createElement","StyledMoreOptions","AccordionGroup","isWrapped","Accordion","title","StyledMoreOptionsInputWrapper","StyledMoreOptionsInput","$shouldChangeColor","onChange","$isInvalid","displayName","_default","exports"],"sources":["../../../../../src/components/color-picker-popup/more-options/MoreOptions.tsx"],"sourcesContent":["import { Accordion, AccordionGroup, AreaContext } from '@chayns-components/core';\nimport { isHex } from '@chayns/colors';\nimport React, { useContext, useEffect, useMemo, useState, type ChangeEvent } from 'react';\n\nimport { extractRgbValues, hexToRgb, isValidRGBA, rgbToHex } from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport {\n StyledMoreOptions,\n StyledMoreOptionsInput,\n StyledMoreOptionsInputWrapper,\n} from './MoreOptions.styles';\n\nconst MoreOptions = () => {\n const { selectedColor, updateSelectedColor, updateShouldCallOnSelect } =\n useContext(ColorPickerContext);\n const areaProvider = useContext(AreaContext);\n\n const [tmpHexValue, setTmpHexValue] = useState('');\n const [tmpRgbValue, setTmpRgbValue] = useState('');\n const [isHexInvalid, setIsHexInvalid] = useState(false);\n const [isRgbInvalid, setIsRgbInvalid] = useState(false);\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\n );\n\n const handleHexChange = (event: ChangeEvent<HTMLInputElement>) => {\n setTmpHexValue(event.target.value);\n\n const isValid = isHex(event.target.value);\n\n setIsHexInvalid(!isValid);\n\n if (typeof updateSelectedColor === 'function' && isValid) {\n const { r, g, b, a } = hexToRgb(event.target.value);\n\n updateSelectedColor(`rgba(${r},${g},${b},${a})`);\n }\n\n if (typeof updateShouldCallOnSelect === 'function' && isValid) {\n updateShouldCallOnSelect(true);\n }\n };\n\n const handleRgbChange = (event: ChangeEvent<HTMLInputElement>) => {\n setTmpRgbValue(event.target.value);\n\n const isValid = isValidRGBA(event.target.value);\n\n setIsRgbInvalid(!isValid);\n\n if (typeof updateSelectedColor === 'function' && isValid) {\n updateSelectedColor(event.target.value);\n }\n\n if (typeof updateShouldCallOnSelect === 'function' && isValid) {\n updateShouldCallOnSelect(true);\n }\n };\n\n useEffect(() => {\n if (selectedColor) {\n setTmpRgbValue(selectedColor);\n setTmpHexValue(rgbToHex(extractRgbValues(selectedColor ?? '')));\n }\n }, [selectedColor]);\n\n return (\n <StyledMoreOptions>\n <AccordionGroup isWrapped>\n <Accordion title=\"Erweitert\">\n <StyledMoreOptionsInputWrapper>\n <StyledMoreOptionsInput\n $shouldChangeColor={shouldChangeColor}\n value={tmpHexValue}\n onChange={handleHexChange}\n $isInvalid={isHexInvalid}\n />\n <StyledMoreOptionsInput\n $shouldChangeColor={shouldChangeColor}\n value={tmpRgbValue}\n onChange={handleRgbChange}\n $isInvalid={isRgbInvalid}\n />\n </StyledMoreOptionsInputWrapper>\n </Accordion>\n </AccordionGroup>\n </StyledMoreOptions>\n );\n};\n\nMoreOptions.displayName = 'MoreOptions';\n\nexport default MoreOptions;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAI8B,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,M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,CAAC,CAAC;IACnE;EACJ,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC;EAEnB,oBACI1B,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACtD,YAAA,CAAAuD,iBAAiB,qBACd3D,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAAC7D,KAAA,CAAA+D,cAAc;IAACC,SAAS;EAAA,gBACrB7D,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAAC7D,KAAA,CAAAiE,SAAS;IAACC,KAAK,EAAC;EAAW,gBACxB/D,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACtD,YAAA,CAAA4D,6BAA6B,qBAC1BhE,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACtD,YAAA,CAAA6D,sBAAsB;IACnBC,kBAAkB,EAAExB,iBAAkB;IACtCK,KAAK,EAAEd,WAAY;IACnBkC,QAAQ,EAAEvB,eAAgB;IAC1BwB,UAAU,EAAE9B;EAAa,CAC5B,CAAC,eACFtC,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACtD,YAAA,CAAA6D,sBAAsB;IACnBC,kBAAkB,EAAExB,iBAAkB;IACtCK,KAAK,EAAEX,WAAY;IACnB+B,QAAQ,EAAEd,eAAgB;IAC1Be,UAAU,EAAE5B;EAAa,CAC5B,CAC0B,CACxB,CACC,CACD,CAAC;AAE5B,CAAC;AAEDf,WAAW,CAAC4C,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEzBc,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoreOptions.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledMoreOptions","exports","styled","div","StyledMoreOptionsInputWrapper","StyledMoreOptionsInput","input","theme","$isInvalid","wrong","$shouldChangeColor","colorMode","text"],"sources":["../../../../../src/components/color-picker-popup/more-options/MoreOptions.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\nexport const StyledMoreOptions = styled.div``;\nexport const StyledMoreOptionsInputWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 8px;\n align-items: center;\n`;\n\ntype StyledMoreOptionsInputProps = WithTheme<{ $isInvalid: boolean; $shouldChangeColor: boolean }>;\n\nexport const StyledMoreOptionsInput = styled.input<StyledMoreOptionsInputProps>`\n width: 100%;\n border-radius: 3px;\n border: 1px solid\n ${({ theme, $isInvalid }: StyledMoreOptionsInputProps) =>\n $isInvalid ? theme.wrong : 'rgba(160, 160, 160, 0.3)'};\n background-color: ${({ theme, $shouldChangeColor }: StyledMoreOptionsInputProps) =>\n theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']};\n color: ${({ theme, $isInvalid }: StyledMoreOptionsInputProps) =>\n $isInvalid ? theme.wrong : theme.text};\n padding: 8px 10px;\n font-size: 11px;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAGE,yBAAM,CAACC,GAAG,EAAE;AACtC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GAAGF,yBAAM,CAACC,GAAG;AACvD;AACA;AACA;AACA;AACA,CAAC;AAIM,MAAME,sBAAsB,GAAAJ,OAAA,CAAAI,sBAAA,GAAGH,yBAAM,CAACI,KAAkC;AAC/E;AACA;AACA;AACA,UAAU,CAAC;EAAEC,KAAK;EAAEC;AAAwC,CAAC,KACjDA,UAAU,GAAGD,KAAK,CAACE,KAAK,GAAG,0BAA0B;AACjE,wBAAwB,CAAC;EAAEF,KAAK;EAAEG;AAAgD,CAAC,KAC3EH,KAAK,CAACI,SAAS,KAAK,SAAS,IAAID,kBAAkB,GAAGH,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAAC,KAAK,CAAC;AACzF,aAAa,CAAC;EAAEA,KAAK;EAAEC;AAAwC,CAAC,KACxDA,UAAU,GAAGD,KAAK,CAACE,KAAK,GAAGF,KAAK,CAACK,IAAI;AAC7C;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _colors = require("@chayns/colors");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _color = require("
|
|
10
|
-
var _color2 = require("
|
|
11
|
-
var _ColorPickerProvider = require("
|
|
9
|
+
var _color = require("../../../constants/color");
|
|
10
|
+
var _color2 = require("../../../utils/color");
|
|
11
|
+
var _ColorPickerProvider = require("../../ColorPickerProvider");
|
|
12
12
|
var _PresetButton = _interopRequireDefault(require("./preset-button/PresetButton"));
|
|
13
13
|
var _PresetColor = _interopRequireDefault(require("./preset-color/PresetColor"));
|
|
14
14
|
var _PresetColors = require("./PresetColors.styles");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetColors.js","names":["_colors","require","_react","_interopRequireWildcard","_color","_color2","_ColorPickerProvider","_PresetButton","_interopRequireDefault","_PresetColor","_PresetColors","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","PresetColors","presetColors","onPresetColorRemove","onPresetColorAdd","selectedColor","useContext","ColorPickerContext","combinedColors","useMemo","tmp","map","color","isCustom","id","newColor","isHex","g","b","hexToRgb","PRESETCOLORS","content","items","forEach","push","createElement","key","currentPresetColor","find","StyledPresetColors","onAdd","onRemove","displayName","_default","exports"],"sources":["../../../../../src/components/color-picker-popup/preset-colors/PresetColors.tsx"],"sourcesContent":["import { isHex } from '@chayns/colors';\nimport React, { useContext, useMemo, type ReactElement } from 'react';\n\nimport { PRESETCOLORS } from '../../../constants/color';\nimport type { IPresetColor } from '../../../types/colorPicker';\nimport { hexToRgb } from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport PresetButton from './preset-button/PresetButton';\nimport PresetColor from './preset-color/PresetColor';\nimport { StyledPresetColors } from './PresetColors.styles';\n\ninterface PresetColorsProps {\n presetColors?: IPresetColor[];\n onPresetColorAdd?: (presetColor: IPresetColor) => void;\n onPresetColorRemove?: (presetColorId: IPresetColor['id']) => void;\n}\n\nconst PresetColors = ({\n presetColors,\n onPresetColorRemove,\n onPresetColorAdd,\n}: PresetColorsProps) => {\n const { selectedColor } = useContext(ColorPickerContext);\n\n const combinedColors = useMemo(() => {\n const tmp = (presetColors ?? []).map(({ color, isCustom, id }) => {\n let newColor = color;\n\n if (isHex(color)) {\n const { r, g, b, a } = hexToRgb(color);\n\n newColor = `rgba(${r},${g},${b},${a})`;\n }\n\n return {\n id,\n isCustom,\n color: newColor,\n };\n });\n\n return [...PRESETCOLORS, ...tmp];\n }, [presetColors]);\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n combinedColors.forEach(({ color, id }) => {\n items.push(<PresetColor key={`preset-color__${id}`} color={color} />);\n });\n\n return items;\n }, [combinedColors]);\n\n const currentPresetColor = useMemo(\n () => combinedColors.find(({ color }) => color === selectedColor),\n [combinedColors, selectedColor],\n );\n\n return (\n <StyledPresetColors>\n {content}\n <PresetButton\n id={currentPresetColor?.id}\n isCustom={currentPresetColor?.isCustom}\n onAdd={onPresetColorAdd}\n onRemove={onPresetColorRemove}\n />\n </StyledPresetColors>\n );\n};\n\nPresetColors.displayName = 'PresetColors';\n\nexport default PresetColors;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAA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,CAAC;IACzE,CAAC,CAAC;IAEF,OAAOU,KAAK;EAChB,CAAC,EAAE,CAACd,cAAc,CAAC,CAAC;EAEpB,MAAMmB,kBAAkB,GAAG,IAAAlB,cAAO,EAC9B,MAAMD,cAAc,CAACoB,IAAI,CAAC,CAAC;IAAEhB;EAAM,CAAC,KAAKA,KAAK,KAAKP,aAAa,CAAC,EACjE,CAACG,cAAc,EAAEH,aAAa,CAClC,CAAC;EAED,oBACIjC,MAAA,CAAAW,OAAA,CAAA0C,aAAA,CAAC7C,aAAA,CAAAiD,kBAAkB,QACdR,OAAO,eACRjD,MAAA,CAAAW,OAAA,CAAA0C,aAAA,CAAChD,aAAA,CAAAM,OAAY;IACT+B,EAAE,EAAEa,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAEb,EAAG;IAC3BD,QAAQ,EAAEc,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAEd,QAAS;IACvCiB,KAAK,EAAE1B,gBAAiB;IACxB2B,QAAQ,EAAE5B;EAAoB,CACjC,CACe,CAAC;AAE7B,CAAC;AAEDF,YAAY,CAAC+B,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAE3BkB,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetColors.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledPresetColors","exports","styled","div"],"sources":["../../../../../src/components/color-picker-popup/preset-colors/PresetColors.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledPresetColors = styled.div`\n display: flex;\n flex-wrap: wrap;\n\n gap: 6px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC5C;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _core = require("@chayns-components/core");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
|
-
var _ColorPickerProvider = require("
|
|
10
|
+
var _ColorPickerProvider = require("../../../ColorPickerProvider");
|
|
11
11
|
var _PresetButton = require("./PresetButton.styles");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetButton.js","names":["_core","require","_react","_interopRequireWildcard","_uuid","_ColorPickerProvider","_PresetButton","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","PresetButton","id","isCustom","onRemove","onAdd","selectedColor","useContext","ColorPickerContext","icon","handleClick","color","uuidv4","createElement","StyledPresetButton","onClick","$isDisabled","Icon","icons","size","displayName","_default","exports"],"sources":["../../../../../../src/components/color-picker-popup/preset-colors/preset-button/PresetButton.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport React, { useContext } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport type { IPresetColor } from '../../../../types/colorPicker';\nimport { ColorPickerContext } from '../../../ColorPickerProvider';\nimport { StyledPresetButton } from './PresetButton.styles';\n\ninterface PresetButtonProps {\n id?: IPresetColor['id'];\n isCustom?: IPresetColor['isCustom'];\n onAdd?: (color: IPresetColor) => void;\n onRemove?: (id: IPresetColor['id']) => void;\n}\n\nconst PresetButton = ({ id, isCustom, onRemove, onAdd }: PresetButtonProps) => {\n const { selectedColor } = useContext(ColorPickerContext);\n\n const icon = isCustom ? ['fa-solid fa-trash'] : ['fa-solid fa-plus'];\n\n const handleClick = () => {\n if (id) {\n if (typeof onRemove === 'function') {\n onRemove(id);\n }\n } else if (typeof onAdd === 'function' && selectedColor) {\n onAdd({ color: selectedColor, isCustom: true, id: uuidv4() });\n }\n };\n\n return (\n <StyledPresetButton onClick={handleClick} $isDisabled={!!id && !isCustom}>\n <Icon icons={icon} size={isCustom ? 10 : 15} />\n </StyledPresetButton>\n );\n};\n\nPresetButton.displayName = 'PresetButton';\n\nexport default PresetButton;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAA2D,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAA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M,KAAK,EAAEL,aAAa;QAAEH,QAAQ,EAAE,IAAI;QAAED,EAAE,EAAE,IAAAU,QAAM,EAAC;MAAE,CAAC,CAAC;IACjE;EACJ,CAAC;EAED,oBACIpC,MAAA,CAAAW,OAAA,CAAA0B,aAAA,CAACjC,aAAA,CAAAkC,kBAAkB;IAACC,OAAO,EAAEL,WAAY;IAACM,WAAW,EAAE,CAAC,CAACd,EAAE,IAAI,CAACC;EAAS,gBACrE3B,MAAA,CAAAW,OAAA,CAAA0B,aAAA,CAACvC,KAAA,CAAA2C,IAAI;IAACC,KAAK,EAAET,IAAK;IAACU,IAAI,EAAEhB,QAAQ,GAAG,EAAE,GAAG;EAAG,CAAE,CAC9B,CAAC;AAE7B,CAAC;AAEDF,YAAY,CAACmB,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnC,OAAA,GAE3Bc,YAAY","ignoreList":[]}
|
package/lib/cjs/components/color-picker-popup/preset-colors/preset-button/PresetButton.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetButton.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledPresetButton","exports","styled","div","$isDisabled"],"sources":["../../../../../../src/components/color-picker-popup/preset-colors/preset-button/PresetButton.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledPresetButtonProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledPresetButton = styled.div<StyledPresetButtonProps>`\n display: flex;\n align-items: center;\n justify-content: center;\n\n background-color: transparent;\n width: 22px;\n aspect-ratio: 1;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'normal' : 'pointer')};\n\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n\n border-radius: 50px;\n border: 1px solid rgba(160, 160, 160, 0.3);\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAA4B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAAY,CAAC,KAAMA,WAAW,GAAG,QAAQ,GAAG,SAAU;AACvE;AACA,eAAe,CAAC;EAAEA;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ColorPickerProvider = require("
|
|
8
|
+
var _ColorPickerProvider = require("../../../ColorPickerProvider");
|
|
9
9
|
var _PresetColor = require("./PresetColor.styles");
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetColor.js","names":["_react","_interopRequireWildcard","require","_ColorPickerProvider","_PresetColor","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","PresetColor","color","selectedColor","updateSelectedColor","updateHueColor","updateShouldCallOnSelect","updateShouldGetCoordinates","updateIsPresetColor","useContext","ColorPickerContext","isSelected","useMemo","handleClick","createElement","StyledPresetColor","onClick","$isSelected","StyledPresetColorBackground","StyledPresetColorColor","$color","displayName","_default","exports"],"sources":["../../../../../../src/components/color-picker-popup/preset-colors/preset-color/PresetColor.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react';\n\nimport type { IPresetColor } from '../../../../types/colorPicker';\nimport { ColorPickerContext } from '../../../ColorPickerProvider';\nimport {\n StyledPresetColor,\n StyledPresetColorBackground,\n StyledPresetColorColor,\n} from './PresetColor.styles';\n\ninterface PresetColorProps {\n color: IPresetColor['color'];\n}\n\nconst PresetColor = ({ color }: PresetColorProps) => {\n const {\n selectedColor,\n updateSelectedColor,\n updateHueColor,\n updateShouldCallOnSelect,\n updateShouldGetCoordinates,\n updateIsPresetColor,\n } = useContext(ColorPickerContext);\n\n const isSelected = useMemo(() => selectedColor === color, [color, selectedColor]);\n\n const handleClick = () => {\n if (typeof updateSelectedColor === 'function') {\n updateSelectedColor(color);\n }\n\n if (typeof updateHueColor === 'function') {\n updateHueColor(color);\n }\n\n if (typeof updateIsPresetColor === 'function') {\n updateIsPresetColor(true);\n }\n\n if (typeof updateShouldCallOnSelect === 'function') {\n updateShouldCallOnSelect(true);\n }\n\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(true);\n }\n };\n\n return (\n <StyledPresetColor onClick={handleClick} $isSelected={isSelected}>\n <StyledPresetColorBackground />\n <StyledPresetColorColor $color={color} />\n </StyledPresetColor>\n );\n};\n\nPresetColor.displayName = 'PresetColor';\n\nexport default PresetColor;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;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PresetColor.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledPresetColor","exports","styled","div","$isSelected","StyledPresetColorColor","$color","StyledPresetColorBackground"],"sources":["../../../../../../src/components/color-picker-popup/preset-colors/preset-color/PresetColor.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledPresetColorProps = WithTheme<{ $isSelected?: boolean }>;\n\nexport const StyledPresetColor = styled.div<StyledPresetColorProps>`\n width: 22px;\n aspect-ratio: 1;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n border-radius: 50px;\n border: ${({ $isSelected }) =>\n $isSelected ? '2px solid rgba(255, 255, 255, 1)' : '1px solid rgba(160, 160, 160, 0.3)'};\n`;\n\ntype StyledPresetColorColorProps = WithTheme<{ $color: string; $isSelected?: boolean }>;\n\nexport const StyledPresetColorColor = styled.div<StyledPresetColorColorProps>`\n background-color: ${({ $color }) => $color};\n height: 100%;\n width: 100%;\n position: absolute;\n`;\n\nexport const StyledPresetColorBackground = styled.div`\n position: absolute;\n background-color: #fff;\n background-image: linear-gradient(45deg, #a0a0a0 25%, #0000 0),\n linear-gradient(-45deg, #a0a0a0 25%, #0000 0), linear-gradient(45deg, #0000 75%, #a0a0a0 0),\n linear-gradient(-45deg, #0000 75%, #a0a0a0 0);\n background-position:\n 0 0,\n 0 4px,\n 4px -4px,\n -4px 0;\n background-repeat: repeat;\n background-size: 8px 8px;\n height: 100%;\n width: 100%;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhC,MAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAGE,yBAAM,CAACC,GAA2B;AACnE;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAAY,CAAC,KACtBA,WAAW,GAAG,kCAAkC,GAAG,oCAAoC;AAC/F,CAAC;AAIM,MAAMC,sBAAsB,GAAAJ,OAAA,CAAAI,sBAAA,GAAGH,yBAAM,CAACC,GAAgC;AAC7E,wBAAwB,CAAC;EAAEG;AAAO,CAAC,KAAKA,MAAM;AAC9C;AACA;AACA;AACA,CAAC;AAEM,MAAMC,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAGL,yBAAM,CAACC,GAAG;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _color = require("
|
|
9
|
-
var _ColorPickerProvider = require("
|
|
10
|
-
var _HueSlider = _interopRequireDefault(require("
|
|
11
|
-
var _TransparencySlider = _interopRequireDefault(require("
|
|
8
|
+
var _color = require("../../../utils/color");
|
|
9
|
+
var _ColorPickerProvider = require("../../ColorPickerProvider");
|
|
10
|
+
var _HueSlider = _interopRequireDefault(require("../../hue-slider/HueSlider"));
|
|
11
|
+
var _TransparencySlider = _interopRequireDefault(require("../../transparency-slider/TransparencySlider"));
|
|
12
12
|
var _ColorPreview = _interopRequireDefault(require("./color-preview/ColorPreview"));
|
|
13
13
|
var _Sliders = require("./Sliders.styles");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sliders.js","names":["_react","_interopRequireWildcard","require","_color","_ColorPickerProvider","_HueSlider","_interopRequireDefault","_TransparencySlider","_ColorPreview","_Sliders","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Sliders","shouldShowTransparencySlider","selectedColor","updateSelectedColor","updateHueColor","updateShouldGetCoordinates","updateShouldCallOnSelect","hueColor","useContext","ColorPickerContext","handleColorChange","color","handleHueColorChange","handleStart","handleEnd","opacity","useMemo","extractRgbValues","createElement","StyledSliders","StyledSlidersWrapper","onEnd","onStart","onChange","displayName","_default","exports"],"sources":["
|
|
1
|
+
{"version":3,"file":"Sliders.js","names":["_react","_interopRequireWildcard","require","_color","_ColorPickerProvider","_HueSlider","_interopRequireDefault","_TransparencySlider","_ColorPreview","_Sliders","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Sliders","shouldShowTransparencySlider","selectedColor","updateSelectedColor","updateHueColor","updateShouldGetCoordinates","updateShouldCallOnSelect","hueColor","useContext","ColorPickerContext","handleColorChange","color","handleHueColorChange","handleStart","handleEnd","opacity","useMemo","extractRgbValues","createElement","StyledSliders","StyledSlidersWrapper","onEnd","onStart","onChange","displayName","_default","exports"],"sources":["../../../../../src/components/color-picker-popup/sliders/Sliders.tsx"],"sourcesContent":["import React, { useContext, useMemo, type CSSProperties } from 'react';\nimport { extractRgbValues } from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport HueSlider from '../../hue-slider/HueSlider';\nimport TransparencySlider from '../../transparency-slider/TransparencySlider';\nimport ColorPreview from './color-preview/ColorPreview';\nimport { StyledSliders, StyledSlidersWrapper } from './Sliders.styles';\n\ninterface SlidersProps {\n shouldShowTransparencySlider: boolean;\n}\n\nconst Sliders = ({ shouldShowTransparencySlider }: SlidersProps) => {\n const {\n selectedColor,\n updateSelectedColor,\n updateHueColor,\n updateShouldGetCoordinates,\n updateShouldCallOnSelect,\n hueColor,\n } = useContext(ColorPickerContext);\n\n const handleColorChange = (color: CSSProperties['color']) => {\n if (typeof updateSelectedColor === 'function' && color) {\n updateSelectedColor(color);\n }\n };\n\n const handleHueColorChange = (color: CSSProperties['color']) => {\n if (typeof updateHueColor === 'function' && color) {\n updateHueColor(color);\n }\n };\n\n const handleStart = () => {\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(false);\n }\n };\n\n const handleEnd = () => {\n if (\n typeof updateShouldGetCoordinates === 'function' &&\n typeof updateShouldCallOnSelect === 'function'\n ) {\n updateShouldGetCoordinates(true);\n updateShouldCallOnSelect(true);\n }\n };\n\n const opacity = useMemo(() => extractRgbValues(selectedColor ?? '').a, [selectedColor]);\n\n return (\n <StyledSliders>\n <StyledSlidersWrapper>\n <HueSlider\n color={hueColor}\n opacity={opacity}\n onEnd={handleEnd}\n onStart={handleStart}\n onChange={handleHueColorChange}\n />\n {shouldShowTransparencySlider && (\n <TransparencySlider\n color={selectedColor}\n onEnd={handleEnd}\n onStart={handleStart}\n onChange={handleColorChange}\n />\n )}\n </StyledSlidersWrapper>\n <ColorPreview />\n </StyledSliders>\n );\n};\n\nSliders.displayName = 'Sliders';\n\nexport default Sliders;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,aAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAuE,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CA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,CAACxC,aAAA,CAAAI,OAAY,MAAE,CACJ,CAAC;AAExB,CAAC;AAEDkB,OAAO,CAACwB,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEjBkB,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sliders.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledSliders","exports","styled","div","StyledSlidersWrapper"],"sources":["../../../../../src/components/color-picker-popup/sliders/Sliders.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledSliders = styled.div`\n display: flex;\n gap: 16px;\n align-items: center;\n height: 60px;\n`;\nexport const StyledSlidersWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,yBAAM,CAACC,GAAG;AACvC;AACA;AACA;AACA;AACA,CAAC;AACM,MAAMC,oBAAoB,GAAAH,OAAA,CAAAG,oBAAA,GAAGF,yBAAM,CAACC,GAAG;AAC9C;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ColorPickerProvider = require("
|
|
8
|
+
var _ColorPickerProvider = require("../../../ColorPickerProvider");
|
|
9
9
|
var _ColorPreview = require("./ColorPreview.styles");
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPreview.js","names":["_react","_interopRequireWildcard","require","_ColorPickerProvider","_ColorPreview","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorPreview","selectedColor","useContext","ColorPickerContext","createElement","StyledColorPreview","StyledColorPreviewColor","$color","displayName","_default","exports"],"sources":["../../../../../../src/components/color-picker-popup/sliders/color-preview/ColorPreview.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { ColorPickerContext } from '../../../ColorPickerProvider';\nimport { StyledColorPreview, StyledColorPreviewColor } from './ColorPreview.styles';\n\nconst ColorPreview = () => {\n const { selectedColor } = useContext(ColorPickerContext);\n\n return (\n <StyledColorPreview>\n <StyledColorPreviewColor $color={selectedColor} />\n </StyledColorPreview>\n );\n};\n\nColorPreview.displayName = 'ColorPreview';\n\nexport default ColorPreview;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAAoF,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,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jC,CAAC;AAE7B,CAAC;AAEDD,YAAY,CAACQ,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAE3Bc,YAAY","ignoreList":[]}
|
package/lib/cjs/components/color-picker-popup/sliders/color-preview/ColorPreview.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPreview.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledColorPreview","exports","styled","div","StyledColorPreviewBackground","StyledColorPreviewColor","attrs","$color","theme","style","backgroundColor","border","text"],"sources":["../../../../../../src/components/color-picker-popup/sliders/color-preview/ColorPreview.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport type { Theme } from '@chayns-components/core/lib/types/components/color-scheme-provider/ColorSchemeProvider';\nimport styled from 'styled-components';\n\nexport const StyledColorPreview = styled.div`\n width: 40px;\n aspect-ratio: 1;\n position: relative;\n\n border-radius: 2px;\n overflow: hidden;\n`;\n\nexport const StyledColorPreviewBackground = styled.div`\n position: absolute;\n background-color: #fff;\n background-image: linear-gradient(45deg, #a0a0a0 25%, #0000 0),\n linear-gradient(-45deg, #a0a0a0 25%, #0000 0), linear-gradient(45deg, #0000 75%, #a0a0a0 0),\n linear-gradient(-45deg, #0000 75%, #a0a0a0 0);\n background-position:\n 0 0,\n 0 4px,\n 4px -4px,\n -4px 0;\n background-repeat: repeat;\n background-size: 8px 8px;\n height: 100%;\n width: 100%;\n`;\n\ntype StyledColorPreviewColorProps = WithTheme<{ $color?: string }>;\n\nexport const StyledColorPreviewColor = styled.div.attrs<StyledColorPreviewColorProps>(\n ({ $color, theme }) => ({\n style: {\n backgroundColor: $color,\n border: `1px ${(theme as Theme).text} solid`,\n },\n }),\n)`\n height: 100%;\n width: 100%;\n position: absolute;\n`;\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,4BAA4B,GAAAH,OAAA,CAAAG,4BAAA,GAAGF,yBAAM,CAACC,GAAG;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAIM,MAAME,uBAAuB,GAAAJ,OAAA,CAAAI,uBAAA,GAAGH,yBAAM,CAACC,GAAG,CAACG,KAAK,CACnD,CAAC;EAAEC,MAAM;EAAEC;AAAM,CAAC,MAAM;EACpBC,KAAK,EAAE;IACHC,eAAe,EAAEH,MAAM;IACvBI,MAAM,EAAE,OAAQH,KAAK,CAAWI,IAAI;EACxC;AACJ,CAAC,CACL,CAAC;AACD;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Popup } from '@chayns-components/core';
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
|
+
import ColorPickerPopup from '../../color-picker-popup/ColorPickerPopup';
|
|
3
4
|
import { ColorPickerContext } from '../../ColorPickerProvider';
|
|
4
|
-
import ColorPickerPopup from './color-picker-popup/ColorPickerPopup';
|
|
5
5
|
import { StyledColorPickerWrapper, StyledColorPickerWrapperInfo, StyledColorPickerWrapperInfoColor, StyledColorPickerWrapperInfoColorBackground, StyledColorPickerWrapperInfoColorWrapper, StyledColorPickerWrapperInfoText } from './ColorPickerWrapper.styles';
|
|
6
6
|
const ColorPickerWrapper = _ref => {
|
|
7
7
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerWrapper.js","names":["Popup","React","useContext","useMemo","
|
|
1
|
+
{"version":3,"file":"ColorPickerWrapper.js","names":["Popup","React","useContext","useMemo","ColorPickerPopup","ColorPickerContext","StyledColorPickerWrapper","StyledColorPickerWrapperInfo","StyledColorPickerWrapperInfoColor","StyledColorPickerWrapperInfoColorBackground","StyledColorPickerWrapperInfoColorWrapper","StyledColorPickerWrapperInfoText","ColorPickerWrapper","_ref","presetColors","onPresetColorRemove","onPresetColorAdd","shouldShowPresetColors","shouldShowAsPopup","shouldShowTransparencySlider","shouldShowMoreOptions","shouldShowRoundPreviewColor","shouldShowPreviewColorString","selectedColor","content","createElement","$shouldShowRoundPreviewColor","$color","displayName"],"sources":["../../../../../src/components/color-picker/color-picker-wrapper/ColorPickerWrapper.tsx"],"sourcesContent":["import { Popup } from '@chayns-components/core';\nimport React, { useContext, useMemo } from 'react';\nimport type { IPresetColor } from '../../../types/colorPicker';\nimport ColorPickerPopup from '../../color-picker-popup/ColorPickerPopup';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport {\n StyledColorPickerWrapper,\n StyledColorPickerWrapperInfo,\n StyledColorPickerWrapperInfoColor,\n StyledColorPickerWrapperInfoColorBackground,\n StyledColorPickerWrapperInfoColorWrapper,\n StyledColorPickerWrapperInfoText,\n} from './ColorPickerWrapper.styles';\n\ninterface ColorPickerWrapperProps {\n presetColors?: IPresetColor[];\n shouldShowPresetColors: boolean;\n onPresetColorAdd?: (presetColor: IPresetColor) => void;\n onPresetColorRemove?: (presetColorId: IPresetColor['id']) => void;\n shouldShowTransparencySlider: boolean;\n shouldShowMoreOptions: boolean;\n shouldShowAsPopup: boolean;\n shouldShowPreviewColorString: boolean;\n shouldShowRoundPreviewColor: boolean;\n}\n\nconst ColorPickerWrapper = ({\n presetColors,\n onPresetColorRemove,\n onPresetColorAdd,\n shouldShowPresetColors,\n shouldShowAsPopup,\n shouldShowTransparencySlider,\n shouldShowMoreOptions,\n shouldShowRoundPreviewColor,\n shouldShowPreviewColorString,\n}: ColorPickerWrapperProps) => {\n const { selectedColor } = useContext(ColorPickerContext);\n\n const content = useMemo(\n () => (\n <ColorPickerPopup\n shouldShowPresetColors={shouldShowPresetColors}\n onPresetColorRemove={onPresetColorRemove}\n onPresetColorAdd={onPresetColorAdd}\n presetColors={presetColors}\n shouldShowMoreOptions={shouldShowMoreOptions}\n shouldShowTransparencySlider={shouldShowTransparencySlider}\n />\n ),\n [\n onPresetColorAdd,\n onPresetColorRemove,\n presetColors,\n shouldShowMoreOptions,\n shouldShowPresetColors,\n shouldShowTransparencySlider,\n ],\n );\n\n return (\n <StyledColorPickerWrapper>\n {shouldShowAsPopup ? (\n <Popup content={content}>\n <StyledColorPickerWrapperInfo>\n <StyledColorPickerWrapperInfoColorWrapper\n $shouldShowRoundPreviewColor={shouldShowRoundPreviewColor}\n >\n <StyledColorPickerWrapperInfoColorBackground />\n <StyledColorPickerWrapperInfoColor $color={selectedColor} />\n </StyledColorPickerWrapperInfoColorWrapper>\n\n {shouldShowPreviewColorString && (\n <StyledColorPickerWrapperInfoText>\n {selectedColor}\n </StyledColorPickerWrapperInfoText>\n )}\n </StyledColorPickerWrapperInfo>\n </Popup>\n ) : (\n content\n )}\n </StyledColorPickerWrapper>\n );\n};\n\nColorPickerWrapper.displayName = 'ColorPickerWrapper';\n\nexport default ColorPickerWrapper;\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,yBAAyB;AAC/C,OAAOC,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAElD,OAAOC,gBAAgB,MAAM,2CAA2C;AACxE,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SACIC,wBAAwB,EACxBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,2CAA2C,EAC3CC,wCAAwC,EACxCC,gCAAgC,QAC7B,6BAA6B;AAcpC,MAAMC,kBAAkB,GAAGC,IAAA,IAUI;EAAA,IAVH;IACxBC,YAAY;IACZC,mBAAmB;IACnBC,gBAAgB;IAChBC,sBAAsB;IACtBC,iBAAiB;IACjBC,4BAA4B;IAC5BC,qBAAqB;IACrBC,2BAA2B;IAC3BC;EACqB,CAAC,GAAAT,IAAA;EACtB,MAAM;IAAEU;EAAc,CAAC,GAAGrB,UAAU,CAACG,kBAAkB,CAAC;EAExD,MAAMmB,OAAO,GAAGrB,OAAO,CACnB,mBACIF,KAAA,CAAAwB,aAAA,CAACrB,gBAAgB;IACba,sBAAsB,EAAEA,sBAAuB;IAC/CF,mBAAmB,EAAEA,mBAAoB;IACzCC,gBAAgB,EAAEA,gBAAiB;IACnCF,YAAY,EAAEA,YAAa;IAC3BM,qBAAqB,EAAEA,qBAAsB;IAC7CD,4BAA4B,EAAEA;EAA6B,CAC9D,CACJ,EACD,CACIH,gBAAgB,EAChBD,mBAAmB,EACnBD,YAAY,EACZM,qBAAqB,EACrBH,sBAAsB,EACtBE,4BAA4B,CAEpC,CAAC;EAED,oBACIlB,KAAA,CAAAwB,aAAA,CAACnB,wBAAwB,QACpBY,iBAAiB,gBACdjB,KAAA,CAAAwB,aAAA,CAACzB,KAAK;IAACwB,OAAO,EAAEA;EAAQ,gBACpBvB,KAAA,CAAAwB,aAAA,CAAClB,4BAA4B,qBACzBN,KAAA,CAAAwB,aAAA,CAACf,wCAAwC;IACrCgB,4BAA4B,EAAEL;EAA4B,gBAE1DpB,KAAA,CAAAwB,aAAA,CAAChB,2CAA2C,MAAE,CAAC,eAC/CR,KAAA,CAAAwB,aAAA,CAACjB,iCAAiC;IAACmB,MAAM,EAAEJ;EAAc,CAAE,CACrB,CAAC,EAE1CD,4BAA4B,iBACzBrB,KAAA,CAAAwB,aAAA,CAACd,gCAAgC,QAC5BY,aAC6B,CAEZ,CAC3B,CAAC,GAERC,OAEkB,CAAC;AAEnC,CAAC;AAEDZ,kBAAkB,CAACgB,WAAW,GAAG,oBAAoB;AAErD,eAAehB,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup.js","names":["React","ColorArea","StyledColorPickerPopup","MoreOptions","PresetColors","Sliders","ColorPickerPopup","_ref","presetColors","onPresetColorRemove","onPresetColorAdd","shouldShowPresetColors","shouldShowTransparencySlider","shouldShowMoreOptions","createElement","displayName"],"sources":["../../../../src/components/color-picker-popup/ColorPickerPopup.tsx"],"sourcesContent":["import React from 'react';\nimport type { IPresetColor } from '../../types/colorPicker';\nimport ColorArea from './color-area/ColorArea';\nimport { StyledColorPickerPopup } from './ColorPickerPopup.styles';\nimport MoreOptions from './more-options/MoreOptions';\nimport PresetColors from './preset-colors/PresetColors';\nimport Sliders from './sliders/Sliders';\n\ninterface ColorPickerPopupProps {\n presetColors?: IPresetColor[];\n shouldShowPresetColors: boolean;\n onPresetColorAdd?: (presetColor: IPresetColor) => void;\n onPresetColorRemove?: (presetColorId: IPresetColor['id']) => void;\n shouldShowTransparencySlider: boolean;\n shouldShowMoreOptions: boolean;\n}\n\nconst ColorPickerPopup = ({\n presetColors,\n onPresetColorRemove,\n onPresetColorAdd,\n shouldShowPresetColors,\n shouldShowTransparencySlider,\n shouldShowMoreOptions,\n}: ColorPickerPopupProps) => (\n <StyledColorPickerPopup>\n <ColorArea />\n <Sliders shouldShowTransparencySlider={shouldShowTransparencySlider} />\n {shouldShowPresetColors && (\n <PresetColors\n presetColors={presetColors}\n onPresetColorAdd={onPresetColorAdd}\n onPresetColorRemove={onPresetColorRemove}\n />\n )}\n {shouldShowMoreOptions && <MoreOptions />}\n </StyledColorPickerPopup>\n);\n\nColorPickerPopup.displayName = 'ColorPickerPopup';\n\nexport default ColorPickerPopup;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,sBAAsB,QAAQ,2BAA2B;AAClE,OAAOC,WAAW,MAAM,4BAA4B;AACpD,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,OAAO,MAAM,mBAAmB;AAWvC,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACtBC,YAAY;IACZC,mBAAmB;IACnBC,gBAAgB;IAChBC,sBAAsB;IACtBC,4BAA4B;IAC5BC;EACmB,CAAC,GAAAN,IAAA;EAAA,oBACpBP,KAAA,CAAAc,aAAA,CAACZ,sBAAsB,qBACnBF,KAAA,CAAAc,aAAA,CAACb,SAAS,MAAE,CAAC,eACbD,KAAA,CAAAc,aAAA,CAACT,OAAO;IAACO,4BAA4B,EAAEA;EAA6B,CAAE,CAAC,EACtED,sBAAsB,iBACnBX,KAAA,CAAAc,aAAA,CAACV,YAAY;IACTI,YAAY,EAAEA,YAAa;IAC3BE,gBAAgB,EAAEA,gBAAiB;IACnCD,mBAAmB,EAAEA;EAAoB,CAC5C,CACJ,EACAI,qBAAqB,iBAAIb,KAAA,CAAAc,aAAA,CAACX,WAAW,MAAE,CACpB,CAAC;AAAA,CAC5B;AAEDG,gBAAgB,CAACS,WAAW,GAAG,kBAAkB;AAEjD,eAAeT,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup.styles.js","names":["styled","StyledColorPickerPopup","div"],"sources":["../../../../src/components/color-picker-popup/ColorPickerPopup.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledColorPickerPopup = styled.div`\n width: 320px;\n padding: 11px;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,sBAAsB,GAAGD,MAAM,CAACE,GAAG;AAChD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -3,8 +3,8 @@ import { StyledColorArea, StyledColorAreaCanvas, StyledColorAreaPseudo, StyledMo
|
|
|
3
3
|
import { hsvToHex } from '@chayns/colors';
|
|
4
4
|
import { setRefreshScrollEnabled } from 'chayns-api';
|
|
5
5
|
import { useDragControls, useMotionValue } from 'framer-motion';
|
|
6
|
-
import { extractRgbValues, getColorFromCoordinates, getCoordinatesFromColor, rgbToHsv } from '
|
|
7
|
-
import { ColorPickerContext } from '
|
|
6
|
+
import { extractRgbValues, getColorFromCoordinates, getCoordinatesFromColor, rgbToHsv } from '../../../utils/color';
|
|
7
|
+
import { ColorPickerContext } from '../../ColorPickerProvider';
|
|
8
8
|
const ColorArea = () => {
|
|
9
9
|
const {
|
|
10
10
|
selectedColor,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorArea.js","names":["React","useCallback","useContext","useEffect","useMemo","useRef","useState","StyledColorArea","StyledColorAreaCanvas","StyledColorAreaPseudo","StyledMotionColorAreaPointer","hsvToHex","setRefreshScrollEnabled","useDragControls","useMotionValue","extractRgbValues","getColorFromCoordinates","getCoordinatesFromColor","rgbToHsv","ColorPickerContext","ColorArea","selectedColor","updateSelectedColor","updateIsPresetColor","isPresetColor","shouldGetCoordinates","updateShouldGetCoordinates","updateShouldCallOnSelect","hueColor","opacity","setOpacity","scale","setScale","scaleX","scaleY","isPresetColorRef","shouldGetCoordinatesRef","canDrag","canvasRef","pseudoRef","dragControls","x","y","current","a","canvas","rect","getBoundingClientRect","width","height","setColor","xCord","get","yCord","color","coordinates","ctx","getContext","hsv","hex","h","s","v","colorGradiant","createLinearGradient","addColorStop","fillStyle","fillRect","transparentGradiant","handleStartDrag","cords","tolerance","set","handleDrag","handleClick","event","left","top","target","clientX","clientY","handlePointerUp","move","xCords","yCords","newXCords","newYCords","handleMouseMove","handleTouchMove","preventDefault","changedTouches","pageX","pageY","window","addEventListener","removeEventListener","createElement","ref","onPointerDown","onClick","drag","dragConstraints","style","dragElastic","dragMomentum","onDrag","displayName"],"sources":["../../../../../src/components/color-picker-popup/color-area/ColorArea.tsx"],"sourcesContent":["import React, {\n MouseEvent,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n StyledColorArea,\n StyledColorAreaCanvas,\n StyledColorAreaPseudo,\n StyledMotionColorAreaPointer,\n} from './ColorArea.styles';\n\nimport { hsvToHex } from '@chayns/colors';\nimport { setRefreshScrollEnabled } from 'chayns-api';\nimport { useDragControls, useMotionValue } from 'framer-motion';\nimport type { Scale } from '../../../types/colorPicker';\nimport {\n extractRgbValues,\n getColorFromCoordinates,\n getCoordinatesFromColor,\n rgbToHsv,\n} from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\n\nconst ColorArea = () => {\n const {\n selectedColor,\n updateSelectedColor,\n updateIsPresetColor,\n isPresetColor,\n shouldGetCoordinates,\n updateShouldGetCoordinates,\n updateShouldCallOnSelect,\n hueColor,\n } = useContext(ColorPickerContext);\n\n const [opacity, setOpacity] = useState<number>(1);\n const [scale, setScale] = useState<Scale>({ scaleX: 0, scaleY: 0 });\n\n const isPresetColorRef = useRef(false);\n const shouldGetCoordinatesRef = useRef(false);\n const canDrag = useRef(false);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n\n const dragControls = useDragControls();\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n useEffect(() => {\n isPresetColorRef.current = isPresetColor ?? false;\n }, [isPresetColor]);\n\n useEffect(() => {\n shouldGetCoordinatesRef.current = shouldGetCoordinates ?? true;\n }, [shouldGetCoordinates]);\n\n useEffect(() => {\n if (selectedColor) {\n const { a } = extractRgbValues(selectedColor);\n\n setOpacity(a);\n }\n }, [selectedColor]);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n\n if (!canvas) {\n return;\n }\n\n const rect = canvas.getBoundingClientRect();\n\n const scaleX = canvas.width / rect.width;\n const scaleY = canvas.height / rect.height;\n\n setScale({ scaleX, scaleY });\n }, []);\n\n const setColor = useCallback(() => {\n const xCord = x.get();\n const yCord = y.get();\n\n if (typeof updateSelectedColor === 'function') {\n const color = getColorFromCoordinates({\n coordinates: {\n x: xCord,\n y: yCord,\n },\n canvas: canvasRef,\n opacity,\n scale,\n });\n\n if (color === 'transparent') {\n return;\n }\n\n updateSelectedColor(color);\n }\n }, [opacity, scale, updateSelectedColor, x, y]);\n\n useEffect(() => {\n const ctx = canvasRef.current?.getContext('2d');\n\n if (!ctx) {\n return;\n }\n\n const hsv = rgbToHsv(hueColor);\n\n const hex = hsvToHex({ h: hsv?.h ?? 1, s: 1, v: 1 });\n\n const colorGradiant = ctx.createLinearGradient(0, 0, 300, 0);\n colorGradiant.addColorStop(0, '#fff');\n colorGradiant.addColorStop(1, hex ?? 'red');\n\n ctx.fillStyle = colorGradiant;\n ctx.fillRect(0, 0, 300, 150);\n\n const transparentGradiant = ctx.createLinearGradient(0, 0, 0, 150);\n\n transparentGradiant.addColorStop(0, 'transparent');\n transparentGradiant.addColorStop(1, '#000');\n\n ctx.fillStyle = transparentGradiant;\n ctx.fillRect(0, 0, 300, 150);\n\n if (isPresetColorRef.current) {\n if (typeof updateIsPresetColor === 'function') {\n updateIsPresetColor(false);\n }\n\n return;\n }\n\n setColor();\n }, [hueColor, setColor, updateIsPresetColor]);\n\n const handleStartDrag = useCallback(() => {\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(false);\n }\n\n canDrag.current = true;\n }, [updateShouldGetCoordinates]);\n\n useEffect(() => {\n if (selectedColor && shouldGetCoordinatesRef.current) {\n const cords = getCoordinatesFromColor({\n color: selectedColor,\n canvas: canvasRef,\n tolerance: 10,\n });\n\n if (cords) {\n x.set(cords.x);\n y.set(cords.y);\n }\n }\n }, [selectedColor, x, y]);\n\n const handleDrag = useCallback(() => {\n setColor();\n }, [setColor]);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(false);\n }\n\n const { left, top } = (event.target as HTMLDivElement).getBoundingClientRect();\n\n x.set(event.clientX - left - 10);\n y.set(event.clientY - top - 10);\n\n setColor();\n },\n [setColor, updateShouldGetCoordinates, x, y],\n );\n\n const handlePointerUp = useCallback(() => {\n canDrag.current = false;\n\n void setRefreshScrollEnabled(true);\n\n if (typeof updateShouldGetCoordinates === 'function') {\n updateShouldGetCoordinates(true);\n }\n\n if (typeof updateShouldCallOnSelect === 'function') {\n updateShouldCallOnSelect(true);\n }\n }, [updateShouldCallOnSelect, updateShouldGetCoordinates]);\n\n const move = useCallback(\n (xCords: number, yCords: number) => {\n let newXCords = xCords;\n let newYCords = yCords;\n\n switch (true) {\n case xCords > 300:\n newXCords = 300;\n break;\n case xCords < 0:\n newXCords = 0;\n break;\n default:\n break;\n }\n\n switch (true) {\n case yCords > 150:\n newYCords = 150;\n break;\n case yCords < 0:\n newYCords = 0;\n break;\n default:\n break;\n }\n\n x.set(newXCords);\n y.set(newYCords);\n\n setColor();\n },\n [setColor, x, y],\n );\n\n const handleMouseMove = useCallback(\n (event: MouseEvent) => {\n if (canDrag.current && pseudoRef.current) {\n const { left, top } = pseudoRef.current.getBoundingClientRect();\n\n const xCords = event.clientX - left - 10;\n const yCords = event.clientY - top - 10;\n\n move(xCords, yCords);\n }\n },\n [move],\n );\n\n const handleTouchMove = useCallback(\n (event: TouchEvent) => {\n if (canDrag.current && pseudoRef.current) {\n event.preventDefault();\n\n void setRefreshScrollEnabled(false);\n\n const { left, top } = pseudoRef.current.getBoundingClientRect();\n\n const xCords = event.changedTouches[0]\n ? event.changedTouches[0].clientX - left - 10\n : (event as unknown as { pageX: number }).pageX;\n const yCords = event.changedTouches[0]\n ? event.changedTouches[0].clientY - top - 10\n : (event as unknown as { pageY: number }).pageY;\n\n move(xCords, yCords);\n }\n },\n [move],\n );\n\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('pointerup', handlePointerUp);\n window.addEventListener('touchmove', handleTouchMove);\n window.addEventListener('touchend', handlePointerUp);\n\n return () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('pointerup', handlePointerUp);\n window.removeEventListener('touchmove', handleTouchMove);\n window.removeEventListener('touchend', handlePointerUp);\n };\n }, [handleMouseMove, handlePointerUp, handleTouchMove]);\n\n return useMemo(\n () => (\n <StyledColorArea>\n <StyledColorAreaCanvas ref={canvasRef} />\n <StyledColorAreaPseudo\n ref={pseudoRef}\n onPointerDown={handleStartDrag}\n onClick={handleClick}\n >\n <StyledMotionColorAreaPointer\n drag\n dragConstraints={pseudoRef}\n style={{ x, y }}\n dragElastic={false}\n dragMomentum={false}\n dragControls={dragControls}\n onDrag={handleDrag}\n />\n </StyledColorAreaPseudo>\n </StyledColorArea>\n ),\n [dragControls, handleClick, handleDrag, handleStartDrag, x, y],\n );\n};\n\nColorArea.displayName = 'ColorArea';\n\nexport default ColorArea;\n"],"mappings":"AAAA,OAAOA,KAAK,IAERC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SACIC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,EACrBC,4BAA4B,QACzB,oBAAoB;AAE3B,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,uBAAuB,QAAQ,YAAY;AACpD,SAASC,eAAe,EAAEC,cAAc,QAAQ,eAAe;AAE/D,SACIC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,EACvBC,QAAQ,QACL,sBAAsB;AAC7B,SAASC,kBAAkB,QAAQ,2BAA2B;AAE9D,MAAMC,SAAS,GAAGA,CAAA,KAAM;EACpB,MAAM;IACFC,aAAa;IACbC,mBAAmB;IACnBC,mBAAmB;IACnBC,aAAa;IACbC,oBAAoB;IACpBC,0BAA0B;IAC1BC,wBAAwB;IACxBC;EACJ,CAAC,GAAG1B,UAAU,CAACiB,kBAAkB,CAAC;EAElC,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAGxB,QAAQ,CAAS,CAAC,CAAC;EACjD,MAAM,CAACyB,KAAK,EAAEC,QAAQ,CAAC,GAAG1B,QAAQ,CAAQ;IAAE2B,MAAM,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAEnE,MAAMC,gBAAgB,GAAG9B,MAAM,CA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CAAE,CAAC,eACzCtC,KAAA,CAAAgG,aAAA,CAACvF,qBAAqB;IAClBwF,GAAG,EAAE1D,SAAU;IACf2D,aAAa,EAAE7B,eAAgB;IAC/B8B,OAAO,EAAEzB;EAAY,gBAErB1E,KAAA,CAAAgG,aAAA,CAACtF,4BAA4B;IACzB0F,IAAI;IACJC,eAAe,EAAE9D,SAAU;IAC3B+D,KAAK,EAAE;MAAE7D,CAAC;MAAEC;IAAE,CAAE;IAChB6D,WAAW,EAAE,KAAM;IACnBC,YAAY,EAAE,KAAM;IACpBhE,YAAY,EAAEA,YAAa;IAC3BiE,MAAM,EAAEhC;EAAW,CACtB,CACkB,CACV,CACpB,EACD,CAACjC,YAAY,EAAEkC,WAAW,EAAED,UAAU,EAAEJ,eAAe,EAAE5B,CAAC,EAAEC,CAAC,CACjE,CAAC;AACL,CAAC;AAEDtB,SAAS,CAACsF,WAAW,GAAG,WAAW;AAEnC,eAAetF,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorArea.styles.js","names":["motion","styled","StyledColorArea","div","StyledColorAreaCanvas","canvas","StyledColorAreaPseudo","StyledMotionColorAreaPointer"],"sources":["../../../../../src/components/color-picker-popup/color-area/ColorArea.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledColorArea = styled.div`\n height: 150px;\n width: 300px;\n position: relative;\n user-select: none;\n overflow: hidden;\n cursor: crosshair;\n`;\n\nexport const StyledColorAreaCanvas = styled.canvas`\n user-select: none;\n`;\n\nexport const StyledColorAreaPseudo = styled.div`\n position: absolute;\n top: -10px;\n left: -10px;\n touch-action: none;\n user-select: none;\n\n height: 170px;\n width: 320px;\n`;\n\nexport const StyledMotionColorAreaPointer = styled(motion.div)`\n position: absolute;\n border-radius: 100%;\n border: 2px solid white;\n width: 20px;\n height: 20px;\n box-shadow:\n 0 0 5px 0 rgba(0, 0, 0, 0.5),\n 0 0 3px 0 rgba(0, 0, 0, 0.5) inset;\n pointer-events: none;\n user-select: none;\n top: 0;\n left: 0;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,eAAe,GAAGD,MAAM,CAACE,GAAG;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,qBAAqB,GAAGH,MAAM,CAACI,MAAM;AAClD;AACA,CAAC;AAED,OAAO,MAAMC,qBAAqB,GAAGL,MAAM,CAACE,GAAG;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,4BAA4B,GAAGN,MAAM,CAACD,MAAM,CAACG,GAAG,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Accordion, AccordionGroup, AreaContext } from '@chayns-components/core';
|
|
2
2
|
import { isHex } from '@chayns/colors';
|
|
3
3
|
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { extractRgbValues, hexToRgb, isValidRGBA, rgbToHex } from '
|
|
5
|
-
import { ColorPickerContext } from '
|
|
4
|
+
import { extractRgbValues, hexToRgb, isValidRGBA, rgbToHex } from '../../../utils/color';
|
|
5
|
+
import { ColorPickerContext } from '../../ColorPickerProvider';
|
|
6
6
|
import { StyledMoreOptions, StyledMoreOptionsInput, StyledMoreOptionsInputWrapper } from './MoreOptions.styles';
|
|
7
7
|
const MoreOptions = () => {
|
|
8
8
|
const {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoreOptions.js","names":["Accordion","AccordionGroup","AreaContext","isHex","React","useContext","useEffect","useMemo","useState","extractRgbValues","hexToRgb","isValidRGBA","rgbToHex","ColorPickerContext","StyledMoreOptions","StyledMoreOptionsInput","StyledMoreOptionsInputWrapper","MoreOptions","selectedColor","updateSelectedColor","updateShouldCallOnSelect","areaProvider","tmpHexValue","setTmpHexValue","tmpRgbValue","setTmpRgbValue","isHexInvalid","setIsHexInvalid","isRgbInvalid","setIsRgbInvalid","shouldChangeColor","handleHexChange","event","target","value","isValid","r","g","b","a","handleRgbChange","createElement","isWrapped","title","$shouldChangeColor","onChange","$isInvalid","displayName"],"sources":["../../../../../src/components/color-picker-popup/more-options/MoreOptions.tsx"],"sourcesContent":["import { Accordion, AccordionGroup, AreaContext } from '@chayns-components/core';\nimport { isHex } from '@chayns/colors';\nimport React, { useContext, useEffect, useMemo, useState, type ChangeEvent } from 'react';\n\nimport { extractRgbValues, hexToRgb, isValidRGBA, rgbToHex } from '../../../utils/color';\nimport { ColorPickerContext } from '../../ColorPickerProvider';\nimport {\n StyledMoreOptions,\n StyledMoreOptionsInput,\n StyledMoreOptionsInputWrapper,\n} from './MoreOptions.styles';\n\nconst MoreOptions = () => {\n const { selectedColor, updateSelectedColor, updateShouldCallOnSelect } =\n useContext(ColorPickerContext);\n const areaProvider = useContext(AreaContext);\n\n const [tmpHexValue, setTmpHexValue] = useState('');\n const [tmpRgbValue, setTmpRgbValue] = useState('');\n const [isHexInvalid, setIsHexInvalid] = useState(false);\n const [isRgbInvalid, setIsRgbInvalid] = useState(false);\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\n );\n\n const handleHexChange = (event: ChangeEvent<HTMLInputElement>) => {\n setTmpHexValue(event.target.value);\n\n const isValid = isHex(event.target.value);\n\n setIsHexInvalid(!isValid);\n\n if (typeof updateSelectedColor === 'function' && isValid) {\n const { r, g, b, a } = hexToRgb(event.target.value);\n\n updateSelectedColor(`rgba(${r},${g},${b},${a})`);\n }\n\n if (typeof updateShouldCallOnSelect === 'function' && isValid) {\n updateShouldCallOnSelect(true);\n }\n };\n\n const handleRgbChange = (event: ChangeEvent<HTMLInputElement>) => {\n setTmpRgbValue(event.target.value);\n\n const isValid = isValidRGBA(event.target.value);\n\n setIsRgbInvalid(!isValid);\n\n if (typeof updateSelectedColor === 'function' && isValid) {\n updateSelectedColor(event.target.value);\n }\n\n if (typeof updateShouldCallOnSelect === 'function' && isValid) {\n updateShouldCallOnSelect(true);\n }\n };\n\n useEffect(() => {\n if (selectedColor) {\n setTmpRgbValue(selectedColor);\n setTmpHexValue(rgbToHex(extractRgbValues(selectedColor ?? '')));\n }\n }, [selectedColor]);\n\n return (\n <StyledMoreOptions>\n <AccordionGroup isWrapped>\n <Accordion title=\"Erweitert\">\n <StyledMoreOptionsInputWrapper>\n <StyledMoreOptionsInput\n $shouldChangeColor={shouldChangeColor}\n value={tmpHexValue}\n onChange={handleHexChange}\n $isInvalid={isHexInvalid}\n />\n <StyledMoreOptionsInput\n $shouldChangeColor={shouldChangeColor}\n value={tmpRgbValue}\n onChange={handleRgbChange}\n $isInvalid={isRgbInvalid}\n />\n </StyledMoreOptionsInputWrapper>\n </Accordion>\n </AccordionGroup>\n </StyledMoreOptions>\n );\n};\n\nMoreOptions.displayName = 'MoreOptions';\n\nexport default MoreOptions;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,cAAc,EAAEC,WAAW,QAAQ,yBAAyB;AAChF,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAOC,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAA0B,OAAO;AAEzF,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,sBAAsB;AACxF,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SACIC,iBAAiB,EACjBC,sBAAsB,EACtBC,6BAA6B,QAC1B,sBAAsB;AAE7B,MAAMC,WAAW,GAAGA,CAAA,KAAM;EACtB,MAAM;IAAEC,aAAa;IAAEC,mBAAmB;IAAEC;EAAyB,CAAC,GAClEf,UAAU,CAACQ,kBAAkB,CAAC;EAClC,MAAMQ,YAAY,GAAGhB,UAAU,C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+
{"version":3,"file":"MoreOptions.styles.js","names":["styled","StyledMoreOptions","div","StyledMoreOptionsInputWrapper","StyledMoreOptionsInput","input","_ref","theme","$isInvalid","wrong","_ref2","$shouldChangeColor","colorMode","_ref3","text"],"sources":["../../../../../src/components/color-picker-popup/more-options/MoreOptions.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\nexport const StyledMoreOptions = styled.div``;\nexport const StyledMoreOptionsInputWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 8px;\n align-items: center;\n`;\n\ntype StyledMoreOptionsInputProps = WithTheme<{ $isInvalid: boolean; $shouldChangeColor: boolean }>;\n\nexport const StyledMoreOptionsInput = styled.input<StyledMoreOptionsInputProps>`\n width: 100%;\n border-radius: 3px;\n border: 1px solid\n ${({ theme, $isInvalid }: StyledMoreOptionsInputProps) =>\n $isInvalid ? theme.wrong : 'rgba(160, 160, 160, 0.3)'};\n background-color: ${({ theme, $shouldChangeColor }: StyledMoreOptionsInputProps) =>\n theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']};\n color: ${({ theme, $isInvalid }: StyledMoreOptionsInputProps) =>\n $isInvalid ? theme.wrong : theme.text};\n padding: 8px 10px;\n font-size: 11px;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,iBAAiB,GAAGD,MAAM,CAACE,GAAG,EAAE;AAC7C,OAAO,MAAMC,6BAA6B,GAAGH,MAAM,CAACE,GAAG;AACvD;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAME,sBAAsB,GAAGJ,MAAM,CAACK,KAAkC;AAC/E;AACA;AACA;AACA,UAAUC,IAAA;EAAA,IAAC;IAAEC,KAAK;IAAEC;EAAwC,CAAC,GAAAF,IAAA;EAAA,OACjDE,UAAU,GAAGD,KAAK,CAACE,KAAK,GAAG,0BAA0B;AAAA;AACjE,wBAAwBC,KAAA;EAAA,IAAC;IAAEH,KAAK;IAAEI;EAAgD,CAAC,GAAAD,KAAA;EAAA,OAC3EH,KAAK,CAACK,SAAS,KAAK,SAAS,IAAID,kBAAkB,GAAGJ,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAAC,KAAK,CAAC;AAAA;AACzF,aAAaM,KAAA;EAAA,IAAC;IAAEN,KAAK;IAAEC;EAAwC,CAAC,GAAAK,KAAA;EAAA,OACxDL,UAAU,GAAGD,KAAK,CAACE,KAAK,GAAGF,KAAK,CAACO,IAAI;AAAA;AAC7C;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isHex } from '@chayns/colors';
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
|
-
import { PRESETCOLORS } from '
|
|
4
|
-
import { hexToRgb } from '
|
|
5
|
-
import { ColorPickerContext } from '
|
|
3
|
+
import { PRESETCOLORS } from '../../../constants/color';
|
|
4
|
+
import { hexToRgb } from '../../../utils/color';
|
|
5
|
+
import { ColorPickerContext } from '../../ColorPickerProvider';
|
|
6
6
|
import PresetButton from './preset-button/PresetButton';
|
|
7
7
|
import PresetColor from './preset-color/PresetColor';
|
|
8
8
|
import { StyledPresetColors } from './PresetColors.styles';
|