@trellixio/roaster-react 2.1.1 → 2.2.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 (204) hide show
  1. package/CHANGELOG.md +383 -0
  2. package/LICENSE.md +38 -2
  3. package/README.md +10 -10
  4. package/cjs/components/ActionList/components/ActionListDropdown.js +6 -5
  5. package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
  6. package/cjs/components/ActionList/components/ActionListItem.js +9 -7
  7. package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
  8. package/cjs/components/ActionList/components/ActionListSearch.js +24 -6
  9. package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -1
  10. package/cjs/components/ActionList/components/ActionListSubmenu.js +7 -5
  11. package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  12. package/cjs/components/ActionList/components/ActionListSwitchItem.js +6 -5
  13. package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
  14. package/cjs/components/Alert/Alert.js +3 -2
  15. package/cjs/components/Alert/Alert.js.map +1 -1
  16. package/cjs/components/AppFrame/AppFrame.js.map +1 -1
  17. package/cjs/components/Avatar/Avatar.js +1 -1
  18. package/cjs/components/Avatar/Avatar.js.map +1 -1
  19. package/cjs/components/Button/Button.js +3 -2
  20. package/cjs/components/Button/Button.js.map +1 -1
  21. package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
  22. package/cjs/components/Checkbox/Checkbox.js +4 -4
  23. package/cjs/components/Checkbox/Checkbox.js.map +1 -1
  24. package/cjs/components/ColorField/ColorField.js +42 -29
  25. package/cjs/components/ColorField/ColorField.js.map +1 -1
  26. package/cjs/components/DatePicker/DatePicker.js +2 -2
  27. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  28. package/cjs/components/DatePicker/components/Calendar/Calendar.js +4 -3
  29. package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  30. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +6 -5
  31. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  32. package/cjs/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  33. package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  34. package/cjs/components/Field/Field.js +26 -6
  35. package/cjs/components/Field/Field.js.map +1 -1
  36. package/cjs/components/FileField/FileField.js +47 -33
  37. package/cjs/components/FileField/FileField.js.map +1 -1
  38. package/cjs/components/Icon/Icon.js.map +1 -1
  39. package/cjs/components/Icon/RoasterIcon.js +12 -0
  40. package/cjs/components/Icon/RoasterIcon.js.map +1 -0
  41. package/cjs/components/IconBadge/IconBadge.js.map +1 -1
  42. package/cjs/components/Modal/Modal.js +3 -2
  43. package/cjs/components/Modal/Modal.js.map +1 -1
  44. package/cjs/components/Pagination/Pagination.js +4 -3
  45. package/cjs/components/Pagination/Pagination.js.map +1 -1
  46. package/cjs/components/RangeField/RangeField.js +34 -21
  47. package/cjs/components/RangeField/RangeField.js.map +1 -1
  48. package/cjs/components/Select/Select.js +8 -6
  49. package/cjs/components/Select/Select.js.map +1 -1
  50. package/cjs/components/Sidebar/Sidebar.js +4 -3
  51. package/cjs/components/Sidebar/Sidebar.js.map +1 -1
  52. package/cjs/components/Sidebar/components/Back.js +7 -3
  53. package/cjs/components/Sidebar/components/Back.js.map +1 -1
  54. package/cjs/components/StatCard/StatCard.js +3 -2
  55. package/cjs/components/StatCard/StatCard.js.map +1 -1
  56. package/cjs/components/Switch/Switch.js +7 -1
  57. package/cjs/components/Switch/Switch.js.map +1 -1
  58. package/cjs/components/Table/components/TableHeadCell.js +4 -3
  59. package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
  60. package/cjs/components/Tag/Tag.js +3 -2
  61. package/cjs/components/Tag/Tag.js.map +1 -1
  62. package/cjs/components/TextField/TextField.js +3 -1
  63. package/cjs/components/TextField/TextField.js.map +1 -1
  64. package/cjs/components/Textarea/Textarea.js +36 -4
  65. package/cjs/components/Textarea/Textarea.js.map +1 -1
  66. package/cjs/components/Thumbnail/Thumbnail.js +3 -2
  67. package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
  68. package/cjs/components/Toast/Toast.js +3 -2
  69. package/cjs/components/Toast/Toast.js.map +1 -1
  70. package/cjs/components/Tooltip/Tooltip.js +6 -5
  71. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  72. package/cjs/components/Tooltip/TooltipCallout.js +3 -2
  73. package/cjs/components/Tooltip/TooltipCallout.js.map +1 -1
  74. package/cjs/components/Visualizer/Visualizer.js +4 -3
  75. package/cjs/components/Visualizer/Visualizer.js.map +1 -1
  76. package/cjs/utils/Slot/index.js +5 -5
  77. package/cjs/utils/Slot/index.js.map +1 -1
  78. package/cjs/utils/useDropdown/DropdownTrigger.js +4 -4
  79. package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -1
  80. package/cjs/utils/useMergeRefs/index.js +51 -0
  81. package/cjs/utils/useMergeRefs/index.js.map +1 -0
  82. package/esm/components/ActionList/components/ActionListDropdown.js +2 -1
  83. package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
  84. package/esm/components/ActionList/components/ActionListItem.js +5 -3
  85. package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
  86. package/esm/components/ActionList/components/ActionListSearch.js +21 -3
  87. package/esm/components/ActionList/components/ActionListSearch.js.map +1 -1
  88. package/esm/components/ActionList/components/ActionListSubmenu.js +5 -3
  89. package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  90. package/esm/components/ActionList/components/ActionListSwitchItem.js +2 -1
  91. package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
  92. package/esm/components/Alert/Alert.js +3 -2
  93. package/esm/components/Alert/Alert.js.map +1 -1
  94. package/esm/components/AppFrame/AppFrame.js.map +1 -1
  95. package/esm/components/Avatar/Avatar.js +1 -1
  96. package/esm/components/Avatar/Avatar.js.map +1 -1
  97. package/esm/components/Button/Button.js +3 -2
  98. package/esm/components/Button/Button.js.map +1 -1
  99. package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
  100. package/esm/components/Checkbox/Checkbox.js +1 -1
  101. package/esm/components/Checkbox/Checkbox.js.map +1 -1
  102. package/esm/components/ColorField/ColorField.js +42 -29
  103. package/esm/components/ColorField/ColorField.js.map +1 -1
  104. package/esm/components/DatePicker/DatePicker.js +1 -1
  105. package/esm/components/DatePicker/DatePicker.js.map +1 -1
  106. package/esm/components/DatePicker/components/Calendar/Calendar.js +4 -3
  107. package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  108. package/esm/components/DropdownCard/components/DropdownCardDropdown.js +2 -1
  109. package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  110. package/esm/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  111. package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  112. package/esm/components/Field/Field.js +26 -6
  113. package/esm/components/Field/Field.js.map +1 -1
  114. package/esm/components/FileField/FileField.js +47 -33
  115. package/esm/components/FileField/FileField.js.map +1 -1
  116. package/esm/components/Icon/Icon.js.map +1 -1
  117. package/esm/components/Icon/RoasterIcon.js +10 -0
  118. package/esm/components/Icon/RoasterIcon.js.map +1 -0
  119. package/esm/components/IconBadge/IconBadge.js.map +1 -1
  120. package/esm/components/Modal/Modal.js +3 -2
  121. package/esm/components/Modal/Modal.js.map +1 -1
  122. package/esm/components/Pagination/Pagination.js +4 -3
  123. package/esm/components/Pagination/Pagination.js.map +1 -1
  124. package/esm/components/RangeField/RangeField.js +34 -21
  125. package/esm/components/RangeField/RangeField.js.map +1 -1
  126. package/esm/components/Select/Select.js +4 -2
  127. package/esm/components/Select/Select.js.map +1 -1
  128. package/esm/components/Sidebar/Sidebar.js +4 -3
  129. package/esm/components/Sidebar/Sidebar.js.map +1 -1
  130. package/esm/components/Sidebar/components/Back.js +7 -3
  131. package/esm/components/Sidebar/components/Back.js.map +1 -1
  132. package/esm/components/StatCard/StatCard.js +3 -2
  133. package/esm/components/StatCard/StatCard.js.map +1 -1
  134. package/esm/components/Switch/Switch.js +7 -1
  135. package/esm/components/Switch/Switch.js.map +1 -1
  136. package/esm/components/Table/components/TableHeadCell.js +4 -3
  137. package/esm/components/Table/components/TableHeadCell.js.map +1 -1
  138. package/esm/components/Tag/Tag.js +3 -2
  139. package/esm/components/Tag/Tag.js.map +1 -1
  140. package/esm/components/TextField/TextField.js +3 -1
  141. package/esm/components/TextField/TextField.js.map +1 -1
  142. package/esm/components/Textarea/Textarea.js +38 -6
  143. package/esm/components/Textarea/Textarea.js.map +1 -1
  144. package/esm/components/Thumbnail/Thumbnail.js +3 -2
  145. package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
  146. package/esm/components/Toast/Toast.js +3 -2
  147. package/esm/components/Toast/Toast.js.map +1 -1
  148. package/esm/components/Tooltip/Tooltip.js +2 -1
  149. package/esm/components/Tooltip/Tooltip.js.map +1 -1
  150. package/esm/components/Tooltip/TooltipCallout.js +3 -2
  151. package/esm/components/Tooltip/TooltipCallout.js.map +1 -1
  152. package/esm/components/Visualizer/Visualizer.js +4 -3
  153. package/esm/components/Visualizer/Visualizer.js.map +1 -1
  154. package/esm/package.json +4 -1
  155. package/esm/utils/Slot/index.js +1 -1
  156. package/esm/utils/Slot/index.js.map +1 -1
  157. package/esm/utils/useDropdown/DropdownTrigger.js +1 -1
  158. package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -1
  159. package/esm/utils/useMergeRefs/index.js +36 -0
  160. package/esm/utils/useMergeRefs/index.js.map +1 -0
  161. package/lib/components/ActionList/components/ActionListItem.d.ts +4 -1
  162. package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
  163. package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -1
  164. package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -1
  165. package/lib/components/AppFrame/AppFrame.d.ts +5 -1
  166. package/lib/components/AppFrame/AppFrame.d.ts.map +1 -1
  167. package/lib/components/Avatar/Avatar.d.ts +4 -1
  168. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  169. package/lib/components/ButtonIcon/ButtonIcon.d.ts +1 -1
  170. package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  171. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  172. package/lib/components/ColorField/ColorField.d.ts.map +1 -1
  173. package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  174. package/lib/components/DatePicker/utils/index.d.ts +2 -1
  175. package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
  176. package/lib/components/Field/Field.d.ts +13 -7
  177. package/lib/components/Field/Field.d.ts.map +1 -1
  178. package/lib/components/FileField/FileField.d.ts.map +1 -1
  179. package/lib/components/Icon/Icon.d.ts +13 -2
  180. package/lib/components/Icon/Icon.d.ts.map +1 -1
  181. package/lib/components/Icon/RoasterIcon.d.ts +13 -0
  182. package/lib/components/Icon/RoasterIcon.d.ts.map +1 -0
  183. package/lib/components/Icon/index.d.ts +2 -0
  184. package/lib/components/Icon/index.d.ts.map +1 -1
  185. package/lib/components/IconBadge/IconBadge.d.ts +2 -2
  186. package/lib/components/RangeField/RangeField.d.ts.map +1 -1
  187. package/lib/components/Select/Select.d.ts.map +1 -1
  188. package/lib/components/Sidebar/components/Back.d.ts.map +1 -1
  189. package/lib/components/Switch/Switch.d.ts.map +1 -1
  190. package/lib/components/TextField/TextField.d.ts.map +1 -1
  191. package/lib/components/Textarea/Textarea.d.ts +6 -1
  192. package/lib/components/Textarea/Textarea.d.ts.map +1 -1
  193. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  194. package/lib/utils/Slot/index.d.ts.map +1 -1
  195. package/lib/utils/index.d.ts +1 -0
  196. package/lib/utils/index.d.ts.map +1 -1
  197. package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -1
  198. package/lib/utils/useMergeRefs/index.d.ts +11 -0
  199. package/lib/utils/useMergeRefs/index.d.ts.map +1 -0
  200. package/package.json +2 -2
  201. package/roaster.css +2 -1
  202. package/themes/azoth.css +1 -1
  203. package/themes/coffee.css +1 -1
  204. package/themes/scalar.css +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { Icon } from '@/components/Icon';\nimport { Section } from './components/Section';\nimport { Menu } from './components/Menu';\nimport type { MenuItemProps } from './components/MenuItem';\nimport { Back } from './components/Back';\n\n/** An item of the sidebar. Its other props (`href`, `onClick`...) go to its link. */\nexport interface SidebarItemProps extends Omit<MenuItemProps, 'children' | 'current'> {\n /** The text of the item. */\n label: React.ReactNode;\n /** The item's path: it is the current page when it matches `activePath`, and is passed to `onMenuItemClick`. */\n pathname?: string;\n /** The items under it, in a sub-menu that opens and closes. */\n subMenu?: SidebarItemProps[];\n}\n\n/** A labeled section of the sidebar, such as \"Company\" or \"Team\": a label over its items. */\nexport interface SidebarSection {\n /** The label, over the items. */\n title: React.ReactNode;\n /** A small button at the label's end, such as one that adds an item. */\n action?: React.ReactNode;\n /** The items of the section. */\n items: SidebarItemProps[];\n}\n\nconst isSection = (entry: SidebarItemProps | SidebarItemProps[] | SidebarSection): entry is SidebarSection =>\n !Array.isArray(entry) && 'items' in entry && 'title' in entry;\n\n/** The text of the sidebar, for other languages. */\nexport interface SidebarLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the button that opens the sidebar where it is a drawer (up to 1024px). */\n open: string;\n /** The name of the button that closes it there. */\n close: string;\n}\n\nconst defaultSidebarLabels: SidebarLabels = { navigation: 'Main', open: 'Open the menu', close: 'Close the menu' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'aside'> {\n /** The top of the sidebar: the logo, buttons. */\n header?: React.ReactNode;\n /** The bottom of the sidebar: settings, the account. */\n footer?: React.ReactNode;\n /** The path of the current page: its item gets `aria-current=\"page\"`, and its sub-menu starts open. */\n activePath?: string;\n /** Next to the button that opens the sidebar where it is a drawer, such as the logo. */\n mobileHeader?: React.ReactNode;\n /**\n * The items. An array of items is a group, set apart from the next by a line or room; a section (`{ title, items }`)\n * is a group with a label over it.\n */\n items: (SidebarItemProps | SidebarItemProps[] | SidebarSection)[];\n /** Called when an item is clicked, with its pathname. */\n onMenuItemClick?: ({ itemId }: { itemId: string }) => void;\n /** The text of the sidebar, in English by default. */\n labels?: Partial<SidebarLabels>;\n}\n\nconst keyOf = (item: SidebarItemProps, index: number) => item.pathname ?? `item-${index}`;\n\nconst SidebarBase = React.forwardRef<HTMLElement, SidebarProps>((props, ref) => {\n const { mobileHeader, header, footer, activePath, onMenuItemClick, items, labels, className, id, ...others } = props;\n const text = { ...defaultSidebarLabels, ...labels };\n const sidebarId = useUid(id);\n const panelRef = React.useRef<HTMLElement | null>(null);\n const setRefs = React.useCallback(\n (panel: HTMLElement | null) => {\n panelRef.current = panel;\n if (typeof ref === 'function') ref(panel);\n else if (ref) ref.current = panel;\n },\n [ref]\n );\n\n // Whether the drawer is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setDrawerOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n\n // The open sub-menus, by pathname: the current page's opens with it.\n const groupOf = React.useCallback(\n (path: string | undefined) =>\n items\n .flatMap((entry) => (isSection(entry) ? entry.items : entry))\n .find((item) => item.subMenu?.some((sub) => sub.pathname === path) || (item.subMenu && item.pathname === path))\n ?.pathname,\n [items]\n );\n const [openGroups, setOpenGroups] = React.useState(() => new Set([groupOf(activePath)].filter(Boolean)));\n React.useEffect(() => {\n const group = groupOf(activePath);\n if (group) setOpenGroups((open) => (open.has(group) ? open : new Set([...open, group])));\n }, [activePath, groupOf]);\n\n function onItemClick(item: SidebarItemProps) {\n if (item.pathname !== undefined) onMenuItemClick?.({ itemId: item.pathname });\n // Where the sidebar is a drawer, choosing a page closes it.\n if (!item.subMenu?.length && drawerOpen) panelRef.current?.hidePopover?.();\n }\n\n function renderItem(item: SidebarItemProps, index: number) {\n const { pathname, subMenu, icon, label, onClick, action, suffix, detail, ...linkProps } = item;\n if (subMenu && subMenu.length > 0) {\n const groupKey = keyOf(item, index);\n return (\n <li key={groupKey}>\n <details\n className=\"roaster-sidebar__group\"\n open={openGroups.has(groupKey)}\n onToggle={(event) => {\n const isOpen = event.currentTarget.open;\n setOpenGroups((open) => {\n if (open.has(groupKey) === isOpen) return open;\n const next = new Set(open);\n if (isOpen) next.add(groupKey);\n else next.delete(groupKey);\n return next;\n });\n }}\n >\n <summary className=\"roaster-sidebar__item\" onClick={() => onItemClick(item)}>\n {icon && <span className=\"roaster-sidebar__icon\">{icon}</span>}\n {label}\n {suffix != null && <span className=\"roaster-sidebar__end\">{suffix}</span>}\n {action && <span className=\"roaster-sidebar__end\">{action}</span>}\n </summary>\n <Menu.SubMenu>{subMenu.map((sub, subIndex) => renderItem(sub, subIndex))}</Menu.SubMenu>\n </details>\n </li>\n );\n }\n return (\n <Menu.Item\n key={keyOf(item, index)}\n {...linkProps}\n icon={icon}\n action={action}\n suffix={suffix}\n detail={detail}\n current={pathname !== undefined && pathname === activePath}\n onClick={(event) => {\n onClick?.(event);\n onItemClick(item);\n }}\n >\n {label}\n </Menu.Item>\n );\n }\n\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <div className=\"roaster-sidebar-opener\">\n <Button\n variant=\"ghost\"\n iconOnly\n aria-label={text.open}\n aria-controls={sidebarId}\n aria-expanded={drawerOpen}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <Icon name=\"bars\" />\n </Button>\n {mobileHeader}\n </div>\n\n <aside {...others} {...popover} id={sidebarId} ref={setRefs} className={classNames('roaster-sidebar', className)}>\n <Button\n variant=\"secondary\"\n iconOnly\n className=\"roaster-sidebar__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <Icon name=\"xmark\" />\n </Button>\n <nav className=\"roaster-sidebar__nav\" aria-label={text.navigation}>\n <Section className=\"roaster-sidebar__header\">{header}</Section>\n <Section className=\"roaster-sidebar__body\">\n {items.map((item, index) =>\n isSection(item) ? (\n <section\n key={`section-${index}`}\n className=\"roaster-sidebar__section\"\n aria-labelledby={`${sidebarId}-section-${index}`}\n >\n <h2 className=\"roaster-sidebar__label\" id={`${sidebarId}-section-${index}`}>\n {item.title}\n {item.action}\n </h2>\n <Menu>{item.items.map(renderItem)}</Menu>\n </section>\n ) : Array.isArray(item) ? (\n <Menu key={`group-${keyOf(item[0] ?? { label: '' }, index)}`}>{item.map(renderItem)}</Menu>\n ) : (\n <Menu key={`group-${keyOf(item, index)}`}>{renderItem(item, index)}</Menu>\n )\n )}\n </Section>\n <Section className=\"roaster-sidebar__footer\">{footer}</Section>\n </nav>\n </aside>\n </>\n );\n});\n\nSidebarBase.displayName = 'Sidebar';\n\n/**\n * The navigation of an application: a header (the logo, or the account button with a Sidebar.Back under it), groups\n * of items with sub-menus (`<details>`), labeled sections, and a footer. The current\n * page's item has `aria-current=\"page\"`. Up to a tablet's width (1024px), it is a drawer (a popover) that a bar at the\n * top opens, with a close button beside it.\n */\nexport const Sidebar = Object.assign(SidebarBase, { Section: Section, Menu: Menu, Back: Back });\n"],"names":["React","useUid","jsx","jsxs","Menu","Fragment","Button","Icon","classNames","Section","Back"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK;AAC1F,MAAM,oBAAoB,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI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AI,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACrP,SAAS,EAAE,CAAC;AACZ,wBAAwBF,cAAG,CAACO,eAAO,EAAE,EAAE,SAAS,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC/F,OAAO,EAAE;AACT,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,SAAS;AACvB,MAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,WAAEA,eAAO,QAAEL,SAAI,QAAEM,SAAI,EAAE;;"}
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { RoasterIcon } from '@/components/Icon';\nimport { Section } from './components/Section';\nimport { Menu } from './components/Menu';\nimport type { MenuItemProps } from './components/MenuItem';\nimport { Back } from './components/Back';\n\n/** An item of the sidebar. Its other props (`href`, `onClick`...) go to its link. */\nexport interface SidebarItemProps extends Omit<MenuItemProps, 'children' | 'current'> {\n /** The text of the item. */\n label: React.ReactNode;\n /** The item's path: it is the current page when it matches `activePath`, and is passed to `onMenuItemClick`. */\n pathname?: string;\n /** The items under it, in a sub-menu that opens and closes. */\n subMenu?: SidebarItemProps[];\n}\n\n/** A labeled section of the sidebar, such as \"Company\" or \"Team\": a label over its items. */\nexport interface SidebarSection {\n /** The label, over the items. */\n title: React.ReactNode;\n /** A small button at the label's end, such as one that adds an item. */\n action?: React.ReactNode;\n /** The items of the section. */\n items: SidebarItemProps[];\n}\n\nconst isSection = (entry: SidebarItemProps | SidebarItemProps[] | SidebarSection): entry is SidebarSection =>\n !Array.isArray(entry) && 'items' in entry && 'title' in entry;\n\n/** The text of the sidebar, for other languages. */\nexport interface SidebarLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the button that opens the sidebar where it is a drawer (up to 1024px). */\n open: string;\n /** The name of the button that closes it there. */\n close: string;\n}\n\nconst defaultSidebarLabels: SidebarLabels = { navigation: 'Main', open: 'Open the menu', close: 'Close the menu' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'aside'> {\n /** The top of the sidebar: the logo, buttons. */\n header?: React.ReactNode;\n /** The bottom of the sidebar: settings, the account. */\n footer?: React.ReactNode;\n /** The path of the current page: its item gets `aria-current=\"page\"`, and its sub-menu starts open. */\n activePath?: string;\n /** Next to the button that opens the sidebar where it is a drawer, such as the logo. */\n mobileHeader?: React.ReactNode;\n /**\n * The items. An array of items is a group, set apart from the next by a line or room; a section (`{ title, items }`)\n * is a group with a label over it.\n */\n items: (SidebarItemProps | SidebarItemProps[] | SidebarSection)[];\n /** Called when an item is clicked, with its pathname. */\n onMenuItemClick?: ({ itemId }: { itemId: string }) => void;\n /** The text of the sidebar, in English by default. */\n labels?: Partial<SidebarLabels>;\n}\n\nconst keyOf = (item: SidebarItemProps, index: number) => item.pathname ?? `item-${index}`;\n\nconst SidebarBase = React.forwardRef<HTMLElement, SidebarProps>((props, ref) => {\n const { mobileHeader, header, footer, activePath, onMenuItemClick, items, labels, className, id, ...others } = props;\n const text = { ...defaultSidebarLabels, ...labels };\n const sidebarId = useUid(id);\n const panelRef = React.useRef<HTMLElement | null>(null);\n const setRefs = React.useCallback(\n (panel: HTMLElement | null) => {\n panelRef.current = panel;\n if (typeof ref === 'function') ref(panel);\n else if (ref) ref.current = panel;\n },\n [ref]\n );\n\n // Whether the drawer is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setDrawerOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n\n // The open sub-menus, by pathname: the current page's opens with it.\n const groupOf = React.useCallback(\n (path: string | undefined) =>\n items\n .flatMap((entry) => (isSection(entry) ? entry.items : entry))\n .find((item) => item.subMenu?.some((sub) => sub.pathname === path) || (item.subMenu && item.pathname === path))\n ?.pathname,\n [items]\n );\n const [openGroups, setOpenGroups] = React.useState(() => new Set([groupOf(activePath)].filter(Boolean)));\n React.useEffect(() => {\n const group = groupOf(activePath);\n if (group) setOpenGroups((open) => (open.has(group) ? open : new Set([...open, group])));\n }, [activePath, groupOf]);\n\n function onItemClick(item: SidebarItemProps) {\n if (item.pathname !== undefined) onMenuItemClick?.({ itemId: item.pathname });\n // Where the sidebar is a drawer, choosing a page closes it.\n if (!item.subMenu?.length && drawerOpen) panelRef.current?.hidePopover?.();\n }\n\n function renderItem(item: SidebarItemProps, index: number) {\n const { pathname, subMenu, icon, label, onClick, action, suffix, detail, ...linkProps } = item;\n if (subMenu && subMenu.length > 0) {\n const groupKey = keyOf(item, index);\n return (\n <li key={groupKey}>\n <details\n className=\"roaster-sidebar__group\"\n open={openGroups.has(groupKey)}\n onToggle={(event) => {\n const isOpen = event.currentTarget.open;\n setOpenGroups((open) => {\n if (open.has(groupKey) === isOpen) return open;\n const next = new Set(open);\n if (isOpen) next.add(groupKey);\n else next.delete(groupKey);\n return next;\n });\n }}\n >\n <summary className=\"roaster-sidebar__item\" onClick={() => onItemClick(item)}>\n {icon && <span className=\"roaster-sidebar__icon\">{icon}</span>}\n {label}\n {suffix != null && <span className=\"roaster-sidebar__end\">{suffix}</span>}\n {action && <span className=\"roaster-sidebar__end\">{action}</span>}\n </summary>\n <Menu.SubMenu>{subMenu.map((sub, subIndex) => renderItem(sub, subIndex))}</Menu.SubMenu>\n </details>\n </li>\n );\n }\n return (\n <Menu.Item\n key={keyOf(item, index)}\n {...linkProps}\n icon={icon}\n action={action}\n suffix={suffix}\n detail={detail}\n current={pathname !== undefined && pathname === activePath}\n onClick={(event) => {\n onClick?.(event);\n onItemClick(item);\n }}\n >\n {label}\n </Menu.Item>\n );\n }\n\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <div className=\"roaster-sidebar-opener\">\n <Button\n variant=\"ghost\"\n iconOnly\n aria-label={text.open}\n aria-controls={sidebarId}\n aria-expanded={drawerOpen}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <RoasterIcon name=\"menu\" />\n </Button>\n {mobileHeader}\n </div>\n\n <aside {...others} {...popover} id={sidebarId} ref={setRefs} className={classNames('roaster-sidebar', className)}>\n <Button\n variant=\"secondary\"\n iconOnly\n className=\"roaster-sidebar__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <RoasterIcon name=\"x\" />\n </Button>\n <nav className=\"roaster-sidebar__nav\" aria-label={text.navigation}>\n <Section className=\"roaster-sidebar__header\">{header}</Section>\n <Section className=\"roaster-sidebar__body\">\n {items.map((item, index) =>\n isSection(item) ? (\n <section\n key={`section-${index}`}\n className=\"roaster-sidebar__section\"\n aria-labelledby={`${sidebarId}-section-${index}`}\n >\n <h2 className=\"roaster-sidebar__label\" id={`${sidebarId}-section-${index}`}>\n {item.title}\n {item.action}\n </h2>\n <Menu>{item.items.map(renderItem)}</Menu>\n </section>\n ) : Array.isArray(item) ? (\n <Menu key={`group-${keyOf(item[0] ?? { label: '' }, index)}`}>{item.map(renderItem)}</Menu>\n ) : (\n <Menu key={`group-${keyOf(item, index)}`}>{renderItem(item, index)}</Menu>\n )\n )}\n </Section>\n <Section className=\"roaster-sidebar__footer\">{footer}</Section>\n </nav>\n </aside>\n </>\n );\n});\n\nSidebarBase.displayName = 'Sidebar';\n\n/**\n * The navigation of an application: a header (the logo, or the account button with a Sidebar.Back under it), groups\n * of items with sub-menus (`<details>`), labeled sections, and a footer. The current\n * page's item has `aria-current=\"page\"`. Up to a tablet's width (1024px), it is a drawer (a popover) that a bar at the\n * top opens, with a close button beside it.\n */\nexport const Sidebar = Object.assign(SidebarBase, { Section: Section, Menu: Menu, Back: Back });\n"],"names":["React","useUid","jsx","jsxs","Menu","Fragment","Button","RoasterIcon","classNames","Section","Back"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK;AAC1F,MAAM,oBAAoB,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE;AACnG,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACrD,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACtH,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE;AACrD,EAAE,MAAM,SAAS,GAAGC,YAAM,CAAC,EAAE,CAAC;AAC9B,EAAE,MAAM,QAAQ,GAAGD,gBAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACrC,EAAE,MAAM,OAAO,GAAGA,gBAAK,CAAC,WAAW;AACnC,IAAI,CAAC,KAAK,KAAK;AACf,MAAM,QAAQ,CAAC,OAAO,GAAG,KAAK;AAC9B,MAAM,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC;AAC/C,W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EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AAClF;AACA,aAAa;AACb,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;AAC7B,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmBF,cAAG,CAACE,SAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAY,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmBF,cAAG,CAACE,SAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACrP,SAAS,EAAE,CAAC;AACZ,wBAAwBF,cAAG,CAACO,eAAO,EAAE,EAAE,SAAS,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC/F,OAAO,EAAE;AACT,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,SAAS;AACvB,MAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,WAAEA,eAAO,QAAEL,SAAI,QAAEM,SAAI,EAAE;;"}
@@ -3,7 +3,8 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var Icon = require('../../Icon/Icon.js');
6
+ require('../../Icon/Icon.js');
7
+ var RoasterIcon = require('../../Icon/RoasterIcon.js');
7
8
  var index = require('../../../utils/classNames/index.js');
8
9
  var index$1 = require('../../../utils/Slot/index.js');
9
10
 
@@ -24,10 +25,13 @@ const Back = React__namespace.forwardRef(
24
25
  ({ children, asChild = false, className, ...others }, ref) => {
25
26
  const classes = index.classNames("roaster-sidebar__back", className);
26
27
  if (asChild && React__namespace.isValidElement(children)) {
27
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Slot, { ...others, ref, className: classes, children: React__namespace.cloneElement(children, void 0, [/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "chevron-left" }, "arrow"), children.props.children]) });
28
+ return /* @__PURE__ */ jsxRuntime.jsx(index$1.Slot, { ...others, ref, className: classes, children: React__namespace.cloneElement(children, void 0, [
29
+ /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-left" }, "arrow"),
30
+ children.props.children
31
+ ]) });
28
32
  }
29
33
  return /* @__PURE__ */ jsxRuntime.jsxs("a", { ...others, ref, className: classes, children: [
30
- /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "chevron-left" }),
34
+ /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-left" }),
31
35
  children
32
36
  ] });
33
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Back.js","sources":["../../../../../src/components/Sidebar/components/Back.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot } from '@/utils';\nimport { Icon } from '@/components/Icon';\n\n/** Every native `<a>` prop (`href`, `onClick`, ...) is accepted and forwarded to the link. */\nexport interface BackProps extends React.ComponentPropsWithoutRef<'a'> {\n /** Where it leads back to, such as \"Settings\" for the settings' navigation. */\n children: React.ReactNode;\n /**\n * Renders the only child (a router's Link) as the link, with the arrow before its text.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/** The way back out of a nested navigation, such as from the settings to the app: in the header, under the account. */\nexport const Back = React.forwardRef<HTMLAnchorElement, BackProps>(\n ({ children, asChild = false, className, ...others }, ref) => {\n const classes = classNames('roaster-sidebar__back', className);\n if (asChild && React.isValidElement<{ children?: React.ReactNode }>(children)) {\n return (\n <Slot {...others} ref={ref as React.Ref<HTMLElement>} className={classes}>\n {React.cloneElement(children, undefined, [<Icon key=\"arrow\" name=\"chevron-left\" />, children.props.children])}\n </Slot>\n );\n }\n return (\n <a {...others} ref={ref} className={classes}>\n <Icon name=\"chevron-left\" />\n {children}\n </a>\n );\n }\n);\nBack.displayName = 'SidebarBack';\n"],"names":["React","classNames","jsx","Slot","Icon","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,IAAI,GAAGA,gBAAK,CAAC,UAAU;AACpC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAChE,IAAI,MAAM,OAAO,GAAGC,gBAAU,CAAC,uBAAuB,EAAE,SAAS,CAAC;AAClE,IAAI,IAAI,OAAO,IAAID,gBAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;AACnD,MAAM,uBAAuBE,cAAG,CAACC,YAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAEH,gBAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiBE,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;AACvN,IAAI;AACJ,IAAI,uBAAuBC,eAAI,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrF,sBAAsBH,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACzD,MAAM;AACN,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,IAAI,CAAC,WAAW,GAAG,aAAa;;"}
1
+ {"version":3,"file":"Back.js","sources":["../../../../../src/components/Sidebar/components/Back.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot } from '@/utils';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** Every native `<a>` prop (`href`, `onClick`, ...) is accepted and forwarded to the link. */\nexport interface BackProps extends React.ComponentPropsWithoutRef<'a'> {\n /** Where it leads back to, such as \"Settings\" for the settings' navigation. */\n children: React.ReactNode;\n /**\n * Renders the only child (a router's Link) as the link, with the arrow before its text.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/** The way back out of a nested navigation, such as from the settings to the app: in the header, under the account. */\nexport const Back = React.forwardRef<HTMLAnchorElement, BackProps>(\n ({ children, asChild = false, className, ...others }, ref) => {\n const classes = classNames('roaster-sidebar__back', className);\n if (asChild && React.isValidElement<{ children?: React.ReactNode }>(children)) {\n return (\n <Slot {...others} ref={ref as React.Ref<HTMLElement>} className={classes}>\n {React.cloneElement(children, undefined, [\n <RoasterIcon key=\"arrow\" name=\"chevron-left\" />,\n children.props.children,\n ])}\n </Slot>\n );\n }\n return (\n <a {...others} ref={ref} className={classes}>\n <RoasterIcon name=\"chevron-left\" />\n {children}\n </a>\n );\n }\n);\nBack.displayName = 'SidebarBack';\n"],"names":["React","classNames","jsx","Slot","RoasterIcon","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,IAAI,GAAGA,gBAAK,CAAC,UAAU;AACpC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAChE,IAAI,MAAM,OAAO,GAAGC,gBAAU,CAAC,uBAAuB,EAAE,SAAS,CAAC;AAClE,IAAI,IAAI,OAAO,IAAID,gBAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;AACnD,MAAM,uBAAuBE,cAAG,CAACC,YAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAEH,gBAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE;AAC5H,wBAAwBE,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC;AAC3E,QAAQ,QAAQ,CAAC,KAAK,CAAC;AACvB,OAAO,CAAC,EAAE,CAAC;AACX,IAAI;AACJ,IAAI,uBAAuBC,eAAI,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrF,sBAAsBH,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AAChE,MAAM;AACN,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,IAAI,CAAC,WAAW,GAAG,aAAa;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Tooltip = require('../Tooltip/Tooltip.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var Progress = require('../Progress/Progress.js');
9
10
  var index = require('../../utils/useUid/index.js');
10
11
  var index$1 = require('../../utils/classNames/index.js');
@@ -36,7 +37,7 @@ const StatCardBase = React__namespace.forwardRef((props, ref) => {
36
37
  children: [
37
38
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-stat-card__header", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "roaster-stat-card__title", children: [
38
39
  /* @__PURE__ */ jsxRuntime.jsx("span", { id: titleId, children: title }),
39
- description && /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { label: description, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "roaster-stat-card__info", type: "button", "aria-label": text.info, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "circle-info" }) }) })
40
+ description && /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { label: description, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "roaster-stat-card__info", type: "button", "aria-label": text.info, children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "info" }) }) })
40
41
  ] }) }),
41
42
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-stat-card__body", children: [
42
43
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-stat-card__text", children: [
@@ -1 +1 @@
1
- {"version":3,"file":"StatCard.js","sources":["../../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Tooltip } from '../Tooltip';\nimport { Icon } from '@/components/Icon';\nimport { Progress } from '../Progress';\n\n/** The text of the stat card, for other languages. */\nexport interface StatCardLabels {\n /** The name of the button that shows the description, read by screen readers. */\n info: string;\n}\n\nconst defaultStatCardLabels: StatCardLabels = { info: 'More information' };\n\n/** Every native `<article>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface StatCardProps extends Omit<React.ComponentPropsWithoutRef<'article'>, 'title'> {\n /** The title of the statistic. It also names the ring. */\n title: React.ReactNode;\n /** The value of the statistic. */\n value: React.ReactNode;\n /** What the statistic means, in a tooltip on an info button next to the title. */\n description?: React.ReactNode;\n /** A ring showing the value as a percentage, from 0 to 100. */\n progressValue?: number;\n /** The line under the value, such as \"20 emails clicked\". */\n progressLabel?: string;\n /** The text of the card, in English by default. */\n labels?: Partial<StatCardLabels>;\n /** The shadow of a clickable card, on a card the page sets apart (the theme may give other cards none). */\n raised?: boolean;\n}\n\nconst StatCardBase = React.forwardRef<HTMLElement, StatCardProps>((props, ref) => {\n const { title, value, description, progressValue, progressLabel, labels, raised, className, ...others } = props;\n const text = { ...defaultStatCardLabels, ...labels };\n const titleId = useUid();\n return (\n <article\n {...others}\n ref={ref}\n className={classNames('roaster-stat-card', { 'roaster-stat-card--raised': raised }, className)}\n >\n <div className=\"roaster-stat-card__header\">\n <p className=\"roaster-stat-card__title\">\n <span id={titleId}>{title}</span>\n {description && (\n <Tooltip label={description}>\n <button className=\"roaster-stat-card__info\" type=\"button\" aria-label={text.info}>\n <Icon name=\"circle-info\" />\n </button>\n </Tooltip>\n )}\n </p>\n </div>\n\n <div className=\"roaster-stat-card__body\">\n <div className=\"roaster-stat-card__text\">\n <span className=\"roaster-stat-card__value\">{value}</span>\n <small className=\"roaster-stat-card__description\">{progressLabel}</small>\n </div>\n\n {progressValue !== undefined && progressValue >= 0 && (\n <Progress variant=\"circular\" value={progressValue} aria-labelledby={titleId} />\n )}\n </div>\n </article>\n );\n});\n\nStatCardBase.displayName = 'StatCard';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface StatCardGroupProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The stat cards. */\n children: React.ReactNode;\n /**\n * `compact`: figures in a row without frames, such as a table's totals. `headline`: a report's head figures, each\n * name underlined in dots where it has a `title` that explains it; a group holding one card shows its figure larger.\n */\n variant?: 'default' | 'compact' | 'headline';\n}\n\n/** A row of stat cards. */\nexport const StatCardGroup = React.forwardRef<HTMLDivElement, StatCardGroupProps>(\n ({ children, variant = 'default', className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-stat-card-group',\n { [`roaster-stat-card-group--${variant}`]: variant !== 'default' },\n className\n )}\n >\n {children}\n </div>\n )\n);\nStatCardGroup.displayName = 'StatCardGroup';\n\n/** A card showing one statistic: a title, a value, a line under it and an optional ring. StatCard.Group sets them in a row. */\nexport const StatCard = Object.assign(StatCardBase, { Group: StatCardGroup });\n"],"names":["React","useUid","jsxs","classNames","jsx","Tooltip","Icon","Progress"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE;AAC1D,MAAM,YAAY,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa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,EAAE,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACnG,4BAA4BA,cAAG,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gCAAgC,EAAE,QAAQ,EAAE,aAAa,EAAE;AACjH,WAAW,EAAE,CAAC;AACd,UAAU,aAAa,KAAK,MAAM,IAAI,aAAa,IAAI,CAAC,oBAAoBA,cAAG,CAACG,iBAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE;AACnK,SAAS,EAAE;AACX;AACA;AACA,GAAG;AACH,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,aAAa,GAAGP,gBAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBI,cAAG;AACvF,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAED,kBAAU;AAC3B,QAAQ,yBAAyB;AACjC,QAAQ,EAAE,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,EAAE;AAC1E,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;AAC/B,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;;"}
1
+ {"version":3,"file":"StatCard.js","sources":["../../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Tooltip } from '../Tooltip';\nimport { RoasterIcon } from '@/components/Icon';\nimport { Progress } from '../Progress';\n\n/** The text of the stat card, for other languages. */\nexport interface StatCardLabels {\n /** The name of the button that shows the description, read by screen readers. */\n info: string;\n}\n\nconst defaultStatCardLabels: StatCardLabels = { info: 'More information' };\n\n/** Every native `<article>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface StatCardProps extends Omit<React.ComponentPropsWithoutRef<'article'>, 'title'> {\n /** The title of the statistic. It also names the ring. */\n title: React.ReactNode;\n /** The value of the statistic. */\n value: React.ReactNode;\n /** What the statistic means, in a tooltip on an info button next to the title. */\n description?: React.ReactNode;\n /** A ring showing the value as a percentage, from 0 to 100. */\n progressValue?: number;\n /** The line under the value, such as \"20 emails clicked\". */\n progressLabel?: string;\n /** The text of the card, in English by default. */\n labels?: Partial<StatCardLabels>;\n /** The shadow of a clickable card, on a card the page sets apart (the theme may give other cards none). */\n raised?: boolean;\n}\n\nconst StatCardBase = React.forwardRef<HTMLElement, StatCardProps>((props, ref) => {\n const { title, value, description, progressValue, progressLabel, labels, raised, className, ...others } = props;\n const text = { ...defaultStatCardLabels, ...labels };\n const titleId = useUid();\n return (\n <article\n {...others}\n ref={ref}\n className={classNames('roaster-stat-card', { 'roaster-stat-card--raised': raised }, className)}\n >\n <div className=\"roaster-stat-card__header\">\n <p className=\"roaster-stat-card__title\">\n <span id={titleId}>{title}</span>\n {description && (\n <Tooltip label={description}>\n <button className=\"roaster-stat-card__info\" type=\"button\" aria-label={text.info}>\n <RoasterIcon name=\"info\" />\n </button>\n </Tooltip>\n )}\n </p>\n </div>\n\n <div className=\"roaster-stat-card__body\">\n <div className=\"roaster-stat-card__text\">\n <span className=\"roaster-stat-card__value\">{value}</span>\n <small className=\"roaster-stat-card__description\">{progressLabel}</small>\n </div>\n\n {progressValue !== undefined && progressValue >= 0 && (\n <Progress variant=\"circular\" value={progressValue} aria-labelledby={titleId} />\n )}\n </div>\n </article>\n );\n});\n\nStatCardBase.displayName = 'StatCard';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface StatCardGroupProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The stat cards. */\n children: React.ReactNode;\n /**\n * `compact`: figures in a row without frames, such as a table's totals. `headline`: a report's head figures, each\n * name underlined in dots where it has a `title` that explains it; a group holding one card shows its figure larger.\n */\n variant?: 'default' | 'compact' | 'headline';\n}\n\n/** A row of stat cards. */\nexport const StatCardGroup = React.forwardRef<HTMLDivElement, StatCardGroupProps>(\n ({ children, variant = 'default', className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-stat-card-group',\n { [`roaster-stat-card-group--${variant}`]: variant !== 'default' },\n className\n )}\n >\n {children}\n </div>\n )\n);\nStatCardGroup.displayName = 'StatCardGroup';\n\n/** A card showing one statistic: a title, a value, a line under it and an optional ring. StatCard.Group sets them in a row. */\nexport const StatCard = Object.assign(StatCardBase, { Group: StatCardGroup });\n"],"names":["React","useUid","jsxs","classNames","jsx","Tooltip","RoasterIcon","Progress"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE;AAC1D,MAAM,YAAY,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACjH,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,qBAAqB,EAAE,GAAG,MAAM,EAAE;AACtD,EAAE,MAAM,OAAO,GAAGC,YAAM,EAAE;AAC1B,EAAE,uBAAuBC,eAAI;AAC7B,IAAI,SAAS;AACb,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,kBAAU,CAAC,mBAAmB,EAAE,EAAE,2BAA2B,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC;AACpG,MAAM,QAAQ,EAAE;AACh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,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,aAAa,GAAGP,gBAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBI,cAAG;AACvF,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAED,kBAAU;AAC3B,QAAQ,yBAAyB;AACjC,QAAQ,EAAE,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,EAAE;AAC1E,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;AAC/B,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;;"}
@@ -29,6 +29,7 @@ const Switch = React__namespace.forwardRef((props, ref) => {
29
29
  checked: checkedProp,
30
30
  defaultChecked = false,
31
31
  description,
32
+ keepDescription,
32
33
  error,
33
34
  className,
34
35
  style,
@@ -54,6 +55,7 @@ const Switch = React__namespace.forwardRef((props, ref) => {
54
55
  controlId: uid,
55
56
  label: beside ? void 0 : label,
56
57
  description,
58
+ keepDescription,
57
59
  error,
58
60
  className,
59
61
  style,
@@ -62,7 +64,11 @@ const Switch = React__namespace.forwardRef((props, ref) => {
62
64
  "input",
63
65
  {
64
66
  ...others,
65
- ...Field.fieldControlProps(uid, { description, error }, others),
67
+ ...Field.fieldControlProps(
68
+ uid,
69
+ { description, error, keepDescription },
70
+ others
71
+ ),
66
72
  ref,
67
73
  type: "checkbox",
68
74
  role: "switch",
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the switch input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SwitchProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the switch element (optional). */\n id?: string;\n /** The name attribute to be applied to the switch element (optional). */\n name?: string;\n /** Whether the switch toggle should be disabled (optional). */\n disabled?: boolean;\n /** The checked state of the switch toggle, for a controlled switch (optional). */\n checked?: boolean;\n /** The default checked state of the switch toggle, for an uncontrolled switch (optional). */\n defaultChecked?: boolean;\n /** Called with the new state when the user toggles the switch. The native `onChange` gets the event. */\n onCheckedChange?(value: boolean): void;\n /**\n * Where the label goes: over the switch, as a field's label (`top`), or beside it (`end`), as a checkbox's, such as\n * in a list of settings.\n * @defaultValue 'top'\n */\n labelPosition?: 'top' | 'end';\n}\n\n/**\n * A toggle switch with a label, over it or beside it. Control it with checked and onCheckedChange, or leave it\n * uncontrolled with defaultChecked.\n */\nexport const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n checked: checkedProp,\n defaultChecked = false,\n description,\n error,\n className,\n style,\n onChange,\n onCheckedChange,\n labelPosition = 'top',\n ...others\n } = props;\n const beside = labelPosition === 'end';\n const [checked, setChecked] = useControllableState<boolean>({\n value: checkedProp,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setChecked(event.currentTarget.checked);\n };\n\n return (\n <Field\n controlId={uid}\n label={beside ? undefined : label}\n description={description}\n error={error}\n className={className}\n style={style}\n >\n {/* Its own label too, so a click on the toggle reaches the input; beside it, it holds the text. */}\n <label className=\"roaster-switch\">\n <input\n {...others}\n {...fieldControlProps(uid, { label: beside ? undefined : label, description, error }, others)}\n ref={ref}\n type=\"checkbox\"\n role=\"switch\"\n className=\"roaster-switch__input\"\n name={name}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n />\n <span className=\"roaster-switch__track\" />\n {beside && label && <span className=\"roaster-switch__label\">{label}</span>}\n </label>\n </Field>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"names":["React","useControllableState","useUid","jsx","Field","jsxs","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,MAAM,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,cAAc,GAAG,KAAK;AAC1B,IAAI,WAAW;AACf,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,MAAM,GAAG,aAAa,KAAK,KAAK;AACxC,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,0BAAoB,CAAC;AACrD,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,YAAY,EAAE,cAAc,IAAI,KAAK;AACzC,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAAG,GAAGC,cAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AAC3C,EAAE,CAAC;AACH,EAAE,uBAAuBC,cAAG;AAC5B,IAAIC,WAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;AACpC,MAAM,WAAW;AACjB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,kBAAkBC,eAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE;AACvF,wBAAwBF,cAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAGG,uBAAiB,CAAC,GAAG,EAAE,EAAkC,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AACrG,YAAY,GAAG;AACf,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,SAAS,EAAE,uBAAuB;AAC9C,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ,EAAE;AACtB;AACA,SAAS;AACT,wBAAwBH,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,QAAQ,MAAM,IAAI,KAAK,oBAAoBA,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the switch input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SwitchProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the switch element (optional). */\n id?: string;\n /** The name attribute to be applied to the switch element (optional). */\n name?: string;\n /** Whether the switch toggle should be disabled (optional). */\n disabled?: boolean;\n /** The checked state of the switch toggle, for a controlled switch (optional). */\n checked?: boolean;\n /** The default checked state of the switch toggle, for an uncontrolled switch (optional). */\n defaultChecked?: boolean;\n /** Called with the new state when the user toggles the switch. The native `onChange` gets the event. */\n onCheckedChange?(value: boolean): void;\n /**\n * Where the label goes: over the switch, as a field's label (`top`), or beside it (`end`), as a checkbox's, such as\n * in a list of settings.\n * @defaultValue 'top'\n */\n labelPosition?: 'top' | 'end';\n}\n\n/**\n * A toggle switch with a label, over it or beside it. Control it with checked and onCheckedChange, or leave it\n * uncontrolled with defaultChecked.\n */\nexport const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n checked: checkedProp,\n defaultChecked = false,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onCheckedChange,\n labelPosition = 'top',\n ...others\n } = props;\n const beside = labelPosition === 'end';\n const [checked, setChecked] = useControllableState<boolean>({\n value: checkedProp,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setChecked(event.currentTarget.checked);\n };\n\n return (\n <Field\n controlId={uid}\n label={beside ? undefined : label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n {/* Its own label too, so a click on the toggle reaches the input; beside it, it holds the text. */}\n <label className=\"roaster-switch\">\n <input\n {...others}\n {...fieldControlProps(\n uid,\n { label: beside ? undefined : label, description, error, keepDescription },\n others\n )}\n ref={ref}\n type=\"checkbox\"\n role=\"switch\"\n className=\"roaster-switch__input\"\n name={name}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n />\n <span className=\"roaster-switch__track\" />\n {beside && label && <span className=\"roaster-switch__label\">{label}</span>}\n </label>\n </Field>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"names":["React","useControllableState","useUid","jsx","Field","jsxs","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,MAAM,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,cAAc,GAAG,KAAK;AAC1B,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,MAAM,GAAG,aAAa,KAAK,KAAK;AACxC,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,0BAAoB,CAAC;AACrD,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,YAAY,EAAE,cAAc,IAAI,KAAK;AACzC,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAAG,GAAGC,cAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AAC3C,EAAE,CAAC;AACH,EAAE,uBAAuBC,cAAG;AAC5B,IAAIC,WAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;AACpC,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,kBAAkBC,eAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE;AACvF,wBAAwBF,cAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAGG,uBAAiB;AAChC,cAAc,GAAG;AACjB,cAAc,EAAkC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE;AACrF,cAAc;AACd,aAAa;AACb,YAAY,GAAG;AACf,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,SAAS,EAAE,uBAAuB;AAC9C,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ,EAAE;AACtB;AACA,SAAS;AACT,wBAAwBH,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,QAAQ,MAAM,IAAI,KAAK,oBAAoBA,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Tooltip = require('../../Tooltip/Tooltip.js');
7
- var Icon = require('../../Icon/Icon.js');
7
+ require('../../Icon/Icon.js');
8
+ var RoasterIcon = require('../../Icon/RoasterIcon.js');
8
9
  var labels = require('../labels.js');
9
10
  var index = require('../../../utils/classNames/index.js');
10
11
 
@@ -28,7 +29,7 @@ const TableHeadCell = React__namespace.forwardRef(
28
29
  title,
29
30
  children,
30
31
  description && " ",
31
- description && /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { placement: "bottom", ...tooltipProps, label: description, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "roaster-table__info", type: "button", "aria-label": text.columnInfo, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "circle-info" }) }) })
32
+ description && /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { placement: "bottom", ...tooltipProps, label: description, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "roaster-table__info", type: "button", "aria-label": text.columnInfo, children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "info" }) }) })
32
33
  ] }) });
33
34
  }
34
35
  );
@@ -39,7 +40,7 @@ const TableSortButton = React__namespace.forwardRef(
39
40
  const sort = React__namespace.useContext(SortContext);
40
41
  return /* @__PURE__ */ jsxRuntime.jsxs("button", { ...props, ref, type, className: index.classNames("roaster-table__sort", className), children: [
41
42
  children,
42
- sort && /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: sort === "ascending" ? "arrow-up" : "arrow-down" })
43
+ sort && /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: sort === "ascending" ? "arrow-up" : "arrow-down" })
43
44
  ] });
44
45
  }
45
46
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeadCell.js","sources":["../../../../../src/components/Table/components/TableHeadCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip, TooltipProps } from '@/components/Tooltip';\nimport { Icon } from '@/components/Icon';\nimport type { TableColumnPriority, TableDataType } from '../Table.types';\nimport { TableLabelsContext } from '../labels';\nimport { classNames } from '@/utils';\n\n/** Every native `<th>` prop is accepted and forwarded to it. */\nexport interface TableHeadCellBaseProps extends Omit<React.ComponentPropsWithoutRef<'th'>, 'title'> {\n /** The column's kind of data, which aligns its cells (`data-type`). */\n type: TableDataType;\n /** What the column means, in a tooltip on an info button after the title. */\n description?: React.ReactNode;\n /** The tooltip's other props, such as `placement`. */\n tooltipProps?: Omit<TooltipProps, 'children' | 'label'>;\n /** How the column sorts the rows (`aria-sort`), with an arrow after its Table.SortButton's title. */\n sort?: 'ascending' | 'descending';\n /** `secondary`: hidden on a phone, with its column (give the column the same priority in `Table`'s `columns`). */\n priority?: TableColumnPriority;\n}\n\nexport interface TableHeadCellPropsWithChildren extends TableHeadCellBaseProps {\n /** The title of the column. */\n children?: React.ReactNode;\n title?: never;\n}\n\nexport interface TableHeadCellPropsWithTitle extends TableHeadCellBaseProps {\n children?: never;\n /** The title of the column. */\n title?: React.ReactNode;\n}\n\nexport type TableHeadCellProps = TableHeadCellPropsWithChildren | TableHeadCellPropsWithTitle;\n\n/** A column title, with an optional info button that shows the column's description. */\nexport const TableHeadCell = React.forwardRef<HTMLTableCellElement, TableHeadCellProps>(\n ({ title, type, description, tooltipProps, sort, priority, children, ...props }, ref) => {\n const text = React.useContext(TableLabelsContext);\n return (\n <th {...props} ref={ref} data-type={type} data-priority={priority} aria-sort={sort}>\n <SortContext.Provider value={sort}>\n {title}\n {children}\n {description && ' '}\n {description && (\n <Tooltip placement=\"bottom\" {...tooltipProps} label={description}>\n <button className=\"roaster-table__info\" type=\"button\" aria-label={text.columnInfo}>\n <Icon name=\"circle-info\" />\n </button>\n </Tooltip>\n )}\n </SortContext.Provider>\n </th>\n );\n }\n);\n\nTableHeadCell.displayName = 'TableHeadCell';\n\nconst SortContext = React.createContext<TableHeadCellBaseProps['sort']>(undefined);\n\n/** Every native `<button>` prop is accepted and forwarded to it. */\nexport interface TableSortButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The column's title. */\n children: React.ReactNode;\n}\n\n/**\n * A sortable column's title, as a button: it sorts the rows, or opens a menu of sort orders (in ActionList.Trigger).\n * The column's `sort` adds its arrow.\n */\nexport const TableSortButton = React.forwardRef<HTMLButtonElement, TableSortButtonProps>(\n ({ children, className, type = 'button', ...props }, ref) => {\n const sort = React.useContext(SortContext);\n return (\n <button {...props} ref={ref} type={type} className={classNames('roaster-table__sort', className)}>\n {children}\n {sort && <Icon name={sort === 'ascending' ? 'arrow-up' : 'arrow-down'} />}\n </button>\n );\n }\n);\nTableSortButton.displayName = 'TableSort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AAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAC/D,IAAI,MAAM,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAAC,WAAW,CAAC;AAC9C,IAAI,uBAAuBG,eAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAEG,gBAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACpI,MAAM,QAAQ;AACd,MAAM,IAAI,oBAAoBJ,cAAG,CAACG,SAAI,EAAE,EAAE,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,UAAU,GAAG,YAAY,EAAE;AAClG,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;"}
1
+ {"version":3,"file":"TableHeadCell.js","sources":["../../../../../src/components/Table/components/TableHeadCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip, TooltipProps } from '@/components/Tooltip';\nimport { RoasterIcon } from '@/components/Icon';\nimport type { TableColumnPriority, TableDataType } from '../Table.types';\nimport { TableLabelsContext } from '../labels';\nimport { classNames } from '@/utils';\n\n/** Every native `<th>` prop is accepted and forwarded to it. */\nexport interface TableHeadCellBaseProps extends Omit<React.ComponentPropsWithoutRef<'th'>, 'title'> {\n /** The column's kind of data, which aligns its cells (`data-type`). */\n type: TableDataType;\n /** What the column means, in a tooltip on an info button after the title. */\n description?: React.ReactNode;\n /** The tooltip's other props, such as `placement`. */\n tooltipProps?: Omit<TooltipProps, 'children' | 'label'>;\n /** How the column sorts the rows (`aria-sort`), with an arrow after its Table.SortButton's title. */\n sort?: 'ascending' | 'descending';\n /** `secondary`: hidden on a phone, with its column (give the column the same priority in `Table`'s `columns`). */\n priority?: TableColumnPriority;\n}\n\nexport interface TableHeadCellPropsWithChildren extends TableHeadCellBaseProps {\n /** The title of the column. */\n children?: React.ReactNode;\n title?: never;\n}\n\nexport interface TableHeadCellPropsWithTitle extends TableHeadCellBaseProps {\n children?: never;\n /** The title of the column. */\n title?: React.ReactNode;\n}\n\nexport type TableHeadCellProps = TableHeadCellPropsWithChildren | TableHeadCellPropsWithTitle;\n\n/** A column title, with an optional info button that shows the column's description. */\nexport const TableHeadCell = React.forwardRef<HTMLTableCellElement, TableHeadCellProps>(\n ({ title, type, description, tooltipProps, sort, priority, children, ...props }, ref) => {\n const text = React.useContext(TableLabelsContext);\n return (\n <th {...props} ref={ref} data-type={type} data-priority={priority} aria-sort={sort}>\n <SortContext.Provider value={sort}>\n {title}\n {children}\n {description && ' '}\n {description && (\n <Tooltip placement=\"bottom\" {...tooltipProps} label={description}>\n <button className=\"roaster-table__info\" type=\"button\" aria-label={text.columnInfo}>\n <RoasterIcon name=\"info\" />\n </button>\n </Tooltip>\n )}\n </SortContext.Provider>\n </th>\n );\n }\n);\n\nTableHeadCell.displayName = 'TableHeadCell';\n\nconst SortContext = React.createContext<TableHeadCellBaseProps['sort']>(undefined);\n\n/** Every native `<button>` prop is accepted and forwarded to it. */\nexport interface TableSortButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The column's title. */\n children: React.ReactNode;\n}\n\n/**\n * A sortable column's title, as a button: it sorts the rows, or opens a menu of sort orders (in ActionList.Trigger).\n * The column's `sort` adds its arrow.\n */\nexport const TableSortButton = React.forwardRef<HTMLButtonElement, TableSortButtonProps>(\n ({ children, className, type = 'button', ...props }, ref) => {\n const sort = React.useContext(SortContext);\n return (\n <button {...props} ref={ref} type={type} className={classNames('roaster-table__sort', className)}>\n {children}\n {sort && <RoasterIcon name={sort === 'ascending' ? 'arrow-up' : 'arrow-down'} />}\n </button>\n );\n }\n);\nTableSortButton.displayName = 'TableSortButton';\n"],"names":["React","TableLabelsContext","jsx","jsxs","Tooltip","RoasterIcon","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,aAAa,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C/D,IAAI,MAAM,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAAC,WAAW,CAAC;AAC9C,IAAI,uBAAuBG,eAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAEG,gBAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACpI,MAAM,QAAQ;AACd,MAAM,IAAI,oBAAoBJ,cAAG,CAACG,uBAAW,EAAE,EAAE,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,UAAU,GAAG,YAAY,EAAE;AACzG,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;"}
@@ -5,7 +5,8 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var TagGroup = require('./TagGroup.js');
7
7
  var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
8
- var Icon = require('../Icon/Icon.js');
8
+ require('../Icon/Icon.js');
9
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
9
10
  var index = require('../../utils/classNames/index.js');
10
11
 
11
12
  function _interopNamespaceDefault(e) {
@@ -39,7 +40,7 @@ const TagBase = React__namespace.forwardRef(
39
40
  ),
40
41
  children: [
41
42
  children,
42
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { className: "roaster-tag__remove", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" }) })
43
+ onRemove && /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { className: "roaster-tag__remove", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" }) })
43
44
  ]
44
45
  }
45
46
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { TagGroup } from './TagGroup';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\n/** The tones of a tag. */\nexport type TagTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the tag, for other languages. */\nexport interface TagLabels {\n /** The name of the remove button, read by screen readers. By default \"Remove\" and the tag's text, when it is text. */\n remove: string;\n}\n\n/**\n * Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it, except the obsolete\n * `color`, left out so that v1's `color` prop is an error rather than ignored: use `tone`.\n */\nexport interface TagProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The content of the tag: text, with an optional icon. */\n children: React.ReactNode;\n /** Shows a remove button, which calls it. */\n onRemove?(): void;\n /**\n * The tone of the tag.\n * @defaultValue 'neutral'\n */\n tone?: TagTone;\n /**\n * `outline` draws an edge instead of a fill, such as for a role (\"Admin\") or a state that asks for nothing; `solid`\n * fills it with the inverted color, such as for a plan name (\"Pro\"); `inline` is a soft pill in a sentence, at the\n * text's own size, such as what the sentence counts.\n */\n variant?: 'outline' | 'solid' | 'inline';\n /** `small` is a lower tag, such as beside a name in a comment's header. */\n size?: 'small';\n /** The text of the tag, in English by default. */\n labels?: Partial<TagLabels>;\n}\n\nconst TagBase = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ children, onRemove, tone = 'neutral', variant, size, labels, className, ...others }, ref) => {\n const text = typeof children === 'string' || typeof children === 'number' ? ` ${children}` : '';\n const removeLabel = labels?.remove ?? `Remove${text}`;\n return (\n <span\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-tag',\n `roaster-tag--${tone}`,\n variant && `roaster-tag--${variant}`,\n size && `roaster-tag--${size}`,\n className\n )}\n >\n {children}\n {onRemove && (\n <ButtonIcon className=\"roaster-tag__remove\" aria-label={removeLabel} onClick={onRemove}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n )}\n </span>\n );\n }\n);\n\nTagBase.displayName = 'Tag';\n\n/** Every native `<span>` prop is accepted and forwarded to it. */\nexport interface TagDotProps extends React.ComponentPropsWithoutRef<'span'> {\n /**\n * The dot's color, such as a label's: a tone, or `primary`. By default the text's color.\n */\n tone?: TagTone | 'primary';\n}\n\n/** A colored dot before a tag's text, such as a label's color. Hidden from screen readers: the text says it. */\nconst TagDot = React.forwardRef<HTMLSpanElement, TagDotProps>(({ tone, className, ...others }, ref) => (\n <span\n aria-hidden=\"true\"\n {...others}\n ref={ref}\n className={classNames('roaster-tag__dot', tone && `roaster-icon-${tone === 'neutral' ? 'muted' : tone}`, className)}\n />\n));\n\nTagDot.displayName = 'Tag.Dot';\n\n/**\n * A small label in a tone (neutral, info, success, warning or danger), optionally removable with a labelled button.\n * Group tags with Tag.Group; Tag.Dot is a colored dot before the text.\n */\nexport const Tag = Object.assign(TagBase, { Group: TagGroup, Dot: TagDot });\n"],"names":["React","jsxs","classNames","jsx","ButtonIcon","Icon","TagGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,OAAO,GAAGA,gBAAK,CAAC,UAAU;AAChC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAClG,IAAI,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE;AACnG,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzD,IAAI,uBAAuBC,eAAI;AAC/B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,gBAAU;AAC7B,UAAU,aAAa;AACvB,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAChC,UAAU,OAAO,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC9C,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACxC,UAAU;AACV,SAAS;AACT,QAAQ,QAAQ,EAAE;AAClB,UAAU,QAAQ;AAClB,UAAU,QAAQ,oBAAoBC,cAAG,CAACC,qBAAU,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;AAChM;AACA;AACA,KAAK;AACL,EAAE;AACF,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,KAAK;AAC3B,MAAM,MAAM,GAAGL,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBG,cAAG;AAC5F,EAAE,MAAM;AACR,EAAE;AACF,IAAI,aAAa,EAAE,MAAM;AACzB,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAED,gBAAU,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS;AACtH;AACA,CAAC,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,SAAS;AAClB,MAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAEI,iBAAQ,EAAE,GAAG,EAAE,MAAM,EAAE;;"}
1
+ {"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { TagGroup } from './TagGroup';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The tones of a tag. */\nexport type TagTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the tag, for other languages. */\nexport interface TagLabels {\n /** The name of the remove button, read by screen readers. By default \"Remove\" and the tag's text, when it is text. */\n remove: string;\n}\n\n/**\n * Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it, except the obsolete\n * `color`, left out so that v1's `color` prop is an error rather than ignored: use `tone`.\n */\nexport interface TagProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The content of the tag: text, with an optional icon. */\n children: React.ReactNode;\n /** Shows a remove button, which calls it. */\n onRemove?(): void;\n /**\n * The tone of the tag.\n * @defaultValue 'neutral'\n */\n tone?: TagTone;\n /**\n * `outline` draws an edge instead of a fill, such as for a role (\"Admin\") or a state that asks for nothing; `solid`\n * fills it with the inverted color, such as for a plan name (\"Pro\"); `inline` is a soft pill in a sentence, at the\n * text's own size, such as what the sentence counts.\n */\n variant?: 'outline' | 'solid' | 'inline';\n /** `small` is a lower tag, such as beside a name in a comment's header. */\n size?: 'small';\n /** The text of the tag, in English by default. */\n labels?: Partial<TagLabels>;\n}\n\nconst TagBase = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ children, onRemove, tone = 'neutral', variant, size, labels, className, ...others }, ref) => {\n const text = typeof children === 'string' || typeof children === 'number' ? ` ${children}` : '';\n const removeLabel = labels?.remove ?? `Remove${text}`;\n return (\n <span\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-tag',\n `roaster-tag--${tone}`,\n variant && `roaster-tag--${variant}`,\n size && `roaster-tag--${size}`,\n className\n )}\n >\n {children}\n {onRemove && (\n <ButtonIcon className=\"roaster-tag__remove\" aria-label={removeLabel} onClick={onRemove}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n )}\n </span>\n );\n }\n);\n\nTagBase.displayName = 'Tag';\n\n/** Every native `<span>` prop is accepted and forwarded to it. */\nexport interface TagDotProps extends React.ComponentPropsWithoutRef<'span'> {\n /**\n * The dot's color, such as a label's: a tone, or `primary`. By default the text's color.\n */\n tone?: TagTone | 'primary';\n}\n\n/** A colored dot before a tag's text, such as a label's color. Hidden from screen readers: the text says it. */\nconst TagDot = React.forwardRef<HTMLSpanElement, TagDotProps>(({ tone, className, ...others }, ref) => (\n <span\n aria-hidden=\"true\"\n {...others}\n ref={ref}\n className={classNames('roaster-tag__dot', tone && `roaster-icon-${tone === 'neutral' ? 'muted' : tone}`, className)}\n />\n));\n\nTagDot.displayName = 'Tag.Dot';\n\n/**\n * A small label in a tone (neutral, info, success, warning or danger), optionally removable with a labelled button.\n * Group tags with Tag.Group; Tag.Dot is a colored dot before the text.\n */\nexport const Tag = Object.assign(TagBase, { Group: TagGroup, Dot: TagDot });\n"],"names":["React","jsxs","classNames","jsx","ButtonIcon","RoasterIcon","TagGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,OAAO,GAAGA,gBAAK,CAAC,UAAU;AAChC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAClG,IAAI,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE;AACnG,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzD,IAAI,uBAAuBC,eAAI;AAC/B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,gBAAU;AAC7B,UAAU,aAAa;AACvB,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAChC,UAAU,OAAO,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC9C,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACxC,UAAU;AACV,SAAS;AACT,QAAQ,QAAQ,EAAE;AAClB,UAAU,QAAQ;AAClB,UAAU,QAAQ,oBAAoBC,cAAG,CAACC,qBAAU,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;AACnM;AACA;AACA,KAAK;AACL,EAAE;AACF,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,KAAK;AAC3B,MAAM,MAAM,GAAGL,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBG,cAAG;AAC5F,EAAE,MAAM;AACR,EAAE;AACF,IAAI,aAAa,EAAE,MAAM;AACzB,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAED,gBAAU,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS;AACtH;AACA,CAAC,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,SAAS;AAClB,MAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAEI,iBAAQ,EAAE,GAAG,EAAE,MAAM,EAAE;;"}
@@ -31,6 +31,7 @@ const TextField = React__namespace.forwardRef((props, ref) => {
31
31
  onChange,
32
32
  onValueChange,
33
33
  description,
34
+ keepDescription,
34
35
  rightSection,
35
36
  type = "text",
36
37
  variant,
@@ -49,7 +50,7 @@ const TextField = React__namespace.forwardRef((props, ref) => {
49
50
  "input",
50
51
  {
51
52
  ...others,
52
- ...Field.fieldControlProps(uid, { description, error }, others),
53
+ ...Field.fieldControlProps(uid, { description, error, keepDescription }, others),
53
54
  ref,
54
55
  type,
55
56
  onChange: handleChange,
@@ -71,6 +72,7 @@ const TextField = React__namespace.forwardRef((props, ref) => {
71
72
  controlId: uid,
72
73
  label,
73
74
  description,
75
+ keepDescription,
74
76
  error,
75
77
  inline,
76
78
  className,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextFieldProps\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'className' | 'style'> {\n /** `plain` has no edge or fill, such as a reply's field in a card's footer. The focus ring stays. */\n variant?: 'plain';\n /** A prefix to display before the input. */\n prefix?: React.ReactNode;\n /** A suffix to display after the input. */\n suffix?: React.ReactNode;\n /** A section to display on the right side of the input. */\n rightSection?: React.ReactNode;\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The type of the input element, such as text, email, tel, url, number, or password. */\n type?: 'text' | 'email' | 'tel' | 'url' | 'number' | 'password';\n}\n\n/**\n * A single-line text field with a label, help text, error message, and an optional prefix, suffix or right-hand\n * section.\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {\n const {\n id,\n label,\n error,\n prefix,\n suffix,\n onChange,\n onValueChange,\n description,\n rightSection,\n type = 'text',\n variant,\n inline,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasRightSection = rightSection != null && rightSection !== false && rightSection !== '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n const input = (\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n type={type}\n onChange={handleChange}\n className={classNames('roaster-input', variant && `roaster-input--${variant}`, {\n 'roaster-merged-inputs__start': hasRightSection,\n 'roaster-input--prefixed': prefix,\n 'roaster-input--suffixed': suffix,\n })}\n />\n );\n // The prefix and suffix sit over the input, in a group as wide as it.\n const control =\n prefix || suffix ? (\n <div className=\"roaster-input-group\">\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n {input}\n {suffix && <span className=\"roaster-input-group__suffix\">{suffix}</span>}\n </div>\n ) : (\n input\n );\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n {hasRightSection ? (\n <div className=\"roaster-merged-inputs\">\n {control}\n {/* An element (a Button) takes the class; text is wrapped first. */}\n <Slot className=\"roaster-merged-inputs__end\">\n {React.isValidElement(rightSection) ? rightSection : <span>{rightSection}</span>}\n </Slot>\n </div>\n ) : (\n control\n )}\n </Field>\n );\n});\n\nTextField.displayName = 'TextField';\n"],"names":["React","useUid","jsx","fieldControlProps","classNames","jsxs","Field","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,IAAI,GAAG,MAAM;AACjB,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG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;AAC5B,IAAII,WAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK;AACX,MAAM,WAAW;AACjB,MAAM,KAAK;AACX,MAAM,MAAM;AACZ,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,EAAE,eAAe,mBAAmBD,eAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE;AAC9G,QAAQ,OAAO;AACf,wBAAwBH,cAAG,CAACK,YAAI,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,QAAQ,EAAEP,gBAAK,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,YAAY,mBAAmBE,cAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE;AACpM,OAAO,EAAE,CAAC,GAAG;AACb;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"TextField.js","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextFieldProps\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'className' | 'style'> {\n /** `plain` has no edge or fill, such as a reply's field in a card's footer. The focus ring stays. */\n variant?: 'plain';\n /** A prefix to display before the input. */\n prefix?: React.ReactNode;\n /** A suffix to display after the input. */\n suffix?: React.ReactNode;\n /** A section to display on the right side of the input. */\n rightSection?: React.ReactNode;\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The type of the input element, such as text, email, tel, url, number, or password. */\n type?: 'text' | 'email' | 'tel' | 'url' | 'number' | 'password';\n}\n\n/**\n * A single-line text field with a label, help text, error message, and an optional prefix, suffix or right-hand\n * section.\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {\n const {\n id,\n label,\n error,\n prefix,\n suffix,\n onChange,\n onValueChange,\n description,\n keepDescription,\n rightSection,\n type = 'text',\n variant,\n inline,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasRightSection = rightSection != null && rightSection !== false && rightSection !== '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n const input = (\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n ref={ref}\n type={type}\n onChange={handleChange}\n className={classNames('roaster-input', variant && `roaster-input--${variant}`, {\n 'roaster-merged-inputs__start': hasRightSection,\n 'roaster-input--prefixed': prefix,\n 'roaster-input--suffixed': suffix,\n })}\n />\n );\n // The prefix and suffix sit over the input, in a group as wide as it.\n const control =\n prefix || suffix ? (\n <div className=\"roaster-input-group\">\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n {input}\n {suffix && <span className=\"roaster-input-group__suffix\">{suffix}</span>}\n </div>\n ) : (\n input\n );\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n {hasRightSection ? (\n <div className=\"roaster-merged-inputs\">\n {control}\n {/* An element (a Button) takes the class; text is wrapped first. */}\n <Slot className=\"roaster-merged-inputs__end\">\n {React.isValidElement(rightSection) ? rightSection : <span>{rightSection}</span>}\n </Slot>\n </div>\n ) : (\n control\n )}\n </Field>\n );\n});\n\nTextField.displayName = 'TextField';\n"],"names":["React","useUid","jsx","fieldControlProps","classNames","jsxs","Field","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU,CAAC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AAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE;AAC/G,IAAI,MAAM,oBAAoBH,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACzG,IAAI,KAAK;AACT,IAAI,MAAM,oBAAoBA,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxG,GAAG,EAAE,CAAC,GAAG,KAAK;AACd,EAAE,uBAAuBA,cAAG;AAC5B,IAAII,WAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK;AACX,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,KAAK;AACX,MAAM,MAAM;AACZ,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,EAAE,eAAe,mBAAmBD,eAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE;AAC9G,QAAQ,OAAO;AACf,wBAAwBH,cAAG,CAACK,YAAI,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,QAAQ,EAAEP,gBAAK,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,YAAY,mBAAmBE,cAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE;AACpM,OAAO,EAAE,CAAC,GAAG;AACb;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -21,22 +21,54 @@ function _interopNamespaceDefault(e) {
21
21
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
22
22
 
23
23
  const Textarea = React__namespace.forwardRef((props, ref) => {
24
- const { label, error, id, description, onChange, onValueChange, variant, className, style, ...others } = props;
24
+ const {
25
+ label,
26
+ error,
27
+ id,
28
+ description,
29
+ keepDescription,
30
+ onChange,
31
+ onValueChange,
32
+ variant,
33
+ footer,
34
+ className,
35
+ style,
36
+ ...others
37
+ } = props;
25
38
  const uid = index.useUid(id);
39
+ const hasFooter = !(footer == null || typeof footer === "boolean" || footer === "");
40
+ const footerId = `${uid}-footer`;
26
41
  const handleChange = (event) => {
27
42
  onChange?.(event);
28
43
  onValueChange?.(event.currentTarget.value);
29
44
  };
30
- return /* @__PURE__ */ jsxRuntime.jsx(Field.Field, { controlId: uid, label, description, error, className, style, children: /* @__PURE__ */ jsxRuntime.jsx(
45
+ const describedBy = [others["aria-describedby"], hasFooter && footerId].filter(Boolean).join(" ") || void 0;
46
+ const textarea = /* @__PURE__ */ jsxRuntime.jsx(
31
47
  "textarea",
32
48
  {
33
49
  ...others,
34
- ...Field.fieldControlProps(uid, { description, error }, others),
50
+ ...Field.fieldControlProps(uid, { description, error, keepDescription }, { "aria-describedby": describedBy }),
35
51
  ref,
36
52
  className: index$1.classNames("roaster-textarea", variant && `roaster-input--${variant}`),
37
53
  onChange: handleChange
38
54
  }
39
- ) });
55
+ );
56
+ return /* @__PURE__ */ jsxRuntime.jsx(
57
+ Field.Field,
58
+ {
59
+ controlId: uid,
60
+ label,
61
+ description,
62
+ keepDescription,
63
+ error,
64
+ className,
65
+ style,
66
+ children: hasFooter ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-textarea-group", children: [
67
+ textarea,
68
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-textarea-group__footer", id: footerId, children: footer })
69
+ ] }) : textarea
70
+ }
71
+ );
40
72
  });
41
73
  Textarea.displayName = "Textarea";
42
74
 
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<textarea>` prop (`name`, `rows`, `required`, `aria-*`, ...) is accepted and forwarded to the\n * textarea, with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextareaProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'textarea'>, 'className' | 'style'> {\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** `plain` has no edge or fill, such as a comment's text area in a card. The focus ring stays. */\n variant?: 'plain';\n}\n\n/** A multiline text field with a label, help text and error message. */\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, ref) => {\n const { label, error, id, description, onChange, onValueChange, variant, className, style, ...others } = props;\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <textarea\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n className={classNames('roaster-textarea', variant && `roaster-input--${variant}`)}\n onChange={handleChange}\n />\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"names":["React","useUid","jsx","Field","fieldControlProps","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,QAAQ,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACzD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AAChH,EAAE,MAAM,GAAG,GAAGC,YAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AAC9C,EAAE,CAAC;AACH,EAAE,uBAAuBC,cAAG,CAACC,WAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,kBAAkBD,cAAG;AAChI,IAAI,UAAU;AACd,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAGE,uBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AACtE,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,kBAAU,CAAC,kBAAkB,EAAE,OAAO,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AACvF,MAAM,QAAQ,EAAE;AAChB;AACA,GAAG,EAAE,CAAC;AACN,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<textarea>` prop (`name`, `rows`, `required`, `aria-*`, ...) is accepted and forwarded to the\n * textarea, with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextareaProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'textarea'>, 'className' | 'style'> {\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** `plain` has no edge or fill, such as a comment's text area in a card. The focus ring stays. */\n variant?: 'plain';\n /**\n * A short text in the box, under the text at its end, such as a count of the characters: `912 / 1000`. The textarea\n * is described by it. Not with `plain`, which has no box: put it beside the card's buttons.\n */\n footer?: React.ReactNode;\n}\n\n/** A multiline text field with a label, help text and error message, and an optional footer in its box. */\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, ref) => {\n const {\n label,\n error,\n id,\n description,\n keepDescription,\n onChange,\n onValueChange,\n variant,\n footer,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasFooter = !(footer == null || typeof footer === 'boolean' || footer === '');\n const footerId = `${uid}-footer`;\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n // The footer describes the textarea after any description it already has, and before the field's texts under it.\n const describedBy = [others['aria-describedby'], hasFooter && footerId].filter(Boolean).join(' ') || undefined;\n const textarea = (\n <textarea\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, { 'aria-describedby': describedBy })}\n ref={ref}\n className={classNames('roaster-textarea', variant && `roaster-input--${variant}`)}\n onChange={handleChange}\n />\n );\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n {hasFooter ? (\n <div className=\"roaster-textarea-group\">\n {textarea}\n <div className=\"roaster-textarea-group__footer\" id={footerId}>\n {footer}\n </div>\n </div>\n ) : (\n textarea\n )}\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"names":["React","useUid","jsx","fieldControlProps","classNames","Field","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,QAAQ,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACzD,EAAE,MAAM;AACR,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,EAAE;AACN,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,GAAG,GAAGC,YAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,CAAC;AACrF,EAAE,MAAM,QAAQ,GAAG,CAAC,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;AACA,GAAG;AACH,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
@@ -3,7 +3,8 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var Icon = require('../Icon/Icon.js');
6
+ require('../Icon/Icon.js');
7
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
7
8
  var index = require('../../utils/useImageFallback/index.js');
8
9
  var index$1 = require('../../utils/classNames/index.js');
9
10
 
@@ -33,7 +34,7 @@ const Thumbnail = React__namespace.forwardRef(
33
34
  ref,
34
35
  className: index$1.classNames("roaster-thumbnail", className),
35
36
  style: { ...size && { width: size, height: size }, ...style },
36
- children: showFallback ? /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "image" }) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: src ?? void 0, alt: label, onError })
37
+ children: showFallback ? /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "image" }) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: src ?? void 0, alt: label, onError })
37
38
  }
38
39
  );
39
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Thumbnail.js","sources":["../../../../src/components/Thumbnail/Thumbnail.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useImageFallback } from '@/utils';\nimport { Icon } from '@/components/Icon';\n\n/** Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface ThumbnailProps extends React.ComponentPropsWithoutRef<'span'> {\n /** The URL of the picture. Without it, or when it fails to load, the thumbnail shows an image icon. */\n src?: string | null;\n /**\n * What the thumbnail says to screen readers. `''` when the name is already written next to it.\n * @defaultValue `name`\n */\n alt?: string;\n /** The name of the product or item. */\n name: string;\n /** The width and height, in pixels. */\n size?: number;\n}\n\n/** A small square picture of a product or an item, with an image icon when the picture is missing. */\nexport const Thumbnail = React.forwardRef<HTMLSpanElement, ThumbnailProps>(\n ({ src, alt, name, size, className, style, ...others }, ref) => {\n const { showFallback, onError } = useImageFallback(src);\n const label = alt ?? name;\n const fallbackProps = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };\n\n return (\n <span\n {...(showFallback ? fallbackProps : {})}\n {...others}\n ref={ref}\n className={classNames('roaster-thumbnail', className)}\n style={{ ...(size && { width: size, height: size }), ...style }}\n >\n {showFallback ? <Icon name=\"image\" /> : <img src={src ?? undefined} alt={label} onError={onError} />}\n </span>\n );\n }\n);\n\nThumbnail.displayName = 'Thumbnail';\n"],"names":["React","useImageFallback","jsx","classNames","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU;AACzC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAClE,IAAI,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAGC,sBAAgB,CAAC,GAAG,CAAC;AAC3D,IAAI,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI;AAC7B,IAAI,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAChG,IAAI,uBAAuBC,cAAG;AAC9B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,EAAE;AAC5C,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,kBAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAC7D,QAAQ,KAAK,EAAE,EAAE,GAAG,IAAI,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE;AACrE,QAAQ,QAAQ,EAAE,YAAY,mBAAmBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,mBAAmBF,cAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AACtJ;AACA,KAAK;AACL,EAAE;AACF;AACA,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"Thumbnail.js","sources":["../../../../src/components/Thumbnail/Thumbnail.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useImageFallback } from '@/utils';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface ThumbnailProps extends React.ComponentPropsWithoutRef<'span'> {\n /** The URL of the picture. Without it, or when it fails to load, the thumbnail shows an image icon. */\n src?: string | null;\n /**\n * What the thumbnail says to screen readers. `''` when the name is already written next to it.\n * @defaultValue `name`\n */\n alt?: string;\n /** The name of the product or item. */\n name: string;\n /** The width and height, in pixels. */\n size?: number;\n}\n\n/** A small square picture of a product or an item, with an image icon when the picture is missing. */\nexport const Thumbnail = React.forwardRef<HTMLSpanElement, ThumbnailProps>(\n ({ src, alt, name, size, className, style, ...others }, ref) => {\n const { showFallback, onError } = useImageFallback(src);\n const label = alt ?? name;\n const fallbackProps = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };\n\n return (\n <span\n {...(showFallback ? fallbackProps : {})}\n {...others}\n ref={ref}\n className={classNames('roaster-thumbnail', className)}\n style={{ ...(size && { width: size, height: size }), ...style }}\n >\n {showFallback ? <RoasterIcon name=\"image\" /> : <img src={src ?? undefined} alt={label} onError={onError} />}\n </span>\n );\n }\n);\n\nThumbnail.displayName = 'Thumbnail';\n"],"names":["React","useImageFallback","jsx","classNames","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU;AACzC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAClE,IAAI,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAGC,sBAAgB,CAAC,GAAG,CAAC;AAC3D,IAAI,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI;AAC7B,IAAI,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAChG,IAAI,uBAAuBC,cAAG;AAC9B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,EAAE;AAC5C,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,kBAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAC7D,QAAQ,KAAK,EAAE,EAAE,GAAG,IAAI,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE;AACrE,QAAQ,QAAQ,EAAE,YAAY,mBAAmBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,mBAAmBF,cAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7J;AACA,KAAK;AACL,EAAE;AACF;AACA,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var index = require('../../utils/classNames/index.js');
9
10
 
10
11
  function _interopNamespaceDefault(e) {
@@ -33,7 +34,7 @@ const Toast = React__namespace.forwardRef((props, ref) => {
33
34
  className: index.classNames("roaster-toast", `roaster-toast--${tone}`, className),
34
35
  children: [
35
36
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-toast__content", children }),
36
- closable && /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { className: "roaster-toast__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" }) })
37
+ closable && /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { className: "roaster-toast__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" }) })
37
38
  ]
38
39
  }
39
40
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\n/** The possible levels for a Toast component. */\n/** The tones of a toast, as Alert's: its color, and how urgently screen readers announce it. */\nexport type ToastTone = 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the toast, for other languages. */\nexport interface ToastLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultToastLabels: ToastLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface ToastProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), the others politely (`role=\"status\"`).\n * @defaultValue 'info'\n */\n tone?: ToastTone;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /**\n * Whether the user can close the toast with its close button.\n * @defaultValue true\n */\n closable?: boolean;\n /** The text of the toast, in English by default. */\n labels?: Partial<ToastLabels>;\n}\n\n/**\n * A temporary message shown in a corner of the screen. Show one with useToast() inside a ToastsProvider.\n */\nexport const Toast = React.forwardRef<HTMLDivElement, ToastProps>((props, ref) => {\n const { className, tone = 'info', closable = true, children, onClose, labels, ...others } = props;\n const text = { ...defaultToastLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-toast', `roaster-toast--${tone}`, className)}\n >\n <div className=\"roaster-toast__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-toast__close\" aria-label={text.close} onClick={onClose}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n )}\n </div>\n );\n});\n\nToast.displayName = 'Toast';\n"],"names":["React","jsxs","classNames","jsx","ButtonIcon","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AACjC,MAAC,KAAK,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnG,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,MAAM,EAAE;AACnD,EAAE,uBAAuBC,eAAI;AAC7B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,IAAI,EAAE,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ;AACxE,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,gBAAU,CAAC,eAAe,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC;AACjF,MAAM,QAAQ,EAAE;AAChB,wBAAwBC,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC;AACrF,QAAQ,QAAQ,oBAAoBA,cAAG,CAACC,qBAAU,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;AAC7L;AACA;AACA,GAAG;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The possible levels for a Toast component. */\n/** The tones of a toast, as Alert's: its color, and how urgently screen readers announce it. */\nexport type ToastTone = 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the toast, for other languages. */\nexport interface ToastLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultToastLabels: ToastLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface ToastProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), the others politely (`role=\"status\"`).\n * @defaultValue 'info'\n */\n tone?: ToastTone;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /**\n * Whether the user can close the toast with its close button.\n * @defaultValue true\n */\n closable?: boolean;\n /** The text of the toast, in English by default. */\n labels?: Partial<ToastLabels>;\n}\n\n/**\n * A temporary message shown in a corner of the screen. Show one with useToast() inside a ToastsProvider.\n */\nexport const Toast = React.forwardRef<HTMLDivElement, ToastProps>((props, ref) => {\n const { className, tone = 'info', closable = true, children, onClose, labels, ...others } = props;\n const text = { ...defaultToastLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-toast', `roaster-toast--${tone}`, className)}\n >\n <div className=\"roaster-toast__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-toast__close\" aria-label={text.close} onClick={onClose}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n )}\n </div>\n );\n});\n\nToast.displayName = 'Toast';\n"],"names":["React","jsxs","classNames","jsx","ButtonIcon","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AACjC,MAAC,KAAK,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnG,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,MAAM,EAAE;AACnD,EAAE,uBAAuBC,eAAI;AAC7B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,IAAI,EAAE,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ;AACxE,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,gBAAU,CAAC,eAAe,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC;AACjF,MAAM,QAAQ,EAAE;AAChB,wBAAwBC,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC;AACrF,QAAQ,QAAQ,oBAAoBA,cAAG,CAACC,qBAAU,EAAE,EAAE,SAAS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