@trellixio/roaster-react 2.1.2 → 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 (102) 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/ActionListItem.js +3 -2
  5. package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
  6. package/cjs/components/ActionList/components/ActionListSubmenu.js +3 -2
  7. package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  8. package/cjs/components/Alert/Alert.js +3 -2
  9. package/cjs/components/Alert/Alert.js.map +1 -1
  10. package/cjs/components/Button/Button.js +3 -2
  11. package/cjs/components/Button/Button.js.map +1 -1
  12. package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
  13. package/cjs/components/DatePicker/components/Calendar/Calendar.js +4 -3
  14. package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  15. package/cjs/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  16. package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  17. package/cjs/components/FileField/FileField.js +6 -5
  18. package/cjs/components/FileField/FileField.js.map +1 -1
  19. package/cjs/components/Icon/Icon.js.map +1 -1
  20. package/cjs/components/Icon/RoasterIcon.js +12 -0
  21. package/cjs/components/Icon/RoasterIcon.js.map +1 -0
  22. package/cjs/components/IconBadge/IconBadge.js.map +1 -1
  23. package/cjs/components/Modal/Modal.js +3 -2
  24. package/cjs/components/Modal/Modal.js.map +1 -1
  25. package/cjs/components/Pagination/Pagination.js +4 -3
  26. package/cjs/components/Pagination/Pagination.js.map +1 -1
  27. package/cjs/components/Sidebar/Sidebar.js +4 -3
  28. package/cjs/components/Sidebar/Sidebar.js.map +1 -1
  29. package/cjs/components/Sidebar/components/Back.js +7 -3
  30. package/cjs/components/Sidebar/components/Back.js.map +1 -1
  31. package/cjs/components/StatCard/StatCard.js +3 -2
  32. package/cjs/components/StatCard/StatCard.js.map +1 -1
  33. package/cjs/components/Table/components/TableHeadCell.js +4 -3
  34. package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
  35. package/cjs/components/Tag/Tag.js +3 -2
  36. package/cjs/components/Tag/Tag.js.map +1 -1
  37. package/cjs/components/Thumbnail/Thumbnail.js +3 -2
  38. package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
  39. package/cjs/components/Toast/Toast.js +3 -2
  40. package/cjs/components/Toast/Toast.js.map +1 -1
  41. package/cjs/components/Tooltip/TooltipCallout.js +3 -2
  42. package/cjs/components/Tooltip/TooltipCallout.js.map +1 -1
  43. package/cjs/components/Visualizer/Visualizer.js +4 -3
  44. package/cjs/components/Visualizer/Visualizer.js.map +1 -1
  45. package/esm/components/ActionList/components/ActionListItem.js +3 -2
  46. package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
  47. package/esm/components/ActionList/components/ActionListSubmenu.js +3 -2
  48. package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  49. package/esm/components/Alert/Alert.js +3 -2
  50. package/esm/components/Alert/Alert.js.map +1 -1
  51. package/esm/components/Button/Button.js +3 -2
  52. package/esm/components/Button/Button.js.map +1 -1
  53. package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
  54. package/esm/components/DatePicker/components/Calendar/Calendar.js +4 -3
  55. package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  56. package/esm/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  57. package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  58. package/esm/components/FileField/FileField.js +6 -5
  59. package/esm/components/FileField/FileField.js.map +1 -1
  60. package/esm/components/Icon/Icon.js.map +1 -1
  61. package/esm/components/Icon/RoasterIcon.js +10 -0
  62. package/esm/components/Icon/RoasterIcon.js.map +1 -0
  63. package/esm/components/IconBadge/IconBadge.js.map +1 -1
  64. package/esm/components/Modal/Modal.js +3 -2
  65. package/esm/components/Modal/Modal.js.map +1 -1
  66. package/esm/components/Pagination/Pagination.js +4 -3
  67. package/esm/components/Pagination/Pagination.js.map +1 -1
  68. package/esm/components/Sidebar/Sidebar.js +4 -3
  69. package/esm/components/Sidebar/Sidebar.js.map +1 -1
  70. package/esm/components/Sidebar/components/Back.js +7 -3
  71. package/esm/components/Sidebar/components/Back.js.map +1 -1
  72. package/esm/components/StatCard/StatCard.js +3 -2
  73. package/esm/components/StatCard/StatCard.js.map +1 -1
  74. package/esm/components/Table/components/TableHeadCell.js +4 -3
  75. package/esm/components/Table/components/TableHeadCell.js.map +1 -1
  76. package/esm/components/Tag/Tag.js +3 -2
  77. package/esm/components/Tag/Tag.js.map +1 -1
  78. package/esm/components/Thumbnail/Thumbnail.js +3 -2
  79. package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
  80. package/esm/components/Toast/Toast.js +3 -2
  81. package/esm/components/Toast/Toast.js.map +1 -1
  82. package/esm/components/Tooltip/TooltipCallout.js +3 -2
  83. package/esm/components/Tooltip/TooltipCallout.js.map +1 -1
  84. package/esm/components/Visualizer/Visualizer.js +4 -3
  85. package/esm/components/Visualizer/Visualizer.js.map +1 -1
  86. package/lib/components/ActionList/components/ActionListItem.d.ts +1 -1
  87. package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
  88. package/lib/components/ButtonIcon/ButtonIcon.d.ts +1 -1
  89. package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  90. package/lib/components/Icon/Icon.d.ts +13 -2
  91. package/lib/components/Icon/Icon.d.ts.map +1 -1
  92. package/lib/components/Icon/RoasterIcon.d.ts +13 -0
  93. package/lib/components/Icon/RoasterIcon.d.ts.map +1 -0
  94. package/lib/components/Icon/index.d.ts +2 -0
  95. package/lib/components/Icon/index.d.ts.map +1 -1
  96. package/lib/components/IconBadge/IconBadge.d.ts +2 -2
  97. package/lib/components/Sidebar/components/Back.d.ts.map +1 -1
  98. package/package.json +2 -2
  99. package/roaster.css +2 -1
  100. package/themes/azoth.css +1 -1
  101. package/themes/coffee.css +1 -1
  102. package/themes/scalar.css +1 -1
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Button = require('../Button/Button.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var Section = require('./components/Section.js');
9
10
  var Menu = require('./components/Menu.js');
10
11
  var Back = require('./components/Back.js');
@@ -121,7 +122,7 @@ const SidebarBase = React__namespace.forwardRef((props, ref) => {
121
122
  "aria-controls": sidebarId,
122
123
  "aria-expanded": drawerOpen,
123
124
  onClick: () => panelRef.current?.showPopover?.(),
124
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "bars" })
125
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "menu" })
125
126
  }
126
127
  ),
127
128
  mobileHeader
@@ -135,7 +136,7 @@ const SidebarBase = React__namespace.forwardRef((props, ref) => {
135
136
  className: "roaster-sidebar__close",
136
137
  "aria-label": text.close,
137
138
  onClick: () => panelRef.current?.hidePopover?.(),
138
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" })
139
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
139
140
  }
140
141
  ),
141
142
  /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "roaster-sidebar__nav", "aria-label": text.navigation, children: [
@@ -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,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,EA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AG,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,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,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,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,MA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K,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;AAChB,wBAAwBC,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkBF,eAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE;AACpK,0BAA0BE,cAAG,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACvE,UAAU,WAAW,oBAAoBA,cAAG,CAACC,eAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,kBAAkBD,cAAG,CAAC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AAO,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;;;"}
@@ -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 = 'TableSortButton';\n"],"names":["React","TableLabelsContext","jsx","jsxs","Tooltip","Icon","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,aAAa,GAAGA,gBAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAC3F,IAAI,MAAM,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAACC,yBAAkB,CAAC;AACrD,IAAI,uBAAuBC,cAAG,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,kBAAkBC,eAAI,CAAC,W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W,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,GAAGA,gBAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAC3F,IAAI,MAAM,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAACC,yBAAkB,CAAC;AACrD,IAAI,uBAAuBC,cAAG,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,kBAAkBC,eAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;AACrM,MAAM,KAAK;AACX,MAAM,QAAQ;AACd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Group.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(T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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","j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,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;;"}
@@ -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,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;AAChM;AACA;AACA,GAAG;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -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/useControllableState/index.js');
8
9
  var index$1 = require('../../utils/useUid/index.js');
9
10
  var index$2 = require('../../utils/classNames/index.js');
@@ -44,7 +45,7 @@ const TooltipCallout = React__namespace.forwardRef(
44
45
  type: "button",
45
46
  "aria-label": text.close,
46
47
  onClick: () => setShown(false),
47
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" })
48
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
48
49
  }
49
50
  ),
50
51
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "roaster-tooltip__title", id: titleId, children: title }),
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipCallout.js","sources":["../../../../src/components/Tooltip/TooltipCallout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { Icon } from '../Icon';\n\n/** The text of the callout, for other languages. */\nexport interface TooltipCalloutLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultLabels: TooltipCalloutLabels = { close: 'Dismiss' };\n\n/** Every native `<div>` prop is accepted and forwarded to the callout. */\nexport interface TooltipCalloutProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** The callout's title, which names it. */\n title: React.ReactNode;\n /** What it says under the title, and a link if any. */\n children: React.ReactNode;\n /** Whether the callout is shown, when the parent controls it. */\n open?: boolean;\n /**\n * Whether the callout starts shown, when it is not controlled.\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Called with `false` when its close button hides it. */\n onOpenChange?(open: boolean): void;\n /** The text of the callout, in English by default. */\n labels?: Partial<TooltipCalloutLabels>;\n}\n\n/**\n * A tooltip that stays open beside its host until it is closed, such as one that introduces a feature: a title, a\n * text, a link and a close button, with a line and a dot pointing at the host. Put it inside its host. It holds\n * controls, so it is a dialog named by its title.\n */\nexport const TooltipCallout = React.forwardRef<HTMLDivElement, TooltipCalloutProps>(\n ({ title, children, open, defaultOpen = true, onOpenChange, labels, className, ...others }, ref) => {\n const [shown, setShown] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });\n const titleId = useUid();\n const text = { ...defaultLabels, ...labels };\n if (!shown) return null;\n return (\n <div\n role=\"dialog\"\n aria-labelledby={titleId}\n {...others}\n ref={ref}\n className={classNames('roaster-tooltip', 'roaster-tooltip--callout', className)}\n >\n <button\n className=\"roaster-tooltip__close\"\n type=\"button\"\n aria-label={text.close}\n onClick={() => setShown(false)}\n >\n <Icon name=\"xmark\" />\n </button>\n <p className=\"roaster-tooltip__title\" id={titleId}>\n {title}\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kBA,cAAG,CAACC,SAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;AACnE;AACA,WAAW;AACX,0BAA0BD,cAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACzG,UAAU;AACV;AACA;AACA,KAAK;AACL,EAAE;AACF;AACA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;"}
1
+ {"version":3,"file":"TooltipCallout.js","sources":["../../../../src/components/Tooltip/TooltipCallout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { RoasterIcon } from '../Icon';\n\n/** The text of the callout, for other languages. */\nexport interface TooltipCalloutLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultLabels: TooltipCalloutLabels = { close: 'Dismiss' };\n\n/** Every native `<div>` prop is accepted and forwarded to the callout. */\nexport interface TooltipCalloutProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** The callout's title, which names it. */\n title: React.ReactNode;\n /** What it says under the title, and a link if any. */\n children: React.ReactNode;\n /** Whether the callout is shown, when the parent controls it. */\n open?: boolean;\n /**\n * Whether the callout starts shown, when it is not controlled.\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Called with `false` when its close button hides it. */\n onOpenChange?(open: boolean): void;\n /** The text of the callout, in English by default. */\n labels?: Partial<TooltipCalloutLabels>;\n}\n\n/**\n * A tooltip that stays open beside its host until it is closed, such as one that introduces a feature: a title, a\n * text, a link and a close button, with a line and a dot pointing at the host. Put it inside its host. It holds\n * controls, so it is a dialog named by its title.\n */\nexport const TooltipCallout = React.forwardRef<HTMLDivElement, TooltipCalloutProps>(\n ({ title, children, open, defaultOpen = true, onOpenChange, labels, className, ...others }, ref) => {\n const [shown, setShown] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });\n const titleId = useUid();\n const text = { ...defaultLabels, ...labels };\n if (!shown) return null;\n return (\n <div\n role=\"dialog\"\n aria-labelledby={titleId}\n {...others}\n ref={ref}\n className={classNames('roaster-tooltip', 'roaster-tooltip--callout', className)}\n >\n <button\n className=\"roaster-tooltip__close\"\n type=\"button\"\n aria-label={text.close}\n onClick={() => setShown(false)}\n >\n <RoasterIcon name=\"x\" />\n </button>\n <p className=\"roaster-tooltip__title\" id={titleId}>\n {title}\n </p>\n {children}\n </div>\n );\n }\n);\nTooltipCallout.displayName = 'TooltipCallout';\n"],"names":["React","useControllableState","useUid","jsxs","classNames","jsx","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,aAAa,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;AAC9B,MAAC,cAAc,GAAGA,gBAAK,CAAC,UAAU;AAC9C,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AACtG,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGC,0BAAoB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACtH,IAAI,MAAM,OAAO,GAAGC,cAAM,EAAE;AAC5B,IAAI,MAAM,IAAI,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE;AAChD,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI;AAC3B,IAAI,uBAAuBC,eAAI;AAC/B,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,iBAAiB,EAAE,OAAO;AAClC,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,kBAAU,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,SAAS,CAAC;AACvF,QAAQ,QAAQ,EAAE;AAClB,0BAA0BC,cAAG;AAC7B,YAAY,QAAQ;AACpB,YAAY;AACZ,cAAc,SAAS,EAAE,wBAAwB;AACjD,cAAc,IAAI,EAAE,QAAQ;AAC5B,cAAc,YAAY,EAAE,IAAI,CAAC,KAAK;AACtC,cAAc,OAAO,EAAE,MAAM,QAAQ,CAAC,KAAK,CAAC;AAC5C,cAAc,QAAQ,kBAAkBA,cAAG,CAACC,uBAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;AACtE;AACA,WAAW;AACX,0BAA0BD,cAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACzG,UAAU;AACV;AACA;AACA,KAAK;AACL,EAAE;AACF;AACA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Button = require('../Button/Button.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/useUid/index.js');
9
10
  var index$1 = require('../../utils/classNames/index.js');
10
11
 
@@ -65,7 +66,7 @@ const Visualizer = React__namespace.forwardRef((props, ref) => {
65
66
  className: "roaster-visualizer__close",
66
67
  "aria-label": text.close,
67
68
  onClick: () => panelRef.current?.hidePopover?.(),
68
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" })
69
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
69
70
  }
70
71
  )
71
72
  ] }),
@@ -84,7 +85,7 @@ const Visualizer = React__namespace.forwardRef((props, ref) => {
84
85
  "aria-controls": panelId,
85
86
  "aria-expanded": open,
86
87
  onClick: () => panelRef.current?.showPopover?.(),
87
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "chevron-up" })
88
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-up" })
88
89
  }
89
90
  )
90
91
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"Visualizer.js","sources":["../../../../src/components/Visualizer/Visualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { Icon } from '@/components/Icon';\n\n/** The text of the visualizer's buttons, for other languages. */\nexport interface VisualizerLabels {\n /** The name of the button that opens the preview on phones, read by screen readers. */\n open: string;\n /** The name of the button that closes it. */\n close: string;\n}\n\nconst defaultVisualizerLabels: VisualizerLabels = { open: 'Open the preview', close: 'Close the preview' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to the panel. */\nexport interface VisualizerProps extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'title'> {\n /** The title of the preview. It also names the panel. */\n title: React.ReactNode;\n /** The preview. */\n children?: React.ReactNode;\n /** The text of the buttons, in English by default. */\n labels?: Partial<VisualizerLabels>;\n}\n\n/**\n * A preview panel beside a form, to see the result of the changes being made. On phones, it is a sheet (a popover)\n * that a bar at the bottom of the screen opens; its close button, Escape and a click outside close it.\n */\nexport const Visualizer = React.forwardRef<HTMLElement, VisualizerProps>((props, ref) => {\n const { className, children, title, labels, id, ...others } = props;\n const text = { ...defaultVisualizerLabels, ...labels };\n const panelId = useUid(id);\n const titleId = useUid();\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 // Whether the sheet is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <aside\n aria-labelledby={titleId}\n {...others}\n {...popover}\n id={panelId}\n ref={setRefs}\n className={classNames('roaster-visualizer', 'roaster-preview-background', className)}\n >\n <div className=\"roaster-visualizer__header\">\n <h2 className=\"roaster-visualizer__title\" id={titleId}>\n {title}\n </h2>\n <Button\n iconOnly\n variant=\"secondary\"\n className=\"roaster-visualizer__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <Icon name=\"xmark\" />\n </Button>\n </div>\n <div className=\"roaster-visualizer__content\">{children}</div>\n </aside>\n <div className=\"roaster-visualizer-opener\">\n <p className=\"roaster-visualizer-opener__title\">{title}</p>\n <Button\n iconOnly\n variant=\"secondary\"\n aria-label={text.open}\n aria-controls={panelId}\n aria-expanded={open}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <Icon name=\"chevron-up\" />\n </Button>\n </div>\n </>\n );\n});\n\nVisualizer.displayName = 'Visualizer';\n"],"names":["React","useUid","jsxs","Fragment","classNames","jsx","Button","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,mBAAmB,EAAE;AAC5E,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACrE,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,MAAM,OAAO,GAAGC,YAAM,CAAC,EAAE,CAAC;AAC5B,EAAE,MAAM,OAAO,GAAGA,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AW,IAAI;AAC1D,UAAU,QAAQ,kBAAkBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACpE;AACA;AACA,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"Visualizer.js","sources":["../../../../src/components/Visualizer/Visualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The text of the visualizer's buttons, for other languages. */\nexport interface VisualizerLabels {\n /** The name of the button that opens the preview on phones, read by screen readers. */\n open: string;\n /** The name of the button that closes it. */\n close: string;\n}\n\nconst defaultVisualizerLabels: VisualizerLabels = { open: 'Open the preview', close: 'Close the preview' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to the panel. */\nexport interface VisualizerProps extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'title'> {\n /** The title of the preview. It also names the panel. */\n title: React.ReactNode;\n /** The preview. */\n children?: React.ReactNode;\n /** The text of the buttons, in English by default. */\n labels?: Partial<VisualizerLabels>;\n}\n\n/**\n * A preview panel beside a form, to see the result of the changes being made. On phones, it is a sheet (a popover)\n * that a bar at the bottom of the screen opens; its close button, Escape and a click outside close it.\n */\nexport const Visualizer = React.forwardRef<HTMLElement, VisualizerProps>((props, ref) => {\n const { className, children, title, labels, id, ...others } = props;\n const text = { ...defaultVisualizerLabels, ...labels };\n const panelId = useUid(id);\n const titleId = useUid();\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 // Whether the sheet is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <aside\n aria-labelledby={titleId}\n {...others}\n {...popover}\n id={panelId}\n ref={setRefs}\n className={classNames('roaster-visualizer', 'roaster-preview-background', className)}\n >\n <div className=\"roaster-visualizer__header\">\n <h2 className=\"roaster-visualizer__title\" id={titleId}>\n {title}\n </h2>\n <Button\n iconOnly\n variant=\"secondary\"\n className=\"roaster-visualizer__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <RoasterIcon name=\"x\" />\n </Button>\n </div>\n <div className=\"roaster-visualizer__content\">{children}</div>\n </aside>\n <div className=\"roaster-visualizer-opener\">\n <p className=\"roaster-visualizer-opener__title\">{title}</p>\n <Button\n iconOnly\n variant=\"secondary\"\n aria-label={text.open}\n aria-controls={panelId}\n aria-expanded={open}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <RoasterIcon name=\"chevron-up\" />\n </Button>\n </div>\n </>\n );\n});\n\nVisualizer.displayName = 'Visualizer';\n"],"names":["React","useUid","jsxs","Fragment","classNames","jsx","Button","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,mBAAmB,EAAE;AAC5E,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACrE,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,MAAM,O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AAE,IAAI;AAC/B,UAAU,OAAO,EAAE,MAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,IAAI;AAC1D,UAAU,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC3E;AACA;AACA,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useListItem } from '@floating-ui/react';
4
4
  import * as React from 'react';
5
- import { Icon } from '../../Icon/Icon.js';
5
+ import '../../Icon/Icon.js';
6
+ import { RoasterIcon } from '../../Icon/RoasterIcon.js';
6
7
  import { useActionListContext } from '../ActionList.context.js';
7
8
  import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
8
9
  import { Slot } from '../../../utils/Slot/index.js';
@@ -48,7 +49,7 @@ const ActionListItem = React.forwardRef(
48
49
  ),
49
50
  children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
50
51
  children,
51
- checkMark && /* @__PURE__ */ jsx(Icon, { name: "check", className: "roaster-action-list__check roaster-action-list__check--end" }),
52
+ checkMark && /* @__PURE__ */ jsx(RoasterIcon, { name: "check", className: "roaster-action-list__check roaster-action-list__check--end" }),
52
53
  detail != null && detail !== false && /* @__PURE__ */ jsx("span", { className: "roaster-action-list__detail", children: detail })
53
54
  ] })
54
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/components/ActionListItem.tsx"],"sourcesContent":["import { useListItem } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, Slot, useMergeRefs } from '@/utils';\nimport { Icon } from '../../Icon';\nimport { useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop (`onClick`, `disabled`, ...) is accepted and forwarded to the item. */\nexport interface ActionListItemProps extends React.ComponentPropsWithoutRef<'button'> {\n /**\n * The text of the item, with an optional icon. An icon after the text goes to the item's end, with the text in a\n * `<span>`: `<span>Privacy</span><Icon name=\"arrow-up-right-from-square\" />`.\n */\n children: React.ReactNode;\n /** `danger` for a destructive action, such as deleting or logging out. */\n tone?: 'danger';\n /** A short text at the item's end, such as the current choice of a setting. With `asChild`, write it in the child. */\n detail?: React.ReactNode;\n /**\n * Makes the item one of a set of choices (`role=\"menuitemradio\"`), chosen when `true`, such as a sort order. Its\n * icon takes the primary color while it is chosen.\n */\n checked?: boolean;\n /**\n * One of several choices that can be chosen together (`role=\"menuitemcheckbox\"`), such as labels, instead of one of a\n * set. With `checked`.\n */\n multiple?: boolean;\n /**\n * Shows a check at the item's end while it is chosen, such as in a picker whose items carry icons of their own (a\n * status, an avatar). With `checked`.\n */\n checkMark?: boolean;\n /**\n * Renders the child element (such as a link, or a router's Link) as the item, instead of a `<button>`.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/**\n * An item of the menu (`role=\"menuitem\"`, or `menuitemradio` with `checked`): a button, or with `asChild` its child,\n * such as a link. Choosing it closes the menu, after its own `onClick`, unless that calls `event.preventDefault()`.\n */\nexport const ActionListItem = React.forwardRef<HTMLButtonElement, ActionListItemProps>(\n (\n {\n className,\n children,\n tone,\n detail,\n checked,\n multiple,\n checkMark,\n asChild = false,\n onClick,\n type = 'button',\n ...rest\n },\n propRef\n ) => {\n const context = useActionListContext();\n const item = useListItem();\n const ref = useMergeRefs([item.ref, propRef]);\n const Component = asChild ? Slot : 'button';\n\n return (\n <Component\n {...(asChild ? {} : { type })}\n role={checked === undefined ? 'menuitem' : multiple ? 'menuitemcheckbox' : 'menuitemradio'}\n aria-checked={checked}\n {...context.getItemProps({\n ...rest,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n if (!event.defaultPrevented) context.setOpen(false);\n },\n })}\n ref={ref}\n tabIndex={context.activeIndex === item.index ? 0 : -1}\n className={classNames(\n 'roaster-action-list__item',\n { 'roaster-action-list__item--danger': tone === 'danger' },\n className\n )}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n {checkMark && <Icon name=\"check\" className=\"roaster-action-list__check roaster-action-list__check--end\" />}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n </>\n )}\n </Component>\n );\n }\n);\nActionListItem.displayName = 'ActionListItem';\n"],"names":[],"mappings":";;;;;;;;;;AAOY,MAAC,cAAc,GAAG,KAAK,CAAC,UAAU;AAC9C,EAAE,CAAC;AACH,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,IAAI;AACR,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO,GAAG,KAAK;AACnB,IAAI,OAAO;AACX,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,GAAG;AACP,GAAG,EAAE,OAAO,KAAK;AACjB,IAAI,MAAM,OAAO,GAAG,oBAAoB,EAAE;AAC1C,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjD,IAAI,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ;AAC/C,IAAI,uBAAuB,GAAG;AAC9B,MAAM,SAAS;AACf,MAAM;AACN,QAAQ,GAAG,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE;AAClC,QAAQ,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,kBAAkB,GAAG,eAAe;AAC/F,QAAQ,cAAc,EAAE,OAAO;AAC/B,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;AAChC,UAAU,GAAG,IAAI;AACjB,UAAU,OAAO,CAAC,KAAK,EAAE;AACzB,YAAY,OAAO,GAAG,KAAK,CAAC;AAC5B,YAAY,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;AAC/D,UAAU;AACV,SAAS,CAAC;AACV,QAAQ,GAAG;AACX,QAAQ,QAAQ,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE;AAC7D,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,2BAA2B;AACrC,UAAU,EAAE,mCAAmC,EAAE,IAAI,KAAK,QAAQ,EAAE;AACpE,UAAU;AACV,SAAS;AACT,QAAQ,QAAQ,EAAE,OAAO,GAAG,QAAQ,mBAAmB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AAClF,UAAU,QAAQ;AAClB,UAAU,SAAS,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,4DAA4D,EAAE,CAAC;AAC5I,UAAU,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1I,SAAS,EAAE;AACX;AACA,KAAK;AACL,EAAE;AACF;AACA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;"}
1
+ {"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/components/ActionListItem.tsx"],"sourcesContent":["import { useListItem } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, Slot, useMergeRefs } from '@/utils';\nimport { RoasterIcon } from '../../Icon';\nimport { useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop (`onClick`, `disabled`, ...) is accepted and forwarded to the item. */\nexport interface ActionListItemProps extends React.ComponentPropsWithoutRef<'button'> {\n /**\n * The text of the item, with an optional icon. An icon after the text goes to the item's end, with the text in a\n * `<span>`: `<span>Privacy</span><i className=\"fa-regular fa-arrow-up-right-from-square\" aria-hidden=\"true\" />`.\n */\n children: React.ReactNode;\n /** `danger` for a destructive action, such as deleting or logging out. */\n tone?: 'danger';\n /** A short text at the item's end, such as the current choice of a setting. With `asChild`, write it in the child. */\n detail?: React.ReactNode;\n /**\n * Makes the item one of a set of choices (`role=\"menuitemradio\"`), chosen when `true`, such as a sort order. Its\n * icon takes the primary color while it is chosen.\n */\n checked?: boolean;\n /**\n * One of several choices that can be chosen together (`role=\"menuitemcheckbox\"`), such as labels, instead of one of a\n * set. With `checked`.\n */\n multiple?: boolean;\n /**\n * Shows a check at the item's end while it is chosen, such as in a picker whose items carry icons of their own (a\n * status, an avatar). With `checked`.\n */\n checkMark?: boolean;\n /**\n * Renders the child element (such as a link, or a router's Link) as the item, instead of a `<button>`.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/**\n * An item of the menu (`role=\"menuitem\"`, or `menuitemradio` with `checked`): a button, or with `asChild` its child,\n * such as a link. Choosing it closes the menu, after its own `onClick`, unless that calls `event.preventDefault()`.\n */\nexport const ActionListItem = React.forwardRef<HTMLButtonElement, ActionListItemProps>(\n (\n {\n className,\n children,\n tone,\n detail,\n checked,\n multiple,\n checkMark,\n asChild = false,\n onClick,\n type = 'button',\n ...rest\n },\n propRef\n ) => {\n const context = useActionListContext();\n const item = useListItem();\n const ref = useMergeRefs([item.ref, propRef]);\n const Component = asChild ? Slot : 'button';\n\n return (\n <Component\n {...(asChild ? {} : { type })}\n role={checked === undefined ? 'menuitem' : multiple ? 'menuitemcheckbox' : 'menuitemradio'}\n aria-checked={checked}\n {...context.getItemProps({\n ...rest,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n if (!event.defaultPrevented) context.setOpen(false);\n },\n })}\n ref={ref}\n tabIndex={context.activeIndex === item.index ? 0 : -1}\n className={classNames(\n 'roaster-action-list__item',\n { 'roaster-action-list__item--danger': tone === 'danger' },\n className\n )}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n {checkMark && (\n <RoasterIcon name=\"check\" className=\"roaster-action-list__check roaster-action-list__check--end\" />\n )}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n </>\n )}\n </Component>\n );\n }\n);\nActionListItem.displayName = 'ActionListItem';\n"],"names":[],"mappings":";;;;;;;;;;;AAOY,MAAC,cAAc,GAAG,KAAK,CAAC,UAAU;AAC9C,EAAE,CAAC;AACH,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,IAAI;AACR,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO,GAAG,KAAK;AACnB,IAAI,OAAO;AACX,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,GAAG;AACP,GAAG,EAAE,OAAO,KAAK;AACjB,IAAI,MAAM,OAAO,GAAG,oBAAoB,EAAE;AAC1C,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjD,IAAI,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ;AAC/C,IAAI,uBAAuB,GAAG;AAC9B,MAAM,SAAS;AACf,MAAM;AACN,QAAQ,GAAG,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE;AAClC,QAAQ,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,kBAAkB,GAAG,eAAe;AAC/F,QAAQ,cAAc,EAAE,OAAO;AAC/B,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;AAChC,UAAU,GAAG,IAAI;AACjB,UAAU,OAAO,CAAC,KAAK,EAAE;AACzB,YAAY,OAAO,GAAG,KAAK,CAAC;AAC5B,YAAY,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;AAC/D,UAAU;AACV,SAAS,CAAC;AACV,QAAQ,GAAG;AACX,QAAQ,QAAQ,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE;AAC7D,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,2BAA2B;AACrC,UAAU,EAAE,mCAAmC,EAAE,IAAI,KAAK,QAAQ,EAAE;AACpE,UAAU;AACV,SAAS;AACT,QAAQ,QAAQ,EAAE,OAAO,GAAG,QAAQ,mBAAmB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AAClF,UAAU,QAAQ;AAClB,UAAU,SAAS,oBAAoB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,4DAA4D,EAAE,CAAC;AACnJ,UAAU,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1I,SAAS,EAAE;AACX;AACA,KAAK;AACL,EAAE;AACF;AACA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useListItem, useFloating, autoUpdate, offset, flip, shift, useInteractions, useClick, useRole, useDismiss, useListNavigation, useTypeahead, FloatingFocusManager, FloatingList } from '@floating-ui/react';
4
4
  import * as React from 'react';
5
- import { Icon } from '../../Icon/Icon.js';
5
+ import '../../Icon/Icon.js';
6
+ import { RoasterIcon } from '../../Icon/RoasterIcon.js';
6
7
  import { useActionListContext, ActionListProvider } from '../ActionList.context.js';
7
8
  import { readLengthToken } from '../../../utils/useDropdown/index.js';
8
9
  import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
@@ -79,7 +80,7 @@ const ActionListSubmenu = React.forwardRef(
79
80
  children: [
80
81
  label,
81
82
  detail != null && detail !== false && /* @__PURE__ */ jsx("span", { className: "roaster-action-list__detail", children: detail }),
82
- /* @__PURE__ */ jsx(Icon, { name: "chevron-right" })
83
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-right" })
83
84
  ]
84
85
  }
85
86
  ),