@efolusi/meridian 1.21.10 → 1.23.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/LICENSE +201 -21
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/ai/AgentRun.js +1 -0
- package/ai/Bubble.js +1 -0
- package/ai/ChatMessage.js +1 -0
- package/ai/Citation.js +45 -22
- package/ai/Confirmation.js +3 -2
- package/ai/Conversation.js +1 -0
- package/ai/DocumentCard.js +1 -0
- package/ai/FeedbackBar.js +1 -0
- package/ai/GeneratedImage.js +1 -0
- package/ai/Marker.js +1 -0
- package/ai/Message.js +1 -0
- package/ai/MessageScroller.js +1 -0
- package/ai/ModelSelector.js +1 -0
- package/ai/Player.js +1 -0
- package/ai/PromptComposer.d.ts +4 -0
- package/ai/PromptComposer.js +8 -1
- package/ai/PromptSteps.js +1 -0
- package/ai/Reasoning.js +1 -0
- package/ai/RichComposer.js +4 -0
- package/ai/Sandbox.js +1 -0
- package/ai/SelectionQuote.js +1 -0
- package/ai/SourceCard.js +13 -4
- package/ai/Suggestions.js +1 -0
- package/ai/Task.js +1 -0
- package/ai/Todo.js +1 -0
- package/ai/ToolCall.js +1 -0
- package/ai/Transcript.js +1 -0
- package/ai/UsageMeter.d.ts +3 -1
- package/ai/UsageMeter.js +9 -2
- package/ai/WebPreview.js +13 -4
- package/code/CodeBlock.js +27 -7
- package/code/Console.js +1 -0
- package/code/CopyField.js +25 -9
- package/code/Diff.js +1 -0
- package/code/EnvList.js +1 -0
- package/code/Exception.js +1 -0
- package/code/Terminal.js +1 -0
- package/components.css +139 -56
- package/data/BarChart.d.ts +4 -0
- package/data/BarChart.js +29 -4
- package/data/Chart.d.ts +1 -1
- package/data/Chart.js +10 -4
- package/data/DonutChart.d.ts +4 -0
- package/data/DonutChart.js +38 -8
- package/data/EmptyState.js +1 -0
- package/data/KeyValueList.js +1 -0
- package/data/LineChart.d.ts +4 -0
- package/data/LineChart.js +30 -7
- package/data/Skeleton.js +1 -0
- package/data/Sparkline.js +1 -0
- package/data/Stat.js +1 -0
- package/data/StatusDot.js +1 -0
- package/data/Table.d.ts +1 -0
- package/data/Table.js +36 -19
- package/dates/Calendar.js +44 -15
- package/dates/TimePicker.js +19 -3
- package/display/Accordion.js +1 -0
- package/display/AspectRatio.js +1 -0
- package/display/Avatar.js +1 -0
- package/display/Badge.js +1 -0
- package/display/Card.js +1 -0
- package/display/Carousel.js +24 -6
- package/display/Collapsible.js +1 -0
- package/display/Direction.js +1 -0
- package/display/Divider.js +1 -0
- package/display/Item.js +1 -0
- package/display/Kbd.js +1 -0
- package/display/Link.js +1 -0
- package/display/Resizable.js +5 -4
- package/display/ScrollArea.js +4 -2
- package/display/Separator.js +1 -0
- package/display/Tag.js +1 -0
- package/display/Timeline.js +1 -0
- package/display/Toolbar.js +2 -0
- package/display/TreeList.js +21 -13
- package/feedback/Alert.js +1 -0
- package/feedback/AlertDialog.js +31 -18
- package/feedback/Banner.js +1 -0
- package/feedback/ConfirmDialog.js +1 -0
- package/feedback/Dialog.js +37 -18
- package/feedback/Loader.js +1 -0
- package/feedback/Progress.js +1 -0
- package/feedback/Spinner.js +1 -0
- package/feedback/Toast.js +10 -3
- package/feedback/Tooltip.js +25 -6
- package/files/Attachment.js +1 -0
- package/files/FileDrop.d.ts +5 -1
- package/files/FileDrop.js +29 -1
- package/files/FileTile.js +1 -0
- package/files/FileTypeIcon.js +1 -0
- package/finance/PaymentCard.js +1 -0
- package/forms/Button.js +55 -0
- package/forms/ButtonGroup.js +1 -0
- package/forms/ButtonTile.js +3 -0
- package/forms/Checkbox.js +1 -0
- package/forms/Combobox.js +31 -9
- package/forms/Field.js +1 -0
- package/forms/IconButton.js +1 -0
- package/forms/Input.js +1 -0
- package/forms/InputGroup.js +1 -0
- package/forms/InputOTP.js +1 -0
- package/forms/Label.js +1 -0
- package/forms/NativeSelect.js +1 -0
- package/forms/NumberInput.js +22 -4
- package/forms/Questionnaire.js +2 -1
- package/forms/Radio.js +1 -0
- package/forms/Select.js +7 -4
- package/forms/Slider.js +26 -3
- package/forms/Switch.js +15 -3
- package/forms/Textarea.js +1 -0
- package/forms/Toggle.js +1 -0
- package/icons/Icon.js +6 -0
- package/icons/_svg.js +1 -1
- package/index.js +3 -3
- package/navigation/Breadcrumbs.js +1 -0
- package/navigation/Menubar.js +1 -0
- package/navigation/NavigationMenu.js +18 -5
- package/navigation/PageControl.js +2 -0
- package/navigation/Pagination.js +1 -0
- package/navigation/SegmentedControl.js +2 -0
- package/navigation/SideNav.js +3 -0
- package/navigation/Sidebar.js +75 -11
- package/navigation/SkipLink.d.ts +2 -1
- package/navigation/SkipLink.js +17 -4
- package/navigation/Steps.js +1 -0
- package/navigation/Tabs.js +1 -0
- package/navigation/TopNav.js +1 -0
- package/overlay/Command.js +2 -0
- package/overlay/ContextMenu.js +40 -13
- package/overlay/Drawer.d.ts +4 -0
- package/overlay/Drawer.js +24 -3
- package/overlay/DropdownMenu.js +40 -13
- package/overlay/HoverCard.js +29 -19
- package/overlay/Popover.js +67 -16
- package/overlay/Portal.js +97 -2
- package/overlay/Sheet.js +1 -0
- package/package.json +2 -2
- package/tailwind.preset.cjs +60 -28
- package/tokens/base.css +19 -3
- package/tokens/colors.css +248 -46
- package/tokens/effects.css +33 -20
- package/tokens/fonts.css +7 -0
- package/tokens/spacing.css +42 -17
- package/tokens/typography.css +29 -8
- package/tokens.json +689 -115
package/dates/TimePicker.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
|
@@ -43,14 +44,22 @@ export function TimePicker({
|
|
|
43
44
|
invalid,
|
|
44
45
|
style,
|
|
45
46
|
className,
|
|
47
|
+
id,
|
|
48
|
+
'aria-label': ariaLabel,
|
|
49
|
+
'aria-labelledby': ariaLabelledBy,
|
|
50
|
+
'aria-describedby': ariaDescribedBy,
|
|
46
51
|
...rest
|
|
47
52
|
}) {
|
|
48
53
|
// Picks up id / aria wiring when nested in a Field; standalone this is a no-op.
|
|
49
54
|
const field = useFieldProps({
|
|
50
55
|
invalid,
|
|
51
|
-
id
|
|
52
|
-
'aria-describedby':
|
|
56
|
+
id,
|
|
57
|
+
'aria-describedby': ariaDescribedBy
|
|
53
58
|
});
|
|
59
|
+
const uid = React.useId();
|
|
60
|
+
const inputId = field.id || (label ? `${uid}i` : undefined);
|
|
61
|
+
const hintId = hint ? `${uid}h` : undefined;
|
|
62
|
+
const describedBy = [...new Set([field.controlProps['aria-describedby'], hintId].filter(Boolean))].join(' ') || undefined;
|
|
54
63
|
const bad = field.invalid;
|
|
55
64
|
const [open, setOpen] = React.useState(false);
|
|
56
65
|
const [q, setQ] = React.useState(null); // null = not editing, input mirrors `value`
|
|
@@ -123,6 +132,7 @@ export function TimePicker({
|
|
|
123
132
|
setOpen(false);
|
|
124
133
|
};
|
|
125
134
|
const onKey = e => {
|
|
135
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
126
136
|
if (e.key === 'ArrowDown') {
|
|
127
137
|
e.preventDefault();
|
|
128
138
|
if (!open) openList();else setHi(h => Math.min(h + 1, shown.length - 1));
|
|
@@ -141,6 +151,10 @@ export function TimePicker({
|
|
|
141
151
|
ref: ref,
|
|
142
152
|
className: `ef-timepicker${bad ? ' ef-timepicker--invalid' : ''}`
|
|
143
153
|
}, /*#__PURE__*/React.createElement("input", _extends({}, field.controlProps, {
|
|
154
|
+
id: inputId,
|
|
155
|
+
"aria-label": ariaLabel,
|
|
156
|
+
"aria-labelledby": ariaLabelledBy,
|
|
157
|
+
"aria-describedby": describedBy,
|
|
144
158
|
className: "ef-timepicker__input",
|
|
145
159
|
role: "combobox",
|
|
146
160
|
"aria-expanded": open,
|
|
@@ -197,9 +211,11 @@ export function TimePicker({
|
|
|
197
211
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
198
212
|
className: `ef-field${className ? ' ' + className : ''}`,
|
|
199
213
|
style: style
|
|
200
|
-
}), label ? /*#__PURE__*/React.createElement("
|
|
214
|
+
}), label ? /*#__PURE__*/React.createElement("label", {
|
|
215
|
+
htmlFor: inputId,
|
|
201
216
|
className: "ef-field__label"
|
|
202
217
|
}, label) : null, control, hint ? /*#__PURE__*/React.createElement("span", {
|
|
218
|
+
id: hintId,
|
|
203
219
|
className: "ef-field__hint"
|
|
204
220
|
}, hint) : null);
|
|
205
221
|
}
|
package/display/Accordion.js
CHANGED
package/display/AspectRatio.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
export const AspectRatio = /*#__PURE__*/React.forwardRef(function AspectRatio({
|
package/display/Avatar.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
function classes(...values) {
|
package/display/Badge.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { mergeRefs } from "../forms/Button.js";
|
package/display/Card.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
function cx(base, className) {
|
package/display/Carousel.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { prefersReducedMotion } from "../forms/Button.js";
|
|
@@ -6,14 +7,27 @@ import { Icon } from "../icons/Icon.js";
|
|
|
6
7
|
import { useDirection } from "./Direction.js";
|
|
7
8
|
const CarouselCtx = /*#__PURE__*/React.createContext(null);
|
|
8
9
|
const EMPTY_PLUGINS = [];
|
|
10
|
+
function isRtlScroller(element) {
|
|
11
|
+
return typeof getComputedStyle === 'function' && getComputedStyle(element).direction === 'rtl';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Distance from the scroll start edge to the slide's start edge. offsetLeft is
|
|
15
|
+
// physical, so in RTL the start edge is measured from the right of the
|
|
16
|
+
// offsetParent (the positioned .ef-carousel), mirroring what LTR gets for free.
|
|
17
|
+
function slideStart(slide, orientation, rtl) {
|
|
18
|
+
if (orientation === 'vertical') return slide.offsetTop;
|
|
19
|
+
if (!rtl) return slide.offsetLeft;
|
|
20
|
+
return (slide.offsetParent ? slide.offsetParent.clientWidth : 0) - slide.offsetLeft - slide.offsetWidth;
|
|
21
|
+
}
|
|
9
22
|
function closestIndex(element, orientation) {
|
|
10
23
|
const position = orientation === 'vertical' ? element.scrollTop : Math.abs(element.scrollLeft);
|
|
11
24
|
const slides = [...element.querySelectorAll('[data-slot="carousel-item"]')];
|
|
12
25
|
if (!slides.length) return 0;
|
|
26
|
+
const rtl = orientation !== 'vertical' && isRtlScroller(element);
|
|
13
27
|
let best = 0;
|
|
14
28
|
let distance = Infinity;
|
|
15
29
|
slides.forEach((slide, index) => {
|
|
16
|
-
const offset =
|
|
30
|
+
const offset = slideStart(slide, orientation, rtl);
|
|
17
31
|
const nextDistance = Math.abs(offset - position);
|
|
18
32
|
if (nextDistance < distance) {
|
|
19
33
|
best = index;
|
|
@@ -59,13 +73,17 @@ export const Carousel = /*#__PURE__*/React.forwardRef(function Carousel({
|
|
|
59
73
|
if (orientation === 'vertical') element.scrollTo({
|
|
60
74
|
top: slide.offsetTop - alignmentOffset,
|
|
61
75
|
behavior
|
|
62
|
-
});else
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
});else {
|
|
77
|
+
// Scroll coordinates follow the scroller's CSS direction, not opts.direction.
|
|
78
|
+
const rtl = isRtlScroller(element);
|
|
79
|
+
element.scrollTo({
|
|
80
|
+
left: (rtl ? -1 : 1) * (slideStart(slide, orientation, rtl) - alignmentOffset),
|
|
81
|
+
behavior
|
|
82
|
+
});
|
|
83
|
+
}
|
|
66
84
|
setSelected(targetIndex);
|
|
67
85
|
queueMicrotask(() => emit('select'));
|
|
68
|
-
}, [align,
|
|
86
|
+
}, [align, emit, loop, orientation]);
|
|
69
87
|
const api = React.useMemo(() => ({
|
|
70
88
|
canScrollNext: () => loop || selectedRef.current < slideCountRef.current - 1,
|
|
71
89
|
canScrollPrev: () => loop || selectedRef.current > 0,
|
package/display/Collapsible.js
CHANGED
package/display/Direction.js
CHANGED
package/display/Divider.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
|
package/display/Item.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { mergeRefs } from "../forms/Button.js";
|
package/display/Kbd.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
function joinClasses(base, className) {
|
package/display/Link.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
package/display/Resizable.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
|
-
import { cssPct } from "../forms/Button.js";
|
|
5
|
+
import { cssPct, isElementOfType } from "../forms/Button.js";
|
|
5
6
|
import { useDirection } from "./Direction.js";
|
|
6
7
|
const ResizableCtx = /*#__PURE__*/React.createContext(null);
|
|
7
8
|
function sizeNumber(value, fallback) {
|
|
@@ -27,7 +28,7 @@ export const ResizablePanelGroup = /*#__PURE__*/React.forwardRef(function Resiza
|
|
|
27
28
|
}, ref) {
|
|
28
29
|
const readingDirection = useDirection();
|
|
29
30
|
const nodes = React.Children.toArray(children);
|
|
30
|
-
const panels = nodes.filter(child =>
|
|
31
|
+
const panels = nodes.filter(child => isElementOfType(child, ResizablePanel));
|
|
31
32
|
const [sizes, setSizes] = React.useState(() => initialPanelSizes(panels));
|
|
32
33
|
const updatePair = React.useCallback((index, delta) => {
|
|
33
34
|
setSizes(current => {
|
|
@@ -65,11 +66,11 @@ export const ResizablePanelGroup = /*#__PURE__*/React.forwardRef(function Resiza
|
|
|
65
66
|
className: `ef-resizable${className ? ' ' + className : ''}`
|
|
66
67
|
}), nodes.map((child, index) => {
|
|
67
68
|
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
68
|
-
if (child
|
|
69
|
+
if (isElementOfType(child, ResizablePanel)) return /*#__PURE__*/React.cloneElement(child, {
|
|
69
70
|
key: child.key ?? index,
|
|
70
71
|
_panelIndex: panelIndex++
|
|
71
72
|
});
|
|
72
|
-
if (child
|
|
73
|
+
if (isElementOfType(child, ResizableHandle)) return /*#__PURE__*/React.cloneElement(child, {
|
|
73
74
|
key: child.key ?? index,
|
|
74
75
|
_handleIndex: handleIndex++
|
|
75
76
|
});
|
package/display/ScrollArea.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
5
|
+
import { isElementOfType } from "../forms/Button.js";
|
|
4
6
|
export const ScrollArea = /*#__PURE__*/React.forwardRef(function ScrollArea({
|
|
5
7
|
maxHeight,
|
|
6
8
|
height,
|
|
@@ -10,8 +12,8 @@ export const ScrollArea = /*#__PURE__*/React.forwardRef(function ScrollArea({
|
|
|
10
12
|
...rest
|
|
11
13
|
}, ref) {
|
|
12
14
|
const nodes = React.Children.toArray(children);
|
|
13
|
-
const bars = nodes.filter(child =>
|
|
14
|
-
const content = nodes.filter(child => !(
|
|
15
|
+
const bars = nodes.filter(child => isElementOfType(child, ScrollBar));
|
|
16
|
+
const content = nodes.filter(child => !isElementOfType(child, ScrollBar));
|
|
15
17
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
16
18
|
ref: ref,
|
|
17
19
|
"data-slot": "scroll-area",
|
package/display/Separator.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
export const Separator = /*#__PURE__*/React.forwardRef(function Separator({
|
package/display/Tag.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
package/display/Timeline.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
package/display/Toolbar.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
|
@@ -25,6 +26,7 @@ export function Toolbar({
|
|
|
25
26
|
});
|
|
26
27
|
const btn = /*#__PURE__*/React.createElement("button", {
|
|
27
28
|
key: it.id,
|
|
29
|
+
type: "button",
|
|
28
30
|
disabled: it.disabled,
|
|
29
31
|
"aria-pressed": active.includes(it.id) || undefined,
|
|
30
32
|
className: `ef-toolbar__btn${active.includes(it.id) ? ' ef-toolbar__btn--active' : ''}`,
|
package/display/TreeList.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
|
@@ -13,10 +14,13 @@ function Node({
|
|
|
13
14
|
const kids = node.children || [];
|
|
14
15
|
const isOpen = open.includes(node.id);
|
|
15
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
17
|
+
type: "button",
|
|
16
18
|
className: `ef-tree__row${sel === node.id ? ' ef-tree__row--sel' : ''}`,
|
|
17
19
|
style: {
|
|
18
20
|
paddingInlineStart: 8 + depth * 18
|
|
19
21
|
},
|
|
22
|
+
"aria-expanded": kids.length ? isOpen : undefined,
|
|
23
|
+
"aria-current": sel === node.id ? 'true' : undefined,
|
|
20
24
|
onClick: () => {
|
|
21
25
|
if (kids.length) toggle(node.id);
|
|
22
26
|
select(node.id, node);
|
|
@@ -71,17 +75,21 @@ export function TreeList({
|
|
|
71
75
|
if (value == null) setInnerSel(id);
|
|
72
76
|
onChange?.(id, node);
|
|
73
77
|
};
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
return (
|
|
79
|
+
/*#__PURE__*/
|
|
80
|
+
// Plain disclosure buttons, not role="tree": a tree promises treeitems and
|
|
81
|
+
// arrow-key navigation, which this list does not implement.
|
|
82
|
+
React.createElement("div", _extends({}, rest, {
|
|
83
|
+
className: `ef-tree${className ? ' ' + className : ''}`,
|
|
84
|
+
style: style
|
|
85
|
+
}), nodes.map(n => /*#__PURE__*/React.createElement(Node, {
|
|
86
|
+
key: n.id,
|
|
87
|
+
node: n,
|
|
88
|
+
depth: 0,
|
|
89
|
+
open: open,
|
|
90
|
+
sel: sel,
|
|
91
|
+
toggle: toggle,
|
|
92
|
+
select: select
|
|
93
|
+
})))
|
|
94
|
+
);
|
|
87
95
|
}
|
package/feedback/Alert.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
export const Alert = /*#__PURE__*/React.forwardRef(function Alert({
|
package/feedback/AlertDialog.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
|
-
import { mergeRefs, buttonVariants } from "../forms/Button.js";
|
|
5
|
-
import { Portal } from "../overlay/Portal.js";
|
|
5
|
+
import { mergeRefs, buttonVariants, useIsoLayoutEffect } from "../forms/Button.js";
|
|
6
|
+
import { Portal, useEscapeLayer, useScrollLock, escapeLayerContext, useHydrated } from "../overlay/Portal.js";
|
|
6
7
|
const AlertDialogContext = /*#__PURE__*/React.createContext(null);
|
|
7
8
|
const FOCUSABLE = 'button:not([disabled]),[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
8
9
|
function useAlertDialog(part) {
|
|
@@ -39,7 +40,9 @@ export function AlertDialog({
|
|
|
39
40
|
}) {
|
|
40
41
|
const controlled = open !== undefined;
|
|
41
42
|
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
42
|
-
|
|
43
|
+
// Closed while React hydrates server HTML (the server rendered no portal),
|
|
44
|
+
// open right after, so effects keyed on it run with the panel present.
|
|
45
|
+
const isOpen = useHydrated() && (controlled ? open : internalOpen);
|
|
43
46
|
const triggerRef = React.useRef(null);
|
|
44
47
|
const titleId = React.useId();
|
|
45
48
|
const descriptionId = React.useId();
|
|
@@ -47,13 +50,17 @@ export function AlertDialog({
|
|
|
47
50
|
if (!controlled) setInternalOpen(next);
|
|
48
51
|
if (onOpenChange) onOpenChange(next);
|
|
49
52
|
}, [controlled, onOpenChange]);
|
|
53
|
+
// the id of the Description actually rendered, so aria-describedby never points at nothing
|
|
54
|
+
const [describedBy, setDescribedBy] = React.useState(undefined);
|
|
50
55
|
const value = React.useMemo(() => ({
|
|
51
56
|
open: isOpen,
|
|
52
57
|
setOpen,
|
|
53
58
|
triggerRef,
|
|
54
59
|
titleId,
|
|
55
|
-
descriptionId
|
|
56
|
-
|
|
60
|
+
descriptionId,
|
|
61
|
+
describedBy,
|
|
62
|
+
setDescribedBy
|
|
63
|
+
}), [isOpen, setOpen, titleId, descriptionId, describedBy]);
|
|
57
64
|
return /*#__PURE__*/React.createElement(AlertDialogContext.Provider, {
|
|
58
65
|
value: value
|
|
59
66
|
}, children);
|
|
@@ -111,28 +118,26 @@ export const AlertDialogContent = /*#__PURE__*/React.forwardRef(function AlertDi
|
|
|
111
118
|
}, ref) {
|
|
112
119
|
const ctx = useAlertDialog('AlertDialogContent');
|
|
113
120
|
const panelRef = React.useRef(null);
|
|
121
|
+
const layer = useEscapeLayer(ctx.open, event => {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
ctx.setOpen(false);
|
|
124
|
+
});
|
|
125
|
+
useScrollLock(ctx.open);
|
|
114
126
|
React.useEffect(() => {
|
|
115
127
|
if (!ctx.open) return;
|
|
116
|
-
const previousOverflow = document.body.style.overflow;
|
|
117
|
-
document.body.style.overflow = 'hidden';
|
|
118
128
|
const panel = panelRef.current;
|
|
119
129
|
const preferred = panel && (panel.querySelector('[data-slot="alert-dialog-cancel"]') || panel.querySelector(FOCUSABLE));
|
|
120
130
|
(preferred || panel)?.focus();
|
|
121
131
|
return () => {
|
|
122
|
-
document.body.style.overflow = previousOverflow;
|
|
123
132
|
ctx.triggerRef.current?.focus?.();
|
|
124
133
|
};
|
|
125
134
|
}, [ctx.open, ctx.triggerRef]);
|
|
126
135
|
if (!ctx.open && !forceMount) return null;
|
|
127
136
|
const handleKeyDown = event => {
|
|
128
137
|
if (onKeyDown) onKeyDown(event);
|
|
129
|
-
if (event.defaultPrevented) return;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
ctx.setOpen(false);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (event.key !== 'Tab') return;
|
|
138
|
+
if (event.defaultPrevented || event.key !== 'Tab') return;
|
|
139
|
+
// focus inside a portaled child layer (a popover) is that layer's business
|
|
140
|
+
if (layer.children > 0 && !panelRef.current?.contains(document.activeElement)) return;
|
|
136
141
|
const focusable = Array.from(panelRef.current?.querySelectorAll(FOCUSABLE) || []);
|
|
137
142
|
if (!focusable.length) {
|
|
138
143
|
event.preventDefault();
|
|
@@ -156,14 +161,16 @@ export const AlertDialogContent = /*#__PURE__*/React.forwardRef(function AlertDi
|
|
|
156
161
|
role: "alertdialog",
|
|
157
162
|
"aria-modal": "true",
|
|
158
163
|
"aria-labelledby": ctx.titleId,
|
|
159
|
-
"aria-describedby": ctx.
|
|
164
|
+
"aria-describedby": rest['aria-describedby'] ?? ctx.describedBy,
|
|
160
165
|
tabIndex: -1,
|
|
161
166
|
"data-slot": "alert-dialog-content",
|
|
162
167
|
"data-state": ctx.open ? 'open' : 'closed',
|
|
163
168
|
"data-size": size,
|
|
164
169
|
className: `ef-alertdialog__content ef-alertdialog__content--${size}${className ? ' ' + className : ''}`,
|
|
165
170
|
onKeyDown: handleKeyDown
|
|
166
|
-
}),
|
|
171
|
+
}), /*#__PURE__*/React.createElement(escapeLayerContext.Provider, {
|
|
172
|
+
value: layer
|
|
173
|
+
}, children))));
|
|
167
174
|
});
|
|
168
175
|
export const AlertDialogHeader = /*#__PURE__*/React.forwardRef(function AlertDialogHeader({
|
|
169
176
|
className,
|
|
@@ -212,9 +219,15 @@ export const AlertDialogDescription = /*#__PURE__*/React.forwardRef(function Ale
|
|
|
212
219
|
...rest
|
|
213
220
|
}, ref) {
|
|
214
221
|
const ctx = useAlertDialog('AlertDialogDescription');
|
|
222
|
+
const resolved = rest.id || ctx.descriptionId;
|
|
223
|
+
const register = ctx.setDescribedBy;
|
|
224
|
+
useIsoLayoutEffect(() => {
|
|
225
|
+
register(resolved);
|
|
226
|
+
return () => register(undefined);
|
|
227
|
+
}, [register, resolved]);
|
|
215
228
|
return /*#__PURE__*/React.createElement("p", _extends({}, rest, {
|
|
216
229
|
ref: ref,
|
|
217
|
-
id:
|
|
230
|
+
id: resolved,
|
|
218
231
|
"data-slot": "alert-dialog-description",
|
|
219
232
|
className: `ef-alertdialog__description${className ? ' ' + className : ''}`
|
|
220
233
|
}));
|
package/feedback/Banner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { Icon } from "../icons/Icon.js";
|
package/feedback/Dialog.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
import { IconButton } from "../forms/IconButton.js";
|
|
5
|
-
import { mergeRefs } from "../forms/Button.js";
|
|
6
|
-
import { Portal } from "../overlay/Portal.js";
|
|
6
|
+
import { mergeRefs, useIsoLayoutEffect } from "../forms/Button.js";
|
|
7
|
+
import { Portal, useEscapeLayer, useScrollLock, escapeLayerContext, useHydrated } from "../overlay/Portal.js";
|
|
7
8
|
const DialogContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
-
const FOCUSABLE = 'button,[href],input,select,textarea,[tabindex]
|
|
9
|
+
const FOCUSABLE = 'button,[href],input,select,textarea,[tabindex]';
|
|
10
|
+
// what Tab can actually reach: not disabled, not taken out with tabindex=-1, not hidden
|
|
11
|
+
const tabbable = root => [...root.querySelectorAll(FOCUSABLE)].filter(x => !x.disabled && x.tabIndex >= 0 && !x.closest('[hidden]'));
|
|
9
12
|
function cx(base, className) {
|
|
10
13
|
return base + (className ? ` ${className}` : '');
|
|
11
14
|
}
|
|
@@ -24,17 +27,23 @@ export function Dialog({
|
|
|
24
27
|
const [internal, setInternal] = React.useState(defaultOpen);
|
|
25
28
|
const titleId = React.useId();
|
|
26
29
|
const descriptionId = React.useId();
|
|
27
|
-
|
|
30
|
+
// Closed while React hydrates server HTML (the server rendered no portal),
|
|
31
|
+
// open right after, so effects keyed on it run with the panel present.
|
|
32
|
+
const open = useHydrated() && (controlled === undefined ? internal : controlled);
|
|
28
33
|
const setOpen = React.useCallback(next => {
|
|
29
34
|
if (controlled === undefined) setInternal(next);
|
|
30
35
|
onOpenChange?.(next);
|
|
31
36
|
}, [controlled, onOpenChange]);
|
|
37
|
+
// the id of the Description actually rendered, so aria-describedby never points at nothing
|
|
38
|
+
const [describedBy, setDescribedBy] = React.useState(undefined);
|
|
32
39
|
const value = React.useMemo(() => ({
|
|
33
40
|
open,
|
|
34
41
|
setOpen,
|
|
35
42
|
titleId,
|
|
36
|
-
descriptionId
|
|
37
|
-
|
|
43
|
+
descriptionId,
|
|
44
|
+
describedBy,
|
|
45
|
+
setDescribedBy
|
|
46
|
+
}), [open, setOpen, titleId, descriptionId, describedBy]);
|
|
38
47
|
return /*#__PURE__*/React.createElement(DialogContext.Provider, {
|
|
39
48
|
value: value
|
|
40
49
|
}, children);
|
|
@@ -135,20 +144,21 @@ export const DialogContent = /*#__PURE__*/React.forwardRef(function DialogConten
|
|
|
135
144
|
if (!ctx || !ctx.open) return;
|
|
136
145
|
previous.current = document.activeElement;
|
|
137
146
|
const panel = panelRef.current;
|
|
138
|
-
const first = panel && panel
|
|
147
|
+
const first = panel && tabbable(panel)[0];
|
|
139
148
|
(first || panel).focus();
|
|
140
149
|
return () => previous.current && previous.current.focus && previous.current.focus();
|
|
141
150
|
}, [ctx && ctx.open]);
|
|
151
|
+
useScrollLock(!!(ctx && ctx.open));
|
|
152
|
+
const layer = useEscapeLayer(!!(ctx && ctx.open), e => {
|
|
153
|
+
if (onEscapeKeyDown) onEscapeKeyDown(e);
|
|
154
|
+
if (!e.defaultPrevented) ctx.setOpen(false);
|
|
155
|
+
});
|
|
142
156
|
React.useEffect(() => {
|
|
143
157
|
if (!ctx || !ctx.open) return;
|
|
144
158
|
const key = e => {
|
|
145
|
-
if (e.key
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (e.key !== 'Tab') return;
|
|
151
|
-
const f = [...panelRef.current.querySelectorAll(FOCUSABLE)].filter(x => !x.disabled);
|
|
159
|
+
if (e.key !== 'Tab' || e.defaultPrevented) return;
|
|
160
|
+
if (layer.children > 0 && !panelRef.current.contains(document.activeElement)) return;
|
|
161
|
+
const f = tabbable(panelRef.current);
|
|
152
162
|
if (!f.length) return e.preventDefault();
|
|
153
163
|
const i = f.indexOf(document.activeElement);
|
|
154
164
|
if (e.shiftKey && i <= 0) {
|
|
@@ -161,7 +171,7 @@ export const DialogContent = /*#__PURE__*/React.forwardRef(function DialogConten
|
|
|
161
171
|
};
|
|
162
172
|
document.addEventListener('keydown', key);
|
|
163
173
|
return () => document.removeEventListener('keydown', key);
|
|
164
|
-
}, [ctx && ctx.open
|
|
174
|
+
}, [ctx && ctx.open]);
|
|
165
175
|
if (!ctx || !ctx.open) return null;
|
|
166
176
|
return /*#__PURE__*/React.createElement(DialogPortal, null, /*#__PURE__*/React.createElement(DialogOverlay, _extends({}, overlayProps, {
|
|
167
177
|
ref: overlayRef
|
|
@@ -171,7 +181,7 @@ export const DialogContent = /*#__PURE__*/React.forwardRef(function DialogConten
|
|
|
171
181
|
role: "dialog",
|
|
172
182
|
"aria-modal": "true",
|
|
173
183
|
"aria-labelledby": rest['aria-label'] ? undefined : ctx.titleId,
|
|
174
|
-
"aria-describedby": ctx.
|
|
184
|
+
"aria-describedby": rest['aria-describedby'] ?? ctx.describedBy,
|
|
175
185
|
tabIndex: -1,
|
|
176
186
|
className: cx('ef-dialog__content', className),
|
|
177
187
|
style: {
|
|
@@ -179,7 +189,9 @@ export const DialogContent = /*#__PURE__*/React.forwardRef(function DialogConten
|
|
|
179
189
|
maxWidth: width,
|
|
180
190
|
...style
|
|
181
191
|
}
|
|
182
|
-
}),
|
|
192
|
+
}), /*#__PURE__*/React.createElement(escapeLayerContext.Provider, {
|
|
193
|
+
value: layer
|
|
194
|
+
}, children), showCloseButton ? /*#__PURE__*/React.createElement("div", {
|
|
183
195
|
className: "ef-dialog__close"
|
|
184
196
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
185
197
|
icon: "x",
|
|
@@ -231,9 +243,16 @@ export const DialogDescription = /*#__PURE__*/React.forwardRef(function DialogDe
|
|
|
231
243
|
...rest
|
|
232
244
|
}, ref) {
|
|
233
245
|
const ctx = React.useContext(DialogContext);
|
|
246
|
+
const resolved = id || ctx && ctx.descriptionId;
|
|
247
|
+
const register = ctx && ctx.setDescribedBy;
|
|
248
|
+
useIsoLayoutEffect(() => {
|
|
249
|
+
if (!register) return;
|
|
250
|
+
register(resolved);
|
|
251
|
+
return () => register(undefined);
|
|
252
|
+
}, [register, resolved]);
|
|
234
253
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
235
254
|
ref: ref,
|
|
236
|
-
id:
|
|
255
|
+
id: resolved,
|
|
237
256
|
"data-slot": slot,
|
|
238
257
|
className: cx('ef-dialog__description', className)
|
|
239
258
|
}));
|
package/feedback/Loader.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
export function Loader({
|
package/feedback/Progress.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
function classes(...values) {
|
package/feedback/Spinner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
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
4
|
import React from 'react';
|
|
4
5
|
export const Spinner = /*#__PURE__*/React.forwardRef(function Spinner({
|