@calcifer-design/ui 0.2.1 → 0.3.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 (47) hide show
  1. package/dist/components/Alert/Alert.js +4 -15
  2. package/dist/components/Alert/Alert.module.js +1 -2
  3. package/dist/components/Alert/Alert_module.css +0 -12
  4. package/dist/components/Avatar/Avatar.js +2 -1
  5. package/dist/components/Avatar/Avatar.module.js +1 -2
  6. package/dist/components/Avatar/Avatar_module.css +0 -12
  7. package/dist/components/DataTable/DataTable.js +7 -2
  8. package/dist/components/DataTable/DataTable_module.css +0 -16
  9. package/dist/components/Dialog/Dialog.d.ts +44 -0
  10. package/dist/components/Dialog/Dialog.js +82 -0
  11. package/dist/components/Dialog/Dialog.module.js +10 -0
  12. package/dist/components/Dialog/Dialog_module.css +51 -0
  13. package/dist/components/LiveRegion/LiveRegion.js +2 -2
  14. package/dist/components/Menu/Menu.d.ts +35 -0
  15. package/dist/components/Menu/Menu.js +44 -0
  16. package/dist/components/Menu/Menu.module.js +6 -0
  17. package/dist/components/Menu/Menu_module.css +29 -0
  18. package/dist/components/NavMenu/NavMenu.js +4 -2
  19. package/dist/components/NavMenu/NavMenu.module.js +0 -2
  20. package/dist/components/NavMenu/NavMenu_module.css +0 -15
  21. package/dist/components/Popover/Popover.d.ts +42 -0
  22. package/dist/components/Popover/Popover.js +61 -0
  23. package/dist/components/Popover/Popover.module.js +6 -0
  24. package/dist/components/Popover/Popover_module.css +13 -0
  25. package/dist/components/Spinner/Spinner.js +2 -1
  26. package/dist/components/Spinner/Spinner.module.js +1 -2
  27. package/dist/components/Spinner/Spinner_module.css +0 -12
  28. package/dist/components/StatusDot/StatusDot.js +6 -1
  29. package/dist/components/StatusDot/StatusDot_module.css +0 -12
  30. package/dist/components/ToastRegion/ToastRegion.d.ts +72 -0
  31. package/dist/components/ToastRegion/ToastRegion.js +85 -0
  32. package/dist/components/ToastRegion/ToastRegion.module.js +10 -0
  33. package/dist/components/ToastRegion/ToastRegion_module.css +104 -0
  34. package/dist/components/Tooltip/Tooltip.d.ts +33 -0
  35. package/dist/components/Tooltip/Tooltip.js +28 -0
  36. package/dist/components/Tooltip/TooltipProvider.d.ts +24 -0
  37. package/dist/components/Tooltip/TooltipProvider.js +11 -0
  38. package/dist/icons/CloseIcon.d.ts +10 -0
  39. package/dist/icons/CloseIcon.js +21 -0
  40. package/dist/index.d.ts +12 -0
  41. package/dist/index.js +6 -0
  42. package/dist/styles/a11y.module.js +5 -0
  43. package/dist/{components/LiveRegion/LiveRegion_module.css → styles/a11y_module.css} +1 -1
  44. package/dist/styles/popup.module.js +9 -0
  45. package/dist/styles/popup_module.css +103 -0
  46. package/package.json +2 -2
  47. package/dist/components/LiveRegion/LiveRegion.module.js +0 -5
@@ -1,5 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { CloseIcon } from "../../icons/CloseIcon.js";
2
3
  import { IconButton } from "../IconButton/IconButton.js";
4
+ import a11y_module from "../../styles/a11y.module.js";
3
5
  import Alert_module from "./Alert.module.js";
4
6
  const toneWords = {
5
7
  info: 'Information',
@@ -78,19 +80,6 @@ function ToneIcon({ tone }) {
78
80
  ]
79
81
  });
80
82
  }
81
- function DismissIcon() {
82
- return /*#__PURE__*/ jsxs("svg", {
83
- ...iconProps,
84
- children: [
85
- /*#__PURE__*/ jsx("path", {
86
- d: "m4.5 4.5 7 7"
87
- }),
88
- /*#__PURE__*/ jsx("path", {
89
- d: "m11.5 4.5-7 7"
90
- })
91
- ]
92
- });
93
- }
94
83
  function Alert({ tone = 'info', heading, headingLevel = 3, children, announce = false, onDismiss, dismissLabel = 'Dismiss' }) {
95
84
  const politeness = 'danger' === tone ? 'assertive' : 'polite';
96
85
  const liveProps = announce ? {
@@ -114,7 +103,7 @@ function Alert({ tone = 'info', heading, headingLevel = 3, children, announce =
114
103
  className: Alert_module.body,
115
104
  children: [
116
105
  /*#__PURE__*/ jsx("span", {
117
- className: Alert_module.toneWord,
106
+ className: a11y_module.visuallyHidden,
118
107
  children: toneWords[tone]
119
108
  }),
120
109
  void 0 !== heading ? /*#__PURE__*/ jsx(Heading, {
@@ -133,7 +122,7 @@ function Alert({ tone = 'info', heading, headingLevel = 3, children, announce =
133
122
  variant: "ghost",
134
123
  size: "sm",
135
124
  onClick: onDismiss,
136
- children: /*#__PURE__*/ jsx(DismissIcon, {})
125
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
137
126
  })
138
127
  }) : null
139
128
  ]
@@ -4,7 +4,6 @@ const Alert_module = {
4
4
  icon: "icon-GCaka",
5
5
  body: "body-ZvhIH",
6
6
  heading: "heading-kAg49",
7
- dismiss: "dismiss-KQOWr",
8
- toneWord: "toneWord-kfv8E"
7
+ dismiss: "dismiss-KQOWr"
9
8
  };
10
9
  export default Alert_module;
@@ -77,15 +77,3 @@
77
77
  align-self: flex-start;
78
78
  }
79
79
 
80
- .toneWord-kfv8E {
81
- clip-path: inset(50%);
82
- white-space: nowrap;
83
- border: 0;
84
- width: 1px;
85
- height: 1px;
86
- margin: -1px;
87
- padding: 0;
88
- position: absolute;
89
- overflow: hidden;
90
- }
91
-
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Avatar } from "@base-ui/react/avatar";
3
+ import a11y_module from "../../styles/a11y.module.js";
3
4
  import Avatar_module from "./Avatar.module.js";
4
5
  function leadingCharacters(word, count) {
5
6
  return Array.from(word).slice(0, count).join('');
@@ -32,7 +33,7 @@ function Avatar_Avatar({ name, src, size = 'md', shape = 'circle' }) {
32
33
  children: initialsFrom(name)
33
34
  }),
34
35
  /*#__PURE__*/ jsx("span", {
35
- className: Avatar_module.name,
36
+ className: a11y_module.visuallyHidden,
36
37
  children: name
37
38
  })
38
39
  ]
@@ -2,7 +2,6 @@ import "./Avatar_module.css";
2
2
  const Avatar_module = {
3
3
  root: "root-uFk_6",
4
4
  image: "image-i3BrF",
5
- fallback: "fallback-r0pag",
6
- name: "name-cQDpe"
5
+ fallback: "fallback-r0pag"
7
6
  };
8
7
  export default Avatar_module;
@@ -47,15 +47,3 @@
47
47
  display: inline-flex;
48
48
  }
49
49
 
50
- .name-cQDpe {
51
- clip-path: inset(50%);
52
- white-space: nowrap;
53
- border: 0;
54
- width: 1px;
55
- height: 1px;
56
- margin: -1px;
57
- padding: 0;
58
- position: absolute;
59
- overflow: hidden;
60
- }
61
-
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { createColumnHelper, createSortedRowModel, flexRender, rowSortingFeature, sortFn_alphanumeric, sortFn_datetime, sortFn_text, tableFeatures, useTable } from "@tanstack/react-table";
3
3
  import { useId, useState } from "react";
4
4
  import { minWidth, useMediaQuery } from "../../hooks/useMediaQuery.js";
5
+ import a11y_module from "../../styles/a11y.module.js";
5
6
  import DataTable_module from "./DataTable.module.js";
6
7
  const features = tableFeatures({
7
8
  rowSortingFeature: rowSortingFeature,
@@ -24,6 +25,10 @@ function DataTable({ caption, columns, data, getRowId, initialSort = [], stackBe
24
25
  const captionId = useId();
25
26
  const isWide = useMediaQuery(stackBelow ? minWidth(stackBelow) : '(min-width: 0px)');
26
27
  const stacked = Boolean(stackBelow) && !isWide;
28
+ const captionClassName = [
29
+ DataTable_module.caption,
30
+ hideCaption ? a11y_module.visuallyHidden : null
31
+ ].filter(Boolean).join(' ');
27
32
  const table = useTable({
28
33
  features: features,
29
34
  data,
@@ -46,12 +51,12 @@ function DataTable({ caption, columns, data, getRowId, initialSort = [], stackBe
46
51
  children: [
47
52
  /*#__PURE__*/ jsx("caption", {
48
53
  id: captionId,
49
- className: DataTable_module.caption,
54
+ className: captionClassName,
50
55
  "data-hidden": hideCaption ? '' : void 0,
51
56
  children: caption
52
57
  }),
53
58
  /*#__PURE__*/ jsx("thead", {
54
- className: DataTable_module.head,
59
+ className: stacked ? a11y_module.visuallyHidden : DataTable_module.head,
55
60
  children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ jsx("tr", {
56
61
  children: headerGroup.headers.map((header)=>{
57
62
  const sortDirection = header.column.getIsSorted();
@@ -27,15 +27,7 @@
27
27
  }
28
28
 
29
29
  .caption-glW7e[data-hidden] {
30
- clip-path: inset(50%);
31
- white-space: nowrap;
32
- border: 0;
33
- width: 1px;
34
- height: 1px;
35
- margin: -1px;
36
30
  padding: 0;
37
- position: absolute;
38
- overflow: hidden;
39
31
  }
40
32
 
41
33
  .head-KQpiR {
@@ -113,14 +105,6 @@
113
105
  padding-inline-end: var(--space-5);
114
106
  }
115
107
 
116
- .table-H20Eb[data-stacked] .head-KQpiR {
117
- clip-path: inset(50%);
118
- width: 1px;
119
- height: 1px;
120
- position: absolute;
121
- overflow: hidden;
122
- }
123
-
124
108
  .table-H20Eb[data-stacked] .row-oItIj {
125
109
  gap: var(--space-1);
126
110
  padding: var(--space-3) var(--space-5);
@@ -0,0 +1,44 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export type DialogVariant = 'center' | 'sheet';
3
+ /** The edge a sheet docks to: `bottom` is the phone pattern, `end` a full-height side panel. */
4
+ export type SheetSide = 'bottom' | 'end';
5
+ export interface DialogProps {
6
+ /**
7
+ * The control that opens the dialog. Optional: a dialog driven by application state passes
8
+ * `open` and `onOpenChange` instead and renders no trigger at all.
9
+ */
10
+ trigger?: ReactElement;
11
+ /** Names the popup: it is both the visible heading and the popup's `aria-labelledby` target. */
12
+ heading: string;
13
+ headingLevel?: 2 | 3 | 4;
14
+ /** Sits under the heading and becomes the popup's `aria-describedby` target. */
15
+ description?: ReactNode;
16
+ children?: ReactNode;
17
+ /**
18
+ * Pinned below the scrolling body; put the confirming action here. These controls are the
19
+ * caller's own — the header's close control always closes the dialog, and a footer control
20
+ * that needs to close it does so through `open`/`onOpenChange`.
21
+ */
22
+ footer?: ReactNode;
23
+ /** `center` floats in the middle of the viewport; `sheet` docks to an edge — see `side`. */
24
+ variant?: DialogVariant;
25
+ /**
26
+ * The edge a `sheet` docks to. `bottom` (the default) is the phone pattern; `end` is a
27
+ * full-height panel on the trailing edge, for an item editor or a filter drawer. Ignored when
28
+ * `variant` is `center`, and not rendered for it.
29
+ */
30
+ side?: SheetSide;
31
+ /** The accessible name of the close control in the header. */
32
+ closeLabel?: string;
33
+ /**
34
+ * Whether a press outside the popup closes it. Escape always does: Base UI has no prop for
35
+ * that, and vetoing it means cancelling the event inside `onOpenChange`, which this wrapper
36
+ * deliberately does not expose.
37
+ */
38
+ dismissOnOutsidePress?: boolean;
39
+ open?: boolean;
40
+ defaultOpen?: boolean;
41
+ /** Base UI calls this as `(open, eventDetails)`; the second argument is passed through. */
42
+ onOpenChange?: (open: boolean, eventDetails: unknown) => void;
43
+ }
44
+ export declare function Dialog({ trigger, heading, headingLevel, description, children, footer, variant, side, closeLabel, dismissOnOutsidePress, open, defaultOpen, onOpenChange, }: DialogProps): import("react").JSX.Element;
@@ -0,0 +1,82 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Dialog } from "@base-ui/react/dialog";
3
+ import { CloseIcon } from "../../icons/CloseIcon.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
+ import popup_module from "../../styles/popup.module.js";
6
+ import Dialog_module from "./Dialog.module.js";
7
+ const headingTags = {
8
+ 2: 'h2',
9
+ 3: 'h3',
10
+ 4: 'h4'
11
+ };
12
+ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, children, footer, variant = 'center', side = 'bottom', closeLabel = 'Close', dismissOnOutsidePress = true, open, defaultOpen, onOpenChange }) {
13
+ const sheetSide = 'sheet' === variant ? side : void 0;
14
+ const Heading = headingTags[headingLevel] ?? 'h2';
15
+ return /*#__PURE__*/ jsxs(Dialog.Root, {
16
+ open: open,
17
+ defaultOpen: defaultOpen,
18
+ onOpenChange: onOpenChange,
19
+ disablePointerDismissal: !dismissOnOutsidePress,
20
+ children: [
21
+ void 0 === trigger ? null : /*#__PURE__*/ jsx(Dialog.Trigger, {
22
+ render: trigger
23
+ }),
24
+ /*#__PURE__*/ jsxs(Dialog.Portal, {
25
+ children: [
26
+ /*#__PURE__*/ jsx(Dialog.Backdrop, {
27
+ className: [
28
+ popup_module.dialogLayer,
29
+ popup_module.scrim
30
+ ].join(' ')
31
+ }),
32
+ /*#__PURE__*/ jsx(Dialog.Viewport, {
33
+ className: [
34
+ popup_module.dialogLayer,
35
+ Dialog_module.viewport
36
+ ].join(' '),
37
+ "data-variant": variant,
38
+ "data-side": sheetSide,
39
+ children: /*#__PURE__*/ jsxs(Dialog.Popup, {
40
+ className: popup_module.surface,
41
+ "data-popup": 'sheet' === variant ? 'sheet' : 'dialog',
42
+ "data-side": sheetSide,
43
+ children: [
44
+ /*#__PURE__*/ jsxs("div", {
45
+ className: Dialog_module.header,
46
+ children: [
47
+ /*#__PURE__*/ jsx(Dialog.Title, {
48
+ className: Dialog_module.heading,
49
+ render: /*#__PURE__*/ jsx(Heading, {}),
50
+ children: heading
51
+ }),
52
+ /*#__PURE__*/ jsx(Dialog.Close, {
53
+ render: /*#__PURE__*/ jsx(IconButton, {
54
+ label: closeLabel,
55
+ variant: "ghost",
56
+ size: "sm",
57
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
58
+ })
59
+ })
60
+ ]
61
+ }),
62
+ void 0 === description ? null : /*#__PURE__*/ jsx(Dialog.Description, {
63
+ className: Dialog_module.description,
64
+ children: description
65
+ }),
66
+ void 0 === children ? null : /*#__PURE__*/ jsx("div", {
67
+ className: Dialog_module.body,
68
+ children: children
69
+ }),
70
+ void 0 === footer ? null : /*#__PURE__*/ jsx("div", {
71
+ className: Dialog_module.footer,
72
+ children: footer
73
+ })
74
+ ]
75
+ })
76
+ })
77
+ ]
78
+ })
79
+ ]
80
+ });
81
+ }
82
+ export { Dialog_Dialog as Dialog };
@@ -0,0 +1,10 @@
1
+ import "./Dialog_module.css";
2
+ const Dialog_module = {
3
+ viewport: "viewport-nOzLZ",
4
+ header: "header-KgP3n",
5
+ heading: "heading-EfBAx",
6
+ description: "description-ZV1a4",
7
+ body: "body-mavCB",
8
+ footer: "footer-CAuV7"
9
+ };
10
+ export default Dialog_module;
@@ -0,0 +1,51 @@
1
+ .viewport-nOzLZ {
2
+ padding: var(--space-4);
3
+ place-items: center;
4
+ display: grid;
5
+ position: fixed;
6
+ inset: 0;
7
+ }
8
+
9
+ .viewport-nOzLZ[data-variant="sheet"] {
10
+ place-items: end center;
11
+ padding: 0;
12
+ }
13
+
14
+ .viewport-nOzLZ[data-side="end"] {
15
+ place-items: center end;
16
+ }
17
+
18
+ .header-KgP3n {
19
+ align-items: flex-start;
20
+ gap: var(--space-3);
21
+ display: flex;
22
+ }
23
+
24
+ .heading-EfBAx {
25
+ min-width: 0;
26
+ color: var(--color-text);
27
+ font-size: var(--text-h3);
28
+ font-weight: 600;
29
+ line-height: var(--leading-snug);
30
+ flex: auto;
31
+ }
32
+
33
+ .description-ZV1a4 {
34
+ color: var(--color-text-muted);
35
+ font-size: var(--text-sm);
36
+ line-height: var(--leading-prose);
37
+ }
38
+
39
+ .body-mavCB {
40
+ overscroll-behavior: contain;
41
+ min-height: 0;
42
+ overflow-y: auto;
43
+ }
44
+
45
+ .footer-CAuV7 {
46
+ justify-content: flex-end;
47
+ gap: var(--space-2);
48
+ flex-wrap: wrap;
49
+ display: flex;
50
+ }
51
+
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import LiveRegion_module from "./LiveRegion.module.js";
2
+ import a11y_module from "../../styles/a11y.module.js";
3
3
  function LiveRegion({ message, politeness = 'polite' }) {
4
4
  const role = 'assertive' === politeness ? 'alert' : 'status';
5
5
  return /*#__PURE__*/ jsx("div", {
6
- className: LiveRegion_module.root,
6
+ className: a11y_module.visuallyHidden,
7
7
  role: role,
8
8
  "aria-live": politeness,
9
9
  "aria-atomic": "true",
@@ -0,0 +1,35 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { PopupAlign, PopupSide } from '../Popover/Popover.js';
3
+ export interface MenuItem {
4
+ /** Stable across renders; used as the React key. */
5
+ id: string;
6
+ /** The visible text, and what Base UI's typeahead matches against. */
7
+ label: string;
8
+ onSelect?: () => void;
9
+ disabled?: boolean;
10
+ /** Draws a hairline above this item, separating the group below from the one above. */
11
+ separatorBefore?: boolean;
12
+ }
13
+ export interface MenuProps {
14
+ /**
15
+ * The control that opens the menu, rendered as the trigger itself: it must be a single element
16
+ * that produces a native `<button>`, and the popup takes its accessible name from it.
17
+ */
18
+ trigger: ReactElement;
19
+ items: MenuItem[];
20
+ side?: PopupSide;
21
+ align?: PopupAlign;
22
+ /** Gap between the trigger and the popup, in pixels. */
23
+ sideOffset?: number;
24
+ /**
25
+ * Base UI defaults this to `true`, which locks page scroll and blocks pointer interaction
26
+ * outside. A menu hanging off a toolbar button is not that, and `NavMenu` already ships
27
+ * `modal={false}` for the same reason, so the default is inverted here.
28
+ */
29
+ modal?: boolean;
30
+ open?: boolean;
31
+ defaultOpen?: boolean;
32
+ /** Base UI calls this as `(open, eventDetails)`; the second argument is passed through. */
33
+ onOpenChange?: (open: boolean, eventDetails: unknown) => void;
34
+ }
35
+ export declare function Menu({ trigger, items, side, align, sideOffset, modal, open, defaultOpen, onOpenChange, }: MenuProps): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Menu } from "@base-ui/react/menu";
3
+ import { Fragment } from "react";
4
+ import popup_module from "../../styles/popup.module.js";
5
+ import Menu_module from "./Menu.module.js";
6
+ function Menu_Menu({ trigger, items, side = 'bottom', align = 'end', sideOffset = 8, modal = false, open, defaultOpen, onOpenChange }) {
7
+ return /*#__PURE__*/ jsxs(Menu.Root, {
8
+ open: open,
9
+ defaultOpen: defaultOpen,
10
+ onOpenChange: onOpenChange,
11
+ modal: modal,
12
+ children: [
13
+ /*#__PURE__*/ jsx(Menu.Trigger, {
14
+ render: trigger
15
+ }),
16
+ /*#__PURE__*/ jsx(Menu.Portal, {
17
+ children: /*#__PURE__*/ jsx(Menu.Positioner, {
18
+ className: popup_module.layer,
19
+ side: side,
20
+ align: align,
21
+ sideOffset: sideOffset,
22
+ children: /*#__PURE__*/ jsx(Menu.Popup, {
23
+ className: popup_module.surface,
24
+ "data-popup": "menu",
25
+ children: items.map((item)=>/*#__PURE__*/ jsxs(Fragment, {
26
+ children: [
27
+ true === item.separatorBefore ? /*#__PURE__*/ jsx(Menu.Separator, {
28
+ className: Menu_module.separator
29
+ }) : null,
30
+ /*#__PURE__*/ jsx(Menu.Item, {
31
+ className: Menu_module.item,
32
+ disabled: item.disabled,
33
+ onClick: item.onSelect,
34
+ children: item.label
35
+ })
36
+ ]
37
+ }, item.id))
38
+ })
39
+ })
40
+ })
41
+ ]
42
+ });
43
+ }
44
+ export { Menu_Menu as Menu };
@@ -0,0 +1,6 @@
1
+ import "./Menu_module.css";
2
+ const Menu_module = {
3
+ item: "item-toMw6",
4
+ separator: "separator-mmvmF"
5
+ };
6
+ export default Menu_module;
@@ -0,0 +1,29 @@
1
+ .item-toMw6 {
2
+ min-height: var(--size-touch);
3
+ padding-inline: var(--space-3);
4
+ border-radius: var(--radius-md);
5
+ color: var(--color-text);
6
+ font-size: var(--text-md);
7
+ cursor: pointer;
8
+ -webkit-user-select: none;
9
+ user-select: none;
10
+ align-items: center;
11
+ display: flex;
12
+ }
13
+
14
+ .item-toMw6[data-highlighted] {
15
+ background: var(--color-surface-2);
16
+ color: var(--color-text);
17
+ }
18
+
19
+ .item-toMw6[data-disabled] {
20
+ color: var(--color-text-subtle);
21
+ cursor: not-allowed;
22
+ }
23
+
24
+ .separator-mmvmF {
25
+ height: 1px;
26
+ margin-block: var(--space-1);
27
+ background: var(--color-border);
28
+ }
29
+
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Menu } from "@base-ui/react/menu";
3
3
  import { useState } from "react";
4
4
  import { minWidth, useMediaQuery } from "../../hooks/useMediaQuery.js";
5
+ import popup_module from "../../styles/popup.module.js";
5
6
  import NavMenu_module from "./NavMenu.module.js";
6
7
  function defaultRenderLink(item, { children, ...linkProps }) {
7
8
  return /*#__PURE__*/ jsx("a", {
@@ -66,12 +67,13 @@ function NavMenu({ items, currentPath, label = 'Primary', renderLink = defaultRe
66
67
  }),
67
68
  /*#__PURE__*/ jsx(Menu.Portal, {
68
69
  children: /*#__PURE__*/ jsx(Menu.Positioner, {
69
- className: NavMenu_module.positioner,
70
+ className: popup_module.layer,
70
71
  side: "bottom",
71
72
  align: "end",
72
73
  sideOffset: 8,
73
74
  children: /*#__PURE__*/ jsx(Menu.Popup, {
74
- className: NavMenu_module.popup,
75
+ className: popup_module.surface,
76
+ "data-popup": "menu",
75
77
  children: items.map((item)=>/*#__PURE__*/ jsx(Menu.Item, {
76
78
  className: NavMenu_module.item,
77
79
  render: renderLink(item, linkPropsFor(item, currentPath))
@@ -5,8 +5,6 @@ const NavMenu_module = {
5
5
  link: "link-R0jaI",
6
6
  trigger: "trigger-dj75u",
7
7
  triggerIcon: "triggerIcon-gSo04",
8
- positioner: "positioner-BPm1p",
9
- popup: "popup-hUQFV",
10
8
  item: "item-yXJoa"
11
9
  };
12
10
  export default NavMenu_module;
@@ -57,21 +57,6 @@
57
57
  height: 1.125rem;
58
58
  }
59
59
 
60
- .positioner-BPm1p {
61
- z-index: 50;
62
- }
63
-
64
- .popup-hUQFV {
65
- min-width: 12rem;
66
- padding: var(--space-2);
67
- border: 1px solid var(--color-border);
68
- border-radius: var(--radius-lg);
69
- background: var(--color-surface-raised);
70
- box-shadow: var(--elevation-2);
71
- flex-direction: column;
72
- display: flex;
73
- }
74
-
75
60
  .item-yXJoa {
76
61
  padding-inline: var(--space-3);
77
62
  border-radius: var(--radius-md);
@@ -0,0 +1,42 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export type PopupSide = 'top' | 'bottom' | 'left' | 'right';
3
+ export type PopupAlign = 'start' | 'center' | 'end';
4
+ export interface PopoverProps {
5
+ /**
6
+ * The control that opens the popover, rendered as the trigger itself: Base UI merges
7
+ * `aria-haspopup`, `aria-expanded` and `aria-controls` onto this element, so it must be a
8
+ * single element that produces a native `<button>` — `Button` and `IconButton` both do.
9
+ */
10
+ trigger: ReactElement;
11
+ /** Names the popup: it is both the visible heading and the popup's `aria-labelledby` target. */
12
+ heading: string;
13
+ headingLevel?: 2 | 3 | 4;
14
+ /** Sits under the heading and becomes the popup's `aria-describedby` target. */
15
+ description?: ReactNode;
16
+ children?: ReactNode;
17
+ side?: PopupSide;
18
+ align?: PopupAlign;
19
+ /** Gap between the anchor and the popup, in pixels. */
20
+ sideOffset?: number;
21
+ /**
22
+ * `true` locks page scroll, blocks pointer interaction outside, and paints the scrim.
23
+ * `'trap-focus'` traps focus and nothing else: page scroll keeps working and clicks outside
24
+ * still land, so it paints **no** scrim — a full-viewport wash that swallows every outside
25
+ * click is exactly what that mode exists not to do. `false`, the default, does none of it.
26
+ *
27
+ * Either truthy value renders the visually-hidden close control below, because Base UI only
28
+ * arms its focus trap when a `Popover.Close` is present inside the popup — `modal` on its own
29
+ * traps nothing, silently — and because a touch screen reader needs a way out of the popup.
30
+ */
31
+ modal?: boolean | 'trap-focus';
32
+ /** The accessible name of that close control. */
33
+ closeLabel?: string;
34
+ open?: boolean;
35
+ defaultOpen?: boolean;
36
+ /**
37
+ * Base UI calls this as `(open, eventDetails)`; a handler that takes only the first argument
38
+ * is what most callers want, and the second is passed through untouched for one that doesn't.
39
+ */
40
+ onOpenChange?: (open: boolean, eventDetails: unknown) => void;
41
+ }
42
+ export declare function Popover({ trigger, heading, headingLevel, description, children, side, align, sideOffset, modal, closeLabel, open, defaultOpen, onOpenChange, }: PopoverProps): import("react").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Popover } from "@base-ui/react/popover";
3
+ import a11y_module from "../../styles/a11y.module.js";
4
+ import popup_module from "../../styles/popup.module.js";
5
+ import Popover_module from "./Popover.module.js";
6
+ const headingTags = {
7
+ 2: 'h2',
8
+ 3: 'h3',
9
+ 4: 'h4'
10
+ };
11
+ function Popover_Popover({ trigger, heading, headingLevel = 3, description, children, side = 'bottom', align = 'center', sideOffset = 8, modal = false, closeLabel = 'Close', open, defaultOpen, onOpenChange }) {
12
+ const Heading = headingTags[headingLevel] ?? 'h3';
13
+ return /*#__PURE__*/ jsxs(Popover.Root, {
14
+ open: open,
15
+ defaultOpen: defaultOpen,
16
+ onOpenChange: onOpenChange,
17
+ modal: modal,
18
+ children: [
19
+ /*#__PURE__*/ jsx(Popover.Trigger, {
20
+ render: trigger
21
+ }),
22
+ /*#__PURE__*/ jsxs(Popover.Portal, {
23
+ children: [
24
+ true === modal ? /*#__PURE__*/ jsx(Popover.Backdrop, {
25
+ className: [
26
+ popup_module.layer,
27
+ popup_module.scrim
28
+ ].join(' ')
29
+ }) : null,
30
+ /*#__PURE__*/ jsx(Popover.Positioner, {
31
+ className: popup_module.layer,
32
+ side: side,
33
+ align: align,
34
+ sideOffset: sideOffset,
35
+ children: /*#__PURE__*/ jsxs(Popover.Popup, {
36
+ className: popup_module.surface,
37
+ "data-popup": "popover",
38
+ children: [
39
+ /*#__PURE__*/ jsx(Popover.Title, {
40
+ className: Popover_module.heading,
41
+ render: /*#__PURE__*/ jsx(Heading, {}),
42
+ children: heading
43
+ }),
44
+ void 0 === description ? null : /*#__PURE__*/ jsx(Popover.Description, {
45
+ className: Popover_module.description,
46
+ children: description
47
+ }),
48
+ children,
49
+ false === modal ? null : /*#__PURE__*/ jsx(Popover.Close, {
50
+ className: a11y_module.visuallyHidden,
51
+ children: closeLabel
52
+ })
53
+ ]
54
+ })
55
+ })
56
+ ]
57
+ })
58
+ ]
59
+ });
60
+ }
61
+ export { Popover_Popover as Popover };