@dheme/react 2.12.0 → 2.13.0

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
@@ -314,15 +314,17 @@ The component renders as a pill in the corner of the screen. Clicking it expands
314
314
 
315
315
  ```tsx
316
316
  <ThemeGenerator
317
- defaultTheme="#4332f6" // Initial primary color
318
- defaultSecondaryColor="#ab67f1" // Initial secondary color
319
- defaultSaturation={10} // Initial saturation adjust (-100 to 100)
320
- defaultLightness={2} // Initial lightness adjust (-100 to 100)
321
- defaultRadius={0} // Initial border radius (0 to 2 rem)
322
- position="bottom-right" // 'bottom-right' | 'bottom-left'
323
- open={isOpen} // Controlled open state (optional)
324
- onOpenChange={setIsOpen} // Controlled open callback (optional)
325
- labels={{ // i18n overrides (all optional)
317
+ defaultTheme="#4332f6" // Initial primary color
318
+ defaultSecondaryColor="#ab67f1" // Initial secondary color
319
+ defaultSecondaryEnabled={false} // Whether secondary starts enabled
320
+ defaultSaturation={10} // Initial saturation adjust (-100 to 100)
321
+ defaultLightness={2} // Initial lightness adjust (-100 to 100)
322
+ defaultRadius={0} // Initial border radius (0 to 2 rem)
323
+ defaultBackgroundIsColored={false} // Initial colorful background toggle
324
+ position="bottom-right" // 'bottom-right' | 'bottom-left'
325
+ open={isOpen} // Controlled open state (optional)
326
+ onOpenChange={setIsOpen} // Controlled open callback (optional)
327
+ labels={{ // i18n overrides (all optional)
326
328
  title: 'Theme Generator',
327
329
  primary: 'Primary Color',
328
330
  secondary: 'Secondary Color',
@@ -330,7 +332,7 @@ The component renders as a pill in the corner of the screen. Clicking it expands
330
332
  lightness: 'Brightness',
331
333
  reset: 'Restore defaults',
332
334
  }}
333
- className="my-fab" // Extra class on the container (optional)
335
+ className="my-fab" // Extra class on the container (optional)
334
336
  />
335
337
  ```
336
338
 
@@ -338,9 +340,11 @@ The component renders as a pill in the corner of the screen. Clicking it expands
338
340
  | --- | --- | --- | --- |
339
341
  | `defaultTheme` | `string` | `'#4332f6'` | Initial primary HEX color. |
340
342
  | `defaultSecondaryColor` | `string` | `'#ab67f1'` | Initial secondary HEX color. |
343
+ | `defaultSecondaryEnabled` | `boolean` | `false` | Whether secondary color starts enabled. |
341
344
  | `defaultSaturation` | `number` | `10` | Initial saturation adjust (-100–100). |
342
345
  | `defaultLightness` | `number` | `2` | Initial lightness adjust (-100–100). |
343
346
  | `defaultRadius` | `number` | `0` | Initial border radius (0–2 rem). |
347
+ | `defaultBackgroundIsColored` | `boolean` | `false` | Initial state of the colorful background toggle. |
344
348
  | `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Corner to anchor the FAB. |
345
349
  | `open` | `boolean` | — | Controlled open state. Omit for uncontrolled. |
346
350
  | `onOpenChange` | `(open: boolean) => void` | — | Called when open state changes. |
package/dist/index.d.mts CHANGED
@@ -67,9 +67,11 @@ declare function DhemeScript({ defaultMode, nonce, }: DhemeScriptProps): React__
67
67
  interface ThemeGeneratorProps {
68
68
  defaultTheme?: string;
69
69
  defaultSecondaryColor?: string;
70
+ defaultSecondaryEnabled?: boolean;
70
71
  defaultSaturation?: number;
71
72
  defaultLightness?: number;
72
73
  defaultRadius?: number;
74
+ defaultBackgroundIsColored?: boolean;
73
75
  position?: 'bottom-right' | 'bottom-left';
74
76
  open?: boolean;
75
77
  onOpenChange?: (open: boolean) => void;
@@ -93,7 +95,7 @@ interface ThemeGeneratorProps {
93
95
  };
94
96
  className?: string;
95
97
  }
96
- declare function ThemeGenerator({ defaultTheme, defaultSecondaryColor, defaultSaturation, defaultLightness, defaultRadius, position, open: controlledOpen, onOpenChange, labels: labelsProp, className, }: ThemeGeneratorProps): React__default.ReactElement;
98
+ declare function ThemeGenerator({ defaultTheme, defaultSecondaryColor, defaultSecondaryEnabled, defaultSaturation, defaultLightness, defaultRadius, defaultBackgroundIsColored, position, open: controlledOpen, onOpenChange, labels: labelsProp, className, }: ThemeGeneratorProps): React__default.ReactElement;
97
99
 
98
100
  declare function useTheme(): ThemeDataState;
99
101
 
package/dist/index.d.ts CHANGED
@@ -67,9 +67,11 @@ declare function DhemeScript({ defaultMode, nonce, }: DhemeScriptProps): React__
67
67
  interface ThemeGeneratorProps {
68
68
  defaultTheme?: string;
69
69
  defaultSecondaryColor?: string;
70
+ defaultSecondaryEnabled?: boolean;
70
71
  defaultSaturation?: number;
71
72
  defaultLightness?: number;
72
73
  defaultRadius?: number;
74
+ defaultBackgroundIsColored?: boolean;
73
75
  position?: 'bottom-right' | 'bottom-left';
74
76
  open?: boolean;
75
77
  onOpenChange?: (open: boolean) => void;
@@ -93,7 +95,7 @@ interface ThemeGeneratorProps {
93
95
  };
94
96
  className?: string;
95
97
  }
96
- declare function ThemeGenerator({ defaultTheme, defaultSecondaryColor, defaultSaturation, defaultLightness, defaultRadius, position, open: controlledOpen, onOpenChange, labels: labelsProp, className, }: ThemeGeneratorProps): React__default.ReactElement;
98
+ declare function ThemeGenerator({ defaultTheme, defaultSecondaryColor, defaultSecondaryEnabled, defaultSaturation, defaultLightness, defaultRadius, defaultBackgroundIsColored, position, open: controlledOpen, onOpenChange, labels: labelsProp, className, }: ThemeGeneratorProps): React__default.ReactElement;
97
99
 
98
100
  declare function useTheme(): ThemeDataState;
99
101
 
package/dist/index.js CHANGED
@@ -1015,9 +1015,11 @@ function cn(...classes) {
1015
1015
  function ThemeGenerator({
1016
1016
  defaultTheme = "#4332f6",
1017
1017
  defaultSecondaryColor = "#ab67f1",
1018
+ defaultSecondaryEnabled = false,
1018
1019
  defaultSaturation = 10,
1019
1020
  defaultLightness = 2,
1020
1021
  defaultRadius = 0,
1022
+ defaultBackgroundIsColored = false,
1021
1023
  position = "bottom-right",
1022
1024
  open: controlledOpen,
1023
1025
  onOpenChange,
@@ -1055,12 +1057,12 @@ function ThemeGenerator({
1055
1057
  );
1056
1058
  const [localPrimary, setLocalPrimary] = (0, import_react7.useState)(defaultTheme);
1057
1059
  const [localSecondary, setLocalSecondary] = (0, import_react7.useState)(defaultSecondaryColor);
1058
- const [isSecondaryEnabled, setIsSecondaryEnabled] = (0, import_react7.useState)(false);
1060
+ const [isSecondaryEnabled, setIsSecondaryEnabled] = (0, import_react7.useState)(defaultSecondaryEnabled);
1059
1061
  const [localSaturation, setLocalSaturation] = (0, import_react7.useState)([defaultSaturation]);
1060
1062
  const [localLightness, setLocalLightness] = (0, import_react7.useState)([defaultLightness]);
1061
1063
  const [localRadius, setLocalRadius] = (0, import_react7.useState)([defaultRadius]);
1062
1064
  const [localCardIsColored, setLocalCardIsColored] = (0, import_react7.useState)(false);
1063
- const [localBackgroundIsColored, setLocalBackgroundIsColored] = (0, import_react7.useState)(false);
1065
+ const [localBackgroundIsColored, setLocalBackgroundIsColored] = (0, import_react7.useState)(defaultBackgroundIsColored);
1064
1066
  const [localBorderIsColored, setLocalBorderIsColored] = (0, import_react7.useState)(false);
1065
1067
  const paramsRef = (0, import_react7.useRef)({
1066
1068
  theme: localPrimary,
@@ -1133,17 +1135,18 @@ function ThemeGenerator({
1133
1135
  setLocalSaturation([defaultSaturation]);
1134
1136
  setLocalLightness([defaultLightness]);
1135
1137
  setLocalRadius([defaultRadius]);
1136
- setIsSecondaryEnabled(false);
1138
+ setIsSecondaryEnabled(defaultSecondaryEnabled);
1137
1139
  setLocalCardIsColored(false);
1138
- setLocalBackgroundIsColored(false);
1140
+ setLocalBackgroundIsColored(defaultBackgroundIsColored);
1139
1141
  setLocalBorderIsColored(false);
1140
1142
  generateTheme({
1141
1143
  theme: defaultTheme,
1144
+ secondaryColor: defaultSecondaryEnabled ? defaultSecondaryColor : void 0,
1142
1145
  saturationAdjust: defaultSaturation,
1143
1146
  lightnessAdjust: defaultLightness,
1144
1147
  radius: defaultRadius,
1145
1148
  cardIsColored: false,
1146
- backgroundIsColored: false,
1149
+ backgroundIsColored: defaultBackgroundIsColored,
1147
1150
  borderIsColored: false
1148
1151
  });
1149
1152
  };
package/dist/index.mjs CHANGED
@@ -965,9 +965,11 @@ function cn(...classes) {
965
965
  function ThemeGenerator({
966
966
  defaultTheme = "#4332f6",
967
967
  defaultSecondaryColor = "#ab67f1",
968
+ defaultSecondaryEnabled = false,
968
969
  defaultSaturation = 10,
969
970
  defaultLightness = 2,
970
971
  defaultRadius = 0,
972
+ defaultBackgroundIsColored = false,
971
973
  position = "bottom-right",
972
974
  open: controlledOpen,
973
975
  onOpenChange,
@@ -1005,12 +1007,12 @@ function ThemeGenerator({
1005
1007
  );
1006
1008
  const [localPrimary, setLocalPrimary] = useState3(defaultTheme);
1007
1009
  const [localSecondary, setLocalSecondary] = useState3(defaultSecondaryColor);
1008
- const [isSecondaryEnabled, setIsSecondaryEnabled] = useState3(false);
1010
+ const [isSecondaryEnabled, setIsSecondaryEnabled] = useState3(defaultSecondaryEnabled);
1009
1011
  const [localSaturation, setLocalSaturation] = useState3([defaultSaturation]);
1010
1012
  const [localLightness, setLocalLightness] = useState3([defaultLightness]);
1011
1013
  const [localRadius, setLocalRadius] = useState3([defaultRadius]);
1012
1014
  const [localCardIsColored, setLocalCardIsColored] = useState3(false);
1013
- const [localBackgroundIsColored, setLocalBackgroundIsColored] = useState3(false);
1015
+ const [localBackgroundIsColored, setLocalBackgroundIsColored] = useState3(defaultBackgroundIsColored);
1014
1016
  const [localBorderIsColored, setLocalBorderIsColored] = useState3(false);
1015
1017
  const paramsRef = useRef2({
1016
1018
  theme: localPrimary,
@@ -1083,17 +1085,18 @@ function ThemeGenerator({
1083
1085
  setLocalSaturation([defaultSaturation]);
1084
1086
  setLocalLightness([defaultLightness]);
1085
1087
  setLocalRadius([defaultRadius]);
1086
- setIsSecondaryEnabled(false);
1088
+ setIsSecondaryEnabled(defaultSecondaryEnabled);
1087
1089
  setLocalCardIsColored(false);
1088
- setLocalBackgroundIsColored(false);
1090
+ setLocalBackgroundIsColored(defaultBackgroundIsColored);
1089
1091
  setLocalBorderIsColored(false);
1090
1092
  generateTheme({
1091
1093
  theme: defaultTheme,
1094
+ secondaryColor: defaultSecondaryEnabled ? defaultSecondaryColor : void 0,
1092
1095
  saturationAdjust: defaultSaturation,
1093
1096
  lightnessAdjust: defaultLightness,
1094
1097
  radius: defaultRadius,
1095
1098
  cardIsColored: false,
1096
- backgroundIsColored: false,
1099
+ backgroundIsColored: defaultBackgroundIsColored,
1097
1100
  borderIsColored: false
1098
1101
  });
1099
1102
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dheme/react",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "React bindings for Dheme SDK with zero-FOUC theme application",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",