@godxjp/ui 18.3.0 → 18.5.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/README.md +18 -3
- package/dist/app/theme-axes.d.ts +11 -3
- package/dist/app/theme-axes.js +2 -1
- package/dist/components/charts/chart-frame.d.ts +17 -3
- package/dist/components/charts/chart-frame.js +7 -1
- package/dist/components/charts/chart-summary.d.ts +21 -0
- package/dist/components/charts/chart-summary.js +32 -5
- package/dist/components/charts/compact-bar-trend.d.ts +29 -0
- package/dist/components/charts/compact-bar-trend.js +74 -0
- package/dist/components/charts/index.d.ts +3 -0
- package/dist/components/charts/index.js +2 -0
- package/dist/components/data-display/badge.d.ts +8 -0
- package/dist/components/data-display/badge.js +7 -1
- package/dist/components/data-display/data-table.d.ts +16 -1
- package/dist/components/data-display/data-table.js +56 -0
- package/dist/components/data-display/index.d.ts +3 -1
- package/dist/components/data-display/index.js +10 -1
- package/dist/components/data-display/list-row.d.ts +22 -4
- package/dist/components/data-display/list-row.js +21 -3
- package/dist/components/data-display/service-launcher-card.d.ts +40 -0
- package/dist/components/data-display/service-launcher-card.js +97 -0
- package/dist/components/data-entry/command-palette.d.ts +37 -0
- package/dist/components/data-entry/command-palette.js +125 -0
- package/dist/components/data-entry/index.d.ts +2 -0
- package/dist/components/data-entry/index.js +2 -0
- package/dist/components/feedback/dialog.d.ts +2 -0
- package/dist/components/feedback/dialog.js +42 -33
- package/dist/components/feedback/index.d.ts +4 -1
- package/dist/components/feedback/index.js +6 -2
- package/dist/components/feedback/sheet.d.ts +26 -4
- package/dist/components/feedback/sheet.js +54 -7
- package/dist/components/feedback/two-factor-setup.d.ts +31 -0
- package/dist/components/feedback/two-factor-setup.js +97 -0
- package/dist/components/general/index.d.ts +1 -1
- package/dist/components/general/logo.d.ts +42 -8
- package/dist/components/general/logo.js +67 -14
- package/dist/components/layout/app-shell.js +22 -6
- package/dist/components/layout/auth-divider.d.ts +7 -0
- package/dist/components/layout/auth-divider.js +21 -0
- package/dist/components/layout/auth-footer.d.ts +5 -0
- package/dist/components/layout/auth-footer.js +24 -0
- package/dist/components/layout/auth-identity.d.ts +5 -0
- package/dist/components/layout/auth-identity.js +17 -0
- package/dist/components/layout/auth-shell.d.ts +8 -1
- package/dist/components/layout/auth-shell.js +25 -6
- package/dist/components/layout/auth-stack.d.ts +4 -0
- package/dist/components/layout/auth-stack.js +8 -0
- package/dist/components/layout/centered-shell.d.ts +5 -2
- package/dist/components/layout/centered-shell.js +2 -1
- package/dist/components/layout/index.d.ts +18 -3
- package/dist/components/layout/index.js +17 -2
- package/dist/components/layout/legal-document-shell.d.ts +34 -0
- package/dist/components/layout/legal-document-shell.js +186 -0
- package/dist/components/layout/master-detail.d.ts +24 -0
- package/dist/components/layout/master-detail.js +48 -0
- package/dist/components/layout/org-switcher.d.ts +9 -0
- package/dist/components/layout/org-switcher.js +218 -0
- package/dist/components/layout/page-container.d.ts +1 -1
- package/dist/components/layout/page-container.js +3 -2
- package/dist/components/layout/sidebar-link.d.ts +43 -0
- package/dist/components/layout/sidebar-link.js +13 -0
- package/dist/components/layout/sidebar.d.ts +42 -5
- package/dist/components/layout/sidebar.js +170 -85
- package/dist/components/navigation/app-setting-picker.js +17 -6
- package/dist/components/navigation/filter-bar.d.ts +12 -3
- package/dist/components/navigation/filter-bar.js +8 -2
- package/dist/components/navigation/index.d.ts +2 -2
- package/dist/components/navigation/index.js +3 -1
- package/dist/components/navigation/tabs-scroll.d.ts +70 -0
- package/dist/components/navigation/tabs-scroll.js +76 -0
- package/dist/components/navigation/tabs.js +35 -20
- package/dist/email/brand-mark.d.ts +92 -0
- package/dist/email/brand-mark.js +83 -0
- package/dist/email/color.d.ts +52 -0
- package/dist/email/color.js +37 -0
- package/dist/email/geometry.d.ts +112 -0
- package/dist/email/geometry.js +89 -0
- package/dist/email/index.d.ts +78 -0
- package/dist/email/index.js +76 -0
- package/dist/email/inline-style.d.ts +25 -0
- package/dist/email/inline-style.js +21 -0
- package/dist/email/tokens.generated.d.ts +147 -0
- package/dist/email/tokens.generated.js +142 -0
- package/dist/i18n/messages/en.json +21 -2
- package/dist/i18n/messages/ja.json +21 -2
- package/dist/i18n/messages/vi.json +21 -2
- package/dist/inertia/index.d.ts +50 -0
- package/dist/inertia/index.js +5 -0
- package/dist/props/components/app.prop.d.ts +11 -1
- package/dist/props/components/charts.prop.d.ts +40 -1
- package/dist/props/components/data-display.prop.d.ts +13 -1
- package/dist/props/components/feedback.prop.d.ts +10 -0
- package/dist/props/components/index.d.ts +2 -2
- package/dist/props/components/layout.prop.d.ts +374 -11
- package/dist/props/components/layout.prop.js +1 -0
- package/dist/props/components/navigation.prop.d.ts +19 -1
- package/dist/props/registry.d.ts +291 -7
- package/dist/props/registry.js +341 -7
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +1 -1
- package/dist/props/vocabulary/layout.prop.d.ts +18 -0
- package/dist/styles/base.css +9 -3
- package/dist/styles/card-layout.css +162 -8
- package/dist/styles/chart-layout.css +97 -0
- package/dist/styles/control.css +48 -2
- package/dist/styles/data-display-layout.css +52 -6
- package/dist/styles/dialog-layout.css +105 -4
- package/dist/styles/fonts.css +29 -20
- package/dist/styles/index.css +11 -3
- package/dist/styles/layout.css +368 -2
- package/dist/styles/logo-layout.css +62 -0
- package/dist/styles/navigation-layout.css +43 -0
- package/dist/styles/shell-layout.css +505 -62
- package/dist/theme/dxs.canonical.css +76 -0
- package/dist/tokens/axes.css +39 -0
- package/dist/tokens/base.css +5 -0
- package/dist/tokens/components/card.css +52 -5
- package/dist/tokens/components/chart.css +47 -0
- package/dist/tokens/components/control.css +16 -0
- package/dist/tokens/components/email.css +66 -0
- package/dist/tokens/components/feedback.css +17 -0
- package/dist/tokens/components/legal-document.css +67 -0
- package/dist/tokens/components/list-row.css +23 -2
- package/dist/tokens/components/logo.css +32 -0
- package/dist/tokens/components/navigation.css +13 -0
- package/dist/tokens/components/sheet.css +19 -0
- package/dist/tokens/components/shell.css +149 -1
- package/dist/tokens/components/sidebar.css +33 -0
- package/dist/tokens/foundation.css +5 -2
- package/dist/tokens/semantic/layout.css +44 -2
- package/package.json +17 -6
|
@@ -1,23 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import * as React from "react";
|
|
4
|
+
import { useTranslation } from "../../i18n/use-translation.js";
|
|
3
5
|
import { cn } from "../../lib/utils.js";
|
|
4
6
|
import { Text } from "../general/typography.js";
|
|
5
7
|
const ListRow = React.forwardRef(
|
|
6
|
-
({
|
|
8
|
+
({
|
|
9
|
+
as = "div",
|
|
10
|
+
leading,
|
|
11
|
+
title,
|
|
12
|
+
description,
|
|
13
|
+
trailing,
|
|
14
|
+
align = "center",
|
|
15
|
+
overflow = "truncate",
|
|
16
|
+
unread,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const { t } = useTranslation();
|
|
7
21
|
const Comp = as;
|
|
22
|
+
const truncate = overflow !== "wrap";
|
|
8
23
|
return /* @__PURE__ */ jsxs(
|
|
9
24
|
Comp,
|
|
10
25
|
{
|
|
11
26
|
ref,
|
|
12
27
|
"data-slot": "list-row",
|
|
13
28
|
"data-align": align === "start" ? "start" : void 0,
|
|
29
|
+
"data-overflow": overflow === "wrap" ? "wrap" : void 0,
|
|
30
|
+
"data-unread": unread === true ? "" : void 0,
|
|
14
31
|
className: cn("ui-list-row", className),
|
|
15
32
|
...props,
|
|
16
33
|
children: [
|
|
34
|
+
unread !== void 0 ? /* @__PURE__ */ jsx("span", { "data-slot": "list-row-indicator", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: unread ? t("dataDisplay.listRow.unread") : t("dataDisplay.listRow.read") }) }) : null,
|
|
17
35
|
leading != null ? /* @__PURE__ */ jsx("span", { "data-slot": "list-row-leading", children: leading }) : null,
|
|
18
36
|
/* @__PURE__ */ jsxs("span", { "data-slot": "list-row-body", children: [
|
|
19
|
-
/* @__PURE__ */ jsx(Text, { weight: "medium", truncate
|
|
20
|
-
description != null ? /* @__PURE__ */ jsx(Text, { size: "xs", tone: "muted", truncate
|
|
37
|
+
/* @__PURE__ */ jsx(Text, { weight: "medium", truncate, children: title }),
|
|
38
|
+
description != null ? /* @__PURE__ */ jsx(Text, { size: "xs", tone: "muted", truncate, children: description }) : null
|
|
21
39
|
] }),
|
|
22
40
|
trailing != null ? /* @__PURE__ */ jsx("span", { "data-slot": "list-row-trailing", children: trailing }) : null
|
|
23
41
|
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { LucideIcon } from "lucide-react";
|
|
3
|
+
import type { HeadingLevelProp, ToneProp } from "../../props/vocabulary/index.js";
|
|
4
|
+
export type ServiceLauncherStatusTone = Extract<ToneProp, "success" | "warning" | "destructive" | "info" | "neutral" | "muted">;
|
|
5
|
+
export interface ServiceLauncherCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
title: React.ReactNode;
|
|
8
|
+
titleLevel?: HeadingLevelProp;
|
|
9
|
+
statusLabel?: React.ReactNode;
|
|
10
|
+
statusTone?: ServiceLauncherStatusTone;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
metadata?: React.ReactNode;
|
|
13
|
+
action: React.ReactNode;
|
|
14
|
+
disabledReason?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Token-owned launcher surface for an organization-scoped downstream service.
|
|
18
|
+
*
|
|
19
|
+
* Consumers supply real status, metadata and actions; access is NEVER inferred — the component
|
|
20
|
+
* derives no entitlement, no launch URL and no disabled state of its own. `statusLabel`/
|
|
21
|
+
* `statusTone` are rendered verbatim, and the action's `disabled` state is the consumer's Button
|
|
22
|
+
* prop. The only thing derived from a prop is presentational: supplying `disabledReason` marks
|
|
23
|
+
* the tile `data-unavailable` so the token layer can drop the medallion's brand wash.
|
|
24
|
+
*
|
|
25
|
+
* Layout is NOT owned here: place tiles in `ResponsiveGrid columns={{ sm: 1, md: 2, lg: 3 }}` for
|
|
26
|
+
* the canonical 3 → 2 → 1 launcher grid (the grid queries its own container, never the viewport).
|
|
27
|
+
*/
|
|
28
|
+
export declare const ServiceLauncherCard: React.ForwardRefExoticComponent<ServiceLauncherCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export interface ServiceCatalogCtaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
30
|
+
icon?: LucideIcon;
|
|
31
|
+
title: React.ReactNode;
|
|
32
|
+
action: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/** Dashed companion tile for the real catalog/add action beside launcher cards. */
|
|
35
|
+
export declare const ServiceCatalogCta: React.ForwardRefExoticComponent<ServiceCatalogCtaProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export interface ServiceLauncherCardSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
label: string;
|
|
38
|
+
}
|
|
39
|
+
/** Shape-matched loading placeholder for a launcher card. */
|
|
40
|
+
export declare function ServiceLauncherCardSkeleton({ className, label, ...props }: ServiceLauncherCardSkeletonProps): React.JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Plus } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Badge } from "./badge.js";
|
|
7
|
+
import { Card } from "./card.js";
|
|
8
|
+
const ServiceLauncherCard = React.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
className,
|
|
11
|
+
icon: Icon,
|
|
12
|
+
title,
|
|
13
|
+
titleLevel = 2,
|
|
14
|
+
statusLabel,
|
|
15
|
+
statusTone = "neutral",
|
|
16
|
+
description,
|
|
17
|
+
metadata,
|
|
18
|
+
action,
|
|
19
|
+
disabledReason,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const Heading = `h${titleLevel}`;
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
Card,
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
density: "tight",
|
|
28
|
+
className: cn("ui-service-launcher-card", className),
|
|
29
|
+
"data-service-launcher": "",
|
|
30
|
+
"data-unavailable": disabledReason != null ? "" : void 0,
|
|
31
|
+
...props,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "service-launcher-heading", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "service-launcher-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Icon, {}) }),
|
|
35
|
+
/* @__PURE__ */ jsx(Heading, { "data-slot": "service-launcher-title", children: title }),
|
|
36
|
+
statusLabel != null ? /* @__PURE__ */ jsx(Badge, { tone: statusTone, "data-slot": "service-launcher-status", children: statusLabel }) : null
|
|
37
|
+
] }),
|
|
38
|
+
description != null ? /* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-description", children: description }) : null,
|
|
39
|
+
metadata != null ? /* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-metadata", children: metadata }) : null,
|
|
40
|
+
disabledReason != null ? /* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-disabled-reason", children: disabledReason }) : null,
|
|
41
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-action", children: action })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
ServiceLauncherCard.displayName = "ServiceLauncherCard";
|
|
48
|
+
const ServiceCatalogCta = React.forwardRef(
|
|
49
|
+
({ className, icon: Icon = Plus, title, action, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
50
|
+
Card,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
variant: "outline",
|
|
54
|
+
className: cn("ui-service-catalog-cta", className),
|
|
55
|
+
"data-service-catalog-cta": "",
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Icon, { "data-slot": "service-catalog-icon", "aria-hidden": "true" }),
|
|
59
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "service-catalog-title", children: title }),
|
|
60
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "service-catalog-action", children: action })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
ServiceCatalogCta.displayName = "ServiceCatalogCta";
|
|
66
|
+
function ServiceLauncherCardSkeleton({
|
|
67
|
+
className,
|
|
68
|
+
label,
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
Card,
|
|
73
|
+
{
|
|
74
|
+
density: "tight",
|
|
75
|
+
className: cn("ui-service-launcher-card", className),
|
|
76
|
+
"data-service-launcher": "",
|
|
77
|
+
"aria-busy": "true",
|
|
78
|
+
...props,
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: label }),
|
|
81
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "service-launcher-skeleton-heading", children: [
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-icon" }),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-title" }),
|
|
84
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-status" })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-description" }),
|
|
87
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-metadata" }),
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-action" })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
ServiceCatalogCta,
|
|
95
|
+
ServiceLauncherCard,
|
|
96
|
+
ServiceLauncherCardSkeleton
|
|
97
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type CommandPaletteItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
searchValue?: string;
|
|
6
|
+
meta?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type CommandPaletteGroup = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
items: CommandPaletteItem[];
|
|
13
|
+
};
|
|
14
|
+
export type CommandPaletteLabels = {
|
|
15
|
+
open: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
placeholder: string;
|
|
19
|
+
empty: React.ReactNode;
|
|
20
|
+
loading?: React.ReactNode;
|
|
21
|
+
move?: React.ReactNode;
|
|
22
|
+
select?: React.ReactNode;
|
|
23
|
+
close?: React.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export type CommandPaletteProps = {
|
|
26
|
+
groups: CommandPaletteGroup[];
|
|
27
|
+
labels: CommandPaletteLabels;
|
|
28
|
+
onSelect: (item: CommandPaletteItem) => void;
|
|
29
|
+
open?: boolean;
|
|
30
|
+
defaultOpen?: boolean;
|
|
31
|
+
onOpenChange?: (open: boolean) => void;
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
error?: React.ReactNode;
|
|
34
|
+
trigger?: React.ReactNode;
|
|
35
|
+
shortcut?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare function CommandPalette({ groups, labels, onSelect, open: controlledOpen, defaultOpen, onOpenChange, loading, error, trigger, shortcut, }: CommandPaletteProps): React.JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Search } from "lucide-react";
|
|
5
|
+
import { Button } from "../general/button.js";
|
|
6
|
+
import { Dialog, DialogContent } from "../feedback/dialog.js";
|
|
7
|
+
import {
|
|
8
|
+
Command,
|
|
9
|
+
CommandEmpty,
|
|
10
|
+
CommandGroup,
|
|
11
|
+
CommandInput,
|
|
12
|
+
CommandItem,
|
|
13
|
+
CommandList
|
|
14
|
+
} from "./command.js";
|
|
15
|
+
function CommandPalette({
|
|
16
|
+
groups,
|
|
17
|
+
labels,
|
|
18
|
+
onSelect,
|
|
19
|
+
open: controlledOpen,
|
|
20
|
+
defaultOpen = false,
|
|
21
|
+
onOpenChange,
|
|
22
|
+
loading = false,
|
|
23
|
+
error,
|
|
24
|
+
trigger,
|
|
25
|
+
shortcut = true
|
|
26
|
+
}) {
|
|
27
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
28
|
+
const shortcutRestoreFocusRef = React.useRef(null);
|
|
29
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
30
|
+
const setOpen = React.useCallback(
|
|
31
|
+
(next) => {
|
|
32
|
+
if (controlledOpen === void 0) {
|
|
33
|
+
setUncontrolledOpen(next);
|
|
34
|
+
}
|
|
35
|
+
onOpenChange?.(next);
|
|
36
|
+
},
|
|
37
|
+
[controlledOpen, onOpenChange]
|
|
38
|
+
);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (!shortcut) return;
|
|
41
|
+
const handleKeyDown = (event) => {
|
|
42
|
+
if (!event.isComposing && event.key.toLowerCase() === "k" && (event.metaKey || event.ctrlKey)) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
if (!open && document.activeElement instanceof HTMLElement) {
|
|
45
|
+
shortcutRestoreFocusRef.current = document.activeElement;
|
|
46
|
+
}
|
|
47
|
+
setOpen(!open);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
51
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
52
|
+
}, [open, setOpen, shortcut]);
|
|
53
|
+
const triggerNode = trigger ?? /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "ui-command-palette-trigger", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Search, { "aria-hidden": "true" }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { children: labels.open }),
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "kbd", "aria-hidden": "true", children: "\u2318K" })
|
|
57
|
+
] });
|
|
58
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: setOpen, children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { asChild: true, children: triggerNode }),
|
|
60
|
+
/* @__PURE__ */ jsxs(
|
|
61
|
+
DialogContent,
|
|
62
|
+
{
|
|
63
|
+
className: "ui-command-palette",
|
|
64
|
+
showCloseButton: false,
|
|
65
|
+
"aria-modal": "true",
|
|
66
|
+
"aria-describedby": "ui-command-palette-description",
|
|
67
|
+
onCloseAutoFocus: (event) => {
|
|
68
|
+
const restoreTarget = shortcutRestoreFocusRef.current;
|
|
69
|
+
if (restoreTarget?.isConnected) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
if (restoreTarget.isConnected) {
|
|
73
|
+
restoreTarget.focus({ preventScroll: true });
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
shortcutRestoreFocusRef.current = null;
|
|
78
|
+
},
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
81
|
+
/* @__PURE__ */ jsx(Dialog.Description, { id: "ui-command-palette-description", className: "sr-only", children: labels.description }),
|
|
82
|
+
/* @__PURE__ */ jsxs(Command, { label: labels.title, children: [
|
|
83
|
+
/* @__PURE__ */ jsx(CommandInput, { autoFocus: true, placeholder: labels.placeholder, "aria-label": labels.placeholder }),
|
|
84
|
+
/* @__PURE__ */ jsx(CommandList, { "aria-busy": loading, children: loading ? /* @__PURE__ */ jsx("div", { className: "ui-command-palette-state", role: "status", children: labels.loading }) : error ? /* @__PURE__ */ jsx("div", { className: "ui-command-palette-state", role: "alert", children: error }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: labels.empty }),
|
|
86
|
+
groups.map((group) => /* @__PURE__ */ jsx(CommandGroup, { heading: group.label, children: group.items.map((item) => /* @__PURE__ */ jsxs(
|
|
87
|
+
CommandItem,
|
|
88
|
+
{
|
|
89
|
+
value: item.searchValue ?? `${item.id} ${String(item.label)}`,
|
|
90
|
+
disabled: item.disabled,
|
|
91
|
+
onSelect: () => {
|
|
92
|
+
setOpen(false);
|
|
93
|
+
onSelect(item);
|
|
94
|
+
},
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "ui-command-palette-label", children: item.label }),
|
|
97
|
+
item.meta != null ? /* @__PURE__ */ jsx("span", { className: "ui-command-palette-meta", children: item.meta }) : null
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
item.id
|
|
101
|
+
)) }, group.id))
|
|
102
|
+
] }) })
|
|
103
|
+
] }),
|
|
104
|
+
labels.move != null || labels.select != null || labels.close != null ? /* @__PURE__ */ jsxs("div", { className: "ui-command-palette-hints", "aria-hidden": "true", children: [
|
|
105
|
+
labels.move != null ? /* @__PURE__ */ jsxs("span", { children: [
|
|
106
|
+
"\u2191\u2193 ",
|
|
107
|
+
labels.move
|
|
108
|
+
] }) : null,
|
|
109
|
+
labels.select != null ? /* @__PURE__ */ jsxs("span", { children: [
|
|
110
|
+
"\u21B5 ",
|
|
111
|
+
labels.select
|
|
112
|
+
] }) : null,
|
|
113
|
+
labels.close != null ? /* @__PURE__ */ jsxs("span", { children: [
|
|
114
|
+
"esc ",
|
|
115
|
+
labels.close
|
|
116
|
+
] }) : null
|
|
117
|
+
] }) : null
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
CommandPalette
|
|
125
|
+
};
|
|
@@ -48,6 +48,8 @@ export type { TreeSelectProps } from "./tree-select.js";
|
|
|
48
48
|
export { Transfer } from "./transfer.js";
|
|
49
49
|
export type { TransferProps, TransferItemProp } from "./transfer.js";
|
|
50
50
|
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "./command.js";
|
|
51
|
+
export { CommandPalette } from "./command-palette.js";
|
|
52
|
+
export type { CommandPaletteGroup, CommandPaletteItem, CommandPaletteLabels, CommandPaletteProps, } from "./command-palette.js";
|
|
51
53
|
export { PasswordInput } from "./password-input.js";
|
|
52
54
|
export type { PasswordInputProps } from "./password-input.js";
|
|
53
55
|
export { PasswordStrength, usePasswordStrength } from "./password-strength.js";
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
CommandItem,
|
|
45
45
|
CommandList
|
|
46
46
|
} from "./command.js";
|
|
47
|
+
import { CommandPalette } from "./command-palette.js";
|
|
47
48
|
import { PasswordInput } from "./password-input.js";
|
|
48
49
|
import { PasswordStrength, usePasswordStrength } from "./password-strength.js";
|
|
49
50
|
import { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from "./input-otp.js";
|
|
@@ -61,6 +62,7 @@ export {
|
|
|
61
62
|
CommandInput,
|
|
62
63
|
CommandItem,
|
|
63
64
|
CommandList,
|
|
65
|
+
CommandPalette,
|
|
64
66
|
DatePicker,
|
|
65
67
|
DateRangePicker,
|
|
66
68
|
Field,
|
|
@@ -13,6 +13,7 @@ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitiv
|
|
|
13
13
|
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
14
14
|
showClose?: boolean;
|
|
15
15
|
showCloseButton?: boolean;
|
|
16
|
+
overlayClassName?: string;
|
|
16
17
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
18
|
interface DialogHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
18
19
|
title?: React.ReactNode;
|
|
@@ -73,6 +74,7 @@ export declare const Dialog: typeof DialogRoot & {
|
|
|
73
74
|
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
74
75
|
showClose?: boolean;
|
|
75
76
|
showCloseButton?: boolean;
|
|
77
|
+
overlayClassName?: string;
|
|
76
78
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
77
79
|
Header: {
|
|
78
80
|
({ className, title, subtitle, extra, tone, children, ...props }: DialogHeaderProps): React.JSX.Element;
|
|
@@ -36,39 +36,48 @@ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
36
36
|
}
|
|
37
37
|
));
|
|
38
38
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
39
|
-
const DialogContent = React.forwardRef(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
39
|
+
const DialogContent = React.forwardRef(
|
|
40
|
+
({
|
|
41
|
+
className,
|
|
42
|
+
children,
|
|
43
|
+
showClose,
|
|
44
|
+
showCloseButton: showCloseButtonProp,
|
|
45
|
+
overlayClassName,
|
|
46
|
+
...props
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const { t } = useTranslation();
|
|
49
|
+
const showCloseButton = showCloseButtonProp ?? showClose ?? true;
|
|
50
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
|
|
52
|
+
/* @__PURE__ */ jsxs(
|
|
53
|
+
DialogPrimitive.Content,
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
"data-slot": "dialog-content",
|
|
57
|
+
className: cn(
|
|
58
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 duration-200 outline-none",
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
...props,
|
|
62
|
+
children: [
|
|
63
|
+
children,
|
|
64
|
+
showCloseButton ? /* @__PURE__ */ jsxs(
|
|
65
|
+
DialogPrimitive.Close,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "dialog-close",
|
|
68
|
+
className: "ring-offset-background focus:ring-ring transition-opacity focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" }),
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t("feedback.alert.dismiss") })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
) : null
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
);
|
|
72
81
|
DialogContent.displayName = "DialogContent";
|
|
73
82
|
const DialogHeader = ({
|
|
74
83
|
className,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogAction, DialogCancel, AlertDialogTrigger, AlertDialogPortal, AlertDialogOverlay, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, AlertDialog, } from "./dialog.js";
|
|
2
2
|
export type { AlertDialogProp, AlertDialogProps } from "./dialog.js";
|
|
3
|
-
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, } from "./sheet.js";
|
|
3
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, useSheetResponsiveMode, } from "./sheet.js";
|
|
4
|
+
export type { SheetContentProps, SheetPresentation, SheetResponsiveProp } from "./sheet.js";
|
|
5
|
+
export { TwoFactorSetup } from "./two-factor-setup.js";
|
|
6
|
+
export type { TwoFactorSetupLabels, TwoFactorSetupProps } from "./two-factor-setup.js";
|
|
4
7
|
export { Toaster } from "./sonner.js";
|
|
5
8
|
export { toast } from "./use-toast.js";
|
|
6
9
|
export { Skeleton, SkeletonRows, SkeletonTable, SkeletonDetail, SkeletonStat } from "./skeleton.js";
|
|
@@ -35,8 +35,10 @@ import {
|
|
|
35
35
|
SheetOverlay,
|
|
36
36
|
SheetPortal,
|
|
37
37
|
SheetTitle,
|
|
38
|
-
SheetTrigger
|
|
38
|
+
SheetTrigger,
|
|
39
|
+
useSheetResponsiveMode
|
|
39
40
|
} from "./sheet.js";
|
|
41
|
+
import { TwoFactorSetup } from "./two-factor-setup.js";
|
|
40
42
|
import { Toaster } from "./sonner.js";
|
|
41
43
|
import { toast } from "./use-toast.js";
|
|
42
44
|
import { Skeleton, SkeletonRows, SkeletonTable, SkeletonDetail, SkeletonStat } from "./skeleton.js";
|
|
@@ -101,5 +103,7 @@ export {
|
|
|
101
103
|
TooltipContent,
|
|
102
104
|
TooltipProvider,
|
|
103
105
|
TooltipTrigger,
|
|
104
|
-
|
|
106
|
+
TwoFactorSetup,
|
|
107
|
+
toast,
|
|
108
|
+
useSheetResponsiveMode
|
|
105
109
|
};
|
|
@@ -1,23 +1,46 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import type { SheetResponsiveProp } from "../../props/components/feedback.prop.js";
|
|
4
5
|
import type { ToneProp, WidthProp } from "../../props/vocabulary/index.js";
|
|
6
|
+
export type { SheetResponsiveProp } from "../../props/components/feedback.prop.js";
|
|
7
|
+
/** Resolved presentation of a responsive sheet: the named side panel, or the mobile bottom sheet. */
|
|
8
|
+
export type SheetPresentation = "side" | "bottom";
|
|
9
|
+
/**
|
|
10
|
+
* The canonical responsive-overlay decision, shared by `SheetContent` and by any composite that
|
|
11
|
+
* swaps a desktop surface for a mobile sheet (see `OrgSwitcher`). Returns `"bottom"` when the
|
|
12
|
+
* viewport is at or below `--sheet-responsive-breakpoint-width`.
|
|
13
|
+
*
|
|
14
|
+
* Public so a consumer NEVER hand-rolls `useMediaQuery("(max-width: 390px)")` in app code — the
|
|
15
|
+
* breakpoint stays one themeable knob for the whole system.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useSheetResponsiveMode(responsive?: SheetResponsiveProp): SheetPresentation;
|
|
5
18
|
export declare function Sheet(props: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
6
19
|
export declare function SheetTrigger(props: React.ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
|
|
7
20
|
export declare function SheetClose(props: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
8
21
|
export declare function SheetPortal(props: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
|
|
9
22
|
export declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
23
|
declare const sheetVariants: (props?: ({
|
|
11
|
-
side?: "left" | "right" | "
|
|
24
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
12
25
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
-
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
26
|
+
export interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
14
27
|
showCloseButton?: boolean;
|
|
28
|
+
/** Optional semantic class for the owned backdrop (for a shell-specific overlay token). */
|
|
29
|
+
overlayClassName?: string;
|
|
15
30
|
/**
|
|
16
31
|
* Desired panel size for side left/right (Ant Drawer `width`). Caps at the viewport — a small
|
|
17
32
|
* screen still gets a full-width panel (`min(width, 100%)`), it is NOT a hard fixed width. Omit
|
|
18
|
-
* to keep the default
|
|
33
|
+
* to keep the canonical drawer default from `--sheet-width-default`.
|
|
19
34
|
*/
|
|
20
35
|
width?: WidthProp;
|
|
36
|
+
/**
|
|
37
|
+
* Responsive drawer / detail-panel contract. `"side"` (default) keeps today's behaviour: the
|
|
38
|
+
* physical `side` the consumer named, at every viewport. `"auto"` renders the desktop side panel
|
|
39
|
+
* above `--sheet-responsive-breakpoint-width` and the mobile bottom sheet at/below it (capped by
|
|
40
|
+
* `--sheet-bottom-max-height`), so ONE `<Sheet>` covers both without a page-local media query.
|
|
41
|
+
* `"bottom"` pins the bottom-sheet presentation.
|
|
42
|
+
*/
|
|
43
|
+
responsive?: SheetResponsiveProp;
|
|
21
44
|
}
|
|
22
45
|
export declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
46
|
export interface SheetHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
@@ -35,4 +58,3 @@ export declare const SheetBody: ({ className, ...props }: React.HTMLAttributes<H
|
|
|
35
58
|
export declare const SheetFooter: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
|
|
36
59
|
export declare const SheetTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
37
60
|
export declare const SheetDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
38
|
-
export {};
|