@nayhoo/ui 0.9.4 → 0.9.5

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.
@@ -10,7 +10,7 @@ import {
10
10
  toastInner,
11
11
  toastRoot,
12
12
  toastViewport
13
- } from "../chunk-54ZBX4ZK.mjs";
13
+ } from "../chunk-53LAMNK6.mjs";
14
14
  import {
15
15
  Heading
16
16
  } from "../chunk-PIOIL3MF.mjs";
@@ -30,69 +30,117 @@ import "../chunk-7EGQM3ZL.mjs";
30
30
  import "../chunk-LZOMFHX3.mjs";
31
31
 
32
32
  // src/providers/theme-provider.tsx
33
- import { createContext, useEffect, useState } from "react";
33
+ import {
34
+ createContext,
35
+ useCallback,
36
+ useEffect,
37
+ useMemo,
38
+ useState
39
+ } from "react";
40
+
41
+ // src/providers/script.ts
42
+ var script = (storageKey2, defaultTheme2, classes2) => {
43
+ const el = document.documentElement;
44
+ function updateDOM(theme) {
45
+ el.classList.remove(...Object.values(classes2));
46
+ el.classList.add(classes2[theme]);
47
+ }
48
+ function getSystemTheme2() {
49
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
50
+ }
51
+ try {
52
+ const themeName = localStorage.getItem(storageKey2) || defaultTheme2;
53
+ const isSystem = themeName === "system";
54
+ const theme = isSystem ? getSystemTheme2() : themeName;
55
+ updateDOM(theme);
56
+ } catch (e) {
57
+ }
58
+ };
59
+
60
+ // src/providers/theme-provider.tsx
34
61
  import { jsx, jsxs } from "react/jsx-runtime";
35
- var themes = ["light", "dark", "system"];
62
+ var MEDIA = "(prefers-color-scheme: dark)";
63
+ var isServer = typeof window === "undefined";
36
64
  var storageKey = "nayhoo-theme";
65
+ var themes = ["light", "dark", "system"];
66
+ var defaultTheme = "system";
67
+ var classes = {
68
+ light: lightTheme,
69
+ dark: darkTheme
70
+ };
37
71
  var ThemeContext = createContext({
38
- theme: "system",
72
+ theme: defaultTheme,
39
73
  setTheme: () => {
40
74
  },
75
+ resolvedTheme: "light",
41
76
  themes
42
77
  });
43
- var defaultTheme = "system";
44
78
  var ThemeProvider = ({ children }) => {
45
79
  const [theme, setTheme] = useState(() => getTheme());
46
- const applyTheme = (theme2) => {
47
- var _a, _b, _c, _d;
48
- const isDark = theme2 === "dark";
49
- const isSystem = theme2 === "system";
50
- if (isDark || (isSystem || !(storageKey in localStorage)) && window.matchMedia("(prefers-color-scheme: dark)").matches) {
51
- (_a = document.querySelector("html")) == null ? void 0 : _a.classList.add(darkTheme);
52
- (_b = document.querySelector("html")) == null ? void 0 : _b.classList.remove(lightTheme);
53
- } else {
54
- (_c = document.querySelector("html")) == null ? void 0 : _c.classList.add(lightTheme);
55
- (_d = document.querySelector("html")) == null ? void 0 : _d.classList.remove(darkTheme);
56
- }
57
- };
80
+ const [resolvedTheme, setResolvedTheme] = useState(
81
+ () => theme === "system" ? getSystemTheme() : theme
82
+ );
83
+ const applyTheme = useCallback((theme2) => {
84
+ const resolved = resolveTheme(theme2);
85
+ setResolvedTheme(resolved);
86
+ const d = document.documentElement;
87
+ d.classList.remove(...Object.values(classes));
88
+ d.classList.add(classes[resolved]);
89
+ }, []);
58
90
  useEffect(() => {
59
91
  applyTheme(theme);
60
92
  try {
61
93
  localStorage.setItem(storageKey, theme);
62
94
  } catch {
63
95
  }
64
- }, [theme]);
65
- return /* @__PURE__ */ jsxs(ThemeContext, { value: { theme, setTheme, themes }, children: [
66
- /* @__PURE__ */ jsx("script", { children: `
67
- const isDark = localStorage.getItem("${storageKey}") === "dark";
68
- const isSystem = localStorage.getItem("${storageKey}") === "system";
69
-
70
- if (
71
- isDark ||
72
- ((isSystem || !("${storageKey}" in localStorage)) &&
73
- window.matchMedia("(prefers-color-scheme: dark)").matches)
74
- ) {
75
- document.querySelector("html")?.classList.add("${darkTheme}");
76
- document.querySelector("html")?.classList.remove("${lightTheme}");
77
- } else {
78
- document.querySelector("html")?.classList.add("${lightTheme}");
79
- document.querySelector("html")?.classList.remove("${darkTheme}");
80
- }
81
- ` }),
96
+ }, [applyTheme, theme]);
97
+ const value = useMemo(
98
+ () => ({
99
+ theme,
100
+ setTheme,
101
+ resolvedTheme: theme === "system" ? resolvedTheme : theme,
102
+ themes
103
+ }),
104
+ [theme, setTheme, resolvedTheme]
105
+ );
106
+ const scriptArgs = JSON.stringify([storageKey, defaultTheme, classes]).slice(
107
+ 1,
108
+ -1
109
+ );
110
+ return /* @__PURE__ */ jsxs(ThemeContext, { value, children: [
111
+ /* @__PURE__ */ jsx(
112
+ "script",
113
+ {
114
+ suppressHydrationWarning: true,
115
+ dangerouslySetInnerHTML: {
116
+ __html: `(${script.toString()})(${scriptArgs})`
117
+ }
118
+ }
119
+ ),
82
120
  children
83
121
  ] });
84
122
  };
85
123
  var getTheme = () => {
86
- var _a;
87
- if (typeof window === "undefined") {
88
- return defaultTheme;
89
- }
90
- let theme;
124
+ if (isServer) return defaultTheme;
125
+ let themeName;
91
126
  try {
92
- theme = localStorage.getItem(storageKey) || void 0;
93
- } catch {
127
+ themeName = localStorage.getItem(storageKey) || void 0;
128
+ } catch (e) {
129
+ }
130
+ return themes.find((theme) => theme === themeName) || defaultTheme;
131
+ };
132
+ var getSystemTheme = (e) => {
133
+ if (!e) e = window.matchMedia(MEDIA);
134
+ const isDark = e.matches;
135
+ const systemTheme = isDark ? "dark" : "light";
136
+ return systemTheme;
137
+ };
138
+ var resolveTheme = (theme) => {
139
+ let resolved = theme;
140
+ if (theme === "system") {
141
+ resolved = getSystemTheme();
94
142
  }
95
- return (_a = themes.find((t) => t === theme)) != null ? _a : defaultTheme;
143
+ return resolved;
96
144
  };
97
145
 
98
146
  // src/providers/toast-provider.tsx
@@ -107,7 +155,7 @@ var defaultToast = Object.assign(() => {
107
155
  error: () => {
108
156
  }
109
157
  });
110
- var ToastProviderContext = React2.createContext(defaultToast);
158
+ var ToastContext = React2.createContext(defaultToast);
111
159
  var toastElementsMapRef = React2.createRef();
112
160
  var defaultToastImpl = {
113
161
  toastElementsMapRef,
@@ -205,7 +253,7 @@ var ToastProvider = ({
205
253
  }),
206
254
  [handleDispatchDefault, handleDispatchSuccess, handleDispatchError]
207
255
  );
208
- return /* @__PURE__ */ jsx2(ToastProviderContext.Provider, { value: toastApi, children: /* @__PURE__ */ jsx2(
256
+ return /* @__PURE__ */ jsx2(ToastContext.Provider, { value: toastApi, children: /* @__PURE__ */ jsx2(
209
257
  ToastContextImpl.Provider,
210
258
  {
211
259
  value: React2.useMemo(
@@ -318,7 +366,7 @@ export {
318
366
  ThemeContext,
319
367
  ThemeProvider,
320
368
  ToastAction,
321
- ToastProvider,
322
- ToastProviderContext
369
+ ToastContext,
370
+ ToastProvider
323
371
  };
324
372
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/theme-provider.tsx","../../src/providers/toast-provider.tsx"],"sourcesContent":["import { darkTheme } from \"@/theme/themes/dark-theme.css\";\nimport { lightTheme } from \"@/theme/themes/light-theme.css\";\nimport { theme as Theme } from \"@/types/theme\";\nimport React, { createContext, useEffect, useState } from \"react\";\n\nconst themes: Theme[] = [\"light\", \"dark\", \"system\"];\nconst storageKey = \"nayhoo-theme\";\n\ntype ThemeContextProps = {\n theme: Theme;\n setTheme: React.Dispatch<React.SetStateAction<Theme>>;\n themes: Theme[];\n};\n\nexport const ThemeContext = createContext<ThemeContextProps>({\n theme: \"system\",\n setTheme: () => {},\n themes,\n});\n\ntype ThemeProviderProps = {\n children: React.ReactNode;\n defaultTheme?: Theme;\n};\n\nconst defaultTheme = \"system\";\n\nexport const ThemeProvider = ({ children }: ThemeProviderProps) => {\n const [theme, setTheme] = useState(() => getTheme());\n\n const applyTheme = (theme: Theme) => {\n const isDark = theme === \"dark\";\n const isSystem = theme === \"system\";\n\n if (\n isDark ||\n ((isSystem || !(storageKey in localStorage)) &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches)\n ) {\n document.querySelector(\"html\")?.classList.add(darkTheme);\n document.querySelector(\"html\")?.classList.remove(lightTheme);\n } else {\n document.querySelector(\"html\")?.classList.add(lightTheme);\n document.querySelector(\"html\")?.classList.remove(darkTheme);\n }\n };\n\n useEffect(() => {\n applyTheme(theme);\n\n try {\n localStorage.setItem(storageKey, theme);\n } catch {}\n }, [theme]);\n\n return (\n <ThemeContext value={{ theme, setTheme, themes }}>\n <script>\n {` \n const isDark = localStorage.getItem(\"${storageKey}\") === \"dark\";\n const isSystem = localStorage.getItem(\"${storageKey}\") === \"system\";\n\n if (\n isDark ||\n ((isSystem || !(\"${storageKey}\" in localStorage)) &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches)\n ) {\n document.querySelector(\"html\")?.classList.add(\"${darkTheme}\");\n document.querySelector(\"html\")?.classList.remove(\"${lightTheme}\");\n } else {\n document.querySelector(\"html\")?.classList.add(\"${lightTheme}\");\n document.querySelector(\"html\")?.classList.remove(\"${darkTheme}\");\n }\n `}\n </script>\n\n {children}\n </ThemeContext>\n );\n};\n\nconst getTheme = () => {\n if (typeof window === \"undefined\") {\n return defaultTheme;\n }\n\n let theme: string | undefined;\n\n try {\n theme = localStorage.getItem(storageKey) || undefined;\n } catch {}\n\n return themes.find((t) => t === theme) ?? defaultTheme;\n};\n","// Credits: https://codesandbox.io/p/sandbox/radix-toast-stack-dpfx5f\n\nimport { Button } from \"@/components/button\";\nimport { Heading } from \"@/components/heading\";\nimport { IconButton } from \"@/components/icon-button\";\nimport { Text } from \"@/components/text\";\nimport {\n checkmark,\n error,\n toastClose,\n toastInner,\n toastRoot,\n toastViewport,\n} from \"@/theme/styles/toaster.css\";\nimport { Cross2Icon } from \"@radix-ui/react-icons\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport * as React from \"react\";\n\ntype Toast = {\n title?: string;\n description?: string;\n status: \"default\" | \"error\" | \"success\";\n action?: React.ReactNode;\n} & ToastPrimitives.ToastProps;\n\ntype AddToastPayload = Omit<Toast, \"status\">;\n\ntype ToastProviderContextProps = ((payload: AddToastPayload) => void) & {\n error: (payload: AddToastPayload) => void;\n success: (payload: AddToastPayload) => void;\n};\n\nconst defaultToast: ToastProviderContextProps = Object.assign(() => {}, {\n success: () => {},\n error: () => {},\n});\n\nexport const ToastProviderContext = React.createContext(defaultToast);\n\ntype ToastContextImplProps = {\n toastElementsMapRef: React.RefObject<Map<string, HTMLLIElement> | null>;\n sortToasts: () => void;\n};\n\nconst toastElementsMapRef = React.createRef<Map<string, HTMLLIElement>>();\n\nconst defaultToastImpl: ToastContextImplProps = {\n toastElementsMapRef,\n sortToasts: () => {},\n};\n\nconst ToastContextImpl = React.createContext(defaultToastImpl);\n\nconst ANIMATION_OUT_DURATION = 350;\n\nexport const ToastProvider = ({\n children,\n ...props\n}: ToastPrimitives.ToastProviderProps) => {\n const [toasts, setToasts] = React.useState<Map<string, Toast>>(new Map());\n const toastElementsMapRef = React.useRef<Map<string, HTMLLIElement>>(\n new Map(),\n );\n const viewportRef = React.useRef<HTMLOListElement>(null);\n\n const sortToasts = React.useCallback(() => {\n const toastElements = Array.from(toastElementsMapRef.current).reverse();\n const heights: number[] = [];\n\n toastElements.forEach(([, toast], index) => {\n if (!toast) return;\n const height = toast.clientHeight;\n heights.push(height);\n const frontToastHeight = heights[0];\n toast.setAttribute(\"data-front\", `${index === 0}`);\n toast.setAttribute(\"data-hidden\", `${index > 2}`);\n toast.style.setProperty(\"--index\", `${index}`);\n toast.style.setProperty(\"--height\", `${height}px`);\n toast.style.setProperty(\"--front-height\", `${frontToastHeight}px`);\n const hoverOffsetY = heights\n .slice(0, index)\n .reduce((res, next) => (res += next), 0);\n toast.style.setProperty(\"--hover-offset-y\", `-${hoverOffsetY}px`);\n });\n }, []);\n\n const handleAddToast = React.useCallback((toast: Toast) => {\n setToasts((currentToasts) => {\n const newMap = new Map(currentToasts);\n newMap.set(String(Date.now()), { ...toast, open: true });\n\n return newMap;\n });\n }, []);\n\n const handleRemoveToast = React.useCallback((key: string) => {\n setToasts((currentToasts) => {\n const newMap = new Map(currentToasts);\n newMap.delete(key);\n\n return newMap;\n });\n }, []);\n\n const handleDispatchDefault = React.useCallback(\n (payload: AddToastPayload) =>\n handleAddToast({ ...payload, status: \"default\" }),\n [handleAddToast],\n );\n\n const handleDispatchSuccess = React.useCallback(\n (payload: AddToastPayload) =>\n handleAddToast({ ...payload, status: \"success\" }),\n [handleAddToast],\n );\n\n const handleDispatchError = React.useCallback(\n (payload: AddToastPayload) =>\n // default duration of 10 mins for `status: \"error\"`.\n handleAddToast({ duration: 60 * 1000 * 10, ...payload, status: \"error\" }),\n [handleAddToast],\n );\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n\n if (viewport) {\n const handleFocus = () => {\n toastElementsMapRef.current.forEach((toast) => {\n toast.setAttribute(\"data-hovering\", \"true\");\n });\n };\n\n // @ts-expect-error TODO: get the correct type\n const handleBlur = (event) => {\n if (!viewport.contains(event.target) || viewport === event.target) {\n toastElementsMapRef.current.forEach((toast) => {\n toast.setAttribute(\"data-hovering\", \"false\");\n });\n }\n };\n\n viewport.addEventListener(\"pointermove\", handleFocus);\n viewport.addEventListener(\"pointerleave\", handleBlur);\n viewport.addEventListener(\"focusin\", handleFocus);\n viewport.addEventListener(\"focusout\", handleBlur);\n\n return () => {\n viewport.removeEventListener(\"pointermove\", handleFocus);\n viewport.removeEventListener(\"pointerleave\", handleBlur);\n viewport.removeEventListener(\"focusin\", handleFocus);\n viewport.removeEventListener(\"focusout\", handleBlur);\n };\n }\n }, []);\n\n const toastApi = React.useMemo(\n () =>\n Object.assign(handleDispatchDefault, {\n success: handleDispatchSuccess,\n error: handleDispatchError,\n }),\n [handleDispatchDefault, handleDispatchSuccess, handleDispatchError],\n );\n\n return (\n <ToastProviderContext.Provider value={toastApi}>\n <ToastContextImpl.Provider\n value={React.useMemo(\n () => ({\n toastElementsMapRef,\n sortToasts,\n }),\n [sortToasts],\n )}\n >\n <ToastPrimitives.Provider {...props}>\n {children}\n {Array.from(toasts).map(([key, toast]) => (\n <Toast\n key={key}\n id={key}\n toast={toast}\n onOpenChange={(open) => {\n if (!open) {\n toastElementsMapRef.current.delete(key);\n sortToasts();\n\n if (!open) {\n setTimeout(() => {\n handleRemoveToast(key);\n }, ANIMATION_OUT_DURATION);\n }\n }\n }}\n />\n ))}\n <ToastPrimitives.Viewport\n ref={viewportRef}\n className={toastViewport}\n />\n </ToastPrimitives.Provider>\n </ToastContextImpl.Provider>\n </ToastProviderContext.Provider>\n );\n};\n\nconst Toast = (props: ToastPrimitives.ToastProps & { toast: Toast }) => {\n const { onOpenChange, toast, id, ...toastProps } = props;\n const ref = React.useRef<HTMLLIElement>(null);\n const context = React.useContext(ToastContextImpl);\n const { sortToasts, toastElementsMapRef } = context;\n const toastElementsMap = toastElementsMapRef.current;\n\n React.useLayoutEffect(() => {\n if (ref.current) {\n toastElementsMap?.set(id as string, ref.current);\n sortToasts();\n }\n }, [id, sortToasts, toastElementsMap]);\n\n return (\n <ToastPrimitives.Root\n {...toastProps}\n ref={ref}\n type={toast.type}\n duration={toast.duration}\n className={toastRoot}\n onOpenChange={onOpenChange}\n >\n <div className={toastInner} data-status={toast.status}>\n <ToastStatusIcon status={toast.status} />\n <ToastPrimitives.Title asChild style={{ gridArea: \"title\" }}>\n <Heading level=\"6\">{toast.title}</Heading>\n </ToastPrimitives.Title>\n <ToastPrimitives.Description\n asChild\n style={{ gridArea: \"description\" }}\n >\n <Text color=\"subtle\" size=\"2\">\n {toast.description}\n </Text>\n </ToastPrimitives.Description>\n {toast.action}\n <ToastPrimitives.Close\n aria-label=\"Close\"\n asChild\n className={toastClose}\n >\n <IconButton variant=\"outline\">\n <Cross2Icon />\n </IconButton>\n </ToastPrimitives.Close>\n </div>\n </ToastPrimitives.Root>\n );\n};\n\nconst ToastStatusIcon = ({ status }: { status: Toast[\"status\"] }) => {\n return status !== \"default\" ? (\n <div style={{ gridArea: \"icon\", alignSelf: \"start\" }}>\n {status === \"success\" && <CheckmarkIcon />}\n {status === \"error\" && <ErrorIcon />}\n </div>\n ) : null;\n};\n\nconst ErrorIcon = () => <div aria-hidden className={error} />;\nconst CheckmarkIcon = () => <div aria-hidden className={checkmark} />;\n\nexport const ToastAction = ({\n ...props\n}: Omit<ToastPrimitives.ToastActionProps, \"asChild\">) => {\n return (\n <ToastPrimitives.Action\n {...props}\n style={{ gridArea: \"action\", ...props.style }}\n asChild\n >\n <Button size=\"1\" variant=\"outline\">\n {props.children}\n </Button>\n </ToastPrimitives.Action>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,eAAe,WAAW,gBAAgB;AAqDtD,SACE,KADF;AAnDJ,IAAM,SAAkB,CAAC,SAAS,QAAQ,QAAQ;AAClD,IAAM,aAAa;AAQZ,IAAM,eAAe,cAAiC;AAAA,EAC3D,OAAO;AAAA,EACP,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB;AACF,CAAC;AAOD,IAAM,eAAe;AAEd,IAAM,gBAAgB,CAAC,EAAE,SAAS,MAA0B;AACjE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,MAAM,SAAS,CAAC;AAEnD,QAAM,aAAa,CAACA,WAAiB;AA9BvC;AA+BI,UAAM,SAASA,WAAU;AACzB,UAAM,WAAWA,WAAU;AAE3B,QACE,WACE,YAAY,EAAE,cAAc,kBAC5B,OAAO,WAAW,8BAA8B,EAAE,SACpD;AACA,qBAAS,cAAc,MAAM,MAA7B,mBAAgC,UAAU,IAAI;AAC9C,qBAAS,cAAc,MAAM,MAA7B,mBAAgC,UAAU,OAAO;AAAA,IACnD,OAAO;AACL,qBAAS,cAAc,MAAM,MAA7B,mBAAgC,UAAU,IAAI;AAC9C,qBAAS,cAAc,MAAM,MAA7B,mBAAgC,UAAU,OAAO;AAAA,IACnD;AAAA,EACF;AAEA,YAAU,MAAM;AACd,eAAW,KAAK;AAEhB,QAAI;AACF,mBAAa,QAAQ,YAAY,KAAK;AAAA,IACxC,QAAQ;AAAA,IAAC;AAAA,EACX,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,qBAAC,gBAAa,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AAAA,IAAiB;AAAA,IAAhB;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AAAA,MAC5C,SAAO;AAAA,MAEP,0BAAAA,KAAC,UAAO,MAAK,KAAI,SAAQ,WACtB,gBAAM,UACT;AAAA;AAAA,EACF;AAEJ;","names":["theme","React","jsx","jsxs","toastElementsMapRef"]}
1
+ {"version":3,"sources":["../../src/providers/theme-provider.tsx","../../src/providers/script.ts","../../src/providers/toast-provider.tsx"],"sourcesContent":["// Credit: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/index.tsx\n\nimport { darkTheme } from \"@/theme/themes/dark-theme.css\";\nimport { lightTheme } from \"@/theme/themes/light-theme.css\";\nimport { Theme } from \"@/types/theme\";\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { script } from \"./script\";\n\nconst MEDIA = \"(prefers-color-scheme: dark)\";\nconst isServer = typeof window === \"undefined\";\n\nconst storageKey = \"nayhoo-theme\";\nconst themes: Theme[] = [\"light\", \"dark\", \"system\"];\nconst defaultTheme: Theme = \"system\";\n\ntype ResolvedTheme = Exclude<Theme, \"system\">;\nconst classes: Record<ResolvedTheme, string> = {\n light: lightTheme,\n dark: darkTheme,\n};\n\ntype ThemeContextProps = {\n theme: Theme;\n setTheme: React.Dispatch<React.SetStateAction<Theme>>;\n resolvedTheme: ResolvedTheme;\n themes: Theme[];\n};\n\nexport const ThemeContext = createContext<ThemeContextProps>({\n theme: defaultTheme,\n setTheme: () => {},\n resolvedTheme: \"light\",\n themes,\n});\n\ntype ThemeProviderProps = {\n children: React.ReactNode;\n};\n\nexport const ThemeProvider = ({ children }: ThemeProviderProps) => {\n const [theme, setTheme] = useState(() => getTheme());\n const [resolvedTheme, setResolvedTheme] = useState(() =>\n theme === \"system\" ? getSystemTheme() : theme,\n );\n\n const applyTheme = useCallback((theme: Theme) => {\n const resolved = resolveTheme(theme);\n\n setResolvedTheme(resolved);\n\n const d = document.documentElement;\n d.classList.remove(...Object.values(classes));\n d.classList.add(classes[resolved]);\n }, []);\n\n useEffect(() => {\n applyTheme(theme);\n\n try {\n localStorage.setItem(storageKey, theme);\n } catch {}\n }, [applyTheme, theme]);\n\n const value = useMemo(\n () => ({\n theme,\n setTheme,\n resolvedTheme: theme === \"system\" ? resolvedTheme : theme,\n themes,\n }),\n [theme, setTheme, resolvedTheme],\n );\n\n const scriptArgs = JSON.stringify([storageKey, defaultTheme, classes]).slice(\n 1,\n -1,\n );\n\n return (\n <ThemeContext value={value}>\n <script\n suppressHydrationWarning\n dangerouslySetInnerHTML={{\n __html: `(${script.toString()})(${scriptArgs})`,\n }}\n />\n\n {children}\n </ThemeContext>\n );\n};\n\nconst getTheme = () => {\n if (isServer) return defaultTheme;\n let themeName: string | undefined;\n\n try {\n themeName = localStorage.getItem(storageKey) || undefined;\n } catch (e) {\n // Unsupported\n }\n\n return themes.find((theme) => theme === themeName) || defaultTheme;\n};\n\nconst getSystemTheme = (\n e?: MediaQueryList | MediaQueryListEvent,\n): ResolvedTheme => {\n if (!e) e = window.matchMedia(MEDIA);\n const isDark = e.matches;\n const systemTheme = isDark ? \"dark\" : \"light\";\n\n return systemTheme;\n};\n\nconst resolveTheme = (theme: Theme) => {\n let resolved = theme;\n\n if (theme === \"system\") {\n resolved = getSystemTheme();\n }\n\n return resolved as ResolvedTheme;\n};\n","// Credit: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/script.ts\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n\nexport const script = (storageKey, defaultTheme, classes) => {\n const el = document.documentElement;\n\n function updateDOM(theme) {\n el.classList.remove(...Object.values(classes));\n el.classList.add(classes[theme]);\n }\n\n function getSystemTheme() {\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n }\n\n try {\n const themeName = localStorage.getItem(storageKey) || defaultTheme;\n const isSystem = themeName === \"system\";\n const theme = isSystem ? getSystemTheme() : themeName;\n updateDOM(theme);\n } catch (e) {\n //\n }\n};\n","// Credits: https://codesandbox.io/p/sandbox/radix-toast-stack-dpfx5f\n\nimport { Button } from \"@/components/button\";\nimport { Heading } from \"@/components/heading\";\nimport { IconButton } from \"@/components/icon-button\";\nimport { Text } from \"@/components/text\";\nimport {\n checkmark,\n error,\n toastClose,\n toastInner,\n toastRoot,\n toastViewport,\n} from \"@/theme/styles/toaster.css\";\nimport { Cross2Icon } from \"@radix-ui/react-icons\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport * as React from \"react\";\n\ntype Toast = {\n title?: string;\n description?: string;\n status: \"default\" | \"error\" | \"success\";\n action?: React.ReactNode;\n} & ToastPrimitives.ToastProps;\n\ntype AddToastPayload = Omit<Toast, \"status\">;\n\ntype ToastContextProps = ((payload: AddToastPayload) => void) & {\n error: (payload: AddToastPayload) => void;\n success: (payload: AddToastPayload) => void;\n};\n\nconst defaultToast: ToastContextProps = Object.assign(() => {}, {\n success: () => {},\n error: () => {},\n});\n\nexport const ToastContext = React.createContext(defaultToast);\n\ntype ToastContextImplProps = {\n toastElementsMapRef: React.RefObject<Map<string, HTMLLIElement> | null>;\n sortToasts: () => void;\n};\n\nconst toastElementsMapRef = React.createRef<Map<string, HTMLLIElement>>();\n\nconst defaultToastImpl: ToastContextImplProps = {\n toastElementsMapRef,\n sortToasts: () => {},\n};\n\nconst ToastContextImpl = React.createContext(defaultToastImpl);\n\nconst ANIMATION_OUT_DURATION = 350;\n\nexport const ToastProvider = ({\n children,\n ...props\n}: ToastPrimitives.ToastProviderProps) => {\n const [toasts, setToasts] = React.useState<Map<string, Toast>>(new Map());\n const toastElementsMapRef = React.useRef<Map<string, HTMLLIElement>>(\n new Map(),\n );\n const viewportRef = React.useRef<HTMLOListElement>(null);\n\n const sortToasts = React.useCallback(() => {\n const toastElements = Array.from(toastElementsMapRef.current).reverse();\n const heights: number[] = [];\n\n toastElements.forEach(([, toast], index) => {\n if (!toast) return;\n const height = toast.clientHeight;\n heights.push(height);\n const frontToastHeight = heights[0];\n toast.setAttribute(\"data-front\", `${index === 0}`);\n toast.setAttribute(\"data-hidden\", `${index > 2}`);\n toast.style.setProperty(\"--index\", `${index}`);\n toast.style.setProperty(\"--height\", `${height}px`);\n toast.style.setProperty(\"--front-height\", `${frontToastHeight}px`);\n const hoverOffsetY = heights\n .slice(0, index)\n .reduce((res, next) => (res += next), 0);\n toast.style.setProperty(\"--hover-offset-y\", `-${hoverOffsetY}px`);\n });\n }, []);\n\n const handleAddToast = React.useCallback((toast: Toast) => {\n setToasts((currentToasts) => {\n const newMap = new Map(currentToasts);\n newMap.set(String(Date.now()), { ...toast, open: true });\n\n return newMap;\n });\n }, []);\n\n const handleRemoveToast = React.useCallback((key: string) => {\n setToasts((currentToasts) => {\n const newMap = new Map(currentToasts);\n newMap.delete(key);\n\n return newMap;\n });\n }, []);\n\n const handleDispatchDefault = React.useCallback(\n (payload: AddToastPayload) =>\n handleAddToast({ ...payload, status: \"default\" }),\n [handleAddToast],\n );\n\n const handleDispatchSuccess = React.useCallback(\n (payload: AddToastPayload) =>\n handleAddToast({ ...payload, status: \"success\" }),\n [handleAddToast],\n );\n\n const handleDispatchError = React.useCallback(\n (payload: AddToastPayload) =>\n // default duration of 10 mins for `status: \"error\"`.\n handleAddToast({ duration: 60 * 1000 * 10, ...payload, status: \"error\" }),\n [handleAddToast],\n );\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n\n if (viewport) {\n const handleFocus = () => {\n toastElementsMapRef.current.forEach((toast) => {\n toast.setAttribute(\"data-hovering\", \"true\");\n });\n };\n\n // @ts-expect-error TODO: get the correct type\n const handleBlur = (event) => {\n if (!viewport.contains(event.target) || viewport === event.target) {\n toastElementsMapRef.current.forEach((toast) => {\n toast.setAttribute(\"data-hovering\", \"false\");\n });\n }\n };\n\n viewport.addEventListener(\"pointermove\", handleFocus);\n viewport.addEventListener(\"pointerleave\", handleBlur);\n viewport.addEventListener(\"focusin\", handleFocus);\n viewport.addEventListener(\"focusout\", handleBlur);\n\n return () => {\n viewport.removeEventListener(\"pointermove\", handleFocus);\n viewport.removeEventListener(\"pointerleave\", handleBlur);\n viewport.removeEventListener(\"focusin\", handleFocus);\n viewport.removeEventListener(\"focusout\", handleBlur);\n };\n }\n }, []);\n\n const toastApi = React.useMemo(\n () =>\n Object.assign(handleDispatchDefault, {\n success: handleDispatchSuccess,\n error: handleDispatchError,\n }),\n [handleDispatchDefault, handleDispatchSuccess, handleDispatchError],\n );\n\n return (\n <ToastContext.Provider value={toastApi}>\n <ToastContextImpl.Provider\n value={React.useMemo(\n () => ({\n toastElementsMapRef,\n sortToasts,\n }),\n [sortToasts],\n )}\n >\n <ToastPrimitives.Provider {...props}>\n {children}\n {Array.from(toasts).map(([key, toast]) => (\n <Toast\n key={key}\n id={key}\n toast={toast}\n onOpenChange={(open) => {\n if (!open) {\n toastElementsMapRef.current.delete(key);\n sortToasts();\n\n if (!open) {\n setTimeout(() => {\n handleRemoveToast(key);\n }, ANIMATION_OUT_DURATION);\n }\n }\n }}\n />\n ))}\n <ToastPrimitives.Viewport\n ref={viewportRef}\n className={toastViewport}\n />\n </ToastPrimitives.Provider>\n </ToastContextImpl.Provider>\n </ToastContext.Provider>\n );\n};\n\nconst Toast = (props: ToastPrimitives.ToastProps & { toast: Toast }) => {\n const { onOpenChange, toast, id, ...toastProps } = props;\n const ref = React.useRef<HTMLLIElement>(null);\n const context = React.useContext(ToastContextImpl);\n const { sortToasts, toastElementsMapRef } = context;\n const toastElementsMap = toastElementsMapRef.current;\n\n React.useLayoutEffect(() => {\n if (ref.current) {\n toastElementsMap?.set(id as string, ref.current);\n sortToasts();\n }\n }, [id, sortToasts, toastElementsMap]);\n\n return (\n <ToastPrimitives.Root\n {...toastProps}\n ref={ref}\n type={toast.type}\n duration={toast.duration}\n className={toastRoot}\n onOpenChange={onOpenChange}\n >\n <div className={toastInner} data-status={toast.status}>\n <ToastStatusIcon status={toast.status} />\n <ToastPrimitives.Title asChild style={{ gridArea: \"title\" }}>\n <Heading level=\"6\">{toast.title}</Heading>\n </ToastPrimitives.Title>\n <ToastPrimitives.Description\n asChild\n style={{ gridArea: \"description\" }}\n >\n <Text color=\"subtle\" size=\"2\">\n {toast.description}\n </Text>\n </ToastPrimitives.Description>\n {toast.action}\n <ToastPrimitives.Close\n aria-label=\"Close\"\n asChild\n className={toastClose}\n >\n <IconButton variant=\"outline\">\n <Cross2Icon />\n </IconButton>\n </ToastPrimitives.Close>\n </div>\n </ToastPrimitives.Root>\n );\n};\n\nconst ToastStatusIcon = ({ status }: { status: Toast[\"status\"] }) => {\n return status !== \"default\" ? (\n <div style={{ gridArea: \"icon\", alignSelf: \"start\" }}>\n {status === \"success\" && <CheckmarkIcon />}\n {status === \"error\" && <ErrorIcon />}\n </div>\n ) : null;\n};\n\nconst ErrorIcon = () => <div aria-hidden className={error} />;\nconst CheckmarkIcon = () => <div aria-hidden className={checkmark} />;\n\nexport const ToastAction = ({\n ...props\n}: Omit<ToastPrimitives.ToastActionProps, \"asChild\">) => {\n return (\n <ToastPrimitives.Action\n {...props}\n style={{ gridArea: \"action\", ...props.style }}\n asChild\n >\n <Button size=\"1\" variant=\"outline\">\n {props.children}\n </Button>\n </ToastPrimitives.Action>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACNA,IAAM,SAAS,CAACA,aAAYC,eAAcC,aAAY;AAC3D,QAAM,KAAK,SAAS;AAEpB,WAAS,UAAU,OAAO;AACxB,OAAG,UAAU,OAAO,GAAG,OAAO,OAAOA,QAAO,CAAC;AAC7C,OAAG,UAAU,IAAIA,SAAQ,KAAK,CAAC;AAAA,EACjC;AAEA,WAASC,kBAAiB;AACxB,WAAO,OAAO,WAAW,8BAA8B,EAAE,UACrD,SACA;AAAA,EACN;AAEA,MAAI;AACF,UAAM,YAAY,aAAa,QA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AA,IACvC,WAAW,WAAW,gBAAAA,KAAC,aAAU;AAAA,KACpC,IACE;AACN;AAEA,IAAM,YAAY,MAAM,gBAAAA,KAAC,SAAI,eAAW,MAAC,WAAW,OAAO;AAC3D,IAAM,gBAAgB,MAAM,gBAAAA,KAAC,SAAI,eAAW,MAAC,WAAW,WAAW;AAE5D,IAAM,cAAc,CAAC;AAAA,EAC1B,GAAG;AACL,MAAyD;AACvD,SACE,gBAAAA;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AAAA,MAC5C,SAAO;AAAA,MAEP,0BAAAA,KAAC,UAAO,MAAK,KAAI,SAAQ,WACtB,gBAAM,UACT;AAAA;AAAA,EACF;AAEJ;","names":["storageKey","defaultTheme","classes","getSystemTheme","theme","React","jsx","jsxs","toastElementsMapRef"]}
@@ -13,7 +13,7 @@ import {
13
13
  toastInner,
14
14
  toastRoot,
15
15
  toastViewport
16
- } from "../chunk-54ZBX4ZK.mjs";
16
+ } from "../chunk-53LAMNK6.mjs";
17
17
  import {
18
18
  separator
19
19
  } from "../chunk-P3OUEGR4.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nayhoo/ui",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },