@uiw/react-color-sketch
Advanced tools
Comparing version 1.1.4 to 1.2.0
@@ -10,2 +10,3 @@ import React from 'react'; | ||
editableDisable?: boolean; | ||
disableAlpha?: boolean; | ||
onChange?: (newShade: ColorResult) => void; | ||
@@ -12,0 +13,0 @@ } |
@@ -22,3 +22,3 @@ "use strict"; | ||
var _jsxRuntime = require("react/jsx-runtime"); | ||
var _excluded = ["prefixCls", "className", "onChange", "width", "presetColors", "color", "editableDisable", "style"]; | ||
var _excluded = ["prefixCls", "className", "onChange", "width", "presetColors", "color", "editableDisable", "disableAlpha", "style"]; | ||
var PRESET_COLORS = ['#D0021B', '#F5A623', '#f8e61b', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF']; | ||
@@ -51,2 +51,4 @@ var Bar = function Bar(props) { | ||
editableDisable = _props$editableDisabl === void 0 ? true : _props$editableDisabl, | ||
_props$disableAlpha = props.disableAlpha, | ||
disableAlpha = _props$disableAlpha === void 0 ? false : _props$disableAlpha, | ||
style = props.style, | ||
@@ -127,3 +129,3 @@ other = (0, _objectWithoutProperties2["default"])(props, _excluded); | ||
} | ||
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColorAlpha["default"], { | ||
}), !disableAlpha && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColorAlpha["default"], { | ||
width: "auto", | ||
@@ -148,3 +150,3 @@ height: 10, | ||
})] | ||
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColorAlpha["default"], { | ||
}), !disableAlpha && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColorAlpha["default"], { | ||
width: 24, | ||
@@ -151,0 +153,0 @@ height: 24, |
@@ -10,2 +10,3 @@ import React from 'react'; | ||
editableDisable?: boolean; | ||
disableAlpha?: boolean; | ||
onChange?: (newShade: ColorResult) => void; | ||
@@ -12,0 +13,0 @@ } |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
var _excluded = ["prefixCls", "className", "onChange", "width", "presetColors", "color", "editableDisable", "style"]; | ||
var _excluded = ["prefixCls", "className", "onChange", "width", "presetColors", "color", "editableDisable", "disableAlpha", "style"]; | ||
import React, { useState, useCallback, Fragment } from 'react'; | ||
@@ -37,2 +37,3 @@ import Saturation from '@uiw/react-color-saturation'; | ||
editableDisable = true, | ||
disableAlpha = false, | ||
style | ||
@@ -107,3 +108,3 @@ } = props, | ||
onChange: newHue => handleChange(_extends({}, hsva, newHue)) | ||
}), /*#__PURE__*/_jsx(Alpha, { | ||
}), !disableAlpha && /*#__PURE__*/_jsx(Alpha, { | ||
width: "auto", | ||
@@ -128,3 +129,3 @@ height: 10, | ||
})] | ||
}), /*#__PURE__*/_jsx(Alpha, { | ||
}), !disableAlpha && /*#__PURE__*/_jsx(Alpha, { | ||
width: 24, | ||
@@ -131,0 +132,0 @@ height: 24, |
{ | ||
"name": "@uiw/react-color-sketch", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"description": "Color Sketch component for React.", | ||
@@ -38,9 +38,9 @@ "homepage": "https://uiwjs.github.io/react-color/#/sketch", | ||
"dependencies": { | ||
"@uiw/color-convert": "1.1.4", | ||
"@uiw/react-color-alpha": "1.1.4", | ||
"@uiw/react-color-editable-input": "1.1.4", | ||
"@uiw/react-color-editable-input-rgba": "1.1.4", | ||
"@uiw/react-color-hue": "1.1.4", | ||
"@uiw/react-color-saturation": "1.1.4", | ||
"@uiw/react-color-swatch": "1.1.4" | ||
"@uiw/color-convert": "1.2.0", | ||
"@uiw/react-color-alpha": "1.2.0", | ||
"@uiw/react-color-editable-input": "1.2.0", | ||
"@uiw/react-color-editable-input-rgba": "1.2.0", | ||
"@uiw/react-color-hue": "1.2.0", | ||
"@uiw/react-color-saturation": "1.2.0", | ||
"@uiw/react-color-swatch": "1.2.0" | ||
}, | ||
@@ -47,0 +47,0 @@ "devDependencies": { |
@@ -18,3 +18,4 @@ React Color Sketch | ||
```js | ||
```jsx mdx:preview | ||
import React, { useState } from 'react'; | ||
import Sketch from '@uiw/react-color-sketch'; | ||
@@ -24,12 +25,21 @@ | ||
const [hex, setHex] = useState("#fff"); | ||
const [disableAlpha, setDisableAlpha] = useState(false); | ||
return ( | ||
<Sketch | ||
style={{ marginLeft: 20 }} | ||
color={hex} | ||
onChange={(color) => { | ||
setHex(color.hex); | ||
}} | ||
/> | ||
<div> | ||
<Sketch | ||
style={{ marginLeft: 20 }} | ||
color={hex} | ||
disableAlpha={disableAlpha} | ||
onChange={(color) => { | ||
setHex(color.hex); | ||
}} | ||
/> | ||
<button onClick={() => setDisableAlpha(!disableAlpha)}> | ||
disableAlpha={disableAlpha.toString()} | ||
</button> | ||
</div> | ||
); | ||
} | ||
export default Demo; | ||
``` | ||
@@ -49,2 +59,3 @@ | ||
editableDisable?: boolean; | ||
disableAlpha?: boolean; | ||
onChange?: (newShade: ColorResult) => void; | ||
@@ -51,0 +62,0 @@ } |
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
24597
640
67
+ Added@uiw/color-convert@1.2.0(transitive)
+ Added@uiw/react-color-alpha@1.2.0(transitive)
+ Added@uiw/react-color-editable-input@1.2.0(transitive)
+ Added@uiw/react-color-editable-input-rgba@1.2.0(transitive)
+ Added@uiw/react-color-hue@1.2.0(transitive)
+ Added@uiw/react-color-saturation@1.2.0(transitive)
+ Added@uiw/react-color-swatch@1.2.0(transitive)
+ Added@uiw/react-drag-event-interactive@1.2.0(transitive)
- Removed@uiw/color-convert@1.1.4(transitive)
- Removed@uiw/react-color-alpha@1.1.4(transitive)
- Removed@uiw/react-color-editable-input@1.1.4(transitive)
- Removed@uiw/react-color-editable-input-rgba@1.1.4(transitive)
- Removed@uiw/react-color-hue@1.1.4(transitive)
- Removed@uiw/react-color-saturation@1.1.4(transitive)
- Removed@uiw/react-color-swatch@1.1.4(transitive)
- Removed@uiw/react-drag-event-interactive@1.1.4(transitive)
Updated@uiw/color-convert@1.2.0
Updated@uiw/react-color-alpha@1.2.0
Updated@uiw/react-color-hue@1.2.0