@olwiba/cn 0.1.27 → 0.1.28

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.d.ts CHANGED
@@ -880,7 +880,7 @@ interface SliderProps extends React$1.ComponentPropsWithoutRef<typeof SliderPrim
880
880
  }
881
881
  declare const Slider: React$1.ForwardRefExoticComponent<SliderProps & React$1.RefAttributes<HTMLSpanElement>>;
882
882
 
883
- type ToasterProps = React.ComponentProps<typeof Toaster$1>;
883
+ type ToasterProps = React$1.ComponentProps<typeof Toaster$1>;
884
884
  type ToasterMode = "playful" | "smooth";
885
885
  declare const Toaster: ({ mode: modeProp, className, style, ...props }: ToasterProps & {
886
886
  mode?: ToasterMode;
package/dist/index.js CHANGED
@@ -35,7 +35,6 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
35
35
  import * as SelectPrimitive from '@radix-ui/react-select';
36
36
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
37
37
  import * as SliderPrimitive from '@radix-ui/react-slider';
38
- import { useTheme } from 'next-themes';
39
38
  import { Toaster as Toaster$1 } from 'sonner';
40
39
  import * as SwitchPrimitives from '@radix-ui/react-switch';
41
40
  import * as TabsPrimitive from '@radix-ui/react-tabs';
@@ -4989,10 +4988,57 @@ var Slider = React37.forwardRef(({ className, size = "default", ...props }, ref)
4989
4988
  }
4990
4989
  ));
4991
4990
  Slider.displayName = SliderPrimitive.Root.displayName;
4991
+ function useDocumentTheme() {
4992
+ const [theme, setTheme] = React37.useState("light");
4993
+ React37.useEffect(() => {
4994
+ const root = document.documentElement;
4995
+ const read = () => setTheme(
4996
+ root.classList.contains("dark") || root.dataset.theme === "dark" ? "dark" : "light"
4997
+ );
4998
+ read();
4999
+ const observer = new MutationObserver(read);
5000
+ observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
5001
+ return () => observer.disconnect();
5002
+ }, []);
5003
+ return theme;
5004
+ }
4992
5005
  var Toaster = ({ mode: modeProp, className, style, ...props }) => {
4993
- const { theme = "system" } = useTheme();
4994
- const mode = modeProp ?? useUIVariant();
5006
+ const theme = useDocumentTheme();
5007
+ const ctxVariant = useUIVariant();
5008
+ const mode = modeProp ?? ctxVariant;
4995
5009
  return /* @__PURE__ */ jsxs(Fragment, { children: [
5010
+ /* @__PURE__ */ jsx("style", { children: `
5011
+ [data-sonner-toaster] {
5012
+ --toast-close-button-start: unset;
5013
+ --toast-close-button-end: 0.5rem;
5014
+ --toast-close-button-transform: translateY(0.5rem);
5015
+ }
5016
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-close-button] {
5017
+ height: 1.25rem;
5018
+ width: 1.25rem;
5019
+ padding: 0;
5020
+ border: none;
5021
+ border-radius: var(--radius-sm);
5022
+ background: transparent;
5023
+ /* Inherited rather than a fixed token: on a richColors toast the
5024
+ text is already the only colour guaranteed to read against that
5025
+ background, so borrowing it keeps the button legible on every
5026
+ variant without a rule per type. */
5027
+ color: inherit;
5028
+ opacity: 0.6;
5029
+ transition: opacity 150ms ease, background-color 150ms ease;
5030
+ }
5031
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-close-button] svg {
5032
+ height: 0.75rem;
5033
+ width: 0.75rem;
5034
+ }
5035
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true']:hover [data-close-button]:hover {
5036
+ background: color-mix(in oklab, currentColor 12%, transparent);
5037
+ border-color: transparent;
5038
+ color: inherit;
5039
+ opacity: 1;
5040
+ }
5041
+ ` }),
4996
5042
  mode === "smooth" && /* @__PURE__ */ jsx("style", { children: `[data-sonner-toaster].toaster-smooth { --border-radius: 1.5rem; }` }),
4997
5043
  mode === "playful" && /* @__PURE__ */ jsx("style", { children: `
4998
5044
  [data-sonner-toaster].toaster-playful [data-sonner-toast][data-mounted=true] {