@efolusi/meridian 1.20.0 → 1.21.1
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
package/feedback/Spinner.js
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
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
|
-
export function Spinner({
|
|
6
|
-
size = 16,
|
|
7
|
-
label,
|
|
8
|
-
style,
|
|
4
|
+
export const Spinner = /*#__PURE__*/React.forwardRef(function Spinner({
|
|
9
5
|
className,
|
|
10
|
-
...
|
|
11
|
-
}) {
|
|
12
|
-
return /*#__PURE__*/React.createElement("
|
|
6
|
+
...props
|
|
7
|
+
}, ref) {
|
|
8
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
9
|
+
ref: ref,
|
|
13
10
|
role: "status",
|
|
14
|
-
"aria-label":
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className:
|
|
24
|
-
}, /*#__PURE__*/React.createElement(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
style: {
|
|
29
|
-
fontSize: 'var(--text-sm)',
|
|
30
|
-
color: 'var(--text-muted)'
|
|
31
|
-
}
|
|
32
|
-
}, label) : null);
|
|
33
|
-
}
|
|
11
|
+
"aria-label": "Loading",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: "2",
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
width: "16",
|
|
19
|
+
height: "16",
|
|
20
|
+
className: `ef-spinner${className ? ' ' + className : ''}`
|
|
21
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M21 12a9 9 0 1 1-6.219-8.56"
|
|
23
|
+
}));
|
|
24
|
+
});
|
package/feedback/Tooltip.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
export interface TooltipProviderProps { delayDuration?: number; skipDelayDuration?: number; disableHoverableContent?: boolean; children?: React.ReactNode; }
|
|
1
2
|
export interface TooltipProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** @deprecated Use `side`. Alias kept for one major; `side` wins when both are passed. */
|
|
6
|
-
position?: 'top' | 'bottom';
|
|
7
|
-
/** Hover delay in ms before showing. Focus always shows immediately. @default 200 */
|
|
8
|
-
delay?: number;
|
|
9
|
-
/** The trigger element */
|
|
3
|
+
delayDuration?: number;
|
|
4
|
+
disableHoverableContent?: boolean;
|
|
5
|
+
open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void;
|
|
10
6
|
children?: React.ReactNode;
|
|
11
|
-
style?: React.CSSProperties;
|
|
12
|
-
className?: string;
|
|
13
7
|
}
|
|
8
|
+
export interface TooltipTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { asChild?: boolean; }
|
|
9
|
+
export interface TooltipContentProps extends React.HTMLAttributes<HTMLSpanElement> { side?: 'top' | 'bottom' | 'left' | 'right'; sideOffset?: number; }
|
|
14
10
|
export declare function Tooltip(props: TooltipProps): React.JSX.Element;
|
|
11
|
+
export declare function TooltipProvider(props: TooltipProviderProps): React.JSX.Element;
|
|
12
|
+
export declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<HTMLElement>>;
|
|
13
|
+
export declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLSpanElement>>;
|
package/feedback/Tooltip.js
CHANGED
|
@@ -1,31 +1,128 @@
|
|
|
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
|
-
import { useIsoLayoutEffect } from "../forms/Button.js";
|
|
4
|
+
import { mergeRefs, useIsoLayoutEffect } from "../forms/Button.js";
|
|
5
5
|
import { Portal } from "../overlay/Portal.js";
|
|
6
6
|
const SIDES = ['top', 'bottom', 'left', 'right'];
|
|
7
|
+
const TooltipProviderCtx = /*#__PURE__*/React.createContext({
|
|
8
|
+
delayDuration: 0,
|
|
9
|
+
skipDelayDuration: 300,
|
|
10
|
+
disableHoverableContent: false
|
|
11
|
+
});
|
|
12
|
+
const TooltipCtx = /*#__PURE__*/React.createContext(null);
|
|
13
|
+
function compose(theirs, ours) {
|
|
14
|
+
return event => {
|
|
15
|
+
theirs?.(event);
|
|
16
|
+
if (!event.defaultPrevented) ours?.(event);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
7
19
|
export function Tooltip({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
delayDuration,
|
|
21
|
+
disableHoverableContent,
|
|
22
|
+
open: controlled,
|
|
23
|
+
defaultOpen = false,
|
|
24
|
+
onOpenChange,
|
|
25
|
+
children
|
|
26
|
+
}) {
|
|
27
|
+
const provider = React.useContext(TooltipProviderCtx);
|
|
28
|
+
const [inner, setInner] = React.useState(defaultOpen);
|
|
29
|
+
const open = controlled !== undefined ? controlled : inner;
|
|
30
|
+
const triggerRef = React.useRef(null);
|
|
31
|
+
const timerRef = React.useRef(null);
|
|
32
|
+
const contentId = React.useId();
|
|
33
|
+
const setOpen = React.useCallback(next => {
|
|
34
|
+
if (controlled === undefined) setInner(next);
|
|
35
|
+
onOpenChange?.(next);
|
|
36
|
+
}, [controlled, onOpenChange]);
|
|
37
|
+
const show = React.useCallback(immediate => {
|
|
38
|
+
clearTimeout(timerRef.current);
|
|
39
|
+
const wait = delayDuration ?? provider.delayDuration;
|
|
40
|
+
if (immediate || wait <= 0) setOpen(true);else timerRef.current = setTimeout(() => setOpen(true), wait);
|
|
41
|
+
}, [delayDuration, provider.delayDuration, setOpen]);
|
|
42
|
+
const hide = React.useCallback(() => {
|
|
43
|
+
clearTimeout(timerRef.current);
|
|
44
|
+
setOpen(false);
|
|
45
|
+
}, [setOpen]);
|
|
46
|
+
React.useEffect(() => () => clearTimeout(timerRef.current), []);
|
|
47
|
+
const value = React.useMemo(() => ({
|
|
48
|
+
open,
|
|
49
|
+
show,
|
|
50
|
+
hide,
|
|
51
|
+
triggerRef,
|
|
52
|
+
contentId,
|
|
53
|
+
disableHoverableContent: disableHoverableContent ?? provider.disableHoverableContent
|
|
54
|
+
}), [open, show, hide, contentId, disableHoverableContent, provider.disableHoverableContent]);
|
|
55
|
+
return /*#__PURE__*/React.createElement(TooltipCtx.Provider, {
|
|
56
|
+
value: value
|
|
57
|
+
}, children);
|
|
58
|
+
}
|
|
59
|
+
export function TooltipProvider({
|
|
60
|
+
delayDuration = 0,
|
|
61
|
+
skipDelayDuration = 300,
|
|
62
|
+
disableHoverableContent = false,
|
|
63
|
+
children
|
|
64
|
+
}) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(TooltipProviderCtx.Provider, {
|
|
66
|
+
value: {
|
|
67
|
+
delayDuration,
|
|
68
|
+
skipDelayDuration,
|
|
69
|
+
disableHoverableContent
|
|
70
|
+
}
|
|
71
|
+
}, children);
|
|
72
|
+
}
|
|
73
|
+
export const TooltipTrigger = /*#__PURE__*/React.forwardRef(function TooltipTrigger({
|
|
74
|
+
asChild = false,
|
|
12
75
|
children,
|
|
13
|
-
|
|
76
|
+
...rest
|
|
77
|
+
}, forwardedRef) {
|
|
78
|
+
const ctx = React.useContext(TooltipCtx);
|
|
79
|
+
if (!ctx) return /*#__PURE__*/React.createElement("button", _extends({
|
|
80
|
+
type: "button"
|
|
81
|
+
}, rest, {
|
|
82
|
+
ref: forwardedRef
|
|
83
|
+
}), children);
|
|
84
|
+
const props = {
|
|
85
|
+
...rest,
|
|
86
|
+
ref: mergeRefs(forwardedRef, ctx.triggerRef),
|
|
87
|
+
'data-slot': 'tooltip-trigger',
|
|
88
|
+
'aria-describedby': ctx.open ? ctx.contentId : undefined,
|
|
89
|
+
onMouseEnter: compose(rest.onMouseEnter, () => ctx.show(false)),
|
|
90
|
+
onMouseLeave: compose(rest.onMouseLeave, ctx.hide),
|
|
91
|
+
onFocus: compose(rest.onFocus, () => ctx.show(true)),
|
|
92
|
+
onBlur: compose(rest.onBlur, ctx.hide),
|
|
93
|
+
onKeyDown: compose(rest.onKeyDown, event => {
|
|
94
|
+
if (event.key === 'Escape') ctx.hide();
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
if (asChild && /*#__PURE__*/React.isValidElement(children)) {
|
|
98
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
99
|
+
...props,
|
|
100
|
+
...children.props,
|
|
101
|
+
ref: mergeRefs(children.ref, props.ref),
|
|
102
|
+
onMouseEnter: compose(children.props.onMouseEnter, props.onMouseEnter),
|
|
103
|
+
onMouseLeave: compose(children.props.onMouseLeave, props.onMouseLeave),
|
|
104
|
+
onFocus: compose(children.props.onFocus, props.onFocus),
|
|
105
|
+
onBlur: compose(children.props.onBlur, props.onBlur),
|
|
106
|
+
onKeyDown: compose(children.props.onKeyDown, props.onKeyDown),
|
|
107
|
+
'aria-describedby': props['aria-describedby'],
|
|
108
|
+
'data-slot': 'tooltip-trigger'
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
112
|
+
type: "button"
|
|
113
|
+
}, props), children);
|
|
114
|
+
});
|
|
115
|
+
export const TooltipContent = /*#__PURE__*/React.forwardRef(function TooltipContent({
|
|
116
|
+
side = 'top',
|
|
117
|
+
sideOffset = 8,
|
|
14
118
|
className,
|
|
119
|
+
style,
|
|
120
|
+
children,
|
|
15
121
|
...rest
|
|
16
|
-
}) {
|
|
17
|
-
const
|
|
18
|
-
const [open, setOpen] = React.useState(false);
|
|
19
|
-
const ref = React.useRef(null);
|
|
122
|
+
}, forwardedRef) {
|
|
123
|
+
const ctx = React.useContext(TooltipCtx);
|
|
20
124
|
const bubbleRef = React.useRef(null);
|
|
21
|
-
const
|
|
22
|
-
// position is the deprecated alias; side (the house placement prop) wins when both are passed.
|
|
23
|
-
const asked = sideProp ?? position;
|
|
24
|
-
const want = SIDES.includes(asked) ? asked : 'top';
|
|
25
|
-
|
|
26
|
-
// Portal's useAnchoredStyle only resolves top/bottom, so the tooltip places
|
|
27
|
-
// itself: the same flip-then-clamp behaviour, extended to left/right. Hidden
|
|
28
|
-
// for the first frame so the measurement never flashes at the origin.
|
|
125
|
+
const want = SIDES.includes(side) ? side : 'top';
|
|
29
126
|
const [placed, setPlaced] = React.useState({
|
|
30
127
|
style: {
|
|
31
128
|
position: 'fixed',
|
|
@@ -33,21 +130,14 @@ export function Tooltip({
|
|
|
33
130
|
left: 0,
|
|
34
131
|
visibility: 'hidden'
|
|
35
132
|
},
|
|
36
|
-
side: want
|
|
133
|
+
side: want,
|
|
134
|
+
arrow: null
|
|
37
135
|
});
|
|
38
136
|
useIsoLayoutEffect(() => {
|
|
39
|
-
if (!
|
|
40
|
-
|
|
41
|
-
...s,
|
|
42
|
-
style: {
|
|
43
|
-
...s.style,
|
|
44
|
-
visibility: 'hidden'
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
137
|
+
if (!ctx) return;
|
|
138
|
+
if (!ctx.open) return;
|
|
49
139
|
const move = () => {
|
|
50
|
-
const anchor =
|
|
140
|
+
const anchor = ctx.triggerRef.current;
|
|
51
141
|
const bubble = bubbleRef.current;
|
|
52
142
|
if (!anchor || !bubble) return;
|
|
53
143
|
const a = anchor.getBoundingClientRect();
|
|
@@ -55,21 +145,22 @@ export function Tooltip({
|
|
|
55
145
|
const vw = document.documentElement.clientWidth;
|
|
56
146
|
const vh = document.documentElement.clientHeight;
|
|
57
147
|
const edge = 8;
|
|
58
|
-
|
|
59
|
-
let side = want;
|
|
148
|
+
let actual = want;
|
|
60
149
|
if (want === 'left' || want === 'right') {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
150
|
+
const left = a.left - sideOffset;
|
|
151
|
+
const right = vw - a.right - sideOffset;
|
|
152
|
+
actual = want === 'left' ? left >= b.width || left >= right ? 'left' : 'right' : right >= b.width || right >= left ? 'right' : 'left';
|
|
64
153
|
} else {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
154
|
+
const above = a.top - sideOffset;
|
|
155
|
+
const below = vh - a.bottom - sideOffset;
|
|
156
|
+
actual = want === 'top' ? above >= b.height || above >= below ? 'top' : 'bottom' : below >= b.height || below >= above ? 'bottom' : 'top';
|
|
68
157
|
}
|
|
69
|
-
let top =
|
|
70
|
-
let left =
|
|
158
|
+
let top = actual === 'top' ? a.top - sideOffset - b.height : actual === 'bottom' ? a.bottom + sideOffset : a.top + a.height / 2 - b.height / 2;
|
|
159
|
+
let left = actual === 'left' ? a.left - sideOffset - b.width : actual === 'right' ? a.right + sideOffset : a.left + a.width / 2 - b.width / 2;
|
|
71
160
|
left = Math.max(edge, Math.min(left, vw - b.width - edge));
|
|
72
161
|
top = Math.max(edge, Math.min(top, vh - b.height - edge));
|
|
162
|
+
const across = actual === 'left' || actual === 'right';
|
|
163
|
+
const arrow = across ? a.top + a.height / 2 - top : a.left + a.width / 2 - left;
|
|
73
164
|
setPlaced({
|
|
74
165
|
style: {
|
|
75
166
|
position: 'fixed',
|
|
@@ -77,71 +168,31 @@ export function Tooltip({
|
|
|
77
168
|
left: Math.round(left),
|
|
78
169
|
visibility: 'visible'
|
|
79
170
|
},
|
|
80
|
-
side
|
|
171
|
+
side: actual,
|
|
172
|
+
arrow: Math.max(8, Math.min(arrow, (across ? b.height : b.width) - 8))
|
|
81
173
|
});
|
|
82
174
|
};
|
|
83
175
|
move();
|
|
84
|
-
// capture phase: any scrolling ancestor moves the anchor, not just the window
|
|
85
176
|
window.addEventListener('scroll', move, true);
|
|
86
177
|
window.addEventListener('resize', move);
|
|
87
178
|
return () => {
|
|
88
179
|
window.removeEventListener('scroll', move, true);
|
|
89
180
|
window.removeEventListener('resize', move);
|
|
90
181
|
};
|
|
91
|
-
}, [open, want]);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} = placed;
|
|
96
|
-
|
|
97
|
-
// Keep the arrow over the trigger's centre even when the bubble has been
|
|
98
|
-
// shifted to stay on screen, so it never points at empty space.
|
|
99
|
-
const [arrow, setArrow] = React.useState(null);
|
|
100
|
-
useIsoLayoutEffect(() => {
|
|
101
|
-
if (!open || !ref.current || !bubbleRef.current) {
|
|
102
|
-
setArrow(null);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const a = ref.current.getBoundingClientRect();
|
|
106
|
-
const b = bubbleRef.current.getBoundingClientRect();
|
|
107
|
-
if (!b.width) return;
|
|
108
|
-
const across = side === 'left' || side === 'right';
|
|
109
|
-
const v = across ? a.top + a.height / 2 - b.top : a.left + a.width / 2 - b.left;
|
|
110
|
-
setArrow(Math.max(8, Math.min(v, (across ? b.height : b.width) - 8)));
|
|
111
|
-
}, [open, side, anchored.left, anchored.top]);
|
|
112
|
-
const show = immediate => {
|
|
113
|
-
clearTimeout(timer.current);
|
|
114
|
-
if (immediate) setOpen(true);else timer.current = setTimeout(() => setOpen(true), delay);
|
|
115
|
-
};
|
|
116
|
-
const hide = () => {
|
|
117
|
-
clearTimeout(timer.current);
|
|
118
|
-
setOpen(false);
|
|
119
|
-
};
|
|
120
|
-
React.useEffect(() => () => clearTimeout(timer.current), []);
|
|
121
|
-
const child = React.Children.count(children) === 1 && /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
122
|
-
'aria-describedby': open ? id : undefined
|
|
123
|
-
}) : children;
|
|
124
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
125
|
-
ref: ref,
|
|
126
|
-
className: `ef-tooltip${className ? ' ' + className : ''}`,
|
|
127
|
-
style: style,
|
|
128
|
-
onMouseEnter: () => show(false),
|
|
129
|
-
onMouseLeave: hide,
|
|
130
|
-
onFocus: () => show(true),
|
|
131
|
-
onBlur: hide,
|
|
132
|
-
onKeyDown: e => {
|
|
133
|
-
if (e.key === 'Escape') hide();
|
|
134
|
-
}
|
|
135
|
-
}), child, open ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("span", {
|
|
136
|
-
ref: bubbleRef,
|
|
182
|
+
}, [ctx?.open, ctx?.triggerRef, want, sideOffset]);
|
|
183
|
+
if (!ctx?.open) return null;
|
|
184
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
185
|
+
ref: mergeRefs(forwardedRef, bubbleRef),
|
|
137
186
|
role: "tooltip",
|
|
138
|
-
id:
|
|
139
|
-
|
|
187
|
+
id: ctx.contentId,
|
|
188
|
+
"data-slot": "tooltip-content",
|
|
189
|
+
"data-state": "open",
|
|
190
|
+
"data-side": placed.side,
|
|
191
|
+
className: `ef-tooltip__bubble${placed.side !== 'top' ? ' ef-tooltip__bubble--' + placed.side : ''}${className ? ' ' + className : ''}`,
|
|
140
192
|
style: {
|
|
141
|
-
...
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
})
|
|
193
|
+
...placed.style,
|
|
194
|
+
'--ef-tt-arrow': placed.arrow == null ? undefined : placed.arrow + 'px',
|
|
195
|
+
...style
|
|
145
196
|
}
|
|
146
|
-
},
|
|
147
|
-
}
|
|
197
|
+
}), children));
|
|
198
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ButtonProps } from '../forms/Button.js';
|
|
3
|
+
|
|
4
|
+
export type AttachmentState = 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
5
|
+
export type AttachmentSize = 'default' | 'sm' | 'xs';
|
|
6
|
+
export type AttachmentOrientation = 'horizontal' | 'vertical';
|
|
7
|
+
|
|
8
|
+
export interface AttachmentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
state?: AttachmentState;
|
|
10
|
+
size?: AttachmentSize;
|
|
11
|
+
orientation?: AttachmentOrientation;
|
|
12
|
+
}
|
|
13
|
+
export declare const Attachment: React.ForwardRefExoticComponent<AttachmentProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
|
|
15
|
+
export interface AttachmentMediaProps extends React.HTMLAttributes<HTMLDivElement> { variant?: 'icon' | 'image'; }
|
|
16
|
+
export declare const AttachmentMedia: React.ForwardRefExoticComponent<AttachmentMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const AttachmentContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export declare const AttachmentTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export declare const AttachmentDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export declare const AttachmentActions: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export declare const AttachmentAction: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
|
|
23
|
+
export interface AttachmentTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
24
|
+
render?: React.ReactElement | ((props: React.ButtonHTMLAttributes<HTMLButtonElement> & { ref?: React.ForwardedRef<HTMLElement> }) => React.ReactElement);
|
|
25
|
+
}
|
|
26
|
+
export declare const AttachmentTrigger: React.ForwardRefExoticComponent<AttachmentTriggerProps & React.RefAttributes<HTMLElement>>;
|
|
27
|
+
export declare const AttachmentGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { Button, mergeRefs } from "../forms/Button.js";
|
|
5
|
+
const classes = (base, className) => base + (className ? ' ' + className : '');
|
|
6
|
+
export const Attachment = /*#__PURE__*/React.forwardRef(function Attachment({
|
|
7
|
+
state = 'done',
|
|
8
|
+
size = 'default',
|
|
9
|
+
orientation = 'horizontal',
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}, ref) {
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
14
|
+
ref: ref,
|
|
15
|
+
"data-state": state,
|
|
16
|
+
"data-size": size,
|
|
17
|
+
"data-orientation": orientation,
|
|
18
|
+
className: classes('ef-attachment', className)
|
|
19
|
+
}, props));
|
|
20
|
+
});
|
|
21
|
+
export const AttachmentMedia = /*#__PURE__*/React.forwardRef(function AttachmentMedia({
|
|
22
|
+
variant = 'icon',
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
27
|
+
ref: ref,
|
|
28
|
+
"data-variant": variant,
|
|
29
|
+
className: classes('ef-attachment__media', className)
|
|
30
|
+
}, props));
|
|
31
|
+
});
|
|
32
|
+
export const AttachmentContent = /*#__PURE__*/React.forwardRef(function AttachmentContent({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}, ref) {
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
37
|
+
ref: ref,
|
|
38
|
+
className: classes('ef-attachment__content', className)
|
|
39
|
+
}, props));
|
|
40
|
+
});
|
|
41
|
+
export const AttachmentTitle = /*#__PURE__*/React.forwardRef(function AttachmentTitle({
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
}, ref) {
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
46
|
+
ref: ref,
|
|
47
|
+
className: classes('ef-attachment__title', className)
|
|
48
|
+
}, props));
|
|
49
|
+
});
|
|
50
|
+
export const AttachmentDescription = /*#__PURE__*/React.forwardRef(function AttachmentDescription({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}, ref) {
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
55
|
+
ref: ref,
|
|
56
|
+
className: classes('ef-attachment__description', className)
|
|
57
|
+
}, props));
|
|
58
|
+
});
|
|
59
|
+
export const AttachmentActions = /*#__PURE__*/React.forwardRef(function AttachmentActions({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}, ref) {
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
64
|
+
ref: ref,
|
|
65
|
+
className: classes('ef-attachment__actions', className)
|
|
66
|
+
}, props));
|
|
67
|
+
});
|
|
68
|
+
export const AttachmentAction = /*#__PURE__*/React.forwardRef(function AttachmentAction({
|
|
69
|
+
size = 'icon-xs',
|
|
70
|
+
...props
|
|
71
|
+
}, ref) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
73
|
+
ref: ref,
|
|
74
|
+
size: size
|
|
75
|
+
}, props));
|
|
76
|
+
});
|
|
77
|
+
export const AttachmentTrigger = /*#__PURE__*/React.forwardRef(function AttachmentTrigger({
|
|
78
|
+
render,
|
|
79
|
+
className,
|
|
80
|
+
...props
|
|
81
|
+
}, ref) {
|
|
82
|
+
const triggerProps = {
|
|
83
|
+
...props,
|
|
84
|
+
className: classes('ef-attachment__trigger', className)
|
|
85
|
+
};
|
|
86
|
+
if (typeof render === 'function') return render({
|
|
87
|
+
...triggerProps,
|
|
88
|
+
ref
|
|
89
|
+
});
|
|
90
|
+
if (/*#__PURE__*/React.isValidElement(render)) {
|
|
91
|
+
return /*#__PURE__*/React.cloneElement(render, {
|
|
92
|
+
...triggerProps,
|
|
93
|
+
...render.props,
|
|
94
|
+
className: classes(triggerProps.className, render.props.className),
|
|
95
|
+
ref: mergeRefs(ref, render.ref)
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
99
|
+
ref: ref,
|
|
100
|
+
type: "button"
|
|
101
|
+
}, triggerProps));
|
|
102
|
+
});
|
|
103
|
+
export const AttachmentGroup = /*#__PURE__*/React.forwardRef(function AttachmentGroup({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}, ref) {
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
108
|
+
ref: ref,
|
|
109
|
+
className: classes('ef-attachment-group', className)
|
|
110
|
+
}, props));
|
|
111
|
+
});
|
package/files/FileDrop.js
CHANGED
|
@@ -46,7 +46,9 @@ export function FileDrop({
|
|
|
46
46
|
size: 22
|
|
47
47
|
})), /*#__PURE__*/React.createElement("span", {
|
|
48
48
|
className: "ef-filedrop__title"
|
|
49
|
-
}, title || /*#__PURE__*/React.createElement("span", null, "Drop files here or ", /*#__PURE__*/React.createElement("
|
|
49
|
+
}, title || /*#__PURE__*/React.createElement("span", null, "Drop files here or ", /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: "ef-filedrop__action"
|
|
51
|
+
}, "browse"))), hint ? /*#__PURE__*/React.createElement("span", {
|
|
50
52
|
className: "ef-filedrop__hint"
|
|
51
53
|
}, hint) : null, /*#__PURE__*/React.createElement("input", {
|
|
52
54
|
ref: inputRef,
|
package/finance/PaymentCard.js
CHANGED
|
@@ -23,7 +23,7 @@ export function PaymentCard({
|
|
|
23
23
|
style: {
|
|
24
24
|
width: 220,
|
|
25
25
|
height: 220,
|
|
26
|
-
|
|
26
|
+
insetInlineEnd: -70,
|
|
27
27
|
top: -70
|
|
28
28
|
}
|
|
29
29
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -31,7 +31,7 @@ export function PaymentCard({
|
|
|
31
31
|
style: {
|
|
32
32
|
width: 220,
|
|
33
33
|
height: 220,
|
|
34
|
-
|
|
34
|
+
insetInlineEnd: -40,
|
|
35
35
|
top: -110
|
|
36
36
|
}
|
|
37
37
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -48,7 +48,7 @@ export function PaymentCard({
|
|
|
48
48
|
}
|
|
49
49
|
}, network), frozen ? /*#__PURE__*/React.createElement("span", {
|
|
50
50
|
style: {
|
|
51
|
-
|
|
51
|
+
marginInlineStart: 'auto',
|
|
52
52
|
fontSize: 10,
|
|
53
53
|
fontWeight: 600,
|
|
54
54
|
letterSpacing: '.08em',
|
package/forms/Button.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
-
/** @default '
|
|
3
|
-
variant?: '
|
|
4
|
-
/** @default '
|
|
5
|
-
size?: 'sm' | '
|
|
2
|
+
/** @default 'default' */
|
|
3
|
+
variant?: 'default' | 'outline' | 'ghost' | 'destructive' | 'secondary' | 'link' | 'primary' | 'danger' | 'brand';
|
|
4
|
+
/** @default 'default' */
|
|
5
|
+
size?: 'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-xs' | 'icon-sm' | 'icon-lg' | 'md';
|
|
6
6
|
/** Lucide icon name rendered before the label */
|
|
7
7
|
iconLeft?: string;
|
|
8
8
|
/** Lucide icon name rendered after the label */
|
|
@@ -12,4 +12,5 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
12
12
|
loading?: boolean;
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
}
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function buttonVariants(options?: Pick<ButtonProps, 'variant' | 'size'> & { className?: string }): string;
|
|
16
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
package/forms/Button.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Icon } from "../icons/Icon.js";
|
|
|
7
7
|
*
|
|
8
8
|
* THE LAYER IS THE POINT. This appends a <style> at runtime, so it always
|
|
9
9
|
* lands after whatever stylesheet the app shipped, and at equal specificity
|
|
10
|
-
* later wins.
|
|
10
|
+
* later wins. Consumer applications otherwise have to double their selectors
|
|
11
11
|
* (`.hide-sm.hide-sm`) because a one-class utility lost to
|
|
12
12
|
* `.ef-badge { display: inline-flex }`, and Efolusi restates radii and colours
|
|
13
13
|
* to get its own back. A design system that has to be out-specified by its
|
|
@@ -80,9 +80,18 @@ export function mergeRefs(...refs) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
export function
|
|
84
|
-
variant = '
|
|
85
|
-
size = '
|
|
83
|
+
export function buttonVariants({
|
|
84
|
+
variant = 'default',
|
|
85
|
+
size = 'default',
|
|
86
|
+
className = ''
|
|
87
|
+
} = {}) {
|
|
88
|
+
const mappedVariant = variant === 'default' ? 'primary' : variant;
|
|
89
|
+
const mappedSize = size === 'default' ? 'md' : size;
|
|
90
|
+
return `ef-btn ef-btn--${mappedVariant} ef-btn--${mappedSize}${className ? ' ' + className : ''}`;
|
|
91
|
+
}
|
|
92
|
+
export const Button = /*#__PURE__*/React.forwardRef(function Button({
|
|
93
|
+
variant = 'default',
|
|
94
|
+
size = 'default',
|
|
86
95
|
iconLeft,
|
|
87
96
|
iconRight,
|
|
88
97
|
fullWidth,
|
|
@@ -92,10 +101,15 @@ export function Button({
|
|
|
92
101
|
style,
|
|
93
102
|
className,
|
|
94
103
|
...rest
|
|
95
|
-
}) {
|
|
96
|
-
const isz = size === 'sm' ? 14 : size === 'lg' ? 18 : 16;
|
|
104
|
+
}, ref) {
|
|
105
|
+
const isz = size === 'xs' || size === 'icon-xs' ? 12 : size === 'sm' || size === 'icon-sm' ? 14 : size === 'lg' || size === 'icon-lg' ? 18 : 16;
|
|
97
106
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
98
|
-
|
|
107
|
+
ref: ref,
|
|
108
|
+
className: buttonVariants({
|
|
109
|
+
variant,
|
|
110
|
+
size,
|
|
111
|
+
className
|
|
112
|
+
}),
|
|
99
113
|
disabled: disabled || loading,
|
|
100
114
|
style: {
|
|
101
115
|
width: fullWidth ? '100%' : undefined,
|
|
@@ -113,4 +127,4 @@ export function Button({
|
|
|
113
127
|
name: iconRight,
|
|
114
128
|
size: isz
|
|
115
129
|
}) : null);
|
|
116
|
-
}
|
|
130
|
+
});
|
package/forms/ButtonGroup.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { SeparatorProps } from '../display/Separator.jsx';
|
|
3
|
+
|
|
1
4
|
export interface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
-
|
|
3
|
-
children: React.ReactNode;
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
6
|
}
|
|
5
|
-
export
|
|
7
|
+
export interface ButtonGroupTextProps extends React.HTMLAttributes<HTMLDivElement> { asChild?: boolean; }
|
|
8
|
+
export interface ButtonGroupSeparatorProps extends SeparatorProps {}
|
|
9
|
+
|
|
10
|
+
export declare function buttonGroupVariants(options?: Pick<ButtonGroupProps, 'orientation'> & { className?: string }): string;
|
|
11
|
+
export declare const ButtonGroup: React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const ButtonGroupText: React.ForwardRefExoticComponent<ButtonGroupTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const ButtonGroupSeparator: React.ForwardRefExoticComponent<ButtonGroupSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|