@highlight-ui/color-picker
Advanced tools
Comparing version 4.2.9 to 4.2.10
@@ -6,15 +6,8 @@ 'use strict'; | ||
}); | ||
var React = require('react'); | ||
var utilsCommons = require('@highlight-ui/utils-commons'); | ||
var icon = require('@highlight-ui/icon'); | ||
var panel = require('@highlight-ui/panel'); | ||
var typography = require('@highlight-ui/typography'); | ||
var colorTokens = require('@highlight-ui/tokens/dist/colors.json'); | ||
function _interopDefaultLegacy(e) { | ||
@@ -25,7 +18,6 @@ return e && typeof e === 'object' && 'default' in e ? e : { | ||
} | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var colorTokens__default = /*#__PURE__*/_interopDefaultLegacy(colorTokens); | ||
var colorTokens__default = /*#__PURE__*/_interopDefaultLegacy(colorTokens); | ||
/*! ***************************************************************************** | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
@@ -45,3 +37,2 @@ | ||
var __assign = function () { | ||
@@ -51,13 +42,10 @@ __assign = Object.assign || function __assign(t) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; // TODO: The values are going to be refactored to use tokens directly instead of SCSS exports | ||
}; | ||
// TODO: The values are going to be refactored to use tokens directly instead of SCSS exports | ||
var mainPalette = function (p) { | ||
@@ -116,3 +104,2 @@ return p; | ||
}]); | ||
var pastelPalette = function (p) { | ||
@@ -172,43 +159,36 @@ return p; | ||
}]); | ||
var styles = { | ||
"colorOption": "ColorPicker-module__19MT-I77__v4-2-9", | ||
"button": "ColorPicker-module__XBQM5x8U__v4-2-9", | ||
"colorPicker": "ColorPicker-module__3H6ypMLc__v4-2-9", | ||
"focus": "ColorPicker-module__1iX9akK___v4-2-9", | ||
"active": "ColorPicker-module__3K79GJJ5__v4-2-9", | ||
"disabled": "ColorPicker-module__2PSNxo4E__v4-2-9", | ||
"buttonArrow": "ColorPicker-module__2AQhgxAG__v4-2-9", | ||
"colorDot": "ColorPicker-module___ZbovZGW__v4-2-9", | ||
"panel": "ColorPicker-module__3aVapG4Z__v4-2-9", | ||
"title": "ColorPicker-module__1dP4IMl5__v4-2-9", | ||
"colorOptions": "ColorPicker-module__3Ej3KfXm__v4-2-9" | ||
"colorOption": "ColorPicker-module__FYnj0znF__v4-2-10", | ||
"button": "ColorPicker-module__SOXvFt0b__v4-2-10", | ||
"colorPicker": "ColorPicker-module__iT9dyWOR__v4-2-10", | ||
"focus": "ColorPicker-module__9aA16Fvg__v4-2-10", | ||
"active": "ColorPicker-module__nntKqhC3__v4-2-10", | ||
"disabled": "ColorPicker-module__SSj3wtEw__v4-2-10", | ||
"buttonArrow": "ColorPicker-module__s0S9P-x5__v4-2-10", | ||
"colorDot": "ColorPicker-module__tAkCpZCm__v4-2-10", | ||
"panel": "ColorPicker-module__j47-5ppo__v4-2-10", | ||
"title": "ColorPicker-module__0JMwjz5N__v4-2-10", | ||
"colorOptions": "ColorPicker-module__bPum-aBR__v4-2-10" | ||
}; | ||
var ColorPicker = function (_a) { | ||
var _b = _a.closeOnSelect, | ||
closeOnSelect = _b === void 0 ? false : _b, | ||
disabled = _a.disabled, | ||
initialColor = _a.initialColor, | ||
metadata = _a.metadata, | ||
onChange = _a.onChange, | ||
_c = _a.palette, | ||
palette = _c === void 0 ? 'main' : _c, | ||
title = _a.title; | ||
closeOnSelect = _b === void 0 ? false : _b, | ||
disabled = _a.disabled, | ||
initialColor = _a.initialColor, | ||
metadata = _a.metadata, | ||
onChange = _a.onChange, | ||
_c = _a.palette, | ||
palette = _c === void 0 ? 'main' : _c, | ||
title = _a.title; | ||
var _d = React.useState(false), | ||
focused = _d[0], | ||
setFocused = _d[1]; | ||
focused = _d[0], | ||
setFocused = _d[1]; | ||
var wrapperRef = React.useRef(null); | ||
var colorPalette = palette === 'pastel' ? pastelPalette : mainPalette; | ||
var _e = React.useState(false), | ||
isPaletteOpen = _e[0], | ||
setIsPaletteOpen = _e[1]; | ||
isPaletteOpen = _e[0], | ||
setIsPaletteOpen = _e[1]; | ||
var _f = React.useState(initialColor === undefined ? colorPalette[0].backgroundColor : initialColor), | ||
currentColor = _f[0], | ||
setCurrentColor = _f[1]; | ||
currentColor = _f[0], | ||
setCurrentColor = _f[1]; | ||
React.useEffect(function () { | ||
@@ -220,3 +200,2 @@ var onDocumentClick = function (e) { | ||
}; | ||
window.document.addEventListener('mousedown', onDocumentClick); | ||
@@ -227,3 +206,2 @@ return function () { | ||
}, []); | ||
var getComputedColor = function (cssColorVariable) { | ||
@@ -234,3 +212,2 @@ // Replace var(--support-red-100) with --support-red-100 | ||
}; | ||
var onColorClick = function (selectedColor) { | ||
@@ -242,3 +219,2 @@ // TODO: Remove isHexColor check in DST-2558 | ||
setCurrentColor(selectedColor); | ||
if (closeOnSelect) { | ||
@@ -248,3 +224,2 @@ setIsPaletteOpen(false); | ||
}; | ||
return React__default["default"].createElement("div", { | ||
@@ -287,4 +262,4 @@ className: styles.colorPicker, | ||
var identifier = _a.identifier, | ||
backgroundColor = _a.backgroundColor, | ||
highlight = _a.highlight; | ||
backgroundColor = _a.backgroundColor, | ||
highlight = _a.highlight; | ||
return React__default["default"].createElement("div", { | ||
@@ -309,4 +284,3 @@ className: styles.colorOption, | ||
}; | ||
exports.ColorPicker = ColorPicker; | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,4 @@ import React, { useState, useRef, useEffect } from 'react'; | ||
import colorTokens from '@highlight-ui/tokens/dist/colors.json'; | ||
/*! ***************************************************************************** | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
@@ -27,13 +28,10 @@ | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; // TODO: The values are going to be refactored to use tokens directly instead of SCSS exports | ||
}; | ||
// TODO: The values are going to be refactored to use tokens directly instead of SCSS exports | ||
var mainPalette = function (p) { | ||
@@ -92,3 +90,2 @@ return p; | ||
}]); | ||
var pastelPalette = function (p) { | ||
@@ -148,43 +145,36 @@ return p; | ||
}]); | ||
var styles = { | ||
"colorOption": "ColorPicker-module__19MT-I77__v4-2-9", | ||
"button": "ColorPicker-module__XBQM5x8U__v4-2-9", | ||
"colorPicker": "ColorPicker-module__3H6ypMLc__v4-2-9", | ||
"focus": "ColorPicker-module__1iX9akK___v4-2-9", | ||
"active": "ColorPicker-module__3K79GJJ5__v4-2-9", | ||
"disabled": "ColorPicker-module__2PSNxo4E__v4-2-9", | ||
"buttonArrow": "ColorPicker-module__2AQhgxAG__v4-2-9", | ||
"colorDot": "ColorPicker-module___ZbovZGW__v4-2-9", | ||
"panel": "ColorPicker-module__3aVapG4Z__v4-2-9", | ||
"title": "ColorPicker-module__1dP4IMl5__v4-2-9", | ||
"colorOptions": "ColorPicker-module__3Ej3KfXm__v4-2-9" | ||
"colorOption": "ColorPicker-module__FYnj0znF__v4-2-10", | ||
"button": "ColorPicker-module__SOXvFt0b__v4-2-10", | ||
"colorPicker": "ColorPicker-module__iT9dyWOR__v4-2-10", | ||
"focus": "ColorPicker-module__9aA16Fvg__v4-2-10", | ||
"active": "ColorPicker-module__nntKqhC3__v4-2-10", | ||
"disabled": "ColorPicker-module__SSj3wtEw__v4-2-10", | ||
"buttonArrow": "ColorPicker-module__s0S9P-x5__v4-2-10", | ||
"colorDot": "ColorPicker-module__tAkCpZCm__v4-2-10", | ||
"panel": "ColorPicker-module__j47-5ppo__v4-2-10", | ||
"title": "ColorPicker-module__0JMwjz5N__v4-2-10", | ||
"colorOptions": "ColorPicker-module__bPum-aBR__v4-2-10" | ||
}; | ||
var ColorPicker = function (_a) { | ||
var _b = _a.closeOnSelect, | ||
closeOnSelect = _b === void 0 ? false : _b, | ||
disabled = _a.disabled, | ||
initialColor = _a.initialColor, | ||
metadata = _a.metadata, | ||
onChange = _a.onChange, | ||
_c = _a.palette, | ||
palette = _c === void 0 ? 'main' : _c, | ||
title = _a.title; | ||
closeOnSelect = _b === void 0 ? false : _b, | ||
disabled = _a.disabled, | ||
initialColor = _a.initialColor, | ||
metadata = _a.metadata, | ||
onChange = _a.onChange, | ||
_c = _a.palette, | ||
palette = _c === void 0 ? 'main' : _c, | ||
title = _a.title; | ||
var _d = useState(false), | ||
focused = _d[0], | ||
setFocused = _d[1]; | ||
focused = _d[0], | ||
setFocused = _d[1]; | ||
var wrapperRef = useRef(null); | ||
var colorPalette = palette === 'pastel' ? pastelPalette : mainPalette; | ||
var _e = useState(false), | ||
isPaletteOpen = _e[0], | ||
setIsPaletteOpen = _e[1]; | ||
isPaletteOpen = _e[0], | ||
setIsPaletteOpen = _e[1]; | ||
var _f = useState(initialColor === undefined ? colorPalette[0].backgroundColor : initialColor), | ||
currentColor = _f[0], | ||
setCurrentColor = _f[1]; | ||
currentColor = _f[0], | ||
setCurrentColor = _f[1]; | ||
useEffect(function () { | ||
@@ -196,3 +186,2 @@ var onDocumentClick = function (e) { | ||
}; | ||
window.document.addEventListener('mousedown', onDocumentClick); | ||
@@ -203,3 +192,2 @@ return function () { | ||
}, []); | ||
var getComputedColor = function (cssColorVariable) { | ||
@@ -210,3 +198,2 @@ // Replace var(--support-red-100) with --support-red-100 | ||
}; | ||
var onColorClick = function (selectedColor) { | ||
@@ -218,3 +205,2 @@ // TODO: Remove isHexColor check in DST-2558 | ||
setCurrentColor(selectedColor); | ||
if (closeOnSelect) { | ||
@@ -224,3 +210,2 @@ setIsPaletteOpen(false); | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
@@ -263,4 +248,4 @@ className: styles.colorPicker, | ||
var identifier = _a.identifier, | ||
backgroundColor = _a.backgroundColor, | ||
highlight = _a.highlight; | ||
backgroundColor = _a.backgroundColor, | ||
highlight = _a.highlight; | ||
return /*#__PURE__*/React.createElement("div", { | ||
@@ -285,4 +270,3 @@ className: styles.colorOption, | ||
}; | ||
export { ColorPicker }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@highlight-ui/color-picker", | ||
"version": "4.2.9", | ||
"version": "4.2.10", | ||
"author": "Personio GmbH & Co. KG", | ||
@@ -29,27 +29,27 @@ "main": "dist/cjs/index.js", | ||
"devDependencies": { | ||
"@highlight-ui/configs-base-jest": "^3.1.1", | ||
"@highlight-ui/configs-base-tsconfig": "^3.2.0", | ||
"@highlight-ui/configs-scripts": "^3.2.2", | ||
"@highlight-ui/theme": "^9.3.3", | ||
"@highlight-ui/utils-dev": "^1.1.5", | ||
"@highlight-ui/configs-base-jest": "^3.1.2", | ||
"@highlight-ui/configs-base-tsconfig": "^3.2.1", | ||
"@highlight-ui/configs-scripts": "^3.2.3", | ||
"@highlight-ui/theme": "^9.3.4", | ||
"@highlight-ui/utils-dev": "^1.1.6", | ||
"@testing-library/dom": "8.19.0", | ||
"@testing-library/react": "12.1.5", | ||
"@testing-library/user-event": "13.5.0", | ||
"classnames": "^2.3.1", | ||
"jest": "^27.2.3", | ||
"react": "^17.0.2", | ||
"rimraf": "^3.0.2" | ||
"classnames": "~2.3.1", | ||
"jest": "~27.2.3", | ||
"react": "17.0.2", | ||
"rimraf": "~3.0.2" | ||
}, | ||
"dependencies": { | ||
"@highlight-ui/icon": "^4.1.6", | ||
"@highlight-ui/panel": "^3.1.18", | ||
"@highlight-ui/tokens": "^2.3.0", | ||
"@highlight-ui/typography": "^5.2.15", | ||
"@highlight-ui/utils-commons": "^2.3.5" | ||
"@highlight-ui/icon": "^4.1.7", | ||
"@highlight-ui/panel": "^3.1.19", | ||
"@highlight-ui/tokens": "^2.3.1", | ||
"@highlight-ui/typography": "^5.2.16", | ||
"@highlight-ui/utils-commons": "^2.3.6" | ||
}, | ||
"peerDependencies": { | ||
"classnames": "^2.3.1", | ||
"react": "^17.0.2" | ||
"classnames": "~2.3.1", | ||
"react": "17.0.2" | ||
}, | ||
"gitHead": "9af145ddc03c7a3909b46ed3f005fa3792be65c2" | ||
"gitHead": "3758f5f987510edb100f5a22ebe829b7cee4573f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94729
781
- Removedclassnames@2.5.1(transitive)
Updated@highlight-ui/icon@^4.1.7
Updated@highlight-ui/panel@^3.1.19
Updated@highlight-ui/tokens@^2.3.1