@nayhoo/ui 0.12.1 → 0.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/dist/{chunk-5VVYRZDU.mjs → chunk-24DFRL5Q.mjs} +12 -9
- package/dist/chunk-24DFRL5Q.mjs.map +1 -0
- package/dist/{chunk-OCXG5SMA.mjs → chunk-2WZQZIYN.mjs} +8 -5
- package/dist/chunk-2WZQZIYN.mjs.map +1 -0
- package/dist/chunk-BALC5CGU.mjs +23 -0
- package/dist/chunk-BALC5CGU.mjs.map +1 -0
- package/dist/chunk-DQ4T4WV3.mjs +16 -0
- package/dist/chunk-DQ4T4WV3.mjs.map +1 -0
- package/dist/{chunk-C53FYO65.mjs → chunk-ELXCOK2T.mjs} +8 -5
- package/dist/chunk-ELXCOK2T.mjs.map +1 -0
- package/dist/chunk-GED6IT3S.mjs +1 -0
- package/dist/{chunk-OKNO3BFR.mjs → chunk-L2MODHAE.mjs} +12 -9
- package/dist/chunk-L2MODHAE.mjs.map +1 -0
- package/dist/{chunk-WPNBONR3.mjs → chunk-LSB5JVS2.mjs} +1 -1
- package/dist/chunk-LSB5JVS2.mjs.map +1 -0
- package/dist/{chunk-HNOMBFLC.mjs → chunk-MIRMF5N3.mjs} +8 -5
- package/dist/chunk-MIRMF5N3.mjs.map +1 -0
- package/dist/{chunk-YJWLCDJE.mjs → chunk-XWF2DDXB.mjs} +8 -5
- package/dist/chunk-XWF2DDXB.mjs.map +1 -0
- package/dist/components/avatar.d.mts +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +34 -9
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/avatar.mjs +18 -11
- package/dist/components/avatar.mjs.map +1 -1
- package/dist/components/badge.d.mts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +24 -5
- package/dist/components/badge.js.map +1 -1
- package/dist/components/badge.mjs +8 -4
- package/dist/components/badge.mjs.map +1 -1
- package/dist/components/box.d.mts +1 -1
- package/dist/components/box.d.ts +1 -1
- package/dist/components/box.js.map +1 -1
- package/dist/components/box.mjs +1 -1
- package/dist/components/button.js +32 -10
- package/dist/components/button.js.map +1 -1
- package/dist/components/button.mjs +4 -3
- package/dist/components/card.d.mts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/card.mjs.map +1 -1
- package/dist/components/checkbox.d.mts +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +26 -6
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/checkbox.mjs +10 -5
- package/dist/components/checkbox.mjs.map +1 -1
- package/dist/components/container.d.mts +1 -1
- package/dist/components/container.d.ts +1 -1
- package/dist/components/container.js +24 -5
- package/dist/components/container.js.map +1 -1
- package/dist/components/container.mjs +8 -4
- package/dist/components/container.mjs.map +1 -1
- package/dist/components/dropdown-menu.d.mts +5 -1
- package/dist/components/dropdown-menu.d.ts +5 -1
- package/dist/components/dropdown-menu.js +21 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropdown-menu.mjs +4 -3
- package/dist/components/dropdown-menu.mjs.map +1 -1
- package/dist/components/flex.d.mts +1 -1
- package/dist/components/flex.d.ts +1 -1
- package/dist/components/flex.js +24 -5
- package/dist/components/flex.js.map +1 -1
- package/dist/components/flex.mjs +3 -2
- package/dist/components/form.d.mts +4 -1
- package/dist/components/form.d.ts +4 -1
- package/dist/components/form.js +26 -7
- package/dist/components/form.js.map +1 -1
- package/dist/components/form.mjs +10 -6
- package/dist/components/form.mjs.map +1 -1
- package/dist/components/grid.d.mts +1 -1
- package/dist/components/grid.d.ts +1 -1
- package/dist/components/grid.js +24 -5
- package/dist/components/grid.js.map +1 -1
- package/dist/components/grid.mjs +8 -4
- package/dist/components/grid.mjs.map +1 -1
- package/dist/components/icon-button.d.mts +1 -1
- package/dist/components/icon-button.d.ts +1 -1
- package/dist/components/icon-button.js +32 -10
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/icon-button.mjs +4 -3
- package/dist/components/label.d.mts +1 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/label.mjs.map +1 -1
- package/dist/components/link.d.mts +1 -1
- package/dist/components/link.d.ts +1 -1
- package/dist/components/link.js +24 -5
- package/dist/components/link.js.map +1 -1
- package/dist/components/link.mjs +8 -4
- package/dist/components/link.mjs.map +1 -1
- package/dist/components/menu.d.mts +3 -1
- package/dist/components/menu.d.ts +3 -1
- package/dist/components/menu.js +21 -2
- package/dist/components/menu.js.map +1 -1
- package/dist/components/menu.mjs +4 -3
- package/dist/components/menu.mjs.map +1 -1
- package/dist/components/panel.d.mts +1 -1
- package/dist/components/panel.d.ts +1 -1
- package/dist/components/panel.js.map +1 -1
- package/dist/components/panel.mjs.map +1 -1
- package/dist/components/paragraph.d.mts +1 -1
- package/dist/components/paragraph.d.ts +1 -1
- package/dist/components/paragraph.js.map +1 -1
- package/dist/components/paragraph.mjs.map +1 -1
- package/dist/components/popover.d.mts +4 -1
- package/dist/components/popover.d.ts +4 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/popover.mjs +2 -2
- package/dist/components/popover.mjs.map +1 -1
- package/dist/components/select.d.mts +3 -1
- package/dist/components/select.d.ts +3 -1
- package/dist/components/select.js +29 -7
- package/dist/components/select.js.map +1 -1
- package/dist/components/select.mjs +4 -3
- package/dist/components/select.mjs.map +1 -1
- package/dist/components/separator.d.mts +1 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/separator.mjs.map +1 -1
- package/dist/components/skeleton.d.mts +1 -1
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +24 -5
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/skeleton.mjs +8 -4
- package/dist/components/skeleton.mjs.map +1 -1
- package/dist/components/spinner.d.mts +1 -1
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.js +24 -5
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/spinner.mjs +3 -2
- package/dist/components/status.d.mts +1 -1
- package/dist/components/status.d.ts +1 -1
- package/dist/components/status.js +24 -5
- package/dist/components/status.js.map +1 -1
- package/dist/components/status.mjs +3 -2
- package/dist/components/switch.d.mts +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +31 -9
- package/dist/components/switch.js.map +1 -1
- package/dist/components/switch.mjs +15 -8
- package/dist/components/switch.mjs.map +1 -1
- package/dist/components/text-field.d.mts +1 -1
- package/dist/components/text-field.d.ts +1 -1
- package/dist/components/text-field.js +24 -5
- package/dist/components/text-field.js.map +1 -1
- package/dist/components/text-field.mjs +8 -4
- package/dist/components/text-field.mjs.map +1 -1
- package/dist/components/text.d.mts +1 -1
- package/dist/components/text.d.ts +1 -1
- package/dist/components/text.js +24 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/text.mjs +3 -2
- package/dist/components/tooltip.d.mts +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +28 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tooltip.mjs +12 -8
- package/dist/components/tooltip.mjs.map +1 -1
- package/dist/providers/index.js +45 -17
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +6 -5
- package/dist/providers/index.mjs.map +1 -1
- package/dist/utils/index.d.mts +3 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/package.json +1 -1
- package/dist/chunk-4N6P3Y54.mjs +0 -13
- package/dist/chunk-4N6P3Y54.mjs.map +0 -1
- package/dist/chunk-5VVYRZDU.mjs.map +0 -1
- package/dist/chunk-C53FYO65.mjs.map +0 -1
- package/dist/chunk-CYDWEPFL.mjs +0 -1
- package/dist/chunk-HNOMBFLC.mjs.map +0 -1
- package/dist/chunk-OCXG5SMA.mjs.map +0 -1
- package/dist/chunk-OKNO3BFR.mjs.map +0 -1
- package/dist/chunk-WPNBONR3.mjs.map +0 -1
- package/dist/chunk-YJWLCDJE.mjs.map +0 -1
- /package/dist/{chunk-CYDWEPFL.mjs.map → chunk-GED6IT3S.mjs.map} +0 -0
package/dist/providers/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Text
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ELXCOK2T.mjs";
|
|
4
4
|
import {
|
|
5
5
|
checkmark,
|
|
6
6
|
darkTheme,
|
|
@@ -16,16 +16,17 @@ import {
|
|
|
16
16
|
} from "../chunk-QKJFDJJP.mjs";
|
|
17
17
|
import {
|
|
18
18
|
IconButton
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-L2MODHAE.mjs";
|
|
20
20
|
import "../chunk-HNVVD3WS.mjs";
|
|
21
21
|
import "../chunk-JZBPCPSP.mjs";
|
|
22
22
|
import {
|
|
23
23
|
Button
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-24DFRL5Q.mjs";
|
|
25
25
|
import "../chunk-66WXCRN4.mjs";
|
|
26
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-MIRMF5N3.mjs";
|
|
27
27
|
import "../chunk-47YGQSLM.mjs";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-DQ4T4WV3.mjs";
|
|
29
|
+
import "../chunk-BALC5CGU.mjs";
|
|
29
30
|
import "../chunk-7EGQM3ZL.mjs";
|
|
30
31
|
|
|
31
32
|
// src/providers/theme-provider.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/theme-provider.tsx","../../src/providers/toast-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { darkTheme } from \"@/theme/themes/dark-theme.css\";\nimport { lightTheme } from \"@/theme/themes/light-theme.css\";\nimport { SystemTheme } from \"@/types/system-theme\";\nimport { Theme as ITheme } from \"@/types/theme\";\nimport * as React from \"react\";\n\nconst classes: Record<SystemTheme, string> = {\n light: lightTheme,\n dark: darkTheme,\n};\nconst defaultTheme: ITheme = \"system\";\nconst storageKey = \"nayhoo-theme\";\nconst systemThemes: SystemTheme[] = [\"light\", \"dark\"];\nconst themes: ITheme[] = [...systemThemes, \"system\"];\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/types.ts\ninterface ScriptProps\n extends React.DetailedHTMLProps<\n React.ScriptHTMLAttributes<HTMLScriptElement>,\n HTMLScriptElement\n > {}\n\nexport interface UseThemeProps {\n /** List of all available theme names */\n themes: ITheme[];\n /** Update the theme */\n setTheme: (value: ITheme) => void;\n /** Active theme name */\n theme?: ITheme | undefined;\n /** If the active theme is \"system\", this returns whether the system preference resolved to \"dark\" or \"light\". Otherwise, identical to `theme` */\n resolvedTheme?: ITheme | undefined;\n /** Returns the System theme preference (\"dark\" or \"light\"), regardless what the active theme is */\n systemTheme?: SystemTheme | undefined;\n}\n\nexport interface ThemeProviderProps extends React.PropsWithChildren {\n /** Props to pass the inline script */\n scriptProps?: ScriptProps;\n}\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/index.tsx\nconst colorSchemes: SystemTheme[] = [\"light\", \"dark\"];\nconst MEDIA = \"(prefers-color-scheme: dark)\";\nconst isServer = typeof window === \"undefined\";\nconst ThemeContext = React.createContext<UseThemeProps | undefined>(undefined);\nconst defaultContext: UseThemeProps = {\n setTheme: () => {\n // TODO: something about needs to be in a provider\n },\n themes,\n};\n\nconst saveToLS = (storageKey: string, value: string) => {\n // Save to storage\n try {\n localStorage.setItem(storageKey, value);\n } catch (e) {\n // Unsupported\n }\n};\n\nexport const useTheme = () => React.useContext(ThemeContext) ?? defaultContext;\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n const context = React.useContext(ThemeContext);\n\n // Ignore nested context providers, just passthrough children\n if (context) return <>{props.children}</>;\n\n return <Theme {...props} />;\n};\n\nconst Theme = ({ children, scriptProps }: ThemeProviderProps) => {\n const [theme, setThemeState] = React.useState(() => getTheme());\n const [resolvedTheme, setResolvedTheme] = React.useState(() =>\n theme === \"system\" ? getSystemTheme() : theme,\n );\n\n const applyTheme = React.useCallback((theme?: ITheme) => {\n let resolved = theme;\n\n if (!resolved) return;\n\n // If theme is system, resolve it before setting theme\n if (theme === \"system\") {\n resolved = getSystemTheme();\n }\n\n const d = document.documentElement;\n\n const handleAttribute = () => {\n d.classList.remove(...Object.values(classes));\n\n if (resolved) d.classList.add(classes[resolved as SystemTheme]);\n };\n\n handleAttribute();\n\n const colorScheme = colorSchemes.some(\n (colorScheme) => colorScheme === resolved,\n )\n ? resolved\n : null;\n\n if (colorScheme) d.style.colorScheme = colorScheme;\n }, []);\n\n const setTheme = React.useCallback((value: ITheme) => {\n setThemeState(value);\n saveToLS(storageKey, value);\n }, []);\n\n const handleMediaQuery = React.useCallback(\n (e: MediaQueryListEvent | MediaQueryList) => {\n const resolved = getSystemTheme(e);\n setResolvedTheme(resolved);\n\n if (theme === \"system\") {\n applyTheme(\"system\");\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme],\n );\n\n // Always listen to System preference\n React.useEffect(() => {\n const media = window.matchMedia(MEDIA);\n\n // Intentionally use deprecated listener methods to support iOS & old browsers\n media.addListener(handleMediaQuery);\n handleMediaQuery(media);\n\n return () => media.removeListener(handleMediaQuery);\n }, [handleMediaQuery]);\n\n // localStorage event handling\n React.useEffect(() => {\n const handleStorage = (e: StorageEvent) => {\n if (e.key !== storageKey) {\n return;\n }\n\n // If default theme set, use it if localstorage === null (happens on local storage manual deletion)\n if (!e.newValue || !isTheme(e.newValue)) {\n setTheme(defaultTheme);\n } else {\n setThemeState(e.newValue); // Direct state update to avoid loops\n }\n };\n\n window.addEventListener(\"storage\", handleStorage);\n\n return () => window.removeEventListener(\"storage\", handleStorage);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setTheme]);\n\n // Whenever theme changes, apply it\n React.useEffect(() => {\n applyTheme(theme);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n const providerValue = React.useMemo(\n () => ({\n theme,\n setTheme,\n resolvedTheme: theme === \"system\" ? resolvedTheme : theme,\n themes,\n systemTheme: resolvedTheme as SystemTheme | undefined,\n }),\n [theme, setTheme, resolvedTheme],\n );\n\n return (\n <ThemeContext.Provider value={providerValue}>\n <ThemeScript\n {...{\n scriptProps,\n }}\n />\n\n {children}\n </ThemeContext.Provider>\n );\n};\n\nconst ThemeScript = React.memo(\n ({ scriptProps }: Omit<ThemeProviderProps, \"children\">) => {\n const scriptArgs = JSON.stringify([\n storageKey,\n defaultTheme,\n systemThemes,\n classes,\n ]).slice(1, -1);\n\n return (\n <script\n {...scriptProps}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{\n __html: `(${script.toString()})(${scriptArgs})`,\n }}\n />\n );\n },\n);\n\nThemeScript.displayName = \"ThemeScript\";\n\n// Helpers\nconst getTheme = () => {\n if (isServer) return undefined;\n let theme;\n\n try {\n theme = localStorage.getItem(storageKey) || undefined;\n } catch (e) {\n // Unsupported\n }\n\n return theme !== undefined && isTheme(theme) ? theme : defaultTheme;\n};\n\nconst getSystemTheme = (e?: MediaQueryList | MediaQueryListEvent) => {\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 isTheme = (value: string): value is ITheme =>\n themes.some((theme) => theme === value);\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/script.ts\nconst script = (\n storageKey: string,\n defaultTheme: ITheme,\n systemThemes: SystemTheme[],\n classes: Record<SystemTheme, string>,\n) => {\n const el = document.documentElement;\n\n function updateDOM(theme: SystemTheme) {\n el.classList.remove(...Object.values(classes));\n el.classList.add(classes[theme]);\n\n setColorScheme(theme);\n }\n\n function setColorScheme(theme: string) {\n if (systemThemes.some((systemTheme) => systemTheme === theme)) {\n el.style.colorScheme = theme;\n }\n }\n\n function getSystemTheme() {\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n }\n\n function isSystemTheme(value: string): value is SystemTheme {\n return systemThemes.some((theme) => theme === value);\n }\n\n try {\n const themeName = localStorage.getItem(storageKey) || defaultTheme;\n const isSystem = themeName === \"system\";\n const theme =\n isSystem || !isSystemTheme(themeName) ? 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/toast.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 defaultContext: ToastContextProps = Object.assign(\n () => {\n // TODO: something about needs to be in a provider\n },\n {\n success: () => {\n // TODO: something about needs to be in a provider\n },\n error: () => {\n // TODO: something about needs to be in a provider\n },\n },\n);\n\nconst ToastContext = React.createContext(defaultContext);\n\nexport const useToast = () => React.useContext(ToastContext) ?? defaultContext;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAY,WAAW;AA+DD,wBA4GlB,YA5GkB;AA7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,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","theme","colorScheme","defaultTheme","systemThemes","classes","getSystemTheme","React","jsx","jsxs","defaultContext","toastElementsMapRef"]}
|
|
1
|
+
{"version":3,"sources":["../../src/providers/theme-provider.tsx","../../src/providers/toast-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { darkTheme } from \"@/theme/themes/dark-theme.css\";\nimport { lightTheme } from \"@/theme/themes/light-theme.css\";\nimport { SystemTheme } from \"@/types/system-theme\";\nimport { Theme as ITheme } from \"@/types/theme\";\nimport * as React from \"react\";\n\nconst classes: Record<SystemTheme, string> = {\n light: lightTheme,\n dark: darkTheme,\n};\nconst defaultTheme: ITheme = \"system\";\nconst storageKey = \"nayhoo-theme\";\nconst systemThemes: SystemTheme[] = [\"light\", \"dark\"];\nconst themes: ITheme[] = [...systemThemes, \"system\"];\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/types.ts\ninterface ScriptProps\n extends React.DetailedHTMLProps<\n React.ScriptHTMLAttributes<HTMLScriptElement>,\n HTMLScriptElement\n > {}\n\nexport interface UseThemeProps {\n /** List of all available theme names */\n themes: ITheme[];\n /** Update the theme */\n setTheme: (value: ITheme) => void;\n /** Active theme name */\n theme?: ITheme | undefined;\n /** If the active theme is \"system\", this returns whether the system preference resolved to \"dark\" or \"light\". Otherwise, identical to `theme` */\n resolvedTheme?: ITheme | undefined;\n /** Returns the System theme preference (\"dark\" or \"light\"), regardless what the active theme is */\n systemTheme?: SystemTheme | undefined;\n}\n\nexport interface ThemeProviderProps extends React.PropsWithChildren {\n /** Props to pass the inline script */\n scriptProps?: ScriptProps;\n}\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/index.tsx\nconst colorSchemes: SystemTheme[] = [\"light\", \"dark\"];\nconst MEDIA = \"(prefers-color-scheme: dark)\";\nconst isServer = typeof window === \"undefined\";\nconst ThemeContext = React.createContext<UseThemeProps | undefined>(undefined);\nconst defaultContext: UseThemeProps = {\n setTheme: () => {\n // TODO: something about needs to be in a provider\n },\n themes,\n};\n\nconst saveToLS = (storageKey: string, value: string) => {\n // Save to storage\n try {\n localStorage.setItem(storageKey, value);\n } catch (e) {\n // Unsupported\n }\n};\n\nexport const useTheme = () => React.useContext(ThemeContext) ?? defaultContext;\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n const context = React.useContext(ThemeContext);\n\n // Ignore nested context providers, just passthrough children\n if (context) return <>{props.children}</>;\n\n return <Theme {...props} />;\n};\n\nconst Theme = ({ children, scriptProps }: ThemeProviderProps) => {\n const [theme, setThemeState] = React.useState(() => getTheme());\n const [resolvedTheme, setResolvedTheme] = React.useState(() =>\n theme === \"system\" ? getSystemTheme() : theme,\n );\n\n const applyTheme = React.useCallback((theme?: ITheme) => {\n let resolved = theme;\n\n if (!resolved) return;\n\n // If theme is system, resolve it before setting theme\n if (theme === \"system\") {\n resolved = getSystemTheme();\n }\n\n const d = document.documentElement;\n\n const handleAttribute = () => {\n d.classList.remove(...Object.values(classes));\n\n if (resolved) d.classList.add(classes[resolved as SystemTheme]);\n };\n\n handleAttribute();\n\n const colorScheme = colorSchemes.some(\n (colorScheme) => colorScheme === resolved,\n )\n ? resolved\n : null;\n\n if (colorScheme) d.style.colorScheme = colorScheme;\n }, []);\n\n const setTheme = React.useCallback((value: ITheme) => {\n setThemeState(value);\n saveToLS(storageKey, value);\n }, []);\n\n const handleMediaQuery = React.useCallback(\n (e: MediaQueryListEvent | MediaQueryList) => {\n const resolved = getSystemTheme(e);\n setResolvedTheme(resolved);\n\n if (theme === \"system\") {\n applyTheme(\"system\");\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme],\n );\n\n // Always listen to System preference\n React.useEffect(() => {\n const media = window.matchMedia(MEDIA);\n\n // Intentionally use deprecated listener methods to support iOS & old browsers\n media.addListener(handleMediaQuery);\n handleMediaQuery(media);\n\n return () => media.removeListener(handleMediaQuery);\n }, [handleMediaQuery]);\n\n // localStorage event handling\n React.useEffect(() => {\n const handleStorage = (e: StorageEvent) => {\n if (e.key !== storageKey) {\n return;\n }\n\n // If default theme set, use it if localstorage === null (happens on local storage manual deletion)\n if (!e.newValue || !isTheme(e.newValue)) {\n setTheme(defaultTheme);\n } else {\n setThemeState(e.newValue); // Direct state update to avoid loops\n }\n };\n\n window.addEventListener(\"storage\", handleStorage);\n\n return () => window.removeEventListener(\"storage\", handleStorage);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setTheme]);\n\n // Whenever theme changes, apply it\n React.useEffect(() => {\n applyTheme(theme);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n const providerValue = React.useMemo(\n () => ({\n theme,\n setTheme,\n resolvedTheme: theme === \"system\" ? resolvedTheme : theme,\n themes,\n systemTheme: resolvedTheme as SystemTheme | undefined,\n }),\n [theme, setTheme, resolvedTheme],\n );\n\n return (\n <ThemeContext.Provider value={providerValue}>\n <ThemeScript\n {...{\n scriptProps,\n }}\n />\n\n {children}\n </ThemeContext.Provider>\n );\n};\n\nconst ThemeScript = React.memo(\n ({ scriptProps }: Omit<ThemeProviderProps, \"children\">) => {\n const scriptArgs = JSON.stringify([\n storageKey,\n defaultTheme,\n systemThemes,\n classes,\n ]).slice(1, -1);\n\n return (\n <script\n {...scriptProps}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{\n __html: `(${script.toString()})(${scriptArgs})`,\n }}\n />\n );\n },\n);\n\nThemeScript.displayName = \"ThemeScript\";\n\n// Helpers\nconst getTheme = () => {\n if (isServer) return undefined;\n let theme;\n\n try {\n theme = localStorage.getItem(storageKey) || undefined;\n } catch (e) {\n // Unsupported\n }\n\n return theme !== undefined && isTheme(theme) ? theme : defaultTheme;\n};\n\nconst getSystemTheme = (e?: MediaQueryList | MediaQueryListEvent) => {\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 isTheme = (value: string): value is ITheme =>\n themes.some((theme) => theme === value);\n\n// Credits: https://github.com/pacocoursey/next-themes/blob/main/next-themes/src/script.ts\nconst script = (\n storageKey: string,\n defaultTheme: ITheme,\n systemThemes: SystemTheme[],\n classes: Record<SystemTheme, string>,\n) => {\n const el = document.documentElement;\n\n function updateDOM(theme: SystemTheme) {\n el.classList.remove(...Object.values(classes));\n el.classList.add(classes[theme]);\n\n setColorScheme(theme);\n }\n\n function setColorScheme(theme: string) {\n if (systemThemes.some((systemTheme) => systemTheme === theme)) {\n el.style.colorScheme = theme;\n }\n }\n\n function getSystemTheme() {\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n }\n\n function isSystemTheme(value: string): value is SystemTheme {\n return systemThemes.some((theme) => theme === value);\n }\n\n try {\n const themeName = localStorage.getItem(storageKey) || defaultTheme;\n const isSystem = themeName === \"system\";\n const theme =\n isSystem || !isSystemTheme(themeName) ? 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/toast.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 defaultContext: ToastContextProps = Object.assign(\n () => {\n // TODO: something about needs to be in a provider\n },\n {\n success: () => {\n // TODO: something about needs to be in a provider\n },\n error: () => {\n // TODO: something about needs to be in a provider\n },\n },\n);\n\nconst ToastContext = React.createContext(defaultContext);\n\nexport const useToast = () => React.useContext(ToastContext) ?? defaultContext;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAY,WAAW;AA+DD,wBA4GlB,YA5GkB;AA7DtB,IAAM,UAAuC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AACR;AACA,IAAM,eAAuB;AAC7B,IAAM,aAAa;AACnB,IAAM,eAA8B,CAAC,SAAS,MAAM;AACpD,IAAM,SAAmB,CAAC,GAAG,cAAc,QAAQ;AA4BnD,IAAM,eAA8B,CAAC,SAAS,MAAM;AACpD,IAAM,QAAQ;AACd,IAAM,WAAW,OAAO,WAAW;AACnC,IAAM,eAAqB,oBAAyC,MAAS;AAC7E,IAAM,iBAAgC;AAAA,EACpC,UAAU,MAAM;AAAA,EAEhB;AAAA,EACA;AACF;AAEA,IAAM,WAAW,CAACA,aAAoB,UAAkB;AAEtD,MAAI;AACF,iBAAa,QAAQA,aAAY,KAAK;AAAA,EACxC,SAAS,GAAG;AAAA,EAEZ;AACF;AAEO,IAAM,WAAW,MAAG;AA/D3B;AA+D8B,eAAM,iBAAW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B;AAAA,UAAhB;AAAA,YACC,SAAO;AAAA,YACP,OAAO,EAAE,UAAU,cAAc;AAAA,YAEjC,0BAAAA,KAAC,QAAK,OAAM,UAAS,MAAK,KACvB,gBAAM,aACT;AAAA;AAAA,QACF;AAAA,QACC,MAAM;AAAA,QACP,gBAAAA;AAAA,UAAiB;AAAA,UAAhB;AAAA,YACC,cAAW;AAAA,YACX,SAAO;AAAA,YACP,WAAW;AAAA,YAEX,0BAAAA,KAAC,cAAW,SAAQ,WAClB,0BAAAA,KAAC,cAAW,GACd;AAAA;AAAA,QACF;AAAA,SACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,kBAAkB,CAAC,EAAE,OAAO,MAAmC;AACnE,SAAO,WAAW,YAChB,gBAAAC,MAAC,SAAI,OAAO,EAAE,UAAU,QAAQ,WAAW,QAAQ,GAChD;AAAA,eAAW,aAAa,gBAAAD,KAAC,iBAAc;AAAA,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","theme","colorScheme","defaultTheme","systemThemes","classes","getSystemTheme","React","jsx","jsxs","defaultContext","toastElementsMapRef"]}
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare function mergeClasses(...classes: (string | undefined)[]): string;
|
|
2
2
|
|
|
3
|
+
declare function omit<T, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* https://stackoverflow.com/a/47232883
|
|
5
7
|
*/
|
|
6
8
|
declare function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
|
|
7
9
|
|
|
8
|
-
export { mergeClasses, pick };
|
|
10
|
+
export { mergeClasses, omit, pick };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare function mergeClasses(...classes: (string | undefined)[]): string;
|
|
2
2
|
|
|
3
|
+
declare function omit<T, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* https://stackoverflow.com/a/47232883
|
|
5
7
|
*/
|
|
6
8
|
declare function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
|
|
7
9
|
|
|
8
|
-
export { mergeClasses, pick };
|
|
10
|
+
export { mergeClasses, omit, pick };
|
package/dist/utils/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var utils_exports = {};
|
|
22
22
|
__export(utils_exports, {
|
|
23
23
|
mergeClasses: () => mergeClasses,
|
|
24
|
+
omit: () => omit,
|
|
24
25
|
pick: () => pick
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -30,6 +31,15 @@ function mergeClasses(...classes) {
|
|
|
30
31
|
return classes.filter((cls) => Boolean(cls)).join(" ");
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
// src/utils/omit.ts
|
|
35
|
+
function omit(obj, ...keys) {
|
|
36
|
+
const ret = { ...obj };
|
|
37
|
+
keys.forEach((key) => {
|
|
38
|
+
delete ret[key];
|
|
39
|
+
});
|
|
40
|
+
return ret;
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
// src/utils/pick.ts
|
|
34
44
|
function pick(obj, ...keys) {
|
|
35
45
|
const ret = {};
|
|
@@ -41,6 +51,7 @@ function pick(obj, ...keys) {
|
|
|
41
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
52
|
0 && (module.exports = {
|
|
43
53
|
mergeClasses,
|
|
54
|
+
omit,
|
|
44
55
|
pick
|
|
45
56
|
});
|
|
46
57
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/merge-classes.ts","../../src/utils/pick.ts"],"sourcesContent":["export * from \"./merge-classes\";\n\nexport * from \"./pick\";\n","export function mergeClasses(...classes: (string | undefined)[]): string {\n return classes.filter((cls): cls is string => Boolean(cls)).join(\" \");\n}\n","/**\n * https://stackoverflow.com/a/47232883\n */\nexport function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const ret: any = {};\n keys.forEach((key) => {\n ret[key] = obj[key];\n });\n\n return ret;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,gBAAgB,SAAyC;AACvE,SAAO,QAAQ,OAAO,CAAC,QAAuB,QAAQ,GAAG,CAAC,EAAE,KAAK,GAAG;AACtE;;;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/merge-classes.ts","../../src/utils/omit.ts","../../src/utils/pick.ts"],"sourcesContent":["export * from \"./merge-classes\";\n\nexport * from \"./omit\";\n\nexport * from \"./pick\";\n","export function mergeClasses(...classes: (string | undefined)[]): string {\n return classes.filter((cls): cls is string => Boolean(cls)).join(\" \");\n}\n","export function omit<T, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K> {\n const ret = { ...obj };\n keys.forEach((key) => {\n delete ret[key];\n });\n\n return ret;\n}\n","/**\n * https://stackoverflow.com/a/47232883\n */\nexport function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const ret: any = {};\n keys.forEach((key) => {\n ret[key] = obj[key];\n });\n\n return ret;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,gBAAgB,SAAyC;AACvE,SAAO,QAAQ,OAAO,CAAC,QAAuB,QAAQ,GAAG,CAAC,EAAE,KAAK,GAAG;AACtE;;;ACFO,SAAS,KAA2B,QAAW,MAAuB;AAC3E,QAAM,MAAM,EAAE,GAAG,IAAI;AACrB,OAAK,QAAQ,CAAC,QAAQ;AACpB,WAAO,IAAI,GAAG;AAAA,EAChB,CAAC;AAED,SAAO;AACT;;;ACJO,SAAS,KAA2B,QAAW,MAAuB;AAE3E,QAAM,MAAW,CAAC;AAClB,OAAK,QAAQ,CAAC,QAAQ;AACpB,QAAI,GAAG,IAAI,IAAI,GAAG;AAAA,EACpB,CAAC;AAED,SAAO;AACT;","names":[]}
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-GED6IT3S.mjs";
|
|
2
2
|
import {
|
|
3
|
+
omit,
|
|
3
4
|
pick
|
|
4
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-BALC5CGU.mjs";
|
|
5
6
|
import {
|
|
6
7
|
mergeClasses
|
|
7
8
|
} from "../chunk-7EGQM3ZL.mjs";
|
|
8
9
|
export {
|
|
9
10
|
mergeClasses,
|
|
11
|
+
omit,
|
|
10
12
|
pick
|
|
11
13
|
};
|
|
12
14
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
package/dist/chunk-4N6P3Y54.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/pick.ts"],"sourcesContent":["/**\n * https://stackoverflow.com/a/47232883\n */\nexport function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const ret: any = {};\n keys.forEach((key) => {\n ret[key] = obj[key];\n });\n\n return ret;\n}\n"],"mappings":";AAGO,SAAS,KAA2B,QAAW,MAAuB;AAE3E,QAAM,MAAW,CAAC;AAClB,OAAK,QAAQ,CAAC,QAAQ;AACpB,QAAI,GAAG,IAAI,IAAI,GAAG;AAAA,EACpB,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/button.tsx"],"sourcesContent":["import { Spinner } from \"@/components/spinner\";\nimport { ButtonVariants, buttonRecipe } from \"@/theme/recipes/button.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"button\";\n\nexport type ButtonProps = ComponentProps<typeof defaultElement, ButtonVariants>;\n\nexport const Button = ({ asChild, ...props }: ButtonProps) => {\n const variants = pick(props, ...buttonRecipe.variants());\n const button = buttonRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp\n {...props}\n className={mergeClasses(button, props.className)}\n disabled={props.disabled || Boolean(variants.loading)}\n >\n {props.children}\n {variants.loading && <Spinner style={{ position: \"absolute\" }} />}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAKA,SAAS,YAAY;AAYjB,SAMuB,KANvB;AAVJ,IAAM,iBAAiB;AAIhB,IAAM,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,MAAmB;AAC5D,QAAM,WAAW,KAAK,OAAO,GAAG,aAAa,SAAS,CAAC;AACvD,QAAM,SAAS,aAAa,QAAQ;AACpC,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,aAAa,QAAQ,MAAM,SAAS;AAAA,MAC/C,UAAU,MAAM,YAAY,QAAQ,SAAS,OAAO;AAAA,MAEnD;AAAA,cAAM;AAAA,QACN,SAAS,WAAW,oBAAC,WAAQ,OAAO,EAAE,UAAU,WAAW,GAAG;AAAA;AAAA;AAAA,EACjE;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/text.tsx"],"sourcesContent":["import { TextVariants, textRecipe } from \"@/theme/recipes/text.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"span\";\n\ntype TextProps = ComponentProps<typeof defaultElement, TextVariants>;\n\nexport const Text = ({ asChild, ...props }: TextProps) => {\n const variants = pick(props, ...textRecipe.variants());\n const text = textRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp {...props} className={mergeClasses(text, props.className)}>\n {props.children}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;AAIA,SAAS,YAAY;AAYjB;AAVJ,IAAM,iBAAiB;AAIhB,IAAM,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,MAAiB;AACxD,QAAM,WAAW,KAAK,OAAO,GAAG,WAAW,SAAS,CAAC;AACrD,QAAM,OAAO,WAAW,QAAQ;AAChC,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE,oBAAC,QAAM,GAAG,OAAO,WAAW,aAAa,MAAM,MAAM,SAAS,GAC3D,gBAAM,UACT;AAEJ;","names":[]}
|
package/dist/chunk-CYDWEPFL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-CYDWEPFL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/spinner.tsx"],"sourcesContent":["import { SpinnerVariants, spinnerRecipe } from \"@/theme/recipes/spinner.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"div\";\n\ntype SpinnerProps = ComponentProps<typeof defaultElement, SpinnerVariants>;\n\nexport const Spinner = ({ asChild, ...props }: SpinnerProps) => {\n const variants = pick(props, ...spinnerRecipe.variants());\n const spinner = spinnerRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp {...props} className={mergeClasses(spinner, props.className)}>\n {props.children}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;AAIA,SAAS,YAAY;AAYjB;AAVJ,IAAM,iBAAiB;AAIhB,IAAM,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,MAAoB;AAC9D,QAAM,WAAW,KAAK,OAAO,GAAG,cAAc,SAAS,CAAC;AACxD,QAAM,UAAU,cAAc,QAAQ;AACtC,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE,oBAAC,QAAM,GAAG,OAAO,WAAW,aAAa,SAAS,MAAM,SAAS,GAC9D,gBAAM,UACT;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/status.tsx"],"sourcesContent":["import { StatusVariants, statusRecipe } from \"@/theme/recipes/status.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"div\";\n\ntype StatusProps = ComponentProps<typeof defaultElement, StatusVariants>;\n\nexport const Status = ({ asChild, ...props }: StatusProps) => {\n const variants = pick(props, ...statusRecipe.variants());\n const status = statusRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp {...props} className={mergeClasses(status, props.className)}>\n {props.children}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;AAIA,SAAS,YAAY;AAYjB;AAVJ,IAAM,iBAAiB;AAIhB,IAAM,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,MAAmB;AAC5D,QAAM,WAAW,KAAK,OAAO,GAAG,aAAa,SAAS,CAAC;AACvD,QAAM,SAAS,aAAa,QAAQ;AACpC,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE,oBAAC,QAAM,GAAG,OAAO,WAAW,aAAa,QAAQ,MAAM,SAAS,GAC7D,gBAAM,UACT;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/icon-button.tsx"],"sourcesContent":["import { Spinner } from \"@/components/spinner\";\nimport {\n IconButtonVariants,\n iconButtonRecipe,\n} from \"@/theme/recipes/icon-button.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"button\";\n\ntype IconButtonProps = ComponentProps<\n typeof defaultElement,\n IconButtonVariants\n>;\n\nexport const IconButton = ({ asChild, ...props }: IconButtonProps) => {\n const variants = pick(props, ...iconButtonRecipe.variants());\n const iconButton = iconButtonRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp\n {...props}\n className={mergeClasses(iconButton, props.className)}\n disabled={props.disabled || Boolean(variants.loading)}\n >\n {props.children}\n {variants.loading && <Spinner style={{ position: \"absolute\" }} />}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,YAAY;AAejB,SAMuB,KANvB;AAbJ,IAAM,iBAAiB;AAOhB,IAAM,aAAa,CAAC,EAAE,SAAS,GAAG,MAAM,MAAuB;AACpE,QAAM,WAAW,KAAK,OAAO,GAAG,iBAAiB,SAAS,CAAC;AAC3D,QAAM,aAAa,iBAAiB,QAAQ;AAC5C,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,aAAa,YAAY,MAAM,SAAS;AAAA,MACnD,UAAU,MAAM,YAAY,QAAQ,SAAS,OAAO;AAAA,MAEnD;AAAA,cAAM;AAAA,QACN,SAAS,WAAW,oBAAC,WAAQ,OAAO,EAAE,UAAU,WAAW,GAAG;AAAA;AAAA;AAAA,EACjE;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/box.tsx"],"sourcesContent":["import { box } from \"@/theme/styles/box.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"div\";\n\ntype BoxProps = ComponentProps<typeof defaultElement>;\n\nexport const Box = ({ asChild, ...props }: BoxProps) => {\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp {...props} className={mergeClasses(box, props.className)}>\n {props.children}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;AAGA,SAAS,YAAY;AAUjB;AARJ,IAAM,iBAAiB;AAIhB,IAAM,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,MAAgB;AACtD,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE,oBAAC,QAAM,GAAG,OAAO,WAAW,aAAa,KAAK,MAAM,SAAS,GAC1D,gBAAM,UACT;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/flex.tsx"],"sourcesContent":["import { FlexVariants, flexRecipe } from \"@/theme/recipes/flex.css\";\nimport { ComponentProps } from \"@/types/component-props\";\nimport { mergeClasses } from \"@/utils/merge-classes\";\nimport { pick } from \"@/utils/pick\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nconst defaultElement = \"div\";\n\ntype FlexProps = ComponentProps<typeof defaultElement, FlexVariants>;\n\nexport const Flex = ({ asChild, ...props }: FlexProps) => {\n const variants = pick(props, ...flexRecipe.variants());\n const flex = flexRecipe(variants);\n const Comp = asChild ? Slot : defaultElement;\n\n return (\n <Comp {...props} className={mergeClasses(flex, props.className)}>\n {props.children}\n </Comp>\n );\n};\n"],"mappings":";;;;;;;;;;;AAIA,SAAS,YAAY;AAYjB;AAVJ,IAAM,iBAAiB;AAIhB,IAAM,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,MAAiB;AACxD,QAAM,WAAW,KAAK,OAAO,GAAG,WAAW,SAAS,CAAC;AACrD,QAAM,OAAO,WAAW,QAAQ;AAChC,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE,oBAAC,QAAM,GAAG,OAAO,WAAW,aAAa,MAAM,MAAM,SAAS,GAC3D,gBAAM,UACT;AAEJ;","names":[]}
|
|
File without changes
|