@efolusi/meridian 1.21.10 → 1.22.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 (60) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -1
  2. package/ai/Citation.js +44 -22
  3. package/ai/Confirmation.js +2 -2
  4. package/ai/PromptComposer.d.ts +4 -0
  5. package/ai/PromptComposer.js +7 -1
  6. package/ai/RichComposer.js +3 -0
  7. package/ai/SourceCard.js +12 -4
  8. package/ai/UsageMeter.d.ts +3 -1
  9. package/ai/UsageMeter.js +8 -2
  10. package/ai/WebPreview.js +12 -4
  11. package/code/CodeBlock.js +26 -7
  12. package/code/CopyField.js +24 -9
  13. package/components.css +137 -56
  14. package/data/BarChart.d.ts +4 -0
  15. package/data/BarChart.js +28 -4
  16. package/data/Chart.d.ts +1 -1
  17. package/data/Chart.js +5 -2
  18. package/data/DonutChart.d.ts +4 -0
  19. package/data/DonutChart.js +38 -8
  20. package/data/LineChart.d.ts +4 -0
  21. package/data/LineChart.js +29 -7
  22. package/data/Table.d.ts +1 -0
  23. package/data/Table.js +35 -19
  24. package/dates/Calendar.js +43 -15
  25. package/dates/TimePicker.js +18 -3
  26. package/display/Toolbar.js +1 -0
  27. package/display/TreeList.js +20 -13
  28. package/feedback/AlertDialog.js +12 -12
  29. package/feedback/Dialog.js +17 -12
  30. package/feedback/Toast.js +5 -2
  31. package/feedback/Tooltip.js +5 -1
  32. package/files/FileDrop.d.ts +5 -1
  33. package/files/FileDrop.js +28 -1
  34. package/forms/ButtonTile.js +2 -0
  35. package/forms/Combobox.js +21 -5
  36. package/forms/NumberInput.js +21 -4
  37. package/forms/Questionnaire.js +1 -1
  38. package/forms/Slider.js +2 -1
  39. package/forms/Switch.js +14 -3
  40. package/index.js +3 -3
  41. package/navigation/NavigationMenu.js +17 -5
  42. package/navigation/PageControl.js +1 -0
  43. package/navigation/SegmentedControl.js +1 -0
  44. package/navigation/SideNav.js +2 -0
  45. package/navigation/Sidebar.js +74 -11
  46. package/navigation/SkipLink.d.ts +2 -1
  47. package/navigation/SkipLink.js +16 -4
  48. package/overlay/Command.js +1 -0
  49. package/overlay/ContextMenu.js +32 -10
  50. package/overlay/Drawer.d.ts +1 -0
  51. package/overlay/Drawer.js +19 -2
  52. package/overlay/DropdownMenu.js +32 -10
  53. package/overlay/HoverCard.js +8 -13
  54. package/overlay/Popover.js +46 -10
  55. package/overlay/Portal.js +67 -2
  56. package/package.json +1 -1
  57. package/tailwind.preset.cjs +34 -13
  58. package/tokens/base.css +5 -0
  59. package/tokens/colors.css +7 -3
  60. package/tokens.json +427 -95
package/overlay/Portal.js CHANGED
@@ -93,6 +93,10 @@ export function useAnchoredStyle(anchorRef, panelRef, {
93
93
  const vh = document.documentElement.clientHeight;
94
94
  const edge = 8;
95
95
  const horizontal = placement === 'left' || placement === 'right';
96
+ // start/end are logical: in a right-to-left layout "start" is the anchor's right edge
97
+ const dirNode = anchor.closest('[dir]');
98
+ const rtl = (dirNode ? dirNode.getAttribute('dir') : document.documentElement.dir) === 'rtl';
99
+ const inline = !horizontal && rtl ? align === 'start' ? 'end' : align === 'end' ? 'start' : align : align;
96
100
  const roomAfter = horizontal ? vw - a.right - offset : vh - a.bottom - offset;
97
101
  const roomBefore = horizontal ? a.left - offset : a.top - offset;
98
102
  const panelSize = horizontal ? p.width : p.height;
@@ -112,8 +116,8 @@ export function useAnchoredStyle(anchorRef, panelRef, {
112
116
  top += crossOffset;
113
117
  } else {
114
118
  top = side === 'bottom' ? a.bottom + offset : a.top - offset - p.height;
115
- left = align === 'end' ? a.right - width : align === 'center' ? a.left + a.width / 2 - width / 2 : a.left;
116
- left += crossOffset;
119
+ left = inline === 'end' ? a.right - width : inline === 'center' ? a.left + a.width / 2 - width / 2 : a.left;
120
+ left += rtl ? -crossOffset : crossOffset;
117
121
  }
118
122
  left = Math.max(edge, Math.min(left, vw - width - edge));
119
123
  top = Math.max(edge, Math.min(top, vh - p.height - edge));
@@ -141,4 +145,65 @@ export function useAnchoredStyle(anchorRef, panelRef, {
141
145
  };
142
146
  }, [open, placement, align, offset, crossOffset, matchWidth, anchorRef, panelRef]);
143
147
  return state;
148
+ }
149
+ export const escapeLayerContext = /*#__PURE__*/React.createContext(null);
150
+ const handledEscapes = new WeakSet();
151
+
152
+ /**
153
+ * Escape dismisses the innermost open layer, and only that one.
154
+ *
155
+ * Every modal and popover used to listen on `document` for itself, so a
156
+ * Popover inside a Dialog, or a Dialog inside a Dialog, closed together on one
157
+ * key press. Layers rendered inside another layer's subtree register with it
158
+ * through context (React context follows portals, the DOM does not), and a
159
+ * layer with an open child leaves the key to the child. A layer whose caller
160
+ * cancels the key (`preventDefault`) or that has no way out still consumes it.
161
+ *
162
+ * Returns the layer; wrap the layer's children in
163
+ * `<escapeLayerContext.Provider value={layer}>`. Not exported on the namespace.
164
+ */
165
+ export function useEscapeLayer(active, onEscape) {
166
+ const parent = React.useContext(escapeLayerContext);
167
+ const layerRef = React.useRef(null);
168
+ if (layerRef.current === null) layerRef.current = {
169
+ children: 0
170
+ };
171
+ const handlerRef = React.useRef(onEscape);
172
+ handlerRef.current = onEscape;
173
+ React.useEffect(() => {
174
+ if (!active) return;
175
+ const layer = layerRef.current;
176
+ if (parent) parent.children += 1;
177
+ const key = event => {
178
+ if (event.key !== 'Escape' || event.defaultPrevented || layer.children > 0 || handledEscapes.has(event)) return;
179
+ handledEscapes.add(event);
180
+ handlerRef.current?.(event);
181
+ };
182
+ document.addEventListener('keydown', key);
183
+ return () => {
184
+ if (parent) parent.children -= 1;
185
+ document.removeEventListener('keydown', key);
186
+ };
187
+ }, [active, parent]);
188
+ return layerRef.current;
189
+ }
190
+ let scrollLocks = 0;
191
+ let savedOverflow = '';
192
+ /**
193
+ * Keep the page behind a modal from scrolling. Counted, so a dialog opened
194
+ * from a dialog does not restore scrolling when the inner one closes.
195
+ */
196
+ export function useScrollLock(active) {
197
+ React.useEffect(() => {
198
+ if (!active) return;
199
+ if (scrollLocks === 0) {
200
+ savedOverflow = document.body.style.overflow;
201
+ document.body.style.overflow = 'hidden';
202
+ }
203
+ scrollLocks += 1;
204
+ return () => {
205
+ scrollLocks -= 1;
206
+ if (scrollLocks === 0) document.body.style.overflow = savedOverflow;
207
+ };
208
+ }, [active]);
144
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efolusi/meridian",
3
- "version": "1.21.10",
3
+ "version": "1.22.0",
4
4
  "description": "A general-purpose open-source design system by Efolusi: accessible React components, design tokens, blocks and example apps.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://meridian.efolusi.com",
@@ -51,12 +51,27 @@ module.exports = { theme: { extend: {
51
51
  "surface-code": "var(--surface-code)",
52
52
  "text-code": "var(--text-code)",
53
53
  "border-code": "var(--border-code)",
54
+ "code-ink": "var(--code-ink)",
55
+ "code-ink-strong": "var(--code-ink-strong)",
56
+ "code-ink-bright": "var(--code-ink-bright)",
57
+ "code-ink-muted": "var(--code-ink-muted)",
58
+ "code-ink-subtle": "var(--code-ink-subtle)",
59
+ "code-ink-faint": "var(--code-ink-faint)",
60
+ "code-divider": "var(--code-divider)",
61
+ "code-edge": "var(--code-edge)",
62
+ "code-edge-hover": "var(--code-edge-hover)",
63
+ "code-raised": "var(--code-raised)",
54
64
  "success-on-dark": "var(--success-on-dark)",
55
65
  "danger-on-dark": "var(--danger-on-dark)",
56
66
  "warning-on-dark": "var(--warning-on-dark)",
57
67
  "overlay-scrim": "var(--overlay-scrim)",
58
68
  "text-on-brand-muted": "var(--text-on-brand-muted)",
59
69
  "text-on-brand": "var(--text-on-brand)",
70
+ "media-backdrop": "var(--media-backdrop)",
71
+ "media-backdrop-dot": "var(--media-backdrop-dot)",
72
+ "media-scrim": "var(--media-scrim)",
73
+ "media-scrim-soft": "var(--media-scrim-soft)",
74
+ "media-scrim-strong": "var(--media-scrim-strong)",
60
75
  "text-on-media": "var(--text-on-media)",
61
76
  "text-on-media-muted": "var(--text-on-media-muted)",
62
77
  "text-primary": "var(--text-primary)",
@@ -69,27 +84,20 @@ module.exports = { theme: { extend: {
69
84
  "border-default": "var(--border-default)",
70
85
  "border-strong": "var(--border-strong)",
71
86
  "border-inverse": "var(--border-inverse)",
87
+ "border-control": "var(--border-control)",
88
+ "border-control-hover": "var(--border-control-hover)",
72
89
  "accent": "var(--accent)",
73
90
  "accent-hover": "var(--accent-hover)",
74
91
  "accent-active": "var(--accent-active)",
75
92
  "accent-subtle": "var(--accent-subtle)",
76
93
  "accent-subtle-border": "var(--accent-subtle-border)",
77
94
  "accent-contrast": "var(--accent-contrast)",
95
+ "accent-subtle-fg": "var(--accent-subtle-fg)",
78
96
  "danger-contrast": "var(--danger-contrast)",
79
97
  "success-contrast": "var(--success-contrast)",
80
98
  "warning-contrast": "var(--warning-contrast)",
81
- "text-2xs": "var(--text-2xs)",
82
- "text-xs": "var(--text-xs)",
83
- "text-sm": "var(--text-sm)",
84
- "text-md": "var(--text-md)",
85
- "text-lg": "var(--text-lg)",
86
- "text-xl": "var(--text-xl)",
87
- "text-2xl": "var(--text-2xl)",
88
- "text-3xl": "var(--text-3xl)",
89
- "text-4xl": "var(--text-4xl)",
90
- "text-5xl": "var(--text-5xl)",
91
- "text-6xl": "var(--text-6xl)",
92
- "text-7xl": "var(--text-7xl)"
99
+ "focus-ring-color": "var(--focus-ring-color)",
100
+ "focus-ring-offset": "var(--focus-ring-offset)"
93
101
  },
94
102
  "spacing": {
95
103
  "0": "var(--space-0)",
@@ -122,7 +130,20 @@ module.exports = { theme: { extend: {
122
130
  "lg": "var(--shadow-lg)",
123
131
  "xl": "var(--shadow-xl)"
124
132
  },
125
- "fontSize": {},
133
+ "fontSize": {
134
+ "2xs": "var(--text-2xs)",
135
+ "xs": "var(--text-xs)",
136
+ "sm": "var(--text-sm)",
137
+ "md": "var(--text-md)",
138
+ "lg": "var(--text-lg)",
139
+ "xl": "var(--text-xl)",
140
+ "2xl": "var(--text-2xl)",
141
+ "3xl": "var(--text-3xl)",
142
+ "4xl": "var(--text-4xl)",
143
+ "5xl": "var(--text-5xl)",
144
+ "6xl": "var(--text-6xl)",
145
+ "7xl": "var(--text-7xl)"
146
+ },
126
147
  "zIndex": {
127
148
  "dropdown": "var(--z-dropdown)",
128
149
  "sticky": "var(--z-sticky)",
package/tokens/base.css CHANGED
@@ -12,3 +12,8 @@ code,pre,kbd{font-family:var(--font-mono)}
12
12
  ::selection{background:var(--brand-100);color:var(--cocoa-900)}
13
13
  *,*::before,*::after{box-sizing:border-box}
14
14
  @media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
15
+ /* Forced colours (Windows High Contrast) remove box-shadow, and box-shadow is how
16
+ every component draws --focus-ring after outline:none, so focus would vanish.
17
+ Unlayered on purpose: it outranks the @layer meridian component rules without
18
+ !important. Highlight is a system colour, so it survives the forced palette. */
19
+ @media (forced-colors:active){:focus-visible{outline:2px solid Highlight;outline-offset:2px}}
package/tokens/colors.css CHANGED
@@ -1,4 +1,6 @@
1
1
  :root{
2
+ /* Native controls, scrollbars and pickers follow the theme */
3
+ color-scheme:light;
2
4
  /* Sand — warm neutrals */
3
5
  --sand-25:#FCFBF9;--sand-50:#FAF9F6;--sand-100:#F3F1EB;--sand-200:#E7E3D9;--sand-300:#D5CFC0;--sand-400:#B4AB97;--sand-500:#948A74;--sand-600:#786E59;--sand-700:#5E5545;--sand-800:#443D32;--sand-900:#2E2922;--sand-950:#1E1A14;
4
6
  /* Brand — cream→latte→caramel→cocoa→espresso coffee ramp */
@@ -25,7 +27,8 @@
25
27
  --text-on-media:var(--sand-50);/* prompt text over imagery — stays light in both themes */--text-on-media-muted:rgba(250,249,246,.75);/* status line over imagery */
26
28
  --text-primary:var(--sand-950);--text-secondary:var(--sand-700);--text-muted:#746A55;/* between sand-600/700: ≥4.5:1 on page, card, and sunken */--text-inverse:var(--sand-50);--text-inverse-muted:rgba(250,249,246,.6);/* dim ink on --surface-inverse (toast close button); remapped in dark where the inverse surface flips light */--text-link:var(--brand-700);--text-link-hover:var(--brand-900);
27
29
  --border-default:var(--sand-200);--border-strong:var(--sand-300);--border-inverse:rgba(250,249,246,.18);
28
- --accent:var(--brand-950);--accent-hover:#1D0E04;--accent-active:#120801;--accent-subtle:var(--brand-50);--accent-subtle-border:var(--brand-200);--accent-contrast:#FFFFFF;
30
+ --border-control:var(--sand-500);--border-control-hover:var(--sand-700);/* form-control edge (Input, Select, Radio…) — ≥3:1 on page, card, sunken and subtle (WCAG 1.4.11); border-default/strong stay for decorative dividers */
31
+ --accent:var(--brand-950);--accent-hover:#1D0E04;--accent-active:#120801;--accent-subtle:var(--brand-50);--accent-subtle-border:var(--brand-200);--accent-contrast:#FFFFFF;--accent-subtle-fg:var(--brand-700);/* text and icons on --accent-subtle — ≥4.5:1 */
29
32
  --danger-contrast:#FFFFFF;/* label on a solid --danger-600 fill; flips in dark where the red lightens */--success-contrast:#FFFFFF;--warning-contrast:#FFFFFF;/* same contract as --danger-contrast, for the green and amber fills */
30
33
  /* Focus ring — opaque, two-layer. The inner offset ring is surface-coloured so the
31
34
  indicator never sits directly against a control fill; the outer ring only ever needs
@@ -36,10 +39,11 @@
36
39
  }
37
40
  /* Dark theme — semantic remap only; ramps stay fixed */
38
41
  [data-theme="dark"]{
42
+ color-scheme:dark;
39
43
  --surface-page:#191512;--surface-card:#211C17;--surface-sunken:#2A251E;--surface-subtle:#1D1814;--surface-inverse:var(--sand-50);--surface-brand:var(--brand-950);
40
44
  --text-primary:#F3EFE7;--text-secondary:#C9C0B2;--text-muted:#9C9280;--text-inverse:var(--sand-950);--text-inverse-muted:rgba(30,26,20,.55);--text-link:var(--brand-400);--text-link-hover:var(--brand-300);
41
- --border-default:#332C24;--border-strong:#453C31;--border-inverse:rgba(30,26,20,.2);
42
- --accent:#F3EFE7;--accent-hover:#FFFFFF;--accent-active:#D5CFC0;--accent-subtle:#2A2119;--accent-subtle-border:#453728;--accent-contrast:#1E1A14;
45
+ --border-default:#332C24;--border-strong:#453C31;--border-inverse:rgba(30,26,20,.2);--border-control:var(--sand-600);--border-control-hover:var(--sand-400);
46
+ --accent:#F3EFE7;--accent-hover:#FFFFFF;--accent-active:#D5CFC0;--accent-subtle:#2A2119;--accent-subtle-border:#453728;--accent-contrast:#1E1A14;--accent-subtle-fg:var(--brand-400);
43
47
  --success-600:#5FB86E;--success-100:#1C2B1F;--success-300:#2E4A34;
44
48
  --warning-100:#2E2413;--warning-300:#4A3A1D;--warning-600:#D9822B;
45
49
  --danger-100:#321B18;--danger-300:#54291F;--danger-600:#E85D4A;--danger-700:#F47765;/* hover fill must retain contrast with dark-mode danger ink */--danger-contrast:#1E1A14;--success-contrast:#1E1A14;--warning-contrast:#1E1A14;