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/dist/index.js CHANGED
@@ -99,13 +99,18 @@ var ThemeProvider = function (_a) {
99
99
  return defaultTheme;
100
100
  }), 2), theme = _c[0], setTheme = _c[1];
101
101
  React.useEffect(function () {
102
- var root = window.document.documentElement;
103
- // Remove previous theme class
104
- root.classList.remove('light', 'dark');
105
- // Add new theme class
106
- root.classList.add(theme);
102
+ // Apply theme to local container instead of document root for better scoping
103
+ var containers = document.querySelectorAll('[data-color-picker-theme]');
104
+ containers.forEach(function (container) {
105
+ // Remove previous theme class
106
+ container.classList.remove('light', 'dark');
107
+ // Add new theme class
108
+ container.classList.add(theme);
109
+ });
107
110
  // Store theme preference
108
- localStorage.setItem('color-picker-theme', theme);
111
+ if (typeof window !== 'undefined') {
112
+ localStorage.setItem('color-picker-theme', theme);
113
+ }
109
114
  }, [theme]);
110
115
  var toggleTheme = function () {
111
116
  setTheme(function (prevTheme) { return (prevTheme === 'light' ? 'dark' : 'light'); });
@@ -7955,9 +7960,9 @@ var IroGradient = function (_a) {
7955
7960
  height: colorBoardHeight + pickerWidth
7956
7961
  } },
7957
7962
  React__default["default"].createElement(IroColorPicker, { ref: iroPickerRef, width: pickerWidth, color: iroColorValue, layout: layoutConfig, onColorChange: handleIroColorChange }))),
7958
- React__default["default"].createElement("div", { className: 'rounded-lg colorpicker-glass' },
7963
+ React__default["default"].createElement("div", { className: 'rounded-lg colorpicker-glass px-4' },
7959
7964
  React__default["default"].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 })),
7960
- React__default["default"].createElement("div", { className: 'pt-4' },
7965
+ React__default["default"].createElement("div", { className: 'pt-4 px-2' },
7961
7966
  React__default["default"].createElement(DefaultColorPanel, { defaultColors: defaultColors, setColor: handleColorFromPanel, setInit: function () { }, setActiveColor: handleSetActiveColor, colorType: 'gradient' })),
7962
7967
  showInputs && (React__default["default"].createElement("div", { className: 'rounded-lg colorpicker-glass' },
7963
7968
  React__default["default"].createElement(InputRgba, { hex: activeColor.hex, alpha: activeColor.alpha, showAlpha: showAlpha, onChange: function (value) {
@@ -8216,7 +8221,7 @@ var PopupTabs = function (_a) {
8216
8221
  activeTab: activeTab
8217
8222
  });
8218
8223
  });
8219
- return (React__default["default"].createElement("div", { className: 'relative rounded-md colorpicker-glass', style: { width: "".concat(popupWidth, "px") } }, childrenContact));
8224
+ return (React__default["default"].createElement("div", { className: 'relative rounded-md', style: { width: "".concat(popupWidth, "px") } }, childrenContact));
8220
8225
  };
8221
8226
  var PopupTabsHeaderLabel = function (_a) {
8222
8227
  var children = _a.children, activeTab = _a.activeTab, tabName = _a.tabName, onClick = _a.onClick;
@@ -8267,7 +8272,7 @@ var ColorPicker = function (_a) {
8267
8272
  };
8268
8273
  if (solid && gradient) {
8269
8274
  return (React__default["default"].createElement(ThemeProvider, null,
8270
- React__default["default"].createElement("div", { className: 'relative' },
8275
+ React__default["default"].createElement("div", { className: 'relative dark', "data-color-picker-theme": true },
8271
8276
  React__default["default"].createElement(ThemeToggle, null),
8272
8277
  React__default["default"].createElement(PopupTabs, { activeTab: activeTab, popupWidth: popupWidth },
8273
8278
  React__default["default"].createElement(PopupTabsHeader, null,
@@ -8280,7 +8285,7 @@ var ColorPicker = function (_a) {
8280
8285
  React__default["default"].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 })))))));
8281
8286
  }
8282
8287
  return (React__default["default"].createElement(ThemeProvider, null,
8283
- React__default["default"].createElement("div", { className: 'relative' },
8288
+ React__default["default"].createElement("div", { className: 'relative dark', "data-color-picker-theme": true },
8284
8289
  React__default["default"].createElement(ThemeToggle, null),
8285
8290
  solid || gradient ? (React__default["default"].createElement(PopupTabs, { popupWidth: popupWidth },
8286
8291
  React__default["default"].createElement(PopupTabsBody, null,