@brdgapp/ui 1.10.0 → 1.11.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 +41 -0
- package/components/action-menu.d.ts +18 -6
- package/components/action-menu.js +27 -8
- package/components/button.d.ts +6 -1
- package/components/button.js +16 -4
- package/components/column-filter-menu.d.ts +20 -4
- package/components/column-filter-menu.js +26 -4
- package/components/copy-field.d.ts +14 -7
- package/components/copy-field.js +25 -22
- package/components/data-table.d.ts +1 -1
- package/components/date-picker.d.ts +77 -0
- package/components/date-picker.js +367 -0
- package/components/filter-pill.d.ts +58 -4
- package/components/filter-pill.js +115 -10
- package/components/icon-button.d.ts +7 -1
- package/components/icon-button.js +14 -4
- package/components/input.d.ts +27 -3
- package/components/input.js +96 -3
- package/components/select.d.ts +41 -6
- package/components/select.js +167 -2
- package/components/spinner.d.ts +19 -0
- package/components/spinner.js +20 -0
- package/hooks/use-copy.d.ts +10 -0
- package/hooks/use-copy.js +27 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versions.
|
|
4
4
|
|
|
5
|
+
## 1.11.0
|
|
6
|
+
|
|
7
|
+
2026-11-20. Spinner; DatePicker; search inside Select; picking several values; ticks in ActionMenu; password fields you can show; icons, prefixes and numbers in Input; copy on Button,
|
|
8
|
+
IconButton and CopyField. Nothing changes for apps already on 1.10, except that a password field now has its own show/hide button:
|
|
9
|
+
delete any the app drew beside it.
|
|
10
|
+
|
|
11
|
+
- New: Spinner (`components/spinner`), for work that has nothing to show yet: a sync running, an account
|
|
12
|
+
connecting, a step in progress. Put it beside the words that say what's happening; `label` names it for
|
|
13
|
+
screen readers when it stands alone. Sizes 14, 16 and 24px; it takes the color of the text around it.
|
|
14
|
+
It replaces an app's own `Loader2` with `animate-spin`, except inside a button (use `loading`) and where
|
|
15
|
+
content will appear (use Skeleton).
|
|
16
|
+
- New: an Input with `type="password"` has a show/hide button at its end, named "Show password", with
|
|
17
|
+
the same words in a Tip. `secretName="API key"` makes it "Show API key"; `reveal={false}` leaves it out.
|
|
18
|
+
- New: Input's `leadingIcon` (an icon before the value) and `prefix` (fixed text: "$", "https://"), inside
|
|
19
|
+
the field's box. They replace an icon laid over a field with `pl-10`.
|
|
20
|
+
- New: Input's `format="number"`: a whole number with commas as it's typed; `onValueChange` gets the plain
|
|
21
|
+
number, or `null` when empty. With `prefix="$"` for money. It replaces `type="number"` and apps' own
|
|
22
|
+
currency fields.
|
|
23
|
+
- New: `copy` on Button and IconButton copies text on click. The label says "Copied" with a check for 1.5
|
|
24
|
+
seconds at the same width, screen readers hear it, and a failed copy shows an error toast. `useCopy`
|
|
25
|
+
(`hooks/use-copy`) is the same behavior for a menu row.
|
|
26
|
+
- New: CopyField's `box` (one value with a copy button at its end) and `block` (several lines, Copy in the
|
|
27
|
+
corner), the kinds `link`, `code` and `text`, and `label` for the button's name.
|
|
28
|
+
- New: DatePicker (`components/date-picker`): a date typed ("Mar 4", "3/4/2026", "today") or picked from a
|
|
29
|
+
calendar whose week starts on Monday, with month and year grids to jump far back. `range` takes a start and
|
|
30
|
+
an end in one box. Values are "YYYY-MM-DD" text; `min` and `max` take a date or "today". `Calendar` is the
|
|
31
|
+
calendar alone, for a table cell's popover. It replaces `<input type="date">` and apps' own calendars. The
|
|
32
|
+
package now depends on `react-day-picker` 10.
|
|
33
|
+
- New: Select's `search`, a search field at the top of the list. `true` filters `options` as people type;
|
|
34
|
+
`{ value, onChange, loading, minLength }` means the app searches and passes its results as `options`.
|
|
35
|
+
`searchPlaceholder` and `emptyText` set its words. `onCreate` adds an Add “…” row for a value that isn't
|
|
36
|
+
listed. It replaces apps' own searchable dropdowns (cmdk Command in a Popover, Combobox, SearchableSelect).
|
|
37
|
+
- New: `multiple` on FilterPill and ColumnFilterMenu: tick several values, each tick filters at once, the
|
|
38
|
+
pill names what's on ("Tags: VC, Mutual +1") and Reset clears them. `search` (`true`, or the app's own
|
|
39
|
+
search) for a long list. `multiple` on Select: each choice is a Tag in the field with × to remove it.
|
|
40
|
+
- New: ticks in ActionMenu. An ActionMenuGroup with `value` and `onValueChange` is a pick-one choice (a sort
|
|
41
|
+
order), with a blue check at the picked row's end; choosing closes the menu. A row with `checked` and
|
|
42
|
+
`onCheckedChange` has a tick box and keeps the menu open, for showing and hiding columns.
|
|
43
|
+
- Changed: CopyField shows an error toast when the browser blocks the copy (it used to do nothing).
|
|
44
|
+
- Fix: an ActionMenuItem with `external` shows ↗ and tells screen readers it opens in a new tab.
|
|
45
|
+
|
|
5
46
|
## 1.10.0
|
|
6
47
|
|
|
7
48
|
2026-11-19. Light by default, the top bar's edges, and Lucide's current icon names. Nothing to change in an
|
|
@@ -51,7 +51,13 @@ type ActionMenuItemProps = {
|
|
|
51
51
|
/** Red, for removing or leaving. */
|
|
52
52
|
danger?: boolean;
|
|
53
53
|
disabled?: boolean;
|
|
54
|
-
/**
|
|
54
|
+
/** In a pick-one ActionMenuGroup: what this choice is. The picked row gets a blue check, and the menu closes. */
|
|
55
|
+
value?: string;
|
|
56
|
+
/** Tick several: the row has a tick box, and the menu stays open so a few can be ticked in a row. */
|
|
57
|
+
checked?: boolean;
|
|
58
|
+
/** With `checked`: gets the row's new state. */
|
|
59
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
60
|
+
/** Whether choosing closes the menu. `false` for a row that shows its own result ("Copied"). Ticked rows stay open. */
|
|
55
61
|
closeOnClick?: boolean;
|
|
56
62
|
/**
|
|
57
63
|
* Render the link with your router's link, e.g. `render={<Link href="/settings" />}`.
|
|
@@ -60,13 +66,19 @@ type ActionMenuItemProps = {
|
|
|
60
66
|
render?: React.ReactElement;
|
|
61
67
|
className?: string;
|
|
62
68
|
};
|
|
63
|
-
declare function ActionMenuItem({ icon, children, description, onClick, href, external, danger, disabled, closeOnClick, render, className, }: ActionMenuItemProps): React.JSX.Element;
|
|
69
|
+
declare function ActionMenuItem({ icon, children, description, onClick, href, external, danger, disabled, value, checked, onCheckedChange, closeOnClick, render, className, }: ActionMenuItemProps): React.JSX.Element;
|
|
64
70
|
/** A thin line between groups of rows. */
|
|
65
71
|
declare function ActionMenuSeparator(): React.JSX.Element;
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
type ActionMenuGroupProps = {
|
|
73
|
+
/** The heading over the rows: "Sort by", "Pin column". Announced with the group. */
|
|
68
74
|
label: React.ReactNode;
|
|
75
|
+
/** Pick one: the row with this `value` gets a blue check. `null` when none is picked yet. */
|
|
76
|
+
value?: string | null;
|
|
77
|
+
/** Pick one: gets the `value` of the row chosen. Turns the rows with a `value` into choices. */
|
|
78
|
+
onValueChange?: (value: string) => void;
|
|
69
79
|
children: React.ReactNode;
|
|
70
|
-
}
|
|
80
|
+
};
|
|
81
|
+
/** Rows under a small heading ("Sort by", "Signed in as …"). With `value` and `onValueChange`, the rows are a pick-one choice. */
|
|
82
|
+
declare function ActionMenuGroup({ label, value, onValueChange, children }: ActionMenuGroupProps): React.JSX.Element;
|
|
71
83
|
export { ActionMenu, ActionMenuGroup, ActionMenuItem, ActionMenuSeparator, useActionMenu, ACTION_MENU_ITEM_CLASS };
|
|
72
|
-
export type {
|
|
84
|
+
export type { ActionMenuGroupProps, ActionMenuItemProps, ActionMenuProps };
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
4
4
|
import { Menu } from "@base-ui/react/menu";
|
|
5
|
-
import { EllipsisVertical } from "lucide-react";
|
|
5
|
+
import { Check, EllipsisVertical, ExternalLink } from "lucide-react";
|
|
6
|
+
import { TickBox } from "@brdgapp/ui/components/filter-pill";
|
|
6
7
|
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
7
8
|
import { Tip } from "@brdgapp/ui/components/info-hint";
|
|
8
9
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
@@ -12,6 +13,10 @@ import { cn } from "@brdgapp/ui/lib/utils";
|
|
|
12
13
|
// scroll instead of closing. The danger colour is now a token (Bridge OS hard-coded #E13535).
|
|
13
14
|
// Added from the app survey (2026-11-05): a Tip on the ⋮ with its name, `align="start"` (9 of the apps'
|
|
14
15
|
// 49 menus open from the left), and ActionMenuGroup for a heading over rows (DropdownMenuLabel, 16 uses).
|
|
16
|
+
// Ticks (Aman 2026-11-24, from the survey: pick one in 5 menus, like sort newest/oldest in app-cc, group by
|
|
17
|
+
// in together, pin left/right in Directories; tick several to show and hide columns in raise and Directories):
|
|
18
|
+
// a group with `value` picks one, with a blue check at the row's right end like AccountMenu's workspaces,
|
|
19
|
+
// and closes; a row with `checked` has Checkbox's tick box and keeps the menu open.
|
|
15
20
|
// The one menu-row look. Exported so custom stateful rows can match it.
|
|
16
21
|
const ACTION_MENU_ITEM_CLASS = "flex w-full cursor-default items-center gap-3 px-3.5 py-2.5 max-md:min-h-11 text-left text-13 leading-normal text-[var(--text-body)] outline-none transition-colors " +
|
|
17
22
|
"data-[highlighted]:bg-[var(--surface-secondary)] hover:bg-[var(--surface-secondary)] data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
@@ -38,20 +43,34 @@ function ActionMenu({ ariaLabel = "More options", size = "md", width = 248, alig
|
|
|
38
43
|
// The same words as the trigger's name, in a Tip, so people who see it and people who hear it get one name.
|
|
39
44
|
_jsx(Tip, { text: ariaLabel, disabled: open, children: _jsx(Menu.Trigger, { render: _jsx(IconButton, { "aria-label": ariaLabel, size: size, className: cn("shrink-0", triggerClassName), children: icon ?? _jsx(EllipsisVertical, {}) }), onClick: stop, onPointerDown: stop }) })), _jsx(Menu.Portal, { children: _jsx(Menu.Positioner, { side: "bottom", align: align, sideOffset: 6, collisionPadding: 8, className: "z-[95]", children: _jsx(Menu.Popup, { "data-slot": "action-menu", style: { width }, className: cn("max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none", "origin-[var(--transform-origin)] transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", menuClassName), children: _jsx(ActionMenuContext.Provider, { value: ctx, children: typeof children === "function" ? children(close) : children }) }) }) })] }));
|
|
40
45
|
}
|
|
41
|
-
function ActionMenuItem({ icon, children, description, onClick, href, external = false, danger = false, disabled = false,
|
|
46
|
+
function ActionMenuItem({ icon, children, description, onClick, href, external = false, danger = false, disabled = false, value, checked, onCheckedChange, closeOnClick, render, className, }) {
|
|
47
|
+
const pickOne = useContext(PickOneContext) && value !== undefined;
|
|
48
|
+
const tick = !pickOne && checked !== undefined;
|
|
42
49
|
const classes = cn(ACTION_MENU_ITEM_CLASS, danger && ACTION_MENU_ITEM_DANGER_CLASS, description && "items-start", className);
|
|
43
|
-
const body = description ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "mt-0.5 inline-flex shrink-0", children: icon }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: cn("block text-13 leading-normal font-semibold", !danger && "text-[var(--text-primary)]"), children: children }), _jsx("span", { className: "block text-12 leading-normal text-[var(--text-muted)]", children: description })] })] })) : (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "inline-flex shrink-0", children: icon })) : null, children] }));
|
|
50
|
+
const body = description ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "mt-0.5 inline-flex shrink-0", children: icon }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block text-13 leading-normal font-semibold", !danger && "text-[var(--text-primary)]"), children: children }), _jsx("span", { className: "block text-12 leading-normal text-[var(--text-muted)]", children: description })] })] })) : (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "inline-flex shrink-0", children: icon })) : null, children] }));
|
|
51
|
+
if (pickOne) {
|
|
52
|
+
return (_jsxs(Menu.RadioItem, { "data-slot": "action-menu-item", value: value, onClick: onClick, disabled: disabled, closeOnClick: closeOnClick ?? true, className: classes, children: [body, _jsx(Menu.RadioItemIndicator, { className: cn("ml-auto inline-flex shrink-0", description && "mt-0.5"), children: _jsx(Check, { "aria-hidden": "true", className: "text-[var(--primary)]" }) })] }));
|
|
53
|
+
}
|
|
54
|
+
if (tick) {
|
|
55
|
+
return (_jsxs(Menu.CheckboxItem, { "data-slot": "action-menu-item", checked: checked, onCheckedChange: (on) => onCheckedChange?.(on), onClick: onClick, disabled: disabled, closeOnClick: closeOnClick ?? false, className: classes, children: [_jsx("span", { className: cn("inline-flex shrink-0", description && "mt-0.5"), children: _jsx(TickBox, { on: checked }) }), body] }));
|
|
56
|
+
}
|
|
44
57
|
if (href && !disabled) {
|
|
45
|
-
return (
|
|
58
|
+
return (_jsxs(Menu.LinkItem, { "data-slot": "action-menu-item", href: href, closeOnClick: closeOnClick ?? true, onClick: onClick, className: classes, render: render, ...(external ? { target: "_blank", rel: "noopener noreferrer" } : {}), children: [body, external ? (_jsxs(_Fragment, { children: [_jsx(ExternalLink, { "aria-hidden": "true", className: "ml-auto size-3.5 shrink-0 text-[var(--text-muted)]" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] })) : null] }));
|
|
46
59
|
}
|
|
47
|
-
return (_jsx(Menu.Item, { "data-slot": "action-menu-item", onClick: onClick, disabled: disabled, closeOnClick: closeOnClick, className: classes, children: body }));
|
|
60
|
+
return (_jsx(Menu.Item, { "data-slot": "action-menu-item", onClick: onClick, disabled: disabled, closeOnClick: closeOnClick ?? true, className: classes, children: body }));
|
|
48
61
|
}
|
|
49
62
|
/** A thin line between groups of rows. */
|
|
50
63
|
function ActionMenuSeparator() {
|
|
51
64
|
return _jsx(Menu.Separator, { "data-slot": "action-menu-separator", className: "my-1 h-px bg-[var(--border-divider)]" });
|
|
52
65
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
// Set by a pick-one group, so its rows know to be choices.
|
|
67
|
+
const PickOneContext = createContext(false);
|
|
68
|
+
/** Rows under a small heading ("Sort by", "Signed in as …"). With `value` and `onValueChange`, the rows are a pick-one choice. */
|
|
69
|
+
function ActionMenuGroup({ label, value, onValueChange, children }) {
|
|
70
|
+
const heading = _jsx(Menu.GroupLabel, { className: "px-3.5 pt-2 pb-1 text-12 leading-normal font-semibold text-[var(--text-muted)]", children: label });
|
|
71
|
+
if (onValueChange) {
|
|
72
|
+
return (_jsxs(Menu.RadioGroup, { "data-slot": "action-menu-group", value: value ?? null, onValueChange: (v) => onValueChange(v), children: [heading, _jsx(PickOneContext.Provider, { value: true, children: children })] }));
|
|
73
|
+
}
|
|
74
|
+
return (_jsxs(Menu.Group, { "data-slot": "action-menu-group", children: [heading, children] }));
|
|
56
75
|
}
|
|
57
76
|
export { ActionMenu, ActionMenuGroup, ActionMenuItem, ActionMenuSeparator, useActionMenu, ACTION_MENU_ITEM_CLASS };
|
package/components/button.d.ts
CHANGED
|
@@ -12,8 +12,13 @@ type ButtonProps = Omit<ButtonPrimitive.Props, "className"> & VariantProps<typeo
|
|
|
12
12
|
icon?: React.ReactNode;
|
|
13
13
|
/** The action is running: shows a spinner, disables the button and sets `aria-busy`. */
|
|
14
14
|
loading?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Text to copy on click: the label becomes "Copied" with a check for 1.5 seconds, the button keeps its
|
|
17
|
+
* width, screen readers hear "Copied", and a failed copy shows an error toast. `onClick` still runs.
|
|
18
|
+
*/
|
|
19
|
+
copy?: string;
|
|
15
20
|
};
|
|
16
|
-
declare function Button({ className, variant, size, fullWidth, icon, loading, disabled, render, children, ...props }: ButtonProps): React.JSX.Element;
|
|
21
|
+
declare function Button({ className, variant, size, fullWidth, icon, loading, disabled, render, children, copy, onClick, ...props }: ButtonProps): React.JSX.Element;
|
|
17
22
|
declare const buttonSkeletonHeights: {
|
|
18
23
|
readonly xs: "h-7";
|
|
19
24
|
readonly sm: "h-8";
|
package/components/button.js
CHANGED
|
@@ -4,11 +4,13 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
|
4
4
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
5
|
import { useRender } from "@base-ui/react/use-render";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
|
-
import { LoaderCircle } from "lucide-react";
|
|
7
|
+
import { Check, LoaderCircle } from "lucide-react";
|
|
8
|
+
import { useCopy } from "@brdgapp/ui/hooks/use-copy";
|
|
8
9
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
9
10
|
// Started from shadcn's Base UI button (style base-nova), then moved onto Bridge's tokens and API.
|
|
10
11
|
// Look and API match Bridge OS src/components/ui/button.tsx (components.md, 2026-10-29); `asChild`
|
|
11
12
|
// became `render`. Fills use the AA-verified --primary-solid / --danger-solid, never --primary / --error.
|
|
13
|
+
// `copy` (Aman 2026-11-20): about 30 hand-made "Copy … link" buttons in 10 apps; see hooks/use-copy.ts.
|
|
12
14
|
const buttonVariants = cva([
|
|
13
15
|
"group/button inline-flex items-center gap-1.5 whitespace-nowrap font-semibold tracking-[0.4px]",
|
|
14
16
|
"transition-all duration-150 ease-out outline-none select-none",
|
|
@@ -60,18 +62,28 @@ const buttonVariants = cva([
|
|
|
60
62
|
fullWidth: false,
|
|
61
63
|
},
|
|
62
64
|
});
|
|
63
|
-
function Button({ className, variant, size, fullWidth, icon, loading = false, disabled, render, children, ...props }) {
|
|
65
|
+
function Button({ className, variant, size, fullWidth, icon, loading = false, disabled, render, children, copy, onClick, ...props }) {
|
|
64
66
|
const classes = cn(buttonVariants({ variant, size, fullWidth }), className);
|
|
67
|
+
const copier = useCopy();
|
|
65
68
|
// With `render` (for example a Next `Link`), the element keeps its own semantics: a link stays a
|
|
66
69
|
// link. It owns its content, so `icon` and `loading` don't apply.
|
|
67
70
|
const rendered = useRender({
|
|
68
71
|
render: render,
|
|
69
72
|
enabled: render !== undefined,
|
|
70
|
-
props: mergeProps({ className: classes, "data-slot": "button" }, props, { children }),
|
|
73
|
+
props: mergeProps({ className: classes, "data-slot": "button" }, { ...props, onClick }, { children }),
|
|
71
74
|
});
|
|
72
75
|
if (rendered)
|
|
73
76
|
return rendered;
|
|
74
|
-
|
|
77
|
+
if (copy !== undefined) {
|
|
78
|
+
const { copied } = copier;
|
|
79
|
+
// A filled button keeps its white check; on the others the check is green.
|
|
80
|
+
const filled = variant === undefined || variant === null || variant === "primary" || variant === "destructive";
|
|
81
|
+
return (_jsxs(ButtonPrimitive, { "data-slot": "button", "data-copied": copied || undefined, className: classes, disabled: disabled || loading, "aria-busy": loading || undefined, ...props, onClick: (e) => {
|
|
82
|
+
void copier.copy(copy);
|
|
83
|
+
onClick?.(e);
|
|
84
|
+
}, children: [_jsxs("span", { className: "inline-grid", children: [_jsxs("span", { "aria-hidden": copied || undefined, className: cn("col-start-1 row-start-1 inline-flex items-center gap-1.5", copied && "invisible"), children: [loading ? (_jsx(LoaderCircle, { "data-slot": "button-spinner", className: "animate-spin", "aria-hidden": "true" })) : icon ? (_jsx("span", { "data-slot": "button-icon", className: "inline-flex shrink-0", "aria-hidden": "true", children: icon })) : null, children] }), _jsxs("span", { "aria-hidden": "true", className: cn("col-start-1 row-start-1 inline-flex items-center justify-center gap-1.5", !copied && "invisible"), children: [_jsx(Check, { className: filled ? undefined : "text-[var(--success-text)]" }), "Copied"] })] }), _jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? "Copied" : "" })] }));
|
|
85
|
+
}
|
|
86
|
+
return (_jsxs(ButtonPrimitive, { "data-slot": "button", className: classes, disabled: disabled || loading, "aria-busy": loading || undefined, onClick: onClick, ...props, children: [loading ? (_jsx(LoaderCircle, { "data-slot": "button-spinner", className: "animate-spin", "aria-hidden": "true" })) : icon ? (_jsx("span", { "data-slot": "button-icon", className: "inline-flex shrink-0", "aria-hidden": "true", children: icon })) : null, children] }));
|
|
75
87
|
}
|
|
76
88
|
const buttonSkeletonHeights = { xs: "h-7", sm: "h-8", md: "h-11 md:h-10", lg: "h-12" };
|
|
77
89
|
/**
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { type LucideIcon } from "lucide-react";
|
|
2
|
-
import { type FilterPillOption } from "@brdgapp/ui/components/filter-pill";
|
|
2
|
+
import { type FilterPillOption, type FilterPillSearch } from "@brdgapp/ui/components/filter-pill";
|
|
3
3
|
import { type ElementProps } from "@brdgapp/ui/lib/utils";
|
|
4
|
-
type
|
|
4
|
+
type ColumnFilterBase = ElementProps<HTMLButtonElement> & {
|
|
5
5
|
/** The column's icon component. Optional: leave it out for a header with only a name. */
|
|
6
6
|
icon?: LucideIcon;
|
|
7
7
|
label: string;
|
|
8
8
|
/** Explains the column. Hidden while the menu is open. */
|
|
9
9
|
tooltip?: string;
|
|
10
|
+
};
|
|
11
|
+
type SingleColumnFilterProps<T extends string> = ColumnFilterBase & {
|
|
12
|
+
multiple?: false;
|
|
10
13
|
value: T;
|
|
11
14
|
options: FilterPillOption<T>[];
|
|
12
15
|
onChange: (value: T) => void;
|
|
13
16
|
};
|
|
14
|
-
|
|
17
|
+
type MultipleColumnFilterProps<T extends string> = ColumnFilterBase & {
|
|
18
|
+
/** Several values: tick rows, each tick filters at once, Reset clears them. */
|
|
19
|
+
multiple: true;
|
|
20
|
+
/** The picked values; empty means no filter. */
|
|
21
|
+
value: T[];
|
|
22
|
+
/** The values to pick from. No "All" row. */
|
|
23
|
+
options: FilterPillOption<T>[];
|
|
24
|
+
onChange: (value: T[]) => void;
|
|
25
|
+
/** A search field on top. `true` filters `options`; an object means the app searches. */
|
|
26
|
+
search?: true | FilterPillSearch;
|
|
27
|
+
searchPlaceholder?: string;
|
|
28
|
+
};
|
|
29
|
+
type ColumnFilterMenuProps<T extends string> = SingleColumnFilterProps<T> | MultipleColumnFilterProps<T>;
|
|
30
|
+
declare function ColumnFilterMenu<T extends string>(props: ColumnFilterMenuProps<T>): import("react").JSX.Element;
|
|
15
31
|
export { ColumnFilterMenu };
|
|
16
|
-
export type { ColumnFilterMenuProps };
|
|
32
|
+
export type { ColumnFilterMenuProps, MultipleColumnFilterProps, SingleColumnFilterProps };
|
|
@@ -2,13 +2,35 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Menu } from "@base-ui/react/menu";
|
|
5
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
5
6
|
import { ChevronDown } from "lucide-react";
|
|
6
|
-
import {
|
|
7
|
+
import { BottomSheet } from "@brdgapp/ui/components/bottom-sheet";
|
|
8
|
+
import { FilterMenuPopup, FilterSheet, MultiPanel, SheetReset, summarize, usePicked } from "@brdgapp/ui/components/filter-pill";
|
|
7
9
|
import { useIsMobile } from "@brdgapp/ui/hooks/use-is-mobile";
|
|
8
10
|
import { Tip } from "@brdgapp/ui/components/info-hint";
|
|
9
11
|
import { columnHeaderButton } from "@brdgapp/ui/components/column-sort-button";
|
|
10
12
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
11
|
-
function ColumnFilterMenu(
|
|
13
|
+
function ColumnFilterMenu(props) {
|
|
14
|
+
return props.multiple ? _jsx(MultipleColumnFilter, { ...props }) : _jsx(SingleColumnFilter, { ...props });
|
|
15
|
+
}
|
|
16
|
+
function MultipleColumnFilter({ multiple, icon: Icon, label, tooltip, value, options, onChange, search, searchPlaceholder, ...rest }) {
|
|
17
|
+
const [open, setOpen] = useState(false);
|
|
18
|
+
const mobile = useIsMobile();
|
|
19
|
+
const { picked, remember } = usePicked(value, options);
|
|
20
|
+
const active = value.length > 0;
|
|
21
|
+
const name = `Filter by ${label.toLowerCase()}${active ? `: ${summarize(picked.map((o) => o.label)).spoken}` : ""}`;
|
|
22
|
+
const triggerClass = cn(columnHeaderButton, active ? "text-[var(--primary)]" : "text-[var(--text-secondary)]");
|
|
23
|
+
const inner = (_jsxs(_Fragment, { children: [Icon ? _jsx(Icon, { "aria-hidden": "true", className: cn("size-3.5", active ? "text-[var(--primary)]" : "text-[var(--text-muted)]") }) : null, label, active ? _jsx("span", { "aria-hidden": "true", className: "size-1.5 rounded-full bg-[var(--primary)]" }) : null, _jsx(ChevronDown, { "aria-hidden": "true", className: cn("size-3.5 text-[var(--text-muted)] transition-transform", open && "rotate-180") })] }));
|
|
24
|
+
const panel = (phone) => (_jsx(MultiPanel, { value: value, options: options, onChange: onChange, name: label, search: search, searchPlaceholder: searchPlaceholder, picked: picked, remember: remember, phone: phone }));
|
|
25
|
+
if (mobile) {
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { ...rest, type: "button", "data-slot": "column-filter-menu", "data-multiple": multiple ? "" : undefined, "aria-haspopup": "dialog", "aria-label": name, className: triggerClass, onClick: (e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
setOpen(true);
|
|
29
|
+
}, children: inner }), _jsx(BottomSheet, { open: open, onClose: () => setOpen(false), title: label, action: _jsx(SheetReset, { show: active, onReset: () => onChange([]) }), children: panel(true) })] }));
|
|
30
|
+
}
|
|
31
|
+
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Tip, { text: tooltip, disabled: open, children: _jsx(PopoverPrimitive.Trigger, { ...rest, "data-slot": "column-filter-menu", "data-multiple": multiple ? "" : undefined, "aria-label": name, onClick: (e) => e.stopPropagation(), className: triggerClass, children: inner }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: "bottom", align: "start", sideOffset: 6, collisionPadding: 8, className: "z-[95]", children: _jsx(PopoverPrimitive.Popup, { "data-slot": "filter-menu", "aria-label": `Filter by ${label.toLowerCase()}`, className: "w-[260px] max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: panel(false) }) }) })] }));
|
|
32
|
+
}
|
|
33
|
+
function SingleColumnFilter({ multiple, icon: Icon, label, tooltip, value, options, onChange, ...rest }) {
|
|
12
34
|
const [open, setOpen] = useState(false);
|
|
13
35
|
const mobile = useIsMobile();
|
|
14
36
|
const active = options.length > 0 && value !== options[0]?.value;
|
|
@@ -18,13 +40,13 @@ function ColumnFilterMenu({ icon: Icon, label, tooltip, value, options, onChange
|
|
|
18
40
|
const inner = (_jsxs(_Fragment, { children: [Icon ? _jsx(Icon, { "aria-hidden": "true", className: cn("size-3.5", active ? "text-[var(--primary)]" : "text-[var(--text-muted)]") }) : null, label, active ? _jsx("span", { "aria-hidden": "true", className: "size-1.5 rounded-full bg-[var(--primary)]" }) : null, _jsx(ChevronDown, { "aria-hidden": "true", className: cn("size-3.5 text-[var(--text-muted)] transition-transform", open && "rotate-180") })] }));
|
|
19
41
|
// Phones: a bottom sheet instead of a menu. No tooltip: touch has no hover.
|
|
20
42
|
if (mobile) {
|
|
21
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { ...rest, type: "button", "data-slot": "column-filter-menu", "aria-haspopup": "dialog", "aria-label": name, className: triggerClass, onClick: (e) => {
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { ...rest, type: "button", "data-slot": "column-filter-menu", "data-multiple": multiple ? "" : undefined, "aria-haspopup": "dialog", "aria-label": name, className: triggerClass, onClick: (e) => {
|
|
22
44
|
// A header often sits in a clickable row; keep the click here.
|
|
23
45
|
e.stopPropagation();
|
|
24
46
|
setOpen(true);
|
|
25
47
|
}, children: inner }), _jsx(FilterSheet, { open: open, onClose: () => setOpen(false), title: label, value: value, options: options, onChange: onChange })] }));
|
|
26
48
|
}
|
|
27
|
-
return (_jsxs(Menu.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Tip, { text: tooltip, disabled: open, children: _jsx(Menu.Trigger, { ...rest, "data-slot": "column-filter-menu", "aria-label": name,
|
|
49
|
+
return (_jsxs(Menu.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Tip, { text: tooltip, disabled: open, children: _jsx(Menu.Trigger, { ...rest, "data-slot": "column-filter-menu", "data-multiple": multiple ? "" : undefined, "aria-label": name,
|
|
28
50
|
// A header often sits in a clickable row; keep the click here.
|
|
29
51
|
onClick: (e) => e.stopPropagation(), className: triggerClass, children: inner }) }), _jsx(FilterMenuPopup, { value: value, options: options, onChange: onChange, width: 220, align: "start" })] }));
|
|
30
52
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { type ElementProps } from "@brdgapp/ui/lib/utils";
|
|
2
|
-
type
|
|
2
|
+
type CopyFieldKind = "email" | "phone" | "link" | "code" | "text";
|
|
3
|
+
type CopyFieldProps = Omit<ElementProps<HTMLButtonElement>, "children"> & {
|
|
3
4
|
value: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** What the value is. `code` (keys, commands, snippets) and `link` are set in a fixed-width font in `box` and `block`. */
|
|
6
|
+
kind: CopyFieldKind;
|
|
7
|
+
/**
|
|
8
|
+
* `row`: a full-width contact row with a Copy hint on hover. `inline`: a compact meta item.
|
|
9
|
+
* `box`: one line in a grey box with a copy button at the end. `block`: several lines, with Copy in the corner.
|
|
10
|
+
*/
|
|
11
|
+
variant?: "row" | "inline" | "box" | "block";
|
|
12
|
+
/** What's copied, for the button's name: "server URL" makes it "Copy server URL". Defaults to the kind. */
|
|
13
|
+
label?: string;
|
|
7
14
|
/** Inline only: the stronger body colour, for a prominent identity line. */
|
|
8
15
|
strong?: boolean;
|
|
9
16
|
/** Inline only: text size. */
|
|
10
17
|
size?: 12 | 14;
|
|
11
|
-
/**
|
|
18
|
+
/** Row and inline: show the kind's icon. */
|
|
12
19
|
showIcon?: boolean;
|
|
13
20
|
className?: string;
|
|
14
21
|
};
|
|
15
|
-
declare function CopyField({ value, kind, variant, strong, size, showIcon, className, ...rest }: CopyFieldProps): import("react").JSX.Element;
|
|
22
|
+
declare function CopyField({ value, kind, variant, label, strong, size, showIcon, className, ...rest }: CopyFieldProps): import("react").JSX.Element;
|
|
16
23
|
export { CopyField };
|
|
17
|
-
export type { CopyFieldProps };
|
|
24
|
+
export type { CopyFieldKind, CopyFieldProps };
|
package/components/copy-field.js
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
3
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
5
|
-
import { Check, Copy, Mail, Phone } from "lucide-react";
|
|
4
|
+
import { Check, Copy, Link2, Mail, Phone, SquareCode } from "lucide-react";
|
|
5
|
+
import { Button } from "@brdgapp/ui/components/button";
|
|
6
|
+
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
7
|
+
import { useCopy } from "@brdgapp/ui/hooks/use-copy";
|
|
6
8
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return ()
|
|
14
|
-
}, [copied]);
|
|
15
|
-
async function copy() {
|
|
16
|
-
try {
|
|
17
|
-
await navigator.clipboard.writeText(value);
|
|
18
|
-
setCopied(true);
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// Clipboard blocked (permissions or an insecure page): nothing to undo.
|
|
22
|
-
}
|
|
9
|
+
const ICON = { email: Mail, phone: Phone, link: Link2, code: SquareCode, text: Copy };
|
|
10
|
+
const NOUN = { email: "email", phone: "phone number", link: "link", code: "code", text: "text" };
|
|
11
|
+
function CopyField({ value, kind, variant = "row", label, strong = false, size = 12, showIcon = true, className, ...rest }) {
|
|
12
|
+
const name = `Copy ${label ?? NOUN[kind]}`;
|
|
13
|
+
const fixed = kind === "code" || kind === "link";
|
|
14
|
+
if (variant === "box") {
|
|
15
|
+
return (_jsxs("div", { "data-slot": "copy-field", className: cn("flex h-11 min-w-0 items-center gap-2 rounded-lg border border-[var(--border-default)] bg-[var(--surface-secondary)] pr-1.5 pl-3.5 md:h-10", className), children: [_jsx("span", { className: cn("min-w-0 flex-1 truncate select-all text-[var(--text-primary)]", fixed ? "font-mono text-13" : "text-14"), children: value }), _jsx(IconButton, { ...rest, size: "sm", copy: value, "aria-label": name })] }));
|
|
23
16
|
}
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
if (variant === "block") {
|
|
18
|
+
// The button has its own column, so long code scrolls beside it, never under it.
|
|
19
|
+
return (_jsxs("div", { "data-slot": "copy-field", className: cn("flex min-w-0 items-start gap-2 rounded-lg border border-[var(--border-default)] bg-[var(--surface-secondary)]", className), children: [_jsx("pre", { className: cn("min-w-0 flex-1 py-3.5 pl-4 text-[var(--text-primary)]", kind === "code"
|
|
20
|
+
? "overflow-x-auto font-mono text-13 leading-[1.7] whitespace-pre"
|
|
21
|
+
: "font-sans text-14 leading-[1.625] break-words whitespace-pre-wrap"), children: value }), _jsx(Button, { ...rest, variant: "secondary", size: "xs", icon: _jsx(Copy, {}), copy: value, "aria-label": name, className: "mt-2.5 mr-2.5 shrink-0", children: "Copy" })] }));
|
|
22
|
+
}
|
|
23
|
+
return _jsx(CopyRow, { value: value, kind: kind, variant: variant, name: name, strong: strong, size: size, showIcon: showIcon, className: className, ...rest });
|
|
24
|
+
}
|
|
25
|
+
// The contact row and the inline meta item: the whole value is the button.
|
|
26
|
+
function CopyRow({ value, kind, variant, name, strong, size, showIcon, className, ...rest }) {
|
|
27
|
+
const { copied, copy } = useCopy();
|
|
28
|
+
const Icon = ICON[kind];
|
|
26
29
|
const announcement = (_jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? "Copied" : "" }));
|
|
27
30
|
if (variant === "inline") {
|
|
28
|
-
return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: copy, "aria-label": `${
|
|
31
|
+
return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: () => void copy(value), "aria-label": `${name}: ${value}`, className: cn(
|
|
29
32
|
// An outline with a 2px gap, so the ring clears the text without moving it (as on HoverCard).
|
|
30
33
|
"inline-flex min-w-0 items-center gap-1.5 rounded-sm outline-none transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]", size === 14 ? "text-14 leading-[1.625]" : "text-12 leading-[1.625]", strong
|
|
31
34
|
? "text-[var(--text-body)] hover:text-[var(--text-primary)]"
|
|
32
35
|
: "text-[var(--text-muted)] hover:text-[var(--text-secondary)]", className), children: [copied ? (_jsx(Check, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-[var(--success)]" })) : showIcon ? (_jsx(Icon, { "aria-hidden": "true", className: "size-3.5 shrink-0" })) : null, _jsx("span", { className: "truncate", children: copied ? "Copied" : value }), announcement] }));
|
|
33
36
|
}
|
|
34
|
-
return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: copy, "aria-label": `${
|
|
37
|
+
return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: () => void copy(value), "aria-label": `${name}: ${value}`, className: cn("group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left outline-none transition-colors", "hover:bg-[var(--surface-secondary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]", className), children: [_jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0 text-[var(--text-disabled)]" }), _jsx("span", { className: "min-w-0 flex-1 truncate text-13 leading-[1.625] text-[var(--text-body)] group-hover:text-[var(--text-primary)]", children: value }), _jsxs("span", { "aria-hidden": "true", className: cn("inline-flex shrink-0 items-center gap-1 text-12 leading-[1.625] font-semibold transition-opacity", copied
|
|
35
38
|
? "text-[var(--success-text)] opacity-100"
|
|
36
39
|
: "text-[var(--text-muted)] [@media(hover:hover)]:opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100"), children: [copied ? _jsx(Check, { className: "size-3.5" }) : _jsx(Copy, { className: "size-3.5" }), copied ? "Copied" : "Copy"] }), announcement] }));
|
|
37
40
|
}
|
|
@@ -78,7 +78,7 @@ declare function DataTable<T>({ columns, rows, rowKey, onRowClick, onRowPrefetch
|
|
|
78
78
|
declare function DataTableToolbar({ search, filters, actions, ...rest }: ElementProps<HTMLDivElement> & {
|
|
79
79
|
/** A SearchInput. It is 288px wide, the whole row on a phone. */
|
|
80
80
|
search?: React.ReactNode;
|
|
81
|
-
/** FilterPills, and
|
|
81
|
+
/** FilterPills, and one "Clear all" link (search and every filter) when any is on. */
|
|
82
82
|
filters?: React.ReactNode;
|
|
83
83
|
/** Buttons that act on the table: Export, Add people. Use Button `md`, the search's height. */
|
|
84
84
|
actions?: React.ReactNode;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** A date as "YYYY-MM-DD", the way the browser's date field and a database write it. */
|
|
3
|
+
type DateString = string;
|
|
4
|
+
/** A from–to range. Either end is `null` until it's picked. */
|
|
5
|
+
type DateRangeValue = {
|
|
6
|
+
start: DateString | null;
|
|
7
|
+
end: DateString | null;
|
|
8
|
+
};
|
|
9
|
+
/** A limit: "YYYY-MM-DD", or "today". */
|
|
10
|
+
type DateLimit = DateString | "today";
|
|
11
|
+
type CalendarSingleProps = {
|
|
12
|
+
range?: false;
|
|
13
|
+
/** The picked day, "YYYY-MM-DD". */
|
|
14
|
+
value?: DateString | null;
|
|
15
|
+
/** Called with the day that was picked. */
|
|
16
|
+
onValueChange?: (value: DateString) => void;
|
|
17
|
+
};
|
|
18
|
+
type CalendarRangeProps = {
|
|
19
|
+
/** Pick a start day, then an end day. */
|
|
20
|
+
range: true;
|
|
21
|
+
value?: DateRangeValue;
|
|
22
|
+
/** Called after each pick: first `{ start, end: null }`, then both. */
|
|
23
|
+
onValueChange?: (value: DateRangeValue) => void;
|
|
24
|
+
};
|
|
25
|
+
type CalendarProps = (CalendarSingleProps | CalendarRangeProps) & {
|
|
26
|
+
/** The earliest day that can be picked: "YYYY-MM-DD" or "today". */
|
|
27
|
+
min?: DateLimit;
|
|
28
|
+
/** The latest day that can be picked: "YYYY-MM-DD" or "today" (no future dates). */
|
|
29
|
+
max?: DateLimit;
|
|
30
|
+
/** Focus the picked day (or today) when it appears, as it does when DatePicker opens it. */
|
|
31
|
+
autoFocus?: boolean;
|
|
32
|
+
/** Layout only. */
|
|
33
|
+
className?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The calendar on its own, for a place that has no field: a table cell's popover. In a form, use
|
|
37
|
+
* DatePicker, which opens this from its calendar button. Weeks start on Monday.
|
|
38
|
+
*/
|
|
39
|
+
declare function Calendar(props: CalendarProps): React.JSX.Element;
|
|
40
|
+
type FieldBits = {
|
|
41
|
+
/** The earliest date allowed: "YYYY-MM-DD" or "today". Earlier days are greyed out, and a typed one is an error. */
|
|
42
|
+
min?: DateLimit;
|
|
43
|
+
/** The latest date allowed: "YYYY-MM-DD" or "today" (no future dates). */
|
|
44
|
+
max?: DateLimit;
|
|
45
|
+
/** Can't be typed in or opened. */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** Sends the value with a form as "YYYY-MM-DD". A range sends two: `name` + "Start" and `name` + "End". */
|
|
48
|
+
name?: string;
|
|
49
|
+
/** Only outside a Field. Inside one, the FieldLabel names it. */
|
|
50
|
+
"aria-label"?: string;
|
|
51
|
+
/** Layout only: `max-w-60`. */
|
|
52
|
+
className?: string;
|
|
53
|
+
};
|
|
54
|
+
type SingleDatePickerProps = FieldBits & {
|
|
55
|
+
range?: false;
|
|
56
|
+
/** The date, "YYYY-MM-DD", or `null` for none. */
|
|
57
|
+
value?: DateString | null;
|
|
58
|
+
defaultValue?: DateString | null;
|
|
59
|
+
/** Called with "YYYY-MM-DD" once a date is picked or typed (when the field is left or Enter is pressed), or `null` when it's emptied or can't be read. */
|
|
60
|
+
onValueChange?: (value: DateString | null) => void;
|
|
61
|
+
};
|
|
62
|
+
type RangeDatePickerProps = FieldBits & {
|
|
63
|
+
/** A from–to range: two dates in one box, one calendar. */
|
|
64
|
+
range: true;
|
|
65
|
+
value?: DateRangeValue;
|
|
66
|
+
defaultValue?: DateRangeValue;
|
|
67
|
+
/** Called with `{ start, end }`, each "YYYY-MM-DD" or `null`. */
|
|
68
|
+
onValueChange?: (value: DateRangeValue) => void;
|
|
69
|
+
};
|
|
70
|
+
type DatePickerProps = SingleDatePickerProps | RangeDatePickerProps;
|
|
71
|
+
/**
|
|
72
|
+
* A date field: type a date ("Mar 4", "3/4/2026", "today") or pick it from the calendar button at its
|
|
73
|
+
* end. `range` makes it a from–to pair in one box. Put it in a Field with a FieldLabel.
|
|
74
|
+
*/
|
|
75
|
+
declare function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
76
|
+
export { Calendar, DatePicker };
|
|
77
|
+
export type { CalendarProps, DateLimit, DatePickerProps, DateRangeValue, DateString, RangeDatePickerProps, SingleDatePickerProps };
|