react-iro-gradient-picker 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  <!-- markdownlint-disable -->
2
+
2
3
  # React Iro Gradient Picker
3
4
 
4
5
  ## ✨ Modern React Color Picker with Complete Dark Theme Support! ✨
@@ -27,8 +28,9 @@ A beautiful, modern React gradient and solid color picker with full dark theme i
27
28
  ### 🚀 **[✨ Try it Live - Interactive Storybook Demo ✨](https://romfatal.github.io/react-iro-gradient-picker/)**
28
29
 
29
30
  Experience all features in action:
31
+
30
32
  - 🌙 **Dark/Light Theme Toggle** - Switch themes and see all components adapt
31
- - 🎨 **Solid Color Picker** - Pick any solid color with alpha transparency
33
+ - 🎨 **Solid Color Picker** - Pick any solid color with alpha transparency
32
34
  - 🌈 **Gradient Picker** - Create linear/radial gradients with multiple stops
33
35
  - 🔄 **Dual Mode** - Switch between solid and gradient modes seamlessly
34
36
  - 📱 **Responsive Design** - Works perfectly on desktop and mobile
@@ -91,7 +93,7 @@ function App() {
91
93
  const [color, setColor] = useState('#3B82F6');
92
94
 
93
95
  return (
94
- <ThemeProvider defaultTheme="dark">
96
+ <ThemeProvider defaultTheme='dark'>
95
97
  <ColorPicker
96
98
  solid
97
99
  gradient
@@ -245,4 +247,7 @@ Special thanks to the original author for creating such a solid foundation! 🙏
245
247
  MIT © [romfatal](https://github.com/romfatal)
246
248
 
247
249
  Original project: MIT © [undind](https://github.com/undind)
250
+
251
+ ```
252
+
248
253
  ```
package/dist/index.es.js CHANGED
@@ -91,13 +91,18 @@ var ThemeProvider = function (_a) {
91
91
  return defaultTheme;
92
92
  }), 2), theme = _c[0], setTheme = _c[1];
93
93
  useEffect(function () {
94
- var root = window.document.documentElement;
95
- // Remove previous theme class
96
- root.classList.remove('light', 'dark');
97
- // Add new theme class
98
- root.classList.add(theme);
94
+ // Apply theme to local container instead of document root for better scoping
95
+ var containers = document.querySelectorAll('[data-color-picker-theme]');
96
+ containers.forEach(function (container) {
97
+ // Remove previous theme class
98
+ container.classList.remove('light', 'dark');
99
+ // Add new theme class
100
+ container.classList.add(theme);
101
+ });
99
102
  // Store theme preference
100
- localStorage.setItem('color-picker-theme', theme);
103
+ if (typeof window !== 'undefined') {
104
+ localStorage.setItem('color-picker-theme', theme);
105
+ }
101
106
  }, [theme]);
102
107
  var toggleTheme = function () {
103
108
  setTheme(function (prevTheme) { return (prevTheme === 'light' ? 'dark' : 'light'); });
@@ -7947,9 +7952,9 @@ var IroGradient = function (_a) {
7947
7952
  height: colorBoardHeight + pickerWidth
7948
7953
  } },
7949
7954
  React.createElement(IroColorPicker, { ref: iroPickerRef, width: pickerWidth, color: iroColorValue, layout: layoutConfig, onColorChange: handleIroColorChange }))),
7950
- React.createElement("div", { className: 'rounded-lg colorpicker-glass' },
7955
+ React.createElement("div", { className: 'rounded-lg colorpicker-glass px-4' },
7951
7956
  React.createElement(GradientPanel$1, { color: color, activeColor: activeColor, setActiveColor: handleSetActiveColor, setColor: updateGradient, setInit: setInit, format: format, showAlpha: showAlpha, showGradientResult: showGradientResult, showGradientStops: showGradientStops, showGradientMode: showGradientMode, showGradientAngle: showGradientAngle, showGradientPosition: showGradientPosition, allowAddGradientStops: allowAddGradientStops })),
7952
- React.createElement("div", { className: 'pt-4' },
7957
+ React.createElement("div", { className: 'pt-4 px-2' },
7953
7958
  React.createElement(DefaultColorPanel, { defaultColors: defaultColors, setColor: handleColorFromPanel, setInit: function () { }, setActiveColor: handleSetActiveColor, colorType: 'gradient' })),
7954
7959
  showInputs && (React.createElement("div", { className: 'rounded-lg colorpicker-glass' },
7955
7960
  React.createElement(InputRgba, { hex: activeColor.hex, alpha: activeColor.alpha, showAlpha: showAlpha, onChange: function (value) {
@@ -8208,7 +8213,7 @@ var PopupTabs = function (_a) {
8208
8213
  activeTab: activeTab
8209
8214
  });
8210
8215
  });
8211
- return (React.createElement("div", { className: 'relative rounded-md colorpicker-glass', style: { width: "".concat(popupWidth, "px") } }, childrenContact));
8216
+ return (React.createElement("div", { className: 'relative rounded-md', style: { width: "".concat(popupWidth, "px") } }, childrenContact));
8212
8217
  };
8213
8218
  var PopupTabsHeaderLabel = function (_a) {
8214
8219
  var children = _a.children, activeTab = _a.activeTab, tabName = _a.tabName, onClick = _a.onClick;
@@ -8259,7 +8264,7 @@ var ColorPicker = function (_a) {
8259
8264
  };
8260
8265
  if (solid && gradient) {
8261
8266
  return (React.createElement(ThemeProvider, null,
8262
- React.createElement("div", { className: 'relative' },
8267
+ React.createElement("div", { className: 'relative dark', "data-color-picker-theme": true },
8263
8268
  React.createElement(ThemeToggle, null),
8264
8269
  React.createElement(PopupTabs, { activeTab: activeTab, popupWidth: popupWidth },
8265
8270
  React.createElement(PopupTabsHeader, null,
@@ -8272,7 +8277,7 @@ var ColorPicker = function (_a) {
8272
8277
  React.createElement(IroGradient, { onChange: onChangeGradient, value: value, format: format, defaultColors: defaultColors, debounceMS: debounceMS, debounce: debounce, showAlpha: showAlpha, showInputs: showInputs, showGradientResult: showGradientResult, showGradientStops: showGradientStops, showGradientMode: showGradientMode, showGradientAngle: showGradientAngle, showGradientPosition: showGradientPosition, allowAddGradientStops: allowAddGradientStops, colorBoardHeight: colorBoardHeight })))))));
8273
8278
  }
8274
8279
  return (React.createElement(ThemeProvider, null,
8275
- React.createElement("div", { className: 'relative' },
8280
+ React.createElement("div", { className: 'relative dark', "data-color-picker-theme": true },
8276
8281
  React.createElement(ThemeToggle, null),
8277
8282
  solid || gradient ? (React.createElement(PopupTabs, { popupWidth: popupWidth },
8278
8283
  React.createElement(PopupTabsBody, null,