oneslash-design-system 2.17.0 → 2.19.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 (282) hide show
  1. package/README.md +2 -2
  2. package/dist/DESIGN.md +55 -14
  3. package/dist/cases/accept-invite.md +1 -5
  4. package/dist/cases/account-menu/menu.d.ts +1 -0
  5. package/dist/cases/account-menu/menu.jsx +99 -0
  6. package/dist/cases/account-menu.md +164 -0
  7. package/dist/cases/agent-asks-before-risky-action.md +0 -4
  8. package/dist/cases/agent-cancels-when-unanswered.md +0 -4
  9. package/dist/cases/agent-options.md +0 -4
  10. package/dist/cases/agent-pending-reply.md +0 -4
  11. package/dist/cases/agent-plan-proposal.md +0 -4
  12. package/dist/cases/agent-question.md +0 -4
  13. package/dist/cases/agent-refuses-clearly.md +0 -4
  14. package/dist/cases/agent-says-what-it-is.md +0 -2
  15. package/dist/cases/agent-settings/form.d.ts +1 -0
  16. package/dist/cases/agent-settings/form.jsx +164 -0
  17. package/dist/cases/agent-settings.md +259 -0
  18. package/dist/cases/agent-shows-progress.md +0 -2
  19. package/dist/cases/agent-shows-sources.md +0 -2
  20. package/dist/cases/api-keys/list.d.ts +1 -0
  21. package/dist/cases/api-keys/list.jsx +162 -0
  22. package/dist/cases/api-keys.md +229 -0
  23. package/dist/cases/app-shell/sidebar.d.ts +1 -0
  24. package/dist/cases/app-shell/sidebar.jsx +124 -0
  25. package/dist/cases/app-shell/top-tabs.d.ts +1 -0
  26. package/dist/cases/app-shell/top-tabs.jsx +106 -0
  27. package/dist/cases/app-shell.md +364 -0
  28. package/dist/cases/artifact-card/card.jsx +32 -6
  29. package/dist/cases/artifact-card.md +55 -11
  30. package/dist/cases/auth-gate-loading.md +0 -4
  31. package/dist/cases/check-your-email.md +0 -4
  32. package/dist/cases/collapsible-search/popover.d.ts +1 -0
  33. package/dist/cases/collapsible-search/popover.jsx +74 -0
  34. package/dist/cases/collapsible-search.md +143 -0
  35. package/dist/cases/composer-limit.md +0 -4
  36. package/dist/cases/confirm-destructive-action.md +0 -4
  37. package/dist/cases/confirm-dialogs.md +0 -4
  38. package/dist/cases/conversation-starters.md +0 -4
  39. package/dist/cases/create-modal.md +0 -4
  40. package/dist/cases/danger-zone/collapsed.d.ts +1 -0
  41. package/dist/cases/danger-zone/collapsed.jsx +75 -0
  42. package/dist/cases/danger-zone/shown.d.ts +1 -0
  43. package/dist/cases/danger-zone/shown.jsx +95 -0
  44. package/dist/cases/danger-zone.md +263 -0
  45. package/dist/cases/device-login.md +0 -4
  46. package/dist/cases/email-confirmed.md +0 -4
  47. package/dist/cases/empty-list.md +0 -4
  48. package/dist/cases/empty-lists.md +0 -4
  49. package/dist/cases/empty-not-set-up.md +0 -4
  50. package/dist/cases/empty-search.md +0 -4
  51. package/dist/cases/error-page/in-shell.jsx +26 -17
  52. package/dist/cases/error-page.md +42 -25
  53. package/dist/cases/feedback-form.md +0 -4
  54. package/dist/cases/filter-menu/presets.d.ts +1 -0
  55. package/dist/cases/filter-menu/presets.jsx +53 -0
  56. package/dist/cases/filter-menu/with-clear.d.ts +1 -0
  57. package/dist/cases/filter-menu/with-clear.jsx +56 -0
  58. package/dist/cases/filter-menu.md +204 -0
  59. package/dist/cases/forgot-password.md +0 -4
  60. package/dist/cases/form-errors.md +0 -4
  61. package/dist/cases/import-checklist.md +0 -4
  62. package/dist/cases/inline-form-feedback.md +0 -4
  63. package/dist/cases/integrations-list/nested.d.ts +1 -0
  64. package/dist/cases/integrations-list/nested.jsx +164 -0
  65. package/dist/cases/integrations-list/rows.d.ts +1 -0
  66. package/dist/cases/integrations-list/rows.jsx +134 -0
  67. package/dist/cases/integrations-list.md +379 -0
  68. package/dist/cases/invite-member.md +0 -4
  69. package/dist/cases/load-failure.md +0 -4
  70. package/dist/cases/log-out-confirm.md +0 -4
  71. package/dist/cases/login-page.md +0 -4
  72. package/dist/cases/master-detail/list-then-page.d.ts +1 -0
  73. package/dist/cases/master-detail/list-then-page.jsx +65 -0
  74. package/dist/cases/master-detail/split.d.ts +1 -0
  75. package/dist/cases/master-detail/split.jsx +49 -0
  76. package/dist/cases/master-detail.md +213 -0
  77. package/dist/cases/members-list/rows.d.ts +1 -0
  78. package/dist/cases/members-list/rows.jsx +318 -0
  79. package/dist/cases/members-list/table.d.ts +1 -0
  80. package/dist/cases/members-list/table.jsx +351 -0
  81. package/dist/cases/members-list.md +799 -0
  82. package/dist/cases/mention-list.md +0 -4
  83. package/dist/cases/message-actions.md +0 -4
  84. package/dist/cases/message-attachments.md +0 -4
  85. package/dist/cases/message-composer.md +0 -4
  86. package/dist/cases/message-edit.md +0 -4
  87. package/dist/cases/message-reactions.md +0 -4
  88. package/dist/cases/message-row.md +0 -4
  89. package/dist/cases/mobile-menu/links.d.ts +1 -0
  90. package/dist/cases/mobile-menu/links.jsx +24 -0
  91. package/dist/cases/mobile-menu/sections.d.ts +1 -0
  92. package/dist/cases/mobile-menu/sections.jsx +61 -0
  93. package/dist/cases/mobile-menu.md +170 -0
  94. package/dist/cases/not-found-page/in-shell.jsx +26 -17
  95. package/dist/cases/not-found-page.md +41 -24
  96. package/dist/cases/notification-menu/menu.d.ts +1 -0
  97. package/dist/cases/notification-menu/menu.jsx +74 -0
  98. package/dist/cases/notification-menu.md +135 -0
  99. package/dist/cases/oauth-consent.md +0 -4
  100. package/dist/cases/on-off-settings/list.d.ts +1 -0
  101. package/dist/cases/on-off-settings/list.jsx +97 -0
  102. package/dist/cases/on-off-settings.md +116 -0
  103. package/dist/cases/on-this-page/aside.d.ts +1 -0
  104. package/dist/cases/on-this-page/aside.jsx +39 -0
  105. package/dist/cases/on-this-page.md +80 -0
  106. package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
  107. package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
  108. package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
  109. package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
  110. package/dist/cases/overflow-menu.md +410 -0
  111. package/dist/cases/page-header/actions.d.ts +1 -0
  112. package/dist/cases/page-header/actions.jsx +65 -0
  113. package/dist/cases/page-header/sub-page.d.ts +1 -0
  114. package/dist/cases/page-header/sub-page.jsx +37 -0
  115. package/dist/cases/page-header.md +195 -0
  116. package/dist/cases/phone-navigation.md +32 -0
  117. package/dist/cases/profile-form/form.d.ts +1 -0
  118. package/dist/cases/profile-form/form.jsx +153 -0
  119. package/dist/cases/profile-form.md +236 -0
  120. package/dist/cases/quick-switcher/modal.d.ts +1 -0
  121. package/dist/cases/quick-switcher/modal.jsx +114 -0
  122. package/dist/cases/quick-switcher.md +205 -0
  123. package/dist/cases/range-switch/segmented.d.ts +1 -0
  124. package/dist/cases/range-switch/segmented.jsx +30 -0
  125. package/dist/cases/range-switch.md +67 -0
  126. package/dist/cases/rename.md +0 -4
  127. package/dist/cases/reply-feedback.md +0 -4
  128. package/dist/cases/reply-sources.md +0 -4
  129. package/dist/cases/route-loading/region.jsx +27 -18
  130. package/dist/cases/route-loading.md +42 -23
  131. package/dist/cases/scope-picker/menu.d.ts +1 -0
  132. package/dist/cases/scope-picker/menu.jsx +47 -0
  133. package/dist/cases/scope-picker.md +97 -0
  134. package/dist/cases/set-new-password.md +0 -4
  135. package/dist/cases/settings-page/side-nav.d.ts +1 -0
  136. package/dist/cases/settings-page/side-nav.jsx +171 -0
  137. package/dist/cases/settings-page/top-tabs.d.ts +1 -0
  138. package/dist/cases/settings-page/top-tabs.jsx +129 -0
  139. package/dist/cases/settings-page.md +378 -0
  140. package/dist/cases/settings-save.md +35 -0
  141. package/dist/cases/side-pane/beside.d.ts +1 -0
  142. package/dist/cases/side-pane/beside.jsx +79 -0
  143. package/dist/cases/side-pane/over.d.ts +1 -0
  144. package/dist/cases/side-pane/over.jsx +58 -0
  145. package/dist/cases/side-pane.md +238 -0
  146. package/dist/cases/sidebar-nav/flat.d.ts +1 -0
  147. package/dist/cases/sidebar-nav/flat.jsx +81 -0
  148. package/dist/cases/sidebar-nav/nested.d.ts +1 -0
  149. package/dist/cases/sidebar-nav/nested.jsx +122 -0
  150. package/dist/cases/sidebar-nav.md +261 -0
  151. package/dist/cases/sign-up-page.md +1 -5
  152. package/dist/cases/site-footer/columns.d.ts +1 -0
  153. package/dist/cases/site-footer/columns.jsx +51 -0
  154. package/dist/cases/site-footer/simple.d.ts +1 -0
  155. package/dist/cases/site-footer/simple.jsx +24 -0
  156. package/dist/cases/site-footer.md +133 -0
  157. package/dist/cases/site-header/links.d.ts +1 -0
  158. package/dist/cases/site-header/links.jsx +26 -0
  159. package/dist/cases/site-header/sections.d.ts +1 -0
  160. package/dist/cases/site-header/sections.jsx +64 -0
  161. package/dist/cases/site-header.md +183 -0
  162. package/dist/cases/slash-command-list.md +0 -4
  163. package/dist/cases/success-feedback.md +0 -4
  164. package/dist/cases/tag-filter/tags.d.ts +1 -0
  165. package/dist/cases/tag-filter/tags.jsx +226 -0
  166. package/dist/cases/tag-filter.md +298 -0
  167. package/dist/cases/theme-switcher/menu.d.ts +1 -0
  168. package/dist/cases/theme-switcher/menu.jsx +47 -0
  169. package/dist/cases/theme-switcher/segmented.d.ts +1 -0
  170. package/dist/cases/theme-switcher/segmented.jsx +26 -0
  171. package/dist/cases/theme-switcher.md +149 -0
  172. package/dist/cases/type-to-confirm.md +0 -4
  173. package/dist/cases/typing-and-status.md +0 -4
  174. package/dist/cases/unsaved-changes-guard.md +0 -4
  175. package/dist/cases/upgrade-prompt.md +0 -4
  176. package/dist/cases.json +1737 -315
  177. package/dist/components/alert.d.ts +3 -1
  178. package/dist/components/alert.jsx +2 -2
  179. package/dist/components/appShell.d.ts +44 -0
  180. package/dist/components/appShell.jsx +121 -0
  181. package/dist/components/button.jsx +5 -2
  182. package/dist/components/checkBox.d.ts +5 -1
  183. package/dist/components/checkBox.jsx +2 -2
  184. package/dist/components/copyField.d.ts +20 -0
  185. package/dist/components/copyField.jsx +99 -0
  186. package/dist/components/drawer.d.ts +31 -0
  187. package/dist/components/drawer.jsx +121 -0
  188. package/dist/components/formField.d.ts +34 -0
  189. package/dist/components/formField.jsx +28 -0
  190. package/dist/components/heading.d.ts +5 -1
  191. package/dist/components/heading.jsx +2 -2
  192. package/dist/components/link.d.ts +6 -1
  193. package/dist/components/link.jsx +11 -3
  194. package/dist/components/menu.jsx +2 -2
  195. package/dist/components/menuItem.d.ts +10 -2
  196. package/dist/components/menuItem.jsx +4 -3
  197. package/dist/components/modal.jsx +12 -23
  198. package/dist/components/navigation.d.ts +9 -1
  199. package/dist/components/navigation.jsx +15 -3
  200. package/dist/components/onThisPage.d.ts +29 -0
  201. package/dist/components/onThisPage.jsx +151 -0
  202. package/dist/components/pageShell.d.ts +7 -1
  203. package/dist/components/pageShell.jsx +14 -1
  204. package/dist/components/popover.jsx +4 -0
  205. package/dist/components/radioGroup.d.ts +5 -1
  206. package/dist/components/radioGroup.jsx +2 -2
  207. package/dist/components/segmentedControl.d.ts +22 -0
  208. package/dist/components/segmentedControl.jsx +54 -0
  209. package/dist/components/select.d.ts +5 -1
  210. package/dist/components/select.jsx +2 -2
  211. package/dist/components/settingsSection.d.ts +36 -0
  212. package/dist/components/settingsSection.jsx +65 -0
  213. package/dist/components/sidePane.d.ts +32 -0
  214. package/dist/components/sidePane.jsx +128 -0
  215. package/dist/components/siteFooter.d.ts +24 -0
  216. package/dist/components/siteFooter.jsx +48 -0
  217. package/dist/components/siteHeader.d.ts +55 -0
  218. package/dist/components/siteHeader.jsx +125 -0
  219. package/dist/components/slidingIndicator.d.ts +50 -0
  220. package/dist/components/slidingIndicator.jsx +102 -0
  221. package/dist/components/switch.d.ts +25 -0
  222. package/dist/components/switch.jsx +55 -0
  223. package/dist/components/tab.jsx +5 -11
  224. package/dist/components/tabsContainer.jsx +5 -67
  225. package/dist/components/textField.d.ts +12 -2
  226. package/dist/components/textField.jsx +11 -4
  227. package/dist/components/textarea.d.ts +5 -1
  228. package/dist/components/textarea.jsx +3 -3
  229. package/dist/components/titleBar.d.ts +17 -0
  230. package/dist/components/titleBar.jsx +17 -0
  231. package/dist/components/useHotkey.d.ts +7 -0
  232. package/dist/components/useHotkey.js +24 -0
  233. package/dist/index.d.ts +13 -0
  234. package/dist/index.js +13 -0
  235. package/dist/internal/copyField.d.ts +5 -0
  236. package/dist/internal/copyField.js +61 -0
  237. package/dist/internal/hotkey.d.ts +16 -0
  238. package/dist/internal/hotkey.js +20 -0
  239. package/dist/internal/overlayStack.d.ts +24 -0
  240. package/dist/internal/overlayStack.js +71 -0
  241. package/dist/internal/resize.d.ts +9 -0
  242. package/dist/internal/resize.js +31 -0
  243. package/dist/internal/scrollSpy.d.ts +24 -0
  244. package/dist/internal/scrollSpy.js +53 -0
  245. package/dist/internal/siteBrand.d.ts +6 -0
  246. package/dist/internal/siteBrand.jsx +11 -0
  247. package/dist/internal/switch.d.ts +5 -0
  248. package/dist/internal/switch.js +9 -0
  249. package/dist/native-mapping.json +72 -0
  250. package/dist/stories/AppShell.stories.d.ts +15 -0
  251. package/dist/stories/AppShell.stories.jsx +137 -0
  252. package/dist/stories/Cases.generated.stories.d.ts +42 -0
  253. package/dist/stories/Cases.generated.stories.jsx +84 -0
  254. package/dist/stories/CopyField.stories.d.ts +11 -0
  255. package/dist/stories/CopyField.stories.jsx +65 -0
  256. package/dist/stories/Drawer.stories.d.ts +10 -0
  257. package/dist/stories/Drawer.stories.jsx +123 -0
  258. package/dist/stories/FormField.stories.d.ts +6 -0
  259. package/dist/stories/FormField.stories.jsx +44 -0
  260. package/dist/stories/Link.stories.d.ts +1 -0
  261. package/dist/stories/Link.stories.jsx +8 -0
  262. package/dist/stories/Navigation.stories.d.ts +1 -0
  263. package/dist/stories/Navigation.stories.jsx +17 -1
  264. package/dist/stories/OnThisPage.stories.d.ts +10 -0
  265. package/dist/stories/OnThisPage.stories.jsx +105 -0
  266. package/dist/stories/SegmentedControl.stories.d.ts +8 -0
  267. package/dist/stories/SegmentedControl.stories.jsx +33 -0
  268. package/dist/stories/SettingsSection.stories.d.ts +12 -0
  269. package/dist/stories/SettingsSection.stories.jsx +91 -0
  270. package/dist/stories/SidePane.stories.d.ts +6 -0
  271. package/dist/stories/SidePane.stories.jsx +37 -0
  272. package/dist/stories/SiteFooter.stories.d.ts +7 -0
  273. package/dist/stories/SiteFooter.stories.jsx +63 -0
  274. package/dist/stories/SiteHeader.stories.d.ts +10 -0
  275. package/dist/stories/SiteHeader.stories.jsx +94 -0
  276. package/dist/stories/Switch.stories.d.ts +14 -0
  277. package/dist/stories/Switch.stories.jsx +87 -0
  278. package/dist/stories/TextField.stories.d.ts +1 -0
  279. package/dist/stories/TextField.stories.jsx +13 -0
  280. package/dist/stories/TitleBar.stories.d.ts +6 -0
  281. package/dist/stories/TitleBar.stories.jsx +34 -0
  282. package/package.json +5 -1
@@ -0,0 +1,61 @@
1
+ // CopyField's clipboard write, kept out of the public API.
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
+ // True only after the clipboard accepted the text. A missing clipboard, a refusal and a throw all give false.
39
+ export function copyText(clipboard, text) {
40
+ return __awaiter(this, void 0, void 0, function () {
41
+ var _a;
42
+ return __generator(this, function (_b) {
43
+ switch (_b.label) {
44
+ case 0:
45
+ if (!clipboard || typeof clipboard.writeText !== 'function')
46
+ return [2 /*return*/, false];
47
+ _b.label = 1;
48
+ case 1:
49
+ _b.trys.push([1, 3, , 4]);
50
+ return [4 /*yield*/, clipboard.writeText(text)];
51
+ case 2:
52
+ _b.sent();
53
+ return [2 /*return*/, true];
54
+ case 3:
55
+ _a = _b.sent();
56
+ return [2 /*return*/, false];
57
+ case 4: return [2 /*return*/];
58
+ }
59
+ });
60
+ });
61
+ }
@@ -0,0 +1,16 @@
1
+ interface HotkeyEvent {
2
+ key: string;
3
+ code?: string;
4
+ metaKey: boolean;
5
+ ctrlKey: boolean;
6
+ altKey: boolean;
7
+ shiftKey: boolean;
8
+ isComposing: boolean;
9
+ repeat: boolean;
10
+ }
11
+ export declare function isHotkey(e: HotkeyEvent, key: string): boolean;
12
+ export declare function isTypingTarget(target: {
13
+ tagName: string;
14
+ isContentEditable: boolean;
15
+ } | null): boolean;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ // useHotkey's pure helpers, kept out of the public API (index.ts and the package exports do not reach internal/)
2
+ // True for Cmd+key or Ctrl+key and nothing more: not with Shift or Alt, not while an input method
3
+ // composes, and not for a key held down. When e.key is not a Latin letter (a non-Latin layout, where it is
4
+ // 'л' or 'ㅏ'), a single letter also matches its physical key (e.code 'KeyK'). A Latin e.key always wins, so
5
+ // Dvorak's Cmd+T (physical KeyK) and AZERTY's Cmd+A (physical KeyQ) do not fire the K or Q shortcut.
6
+ export function isHotkey(e, key) {
7
+ if (e.altKey || e.shiftKey || e.isComposing || e.repeat)
8
+ return false;
9
+ if (!(e.metaKey || e.ctrlKey))
10
+ return false;
11
+ if (e.key.toLowerCase() === key.toLowerCase())
12
+ return true;
13
+ return !/^[a-z]$/i.test(e.key) && /^[a-z]$/i.test(key) && e.code === "Key".concat(key.toUpperCase());
14
+ }
15
+ // True when the target takes typed text, where a shortcut could be meant as text editing.
16
+ export function isTypingTarget(target) {
17
+ if (!target)
18
+ return false;
19
+ return target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName);
20
+ }
@@ -0,0 +1,24 @@
1
+ type Overlay = {
2
+ id: string;
3
+ panel?: {
4
+ contains(node: unknown): boolean;
5
+ } | null;
6
+ };
7
+ export declare function pushOverlay(id: string, panel?: Overlay['panel']): void;
8
+ export declare function popOverlay(id: string): void;
9
+ export declare function isTopOverlay(id: string): boolean;
10
+ export declare function isInTopOverlay(node: unknown): boolean;
11
+ export declare function claimEvent(event: object): boolean;
12
+ export declare function lockScroll(): void;
13
+ export declare function unlockScroll(): void;
14
+ export declare const PICKABLE: string;
15
+ type Focusable = {
16
+ focus(): void;
17
+ };
18
+ export declare function trapTab(panel: {
19
+ querySelectorAll(selector: string): ArrayLike<Focusable> | Iterable<Focusable>;
20
+ }, event: {
21
+ shiftKey: boolean;
22
+ preventDefault(): void;
23
+ }): void;
24
+ export {};
@@ -0,0 +1,71 @@
1
+ // One stack for the overlays that cover the page (Modal, Drawer), kept out of the public API.
2
+ // The newest open overlay is on top: only it acts on Escape, Tab and a scrim click, so a Modal
3
+ // opened from a Drawer closes alone. Nothing here touches the document until an effect calls it.
4
+ var stack = [];
5
+ // Puts an overlay on top. Pass its panel so a Popover can tell whether it sits in the top overlay.
6
+ export function pushOverlay(id, panel) {
7
+ popOverlay(id);
8
+ stack.push({ id: id, panel: panel });
9
+ }
10
+ // Takes an overlay off the stack wherever it is, so one below can close first
11
+ export function popOverlay(id) {
12
+ var index = stack.findIndex(function (o) { return o.id === id; });
13
+ if (index >= 0)
14
+ stack.splice(index, 1);
15
+ }
16
+ export function isTopOverlay(id) {
17
+ return stack.length > 0 && stack[stack.length - 1].id === id;
18
+ }
19
+ // True when no overlay is open or the top one holds `node`; false when a newer overlay covers it
20
+ export function isInTopOverlay(node) {
21
+ var top = stack[stack.length - 1];
22
+ return !(top === null || top === void 0 ? void 0 : top.panel) || top.panel.contains(node);
23
+ }
24
+ // Every overlay hears the same keydown on window. A browser runs React's update between two
25
+ // listeners, so the top overlay may already be gone when the next one asks: the first to claim
26
+ // an event acts on it, and the others leave it.
27
+ var claimed = new WeakSet();
28
+ export function claimEvent(event) {
29
+ if (claimed.has(event))
30
+ return false;
31
+ claimed.add(event);
32
+ return true;
33
+ }
34
+ // Counted, so stacked overlays lock the page once and give the page its own overflow back once
35
+ var locks = 0;
36
+ var savedOverflow = '';
37
+ export function lockScroll() {
38
+ if (locks++ === 0) {
39
+ savedOverflow = document.body.style.overflow;
40
+ document.body.style.overflow = 'hidden';
41
+ }
42
+ }
43
+ export function unlockScroll() {
44
+ if (locks === 0)
45
+ return;
46
+ if (--locks === 0)
47
+ document.body.style.overflow = savedOverflow;
48
+ }
49
+ var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
50
+ // For the first focus and the Tab trap: the same, minus a hidden input, which matches but cannot take focus
51
+ export var PICKABLE = FOCUSABLE.replace('input:not([disabled])', 'input:not([disabled]):not([type="hidden"])');
52
+ // Keeps Tab and Shift+Tab inside the panel: from the last element to the first and back.
53
+ // With nothing to focus, Tab does nothing.
54
+ export function trapTab(panel, event) {
55
+ var focusable = Array.from(panel.querySelectorAll(PICKABLE));
56
+ if (focusable.length === 0) {
57
+ event.preventDefault();
58
+ return;
59
+ }
60
+ var first = focusable[0];
61
+ var last = focusable[focusable.length - 1];
62
+ var active = document.activeElement;
63
+ if (event.shiftKey && active === first) {
64
+ event.preventDefault();
65
+ last.focus();
66
+ }
67
+ else if (!event.shiftKey && active === last) {
68
+ event.preventDefault();
69
+ first.focus();
70
+ }
71
+ }
@@ -0,0 +1,9 @@
1
+ /** One arrow key press moves the edge this far */
2
+ export declare const KEY_STEP = 16;
3
+ export declare function clampWidth(width: number, min: number, max: number): number;
4
+ export declare function paneLimits(minWidth: number, maxWidth: number | undefined, windowWidth: number): {
5
+ min: number;
6
+ max: number;
7
+ };
8
+ export declare function keyWidth(key: string, width: number, min: number, max: number): number | null;
9
+ export declare function dragWidth(startWidth: number, startX: number, x: number, min: number, max: number): number;
@@ -0,0 +1,31 @@
1
+ // Width math for a pane resized from its start edge (SidePane). Pure, so it is tested without a page.
2
+ /** One arrow key press moves the edge this far */
3
+ export var KEY_STEP = 16;
4
+ export function clampWidth(width, min, max) {
5
+ return Math.min(max, Math.max(min, width));
6
+ }
7
+ // The default maximum is 60% of the window, and the maximum is never under the minimum
8
+ export function paneLimits(minWidth, maxWidth, windowWidth) {
9
+ var max = maxWidth !== null && maxWidth !== void 0 ? maxWidth : Math.round(windowWidth * 0.6);
10
+ return { min: minWidth, max: Math.max(minWidth, max) };
11
+ }
12
+ // The edge is on the pane's start side: Left widens the pane, Right narrows it, Home and End go to
13
+ // the smallest and largest width. Any other key gives null.
14
+ export function keyWidth(key, width, min, max) {
15
+ switch (key) {
16
+ case 'ArrowLeft':
17
+ return clampWidth(width + KEY_STEP, min, max);
18
+ case 'ArrowRight':
19
+ return clampWidth(width - KEY_STEP, min, max);
20
+ case 'Home':
21
+ return min;
22
+ case 'End':
23
+ return max;
24
+ default:
25
+ return null;
26
+ }
27
+ }
28
+ // Dragging the edge left by some pixels widens the pane by as many
29
+ export function dragWidth(startWidth, startX, x, min, max) {
30
+ return clampWidth(startWidth + (startX - x), min, max);
31
+ }
@@ -0,0 +1,24 @@
1
+ /** How close to the end of the scroll counts as the end, in px */
2
+ export declare const BOTTOM_SLACK = 2;
3
+ /** The window to read from: its scroll position and sizes */
4
+ export interface ScrollMetrics {
5
+ scrollTop: number;
6
+ clientHeight: number;
7
+ scrollHeight: number;
8
+ }
9
+ /**
10
+ * Whether the scroll is at its end. A page that does not scroll is not at its end: its last
11
+ * section would otherwise be current on a short page.
12
+ */
13
+ export declare function isAtBottom({ scrollTop, clientHeight, scrollHeight }: ScrollMetrics): boolean;
14
+ /**
15
+ * The index of the current item. `tops` holds each heading's distance from the top of the scroll
16
+ * area (null for a heading that is not on the page yet).
17
+ * - At the end of the scroll, the last item: a last section shorter than the window never reaches the offset.
18
+ * - Otherwise the last heading at or above `offset`.
19
+ * - Above every heading, the first item.
20
+ * - -1 when no heading is on the page.
21
+ */
22
+ export declare function pickCurrent(tops: (number | null)[], offset: number, atBottom: boolean): number;
23
+ /** The id a `#hash` names, when it is one of the items; else null. Reads `#a%20b` as `a b`. */
24
+ export declare function hashId(hash: string, ids: string[]): string | null;
@@ -0,0 +1,53 @@
1
+ // Which heading a long page is "at", for OnThisPage. Pure, so it is tested without a page.
2
+ /** How close to the end of the scroll counts as the end, in px */
3
+ export var BOTTOM_SLACK = 2;
4
+ /**
5
+ * Whether the scroll is at its end. A page that does not scroll is not at its end: its last
6
+ * section would otherwise be current on a short page.
7
+ */
8
+ export function isAtBottom(_a) {
9
+ var scrollTop = _a.scrollTop, clientHeight = _a.clientHeight, scrollHeight = _a.scrollHeight;
10
+ if (scrollHeight <= clientHeight + BOTTOM_SLACK)
11
+ return false;
12
+ return scrollTop + clientHeight >= scrollHeight - BOTTOM_SLACK;
13
+ }
14
+ /**
15
+ * The index of the current item. `tops` holds each heading's distance from the top of the scroll
16
+ * area (null for a heading that is not on the page yet).
17
+ * - At the end of the scroll, the last item: a last section shorter than the window never reaches the offset.
18
+ * - Otherwise the last heading at or above `offset`.
19
+ * - Above every heading, the first item.
20
+ * - -1 when no heading is on the page.
21
+ */
22
+ export function pickCurrent(tops, offset, atBottom) {
23
+ var first = -1;
24
+ var last = -1;
25
+ var passed = -1;
26
+ tops.forEach(function (top, i) {
27
+ if (top === null)
28
+ return;
29
+ if (first < 0)
30
+ first = i;
31
+ last = i;
32
+ if (top <= offset)
33
+ passed = i;
34
+ });
35
+ if (first < 0)
36
+ return -1;
37
+ if (atBottom)
38
+ return last;
39
+ return passed >= 0 ? passed : first;
40
+ }
41
+ /** The id a `#hash` names, when it is one of the items; else null. Reads `#a%20b` as `a b`. */
42
+ export function hashId(hash, ids) {
43
+ if (!hash || hash === '#')
44
+ return null;
45
+ var id = hash.startsWith('#') ? hash.slice(1) : hash;
46
+ try {
47
+ id = decodeURIComponent(id);
48
+ }
49
+ catch (_a) {
50
+ // keep the raw text
51
+ }
52
+ return ids.includes(id) ? id : null;
53
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { SiteBrand } from '../components/siteHeader';
3
+ /** The brand as a link home: the logo named by the site, or the name as text. Shared by `SiteHeader` and `SiteFooter`, not public. */
4
+ export declare function SiteBrandLink({ brand }: {
5
+ brand: SiteBrand;
6
+ }): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Image from '../components/image';
3
+ import { focusRing } from '../components/sharedStyles';
4
+ /** The brand as a link home: the logo named by the site, or the name as text. Shared by `SiteHeader` and `SiteFooter`, not public. */
5
+ export function SiteBrandLink(_a) {
6
+ var _b;
7
+ var brand = _a.brand;
8
+ return (<a href={brand.href} className={"flex shrink-0 items-center rounded-control text-subtitle1 text-fg-primary no-underline ".concat(focusRing)}>
9
+ {brand.src ? <Image src={brand.src} alt={brand.name} width={brand.width} height={(_b = brand.height) !== null && _b !== void 0 ? _b : 28}/> : brand.name}
10
+ </a>);
11
+ }
@@ -0,0 +1,5 @@
1
+ export declare function nextSwitchValue({ checked, busy, disabled, }: {
2
+ checked: boolean;
3
+ busy?: boolean;
4
+ disabled?: boolean;
5
+ }): boolean | undefined;
@@ -0,0 +1,9 @@
1
+ // What a Switch press asks its parent for. Kept out of the public API.
2
+ // The value to pass to onChange, or undefined when the press must do nothing:
3
+ // a busy switch is waiting for its parent and a disabled one is off.
4
+ export function nextSwitchValue(_a) {
5
+ var checked = _a.checked, _b = _a.busy, busy = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
6
+ if (busy || disabled)
7
+ return undefined;
8
+ return !checked;
9
+ }
@@ -6,6 +6,12 @@
6
6
  "compose": "`OdsBanner` for an inline message; `AlertDialog` for one that needs a decision",
7
7
  "note": "ODS has no native toast: on Android use `Snackbar` in a `SnackbarHost`."
8
8
  },
9
+ {
10
+ "ods": "appShell",
11
+ "swiftui": "`NavigationSplitView` with the sidebar, the content and an `.inspector`; on iPhone a `NavigationStack`, or a `TabView` of five places or fewer",
12
+ "compose": "`NavigationSuiteScaffold`; on a phone a `ModalNavigationDrawer` around a `Scaffold`",
13
+ "note": "The split view collapses to a stack on iPhone and shows and hides the sidebar itself. The skip link is web only."
14
+ },
9
15
  {
10
16
  "ods": "button",
11
17
  "swiftui": "`Button` with `.odsProminentButton()` for accent (`.odsProminentButton(.glass)` for the glass style), `.bordered` for primary",
@@ -28,6 +34,18 @@
28
34
  "compose": "`OutlinedTextField` with `maxLines = 6` over a `Row` of the tool `IconButton`s and a send `IconButton`",
29
35
  "note": "On iPhone and Android, Return adds a line and the send button sends. While an agent works, send becomes Stop."
30
36
  },
37
+ {
38
+ "ods": "copyField",
39
+ "swiftui": "A `LabeledContent` row with the value in a `Text` (`.textSelection(.enabled)`) and a `Button` that sets `UIPasteboard` / `NSPasteboard`",
40
+ "compose": "An `OutlinedTextField` with `readOnly = true` and a `trailingIcon` `TextButton` that calls `LocalClipboard`",
41
+ "note": "Show \"Copied\" for 2 seconds only after the write succeeds. Announce it for VoiceOver / TalkBack. A secret shown once gets the line under it."
42
+ },
43
+ {
44
+ "ods": "drawer",
45
+ "swiftui": "`.sheet` with `.presentationDetents` on iPhone; `.inspector` on iPad and Mac",
46
+ "compose": "`ModalNavigationDrawer` for `side=\"start\"`; `ModalBottomSheet` for `side=\"end\"`",
47
+ "note": "The system sheet, inspector and drawer handle the scrim, swipe to close and focus. `ModalBottomSheet` needs `@OptIn(ExperimentalMaterial3Api::class)`."
48
+ },
31
49
  {
32
50
  "ods": "emptyBox",
33
51
  "swiftui": "`ContentUnavailableView`",
@@ -52,6 +70,12 @@
52
70
  "compose": "An `InputChip` with a `trailingIcon` that removes it",
53
71
  "note": "An uploading chip gets a `ProgressView`; a failed one an alert symbol, not color alone. Say the state in the VoiceOver / TalkBack label."
54
72
  },
73
+ {
74
+ "ods": "formField",
75
+ "swiftui": "A `Section` in a `Form`: the control carries its own label, `footer:` holds the help or error text",
76
+ "compose": "The field's `label`, `supportingText` and `isError` on an `OutlinedTextField`; a `Column` with a supporting `Text` for other controls",
77
+ "note": "On Apple the system ties the label to the control; do not add one. Say the error in the VoiceOver / TalkBack text, not color alone."
78
+ },
55
79
  {
56
80
  "ods": "form",
57
81
  "swiftui": "`Form`",
@@ -145,6 +169,12 @@
145
169
  "compose": "Not applicable: web page pattern",
146
170
  "note": "In an app screen: rows of a `List` / `ListItem`s."
147
171
  },
172
+ {
173
+ "ods": "onThisPage",
174
+ "swiftui": "Not applicable: web page pattern",
175
+ "compose": "Not applicable: web page pattern",
176
+ "note": "A site is web only. A long screen is a `List` in sections."
177
+ },
148
178
  {
149
179
  "ods": "pageHeader",
150
180
  "swiftui": "Not applicable: web page pattern",
@@ -180,11 +210,41 @@
180
210
  "compose": "Not applicable: web page pattern",
181
211
  "note": "In an app screen: a `Section` header in a `List` or `Form` / a heading `Text`."
182
212
  },
213
+ {
214
+ "ods": "segmentedControl",
215
+ "swiftui": "`Picker` with `.pickerStyle(.segmented)`",
216
+ "compose": "`SingleChoiceSegmentedButtonRow` with `SegmentedButton`",
217
+ "note": "It sets a value on the same screen. To switch panels use `TabView` / `PrimaryTabRow`. Give the picker an accessibility label."
218
+ },
183
219
  {
184
220
  "ods": "select",
185
221
  "swiftui": "`Picker` or `Menu`",
186
222
  "compose": "`ExposedDropdownMenuBox`"
187
223
  },
224
+ {
225
+ "ods": "settingsSection",
226
+ "swiftui": "A `Section` with a header `Text` and footer `Text` in a grouped `Form`",
227
+ "compose": "A `Column` with a title `Text`, a supporting `Text` and the controls under a `HorizontalDivider`",
228
+ "note": "A danger zone gets its own `Section` with the error color on the header. Settings Columns is a screen layout: one column on a phone. For Settings Layout, on a phone the nav is its own screen, pushed with `NavigationStack` / `NavHost`. `navWidth=\"wide\"` (a list beside its detail) is a `NavigationSplitView` list column / `ListDetailPaneScaffold`."
229
+ },
230
+ {
231
+ "ods": "sidePane",
232
+ "swiftui": "`.inspector(isPresented:)` with `.inspectorColumnWidth(min:ideal:max:)`",
233
+ "compose": "`SupportingPaneScaffold`",
234
+ "note": "The system resizes the inspector on iPad and Mac and shows it as a sheet on iPhone. `SupportingPaneScaffold` is in the Material 3 adaptive library and needs `@OptIn(ExperimentalMaterial3AdaptiveApi::class)`."
235
+ },
236
+ {
237
+ "ods": "siteFooter",
238
+ "swiftui": "Not applicable: web page pattern",
239
+ "compose": "Not applicable: web page pattern",
240
+ "note": "A site is web only. An app has no footer: its links live in Settings, as rows."
241
+ },
242
+ {
243
+ "ods": "siteHeader",
244
+ "swiftui": "Not applicable: web page pattern",
245
+ "compose": "Not applicable: web page pattern",
246
+ "note": "A site is web only. In an app: `NavigationStack` with a toolbar, and a `TabView` or `NavigationSuiteScaffold` for the places."
247
+ },
188
248
  {
189
249
  "ods": "sourceCard",
190
250
  "swiftui": "`Link` or `Button` with a `Label` (icon, title) and the meta as a secondary line",
@@ -203,6 +263,12 @@
203
263
  "compose": "Not applicable: web page pattern",
204
264
  "note": "In an app screen: a `Form` section or `GroupBox` / `Card`."
205
265
  },
266
+ {
267
+ "ods": "switch",
268
+ "swiftui": "`Toggle` in a `Form` row (`.toggleStyle(.switch)`); the description is the row's secondary line",
269
+ "compose": "`Switch` in a `ListItem` with `trailingContent`",
270
+ "note": "While a change saves, disable the control or show a `ProgressView` / `CircularProgressIndicator` beside it and put the value back if it fails."
271
+ },
206
272
  {
207
273
  "ods": "tab",
208
274
  "swiftui": "`TabView` or segmented `Picker`",
@@ -266,6 +332,12 @@
266
332
  "swiftui": "`Text(_:style:)` (`.relative`) or `Text(_:format:)` (`.dateTime`)",
267
333
  "compose": "`Text` with `DateUtils.getRelativeTimeSpanString` or `DateTimeFormatter.ofLocalizedDateTime`"
268
334
  },
335
+ {
336
+ "ods": "titleBar",
337
+ "swiftui": "`.navigationTitle` with `.toolbar` items",
338
+ "compose": "`TopAppBar` with `navigationIcon` and `actions`",
339
+ "note": "The main action stays in the toolbar; the rest go in a `Menu` / an overflow `DropdownMenu`."
340
+ },
269
341
  {
270
342
  "ods": "toaster",
271
343
  "swiftui": "`ODSBanner` for an inline message; a system banner (a local notification) when the app is not in front",
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import AppShell from "../components/appShell";
4
+ declare const meta: Meta<typeof AppShell>;
5
+ export default meta;
6
+ declare function ShellBox({ initialNav, initialPane, resizable }: {
7
+ initialNav?: boolean;
8
+ initialPane?: boolean;
9
+ resizable?: boolean;
10
+ }): React.JSX.Element;
11
+ type Story = StoryObj<typeof ShellBox>;
12
+ export declare const Default: Story;
13
+ export declare const WithPane: Story;
14
+ export declare const Phone: Story;
15
+ export declare const Probe: Story;
@@ -0,0 +1,137 @@
1
+ import React, { useRef, useState } from "react";
2
+ import AppShell from "../components/appShell";
3
+ import SidePane from "../components/sidePane";
4
+ import TitleBar from "../components/titleBar";
5
+ import Navigation, { NavigationGroup } from "../components/navigation";
6
+ import MenuItem from "../components/menuItem";
7
+ import Button from "../components/button";
8
+ import IconButton from "../components/iconButton";
9
+ import Paragraph from "../components/paragraph";
10
+ import Popover from "../components/popover";
11
+ import Menu from "../components/menu";
12
+ import Line from "../components/line";
13
+ import Modal from "../components/modal";
14
+ import UserImage from "../components/userImage";
15
+ var meta = {
16
+ title: "Components/AppShell",
17
+ component: AppShell,
18
+ parameters: { layout: "fullscreen" },
19
+ };
20
+ export default meta;
21
+ // The story frame pads its content; the shell is a whole page, so it takes the padding back
22
+ var Bleed = function (_a) {
23
+ var children = _a.children;
24
+ return <div style={{ margin: "-1rem" }}>{children}</div>;
25
+ };
26
+ // The account menu keeps its own state, so the copy in the column and the copy in the phone Drawer
27
+ // never open the same Modal twice. Its Log Out Modal leaves focus where Modal puts it back.
28
+ function AccountMenu() {
29
+ var _a = useState(null), anchor = _a[0], setAnchor = _a[1];
30
+ var _b = useState(false), open = _b[0], setOpen = _b[1];
31
+ var _c = useState(false), confirming = _c[0], setConfirming = _c[1];
32
+ return (<div id="appshell-account" style={{ marginTop: "auto", paddingTop: "8px" }}>
33
+ <Button size="small" type="tertiary" state={open ? "selected" : "enabled"} label="Dana Lee" decoIcon={<UserImage userHandle="Dana Lee" size={20} decorative/>} aria-label="Dana Lee, account menu" aria-haspopup="menu" aria-expanded={open} onClickButton={function (e) {
34
+ setAnchor(e.currentTarget);
35
+ setOpen(function (o) { return !o; });
36
+ }}/>
37
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
38
+ <Menu navigable aria-label="Account" width={200}>
39
+ <MenuItem size="small" iconName="Settings" label="Settings" onClick={function () { return setOpen(false); }}/>
40
+ <Line />
41
+ <MenuItem size="small" iconName="LogOut" label="Log Out" onClick={function () { setOpen(false); setConfirming(true); }}/>
42
+ </Menu>
43
+ </Popover>
44
+ <Modal isOpen={confirming} size="small" title="Log Out" onClose={function () { return setConfirming(false); }} actions={<>
45
+ <Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={function () { return setConfirming(false); }}/>
46
+ <Button size="small" type="primary" state="enabled" label="Log Out" onClickButton={function () { return setConfirming(false); }}/>
47
+ </>}>
48
+ <Paragraph measure="none">You will need to log in again to use Acme on this device.</Paragraph>
49
+ </Modal>
50
+ </div>);
51
+ }
52
+ function Sidebar(_a) {
53
+ var current = _a.current, onPick = _a.onPick;
54
+ var item = function (label, iconName, count) { return (<MenuItem size="small" iconName={iconName} label={label} isSelected={current === label} aria-current={current === label ? "page" : undefined}
55
+ // A count is unread items, and the row's name says so
56
+ tag={count ? { label: String(count), variant: "textOnly" } : undefined} aria-label={count ? "".concat(label, ", ").concat(count, " unread") : undefined} onClick={function () { return onPick(label); }}/>); };
57
+ return (<Navigation aria-label="Main">
58
+ <NavigationGroup label="Mail">
59
+ {item("Inbox", "Inbox")}
60
+ {item("Mentions", "AtSign", 3)}
61
+ {item("Sent", "Send")}
62
+ </NavigationGroup>
63
+ <NavigationGroup label="Projects">
64
+ {item("Website", "Globe", 12)}
65
+ {item("Mobile App", "Smartphone")}
66
+ </NavigationGroup>
67
+ <AccountMenu />
68
+ </Navigation>);
69
+ }
70
+ var members = ["Dana Lee", "Ben Carter", "Omar Reyes"];
71
+ function ShellBox(_a) {
72
+ var _b = _a.initialNav, initialNav = _b === void 0 ? false : _b, _c = _a.initialPane, initialPane = _c === void 0 ? false : _c, _d = _a.resizable, resizable = _d === void 0 ? false : _d;
73
+ var _e = useState(initialNav), navOpen = _e[0], setNavOpen = _e[1];
74
+ var _f = useState("Inbox"), place = _f[0], setPlace = _f[1];
75
+ var _g = useState(initialPane), paneOpen = _g[0], setPaneOpen = _g[1];
76
+ var _h = useState(384), width = _h[0], setWidth = _h[1];
77
+ var _j = useState(null), removing = _j[0], setRemoving = _j[1];
78
+ var _k = useState(null), moreAnchor = _k[0], setMoreAnchor = _k[1];
79
+ var _l = useState(false), moreOpen = _l[0], setMoreOpen = _l[1];
80
+ var pane = useRef(null);
81
+ var membersButton = (<IconButton color="iconOnly" state={paneOpen ? "selected" : "enabled"} size="medium" iconName="Users" ariaLabel="Members" aria-expanded={paneOpen}
82
+ // Pressed again while open, it brings the pane forward instead of opening a second one
83
+ onClick={function () { var _a; return (paneOpen ? (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus() : setPaneOpen(true)); }}/>);
84
+ return (<Bleed>
85
+ <AppShell title={place} navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={<Sidebar current={place} onPick={setPlace}/>} pane={paneOpen && (<SidePane ref={pane} title="Members" onClose={function () { return setPaneOpen(false); }} width={resizable ? width : undefined} onWidthChange={resizable ? setWidth : undefined} actions={<>
86
+ <IconButton color="iconOnly" state="enabled" size="medium" iconName="MoreHorizontal" ariaLabel="More" aria-haspopup="menu" aria-expanded={moreOpen} onClick={function (e) { setMoreAnchor(e.currentTarget); setMoreOpen(function (o) { return !o; }); }}/>
87
+ <Popover open={moreOpen} anchorEl={moreAnchor} onClose={function () { return setMoreOpen(false); }} returnFocus>
88
+ <Menu navigable aria-label="Members actions" width={200}>
89
+ <MenuItem size="small" iconName="UserPlus" label="Invite People" onClick={function () { return setMoreOpen(false); }}/>
90
+ <MenuItem size="small" iconName="Download" label="Export List" onClick={function () { return setMoreOpen(false); }}/>
91
+ </Menu>
92
+ </Popover>
93
+ </>}>
94
+ <div style={{ display: "flex", flexDirection: "column", gap: "12px" }}>
95
+ {members.map(function (name) { return (<div key={name} style={{ display: "flex", alignItems: "center", gap: "8px" }}>
96
+ <UserImage userHandle={name} decorative/>
97
+ <span style={{ flex: 1 }}>{name}</span>
98
+ {name !== "Dana Lee" && (<IconButton color="iconOnly" state="enabled" size="small" iconName="UserMinus" ariaLabel={"Remove ".concat(name)} onClick={function () { return setRemoving(name); }}/>)}
99
+ </div>); })}
100
+ </div>
101
+ <Modal isOpen={removing !== null} size="small" title="Remove Member" onClose={function () { return setRemoving(null); }} actions={<>
102
+ <Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={function () { return setRemoving(null); }}/>
103
+ <Button size="small" type="primary" color="danger" state="enabled" label="Remove" onClickButton={function () { return setRemoving(null); }}/>
104
+ </>}>
105
+ <Paragraph measure="none">{removing} will lose access to Acme.</Paragraph>
106
+ </Modal>
107
+ </SidePane>)}>
108
+ <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
109
+ <TitleBar title={place} actions={<>
110
+ <Button size="medium" type="primary" state="enabled" label="New Message" decoIcon="Plus"/>
111
+ {membersButton}
112
+ </>}/>
113
+ <Paragraph tone="secondary">Ben Carter shared the launch plan. Omar Reyes asked for the new screens by Friday.</Paragraph>
114
+ <Paragraph tone="secondary">Pick a place in the sidebar. On a phone the Menu button at the top opens it.</Paragraph>
115
+ </div>
116
+ </AppShell>
117
+ </Bleed>);
118
+ }
119
+ // Also shot at 375px by tests/stories.spec.ts (the "shell" tag)
120
+ export var Default = {
121
+ tags: ["shell"],
122
+ render: function () { return <ShellBox />; },
123
+ };
124
+ export var WithPane = {
125
+ tags: ["shell"],
126
+ render: function () { return <ShellBox initialPane/>; },
127
+ };
128
+ // Shot at 375px only (the "phone" tag): the sidebar in its Drawer
129
+ export var Phone = {
130
+ tags: ["phone"],
131
+ render: function () { return <ShellBox initialNav/>; },
132
+ };
133
+ // For tests/interactions.spec.ts only: the phone sidebar, its account menu and Log Out Modal, and a resizable Members pane
134
+ export var Probe = {
135
+ tags: ["!dev", "!autodocs", "test-only"],
136
+ render: function () { return <ShellBox resizable/>; },
137
+ };