beez-ui 2.7.1 → 3.0.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/CHANGELOG.md +72 -0
- package/README.md +43 -13
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/account-menu.d.ts +4 -3
- package/dist/components/account-menu.js +63 -54
- package/dist/components/alert.d.ts +15 -15
- package/dist/components/alert.js +289 -270
- package/dist/components/animated-theme-toggler.js +1 -1
- package/dist/components/avatar.d.ts +56 -31
- package/dist/components/avatar.js +394 -277
- package/dist/components/badge.d.ts +8 -28
- package/dist/components/badge.js +55 -108
- package/dist/components/calendar.d.ts +36 -26
- package/dist/components/calendar.js +132 -1227
- package/dist/components/card.d.ts +36 -25
- package/dist/components/card.js +895 -72
- package/dist/components/carousel.d.ts +63 -47
- package/dist/components/carousel.js +496 -777
- package/dist/components/data-table.d.ts +5 -4
- package/dist/components/data-table.js +7 -6
- package/dist/components/dialog-surface.d.ts +23 -1
- package/dist/components/dialog-surface.js +99 -3
- package/dist/components/dialog.d.ts +80 -45
- package/dist/components/dialog.js +258 -503
- package/dist/components/dropdown-menu.d.ts +56 -73
- package/dist/components/dropdown-menu.js +79 -714
- package/dist/components/field.d.ts +3 -1
- package/dist/components/field.js +49 -39
- package/dist/components/filter-presets-bar.js +2 -2
- package/dist/components/filter-query-bar.js +1 -1
- package/dist/components/hover-card.d.ts +42 -41
- package/dist/components/hover-card.js +57 -483
- package/dist/components/pagination.d.ts +53 -31
- package/dist/components/pagination.js +176 -412
- package/dist/components/popover.d.ts +11 -23
- package/dist/components/popover.js +19 -304
- package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
- package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +267 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +557 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +36 -0
- package/dist/components/primitives/select.js +407 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/radio-group.d.ts +30 -17
- package/dist/components/radio-group.js +266 -315
- package/dist/components/rich-link-editor.js +1 -1
- package/dist/components/select.d.ts +51 -42
- package/dist/components/select.js +163 -495
- package/dist/components/skeleton.d.ts +16 -15
- package/dist/components/skeleton.js +99 -205
- package/dist/components/split-button.js +1 -1
- package/dist/components/switch.d.ts +3 -6
- package/dist/components/switch.js +163 -170
- package/dist/components/tabs.d.ts +3 -11
- package/dist/components/tabs.js +61 -75
- package/dist/components/themed-toaster.d.ts +1 -1
- package/dist/components/themed-toaster.js +1 -1
- package/dist/components/toaster.d.ts +1 -1
- package/dist/components/toaster.js +1 -1
- package/dist/components/tooltip.d.ts +36 -31
- package/dist/components/tooltip.js +44 -284
- package/dist/constants/alert.d.ts +5 -1
- package/dist/constants/alert.js +5 -1
- package/dist/constants/avatar.d.ts +24 -1
- package/dist/constants/avatar.js +19 -0
- package/dist/constants/calendar.d.ts +12 -0
- package/dist/constants/calendar.js +12 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +31 -13
- package/dist/constants/carousel.js +32 -11
- package/dist/constants/dialog.d.ts +6 -1
- package/dist/constants/dialog.js +5 -1
- package/dist/constants/dropdown-menu.d.ts +2 -2
- package/dist/constants/dropdown-menu.js +2 -2
- package/dist/constants/pagination.d.ts +13 -2
- package/dist/constants/pagination.js +13 -2
- package/dist/constants/select.d.ts +4 -2
- package/dist/constants/select.js +4 -2
- package/dist/constants/switch.d.ts +5 -16
- package/dist/constants/switch.js +6 -14
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/motion/glide-indicator.d.ts +1 -1
- package/dist/motion/glide-indicator.js +1 -1
- package/dist/motion/presence.d.ts +0 -1
- package/dist/motion/presence.js +0 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ColumnDef, OnChangeFn, SortingState, VisibilityState } from "@tanstack/react-table";
|
|
3
3
|
import { type AppliedFilter, type FilterQualifierConfig } from "./filter-query-grammar.js";
|
|
4
|
+
import { type DropdownItem } from "./primitives/dropdown-menu-items.js";
|
|
4
5
|
export type { DataTableColumnFilterValue } from "../types/data-table.js";
|
|
5
6
|
/**
|
|
6
7
|
* Controles imperativos de la barra unificada que la tabla expone vía
|
|
@@ -93,10 +94,10 @@ export interface DataTableProps<TData, TValue> {
|
|
|
93
94
|
columnVisibilityButtonLabel?: string;
|
|
94
95
|
columnVisibilityMenuLabel?: string;
|
|
95
96
|
/**
|
|
96
|
-
* Ítems extra al tope del menú de columnas (p. ej. preferencias de vista)
|
|
97
|
-
* se separan de la sección de columnas con un separador.
|
|
97
|
+
* Ítems extra al tope del menú de columnas (p. ej. preferencias de vista), con la
|
|
98
|
+
* forma de los `items` de `DropdownMenu`; se separan de la sección de columnas con un separador.
|
|
98
99
|
*/
|
|
99
|
-
|
|
100
|
+
columnVisibilityMenuExtraItems?: DropdownItem[];
|
|
100
101
|
sortingBadgeLabelOverrides?: Record<string, string>;
|
|
101
102
|
/**
|
|
102
103
|
* Ids de columnas de orden "internas" (p. ej. la posición de grupo) que el
|
|
@@ -114,4 +115,4 @@ export interface DataTableColumnMeta {
|
|
|
114
115
|
isClickable?: boolean;
|
|
115
116
|
onHeaderClick?: (event: React.MouseEvent<HTMLTableCellElement>) => void;
|
|
116
117
|
}
|
|
117
|
-
export declare function DataTable<TData, TValue>({ columns, data, emptyMessage, toolbarActions, onVisibleRowsChange, onCellClick, getRowClassName, sorting: controlledSorting, onSortingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, filterColumnId, filterLabel, filterPlaceholder, filterExtraContent, filterValue: controlledFilterValue, onFilterValueChange, queryFilterConfig, queryFilterPlaceholder, queryFilterLabel, onAppliedFiltersChange, queryFilterControlsRef, queryFilterTrailingAction, rowGroups, showExcludeFilterToggle, excludeFilterValues: controlledExcludeFilterValues, onExcludeFilterValuesChange, excludeFilterPlaceholder, excludeFilterLabel, excludeFilterToggleLabel, excludeFilterRowsCountByValue, excludeFilterUniqueRowsCount, showColumnVisibilityToggle, columnVisibilityButtonLabel, columnVisibilityMenuLabel,
|
|
118
|
+
export declare function DataTable<TData, TValue>({ columns, data, emptyMessage, toolbarActions, onVisibleRowsChange, onCellClick, getRowClassName, sorting: controlledSorting, onSortingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, filterColumnId, filterLabel, filterPlaceholder, filterExtraContent, filterValue: controlledFilterValue, onFilterValueChange, queryFilterConfig, queryFilterPlaceholder, queryFilterLabel, onAppliedFiltersChange, queryFilterControlsRef, queryFilterTrailingAction, rowGroups, showExcludeFilterToggle, excludeFilterValues: controlledExcludeFilterValues, onExcludeFilterValuesChange, excludeFilterPlaceholder, excludeFilterLabel, excludeFilterToggleLabel, excludeFilterRowsCountByValue, excludeFilterUniqueRowsCount, showColumnVisibilityToggle, columnVisibilityButtonLabel, columnVisibilityMenuLabel, columnVisibilityMenuExtraItems, sortingBadgeLabelOverrides, sortingBadgeIgnoredColumnIds, selectAllColumnsLabel, deselectAllColumnsLabel, hideableColumnsDefaultVisibility, }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
@@ -9,7 +9,8 @@ import { ControlButton } from "./control-button.js";
|
|
|
9
9
|
import { Badge } from "./badge.js";
|
|
10
10
|
import { FilterQueryBar } from "./filter-query-bar.js";
|
|
11
11
|
import { parseFilterQuery, serializeFilterQuery } from "./filter-query-grammar.js";
|
|
12
|
-
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
12
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./primitives/dropdown-menu.js";
|
|
13
|
+
import { DropdownMenuItems } from "./primitives/dropdown-menu-items.js";
|
|
13
14
|
import { Input } from "./input.js";
|
|
14
15
|
import { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./table.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -102,7 +103,7 @@ function areAdvancedFilterMapsEqual(leftMap, rightMap) {
|
|
|
102
103
|
return rightValue != null && areColumnFilterValuesEqual(leftMap[key], rightValue);
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
|
-
export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisibleRowsChange, onCellClick, getRowClassName, sorting: controlledSorting, onSortingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, filterColumnId, filterLabel = "Filtrar", filterPlaceholder = "Filtrar...", filterExtraContent, filterValue: controlledFilterValue, onFilterValueChange, queryFilterConfig, queryFilterPlaceholder, queryFilterLabel, onAppliedFiltersChange, queryFilterControlsRef, queryFilterTrailingAction, rowGroups, showExcludeFilterToggle = false, excludeFilterValues: controlledExcludeFilterValues, onExcludeFilterValuesChange, excludeFilterPlaceholder = "Excluir por descripción", excludeFilterLabel = "Filtro de exclusión", excludeFilterToggleLabel = "Mostrar filtros de exclusión", excludeFilterRowsCountByValue, excludeFilterUniqueRowsCount, showColumnVisibilityToggle = false, columnVisibilityButtonLabel = "Columnas", columnVisibilityMenuLabel = "Mostrar columnas",
|
|
106
|
+
export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisibleRowsChange, onCellClick, getRowClassName, sorting: controlledSorting, onSortingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, filterColumnId, filterLabel = "Filtrar", filterPlaceholder = "Filtrar...", filterExtraContent, filterValue: controlledFilterValue, onFilterValueChange, queryFilterConfig, queryFilterPlaceholder, queryFilterLabel, onAppliedFiltersChange, queryFilterControlsRef, queryFilterTrailingAction, rowGroups, showExcludeFilterToggle = false, excludeFilterValues: controlledExcludeFilterValues, onExcludeFilterValuesChange, excludeFilterPlaceholder = "Excluir por descripción", excludeFilterLabel = "Filtro de exclusión", excludeFilterToggleLabel = "Mostrar filtros de exclusión", excludeFilterRowsCountByValue, excludeFilterUniqueRowsCount, showColumnVisibilityToggle = false, columnVisibilityButtonLabel = "Columnas", columnVisibilityMenuLabel = "Mostrar columnas", columnVisibilityMenuExtraItems, sortingBadgeLabelOverrides, sortingBadgeIgnoredColumnIds, selectAllColumnsLabel = "Mostrar todas", deselectAllColumnsLabel = "Ocultar todas", hideableColumnsDefaultVisibility }) {
|
|
106
107
|
const [uncontrolledSorting, setUncontrolledSorting] = React.useState([]);
|
|
107
108
|
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
108
109
|
const [uncontrolledFilterValue, setUncontrolledFilterValue] = React.useState("");
|
|
@@ -449,7 +450,7 @@ export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisib
|
|
|
449
450
|
const sortingBadgeNode = shouldShowSortingBadge ? /* @__PURE__ */ _jsxs(Badge, {
|
|
450
451
|
"aria-live": "polite",
|
|
451
452
|
className: "inline-flex w-fit items-center gap-1.5",
|
|
452
|
-
|
|
453
|
+
tone: "neutral",
|
|
453
454
|
children: [
|
|
454
455
|
/* @__PURE__ */ _jsx("span", { children: `Ordenado por: ${activeSortingColumnLabel} ${activeSortingDirectionSymbol}` }),
|
|
455
456
|
/* @__PURE__ */ _jsx("span", {
|
|
@@ -744,7 +745,7 @@ export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisib
|
|
|
744
745
|
children: [excludeFilterUniqueRowsCount != null ? /* @__PURE__ */ _jsxs(Badge, {
|
|
745
746
|
"aria-label": `Total de filas excluidas únicas: ${excludeFilterUniqueRowsCount}`,
|
|
746
747
|
className: "inline-flex h-6 items-center gap-1.5 px-2.5",
|
|
747
|
-
|
|
748
|
+
tone: "danger",
|
|
748
749
|
children: [
|
|
749
750
|
/* @__PURE__ */ _jsx("span", { children: `${EXCLUDED_ROWS_SUMMARY_LABEL}:` }),
|
|
750
751
|
/* @__PURE__ */ _jsx("span", {
|
|
@@ -766,7 +767,7 @@ export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisib
|
|
|
766
767
|
const excludedRowsCount = excludeFilterRowsCountByValue?.[excludeFilterValue];
|
|
767
768
|
return /* @__PURE__ */ _jsxs(Badge, {
|
|
768
769
|
className: "inline-flex h-6 items-center gap-1.5 px-2.5",
|
|
769
|
-
|
|
770
|
+
tone: "danger",
|
|
770
771
|
children: [
|
|
771
772
|
/* @__PURE__ */ _jsx("span", { children: `− ${excludeFilterValue}` }),
|
|
772
773
|
excludedRowsCount != null ? /* @__PURE__ */ _jsx("span", {
|
|
@@ -821,7 +822,7 @@ export function DataTable({ columns, data, emptyMessage, toolbarActions, onVisib
|
|
|
821
822
|
}), /* @__PURE__ */ _jsxs(DropdownMenuContent, {
|
|
822
823
|
align: "end",
|
|
823
824
|
children: [
|
|
824
|
-
|
|
825
|
+
columnVisibilityMenuExtraItems?.length ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx(DropdownMenuItems, { items: columnVisibilityMenuExtraItems }), /* @__PURE__ */ _jsx(DropdownMenuSeparator, {})] }) : null,
|
|
825
826
|
/* @__PURE__ */ _jsx(DropdownMenuLabel, { children: columnVisibilityMenuLabel }),
|
|
826
827
|
/* @__PURE__ */ _jsx(DropdownMenuItem, {
|
|
827
828
|
disabled: areHideableColumnsAtDefaultVisibility,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
2
|
/** Arc's overlay: a near-black scrim at 46% with a 7px backdrop blur where the engine supports it. */
|
|
3
3
|
export declare const dialogOverlayClassName = "fixed inset-0 isolate z-50 bg-[oklch(10%_0_0/0.46)] supports-backdrop-filter:backdrop-blur-[7px]";
|
|
4
4
|
/**
|
|
@@ -17,6 +17,28 @@ export declare const dialogDescriptionClassName = "text-sm leading-(--leading-bo
|
|
|
17
17
|
* from `ControlButton`.
|
|
18
18
|
*/
|
|
19
19
|
export declare const dialogCloseButtonClassName = "size-(--space-8) rounded-(--radius-control) border-border bg-surface-muted/50 text-text-secondary hover-fine:bg-surface-muted hover-fine:text-foreground [&_svg:not([class*='size-'])]:size-4";
|
|
20
|
+
/** Where the dialog close button sits: inside the panel or pinned to the viewport corner. */
|
|
21
|
+
export type DialogCloseButtonPlacement = "content" | "viewport";
|
|
22
|
+
/** Which Radix family owns the close button: a regular dialog closes, an alert dialog cancels. */
|
|
23
|
+
export type DialogSurfaceKind = "dialog" | "alert";
|
|
24
|
+
/**
|
|
25
|
+
* Arc's bordered close button for both dialog families. Pinned to the viewport corner it stays hidden while the panel
|
|
26
|
+
* enters, because the entrance transform would otherwise carry it along with the panel, fades in once the panel settles and hides
|
|
27
|
+
* at once when the dialog starts closing; while hidden it is also `visibility: hidden`, so the initial focus and the
|
|
28
|
+
* keyboard never land on a control that cannot be seen. Inside the panel it pops in after the panel.
|
|
29
|
+
* @param props - The Radix family, the placement and the accessible name.
|
|
30
|
+
* @param props.kind - `alert` renders Radix's `AlertDialog.Cancel`, `dialog` its `Dialog.Close`.
|
|
31
|
+
* @param props.placement - `viewport` pins it to the viewport corner; `content` keeps it in the panel.
|
|
32
|
+
* @param props.label - Accessible name of the icon-only button.
|
|
33
|
+
* @returns The close control.
|
|
34
|
+
*/
|
|
35
|
+
export declare function DialogSurfaceCloseButton({ kind, placement, label, buttonRef, }: {
|
|
36
|
+
kind: DialogSurfaceKind;
|
|
37
|
+
placement: DialogCloseButtonPlacement;
|
|
38
|
+
label?: string;
|
|
39
|
+
/** Ref of the close button element. */
|
|
40
|
+
buttonRef?: Ref<HTMLButtonElement>;
|
|
41
|
+
}): import("react").JSX.Element;
|
|
20
42
|
/**
|
|
21
43
|
* Arc's text swap: when a dialog's title or description text changes while it is open, the new copy rises in and the
|
|
22
44
|
* old copy lifts out. The first render is static, so server HTML and the opening frame never animate the copy.
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* Arc's Dialog surface (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md), shared by `Dialog` and
|
|
5
|
-
* `
|
|
5
|
+
* its `alert` mode: the dimmed, blurred overlay, the raised panel with Arc's surface radius, border and floating shadow,
|
|
6
6
|
* the title and description type, the bordered close button and the text swap that animates a title or description
|
|
7
7
|
* changed while the dialog is open. Internal: the panel's entrance and exit are Arc's, played by `MotionSlot`.
|
|
8
8
|
*/
|
|
9
|
+
import { XIcon } from "lucide-react";
|
|
9
10
|
import { AnimatePresence, motion, useIsPresent } from "motion/react";
|
|
10
|
-
import {
|
|
11
|
+
import { AlertDialog as AlertDialogPrimitive, Dialog as DialogPrimitive } from "radix-ui";
|
|
12
|
+
import { DIALOG_DEFAULT_COPY, DIALOG_TEXT_SWAP_OFFSET_EM } from "../constants/dialog.js";
|
|
11
13
|
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
14
|
+
import { cn } from "../lib/utils.js";
|
|
12
15
|
import { ARC_BLUR, ARC_DURATION, ARC_EASE } from "../motion/arc-tokens.js";
|
|
13
|
-
import {
|
|
16
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
17
|
+
import { ControlButton } from "./control-button.js";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
19
|
/** Arc's overlay: a near-black scrim at 46% with a 7px backdrop blur where the engine supports it. */
|
|
15
20
|
export const dialogOverlayClassName = "fixed inset-0 isolate z-50 bg-[oklch(10%_0_0/0.46)] supports-backdrop-filter:backdrop-blur-[7px]";
|
|
16
21
|
/**
|
|
@@ -29,6 +34,97 @@ export const dialogDescriptionClassName = "text-sm leading-(--leading-body) text
|
|
|
29
34
|
* from `ControlButton`.
|
|
30
35
|
*/
|
|
31
36
|
export const dialogCloseButtonClassName = "size-(--space-8) rounded-(--radius-control) border-border bg-surface-muted/50 text-text-secondary hover-fine:bg-surface-muted hover-fine:text-foreground [&_svg:not([class*='size-'])]:size-4";
|
|
37
|
+
/** Classes of a close button pinned to the viewport corner while the panel enters and closes. */
|
|
38
|
+
const viewportCloseButtonClassName = "fixed top-4 right-4 transition-opacity duration-200 ease-out in-data-motion-entering:invisible in-data-motion-entering:opacity-0 in-data-motion-entering:transition-none in-data-[state=closed]:invisible in-data-[state=closed]:opacity-0 in-data-[state=closed]:transition-none motion-reduce:transition-none";
|
|
39
|
+
/** Classes of a close button centred on the first line of an 18px title, as in Arc's header row. */
|
|
40
|
+
const contentCloseButtonClassName = "absolute top-[calc(var(--space-6)+(var(--text-lg)*var(--leading-body)-var(--space-8))/2)] right-(--space-6)";
|
|
41
|
+
/**
|
|
42
|
+
* Arc's bordered close button for both dialog families. Pinned to the viewport corner it stays hidden while the panel
|
|
43
|
+
* enters, because the entrance transform would otherwise carry it along with the panel, fades in once the panel settles and hides
|
|
44
|
+
* at once when the dialog starts closing; while hidden it is also `visibility: hidden`, so the initial focus and the
|
|
45
|
+
* keyboard never land on a control that cannot be seen. Inside the panel it pops in after the panel.
|
|
46
|
+
* @param props - The Radix family, the placement and the accessible name.
|
|
47
|
+
* @param props.kind - `alert` renders Radix's `AlertDialog.Cancel`, `dialog` its `Dialog.Close`.
|
|
48
|
+
* @param props.placement - `viewport` pins it to the viewport corner; `content` keeps it in the panel.
|
|
49
|
+
* @param props.label - Accessible name of the icon-only button.
|
|
50
|
+
* @returns The close control.
|
|
51
|
+
*/
|
|
52
|
+
export function DialogSurfaceCloseButton(t0) {
|
|
53
|
+
const $ = _c(15);
|
|
54
|
+
const { kind, placement, label: t1, buttonRef } = t0;
|
|
55
|
+
const label = t1 === undefined ? DIALOG_DEFAULT_COPY.closeLabel : t1;
|
|
56
|
+
const Close = kind === "alert" ? AlertDialogPrimitive.Cancel : DialogPrimitive.Close;
|
|
57
|
+
const t2 = placement === "viewport" ? viewportCloseButtonClassName : contentCloseButtonClassName;
|
|
58
|
+
let t3;
|
|
59
|
+
if ($[0] !== t2) {
|
|
60
|
+
t3 = cn(dialogCloseButtonClassName, t2);
|
|
61
|
+
$[0] = t2;
|
|
62
|
+
$[1] = t3;
|
|
63
|
+
} else {
|
|
64
|
+
t3 = $[1];
|
|
65
|
+
}
|
|
66
|
+
let t4;
|
|
67
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
|
+
t4 = /* @__PURE__ */ _jsx(XIcon, { "aria-hidden": "true" });
|
|
69
|
+
$[2] = t4;
|
|
70
|
+
} else {
|
|
71
|
+
t4 = $[2];
|
|
72
|
+
}
|
|
73
|
+
let t5;
|
|
74
|
+
if ($[3] !== label) {
|
|
75
|
+
t5 = /* @__PURE__ */ _jsx("span", {
|
|
76
|
+
className: "sr-only",
|
|
77
|
+
children: label
|
|
78
|
+
});
|
|
79
|
+
$[3] = label;
|
|
80
|
+
$[4] = t5;
|
|
81
|
+
} else {
|
|
82
|
+
t5 = $[4];
|
|
83
|
+
}
|
|
84
|
+
let t6;
|
|
85
|
+
if ($[5] !== buttonRef || $[6] !== t3 || $[7] !== t5) {
|
|
86
|
+
t6 = /* @__PURE__ */ _jsxs(ControlButton, {
|
|
87
|
+
ref: buttonRef,
|
|
88
|
+
variant: "ghost",
|
|
89
|
+
size: "icon-sm",
|
|
90
|
+
className: t3,
|
|
91
|
+
children: [t4, t5]
|
|
92
|
+
});
|
|
93
|
+
$[5] = buttonRef;
|
|
94
|
+
$[6] = t3;
|
|
95
|
+
$[7] = t5;
|
|
96
|
+
$[8] = t6;
|
|
97
|
+
} else {
|
|
98
|
+
t6 = $[8];
|
|
99
|
+
}
|
|
100
|
+
const button = t6;
|
|
101
|
+
let t7;
|
|
102
|
+
if ($[9] !== button || $[10] !== placement) {
|
|
103
|
+
t7 = placement === "viewport" ? button : /* @__PURE__ */ _jsx(MotionSlot, {
|
|
104
|
+
kind: "delayed-pop",
|
|
105
|
+
children: button
|
|
106
|
+
});
|
|
107
|
+
$[9] = button;
|
|
108
|
+
$[10] = placement;
|
|
109
|
+
$[11] = t7;
|
|
110
|
+
} else {
|
|
111
|
+
t7 = $[11];
|
|
112
|
+
}
|
|
113
|
+
let t8;
|
|
114
|
+
if ($[12] !== Close || $[13] !== t7) {
|
|
115
|
+
t8 = /* @__PURE__ */ _jsx(Close, {
|
|
116
|
+
"data-slot": "dialog-close",
|
|
117
|
+
asChild: true,
|
|
118
|
+
children: t7
|
|
119
|
+
});
|
|
120
|
+
$[12] = Close;
|
|
121
|
+
$[13] = t7;
|
|
122
|
+
$[14] = t8;
|
|
123
|
+
} else {
|
|
124
|
+
t8 = $[14];
|
|
125
|
+
}
|
|
126
|
+
return t8;
|
|
127
|
+
}
|
|
32
128
|
/**
|
|
33
129
|
* One version of the copy. While it lifts out it turns inert and hidden from assistive technology, so the dialog's
|
|
34
130
|
* accessible name never reads the old and the new copy together.
|
|
@@ -1,57 +1,92 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Arc's Dialog (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a focused surface for decisions that need
|
|
3
|
-
* attention
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* attention. Arc's API (`Dialog`, `DialogTrigger`, `DialogContent` with its `title`, `description` and built-in close
|
|
4
|
+
* button, `DialogClose`) on Arc's overlay, raised panel, text swap and dialog transition. beez-ui
|
|
5
|
+
* extends it with a footer slot, a hidden title, the viewport close button placement, Spanish copy and an `alert` mode
|
|
6
|
+
* that replaces the former `AlertDialog`.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { Dialog as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
import { type ComponentProps, type ReactNode, type Ref } from "react";
|
|
9
|
+
import { type Dialog as DialogRadix } from "radix-ui";
|
|
10
|
+
import type { DialogCloseButtonPlacement } from "./dialog-surface.js";
|
|
11
|
+
export type { DialogCloseButtonPlacement } from "./dialog-surface.js";
|
|
12
|
+
/** Props of `Dialog`: Radix's root contract plus beez-ui's `alert` mode. */
|
|
13
|
+
export type DialogProps = ComponentProps<typeof DialogRadix.Root> & {
|
|
14
|
+
/**
|
|
15
|
+
* Gives the dialog alert dialog semantics: `role="alertdialog"`, a press outside never closes it, it opens with the
|
|
16
|
+
* focus on the first `DialogClose` (the least destructive answer) and `DialogContent` hides its close button by
|
|
17
|
+
* default. `Escape` still cancels it. `modal` does not apply: an alert dialog is always modal.
|
|
18
|
+
*/
|
|
19
|
+
alert?: boolean;
|
|
20
|
+
};
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param props -
|
|
21
|
-
* @
|
|
22
|
-
* @param props.closeButtonPlacement - `viewport` pins the close button to the viewport corner
|
|
23
|
-
* and shows it only once the panel has settled; `content` (default) keeps it in the panel.
|
|
24
|
-
* @returns The styled primitive with its original interaction contract.
|
|
22
|
+
* Root that tracks the open state so the content can animate out. Controlled (`open`, `onOpenChange`) or uncontrolled
|
|
23
|
+
* (`defaultOpen`).
|
|
24
|
+
* @param props - Radix root props and `alert`.
|
|
25
|
+
* @returns The dialog root.
|
|
25
26
|
*/
|
|
26
|
-
declare function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}): React.JSX.Element;
|
|
27
|
+
declare function Dialog({ alert, modal, ...props }: DialogProps): import("react").JSX.Element;
|
|
28
|
+
/** Props of `DialogTrigger`: Radix's trigger contract, including `asChild`. */
|
|
29
|
+
export type DialogTriggerProps = ComponentProps<typeof DialogRadix.Trigger>;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
* @returns The header block.
|
|
31
|
+
* Opens the dialog. Use `asChild` to render your own button.
|
|
32
|
+
* @param props - Radix trigger props.
|
|
33
|
+
* @returns The trigger.
|
|
35
34
|
*/
|
|
36
|
-
declare function
|
|
35
|
+
declare function DialogTrigger(props: DialogTriggerProps): import("react").JSX.Element;
|
|
36
|
+
/** Props of `DialogClose`: Radix's close contract, including `asChild`. */
|
|
37
|
+
export type DialogCloseProps = ComponentProps<typeof DialogRadix.Close>;
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
39
|
+
* Closes the dialog from a custom control, such as a cancel button. In `alert` mode it cancels the confirmation, and
|
|
40
|
+
* the first one receives the focus when the dialog opens.
|
|
41
|
+
* @param props - Radix close props.
|
|
42
|
+
* @returns The close control.
|
|
41
43
|
*/
|
|
42
|
-
declare function
|
|
44
|
+
declare function DialogClose(props: DialogCloseProps): import("react").JSX.Element;
|
|
45
|
+
/** Props of `DialogContent`: Arc's titled panel, beez-ui's extensions and Radix's content props. */
|
|
46
|
+
export type DialogContentProps = Omit<ComponentProps<typeof DialogRadix.Content>, "title" | "children"> & {
|
|
47
|
+
/** Heading of the dialog and its accessible name. Plain text that changes while open crossfades in place. */
|
|
48
|
+
title: ReactNode;
|
|
49
|
+
/** Supporting line under the title, wired to `aria-describedby`. */
|
|
50
|
+
description?: ReactNode;
|
|
51
|
+
/** Body of the dialog, usually a form or actions. */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
/** Edge-to-edge action row under a hairline at the bottom of the panel, usually the dialog's buttons. */
|
|
54
|
+
footer?: ReactNode;
|
|
55
|
+
/** Keeps the title as the accessible name but shows it only to screen readers. */
|
|
56
|
+
hideTitle?: boolean;
|
|
57
|
+
/** Whether the panel renders its close button. Defaults to `true`, or `false` in `alert` mode. */
|
|
43
58
|
showCloseButton?: boolean;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
|
|
59
|
+
/**
|
|
60
|
+
* `content` (default) places the close button in the panel header; `viewport` pins it to the viewport corner and
|
|
61
|
+
* shows it once the panel has settled.
|
|
62
|
+
*/
|
|
63
|
+
closeButtonPlacement?: DialogCloseButtonPlacement;
|
|
64
|
+
/** Accessible name of the close button. Defaults to "Cerrar diálogo". */
|
|
65
|
+
closeLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Ref of the built-in close button, while it is rendered. To open the dialog with the focus on it, call
|
|
68
|
+
* `event.preventDefault()` in `onOpenAutoFocus` and focus `closeButtonRef.current`.
|
|
69
|
+
*/
|
|
70
|
+
closeButtonRef?: Ref<HTMLButtonElement>;
|
|
71
|
+
/**
|
|
72
|
+
* Extra content of the header, rendered after the title and before the description but outside the title, such as
|
|
73
|
+
* type or status badges. The dialog keeps the title alone as its accessible name.
|
|
74
|
+
*/
|
|
75
|
+
headerContent?: ReactNode;
|
|
76
|
+
/** Classes of the block that holds the title, the header content and the description. */
|
|
77
|
+
headerClassName?: string;
|
|
78
|
+
/** Classes of the title. */
|
|
79
|
+
titleClassName?: string;
|
|
80
|
+
/** Classes of the description. */
|
|
81
|
+
descriptionClassName?: string;
|
|
82
|
+
/** Classes of the footer. */
|
|
83
|
+
footerClassName?: string;
|
|
84
|
+
};
|
|
51
85
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param props -
|
|
54
|
-
*
|
|
86
|
+
* The portaled overlay and panel with a titled header, the body, an optional footer and the built-in close button.
|
|
87
|
+
* @param props - Title, header content, description, body, footer, close button options and ref, part classes and
|
|
88
|
+
* Radix content props.
|
|
89
|
+
* @returns The dialog panel.
|
|
55
90
|
*/
|
|
56
|
-
declare function
|
|
57
|
-
export { Dialog, DialogClose, DialogContent,
|
|
91
|
+
declare function DialogContent({ title, description, children, footer, hideTitle, showCloseButton, closeButtonPlacement, closeLabel, closeButtonRef, headerContent, headerClassName, titleClassName, descriptionClassName, footerClassName, onOpenAutoFocus, ...props }: DialogContentProps): import("react").JSX.Element;
|
|
92
|
+
export { Dialog, DialogClose, DialogContent, DialogTrigger };
|