@efolusi/meridian 1.20.0 → 1.21.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 +1 -1
- package/ai/Bubble.d.ts +16 -0
- package/ai/Bubble.js +71 -0
- package/ai/ChatMessage.js +2 -5
- package/ai/Confirmation.d.ts +0 -7
- package/ai/Confirmation.js +3 -6
- package/ai/GeneratedImage.d.ts +0 -2
- package/ai/GeneratedImage.js +2 -4
- package/ai/Marker.d.ts +26 -0
- package/ai/Marker.js +67 -0
- package/ai/Message.d.ts +13 -0
- package/ai/Message.js +68 -0
- package/ai/MessageScroller.d.ts +21 -0
- package/ai/MessageScroller.js +283 -0
- package/ai/ModelSelector.d.ts +2 -2
- package/ai/ModelSelector.js +1 -2
- package/ai/Player.js +1 -1
- package/ai/PromptSteps.js +4 -2
- package/ai/Sandbox.d.ts +0 -2
- package/ai/Sandbox.js +2 -4
- package/ai/Suggestions.d.ts +0 -2
- package/ai/Suggestions.js +1 -4
- package/ai/WebPreview.d.ts +0 -2
- package/ai/WebPreview.js +2 -4
- package/code/Console.js +1 -1
- package/code/EnvList.d.ts +0 -2
- package/code/EnvList.js +2 -3
- package/components.css +652 -418
- package/data/BarChart.d.ts +0 -2
- package/data/BarChart.js +1 -4
- package/data/Chart.d.ts +14 -0
- package/data/Chart.js +149 -0
- package/data/EmptyState.d.ts +8 -13
- package/data/EmptyState.js +62 -24
- package/data/LineChart.js +7 -4
- package/data/Skeleton.d.ts +2 -11
- package/data/Skeleton.js +8 -38
- package/data/Sparkline.js +4 -1
- package/data/StatusDot.d.ts +0 -4
- package/data/StatusDot.js +3 -6
- package/data/Table.d.ts +11 -4
- package/data/Table.js +39 -7
- package/dates/Calendar.d.ts +10 -27
- package/dates/Calendar.js +250 -184
- package/dates/TimePicker.js +2 -2
- package/display/Accordion.d.ts +47 -15
- package/display/Accordion.js +257 -27
- package/display/AspectRatio.d.ts +4 -6
- package/display/AspectRatio.js +7 -5
- package/display/Avatar.d.ts +17 -14
- package/display/Avatar.js +68 -43
- package/display/Badge.d.ts +9 -8
- package/display/Badge.js +32 -14
- package/display/Card.d.ts +11 -13
- package/display/Card.js +74 -29
- package/display/Carousel.d.ts +23 -15
- package/display/Carousel.js +217 -66
- package/display/Collapsible.d.ts +19 -9
- package/display/Collapsible.js +140 -28
- package/display/Direction.d.ts +10 -0
- package/display/Direction.js +24 -0
- package/display/Item.d.ts +19 -0
- package/display/Item.js +152 -0
- package/display/Kbd.d.ts +5 -7
- package/display/Kbd.js +22 -10
- package/display/Link.js +2 -4
- package/display/Resizable.d.ts +6 -16
- package/display/Resizable.js +141 -58
- package/display/ScrollArea.d.ts +3 -1
- package/display/ScrollArea.js +30 -5
- package/display/Separator.d.ts +9 -0
- package/display/Separator.js +18 -0
- package/display/Timeline.d.ts +24 -0
- package/display/Timeline.js +51 -0
- package/display/Toolbar.js +5 -4
- package/display/TreeList.d.ts +0 -2
- package/display/TreeList.js +2 -5
- package/feedback/Alert.d.ts +13 -13
- package/feedback/Alert.js +40 -36
- package/feedback/AlertDialog.d.ts +30 -0
- package/feedback/AlertDialog.js +249 -0
- package/feedback/Banner.d.ts +1 -3
- package/feedback/Banner.js +1 -5
- package/feedback/ConfirmDialog.d.ts +1 -1
- package/feedback/ConfirmDialog.js +18 -20
- package/feedback/Dialog.d.ts +13 -16
- package/feedback/Dialog.js +204 -62
- package/feedback/Progress.d.ts +8 -9
- package/feedback/Progress.js +42 -24
- package/feedback/Sonner.d.ts +8 -0
- package/feedback/Sonner.js +238 -0
- package/feedback/Spinner.d.ts +2 -9
- package/feedback/Spinner.js +19 -28
- package/feedback/Tooltip.d.ts +9 -10
- package/feedback/Tooltip.js +147 -96
- package/files/Attachment.d.ts +27 -0
- package/files/Attachment.js +111 -0
- package/files/FileDrop.js +3 -1
- package/finance/PaymentCard.js +3 -3
- package/forms/Button.d.ts +6 -5
- package/forms/Button.js +22 -8
- package/forms/ButtonGroup.d.ts +11 -3
- package/forms/ButtonGroup.js +57 -6
- package/forms/Checkbox.d.ts +14 -3
- package/forms/Checkbox.js +84 -16
- package/forms/Combobox.d.ts +24 -16
- package/forms/Combobox.js +466 -135
- package/forms/Field.d.ts +14 -0
- package/forms/Field.js +99 -0
- package/forms/IconButton.d.ts +1 -1
- package/forms/IconButton.js +4 -3
- package/forms/Input.d.ts +8 -8
- package/forms/Input.js +46 -33
- package/forms/InputGroup.d.ts +8 -15
- package/forms/InputGroup.js +74 -35
- package/forms/InputOTP.d.ts +13 -0
- package/forms/InputOTP.js +125 -0
- package/forms/Label.d.ts +2 -6
- package/forms/Label.js +6 -4
- package/forms/NativeSelect.d.ts +16 -0
- package/forms/NativeSelect.js +35 -0
- package/forms/NumberInput.js +2 -2
- package/forms/Radio.d.ts +12 -1
- package/forms/Radio.js +76 -6
- package/forms/Select.d.ts +12 -9
- package/forms/Select.js +254 -42
- package/forms/Slider.d.ts +10 -17
- package/forms/Slider.js +78 -39
- package/forms/Switch.d.ts +8 -2
- package/forms/Switch.js +46 -15
- package/forms/Textarea.d.ts +1 -1
- package/forms/Textarea.js +26 -18
- package/forms/Toggle.d.ts +18 -15
- package/forms/Toggle.js +96 -42
- package/icons/_svg.js +2 -0
- package/index.d.ts +20 -8
- package/index.js +50 -38
- package/navigation/Breadcrumbs.d.ts +18 -11
- package/navigation/Breadcrumbs.js +99 -26
- package/navigation/Menubar.d.ts +52 -10
- package/navigation/Menubar.js +191 -146
- package/navigation/NavigationMenu.d.ts +15 -0
- package/navigation/NavigationMenu.js +296 -0
- package/navigation/Pagination.d.ts +10 -9
- package/navigation/Pagination.js +94 -51
- package/navigation/SideNav.js +4 -3
- package/navigation/Sidebar.d.ts +29 -0
- package/navigation/Sidebar.js +311 -0
- package/navigation/Tabs.d.ts +9 -5
- package/navigation/Tabs.js +132 -44
- package/overlay/Command.d.ts +32 -0
- package/overlay/Command.js +257 -0
- package/overlay/ContextMenu.d.ts +40 -8
- package/overlay/ContextMenu.js +468 -107
- package/overlay/Drawer.d.ts +29 -14
- package/overlay/Drawer.js +178 -80
- package/overlay/DropdownMenu.d.ts +43 -0
- package/overlay/DropdownMenu.js +502 -0
- package/overlay/HoverCard.d.ts +21 -12
- package/overlay/HoverCard.js +129 -61
- package/overlay/Popover.d.ts +11 -13
- package/overlay/Popover.js +138 -65
- package/overlay/Portal.js +21 -7
- package/overlay/Sheet.d.ts +11 -0
- package/overlay/Sheet.js +62 -0
- package/package.json +4 -1
- package/tokens/base.css +1 -1
- package/dates/DatePicker.d.ts +0 -14
- package/dates/DatePicker.js +0 -111
- package/dates/DateRangePicker.d.ts +0 -23
- package/dates/DateRangePicker.js +0 -150
- package/display/ListItem.d.ts +0 -19
- package/display/ListItem.js +0 -50
- package/feedback/Toast.d.ts +0 -78
- package/feedback/Toast.js +0 -192
- package/forms/DigitEntry.d.ts +0 -15
- package/forms/DigitEntry.js +0 -79
- package/forms/FormField.d.ts +0 -82
- package/forms/FormField.js +0 -209
- package/overlay/CommandPalette.d.ts +0 -21
- package/overlay/CommandPalette.js +0 -148
- package/overlay/Menu.d.ts +0 -24
- package/overlay/Menu.js +0 -139
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Icon } from "../icons/Icon.js";
|
|
5
|
+
const TONE_ICONS = {
|
|
6
|
+
success: 'check',
|
|
7
|
+
warning: 'triangle-alert',
|
|
8
|
+
danger: 'x'
|
|
9
|
+
};
|
|
10
|
+
export function Timeline({
|
|
11
|
+
items = [],
|
|
12
|
+
compact = false,
|
|
13
|
+
style,
|
|
14
|
+
className,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
return /*#__PURE__*/React.createElement("ol", _extends({}, rest, {
|
|
18
|
+
className: `ef-timeline${compact ? ' ef-timeline--compact' : ''}${className ? ' ' + className : ''}`,
|
|
19
|
+
style: style
|
|
20
|
+
}), items.map((item, index) => {
|
|
21
|
+
const tone = ['success', 'warning', 'danger'].includes(item.tone) ? item.tone : 'neutral';
|
|
22
|
+
const icon = item.icon || TONE_ICONS[tone] || 'circle';
|
|
23
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
24
|
+
key: item.id ?? index,
|
|
25
|
+
className: `ef-timeline__item ef-timeline__item--${tone}`
|
|
26
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "ef-timeline__rail",
|
|
28
|
+
"aria-hidden": "true"
|
|
29
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
className: "ef-timeline__marker"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
32
|
+
name: icon,
|
|
33
|
+
size: 13
|
|
34
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
className: "ef-timeline__line"
|
|
36
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "ef-timeline__content"
|
|
38
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "ef-timeline__head"
|
|
40
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: "ef-timeline__title"
|
|
42
|
+
}, item.title), item.time ? /*#__PURE__*/React.createElement("time", {
|
|
43
|
+
className: "ef-timeline__time",
|
|
44
|
+
dateTime: item.dateTime
|
|
45
|
+
}, item.time) : null), item.description ? /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "ef-timeline__desc"
|
|
47
|
+
}, item.description) : null, item.actor || item.meta ? /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "ef-timeline__meta"
|
|
49
|
+
}, item.actor, item.actor && item.meta ? ' · ' : null, item.meta) : null));
|
|
50
|
+
}));
|
|
51
|
+
}
|
package/display/Toolbar.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Icon } from "../icons/Icon.js";
|
|
5
|
-
import { Tooltip } from "../feedback/Tooltip.js";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../feedback/Tooltip.js";
|
|
6
6
|
export function Toolbar({
|
|
7
7
|
items,
|
|
8
8
|
value,
|
|
@@ -37,8 +37,9 @@ export function Toolbar({
|
|
|
37
37
|
size: 15
|
|
38
38
|
}) : null, it.label || null);
|
|
39
39
|
return it.tip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
40
|
-
key: it.id
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
key: it.id
|
|
41
|
+
}, /*#__PURE__*/React.createElement(TooltipTrigger, {
|
|
42
|
+
asChild: true
|
|
43
|
+
}, btn), /*#__PURE__*/React.createElement(TooltipContent, null, it.tip)) : btn;
|
|
43
44
|
}));
|
|
44
45
|
}
|
package/display/TreeList.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export interface TreeListProps {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
/** Fires with the clicked row's id and node */
|
|
15
15
|
onChange?: (id: string, node: TreeNode) => void;
|
|
16
|
-
/** @deprecated Use `onChange`. Alias kept for one major; `onChange` wins when both are passed. */
|
|
17
|
-
onSelect?: (id: string, node: TreeNode) => void;
|
|
18
16
|
/** Branch ids open initially (default: all top-level) */
|
|
19
17
|
defaultOpen?: string[];
|
|
20
18
|
style?: React.CSSProperties;
|
package/display/TreeList.js
CHANGED
|
@@ -15,7 +15,7 @@ function Node({
|
|
|
15
15
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
16
16
|
className: `ef-tree__row${sel === node.id ? ' ef-tree__row--sel' : ''}`,
|
|
17
17
|
style: {
|
|
18
|
-
|
|
18
|
+
paddingInlineStart: 8 + depth * 18
|
|
19
19
|
},
|
|
20
20
|
onClick: () => {
|
|
21
21
|
if (kids.length) toggle(node.id);
|
|
@@ -58,21 +58,18 @@ export function TreeList({
|
|
|
58
58
|
nodes,
|
|
59
59
|
value,
|
|
60
60
|
onChange,
|
|
61
|
-
onSelect,
|
|
62
61
|
defaultOpen,
|
|
63
62
|
style,
|
|
64
63
|
className,
|
|
65
64
|
...rest
|
|
66
65
|
}) {
|
|
67
|
-
// onSelect is the deprecated alias; onChange (state-carrying selection) wins when both are passed.
|
|
68
|
-
const fire = onChange ?? onSelect;
|
|
69
66
|
const [open, setOpen] = React.useState(defaultOpen || nodes.filter(n => n.children).map(n => n.id));
|
|
70
67
|
const [innerSel, setInnerSel] = React.useState(null);
|
|
71
68
|
const sel = value != null ? value : innerSel;
|
|
72
69
|
const toggle = id => setOpen(o => o.includes(id) ? o.filter(x => x !== id) : [...o, id]);
|
|
73
70
|
const select = (id, node) => {
|
|
74
71
|
if (value == null) setInnerSel(id);
|
|
75
|
-
|
|
72
|
+
onChange?.(id, node);
|
|
76
73
|
};
|
|
77
74
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
78
75
|
role: "tree",
|
package/feedback/Alert.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
icon?: string;
|
|
6
|
-
title?: React.ReactNode;
|
|
7
|
-
description?: React.ReactNode;
|
|
8
|
-
/** Right-aligned slot (button/link) */
|
|
9
|
-
action?: React.ReactNode;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
style?: React.CSSProperties;
|
|
12
|
-
className?: string;
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
variant?: 'default' | 'destructive';
|
|
13
5
|
}
|
|
14
|
-
|
|
6
|
+
|
|
7
|
+
export type AlertTitleProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
|
+
export type AlertDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
export type AlertActionProps = React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
|
|
11
|
+
export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const AlertTitle: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const AlertDescription: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const AlertAction: React.ForwardRefExoticComponent<AlertActionProps & React.RefAttributes<HTMLDivElement>>;
|
package/feedback/Alert.js
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
info: 'info',
|
|
7
|
-
success: 'circle-check',
|
|
8
|
-
warning: 'triangle-alert',
|
|
9
|
-
danger: 'circle-alert'
|
|
10
|
-
};
|
|
11
|
-
export function Alert({
|
|
12
|
-
tone = 'info',
|
|
13
|
-
icon,
|
|
14
|
-
title,
|
|
15
|
-
description,
|
|
16
|
-
action,
|
|
4
|
+
export const Alert = /*#__PURE__*/React.forwardRef(function Alert({
|
|
5
|
+
variant = 'default',
|
|
17
6
|
children,
|
|
18
|
-
style,
|
|
19
7
|
className,
|
|
20
8
|
...rest
|
|
21
|
-
}) {
|
|
9
|
+
}, ref) {
|
|
10
|
+
const classes = ['ef-alert', `ef-alert--${variant}`, className || ''].filter(Boolean).join(' ');
|
|
22
11
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
12
|
+
ref: ref,
|
|
13
|
+
"data-slot": "alert",
|
|
14
|
+
role: "alert",
|
|
15
|
+
className: classes
|
|
16
|
+
}), children);
|
|
17
|
+
});
|
|
18
|
+
export const AlertTitle = /*#__PURE__*/React.forwardRef(function AlertTitle({
|
|
19
|
+
className,
|
|
20
|
+
...rest
|
|
21
|
+
}, ref) {
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
23
|
+
ref: ref,
|
|
24
|
+
"data-slot": "alert-title",
|
|
25
|
+
className: `ef-alert__title${className ? ' ' + className : ''}`
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
export const AlertDescription = /*#__PURE__*/React.forwardRef(function AlertDescription({
|
|
29
|
+
className,
|
|
30
|
+
...rest
|
|
31
|
+
}, ref) {
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
"data-slot": "alert-description",
|
|
35
|
+
className: `ef-alert__description${className ? ' ' + className : ''}`
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
export const AlertAction = /*#__PURE__*/React.forwardRef(function AlertAction({
|
|
39
|
+
className,
|
|
40
|
+
...rest
|
|
41
|
+
}, ref) {
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
43
|
+
ref: ref,
|
|
44
|
+
"data-slot": "alert-action",
|
|
45
|
+
className: `ef-alert__action${className ? ' ' + className : ''}`
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { ButtonProps } from '../forms/Button.jsx';
|
|
3
|
+
|
|
4
|
+
export interface AlertDialogProps {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface AlertDialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { asChild?: boolean; }
|
|
10
|
+
export interface AlertDialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
size?: 'default' | 'sm';
|
|
12
|
+
forceMount?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AlertDialogPortalProps { forceMount?: boolean; container?: HTMLElement | null; children?: React.ReactNode; }
|
|
15
|
+
export interface AlertDialogOverlayProps extends React.HTMLAttributes<HTMLDivElement> { forceMount?: boolean; }
|
|
16
|
+
export interface AlertDialogActionProps extends ButtonProps { asChild?: boolean; }
|
|
17
|
+
export interface AlertDialogCancelProps extends ButtonProps { asChild?: boolean; }
|
|
18
|
+
|
|
19
|
+
export declare function AlertDialog(props: AlertDialogProps): React.JSX.Element;
|
|
20
|
+
export declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
export declare function AlertDialogPortal(props: AlertDialogPortalProps): React.JSX.Element | null;
|
|
22
|
+
export declare const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export declare const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export declare const AlertDialogHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export declare const AlertDialogFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export declare const AlertDialogMedia: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export declare const AlertDialogTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
28
|
+
export declare const AlertDialogDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
29
|
+
export declare const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
export declare const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { mergeRefs, buttonVariants } from "../forms/Button.js";
|
|
5
|
+
import { Portal } from "../overlay/Portal.js";
|
|
6
|
+
const AlertDialogContext = /*#__PURE__*/React.createContext(null);
|
|
7
|
+
const FOCUSABLE = 'button:not([disabled]),[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
8
|
+
function useAlertDialog(part) {
|
|
9
|
+
const value = React.useContext(AlertDialogContext);
|
|
10
|
+
if (!value) throw new Error(`${part} must be used inside AlertDialog`);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function composeEventHandlers(theirs, ours) {
|
|
14
|
+
return event => {
|
|
15
|
+
if (theirs) theirs(event);
|
|
16
|
+
if (!event.defaultPrevented) ours(event);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function renderSlot(asChild, children, props, ref) {
|
|
20
|
+
if (!asChild) return /*#__PURE__*/React.createElement(props.as, {
|
|
21
|
+
...props,
|
|
22
|
+
as: undefined,
|
|
23
|
+
ref
|
|
24
|
+
}, children);
|
|
25
|
+
const child = React.Children.only(children);
|
|
26
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
27
|
+
...props,
|
|
28
|
+
as: undefined,
|
|
29
|
+
className: [props.className, child.props.className].filter(Boolean).join(' '),
|
|
30
|
+
onClick: composeEventHandlers(child.props.onClick, props.onClick || (() => {})),
|
|
31
|
+
ref: mergeRefs(ref, child.ref)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function AlertDialog({
|
|
35
|
+
open,
|
|
36
|
+
defaultOpen = false,
|
|
37
|
+
onOpenChange,
|
|
38
|
+
children
|
|
39
|
+
}) {
|
|
40
|
+
const controlled = open !== undefined;
|
|
41
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
42
|
+
const isOpen = controlled ? open : internalOpen;
|
|
43
|
+
const triggerRef = React.useRef(null);
|
|
44
|
+
const titleId = React.useId();
|
|
45
|
+
const descriptionId = React.useId();
|
|
46
|
+
const setOpen = React.useCallback(next => {
|
|
47
|
+
if (!controlled) setInternalOpen(next);
|
|
48
|
+
if (onOpenChange) onOpenChange(next);
|
|
49
|
+
}, [controlled, onOpenChange]);
|
|
50
|
+
const value = React.useMemo(() => ({
|
|
51
|
+
open: isOpen,
|
|
52
|
+
setOpen,
|
|
53
|
+
triggerRef,
|
|
54
|
+
titleId,
|
|
55
|
+
descriptionId
|
|
56
|
+
}), [isOpen, setOpen, titleId, descriptionId]);
|
|
57
|
+
return /*#__PURE__*/React.createElement(AlertDialogContext.Provider, {
|
|
58
|
+
value: value
|
|
59
|
+
}, children);
|
|
60
|
+
}
|
|
61
|
+
export const AlertDialogTrigger = /*#__PURE__*/React.forwardRef(function AlertDialogTrigger({
|
|
62
|
+
asChild = false,
|
|
63
|
+
children,
|
|
64
|
+
onClick,
|
|
65
|
+
...rest
|
|
66
|
+
}, ref) {
|
|
67
|
+
const ctx = useAlertDialog('AlertDialogTrigger');
|
|
68
|
+
const props = {
|
|
69
|
+
...rest,
|
|
70
|
+
as: 'button',
|
|
71
|
+
type: asChild ? undefined : rest.type || 'button',
|
|
72
|
+
'data-slot': 'alert-dialog-trigger',
|
|
73
|
+
'aria-haspopup': 'alertdialog',
|
|
74
|
+
'aria-expanded': ctx.open,
|
|
75
|
+
onClick: composeEventHandlers(onClick, () => ctx.setOpen(true))
|
|
76
|
+
};
|
|
77
|
+
return renderSlot(asChild, children, props, mergeRefs(ref, ctx.triggerRef));
|
|
78
|
+
});
|
|
79
|
+
export function AlertDialogPortal({
|
|
80
|
+
forceMount = false,
|
|
81
|
+
container,
|
|
82
|
+
children
|
|
83
|
+
}) {
|
|
84
|
+
const ctx = useAlertDialog('AlertDialogPortal');
|
|
85
|
+
if (!ctx.open && !forceMount) return null;
|
|
86
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
|
87
|
+
container: container
|
|
88
|
+
}, children);
|
|
89
|
+
}
|
|
90
|
+
export const AlertDialogOverlay = /*#__PURE__*/React.forwardRef(function AlertDialogOverlay({
|
|
91
|
+
forceMount = false,
|
|
92
|
+
className,
|
|
93
|
+
...rest
|
|
94
|
+
}, ref) {
|
|
95
|
+
const ctx = useAlertDialog('AlertDialogOverlay');
|
|
96
|
+
if (!ctx.open && !forceMount) return null;
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
98
|
+
ref: ref,
|
|
99
|
+
className: `ef-alertdialog__overlay${className ? ' ' + className : ''}`,
|
|
100
|
+
"data-slot": "alert-dialog-overlay",
|
|
101
|
+
"data-state": ctx.open ? 'open' : 'closed'
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
export const AlertDialogContent = /*#__PURE__*/React.forwardRef(function AlertDialogContent({
|
|
105
|
+
size = 'default',
|
|
106
|
+
forceMount = false,
|
|
107
|
+
children,
|
|
108
|
+
className,
|
|
109
|
+
onKeyDown,
|
|
110
|
+
...rest
|
|
111
|
+
}, ref) {
|
|
112
|
+
const ctx = useAlertDialog('AlertDialogContent');
|
|
113
|
+
const panelRef = React.useRef(null);
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
if (!ctx.open) return;
|
|
116
|
+
const previousOverflow = document.body.style.overflow;
|
|
117
|
+
document.body.style.overflow = 'hidden';
|
|
118
|
+
const panel = panelRef.current;
|
|
119
|
+
const preferred = panel && (panel.querySelector('[data-slot="alert-dialog-cancel"]') || panel.querySelector(FOCUSABLE));
|
|
120
|
+
(preferred || panel)?.focus();
|
|
121
|
+
return () => {
|
|
122
|
+
document.body.style.overflow = previousOverflow;
|
|
123
|
+
ctx.triggerRef.current?.focus?.();
|
|
124
|
+
};
|
|
125
|
+
}, [ctx.open, ctx.triggerRef]);
|
|
126
|
+
if (!ctx.open && !forceMount) return null;
|
|
127
|
+
const handleKeyDown = event => {
|
|
128
|
+
if (onKeyDown) onKeyDown(event);
|
|
129
|
+
if (event.defaultPrevented) return;
|
|
130
|
+
if (event.key === 'Escape') {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
ctx.setOpen(false);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (event.key !== 'Tab') return;
|
|
136
|
+
const focusable = Array.from(panelRef.current?.querySelectorAll(FOCUSABLE) || []);
|
|
137
|
+
if (!focusable.length) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const index = focusable.indexOf(document.activeElement);
|
|
142
|
+
if (event.shiftKey && index <= 0) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
focusable[focusable.length - 1].focus();
|
|
145
|
+
} else if (!event.shiftKey && (index < 0 || index === focusable.length - 1)) {
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
focusable[0].focus();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return /*#__PURE__*/React.createElement(AlertDialogPortal, {
|
|
151
|
+
forceMount: forceMount
|
|
152
|
+
}, /*#__PURE__*/React.createElement(AlertDialogOverlay, {
|
|
153
|
+
forceMount: forceMount
|
|
154
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
155
|
+
ref: mergeRefs(ref, panelRef),
|
|
156
|
+
role: "alertdialog",
|
|
157
|
+
"aria-modal": "true",
|
|
158
|
+
"aria-labelledby": ctx.titleId,
|
|
159
|
+
"aria-describedby": ctx.descriptionId,
|
|
160
|
+
tabIndex: -1,
|
|
161
|
+
"data-slot": "alert-dialog-content",
|
|
162
|
+
"data-state": ctx.open ? 'open' : 'closed',
|
|
163
|
+
"data-size": size,
|
|
164
|
+
className: `ef-alertdialog__content ef-alertdialog__content--${size}${className ? ' ' + className : ''}`,
|
|
165
|
+
onKeyDown: handleKeyDown
|
|
166
|
+
}), children)));
|
|
167
|
+
});
|
|
168
|
+
export const AlertDialogHeader = /*#__PURE__*/React.forwardRef(function AlertDialogHeader({
|
|
169
|
+
className,
|
|
170
|
+
...rest
|
|
171
|
+
}, ref) {
|
|
172
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
173
|
+
ref: ref,
|
|
174
|
+
"data-slot": "alert-dialog-header",
|
|
175
|
+
className: `ef-alertdialog__header${className ? ' ' + className : ''}`
|
|
176
|
+
}));
|
|
177
|
+
});
|
|
178
|
+
export const AlertDialogFooter = /*#__PURE__*/React.forwardRef(function AlertDialogFooter({
|
|
179
|
+
className,
|
|
180
|
+
...rest
|
|
181
|
+
}, ref) {
|
|
182
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
183
|
+
ref: ref,
|
|
184
|
+
"data-slot": "alert-dialog-footer",
|
|
185
|
+
className: `ef-alertdialog__footer${className ? ' ' + className : ''}`
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
export const AlertDialogMedia = /*#__PURE__*/React.forwardRef(function AlertDialogMedia({
|
|
189
|
+
className,
|
|
190
|
+
...rest
|
|
191
|
+
}, ref) {
|
|
192
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
193
|
+
ref: ref,
|
|
194
|
+
"data-slot": "alert-dialog-media",
|
|
195
|
+
className: `ef-alertdialog__media${className ? ' ' + className : ''}`
|
|
196
|
+
}));
|
|
197
|
+
});
|
|
198
|
+
export const AlertDialogTitle = /*#__PURE__*/React.forwardRef(function AlertDialogTitle({
|
|
199
|
+
className,
|
|
200
|
+
...rest
|
|
201
|
+
}, ref) {
|
|
202
|
+
const ctx = useAlertDialog('AlertDialogTitle');
|
|
203
|
+
return /*#__PURE__*/React.createElement("h2", _extends({}, rest, {
|
|
204
|
+
ref: ref,
|
|
205
|
+
id: rest.id || ctx.titleId,
|
|
206
|
+
"data-slot": "alert-dialog-title",
|
|
207
|
+
className: `ef-alertdialog__title${className ? ' ' + className : ''}`
|
|
208
|
+
}));
|
|
209
|
+
});
|
|
210
|
+
export const AlertDialogDescription = /*#__PURE__*/React.forwardRef(function AlertDialogDescription({
|
|
211
|
+
className,
|
|
212
|
+
...rest
|
|
213
|
+
}, ref) {
|
|
214
|
+
const ctx = useAlertDialog('AlertDialogDescription');
|
|
215
|
+
return /*#__PURE__*/React.createElement("p", _extends({}, rest, {
|
|
216
|
+
ref: ref,
|
|
217
|
+
id: rest.id || ctx.descriptionId,
|
|
218
|
+
"data-slot": "alert-dialog-description",
|
|
219
|
+
className: `ef-alertdialog__description${className ? ' ' + className : ''}`
|
|
220
|
+
}));
|
|
221
|
+
});
|
|
222
|
+
function createAction(name, slot, variant, closes) {
|
|
223
|
+
return /*#__PURE__*/React.forwardRef(function AlertDialogButton({
|
|
224
|
+
asChild = false,
|
|
225
|
+
children,
|
|
226
|
+
className,
|
|
227
|
+
onClick,
|
|
228
|
+
variant: selectedVariant = variant,
|
|
229
|
+
size = 'default',
|
|
230
|
+
...rest
|
|
231
|
+
}, ref) {
|
|
232
|
+
const ctx = useAlertDialog(name);
|
|
233
|
+
const props = {
|
|
234
|
+
...rest,
|
|
235
|
+
as: 'button',
|
|
236
|
+
type: asChild ? undefined : rest.type || 'button',
|
|
237
|
+
'data-slot': slot,
|
|
238
|
+
className: asChild ? className : buttonVariants({
|
|
239
|
+
variant: selectedVariant,
|
|
240
|
+
size,
|
|
241
|
+
className
|
|
242
|
+
}),
|
|
243
|
+
onClick: composeEventHandlers(onClick, () => closes && ctx.setOpen(false))
|
|
244
|
+
};
|
|
245
|
+
return renderSlot(asChild, children, props, ref);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
export const AlertDialogCancel = createAction('AlertDialogCancel', 'alert-dialog-cancel', 'outline', true);
|
|
249
|
+
export const AlertDialogAction = createAction('AlertDialogAction', 'alert-dialog-action', 'default', true);
|
package/feedback/Banner.d.ts
CHANGED
|
@@ -3,10 +3,8 @@ export interface BannerProps {
|
|
|
3
3
|
tone?: 'neutral' | 'brand' | 'warning' | 'danger';
|
|
4
4
|
/** Lucide icon name */
|
|
5
5
|
icon?: string;
|
|
6
|
-
/** Action slot
|
|
6
|
+
/** Action slot, rendered as-is. */
|
|
7
7
|
action?: React.ReactNode;
|
|
8
|
-
/** @deprecated pass a node to `action` instead */
|
|
9
|
-
onAction?: () => void;
|
|
10
8
|
/** Shows a dismiss ✕ */
|
|
11
9
|
onDismiss?: () => void;
|
|
12
10
|
children?: React.ReactNode;
|
package/feedback/Banner.js
CHANGED
|
@@ -7,7 +7,6 @@ export function Banner({
|
|
|
7
7
|
tone = 'neutral',
|
|
8
8
|
icon,
|
|
9
9
|
action,
|
|
10
|
-
onAction,
|
|
11
10
|
onDismiss,
|
|
12
11
|
children,
|
|
13
12
|
style,
|
|
@@ -25,10 +24,7 @@ export function Banner({
|
|
|
25
24
|
size: 15
|
|
26
25
|
})) : null, /*#__PURE__*/React.createElement("span", {
|
|
27
26
|
className: "ef-banner__text"
|
|
28
|
-
}, children), action
|
|
29
|
-
className: "ef-banner__action",
|
|
30
|
-
onClick: onAction
|
|
31
|
-
}, action) : null, onDismiss ? /*#__PURE__*/React.createElement(IconButton, {
|
|
27
|
+
}, children), action || null, onDismiss ? /*#__PURE__*/React.createElement(IconButton, {
|
|
32
28
|
icon: "x",
|
|
33
29
|
label: "Dismiss",
|
|
34
30
|
size: "sm",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { Dialog } from "./Dialog.js";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "./Dialog.js";
|
|
5
4
|
import { Button } from "../forms/Button.js";
|
|
6
5
|
import { Input } from "../forms/Input.js";
|
|
7
6
|
export function ConfirmDialog({
|
|
8
7
|
open,
|
|
9
|
-
|
|
8
|
+
onOpenChange,
|
|
10
9
|
onConfirm,
|
|
11
10
|
title,
|
|
12
11
|
description,
|
|
@@ -22,23 +21,12 @@ export function ConfirmDialog({
|
|
|
22
21
|
if (!open) setTyped('');
|
|
23
22
|
}, [open]);
|
|
24
23
|
const blocked = typeToConfirm ? typed !== typeToConfirm : false;
|
|
25
|
-
return /*#__PURE__*/React.createElement(Dialog,
|
|
24
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
26
25
|
open: open,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
variant: "ghost",
|
|
32
|
-
onClick: onClose
|
|
33
|
-
}, cancelLabel), /*#__PURE__*/React.createElement(Button, {
|
|
34
|
-
variant: tone === 'danger' ? 'danger' : 'primary',
|
|
35
|
-
disabled: blocked,
|
|
36
|
-
onClick: () => {
|
|
37
|
-
if (onConfirm) onConfirm();
|
|
38
|
-
if (onClose) onClose();
|
|
39
|
-
}
|
|
40
|
-
}, confirmLabel))
|
|
41
|
-
}), children, typeToConfirm ? /*#__PURE__*/React.createElement(Input, {
|
|
26
|
+
onOpenChange: onOpenChange
|
|
27
|
+
}, /*#__PURE__*/React.createElement(DialogContent, rest, /*#__PURE__*/React.createElement(DialogHeader, null, /*#__PURE__*/React.createElement(DialogTitle, null, title), description ? /*#__PURE__*/React.createElement(DialogDescription, null, description) : null), /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "ef-dialog__body"
|
|
29
|
+
}, children, typeToConfirm ? /*#__PURE__*/React.createElement(Input, {
|
|
42
30
|
label: `Type “${typeToConfirm}” to confirm`,
|
|
43
31
|
value: typed,
|
|
44
32
|
onChange: e => setTyped(e.target.value),
|
|
@@ -46,5 +34,15 @@ export function ConfirmDialog({
|
|
|
46
34
|
style: children ? {
|
|
47
35
|
marginTop: 14
|
|
48
36
|
} : undefined
|
|
49
|
-
}) : null)
|
|
37
|
+
}) : null), /*#__PURE__*/React.createElement(DialogFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
onClick: () => onOpenChange?.(false)
|
|
40
|
+
}, cancelLabel), /*#__PURE__*/React.createElement(Button, {
|
|
41
|
+
variant: tone === 'danger' ? 'danger' : 'primary',
|
|
42
|
+
disabled: blocked,
|
|
43
|
+
onClick: () => {
|
|
44
|
+
onConfirm?.();
|
|
45
|
+
onOpenChange?.(false);
|
|
46
|
+
}
|
|
47
|
+
}, confirmLabel))));
|
|
50
48
|
}
|
package/feedback/Dialog.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
1
|
+
export interface DialogRootProps { open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void; children?: React.ReactNode; }
|
|
2
|
+
export declare function Dialog(props: DialogRootProps): React.JSX.Element;
|
|
3
|
+
export interface DialogSlotProps extends React.HTMLAttributes<HTMLDivElement> { asChild?: boolean; slot?: string; }
|
|
4
|
+
export declare const DialogTrigger: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean; slot?: string } & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare function DialogPortal(props: { children?: React.ReactNode; container?: HTMLElement }): React.JSX.Element | null;
|
|
6
|
+
export declare const DialogOverlay: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & { slot?: string } & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const DialogClose: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean; slot?: string } & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export interface DialogContentProps extends React.HTMLAttributes<HTMLDivElement> { width?: number | string; showCloseButton?: boolean; closeLabel?: string; onEscapeKeyDown?: (event: KeyboardEvent) => void; slot?: string; }
|
|
9
|
+
export declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const DialogHeader: React.ForwardRefExoticComponent<DialogSlotProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const DialogFooter: React.ForwardRefExoticComponent<DialogSlotProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const DialogTitle: React.ForwardRefExoticComponent<DialogSlotProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const DialogDescription: React.ForwardRefExoticComponent<DialogSlotProps & React.RefAttributes<HTMLDivElement>>;
|