@giddaa-housing/ui 3.0.1 → 3.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.
- package/css/generated/shared.css +1 -1
- package/css/giddaa.css +173 -2
- package/css/preset.css +8 -1
- package/css/theme.css +4 -1
- package/dist/accordion.js +2 -2
- package/dist/activity-timeline.js +5 -5
- package/dist/alert.js +1 -1
- package/dist/auth-layout.js +18 -18
- package/dist/bar-chart.d.ts +1 -1
- package/dist/breadcrumb.js +3 -3
- package/dist/bullet-chart.d.ts +1 -1
- package/dist/button-group.d.ts +1 -1
- package/dist/button.js +2 -2
- package/dist/calendar.js +3 -3
- package/dist/call-card.js +1 -1
- package/dist/carousel.d.ts +1 -1
- package/dist/carousel.js +3 -3
- package/dist/chart.d.ts +1 -1
- package/dist/chart.js +1 -1
- package/dist/chat.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/combobox.d.ts +1 -1
- package/dist/combobox.js +6 -6
- package/dist/cta.js +3 -3
- package/dist/currency-selector.d.ts +10 -8
- package/dist/currency-selector.js +247 -28
- package/dist/data-table.js +2 -2
- package/dist/date-picker.js +6 -6
- package/dist/dialog.js +2 -2
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +20 -20
- package/dist/dropzone.js +1 -1
- package/dist/editorial-card.d.ts +20 -11
- package/dist/editorial-card.js +67 -2
- package/dist/file-upload.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/footer.d.ts +4 -2
- package/dist/footer.js +38 -34
- package/dist/funnel-chart.d.ts +1 -1
- package/dist/heatmap-chart.d.ts +1 -1
- package/dist/icons.d.ts +93 -0
- package/dist/icons.js +905 -0
- package/dist/infinite-scroll.js +1 -1
- package/dist/input-group.js +4 -5
- package/dist/input-otp.js +2 -2
- package/dist/input-size-context.js +4 -2
- package/dist/input.js +1 -1
- package/dist/kpi-card.js +1 -1
- package/dist/line-chart.d.ts +1 -1
- package/dist/mask-input.d.ts +61 -0
- package/dist/mask-input.js +0 -0
- package/dist/match.js +1 -1
- package/dist/media-gallery-hero.js +1 -1
- package/dist/media-player.js +59 -48
- package/dist/message.js +1 -1
- package/dist/mobile-sidebar.d.ts +57 -0
- package/dist/mobile-sidebar.js +196 -0
- package/dist/multi-step-form.js +2 -2
- package/dist/number-input.d.ts +1 -1
- package/dist/number-input.js +3 -3
- package/dist/pagination.js +4 -4
- package/dist/password-input.js +1 -1
- package/dist/phone-input.d.ts +1 -1
- package/dist/phone-input.js +4 -4
- package/dist/photo-gallery.js +3 -3
- package/dist/pie-chart.d.ts +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/price-tag.js +1 -1
- package/dist/radar-chart.d.ts +1 -1
- package/dist/rich-text-editor.d.ts +1 -1
- package/dist/rich-text-editor.js +4 -4
- package/dist/scatter-chart.d.ts +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +6 -6
- package/dist/sheet.js +2 -2
- package/dist/sidebar.js +1 -1
- package/dist/{size-context-D4mYvcg8.d.ts → size-context-BX6kAdVj.d.ts} +2 -1
- package/dist/size-context.d.ts +2 -2
- package/dist/size-context.js +5 -2
- package/dist/sparkline.d.ts +1 -1
- package/dist/stepper.js +2 -2
- package/dist/styles.css +681 -128
- package/dist/table.js +2 -2
- package/dist/tabs.d.ts +1 -1
- package/dist/tag.d.ts +1 -1
- package/dist/tag.js +1 -1
- package/dist/testimonial-block.js +1 -1
- package/dist/theme-switcher.d.ts +31 -0
- package/dist/theme-switcher.js +78 -0
- package/dist/time-picker.js +2 -2
- package/dist/toast.d.ts +38 -10
- package/dist/toast.js +55 -52
- package/dist/top-navbar.d.ts +100 -0
- package/dist/top-navbar.js +295 -0
- package/dist/tree-map.d.ts +1 -1
- package/dist/video-player-dialog.d.ts +57 -0
- package/dist/video-player-dialog.js +188 -0
- package/dist/waterfall-chart.d.ts +1 -1
- package/package.json +25 -2
package/dist/table.js
CHANGED
|
@@ -16,7 +16,7 @@ function getPinnedDividerClassName(pinnedSide) {
|
|
|
16
16
|
function Table({ className, containerClassName, ...props }) {
|
|
17
17
|
return /* @__PURE__ */ jsx("div", {
|
|
18
18
|
"data-slot": "table-container",
|
|
19
|
-
className: cn("relative w-full overflow-x-auto rounded-2xl border border-line-subtle bg-canvas", containerClassName),
|
|
19
|
+
className: cn("relative isolate w-full overflow-x-auto rounded-2xl border border-line-subtle bg-canvas", containerClassName),
|
|
20
20
|
children: /* @__PURE__ */ jsx("table", {
|
|
21
21
|
"data-slot": "table",
|
|
22
22
|
className: cn("min-w-full caption-bottom", className),
|
|
@@ -79,7 +79,7 @@ function TableRow({ className, ...props }) {
|
|
|
79
79
|
function TableHead({ className, pinnedSide, ...props }) {
|
|
80
80
|
return /* @__PURE__ */ jsx("th", {
|
|
81
81
|
"data-slot": "table-head",
|
|
82
|
-
className: cn("relative h-14 px-6 py-4 text-left align-middle bg-surface-raised", "text-gdt-sm font-semibold text-fg-secondary", "break-words has-[[role=checkbox]]:pr-0", getPinnedDividerClassName(pinnedSide), className),
|
|
82
|
+
className: cn("relative h-14 px-6 py-4 text-left align-middle bg-surface-raised first:rounded-tl-2xl last:rounded-tr-2xl", "text-gdt-sm font-semibold text-fg-secondary", "break-words has-[[role=checkbox]]:pr-0", getPinnedDividerClassName(pinnedSide), className),
|
|
83
83
|
...props
|
|
84
84
|
});
|
|
85
85
|
}
|
package/dist/tabs.d.ts
CHANGED
package/dist/tag.d.ts
CHANGED
package/dist/tag.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { X } from "./icons.js";
|
|
2
3
|
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
4
|
import { useComponentSize } from "./size-context.js";
|
|
4
|
-
import { X } from "lucide-react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
//#region src/tag.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { ArrowUpRight, Play, Star } from "./icons.js";
|
|
2
3
|
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
4
|
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
4
5
|
import { buttonVariants } from "./button.js";
|
|
5
|
-
import { ArrowUpRight, Play, Star } from "lucide-react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
8
8
|
import { useRender } from "@base-ui/react/use-render";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region src/theme-switcher.d.ts
|
|
5
|
+
type ThemeSwitcherValue = "light" | "dark" | "system";
|
|
6
|
+
type ThemeSwitcherOption = {
|
|
7
|
+
value: ThemeSwitcherValue;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare const themeSwitcherVariants: (props?: ({
|
|
12
|
+
size?: "lg" | "md" | "sm" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
declare const defaultThemeSwitcherOptions: readonly ThemeSwitcherOption[];
|
|
15
|
+
type ThemeSwitcherProps = Omit<React.ComponentProps<typeof DropdownMenuTrigger>, "children"> & VariantProps<typeof themeSwitcherVariants> & {
|
|
16
|
+
/** The selected theme. Pass this with `onValueChange` for controlled use. */
|
|
17
|
+
value?: ThemeSwitcherValue;
|
|
18
|
+
/** The initial theme when the switcher is uncontrolled. */
|
|
19
|
+
defaultValue?: ThemeSwitcherValue;
|
|
20
|
+
/** Called when a theme is selected. Applying the theme remains app-owned. */
|
|
21
|
+
onValueChange?: (value: ThemeSwitcherValue) => void;
|
|
22
|
+
/** Available modes, in menu order. Defaults to Light, Dark, and System. */
|
|
23
|
+
options?: readonly ThemeSwitcherOption[];
|
|
24
|
+
showIcon?: boolean;
|
|
25
|
+
showLabel?: boolean;
|
|
26
|
+
/** Accessible label used when the visible theme label is hidden. */
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
};
|
|
29
|
+
declare function ThemeSwitcher({ className, size, value, defaultValue, onValueChange, options, showIcon, showLabel, "aria-label": ariaLabel, ...props }: ThemeSwitcherProps): React.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ThemeSwitcher, type ThemeSwitcherOption, type ThemeSwitcherProps, type ThemeSwitcherValue, defaultThemeSwitcherOptions, themeSwitcherVariants };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ChevronDown, Monitor, Moon, Sun } from "./icons.js";
|
|
3
|
+
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
4
|
+
import { useComponentSize } from "./size-context.js";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
//#region src/theme-switcher.tsx
|
|
10
|
+
const themeSwitcherVariants = cva("group/theme-switcher inline-flex shrink-0 items-center justify-center rounded-full bg-action-tertiary font-bold text-fg-primary outline-none transition-[background-color,box-shadow,scale] duration-(--duration-motion-press) ease-gdt-out hover:bg-action-tertiary-hover active:scale-[0.97] active:bg-action-tertiary-pressed focus-visible:shadow-[0_0_0_2px_var(--color-line-focus)] data-popup-open:bg-action-tertiary-pressed motion-reduce:active:scale-100 [&_svg]:shrink-0", {
|
|
11
|
+
variants: { size: {
|
|
12
|
+
sm: "h-8 gap-1.5 px-3 text-gdt-xs [&_svg]:size-3.5",
|
|
13
|
+
md: "h-10 gap-2 px-3.5 text-gdt-sm [&_svg]:size-4",
|
|
14
|
+
lg: "h-12 gap-2.5 px-4.5 text-gdt-md [&_svg]:size-4.5"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { size: "md" }
|
|
17
|
+
});
|
|
18
|
+
const defaultThemeSwitcherOptions = [
|
|
19
|
+
{
|
|
20
|
+
value: "light",
|
|
21
|
+
label: "Light",
|
|
22
|
+
icon: /* @__PURE__ */ jsx(Sun, { "aria-hidden": "true" })
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "dark",
|
|
26
|
+
label: "Dark",
|
|
27
|
+
icon: /* @__PURE__ */ jsx(Moon, { "aria-hidden": "true" })
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "system",
|
|
31
|
+
label: "System",
|
|
32
|
+
icon: /* @__PURE__ */ jsx(Monitor, { "aria-hidden": "true" })
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
function ThemeSwitcher({ className, size, value, defaultValue = "system", onValueChange, options = defaultThemeSwitcherOptions, showIcon = true, showLabel = true, "aria-label": ariaLabel, ...props }) {
|
|
36
|
+
const resolvedSize = useComponentSize(size);
|
|
37
|
+
const resolvedOptions = options.length ? options : defaultThemeSwitcherOptions;
|
|
38
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
39
|
+
const requestedValue = value ?? uncontrolledValue;
|
|
40
|
+
const selectedTheme = resolvedOptions.find((option) => option.value === requestedValue) ?? resolvedOptions[0];
|
|
41
|
+
const selectedValue = selectedTheme.value;
|
|
42
|
+
function handleValueChange(nextValue) {
|
|
43
|
+
const nextTheme = nextValue;
|
|
44
|
+
if (value === void 0) setUncontrolledValue(nextTheme);
|
|
45
|
+
onValueChange?.(nextTheme);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
48
|
+
size: resolvedSize,
|
|
49
|
+
children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
50
|
+
"data-slot": "theme-switcher",
|
|
51
|
+
className: cn(themeSwitcherVariants({ size: resolvedSize }), className),
|
|
52
|
+
"aria-label": ariaLabel ?? (!showLabel ? `Theme: ${selectedTheme.label}` : void 0),
|
|
53
|
+
...props,
|
|
54
|
+
children: [
|
|
55
|
+
showIcon && selectedTheme.icon,
|
|
56
|
+
showLabel && /* @__PURE__ */ jsx("span", { children: selectedTheme.label }),
|
|
57
|
+
/* @__PURE__ */ jsx(ChevronDown, {
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: "text-fg-secondary transition-transform duration-(--duration-motion-popup) group-data-[popup-open]/theme-switcher:rotate-180 motion-reduce:transition-none"
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
63
|
+
align: "end",
|
|
64
|
+
className: "w-auto min-w-36",
|
|
65
|
+
children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
|
|
66
|
+
value: selectedValue,
|
|
67
|
+
onValueChange: handleValueChange,
|
|
68
|
+
children: resolvedOptions.map(({ value: optionValue, label, icon }) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
69
|
+
value: optionValue,
|
|
70
|
+
closeOnClick: true,
|
|
71
|
+
children: [icon, label]
|
|
72
|
+
}, optionValue))
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { ThemeSwitcher, defaultThemeSwitcherOptions, themeSwitcherVariants };
|
package/dist/time-picker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Clock } from "./icons.js";
|
|
2
3
|
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
4
|
import { t as useReducedMotion } from "./use-reduced-motion-BDvOK14x.js";
|
|
4
5
|
import { Popover, PopoverContent } from "./popover.js";
|
|
5
6
|
import { n as PickerFooter, r as PickerTrigger, t as PICKER_COLLISION_AVOIDANCE } from "./picker-xSTzeYhc.js";
|
|
6
|
-
import { ClockIcon } from "lucide-react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
//#region src/lib/time-picker-paint.ts
|
|
@@ -264,7 +264,7 @@ function TimePicker({ value, onChange, format = "12h", disabled = false, size, p
|
|
|
264
264
|
open,
|
|
265
265
|
onOpenChange: handleOpenChange,
|
|
266
266
|
children: [/* @__PURE__ */ jsx(PickerTrigger, {
|
|
267
|
-
icon:
|
|
267
|
+
icon: Clock,
|
|
268
268
|
displayValue: value ?? "",
|
|
269
269
|
placeholder,
|
|
270
270
|
disabled,
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,21 +1,49 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { ToastManagerAddOptions, ToastManagerUpdateOptions } from "@base-ui/react/toast";
|
|
1
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
import { ToastManagerAddOptions, ToastManagerUpdateOptions, ToastObject } from "@base-ui/react/toast";
|
|
3
3
|
//#region src/toast.d.ts
|
|
4
4
|
type ToastVariant = "success" | "info" | "warning" | "error" | "loading";
|
|
5
|
+
type ToastRenderProps = {
|
|
6
|
+
/** The live toast object, including `id`, `title`, and `description`. */
|
|
7
|
+
toast: ToastObject<ToastData>;
|
|
8
|
+
/** Dismisses this toast, playing the usual exit transition. */
|
|
9
|
+
close: () => void;
|
|
10
|
+
};
|
|
5
11
|
type ToastData = {
|
|
6
|
-
type
|
|
12
|
+
type?: ToastVariant;
|
|
13
|
+
render?: (props: ToastRenderProps) => ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Options for `toast.add`. `render` and `className` are lifted to the top level
|
|
18
|
+
* for convenience and stored on the toast's `data` under the hood.
|
|
19
|
+
*/
|
|
20
|
+
type ToastAddOptions = Omit<ToastManagerAddOptions<ToastData>, "data"> & {
|
|
21
|
+
/**
|
|
22
|
+
* Replaces the default icon/title/description layout with your own markup.
|
|
23
|
+
* The toast keeps its stacking, swipe, and timeout behavior.
|
|
24
|
+
*/
|
|
25
|
+
render?: (props: ToastRenderProps) => ReactNode;
|
|
26
|
+
/** Merged into the toast surface classes — restyle padding, width, colors. */
|
|
27
|
+
className?: string;
|
|
28
|
+
data?: ToastData;
|
|
7
29
|
};
|
|
8
30
|
declare const toastManager: import("@base-ui/react").ToastManager<any>;
|
|
9
|
-
declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
31
|
+
declare function addToast({ render, className, data, ...options }: ToastAddOptions): string;
|
|
32
|
+
declare const toast: ((options: ToastAddOptions) => string) & {
|
|
33
|
+
/**
|
|
34
|
+
* Adds a toast without a preset variant. Pass `render` to take over the
|
|
35
|
+
* toast body entirely, or just `title`/`description` for the stock layout.
|
|
36
|
+
*/
|
|
37
|
+
add: typeof addToast;
|
|
38
|
+
success: ({ data, ...options }: ToastAddOptions) => string;
|
|
39
|
+
info: ({ data, ...options }: ToastAddOptions) => string;
|
|
40
|
+
warning: ({ data, ...options }: ToastAddOptions) => string;
|
|
41
|
+
error: ({ data, ...options }: ToastAddOptions) => string;
|
|
42
|
+
loading: ({ data, ...options }: ToastAddOptions) => string;
|
|
15
43
|
dismiss: (toastId?: string | number) => void;
|
|
16
44
|
update: (toastId: string | number, options: ToastManagerUpdateOptions<ToastData>) => void;
|
|
17
45
|
promise: <Value, T extends any = any>(promiseValue: Promise<Value>, options: import("@base-ui/react").ToastManagerPromiseOptions<Value, T>) => Promise<Value>;
|
|
18
46
|
};
|
|
19
47
|
declare function ToastProvider({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
20
48
|
//#endregion
|
|
21
|
-
export { ToastProvider, toast, toastManager };
|
|
49
|
+
export { type ToastAddOptions, type ToastData, ToastProvider, type ToastRenderProps, type ToastVariant, toast, toastManager };
|
package/dist/toast.js
CHANGED
|
@@ -1,48 +1,43 @@
|
|
|
1
|
+
import { Check, Info, X } from "./icons.js";
|
|
1
2
|
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
2
3
|
import { Button } from "./button.js";
|
|
3
|
-
import { Check, Info, X } from "lucide-react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Toast } from "@base-ui/react/toast";
|
|
6
6
|
//#region src/toast.tsx
|
|
7
7
|
const DEFAULT_TOAST_SIDE = "top";
|
|
8
8
|
const DEFAULT_TOAST_ALIGN = "end";
|
|
9
9
|
const toastManager = Toast.createToastManager();
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
function addToast({ render, className, data, ...options }) {
|
|
11
|
+
return toastManager.add({
|
|
12
12
|
...options,
|
|
13
13
|
data: {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
...data,
|
|
15
|
+
render,
|
|
16
|
+
className
|
|
16
17
|
}
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...options.data
|
|
23
|
-
}
|
|
24
|
-
}),
|
|
25
|
-
warning: (options) => toastManager.add({
|
|
26
|
-
...options,
|
|
27
|
-
data: {
|
|
28
|
-
type: "warning",
|
|
29
|
-
...options.data
|
|
30
|
-
}
|
|
31
|
-
}),
|
|
32
|
-
error: (options) => toastManager.add({
|
|
33
|
-
...options,
|
|
34
|
-
data: {
|
|
35
|
-
type: "error",
|
|
36
|
-
...options.data
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
loading: (options) => toastManager.add({
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** Presets the variant while leaving every `toast.add` option available. */
|
|
21
|
+
function addVariant(type) {
|
|
22
|
+
return ({ data, ...options }) => addToast({
|
|
40
23
|
...options,
|
|
41
24
|
data: {
|
|
42
|
-
type
|
|
43
|
-
...
|
|
25
|
+
type,
|
|
26
|
+
...data
|
|
44
27
|
}
|
|
45
|
-
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const toast = Object.assign((options) => addToast(options), {
|
|
31
|
+
/**
|
|
32
|
+
* Adds a toast without a preset variant. Pass `render` to take over the
|
|
33
|
+
* toast body entirely, or just `title`/`description` for the stock layout.
|
|
34
|
+
*/
|
|
35
|
+
add: addToast,
|
|
36
|
+
success: addVariant("success"),
|
|
37
|
+
info: addVariant("info"),
|
|
38
|
+
warning: addVariant("warning"),
|
|
39
|
+
error: addVariant("error"),
|
|
40
|
+
loading: addVariant("loading"),
|
|
46
41
|
dismiss: (toastId) => toastManager.close(toastId?.toString()),
|
|
47
42
|
update: (toastId, options) => toastManager.update(toastId.toString(), options),
|
|
48
43
|
promise: toastManager.promise
|
|
@@ -78,32 +73,39 @@ function ToastList() {
|
|
|
78
73
|
stack.domIndex += 1;
|
|
79
74
|
if (item.transitionStatus !== "ending") stack.visibleIndex += 1;
|
|
80
75
|
placementStacks.set(placement.key, stack);
|
|
76
|
+
const render = item.data?.render;
|
|
81
77
|
return /* @__PURE__ */ jsx(Toast.Root, {
|
|
82
78
|
toast: item,
|
|
83
|
-
className: cn(toastRootBaseClassName, getToastPositionClassName(placement), getToastStackClassName(placement), getToastExitClassName(placement.side)),
|
|
79
|
+
className: cn(toastRootBaseClassName, getToastPositionClassName(placement), getToastStackClassName(placement), getToastExitClassName(placement.side), item.data?.className),
|
|
84
80
|
swipeDirection: getSwipeDirections(item),
|
|
85
81
|
style,
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
className:
|
|
88
|
-
children:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
children: /* @__PURE__ */ jsx(Toast.Content, {
|
|
83
|
+
className: toastContentClassName,
|
|
84
|
+
children: render ? render({
|
|
85
|
+
toast: item,
|
|
86
|
+
close: () => toastManager.close(item.id)
|
|
87
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
88
|
+
className: "grid grid-cols-[16px_minmax(0,1fr)_24px] items-start gap-3 overflow-hidden px-2.5 py-3.5 pl-3",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(ToastIcon, { type: item.data?.type }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "min-w-0 flex flex-col gap-1.5",
|
|
93
|
+
children: [
|
|
94
|
+
item.title ? /* @__PURE__ */ jsx(Toast.Title, { className: "text-gdt-sm font-semibold text-fg-primary" }) : null,
|
|
95
|
+
item.description ? /* @__PURE__ */ jsx(Toast.Description, { className: "text-gdt-sm text-fg-secondary" }) : null,
|
|
96
|
+
/* @__PURE__ */ jsx(Toast.Action, { className: cn("cursor-pointer border-0 bg-transparent p-0 font-inherit text-gdt-sm font-semibold inline-flex w-fit items-center hover:underline underline-offset-2", item.data?.type === "success" && "text-fg-brand", item.data?.type === "info" && "text-fg-primary", item.data?.type === "warning" && "text-fg-accent", item.data?.type === "error" && "text-fg-danger") })
|
|
97
|
+
]
|
|
102
98
|
}),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
/* @__PURE__ */ jsx(Toast.Close, {
|
|
100
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
size: "icon-xs"
|
|
103
|
+
}),
|
|
104
|
+
"aria-label": "Close toast",
|
|
105
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
})
|
|
107
109
|
})
|
|
108
110
|
}, item.id);
|
|
109
111
|
});
|
|
@@ -133,6 +135,7 @@ function ToastIcon({ type }) {
|
|
|
133
135
|
]
|
|
134
136
|
});
|
|
135
137
|
}
|
|
138
|
+
const toastContentClassName = "transition-opacity duration-250 data-behind:pointer-events-none data-behind:opacity-0 data-expanded:pointer-events-auto data-expanded:opacity-100";
|
|
136
139
|
const toastRootBaseClassName = "[--gap:12px] [--peek:12px] [--anchor-x:0px] [--anchor-y:0px] [--scale:calc(max(0,1-(var(--toast-placement-index)*0.04)))] [--shrink:calc(1-var(--scale))] [--height:var(--toast-placement-frontmost-height,var(--toast-height))] absolute z-[calc(1000-var(--toast-placement-index))] h-[var(--height)] min-h-[var(--height)] w-[min(335px,calc(100vw-32px))] overflow-visible rounded-lg border border-line bg-surface-overlay text-fg-primary shadow-[var(--elevation-e2-shadow)] pointer-events-auto select-none [transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(var(--collapsed-y))_scale(var(--scale))] [transition:transform_var(--duration-motion-surface)_var(--ease-gdt-out),opacity_var(--duration-motion-surface)_var(--ease-gdt-out)] motion-reduce:[transition:opacity_var(--duration-motion-surface)_var(--ease-gdt-out)] data-swiping:transition-none after:absolute after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:pointer-events-auto after:content-[''] data-[expanded]:h-[var(--toast-height)] data-[expanded]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(var(--expanded-y))_scale(1)] data-[starting-style]:opacity-0 data-[starting-style]:[transform:translateX(var(--exit-x))_translateY(var(--exit-y))_scale(var(--scale))] data-[ending-style]:opacity-0 data-[limited]:opacity-0 [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateX(var(--exit-x))_translateY(var(--exit-y))_scale(var(--scale))] data-[ending-style]:data-[swipe-direction=up]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(calc(var(--anchor-y)+var(--toast-swipe-movement-y)-150%))_scale(var(--scale))] data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(calc(var(--anchor-y)+var(--toast-swipe-movement-y)-150%))_scale(1)] data-[ending-style]:data-[swipe-direction=down]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(calc(var(--anchor-y)+var(--toast-swipe-movement-y)+150%))_scale(var(--scale))] data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)))_translateY(calc(var(--anchor-y)+var(--toast-swipe-movement-y)+150%))_scale(1)] data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)-150%))_translateY(var(--expanded-y))_scale(var(--scale))] data-[expanded]:data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)-150%))_translateY(var(--expanded-y))_scale(1)] data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)+150%))_translateY(var(--expanded-y))_scale(var(--scale))] data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--anchor-x)+var(--toast-swipe-movement-x,0px)+150%))_translateY(var(--expanded-y))_scale(1)]";
|
|
137
140
|
function getToastPlacement(item, isRtl = false) {
|
|
138
141
|
const side = item.positionerProps?.side ?? DEFAULT_TOAST_SIDE;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { NavigationMenu } from "@base-ui/react/navigation-menu";
|
|
4
|
+
//#region src/top-navbar.d.ts
|
|
5
|
+
type TopNavbarRootProps = React.ComponentProps<"header">;
|
|
6
|
+
declare function TopNavbarRoot({ className, children, ...props }: TopNavbarRootProps): React.JSX.Element;
|
|
7
|
+
declare function TopNavbarContainer({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function TopNavbarLeading({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function TopNavbarBrand({ className, render, ...props }: useRender.ComponentProps<"a">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
10
|
+
declare function TopNavbarNavigation({ className, ...props }: NavigationMenu.Root.Props): React.JSX.Element;
|
|
11
|
+
declare function TopNavbarList({ className, ...props }: NavigationMenu.List.Props): React.JSX.Element;
|
|
12
|
+
declare function TopNavbarItem(props: NavigationMenu.Item.Props): React.JSX.Element;
|
|
13
|
+
type TopNavbarTriggerProps = NavigationMenu.Trigger.Props & {
|
|
14
|
+
active?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare function TopNavbarTrigger({ active, className, children, ...props }: TopNavbarTriggerProps): React.JSX.Element;
|
|
17
|
+
type TopNavbarLinkProps = NavigationMenu.Link.Props & {
|
|
18
|
+
active?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare function TopNavbarLink({ active, className, ...props }: TopNavbarLinkProps): React.JSX.Element;
|
|
21
|
+
declare function TopNavbarContent({ className, ...props }: NavigationMenu.Content.Props): React.JSX.Element;
|
|
22
|
+
declare function TopNavbarMenuGrid({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
23
|
+
type TopNavbarMenuLinkProps = NavigationMenu.Link.Props & {
|
|
24
|
+
featured?: boolean;
|
|
25
|
+
showArrow?: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare function TopNavbarMenuLink({ featured, showArrow, className, children, ...props }: TopNavbarMenuLinkProps): React.JSX.Element;
|
|
28
|
+
declare function TopNavbarMenuIcon({ featured, className, ...props }: React.ComponentProps<"span"> & {
|
|
29
|
+
featured?: boolean;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
declare function TopNavbarMenuText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
32
|
+
declare function TopNavbarMenuTitle({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
33
|
+
declare function TopNavbarMenuDescription({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
34
|
+
type TopNavbarViewportProps = Omit<NavigationMenu.Popup.Props, "className"> & {
|
|
35
|
+
className?: string;
|
|
36
|
+
portalProps?: NavigationMenu.Portal.Props;
|
|
37
|
+
positionerProps?: Omit<NavigationMenu.Positioner.Props, "className"> & {
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
viewportProps?: Omit<NavigationMenu.Viewport.Props, "className"> & {
|
|
41
|
+
className?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
declare function TopNavbarViewport({ className, children, portalProps, positionerProps, viewportProps, ...props }: TopNavbarViewportProps): React.JSX.Element;
|
|
45
|
+
declare function TopNavbarActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
46
|
+
declare function TopNavbarActionGroup({ className, surface, ...props }: React.ComponentProps<"div"> & {
|
|
47
|
+
surface?: boolean;
|
|
48
|
+
}): React.JSX.Element;
|
|
49
|
+
declare function TopNavbarActionLink({ className, render, ...props }: useRender.ComponentProps<"a">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
50
|
+
type TopNavbarMenuItem = {
|
|
51
|
+
title: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
href: string;
|
|
54
|
+
icon?: React.ReactNode;
|
|
55
|
+
featured?: boolean;
|
|
56
|
+
render?: React.ReactElement;
|
|
57
|
+
};
|
|
58
|
+
type TopNavbarItemData = {
|
|
59
|
+
label: string;
|
|
60
|
+
href: string;
|
|
61
|
+
active?: boolean;
|
|
62
|
+
icon?: React.ReactNode;
|
|
63
|
+
menu?: readonly TopNavbarMenuItem[];
|
|
64
|
+
render?: React.ReactElement;
|
|
65
|
+
};
|
|
66
|
+
type TopNavbarProps = Omit<TopNavbarRootProps, "children"> & {
|
|
67
|
+
brand: React.ReactNode;
|
|
68
|
+
brandHref?: string;
|
|
69
|
+
brandLabel?: string;
|
|
70
|
+
brandRender?: React.ReactElement;
|
|
71
|
+
items: readonly TopNavbarItemData[];
|
|
72
|
+
actions?: React.ReactNode;
|
|
73
|
+
mobileActions?: React.ReactNode;
|
|
74
|
+
mobileMenuLabel?: string;
|
|
75
|
+
};
|
|
76
|
+
declare function TopNavbarComponent({ brand, brandHref, brandLabel, brandRender, items, actions, mobileActions, mobileMenuLabel, ...props }: TopNavbarProps): React.JSX.Element;
|
|
77
|
+
declare const TopNavbar: typeof TopNavbarComponent & {
|
|
78
|
+
Root: typeof TopNavbarRoot;
|
|
79
|
+
Container: typeof TopNavbarContainer;
|
|
80
|
+
Leading: typeof TopNavbarLeading;
|
|
81
|
+
Brand: typeof TopNavbarBrand;
|
|
82
|
+
Navigation: typeof TopNavbarNavigation;
|
|
83
|
+
List: typeof TopNavbarList;
|
|
84
|
+
Item: typeof TopNavbarItem;
|
|
85
|
+
Trigger: typeof TopNavbarTrigger;
|
|
86
|
+
Link: typeof TopNavbarLink;
|
|
87
|
+
Content: typeof TopNavbarContent;
|
|
88
|
+
MenuGrid: typeof TopNavbarMenuGrid;
|
|
89
|
+
MenuLink: typeof TopNavbarMenuLink;
|
|
90
|
+
MenuIcon: typeof TopNavbarMenuIcon;
|
|
91
|
+
MenuText: typeof TopNavbarMenuText;
|
|
92
|
+
MenuTitle: typeof TopNavbarMenuTitle;
|
|
93
|
+
MenuDescription: typeof TopNavbarMenuDescription;
|
|
94
|
+
Viewport: typeof TopNavbarViewport;
|
|
95
|
+
Actions: typeof TopNavbarActions;
|
|
96
|
+
ActionGroup: typeof TopNavbarActionGroup;
|
|
97
|
+
ActionLink: typeof TopNavbarActionLink;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { TopNavbar, TopNavbarActionGroup, TopNavbarActionLink, TopNavbarActions, TopNavbarBrand, TopNavbarContainer, TopNavbarContent, TopNavbarItem, type TopNavbarItemData, TopNavbarLeading, TopNavbarLink, TopNavbarList, TopNavbarMenuDescription, TopNavbarMenuGrid, TopNavbarMenuIcon, type TopNavbarMenuItem, TopNavbarMenuLink, TopNavbarMenuText, TopNavbarMenuTitle, TopNavbarNavigation, type TopNavbarProps, TopNavbarRoot, type TopNavbarRootProps, TopNavbarTrigger, TopNavbarViewport };
|