@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
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListSubmenu.js","sources":["../../../../../src/components/ActionList/components/ActionListSubmenu.tsx"],"sourcesContent":["import {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useListItem,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, readLengthToken, useMergeRefs } from '@/utils';\nimport { Icon } from '../../Icon';\nimport { ActionListProvider, useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop is accepted and forwarded to the item that opens the submenu. */\nexport interface ActionListSubmenuProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {\n /** The item that opens the submenu: its text, with an optional icon. */\n label: React.ReactNode;\n /** A short text before the item's chevron, such as the current choice. */\n detail?: React.ReactNode;\n /** The submenu's groups, dividers and items, as in ActionList.Dropdown. */\n children: React.ReactNode;\n /**\n * Where the submenu opens. It moves to the other side when there is no room.\n * @defaultValue 'right-start'\n */\n placement?: Placement;\n}\n\n/**\n * An item that opens a submenu beside it, such as a setting's choices: on click, Enter, or the right arrow (the left\n * arrow and Escape close it). The item names the submenu. Choosing an item of the submenu closes it and its menu.\n */\nexport const ActionListSubmenu = React.forwardRef<HTMLButtonElement, ActionListSubmenuProps>(\n ({ label, detail, children, placement = 'right-start', className, type = 'button', ...rest }, propRef) => {\n const parent = useActionListContext();\n const item = useListItem();\n const [open, setOpen] = React.useState(false);\n const elementsRef = React.useRef<Array<HTMLElement | null>>([]);\n const labelsRef = React.useRef<Array<string | null>>([]);\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null);\n\n const data = useFloating({\n placement,\n strategy: 'fixed',\n transform: false,\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n // As far from its item as the menu is from its button, past the menu's padding.\n offset(\n ({ elements }) =>\n readLengthToken(elements.floating, '--roaster-action-list-offset', 8) +\n readLengthToken(elements.floating, '--roaster-action-list-padding', 0)\n ),\n flip(),\n shift({ padding: 8 }),\n ],\n });\n const { context } = data;\n const interactions = useInteractions([\n useClick(context),\n useRole(context, { role: 'menu' }),\n useDismiss(context),\n useListNavigation(context, {\n listRef: elementsRef,\n activeIndex,\n onNavigate: setActiveIndex,\n loop: true,\n nested: true,\n focusItemOnOpen: true,\n }),\n useTypeahead(context, { listRef: labelsRef, activeIndex, onMatch: open ? setActiveIndex : undefined }),\n ]);\n\n // The submenu's items close it and the menu it came from.\n const parentSetOpen = parent.setOpen;\n const submenu = React.useMemo(\n () => ({\n ...data,\n ...interactions,\n open,\n activeIndex,\n elementsRef,\n labelsRef,\n setOpen: (next: boolean | ((previous: boolean) => boolean)) => {\n const value = typeof next === 'function' ? next(open) : next;\n setOpen(value);\n if (!value) parentSetOpen(false);\n },\n }),\n [data, interactions, open, activeIndex, parentSetOpen]\n );\n\n const triggerRef = useMergeRefs([item.ref, data.refs.setReference, propRef]);\n\n return (\n <>\n <button\n {...parent.getItemProps(interactions.getReferenceProps(rest))}\n ref={triggerRef}\n type={type}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n tabIndex={parent.activeIndex === item.index ? 0 : -1}\n className={classNames('roaster-action-list__item', className)}\n >\n {label}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n <Icon name=\"chevron-right\" />\n </button>\n {open && (\n <FloatingFocusManager context={context} modal={false} initialFocus={-1}>\n <div\n ref={data.refs.setFloating}\n {...interactions.getFloatingProps({\n onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n // Its keys are its own: the menu around it doesn't move, nor close on Escape, which closes only\n // the submenu. Tab goes on to close both.\n if (event.key === 'Tab') return;\n event.stopPropagation();\n if (event.key === 'Escape') {\n setOpen(false);\n (data.refs.domReference.current as HTMLElement | null)?.focus();\n }\n },\n })}\n className=\"roaster-action-list roaster-action-list--submenu roaster-action-list--floating\"\n style={data.floatingStyles}\n >\n <ActionListProvider value={submenu}>\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {children}\n </FloatingList>\n </ActionListProvider>\n </div>\n </FloatingFocusManager>\n )}\n </>\n );\n }\n);\nActionListSubmenu.displayName = 'ActionListSubmenu';\n"],"names":[],"mappings":";;;;;;;;;;AAsBY,MAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU;AACjD,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,aAAa,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,KAAK;AAC5G,IAAI,MAAM,MAAM,GAAG,oBAAoB,EAAE;AACzC,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;AACjD,IAAI,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AACxC,IAAI,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AACtC,IAAI,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9D,IAAI,MAAM,IAAI,GAAG,WAAW,CAAC;AAC7B,MAAM,SAAS;AACf,MAAM,QAAQ,EAAE,OAAO;AACvB,MAAM,SAAS,EAAE,KAAK;AACtB,MAAM,IAAI;AACV,MAAM,YAAY,EAAE,OAAO;AAC3B,MAAM,oBAAoB,EAAE,UAAU;AACtC,MAAM,UAAU,EAAE;AAClB;AACA,QAAQ,MAAM;AACd,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,QAAQ,CAAC,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AG,YAAY,CAAC,gBAAgB,CAAC;AAC3C,YAAY,SAAS,CAAC,KAAK,EAAE;AAC7B,cAAc,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE;AACvC,cAAc,KAAK,CAAC,eAAe,EAAE;AACrC,cAAc,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;AAC1C,gBAAgB,OAAO,CAAC,KAAK,CAAC;AAC9B,gBAAgB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE;AACvD,cAAc;AACd,YAAY;AACZ,WAAW,CAAC;AACZ,UAAU,SAAS,EAAE,gFAAgF;AACrG,UAAU,KAAK,EAAE,IAAI,CAAC,cAAc;AACpC,UAAU,QAAQ,kBAAkB,GAAG,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,kBAAkB,GAAG,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE;AACjK;AACA,OAAO,EAAE;AACT,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
1
+ {"version":3,"file":"ActionListSubmenu.js","sources":["../../../../../src/components/ActionList/components/ActionListSubmenu.tsx"],"sourcesContent":["import {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useListItem,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, readLengthToken, useMergeRefs } from '@/utils';\nimport { RoasterIcon } from '../../Icon';\nimport { ActionListProvider, useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop is accepted and forwarded to the item that opens the submenu. */\nexport interface ActionListSubmenuProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {\n /** The item that opens the submenu: its text, with an optional icon. */\n label: React.ReactNode;\n /** A short text before the item's chevron, such as the current choice. */\n detail?: React.ReactNode;\n /** The submenu's groups, dividers and items, as in ActionList.Dropdown. */\n children: React.ReactNode;\n /**\n * Where the submenu opens. It moves to the other side when there is no room.\n * @defaultValue 'right-start'\n */\n placement?: Placement;\n}\n\n/**\n * An item that opens a submenu beside it, such as a setting's choices: on click, Enter, or the right arrow (the left\n * arrow and Escape close it). The item names the submenu. Choosing an item of the submenu closes it and its menu.\n */\nexport const ActionListSubmenu = React.forwardRef<HTMLButtonElement, ActionListSubmenuProps>(\n ({ label, detail, children, placement = 'right-start', className, type = 'button', ...rest }, propRef) => {\n const parent = useActionListContext();\n const item = useListItem();\n const [open, setOpen] = React.useState(false);\n const elementsRef = React.useRef<Array<HTMLElement | null>>([]);\n const labelsRef = React.useRef<Array<string | null>>([]);\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null);\n\n const data = useFloating({\n placement,\n strategy: 'fixed',\n transform: false,\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n // As far from its item as the menu is from its button, past the menu's padding.\n offset(\n ({ elements }) =>\n readLengthToken(elements.floating, '--roaster-action-list-offset', 8) +\n readLengthToken(elements.floating, '--roaster-action-list-padding', 0)\n ),\n flip(),\n shift({ padding: 8 }),\n ],\n });\n const { context } = data;\n const interactions = useInteractions([\n useClick(context),\n useRole(context, { role: 'menu' }),\n useDismiss(context),\n useListNavigation(context, {\n listRef: elementsRef,\n activeIndex,\n onNavigate: setActiveIndex,\n loop: true,\n nested: true,\n focusItemOnOpen: true,\n }),\n useTypeahead(context, { listRef: labelsRef, activeIndex, onMatch: open ? setActiveIndex : undefined }),\n ]);\n\n // The submenu's items close it and the menu it came from.\n const parentSetOpen = parent.setOpen;\n const submenu = React.useMemo(\n () => ({\n ...data,\n ...interactions,\n open,\n activeIndex,\n elementsRef,\n labelsRef,\n setOpen: (next: boolean | ((previous: boolean) => boolean)) => {\n const value = typeof next === 'function' ? next(open) : next;\n setOpen(value);\n if (!value) parentSetOpen(false);\n },\n }),\n [data, interactions, open, activeIndex, parentSetOpen]\n );\n\n const triggerRef = useMergeRefs([item.ref, data.refs.setReference, propRef]);\n\n return (\n <>\n <button\n {...parent.getItemProps(interactions.getReferenceProps(rest))}\n ref={triggerRef}\n type={type}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n tabIndex={parent.activeIndex === item.index ? 0 : -1}\n className={classNames('roaster-action-list__item', className)}\n >\n {label}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n <RoasterIcon name=\"chevron-right\" />\n </button>\n {open && (\n <FloatingFocusManager context={context} modal={false} initialFocus={-1}>\n <div\n ref={data.refs.setFloating}\n {...interactions.getFloatingProps({\n onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n // Its keys are its own: the menu around it doesn't move, nor close on Escape, which closes only\n // the submenu. Tab goes on to close both.\n if (event.key === 'Tab') return;\n event.stopPropagation();\n if (event.key === 'Escape') {\n setOpen(false);\n (data.refs.domReference.current as HTMLElement | null)?.focus();\n }\n },\n })}\n className=\"roaster-action-list roaster-action-list--submenu roaster-action-list--floating\"\n style={data.floatingStyles}\n >\n <ActionListProvider value={submenu}>\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {children}\n </FloatingList>\n </ActionListProvider>\n </div>\n </FloatingFocusManager>\n )}\n </>\n );\n }\n);\nActionListSubmenu.displayName = 'ActionListSubmenu';\n"],"names":[],"mappings":";;;;;;;;;;;AAsBY,MAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU;AACjD,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,aAAa,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,KAAK;AAC5G,IAAI,MAAM,MAAM,GAAG,oBAAoB,EAAE;AACzC,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,CAAC,IAAI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YAAY,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE;AACjK;AACA,OAAO,EAAE;AACT,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { classNames } from '../../utils/classNames/index.js';
7
8
 
8
9
  const defaultAlertLabels = { close: "Close" };
@@ -19,7 +20,7 @@ const Alert = React.forwardRef((props, ref) => {
19
20
  children: [
20
21
  icon && /* @__PURE__ */ jsx("span", { className: "roaster-alert__icon", children: icon }),
21
22
  /* @__PURE__ */ jsx("div", { className: "roaster-alert__content", children }),
22
- closable && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-alert__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) })
23
+ closable && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-alert__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" }) })
23
24
  ]
24
25
  }
25
26
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\n/** The tones of an alert: its color, icon, and how urgently screen readers announce it. */\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger' | 'primary';\n\n/** The text of the alert, for other languages. */\nexport interface AlertLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultAlertLabels: AlertLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message: text, links, or blocks such as a list. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), `info`, `success` and `primary`\n * politely (`role=\"status\"`). `primary` is a prompt that asks for a decision, with its buttons in the message.\n * @defaultValue 'info'\n */\n tone?: AlertTone;\n /** An icon in place of the tone's, such as an `Icon`. */\n icon?: React.ReactNode;\n /** Shows a close button, which calls `onClose`. */\n closable?: boolean;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /** The text of the alert, in English by default. */\n labels?: Partial<AlertLabels>;\n}\n\n/** A message banner in a tone (info, success, warning, danger, or primary for a prompt), with an optional close button. */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const { children, closable = false, tone = 'info', icon, onClose, labels, className, ...others } = props;\n const text = { ...defaultAlertLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-alert', `roaster-alert--${tone}`, className)}\n >\n {icon && <span className=\"roaster-alert__icon\">{icon}</span>}\n <div className=\"roaster-alert__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-alert__close\" aria-label={text.close} onClick={onClose}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n )}\n </div>\n );\n});\n\nAlert.displayName = 'Alert';\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AACjC,MAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AAC1G,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,MAAM,EAAE;AACnD,EAAE,uBAAuB,IAAI;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,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC;AACjF,MAAM,QAAQ,EAAE;AAChB,QAAQ,IAAI,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjG,wBAAwB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC;AACrF,QAAQ,QAAQ,oBAAoB,GAAG,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;AAC7L;AACA;AACA,GAAG;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The tones of an alert: its color, icon, and how urgently screen readers announce it. */\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger' | 'primary';\n\n/** The text of the alert, for other languages. */\nexport interface AlertLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultAlertLabels: AlertLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message: text, links, or blocks such as a list. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), `info`, `success` and `primary`\n * politely (`role=\"status\"`). `primary` is a prompt that asks for a decision, with its buttons in the message.\n * @defaultValue 'info'\n */\n tone?: AlertTone;\n /** An icon in place of the tone's, such as an `Icon`. */\n icon?: React.ReactNode;\n /** Shows a close button, which calls `onClose`. */\n closable?: boolean;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /** The text of the alert, in English by default. */\n labels?: Partial<AlertLabels>;\n}\n\n/** A message banner in a tone (info, success, warning, danger, or primary for a prompt), with an optional close button. */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const { children, closable = false, tone = 'info', icon, onClose, labels, className, ...others } = props;\n const text = { ...defaultAlertLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-alert', `roaster-alert--${tone}`, className)}\n >\n {icon && <span className=\"roaster-alert__icon\">{icon}</span>}\n <div className=\"roaster-alert__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-alert__close\" aria-label={text.close} onClick={onClose}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n )}\n </div>\n );\n});\n\nAlert.displayName = 'Alert';\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AACjC,MAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AAC1G,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,MAAM,EAAE;AACnD,EAAE,uBAAuB,IAAI;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,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC;AACjF,MAAM,QAAQ,EAAE;AAChB,QAAQ,IAAI,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjG,wBAAwB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC;AACrF,QAAQ,QAAQ,oBAAoB,GAAG,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,kBAAkB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;AAChM;AACA;AACA,GAAG;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { Icon } from '../Icon/Icon.js';
4
+ import '../Icon/Icon.js';
5
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
5
6
  import { classNames } from '../../utils/classNames/index.js';
6
7
  import { Slot } from '../../utils/Slot/index.js';
7
8
 
@@ -47,7 +48,7 @@ const Button = React.forwardRef((props, ref) => {
47
48
  }
48
49
  return /* @__PURE__ */ jsxs("button", { ...others, ...loadingProps, ref, type, className: classes, onClick: handleClick, children: [
49
50
  children,
50
- caret && /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: "roaster-button__caret" })
51
+ caret && /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-down", className: "roaster-button__caret" })
51
52
  ] });
52
53
  });
53
54
  Button.displayName = "Button";
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Icon } from '../Icon';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<button>` prop (`type`, `name`, `aria-*`, ...) is accepted and forwarded to it. */\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The button's content: its text, and an `Icon` if any. */\n children: React.ReactNode;\n /**\n * The look of the button:\n * - `primary`: filled, for the main action\n * - `secondary`: for other actions: outlined in coffee, filled in Azoth\n * - `plain`: a link-like text button\n * - `ghost`: no background or border, such as an icon in a toolbar\n * - `chip`: a filter or a toggle, such as the filters above a table; `aria-pressed` turns it on. It looks like\n * `secondary` in the coffee theme\n * @defaultValue 'primary'\n */\n variant?: 'primary' | 'secondary' | 'plain' | 'ghost' | 'chip';\n /**\n * A status color: `success` for positive actions, `danger` for destructive ones. `neutral`, for a `plain` button: a\n * quiet action in the text's secondary color, such as one under a form.\n */\n tone?: 'success' | 'danger' | 'neutral';\n /**\n * `large` for the buttons of full-page flows and a few prominent calls to action. Buttons in a modal's footer and in\n * `FormActions` are large without it. `small` for smaller text, such as a quiet action under a field. The sizes look\n * the same in the coffee theme.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** A square button holding only an icon. Name it with `aria-label`. */\n iconOnly?: boolean;\n /** A chevron after the text, for a button that opens a menu, such as a filter chip. Not with `asChild`. */\n caret?: boolean;\n /** Takes the whole width of its container. */\n fullWidth?: boolean;\n /** Its label lines up with the text before it, its padding hanging out of its place, such as a period picker. */\n flush?: boolean;\n /**\n * A value in a column of rows, such as a property in a page's side column: its icon nearer the start, its text cut\n * short with an ellipsis when it doesn't fit.\n */\n row?: boolean;\n /** Shows a spinner in place of the content, and ignores clicks, while an action runs. */\n loading?: boolean;\n /**\n * Render the element your child is, such as a link (`<Button asChild><a href=\"/new\">New</a></Button>`), with the\n * button's look.\n */\n asChild?: boolean;\n}\n\n/**\n * A button in the primary, secondary, plain, ghost or chip style, optionally in the success, danger or (plain) neutral\n * tone, and in the small, medium or large size. It is\n * `type=\"button\"` unless you say otherwise, so it never submits a form by accident.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n children,\n variant = 'primary',\n tone,\n size = 'medium',\n iconOnly,\n caret,\n fullWidth,\n flush,\n row,\n loading,\n asChild,\n className,\n onClick,\n type = 'button',\n ...others\n } = props;\n\n const classes = classNames(\n 'roaster-button',\n `roaster-button--${variant}`,\n tone && `roaster-button--${tone}`,\n {\n 'roaster-button--small': size === 'small',\n 'roaster-button--large': size === 'large',\n 'roaster-button--icon-only': iconOnly,\n 'roaster-button--full-width': fullWidth,\n 'roaster-button--flush': flush,\n 'roaster-button--row': row,\n },\n className\n );\n const loadingProps = loading ? { 'aria-busy': true, 'aria-disabled': true } : {};\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // A loading button stays focusable, so a click can still reach it from the keyboard.\n if (loading) event.preventDefault();\n else onClick?.(event);\n };\n\n if (asChild) {\n return (\n <Slot {...others} {...loadingProps} ref={ref as React.Ref<HTMLElement>} className={classes} onClick={handleClick}>\n {children}\n </Slot>\n );\n }\n return (\n <button {...others} {...loadingProps} ref={ref} type={type} className={classes} onClick={handleClick}>\n {children}\n {caret && <Icon name=\"chevron-down\" className=\"roaster-button__caret\" />}\n </button>\n );\n});\n\nButton.displayName = 'Button';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GA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EAAE,CAAC;AAC7H,EAAE;AACF,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACrI,IAAI,QAAQ;AACZ,IAAI,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,uBAAuB,EAAE;AACnG,GAAG,EAAE,CAAC;AACN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { RoasterIcon } from '../Icon';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<button>` prop (`type`, `name`, `aria-*`, ...) is accepted and forwarded to it. */\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The button's content: its text, and an `Icon` if any. */\n children: React.ReactNode;\n /**\n * The look of the button:\n * - `primary`: filled, for the main action\n * - `secondary`: for other actions: outlined in coffee, filled in Azoth\n * - `plain`: a link-like text button\n * - `ghost`: no background or border, such as an icon in a toolbar\n * - `chip`: a filter or a toggle, such as the filters above a table; `aria-pressed` turns it on. It looks like\n * `secondary` in the coffee theme\n * @defaultValue 'primary'\n */\n variant?: 'primary' | 'secondary' | 'plain' | 'ghost' | 'chip';\n /**\n * A status color: `success` for positive actions, `danger` for destructive ones. `neutral`, for a `plain` button: a\n * quiet action in the text's secondary color, such as one under a form.\n */\n tone?: 'success' | 'danger' | 'neutral';\n /**\n * `large` for the buttons of full-page flows and a few prominent calls to action. Buttons in a modal's footer and in\n * `FormActions` are large without it. `small` for smaller text, such as a quiet action under a field. The sizes look\n * the same in the coffee theme.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** A square button holding only an icon. Name it with `aria-label`. */\n iconOnly?: boolean;\n /** A chevron after the text, for a button that opens a menu, such as a filter chip. Not with `asChild`. */\n caret?: boolean;\n /** Takes the whole width of its container. */\n fullWidth?: boolean;\n /** Its label lines up with the text before it, its padding hanging out of its place, such as a period picker. */\n flush?: boolean;\n /**\n * A value in a column of rows, such as a property in a page's side column: its icon nearer the start, its text cut\n * short with an ellipsis when it doesn't fit.\n */\n row?: boolean;\n /** Shows a spinner in place of the content, and ignores clicks, while an action runs. */\n loading?: boolean;\n /**\n * Render the element your child is, such as a link (`<Button asChild><a href=\"/new\">New</a></Button>`), with the\n * button's look.\n */\n asChild?: boolean;\n}\n\n/**\n * A button in the primary, secondary, plain, ghost or chip style, optionally in the success, danger or (plain) neutral\n * tone, and in the small, medium or large size. It is\n * `type=\"button\"` unless you say otherwise, so it never submits a form by accident.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n children,\n variant = 'primary',\n tone,\n size = 'medium',\n iconOnly,\n caret,\n fullWidth,\n flush,\n row,\n loading,\n asChild,\n className,\n onClick,\n type = 'button',\n ...others\n } = props;\n\n const classes = classNames(\n 'roaster-button',\n `roaster-button--${variant}`,\n tone && `roaster-button--${tone}`,\n {\n 'roaster-button--small': size === 'small',\n 'roaster-button--large': size === 'large',\n 'roaster-button--icon-only': iconOnly,\n 'roaster-button--full-width': fullWidth,\n 'roaster-button--flush': flush,\n 'roaster-button--row': row,\n },\n className\n );\n const loadingProps = loading ? { 'aria-busy': true, 'aria-disabled': true } : {};\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // A loading button stays focusable, so a click can still reach it from the keyboard.\n if (loading) event.preventDefault();\n else onClick?.(event);\n };\n\n if (asChild) {\n return (\n <Slot {...others} {...loadingProps} ref={ref as React.Ref<HTMLElement>} className={classes} onClick={handleClick}>\n {children}\n </Slot>\n );\n }\n return (\n <button {...others} {...loadingProps} ref={ref} type={type} className={classes} onClick={handleClick}>\n {children}\n {caret && <RoasterIcon name=\"chevron-down\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IAAI,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC7H,EAAE;AACF,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACrI,IAAI,QAAQ;AACZ,IAAI,KAAK,oBAAoB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,uBAAuB,EAAE;AAC1G,GAAG,EAAE,CAAC;AACN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\ninterface ButtonIconBaseProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'aria-labelledby'> {\n /** The icon, such as `<Icon name=\"xmark\" />`. */\n children: React.ReactNode;\n /**\n * The size of the icon: `small` (alerts, toasts, tags) or `medium` (modals).\n * @defaultValue 'small'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A small icon-only button, such as the close button of an alert, a tag or a modal. It has no text, so it needs a\n * name: `aria-label`, or `aria-labelledby` pointing at text on the page. Every native `<button>` prop is accepted.\n */\nexport type ButtonIconProps = ButtonIconBaseProps &\n ({ 'aria-label': string; 'aria-labelledby'?: string } | { 'aria-label'?: string; 'aria-labelledby': string });\n\n/** A small icon-only button, such as the close button of an alert, a tag or a modal. Name it with `aria-label`. */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>((props, ref) => {\n const { children, size = 'small', className, type = 'button', ...others } = props;\n\n return (\n <button\n {...others}\n ref={ref}\n type={type}\n className={classNames('roaster-icon-button', { 'roaster-icon-button--medium': size === 'medium' }, className)}\n >\n {children}\n </button>\n );\n});\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnF,EAAE,uBAAuB,GAAG;AAC5B,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,6BAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,EAAE,SAAS,CAAC;AACnH,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\ninterface ButtonIconBaseProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'aria-labelledby'> {\n /** The icon, such as Roaster's cross: `<i className=\"roaster-icon roaster-icon--x\" aria-hidden=\"true\" />`. */\n children: React.ReactNode;\n /**\n * The size of the icon: `small` (alerts, toasts, tags) or `medium` (modals).\n * @defaultValue 'small'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A small icon-only button, such as the close button of an alert, a tag or a modal. It has no text, so it needs a\n * name: `aria-label`, or `aria-labelledby` pointing at text on the page. Every native `<button>` prop is accepted.\n */\nexport type ButtonIconProps = ButtonIconBaseProps &\n ({ 'aria-label': string; 'aria-labelledby'?: string } | { 'aria-label'?: string; 'aria-labelledby': string });\n\n/** A small icon-only button, such as the close button of an alert, a tag or a modal. Name it with `aria-label`. */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>((props, ref) => {\n const { children, size = 'small', className, type = 'button', ...others } = props;\n\n return (\n <button\n {...others}\n ref={ref}\n type={type}\n className={classNames('roaster-icon-button', { 'roaster-icon-button--medium': size === 'medium' }, className)}\n >\n {children}\n </button>\n );\n});\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnF,EAAE,uBAAuB,GAAG;AAC5B,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,6BAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,EAAE,SAAS,CAAC;AACnH,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -3,7 +3,8 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Button } from '../../../Button/Button.js';
4
4
  import { monthTitle, noop, getPreviousDisplayMonth, getPreviousDisplayYear, getNextDisplayMonth, getNextDisplayYear } from '../../utils/index.js';
5
5
  import { Month } from '../Month/Month.js';
6
- import { Icon } from '../../../Icon/Icon.js';
6
+ import '../../../Icon/Icon.js';
7
+ import { RoasterIcon } from '../../../Icon/RoasterIcon.js';
7
8
 
8
9
  const defaultCalendarLabels = {
9
10
  calendar: "Choose a date",
@@ -44,7 +45,7 @@ function Calendar({
44
45
  iconOnly: true,
45
46
  "aria-label": text.previousMonth,
46
47
  onClick: () => onMonthChange?.(showPreviousMonth, showPreviousYear),
47
- children: /* @__PURE__ */ jsx(Icon, { name: "arrow-left" })
48
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "arrow-left" })
48
49
  }
49
50
  ),
50
51
  /* @__PURE__ */ jsx("span", { className: "roaster-date-picker__month", "aria-live": "polite", children: monthTitle(month, year, locale) }),
@@ -55,7 +56,7 @@ function Calendar({
55
56
  iconOnly: true,
56
57
  "aria-label": text.nextMonth,
57
58
  onClick: () => onMonthChange?.(showNextMonth, showNextYear),
58
- children: /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
59
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "arrow-right" })
59
60
  }
60
61
  )
61
62
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["import { Button } from '@/components/Button';\nimport {\n getNextDisplayMonth,\n getNextDisplayYear,\n getPreviousDisplayMonth,\n getPreviousDisplayYear,\n monthTitle,\n type WeekStartsOn,\n noop,\n} from '../../utils';\n\nimport { Month } from '../Month';\nimport { Icon } from '@/components/Icon';\n\nexport interface CalendarProps {\n /**\n * The language of the month and weekday names, as a BCP 47 tag such as `fr-FR`.\n * @defaultValue 'en-US'\n */\n locale?: string;\n /**\n * The day the week starts on: 0 is Sunday, 1 Monday ... 6 Saturday.\n * @defaultValue 0\n */\n weekStartsOn?: WeekStartsOn;\n /** Mounts Calendar if true */\n isOpen?: boolean;\n /** Callback to close the calendar. */\n onClose?(): void;\n /** The selected date */\n selected?: Date;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month: number;\n /** The year to show */\n year: number;\n /** Disable selecting dates before this. */\n minDate?: Date;\n /** Disable selecting dates after this. */\n maxDate?: Date;\n /** Disable specific dates. */\n disableSpecificDates?: Date[];\n /** Callback when date is selected. */\n handleDateSelection?(date: Date): void;\n /** Callback when month is changed. */\n onMonthChange?(month: number, year: number): void;\n}\n\n/** The text of the calendar, for other languages. */\nexport interface CalendarLabels {\n /** The name of the calendar, read by screen readers. */\n calendar: string;\n /** The name of the previous month button. */\n previousMonth: string;\n /** The name of the next month button. */\n nextMonth: string;\n}\n\nexport const defaultCalendarLabels: CalendarLabels = {\n calendar: 'Choose a date',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport function Calendar({\n selected,\n month,\n year,\n minDate,\n maxDate,\n disableSpecificDates,\n onMonthChange,\n handleDateSelection = noop,\n isOpen = false,\n onClose,\n locale,\n weekStartsOn,\n labels,\n}: CalendarProps & { labels?: Partial<CalendarLabels> }) {\n const text = { ...defaultCalendarLabels, ...labels };\n const showNextYear = getNextDisplayYear(month, year);\n const showNextMonth = getNextDisplayMonth(month);\n\n const showPreviousYear = getPreviousDisplayYear(month, year);\n const showPreviousMonth = getPreviousDisplayMonth(month);\n\n if (!isOpen) return null;\n\n return (\n // A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would\n // otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"roaster-date-picker__popup\" onMouseDown={(event) => event.preventDefault()}>\n <div className=\"roaster-date-picker__calendar\" role=\"dialog\" aria-label={text.calendar}>\n <div className=\"roaster-date-picker__nav\">\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.previousMonth}\n onClick={() => onMonthChange?.(showPreviousMonth, showPreviousYear)}\n >\n <Icon name=\"arrow-left\" />\n </Button>\n <span className=\"roaster-date-picker__month\" aria-live=\"polite\">\n {monthTitle(month, year, locale)}\n </span>\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.nextMonth}\n onClick={() => onMonthChange?.(showNextMonth, showNextYear)}\n >\n <Icon name=\"arrow-right\" />\n </Button>\n </div>\n <Month\n month={month}\n year={year}\n selected={selected}\n onChange={handleDateSelection}\n onMonthChange={onMonthChange}\n onEscape={onClose}\n minDate={minDate}\n maxDate={maxDate}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAaY,MAAC,qBAAqB,GAAG;AACrC,EAAE,QAAQ,EAAE,eAAe;AAC3B,EAAE,aAAa,EAAE,gBAAgB;AACjC,EAAE,SAAS,EAAE;AACb;AACO,SAAS,QAAQ,CAAC;AACzB,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,oBAAoB;AACtB,EAAE,aAAa;AACf,EAAE,mBAAmB,GAAG,IAAI;AAC5B,EAAE,MAAM,GAAG,KAAK;AAChB,EAAE,OAAO;AACT,EAAE,MAAM;AACR,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,qBAAqB,EAAE,GAAG,MAAM,EAAE;AACtD,EAAE,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;AACtD,EAAE,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC;AAClD,EAAE,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC;AAC9D,EAAE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,KAAK,CAAC;AAC1D,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI;AAC1B,EAAE;AACF;AACA;AACA;AACA,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,WAAW,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,EAAE,EAAE,QAAQ,kBAAkB,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,+BAA+B,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAA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E;AACV;AACA;;"}
1
+ {"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["import { Button } from '@/components/Button';\nimport {\n getNextDisplayMonth,\n getNextDisplayYear,\n getPreviousDisplayMonth,\n getPreviousDisplayYear,\n monthTitle,\n type WeekStartsOn,\n noop,\n} from '../../utils';\n\nimport { Month } from '../Month';\nimport { RoasterIcon } from '@/components/Icon';\n\nexport interface CalendarProps {\n /**\n * The language of the month and weekday names, as a BCP 47 tag such as `fr-FR`.\n * @defaultValue 'en-US'\n */\n locale?: string;\n /**\n * The day the week starts on: 0 is Sunday, 1 Monday ... 6 Saturday.\n * @defaultValue 0\n */\n weekStartsOn?: WeekStartsOn;\n /** Mounts Calendar if true */\n isOpen?: boolean;\n /** Callback to close the calendar. */\n onClose?(): void;\n /** The selected date */\n selected?: Date;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month: number;\n /** The year to show */\n year: number;\n /** Disable selecting dates before this. */\n minDate?: Date;\n /** Disable selecting dates after this. */\n maxDate?: Date;\n /** Disable specific dates. */\n disableSpecificDates?: Date[];\n /** Callback when date is selected. */\n handleDateSelection?(date: Date): void;\n /** Callback when month is changed. */\n onMonthChange?(month: number, year: number): void;\n}\n\n/** The text of the calendar, for other languages. */\nexport interface CalendarLabels {\n /** The name of the calendar, read by screen readers. */\n calendar: string;\n /** The name of the previous month button. */\n previousMonth: string;\n /** The name of the next month button. */\n nextMonth: string;\n}\n\nexport const defaultCalendarLabels: CalendarLabels = {\n calendar: 'Choose a date',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport function Calendar({\n selected,\n month,\n year,\n minDate,\n maxDate,\n disableSpecificDates,\n onMonthChange,\n handleDateSelection = noop,\n isOpen = false,\n onClose,\n locale,\n weekStartsOn,\n labels,\n}: CalendarProps & { labels?: Partial<CalendarLabels> }) {\n const text = { ...defaultCalendarLabels, ...labels };\n const showNextYear = getNextDisplayYear(month, year);\n const showNextMonth = getNextDisplayMonth(month);\n\n const showPreviousYear = getPreviousDisplayYear(month, year);\n const showPreviousMonth = getPreviousDisplayMonth(month);\n\n if (!isOpen) return null;\n\n return (\n // A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would\n // otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"roaster-date-picker__popup\" onMouseDown={(event) => event.preventDefault()}>\n <div className=\"roaster-date-picker__calendar\" role=\"dialog\" aria-label={text.calendar}>\n <div className=\"roaster-date-picker__nav\">\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.previousMonth}\n onClick={() => onMonthChange?.(showPreviousMonth, showPreviousYear)}\n >\n <RoasterIcon name=\"arrow-left\" />\n </Button>\n <span className=\"roaster-date-picker__month\" aria-live=\"polite\">\n {monthTitle(month, year, locale)}\n </span>\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.nextMonth}\n onClick={() => onMonthChange?.(showNextMonth, showNextYear)}\n >\n <RoasterIcon name=\"arrow-right\" />\n </Button>\n </div>\n <Month\n month={month}\n year={year}\n selected={selected}\n onChange={handleDateSelection}\n onMonthChange={onMonthChange}\n onEscape={onClose}\n minDate={minDate}\n maxDate={maxDate}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAaY,MAAC,qBAAqB,GAAG;AACrC,EAAE,QAAQ,EAAE,eAAe;AAC3B,EAAE,aAAa,EAAE,gBAAgB;AACjC,EAAE,SAAS,EAAE;AACb;AACO,SAAS,QAAQ,CAAC;AACzB,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,oBAAoB;AACtB,EAAE,aAAa;AACf,EAAE,mBAAmB,GAAG,IAAI;AAC5B,EAAE,MAAM,GAAG,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,EAAE,4BAA4B,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;AAClJ,wBAAwB,GAAG;AAC3B,UAAU,MAAM;AAChB,UAAU;AACV,YAAY,OAAO,EAAE,WAAW;AAChC,YAAY,QAAQ,EAAE,IAAI;AAC1B,YAAY,YAAY,EAAE,IAAI,CAAC,SAAS;AACxC,YAAY,OAAO,EAAE,MAAM,aAAa,GAAG,aAAa,EAAE,YAAY,CAAC;AACvE,YAAY,QAAQ,kBAAkB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AAC9E;AACA;AACA,OAAO,EAAE,CAAC;AACV,sBAAsB,GAAG;AACzB,QAAQ,KAAK;AACb,QAAQ;AACR,UAAU,KAAK;AACf,UAAU,IAAI;AACd,UAAU,QAAQ;AAClB,UAAU,QAAQ,EAAE,mBAAmB;AACvC,UAAU,aAAa;AACvB,UAAU,QAAQ,EAAE,OAAO;AAC3B,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB,UAAU,oBAAoB;AAC9B,UAAU,MAAM;AAChB,UAAU;AACV;AACA;AACA,KAAK,EAAE,CAAC,EAAE;AACV;AACA;;"}
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { Icon } from '../../Icon/Icon.js';
4
+ import '../../Icon/Icon.js';
5
+ import { RoasterIcon } from '../../Icon/RoasterIcon.js';
5
6
  import { classNames } from '../../../utils/classNames/index.js';
6
7
  import { useControllableState } from '../../../utils/useControllableState/index.js';
7
8
  import { useUid } from '../../../utils/useUid/index.js';
@@ -87,7 +88,7 @@ const DropdownCardTab = React.forwardRef(
87
88
  children: [
88
89
  icon,
89
90
  children,
90
- /* @__PURE__ */ jsx(Icon, { name: "angle-right" })
91
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-right" })
91
92
  ]
92
93
  }
93
94
  );
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownCardTabs.js","sources":["../../../../../src/components/DropdownCard/components/DropdownCardTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { Icon } from '../../Icon';\n\ninterface TabsContextValue {\n value: string;\n setValue(value: string): void;\n baseId: string;\n}\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext() {\n const context = React.useContext(TabsContext);\n if (context == null) throw new Error('DropdownCard.TabList, Tab and Panel must be wrapped in <DropdownCard.Tabs />');\n return context;\n}\n\nconst idOf = (baseId: string, part: 'tab' | 'panel', value: string) => `${baseId}-${part}-${value}`;\n\nexport interface DropdownCardTabsProps {\n /** The tab list and the panels. */\n children: React.ReactNode;\n /** The chosen tab's value, for controlled tabs. */\n value?: string;\n /** The tab chosen at first, for uncontrolled tabs. */\n defaultValue?: string;\n /** Called with the tab's value when the user chooses a tab. */\n onValueChange?(value: string): void;\n}\n\n/**\n * Tabs in a dropdown card (`variant=\"tabs\"` on DropdownCard.Dropdown): a list of tabs beside the content, one panel\n * per tab, such as one filter per tab. Compose it with DropdownCard.TabList, DropdownCard.Tab and DropdownCard.Panel.\n */\nexport function DropdownCardTabs({ children, value, defaultValue, onValueChange }: DropdownCardTabsProps) {\n const [current, setCurrent] = useControllableState({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange,\n });\n const baseId = useUid();\n const context = React.useMemo(\n () => ({ value: current, setValue: setCurrent, baseId }),\n [current, setCurrent, baseId]\n );\n return <TabsContext.Provider value={context}>{children}</TabsContext.Provider>;\n}\n\n/** Every native `<div>` prop (`aria-label`, ...) is accepted and forwarded to the list. Name it with `aria-label`. */\nexport interface DropdownCardTabListProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The tabs. */\n children: React.ReactNode;\n}\n\n/** The list of tabs (`role=\"tablist\"`), on the card's start side. The arrow keys, Home and End choose a tab. */\nexport const DropdownCardTabList = React.forwardRef<HTMLDivElement, DropdownCardTabListProps>(\n ({ className, children, onKeyDown, ...rest }, ref) => {\n const { setValue } = useTabsContext();\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLElement>(':scope > [role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(event.target as HTMLElement);\n if (index === -1) return;\n const step = ({ ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 } as Record<string, number>)[event.key];\n let next: HTMLElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs[tabs.length - 1];\n if (!next) return;\n event.preventDefault();\n setValue(next.dataset.value ?? '');\n next.focus();\n };\n return (\n // The keys come from its tabs, which take the focus.\n // eslint-disable-next-line jsx-a11y/interactive-supports-focus\n <div\n role=\"tablist\"\n aria-orientation=\"vertical\"\n {...rest}\n ref={ref}\n onKeyDown={handleKeyDown}\n className={classNames('roaster-dropdown-card__tabs', className)}\n >\n {children}\n </div>\n );\n }\n);\nDropdownCardTabList.displayName = 'DropdownCardTabList';\n\n/** Every native `<button>` prop is accepted and forwarded to the tab. */\nexport interface DropdownCardTabProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value'> {\n /** The tab's value, which names its panel. */\n value: string;\n /** The tab's name. */\n children: React.ReactNode;\n /** An `Icon` before the name. */\n icon?: React.ReactNode;\n}\n\n/** A tab: choosing it shows its panel. The chosen tab is the list's one tab stop, with a chevron at its end. */\nexport const DropdownCardTab = React.forwardRef<HTMLButtonElement, DropdownCardTabProps>(\n ({ value, icon, children, className, onClick, type = 'button', ...rest }, ref) => {\n const context = useTabsContext();\n const selected = context.value === value;\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n role=\"tab\"\n id={idOf(context.baseId, 'tab', value)}\n aria-controls={idOf(context.baseId, 'panel', value)}\n aria-selected={selected}\n tabIndex={selected ? 0 : -1}\n data-value={value}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.setValue(value);\n }}\n className={classNames('roaster-dropdown-card__tab', className)}\n >\n {icon}\n {children}\n <Icon name=\"angle-right\" />\n </button>\n );\n }\n);\nDropdownCardTab.displayName = 'DropdownCardTab';\n\n/** Every native `<div>` prop is accepted and forwarded to the panel. */\nexport interface DropdownCardPanelProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The value of the tab that shows the panel. */\n value: string;\n /** The panel's fields. It scrolls when it is taller than the card. */\n children: React.ReactNode;\n}\n\n/** The content of one tab (`role=\"tabpanel\"`), hidden while another tab is chosen. */\nexport const DropdownCardPanel = React.forwardRef<HTMLDivElement, DropdownCardPanelProps>(\n ({ value, className, children, ...rest }, ref) => {\n const context = useTabsContext();\n return (\n <div\n {...rest}\n ref={ref}\n role=\"tabpanel\"\n id={idOf(context.baseId, 'panel', value)}\n aria-labelledby={idOf(context.baseId, 'tab', value)}\n hidden={context.value !== value}\n className={classNames('roaster-dropdown-card__content', className)}\n >\n {children}\n </div>\n );\n }\n);\nDropdownCardPanel.displayName = 'DropdownCardPanel';\n"],"names":[],"mappings":";;;;;;;;AAKA,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7C,SAAS,cAAc,GAAG;AAC1B,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;AAC/C,EAAE,IAAI,OAAO,IAAI,IAAI,EAAE,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC;AACtH,EAAE,OAAO,OAAO;AAChB;AACA,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC3D,SAAS,gBAAgB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,aA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,EAAE,KAAK,CAAC;AAChD,QAAQ,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;AAC7D,QAAQ,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,KAAK;AACvC,QAAQ,SAAS,EAAE,UAAU,CAAC,gCAAgC,EAAE,SAAS,CAAC;AAC1E,QAAQ;AACR;AACA,KAAK;AACL,EAAE;AACF;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
1
+ {"version":3,"file":"DropdownCardTabs.js","sources":["../../../../../src/components/DropdownCard/components/DropdownCardTabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { RoasterIcon } from '../../Icon';\n\ninterface TabsContextValue {\n value: string;\n setValue(value: string): void;\n baseId: string;\n}\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext() {\n const context = React.useContext(TabsContext);\n if (context == null) throw new Error('DropdownCard.TabList, Tab and Panel must be wrapped in <DropdownCard.Tabs />');\n return context;\n}\n\nconst idOf = (baseId: string, part: 'tab' | 'panel', value: string) => `${baseId}-${part}-${value}`;\n\nexport interface DropdownCardTabsProps {\n /** The tab list and the panels. */\n children: React.ReactNode;\n /** The chosen tab's value, for controlled tabs. */\n value?: string;\n /** The tab chosen at first, for uncontrolled tabs. */\n defaultValue?: string;\n /** Called with the tab's value when the user chooses a tab. */\n onValueChange?(value: string): void;\n}\n\n/**\n * Tabs in a dropdown card (`variant=\"tabs\"` on DropdownCard.Dropdown): a list of tabs beside the content, one panel\n * per tab, such as one filter per tab. Compose it with DropdownCard.TabList, DropdownCard.Tab and DropdownCard.Panel.\n */\nexport function DropdownCardTabs({ children, value, defaultValue, onValueChange }: DropdownCardTabsProps) {\n const [current, setCurrent] = useControllableState({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange,\n });\n const baseId = useUid();\n const context = React.useMemo(\n () => ({ value: current, setValue: setCurrent, baseId }),\n [current, setCurrent, baseId]\n );\n return <TabsContext.Provider value={context}>{children}</TabsContext.Provider>;\n}\n\n/** Every native `<div>` prop (`aria-label`, ...) is accepted and forwarded to the list. Name it with `aria-label`. */\nexport interface DropdownCardTabListProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The tabs. */\n children: React.ReactNode;\n}\n\n/** The list of tabs (`role=\"tablist\"`), on the card's start side. The arrow keys, Home and End choose a tab. */\nexport const DropdownCardTabList = React.forwardRef<HTMLDivElement, DropdownCardTabListProps>(\n ({ className, children, onKeyDown, ...rest }, ref) => {\n const { setValue } = useTabsContext();\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLElement>(':scope > [role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(event.target as HTMLElement);\n if (index === -1) return;\n const step = ({ ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 } as Record<string, number>)[event.key];\n let next: HTMLElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs[tabs.length - 1];\n if (!next) return;\n event.preventDefault();\n setValue(next.dataset.value ?? '');\n next.focus();\n };\n return (\n // The keys come from its tabs, which take the focus.\n // eslint-disable-next-line jsx-a11y/interactive-supports-focus\n <div\n role=\"tablist\"\n aria-orientation=\"vertical\"\n {...rest}\n ref={ref}\n onKeyDown={handleKeyDown}\n className={classNames('roaster-dropdown-card__tabs', className)}\n >\n {children}\n </div>\n );\n }\n);\nDropdownCardTabList.displayName = 'DropdownCardTabList';\n\n/** Every native `<button>` prop is accepted and forwarded to the tab. */\nexport interface DropdownCardTabProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value'> {\n /** The tab's value, which names its panel. */\n value: string;\n /** The tab's name. */\n children: React.ReactNode;\n /** An `Icon` before the name. */\n icon?: React.ReactNode;\n}\n\n/** A tab: choosing it shows its panel. The chosen tab is the list's one tab stop, with a chevron at its end. */\nexport const DropdownCardTab = React.forwardRef<HTMLButtonElement, DropdownCardTabProps>(\n ({ value, icon, children, className, onClick, type = 'button', ...rest }, ref) => {\n const context = useTabsContext();\n const selected = context.value === value;\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n role=\"tab\"\n id={idOf(context.baseId, 'tab', value)}\n aria-controls={idOf(context.baseId, 'panel', value)}\n aria-selected={selected}\n tabIndex={selected ? 0 : -1}\n data-value={value}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.setValue(value);\n }}\n className={classNames('roaster-dropdown-card__tab', className)}\n >\n {icon}\n {children}\n <RoasterIcon name=\"chevron-right\" />\n </button>\n );\n }\n);\nDropdownCardTab.displayName = 'DropdownCardTab';\n\n/** Every native `<div>` prop is accepted and forwarded to the panel. */\nexport interface DropdownCardPanelProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The value of the tab that shows the panel. */\n value: string;\n /** The panel's fields. It scrolls when it is taller than the card. */\n children: React.ReactNode;\n}\n\n/** The content of one tab (`role=\"tabpanel\"`), hidden while another tab is chosen. */\nexport const DropdownCardPanel = React.forwardRef<HTMLDivElement, DropdownCardPanelProps>(\n ({ value, className, children, ...rest }, ref) => {\n const context = useTabsContext();\n return (\n <div\n {...rest}\n ref={ref}\n role=\"tabpanel\"\n id={idOf(context.baseId, 'panel', value)}\n aria-labelledby={idOf(context.baseId, 'tab', value)}\n hidden={context.value !== value}\n className={classNames('roaster-dropdown-card__content', className)}\n >\n {children}\n </div>\n );\n }\n);\nDropdownCardPanel.displayName = 'DropdownCardPanel';\n"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7C,SAAS,cAAc,GAAG;AAC1B,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;AAC/C,EAAE,IAAI,OAAO,IAAI,IAAI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AAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,KAAK;AACpD,IAAI,MAAM,OAAO,GAAG,cAAc,EAAE;AACpC,IAAI,uBAAuB,GAAG;AAC9B,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,GAAG,IAAI;AACf,QAAQ,GAAG;AACX,QAAQ,IAAI,EAAE,UAAU;AACxB,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;AAChD,QAAQ,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;AAC7D,QAAQ,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,KAAK;AACvC,QAAQ,SAAS,EAAE,UAAU,CAAC,gCAAgC,EAAE,SAAS,CAAC;AAC1E,QAAQ;AACR;AACA,KAAK;AACL,EAAE;AACF;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Field, fieldControlProps } from '../Field/Field.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { useUid } from '../../utils/useUid/index.js';
7
8
  import { classNames } from '../../utils/classNames/index.js';
8
9
 
@@ -14,13 +15,13 @@ function EmptyMarkupPlaceholder({
14
15
  }) {
15
16
  if (type === "file")
16
17
  return /* @__PURE__ */ jsxs(Fragment, { children: [
17
- /* @__PURE__ */ jsx(Icon, { name: "file-csv", className: "roaster-file__icon" }),
18
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "file-spreadsheet", className: "roaster-file__icon" }),
18
19
  /* @__PURE__ */ jsx("span", { className: "roaster-file__name", children: noFileLabel })
19
20
  ] });
20
21
  if (defaultValue) {
21
22
  return /* @__PURE__ */ jsx("img", { src: defaultValue, alt: "" });
22
23
  }
23
- return /* @__PURE__ */ jsx("div", { className: "roaster-file__placeholder", children: /* @__PURE__ */ jsx(Icon, { name: "image" }) });
24
+ return /* @__PURE__ */ jsx("div", { className: "roaster-file__placeholder", children: /* @__PURE__ */ jsx(RoasterIcon, { name: "image" }) });
24
25
  }
25
26
  function Preview({ type, files }) {
26
27
  const file = files[0];
@@ -35,7 +36,7 @@ function Preview({ type, files }) {
35
36
  return imageUrl ? /* @__PURE__ */ jsx("img", { src: imageUrl, alt: file.name }) : null;
36
37
  }
37
38
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38
- /* @__PURE__ */ jsx(Icon, { name: "file-csv", className: "roaster-file__icon" }),
39
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "file-spreadsheet", className: "roaster-file__icon" }),
39
40
  /* @__PURE__ */ jsx("span", { className: "roaster-file__name", children: files.map((chosen) => chosen.name).join(", ") })
40
41
  ] });
41
42
  }
@@ -88,7 +89,7 @@ const FileField = React.forwardRef((props, ref) => {
88
89
  /* @__PURE__ */ jsx("div", { className: type === "image" ? "roaster-file__image" : "roaster-file__preview", children: files.length === 0 ? /* @__PURE__ */ jsx(EmptyMarkupPlaceholder, { type, defaultValue, noFileLabel: text.noFile }) : /* @__PURE__ */ jsx(Preview, { type, files }) }),
89
90
  /* @__PURE__ */ jsxs("div", { className: "roaster-file__button", children: [
90
91
  /* @__PURE__ */ jsxs("span", { children: [
91
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-from-bracket" }),
92
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "upload" }),
92
93
  text.upload,
93
94
  hint && /* @__PURE__ */ jsx("small", { className: "roaster-file__hint", children: hint })
94
95
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"FileField.js","sources":["../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\nimport { Icon } from '@/components/Icon';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the file input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface FileFieldProps\n extends\n FieldBaseProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'size' | 'defaultValue' | 'value' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * Called with the chosen files when the user picks some: one, or several with `multiple`. The native `onChange`\n * gets the event.\n */\n onValueChange?(files: File[]): void;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** The text of the field, in English by default. */\n labels?: Partial<FileFieldLabels>;\n /** A line under the upload label, such as the files it takes. */\n hint?: React.ReactNode;\n}\n\n/** The text of the file field, for other languages. */\nexport interface FileFieldLabels {\n /** The upload button. */\n upload: React.ReactNode;\n /** Shown for a file field (`type=\"file\"`) with no file yet. */\n noFile: React.ReactNode;\n}\n\nconst defaultFileFieldLabels: FileFieldLabels = { upload: 'Upload a file', noFile: 'No file added' };\n\nfunction EmptyMarkupPlaceholder({\n type,\n defaultValue,\n noFileLabel,\n}: {\n type: 'image' | 'file';\n defaultValue?: string | null;\n noFileLabel: React.ReactNode;\n}) {\n if (type === 'file')\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{noFileLabel}</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"roaster-file__placeholder\">\n <Icon name=\"image\" />\n </div>\n );\n}\n\nfunction Preview({ type, files }: { type: string; files: File[] }) {\n const file = files[0];\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{files.map((chosen) => chosen.name).join(', ')}</span>\n </>\n );\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onValueChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n labels,\n hint,\n ...others\n } = props;\n const text = { ...defaultFileFieldLabels, ...labels };\n const uid = useUid(id);\n // Every chosen file: several with `multiple`.\n const [files, setFiles] = React.useState<File[]>([]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const chosen = [...(event.currentTarget.files ?? [])];\n setFiles(chosen);\n onChange?.(event);\n onValueChange?.(chosen);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n <div\n className={classNames('roaster-file', `roaster-file--${size}`)}\n data-state={files.length > 0 ? 'filled' : undefined}\n >\n <div className={type === 'image' ? 'roaster-file__image' : 'roaster-file__preview'}>\n {files.length === 0 ? (\n <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} noFileLabel={text.noFile} />\n ) : (\n <Preview type={type} files={files} />\n )}\n </div>\n <div className=\"roaster-file__button\">\n <span>\n <Icon name=\"arrow-up-from-bracket\" />\n {text.upload}\n {hint && <small className=\"roaster-file__hint\">{hint}</small>}\n </span>\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n name={name}\n ref={ref}\n className=\"roaster-file__input\"\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n />\n </div>\n </div>\n </Field>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,sBAAsB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;AACnF,SAAS,sBAAsB,CAAC;AAChC,EAAE,IAAI;AACN,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,IAAI,IAAI,KAAK,MAAM;AACrB,IAAI,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AACtF,sBAAsB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC5F,KAAK,EAAE,CAAC;AACR,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACrE,EAAE;AACF,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACvI;AACA,SAAS,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;AAClC,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;AACvB,EAAE,M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Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\nimport { RoasterIcon } from '@/components/Icon';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the file input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface FileFieldProps\n extends\n FieldBaseProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'size' | 'defaultValue' | 'value' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * Called with the chosen files when the user picks some: one, or several with `multiple`. The native `onChange`\n * gets the event.\n */\n onValueChange?(files: File[]): void;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** The text of the field, in English by default. */\n labels?: Partial<FileFieldLabels>;\n /** A line under the upload label, such as the files it takes. */\n hint?: React.ReactNode;\n}\n\n/** The text of the file field, for other languages. */\nexport interface FileFieldLabels {\n /** The upload button. */\n upload: React.ReactNode;\n /** Shown for a file field (`type=\"file\"`) with no file yet. */\n noFile: React.ReactNode;\n}\n\nconst defaultFileFieldLabels: FileFieldLabels = { upload: 'Upload a file', noFile: 'No file added' };\n\nfunction EmptyMarkupPlaceholder({\n type,\n defaultValue,\n noFileLabel,\n}: {\n type: 'image' | 'file';\n defaultValue?: string | null;\n noFileLabel: React.ReactNode;\n}) {\n if (type === 'file')\n return (\n <>\n <RoasterIcon name=\"file-spreadsheet\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{noFileLabel}</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"roaster-file__placeholder\">\n <RoasterIcon name=\"image\" />\n </div>\n );\n}\n\nfunction Preview({ type, files }: { type: string; files: File[] }) {\n const file = files[0];\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return (\n <>\n <RoasterIcon name=\"file-spreadsheet\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{files.map((chosen) => chosen.name).join(', ')}</span>\n </>\n );\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onValueChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n labels,\n hint,\n ...others\n } = props;\n const text = { ...defaultFileFieldLabels, ...labels };\n const uid = useUid(id);\n // Every chosen file: several with `multiple`.\n const [files, setFiles] = React.useState<File[]>([]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const chosen = [...(event.currentTarget.files ?? [])];\n setFiles(chosen);\n onChange?.(event);\n onValueChange?.(chosen);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n <div\n className={classNames('roaster-file', `roaster-file--${size}`)}\n data-state={files.length > 0 ? 'filled' : undefined}\n >\n <div className={type === 'image' ? 'roaster-file__image' : 'roaster-file__preview'}>\n {files.length === 0 ? (\n <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} noFileLabel={text.noFile} />\n ) : (\n <Preview type={type} files={files} />\n )}\n </div>\n <div className=\"roaster-file__button\">\n <span>\n <RoasterIcon name=\"upload\" />\n {text.upload}\n {hint && <small className=\"roaster-file__hint\">{hint}</small>}\n </span>\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n name={name}\n ref={ref}\n className=\"roaster-file__input\"\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n />\n </div>\n </div>\n </Field>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,sBAAsB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;AACnF,SAAS,sBAAsB,CAAC;AAChC,EAAE,IAAI;AACN,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,IAAI,IAAI,KAAK,MAAM;AACrB,IAAI,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AACrG,sBAAsB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC5F,KAAK,EAAE,CAAC;AACR,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACrE,EAAE;AACF,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC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ACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<i>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface IconProps extends Omit<React.ComponentPropsWithoutRef<'i'>, 'children'> {\n /** The Font Awesome icon's name, without its `fa-` prefix: `xmark`, `circle-info`. */\n name: string;\n /**\n * What the icon means, for an icon that stands alone, such as a status. Leave it out for an icon next to text that\n * says the same, or inside a button with its own name: the icon is then hidden from screen readers.\n */\n label?: string;\n}\n\n/**\n * A Font Awesome icon, in the regular style: `<Icon name=\"xmark\" />`. It needs `fontawesome.css` from the CDN. Use\n * `IconBadge` for an icon on a colored, rounded background.\n */\nexport const Icon = React.forwardRef<HTMLElement, IconProps>(({ name, label, className, ...others }, ref) => (\n <i\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...others}\n ref={ref}\n className={classNames('fa-regular', `fa-${name}`, className)}\n />\n));\n\nIcon.displayName = 'Icon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AACxG,EAAE,GAAG;AACL,EAAE;AACF,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAC7E,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC/D;AACA,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
1
+ {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/**\n * Every native `<i>` prop (`id`, `data-*`, ...) is accepted and forwarded to it.\n *\n * @deprecated `Icon` is deprecated: pass your icon set's own element.\n */\nexport interface IconProps extends Omit<React.ComponentPropsWithoutRef<'i'>, 'children'> {\n /** The Font Awesome icon's name, without its `fa-` prefix: `xmark`, `circle-info`. */\n name: string;\n /**\n * What the icon means, for an icon that stands alone, such as a status. Leave it out for an icon next to text that\n * says the same, or inside a button with its own name: the icon is then hidden from screen readers.\n */\n label?: string;\n}\n\n/**\n * Deprecated: pass your icon set's own element instead, such as Font Awesome's\n * `<i className=\"fa-regular fa-house\" aria-hidden=\"true\" />`. Roaster's components draw their own icons, and an app's\n * icons are the app's, from the icon set it loads.\n *\n * A Font Awesome icon, in the regular style: `<Icon name=\"house\" />`. It needs Font Awesome, which the app loads. Use\n * `IconBadge` for an icon on a colored, rounded background.\n *\n * @deprecated Pass your icon set's own element instead, such as Font Awesome's\n * `<i className=\"fa-regular fa-house\" aria-hidden=\"true\" />`.\n */\nexport const Icon = React.forwardRef<HTMLElement, IconProps>(({ name, label, className, ...others }, ref) => (\n <i\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...others}\n ref={ref}\n className={classNames('fa-regular', `fa-${name}`, className)}\n />\n));\n\nIcon.displayName = 'Icon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AACxG,EAAE,GAAG;AACL,EAAE;AACF,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAC7E,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC/D;AACA,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { classNames } from '../../utils/classNames/index.js';
4
+
5
+ function RoasterIcon({ name, className }) {
6
+ return /* @__PURE__ */ jsx("i", { className: classNames("roaster-icon", `roaster-icon--${name}`, className), "aria-hidden": "true" });
7
+ }
8
+
9
+ export { RoasterIcon };
10
+ //# sourceMappingURL=RoasterIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoasterIcon.js","sources":["../../../../src/components/Icon/RoasterIcon.tsx"],"sourcesContent":["import { classNames } from '@/utils';\n\n/** The icons Roaster draws, each a `roaster-icon--<name>` class of roaster.css: Lucide's, by their Lucide names. */\nexport type RoasterIconName =\n | 'x'\n | 'check'\n | 'chevron-up'\n | 'chevron-down'\n | 'chevron-left'\n | 'chevron-right'\n | 'arrow-up'\n | 'arrow-down'\n | 'arrow-left'\n | 'arrow-right'\n | 'info'\n | 'menu'\n | 'image'\n | 'file-spreadsheet'\n | 'upload'\n | 'bold'\n | 'italic'\n | 'underline'\n | 'strikethrough'\n | 'link'\n | 'list'\n | 'list-ordered'\n | 'heading-1'\n | 'heading-2'\n | 'heading-3'\n | 'square-pen'\n | 'save'\n | 'trash';\n\nexport interface RoasterIconProps {\n name: RoasterIconName;\n className?: string;\n}\n\n/**\n * One of the icons Roaster's components draw, such as a close button's cross: `<RoasterIcon name=\"x\" />`. It needs no\n * icon font, and is hidden from screen readers, as the control around it is named. Internal: an app's own icons go\n * through `Icon`.\n */\nexport function RoasterIcon({ name, className }: RoasterIconProps) {\n return <i className={classNames('roaster-icon', `roaster-icon--${name}`, className)} aria-hidden=\"true\" />;\n}\n"],"names":[],"mappings":";;;;AAGO,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;AACjD,EAAE,uBAAuB,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;AACvI;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconBadge.js","sources":["../../../../src/components/IconBadge/IconBadge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** The tones of the badge's background. Without one, it has none. */\nexport type IconBadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'danger';\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 IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The icon or image. */\n children: React.ReactNode;\n /** The background's tone. */\n tone?: IconBadgeTone;\n /**\n * 36px (`medium`) or 20px (`small`). In a Timeline.Item, it takes the timeline marker's size.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A round badge around an icon or an image, in a tone. For the icon alone, use `Icon`; for a description on hover and\n * focus, put a focusable element in a `Tooltip`.\n */\nexport const IconBadge = React.forwardRef<HTMLSpanElement, IconBadgeProps>((props, ref) => {\n const { tone, children, size = 'medium', className, ...otherProps } = props;\n\n return (\n <span\n {...otherProps}\n ref={ref}\n className={classNames(\n 'roaster-icon-badge',\n { 'roaster-icon-badge--small': size === 'small', [`roaster-icon-badge--${tone}`]: tone },\n className\n )}\n >\n {children}\n </span>\n );\n});\n\nIconBadge.displayName = 'IconBadge';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAC7E,EAAE,uBAAuB,GAAG;AAC5B,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG,UAAU;AACnB,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU;AAC3B,QAAQ,oBAAoB;AAC5B,QAAQ,EAAE,2BAA2B,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE;AAChG,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"IconBadge.js","sources":["../../../../src/components/IconBadge/IconBadge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** The tones of the badge's background. Without one, it has none. */\nexport type IconBadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'danger';\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 IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The icon or image. */\n children: React.ReactNode;\n /** The background's tone. */\n tone?: IconBadgeTone;\n /**\n * 36px (`medium`) or 20px (`small`). In a Timeline.Item, it takes the timeline marker's size.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A round badge around an icon or an image, in a tone. For a description on hover and focus, put a focusable element\n * in a `Tooltip`.\n */\nexport const IconBadge = React.forwardRef<HTMLSpanElement, IconBadgeProps>((props, ref) => {\n const { tone, children, size = 'medium', className, ...otherProps } = props;\n\n return (\n <span\n {...otherProps}\n ref={ref}\n className={classNames(\n 'roaster-icon-badge',\n { 'roaster-icon-badge--small': size === 'small', [`roaster-icon-badge--${tone}`]: tone },\n className\n )}\n >\n {children}\n </span>\n );\n});\n\nIconBadge.displayName = 'IconBadge';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAC7E,EAAE,uBAAuB,GAAG;AAC5B,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG,UAAU;AACnB,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU;AAC3B,QAAQ,oBAAoB;AAC5B,QAAQ,EAAE,2BAA2B,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE;AAChG,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { useControllableState } from '../../utils/useControllableState/index.js';
7
8
  import { useUid } from '../../utils/useUid/index.js';
8
9
  import { classNames } from '../../utils/classNames/index.js';
@@ -90,7 +91,7 @@ const Modal = React.forwardRef((props, ref) => {
90
91
  children: [
91
92
  /* @__PURE__ */ jsxs("div", { className: "roaster-modal__header", children: [
92
93
  title && /* @__PURE__ */ jsx("h2", { className: "roaster-modal__title", id: titleId, children: title }),
93
- /* @__PURE__ */ jsx(ButtonIcon, { size: "medium", "aria-label": text.close, onClick: () => setOpen(false), children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) }),
94
+ /* @__PURE__ */ jsx(ButtonIcon, { size: "medium", "aria-label": text.close, onClick: () => setOpen(false), children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" }) }),
94
95
  description && /* @__PURE__ */ jsx("p", { className: "roaster-modal__description", id: descriptionId, children: description })
95
96
  ] }),
96
97
  /* @__PURE__ */ jsx("div", { className: "roaster-modal__body", children }),
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { ModalLabels, ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\nconst defaultModalLabels: ModalLabels = { close: 'Close' };\n\n// A layout effect in the browser (the modal opens before it paints), and nothing on the server, which warns about one.\nconst useClientLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/** Whether the pointer event happened outside the dialog's box, on its backdrop. */\nfunction onBackdrop(dialog: HTMLDialogElement, event: React.MouseEvent) {\n const box = dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n}\n\n/**\n * A dialog over the page (`<dialog>` opened with `showModal()`), with a title, content and an optional footer. The page\n * behind is inert and doesn't scroll; the close button, Escape and a click outside ask to close it; the focus goes\n * back where it was. Open it with `open`, or with `useModal().openModal()` inside a ModalProvider.\n */\nexport const Modal = React.forwardRef<HTMLDialogElement, ModalProps>((props, ref) => {\n const {\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n size = 'small',\n sheet = false,\n footer,\n labels,\n children,\n className,\n onCancel,\n onMouseDown,\n onClick,\n ...others\n } = props;\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const text = { ...defaultModalLabels, ...labels };\n const titleId = useUid();\n const descriptionId = useUid();\n const dialogRef = React.useRef<HTMLDialogElement | null>(null);\n const setRefs = React.useCallback(\n (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n },\n [ref]\n );\n // Set on mousedown, so that a selection dragged from inside the dialog to outside doesn't close it.\n const pressedOutside = React.useRef(false);\n\n // Shown as a modal once mounted. Unmounting removes it without close(), so the focus goes back by hand.\n useClientLayoutEffect(() => {\n if (!open) return undefined;\n const dialog = dialogRef.current;\n const previous = document.activeElement;\n if (dialog && !dialog.open) dialog.showModal();\n return () => {\n if (dialog?.open) dialog.close();\n if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });\n };\n }, [open]);\n\n if (!open) return null;\n\n return (\n // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n {...others}\n ref={setRefs}\n className={classNames(\n 'roaster-modal',\n size !== 'small' && `roaster-modal--${size}`,\n sheet && 'roaster-modal--sheet',\n className\n )}\n onCancel={(event) => {\n onCancel?.(event);\n // Escape: the state closes the dialog, so a parent that keeps it open is obeyed.\n event.preventDefault();\n setOpen(false);\n }}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n }}\n onClick={(event) => {\n onClick?.(event);\n const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n if (pressedOutside.current && outside) setOpen(false);\n pressedOutside.current = false;\n }}\n >\n <div className=\"roaster-modal__header\">\n {title && (\n <h2 className=\"roaster-modal__title\" id={titleId}>\n {title}\n </h2>\n )}\n <ButtonIcon size=\"medium\" aria-label={text.close} onClick={() => setOpen(false)}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n {description && (\n <p className=\"roaster-modal__description\" id={descriptionId}>\n {description}\n </p>\n )}\n </div>\n <div className=\"roaster-modal__body\">{children}</div>\n {footer && <div className=\"roaster-modal__footer\">{footer}</div>}\n </dialog>\n );\n});\n\nModal.displayName = 'Modal';\n"],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7C,MAAM,qBAAqB,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe;AACrG,SAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;AACnC,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC5C,EAAE,OAAO,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM;AACvH;AACY,MAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM;AACR,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,GAAG,KAAK;AACvB,IAAI,YAAY;AAChB,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,IAAI,GAAG,OAAO;AAClB,IAAI,KAAK,GAAG,KAAK;AACjB,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,WAAW;AACf,IAAI,OAAO;AACX,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,C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B,EAAE,QAAQ,EAAE;AACtF,YAAY,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACnH,4BAA4B,GAAG,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAChL,YAAY,WAAW,oBAAoB,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE;AACzI,WAAW,EAAE,CAAC;AACd,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACpF,UAAU,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE;AACvG;AACA;AACA;AACA;AACA,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { ModalLabels, ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\nconst defaultModalLabels: ModalLabels = { close: 'Close' };\n\n// A layout effect in the browser (the modal opens before it paints), and nothing on the server, which warns about one.\nconst useClientLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/** Whether the pointer event happened outside the dialog's box, on its backdrop. */\nfunction onBackdrop(dialog: HTMLDialogElement, event: React.MouseEvent) {\n const box = dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n}\n\n/**\n * A dialog over the page (`<dialog>` opened with `showModal()`), with a title, content and an optional footer. The page\n * behind is inert and doesn't scroll; the close button, Escape and a click outside ask to close it; the focus goes\n * back where it was. Open it with `open`, or with `useModal().openModal()` inside a ModalProvider.\n */\nexport const Modal = React.forwardRef<HTMLDialogElement, ModalProps>((props, ref) => {\n const {\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n size = 'small',\n sheet = false,\n footer,\n labels,\n children,\n className,\n onCancel,\n onMouseDown,\n onClick,\n ...others\n } = props;\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const text = { ...defaultModalLabels, ...labels };\n const titleId = useUid();\n const descriptionId = useUid();\n const dialogRef = React.useRef<HTMLDialogElement | null>(null);\n const setRefs = React.useCallback(\n (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n },\n [ref]\n );\n // Set on mousedown, so that a selection dragged from inside the dialog to outside doesn't close it.\n const pressedOutside = React.useRef(false);\n\n // Shown as a modal once mounted. Unmounting removes it without close(), so the focus goes back by hand.\n useClientLayoutEffect(() => {\n if (!open) return undefined;\n const dialog = dialogRef.current;\n const previous = document.activeElement;\n if (dialog && !dialog.open) dialog.showModal();\n return () => {\n if (dialog?.open) dialog.close();\n if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });\n };\n }, [open]);\n\n if (!open) return null;\n\n return (\n // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n {...others}\n ref={setRefs}\n className={classNames(\n 'roaster-modal',\n size !== 'small' && `roaster-modal--${size}`,\n sheet && 'roaster-modal--sheet',\n className\n )}\n onCancel={(event) => {\n onCancel?.(event);\n // Escape: the state closes the dialog, so a parent that keeps it open is obeyed.\n event.preventDefault();\n setOpen(false);\n }}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n }}\n onClick={(event) => {\n onClick?.(event);\n const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n if (pressedOutside.current && outside) setOpen(false);\n pressedOutside.current = false;\n }}\n >\n <div className=\"roaster-modal__header\">\n {title && (\n <h2 className=\"roaster-modal__title\" id={titleId}>\n {title}\n </h2>\n )}\n <ButtonIcon size=\"medium\" aria-label={text.close} onClick={() => setOpen(false)}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n {description && (\n <p className=\"roaster-modal__description\" id={descriptionId}>\n {description}\n </p>\n )}\n </div>\n <div className=\"roaster-modal__body\">{children}</div>\n {footer && <div className=\"roaster-modal__footer\">{footer}</div>}\n </dialog>\n );\n});\n\nModal.displayName = 'Modal';\n"],"names":[],"mappings":";;;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7C,MAAM,qBAAqB,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe;AACrG,SAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;AACnC,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC5C,EAAE,OAAO,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM;AACvH;AACY,MAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,K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AS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE;AACvG;AACA;AACA;AACA;AACA,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Button } from '../Button/Button.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { classNames } from '../../utils/classNames/index.js';
7
8
 
8
9
  const defaultPaginationLabels = {
@@ -20,10 +21,10 @@ const Pagination = React.forwardRef(function Pagination2({ onNextPage, onPreviou
20
21
  disabled: !hasPreviousPage,
21
22
  onClick: () => onPreviousPage?.(),
22
23
  "aria-label": text.previousPage,
23
- children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left" })
24
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-left" })
24
25
  }
25
26
  ),
26
- /* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasNextPage, onClick: () => onNextPage?.(), "aria-label": text.nextPage, children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right" }) })
27
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasNextPage, onClick: () => onNextPage?.(), "aria-label": text.nextPage, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-right" }) })
27
28
  ] });
28
29
  });
29
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button';\nimport { classNames } from '@/utils';\nimport { Icon } from '@/components/Icon';\n\n/** The text of the pagination, for other languages. */\nexport interface PaginationLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the previous page button, read by screen readers. */\n previousPage: string;\n /** The name of the next page button, read by screen readers. */\n nextPage: string;\n}\n\nconst defaultPaginationLabels: PaginationLabels = {\n navigation: 'Pagination',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n};\n\n/** Every native `<nav>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<'nav'> {\n /** Called when the next page button is clicked. */\n onNextPage?: () => void;\n /** Called when the previous page button is clicked. */\n onPreviousPage?: () => void;\n /** Whether there is a next page: the button is disabled otherwise. */\n hasNextPage?: boolean;\n /** Whether there is a previous page: the button is disabled otherwise. */\n hasPreviousPage?: boolean;\n /** The text of the pagination, in English by default. */\n labels?: Partial<PaginationLabels>;\n}\n\n/** Previous and next buttons to move through pages of results, in a named `nav`. */\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { onNextPage, onPreviousPage, hasNextPage, hasPreviousPage, className, labels, ...others },\n ref\n) {\n const text = { ...defaultPaginationLabels, ...labels };\n return (\n <nav aria-label={text.navigation} {...others} ref={ref} className={classNames('roaster-pagination', className)}>\n <Button\n variant=\"secondary\"\n disabled={!hasPreviousPage}\n onClick={() => onPreviousPage?.()}\n aria-label={text.previousPage}\n >\n <Icon name=\"chevron-left\" />\n </Button>\n <Button variant=\"secondary\" disabled={!hasNextPage} onClick={() => onNextPage?.()} aria-label={text.nextPage}>\n <Icon name=\"chevron-right\" />\n </Button>\n </nav>\n );\n});\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,uBAAuB,GAAG;AAChC,EAAE,UAAU,EAAE,YAAY;AAC1B,EAAE,YAAY,EAAE,eAAe;AAC/B,EAAE,QAAQ,EAAE;AACZ,CAAC;AACW,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE;AACjK,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,uBAAuB,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACxJ,oBAAoB,GAAG;AACvB,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,OAAO,EAAE,WAAW;AAC5B,QAAQ,QAAQ,EAAE,CAAC,eAAe;AAClC,QAAQ,OAAO,EAAE,MAAM,cAAc,IAAI;AACzC,QAAQ,YAAY,EAAE,IAAI,CAAC,YAAY;AACvC,QAAQ,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AACpE;AACA,KAAK;AACL,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE;AAC5M,GAAG,EAAE,CAAC;AACN,CAAC;;"}
1
+ {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button';\nimport { classNames } from '@/utils';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The text of the pagination, for other languages. */\nexport interface PaginationLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the previous page button, read by screen readers. */\n previousPage: string;\n /** The name of the next page button, read by screen readers. */\n nextPage: string;\n}\n\nconst defaultPaginationLabels: PaginationLabels = {\n navigation: 'Pagination',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n};\n\n/** Every native `<nav>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<'nav'> {\n /** Called when the next page button is clicked. */\n onNextPage?: () => void;\n /** Called when the previous page button is clicked. */\n onPreviousPage?: () => void;\n /** Whether there is a next page: the button is disabled otherwise. */\n hasNextPage?: boolean;\n /** Whether there is a previous page: the button is disabled otherwise. */\n hasPreviousPage?: boolean;\n /** The text of the pagination, in English by default. */\n labels?: Partial<PaginationLabels>;\n}\n\n/** Previous and next buttons to move through pages of results, in a named `nav`. */\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { onNextPage, onPreviousPage, hasNextPage, hasPreviousPage, className, labels, ...others },\n ref\n) {\n const text = { ...defaultPaginationLabels, ...labels };\n return (\n <nav aria-label={text.navigation} {...others} ref={ref} className={classNames('roaster-pagination', className)}>\n <Button\n variant=\"secondary\"\n disabled={!hasPreviousPage}\n onClick={() => onPreviousPage?.()}\n aria-label={text.previousPage}\n >\n <RoasterIcon name=\"chevron-left\" />\n </Button>\n <Button variant=\"secondary\" disabled={!hasNextPage} onClick={() => onNextPage?.()} aria-label={text.nextPage}>\n <RoasterIcon name=\"chevron-right\" />\n </Button>\n </nav>\n );\n});\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,uBAAuB,GAAG;AAChC,EAAE,UAAU,EAAE,YAAY;AAC1B,EAAE,YAAY,EAAE,eAAe;AAC/B,EAAE,QAAQ,EAAE;AACZ,CAAC;AACW,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE;AACjK,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,uBAAuB,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACxJ,oBAAoB,GAAG;AACvB,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,OAAO,EAAE,WAAW;AAC5B,QAAQ,QAAQ,EAAE,CAAC,eAAe;AAClC,QAAQ,OAAO,EAAE,MAAM,cAAc,IAAI;AACzC,QAAQ,YAAY,EAAE,IAAI,CAAC,YAAY;AACvC,QAAQ,QAAQ,kBAAkB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AAC3E;AACA,KAAK;AACL,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,kBAAkB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE;AACnN,GAAG,EAAE,CAAC;AACN,CAAC;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Button } from '../Button/Button.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { Section } from './components/Section.js';
7
8
  import { Menu } from './components/Menu.js';
8
9
  import { Back } from './components/Back.js';
@@ -106,7 +107,7 @@ const SidebarBase = React.forwardRef((props, ref) => {
106
107
  "aria-controls": sidebarId,
107
108
  "aria-expanded": drawerOpen,
108
109
  onClick: () => panelRef.current?.showPopover?.(),
109
- children: /* @__PURE__ */ jsx(Icon, { name: "bars" })
110
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "menu" })
110
111
  }
111
112
  ),
112
113
  mobileHeader
@@ -120,7 +121,7 @@ const SidebarBase = React.forwardRef((props, ref) => {
120
121
  className: "roaster-sidebar__close",
121
122
  "aria-label": text.close,
122
123
  onClick: () => panelRef.current?.hidePopover?.(),
123
- children: /* @__PURE__ */ jsx(Icon, { name: "xmark" })
124
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" })
124
125
  }
125
126
  ),
126
127
  /* @__PURE__ */ jsxs("nav", { className: "roaster-sidebar__nav", "aria-label": text.navigation, children: [