Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-best-gradient-color-picker

Package Overview
Dependencies
Maintainers
0
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-best-gradient-color-picker - npm Package Compare versions

Comparing version 3.0.12-beta.1 to 3.0.12-beta.2

2

dist/cjs/components/index.d.ts
import React from 'react';
import { ColorPickerProps } from '../shared/types.js';
export declare function ColorPicker({ value, onChange, hideControls, hideInputs, hideOpacity, hidePresets, hideHue, presets, hideEyeDrop, hideAdvancedSliders, hideColorGuide, hideInputType, hideColorTypeBtns, hideGradientType, hideGradientAngle, hideGradientStop, hideGradientControls, locales, width, height, style, className, disableDarkMode, disableLightMode, }: ColorPickerProps): React.JSX.Element;
export declare function ColorPicker({ id, value, onChange, hideControls, hideInputs, hideOpacity, hidePresets, hideHue, presets, hideEyeDrop, hideAdvancedSliders, hideColorGuide, hideInputType, hideColorTypeBtns, hideGradientType, hideGradientAngle, hideGradientStop, hideGradientControls, locales, width, height, style, className, disableDarkMode, disableLightMode, hidePickerSquare, }: ColorPickerProps): React.JSX.Element;

@@ -26,6 +26,13 @@ "use strict";

function ColorPicker(_a) {
var _b = _a.value, value = _b === void 0 ? 'rgba(175, 51, 242, 1)' : _b, onChange = _a.onChange, _c = _a.hideControls, hideControls = _c === void 0 ? false : _c, _d = _a.hideInputs, hideInputs = _d === void 0 ? false : _d, _e = _a.hideOpacity, hideOpacity = _e === void 0 ? false : _e, _f = _a.hidePresets, hidePresets = _f === void 0 ? false : _f, _g = _a.hideHue, hideHue = _g === void 0 ? false : _g, _h = _a.presets, presets = _h === void 0 ? [] : _h, _j = _a.hideEyeDrop, hideEyeDrop = _j === void 0 ? false : _j, _k = _a.hideAdvancedSliders, hideAdvancedSliders = _k === void 0 ? false : _k, _l = _a.hideColorGuide, hideColorGuide = _l === void 0 ? false : _l, _m = _a.hideInputType, hideInputType = _m === void 0 ? false : _m, _o = _a.hideColorTypeBtns, hideColorTypeBtns = _o === void 0 ? false : _o, _p = _a.hideGradientType, hideGradientType = _p === void 0 ? false : _p, _q = _a.hideGradientAngle, hideGradientAngle = _q === void 0 ? false : _q, _r = _a.hideGradientStop, hideGradientStop = _r === void 0 ? false : _r, _s = _a.hideGradientControls, hideGradientControls = _s === void 0 ? false : _s, _t = _a.locales, locales = _t === void 0 ? constants_js_1.defaultLocales : _t, _u = _a.width, width = _u === void 0 ? 294 : _u, _v = _a.height, height = _v === void 0 ? 294 : _v, _w = _a.style, style = _w === void 0 ? {} : _w, className = _a.className, _x = _a.disableDarkMode, disableDarkMode = _x === void 0 ? false : _x, _y = _a.disableLightMode, disableLightMode = _y === void 0 ? false : _y;
var id = _a.id, _b = _a.value, value = _b === void 0 ? 'rgba(175, 51, 242, 1)' : _b, onChange = _a.onChange, _c = _a.hideControls, hideControls = _c === void 0 ? false : _c, _d = _a.hideInputs, hideInputs = _d === void 0 ? false : _d, _e = _a.hideOpacity, hideOpacity = _e === void 0 ? false : _e, _f = _a.hidePresets, hidePresets = _f === void 0 ? false : _f, _g = _a.hideHue, hideHue = _g === void 0 ? false : _g, _h = _a.presets, presets = _h === void 0 ? [] : _h, _j = _a.hideEyeDrop, hideEyeDrop = _j === void 0 ? false : _j, _k = _a.hideAdvancedSliders, hideAdvancedSliders = _k === void 0 ? false : _k, _l = _a.hideColorGuide, hideColorGuide = _l === void 0 ? false : _l, _m = _a.hideInputType, hideInputType = _m === void 0 ? false : _m, _o = _a.hideColorTypeBtns, hideColorTypeBtns = _o === void 0 ? false : _o, _p = _a.hideGradientType, hideGradientType = _p === void 0 ? false : _p, _q = _a.hideGradientAngle, hideGradientAngle = _q === void 0 ? false : _q, _r = _a.hideGradientStop, hideGradientStop = _r === void 0 ? false : _r, _s = _a.hideGradientControls, hideGradientControls = _s === void 0 ? false : _s, _t = _a.locales, locales = _t === void 0 ? constants_js_1.defaultLocales : _t, _u = _a.width, width = _u === void 0 ? 294 : _u, _v = _a.height, height = _v === void 0 ? 294 : _v, _w = _a.style, style = _w === void 0 ? {} : _w, className = _a.className, _x = _a.disableDarkMode, disableDarkMode = _x === void 0 ? false : _x, _y = _a.disableLightMode, disableLightMode = _y === void 0 ? false : _y, _z = _a.hidePickerSquare, hidePickerSquare = _z === void 0 ? false : _z;
var safeValue = (0, utils_js_1.objectToString)(value);
// const contRef = useRef<HTMLDivElement>(null)
var defaultStyles = (0, styles_js_1.getStyles)(disableDarkMode, disableLightMode);
var pickerId = id
? id
: !disableDarkMode && !disableLightMode
? 'rbgcp-color-picker'
: disableDarkMode
? 'rbgcp-color-picker-light'
: 'rbgcp-color-picker-dark';
return (react_1.default.createElement("div", {

@@ -35,3 +42,3 @@ // ref={contRef}

react_1.default.createElement(context_js_1.default, { value: safeValue, onChange: onChange, squareWidth: width, squareHeight: height, hideOpacity: hideOpacity, defaultStyles: defaultStyles },
react_1.default.createElement(Picker_js_1.default, { hideControls: hideControls, hideInputs: hideInputs, hidePresets: hidePresets, hideOpacity: hideOpacity, hideHue: hideHue, presets: presets, hideEyeDrop: hideEyeDrop, hideAdvancedSliders: hideAdvancedSliders, hideColorGuide: hideColorGuide, hideInputType: hideInputType, hideColorTypeBtns: hideColorTypeBtns, hideGradientType: hideGradientType, hideGradientAngle: hideGradientAngle, hideGradientStop: hideGradientStop, hideGradientControls: hideGradientControls, locales: locales }))));
react_1.default.createElement(Picker_js_1.default, { pickerId: pickerId, hideControls: hideControls, hideInputs: hideInputs, hidePresets: hidePresets, hideOpacity: hideOpacity, hideHue: hideHue, presets: presets, hideEyeDrop: hideEyeDrop, hideAdvancedSliders: hideAdvancedSliders, hideColorGuide: hideColorGuide, hideInputType: hideInputType, hideColorTypeBtns: hideColorTypeBtns, hideGradientType: hideGradientType, hideGradientAngle: hideGradientAngle, hideGradientStop: hideGradientStop, hideGradientControls: hideGradientControls, hidePickerSquare: hidePickerSquare, locales: locales }))));
}
import React from 'react';
import { LocalesProps } from '../shared/types.js';
declare const Picker: ({ locales, presets, hideHue, hideInputs, hidePresets, hideOpacity, hideEyeDrop, hideControls, hideInputType, hideColorGuide, hideGradientType, hideGradientStop, hideGradientAngle, hideColorTypeBtns, hideAdvancedSliders, hideGradientControls, }: PickerProps) => React.JSX.Element;
declare const Picker: ({ locales, presets, hideHue, pickerId, hideInputs, hidePresets, hideOpacity, hideEyeDrop, hideControls, hideInputType, hideColorGuide, hidePickerSquare, hideGradientType, hideGradientStop, hideGradientAngle, hideColorTypeBtns, hideAdvancedSliders, hideGradientControls, }: PickerProps) => React.JSX.Element;
export default Picker;

@@ -22,2 +22,4 @@ type PickerProps = {

locales?: LocalesProps;
pickerId?: string;
hidePickerSquare?: boolean;
};

@@ -16,6 +16,6 @@ "use strict";

var Picker = function (_a) {
var locales = _a.locales, presets = _a.presets, hideHue = _a.hideHue, hideInputs = _a.hideInputs, hidePresets = _a.hidePresets, hideOpacity = _a.hideOpacity, hideEyeDrop = _a.hideEyeDrop, hideControls = _a.hideControls, hideInputType = _a.hideInputType, hideColorGuide = _a.hideColorGuide, hideGradientType = _a.hideGradientType, hideGradientStop = _a.hideGradientStop, hideGradientAngle = _a.hideGradientAngle, hideColorTypeBtns = _a.hideColorTypeBtns, hideAdvancedSliders = _a.hideAdvancedSliders, hideGradientControls = _a.hideGradientControls;
var locales = _a.locales, presets = _a.presets, hideHue = _a.hideHue, pickerId = _a.pickerId, hideInputs = _a.hideInputs, hidePresets = _a.hidePresets, hideOpacity = _a.hideOpacity, hideEyeDrop = _a.hideEyeDrop, hideControls = _a.hideControls, hideInputType = _a.hideInputType, hideColorGuide = _a.hideColorGuide, hidePickerSquare = _a.hidePickerSquare, hideGradientType = _a.hideGradientType, hideGradientStop = _a.hideGradientStop, hideGradientAngle = _a.hideGradientAngle, hideColorTypeBtns = _a.hideColorTypeBtns, hideAdvancedSliders = _a.hideAdvancedSliders, hideGradientControls = _a.hideGradientControls;
var isGradient = (0, context_js_1.usePicker)().isGradient;
return (react_1.default.createElement("div", { style: { userSelect: 'none' }, id: "rbgcp-wrapper" },
react_1.default.createElement(Square_js_1.default, null),
return (react_1.default.createElement("div", { style: { userSelect: 'none' }, id: pickerId !== null && pickerId !== void 0 ? pickerId : 'rbgcp-color-picker' },
!hidePickerSquare && react_1.default.createElement(Square_js_1.default, null),
!hideControls && (react_1.default.createElement(Controls_js_1.default, { locales: locales, hideEyeDrop: hideEyeDrop, hideInputType: hideInputType, hideColorGuide: hideColorGuide, hideGradientType: hideGradientType, hideGradientStop: hideGradientStop, hideColorTypeBtns: hideColorTypeBtns, hideGradientAngle: hideGradientAngle, hideAdvancedSliders: hideAdvancedSliders, hideGradientControls: hideGradientControls })),

@@ -22,0 +22,0 @@ isGradient && react_1.default.createElement(GradientBar_js_1.default, null),

@@ -53,3 +53,3 @@ "use strict";

marginBottom: 2,
border: p === 'rgba(255,255,255, 1)' ? '1px solid #96959c' : '',
border: p === 'rgba(255,255,255,1)' ? '1px solid #96959c' : '',
},

@@ -56,0 +56,0 @@ // className="rbgcp-preset-color"

@@ -117,2 +117,3 @@ "use strict";

var handleChange = function (newColor) {
newColor = newColor === null || newColor === void 0 ? void 0 : newColor.replace(/\s+/g, '');
if (isGradient) {

@@ -119,0 +120,0 @@ handleGradient(newColor);

export type ColorPickerProps = {
id?: string;
value?: string;

@@ -26,2 +27,3 @@ onChange: (value: string) => void;

disableLightMode?: boolean;
hidePickerSquare?: boolean;
};

@@ -28,0 +30,0 @@ export type ColorsProps = {

import React from 'react';
import { ColorPickerProps } from '../shared/types.js';
export declare function ColorPicker({ value, onChange, hideControls, hideInputs, hideOpacity, hidePresets, hideHue, presets, hideEyeDrop, hideAdvancedSliders, hideColorGuide, hideInputType, hideColorTypeBtns, hideGradientType, hideGradientAngle, hideGradientStop, hideGradientControls, locales, width, height, style, className, disableDarkMode, disableLightMode, }: ColorPickerProps): React.JSX.Element;
export declare function ColorPicker({ id, value, onChange, hideControls, hideInputs, hideOpacity, hidePresets, hideHue, presets, hideEyeDrop, hideAdvancedSliders, hideColorGuide, hideInputType, hideColorTypeBtns, hideGradientType, hideGradientAngle, hideGradientStop, hideGradientControls, locales, width, height, style, className, disableDarkMode, disableLightMode, hidePickerSquare, }: ColorPickerProps): React.JSX.Element;

@@ -20,6 +20,13 @@ 'use client';

export function ColorPicker(_a) {
var _b = _a.value, value = _b === void 0 ? 'rgba(175, 51, 242, 1)' : _b, onChange = _a.onChange, _c = _a.hideControls, hideControls = _c === void 0 ? false : _c, _d = _a.hideInputs, hideInputs = _d === void 0 ? false : _d, _e = _a.hideOpacity, hideOpacity = _e === void 0 ? false : _e, _f = _a.hidePresets, hidePresets = _f === void 0 ? false : _f, _g = _a.hideHue, hideHue = _g === void 0 ? false : _g, _h = _a.presets, presets = _h === void 0 ? [] : _h, _j = _a.hideEyeDrop, hideEyeDrop = _j === void 0 ? false : _j, _k = _a.hideAdvancedSliders, hideAdvancedSliders = _k === void 0 ? false : _k, _l = _a.hideColorGuide, hideColorGuide = _l === void 0 ? false : _l, _m = _a.hideInputType, hideInputType = _m === void 0 ? false : _m, _o = _a.hideColorTypeBtns, hideColorTypeBtns = _o === void 0 ? false : _o, _p = _a.hideGradientType, hideGradientType = _p === void 0 ? false : _p, _q = _a.hideGradientAngle, hideGradientAngle = _q === void 0 ? false : _q, _r = _a.hideGradientStop, hideGradientStop = _r === void 0 ? false : _r, _s = _a.hideGradientControls, hideGradientControls = _s === void 0 ? false : _s, _t = _a.locales, locales = _t === void 0 ? defaultLocales : _t, _u = _a.width, width = _u === void 0 ? 294 : _u, _v = _a.height, height = _v === void 0 ? 294 : _v, _w = _a.style, style = _w === void 0 ? {} : _w, className = _a.className, _x = _a.disableDarkMode, disableDarkMode = _x === void 0 ? false : _x, _y = _a.disableLightMode, disableLightMode = _y === void 0 ? false : _y;
var id = _a.id, _b = _a.value, value = _b === void 0 ? 'rgba(175, 51, 242, 1)' : _b, onChange = _a.onChange, _c = _a.hideControls, hideControls = _c === void 0 ? false : _c, _d = _a.hideInputs, hideInputs = _d === void 0 ? false : _d, _e = _a.hideOpacity, hideOpacity = _e === void 0 ? false : _e, _f = _a.hidePresets, hidePresets = _f === void 0 ? false : _f, _g = _a.hideHue, hideHue = _g === void 0 ? false : _g, _h = _a.presets, presets = _h === void 0 ? [] : _h, _j = _a.hideEyeDrop, hideEyeDrop = _j === void 0 ? false : _j, _k = _a.hideAdvancedSliders, hideAdvancedSliders = _k === void 0 ? false : _k, _l = _a.hideColorGuide, hideColorGuide = _l === void 0 ? false : _l, _m = _a.hideInputType, hideInputType = _m === void 0 ? false : _m, _o = _a.hideColorTypeBtns, hideColorTypeBtns = _o === void 0 ? false : _o, _p = _a.hideGradientType, hideGradientType = _p === void 0 ? false : _p, _q = _a.hideGradientAngle, hideGradientAngle = _q === void 0 ? false : _q, _r = _a.hideGradientStop, hideGradientStop = _r === void 0 ? false : _r, _s = _a.hideGradientControls, hideGradientControls = _s === void 0 ? false : _s, _t = _a.locales, locales = _t === void 0 ? defaultLocales : _t, _u = _a.width, width = _u === void 0 ? 294 : _u, _v = _a.height, height = _v === void 0 ? 294 : _v, _w = _a.style, style = _w === void 0 ? {} : _w, className = _a.className, _x = _a.disableDarkMode, disableDarkMode = _x === void 0 ? false : _x, _y = _a.disableLightMode, disableLightMode = _y === void 0 ? false : _y, _z = _a.hidePickerSquare, hidePickerSquare = _z === void 0 ? false : _z;
var safeValue = objectToString(value);
// const contRef = useRef<HTMLDivElement>(null)
var defaultStyles = getStyles(disableDarkMode, disableLightMode);
var pickerId = id
? id
: !disableDarkMode && !disableLightMode
? 'rbgcp-color-picker'
: disableDarkMode
? 'rbgcp-color-picker-light'
: 'rbgcp-color-picker-dark';
return (React.createElement("div", {

@@ -29,3 +36,3 @@ // ref={contRef}

React.createElement(PickerContextWrapper, { value: safeValue, onChange: onChange, squareWidth: width, squareHeight: height, hideOpacity: hideOpacity, defaultStyles: defaultStyles },
React.createElement(Picker, { hideControls: hideControls, hideInputs: hideInputs, hidePresets: hidePresets, hideOpacity: hideOpacity, hideHue: hideHue, presets: presets, hideEyeDrop: hideEyeDrop, hideAdvancedSliders: hideAdvancedSliders, hideColorGuide: hideColorGuide, hideInputType: hideInputType, hideColorTypeBtns: hideColorTypeBtns, hideGradientType: hideGradientType, hideGradientAngle: hideGradientAngle, hideGradientStop: hideGradientStop, hideGradientControls: hideGradientControls, locales: locales }))));
React.createElement(Picker, { pickerId: pickerId, hideControls: hideControls, hideInputs: hideInputs, hidePresets: hidePresets, hideOpacity: hideOpacity, hideHue: hideHue, presets: presets, hideEyeDrop: hideEyeDrop, hideAdvancedSliders: hideAdvancedSliders, hideColorGuide: hideColorGuide, hideInputType: hideInputType, hideColorTypeBtns: hideColorTypeBtns, hideGradientType: hideGradientType, hideGradientAngle: hideGradientAngle, hideGradientStop: hideGradientStop, hideGradientControls: hideGradientControls, hidePickerSquare: hidePickerSquare, locales: locales }))));
}
import React from 'react';
import { LocalesProps } from '../shared/types.js';
declare const Picker: ({ locales, presets, hideHue, hideInputs, hidePresets, hideOpacity, hideEyeDrop, hideControls, hideInputType, hideColorGuide, hideGradientType, hideGradientStop, hideGradientAngle, hideColorTypeBtns, hideAdvancedSliders, hideGradientControls, }: PickerProps) => React.JSX.Element;
declare const Picker: ({ locales, presets, hideHue, pickerId, hideInputs, hidePresets, hideOpacity, hideEyeDrop, hideControls, hideInputType, hideColorGuide, hidePickerSquare, hideGradientType, hideGradientStop, hideGradientAngle, hideColorTypeBtns, hideAdvancedSliders, hideGradientControls, }: PickerProps) => React.JSX.Element;
export default Picker;

@@ -22,2 +22,4 @@ type PickerProps = {

locales?: LocalesProps;
pickerId?: string;
hidePickerSquare?: boolean;
};

@@ -11,6 +11,6 @@ import React from 'react';

var Picker = function (_a) {
var locales = _a.locales, presets = _a.presets, hideHue = _a.hideHue, hideInputs = _a.hideInputs, hidePresets = _a.hidePresets, hideOpacity = _a.hideOpacity, hideEyeDrop = _a.hideEyeDrop, hideControls = _a.hideControls, hideInputType = _a.hideInputType, hideColorGuide = _a.hideColorGuide, hideGradientType = _a.hideGradientType, hideGradientStop = _a.hideGradientStop, hideGradientAngle = _a.hideGradientAngle, hideColorTypeBtns = _a.hideColorTypeBtns, hideAdvancedSliders = _a.hideAdvancedSliders, hideGradientControls = _a.hideGradientControls;
var locales = _a.locales, presets = _a.presets, hideHue = _a.hideHue, pickerId = _a.pickerId, hideInputs = _a.hideInputs, hidePresets = _a.hidePresets, hideOpacity = _a.hideOpacity, hideEyeDrop = _a.hideEyeDrop, hideControls = _a.hideControls, hideInputType = _a.hideInputType, hideColorGuide = _a.hideColorGuide, hidePickerSquare = _a.hidePickerSquare, hideGradientType = _a.hideGradientType, hideGradientStop = _a.hideGradientStop, hideGradientAngle = _a.hideGradientAngle, hideColorTypeBtns = _a.hideColorTypeBtns, hideAdvancedSliders = _a.hideAdvancedSliders, hideGradientControls = _a.hideGradientControls;
var isGradient = usePicker().isGradient;
return (React.createElement("div", { style: { userSelect: 'none' }, id: "rbgcp-wrapper" },
React.createElement(Square, null),
return (React.createElement("div", { style: { userSelect: 'none' }, id: pickerId !== null && pickerId !== void 0 ? pickerId : 'rbgcp-color-picker' },
!hidePickerSquare && React.createElement(Square, null),
!hideControls && (React.createElement(Controls, { locales: locales, hideEyeDrop: hideEyeDrop, hideInputType: hideInputType, hideColorGuide: hideColorGuide, hideGradientType: hideGradientType, hideGradientStop: hideGradientStop, hideColorTypeBtns: hideColorTypeBtns, hideGradientAngle: hideGradientAngle, hideAdvancedSliders: hideAdvancedSliders, hideGradientControls: hideGradientControls })),

@@ -17,0 +17,0 @@ isGradient && React.createElement(GradientBar, null),

@@ -48,3 +48,3 @@ /* eslint-disable react/no-array-index-key */

marginBottom: 2,
border: p === 'rgba(255,255,255, 1)' ? '1px solid #96959c' : '',
border: p === 'rgba(255,255,255,1)' ? '1px solid #96959c' : '',
},

@@ -51,0 +51,0 @@ // className="rbgcp-preset-color"

@@ -111,2 +111,3 @@ var __assign = (this && this.__assign) || function () {

var handleChange = function (newColor) {
newColor = newColor === null || newColor === void 0 ? void 0 : newColor.replace(/\s+/g, '');
if (isGradient) {

@@ -113,0 +114,0 @@ handleGradient(newColor);

export type ColorPickerProps = {
id?: string;
value?: string;

@@ -26,2 +27,3 @@ onChange: (value: string) => void;

disableLightMode?: boolean;
hidePickerSquare?: boolean;
};

@@ -28,0 +30,0 @@ export type ColorsProps = {

{
"name": "react-best-gradient-color-picker",
"version": "3.0.12-beta.1",
"version": "3.0.12-beta.2",
"description": "An easy to use color/gradient picker for React.js",

@@ -5,0 +5,0 @@ "type": "module",

@@ -92,4 +92,4 @@ [![Npm Version][npm-version-image]][npm-version-url]

| locales | `object` | { CONTROLS: { SOLID: 'Solid', GRADIENT: 'Gradient' }} | (optional) pass in custom locales |
| disbaleDarkMode | `boolean` | false | (optional) disbale automatic dark mode style adjustments |
| disbaleLightMode | `boolean` | false | (optional) force the component to only use the dark mode styles |
| disableDarkMode | `boolean` | false | (optional) disable automatic dark mode style adjustments |
| disableLightMode | `boolean` | false | (optional) force the component to only use the dark mode styles |
| className | `string` | '' | (optional) a CSS class for the picker parent (see styling for more options)|

@@ -96,0 +96,0 @@

@@ -121,2 +121,3 @@ import { useState, useEffect } from 'react'

const handleChange = (newColor: string) => {
newColor = newColor?.replace(/\s+/g, '')
if (isGradient) {

@@ -123,0 +124,0 @@ handleGradient(newColor)

export type ColorPickerProps = {
id?: string
value?: string

@@ -26,2 +27,3 @@ onChange: (value: string) => void

disableLightMode?: boolean
hidePickerSquare?: boolean
}

@@ -28,0 +30,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc