oneslash-design-system 2.20.0 → 2.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 (167) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +34 -1
  3. package/dist/cases/about-page/profile.d.ts +1 -0
  4. package/dist/cases/about-page/profile.jsx +64 -0
  5. package/dist/cases/about-page.md +114 -0
  6. package/dist/cases/admin-inbox/list.d.ts +1 -0
  7. package/dist/cases/admin-inbox/list.jsx +104 -0
  8. package/dist/cases/admin-inbox/split.d.ts +1 -0
  9. package/dist/cases/admin-inbox/split.jsx +68 -0
  10. package/dist/cases/admin-inbox.md +254 -0
  11. package/dist/cases/api-keys.md +1 -1
  12. package/dist/cases/app-shell/top-tabs.jsx +10 -4
  13. package/dist/cases/app-shell.md +13 -5
  14. package/dist/cases/blog-index/cards.d.ts +1 -0
  15. package/dist/cases/blog-index/cards.jsx +45 -0
  16. package/dist/cases/blog-index/list.d.ts +1 -0
  17. package/dist/cases/blog-index/list.jsx +46 -0
  18. package/dist/cases/blog-index.md +160 -0
  19. package/dist/cases/changelog/by-month.d.ts +1 -0
  20. package/dist/cases/changelog/by-month.jsx +70 -0
  21. package/dist/cases/changelog/one-page.d.ts +1 -0
  22. package/dist/cases/changelog/one-page.jsx +70 -0
  23. package/dist/cases/changelog.md +200 -0
  24. package/dist/cases/code-sample/block.d.ts +1 -0
  25. package/dist/cases/code-sample/block.jsx +19 -0
  26. package/dist/cases/code-sample/command.d.ts +1 -0
  27. package/dist/cases/code-sample/command.jsx +17 -0
  28. package/dist/cases/code-sample.md +96 -0
  29. package/dist/cases/contact-page/form.d.ts +1 -0
  30. package/dist/cases/contact-page/form.jsx +83 -0
  31. package/dist/cases/contact-page/links.d.ts +1 -0
  32. package/dist/cases/contact-page/links.jsx +19 -0
  33. package/dist/cases/contact-page.md +142 -0
  34. package/dist/cases/docs-component-page/reference.d.ts +1 -0
  35. package/dist/cases/docs-component-page/reference.jsx +93 -0
  36. package/dist/cases/docs-component-page.md +144 -0
  37. package/dist/cases/faq/accordion.d.ts +1 -0
  38. package/dist/cases/faq/accordion.jsx +25 -0
  39. package/dist/cases/faq/open-list.d.ts +1 -0
  40. package/dist/cases/faq/open-list.jsx +27 -0
  41. package/dist/cases/faq.md +110 -0
  42. package/dist/cases/feature-grid/cards.d.ts +1 -0
  43. package/dist/cases/feature-grid/cards.jsx +33 -0
  44. package/dist/cases/feature-grid/rows.d.ts +1 -0
  45. package/dist/cases/feature-grid/rows.jsx +30 -0
  46. package/dist/cases/feature-grid.md +132 -0
  47. package/dist/cases/image-viewer/gallery.d.ts +1 -0
  48. package/dist/cases/image-viewer/gallery.jsx +32 -0
  49. package/dist/cases/image-viewer/single.d.ts +1 -0
  50. package/dist/cases/image-viewer/single.jsx +25 -0
  51. package/dist/cases/image-viewer.md +123 -0
  52. package/dist/cases/landing-hero/centered.d.ts +1 -0
  53. package/dist/cases/landing-hero/centered.jsx +22 -0
  54. package/dist/cases/landing-hero/split.d.ts +1 -0
  55. package/dist/cases/landing-hero/split.jsx +30 -0
  56. package/dist/cases/landing-hero.md +114 -0
  57. package/dist/cases/legal-page/sections.d.ts +1 -0
  58. package/dist/cases/legal-page/sections.jsx +61 -0
  59. package/dist/cases/legal-page.md +96 -0
  60. package/dist/cases/long-form-page/article.d.ts +1 -0
  61. package/dist/cases/long-form-page/article.jsx +58 -0
  62. package/dist/cases/long-form-page/with-contents.d.ts +1 -0
  63. package/dist/cases/long-form-page/with-contents.jsx +41 -0
  64. package/dist/cases/long-form-page.md +170 -0
  65. package/dist/cases/message-actions/hover-toolbar.jsx +11 -8
  66. package/dist/cases/message-actions/menu.jsx +10 -7
  67. package/dist/cases/message-actions.md +19 -13
  68. package/dist/cases/message-attachments/in-composer.jsx +2 -2
  69. package/dist/cases/message-attachments/in-message.jsx +16 -11
  70. package/dist/cases/message-attachments.md +29 -17
  71. package/dist/cases/one-main-action.md +33 -0
  72. package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
  73. package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
  74. package/dist/cases/overflow-menu.md +16 -10
  75. package/dist/cases/page-end/cta-band.d.ts +1 -0
  76. package/dist/cases/page-end/cta-band.jsx +24 -0
  77. package/dist/cases/page-end/next-link.d.ts +1 -0
  78. package/dist/cases/page-end/next-link.jsx +18 -0
  79. package/dist/cases/page-end.md +88 -0
  80. package/dist/cases/password-gate/inline.d.ts +1 -0
  81. package/dist/cases/password-gate/inline.jsx +94 -0
  82. package/dist/cases/password-gate/modal.d.ts +1 -0
  83. package/dist/cases/password-gate/modal.jsx +81 -0
  84. package/dist/cases/password-gate/page.d.ts +1 -0
  85. package/dist/cases/password-gate/page.jsx +82 -0
  86. package/dist/cases/password-gate.md +351 -0
  87. package/dist/cases/pricing-section/cards.d.ts +1 -0
  88. package/dist/cases/pricing-section/cards.jsx +41 -0
  89. package/dist/cases/pricing-section.md +87 -0
  90. package/dist/cases/product-cards/grid.d.ts +1 -0
  91. package/dist/cases/product-cards/grid.jsx +20 -0
  92. package/dist/cases/product-cards.md +71 -0
  93. package/dist/cases/reply-feedback/thumbs.jsx +11 -8
  94. package/dist/cases/reply-feedback/with-reason.jsx +11 -8
  95. package/dist/cases/reply-feedback.md +20 -14
  96. package/dist/cases/section-index/cards.d.ts +1 -0
  97. package/dist/cases/section-index/cards.jsx +25 -0
  98. package/dist/cases/section-index/list.d.ts +1 -0
  99. package/dist/cases/section-index/list.jsx +56 -0
  100. package/dist/cases/section-index.md +140 -0
  101. package/dist/cases/settings-page/top-tabs.jsx +9 -6
  102. package/dist/cases/settings-page.md +13 -7
  103. package/dist/cases/site-header.md +1 -1
  104. package/dist/cases/site-search/dialog.d.ts +1 -0
  105. package/dist/cases/site-search/dialog.jsx +131 -0
  106. package/dist/cases/site-search.md +176 -0
  107. package/dist/cases/tabbed-panels/tabs.d.ts +1 -0
  108. package/dist/cases/tabbed-panels/tabs.jsx +40 -0
  109. package/dist/cases/tabbed-panels.md +81 -0
  110. package/dist/cases.json +1177 -31
  111. package/dist/components/accordion.d.ts +31 -0
  112. package/dist/components/accordion.jsx +103 -0
  113. package/dist/components/button.d.ts +2 -0
  114. package/dist/components/button.jsx +2 -2
  115. package/dist/components/codeBlock.d.ts +26 -0
  116. package/dist/components/codeBlock.jsx +101 -0
  117. package/dist/components/lightbox.d.ts +34 -0
  118. package/dist/components/lightbox.jsx +206 -0
  119. package/dist/components/linkCard.d.ts +10 -1
  120. package/dist/components/linkCard.jsx +32 -6
  121. package/dist/components/menuItem.jsx +1 -1
  122. package/dist/components/modal.d.ts +10 -2
  123. package/dist/components/modal.jsx +17 -12
  124. package/dist/components/pageHeader.jsx +1 -1
  125. package/dist/components/searchDialog.d.ts +44 -0
  126. package/dist/components/searchDialog.jsx +152 -0
  127. package/dist/components/siteHeader.d.ts +13 -2
  128. package/dist/components/siteHeader.jsx +21 -12
  129. package/dist/components/tab.d.ts +5 -1
  130. package/dist/components/tab.jsx +2 -2
  131. package/dist/components/tabPanel.d.ts +16 -0
  132. package/dist/components/tabPanel.jsx +12 -0
  133. package/dist/components/tabsContainer.d.ts +5 -1
  134. package/dist/components/tabsContainer.jsx +2 -2
  135. package/dist/components/tag.d.ts +6 -1
  136. package/dist/components/tag.jsx +10 -5
  137. package/dist/index.d.ts +5 -0
  138. package/dist/index.js +5 -0
  139. package/dist/internal/accordion.d.ts +4 -0
  140. package/dist/internal/accordion.js +53 -0
  141. package/dist/internal/combobox.d.ts +20 -0
  142. package/dist/internal/combobox.js +28 -0
  143. package/dist/internal/highlight.d.ts +5 -0
  144. package/dist/internal/highlight.js +18 -0
  145. package/dist/native-mapping.json +31 -1
  146. package/dist/stories/Accordion.stories.d.ts +11 -0
  147. package/dist/stories/Accordion.stories.jsx +93 -0
  148. package/dist/stories/Button.stories.jsx +12 -8
  149. package/dist/stories/Cases.generated.stories.d.ts +34 -0
  150. package/dist/stories/Cases.generated.stories.jsx +68 -0
  151. package/dist/stories/CodeBlock.stories.d.ts +12 -0
  152. package/dist/stories/CodeBlock.stories.jsx +65 -0
  153. package/dist/stories/Lightbox.stories.d.ts +11 -0
  154. package/dist/stories/Lightbox.stories.jsx +83 -0
  155. package/dist/stories/LinkCard.stories.d.ts +6 -0
  156. package/dist/stories/LinkCard.stories.jsx +17 -0
  157. package/dist/stories/MenuItem.stories.d.ts +1 -0
  158. package/dist/stories/MenuItem.stories.jsx +8 -0
  159. package/dist/stories/PageHeader.stories.d.ts +2 -0
  160. package/dist/stories/PageHeader.stories.jsx +13 -0
  161. package/dist/stories/SearchDialog.stories.d.ts +17 -0
  162. package/dist/stories/SearchDialog.stories.jsx +111 -0
  163. package/dist/stories/SiteHeader.stories.d.ts +4 -0
  164. package/dist/stories/SiteHeader.stories.jsx +89 -0
  165. package/dist/stories/TabPanel.stories.d.ts +7 -0
  166. package/dist/stories/TabPanel.stories.jsx +31 -0
  167. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ export interface AccordionItem {
3
+ /** Names the item in `open` and in the address (`#<id>-<item.id>`) */
4
+ id: string;
5
+ /** The words on the heading's button */
6
+ title: string;
7
+ content: React.ReactNode;
8
+ }
9
+ interface AccordionProps {
10
+ items: AccordionItem[];
11
+ /** More than one item can be open. `false` keeps one open: opening an item closes the other. Default true. */
12
+ multiple?: boolean;
13
+ /** The item ids open at first, when `open` is not given */
14
+ defaultOpen?: string[];
15
+ /** The item ids open now. With it the accordion is controlled: say what changed in `onOpenChange`. */
16
+ open?: string[];
17
+ onOpenChange?: (open: string[]) => void;
18
+ /** The heading element of each item, 2 to 4. Pick the one that fits the page's outline. Default 3. */
19
+ headingLevel?: 2 | 3 | 4;
20
+ /** Opens the item named by the address `#<id>-<item.id>` on load and on change, and scrolls it under a `SiteHeader` */
21
+ linkable?: boolean;
22
+ /** Prefixes the ids of the items and their panels */
23
+ id: string;
24
+ }
25
+ /**
26
+ * Headings that each hold a full-width button opening a panel under it, with hairlines between and no box.
27
+ * Closed panels are in the server HTML, `hidden`. A panel is a `region` named by its heading when there are 6 items
28
+ * or fewer. Up, Down, Home and End move between the headings.
29
+ */
30
+ export default function Accordion({ items, multiple, defaultOpen, open, onOpenChange, headingLevel, linkable, id, }: AccordionProps): React.JSX.Element;
31
+ export { Accordion };
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { ChevronDown } from 'lucide-react';
4
+ import { focusRing } from './sharedStyles';
5
+ import { hashItem, nextHeading, normalizeOpen, toggleOpen } from '../internal/accordion';
6
+ // More than this many open-able regions are noise for a screen reader's landmark list
7
+ var MAX_REGIONS = 6;
8
+ /**
9
+ * Headings that each hold a full-width button opening a panel under it, with hairlines between and no box.
10
+ * Closed panels are in the server HTML, `hidden`. A panel is a `region` named by its heading when there are 6 items
11
+ * or fewer. Up, Down, Home and End move between the headings.
12
+ */
13
+ export default function Accordion(_a) {
14
+ var items = _a.items, _b = _a.multiple, multiple = _b === void 0 ? true : _b, _c = _a.defaultOpen, defaultOpen = _c === void 0 ? [] : _c, open = _a.open, onOpenChange = _a.onOpenChange, _d = _a.headingLevel, headingLevel = _d === void 0 ? 3 : _d, _e = _a.linkable, linkable = _e === void 0 ? false : _e, id = _a.id;
15
+ var ids = items.map(function (item) { return item.id; });
16
+ var _f = useState(function () { return normalizeOpen(defaultOpen, ids, multiple); }), inner = _f[0], setInner = _f[1];
17
+ var controlled = open !== undefined;
18
+ var current = normalizeOpen(controlled ? open : inner, ids, multiple);
19
+ var buttons = useRef([]);
20
+ // The effect below reads the latest values through here, so the hashchange listener is not re-bound on every render
21
+ var latest = useRef({ current: current, controlled: controlled, multiple: multiple, onOpenChange: onOpenChange });
22
+ latest.current = { current: current, controlled: controlled, multiple: multiple, onOpenChange: onOpenChange };
23
+ var change = function (next) {
24
+ var _a, _b;
25
+ if (!latest.current.controlled)
26
+ setInner(next);
27
+ (_b = (_a = latest.current).onOpenChange) === null || _b === void 0 ? void 0 : _b.call(_a, next);
28
+ };
29
+ var key = ids.join('\n');
30
+ useEffect(function () {
31
+ if (!linkable)
32
+ return;
33
+ var frame = 0;
34
+ // On mount the browser has already jumped to a server-rendered #hash, so scroll again only when the heading sits
35
+ // under the header (where that jump put it). A reload or back that restored a scroll position far from it stays.
36
+ var first = true;
37
+ var apply = function () {
38
+ var item = hashItem(window.location.hash, id, ids);
39
+ if (!item)
40
+ return;
41
+ var heading = document.getElementById("".concat(id, "-").concat(item));
42
+ var scroll = true;
43
+ if (first && heading) {
44
+ var offset = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--os-header-offset')) || 0;
45
+ var top_1 = heading.getBoundingClientRect().top;
46
+ // A client-rendered page has no jump to rely on: at the top of the page, a heading far below needs the scroll
47
+ scroll = (top_1 > -2 && top_1 <= offset + 2) || (window.scrollY === 0 && top_1 > offset + 2);
48
+ }
49
+ first = false;
50
+ var _a = latest.current, now = _a.current, many = _a.multiple;
51
+ if (!now.includes(item))
52
+ change(toggleOpen(now, item, many));
53
+ if (!scroll)
54
+ return;
55
+ // After the panels that close have left the layout, bring the heading just under the header (scroll-margin-top)
56
+ cancelAnimationFrame(frame);
57
+ frame = requestAnimationFrame(function () {
58
+ var _a;
59
+ (_a = document.getElementById("".concat(id, "-").concat(item))) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'start', behavior: 'instant' });
60
+ });
61
+ };
62
+ apply();
63
+ window.addEventListener('hashchange', apply);
64
+ return function () {
65
+ cancelAnimationFrame(frame);
66
+ window.removeEventListener('hashchange', apply);
67
+ };
68
+ }, [linkable, id, key]); // eslint-disable-line react-hooks/exhaustive-deps
69
+ var onKeyDown = function (e, index) {
70
+ var _a;
71
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)
72
+ return;
73
+ var to = nextHeading(e.key, index, items.length);
74
+ if (to < 0)
75
+ return;
76
+ e.preventDefault();
77
+ (_a = buttons.current[to]) === null || _a === void 0 ? void 0 : _a.focus();
78
+ };
79
+ var Heading = "h".concat(headingLevel);
80
+ var regions = items.length <= MAX_REGIONS;
81
+ return (<div className="w-full border-y border-misc-divider divide-y divide-misc-divider">
82
+ {items.map(function (item, index) {
83
+ var isOpen = current.includes(item.id);
84
+ var headingId = "".concat(id, "-").concat(item.id);
85
+ var buttonId = "".concat(headingId, "-button");
86
+ var panelId = "".concat(headingId, "-panel");
87
+ return (<div key={item.id}>
88
+ <Heading id={headingId} className="m-0 scroll-mt-[var(--os-header-offset,0px)]">
89
+ <button ref={function (el) {
90
+ buttons.current[index] = el;
91
+ }} id={buttonId} type="button" aria-expanded={isOpen} aria-controls={panelId} onClick={function () { return change(toggleOpen(current, item.id, multiple)); }} onKeyDown={function (e) { return onKeyDown(e, index); }} className={"flex w-full items-center justify-between gap-3 rounded-control py-3 text-left text-subtitle1 text-fg-primary ".concat(focusRing)}>
92
+ <span className="min-w-0 break-words">{item.title}</span>
93
+ <ChevronDown aria-hidden strokeWidth={2} className={"h-6 w-6 shrink-0 text-fg-secondary transition-transform duration-[var(--os-duration-fast)] ease-out motion-reduce:transition-none ".concat(isOpen ? 'rotate-180' : '')}/>
94
+ </button>
95
+ </Heading>
96
+ <div id={panelId} hidden={!isOpen} role={regions ? 'region' : undefined} aria-labelledby={regions ? buttonId : undefined} className="pb-4 text-body1 text-fg-secondary">
97
+ {item.content}
98
+ </div>
99
+ </div>);
100
+ })}
101
+ </div>);
102
+ }
103
+ export { Accordion };
@@ -18,6 +18,8 @@ interface ButtonProps extends React.AriaAttributes {
18
18
  onClickButton?: any;
19
19
  onClickActionIcon?: () => void;
20
20
  className?: string;
21
+ /** Fills the width of its container, as a `<button>` and as a link. Without it a link Button is as wide as its label. */
22
+ fullWidth?: boolean;
21
23
  /** Shows a spinner in the icon slot and keeps the label. The button stays focusable (`aria-disabled`) and ignores presses, so a form cannot submit twice. */
22
24
  loading?: boolean;
23
25
  /** Renders a link that looks like the button. A path goes through `next/link`; an `http(s)://` URL is a plain `<a>`. */
@@ -28,7 +28,7 @@ import { LoadingSmall } from './loadingScreen';
28
28
  import { focusRing, focusRingDanger, pressFeedback, pressFeedbackAny, stateTransition } from './sharedStyles';
29
29
  /** The ref reaches the `<button>`, or the `<a>` when `href` is set, so a page can move focus to it */
30
30
  var Button = forwardRef(function Button(_a, ref) {
31
- var size = _a.size, type = _a.type, _b = _a.color, color = _b === void 0 ? 'default' : _b, state = _a.state, label = _a.label, secondLabel = _a.secondLabel, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, onClickButton = _a.onClickButton, onClickActionIcon = _a.onClickActionIcon, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.loading, loading = _d === void 0 ? false : _d, href = _a.href, _e = _a.openInNewTab, openInNewTab = _e === void 0 ? false : _e, replace = _a.replace, _f = _a.htmlType, htmlType = _f === void 0 ? 'button' : _f, rest = __rest(_a, ["size", "type", "color", "state", "label", "secondLabel", "decoIcon", "actionIcon", "onClickButton", "onClickActionIcon", "className", "loading", "href", "openInNewTab", "replace", "htmlType"]);
31
+ var size = _a.size, type = _a.type, _b = _a.color, color = _b === void 0 ? 'default' : _b, state = _a.state, label = _a.label, secondLabel = _a.secondLabel, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, onClickButton = _a.onClickButton, onClickActionIcon = _a.onClickActionIcon, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.fullWidth, fullWidth = _d === void 0 ? false : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, href = _a.href, _f = _a.openInNewTab, openInNewTab = _f === void 0 ? false : _f, replace = _a.replace, _g = _a.htmlType, htmlType = _g === void 0 ? 'button' : _g, rest = __rest(_a, ["size", "type", "color", "state", "label", "secondLabel", "decoIcon", "actionIcon", "onClickButton", "onClickActionIcon", "className", "fullWidth", "loading", "href", "openInNewTab", "replace", "htmlType"]);
32
32
  var isLink = href !== undefined;
33
33
  // Horizontal padding sits on the button so an icon and the label are inset equally
34
34
  var sizeClasses = {
@@ -94,7 +94,7 @@ var Button = forwardRef(function Button(_a, ref) {
94
94
  // gets the press feedback for non-buttons and a zero-specificity fit width that `w-full` overrides.
95
95
  var linkClasses = state === 'disabled' || loading ? '[:where(&)]:w-fit' : "[:where(&)]:w-fit ".concat(pressFeedbackAny);
96
96
  // Hover is pure CSS; `state="hovered"` and `state="focused"` only exist to show those states in docs
97
- var buttonClasses = "\n flex flex-row items-center rounded-control ".concat(justify, " ").concat(stateTransition, " ").concat(isLink ? linkClasses : loading ? '' : pressFeedback, "\n ").concat(color === 'danger' ? focusRingDanger : focusRing, "\n ").concat(sizeClasses, "\n ").concat(state === 'selected' ? stateClasses.selected : '', "\n ").concat(state === 'enabled' || state === 'hovered' ? "".concat(baseTypeClasses, " ").concat(loading ? 'cursor-wait' : "".concat(stateClasses.enabled, " ").concat(hoverTypeClasses)) : '', "\n ").concat(state === 'focused' ? "".concat(baseTypeClasses, " ").concat(hoverTypeClasses, " ").concat(stateClasses.focused) : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled : '', "\n ").concat(className, "\n ");
97
+ var buttonClasses = "\n flex flex-row items-center rounded-control ".concat(justify, " ").concat(stateTransition, " ").concat(isLink ? linkClasses : loading ? '' : pressFeedback, "\n ").concat(color === 'danger' ? focusRingDanger : focusRing, "\n ").concat(sizeClasses, "\n ").concat(state === 'selected' ? stateClasses.selected : '', "\n ").concat(state === 'enabled' || state === 'hovered' ? "".concat(baseTypeClasses, " ").concat(loading ? 'cursor-wait' : "".concat(stateClasses.enabled, " ").concat(hoverTypeClasses)) : '', "\n ").concat(state === 'focused' ? "".concat(baseTypeClasses, " ").concat(hoverTypeClasses, " ").concat(stateClasses.focused) : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled : '', "\n ").concat(className).concat(fullWidth ? ' w-full' : '', "\n ");
98
98
  var content = (<>
99
99
  {/* Group IconLeft and label in a flex container for left alignment */}
100
100
  <div className={"flex items-center ".concat(size === 'tiny' ? 'gap-0.5' : 'gap-1')}>
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ interface CodeBlockProps {
3
+ /** The text, exactly as it is copied. Line breaks stay. */
4
+ code: string;
5
+ /** Visible above the code ('Install command', 'button.tsx'); it names the scroll region and the Copy button */
6
+ label: string;
7
+ /** Shown beside the label for the reader ('tsx', 'bash'). It does not color the code. */
8
+ language?: string;
9
+ /** Wrap long lines instead of scrolling them sideways. Default false. */
10
+ wrap?: boolean;
11
+ /** The button's words. Defaults to "Copy". */
12
+ copyLabel?: string;
13
+ /** The button's words for 2 seconds after the text is on the clipboard. Defaults to "Copied". */
14
+ copiedLabel?: string;
15
+ /** Prefixes the ids of the code and the line shown when copying is blocked */
16
+ id: string;
17
+ }
18
+ /**
19
+ * Code in a figure: a visible label, a Copy button at the end of the label row, and the code on the panel
20
+ * surface. A long line scrolls inside the code, a named region a keyboard can focus and scroll; the page never
21
+ * does. "Copied" shows only after the browser accepted the text; otherwise a line says to copy by hand.
22
+ * With `wrap` the block is still a Tab stop, so use `wrap` only for short blocks.
23
+ * No highlighting and no line numbers. One line to paste is a `CopyField`.
24
+ */
25
+ export default function CodeBlock({ code, label, language, wrap, copyLabel, copiedLabel, id, }: CodeBlockProps): React.JSX.Element;
26
+ export { CodeBlock };
@@ -0,0 +1,101 @@
1
+ 'use client';
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ import React, { useEffect, useRef, useState } from 'react';
39
+ import { copyText } from '../internal/copyField';
40
+ import Button from './button';
41
+ import { focusRing } from './sharedStyles';
42
+ /**
43
+ * Code in a figure: a visible label, a Copy button at the end of the label row, and the code on the panel
44
+ * surface. A long line scrolls inside the code, a named region a keyboard can focus and scroll; the page never
45
+ * does. "Copied" shows only after the browser accepted the text; otherwise a line says to copy by hand.
46
+ * With `wrap` the block is still a Tab stop, so use `wrap` only for short blocks.
47
+ * No highlighting and no line numbers. One line to paste is a `CopyField`.
48
+ */
49
+ export default function CodeBlock(_a) {
50
+ var _this = this;
51
+ var code = _a.code, label = _a.label, language = _a.language, _b = _a.wrap, wrap = _b === void 0 ? false : _b, _c = _a.copyLabel, copyLabel = _c === void 0 ? 'Copy' : _c, _d = _a.copiedLabel, copiedLabel = _d === void 0 ? 'Copied' : _d, id = _a.id;
52
+ var _e = useState(false), copied = _e[0], setCopied = _e[1];
53
+ var _f = useState(false), blocked = _f[0], setBlocked = _f[1];
54
+ var timer = useRef(undefined);
55
+ var mounted = useRef(false);
56
+ useEffect(function () {
57
+ mounted.current = true;
58
+ return function () {
59
+ mounted.current = false;
60
+ clearTimeout(timer.current);
61
+ };
62
+ }, []);
63
+ var handleCopy = function () { return __awaiter(_this, void 0, void 0, function () {
64
+ var ok;
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0: return [4 /*yield*/, copyText(typeof navigator === 'undefined' ? undefined : navigator.clipboard, code)];
68
+ case 1:
69
+ ok = _a.sent();
70
+ if (!mounted.current)
71
+ return [2 /*return*/];
72
+ clearTimeout(timer.current);
73
+ setBlocked(!ok);
74
+ setCopied(ok);
75
+ if (ok)
76
+ timer.current = setTimeout(function () { return setCopied(false); }, 2000);
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ }); };
81
+ var blockedId = "".concat(id, "-blocked");
82
+ return (<figure className="m-0 grid w-full min-w-0 max-w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-1">
83
+ <figcaption className="min-w-0 break-words text-caption text-fg-secondary">
84
+ {label}
85
+ {language && <span className="ml-2 text-caption text-fg-secondary">{language}</span>}
86
+ </figcaption>
87
+ <div className="flex-shrink-0">
88
+ <Button size="small" type="tertiary" state="enabled" label={copied ? copiedLabel : copyLabel} aria-label={"".concat(copied ? copiedLabel : copyLabel, " ").concat(label)} aria-describedby={blocked ? blockedId : undefined} onClickButton={handleCopy}/>
89
+ </div>
90
+ <pre id={"".concat(id, "-code")} tabIndex={0} role="region" aria-label={label} className={"col-span-2 m-0 max-w-full overflow-x-auto rounded-control bg-background-panel p-medium font-mono text-body2 text-fg-primary ".concat(wrap ? 'whitespace-pre-wrap break-words' : '', " ").concat(focusRing)}>
91
+ <code>{code}</code>
92
+ </pre>
93
+ {blocked && (<p id={blockedId} role="alert" className="col-span-2 text-error-text text-body2">
94
+ Copying is blocked here. Select the text and copy it.
95
+ </p>)}
96
+ <span role="status" className="sr-only col-span-2">
97
+ {copied ? copiedLabel : ''}
98
+ </span>
99
+ </figure>);
100
+ }
101
+ export { CodeBlock };
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ export interface LightboxImage {
3
+ src: string;
4
+ /** Required: it names the thumbnail, titles the viewer when there is no caption, and stands in for an image that fails. */
5
+ alt: string;
6
+ /** Shown under the image, and as the viewer's title. */
7
+ caption?: string;
8
+ }
9
+ interface LightboxProps {
10
+ images: LightboxImage[];
11
+ /** The image shown, counted from 0. */
12
+ index: number;
13
+ onIndexChange: (index: number) => void;
14
+ isOpen: boolean;
15
+ onClose: () => void;
16
+ /** Names the dialog. Defaults to 'Image viewer'. The visible title is the image's caption or alt text. */
17
+ 'aria-label'?: string;
18
+ }
19
+ /**
20
+ * Images in a full-size Modal: the image fits the viewport, its caption under it, and '2 of 5' after the title.
21
+ * 'Previous image' and 'Next image', ArrowLeft and ArrowRight, and a 40px swipe on touch step one image and stop at
22
+ * the ends; the Button at an end is disabled and focus moves to the other one, as Pagination does. Escape, the
23
+ * backdrop and Close close it, and the Modal gives focus back to what opened it. Images only: no video.
24
+ */
25
+ export default function Lightbox({ images, index, onIndexChange, isOpen, onClose, 'aria-label': ariaLabel, }: LightboxProps): React.JSX.Element | null;
26
+ /**
27
+ * A thumbnail that opens the Lightbox: a button named 'Open image: <alt>' around a cropped Figure. When its image
28
+ * fails, a tile with 'Image not loaded' takes its place in the same box, and it still opens the viewer.
29
+ */
30
+ export declare function LightboxThumbnail({ image, onOpen }: {
31
+ image: LightboxImage;
32
+ onOpen: () => void;
33
+ }): React.JSX.Element;
34
+ export { Lightbox };
@@ -0,0 +1,206 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
14
+ import { ChevronLeft, ChevronRight, ImageOff, X } from 'lucide-react';
15
+ import Modal from './modal';
16
+ import IconButton from './iconButton';
17
+ import Icon from './icon';
18
+ import Image from './image';
19
+ import Figure from './figure';
20
+ import { formatCount } from './formatNumber';
21
+ import { focusRing } from './sharedStyles';
22
+ // useLayoutEffect warns during server rendering on React 18
23
+ var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
24
+ // A horizontal move this long on touch steps to the next or previous image
25
+ var SWIPE_PX = 40;
26
+ // The image in its frame, or the words that stand in for it when it fails. Mounted per image (keyed by src), so its
27
+ // layout effect attaches the error listener before the browser can report a failure.
28
+ function Frame(_a) {
29
+ var image = _a.image, broken = _a.broken, onBroken = _a.onBroken, onSwipe = _a.onSwipe;
30
+ var ref = useRef(null);
31
+ var start = useRef(null);
32
+ var onBrokenRef = useRef(onBroken);
33
+ onBrokenRef.current = onBroken;
34
+ useIsomorphicLayoutEffect(function () {
35
+ var _a;
36
+ var img = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('img');
37
+ if (!img)
38
+ return;
39
+ var fail = function () { return onBrokenRef.current(); };
40
+ img.addEventListener('error', fail);
41
+ return function () { return img.removeEventListener('error', fail); };
42
+ }, []);
43
+ return (<div ref={ref} className="relative min-h-0 flex-1 touch-pan-y touch-pinch-zoom [&_img]:absolute [&_img]:inset-0 [&_img]:h-full [&_img]:w-full" onPointerDown={function (e) {
44
+ start.current = e.pointerType === 'touch' ? { x: e.clientX, y: e.clientY } : null;
45
+ }} onPointerUp={function (e) {
46
+ var s = start.current;
47
+ start.current = null;
48
+ if (!s)
49
+ return;
50
+ var dx = e.clientX - s.x;
51
+ if (Math.abs(dx) < SWIPE_PX || Math.abs(dx) <= Math.abs(e.clientY - s.y))
52
+ return;
53
+ onSwipe(dx < 0 ? 'next' : 'prev');
54
+ }} onPointerCancel={function () {
55
+ start.current = null;
56
+ }}>
57
+ {broken ? (<div className="absolute inset-0 flex flex-col items-center justify-center gap-small rounded-control bg-background-panel p-large text-center">
58
+ <Icon icon={ImageOff} size="medium" color="disabled"/>
59
+ <p className="text-body1 text-fg-primary">This image could not be loaded.</p>
60
+ <p className="text-body2 text-fg-secondary">{image.alt}</p>
61
+ </div>) : (<Image src={image.src} alt={image.alt} fit="contain"/>)}
62
+ </div>);
63
+ }
64
+ /**
65
+ * Images in a full-size Modal: the image fits the viewport, its caption under it, and '2 of 5' after the title.
66
+ * 'Previous image' and 'Next image', ArrowLeft and ArrowRight, and a 40px swipe on touch step one image and stop at
67
+ * the ends; the Button at an end is disabled and focus moves to the other one, as Pagination does. Escape, the
68
+ * backdrop and Close close it, and the Modal gives focus back to what opened it. Images only: no video.
69
+ */
70
+ export default function Lightbox(_a) {
71
+ var images = _a.images, index = _a.index, onIndexChange = _a.onIndexChange, isOpen = _a.isOpen, onClose = _a.onClose, _b = _a["aria-label"], ariaLabel = _b === void 0 ? 'Image viewer' : _b;
72
+ var count = images.length;
73
+ var at = Math.min(Math.max(index, 0), Math.max(count - 1, 0));
74
+ var image = images[at];
75
+ var many = count >= 2;
76
+ var atFirst = at <= 0;
77
+ var atLast = at >= count - 1;
78
+ var viewRef = useRef(null);
79
+ var prevRef = useRef(null);
80
+ var nextRef = useRef(null);
81
+ var pending = useRef(null);
82
+ var onChange = useRef(onIndexChange);
83
+ onChange.current = onIndexChange;
84
+ var _c = useState({}), broken = _c[0], setBroken = _c[1];
85
+ var go = function (to, from) {
86
+ if (to < 0 || to > count - 1 || to === at)
87
+ return;
88
+ if (to === 0 || to === count - 1)
89
+ pending.current = { to: to, focus: from === 'prev' ? 'next' : 'prev' };
90
+ onChange.current(to);
91
+ };
92
+ var goRef = useRef(go);
93
+ goRef.current = go;
94
+ // Focus must not drop to the page when the Button it was on turns disabled at an end
95
+ useEffect(function () {
96
+ var _a, _b;
97
+ var p = pending.current;
98
+ if (!p || p.to !== at)
99
+ return;
100
+ pending.current = null;
101
+ var dialog = (_a = viewRef.current) === null || _a === void 0 ? void 0 : _a.closest('[role="dialog"]');
102
+ var disabled = p.focus === 'prev' ? nextRef.current : prevRef.current;
103
+ var active = document.activeElement;
104
+ if (active && active !== document.body && active !== disabled && (dialog === null || dialog === void 0 ? void 0 : dialog.contains(active)))
105
+ return;
106
+ (_b = (p.focus === 'prev' ? prevRef : nextRef).current) === null || _b === void 0 ? void 0 : _b.focus();
107
+ }, [at]);
108
+ // ArrowLeft and ArrowRight step while focus is in this viewer, wherever it is in the dialog
109
+ useEffect(function () {
110
+ if (!isOpen || !many)
111
+ return;
112
+ var onKey = function (e) {
113
+ var _a;
114
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)
115
+ return;
116
+ if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')
117
+ return;
118
+ var dialog = (_a = viewRef.current) === null || _a === void 0 ? void 0 : _a.closest('[role="dialog"]');
119
+ if (!dialog || !(e.target instanceof Node) || !dialog.contains(e.target))
120
+ return;
121
+ e.preventDefault();
122
+ if (e.key === 'ArrowLeft')
123
+ goRef.current(at - 1, 'prev');
124
+ else
125
+ goRef.current(at + 1, 'next');
126
+ };
127
+ document.addEventListener('keydown', onKey);
128
+ return function () { return document.removeEventListener('keydown', onKey); };
129
+ }, [isOpen, many, at]);
130
+ if (!image)
131
+ return null;
132
+ var title = image.caption || image.alt;
133
+ var of = many ? "".concat(formatCount(at + 1), " of ").concat(formatCount(count)) : undefined;
134
+ return (<Modal isOpen={isOpen} onClose={onClose} size="fill" title={title} secondTitle={of} aria-label={ariaLabel} actions={<IconButton color="iconOnly" size="medium" state="enabled" icon={X} ariaLabel="Close" onClick={onClose}/>}>
135
+ <div ref={viewRef} className="flex h-full min-h-0 flex-col gap-medium">
136
+ <figure className="flex min-h-0 flex-1 flex-col gap-medium">
137
+ <Frame key={image.src} image={image} broken={!!broken[image.src]} onBroken={function () { return setBroken(function (b) {
138
+ var _a;
139
+ return (__assign(__assign({}, b), (_a = {}, _a[image.src] = true, _a)));
140
+ }); }} onSwipe={function (direction) { return (direction === 'next' ? go(at + 1, 'next') : go(at - 1, 'prev')); }}/>
141
+ {image.caption && <figcaption aria-hidden="true" className="text-body2 text-fg-secondary">{image.caption}</figcaption>}
142
+ </figure>
143
+ {many && (<div className="flex shrink-0 items-center justify-between gap-medium">
144
+ <IconButton ref={prevRef} color="tertiary" size="large" state={atFirst ? 'disabled' : 'enabled'} icon={ChevronLeft} ariaLabel="Previous image" onClick={function () { return go(at - 1, 'prev'); }}/>
145
+ {/* The count is in the title; say it when it changes, as the title is not read again */}
146
+ <span className="sr-only" aria-live="polite" aria-atomic="true">{image.caption ? "".concat(image.caption, ". ").concat(image.alt, ", ").concat(of) : "".concat(image.alt, ", ").concat(of)}</span>
147
+ <IconButton ref={nextRef} color="tertiary" size="large" state={atLast ? 'disabled' : 'enabled'} icon={ChevronRight} ariaLabel="Next image" onClick={function () { return go(at + 1, 'next'); }}/>
148
+ </div>)}
149
+ </div>
150
+ </Modal>);
151
+ }
152
+ /**
153
+ * A thumbnail that opens the Lightbox: a button named 'Open image: <alt>' around a cropped Figure. When its image
154
+ * fails, a tile with 'Image not loaded' takes its place in the same box, and it still opens the viewer.
155
+ */
156
+ export function LightboxThumbnail(_a) {
157
+ var image = _a.image, onOpen = _a.onOpen;
158
+ var ref = useRef(null);
159
+ // The src that failed, so a new src starts over and a late result for an old one changes nothing
160
+ var _b = useState(null), failedSrc = _b[0], setFailedSrc = _b[1];
161
+ var broken = failedSrc === image.src;
162
+ useIsomorphicLayoutEffect(function () {
163
+ var _a;
164
+ if (broken)
165
+ return;
166
+ var img = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('img');
167
+ if (!img)
168
+ return;
169
+ var src = image.src;
170
+ var live = true;
171
+ var fail = function () {
172
+ if (live)
173
+ setFailedSrc(src);
174
+ };
175
+ var probe = null;
176
+ img.addEventListener('error', fail);
177
+ // An image that failed before this listener existed (server-rendered HTML) is complete with no pixels. decode()
178
+ // rejects for it; a loaded image resolves, and one still loading is not complete and waits for the error event.
179
+ if (img.complete) {
180
+ img.decode().catch(function () {
181
+ if (!live || img.naturalWidth !== 0)
182
+ return;
183
+ // A good image with no natural size (an SVG with only a viewBox) loads again; a broken one fails again.
184
+ // The probe is never put in the page.
185
+ probe = document.createElement('img');
186
+ probe.onerror = fail;
187
+ probe.src = src;
188
+ });
189
+ }
190
+ return function () {
191
+ live = false;
192
+ img.removeEventListener('error', fail);
193
+ if (probe)
194
+ probe.onerror = null;
195
+ };
196
+ }, [image.src, broken]);
197
+ return (<button ref={ref} type="button" aria-label={"Open image: ".concat(image.alt)} onClick={onOpen} className={"block w-full cursor-zoom-in rounded-container transition-opacity hover:opacity-90 motion-reduce:transition-none ".concat(focusRing)}>
198
+ <Figure crop={4 / 3}>
199
+ {broken ? (<div className="absolute inset-0 flex flex-col items-center justify-center gap-small bg-background-panel p-small text-center">
200
+ <Icon icon={ImageOff} size="small" color="disabled"/>
201
+ <span className="text-caption text-fg-secondary">Image not loaded</span>
202
+ </div>) : (<Image src={image.src} alt=""/>)}
203
+ </Figure>
204
+ </button>);
205
+ }
206
+ export { Lightbox };
@@ -4,7 +4,16 @@ interface LinkCardProps {
4
4
  title: string;
5
5
  /** A small line under the title, in the mono face. */
6
6
  caption?: string;
7
+ /** A body2 line under the title that says what is there. */
8
+ description?: string;
9
+ /** An image on top of the card, cropped to 16:9. Its alt text joins the link's name: use "" when the title says it all. */
10
+ image?: {
11
+ src: string;
12
+ alt: string;
13
+ };
14
+ /** Opens the link in a new tab (`target="_blank"`, `rel="noopener noreferrer"`) and says so to a screen reader. */
15
+ external?: boolean;
7
16
  className?: string;
8
17
  }
9
- export default function LinkCard({ href, title, caption, className }: LinkCardProps): React.JSX.Element;
18
+ export default function LinkCard({ href, title, caption, description, image, external, className }: LinkCardProps): React.JSX.Element;
10
19
  export {};
@@ -2,15 +2,41 @@
2
2
  import React from 'react';
3
3
  import NextLink from 'next/link';
4
4
  import Icon from './icon';
5
+ import Figure from './figure';
6
+ import Image from './image';
5
7
  import { focusRing } from './sharedStyles';
6
8
  // A link set as a card: the title, a caption, and an arrow that moves off the corner.
7
9
  export default function LinkCard(_a) {
8
- var href = _a.href, title = _a.title, caption = _a.caption, _b = _a.className, className = _b === void 0 ? '' : _b;
9
- return (<NextLink href={href} className={"group flex items-center justify-between gap-xxlarge rounded-container bg-background-panel p-large transition-colors hover:bg-background-accent200 motion-reduce:transition-none ".concat(focusRing, " ").concat(className)}>
10
- <span className="flex flex-col gap-small">
11
- <span className="text-subtitle1 text-fg-primary">{title}</span>
12
- {caption && <span className="font-mono text-caption text-fg-secondary">{caption}</span>}
10
+ var href = _a.href, title = _a.title, caption = _a.caption, description = _a.description, image = _a.image, _b = _a.external, external = _b === void 0 ? false : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
11
+ var text = (<span className="flex flex-col gap-small">
12
+ <span className="text-subtitle1 text-fg-primary">
13
+ {title}
14
+ {external && <span className="sr-only">, opens in a new tab</span>}
13
15
  </span>
14
- <Icon name="ArrowUpRight" size="small" color="secondary" className="shrink-0 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5 motion-reduce:transition-none"/>
16
+ {description && <span className="text-body2 text-fg-secondary">{description}</span>}
17
+ {caption && <span className="font-mono text-caption text-fg-secondary">{caption}</span>}
18
+ </span>);
19
+ var arrow = (<Icon name="ArrowUpRight" size="small" color="secondary" className="shrink-0 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5 motion-reduce:transition-none"/>);
20
+ var look = "rounded-container bg-background-panel p-large transition-colors hover:bg-background-accent200 motion-reduce:transition-none ".concat(focusRing, " ").concat(className);
21
+ var content = image ? (<>
22
+ <Figure crop={16 / 9} radius="control">
23
+ <Image src={image.src} alt={image.alt}/>
24
+ </Figure>
25
+ <span className="flex items-center justify-between gap-xxlarge">
26
+ {text}
27
+ {arrow}
28
+ </span>
29
+ </>) : (<>
30
+ {text}
31
+ {arrow}
32
+ </>);
33
+ var classes = image ? "group flex flex-col gap-medium ".concat(look) : "group flex items-center justify-between gap-xxlarge ".concat(look);
34
+ if (external) {
35
+ return (<a href={href} target="_blank" rel="noopener noreferrer" className={classes}>
36
+ {content}
37
+ </a>);
38
+ }
39
+ return (<NextLink href={href} className={classes}>
40
+ {content}
15
41
  </NextLink>);
16
42
  }
@@ -43,7 +43,7 @@ export default function MenuItem(_a) {
43
43
  <div className="flex items-center gap-2 flex-shrink-0">
44
44
  {tag && (<Tag variant={tag.variant || 'contained'} size={tagSize} label={tag.label} iconName={tag.iconName}
45
45
  // 'default' has a fill that stays visible on the menu background
46
- color={(_b = tag.color) !== null && _b !== void 0 ? _b : 'default'}/>)}
46
+ color={(_b = tag.color) !== null && _b !== void 0 ? _b : 'default'} onSelectedRow={!!isSelected}/>)}
47
47
  <IconSlot icon={iconRight} className={"".concat(iconSize, " ").concat(isSelected ? 'text-primary-contrast' : 'text-fg-secondary', " flex-shrink-0")}/>
48
48
  {rightAction && (<div onClick={function (e) { return e.stopPropagation(); }}>
49
49
  {rightAction}
@@ -6,8 +6,16 @@ interface ModalProps {
6
6
  children: React.ReactNode;
7
7
  onClose: () => void;
8
8
  actions?: React.ReactNode;
9
- size?: 'small' | 'medium' | 'large';
9
+ /** `fill` is the viewport less 16px on a phone and 32px from md, for a Lightbox. */
10
+ size?: 'small' | 'medium' | 'large' | 'fill';
10
11
  initialFocus?: 'first' | 'body';
12
+ /**
13
+ * Names the dialog when it has no title (a search dialog), or in place of a title that changes as the
14
+ * dialog is used (a Lightbox, whose title is the image shown). Wins over the title for the name.
15
+ */
16
+ 'aria-label'?: string;
17
+ /** `top` sits the panel at the top below sm, so a phone keyboard does not cover a field in it. Centered from sm up. Default 'center'. */
18
+ placement?: 'center' | 'top';
11
19
  }
12
- export default function Modal({ isOpen, title, secondTitle, children, onClose, actions, size, initialFocus, }: ModalProps): React.JSX.Element | null;
20
+ export default function Modal({ isOpen, title, secondTitle, children, onClose, actions, size, initialFocus, 'aria-label': ariaLabel, placement, }: ModalProps): React.JSX.Element | null;
13
21
  export {};