@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/forms/Slider.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 { useFieldProps } from "./Field.js";
|
|
@@ -8,6 +9,12 @@ function clamp(value, min, max) {
|
|
|
8
9
|
function asArray(value, fallback) {
|
|
9
10
|
return Array.isArray(value) ? value : fallback;
|
|
10
11
|
}
|
|
12
|
+
// value + step in floating point gives 0.30000000000000004 for 0.2 + 0.1; round
|
|
13
|
+
// to the step's decimals so keyboard steps land where a native step would.
|
|
14
|
+
function stepFrom(value, delta, step) {
|
|
15
|
+
const decimals = (String(step).split('.')[1] || '').length;
|
|
16
|
+
return Number((value + delta).toFixed(decimals));
|
|
17
|
+
}
|
|
11
18
|
export const Slider = /*#__PURE__*/React.forwardRef(function Slider({
|
|
12
19
|
min = 0,
|
|
13
20
|
max = 100,
|
|
@@ -56,6 +63,9 @@ export const Slider = /*#__PURE__*/React.forwardRef(function Slider({
|
|
|
56
63
|
insetInlineStart: `${inverted ? 100 - high : low}%`,
|
|
57
64
|
width: `${high - low}%`
|
|
58
65
|
};
|
|
66
|
+
// Every thumb's native min/max is the full range, so each thumb sits on the
|
|
67
|
+
// shared track where the range fill ends. The neighbour limit is enforced by
|
|
68
|
+
// update() and announced through aria-valuemin/aria-valuemax.
|
|
59
69
|
const control = /*#__PURE__*/React.createElement("span", {
|
|
60
70
|
className: "ef-slider__control"
|
|
61
71
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -67,20 +77,33 @@ export const Slider = /*#__PURE__*/React.forwardRef(function Slider({
|
|
|
67
77
|
style: rangeStyle
|
|
68
78
|
})), values.map((value, index) => /*#__PURE__*/React.createElement("input", _extends({}, rest, field.controlProps, {
|
|
69
79
|
key: index,
|
|
80
|
+
id: index === 0 ? field.controlProps.id || rest.id : undefined,
|
|
70
81
|
type: "range",
|
|
71
82
|
"data-slot": "slider-thumb",
|
|
72
83
|
"aria-label": rest['aria-label'] ? `${rest['aria-label']}${values.length > 1 ? ` ${index + 1}` : ''}` : undefined,
|
|
73
|
-
min:
|
|
74
|
-
max:
|
|
84
|
+
min: min,
|
|
85
|
+
max: max,
|
|
86
|
+
"aria-valuemin": index > 0 ? values[index - 1] + minStepsBetweenThumbs * step : min,
|
|
87
|
+
"aria-valuemax": index < values.length - 1 ? values[index + 1] - minStepsBetweenThumbs * step : max,
|
|
75
88
|
step: step,
|
|
76
89
|
value: value,
|
|
77
90
|
disabled: disabled,
|
|
78
91
|
dir: inverted ? dir === 'rtl' ? 'ltr' : 'rtl' : dir,
|
|
79
92
|
className: "ef-slider__input",
|
|
80
93
|
onChange: event => update(index, Number(event.target.value)),
|
|
94
|
+
onKeyDown: event => {
|
|
95
|
+
rest.onKeyDown?.(event);
|
|
96
|
+
if (event.defaultPrevented || orientation === 'vertical' || event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;
|
|
97
|
+
// WebKit steps a native range by key, not by side: ArrowRight raises the
|
|
98
|
+
// value even when the thumb moves left in RTL. Step toward the arrow's
|
|
99
|
+
// side in every engine, as Chromium does natively.
|
|
100
|
+
const rtl = event.currentTarget.closest('[dir]')?.getAttribute('dir') === 'rtl';
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
update(index, stepFrom(value, event.key === 'ArrowRight' !== rtl ? step : -step, step));
|
|
103
|
+
},
|
|
81
104
|
onPointerUp: () => onValueCommit?.(latestRef.current),
|
|
82
105
|
onKeyUp: event => {
|
|
83
|
-
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) onValueCommit?.(latestRef.current);
|
|
106
|
+
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes(event.key)) onValueCommit?.(latestRef.current);
|
|
84
107
|
}
|
|
85
108
|
}))));
|
|
86
109
|
const rootProps = {
|
package/forms/Switch.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 { mergeRefs } from "./Button.js";
|
|
4
6
|
import { useFieldProps } from "./Field.js";
|
|
5
7
|
export const Switch = /*#__PURE__*/React.forwardRef(function Switch({
|
|
6
8
|
label,
|
|
@@ -23,12 +25,16 @@ export const Switch = /*#__PURE__*/React.forwardRef(function Switch({
|
|
|
23
25
|
'aria-describedby': rest['aria-describedby']
|
|
24
26
|
});
|
|
25
27
|
const [inner, setInner] = React.useState(!!defaultChecked);
|
|
28
|
+
const uid = React.useId();
|
|
29
|
+
const buttonRef = React.useRef(null);
|
|
30
|
+
const labelId = label ? `${uid}l` : undefined;
|
|
26
31
|
const checked = checkedProp !== undefined ? checkedProp : inner;
|
|
27
32
|
const control = /*#__PURE__*/React.createElement("button", _extends({
|
|
28
|
-
ref: ref,
|
|
33
|
+
ref: mergeRefs(ref, buttonRef),
|
|
29
34
|
type: "button",
|
|
30
35
|
role: "switch",
|
|
31
36
|
"aria-checked": checked,
|
|
37
|
+
"aria-labelledby": labelId,
|
|
32
38
|
"aria-required": required || undefined,
|
|
33
39
|
disabled: disabled,
|
|
34
40
|
"data-slot": "switch",
|
|
@@ -55,8 +61,14 @@ export const Switch = /*#__PURE__*/React.forwardRef(function Switch({
|
|
|
55
61
|
}) : null;
|
|
56
62
|
if (!label) return /*#__PURE__*/React.createElement(React.Fragment, null, control, formValue);
|
|
57
63
|
return /*#__PURE__*/React.createElement("span", {
|
|
58
|
-
className: "ef-switch-field"
|
|
64
|
+
className: "ef-switch-field",
|
|
65
|
+
"data-disabled": disabled ? '' : undefined
|
|
59
66
|
}, control, /*#__PURE__*/React.createElement("span", {
|
|
60
|
-
|
|
67
|
+
id: labelId,
|
|
68
|
+
className: "ef-switch__label",
|
|
69
|
+
onClick: event => {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
if (!disabled) buttonRef.current?.click();
|
|
72
|
+
}
|
|
61
73
|
}, label), formValue);
|
|
62
74
|
});
|
package/forms/Textarea.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/forms/Toggle.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
|
const GroupCtx = /*#__PURE__*/React.createContext(null);
|
package/icons/Icon.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
// The Icon that ships to bundler consumers: the npm package (scripts/build_npm.mjs)
|
|
3
|
+
// and the copy-in registry (scripts/build_registry.py) both use this file in
|
|
4
|
+
// place of components/icons/Icon.jsx. That one fetches each SVG from a base URL
|
|
5
|
+
// only the zero-build site has; here every glyph is in ./_svg.js, generated from
|
|
6
|
+
// assets/icons/ by scripts/build_registry.py, so nothing depends on where the app
|
|
7
|
+
// is served from. Keep the props and the output markup identical to the original.
|
|
2
8
|
import React from 'react';
|
|
3
9
|
import { SVGS } from './_svg.js';
|
|
4
10
|
|
package/icons/_svg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by scripts/
|
|
1
|
+
// Generated by scripts/build_registry.py from assets/icons/. Do not edit.
|
|
2
2
|
export const SVGS = {
|
|
3
3
|
"activity": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\"></path>\n</svg>",
|
|
4
4
|
"archive": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\"></rect>\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\"></path>\n <path d=\"M10 12h4\"></path>\n</svg>",
|
package/index.js
CHANGED
|
@@ -53,7 +53,7 @@ export { badgeVariants, Badge } from './display/Badge.js';
|
|
|
53
53
|
export { CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter, Card } from './display/Card.js';
|
|
54
54
|
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext } from './display/Carousel.js';
|
|
55
55
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './display/Collapsible.js';
|
|
56
|
-
export { DirectionProvider } from './display/Direction.js';
|
|
56
|
+
export { DirectionProvider, useDirection } from './display/Direction.js';
|
|
57
57
|
export { Divider } from './display/Divider.js';
|
|
58
58
|
export { ItemGroup, ItemSeparator, Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions, ItemHeader, ItemFooter } from './display/Item.js';
|
|
59
59
|
export { Kbd, KbdGroup } from './display/Kbd.js';
|
|
@@ -81,10 +81,10 @@ export { FileTile } from './files/FileTile.js';
|
|
|
81
81
|
export { FileTypeIcon } from './files/FileTypeIcon.js';
|
|
82
82
|
export { PaymentCard } from './finance/PaymentCard.js';
|
|
83
83
|
export { buttonVariants, Button } from './forms/Button.js';
|
|
84
|
-
export { ButtonGroup, ButtonGroupText, ButtonGroupSeparator } from './forms/ButtonGroup.js';
|
|
84
|
+
export { buttonGroupVariants, ButtonGroup, ButtonGroupText, ButtonGroupSeparator } from './forms/ButtonGroup.js';
|
|
85
85
|
export { ButtonTile, ButtonTileGroup } from './forms/ButtonTile.js';
|
|
86
86
|
export { Checkbox } from './forms/Checkbox.js';
|
|
87
|
-
export { Combobox, ComboboxValue, ComboboxTrigger, ComboboxClear, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput } from './forms/Combobox.js';
|
|
87
|
+
export { Combobox, ComboboxValue, ComboboxTrigger, ComboboxClear, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, useComboboxAnchor } from './forms/Combobox.js';
|
|
88
88
|
export { Field, FieldSet, FieldGroup, FieldContent, FieldLabel, FieldTitle, FieldDescription, FieldLegend, FieldSeparator, FieldError } from './forms/Field.js';
|
|
89
89
|
export { IconButton } from './forms/IconButton.js';
|
|
90
90
|
export { Input } from './forms/Input.js';
|
|
@@ -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/navigation/Menubar.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";
|
|
@@ -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 ReactDOM from 'react-dom';
|
|
@@ -38,6 +39,7 @@ export const NavigationMenu = /*#__PURE__*/React.forwardRef(function NavigationM
|
|
|
38
39
|
});
|
|
39
40
|
const rootRef = React.useRef(null);
|
|
40
41
|
const timerRef = React.useRef(null);
|
|
42
|
+
const pendingFocusRef = React.useRef(null);
|
|
41
43
|
const value = controlled === undefined ? internal : controlled;
|
|
42
44
|
const setValue = React.useCallback(next => {
|
|
43
45
|
if (controlled === undefined) setInternal(next);
|
|
@@ -48,11 +50,13 @@ export const NavigationMenu = /*#__PURE__*/React.forwardRef(function NavigationM
|
|
|
48
50
|
if (!root || !trigger) return;
|
|
49
51
|
const rootRect = root.getBoundingClientRect();
|
|
50
52
|
const triggerRect = trigger.getBoundingClientRect();
|
|
53
|
+
// inset-inline-start counts from the right edge in a right-to-left layout
|
|
54
|
+
const rtl = (root.closest('[dir]')?.getAttribute('dir') || direction) === 'rtl';
|
|
51
55
|
setIndicator({
|
|
52
|
-
start: triggerRect.left - rootRect.left,
|
|
56
|
+
start: rtl ? rootRect.right - triggerRect.right : triggerRect.left - rootRect.left,
|
|
53
57
|
width: triggerRect.width
|
|
54
58
|
});
|
|
55
|
-
}, []);
|
|
59
|
+
}, [direction]);
|
|
56
60
|
const openItem = React.useCallback((next, trigger, immediate = false) => {
|
|
57
61
|
clearTimeout(timerRef.current);
|
|
58
62
|
const open = () => {
|
|
@@ -96,7 +100,8 @@ export const NavigationMenu = /*#__PURE__*/React.forwardRef(function NavigationM
|
|
|
96
100
|
tabStop,
|
|
97
101
|
setTabStop,
|
|
98
102
|
indicator,
|
|
99
|
-
updateIndicator
|
|
103
|
+
updateIndicator,
|
|
104
|
+
pendingFocusRef
|
|
100
105
|
}), [value, setValue, viewport, viewportNode, openItem, moveTrigger, focusTrigger, direction, orientation, tabStop, indicator, updateIndicator]);
|
|
101
106
|
return /*#__PURE__*/React.createElement(NavigationRootContext.Provider, {
|
|
102
107
|
value: context
|
|
@@ -161,8 +166,10 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
161
166
|
if (event.defaultPrevented) return;
|
|
162
167
|
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown') {
|
|
163
168
|
event.preventDefault();
|
|
169
|
+
// the panel may not exist yet (the viewport mounts on first open), so the
|
|
170
|
+
// content moves focus into itself once it has rendered
|
|
171
|
+
if (root) root.pendingFocusRef.current = itemValue;
|
|
164
172
|
root?.openItem(itemValue, localRef.current, true);
|
|
165
|
-
requestAnimationFrame(() => root?.viewportNode?.querySelector('a,button,[tabindex]:not([tabindex="-1"])')?.focus());
|
|
166
173
|
} else if (root?.orientation === 'horizontal' && (event.key === 'ArrowLeft' || event.key === 'ArrowRight') || root?.orientation === 'vertical' && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
|
|
167
174
|
event.preventDefault();
|
|
168
175
|
const visualDelta = event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1;
|
|
@@ -209,6 +216,12 @@ export const NavigationMenuContent = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
209
216
|
const root = React.useContext(NavigationRootContext);
|
|
210
217
|
const itemValue = React.useContext(NavigationItemContext);
|
|
211
218
|
const open = root?.value === itemValue;
|
|
219
|
+
const localRef = React.useRef(null);
|
|
220
|
+
useIsoLayoutEffect(() => {
|
|
221
|
+
if (!open || !localRef.current || root?.pendingFocusRef.current !== itemValue) return;
|
|
222
|
+
root.pendingFocusRef.current = null;
|
|
223
|
+
localRef.current.querySelector('a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"])')?.focus();
|
|
224
|
+
});
|
|
212
225
|
const keyboard = event => {
|
|
213
226
|
onKeyDown?.(event);
|
|
214
227
|
if (!event.defaultPrevented && event.key === 'Escape') {
|
|
@@ -219,7 +232,7 @@ export const NavigationMenuContent = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
219
232
|
};
|
|
220
233
|
if (!open && !forceMount) return null;
|
|
221
234
|
const content = /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
222
|
-
ref: ref,
|
|
235
|
+
ref: mergeRefs(ref, localRef),
|
|
223
236
|
"data-slot": "navigation-menu-content",
|
|
224
237
|
"data-state": open ? 'open' : 'closed',
|
|
225
238
|
hidden: !open,
|
|
@@ -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 PageControl({
|
|
@@ -19,6 +20,7 @@ export function PageControl({
|
|
|
19
20
|
length: count
|
|
20
21
|
}, (_, i) => /*#__PURE__*/React.createElement("button", {
|
|
21
22
|
key: i,
|
|
23
|
+
type: "button",
|
|
22
24
|
role: "tab",
|
|
23
25
|
"aria-selected": i === index,
|
|
24
26
|
"aria-label": `${label} ${i + 1} of ${count}`,
|
package/navigation/Pagination.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";
|
|
@@ -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";
|
|
@@ -21,6 +22,7 @@ export function SegmentedControl({
|
|
|
21
22
|
} : o;
|
|
22
23
|
return /*#__PURE__*/React.createElement("button", {
|
|
23
24
|
key: opt.id,
|
|
25
|
+
type: "button",
|
|
24
26
|
className: `ef-seg__opt${value === opt.id ? ' ef-seg__opt--active' : ''}`,
|
|
25
27
|
"aria-pressed": value === opt.id,
|
|
26
28
|
disabled: opt.disabled,
|
package/navigation/SideNav.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";
|
|
@@ -52,6 +53,8 @@ export function SideNav({
|
|
|
52
53
|
}
|
|
53
54
|
}, g.items.map(it => /*#__PURE__*/React.createElement("button", {
|
|
54
55
|
key: it.id,
|
|
56
|
+
type: "button",
|
|
57
|
+
"aria-current": value === it.id ? 'page' : undefined,
|
|
55
58
|
className: `ef-sidenav__item${value === it.id ? ' ef-sidenav__item--on' : ''}`,
|
|
56
59
|
onClick: () => onChange && onChange(it.id)
|
|
57
60
|
}, /*#__PURE__*/React.createElement("span", {
|
package/navigation/Sidebar.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
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";
|
|
5
6
|
import { mergeRefs } from "../forms/Button.js";
|
|
7
|
+
import { useScrollLock, useEscapeLayer, escapeLayerContext } from "../overlay/Portal.js";
|
|
6
8
|
const SidebarContext = /*#__PURE__*/React.createContext(null);
|
|
9
|
+
// Cmd/Ctrl+B is "bold" in every text field and rich-text editor; the sidebar
|
|
10
|
+
// shortcut must not take it from them.
|
|
11
|
+
const EDITABLE = 'input,textarea,select,[contenteditable]:not([contenteditable="false"])';
|
|
12
|
+
const isEditable = target => !!(target && target.closest && target.closest(EDITABLE));
|
|
7
13
|
const join = (...parts) => parts.filter(Boolean).join(' ');
|
|
8
14
|
function compose(render, fallback, props, ref, children) {
|
|
9
15
|
if (/*#__PURE__*/React.isValidElement(render)) return /*#__PURE__*/React.cloneElement(render, {
|
|
@@ -52,18 +58,14 @@ export const SidebarProvider = /*#__PURE__*/React.forwardRef(function SidebarPro
|
|
|
52
58
|
}, []);
|
|
53
59
|
React.useEffect(() => {
|
|
54
60
|
const onKeyDown = event => {
|
|
55
|
-
if (event.key === '
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
setOpenMobile(false);
|
|
58
|
-
}
|
|
59
|
-
if (event.key.toLowerCase() === 'b' && (event.metaKey || event.ctrlKey)) {
|
|
61
|
+
if (typeof event.key === 'string' && event.key.toLowerCase() === 'b' && (event.metaKey || event.ctrlKey) && !isEditable(event.target)) {
|
|
60
62
|
event.preventDefault();
|
|
61
63
|
toggleSidebar();
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
window.addEventListener('keydown', onKeyDown);
|
|
65
67
|
return () => window.removeEventListener('keydown', onKeyDown);
|
|
66
|
-
}, [
|
|
68
|
+
}, [toggleSidebar]);
|
|
67
69
|
const context = React.useMemo(() => ({
|
|
68
70
|
state: open ? 'expanded' : 'collapsed',
|
|
69
71
|
open,
|
|
@@ -110,17 +112,79 @@ export const Sidebar = /*#__PURE__*/React.forwardRef(function Sidebar({
|
|
|
110
112
|
}), /*#__PURE__*/React.createElement("div", {
|
|
111
113
|
"data-slot": "sidebar-container",
|
|
112
114
|
className: "ef-sidebar__panel"
|
|
113
|
-
}, children)), context.openMobile ? /*#__PURE__*/React.createElement(
|
|
115
|
+
}, children)), context.openMobile ? /*#__PURE__*/React.createElement(MobileSidebarPanel, {
|
|
116
|
+
common: common,
|
|
117
|
+
dir: dir,
|
|
118
|
+
label: props['aria-label'] || 'Sidebar',
|
|
119
|
+
onClose: () => context.setOpenMobile(false)
|
|
120
|
+
}, children) : null);
|
|
121
|
+
});
|
|
122
|
+
const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
123
|
+
|
|
124
|
+
// The off-canvas sidebar on a phone covers the page behind a backdrop, so it
|
|
125
|
+
// behaves as a modal dialog: focus moves in, Tab stays in, the page does not
|
|
126
|
+
// scroll, and closing returns focus to whatever opened it. Escape goes through
|
|
127
|
+
// the shared layer stack, so a menu, popover or dialog opened inside the panel
|
|
128
|
+
// closes first and the panel only on the next press.
|
|
129
|
+
function MobileSidebarPanel({
|
|
130
|
+
common,
|
|
131
|
+
dir,
|
|
132
|
+
label,
|
|
133
|
+
onClose,
|
|
134
|
+
children
|
|
135
|
+
}) {
|
|
136
|
+
const panelRef = React.useRef(null);
|
|
137
|
+
useScrollLock(true);
|
|
138
|
+
const layer = useEscapeLayer(true, event => {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
onClose();
|
|
141
|
+
});
|
|
142
|
+
React.useEffect(() => {
|
|
143
|
+
const previous = document.activeElement;
|
|
144
|
+
const panel = panelRef.current;
|
|
145
|
+
(panel?.querySelector(FOCUSABLE) || panel)?.focus();
|
|
146
|
+
return () => {
|
|
147
|
+
if (previous && previous.isConnected && previous.focus) previous.focus();
|
|
148
|
+
};
|
|
149
|
+
}, []);
|
|
150
|
+
const keydown = event => {
|
|
151
|
+
if (event.key !== 'Tab' || event.defaultPrevented) return;
|
|
152
|
+
// focus inside a portaled child layer (a popover) is that layer's business
|
|
153
|
+
if (layer.children > 0 && !panelRef.current?.contains(document.activeElement)) return;
|
|
154
|
+
const items = Array.from(panelRef.current?.querySelectorAll(FOCUSABLE) || []);
|
|
155
|
+
if (!items.length) {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const index = items.indexOf(document.activeElement);
|
|
160
|
+
if (event.shiftKey && index <= 0) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
items[items.length - 1].focus();
|
|
163
|
+
} else if (!event.shiftKey && (index < 0 || index === items.length - 1)) {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
items[0].focus();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
114
169
|
type: "button",
|
|
115
170
|
className: "ef-sidebar-mobile-backdrop",
|
|
116
171
|
"aria-label": "Close sidebar",
|
|
117
|
-
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
onClick: onClose
|
|
118
174
|
}), /*#__PURE__*/React.createElement("aside", _extends({}, common, {
|
|
175
|
+
ref: panelRef,
|
|
119
176
|
dir: dir,
|
|
120
177
|
"data-mobile": "true",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
178
|
+
role: "dialog",
|
|
179
|
+
"aria-modal": "true",
|
|
180
|
+
"aria-label": label,
|
|
181
|
+
tabIndex: -1,
|
|
182
|
+
className: "ef-sidebar-mobile",
|
|
183
|
+
onKeyDown: keydown
|
|
184
|
+
}), /*#__PURE__*/React.createElement(escapeLayerContext.Provider, {
|
|
185
|
+
value: layer
|
|
186
|
+
}, children)));
|
|
187
|
+
}
|
|
124
188
|
export const SidebarTrigger = /*#__PURE__*/React.forwardRef(function SidebarTrigger({
|
|
125
189
|
render,
|
|
126
190
|
className,
|
package/navigation/SkipLink.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface SkipLinkProps {
|
|
2
|
-
/**
|
|
2
|
+
/** Fragment of the target landmark. The link focuses it directly (adding tabIndex=-1 if needed) without changing location.hash. @default '#main' */
|
|
3
3
|
href?: string;
|
|
4
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
style?: React.CSSProperties;
|
|
6
7
|
className?: string;
|
package/navigation/SkipLink.js
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
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
|
/**
|
|
5
6
|
* First focusable element on the page: one Tab press moves a keyboard user past
|
|
6
7
|
* the whole header into the content.
|
|
7
8
|
*
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* The link moves focus to its target itself instead of following the hash:
|
|
10
|
+
* a plain jump changes location.hash, which a hash-based router reads as a
|
|
11
|
+
* route, and Safari and Firefox scroll without moving focus unless the target
|
|
12
|
+
* is focusable. The target gets `tabIndex=-1` when it has no tabindex, then
|
|
13
|
+
* receives focus. An onClick that calls preventDefault keeps full control.
|
|
12
14
|
*/
|
|
13
15
|
export function SkipLink({
|
|
14
16
|
href = '#main',
|
|
15
17
|
children = 'Skip to content',
|
|
16
18
|
style,
|
|
17
19
|
className,
|
|
20
|
+
onClick,
|
|
18
21
|
...rest
|
|
19
22
|
}) {
|
|
23
|
+
const jump = event => {
|
|
24
|
+
onClick?.(event);
|
|
25
|
+
if (event.defaultPrevented || typeof href !== 'string' || href.length < 2 || href[0] !== '#') return;
|
|
26
|
+
const target = document.getElementById(decodeURIComponent(href.slice(1)));
|
|
27
|
+
if (!target) return;
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');
|
|
30
|
+
target.focus();
|
|
31
|
+
};
|
|
20
32
|
return /*#__PURE__*/React.createElement("a", _extends({}, rest, {
|
|
21
33
|
href: href,
|
|
34
|
+
onClick: jump,
|
|
22
35
|
className: `ef-skip${className ? ' ' + className : ''}`,
|
|
23
36
|
style: style
|
|
24
37
|
}), children);
|
package/navigation/Steps.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/navigation/Tabs.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/navigation/TopNav.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 TopNav({
|
package/overlay/Command.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";
|
|
@@ -227,6 +228,7 @@ export const CommandItem = /*#__PURE__*/React.forwardRef(function CommandItem({
|
|
|
227
228
|
"data-disabled": disabled ? 'true' : 'false',
|
|
228
229
|
role: "option",
|
|
229
230
|
"aria-selected": selected,
|
|
231
|
+
tabIndex: -1,
|
|
230
232
|
disabled: disabled,
|
|
231
233
|
hidden: hidden,
|
|
232
234
|
className: join('ef-command__item', className),
|