oneslash-design-system 2.28.1 → 2.30.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 (248) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +31 -1
  3. package/dist/cases/about-page.md +2 -0
  4. package/dist/cases/accept-invite.md +2 -0
  5. package/dist/cases/account-menu.md +2 -0
  6. package/dist/cases/activity-timeline.md +2 -0
  7. package/dist/cases/admin-inbox.md +2 -0
  8. package/dist/cases/agent-asks-before-risky-action.md +3 -1
  9. package/dist/cases/agent-cancels-when-unanswered.md +2 -0
  10. package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
  11. package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
  12. package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
  13. package/dist/cases/agent-changes-review/per-change.jsx +203 -0
  14. package/dist/cases/agent-changes-review.md +585 -0
  15. package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
  16. package/dist/cases/agent-handoff/to-agent.jsx +53 -0
  17. package/dist/cases/agent-handoff/to-person.d.ts +1 -0
  18. package/dist/cases/agent-handoff/to-person.jsx +84 -0
  19. package/dist/cases/agent-handoff.md +231 -0
  20. package/dist/cases/agent-memory/list.d.ts +1 -0
  21. package/dist/cases/agent-memory/list.jsx +256 -0
  22. package/dist/cases/agent-memory.md +354 -0
  23. package/dist/cases/agent-options.md +2 -0
  24. package/dist/cases/agent-pending-reply/steps.jsx +70 -21
  25. package/dist/cases/agent-pending-reply.md +74 -27
  26. package/dist/cases/agent-permissions/levels.d.ts +3 -0
  27. package/dist/cases/agent-permissions/levels.jsx +51 -0
  28. package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
  29. package/dist/cases/agent-permissions/per-tool.jsx +180 -0
  30. package/dist/cases/agent-permissions.md +319 -0
  31. package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
  32. package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
  33. package/dist/cases/agent-plan-proposal.md +36 -21
  34. package/dist/cases/agent-question.md +2 -0
  35. package/dist/cases/agent-refuses-clearly.md +2 -0
  36. package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
  37. package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
  38. package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
  39. package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
  40. package/dist/cases/agent-run-failure.md +500 -0
  41. package/dist/cases/agent-says-what-it-is.md +2 -0
  42. package/dist/cases/agent-says-where-it-stopped.md +27 -0
  43. package/dist/cases/agent-settings.md +2 -0
  44. package/dist/cases/agent-shows-progress.md +2 -0
  45. package/dist/cases/agent-shows-sources.md +2 -0
  46. package/dist/cases/api-keys.md +2 -0
  47. package/dist/cases/app-shell.md +2 -0
  48. package/dist/cases/artifact-card.md +2 -0
  49. package/dist/cases/ask-page.md +2 -0
  50. package/dist/cases/auth-gate-loading.md +2 -0
  51. package/dist/cases/billing-page.md +2 -0
  52. package/dist/cases/blog-index.md +2 -0
  53. package/dist/cases/breadcrumb.md +2 -0
  54. package/dist/cases/breakdown-list.md +2 -0
  55. package/dist/cases/bulk-actions/list.d.ts +1 -0
  56. package/dist/cases/bulk-actions/list.jsx +206 -0
  57. package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
  58. package/dist/cases/bulk-actions/paged-table.jsx +243 -0
  59. package/dist/cases/bulk-actions.md +553 -0
  60. package/dist/cases/changelog.md +2 -0
  61. package/dist/cases/chart.md +2 -0
  62. package/dist/cases/check-your-email.md +2 -0
  63. package/dist/cases/code-sample.md +2 -0
  64. package/dist/cases/collapsible-search.md +2 -0
  65. package/dist/cases/comment-thread.md +2 -0
  66. package/dist/cases/comparison-page/table.d.ts +1 -0
  67. package/dist/cases/comparison-page/table.jsx +97 -0
  68. package/dist/cases/comparison-page.md +156 -0
  69. package/dist/cases/composer-limit.md +2 -0
  70. package/dist/cases/confirm-destructive-action.md +2 -0
  71. package/dist/cases/confirm-dialogs.md +2 -0
  72. package/dist/cases/connection-status/card.d.ts +1 -0
  73. package/dist/cases/connection-status/card.jsx +97 -0
  74. package/dist/cases/connection-status/row.d.ts +1 -0
  75. package/dist/cases/connection-status/row.jsx +120 -0
  76. package/dist/cases/connection-status.md +330 -0
  77. package/dist/cases/contact-page.md +2 -0
  78. package/dist/cases/conversation-starters.md +2 -0
  79. package/dist/cases/cookie-choice.md +2 -0
  80. package/dist/cases/create-modal.md +2 -0
  81. package/dist/cases/danger-zone.md +2 -0
  82. package/dist/cases/dashboard.md +2 -0
  83. package/dist/cases/data-table-page.md +2 -0
  84. package/dist/cases/date-field.md +2 -0
  85. package/dist/cases/device-login.md +2 -0
  86. package/dist/cases/docs-component-page.md +2 -0
  87. package/dist/cases/email-confirmed.md +2 -0
  88. package/dist/cases/empty-list.md +2 -0
  89. package/dist/cases/empty-lists.md +2 -0
  90. package/dist/cases/empty-not-set-up.md +2 -0
  91. package/dist/cases/empty-search.md +2 -0
  92. package/dist/cases/error-page.md +2 -0
  93. package/dist/cases/faq.md +2 -0
  94. package/dist/cases/feature-grid.md +2 -0
  95. package/dist/cases/feedback-form.md +2 -0
  96. package/dist/cases/file-upload.md +2 -0
  97. package/dist/cases/filter-menu.md +2 -0
  98. package/dist/cases/forgot-password.md +2 -0
  99. package/dist/cases/form-errors.md +2 -0
  100. package/dist/cases/image-viewer.md +2 -0
  101. package/dist/cases/import-checklist.md +2 -0
  102. package/dist/cases/inline-form-feedback.md +2 -0
  103. package/dist/cases/integrations-list/nested.jsx +1 -1
  104. package/dist/cases/integrations-list/rows.jsx +1 -1
  105. package/dist/cases/integrations-list.md +6 -4
  106. package/dist/cases/invite-member.md +2 -0
  107. package/dist/cases/invoice-list.md +2 -0
  108. package/dist/cases/landing-hero.md +2 -0
  109. package/dist/cases/leaderboard.md +2 -0
  110. package/dist/cases/legal-page.md +2 -0
  111. package/dist/cases/load-failure.md +2 -0
  112. package/dist/cases/log-out-confirm.md +2 -0
  113. package/dist/cases/login-page.md +2 -0
  114. package/dist/cases/long-form-page.md +2 -0
  115. package/dist/cases/master-detail.md +2 -0
  116. package/dist/cases/members-list.md +2 -0
  117. package/dist/cases/mention-list.md +2 -0
  118. package/dist/cases/message-actions.md +2 -0
  119. package/dist/cases/message-attachments.md +2 -0
  120. package/dist/cases/message-composer/with-tools.jsx +17 -7
  121. package/dist/cases/message-composer.md +28 -11
  122. package/dist/cases/message-edit.md +2 -0
  123. package/dist/cases/message-reactions.md +2 -0
  124. package/dist/cases/message-row.md +2 -0
  125. package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
  126. package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
  127. package/dist/cases/message-send-failure/retrying.d.ts +1 -0
  128. package/dist/cases/message-send-failure/retrying.jsx +116 -0
  129. package/dist/cases/message-send-failure.md +308 -0
  130. package/dist/cases/mobile-menu.md +2 -0
  131. package/dist/cases/newsletter-signup.md +2 -0
  132. package/dist/cases/no-access/page.d.ts +1 -0
  133. package/dist/cases/no-access/page.jsx +37 -0
  134. package/dist/cases/no-access/read-only.d.ts +1 -0
  135. package/dist/cases/no-access/read-only.jsx +33 -0
  136. package/dist/cases/no-access.md +147 -0
  137. package/dist/cases/not-found-page.md +2 -0
  138. package/dist/cases/notification-menu.md +2 -0
  139. package/dist/cases/number-format.md +2 -0
  140. package/dist/cases/oauth-consent.md +2 -0
  141. package/dist/cases/on-off-settings.md +2 -0
  142. package/dist/cases/on-this-page.md +2 -0
  143. package/dist/cases/onboarding.md +2 -0
  144. package/dist/cases/one-main-action.md +2 -0
  145. package/dist/cases/overflow-menu.md +2 -0
  146. package/dist/cases/page-end.md +2 -0
  147. package/dist/cases/page-header.md +2 -0
  148. package/dist/cases/paged-card.md +2 -0
  149. package/dist/cases/password-gate.md +2 -0
  150. package/dist/cases/payment-method.md +2 -0
  151. package/dist/cases/people-row.md +2 -0
  152. package/dist/cases/phone-navigation.md +2 -0
  153. package/dist/cases/plan-change-confirm.md +2 -0
  154. package/dist/cases/plan-comparison.md +3 -1
  155. package/dist/cases/plan-picker.md +4 -1
  156. package/dist/cases/plan-sign-off.md +2 -0
  157. package/dist/cases/pricing-section.md +5 -1
  158. package/dist/cases/product-cards.md +2 -0
  159. package/dist/cases/product-demo/scripted.d.ts +1 -0
  160. package/dist/cases/product-demo/scripted.jsx +99 -0
  161. package/dist/cases/product-demo/still.d.ts +1 -0
  162. package/dist/cases/product-demo/still.jsx +20 -0
  163. package/dist/cases/product-demo.md +226 -0
  164. package/dist/cases/profile-form.md +2 -0
  165. package/dist/cases/quick-switcher.md +2 -0
  166. package/dist/cases/range-switch.md +2 -0
  167. package/dist/cases/rename.md +2 -0
  168. package/dist/cases/reply-feedback.md +2 -0
  169. package/dist/cases/reply-sources.md +2 -0
  170. package/dist/cases/route-loading.md +2 -0
  171. package/dist/cases/scope-picker.md +2 -0
  172. package/dist/cases/section-index.md +2 -0
  173. package/dist/cases/session-expired/in-place.d.ts +1 -0
  174. package/dist/cases/session-expired/in-place.jsx +63 -0
  175. package/dist/cases/session-expired/redirect.d.ts +1 -0
  176. package/dist/cases/session-expired/redirect.jsx +62 -0
  177. package/dist/cases/session-expired.md +204 -0
  178. package/dist/cases/set-new-password.md +2 -0
  179. package/dist/cases/settings-page.md +2 -0
  180. package/dist/cases/settings-save.md +2 -0
  181. package/dist/cases/side-pane.md +2 -0
  182. package/dist/cases/sidebar-nav.md +2 -0
  183. package/dist/cases/sign-up-page.md +3 -0
  184. package/dist/cases/signup-from-site/plain.d.ts +1 -0
  185. package/dist/cases/signup-from-site/plain.jsx +125 -0
  186. package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
  187. package/dist/cases/signup-from-site/with-plan.jsx +151 -0
  188. package/dist/cases/signup-from-site.md +351 -0
  189. package/dist/cases/site-footer.md +2 -0
  190. package/dist/cases/site-header/links.d.ts +3 -1
  191. package/dist/cases/site-header/links.jsx +6 -2
  192. package/dist/cases/site-header.md +11 -3
  193. package/dist/cases/site-matches-app.md +32 -0
  194. package/dist/cases/site-search.md +2 -0
  195. package/dist/cases/slash-command-list.md +2 -0
  196. package/dist/cases/stat-row.md +2 -0
  197. package/dist/cases/status-label.md +3 -1
  198. package/dist/cases/success-feedback.md +2 -0
  199. package/dist/cases/tabbed-panels.md +2 -0
  200. package/dist/cases/tag-filter.md +2 -0
  201. package/dist/cases/task-header.md +2 -0
  202. package/dist/cases/theme-switcher.md +2 -0
  203. package/dist/cases/type-to-confirm.md +2 -0
  204. package/dist/cases/typing-and-status.md +2 -0
  205. package/dist/cases/unsaved-changes-guard.md +2 -0
  206. package/dist/cases/upgrade-prompt.md +2 -0
  207. package/dist/cases/usage-meters.md +2 -0
  208. package/dist/cases.json +1492 -39
  209. package/dist/components/checkBox.d.ts +7 -2
  210. package/dist/components/checkBox.jsx +39 -14
  211. package/dist/components/diff.d.ts +32 -0
  212. package/dist/components/diff.jsx +42 -0
  213. package/dist/components/segmentedControl.d.ts +3 -1
  214. package/dist/components/segmentedControl.jsx +8 -6
  215. package/dist/components/slidingIndicator.d.ts +5 -2
  216. package/dist/components/slidingIndicator.jsx +9 -3
  217. package/dist/components/tableContainer.d.ts +1 -1
  218. package/dist/components/tableContainer.jsx +2 -2
  219. package/dist/components/timeStamp.d.ts +3 -1
  220. package/dist/components/timeStamp.jsx +4 -2
  221. package/dist/components/useReducedMotion.d.ts +6 -0
  222. package/dist/components/useReducedMotion.js +19 -0
  223. package/dist/index.d.ts +2 -0
  224. package/dist/index.js +2 -0
  225. package/dist/internal/diff.d.ts +17 -0
  226. package/dist/internal/diff.js +44 -0
  227. package/dist/native-mapping.json +9 -2
  228. package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
  229. package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
  230. package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
  231. package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
  232. package/dist/stories/Cases.generated.stories.d.ts +24 -0
  233. package/dist/stories/Cases.generated.stories.jsx +48 -0
  234. package/dist/stories/Checkbox.stories.d.ts +3 -0
  235. package/dist/stories/Checkbox.stories.jsx +38 -0
  236. package/dist/stories/Diff.stories.d.ts +10 -0
  237. package/dist/stories/Diff.stories.jsx +45 -0
  238. package/dist/stories/SegmentedControl.stories.d.ts +1 -0
  239. package/dist/stories/SegmentedControl.stories.jsx +6 -0
  240. package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
  241. package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
  242. package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
  243. package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
  244. package/dist/stories/Table.stories.d.ts +1 -0
  245. package/dist/stories/Table.stories.jsx +25 -0
  246. package/dist/stories/TimeStamp.stories.d.ts +1 -0
  247. package/dist/stories/TimeStamp.stories.jsx +13 -0
  248. package/package.json +5 -1
@@ -9,6 +9,11 @@ interface CheckboxProps {
9
9
  id?: string;
10
10
  /** Id of the element that describes the checkbox, e.g. help or error text */
11
11
  'aria-describedby'?: string;
12
+ /** Names a checkbox that has no visible label, e.g. a row checkbox named for its row */
13
+ 'aria-label'?: string;
14
+ /** Mixed state, e.g. the header checkbox of a partly selected list. Shows a dash. A press calls `onChange(true)` and stays mixed until the parent sets `checked`. Does nothing while `checked` */
15
+ indeterminate?: boolean;
12
16
  }
13
- export default function Checkbox({ label, secondLabel, checked, onChange, disabled, id, 'aria-describedby': ariaDescribedBy, }: CheckboxProps): React.JSX.Element;
14
- export {};
17
+ /** The ref reaches the `<input>`, so a page can move focus to it */
18
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
19
+ export default Checkbox;
@@ -1,34 +1,58 @@
1
1
  'use client';
2
- import React, { useEffect, useState } from 'react';
2
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
3
3
  import { popTransition, stateTransition } from './sharedStyles';
4
- export default function Checkbox(_a) {
5
- var label = _a.label, secondLabel = _a.secondLabel, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, id = _a.id, ariaDescribedBy = _a["aria-describedby"];
6
- var _d = useState(checked), isChecked = _d[0], setIsChecked = _d[1];
7
- // Follow the parent when it changes `checked` (e.g. resetting a form)
8
- useEffect(function () {
4
+ /** The ref reaches the `<input>`, so a page can move focus to it */
5
+ var Checkbox = forwardRef(function Checkbox(_a, ref) {
6
+ var label = _a.label, secondLabel = _a.secondLabel, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, id = _a.id, ariaDescribedBy = _a["aria-describedby"], ariaLabel = _a["aria-label"], _d = _a.indeterminate, indeterminate = _d === void 0 ? false : _d;
7
+ var _e = useState(checked), isChecked = _e[0], setIsChecked = _e[1];
8
+ var inputRef = useRef(null);
9
+ var isMixed = indeterminate && !isChecked;
10
+ var filled = isChecked || isMixed;
11
+ // Follow the parent when it changes `checked` (e.g. resetting a form). Done while rendering, not in an
12
+ // effect, so the box never paints the old value first
13
+ var _f = useState(checked), lastChecked = _f[0], setLastChecked = _f[1];
14
+ if (checked !== lastChecked) {
15
+ setLastChecked(checked);
9
16
  setIsChecked(checked);
10
- }, [checked]);
17
+ }
18
+ // The DOM property is what browsers expose to assistive tech as mixed
19
+ useEffect(function () {
20
+ if (inputRef.current)
21
+ inputRef.current.indeterminate = isMixed;
22
+ }, [isMixed]);
11
23
  var handleChange = function (event) {
12
24
  if (disabled)
13
25
  return;
26
+ // While mixed, the parent decides: the box stays mixed until it sets `checked`
27
+ if (isMixed) {
28
+ event.target.indeterminate = true;
29
+ onChange === null || onChange === void 0 ? void 0 : onChange(event.target.checked);
30
+ return;
31
+ }
14
32
  setIsChecked(event.target.checked);
15
33
  onChange === null || onChange === void 0 ? void 0 : onChange(event.target.checked);
16
34
  };
17
35
  return (<label className={"group relative flex items-start ".concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>
18
36
  {/* Native input keeps keyboard focus, Space to toggle and screen-reader semantics */}
19
- <input type="checkbox" id={id} aria-describedby={ariaDescribedBy} className="peer sr-only" checked={isChecked} disabled={disabled} onChange={handleChange}/>
37
+ <input type="checkbox" ref={function (el) {
38
+ inputRef.current = el;
39
+ if (typeof ref === 'function')
40
+ ref(el);
41
+ else if (ref)
42
+ ref.current = el;
43
+ }} id={id} aria-describedby={ariaDescribedBy} aria-label={ariaLabel} data-indeterminate={isMixed ? 'true' : undefined} className="peer sr-only" checked={isChecked} disabled={disabled} onChange={handleChange}/>
20
44
  <span className={"relative flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full ".concat(stateTransition, "\n peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-0 peer-focus-visible:outline-fg-primary\n ").concat(disabled ? '' : 'group-hover:bg-action-selected')}>
21
45
  {/* Checkbox */}
22
46
  <span className={"relative w-4 h-4 border-2 rounded ".concat(stateTransition, " ").concat(disabled
23
- ? isChecked
47
+ ? filled
24
48
  ? 'bg-fg-disabled border-transparent'
25
49
  : 'border-fg-disabled'
26
- : isChecked
50
+ : filled
27
51
  ? 'bg-fg-primary border-transparent'
28
52
  : 'border-fg-secondary', " flex items-center justify-center")}>
29
- {/* Always rendered so the tick can scale in and out */}
30
- <svg className={"w-3 h-3 text-fg-contrast ".concat(popTransition, " ").concat(isChecked ? 'scale-100' : 'scale-0')} fill="none" stroke="currentColor" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" aria-hidden>
31
- <path strokeWidth="2" d="M1 6l4 3 6-7"/>
53
+ {/* Always rendered so the tick can scale in and out. The dash takes its place while mixed */}
54
+ <svg className={"w-3 h-3 text-fg-contrast ".concat(popTransition, " ").concat(filled ? 'scale-100' : 'scale-0')} fill="none" stroke="currentColor" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" aria-hidden>
55
+ <path strokeWidth="2" d={isMixed ? 'M2 6h8' : 'M1 6l4 3 6-7'}/>
32
56
  </svg>
33
57
  </span>
34
58
  </span>
@@ -45,4 +69,5 @@ export default function Checkbox(_a) {
45
69
  </span>)}
46
70
  </span>)}
47
71
  </label>);
48
- }
72
+ });
73
+ export default Checkbox;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { DiffLine } from '../internal/diff';
3
+ export type { DiffLine } from '../internal/diff';
4
+ export { diffLines } from '../internal/diff';
5
+ interface DiffProps {
6
+ /** Prefixes the id of the scroll region */
7
+ id: string;
8
+ /** Visible above the lines ('settings.ts'); it names the scroll region */
9
+ label: string;
10
+ /** The lines in order. `diffLines(before, after)` makes them from two texts. */
11
+ lines: DiffLine[];
12
+ /**
13
+ * The most lines the diff is tall; the rest scrolls inside it, in the same named region a keyboard can focus.
14
+ * Default none: the diff is as tall as its lines.
15
+ */
16
+ maxRows?: number;
17
+ /** Shown when no line changed, or there are no lines. Default 'No changes'. */
18
+ emptyText?: string;
19
+ /** Wrap long lines instead of scrolling them sideways. Default false. */
20
+ wrap?: boolean;
21
+ /** Draw each line's number in the old text and in the new text, before its mark. Default false. */
22
+ lineNumbers?: boolean;
23
+ }
24
+ /**
25
+ * The lines a change adds and removes, in a figure: a visible label, then a table in a named region. An added
26
+ * line has a quiet success fill and a removed line a quiet error fill, and each also has a `+` or `-` mark and
27
+ * hidden text 'Added: ' or 'Removed: ', so color is never the only sign. A long line scrolls inside the region,
28
+ * a Tab stop a keyboard can scroll; the page never does. When nothing changed it shows `emptyText` instead.
29
+ * `lineNumbers` adds the old and the new line number to each row, for eyes only.
30
+ */
31
+ export default function Diff({ id, label, lines, maxRows, emptyText, wrap, lineNumbers }: DiffProps): React.JSX.Element;
32
+ export { Diff };
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { focusRing } from './sharedStyles';
3
+ export { diffLines } from '../internal/diff';
4
+ var rowFill = { added: 'bg-success-alertBg', removed: 'bg-error-alertBg', same: '' };
5
+ var mark = { added: '+', removed: '-', same: '' };
6
+ // As wide as four digits, so the columns line up down the diff
7
+ var numberCell = 'w-[5ch] min-w-[5ch] select-none pl-2 text-right align-top tabular-nums text-fg-secondary';
8
+ var hidden = { added: 'Added: ', removed: 'Removed: ', same: '' };
9
+ /**
10
+ * The lines a change adds and removes, in a figure: a visible label, then a table in a named region. An added
11
+ * line has a quiet success fill and a removed line a quiet error fill, and each also has a `+` or `-` mark and
12
+ * hidden text 'Added: ' or 'Removed: ', so color is never the only sign. A long line scrolls inside the region,
13
+ * a Tab stop a keyboard can scroll; the page never does. When nothing changed it shows `emptyText` instead.
14
+ * `lineNumbers` adds the old and the new line number to each row, for eyes only.
15
+ */
16
+ export default function Diff(_a) {
17
+ var id = _a.id, label = _a.label, lines = _a.lines, maxRows = _a.maxRows, _b = _a.emptyText, emptyText = _b === void 0 ? 'No changes' : _b, _c = _a.wrap, wrap = _c === void 0 ? false : _c, _d = _a.lineNumbers, lineNumbers = _d === void 0 ? false : _d;
18
+ var changed = lines.some(function (line) { return line.kind !== 'same'; });
19
+ return (<figure className="m-0 grid w-full min-w-0 max-w-full gap-y-1">
20
+ <figcaption className="min-w-0 break-words text-caption text-fg-secondary">{label}</figcaption>
21
+ {changed ? (<div id={"".concat(id, "-diff")} tabIndex={0} role="region" aria-label={label}
22
+ // The height of that many lines; the rows have no padding of their own
23
+ style={maxRows ? { maxHeight: "calc(".concat(maxRows, "lh)") } : undefined} className={"max-w-full ".concat(maxRows ? 'overflow-auto' : 'overflow-x-auto', " rounded-control bg-background-panel font-mono text-body2 text-fg-primary ").concat(focusRing)}>
24
+ <table className={"border-collapse ".concat(wrap ? 'w-full table-fixed' : 'w-max min-w-full')}>
25
+ <tbody>
26
+ {lines.map(function (line, i) { return (<tr key={i} className={rowFill[line.kind]}>
27
+ {lineNumbers && (<>
28
+ <td aria-hidden="true" className={numberCell}>{line.oldNumber}</td>
29
+ <td aria-hidden="true" className={numberCell}>{line.newNumber}</td>
30
+ </>)}
31
+ <td aria-hidden="true" className="w-6 select-none px-2 text-center align-top">{mark[line.kind]}</td>
32
+ <td className={"pr-medium align-top ".concat(wrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre')}>
33
+ {line.kind !== 'same' && <span className="sr-only">{hidden[line.kind]}</span>}
34
+ {line.text === '' ? ' ' : line.text}
35
+ </td>
36
+ </tr>); })}
37
+ </tbody>
38
+ </table>
39
+ </div>) : (<p className="m-0 rounded-control bg-background-panel p-medium text-body2 text-fg-secondary">{emptyText}</p>)}
40
+ </figure>);
41
+ }
42
+ export { Diff };
@@ -12,11 +12,13 @@ interface SegmentedControlProps {
12
12
  size?: 'medium' | 'small' | 'tiny';
13
13
  /** `fill` takes the width of its container. `fit` is as wide as its options, for a control that sits beside a heading. */
14
14
  width?: 'fill' | 'fit';
15
+ /** Shows the value and takes no press and no focus, e.g. a setting only an admin can change. Say why beside it. */
16
+ disabled?: boolean;
15
17
  }
16
18
  /**
17
19
  * A row of options that sets one value on the same page, with the look of `TabsContainer fill`.
18
20
  * Use tabs to switch panels and this to change a value. Arrow keys move and select; only the
19
21
  * selected option is in the tab order.
20
22
  */
21
- export default function SegmentedControl({ options, value, onChange, 'aria-label': ariaLabel, size, width, }: SegmentedControlProps): React.JSX.Element;
23
+ export default function SegmentedControl({ options, value, onChange, 'aria-label': ariaLabel, size, width, disabled, }: SegmentedControlProps): React.JSX.Element;
22
24
  export { SegmentedControl };
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
  import React, { useRef } from 'react';
3
- import { SlidingPill, segmentIdleClasses, segmentItemClasses, segmentSelectedClasses, segmentSizes, segmentTrackClasses, segmentTrackStyle, useSlidingIndicator, } from './slidingIndicator';
3
+ import { SlidingPill, segmentDisabledIdleClasses, segmentDisabledSelectedClasses, segmentIdleClasses, segmentItemClasses, segmentSelectedClasses, segmentSizes, segmentTrackClasses, segmentTrackStyle, useSlidingIndicator, } from './slidingIndicator';
4
4
  /**
5
5
  * A row of options that sets one value on the same page, with the look of `TabsContainer fill`.
6
6
  * Use tabs to switch panels and this to change a value. Arrow keys move and select; only the
7
7
  * selected option is in the tab order.
8
8
  */
9
9
  export default function SegmentedControl(_a) {
10
- var options = _a.options, value = _a.value, onChange = _a.onChange, ariaLabel = _a["aria-label"], _b = _a.size, size = _b === void 0 ? 'medium' : _b, _c = _a.width, width = _c === void 0 ? 'fill' : _c;
11
- var _d = useSlidingIndicator(options), containerRef = _d.containerRef, indicator = _d.indicator;
10
+ var options = _a.options, value = _a.value, onChange = _a.onChange, ariaLabel = _a["aria-label"], _b = _a.size, size = _b === void 0 ? 'medium' : _b, _c = _a.width, width = _c === void 0 ? 'fill' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d;
11
+ var _e = useSlidingIndicator(options), containerRef = _e.containerRef, indicator = _e.indicator;
12
12
  var refs = useRef([]);
13
13
  var sizeClasses = segmentSizes[size];
14
14
  var selectedIndex = options.findIndex(function (o) { return o.value === value; });
@@ -37,13 +37,15 @@ export default function SegmentedControl(_a) {
37
37
  e.preventDefault();
38
38
  move(next);
39
39
  };
40
- return (<div ref={containerRef} role="radiogroup" aria-label={ariaLabel} onKeyDown={handleKeyDown} className={segmentTrackClasses(width === 'fill', options.length > 0)} style={segmentTrackStyle}>
41
- <SlidingPill indicator={indicator}/>
40
+ return (<div ref={containerRef} role="radiogroup" aria-label={ariaLabel} aria-disabled={disabled || undefined} onKeyDown={handleKeyDown} className={segmentTrackClasses(width === 'fill', options.length > 0)} style={segmentTrackStyle}>
41
+ <SlidingPill indicator={indicator} disabled={disabled}/>
42
42
  {options.map(function (option, i) {
43
43
  var selected = i === selectedIndex;
44
44
  return (<button key={option.value} ref={function (el) {
45
45
  refs.current[i] = el;
46
- }} type="button" role="radio" aria-checked={selected} tabIndex={i === tabStop ? 0 : -1} data-tab-selected={selected} onClick={function () { return onChange(option.value); }} className={segmentItemClasses(width === 'fill', sizeClasses.tab, selected ? segmentSelectedClasses : segmentIdleClasses)}>
46
+ }} type="button" role="radio" aria-checked={selected} tabIndex={i === tabStop ? 0 : -1} disabled={disabled || undefined} data-tab-selected={selected} onClick={function () { return onChange(option.value); }} className={segmentItemClasses(width === 'fill', sizeClasses.tab, disabled
47
+ ? (selected ? segmentDisabledSelectedClasses : segmentDisabledIdleClasses)
48
+ : (selected ? segmentSelectedClasses : segmentIdleClasses), disabled)}>
47
49
  <div className={"flex flex-col text-center ".concat(sizeClasses.label)}>
48
50
  <span className="whitespace-nowrap">{option.label}</span>
49
51
  </div>
@@ -10,7 +10,7 @@ type IndicatorRect = {
10
10
  export declare function segmentTrackClasses(fill: boolean, filled: boolean): string;
11
11
  export declare const segmentTrackStyle: React.CSSProperties;
12
12
  /** The classes every item has, selected or not */
13
- export declare function segmentItemClasses(fill: boolean, sizeClass: string, selectedClasses: string): string;
13
+ export declare function segmentItemClasses(fill: boolean, sizeClass: string, selectedClasses: string, disabled?: boolean): string;
14
14
  /** Item text and icon sizes. Items use `data-tab-selected="true"` on the selected one. */
15
15
  export declare const segmentSizes: {
16
16
  medium: {
@@ -34,6 +34,8 @@ export declare const segmentSizes: {
34
34
  };
35
35
  export declare const segmentSelectedClasses = "text-primary-contrast";
36
36
  export declare const segmentIdleClasses = "text-fg-primary hover:bg-background-accent200";
37
+ export declare const segmentDisabledSelectedClasses = "text-fg-contrast";
38
+ export declare const segmentDisabledIdleClasses = "text-fg-disabled";
37
39
  /**
38
40
  * Places a pill behind the item marked `data-tab-selected="true"` inside the container, keeps it
39
41
  * there as items resize, and scrolls a newly selected item into view. Pass the container's `ref`
@@ -44,7 +46,8 @@ export declare function useSlidingIndicator(children: unknown): {
44
46
  indicator: IndicatorRect | null;
45
47
  };
46
48
  /** The pill itself. Render it first inside the track. */
47
- export declare function SlidingPill({ indicator }: {
49
+ export declare function SlidingPill({ indicator, disabled }: {
48
50
  indicator: IndicatorRect | null;
51
+ disabled?: boolean;
49
52
  }): React.JSX.Element | null;
50
53
  export {};
@@ -15,7 +15,11 @@ export var segmentTrackStyle = {
15
15
  msOverflowStyle: 'none',
16
16
  };
17
17
  /** The classes every item has, selected or not */
18
- export function segmentItemClasses(fill, sizeClass, selectedClasses) {
18
+ export function segmentItemClasses(fill, sizeClass, selectedClasses, disabled) {
19
+ if (disabled === void 0) { disabled = false; }
20
+ if (disabled) {
21
+ return "\n relative flex items-center space-x-1 rounded-control cursor-not-allowed ".concat(fill ? 'flex-1 justify-center' : 'justify-start', "\n ").concat(sizeClass, "\n ").concat(selectedClasses, "\n ");
22
+ }
19
23
  return "\n relative flex items-center space-x-1 rounded-control cursor-pointer ".concat(fill ? 'flex-1 justify-center' : 'justify-start', " ").concat(stateTransition, " ").concat(pressFeedbackAny, " ").concat(focusRing, "\n ").concat(sizeClass, "\n ").concat(selectedClasses, "\n ");
20
24
  }
21
25
  /** Item text and icon sizes. Items use `data-tab-selected="true"` on the selected one. */
@@ -26,6 +30,8 @@ export var segmentSizes = {
26
30
  };
27
31
  export var segmentSelectedClasses = 'text-primary-contrast';
28
32
  export var segmentIdleClasses = 'text-fg-primary hover:bg-background-accent200';
33
+ export var segmentDisabledSelectedClasses = 'text-fg-contrast';
34
+ export var segmentDisabledIdleClasses = 'text-fg-disabled';
29
35
  /**
30
36
  * Places a pill behind the item marked `data-tab-selected="true"` inside the container, keeps it
31
37
  * there as items resize, and scrolls a newly selected item into view. Pass the container's `ref`
@@ -89,10 +95,10 @@ export function useSlidingIndicator(children) {
89
95
  }
90
96
  /** The pill itself. Render it first inside the track. */
91
97
  export function SlidingPill(_a) {
92
- var indicator = _a.indicator;
98
+ var indicator = _a.indicator, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
93
99
  if (!indicator)
94
100
  return null;
95
- return (<span aria-hidden className={"absolute rounded-control pointer-events-none bg-primary-dark\n ".concat(indicator.animate ? 'transition-[transform,width,height] duration-[var(--os-duration-slide)] ease-emphasized motion-reduce:transition-none' : '')} style={{
101
+ return (<span aria-hidden className={"absolute rounded-control pointer-events-none ".concat(disabled ? 'bg-fg-disabled' : 'bg-primary-dark', "\n ").concat(indicator.animate ? 'transition-[transform,width,height] duration-[var(--os-duration-slide)] ease-emphasized motion-reduce:transition-none' : '')} style={{
96
102
  top: 0,
97
103
  left: 0,
98
104
  transform: "translate(".concat(indicator.x, "px, ").concat(indicator.y, "px)"),
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface TableContainerProps {
3
3
  children: React.ReactNode;
4
- /** Names the table. Name it when it can overflow; a named table is a Tab stop. With a name the table sits in a scrollable `role="region"` of the same name that a keyboard can focus and scroll, for a table wider than a phone. */
4
+ /** Names the table. Name it when it can overflow; a named table is a Tab stop. With a name the table sits in a scrollable `role="region"` of the same name that a keyboard can focus and scroll, for a table wider than a phone. The scroll box is `relative`, so hidden text inside it (a `Link` with `announceNewTab`) scrolls with the table and never widens the page. */
5
5
  'aria-label'?: string;
6
6
  /** With `aria-label`: the width the table keeps, e.g. '640px', so its columns do not squeeze and the region scrolls sideways. Ignored without a name. */
7
7
  minWidth?: string;
@@ -4,13 +4,13 @@ import { focusRing } from './sharedStyles';
4
4
  export default function TableContainer(_a) {
5
5
  var children = _a.children, ariaLabel = _a["aria-label"], minWidth = _a.minWidth;
6
6
  if (ariaLabel) {
7
- return (<div role="region" aria-label={ariaLabel} tabIndex={0} className={"w-full overflow-x-auto bg-background-default rounded-control ".concat(focusRing)}>
7
+ return (<div role="region" aria-label={ariaLabel} tabIndex={0} className={"relative w-full overflow-x-auto bg-background-default rounded-control ".concat(focusRing)}>
8
8
  <div role="table" aria-label={ariaLabel} className="w-full bg-background-default" style={minWidth ? { minWidth: minWidth } : undefined}>
9
9
  {children}
10
10
  </div>
11
11
  </div>);
12
12
  }
13
- return (<div role="table" className="w-full overflow-x-auto bg-background-default">
13
+ return (<div role="table" className="relative w-full overflow-x-auto bg-background-default">
14
14
  {children}
15
15
  </div>);
16
16
  }
@@ -5,6 +5,8 @@ interface TimeStampProps {
5
5
  textSize?: 'small' | 'medium' | 'large';
6
6
  textColor?: 'secondary' | 'primary';
7
7
  data?: 'date-and-time' | 'date' | 'time';
8
+ /** With `absolute`: `'24'` prints 14:40 and `'12'` prints 2:40 PM. Default `'24'`. */
9
+ hourCycle?: '24' | '12';
8
10
  }
9
- export default function TimeStamp({ createdAt, dateFormat, textSize, textColor, data, }: TimeStampProps): React.JSX.Element;
11
+ export default function TimeStamp({ createdAt, dateFormat, textSize, textColor, data, hourCycle, }: TimeStampProps): React.JSX.Element;
10
12
  export {};
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
  export default function TimeStamp(_a) {
4
- var createdAt = _a.createdAt, dateFormat = _a.dateFormat, _b = _a.textSize, textSize = _b === void 0 ? 'small' : _b, _c = _a.textColor, textColor = _c === void 0 ? 'secondary' : _c, _d = _a.data, data = _d === void 0 ? 'date-and-time' : _d;
4
+ var createdAt = _a.createdAt, dateFormat = _a.dateFormat, _b = _a.textSize, textSize = _b === void 0 ? 'small' : _b, _c = _a.textColor, textColor = _c === void 0 ? 'secondary' : _c, _d = _a.data, data = _d === void 0 ? 'date-and-time' : _d, _e = _a.hourCycle, hourCycle = _e === void 0 ? '24' : _e;
5
5
  // absolute timestamp
6
6
  var absoluteTimeStamp = function (createdAt) {
7
7
  var date = new Date(createdAt);
@@ -15,7 +15,9 @@ export default function TimeStamp(_a) {
15
15
  var daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
16
16
  var dayOfWeek = daysOfWeek[date.getDay()];
17
17
  var dateString = "".concat(month, "/").concat(day, "/").concat(year, " ").concat(dayOfWeek);
18
- var timeString = "".concat(formattedHours, ":").concat(formattedMinutes);
18
+ var timeString = hourCycle === '12'
19
+ ? "".concat(hours % 12 || 12, ":").concat(formattedMinutes, " ").concat(hours < 12 ? 'AM' : 'PM')
20
+ : "".concat(formattedHours, ":").concat(formattedMinutes);
19
21
  if (data === 'date') {
20
22
  return dateString;
21
23
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * True when the visitor asks for reduced motion, and it follows the setting as it changes.
3
+ * True on the server and while hydrating, so motion that starts by itself waits for the browser's answer.
4
+ * CSS motion already stops with `motion-reduce:`; use this for motion a script starts, such as a demo that plays on open.
5
+ */
6
+ export default function useReducedMotion(): boolean;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { useSyncExternalStore } from 'react';
3
+ var QUERY = '(prefers-reduced-motion: reduce)';
4
+ var subscribe = function (onChange) {
5
+ var mq = window.matchMedia ? window.matchMedia(QUERY) : null;
6
+ mq === null || mq === void 0 ? void 0 : mq.addEventListener('change', onChange);
7
+ return function () { return mq === null || mq === void 0 ? void 0 : mq.removeEventListener('change', onChange); };
8
+ };
9
+ var fromBrowser = function () { return (window.matchMedia ? window.matchMedia(QUERY).matches : false); };
10
+ // A server cannot know, so it takes the safe side: nothing moves until the browser says it may
11
+ var onServer = function () { return true; };
12
+ /**
13
+ * True when the visitor asks for reduced motion, and it follows the setting as it changes.
14
+ * True on the server and while hydrating, so motion that starts by itself waits for the browser's answer.
15
+ * CSS motion already stops with `motion-reduce:`; use this for motion a script starts, such as a demo that plays on open.
16
+ */
17
+ export default function useReducedMotion() {
18
+ return useSyncExternalStore(subscribe, fromBrowser, onServer);
19
+ }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './components/button';
6
6
  export * from './components/checkBox';
7
7
  export * from './components/codeBlock';
8
8
  export * from './components/copyField';
9
+ export * from './components/diff';
9
10
  export * from './components/drawer';
10
11
  export * from './components/emptyBox';
11
12
  export * from './components/formField';
@@ -52,3 +53,4 @@ export * from './components/tooltip';
52
53
  export * from './components/userImage';
53
54
  export { default as useDarkMode, resolveDarkMode } from './components/useDarkMode';
54
55
  export { default as useHotkey } from './components/useHotkey';
56
+ export { default as useReducedMotion } from './components/useReducedMotion';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './components/button';
6
6
  export * from './components/checkBox';
7
7
  export * from './components/codeBlock';
8
8
  export * from './components/copyField';
9
+ export * from './components/diff';
9
10
  export * from './components/drawer';
10
11
  export * from './components/emptyBox';
11
12
  export * from './components/formField';
@@ -52,3 +53,4 @@ export * from './components/tooltip';
52
53
  export * from './components/userImage';
53
54
  export { default as useDarkMode, resolveDarkMode } from './components/useDarkMode';
54
55
  export { default as useHotkey } from './components/useHotkey';
56
+ export { default as useReducedMotion } from './components/useReducedMotion';
@@ -0,0 +1,17 @@
1
+ export type DiffKind = 'added' | 'removed' | 'same';
2
+ export interface DiffLine {
3
+ kind: DiffKind;
4
+ text: string;
5
+ /** The line's number in the old text; not on an added line */
6
+ oldNumber?: number;
7
+ /** The line's number in the new text; not on a removed line */
8
+ newNumber?: number;
9
+ }
10
+ /** Past this many lines on either side nothing is matched, so the work stays small */
11
+ export declare const MAX_DIFF_LINES = 2000;
12
+ /**
13
+ * A line-based diff by longest common subsequence. A removed line comes before the added line that replaces it.
14
+ * A trailing newline adds no empty line, and `\r\n` and `\n` are the same line end.
15
+ * Past 2,000 lines on either side every old line is removed and every new line is added.
16
+ */
17
+ export declare function diffLines(before: string, after: string): DiffLine[];
@@ -0,0 +1,44 @@
1
+ /** Past this many lines on either side nothing is matched, so the work stays small */
2
+ export var MAX_DIFF_LINES = 2000;
3
+ // One trailing newline ends the last line and adds none. Windows line ends count as one
4
+ var split = function (text) { return (text === '' ? [] : text.replace(/\r?\n$/, '').split(/\r?\n/)); };
5
+ /**
6
+ * A line-based diff by longest common subsequence. A removed line comes before the added line that replaces it.
7
+ * A trailing newline adds no empty line, and `\r\n` and `\n` are the same line end.
8
+ * Past 2,000 lines on either side every old line is removed and every new line is added.
9
+ */
10
+ export function diffLines(before, after) {
11
+ var a = split(before);
12
+ var b = split(after);
13
+ var out = [];
14
+ if (a.length > MAX_DIFF_LINES || b.length > MAX_DIFF_LINES) {
15
+ a.forEach(function (text, i) { return out.push({ kind: 'removed', text: text, oldNumber: i + 1 }); });
16
+ b.forEach(function (text, i) { return out.push({ kind: 'added', text: text, newNumber: i + 1 }); });
17
+ return out;
18
+ }
19
+ // lcs[i][j]: the longest common run of a[i..] and b[j..]
20
+ var lcs = Array.from({ length: a.length + 1 }, function () { return new Array(b.length + 1).fill(0); });
21
+ for (var i_1 = a.length - 1; i_1 >= 0; i_1--) {
22
+ for (var j_1 = b.length - 1; j_1 >= 0; j_1--) {
23
+ lcs[i_1][j_1] = a[i_1] === b[j_1] ? lcs[i_1 + 1][j_1 + 1] + 1 : Math.max(lcs[i_1 + 1][j_1], lcs[i_1][j_1 + 1]);
24
+ }
25
+ }
26
+ var i = 0;
27
+ var j = 0;
28
+ while (i < a.length || j < b.length) {
29
+ if (i < a.length && j < b.length && a[i] === b[j]) {
30
+ out.push({ kind: 'same', text: a[i], oldNumber: i + 1, newNumber: j + 1 });
31
+ i++;
32
+ j++;
33
+ }
34
+ else if (i < a.length && (j === b.length || lcs[i + 1][j] >= lcs[i][j + 1])) {
35
+ out.push({ kind: 'removed', text: a[i], oldNumber: i + 1 });
36
+ i++;
37
+ }
38
+ else {
39
+ out.push({ kind: 'added', text: b[j], newNumber: j + 1 });
40
+ j++;
41
+ }
42
+ }
43
+ return out;
44
+ }
@@ -55,8 +55,9 @@
55
55
  },
56
56
  {
57
57
  "ods": "checkBox",
58
- "swiftui": "`Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS)",
59
- "compose": "`Checkbox`"
58
+ "swiftui": "`Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS); `Toggle(sources:isOn:)` over the rows for a mixed header",
59
+ "compose": "`Checkbox`; `TriStateCheckbox` with `ToggleableState.Indeterminate` for a mixed header",
60
+ "note": "The mixed state (`indeterminate`) is for a header over a partly selected list. A press selects every row. The iOS switch draws no mixed state, so say the count beside it, such as '2 of 3 selected'."
60
61
  },
61
62
  {
62
63
  "ods": "codeBlock",
@@ -82,6 +83,12 @@
82
83
  "compose": "`DatePicker` in a `DatePickerDialog`, opened from a read-only `OutlinedTextField`, with `selectableDates` for the range",
83
84
  "note": "The system picker cannot hold a day outside the range, so there is no out-of-range message. Store the day as `YYYY-MM-DD`, not a time."
84
85
  },
86
+ {
87
+ "ods": "diff",
88
+ "swiftui": "A `ScrollView([.horizontal, .vertical])` of a `LazyVStack` of rows: a `Text(\"+\")` or `Text(\"-\")` mark, then the line `.monospaced()`, with `.accessibilityLabel(\"Added: …\")` or `\"Removed: …\"`",
89
+ "compose": "A `LazyColumn` in a `horizontalScroll` of rows: a mark `Text`, then the line in the code family, with `semantics { contentDescription = \"Added: …\" }` or `\"Removed: …\"`",
90
+ "note": "No system control shows a diff, so it is a monospaced text view with a mark on each row. Added lines use the `success` fill and removed lines the `error` fill, quiet, with primary text. The mark and the spoken word say it too, never color alone. No change shows the empty text."
91
+ },
85
92
  {
86
93
  "ods": "drawer",
87
94
  "swiftui": "`.sheet` with `.presentationDetents` on iPhone; `.inspector` on iPad and Mac",
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import AgentPermissionsLevels from "../cases/agent-permissions/levels";
3
+ declare const meta: Meta<typeof AgentPermissionsLevels>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof AgentPermissionsLevels>;
6
+ export declare const LevelsMemberProbe: Story;
7
+ export declare const PerToolMemberProbe: Story;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import AgentPermissionsLevels from "../cases/agent-permissions/levels";
3
+ import AgentPermissionsPerTool from "../cases/agent-permissions/per-tool";
4
+ var meta = {
5
+ title: "AgentPermissions",
6
+ component: AgentPermissionsLevels,
7
+ };
8
+ export default meta;
9
+ // For tests/interactions.spec.ts only: a member's view, who cannot change the settings
10
+ export var LevelsMemberProbe = {
11
+ tags: ["!dev", "!autodocs", "test-only"],
12
+ render: function () { return <AgentPermissionsLevels canChange={false}/>; },
13
+ };
14
+ // For tests/interactions.spec.ts only: a member's view, who cannot change the tools
15
+ export var PerToolMemberProbe = {
16
+ tags: ["!dev", "!autodocs", "test-only"],
17
+ render: function () { return <AgentPermissionsPerTool canChange={false}/>; },
18
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import AgentRunFailureStepFailed from "../cases/agent-run-failure/step-failed";
3
+ declare const meta: Meta<typeof AgentRunFailureStepFailed>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof AgentRunFailureStepFailed>;
6
+ export declare const StepFailedProbe: Story;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import AgentRunFailureStepFailed from "../cases/agent-run-failure/step-failed";
3
+ var meta = {
4
+ title: "AgentRunFailure",
5
+ component: AgentRunFailureStepFailed,
6
+ };
7
+ export default meta;
8
+ // For tests/interactions.spec.ts only: the run starts at step 1 and fails at step 3, so focus moves when it stops
9
+ export var StepFailedProbe = {
10
+ tags: ["!dev", "!autodocs", "test-only"],
11
+ render: function () { return <AgentRunFailureStepFailed live/>; },
12
+ };