@fakhrirafiki/theme-engine 0.4.17 → 0.4.18

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
@@ -4715,10 +4715,29 @@ var MoonIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4715
4715
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
4716
4716
  }
4717
4717
  );
4718
+ var SystemIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4719
+ "svg",
4720
+ {
4721
+ xmlns: "http://www.w3.org/2000/svg",
4722
+ width: "16",
4723
+ height: "16",
4724
+ viewBox: "0 0 24 24",
4725
+ fill: "none",
4726
+ stroke: "currentColor",
4727
+ strokeWidth: "2",
4728
+ strokeLinecap: "round",
4729
+ strokeLinejoin: "round",
4730
+ className: "theme-toggle-icon",
4731
+ children: [
4732
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
4733
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
4734
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
4735
+ ]
4736
+ }
4737
+ );
4718
4738
  var ThemeToggle = (0, import_react3.forwardRef)(
4719
4739
  ({ className, size = "md", variant = "default", children, ...props }, ref) => {
4720
4740
  const { mode, resolvedMode, toggleMode } = useTheme();
4721
- const nextResolvedMode = resolvedMode === "light" ? "dark" : "light";
4722
4741
  const handleClick = (event) => {
4723
4742
  const { clientX: x, clientY: y } = event;
4724
4743
  toggleMode({ x, y });
@@ -4748,7 +4767,16 @@ var ThemeToggle = (0, import_react3.forwardRef)(
4748
4767
  );
4749
4768
  const renderIcon = () => {
4750
4769
  if (children) return children;
4751
- return nextResolvedMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MoonIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SunIcon, {});
4770
+ switch (mode) {
4771
+ case "light":
4772
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SunIcon, {});
4773
+ case "dark":
4774
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MoonIcon, {});
4775
+ case "system":
4776
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SystemIcon, {});
4777
+ default:
4778
+ return resolvedMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MoonIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SunIcon, {});
4779
+ }
4752
4780
  };
4753
4781
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4754
4782
  "button",
@@ -4756,10 +4784,10 @@ var ThemeToggle = (0, import_react3.forwardRef)(
4756
4784
  ref,
4757
4785
  className: baseClasses,
4758
4786
  onClick: handleClick,
4759
- "data-mode": mode,
4787
+ "data-mode": resolvedMode,
4760
4788
  "data-theme": resolvedMode,
4761
- "aria-label": `Switch to ${nextResolvedMode} mode`,
4762
- title: `Switch to ${nextResolvedMode} mode`,
4789
+ "aria-label": `Switch to ${resolvedMode === "light" ? "dark" : "light"} mode`,
4790
+ title: `Switch to ${resolvedMode === "light" ? "dark" : "light"} mode`,
4763
4791
  ...props,
4764
4792
  children: renderIcon()
4765
4793
  }
package/dist/index.mjs CHANGED
@@ -4671,10 +4671,29 @@ var MoonIcon = () => /* @__PURE__ */ jsx3(
4671
4671
  children: /* @__PURE__ */ jsx3("path", { d: "m12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
4672
4672
  }
4673
4673
  );
4674
+ var SystemIcon = () => /* @__PURE__ */ jsxs2(
4675
+ "svg",
4676
+ {
4677
+ xmlns: "http://www.w3.org/2000/svg",
4678
+ width: "16",
4679
+ height: "16",
4680
+ viewBox: "0 0 24 24",
4681
+ fill: "none",
4682
+ stroke: "currentColor",
4683
+ strokeWidth: "2",
4684
+ strokeLinecap: "round",
4685
+ strokeLinejoin: "round",
4686
+ className: "theme-toggle-icon",
4687
+ children: [
4688
+ /* @__PURE__ */ jsx3("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
4689
+ /* @__PURE__ */ jsx3("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
4690
+ /* @__PURE__ */ jsx3("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
4691
+ ]
4692
+ }
4693
+ );
4674
4694
  var ThemeToggle = forwardRef(
4675
4695
  ({ className, size = "md", variant = "default", children, ...props }, ref) => {
4676
4696
  const { mode, resolvedMode, toggleMode } = useTheme();
4677
- const nextResolvedMode = resolvedMode === "light" ? "dark" : "light";
4678
4697
  const handleClick = (event) => {
4679
4698
  const { clientX: x, clientY: y } = event;
4680
4699
  toggleMode({ x, y });
@@ -4704,7 +4723,16 @@ var ThemeToggle = forwardRef(
4704
4723
  );
4705
4724
  const renderIcon = () => {
4706
4725
  if (children) return children;
4707
- return nextResolvedMode === "dark" ? /* @__PURE__ */ jsx3(MoonIcon, {}) : /* @__PURE__ */ jsx3(SunIcon, {});
4726
+ switch (mode) {
4727
+ case "light":
4728
+ return /* @__PURE__ */ jsx3(SunIcon, {});
4729
+ case "dark":
4730
+ return /* @__PURE__ */ jsx3(MoonIcon, {});
4731
+ case "system":
4732
+ return /* @__PURE__ */ jsx3(SystemIcon, {});
4733
+ default:
4734
+ return resolvedMode === "dark" ? /* @__PURE__ */ jsx3(MoonIcon, {}) : /* @__PURE__ */ jsx3(SunIcon, {});
4735
+ }
4708
4736
  };
4709
4737
  return /* @__PURE__ */ jsx3(
4710
4738
  "button",
@@ -4712,10 +4740,10 @@ var ThemeToggle = forwardRef(
4712
4740
  ref,
4713
4741
  className: baseClasses,
4714
4742
  onClick: handleClick,
4715
- "data-mode": mode,
4743
+ "data-mode": resolvedMode,
4716
4744
  "data-theme": resolvedMode,
4717
- "aria-label": `Switch to ${nextResolvedMode} mode`,
4718
- title: `Switch to ${nextResolvedMode} mode`,
4745
+ "aria-label": `Switch to ${resolvedMode === "light" ? "dark" : "light"} mode`,
4746
+ title: `Switch to ${resolvedMode === "light" ? "dark" : "light"} mode`,
4719
4747
  ...props,
4720
4748
  children: renderIcon()
4721
4749
  }
@@ -31,14 +31,6 @@
31
31
  color: hsl(var(--foreground));
32
32
  }
33
33
 
34
- .theme-toggle[data-theme="light"] .theme-toggle-icon {
35
- rotate: 180deg;
36
- }
37
-
38
- .theme-toggle[data-theme="dark"] .theme-toggle-icon {
39
- rotate: 0deg;
40
- }
41
-
42
34
  /* ThemePresetButtons: lightweight CSS-based animations and hover affordances */
43
35
 
44
36
  /* ThemePresetButtons: base button styling (no Tailwind required) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fakhrirafiki/theme-engine",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "Elegant theming system with smooth transitions, custom presets, semantic accent colors, and complete shadcn/ui support for modern React applications",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",