@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,10 @@
|
|
|
1
|
+
export interface DirectionProviderProps {
|
|
2
|
+
/** Standard reading-direction prop. */
|
|
3
|
+
dir?: 'ltr' | 'rtl';
|
|
4
|
+
/** Reading direction supplied to direction-aware Meridian components. @default 'ltr' */
|
|
5
|
+
direction?: 'ltr' | 'rtl';
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare function DirectionProvider(props: DirectionProviderProps): React.JSX.Element;
|
|
10
|
+
export declare function useDirection(): 'ltr' | 'rtl';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const DirectionContext = /*#__PURE__*/React.createContext(undefined);
|
|
4
|
+
|
|
5
|
+
/** Supply reading direction to components whose keyboard behavior must mirror. */
|
|
6
|
+
export function DirectionProvider({
|
|
7
|
+
dir,
|
|
8
|
+
direction,
|
|
9
|
+
children
|
|
10
|
+
}) {
|
|
11
|
+
const requested = direction ?? dir ?? 'ltr';
|
|
12
|
+
const value = requested === 'rtl' ? 'rtl' : 'ltr';
|
|
13
|
+
return /*#__PURE__*/React.createElement(DirectionContext.Provider, {
|
|
14
|
+
value: value
|
|
15
|
+
}, children);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Read the nearest provider, falling back to the document direction. */
|
|
19
|
+
export function useDirection() {
|
|
20
|
+
const provided = React.useContext(DirectionContext);
|
|
21
|
+
if (provided) return provided;
|
|
22
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') return 'rtl';
|
|
23
|
+
return 'ltr';
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ItemVariant = 'default' | 'outline' | 'muted';
|
|
2
|
+
export type ItemSize = 'default' | 'sm' | 'xs';
|
|
3
|
+
export interface ItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
variant?: ItemVariant;
|
|
5
|
+
size?: ItemSize;
|
|
6
|
+
render?: React.ReactElement | ((props: React.HTMLAttributes<HTMLElement> & { ref?: React.Ref<HTMLElement> }) => React.ReactElement);
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ItemMediaProps extends React.HTMLAttributes<HTMLDivElement> { variant?: 'default' | 'icon' | 'image' }
|
|
10
|
+
export declare const Item: React.ForwardRefExoticComponent<ItemProps & React.RefAttributes<HTMLElement>>;
|
|
11
|
+
export declare const ItemGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const ItemSeparator: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const ItemMedia: React.ForwardRefExoticComponent<ItemMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const ItemContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const ItemTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export declare const ItemDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
17
|
+
export declare const ItemActions: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export declare const ItemHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export declare const ItemFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
package/display/Item.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
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 } from "../forms/Button.js";
|
|
5
|
+
import { Separator } from "./Separator.js";
|
|
6
|
+
function classes(...values) {
|
|
7
|
+
return values.filter(Boolean).join(' ');
|
|
8
|
+
}
|
|
9
|
+
function renderRoot({
|
|
10
|
+
render,
|
|
11
|
+
asChild,
|
|
12
|
+
children,
|
|
13
|
+
rootProps,
|
|
14
|
+
ref
|
|
15
|
+
}) {
|
|
16
|
+
const candidate = render || (asChild ? React.Children.only(children) : null);
|
|
17
|
+
if (typeof candidate === 'function') return candidate({
|
|
18
|
+
...rootProps,
|
|
19
|
+
ref
|
|
20
|
+
});
|
|
21
|
+
if (/*#__PURE__*/React.isValidElement(candidate)) {
|
|
22
|
+
return /*#__PURE__*/React.cloneElement(candidate, {
|
|
23
|
+
...rootProps,
|
|
24
|
+
...candidate.props,
|
|
25
|
+
className: classes(rootProps.className, candidate.props.className),
|
|
26
|
+
ref: mergeRefs(ref, candidate.ref),
|
|
27
|
+
children: candidate.props.children ?? children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rootProps, {
|
|
31
|
+
ref: ref
|
|
32
|
+
}), children);
|
|
33
|
+
}
|
|
34
|
+
export const ItemGroup = /*#__PURE__*/React.forwardRef(function ItemGroup({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}, ref) {
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
39
|
+
ref: ref,
|
|
40
|
+
role: "list",
|
|
41
|
+
"data-slot": "item-group",
|
|
42
|
+
className: classes('ef-item-group', className)
|
|
43
|
+
}, props));
|
|
44
|
+
});
|
|
45
|
+
export const ItemSeparator = /*#__PURE__*/React.forwardRef(function ItemSeparator({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}, ref) {
|
|
49
|
+
return /*#__PURE__*/React.createElement(Separator, _extends({
|
|
50
|
+
ref: ref,
|
|
51
|
+
"data-slot": "item-separator",
|
|
52
|
+
orientation: "horizontal",
|
|
53
|
+
className: classes('ef-item-separator', className)
|
|
54
|
+
}, props));
|
|
55
|
+
});
|
|
56
|
+
export const Item = /*#__PURE__*/React.forwardRef(function Item({
|
|
57
|
+
variant = 'default',
|
|
58
|
+
size = 'default',
|
|
59
|
+
render,
|
|
60
|
+
asChild = false,
|
|
61
|
+
className,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}, ref) {
|
|
65
|
+
const rootProps = {
|
|
66
|
+
...props,
|
|
67
|
+
'data-slot': 'item',
|
|
68
|
+
'data-variant': variant,
|
|
69
|
+
'data-size': size,
|
|
70
|
+
className: classes('ef-item', className),
|
|
71
|
+
children
|
|
72
|
+
};
|
|
73
|
+
return renderRoot({
|
|
74
|
+
render,
|
|
75
|
+
asChild,
|
|
76
|
+
children,
|
|
77
|
+
rootProps,
|
|
78
|
+
ref
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
export const ItemMedia = /*#__PURE__*/React.forwardRef(function ItemMedia({
|
|
82
|
+
variant = 'default',
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}, ref) {
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
87
|
+
ref: ref,
|
|
88
|
+
"data-slot": "item-media",
|
|
89
|
+
"data-variant": variant,
|
|
90
|
+
className: classes('ef-item__media', className)
|
|
91
|
+
}, props));
|
|
92
|
+
});
|
|
93
|
+
export const ItemContent = /*#__PURE__*/React.forwardRef(function ItemContent({
|
|
94
|
+
className,
|
|
95
|
+
...props
|
|
96
|
+
}, ref) {
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
98
|
+
ref: ref,
|
|
99
|
+
"data-slot": "item-content",
|
|
100
|
+
className: classes('ef-item__content', className)
|
|
101
|
+
}, props));
|
|
102
|
+
});
|
|
103
|
+
export const ItemTitle = /*#__PURE__*/React.forwardRef(function ItemTitle({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}, ref) {
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
108
|
+
ref: ref,
|
|
109
|
+
"data-slot": "item-title",
|
|
110
|
+
className: classes('ef-item__title', className)
|
|
111
|
+
}, props));
|
|
112
|
+
});
|
|
113
|
+
export const ItemDescription = /*#__PURE__*/React.forwardRef(function ItemDescription({
|
|
114
|
+
className,
|
|
115
|
+
...props
|
|
116
|
+
}, ref) {
|
|
117
|
+
return /*#__PURE__*/React.createElement("p", _extends({
|
|
118
|
+
ref: ref,
|
|
119
|
+
"data-slot": "item-description",
|
|
120
|
+
className: classes('ef-item__description', className)
|
|
121
|
+
}, props));
|
|
122
|
+
});
|
|
123
|
+
export const ItemActions = /*#__PURE__*/React.forwardRef(function ItemActions({
|
|
124
|
+
className,
|
|
125
|
+
...props
|
|
126
|
+
}, ref) {
|
|
127
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
128
|
+
ref: ref,
|
|
129
|
+
"data-slot": "item-actions",
|
|
130
|
+
className: classes('ef-item__actions', className)
|
|
131
|
+
}, props));
|
|
132
|
+
});
|
|
133
|
+
export const ItemHeader = /*#__PURE__*/React.forwardRef(function ItemHeader({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}, ref) {
|
|
137
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
138
|
+
ref: ref,
|
|
139
|
+
"data-slot": "item-header",
|
|
140
|
+
className: classes('ef-item__header', className)
|
|
141
|
+
}, props));
|
|
142
|
+
});
|
|
143
|
+
export const ItemFooter = /*#__PURE__*/React.forwardRef(function ItemFooter({
|
|
144
|
+
className,
|
|
145
|
+
...props
|
|
146
|
+
}, ref) {
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
148
|
+
ref: ref,
|
|
149
|
+
"data-slot": "item-footer",
|
|
150
|
+
className: classes('ef-item__footer', className)
|
|
151
|
+
}, props));
|
|
152
|
+
});
|
package/display/Kbd.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare function Kbd(props: KbdProps): React.JSX.Element;
|
|
1
|
+
export type KbdProps = React.HTMLAttributes<HTMLElement>;
|
|
2
|
+
export type KbdGroupProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
3
|
+
|
|
4
|
+
export declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
|
|
5
|
+
export declare const KbdGroup: React.ForwardRefExoticComponent<KbdGroupProps & React.RefAttributes<HTMLSpanElement>>;
|
package/display/Kbd.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
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
|
-
|
|
4
|
+
function joinClasses(base, className) {
|
|
5
|
+
return `${base}${className ? ' ' + className : ''}`;
|
|
6
|
+
}
|
|
7
|
+
export const Kbd = /*#__PURE__*/React.forwardRef(function Kbd({
|
|
7
8
|
className,
|
|
8
|
-
...
|
|
9
|
-
}) {
|
|
10
|
-
return /*#__PURE__*/React.createElement("kbd", _extends({},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
9
|
+
...props
|
|
10
|
+
}, ref) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("kbd", _extends({}, props, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
"data-slot": "kbd",
|
|
14
|
+
className: joinClasses('ef-kbd', className)
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
export const KbdGroup = /*#__PURE__*/React.forwardRef(function KbdGroup({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}, ref) {
|
|
21
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
"data-slot": "kbd-group",
|
|
24
|
+
className: joinClasses('ef-kbd-group', className)
|
|
25
|
+
}));
|
|
26
|
+
});
|
package/display/Link.js
CHANGED
|
@@ -3,10 +3,8 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Icon } from "../icons/Icon.js";
|
|
5
5
|
|
|
6
|
-
// Hover deepens the link's own hue
|
|
7
|
-
//
|
|
8
|
-
// hover reads as broken, not emphasised. The underline stays: colour alone is
|
|
9
|
-
// not a safe affordance (WCAG 1.4.1).
|
|
6
|
+
// Hover deepens the link's own hue without changing text decoration. Link
|
|
7
|
+
// identity stays stable across pointer, keyboard, and touch interaction.
|
|
10
8
|
|
|
11
9
|
export function Link({
|
|
12
10
|
href = '#',
|
package/display/Resizable.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
min?: number;
|
|
8
|
-
/** @default 0.85 */
|
|
9
|
-
max?: number;
|
|
10
|
-
onRatioChange?: (ratio: number) => void;
|
|
11
|
-
/** Exactly two panes */
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function Resizable(props: ResizableProps): React.JSX.Element;
|
|
1
|
+
export interface ResizablePanelGroupProps extends React.HTMLAttributes<HTMLDivElement> { orientation?: 'horizontal' | 'vertical'; direction?: 'ltr' | 'rtl'; onLayoutChange?: (sizes: number[]) => void; }
|
|
2
|
+
export interface ResizablePanelProps extends React.HTMLAttributes<HTMLDivElement> { defaultSize?: number | string; minSize?: number | string; maxSize?: number | string; }
|
|
3
|
+
export interface ResizableHandleProps extends React.HTMLAttributes<HTMLDivElement> { withHandle?: boolean; disabled?: boolean; }
|
|
4
|
+
export declare const ResizablePanelGroup: React.ForwardRefExoticComponent<ResizablePanelGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export declare const ResizablePanel: React.ForwardRefExoticComponent<ResizablePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const ResizableHandle: React.ForwardRefExoticComponent<ResizableHandleProps & React.RefAttributes<HTMLDivElement>>;
|
package/display/Resizable.js
CHANGED
|
@@ -2,76 +2,159 @@
|
|
|
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 { cssPct } from "../forms/Button.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { useDirection } from "./Direction.js";
|
|
6
|
+
const ResizableCtx = /*#__PURE__*/React.createContext(null);
|
|
7
|
+
function sizeNumber(value, fallback) {
|
|
8
|
+
const parsed = typeof value === 'string' ? Number.parseFloat(value) : Number(value);
|
|
9
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
10
|
+
}
|
|
11
|
+
function initialPanelSizes(panels) {
|
|
12
|
+
const declared = panels.map(panel => panel.props.defaultSize == null ? null : sizeNumber(panel.props.defaultSize, null));
|
|
13
|
+
const knownTotal = declared.reduce((sum, value) => sum + (value ?? 0), 0);
|
|
14
|
+
const missing = declared.filter(value => value == null).length;
|
|
15
|
+
const fill = missing ? Math.max(0, 100 - knownTotal) / missing : 0;
|
|
16
|
+
const values = declared.map(value => value ?? fill);
|
|
17
|
+
const total = values.reduce((sum, value) => sum + value, 0) || 100;
|
|
18
|
+
return values.map(value => value / total * 100);
|
|
19
|
+
}
|
|
20
|
+
export const ResizablePanelGroup = /*#__PURE__*/React.forwardRef(function ResizablePanelGroup({
|
|
21
|
+
orientation = 'horizontal',
|
|
22
|
+
direction,
|
|
23
|
+
onLayoutChange,
|
|
11
24
|
children,
|
|
12
|
-
style,
|
|
13
25
|
className,
|
|
14
|
-
...
|
|
15
|
-
}) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
26
|
+
...props
|
|
27
|
+
}, ref) {
|
|
28
|
+
const readingDirection = useDirection();
|
|
29
|
+
const nodes = React.Children.toArray(children);
|
|
30
|
+
const panels = nodes.filter(child => /*#__PURE__*/React.isValidElement(child) && child.type === ResizablePanel);
|
|
31
|
+
const [sizes, setSizes] = React.useState(() => initialPanelSizes(panels));
|
|
32
|
+
const updatePair = React.useCallback((index, delta) => {
|
|
33
|
+
setSizes(current => {
|
|
34
|
+
const next = [...current];
|
|
35
|
+
const before = panels[index]?.props || {};
|
|
36
|
+
const after = panels[index + 1]?.props || {};
|
|
37
|
+
const combined = next[index] + next[index + 1];
|
|
38
|
+
const minBefore = sizeNumber(before.minSize, 0);
|
|
39
|
+
const maxBefore = sizeNumber(before.maxSize, combined);
|
|
40
|
+
const minAfter = sizeNumber(after.minSize, 0);
|
|
41
|
+
const maxAfter = sizeNumber(after.maxSize, combined);
|
|
42
|
+
const proposed = Math.max(minBefore, Math.min(maxBefore, next[index] + delta));
|
|
43
|
+
const bounded = Math.max(combined - maxAfter, Math.min(combined - minAfter, proposed));
|
|
44
|
+
next[index] = bounded;
|
|
45
|
+
next[index + 1] = combined - bounded;
|
|
46
|
+
onLayoutChange?.(next);
|
|
47
|
+
return next;
|
|
48
|
+
});
|
|
49
|
+
}, [onLayoutChange, panels]);
|
|
50
|
+
let panelIndex = 0;
|
|
51
|
+
let handleIndex = 0;
|
|
52
|
+
const value = React.useMemo(() => ({
|
|
53
|
+
orientation,
|
|
54
|
+
direction: direction || readingDirection,
|
|
55
|
+
sizes,
|
|
56
|
+
updatePair
|
|
57
|
+
}), [orientation, direction, readingDirection, sizes, updatePair]);
|
|
58
|
+
return /*#__PURE__*/React.createElement(ResizableCtx.Provider, {
|
|
59
|
+
value: value
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
61
|
+
ref: ref,
|
|
62
|
+
"data-slot": "resizable-panel-group",
|
|
63
|
+
"data-orientation": orientation,
|
|
64
|
+
"aria-orientation": orientation,
|
|
65
|
+
className: `ef-resizable${className ? ' ' + className : ''}`
|
|
66
|
+
}), nodes.map((child, index) => {
|
|
67
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
68
|
+
if (child.type === ResizablePanel) return /*#__PURE__*/React.cloneElement(child, {
|
|
69
|
+
key: child.key ?? index,
|
|
70
|
+
_panelIndex: panelIndex++
|
|
71
|
+
});
|
|
72
|
+
if (child.type === ResizableHandle) return /*#__PURE__*/React.cloneElement(child, {
|
|
73
|
+
key: child.key ?? index,
|
|
74
|
+
_handleIndex: handleIndex++
|
|
75
|
+
});
|
|
76
|
+
return child;
|
|
77
|
+
})));
|
|
78
|
+
});
|
|
79
|
+
export const ResizablePanel = /*#__PURE__*/React.forwardRef(function ResizablePanel({
|
|
80
|
+
_panelIndex = 0,
|
|
81
|
+
defaultSize,
|
|
82
|
+
minSize,
|
|
83
|
+
maxSize,
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}, ref) {
|
|
87
|
+
const ctx = React.useContext(ResizableCtx);
|
|
88
|
+
const size = ctx?.sizes[_panelIndex] ?? sizeNumber(defaultSize, 50);
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
90
|
+
ref: ref,
|
|
91
|
+
"data-slot": "resizable-panel",
|
|
92
|
+
"data-panel-index": _panelIndex,
|
|
93
|
+
className: `ef-resizable__pane${className ? ' ' + className : ''}`,
|
|
94
|
+
style: {
|
|
95
|
+
flexBasis: cssPct(size),
|
|
96
|
+
flexGrow: 0,
|
|
97
|
+
flexShrink: 0,
|
|
98
|
+
...props.style
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
export const ResizableHandle = /*#__PURE__*/React.forwardRef(function ResizableHandle({
|
|
103
|
+
_handleIndex = 0,
|
|
104
|
+
withHandle = false,
|
|
105
|
+
disabled = false,
|
|
106
|
+
className,
|
|
107
|
+
...props
|
|
108
|
+
}, ref) {
|
|
109
|
+
const ctx = React.useContext(ResizableCtx);
|
|
110
|
+
const [active, setActive] = React.useState(false);
|
|
111
|
+
const down = event => {
|
|
112
|
+
props.onPointerDown?.(event);
|
|
113
|
+
if (event.defaultPrevented || disabled || !ctx) return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
setActive(true);
|
|
116
|
+
const root = event.currentTarget.parentElement;
|
|
117
|
+
let previous = ctx.orientation === 'horizontal' ? event.clientX : event.clientY;
|
|
118
|
+
const dimension = ctx.orientation === 'horizontal' ? root.clientWidth : root.clientHeight;
|
|
119
|
+
const move = nextEvent => {
|
|
120
|
+
const current = ctx.orientation === 'horizontal' ? nextEvent.clientX : nextEvent.clientY;
|
|
121
|
+
let delta = (current - previous) / Math.max(1, dimension) * 100;
|
|
122
|
+
previous = current;
|
|
123
|
+
if (ctx.orientation === 'horizontal' && ctx.direction === 'rtl') delta *= -1;
|
|
124
|
+
ctx.updatePair(_handleIndex, delta);
|
|
31
125
|
};
|
|
32
126
|
const up = () => {
|
|
33
|
-
|
|
127
|
+
setActive(false);
|
|
34
128
|
window.removeEventListener('pointermove', move);
|
|
35
129
|
window.removeEventListener('pointerup', up);
|
|
36
130
|
};
|
|
37
131
|
window.addEventListener('pointermove', move);
|
|
38
132
|
window.addEventListener('pointerup', up);
|
|
39
133
|
};
|
|
40
|
-
const key =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
apply(ratio + d);
|
|
134
|
+
const key = event => {
|
|
135
|
+
props.onKeyDown?.(event);
|
|
136
|
+
if (event.defaultPrevented || disabled || !ctx) return;
|
|
137
|
+
const horizontal = ctx.orientation === 'horizontal';
|
|
138
|
+
const rtl = ctx.direction === 'rtl';
|
|
139
|
+
const delta = event.key === (horizontal ? 'ArrowLeft' : 'ArrowUp') ? horizontal && rtl ? 2 : -2 : event.key === (horizontal ? 'ArrowRight' : 'ArrowDown') ? horizontal && rtl ? -2 : 2 : null;
|
|
140
|
+
if (delta == null) return;
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
ctx.updatePair(_handleIndex, delta);
|
|
50
143
|
};
|
|
51
|
-
|
|
52
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
144
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
53
145
|
ref: ref,
|
|
54
|
-
className: `ef-resizable ef-resizable--${direction}${className ? ' ' + className : ''}`,
|
|
55
|
-
style: style
|
|
56
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
57
|
-
className: "ef-resizable__pane",
|
|
58
|
-
style: {
|
|
59
|
-
flexBasis: cssPct(ratio * 100),
|
|
60
|
-
flexGrow: 0,
|
|
61
|
-
flexShrink: 0
|
|
62
|
-
}
|
|
63
|
-
}, kids[0]), /*#__PURE__*/React.createElement("button", {
|
|
64
|
-
type: "button",
|
|
65
146
|
role: "separator",
|
|
66
|
-
|
|
67
|
-
"aria-label":
|
|
68
|
-
|
|
147
|
+
tabIndex: disabled ? undefined : 0,
|
|
148
|
+
"aria-label": props['aria-label'] || 'Resize panes',
|
|
149
|
+
"aria-disabled": disabled || undefined,
|
|
150
|
+
"aria-orientation": ctx?.orientation === 'horizontal' ? 'vertical' : 'horizontal',
|
|
151
|
+
"data-slot": "resizable-handle",
|
|
152
|
+
"data-resize-handle-active": active ? '' : undefined,
|
|
153
|
+
className: `ef-resizable__handle${className ? ' ' + className : ''}`,
|
|
69
154
|
onPointerDown: down,
|
|
70
155
|
onKeyDown: key
|
|
71
|
-
}), /*#__PURE__*/React.createElement("
|
|
72
|
-
className: "ef-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, kids[1]));
|
|
77
|
-
}
|
|
156
|
+
}), withHandle ? /*#__PURE__*/React.createElement("span", {
|
|
157
|
+
className: "ef-resizable__grip",
|
|
158
|
+
"aria-hidden": "true"
|
|
159
|
+
}) : null);
|
|
160
|
+
});
|
package/display/ScrollArea.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
height?: number | string;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export interface ScrollBarProps extends React.HTMLAttributes<HTMLSpanElement> { orientation?: 'horizontal' | 'vertical'; }
|
|
9
|
+
export declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const ScrollBar: React.ForwardRefExoticComponent<ScrollBarProps & React.RefAttributes<HTMLSpanElement>>;
|
package/display/ScrollArea.js
CHANGED
|
@@ -1,20 +1,45 @@
|
|
|
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
|
-
export function ScrollArea({
|
|
4
|
+
export const ScrollArea = /*#__PURE__*/React.forwardRef(function ScrollArea({
|
|
5
5
|
maxHeight,
|
|
6
6
|
height,
|
|
7
7
|
children,
|
|
8
8
|
style,
|
|
9
9
|
className,
|
|
10
10
|
...rest
|
|
11
|
-
}) {
|
|
12
|
-
|
|
11
|
+
}, ref) {
|
|
12
|
+
const nodes = React.Children.toArray(children);
|
|
13
|
+
const bars = nodes.filter(child => /*#__PURE__*/React.isValidElement(child) && child.type === ScrollBar);
|
|
14
|
+
const content = nodes.filter(child => !(/*#__PURE__*/React.isValidElement(child) && child.type === ScrollBar));
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
16
|
+
ref: ref,
|
|
17
|
+
"data-slot": "scroll-area",
|
|
13
18
|
className: `ef-scrollarea${className ? ' ' + className : ''}`,
|
|
14
19
|
style: {
|
|
15
20
|
maxHeight,
|
|
16
21
|
height,
|
|
17
22
|
...style
|
|
18
23
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
24
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
"data-slot": "scroll-area-viewport",
|
|
26
|
+
className: "ef-scrollarea__viewport",
|
|
27
|
+
style: {
|
|
28
|
+
maxHeight,
|
|
29
|
+
height
|
|
30
|
+
}
|
|
31
|
+
}, content), bars);
|
|
32
|
+
});
|
|
33
|
+
export const ScrollBar = /*#__PURE__*/React.forwardRef(function ScrollBar({
|
|
34
|
+
orientation = 'vertical',
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}, ref) {
|
|
38
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
39
|
+
ref: ref,
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
"data-slot": "scroll-area-scrollbar",
|
|
42
|
+
"data-orientation": orientation,
|
|
43
|
+
className: `ef-scrollarea__bar${className ? ' ' + className : ''}`
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/** Axis of the dividing rule. @default 'horizontal' */
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
/** Remove separator semantics when the rule is only visual. @default true */
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Separator: React.ForwardRefExoticComponent<
|
|
8
|
+
SeparatorProps & React.RefAttributes<HTMLDivElement>
|
|
9
|
+
>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export const Separator = /*#__PURE__*/React.forwardRef(function Separator({
|
|
5
|
+
orientation = 'horizontal',
|
|
6
|
+
decorative = true,
|
|
7
|
+
className,
|
|
8
|
+
...rest
|
|
9
|
+
}, ref) {
|
|
10
|
+
const axis = orientation === 'vertical' ? 'vertical' : 'horizontal';
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
role: decorative ? 'none' : 'separator',
|
|
14
|
+
"aria-orientation": !decorative && axis === 'vertical' ? 'vertical' : undefined,
|
|
15
|
+
"data-orientation": axis,
|
|
16
|
+
className: `ef-separator${className ? ` ${className}` : ''}`
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type TimelineTone = 'neutral' | 'success' | 'warning' | 'danger';
|
|
2
|
+
|
|
3
|
+
export interface TimelineItem {
|
|
4
|
+
id?: React.Key;
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
/** Human-readable time shown in the UI. */
|
|
8
|
+
time?: React.ReactNode;
|
|
9
|
+
/** Machine-readable ISO date/time passed to the native time element. */
|
|
10
|
+
dateTime?: string;
|
|
11
|
+
actor?: React.ReactNode;
|
|
12
|
+
meta?: React.ReactNode;
|
|
13
|
+
tone?: TimelineTone;
|
|
14
|
+
/** Lucide icon name. Defaults from tone. */
|
|
15
|
+
icon?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TimelineProps extends Omit<React.OlHTMLAttributes<HTMLOListElement>, 'children'> {
|
|
19
|
+
items: TimelineItem[];
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare function Timeline(props: TimelineProps): React.JSX.Element;
|
|
24
|
+
|