@mistriwork/ui 1.0.0-rc.57 → 1.0.0-rc.59

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 (122) hide show
  1. package/README.md +46 -12
  2. package/dist/Avatar.js +3 -3
  3. package/dist/Button.d.ts +4 -14
  4. package/dist/Button.js +26 -13
  5. package/dist/Carousel.d.ts +6 -5
  6. package/dist/Carousel.js +58 -67
  7. package/dist/Choices.d.ts +2 -9
  8. package/dist/Choices.js +127 -64
  9. package/dist/DateField.d.ts +9 -4
  10. package/dist/DateField.js +102 -119
  11. package/dist/Drawer.d.ts +1 -19
  12. package/dist/Drawer.js +8 -9
  13. package/dist/DropMenu.d.ts +8 -21
  14. package/dist/DropMenu.js +84 -30
  15. package/dist/Dropdown.d.ts +9 -8
  16. package/dist/Dropdown.js +69 -65
  17. package/dist/Field.d.ts +2 -1
  18. package/dist/Field.js +12 -18
  19. package/dist/FileField.d.ts +3 -10
  20. package/dist/FileField.js +12 -9
  21. package/dist/FormParts.d.ts +17 -10
  22. package/dist/FormParts.js +26 -41
  23. package/dist/HeroBlocks.d.ts +7 -3
  24. package/dist/HeroBlocks.js +11 -6
  25. package/dist/Modal.d.ts +6 -17
  26. package/dist/Modal.js +90 -21
  27. package/dist/Pagination.d.ts +1 -12
  28. package/dist/Pagination.js +17 -3
  29. package/dist/Popover.d.ts +1 -15
  30. package/dist/Popover.js +10 -15
  31. package/dist/Resizable.d.ts +3 -21
  32. package/dist/Resizable.js +14 -91
  33. package/dist/ScrollArea.d.ts +4 -2
  34. package/dist/ScrollArea.js +11 -11
  35. package/dist/Select.d.ts +1 -6
  36. package/dist/Select.js +16 -7
  37. package/dist/SensitiveField.d.ts +1 -8
  38. package/dist/SensitiveField.js +6 -4
  39. package/dist/Slider.d.ts +1 -5
  40. package/dist/Slider.js +13 -5
  41. package/dist/Switch.d.ts +1 -11
  42. package/dist/Switch.js +10 -9
  43. package/dist/Tabs.d.ts +3 -3
  44. package/dist/Tabs.js +3 -3
  45. package/dist/TextArea.d.ts +4 -6
  46. package/dist/TextArea.js +14 -5
  47. package/dist/TextField.d.ts +5 -9
  48. package/dist/TextField.js +67 -9
  49. package/dist/Tooltip.d.ts +1 -21
  50. package/dist/Tooltip.js +13 -31
  51. package/dist/Typeahead.d.ts +15 -18
  52. package/dist/Typeahead.js +151 -86
  53. package/dist/UiKit.d.ts +63 -4
  54. package/dist/UiKit.js +46 -5
  55. package/dist/behaviors/DaysParts.js +28 -0
  56. package/dist/behaviors/EditableParts.js +21 -0
  57. package/dist/behaviors/PickParts.js +30 -0
  58. package/dist/behaviors/ScrubParts.js +21 -0
  59. package/dist/behaviors/SortableParts.js +32 -0
  60. package/dist/behaviors/SpansParts.js +12 -0
  61. package/dist/behaviors/TransferParts.js +37 -0
  62. package/dist/behaviors/TurnsParts.js +31 -0
  63. package/dist/behaviors/WidthsParts.js +27 -0
  64. package/dist/behaviors/days.js +216 -0
  65. package/dist/behaviors/dress.js +86 -0
  66. package/dist/behaviors/editable.js +104 -0
  67. package/dist/behaviors/heard.js +22 -0
  68. package/dist/behaviors/index.d.ts +310 -0
  69. package/dist/behaviors/index.js +44 -0
  70. package/dist/behaviors/pick.js +158 -0
  71. package/dist/behaviors/scrub.js +152 -0
  72. package/dist/behaviors/sortable.js +170 -0
  73. package/dist/behaviors/spans.js +240 -0
  74. package/dist/behaviors/testing.js +48 -0
  75. package/dist/behaviors/transfer.js +202 -0
  76. package/dist/behaviors/turns.js +106 -0
  77. package/dist/behaviors/widths.js +150 -0
  78. package/dist/behaviors.css +309 -0
  79. package/dist/changeDetails.d.ts +4 -8
  80. package/dist/changeDetails.js +0 -6
  81. package/dist/conformance.js +107 -1
  82. package/dist/controls.css +36 -0
  83. package/dist/fieldFrame.d.ts +2 -15
  84. package/dist/fieldFrame.js +1 -17
  85. package/dist/index.d.ts +6 -5
  86. package/dist/index.js +6 -5
  87. package/dist/internal/Frame.d.ts +6 -0
  88. package/dist/internal/Frame.js +25 -0
  89. package/dist/internal/HelpTip.d.ts +5 -0
  90. package/dist/internal/HelpTip.js +37 -0
  91. package/dist/internal/layers.d.ts +21 -0
  92. package/dist/internal/layers.js +66 -0
  93. package/dist/internal/popups.d.ts +12 -10
  94. package/dist/internal/popups.js +18 -14
  95. package/dist/internal/told.d.ts +14 -0
  96. package/dist/internal/told.js +20 -0
  97. package/dist/internal/uiKitContext.js +6 -4
  98. package/dist/preferences.css +2 -3
  99. package/dist/style.css +5 -16
  100. package/dist/styles/extras.css +461 -0
  101. package/dist/styles/forms.css +346 -0
  102. package/dist/styles/guard.css +114 -0
  103. package/dist/styles/kit-fields.css +181 -0
  104. package/dist/styles/kit-parts.css +130 -0
  105. package/dist/styles/kit.css +558 -0
  106. package/dist/styles/layers.css +4 -0
  107. package/dist/styles/looks.css +374 -0
  108. package/dist/styles/m-tokens.css +173 -0
  109. package/dist/styles/overlays.css +107 -0
  110. package/dist/styles/parts.css +456 -0
  111. package/dist/styles/screens.css +76 -0
  112. package/dist/styles/ui-sdk.css +1635 -0
  113. package/dist/tokens.css +15 -4
  114. package/dist/uiKitSlots.d.ts +1 -1
  115. package/dist/uiKitSlots.js +18 -2
  116. package/package.json +13 -11
  117. package/dist/forms.css +0 -225
  118. package/dist/hero.css +0 -23
  119. package/dist/internal/anchor.d.ts +0 -19
  120. package/dist/internal/anchor.js +0 -52
  121. package/dist/primitives.css +0 -200
  122. package/dist/standalone.css +0 -478
package/dist/FileField.js CHANGED
@@ -7,12 +7,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  * (Tab to it, Enter or Space) and the file dialog are the platform's. A command's form has `field.file`, which sends
8
8
  * the bytes; this sends nothing. Props only. Preview: @mistriwork/ui is Preview at 1.0.
9
9
  */
10
+ import { Button } from '@ui-sdk/react/button';
11
+ import { FieldControl } from '@ui-sdk/react/field';
10
12
  import { useEffect, useRef } from 'react';
11
- import { buttonClass } from './Button.js';
12
13
  import { changeDetails } from './changeDetails.js';
13
- import { Field } from './Field.js';
14
- import { frameOf } from './fieldFrame.js';
15
- export function FileField(props) {
14
+ import { Frame } from './internal/Frame.js';
15
+ import { slotted } from './internal/uiKitContext.js';
16
+ function DefaultFileField(props) {
16
17
  const own = useRef(null);
17
18
  // The input keeps its own files, so a page that clears the value (null, or an empty list) has to clear it too.
18
19
  const cleared = props.multiple ? props.value.length === 0 : props.value === null;
@@ -23,18 +24,20 @@ export function FileField(props) {
23
24
  const chosen = props.value;
24
25
  const names = Array.isArray(chosen) ? chosen.map((file) => file.name) : chosen ? [chosen.name] : [];
25
26
  const said = names.join(', ');
26
- return (_jsx(Field, { ...frameOf(props), children: (control) => (_jsxs("div", { className: "field-file", children: [_jsx("input", { ...control, ref: (node) => {
27
+ return (_jsx(Frame, { ...props, children: _jsxs("div", { "data-slot": "file-field", children: [_jsx(FieldControl, { id: props.id, ref: (node) => {
27
28
  own.current = node;
28
29
  if (typeof props.inputRef === 'function')
29
30
  props.inputRef(node);
30
31
  else if (props.inputRef)
31
32
  props.inputRef.current = node;
32
- }, className: "field-file-input", type: "file", name: props.name, accept: props.accept, disabled: props.disabled, multiple: props.multiple === true, onChange: (e) => {
33
- const files = Array.from(e.target.files ?? []);
34
- const details = changeDetails('file-pick', e);
33
+ }, "data-kind": "file", type: "file", name: props.name, accept: props.accept, disabled: props.disabled, multiple: props.multiple === true, "aria-required": props.required || undefined, onChange: (event) => {
34
+ const files = Array.from(event.target.files ?? []);
35
+ const details = changeDetails('file-pick', event);
35
36
  if (props.multiple === true)
36
37
  props.onChange(files, details);
37
38
  else
38
39
  props.onChange(files[0] ?? null, details);
39
- } }), _jsx("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: buttonClass({ intent: 'secondary', className: 'field-file-button' }), disabled: props.disabled, onClick: () => own.current?.click(), children: props.chooseLabel ?? (props.multiple ? 'Choose files' : 'Choose file') }), _jsx("span", { className: `field-file-names${names.length ? '' : ' is-none'}`, title: said || undefined, children: said || (props.noneLabel ?? 'No file chosen') })] })) }));
40
+ } }), _jsx(Button, { type: "button", "data-kind": "file", tabIndex: -1, "aria-hidden": "true", disabled: props.disabled, onClick: () => own.current?.click(), children: props.chooseLabel ?? (props.multiple ? 'Choose files' : 'Choose file') }), _jsx("span", { "data-slot": "file-field-names", "data-none": names.length ? undefined : '', title: said || undefined, children: said || (props.noneLabel ?? 'No file chosen') })] }) }));
40
41
  }
42
+ /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
43
+ export const FileField = slotted('FileField', DefaultFileField, { onChange: [1, 'file-pick'] });
@@ -3,7 +3,8 @@
3
3
  * review group and a row of columns. Props only: every word and every picture arrives as a prop, and none of them
4
4
  * knows a field, a step or an address. Preview: @mistriwork/ui is Preview at 1.0.
5
5
  */
6
- import { type ReactNode } from 'react';
6
+ import type { ReactNode } from 'react';
7
+ import { HelpTip } from './internal/HelpTip.js';
7
8
  export interface HelpTipProps {
8
9
  /** The tip's text. */
9
10
  text: ReactNode;
@@ -12,8 +13,6 @@ export interface HelpTipProps {
12
13
  /** The mark on the button; without one, an "i". */
13
14
  icon?: ReactNode;
14
15
  }
15
- /** The "i" beside a label: a button that opens its text under it. Escape and a press elsewhere close it. */
16
- export declare function HelpTip({ text, label, icon }: HelpTipProps): ReactNode;
17
16
  export interface ProgressBarProps {
18
17
  value: number;
19
18
  max: number;
@@ -24,7 +23,7 @@ export interface ProgressBarProps {
24
23
  decorative?: boolean;
25
24
  }
26
25
  /** How far along: a filled track. It is information that moves often, so the fill is not animated. */
27
- export declare function ProgressBar({ value, max, min, label, decorative }: ProgressBarProps): ReactNode;
26
+ declare function DefaultProgressBar({ value, max, min, label, decorative }: ProgressBarProps): ReactNode;
28
27
  export interface StepHeaderProps {
29
28
  title: ReactNode;
30
29
  /** The heading's level: 1 (the room's own) by default, 2 where the form sits in a dialog that has its title. */
@@ -35,8 +34,9 @@ export interface StepHeaderProps {
35
34
  /** A decorative glyph before the title. */
36
35
  mark?: ReactNode;
37
36
  }
38
- /** A step's title and the quiet lead under it. */
39
- export declare function StepHeader({ title, lead, mark, level, id }: StepHeaderProps): ReactNode;
37
+ /** A step's title and the quiet lead under it. The heading takes the keyboard when the step changes, so the next key
38
+ is about it. */
39
+ declare function DefaultStepHeader({ title, lead, mark, level, id }: StepHeaderProps): ReactNode;
40
40
  export interface ActionBarProps {
41
41
  /** Another class on the bar, for the form that draws it. */
42
42
  className?: string;
@@ -55,14 +55,21 @@ export interface ActionBarProps {
55
55
  };
56
56
  }
57
57
  /** The bar fixed to the foot of its container: Back as a quiet word, and a filled primary that takes the rest of the width. */
58
- export declare function ActionBar({ back, primary, className }: ActionBarProps): ReactNode;
59
- /** Fields side by side; `cols` is a grid template such as "1fr 1.8fr". A row stacks where its fields no longer fit. */
60
- export declare function Columns({ cols, children }: {
58
+ declare function DefaultActionBar({ back, primary, className }: ActionBarProps): ReactNode;
59
+ /** Fields side by side; `cols` is a grid template such as "1fr 1.8fr". A row stacks where its fields no longer fit:
60
+ the template is handed to the stylesheet as a property and not written as the grid itself, so it can. */
61
+ declare function DefaultColumns({ cols, children }: {
61
62
  cols?: string;
62
63
  children: ReactNode;
63
64
  }): ReactNode;
64
65
  /** The editable review: earlier steps' fields drawn again in one labelled group. */
65
- export declare function ReviewList({ label, children }: {
66
+ declare function DefaultReviewList({ label, children }: {
66
67
  label: string;
67
68
  children: ReactNode;
68
69
  }): ReactNode;
70
+ export { HelpTip };
71
+ export declare const ProgressBar: typeof DefaultProgressBar;
72
+ export declare const StepHeader: typeof DefaultStepHeader;
73
+ export declare const ActionBar: typeof DefaultActionBar;
74
+ export declare const Columns: typeof DefaultColumns;
75
+ export declare const ReviewList: typeof DefaultReviewList;
package/dist/FormParts.js CHANGED
@@ -1,53 +1,38 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * The small parts a form is drawn from: the help tip, the progress bar, a step's heading, the fixed action bar, the
4
- * review group and a row of columns. Props only: every word and every picture arrives as a prop, and none of them
5
- * knows a field, a step or an address. Preview: @mistriwork/ui is Preview at 1.0.
6
- */
7
- import { useEffect, useId, useRef, useState } from 'react';
8
2
  import { Button } from './Button.js';
9
- /** The "i" beside a label: a button that opens its text under it. Escape and a press elsewhere close it. */
10
- export function HelpTip({ text, label, icon }) {
11
- const [open, setOpen] = useState(false);
12
- const tipId = useId();
13
- const root = useRef(null);
14
- useEffect(() => {
15
- if (!open)
16
- return undefined;
17
- const outside = (e) => {
18
- if (root.current && !root.current.contains(e.target))
19
- setOpen(false);
20
- };
21
- document.addEventListener('pointerdown', outside);
22
- return () => document.removeEventListener('pointerdown', outside);
23
- }, [open]);
24
- return (_jsxs("span", { className: "help-tip", ref: root, children: [_jsx("button", { type: "button", className: "help-tip-button", "aria-label": label, "aria-expanded": open, "aria-describedby": open ? tipId : undefined, onClick: () => setOpen(!open), onKeyDown: (e) => {
25
- if (e.key === 'Escape' && open) {
26
- e.stopPropagation();
27
- setOpen(false);
28
- }
29
- }, children: icon ?? _jsx("span", { "aria-hidden": "true", children: "i" }) }), open ? (_jsx("span", { role: "tooltip", id: tipId, className: "help-tip-text", children: text })) : null] }));
30
- }
3
+ import { HelpTip } from './internal/HelpTip.js';
4
+ import { slotted } from './internal/uiKitContext.js';
31
5
  /** How far along: a filled track. It is information that moves often, so the fill is not animated. */
32
- export function ProgressBar({ value, max, min = 0, label, decorative }) {
33
- return (_jsx("div", { className: "progress-bar", ...(decorative
6
+ function DefaultProgressBar({ value, max, min = 0, label, decorative }) {
7
+ return (_jsx("div", { "data-slot": "progress-track", "data-kind": "bar", ...(decorative
34
8
  ? { 'aria-hidden': true }
35
- : { role: 'progressbar', 'aria-label': label, 'aria-valuemin': min, 'aria-valuemax': max, 'aria-valuenow': value }), children: _jsx("span", { className: "progress-bar-fill", style: { width: `${max > 0 ? Math.min(100, (value / max) * 100) : 0}%` } }) }));
9
+ : { role: 'progressbar', 'aria-label': label, 'aria-valuemin': min, 'aria-valuemax': max, 'aria-valuenow': value }), children: _jsx("span", { "data-slot": "progress-indicator", style: { width: `${max > 0 ? Math.min(100, (value / max) * 100) : 0}%` } }) }));
36
10
  }
37
- /** A step's title and the quiet lead under it. */
38
- export function StepHeader({ title, lead, mark, level = 1, id }) {
11
+ /** A step's title and the quiet lead under it. The heading takes the keyboard when the step changes, so the next key
12
+ is about it. */
13
+ function DefaultStepHeader({ title, lead, mark, level = 1, id }) {
39
14
  const Heading = level === 1 ? 'h1' : 'h2';
40
- return (_jsxs("header", { className: "step-header", children: [_jsxs(Heading, { className: "step-title", id: id, tabIndex: -1, children: [mark ? (_jsx("span", { className: "step-mark", "aria-hidden": "true", children: mark })) : null, title] }), lead ? _jsx("p", { className: "step-lead", children: lead }) : null] }));
15
+ return (_jsxs("header", { "data-slot": "step-header", children: [_jsxs(Heading, { id: id, tabIndex: -1, children: [mark ? (_jsx("span", { "data-slot": "step-mark", "aria-hidden": "true", children: mark })) : null, title] }), lead ? _jsx("p", { "data-slot": "step-lead", children: lead }) : null] }));
41
16
  }
42
17
  /** The bar fixed to the foot of its container: Back as a quiet word, and a filled primary that takes the rest of the width. */
43
- export function ActionBar({ back, primary, className }) {
44
- return (_jsxs("footer", { className: className ? `action-bar ${className}` : 'action-bar', children: [back ? (_jsxs(Button, { intent: "quiet", size: "large", className: "action-bar-back", onClick: back.onClick, children: [back.icon, back.label] })) : null, _jsxs(Button, { intent: "primary", size: "large", className: "action-bar-primary", disabled: primary.disabled, busy: primary.busy, busyLabel: primary.busyLabel, onClick: primary.onClick, children: [primary.label, primary.icon] })] }));
18
+ function DefaultActionBar({ back, primary, className }) {
19
+ return (_jsxs("footer", { "data-slot": "action-bar", className: className || undefined, children: [back ? (_jsxs(Button, { intent: "quiet", size: "large", onClick: back.onClick, children: [back.icon, back.label] })) : null, _jsxs(Button, { intent: "primary", size: "large", disabled: primary.disabled, busy: primary.busy, busyLabel: primary.busyLabel, onClick: primary.onClick, children: [primary.label, primary.icon] })] }));
45
20
  }
46
- /** Fields side by side; `cols` is a grid template such as "1fr 1.8fr". A row stacks where its fields no longer fit. */
47
- export function Columns({ cols, children }) {
48
- return (_jsx("div", { className: "form-columns", style: cols ? { '--form-columns': cols } : undefined, children: children }));
21
+ /** Fields side by side; `cols` is a grid template such as "1fr 1.8fr". A row stacks where its fields no longer fit:
22
+ the template is handed to the stylesheet as a property and not written as the grid itself, so it can. */
23
+ function DefaultColumns({ cols, children }) {
24
+ return (_jsx("div", { "data-slot": "columns", "data-kind": cols ? 'template' : undefined, style: cols ? { '--form-columns': cols } : undefined, children: children }));
49
25
  }
50
26
  /** The editable review: earlier steps' fields drawn again in one labelled group. */
51
- export function ReviewList({ label, children }) {
52
- return (_jsx("div", { className: "review-list", role: "group", "aria-label": label, children: children }));
27
+ function DefaultReviewList({ label, children }) {
28
+ return (_jsx("div", { "data-slot": "review-list", "data-kind": "group", role: "group", "aria-label": label, children: children }));
53
29
  }
30
+ /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. The "i"
31
+ beside a label is a button that opens its text under it; Escape and a press elsewhere close it. Its default is
32
+ drawn in a module of its own (internal/HelpTip.tsx), which a field's frame also draws from. */
33
+ export { HelpTip };
34
+ export const ProgressBar = slotted('ProgressBar', DefaultProgressBar);
35
+ export const StepHeader = slotted('StepHeader', DefaultStepHeader);
36
+ export const ActionBar = slotted('ActionBar', DefaultActionBar);
37
+ export const Columns = slotted('Columns', DefaultColumns);
38
+ export const ReviewList = slotted('ReviewList', DefaultReviewList);
@@ -11,7 +11,7 @@ export interface BadgeProps {
11
11
  icon?: ReactNode;
12
12
  }
13
13
  /** A pill of a few words with an optional icon, over a heading. Quiet: a note on the page, never a button. */
14
- export declare function Badge({ children, icon }: BadgeProps): import("react").JSX.Element;
14
+ declare function DefaultBadge({ children, icon }: BadgeProps): import("react").JSX.Element;
15
15
  export interface PhotoTile {
16
16
  src: string;
17
17
  alt: string;
@@ -26,7 +26,7 @@ export interface PhotoTilesProps {
26
26
  * and nothing moves. The first is the one the page waits for; the rest load as they come near. Fewer than two is no
27
27
  * mosaic, and more than four are cut off.
28
28
  */
29
- export declare function PhotoTiles({ tiles }: PhotoTilesProps): import("react").JSX.Element | null;
29
+ declare function DefaultPhotoTiles({ tiles }: PhotoTilesProps): import("react").JSX.Element | null;
30
30
  export interface IconRowsProps {
31
31
  rows: readonly {
32
32
  icon: ReactNode;
@@ -34,4 +34,8 @@ export interface IconRowsProps {
34
34
  }[];
35
35
  }
36
36
  /** Up to four rows, each an icon in the accent and a line in the muted ink. Nothing for no rows. */
37
- export declare function IconRows({ rows }: IconRowsProps): import("react").JSX.Element | null;
37
+ declare function DefaultIconRows({ rows }: IconRowsProps): import("react").JSX.Element | null;
38
+ export declare const Badge: typeof DefaultBadge;
39
+ export declare const PhotoTiles: typeof DefaultPhotoTiles;
40
+ export declare const IconRows: typeof DefaultIconRows;
41
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { slotted } from './internal/uiKitContext.js';
2
3
  /** A pill of a few words with an optional icon, over a heading. Quiet: a note on the page, never a button. */
3
- export function Badge({ children, icon }) {
4
- return (_jsxs("p", { className: "front-badge", children: [icon, _jsx("span", { children: children })] }));
4
+ function DefaultBadge({ children, icon }) {
5
+ return (_jsxs("p", { "data-slot": "badge", "data-kind": "hero", children: [icon, _jsx("span", { children: children })] }));
5
6
  }
6
7
  /** The most tiles a mosaic cuts the box into. */
7
8
  const MOST_TILES = 4;
@@ -10,17 +11,21 @@ const MOST_TILES = 4;
10
11
  * and nothing moves. The first is the one the page waits for; the rest load as they come near. Fewer than two is no
11
12
  * mosaic, and more than four are cut off.
12
13
  */
13
- export function PhotoTiles({ tiles }) {
14
+ function DefaultPhotoTiles({ tiles }) {
14
15
  if (tiles.length < 2)
15
16
  return null;
16
17
  const shown = tiles.slice(0, MOST_TILES);
17
- return (_jsx("div", { className: `front-hero-media front-hero-tiles front-hero-tiles-${shown.length}`, children: shown.map((tile, index) => (_jsx("img", { src: tile.src, srcSet: tile.srcSet, sizes: tile.sizes, alt: tile.alt, decoding: "async", ...(index === 0 ? { fetchPriority: 'high' } : { loading: 'lazy' }) }, `${index}:${tile.src}`))) }));
18
+ return (_jsx("div", { "data-slot": "photo-tiles", "data-count": shown.length, children: shown.map((tile, index) => (_jsx("figure", { children: _jsx("img", { src: tile.src, srcSet: tile.srcSet, sizes: tile.sizes, alt: tile.alt, decoding: "async", ...(index === 0 ? { fetchPriority: 'high' } : { loading: 'lazy' }) }) }, `${index}:${tile.src}`))) }));
18
19
  }
19
20
  /** The most rows the block draws. */
20
21
  const MOST_ROWS = 4;
21
22
  /** Up to four rows, each an icon in the accent and a line in the muted ink. Nothing for no rows. */
22
- export function IconRows({ rows }) {
23
+ function DefaultIconRows({ rows }) {
23
24
  if (!rows.length)
24
25
  return null;
25
- return (_jsx("ul", { className: "front-points", children: rows.slice(0, MOST_ROWS).map((row, index) => (_jsxs("li", { children: [row.icon, _jsx("span", { children: row.text })] }, `${index}:${row.text}`))) }));
26
+ return (_jsx("ul", { "data-slot": "icon-rows", "data-kind": "plain", children: rows.slice(0, MOST_ROWS).map((row, index) => (_jsxs("li", { children: [_jsx("span", { "data-slot": "icon-rows-icon", "aria-hidden": "true", children: row.icon }), _jsx("span", { children: row.text })] }, `${index}:${row.text}`))) }));
26
27
  }
28
+ /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
29
+ export const Badge = slotted('Badge', DefaultBadge);
30
+ export const PhotoTiles = slotted('PhotoTiles', DefaultPhotoTiles);
31
+ export const IconRows = slotted('IconRows', DefaultIconRows);
package/dist/Modal.d.ts CHANGED
@@ -1,23 +1,9 @@
1
- /**
2
- * A modal, over Base UI's Dialog: what every dialog here used to get from
3
- * the native `<dialog>` — the scrim, focus held inside, Escape and a click
4
- * on the scrim to dismiss, focus handed back on close — in one place, and
5
- * the one thing the native element could not give: popups drawn inside it
6
- * (a listbox, a menu) that Base UI knows are its own.
7
- *
8
- * Open from the moment it mounts, gone when the caller unmounts it; the
9
- * caller hears `onClose` once, whichever way it closed, and can close it
10
- * itself through the handle. Wears the caller's classes — `confirm`,
11
- * `prefs`, `cols` — so the stylesheet and the browser suite see the box
12
- * they always saw, plus `modal` for the placement the element used to
13
- * supply, and a backdrop named after the first class for its scrim.
14
- */
15
1
  import { type ReactNode, type Ref, type RefObject } from 'react';
16
2
  export interface ModalHandle {
17
3
  close: () => void;
18
4
  }
19
5
  interface ModalProps {
20
- /** The classes the stylesheet knows the box by (`confirm`, `prefs`); the first also names the scrim (`confirm-backdrop`). Optional: a bare modal is centered and sized by `modal` alone. */
6
+ /** The classes the stylesheet knows the box by (`confirm`, `prefs`); the first also names the scrim (`[data-slot='dialog-backdrop'][data-for='confirm']`). Optional: a bare modal is centered and sized as a modal alone. */
21
7
  className?: string;
22
8
  /** Told once, however the dialog closed. */
23
9
  onClose: () => void;
@@ -26,12 +12,15 @@ interface ModalProps {
26
12
  /** Return false to keep the dialog open, for example while confirming discard. */
27
13
  beforeClose?: () => boolean;
28
14
  children: ReactNode;
29
- /** The control to focus on open; Base UI's default (the first focusable) otherwise. */
15
+ /** The control to focus on open; UI SDK's default (the first focusable) otherwise. */
30
16
  initialFocus?: RefObject<HTMLElement | null> | false;
31
17
  /** Where focus goes on close, once the page is no longer inert; the element focused at open otherwise. */
32
18
  finalFocus?: RefObject<HTMLElement | null>;
33
19
  /** The dialog's name; absent, its first heading names it. */
34
20
  ariaLabel?: string;
21
+ /** The name of a cross in the box's top corner that closes it ("Close"). Given, the cross is drawn; it steps aside
22
+ while a button of the caller's own says the same word, so a dialog has one control of that name. */
23
+ closeLabel?: string;
35
24
  /** The box places itself — a panel that is its own scrim, a box the stylesheet already centres — so the `modal` placement is left off. */
36
25
  plain?: boolean;
37
26
  /** No scrim element: the box covers the screen itself. */
@@ -44,6 +33,6 @@ interface ModalProps {
44
33
  fullscreen?: boolean | 'mobile';
45
34
  ref?: Ref<ModalHandle>;
46
35
  }
47
- declare function DefaultModal({ className, onClose, closeDisabled, beforeClose, children, initialFocus, finalFocus, ariaLabel, plain, backdrop, fullscreen, ref, }: ModalProps): import("react").JSX.Element;
36
+ declare function DefaultModal({ className, onClose, closeDisabled, beforeClose, children, initialFocus, finalFocus, ariaLabel, closeLabel, plain, backdrop, fullscreen, ref, }: ModalProps): import("react").JSX.Element;
48
37
  export declare const Modal: typeof DefaultModal;
49
38
  export {};
package/dist/Modal.js CHANGED
@@ -1,24 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
- * A modal, over Base UI's Dialog: what every dialog here used to get from
3
+ * A modal, over UI SDK's Dialog: what every dialog here used to get from
4
4
  * the native `<dialog>` — the scrim, focus held inside, Escape and a click
5
5
  * on the scrim to dismiss, focus handed back on close — in one place, and
6
6
  * the one thing the native element could not give: popups drawn inside it
7
- * (a listbox, a menu) that Base UI knows are its own.
7
+ * (a listbox, a menu) that the dialog knows are its own.
8
8
  *
9
9
  * Open from the moment it mounts, gone when the caller unmounts it; the
10
10
  * caller hears `onClose` once, whichever way it closed, and can close it
11
11
  * itself through the handle. Wears the caller's classes — `confirm`,
12
- * `prefs`, `cols` — so the stylesheet and the browser suite see the box
13
- * they always saw, plus `modal` for the placement the element used to
14
- * supply, and a backdrop named after the first class for its scrim.
12
+ * `prefs`, `cols` — so the caller's stylesheet and the browser suite see
13
+ * the box they always saw. The scrim wears no class: it says whose it is
14
+ * (`data-for`, the box's first class), so a caller's stylesheet that knows
15
+ * the box can say what stands behind it. The placement the element used
16
+ * to supply is the stylesheet's, by the part (`data-kind="modal"`); a
17
+ * `plain` box is left to place itself.
15
18
  */
16
- import { useCallback, useContext, useId, useImperativeHandle, useRef, useState } from 'react';
19
+ import { Dialog, DialogBackdrop, DialogContent } from '@ui-sdk/react/dialog';
20
+ import { useCallback, useContext, useEffect, useId, useImperativeHandle, useRef, useState, } from 'react';
17
21
  import { ComponentStyleScope } from './internal/ComponentStyleScope.js';
18
- import { Dialog } from '@base-ui/react/dialog';
19
22
  import { popupContainer } from './internal/popups.js';
20
23
  import { slotted } from './internal/uiKitContext.js';
21
- function DefaultModal({ className = '', onClose, closeDisabled = false, beforeClose, children, initialFocus, finalFocus, ariaLabel, plain = false, backdrop = true, fullscreen = 'mobile', ref, }) {
24
+ function DefaultModal({ className = '', onClose, closeDisabled = false, beforeClose, children, initialFocus, finalFocus, ariaLabel, closeLabel, plain = false, backdrop = true, fullscreen = 'mobile', ref, }) {
25
+ /* A dialog is drawn outside the component that opened it, so it says whose it is: the component's scoped
26
+ stylesheet reaches what carries its name and nothing else. */
22
27
  const componentScope = useContext(ComponentStyleScope);
23
28
  const [open, setOpen] = useState(true);
24
29
  const closed = useRef(false);
@@ -31,30 +36,94 @@ function DefaultModal({ className = '', onClose, closeDisabled = false, beforeCl
31
36
  return true;
32
37
  };
33
38
  useImperativeHandle(ref, () => ({ close }));
39
+ /* The caller unmounts the dialog the moment it hears `onClose`, which is before UI SDK has handed the focus
40
+ back. So what had the focus when the dialog arrived is remembered here, read while rendering (before any
41
+ effect has moved it), and given it back when the dialog goes, unless the caller named another place. */
42
+ const [opener] = useState(() => (typeof document === 'undefined' ? null : document.activeElement));
43
+ useEffect(() => () => {
44
+ const to = finalFocus?.current ?? opener;
45
+ queueMicrotask(() => {
46
+ const at = document.activeElement;
47
+ if (to?.isConnected && (!at || at === document.body || !at.isConnected))
48
+ to.focus({ preventScroll: true });
49
+ });
50
+ }, [opener, finalFocus]);
34
51
  /* A dialog with no `aria-label` is named by its first heading, which every one of these opens with: a screen reader
35
52
  announces "Delete invoice 7, dialog" rather than an unnamed dialog. Done when the box attaches, because the heading
36
- is the caller's children and the box mounts in a portal after this component's first effect. */
53
+ is the caller's children and the box mounts after this component's first effect. */
37
54
  const headingId = useId();
38
55
  const [labelledBy, setLabelledBy] = useState();
56
+ const unwatch = useRef(undefined);
57
+ /* Whether the focus is in the box, kept across the box being read again: a dialog whose name changes (a glance,
58
+ stepping) is handed a new callback in the very render that removes what had the focus. */
59
+ const within = useRef(false);
60
+ /* The caller's own button already says the cross's word (a form that has finished offers "Close" in its foot):
61
+ two controls of one name in one dialog are one too many to ask for by name, so the cross leaves while it stands. */
62
+ const [ownClose, setOwnClose] = useState(false);
63
+ useEffect(() => () => unwatch.current?.(), []);
39
64
  const popup = useCallback((node) => {
40
- if (ariaLabel || !node)
65
+ unwatch.current?.();
66
+ unwatch.current = undefined;
67
+ if (!node)
41
68
  return;
42
- const heading = node.querySelector('h1, h2, h3');
43
- if (!heading)
44
- return;
45
- if (!heading.id)
46
- heading.id = headingId;
47
- setLabelledBy(heading.id);
48
- }, [ariaLabel, headingId]);
69
+ const heading = ariaLabel ? null : node.querySelector('h1, h2, h3');
70
+ if (heading) {
71
+ if (!heading.id)
72
+ heading.id = headingId;
73
+ setLabelledBy(heading.id);
74
+ }
75
+ /* What has the focus may be taken off the page while the dialog is open: a glance steps to the next record
76
+ and draws its body anew, a row in a dialog is removed. The browser then leaves the focus on the body, under
77
+ the dialog, where no key reaches it, and says so with no event. So the box is watched, and takes the focus
78
+ itself when the element that had it is gone. */
79
+ const page = node.ownerDocument;
80
+ const entered = () => {
81
+ within.current = true;
82
+ };
83
+ const left = (event) => {
84
+ if (!(event.relatedTarget instanceof Node) || !node.contains(event.relatedTarget))
85
+ within.current = event.relatedTarget === null;
86
+ };
87
+ const held = () => {
88
+ const at = page.activeElement;
89
+ if (within.current && node.isConnected && (!at || at === page.body))
90
+ node.focus({ preventScroll: true });
91
+ };
92
+ const named = () => {
93
+ if (!closeLabel)
94
+ return;
95
+ const said = closeLabel.trim().toLowerCase();
96
+ setOwnClose([...node.querySelectorAll('button:not([data-slot="dialog-close"])')].some((button) => (button.getAttribute('aria-label') ?? button.textContent ?? '').trim().toLowerCase() === said));
97
+ };
98
+ const watch = new MutationObserver(() => {
99
+ held();
100
+ named();
101
+ });
102
+ node.addEventListener('focusin', entered);
103
+ node.addEventListener('focusout', left);
104
+ watch.observe(node, { childList: true, subtree: true, characterData: true });
105
+ named();
106
+ /* The render that renames the dialog is the one that draws its body anew, and this callback is that render's:
107
+ the last watcher was let go before the change and this one begins after it, so neither saw it. Asked once
108
+ here, or the focus stayed on the page until something else in the box happened to change. */
109
+ held();
110
+ unwatch.current = () => {
111
+ node.removeEventListener('focusin', entered);
112
+ node.removeEventListener('focusout', left);
113
+ watch.disconnect();
114
+ };
115
+ }, [ariaLabel, headingId, closeLabel]);
116
+ /* The scrim says which box it stands behind, by the box's first class, so a caller's stylesheet that knows the
117
+ box (`lightbox`) can say what stands behind it (`[data-slot='dialog-backdrop'][data-for='lightbox']`). */
49
118
  const first = className.split(/\s+/)[0];
50
- const scrim = first ? `modal-backdrop ${first}-backdrop` : 'modal-backdrop';
51
- const size = fullscreen ? ` modal-fullscreen${fullscreen === 'mobile' ? '-mobile' : ''}` : '';
52
- return (_jsx(Dialog.Root, { modal: true, open: open, onOpenChange: (next, details) => {
119
+ // A plain box places itself, and its scrim is the caller's to paint: neither wears the modal's dress.
120
+ const kind = plain ? 'plain' : 'modal';
121
+ return (_jsxs(Dialog, { container: popupContainer(), open: open, onOpenChange: (next, details) => {
53
122
  if (next)
54
123
  return;
55
124
  if (!close())
56
125
  details.cancel();
57
- }, children: _jsxs(Dialog.Portal, { container: popupContainer(), children: [backdrop ? _jsx(Dialog.Backdrop, { className: plain ? scrim.replace('modal-backdrop ', '') : scrim }) : null, _jsx(Dialog.Popup, { "data-component": componentScope, className: `${plain ? className : `modal ${className}`.trim()}${size}`, initialFocus: initialFocus, ...(finalFocus ? { finalFocus } : {}), ref: popup, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : labelledBy, "aria-modal": "true", children: children })] }) }));
126
+ }, children: [backdrop ? _jsx(DialogBackdrop, { "data-for": first || undefined, "data-kind": kind }) : null, _jsxs(DialogContent, { ref: popup, className: className || undefined, "data-kind": kind, "data-component": componentScope, "data-fullscreen": fullscreen === true ? 'always' : fullscreen === 'mobile' ? 'mobile' : undefined, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : labelledBy, "aria-modal": "true", initialFocus: initialFocus === false ? 'content' : initialFocus ? () => initialFocus.current : undefined, finalFocus: finalFocus ? () => finalFocus.current : undefined, children: [children, closeLabel && !ownClose && (_jsx("button", { type: "button", "data-slot": "dialog-close", "data-part": "cross", "aria-label": closeLabel, title: closeLabel, disabled: closeDisabled, onClick: () => close(), children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) }))] })] }));
58
127
  }
59
128
  /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
60
129
  export const Modal = slotted('Modal', DefaultModal);
@@ -1,16 +1,5 @@
1
- /**
2
- * Pagination: the pages of a list, as a row of buttons. Plain React —
3
- * Base UI has no pagination, and a row of buttons is all one is — with
4
- * the rules a list's pages need: the current page is `aria-current`,
5
- * never a button to itself; Previous and Next are disabled at the ends,
6
- * never hidden, so the row keeps its shape; and a long run of pages is
7
- * shortened with an ellipsis, never with a jump the reader cannot see.
8
- * Pages are 1-based, as the reader counts them; `pages` is the count of
9
- * pages, not of rows. With one page or none, the row renders nothing:
10
- * a pager for a single page is noise.
11
- */
12
1
  import type { ReactNode } from 'react';
13
- import { type ChangeDetails } from './changeDetails.js';
2
+ import type { ChangeDetails } from './changeDetails.js';
14
3
  export interface PaginationProps {
15
4
  /** The current page, 1-based. */
16
5
  page: number;
@@ -1,5 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { changeDetails } from './changeDetails.js';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Pagination: the pages of a list, as a row of buttons, over UI SDK's
4
+ * Pagination, with the rules a list's pages need: the current page is
5
+ * `aria-current`, never a button to itself; Previous and Next are
6
+ * disabled at the ends, never hidden, so the row keeps its shape; and a
7
+ * long run of pages is shortened with an ellipsis, never with a jump the
8
+ * reader cannot see. Pages are 1-based, as the reader counts them;
9
+ * `pages` is the count of pages, not of rows. With one page or none, the
10
+ * row renders nothing: a pager for a single page is noise.
11
+ */
12
+ import { Pagination as Pages, PaginationEllipsis, PaginationItem, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, } from '@ui-sdk/react/pagination';
13
+ import { told } from './internal/told.js';
3
14
  import { slotted } from './internal/uiKitContext.js';
4
15
  /** The page numbers to draw: the first, the last, and a window of five around the current, with gaps as ellipses. */
5
16
  export function paginationItems(page, pages) {
@@ -18,12 +29,15 @@ export function paginationItems(page, pages) {
18
29
  }
19
30
  return items;
20
31
  }
32
+ /* A step is typed as the link it can be and drawn as a button here, where no page has an address: `disabled` is
33
+ the button's. */
34
+ const shut = (at) => (at ? { disabled: true } : {});
21
35
  function DefaultPagination({ page, pages, onPageChange, ariaLabel, words: given }) {
22
36
  const words = { pages: 'Pages', previous: 'Previous', next: 'Next', ...given };
23
37
  if (pages <= 1)
24
38
  return null;
25
39
  const current = Math.min(Math.max(page, 1), pages);
26
- return (_jsxs("nav", { className: "ui-pagination", "aria-label": ariaLabel ?? words.pages, children: [_jsx("button", { type: "button", className: "ui-page ui-page-step", disabled: current === 1, onClick: (e) => onPageChange(current - 1, changeDetails('page-press', e)), children: words.previous }), paginationItems(current, pages).map((item, i) => item === '…' ? (_jsx("span", { className: "ui-page-gap", "aria-hidden": "true", children: "\u2026" }, `gap-${i}`)) : (_jsx("button", { type: "button", className: "ui-page", "aria-current": item === current ? 'page' : undefined, onClick: (e) => onPageChange(item, changeDetails('page-press', e)), children: item }, item))), _jsx("button", { type: "button", className: "ui-page ui-page-step", disabled: current === pages, onClick: (e) => onPageChange(current + 1, changeDetails('page-press', e)), children: words.next })] }));
40
+ return (_jsx(Pages, { "aria-label": ariaLabel ?? words.pages, page: current, pageCount: pages, siblings: 2, onPageChange: (next, details) => onPageChange(next, told('page-press', details)), children: _jsx(PaginationList, { children: ({ items }) => (_jsxs(_Fragment, { children: [_jsx(PaginationItem, { children: _jsx(PaginationPrevious, { "data-kind": "words", ...shut(current === 1), children: words.previous }) }), items.map((item) => (_jsx(PaginationItem, { children: typeof item === 'number' ? _jsx(PaginationLink, { page: item }) : _jsx(PaginationEllipsis, {}) }, item))), _jsx(PaginationItem, { children: _jsx(PaginationNext, { "data-kind": "words", ...shut(current === pages), children: words.next }) })] })) }) }));
27
41
  }
28
42
  /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
29
43
  export const Pagination = slotted('Pagination', DefaultPagination, { onPageChange: [1, 'page-press'] });
package/dist/Popover.d.ts CHANGED
@@ -1,19 +1,5 @@
1
- /**
2
- * A popover: a small layer anchored to a trigger, over Base UI's Popover,
3
- * which gives it the anchoring, Escape and a click outside to dismiss,
4
- * and focus handed back on close. The trigger is the caller's element
5
- * (a button, a word); the popup is the layer's children. Controlled with
6
- * `open`/`onOpenChange`, uncontrolled with `defaultOpen`. Where the
7
- * popup is a menu of actions, DropMenu is the right primitive instead:
8
- * a popover is a layer, not a list of commands.
9
- *
10
- * Placed as DropMenu places its menu: anchored on the zoom-aware ruler
11
- * (anchor.ts) and fixed to the viewport, and drawn inside an enclosing
12
- * dialog, so the density zoom cannot throw it a room away from its trigger
13
- * and a dialog's focus trap keeps it as its own.
14
- */
15
1
  import { type ReactNode } from 'react';
16
- import { type ChangeDetails } from './changeDetails.js';
2
+ import type { ChangeDetails } from './changeDetails.js';
17
3
  export interface PopoverProps {
18
4
  trigger: ReactNode;
19
5
  children: ReactNode;
package/dist/Popover.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
- * A popover: a small layer anchored to a trigger, over Base UI's Popover,
3
+ * A popover: a small layer anchored to a trigger, over UI SDK's Popover,
4
4
  * which gives it the anchoring, Escape and a click outside to dismiss,
5
5
  * and focus handed back on close. The trigger is the caller's element
6
6
  * (a button, a word); the popup is the layer's children. Controlled with
@@ -8,29 +8,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  * popup is a menu of actions, DropMenu is the right primitive instead:
9
9
  * a popover is a layer, not a list of commands.
10
10
  *
11
- * Placed as DropMenu places its menu: anchored on the zoom-aware ruler
12
- * (anchor.ts) and fixed to the viewport, and drawn inside an enclosing
13
- * dialog, so the density zoom cannot throw it a room away from its trigger
14
- * and a dialog's focus trap keeps it as its own.
11
+ * Drawn inside an enclosing dialog, so a dialog's focus trap keeps it as
12
+ * its own, and otherwise where the page says its popups go (popups.ts).
15
13
  */
16
- import { isValidElement, useContext, useRef } from 'react';
17
- import { Popover as BasePopover } from '@base-ui/react/popover';
18
- import { layoutViewport, zoomAnchor } from './internal/anchor.js';
14
+ import { Popover as Layer, PopoverContent, PopoverTrigger } from '@ui-sdk/react/popover';
15
+ import { useContext, useRef } from 'react';
19
16
  import { ComponentStyleScope } from './internal/ComponentStyleScope.js';
17
+ import { heard, triggerElement } from './internal/layers.js';
20
18
  import { popupContainer, useDialogContainer } from './internal/popups.js';
21
- import { fromBaseUi } from './changeDetails.js';
22
19
  import { slotted } from './internal/uiKitContext.js';
23
20
  function DefaultPopover({ trigger, children, open, defaultOpen, onOpenChange, className, ariaLabel }) {
24
- /* The trigger is rendered as the trigger, not inside one: a button
25
- passed as a child nested inside Base UI's own button, giving two
26
- buttons for one control. The render prop merges onto the caller's
27
- element (DropMenu.tsx does the same for its trigger). */
28
- const triggerElement = isValidElement(trigger) ? trigger : _jsx("button", { type: "button", children: trigger });
29
21
  const anchor = useRef(null);
30
22
  const container = useDialogContainer(anchor);
31
23
  /* The layer is drawn outside the page that opened it; the page's scope goes with it (Modal.tsx). */
32
24
  const componentScope = useContext(ComponentStyleScope);
33
- return (_jsxs(BasePopover.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange && ((next, details) => onOpenChange(next, fromBaseUi(details, 'implicit'))), children: [_jsx(BasePopover.Trigger, { className: "ui-popover-trigger", render: triggerElement, ref: anchor }), _jsx(BasePopover.Portal, { container: container ?? popupContainer(), children: _jsx(BasePopover.Positioner, { anchor: () => (anchor.current ? zoomAnchor(anchor.current) : null), positionMethod: "fixed", sideOffset: 8, collisionBoundary: layoutViewport(), collisionPadding: 8, children: _jsx(BasePopover.Popup, { "data-component": componentScope, className: ['ui-popover', className].filter(Boolean).join(' '), "aria-label": ariaLabel, children: children }) }) })] }));
25
+ return (_jsxs(Layer, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange && ((next, details) => onOpenChange(next, heard(details))), children: [_jsx(PopoverTrigger, { render: triggerElement(trigger), ref: anchor }), _jsx(PopoverContent, { className: className, "data-component": componentScope, "aria-label": ariaLabel,
26
+ /* UI SDK names the popup by its trigger. A name the caller gives is the popup's own, and the trigger's
27
+ words would be read in its place: `aria-labelledby` outranks `aria-label`. */
28
+ render: ariaLabel ? (drawn) => _jsx("div", { ...drawn, "aria-labelledby": undefined }) : undefined, sideOffset: 8, collisionPadding: 8, container: container ?? popupContainer(), children: children })] }));
34
29
  }
35
30
  /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
36
31
  export const Popover = slotted('Popover', DefaultPopover, { onOpenChange: [1, 'implicit'] });