oneslash-design-system 2.16.0 → 2.18.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 (301) hide show
  1. package/README.md +2 -2
  2. package/dist/DESIGN.md +56 -17
  3. package/dist/cases/accept-invite/signed-in.jsx +1 -1
  4. package/dist/cases/accept-invite/signed-out.jsx +1 -1
  5. package/dist/cases/accept-invite.md +3 -7
  6. package/dist/cases/account-menu/menu.d.ts +1 -0
  7. package/dist/cases/account-menu/menu.jsx +99 -0
  8. package/dist/cases/account-menu.md +164 -0
  9. package/dist/cases/agent-asks-before-risky-action.md +0 -4
  10. package/dist/cases/agent-cancels-when-unanswered.md +0 -4
  11. package/dist/cases/agent-options/cards.d.ts +1 -0
  12. package/dist/cases/agent-options/cards.jsx +91 -0
  13. package/dist/cases/agent-options.md +164 -0
  14. package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
  15. package/dist/cases/agent-pending-reply/steps.jsx +149 -0
  16. package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
  17. package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
  18. package/dist/cases/agent-pending-reply.md +428 -0
  19. package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
  20. package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
  21. package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
  22. package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
  23. package/dist/cases/agent-plan-proposal.md +652 -0
  24. package/dist/cases/agent-question/choices.d.ts +1 -0
  25. package/dist/cases/agent-question/choices.jsx +132 -0
  26. package/dist/cases/agent-question/free-text.d.ts +1 -0
  27. package/dist/cases/agent-question/free-text.jsx +81 -0
  28. package/dist/cases/agent-question.md +334 -0
  29. package/dist/cases/agent-refuses-clearly.md +0 -4
  30. package/dist/cases/agent-says-what-it-is.md +0 -2
  31. package/dist/cases/agent-settings/form.d.ts +1 -0
  32. package/dist/cases/agent-settings/form.jsx +164 -0
  33. package/dist/cases/agent-settings.md +259 -0
  34. package/dist/cases/agent-shows-progress.md +0 -2
  35. package/dist/cases/agent-shows-sources.md +2 -4
  36. package/dist/cases/api-keys/list.d.ts +1 -0
  37. package/dist/cases/api-keys/list.jsx +162 -0
  38. package/dist/cases/api-keys.md +229 -0
  39. package/dist/cases/artifact-card/card.d.ts +1 -0
  40. package/dist/cases/artifact-card/card.jsx +45 -0
  41. package/dist/cases/artifact-card.md +99 -0
  42. package/dist/cases/auth-gate-loading.md +0 -4
  43. package/dist/cases/check-your-email.md +0 -4
  44. package/dist/cases/collapsible-search/popover.d.ts +1 -0
  45. package/dist/cases/collapsible-search/popover.jsx +74 -0
  46. package/dist/cases/collapsible-search.md +143 -0
  47. package/dist/cases/composer-limit/notice-with-action.d.ts +1 -0
  48. package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
  49. package/dist/cases/composer-limit/notice.d.ts +1 -0
  50. package/dist/cases/composer-limit/notice.jsx +84 -0
  51. package/dist/cases/composer-limit.md +282 -0
  52. package/dist/cases/confirm-destructive-action.md +0 -4
  53. package/dist/cases/confirm-dialogs.md +0 -4
  54. package/dist/cases/conversation-starters/chips.d.ts +1 -0
  55. package/dist/cases/conversation-starters/chips.jsx +69 -0
  56. package/dist/cases/conversation-starters/none.d.ts +1 -0
  57. package/dist/cases/conversation-starters/none.jsx +45 -0
  58. package/dist/cases/conversation-starters.md +204 -0
  59. package/dist/cases/create-modal.md +0 -4
  60. package/dist/cases/danger-zone/collapsed.d.ts +1 -0
  61. package/dist/cases/danger-zone/collapsed.jsx +75 -0
  62. package/dist/cases/danger-zone/shown.d.ts +1 -0
  63. package/dist/cases/danger-zone/shown.jsx +95 -0
  64. package/dist/cases/danger-zone.md +263 -0
  65. package/dist/cases/device-login.md +0 -4
  66. package/dist/cases/email-confirmed.md +0 -4
  67. package/dist/cases/empty-list.md +0 -4
  68. package/dist/cases/empty-lists.md +0 -4
  69. package/dist/cases/empty-not-set-up.md +0 -4
  70. package/dist/cases/empty-search.md +0 -4
  71. package/dist/cases/error-page.md +0 -4
  72. package/dist/cases/feedback-form.md +0 -4
  73. package/dist/cases/filter-menu/presets.d.ts +1 -0
  74. package/dist/cases/filter-menu/presets.jsx +53 -0
  75. package/dist/cases/filter-menu/with-clear.d.ts +1 -0
  76. package/dist/cases/filter-menu/with-clear.jsx +56 -0
  77. package/dist/cases/filter-menu.md +204 -0
  78. package/dist/cases/forgot-password.md +0 -4
  79. package/dist/cases/form-errors.md +0 -4
  80. package/dist/cases/import-checklist.md +0 -4
  81. package/dist/cases/inline-form-feedback.md +0 -4
  82. package/dist/cases/integrations-list/nested.d.ts +1 -0
  83. package/dist/cases/integrations-list/nested.jsx +164 -0
  84. package/dist/cases/integrations-list/rows.d.ts +1 -0
  85. package/dist/cases/integrations-list/rows.jsx +134 -0
  86. package/dist/cases/integrations-list.md +379 -0
  87. package/dist/cases/invite-member.md +0 -4
  88. package/dist/cases/load-failure.md +0 -4
  89. package/dist/cases/log-out-confirm.md +0 -4
  90. package/dist/cases/login-page.md +0 -4
  91. package/dist/cases/members-list/rows.d.ts +1 -0
  92. package/dist/cases/members-list/rows.jsx +318 -0
  93. package/dist/cases/members-list/table.d.ts +1 -0
  94. package/dist/cases/members-list/table.jsx +351 -0
  95. package/dist/cases/members-list.md +799 -0
  96. package/dist/cases/mention-list/in-composer.d.ts +1 -0
  97. package/dist/cases/mention-list/in-composer.jsx +169 -0
  98. package/dist/cases/mention-list.md +248 -0
  99. package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
  100. package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
  101. package/dist/cases/message-actions/menu.d.ts +1 -0
  102. package/dist/cases/message-actions/menu.jsx +258 -0
  103. package/dist/cases/message-actions.md +647 -0
  104. package/dist/cases/message-attachments/in-composer.d.ts +1 -0
  105. package/dist/cases/message-attachments/in-composer.jsx +134 -0
  106. package/dist/cases/message-attachments/in-message.d.ts +1 -0
  107. package/dist/cases/message-attachments/in-message.jsx +46 -0
  108. package/dist/cases/message-attachments.md +306 -0
  109. package/dist/cases/message-composer/plain.d.ts +1 -0
  110. package/dist/cases/message-composer/plain.jsx +57 -0
  111. package/dist/cases/message-composer/with-tools.d.ts +1 -0
  112. package/dist/cases/message-composer/with-tools.jsx +182 -0
  113. package/dist/cases/message-composer.md +352 -0
  114. package/dist/cases/message-edit/in-place.d.ts +1 -0
  115. package/dist/cases/message-edit/in-place.jsx +99 -0
  116. package/dist/cases/message-edit.md +175 -0
  117. package/dist/cases/message-reactions/chips.d.ts +1 -0
  118. package/dist/cases/message-reactions/chips.jsx +118 -0
  119. package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
  120. package/dist/cases/message-reactions/quick-pick.jsx +155 -0
  121. package/dist/cases/message-reactions.md +367 -0
  122. package/dist/cases/message-row/grouped.d.ts +1 -0
  123. package/dist/cases/message-row/grouped.jsx +56 -0
  124. package/dist/cases/message-row/person-and-agent.d.ts +1 -0
  125. package/dist/cases/message-row/person-and-agent.jsx +41 -0
  126. package/dist/cases/message-row.md +185 -0
  127. package/dist/cases/not-found-page.md +0 -4
  128. package/dist/cases/notification-menu/menu.d.ts +1 -0
  129. package/dist/cases/notification-menu/menu.jsx +74 -0
  130. package/dist/cases/notification-menu.md +135 -0
  131. package/dist/cases/oauth-consent.md +0 -4
  132. package/dist/cases/on-off-settings/list.d.ts +1 -0
  133. package/dist/cases/on-off-settings/list.jsx +97 -0
  134. package/dist/cases/on-off-settings.md +116 -0
  135. package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
  136. package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
  137. package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
  138. package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
  139. package/dist/cases/overflow-menu.md +410 -0
  140. package/dist/cases/profile-form/form.d.ts +1 -0
  141. package/dist/cases/profile-form/form.jsx +153 -0
  142. package/dist/cases/profile-form.md +236 -0
  143. package/dist/cases/quick-switcher/modal.d.ts +1 -0
  144. package/dist/cases/quick-switcher/modal.jsx +114 -0
  145. package/dist/cases/quick-switcher.md +205 -0
  146. package/dist/cases/range-switch/segmented.d.ts +1 -0
  147. package/dist/cases/range-switch/segmented.jsx +30 -0
  148. package/dist/cases/range-switch.md +67 -0
  149. package/dist/cases/rename.md +0 -4
  150. package/dist/cases/reply-feedback/thumbs.d.ts +1 -0
  151. package/dist/cases/reply-feedback/thumbs.jsx +191 -0
  152. package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
  153. package/dist/cases/reply-feedback/with-reason.jsx +221 -0
  154. package/dist/cases/reply-feedback.md +548 -0
  155. package/dist/cases/reply-sources/cards.d.ts +1 -0
  156. package/dist/cases/reply-sources/cards.jsx +83 -0
  157. package/dist/cases/reply-sources/tag-only.d.ts +1 -0
  158. package/dist/cases/reply-sources/tag-only.jsx +45 -0
  159. package/dist/cases/reply-sources.md +243 -0
  160. package/dist/cases/route-loading.md +0 -2
  161. package/dist/cases/scope-picker/menu.d.ts +1 -0
  162. package/dist/cases/scope-picker/menu.jsx +47 -0
  163. package/dist/cases/scope-picker.md +97 -0
  164. package/dist/cases/set-new-password.md +0 -4
  165. package/dist/cases/settings-page/side-nav.d.ts +1 -0
  166. package/dist/cases/settings-page/side-nav.jsx +171 -0
  167. package/dist/cases/settings-page/top-tabs.d.ts +1 -0
  168. package/dist/cases/settings-page/top-tabs.jsx +129 -0
  169. package/dist/cases/settings-page.md +378 -0
  170. package/dist/cases/settings-save.md +35 -0
  171. package/dist/cases/sign-up-page.md +1 -5
  172. package/dist/cases/slash-command-list/in-composer.d.ts +1 -0
  173. package/dist/cases/slash-command-list/in-composer.jsx +162 -0
  174. package/dist/cases/slash-command-list.md +243 -0
  175. package/dist/cases/success-feedback.md +1 -5
  176. package/dist/cases/tag-filter/tags.d.ts +1 -0
  177. package/dist/cases/tag-filter/tags.jsx +226 -0
  178. package/dist/cases/tag-filter.md +298 -0
  179. package/dist/cases/type-to-confirm.md +0 -4
  180. package/dist/cases/typing-and-status/line.d.ts +1 -0
  181. package/dist/cases/typing-and-status/line.jsx +50 -0
  182. package/dist/cases/typing-and-status.md +92 -0
  183. package/dist/cases/unsaved-changes-guard.md +0 -4
  184. package/dist/cases/upgrade-prompt.md +0 -4
  185. package/dist/cases.json +2331 -294
  186. package/dist/components/alert.d.ts +3 -1
  187. package/dist/components/alert.jsx +2 -2
  188. package/dist/components/button.d.ts +3 -2
  189. package/dist/components/button.jsx +14 -9
  190. package/dist/components/checkBox.d.ts +5 -1
  191. package/dist/components/checkBox.jsx +2 -2
  192. package/dist/components/composer.d.ts +74 -0
  193. package/dist/components/composer.jsx +122 -0
  194. package/dist/components/copyField.d.ts +20 -0
  195. package/dist/components/copyField.jsx +99 -0
  196. package/dist/components/fileChip.d.ts +33 -0
  197. package/dist/components/fileChip.jsx +61 -0
  198. package/dist/components/formField.d.ts +34 -0
  199. package/dist/components/formField.jsx +28 -0
  200. package/dist/components/heading.d.ts +3 -1
  201. package/dist/components/heading.jsx +2 -2
  202. package/dist/components/iconButton.d.ts +3 -3
  203. package/dist/components/iconButton.jsx +9 -7
  204. package/dist/components/layout.d.ts +7 -1
  205. package/dist/components/layout.jsx +5 -2
  206. package/dist/components/menu.d.ts +21 -0
  207. package/dist/components/menu.jsx +27 -3
  208. package/dist/components/menuItem.d.ts +12 -2
  209. package/dist/components/menuItem.jsx +6 -5
  210. package/dist/components/message.d.ts +28 -0
  211. package/dist/components/message.jsx +25 -0
  212. package/dist/components/navigation.d.ts +9 -1
  213. package/dist/components/navigation.jsx +15 -3
  214. package/dist/components/paragraph.d.ts +3 -1
  215. package/dist/components/paragraph.jsx +2 -2
  216. package/dist/components/popover.d.ts +7 -1
  217. package/dist/components/popover.jsx +35 -9
  218. package/dist/components/radioGroup.d.ts +12 -1
  219. package/dist/components/radioGroup.jsx +20 -9
  220. package/dist/components/segmentedControl.d.ts +22 -0
  221. package/dist/components/segmentedControl.jsx +54 -0
  222. package/dist/components/select.d.ts +5 -1
  223. package/dist/components/select.jsx +2 -2
  224. package/dist/components/settingsSection.d.ts +31 -0
  225. package/dist/components/settingsSection.jsx +58 -0
  226. package/dist/components/slidingIndicator.d.ts +50 -0
  227. package/dist/components/slidingIndicator.jsx +102 -0
  228. package/dist/components/sourceCard.d.ts +23 -0
  229. package/dist/components/sourceCard.jsx +56 -0
  230. package/dist/components/stepList.d.ts +17 -0
  231. package/dist/components/stepList.jsx +79 -0
  232. package/dist/components/switch.d.ts +25 -0
  233. package/dist/components/switch.jsx +55 -0
  234. package/dist/components/tab.jsx +5 -11
  235. package/dist/components/tabsContainer.jsx +5 -67
  236. package/dist/components/tag.d.ts +9 -1
  237. package/dist/components/tag.jsx +6 -4
  238. package/dist/components/textField.d.ts +12 -2
  239. package/dist/components/textField.jsx +11 -4
  240. package/dist/components/textarea.d.ts +5 -1
  241. package/dist/components/textarea.jsx +6 -21
  242. package/dist/components/useHotkey.d.ts +7 -0
  243. package/dist/components/useHotkey.js +24 -0
  244. package/dist/components/userImage.d.ts +9 -1
  245. package/dist/components/userImage.jsx +10 -3
  246. package/dist/index.d.ts +6 -0
  247. package/dist/index.js +6 -0
  248. package/dist/internal/autoGrow.d.ts +11 -0
  249. package/dist/internal/autoGrow.js +28 -0
  250. package/dist/internal/composer.d.ts +16 -0
  251. package/dist/internal/composer.js +18 -0
  252. package/dist/internal/copyField.d.ts +5 -0
  253. package/dist/internal/copyField.js +61 -0
  254. package/dist/internal/hotkey.d.ts +16 -0
  255. package/dist/internal/hotkey.js +20 -0
  256. package/dist/internal/menu.d.ts +6 -0
  257. package/dist/internal/menu.js +31 -0
  258. package/dist/internal/switch.d.ts +5 -0
  259. package/dist/internal/switch.js +9 -0
  260. package/dist/native-mapping.json +62 -1
  261. package/dist/stories/Button.stories.d.ts +1 -0
  262. package/dist/stories/Button.stories.jsx +17 -1
  263. package/dist/stories/Cases.generated.stories.d.ts +53 -0
  264. package/dist/stories/Cases.generated.stories.jsx +106 -0
  265. package/dist/stories/Composer.stories.d.ts +23 -0
  266. package/dist/stories/Composer.stories.jsx +121 -0
  267. package/dist/stories/CopyField.stories.d.ts +11 -0
  268. package/dist/stories/CopyField.stories.jsx +65 -0
  269. package/dist/stories/FileChip.stories.d.ts +7 -0
  270. package/dist/stories/FileChip.stories.jsx +35 -0
  271. package/dist/stories/FormField.stories.d.ts +6 -0
  272. package/dist/stories/FormField.stories.jsx +44 -0
  273. package/dist/stories/IconButton.stories.d.ts +1 -0
  274. package/dist/stories/IconButton.stories.jsx +18 -1
  275. package/dist/stories/Menu.stories.d.ts +4 -0
  276. package/dist/stories/Menu.stories.jsx +46 -1
  277. package/dist/stories/MenuItem.stories.d.ts +1 -0
  278. package/dist/stories/MenuItem.stories.jsx +8 -0
  279. package/dist/stories/Message.stories.d.ts +10 -0
  280. package/dist/stories/Message.stories.jsx +77 -0
  281. package/dist/stories/Navigation.stories.d.ts +1 -0
  282. package/dist/stories/Navigation.stories.jsx +17 -1
  283. package/dist/stories/PageComponents.stories.d.ts +1 -0
  284. package/dist/stories/PageComponents.stories.jsx +21 -0
  285. package/dist/stories/RadioGroup.stories.d.ts +2 -0
  286. package/dist/stories/RadioGroup.stories.jsx +40 -1
  287. package/dist/stories/SegmentedControl.stories.d.ts +8 -0
  288. package/dist/stories/SegmentedControl.stories.jsx +33 -0
  289. package/dist/stories/SettingsSection.stories.d.ts +11 -0
  290. package/dist/stories/SettingsSection.stories.jsx +64 -0
  291. package/dist/stories/SourceCard.stories.d.ts +8 -0
  292. package/dist/stories/SourceCard.stories.jsx +33 -0
  293. package/dist/stories/StepList.stories.d.ts +8 -0
  294. package/dist/stories/StepList.stories.jsx +35 -0
  295. package/dist/stories/Switch.stories.d.ts +14 -0
  296. package/dist/stories/Switch.stories.jsx +87 -0
  297. package/dist/stories/TextField.stories.d.ts +1 -0
  298. package/dist/stories/TextField.stories.jsx +13 -0
  299. package/dist/stories/UserImage.stories.d.ts +2 -0
  300. package/dist/stories/UserImage.stories.jsx +19 -0
  301. package/package.json +8 -3
@@ -14,7 +14,11 @@ interface SelectProps {
14
14
  width?: number | string;
15
15
  multiple?: boolean;
16
16
  className?: string;
17
+ /** On the combobox element, so a `FormField` label and help text can point at it */
18
+ id?: string;
17
19
  'aria-label'?: string;
20
+ /** Id of the element that describes the select, e.g. help or error text */
21
+ 'aria-describedby'?: string;
18
22
  }
19
- export default function Select({ value, options, onChange, disabled, placeholder, decoIconName, width, multiple, className, 'aria-label': ariaLabel, }: SelectProps): React.JSX.Element;
23
+ export default function Select({ value, options, onChange, disabled, placeholder, decoIconName, width, multiple, className, id, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }: SelectProps): React.JSX.Element;
20
24
  export { Select };
@@ -42,7 +42,7 @@ var popperOptions = {
42
42
  };
43
43
  export default function Select(_a) {
44
44
  var _b, _c;
45
- var value = _a.value, options = _a.options, onChange = _a.onChange, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? 'Label' : _e, decoIconName = _a.decoIconName, width = _a.width, _f = _a.multiple, multiple = _f === void 0 ? false : _f, _g = _a.className, className = _g === void 0 ? '' : _g, ariaLabel = _a["aria-label"];
45
+ var value = _a.value, options = _a.options, onChange = _a.onChange, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? 'Label' : _e, decoIconName = _a.decoIconName, width = _a.width, _f = _a.multiple, multiple = _f === void 0 ? false : _f, _g = _a.className, className = _g === void 0 ? '' : _g, id = _a.id, ariaLabel = _a["aria-label"], ariaDescribedBy = _a["aria-describedby"];
46
46
  var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
47
47
  // Option highlighted by the keyboard; focus itself stays on the trigger
48
48
  var _j = useState(-1), activeIndex = _j[0], setActiveIndex = _j[1];
@@ -210,7 +210,7 @@ export default function Select(_a) {
210
210
  };
211
211
  return (<div className={"relative ".concat(className)} style={{ width: width || '100%' }}>
212
212
  {/* Select Button */}
213
- <div ref={setTrigger} role="combobox" aria-label={ariaLabel} aria-haspopup="listbox" aria-expanded={isOpen} aria-controls={listboxId} aria-activedescendant={isOpen && activeIndex >= 0 ? optionId(activeIndex) : undefined} aria-disabled={disabled || undefined} className={"\n rounded-control\n ".concat(getStateStyles(), "\n ").concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer', "\n ").concat(stateTransition, "\n ").concat(focusRing, "\n ")} onClick={handleToggle} tabIndex={disabled ? -1 : 0} onKeyDown={handleKeyDown}>
213
+ <div ref={setTrigger} role="combobox" id={id} aria-label={ariaLabel} aria-describedby={ariaDescribedBy} aria-haspopup="listbox" aria-expanded={isOpen} aria-controls={listboxId} aria-activedescendant={isOpen && activeIndex >= 0 ? optionId(activeIndex) : undefined} aria-disabled={disabled || undefined} className={"\n rounded-control\n ".concat(getStateStyles(), "\n ").concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer', "\n ").concat(stateTransition, "\n ").concat(focusRing, "\n ")} onClick={handleToggle} tabIndex={disabled ? -1 : 0} onKeyDown={handleKeyDown}>
214
214
  {/* Inner Content Container; 7px vertical padding makes the control 40px like Button and TextField */}
215
215
  <div className={"flex items-center justify-between px-2 py-[7px] ".concat(getTextColor())}>
216
216
  {/* Content Container */}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ interface SettingsSectionProps {
3
+ title: string;
4
+ /** One line under the title, in secondary text. */
5
+ description?: string;
6
+ /** The section's controls, in one column. */
7
+ children: React.ReactNode;
8
+ /** `danger` colors the title and the line above with the error colors, for a danger zone. */
9
+ tone?: 'default' | 'danger';
10
+ /** The section's id; the title gets `<id>-title`. Lets a nav link to the section. */
11
+ id?: string;
12
+ /** The title's element. Default 2. */
13
+ level?: 2 | 3 | 4;
14
+ }
15
+ export default function SettingsSection({ title, description, children, tone, id, level }: SettingsSectionProps): React.JSX.Element;
16
+ interface SettingsColumnsProps {
17
+ children: React.ReactNode;
18
+ }
19
+ export declare function SettingsColumns({ children }: SettingsColumnsProps): React.JSX.Element;
20
+ interface SettingsLayoutProps {
21
+ /** The side navigation, a `Navigation`. */
22
+ nav: React.ReactNode;
23
+ /** The open area's content. */
24
+ children: React.ReactNode;
25
+ /** Below md, show the content (`true`) or the nav (`false`). From md up the nav and the content always sit side by side. */
26
+ showContent: boolean;
27
+ /** A Button that goes back to the nav. Shown only below md, above the content. */
28
+ back?: React.ReactNode;
29
+ }
30
+ export declare function SettingsLayout({ nav, children, showContent, back }: SettingsLayoutProps): React.JSX.Element;
31
+ export { SettingsSection };
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ import React, { useEffect, useId, useRef } from 'react';
3
+ import Heading from './heading';
4
+ // A hairline, a title, a description and then the controls. Reads as one block, so it never splits.
5
+ export default function SettingsSection(_a) {
6
+ var title = _a.title, description = _a.description, children = _a.children, _b = _a.tone, tone = _b === void 0 ? 'default' : _b, id = _a.id, _c = _a.level, level = _c === void 0 ? 2 : _c;
7
+ var generated = useId();
8
+ var titleId = id ? "".concat(id, "-title") : generated;
9
+ var danger = tone === 'danger';
10
+ return (<section id={id} aria-labelledby={titleId} className={"flex flex-col gap-large border-t pt-large ".concat(danger ? 'border-error-main' : 'border-misc-divider')}>
11
+ <div className="flex flex-col gap-small">
12
+ <Heading level={level} id={titleId} color={danger ? 'danger' : 'default'}>
13
+ {title}
14
+ </Heading>
15
+ {description && <p className="text-body2 text-fg-secondary">{description}</p>}
16
+ </div>
17
+ <div className="flex flex-col gap-medium">{children}</div>
18
+ </section>);
19
+ }
20
+ // Sections in one column, two from md up. A grid, so a section is never cut across columns.
21
+ export function SettingsColumns(_a) {
22
+ var children = _a.children;
23
+ return <div className="grid grid-cols-1 items-start gap-xlarge md:grid-cols-2">{children}</div>;
24
+ }
25
+ // A side nav beside its content from md up. On a phone the nav is the page and an item opens its content, so only one shows at a time.
26
+ var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
27
+ var isHidden = function (el) { return !el || getComputedStyle(el).display === 'none'; };
28
+ export function SettingsLayout(_a) {
29
+ var nav = _a.nav, children = _a.children, showContent = _a.showContent, back = _a.back;
30
+ var navRef = useRef(null);
31
+ var contentRef = useRef(null);
32
+ var prev = useRef(showContent);
33
+ // On a phone one side hides the other, and the focused control goes with it. Move focus to the side that shows:
34
+ // the back Button (or the first control) when the content opens, the open item when the nav returns.
35
+ // From md up both sides show, so focus stays where it is.
36
+ useEffect(function () {
37
+ var _a, _b, _c, _d;
38
+ // Compare with the last value, not a first-run flag: StrictMode runs the effect twice on mount.
39
+ if (prev.current === showContent)
40
+ return;
41
+ prev.current = showContent;
42
+ if (showContent && isHidden(navRef.current)) {
43
+ (_b = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE)) === null || _b === void 0 ? void 0 : _b.focus();
44
+ }
45
+ else if (!showContent && isHidden(contentRef.current)) {
46
+ var items = navRef.current;
47
+ (_d = ((_c = items === null || items === void 0 ? void 0 : items.querySelector('[aria-current]')) !== null && _c !== void 0 ? _c : items === null || items === void 0 ? void 0 : items.querySelector(FOCUSABLE))) === null || _d === void 0 ? void 0 : _d.focus();
48
+ }
49
+ }, [showContent]);
50
+ return (<div className="grid grid-cols-1 items-start gap-xlarge md:grid-cols-[16rem_minmax(0,1fr)]">
51
+ <div ref={navRef} className={showContent ? 'hidden md:block' : 'block'}>{nav}</div>
52
+ <div ref={contentRef} className={"flex-col gap-large ".concat(showContent ? 'flex' : 'hidden md:flex')}>
53
+ {back && <div className="md:hidden">{back}</div>}
54
+ {children}
55
+ </div>
56
+ </div>);
57
+ }
58
+ export { SettingsSection };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ type IndicatorRect = {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ animate: boolean;
8
+ };
9
+ /** The track around the items. `filled` is false for an empty track, which stays transparent. */
10
+ export declare function segmentTrackClasses(fill: boolean, filled: boolean): string;
11
+ export declare const segmentTrackStyle: React.CSSProperties;
12
+ /** The classes every item has, selected or not */
13
+ export declare function segmentItemClasses(fill: boolean, sizeClass: string, selectedClasses: string): string;
14
+ /** Item text and icon sizes. Items use `data-tab-selected="true"` on the selected one. */
15
+ export declare const segmentSizes: {
16
+ medium: {
17
+ tab: string;
18
+ label: string;
19
+ secondLabel: string;
20
+ icon: string;
21
+ };
22
+ small: {
23
+ tab: string;
24
+ label: string;
25
+ secondLabel: string;
26
+ icon: string;
27
+ };
28
+ tiny: {
29
+ tab: string;
30
+ label: string;
31
+ secondLabel: string;
32
+ icon: string;
33
+ };
34
+ };
35
+ export declare const segmentSelectedClasses = "text-primary-contrast";
36
+ export declare const segmentIdleClasses = "text-fg-primary hover:bg-background-accent200";
37
+ /**
38
+ * Places a pill behind the item marked `data-tab-selected="true"` inside the container, keeps it
39
+ * there as items resize, and scrolls a newly selected item into view. Pass the container's `ref`
40
+ * and `children` (the effect runs again when they change).
41
+ */
42
+ export declare function useSlidingIndicator(children: unknown): {
43
+ containerRef: React.RefObject<HTMLDivElement>;
44
+ indicator: IndicatorRect | null;
45
+ };
46
+ /** The pill itself. Render it first inside the track. */
47
+ export declare function SlidingPill({ indicator }: {
48
+ indicator: IndicatorRect | null;
49
+ }): React.JSX.Element | null;
50
+ export {};
@@ -0,0 +1,102 @@
1
+ 'use client';
2
+ // What TabsContainer and SegmentedControl share: the track classes, the sliding pill behind the
3
+ // selected item, and the item classes and sizes. Not exported from the package index. It lives in
4
+ // components/ like sharedStyles, so the class names in it are found by the Tailwind scan.
5
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
6
+ import { focusRing, pressFeedbackAny, stateTransition } from './sharedStyles';
7
+ // useLayoutEffect warns on a server render, where it cannot run; useEffect is the same there and silent
8
+ var useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
9
+ /** The track around the items. `filled` is false for an empty track, which stays transparent. */
10
+ export function segmentTrackClasses(fill, filled) {
11
+ return "\n relative flex gap-0.5 p-1 rounded-container overflow-x-auto".concat(fill ? ' w-full' : '', "\n ").concat(filled ? 'bg-background-accent100' : 'bg-transparent', "\n ");
12
+ }
13
+ export var segmentTrackStyle = {
14
+ scrollbarWidth: 'none',
15
+ msOverflowStyle: 'none',
16
+ };
17
+ /** The classes every item has, selected or not */
18
+ export function segmentItemClasses(fill, sizeClass, selectedClasses) {
19
+ 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
+ }
21
+ /** Item text and icon sizes. Items use `data-tab-selected="true"` on the selected one. */
22
+ export var segmentSizes = {
23
+ medium: { tab: 'py-1 px-[6px]', label: 'px-[6px] text-body1', secondLabel: 'text-body2', icon: 'w-6 h-6' },
24
+ small: { tab: 'py-1 px-[6px]', label: 'px-1 text-body2', secondLabel: 'text-caption', icon: 'w-5 h-5' },
25
+ tiny: { tab: 'py-0.5 px-1', label: 'px-1 text-caption', secondLabel: 'text-caption', icon: 'w-4 h-4' },
26
+ };
27
+ export var segmentSelectedClasses = 'text-primary-contrast';
28
+ export var segmentIdleClasses = 'text-fg-primary hover:bg-background-accent200';
29
+ /**
30
+ * Places a pill behind the item marked `data-tab-selected="true"` inside the container, keeps it
31
+ * there as items resize, and scrolls a newly selected item into view. Pass the container's `ref`
32
+ * and `children` (the effect runs again when they change).
33
+ */
34
+ export function useSlidingIndicator(children) {
35
+ var containerRef = useRef(null);
36
+ var selectedRef = useRef(null);
37
+ var _a = useState(null), indicator = _a[0], setIndicator = _a[1];
38
+ useIsomorphicLayoutEffect(function () {
39
+ var _a;
40
+ var container = containerRef.current;
41
+ if (!container)
42
+ return;
43
+ var update = function () {
44
+ var selected = container.querySelector('[data-tab-selected="true"]');
45
+ if (!selected) {
46
+ selectedRef.current = null;
47
+ setIndicator(null);
48
+ return;
49
+ }
50
+ setIndicator(function (prev) { return ({
51
+ animate: prev !== null,
52
+ x: selected.offsetLeft,
53
+ y: selected.offsetTop,
54
+ width: selected.offsetWidth,
55
+ height: selected.offsetHeight,
56
+ }); });
57
+ // Items scroll horizontally instead of wrapping; keep a newly selected item in view
58
+ if (selected !== selectedRef.current) {
59
+ selectedRef.current = selected;
60
+ var left = selected.offsetLeft;
61
+ var right = left + selected.offsetWidth;
62
+ if (left < container.scrollLeft) {
63
+ container.scrollTo({ left: left - 4, behavior: 'smooth' });
64
+ }
65
+ else if (right > container.scrollLeft + container.clientWidth) {
66
+ container.scrollTo({ left: right - container.clientWidth + 4, behavior: 'smooth' });
67
+ }
68
+ }
69
+ };
70
+ update();
71
+ // Item widths change once web fonts load
72
+ (_a = document.fonts) === null || _a === void 0 ? void 0 : _a.ready.then(update);
73
+ var resizeObserver = new ResizeObserver(update);
74
+ resizeObserver.observe(container);
75
+ Array.from(container.children).forEach(function (child) { return resizeObserver.observe(child); });
76
+ var mutationObserver = new MutationObserver(update);
77
+ mutationObserver.observe(container, {
78
+ subtree: true,
79
+ childList: true,
80
+ attributes: true,
81
+ attributeFilter: ['data-tab-selected'],
82
+ });
83
+ return function () {
84
+ resizeObserver.disconnect();
85
+ mutationObserver.disconnect();
86
+ };
87
+ }, [children]);
88
+ return { containerRef: containerRef, indicator: indicator };
89
+ }
90
+ /** The pill itself. Render it first inside the track. */
91
+ export function SlidingPill(_a) {
92
+ var indicator = _a.indicator;
93
+ if (!indicator)
94
+ 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={{
96
+ top: 0,
97
+ left: 0,
98
+ transform: "translate(".concat(indicator.x, "px, ").concat(indicator.y, "px)"),
99
+ width: indicator.width,
100
+ height: indicator.height,
101
+ }}/>);
102
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { type IconSource } from './iconSlot';
3
+ interface SourceCardProps {
4
+ /** Shown at the left in secondary color. A Lucide icon name, an icon component or an element. */
5
+ icon?: IconSource;
6
+ /** One line; a longer title is cut with an ellipsis */
7
+ title: string;
8
+ /** One line of secondary text under the title: where the source lives, or its date */
9
+ meta?: string;
10
+ /** Makes the card a link. A path goes through `next/link`; an `http(s)://` URL is a plain `<a>`. */
11
+ href?: string;
12
+ /** Makes the card a button. Ignored when `href` is set: the link wins and `onClick` does not run. */
13
+ onClick?: () => void;
14
+ /** A short text at the right end ('Open'), in the info text color. Shown only on a link or button card, and part of its accessible name. */
15
+ action?: string;
16
+ /** With `href`: open in a new tab. Another site (`http(s)://`) always opens in a new tab. */
17
+ openInNewTab?: boolean;
18
+ /** Overrides the accessible name of a link or button card: by default the title, the meta and the action, joined with commas */
19
+ 'aria-label'?: string;
20
+ }
21
+ /** The ref reaches the link or the button, so a page can move focus back to the card that opened something. A static card has no ref target. */
22
+ declare const SourceCard: React.ForwardRefExoticComponent<SourceCardProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
23
+ export default SourceCard;
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ import React, { forwardRef } from 'react';
14
+ import NextLink from 'next/link';
15
+ import IconSlot from './iconSlot';
16
+ import { focusRing, stateTransition } from './sharedStyles';
17
+ // The card for one thing an agent read or made. With `href` or `onClick` it is a link or a
18
+ // button with a hover look and a focus ring; with neither it is plain static text: no role,
19
+ // no hover, no pointer. It fills the width of its parent, so a Grid cell gives it its size.
20
+ // Like Link, it only sets new-tab attributes and shows no extra icon.
21
+ /** The ref reaches the link or the button, so a page can move focus back to the card that opened something. A static card has no ref target. */
22
+ var SourceCard = forwardRef(function SourceCard(_a, ref) {
23
+ var icon = _a.icon, title = _a.title, meta = _a.meta, href = _a.href, onClick = _a.onClick, action = _a.action, _b = _a.openInNewTab, openInNewTab = _b === void 0 ? false : _b, ariaLabel = _a["aria-label"];
24
+ var interactive = href !== undefined || onClick !== undefined;
25
+ var showAction = interactive && !!action;
26
+ // A link or button is named in one string, so the parts are read with a pause between them
27
+ var name = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : [title, meta, showAction && action].filter(Boolean).join(', ');
28
+ var classes = "flex w-full min-w-0 items-center gap-medium rounded-container border border-fg-disabled p-3 text-left".concat(interactive ? " cursor-pointer hover:bg-background-accent200 ".concat(stateTransition, " ").concat(focusRing) : '');
29
+ var content = (<>
30
+ {icon && (<span aria-hidden="true" className="flex shrink-0">
31
+ <IconSlot icon={icon} className="size-5 text-fg-secondary"/>
32
+ </span>)}
33
+ <span className="flex min-w-0 flex-1 flex-col">
34
+ {/* Block-level lines, so a static card's title and meta are read as two words, not run together */}
35
+ <span className="truncate text-body1 text-fg-primary">{title}</span>
36
+ {meta && <span className="truncate text-caption text-fg-secondary">{meta}</span>}
37
+ </span>
38
+ {showAction && <span className="shrink-0 text-body2 text-info-text">{action}</span>}
39
+ </>);
40
+ if (href !== undefined) {
41
+ var isExternal = href.startsWith('http://') || href.startsWith('https://');
42
+ var newTab = openInNewTab || isExternal;
43
+ var props = __assign({ className: classes, 'aria-label': name }, (newTab && { target: '_blank', rel: 'noopener noreferrer' }));
44
+ if (newTab) {
45
+ return <a href={href} {...props} ref={ref}>{content}</a>;
46
+ }
47
+ return <NextLink href={href} {...props} ref={ref}>{content}</NextLink>;
48
+ }
49
+ if (onClick) {
50
+ return (<button ref={ref} type="button" className={classes} onClick={onClick} aria-label={name}>
51
+ {content}
52
+ </button>);
53
+ }
54
+ return <div className={classes}>{content}</div>;
55
+ });
56
+ export default SourceCard;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export type StepListStatus = 'waiting' | 'running' | 'done' | 'failed' | 'cancelled';
3
+ export interface StepListStep {
4
+ label: string;
5
+ /** Default `waiting` */
6
+ status?: StepListStatus;
7
+ /** One line of secondary text under the label */
8
+ detail?: string;
9
+ }
10
+ interface StepListProps {
11
+ steps: StepListStep[];
12
+ /** Numbers every step in a column before the status mark, for a plan whose order matters */
13
+ numbered?: boolean;
14
+ 'aria-label'?: string;
15
+ }
16
+ export default function StepList({ steps, numbered, 'aria-label': ariaLabel }: StepListProps): React.JSX.Element | null;
17
+ export {};
@@ -0,0 +1,79 @@
1
+ import React from 'react';
2
+ import { Check, Circle, Minus, X } from 'lucide-react';
3
+ import { LoadingSmall } from './loadingScreen';
4
+ var words = {
5
+ waiting: 'Waiting',
6
+ running: 'Running',
7
+ done: 'Done',
8
+ failed: 'Failed',
9
+ cancelled: 'Cancelled',
10
+ };
11
+ // Mark colors; a running mark takes its color from the text, so it shows in dark too.
12
+ var markColors = {
13
+ waiting: 'text-fg-secondary',
14
+ running: 'text-fg-primary',
15
+ done: 'text-success-text',
16
+ failed: 'text-error-text',
17
+ cancelled: 'text-fg-secondary',
18
+ };
19
+ var labelColors = {
20
+ waiting: 'text-fg-secondary',
21
+ running: 'text-fg-primary',
22
+ done: 'text-fg-primary',
23
+ failed: 'text-fg-primary',
24
+ cancelled: 'text-fg-secondary',
25
+ };
26
+ // Steps with a status each: an agent's progress, a plan, an import. An ordered list.
27
+ // A screen reader hears the status, then the label ("Done: Read file"); with `numbered` it hears
28
+ // the position too ("Step 2, Running: Read file"). Each status has its own shape and word, so
29
+ // color is never the only cue. The mark box is as tall as the first text line (24px), so a
30
+ // wrapped label keeps the mark at its first line. There is no line between steps in this version.
31
+ // `numbered` draws a number column before the mark; the drawn number is hidden from assistive tech
32
+ // and the hidden text carries the position, so it is not read twice. A waiting numbered step shows
33
+ // its number and no circle, and its label is primary text: a plan waiting for approval is not disabled.
34
+ // It is read as "Step 1: Read file", with no status word, since it draws none: an approved plan is not read as waiting.
35
+ // There is no live region: a caller that updates the list while an agent works wraps it in
36
+ // `role="status"` or `aria-live="polite"` itself.
37
+ export default function StepList(_a) {
38
+ var steps = _a.steps, _b = _a.numbered, numbered = _b === void 0 ? false : _b, ariaLabel = _a["aria-label"];
39
+ if (steps.length === 0)
40
+ return null;
41
+ var mark = function (status) {
42
+ switch (status) {
43
+ case 'running':
44
+ // The spinner's own "Loading" status is hidden: the row says "Running".
45
+ return <div aria-hidden="true"><LoadingSmall size="tiny"/></div>;
46
+ case 'done':
47
+ return <Check className="size-4" strokeWidth={2} aria-hidden/>;
48
+ case 'failed':
49
+ return <X className="size-4" strokeWidth={2} aria-hidden/>;
50
+ case 'cancelled':
51
+ return <Minus className="size-4" strokeWidth={2} aria-hidden/>;
52
+ default:
53
+ return <Circle className="size-4" strokeWidth={2} aria-hidden/>;
54
+ }
55
+ };
56
+ return (<ol role="list" aria-label={ariaLabel} className="flex flex-col gap-medium">
57
+ {steps.map(function (step, i) {
58
+ var _a;
59
+ var status = (_a = step.status) !== null && _a !== void 0 ? _a : 'waiting';
60
+ var label = labelColors[status === 'waiting' && numbered ? 'running' : status];
61
+ var spoken = numbered
62
+ ? status === 'waiting' ? "Step ".concat(i + 1, ": ") : "Step ".concat(i + 1, ", ").concat(words[status], ": ")
63
+ : "".concat(words[status], ": ");
64
+ return (<li key={i} aria-current={status === 'running' ? 'step' : undefined} className="flex items-start gap-medium">
65
+ {numbered && (<span aria-hidden="true" className="flex h-6 w-6 flex-shrink-0 items-center justify-center text-body2 text-fg-secondary">{i + 1}</span>)}
66
+ {(!numbered || status !== 'waiting') && (<span aria-hidden="true" className={"flex flex-shrink-0 items-center justify-center w-6 h-6 ".concat(markColors[status])}>
67
+ {mark(status)}
68
+ </span>)}
69
+ <span className="flex flex-col flex-1 min-w-0">
70
+ <span className={"break-words text-body1 ".concat(label)}>
71
+ <span className="sr-only">{spoken}</span>
72
+ {step.label}
73
+ </span>
74
+ {step.detail && <span className="break-words text-body2 text-fg-secondary">{step.detail}</span>}
75
+ </span>
76
+ </li>);
77
+ })}
78
+ </ol>);
79
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ interface SwitchBaseProps {
3
+ /** On the `<button>`. Defaults to a generated id. */
4
+ id?: string;
5
+ checked: boolean;
6
+ /** Called with the value the press asks for. The Switch stays controlled: it shows `checked` until the parent changes it. */
7
+ onChange: (next: boolean) => void;
8
+ /** A line under the label. Tied to the switch with `aria-describedby`. */
9
+ description?: string;
10
+ disabled?: boolean;
11
+ /** A change is being saved: the switch keeps its position, shows a spinner in the thumb and ignores presses. Set it from the parent while its request runs. */
12
+ busy?: boolean;
13
+ /** Shown under the row and tied to the switch. The parent sets it and puts `checked` back when a change fails. */
14
+ error?: string;
15
+ }
16
+ type SwitchProps = SwitchBaseProps & ({
17
+ label: string;
18
+ 'aria-label'?: string;
19
+ } | {
20
+ label?: undefined;
21
+ 'aria-label': string;
22
+ });
23
+ /** A settings row with an on/off switch at the right. Space and Enter toggle it. */
24
+ export default function Switch({ id, checked, onChange, label, description, disabled, busy, error, 'aria-label': ariaLabel, }: SwitchProps): React.JSX.Element;
25
+ export { Switch };
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+ import React, { useId } from 'react';
3
+ import { nextSwitchValue } from '../internal/switch';
4
+ import { focusRing, stateTransition } from './sharedStyles';
5
+ /** A settings row with an on/off switch at the right. Space and Enter toggle it. */
6
+ export default function Switch(_a) {
7
+ var id = _a.id, checked = _a.checked, onChange = _a.onChange, label = _a.label, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.busy, busy = _c === void 0 ? false : _c, error = _a.error, ariaLabel = _a["aria-label"];
8
+ var generatedId = useId();
9
+ var switchId = id !== null && id !== void 0 ? id : generatedId;
10
+ var descriptionId = "".concat(switchId, "-description");
11
+ var errorId = "".concat(switchId, "-error");
12
+ var describedBy = [description ? descriptionId : '', error ? errorId : ''].filter(Boolean).join(' ') || undefined;
13
+ var handleClick = function () {
14
+ var next = nextSwitchValue({ checked: checked, busy: busy, disabled: disabled });
15
+ if (next !== undefined)
16
+ onChange(next);
17
+ };
18
+ var track = disabled
19
+ ? checked
20
+ ? 'bg-fg-disabled border-transparent'
21
+ : 'border-fg-disabled'
22
+ : checked
23
+ ? 'bg-accent-main border-transparent'
24
+ : 'border-fg-secondary';
25
+ var thumb = disabled
26
+ ? checked
27
+ ? 'bg-fg-contrast'
28
+ : 'bg-fg-disabled'
29
+ : checked
30
+ ? 'bg-accent-contrast'
31
+ : 'bg-fg-secondary';
32
+ // The spinner takes the color of the track behind the thumb
33
+ var spinner = checked && !disabled ? 'text-accent-main' : 'text-background-default';
34
+ return (<div className="flex flex-col w-full">
35
+ <div className="flex items-start justify-between gap-3">
36
+ <div className="flex flex-col min-w-0">
37
+ {label && (<label htmlFor={switchId} className={"text-body1 ".concat(disabled ? 'text-fg-disabled cursor-not-allowed' : 'text-fg-primary cursor-pointer')}>
38
+ {label}
39
+ </label>)}
40
+ {description && (<p id={descriptionId} className={"text-body2 ".concat(disabled ? 'text-fg-disabled' : 'text-fg-secondary')}>
41
+ {description}
42
+ </p>)}
43
+ </div>
44
+ <button type="button" role="switch" id={switchId} aria-checked={checked} aria-label={ariaLabel} aria-describedby={describedBy} aria-invalid={error ? true : undefined} aria-busy={busy || undefined} disabled={disabled} onClick={handleClick} className={"relative flex flex-shrink-0 items-center w-10 h-6 px-0.5 rounded-full border-2 ".concat(stateTransition, " ").concat(focusRing, " ").concat(track, " ").concat(disabled ? 'cursor-not-allowed' : busy ? 'cursor-wait' : 'cursor-pointer')}>
45
+ <span aria-hidden="true" className={"flex items-center justify-center w-4 h-4 rounded-full ".concat(thumb, " transition-transform duration-[var(--os-duration-fast)] ease-out motion-reduce:transition-none ").concat(checked ? 'translate-x-4' : 'translate-x-0')}>
46
+ {busy && (<span className={"w-3 h-3 rounded-full border-2 border-current border-t-transparent animate-spin motion-reduce:animate-none ".concat(spinner)}/>)}
47
+ </span>
48
+ </button>
49
+ </div>
50
+ {error && (<p id={errorId} className="mt-1 text-error-text text-body2">
51
+ {error}
52
+ </p>)}
53
+ </div>);
54
+ }
55
+ export { Switch };
@@ -2,7 +2,7 @@
2
2
  import React, { useContext } from 'react';
3
3
  import IconSlot from './iconSlot';
4
4
  import { TabsContainerContext, TabsFillContext } from './tabsContainer';
5
- import { focusRing, pressFeedbackAny, stateTransition } from './sharedStyles';
5
+ import { segmentIdleClasses, segmentItemClasses, segmentSelectedClasses, segmentSizes } from './slidingIndicator';
6
6
  export default function Tab(_a) {
7
7
  var label = _a.label, secondLabel = _a.secondLabel, href = _a.href, isSelected = _a.isSelected, onClickTab = _a.onClickTab, onClickActionIcon = _a.onClickActionIcon, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, router = _a.router, _b = _a.size, size = _b === void 0 ? 'medium' : _b;
8
8
  var inContainer = useContext(TabsContainerContext);
@@ -13,15 +13,11 @@ export default function Tab(_a) {
13
13
  router.push(href);
14
14
  }
15
15
  };
16
- var sizeClasses = {
17
- medium: { tab: 'py-1 px-[6px]', label: 'px-[6px] text-body1', secondLabel: 'text-body2', icon: 'w-6 h-6' },
18
- small: { tab: 'py-1 px-[6px]', label: 'px-1 text-body2', secondLabel: 'text-caption', icon: 'w-5 h-5' },
19
- tiny: { tab: 'py-0.5 px-1', label: 'px-1 text-caption', secondLabel: 'text-caption', icon: 'w-4 h-4' },
20
- }[size];
16
+ var sizeClasses = segmentSizes[size];
21
17
  // Inside a TabsContainer the container's sliding pill is the selected background
22
18
  var selectedClasses = inContainer
23
- ? 'text-primary-contrast'
24
- : 'bg-primary-dark text-primary-contrast';
19
+ ? segmentSelectedClasses
20
+ : "bg-primary-dark ".concat(segmentSelectedClasses);
25
21
  return (<div data-tab-selected={isSelected} role="tab" aria-selected={isSelected}
26
22
  // Inside a container only the selected tab is in the Tab order; arrow keys move between tabs
27
23
  tabIndex={inContainer && !isSelected ? -1 : 0} onKeyDown={function (e) {
@@ -29,9 +25,7 @@ export default function Tab(_a) {
29
25
  e.preventDefault();
30
26
  handleClick();
31
27
  }
32
- }} className={"\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(sizeClasses.tab, "\n ").concat(isSelected
33
- ? selectedClasses
34
- : 'text-fg-primary hover:bg-background-accent200', "\n ")} onClick={handleClick}>
28
+ }} className={segmentItemClasses(fill, sizeClasses.tab, isSelected ? selectedClasses : segmentIdleClasses)} onClick={handleClick}>
35
29
  <IconSlot icon={decoIcon} className={sizeClasses.icon}/>
36
30
  <div className={"flex flex-col text-center ".concat(sizeClasses.label)}>
37
31
  <span className="whitespace-nowrap">