@efolusi/meridian 1.22.0 → 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.
Files changed (137) hide show
  1. package/LICENSE +201 -21
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/ai/AgentRun.js +1 -0
  4. package/ai/Bubble.js +1 -0
  5. package/ai/ChatMessage.js +1 -0
  6. package/ai/Citation.js +1 -0
  7. package/ai/Confirmation.js +1 -0
  8. package/ai/Conversation.js +1 -0
  9. package/ai/DocumentCard.js +1 -0
  10. package/ai/FeedbackBar.js +1 -0
  11. package/ai/GeneratedImage.js +1 -0
  12. package/ai/Marker.js +1 -0
  13. package/ai/Message.js +1 -0
  14. package/ai/MessageScroller.js +1 -0
  15. package/ai/ModelSelector.js +1 -0
  16. package/ai/Player.js +1 -0
  17. package/ai/PromptComposer.js +1 -0
  18. package/ai/PromptSteps.js +1 -0
  19. package/ai/Reasoning.js +1 -0
  20. package/ai/RichComposer.js +1 -0
  21. package/ai/Sandbox.js +1 -0
  22. package/ai/SelectionQuote.js +1 -0
  23. package/ai/SourceCard.js +1 -0
  24. package/ai/Suggestions.js +1 -0
  25. package/ai/Task.js +1 -0
  26. package/ai/Todo.js +1 -0
  27. package/ai/ToolCall.js +1 -0
  28. package/ai/Transcript.js +1 -0
  29. package/ai/UsageMeter.js +1 -0
  30. package/ai/WebPreview.js +1 -0
  31. package/code/CodeBlock.js +1 -0
  32. package/code/Console.js +1 -0
  33. package/code/CopyField.js +1 -0
  34. package/code/Diff.js +1 -0
  35. package/code/EnvList.js +1 -0
  36. package/code/Exception.js +1 -0
  37. package/code/Terminal.js +1 -0
  38. package/components.css +2 -0
  39. package/data/BarChart.js +1 -0
  40. package/data/Chart.js +5 -2
  41. package/data/DonutChart.js +4 -4
  42. package/data/EmptyState.js +1 -0
  43. package/data/KeyValueList.js +1 -0
  44. package/data/LineChart.js +1 -0
  45. package/data/Skeleton.js +1 -0
  46. package/data/Sparkline.js +1 -0
  47. package/data/Stat.js +1 -0
  48. package/data/StatusDot.js +1 -0
  49. package/data/Table.js +1 -0
  50. package/dates/Calendar.js +1 -0
  51. package/dates/TimePicker.js +1 -0
  52. package/display/Accordion.js +1 -0
  53. package/display/AspectRatio.js +1 -0
  54. package/display/Avatar.js +1 -0
  55. package/display/Badge.js +1 -0
  56. package/display/Card.js +1 -0
  57. package/display/Carousel.js +24 -6
  58. package/display/Collapsible.js +1 -0
  59. package/display/Direction.js +1 -0
  60. package/display/Divider.js +1 -0
  61. package/display/Item.js +1 -0
  62. package/display/Kbd.js +1 -0
  63. package/display/Link.js +1 -0
  64. package/display/Resizable.js +5 -4
  65. package/display/ScrollArea.js +4 -2
  66. package/display/Separator.js +1 -0
  67. package/display/Tag.js +1 -0
  68. package/display/Timeline.js +1 -0
  69. package/display/Toolbar.js +1 -0
  70. package/display/TreeList.js +1 -0
  71. package/feedback/Alert.js +1 -0
  72. package/feedback/AlertDialog.js +20 -7
  73. package/feedback/Banner.js +1 -0
  74. package/feedback/ConfirmDialog.js +1 -0
  75. package/feedback/Dialog.js +21 -7
  76. package/feedback/Loader.js +1 -0
  77. package/feedback/Progress.js +1 -0
  78. package/feedback/Spinner.js +1 -0
  79. package/feedback/Toast.js +5 -1
  80. package/feedback/Tooltip.js +20 -5
  81. package/files/Attachment.js +1 -0
  82. package/files/FileDrop.js +1 -0
  83. package/files/FileTile.js +1 -0
  84. package/files/FileTypeIcon.js +1 -0
  85. package/finance/PaymentCard.js +1 -0
  86. package/forms/Button.js +55 -0
  87. package/forms/ButtonGroup.js +1 -0
  88. package/forms/ButtonTile.js +1 -0
  89. package/forms/Checkbox.js +1 -0
  90. package/forms/Combobox.js +10 -4
  91. package/forms/Field.js +1 -0
  92. package/forms/IconButton.js +1 -0
  93. package/forms/Input.js +1 -0
  94. package/forms/InputGroup.js +1 -0
  95. package/forms/InputOTP.js +1 -0
  96. package/forms/Label.js +1 -0
  97. package/forms/NativeSelect.js +1 -0
  98. package/forms/NumberInput.js +1 -0
  99. package/forms/Questionnaire.js +1 -0
  100. package/forms/Radio.js +1 -0
  101. package/forms/Select.js +7 -4
  102. package/forms/Slider.js +24 -2
  103. package/forms/Switch.js +1 -0
  104. package/forms/Textarea.js +1 -0
  105. package/forms/Toggle.js +1 -0
  106. package/icons/Icon.js +6 -0
  107. package/icons/_svg.js +1 -1
  108. package/navigation/Breadcrumbs.js +1 -0
  109. package/navigation/Menubar.js +1 -0
  110. package/navigation/NavigationMenu.js +1 -0
  111. package/navigation/PageControl.js +1 -0
  112. package/navigation/Pagination.js +1 -0
  113. package/navigation/SegmentedControl.js +1 -0
  114. package/navigation/SideNav.js +1 -0
  115. package/navigation/Sidebar.js +1 -0
  116. package/navigation/SkipLink.js +1 -0
  117. package/navigation/Steps.js +1 -0
  118. package/navigation/Tabs.js +1 -0
  119. package/navigation/TopNav.js +1 -0
  120. package/overlay/Command.js +1 -0
  121. package/overlay/ContextMenu.js +8 -3
  122. package/overlay/Drawer.d.ts +4 -1
  123. package/overlay/Drawer.js +6 -2
  124. package/overlay/DropdownMenu.js +8 -3
  125. package/overlay/HoverCard.js +22 -7
  126. package/overlay/Popover.js +22 -7
  127. package/overlay/Portal.js +30 -0
  128. package/overlay/Sheet.js +1 -0
  129. package/package.json +2 -2
  130. package/tailwind.preset.cjs +40 -29
  131. package/tokens/base.css +16 -5
  132. package/tokens/colors.css +248 -50
  133. package/tokens/effects.css +33 -20
  134. package/tokens/fonts.css +7 -0
  135. package/tokens/spacing.css +42 -17
  136. package/tokens/typography.css +29 -8
  137. package/tokens.json +268 -26
package/forms/Button.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";
@@ -21,9 +22,46 @@ import { Icon } from "../icons/Icon.js";
21
22
  * app rule accidentally collided with a component rule and lost, it now wins.
22
23
  * That is the intended direction, but it is a real change and worth looking at
23
24
  * a page or two after upgrading.
25
+ *
26
+ * Server-rendered apps can also import a static components.css (the registry's
27
+ * `meridian-ssr-css` item), so the HTML is styled before hydration. That sheet
28
+ * lists `<id>_<hash>` pairs in `--ef-css-static` on :root, the hash being
29
+ * FNV-1a over the exact text each component passes here. This skips an id only
30
+ * when the hash of `text` matches: an edited copy, or a component from another
31
+ * release than the sheet, injects its own CSS as before, so the static sheet
32
+ * can save work but never replace a component's CSS. The list is read once per
33
+ * page: reading it per call would force a style recalculation after every
34
+ * <style> this appends.
24
35
  */
36
+ let efStaticCss;
37
+ function efCssHash(text) {
38
+ let h = 0x811c9dc5;
39
+ for (let i = 0; i < text.length; i++) {
40
+ h ^= text.charCodeAt(i);
41
+ h = Math.imul(h, 0x01000193);
42
+ }
43
+ return (h >>> 0).toString(16).padStart(8, '0');
44
+ }
25
45
  export function injectEfCss(id, text) {
26
46
  if (typeof document === 'undefined' || document.getElementById(id)) return;
47
+ if (!efStaticCss) {
48
+ efStaticCss = new Map();
49
+ const listed = getComputedStyle(document.documentElement).getPropertyValue('--ef-css-static').trim();
50
+ for (const pair of listed ? listed.split(/\s+/) : []) {
51
+ const at = pair.lastIndexOf('_');
52
+ if (at > 0) efStaticCss.set(pair.slice(0, at), pair.slice(at + 1));
53
+ }
54
+ }
55
+ const listedHash = efStaticCss.get(id);
56
+ if (listedHash === true) return;
57
+ if (listedHash !== undefined) {
58
+ // Settle each id once: the hash runs on first render, not on every one.
59
+ if (listedHash === efCssHash(text)) {
60
+ efStaticCss.set(id, true);
61
+ return;
62
+ }
63
+ efStaticCss.delete(id);
64
+ }
27
65
  const s = document.createElement('style');
28
66
  s.id = id;
29
67
  s.textContent = `@layer meridian{${text}}`;
@@ -65,6 +103,23 @@ export function cssPct(value) {
65
103
  * to useEffect on the server is behaviour-identical. Lowercase: internal.
66
104
  */
67
105
  export const useIsoLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
106
+ const LAZY_TYPE = Symbol.for('react.lazy');
107
+ /**
108
+ * Whether `child` is an element of `Component`, for compound components that
109
+ * sort their children (Select items, Resizable panels, ScrollArea bars).
110
+ *
111
+ * Children written in a Next.js Server Component reach a client component with
112
+ * a lazy client reference as their type, not the function, so a plain
113
+ * `child.type === Component` is false there. Unwrap the lazy first. While its
114
+ * module is still loading, `_init` throws the module's promise, which suspends
115
+ * exactly as rendering the lazy element would.
116
+ */
117
+ export function isElementOfType(child, Component) {
118
+ if (! /*#__PURE__*/React.isValidElement(child)) return false;
119
+ let type = child.type;
120
+ if (type && type.$$typeof === LAZY_TYPE && typeof type._init === 'function') type = type._init(type._payload);
121
+ return type === Component;
122
+ }
68
123
  /**
69
124
  * The CSS kill-switch cannot reach JS-driven motion — rAF count-ups and
70
125
  * scrollTo({behavior:'smooth'}) — so those call sites ask here. Lowercase: internal.
@@ -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 "./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 { Icon } from "../icons/Icon.js";
package/forms/Checkbox.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/Combobox.js CHANGED
@@ -1,9 +1,10 @@
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 { InputGroup, InputGroupAddon, InputGroupInput } from "./InputGroup.js";
6
- import { Portal, useAnchoredStyle } from "../overlay/Portal.js";
7
+ import { Portal, useAnchoredStyle, useHydrated } from "../overlay/Portal.js";
7
8
  const ComboboxContext = /*#__PURE__*/React.createContext(null);
8
9
  const join = (...values) => values.filter(Boolean).join(' ');
9
10
  const textOf = node => React.Children.toArray(node).map(child => typeof child === 'string' || typeof child === 'number' ? String(child) : /*#__PURE__*/React.isValidElement(child) ? textOf(child.props.children) : '').join(' ').trim();
@@ -35,7 +36,10 @@ export function Combobox({
35
36
  const records = React.useRef(new Map());
36
37
  const anchorRef = React.useRef(null);
37
38
  const currentValue = value === undefined ? internalValue : value;
38
- const isOpen = open === undefined ? internalOpen : open;
39
+ // Closed while React hydrates server HTML (the server rendered no portal),
40
+ // open right after, so effects keyed on it run with the panel present.
41
+ const requestedOpen = open === undefined ? internalOpen : open;
42
+ const isOpen = useHydrated() && requestedOpen;
39
43
  const query = inputValue === undefined ? internalInput : inputValue;
40
44
  const setOpen = React.useCallback(next => {
41
45
  if (open === undefined) setInternalOpen(next);
@@ -70,11 +74,13 @@ export function Combobox({
70
74
  const record = [...records.current.values()].find(entry => same(entry.value, next));
71
75
  return record ? record.text : undefined;
72
76
  };
77
+ // Keyed on the requested state, not isOpen: the hydration pass is not a
78
+ // close, and treating it as one filled the input and narrowed the list.
73
79
  React.useEffect(() => {
74
- if (multiple || isOpen || query || currentValue == null) return;
80
+ if (multiple || requestedOpen || query || currentValue == null) return;
75
81
  const label = labelOf(currentValue);
76
82
  if (label !== undefined) setQuery(label);
77
- }, [currentValue, items, isOpen, multiple]);
83
+ }, [currentValue, items, requestedOpen, multiple]);
78
84
  // A value changed from outside (a controlled reset, a programmatic pick)
79
85
  // must also move the text in the input, or it keeps showing the old label.
80
86
  const shownValue = React.useRef(currentValue);
package/forms/Field.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 FieldCtx = /*#__PURE__*/React.createContext(null);
@@ -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/Input.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 { useFieldProps } from "./Field.js";
package/forms/InputOTP.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 InputOTPCtx = /*#__PURE__*/React.createContext(null);
package/forms/Label.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 Label = /*#__PURE__*/React.forwardRef(function Label({
@@ -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";
@@ -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 RootContext = /*#__PURE__*/React.createContext(null);
package/forms/Radio.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";
package/forms/Select.js CHANGED
@@ -1,15 +1,16 @@
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
- import { mergeRefs } from "./Button.js";
6
- import { Portal, useAnchoredStyle } from "../overlay/Portal.js";
6
+ import { mergeRefs, isElementOfType } from "./Button.js";
7
+ import { Portal, useAnchoredStyle, useHydrated } from "../overlay/Portal.js";
7
8
  const SelectCtx = /*#__PURE__*/React.createContext(null);
8
9
  const itemText = children => typeof children === 'string' || typeof children === 'number' ? String(children) : '';
9
10
  function collectLabels(children, out = {}) {
10
11
  React.Children.forEach(children, child => {
11
12
  if (! /*#__PURE__*/React.isValidElement(child)) return;
12
- if (child.type === SelectItem) out[child.props.value] = itemText(child.props.children) || child.props.value;
13
+ if (isElementOfType(child, SelectItem)) out[child.props.value] = itemText(child.props.children) || child.props.value;
13
14
  if (child.props.children) collectLabels(child.props.children, out);
14
15
  });
15
16
  return out;
@@ -29,7 +30,9 @@ export function Select({
29
30
  const [innerValue, setInnerValue] = React.useState(defaultValue);
30
31
  const [innerOpen, setInnerOpen] = React.useState(defaultOpen);
31
32
  const value = controlled !== undefined ? controlled : innerValue;
32
- const open = controlledOpen !== undefined ? controlledOpen : innerOpen;
33
+ // Closed while React hydrates server HTML (the server rendered no portal),
34
+ // open right after, so effects keyed on it run with the panel present.
35
+ const open = useHydrated() && (controlledOpen !== undefined ? controlledOpen : innerOpen);
33
36
  const triggerRef = React.useRef(null);
34
37
  const contentRef = React.useRef(null);
35
38
  const declaredLabels = React.useMemo(() => collectLabels(children), [children]);
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", {
@@ -71,14 +81,26 @@ export const Slider = /*#__PURE__*/React.forwardRef(function Slider({
71
81
  type: "range",
72
82
  "data-slot": "slider-thumb",
73
83
  "aria-label": rest['aria-label'] ? `${rest['aria-label']}${values.length > 1 ? ` ${index + 1}` : ''}` : undefined,
74
- min: index > 0 ? values[index - 1] + minStepsBetweenThumbs * step : min,
75
- max: index < values.length - 1 ? values[index + 1] - minStepsBetweenThumbs * step : 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,
76
88
  step: step,
77
89
  value: value,
78
90
  disabled: disabled,
79
91
  dir: inverted ? dir === 'rtl' ? 'ltr' : 'rtl' : dir,
80
92
  className: "ef-slider__input",
81
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
+ },
82
104
  onPointerUp: () => onValueCommit?.(latestRef.current),
83
105
  onKeyUp: event => {
84
106
  if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes(event.key)) onValueCommit?.(latestRef.current);
package/forms/Switch.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 "./Button.js";
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/build_npm.mjs from assets/icons/. Do not edit.
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>",
@@ -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 { 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';
@@ -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({
@@ -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";
@@ -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";
@@ -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
  /**
@@ -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";
@@ -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({
@@ -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,9 +1,10 @@
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, useIsoLayoutEffect } from "../forms/Button.js";
5
6
  import { Icon } from "../icons/Icon.js";
6
- import { Portal, useAnchoredStyle } from "./Portal.js";
7
+ import { Portal, useAnchoredStyle, useHydrated } from "./Portal.js";
7
8
  import { useDirection } from "../display/Direction.js";
8
9
  const RootCtx = /*#__PURE__*/React.createContext(null);
9
10
  const SubCtx = /*#__PURE__*/React.createContext(null);
@@ -74,7 +75,9 @@ export function ContextMenu({
74
75
  x: 0,
75
76
  y: 0
76
77
  });
77
- const open = controlled !== undefined ? controlled : inner;
78
+ // Closed while React hydrates server HTML (the server rendered no portal),
79
+ // open right after, so effects keyed on it run with the panel present.
80
+ const open = useHydrated() && (controlled !== undefined ? controlled : inner);
78
81
  const triggerRef = React.useRef(null);
79
82
  const contentRef = React.useRef(null);
80
83
  const menuId = React.useId();
@@ -400,7 +403,9 @@ export function ContextMenuSub({
400
403
  children
401
404
  }) {
402
405
  const [inner, setInner] = React.useState(defaultOpen);
403
- const open = controlled !== undefined ? controlled : inner;
406
+ // Closed while React hydrates server HTML (the server rendered no portal),
407
+ // open right after, so effects keyed on it run with the panel present.
408
+ const open = useHydrated() && (controlled !== undefined ? controlled : inner);
404
409
  const triggerRef = React.useRef(null);
405
410
  const contentRef = React.useRef(null);
406
411
  const setOpen = next => {
@@ -7,7 +7,10 @@ export interface DrawerProps {
7
7
  onOpenChange?: (open: boolean) => void;
8
8
  direction?: DrawerDirection;
9
9
  dismissible?: boolean;
10
- /** @deprecated Ignored: a Drawer is always modal. Passing `false` logs a development warning; the prop will be removed in the next major version. */
10
+ /**
11
+ * @deprecated Ignored: a Drawer is always modal. Passing `false` logs a development warning; the prop will be removed in the next major version. Migration: https://meridian.efolusi.com/guidelines/migration.md
12
+ * @codemod remove
13
+ */
11
14
  modal?: boolean;
12
15
  handleOnly?: boolean;
13
16
  children?: React.ReactNode;
package/overlay/Drawer.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 { useHydrated } from "./Portal.js";
4
6
  import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "../feedback/Dialog.js";
5
7
  const DrawerContext = /*#__PURE__*/React.createContext(null);
6
8
  const join = (...values) => values.filter(Boolean).join(' ');
@@ -21,7 +23,7 @@ function warnModalIgnored() {
21
23
  if (process.env.NODE_ENV === 'production') return;
22
24
  } catch (e) {/* no build-time env */}
23
25
  warnedModal = true;
24
- console.warn('[meridian] <Drawer modal={false}> is deprecated and ignored: a Drawer is always modal. The prop will be removed in the next major version.');
26
+ console.warn('[meridian] <Drawer modal={false}> is deprecated and ignored: a Drawer is always modal. The prop will be removed in the next major version. Migration: https://meridian.efolusi.com/guidelines/migration.md');
25
27
  }
26
28
  export function Drawer({
27
29
  open: controlled,
@@ -37,7 +39,9 @@ export function Drawer({
37
39
  if (modal === false) warnModalIgnored();
38
40
  }, [modal]);
39
41
  const [internal, setInternal] = React.useState(defaultOpen);
40
- const open = controlled === undefined ? internal : controlled;
42
+ // Closed while React hydrates server HTML (the server rendered no portal),
43
+ // open right after, so effects keyed on it run with the panel present.
44
+ const open = useHydrated() && (controlled === undefined ? internal : controlled);
41
45
  const setOpen = React.useCallback(next => {
42
46
  if (controlled === undefined) setInternal(next);
43
47
  onOpenChange?.(next);
@@ -1,9 +1,10 @@
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, useIsoLayoutEffect } from "../forms/Button.js";
5
6
  import { Icon } from "../icons/Icon.js";
6
- import { Portal, useAnchoredStyle } from "./Portal.js";
7
+ import { Portal, useAnchoredStyle, useHydrated } from "./Portal.js";
7
8
  import { useDirection } from "../display/Direction.js";
8
9
  const RootCtx = /*#__PURE__*/React.createContext(null);
9
10
  const SubCtx = /*#__PURE__*/React.createContext(null);
@@ -70,7 +71,9 @@ export function DropdownMenu({
70
71
  children
71
72
  }) {
72
73
  const [inner, setInner] = React.useState(defaultOpen);
73
- const open = controlled !== undefined ? controlled : inner;
74
+ // Closed while React hydrates server HTML (the server rendered no portal),
75
+ // open right after, so effects keyed on it run with the panel present.
76
+ const open = useHydrated() && (controlled !== undefined ? controlled : inner);
74
77
  const triggerRef = React.useRef(null);
75
78
  const contentRef = React.useRef(null);
76
79
  const menuId = React.useId();
@@ -411,7 +414,9 @@ export function DropdownMenuSub({
411
414
  children
412
415
  }) {
413
416
  const [inner, setInner] = React.useState(defaultOpen);
414
- const open = controlled !== undefined ? controlled : inner;
417
+ // Closed while React hydrates server HTML (the server rendered no portal),
418
+ // open right after, so effects keyed on it run with the panel present.
419
+ const open = useHydrated() && (controlled !== undefined ? controlled : inner);
415
420
  const triggerRef = React.useRef(null);
416
421
  const contentRef = React.useRef(null);
417
422
  const setOpen = next => {
@@ -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 } from "../forms/Button.js";
5
- import { Portal, useAnchoredStyle, useEscapeLayer, escapeLayerContext } from "./Portal.js";
5
+ import { mergeRefs, useIsoLayoutEffect } from "../forms/Button.js";
6
+ import { Portal, useAnchoredStyle, useEscapeLayer, escapeLayerContext, useHydrated } from "./Portal.js";
6
7
  const HoverCardCtx = /*#__PURE__*/React.createContext(null);
7
8
  function compose(theirs, ours) {
8
9
  return event => {
@@ -19,11 +20,17 @@ export function HoverCard({
19
20
  children
20
21
  }) {
21
22
  const [inner, setInner] = React.useState(defaultOpen);
22
- const open = controlled !== undefined ? controlled : inner;
23
+ // Closed while React hydrates server HTML (the server rendered no portal),
24
+ // open right after, so effects keyed on it run with the panel present.
25
+ const open = useHydrated() && (controlled !== undefined ? controlled : inner);
23
26
  const triggerRef = React.useRef(null);
24
27
  const contentRef = React.useRef(null);
25
28
  const timerRef = React.useRef(null);
26
- const contentId = React.useId();
29
+ // The content's own `id` wins over the generated one, and the trigger's
30
+ // aria attribute follows whichever is rendered.
31
+ const baseId = React.useId();
32
+ const [customId, setContentId] = React.useState();
33
+ const contentId = customId || baseId;
27
34
  const setOpen = React.useCallback(next => {
28
35
  if (controlled === undefined) setInner(next);
29
36
  onOpenChange?.(next);
@@ -50,8 +57,9 @@ export function HoverCard({
50
57
  clearTimer,
51
58
  triggerRef,
52
59
  contentRef,
53
- contentId
54
- }), [open, setOpen, openSoon, closeSoon, clearTimer, contentId]);
60
+ contentId,
61
+ setContentId
62
+ }), [open, setOpen, openSoon, closeSoon, clearTimer, contentId, setContentId]);
55
63
  return /*#__PURE__*/React.createElement(HoverCardCtx.Provider, {
56
64
  value: value
57
65
  }, /*#__PURE__*/React.createElement(escapeLayerContext.Provider, {
@@ -106,9 +114,16 @@ export const HoverCardContent = /*#__PURE__*/React.forwardRef(function HoverCard
106
114
  className,
107
115
  style,
108
116
  children,
117
+ id,
109
118
  ...rest
110
119
  }, forwardedRef) {
111
120
  const ctx = React.useContext(HoverCardCtx);
121
+ const registerId = ctx?.setContentId;
122
+ useIsoLayoutEffect(() => {
123
+ if (!registerId) return;
124
+ registerId(id);
125
+ return () => registerId(undefined);
126
+ }, [registerId, id]);
112
127
  const fallbackTriggerRef = React.useRef(null);
113
128
  const fallbackContentRef = React.useRef(null);
114
129
  const {
@@ -124,7 +139,7 @@ export const HoverCardContent = /*#__PURE__*/React.forwardRef(function HoverCard
124
139
  if (!ctx?.open) return null;
125
140
  return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", _extends({}, rest, {
126
141
  ref: mergeRefs(forwardedRef, ctx.contentRef),
127
- id: ctx.contentId,
142
+ id: id || ctx.contentId,
128
143
  "data-slot": "hover-card-content",
129
144
  "data-state": "open",
130
145
  "data-side": resolvedSide,