@spark-ui/components 12.1.1 → 12.2.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.
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  IconButton
3
3
  } from "../chunk-DCXWGQVZ.mjs";
4
- import "../chunk-2YM6GKWW.mjs";
5
- import "../chunk-GAK4SC2F.mjs";
6
4
  import {
7
5
  Icon
8
6
  } from "../chunk-UMUMFMFB.mjs";
7
+ import "../chunk-2YM6GKWW.mjs";
8
+ import "../chunk-GAK4SC2F.mjs";
9
9
  import "../chunk-KEGAAGJW.mjs";
10
10
  import "../chunk-6QCEPQ3U.mjs";
11
11
 
@@ -2,11 +2,11 @@ import {
2
2
  Popover
3
3
  } from "../chunk-GPJMLIHC.mjs";
4
4
  import "../chunk-DCXWGQVZ.mjs";
5
- import "../chunk-2YM6GKWW.mjs";
6
- import "../chunk-GAK4SC2F.mjs";
7
5
  import {
8
6
  Icon
9
7
  } from "../chunk-UMUMFMFB.mjs";
8
+ import "../chunk-2YM6GKWW.mjs";
9
+ import "../chunk-GAK4SC2F.mjs";
10
10
  import {
11
11
  VisuallyHidden
12
12
  } from "../chunk-KEGAAGJW.mjs";
@@ -4,14 +4,14 @@ import {
4
4
  import {
5
5
  IconButton
6
6
  } from "../chunk-DCXWGQVZ.mjs";
7
+ import {
8
+ Icon
9
+ } from "../chunk-UMUMFMFB.mjs";
7
10
  import {
8
11
  Button,
9
12
  buttonStyles
10
13
  } from "../chunk-2YM6GKWW.mjs";
11
14
  import "../chunk-GAK4SC2F.mjs";
12
- import {
13
- Icon
14
- } from "../chunk-UMUMFMFB.mjs";
15
15
  import "../chunk-KEGAAGJW.mjs";
16
16
  import {
17
17
  Slot
@@ -4,8 +4,8 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const iconStyles: (props?: ({
7
- intent?: "main" | "alert" | "error" | "current" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
- size?: "sm" | "md" | "lg" | "current" | "xl" | null | undefined;
7
+ intent?: "main" | "current" | "alert" | "error" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
+ size?: "current" | "sm" | "md" | "lg" | "xl" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  type IconVariantsProps = VariantProps<typeof iconStyles>;
11
11
 
@@ -4,8 +4,8 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const iconStyles: (props?: ({
7
- intent?: "main" | "alert" | "error" | "current" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
- size?: "sm" | "md" | "lg" | "current" | "xl" | null | undefined;
7
+ intent?: "main" | "current" | "alert" | "error" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
+ size?: "current" | "sm" | "md" | "lg" | "xl" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  type IconVariantsProps = VariantProps<typeof iconStyles>;
11
11
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  IconButton
3
3
  } from "../chunk-DCXWGQVZ.mjs";
4
+ import {
5
+ Icon
6
+ } from "../chunk-UMUMFMFB.mjs";
4
7
  import {
5
8
  Button
6
9
  } from "../chunk-2YM6GKWW.mjs";
7
10
  import "../chunk-GAK4SC2F.mjs";
8
- import {
9
- Icon
10
- } from "../chunk-UMUMFMFB.mjs";
11
11
  import "../chunk-KEGAAGJW.mjs";
12
12
  import "../chunk-6QCEPQ3U.mjs";
13
13
 
@@ -2,9 +2,9 @@ import {
2
2
  Popover
3
3
  } from "../chunk-GPJMLIHC.mjs";
4
4
  import "../chunk-DCXWGQVZ.mjs";
5
+ import "../chunk-UMUMFMFB.mjs";
5
6
  import "../chunk-2YM6GKWW.mjs";
6
7
  import "../chunk-GAK4SC2F.mjs";
7
- import "../chunk-UMUMFMFB.mjs";
8
8
  import "../chunk-KEGAAGJW.mjs";
9
9
  import "../chunk-6QCEPQ3U.mjs";
10
10
  export {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  IconButton
3
3
  } from "../chunk-DCXWGQVZ.mjs";
4
+ import {
5
+ Icon
6
+ } from "../chunk-UMUMFMFB.mjs";
4
7
  import {
5
8
  Button
6
9
  } from "../chunk-2YM6GKWW.mjs";
7
10
  import "../chunk-GAK4SC2F.mjs";
8
- import {
9
- Icon
10
- } from "../chunk-UMUMFMFB.mjs";
11
11
  import "../chunk-KEGAAGJW.mjs";
12
12
  import {
13
13
  Slot
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  IconButton
3
3
  } from "../chunk-DCXWGQVZ.mjs";
4
+ import {
5
+ Icon
6
+ } from "../chunk-UMUMFMFB.mjs";
4
7
  import {
5
8
  Button
6
9
  } from "../chunk-2YM6GKWW.mjs";
7
10
  import "../chunk-GAK4SC2F.mjs";
8
- import {
9
- Icon
10
- } from "../chunk-UMUMFMFB.mjs";
11
11
  import "../chunk-KEGAAGJW.mjs";
12
12
  import "../chunk-6QCEPQ3U.mjs";
13
13
 
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const spinnerStyles: (props?: ({
7
7
  size?: "sm" | "md" | "current" | "full" | null | undefined;
8
- intent?: "main" | "alert" | "error" | "current" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
+ intent?: "main" | "current" | "alert" | "error" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
9
9
  isBackgroundVisible?: boolean | null | undefined;
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
11
11
  type SpinnerStylesProps = VariantProps<typeof spinnerStyles>;
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const spinnerStyles: (props?: ({
7
7
  size?: "sm" | "md" | "current" | "full" | null | undefined;
8
- intent?: "main" | "alert" | "error" | "current" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
8
+ intent?: "main" | "current" | "alert" | "error" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | null | undefined;
9
9
  isBackgroundVisible?: boolean | null | undefined;
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
11
11
  type SpinnerStylesProps = VariantProps<typeof spinnerStyles>;
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  IconButton
7
7
  } from "../chunk-DCXWGQVZ.mjs";
8
- import "../chunk-2YM6GKWW.mjs";
9
- import "../chunk-GAK4SC2F.mjs";
10
8
  import {
11
9
  Icon
12
10
  } from "../chunk-UMUMFMFB.mjs";
11
+ import "../chunk-2YM6GKWW.mjs";
12
+ import "../chunk-GAK4SC2F.mjs";
13
13
  import "../chunk-KEGAAGJW.mjs";
14
14
  import "../chunk-6QCEPQ3U.mjs";
15
15
 
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Tabs as Tabs$2 } from 'radix-ui';
3
- import * as react from 'react';
3
+ import * as React from 'react';
4
4
  import { PropsWithChildren, Ref, ReactElement, ComponentType, ReactNode } from 'react';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
@@ -80,8 +80,8 @@ interface TabsPopoverTriggerProps extends Omit<TriggerProps, 'asChild' | 'childr
80
80
  'aria-label': string;
81
81
  children?: ReactNode;
82
82
  }
83
- declare const TabsPopoverTrigger: react.ForwardRefExoticComponent<Omit<TabsPopoverTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
84
- declare const TabsPopoverContent: react.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
83
+ declare const TabsPopoverTrigger: React.ForwardRefExoticComponent<Omit<TabsPopoverTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
84
+ declare const TabsPopoverContent: React.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
85
85
  type TabsPopoverTriggerComponent = typeof TabsPopoverTrigger;
86
86
  type TabsPopoverContentComponent = typeof TabsPopoverContent;
87
87
  type ConfiguredPopoverComponent = ComponentType<PopoverProps> & Omit<typeof Popover, 'Content' | 'Trigger'> & {
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Tabs as Tabs$2 } from 'radix-ui';
3
- import * as react from 'react';
3
+ import * as React from 'react';
4
4
  import { PropsWithChildren, Ref, ReactElement, ComponentType, ReactNode } from 'react';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
@@ -80,8 +80,8 @@ interface TabsPopoverTriggerProps extends Omit<TriggerProps, 'asChild' | 'childr
80
80
  'aria-label': string;
81
81
  children?: ReactNode;
82
82
  }
83
- declare const TabsPopoverTrigger: react.ForwardRefExoticComponent<Omit<TabsPopoverTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
84
- declare const TabsPopoverContent: react.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
83
+ declare const TabsPopoverTrigger: React.ForwardRefExoticComponent<Omit<TabsPopoverTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
84
+ declare const TabsPopoverContent: React.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
85
85
  type TabsPopoverTriggerComponent = typeof TabsPopoverTrigger;
86
86
  type TabsPopoverContentComponent = typeof TabsPopoverContent;
87
87
  type ConfiguredPopoverComponent = ComponentType<PopoverProps> & Omit<typeof Popover, 'Content' | 'Trigger'> & {
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  IconButton
6
6
  } from "../chunk-DCXWGQVZ.mjs";
7
+ import {
8
+ Icon
9
+ } from "../chunk-UMUMFMFB.mjs";
7
10
  import {
8
11
  Button
9
12
  } from "../chunk-2YM6GKWW.mjs";
10
13
  import "../chunk-GAK4SC2F.mjs";
11
- import {
12
- Icon
13
- } from "../chunk-UMUMFMFB.mjs";
14
14
  import "../chunk-KEGAAGJW.mjs";
15
15
  import "../chunk-6QCEPQ3U.mjs";
16
16
 
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Toast } from '@base-ui-components/react/toast';
3
- import * as react from 'react';
3
+ import * as React from 'react';
4
4
  import { ButtonProps } from '../button/index.mjs';
5
5
  import 'class-variance-authority/types';
6
6
  import 'class-variance-authority';
@@ -8,12 +8,14 @@ import 'class-variance-authority';
8
8
  type ToastIntent = 'main' | 'support' | 'accent' | 'basic' | 'success' | 'alert' | 'error' | 'info' | 'neutral' | 'surface' | 'surfaceInverse';
9
9
  type ToastDesign = 'tinted' | 'filled';
10
10
  interface ToastData {
11
- icon?: react.ReactNode;
11
+ icon?: React.ReactNode;
12
12
  design?: ToastDesign;
13
13
  intent?: ToastIntent;
14
14
  isClosable?: boolean;
15
15
  closeLabel?: string;
16
16
  compact?: boolean;
17
+ title?: React.ReactNode;
18
+ description?: React.ReactNode;
17
19
  action?: {
18
20
  close?: boolean;
19
21
  label: string;
@@ -21,8 +23,10 @@ interface ToastData {
21
23
  } & ButtonProps;
22
24
  }
23
25
  type ToastObject = Toast.Root.ToastObject<ToastData>;
24
- interface AddOptions extends Omit<ToastObject, 'id' | 'animation' | 'height' | 'ref' | 'limited'> {
26
+ interface AddOptions extends Omit<ToastObject, 'id' | 'animation' | 'height' | 'ref' | 'limited' | 'title' | 'description'> {
25
27
  id?: string;
28
+ title?: string | React.ReactNode;
29
+ description?: string | React.ReactNode;
26
30
  }
27
31
  type UpdateOptions = Partial<AddOptions>;
28
32
  interface PromiseOptions<Value> {
@@ -41,19 +45,19 @@ interface UseToastManagerReturnValue {
41
45
 
42
46
  declare function useToastManager(): UseToastManagerReturnValue;
43
47
 
44
- interface ToastProviderProps extends react.ComponentProps<typeof Toast.Provider> {
45
- children: react.ReactNode;
48
+ interface ToastProviderProps extends React.ComponentProps<typeof Toast.Provider> {
49
+ children: React.ReactNode;
46
50
  }
47
51
  declare function ToastProvider({ children, limit, ...props }: ToastProviderProps): react_jsx_runtime.JSX.Element;
48
- interface ToastTriggerProps extends react.ComponentPropsWithRef<'button'>, Pick<ToastObject, 'priority'>, Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {
49
- children: react.ReactNode;
52
+ interface ToastTriggerProps extends Omit<React.ComponentPropsWithRef<'button'>, 'title'>, Pick<ToastObject, 'priority'>, Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {
53
+ children: React.ReactNode;
50
54
  asChild?: boolean;
51
- title: string;
52
- description?: string;
55
+ title: string | React.ReactNode;
56
+ description?: string | React.ReactNode;
53
57
  timeout?: number;
54
58
  }
55
59
  declare function ToastTrigger({ children, onClick, asChild, title, description, timeout, design, intent, isClosable, icon, action, compact, priority, }: ToastTriggerProps): react_jsx_runtime.JSX.Element;
56
60
  type ToastManager = ReturnType<typeof Toast.createToastManager>;
57
61
  declare const createToastManager: () => ToastManager;
58
62
 
59
- export { type ToastData, type ToastDesign, type ToastIntent, type ToastManager, type ToastObject, ToastProvider, ToastTrigger, type UseToastManagerReturnValue, createToastManager, useToastManager };
63
+ export { type AddOptions, type ToastData, type ToastDesign, type ToastIntent, type ToastManager, type ToastObject, ToastProvider, ToastTrigger, type UseToastManagerReturnValue, createToastManager, useToastManager };
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Toast } from '@base-ui-components/react/toast';
3
- import * as react from 'react';
3
+ import * as React from 'react';
4
4
  import { ButtonProps } from '../button/index.js';
5
5
  import 'class-variance-authority/types';
6
6
  import 'class-variance-authority';
@@ -8,12 +8,14 @@ import 'class-variance-authority';
8
8
  type ToastIntent = 'main' | 'support' | 'accent' | 'basic' | 'success' | 'alert' | 'error' | 'info' | 'neutral' | 'surface' | 'surfaceInverse';
9
9
  type ToastDesign = 'tinted' | 'filled';
10
10
  interface ToastData {
11
- icon?: react.ReactNode;
11
+ icon?: React.ReactNode;
12
12
  design?: ToastDesign;
13
13
  intent?: ToastIntent;
14
14
  isClosable?: boolean;
15
15
  closeLabel?: string;
16
16
  compact?: boolean;
17
+ title?: React.ReactNode;
18
+ description?: React.ReactNode;
17
19
  action?: {
18
20
  close?: boolean;
19
21
  label: string;
@@ -21,8 +23,10 @@ interface ToastData {
21
23
  } & ButtonProps;
22
24
  }
23
25
  type ToastObject = Toast.Root.ToastObject<ToastData>;
24
- interface AddOptions extends Omit<ToastObject, 'id' | 'animation' | 'height' | 'ref' | 'limited'> {
26
+ interface AddOptions extends Omit<ToastObject, 'id' | 'animation' | 'height' | 'ref' | 'limited' | 'title' | 'description'> {
25
27
  id?: string;
28
+ title?: string | React.ReactNode;
29
+ description?: string | React.ReactNode;
26
30
  }
27
31
  type UpdateOptions = Partial<AddOptions>;
28
32
  interface PromiseOptions<Value> {
@@ -41,19 +45,19 @@ interface UseToastManagerReturnValue {
41
45
 
42
46
  declare function useToastManager(): UseToastManagerReturnValue;
43
47
 
44
- interface ToastProviderProps extends react.ComponentProps<typeof Toast.Provider> {
45
- children: react.ReactNode;
48
+ interface ToastProviderProps extends React.ComponentProps<typeof Toast.Provider> {
49
+ children: React.ReactNode;
46
50
  }
47
51
  declare function ToastProvider({ children, limit, ...props }: ToastProviderProps): react_jsx_runtime.JSX.Element;
48
- interface ToastTriggerProps extends react.ComponentPropsWithRef<'button'>, Pick<ToastObject, 'priority'>, Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {
49
- children: react.ReactNode;
52
+ interface ToastTriggerProps extends Omit<React.ComponentPropsWithRef<'button'>, 'title'>, Pick<ToastObject, 'priority'>, Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {
53
+ children: React.ReactNode;
50
54
  asChild?: boolean;
51
- title: string;
52
- description?: string;
55
+ title: string | React.ReactNode;
56
+ description?: string | React.ReactNode;
53
57
  timeout?: number;
54
58
  }
55
59
  declare function ToastTrigger({ children, onClick, asChild, title, description, timeout, design, intent, isClosable, icon, action, compact, priority, }: ToastTriggerProps): react_jsx_runtime.JSX.Element;
56
60
  type ToastManager = ReturnType<typeof Toast.createToastManager>;
57
61
  declare const createToastManager: () => ToastManager;
58
62
 
59
- export { type ToastData, type ToastDesign, type ToastIntent, type ToastManager, type ToastObject, ToastProvider, ToastTrigger, type UseToastManagerReturnValue, createToastManager, useToastManager };
63
+ export { type AddOptions, type ToastData, type ToastDesign, type ToastIntent, type ToastManager, type ToastObject, ToastProvider, ToastTrigger, type UseToastManagerReturnValue, createToastManager, useToastManager };
@@ -1324,6 +1324,29 @@ function Toast({ toast }) {
1324
1324
  }
1325
1325
  );
1326
1326
  };
1327
+ const renderTitle = () => {
1328
+ const title = toast.data?.title ?? toast.title;
1329
+ const hasDescription = !!(toast.data?.description ?? toast.description);
1330
+ if (typeof title !== "string" && title !== void 0) {
1331
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1332
+ import_toast.Toast.Title,
1333
+ {
1334
+ className: hasDescription ? "text-headline-2" : "text-body-1",
1335
+ render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {}),
1336
+ children: title
1337
+ }
1338
+ );
1339
+ }
1340
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Title, { className: hasDescription ? "text-headline-2" : "text-body-1" });
1341
+ };
1342
+ const renderDescription = () => {
1343
+ const description = toast.data?.description ?? toast.description;
1344
+ if (!description) return null;
1345
+ if (typeof description !== "string") {
1346
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Description, { className: "text-body-1 break-all", render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {}), children: description });
1347
+ }
1348
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Description, { className: "text-body-1 break-all" });
1349
+ };
1327
1350
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Root, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_class_variance_authority7.cx)("flex", compact ? "gap-lg items-center" : "gap-md flex-col"), children: [
1328
1351
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gap-lg p-md flex grow items-center", children: [
1329
1352
  ToastIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "md", children: ToastIcon }),
@@ -1336,8 +1359,8 @@ function Toast({ toast }) {
1336
1359
  !compact && isClosable && "pr-3xl"
1337
1360
  ),
1338
1361
  children: [
1339
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Title, { className: toast.description ? "text-headline-2" : "text-body-1" }),
1340
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Description, { className: "text-body-1" })
1362
+ renderTitle(),
1363
+ renderDescription()
1341
1364
  ]
1342
1365
  }
1343
1366
  )
@@ -1399,7 +1422,7 @@ function ToastTrigger({
1399
1422
  compact,
1400
1423
  priority = "low"
1401
1424
  }) {
1402
- const toastManager = import_toast3.Toast.useToastManager();
1425
+ const toastManager = useToastManager();
1403
1426
  const Component = asChild ? Slot : "button";
1404
1427
  function createToast(e) {
1405
1428
  onClick?.(e);