@trellixio/roaster-react 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +383 -0
- package/LICENSE.md +38 -2
- package/README.md +10 -10
- package/cjs/components/ActionList/components/ActionListDropdown.js +6 -5
- package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListItem.js +9 -7
- package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSearch.js +24 -6
- package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSubmenu.js +7 -5
- package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSwitchItem.js +6 -5
- package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
- package/cjs/components/Alert/Alert.js +3 -2
- package/cjs/components/Alert/Alert.js.map +1 -1
- package/cjs/components/AppFrame/AppFrame.js.map +1 -1
- package/cjs/components/Avatar/Avatar.js +1 -1
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/cjs/components/Button/Button.js +3 -2
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.js +4 -4
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/ColorField/ColorField.js +42 -29
- package/cjs/components/ColorField/ColorField.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.js +2 -2
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/components/Calendar/Calendar.js +4 -3
- package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +6 -5
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js +3 -2
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
- package/cjs/components/Field/Field.js +26 -6
- package/cjs/components/Field/Field.js.map +1 -1
- package/cjs/components/FileField/FileField.js +47 -33
- package/cjs/components/FileField/FileField.js.map +1 -1
- package/cjs/components/Icon/Icon.js.map +1 -1
- package/cjs/components/Icon/RoasterIcon.js +12 -0
- package/cjs/components/Icon/RoasterIcon.js.map +1 -0
- package/cjs/components/IconBadge/IconBadge.js.map +1 -1
- package/cjs/components/Modal/Modal.js +3 -2
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Pagination/Pagination.js +4 -3
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/RangeField/RangeField.js +34 -21
- package/cjs/components/RangeField/RangeField.js.map +1 -1
- package/cjs/components/Select/Select.js +8 -6
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Sidebar/Sidebar.js +4 -3
- package/cjs/components/Sidebar/Sidebar.js.map +1 -1
- package/cjs/components/Sidebar/components/Back.js +7 -3
- package/cjs/components/Sidebar/components/Back.js.map +1 -1
- package/cjs/components/StatCard/StatCard.js +3 -2
- package/cjs/components/StatCard/StatCard.js.map +1 -1
- package/cjs/components/Switch/Switch.js +7 -1
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/cjs/components/Table/components/TableHeadCell.js +4 -3
- package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
- package/cjs/components/Tag/Tag.js +3 -2
- package/cjs/components/Tag/Tag.js.map +1 -1
- package/cjs/components/TextField/TextField.js +3 -1
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/Textarea/Textarea.js +36 -4
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Thumbnail/Thumbnail.js +3 -2
- package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
- package/cjs/components/Toast/Toast.js +3 -2
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +6 -5
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/Tooltip/TooltipCallout.js +3 -2
- package/cjs/components/Tooltip/TooltipCallout.js.map +1 -1
- package/cjs/components/Visualizer/Visualizer.js +4 -3
- package/cjs/components/Visualizer/Visualizer.js.map +1 -1
- package/cjs/utils/Slot/index.js +5 -5
- package/cjs/utils/Slot/index.js.map +1 -1
- package/cjs/utils/useDropdown/DropdownTrigger.js +4 -4
- package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -1
- package/cjs/utils/useMergeRefs/index.js +51 -0
- package/cjs/utils/useMergeRefs/index.js.map +1 -0
- package/esm/components/ActionList/components/ActionListDropdown.js +2 -1
- package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/esm/components/ActionList/components/ActionListItem.js +5 -3
- package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSearch.js +21 -3
- package/esm/components/ActionList/components/ActionListSearch.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSubmenu.js +5 -3
- package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSwitchItem.js +2 -1
- package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
- package/esm/components/Alert/Alert.js +3 -2
- package/esm/components/Alert/Alert.js.map +1 -1
- package/esm/components/AppFrame/AppFrame.js.map +1 -1
- package/esm/components/Avatar/Avatar.js +1 -1
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/Button/Button.js +3 -2
- package/esm/components/Button/Button.js.map +1 -1
- package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/esm/components/Checkbox/Checkbox.js +1 -1
- package/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/esm/components/ColorField/ColorField.js +42 -29
- package/esm/components/ColorField/ColorField.js.map +1 -1
- package/esm/components/DatePicker/DatePicker.js +1 -1
- package/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/esm/components/DatePicker/components/Calendar/Calendar.js +4 -3
- package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js +2 -1
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardTabs.js +3 -2
- package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
- package/esm/components/Field/Field.js +26 -6
- package/esm/components/Field/Field.js.map +1 -1
- package/esm/components/FileField/FileField.js +47 -33
- package/esm/components/FileField/FileField.js.map +1 -1
- package/esm/components/Icon/Icon.js.map +1 -1
- package/esm/components/Icon/RoasterIcon.js +10 -0
- package/esm/components/Icon/RoasterIcon.js.map +1 -0
- package/esm/components/IconBadge/IconBadge.js.map +1 -1
- package/esm/components/Modal/Modal.js +3 -2
- package/esm/components/Modal/Modal.js.map +1 -1
- package/esm/components/Pagination/Pagination.js +4 -3
- package/esm/components/Pagination/Pagination.js.map +1 -1
- package/esm/components/RangeField/RangeField.js +34 -21
- package/esm/components/RangeField/RangeField.js.map +1 -1
- package/esm/components/Select/Select.js +4 -2
- package/esm/components/Select/Select.js.map +1 -1
- package/esm/components/Sidebar/Sidebar.js +4 -3
- package/esm/components/Sidebar/Sidebar.js.map +1 -1
- package/esm/components/Sidebar/components/Back.js +7 -3
- package/esm/components/Sidebar/components/Back.js.map +1 -1
- package/esm/components/StatCard/StatCard.js +3 -2
- package/esm/components/StatCard/StatCard.js.map +1 -1
- package/esm/components/Switch/Switch.js +7 -1
- package/esm/components/Switch/Switch.js.map +1 -1
- package/esm/components/Table/components/TableHeadCell.js +4 -3
- package/esm/components/Table/components/TableHeadCell.js.map +1 -1
- package/esm/components/Tag/Tag.js +3 -2
- package/esm/components/Tag/Tag.js.map +1 -1
- package/esm/components/TextField/TextField.js +3 -1
- package/esm/components/TextField/TextField.js.map +1 -1
- package/esm/components/Textarea/Textarea.js +38 -6
- package/esm/components/Textarea/Textarea.js.map +1 -1
- package/esm/components/Thumbnail/Thumbnail.js +3 -2
- package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
- package/esm/components/Toast/Toast.js +3 -2
- package/esm/components/Toast/Toast.js.map +1 -1
- package/esm/components/Tooltip/Tooltip.js +2 -1
- package/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/esm/components/Tooltip/TooltipCallout.js +3 -2
- package/esm/components/Tooltip/TooltipCallout.js.map +1 -1
- package/esm/components/Visualizer/Visualizer.js +4 -3
- package/esm/components/Visualizer/Visualizer.js.map +1 -1
- package/esm/package.json +4 -1
- package/esm/utils/Slot/index.js +1 -1
- package/esm/utils/Slot/index.js.map +1 -1
- package/esm/utils/useDropdown/DropdownTrigger.js +1 -1
- package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -1
- package/esm/utils/useMergeRefs/index.js +36 -0
- package/esm/utils/useMergeRefs/index.js.map +1 -0
- package/lib/components/ActionList/components/ActionListItem.d.ts +4 -1
- package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -1
- package/lib/components/AppFrame/AppFrame.d.ts +5 -1
- package/lib/components/AppFrame/AppFrame.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +4 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/ButtonIcon/ButtonIcon.d.ts +1 -1
- package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/ColorField/ColorField.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/utils/index.d.ts +2 -1
- package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
- package/lib/components/Field/Field.d.ts +13 -7
- package/lib/components/Field/Field.d.ts.map +1 -1
- package/lib/components/FileField/FileField.d.ts.map +1 -1
- package/lib/components/Icon/Icon.d.ts +13 -2
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/RoasterIcon.d.ts +13 -0
- package/lib/components/Icon/RoasterIcon.d.ts.map +1 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.d.ts.map +1 -1
- package/lib/components/IconBadge/IconBadge.d.ts +2 -2
- package/lib/components/RangeField/RangeField.d.ts.map +1 -1
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Sidebar/components/Back.d.ts.map +1 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/Textarea/Textarea.d.ts +6 -1
- package/lib/components/Textarea/Textarea.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/utils/Slot/index.d.ts.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -1
- package/lib/utils/useMergeRefs/index.d.ts +11 -0
- package/lib/utils/useMergeRefs/index.d.ts.map +1 -0
- package/package.json +2 -2
- package/roaster.css +2 -1
- package/themes/azoth.css +1 -1
- package/themes/coffee.css +1 -1
- package/themes/scalar.css +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# @trellixio/roaster-react
|
|
2
|
+
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 089e59d: `Icon` is deprecated. Pass your icon set's own element instead, in a component's `icon` prop or inside it, such as Font Awesome's `<i className="fa-regular fa-house" aria-hidden="true" />` for `<Icon name="house" />`: Roaster's components draw their own icons, and an app's icons come from the icon set it loads. `Icon` still works, with Font Awesome loaded, until a later version removes it.
|
|
8
|
+
- 6ea1147: Roaster draws its own icons without Font Awesome. A close button's cross, the chevrons and arrows, a chosen item's check, the table's sort arrows, the file field's icons and the rich text editor's toolbar are [Lucide](https://lucide.dev)'s icons, in `roaster.css`, and look slightly different. The React components, `theme.js` and `richText.js` draw them, with no icon font. In plain HTML, write them as `<i class="roaster-icon roaster-icon--x" aria-hidden="true"></i>` where Roaster's controls had `fa-regular fa-xmark` and the like: the Icons page lists the 28 of them, and "Upgrading to 2.2" which class replaces which.
|
|
9
|
+
|
|
10
|
+
CSS that styled Roaster's icons by their Font Awesome classes, such as `.roaster-alert__close .fa-xmark`, needs `.roaster-icon` instead.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 6965bf2: The changelog can be read outside the team: a Changelog page in the docs lists every release of the CSS and the React package, with the changes in the React components only marked **React**. The README and the CDN's landing page link to it, and the npm package includes `CHANGELOG.md`. The package's homepage on npm is the docs, https://cdn.trellix.io/roaster/, and the README published with each version links to that version's docs.
|
|
15
|
+
|
|
16
|
+
## 2.1.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 3c6b66f: `Avatar` shows `initials` as written, so a brand written in lower case, such as a "k", keeps it. Only the letter taken from `name`, when there are no `initials`, is in capitals. Initials passed in lower case were shown in capitals before: pass them in capitals to keep that.
|
|
21
|
+
- 9a5133e: An action list item's check mark is at its end when its label is only text, such as `<ActionList.Item checkMark checked>Bug</ActionList.Item>`: it came right after the text. In HTML, such a check takes `roaster-action-list__check--end` too, since selectors can't tell it from a check that comes first, in a list of choices without icons.
|
|
22
|
+
- a6d2892: A field can keep its help text when it shows an error: `keepDescription` on `TextField`, `Textarea`, `Select`, `Switch`, `ColorField`, `RangeField` and `FileField` shows the error under the help text instead of in its place, and the control is described by both. Use it for help that stays useful while the value is wrong, such as the format the value needs. Without it, the error still replaces the help text. In HTML, write both `<small>`s, the error last, and name both in `aria-describedby`.
|
|
23
|
+
- da45d7c: An avatar in the header menu keeps its size. Only a picture in a button with the name, such as the account's (`roaster-button` with a `roaster-avatar`, the name and a chevron), is the size of an icon there; any other was 13px wide, such as the account's picture alone. For that one, the top bar's round account button, `roaster-top-bar__account`, works in the header menu too, as its docs now say.
|
|
24
|
+
- 37dd1b7: Roaster's own icons load from a 2 KB font instead of Font Awesome's full one, 240 KB. `fontawesome.css` declares both as one family, each for its own icons: a page drawing only the icons Roaster's components, `theme.js` and stylesheets draw (the close buttons' cross, the chevrons and arrows, a chosen item's check, and so on) downloads only the small font, and the full one loads as before on a page that shows any other icon. Nothing changes in the markup.
|
|
25
|
+
- 8b663d1: Smaller bundles. Floating UI now comes only with the components that open something over the page: action lists, dropdown cards and tooltips. A button, a checkbox, a select or a date picker took one small helper from it, and Floating UI ships as one file, so an app with an action list anywhere, even a lazy-loaded one, had all of Floating UI in its first load.
|
|
26
|
+
|
|
27
|
+
webpack now leaves out the components an app doesn't use. The package declares that its JavaScript has no side effects, but webpack reads that from the nearest `package.json`, the ESM folder's own, which didn't repeat it: every component was in every webpack bundle.
|
|
28
|
+
|
|
29
|
+
- 245d161: A submenu's chevron is at its item's end whatever the label. With a plain-text label, such as `<ActionList.Submenu label="Appearance">`, it came right after the text. An item that opens a submenu (`aria-haspopup="menu"`, which the docs now ask for in HTML) ends with its chevron, whatever comes before it.
|
|
30
|
+
|
|
31
|
+
Any other icon at an item's end still needs the text before it in an element, `<span>Privacy</span><i …></i>`, as the docs now say: CSS can't tell bare text before an icon from text after it.
|
|
32
|
+
|
|
33
|
+
- 7d7fb42: A textarea can show a footer in its box, under the text at its end, such as a count of the characters, `912 / 1000`: `footer` on `Textarea`. The textarea is described by it, and an error goes under the box as usual, in place of the help text. In HTML, a `roaster-textarea-group` holds the textarea and a `roaster-textarea-group__footer`; it draws the box, in the textarea's states, and the textarea inside it only the text, which never runs under the footer.
|
|
34
|
+
- 23d429d: A menu's search row, `ActionList.Search`, keeps the focus when the menu opens, on a slow device too. The menu gives the focus to its first item a frame after it opens, and the search takes it back after that; when the menu's came later, the item kept it. Until a key or a click in the menu, the search now takes the focus back from an item, once.
|
|
35
|
+
|
|
36
|
+
## 2.1.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- 2f30846: Account menus in the action list. An account menu can start with who is signed in, `roaster-action-list__header`: their picture (`roaster-avatar`), `__title` and `__subtitle` (a name and an email), cut to the menu's width. An item's label can have a second line under it, `__description`, such as a submenu's current choice. In a list of choices without icons, the check (`__check`) can come before the label, where it keeps its room while hidden, so the labels line up.
|
|
41
|
+
|
|
42
|
+
A new token, `action-list.divider.margin-block`, sets the space above and below a line between groups. Azoth puts 8px on each side of it.
|
|
43
|
+
|
|
44
|
+
A menu's search row now hides the lines left between the groups it hid. Before, a filtered menu could show two lines under its search, or one at its end.
|
|
45
|
+
|
|
46
|
+
- 021e78d: Phones. A page built from Roaster's layout now fits a phone's width in every theme, without scrolling sideways:
|
|
47
|
+
|
|
48
|
+
- A stack laid out as a column (`--column`, `--fields`, and `--even` and `--spread` on phones) no longer wraps on a phone, which made it as wide as its children side by side. `roaster-stack--nowrap` keeps a row on one line there too, such as a title and its buttons in a bar.
|
|
49
|
+
- A row of `--even` children, one under the other on a phone, gives each the column's full width.
|
|
50
|
+
- The top bar shows its buttons' icons only on a phone, so its search, its actions and the account fit; a breadcrumb trail in it ends in an ellipsis.
|
|
51
|
+
- A chart or a table reaching the page's edges (`--bleed`) follows the page's padding on a phone.
|
|
52
|
+
- A fixed side column (`roaster-stack--aside-fixed`) goes under the main one on a phone, and a sticky one (`--sticky`) scrolls with the page there.
|
|
53
|
+
- Compact and headline stat cards wrap onto more rows on a phone.
|
|
54
|
+
- Scalar's main frame no longer cuts off what doesn't fit on a phone.
|
|
55
|
+
|
|
56
|
+
Fields (input, select, textarea, a menu's search, the rich-text and code editors) are at least 16px on a touch screen, so iOS Safari no longer zooms the page when one takes the focus.
|
|
57
|
+
|
|
58
|
+
Menus and dropdown cards stay inside the window on a phone, and an action list is never wider than the window. A menu opened by one of several buttons now opens beside that button: it could open beside another one that had opened it before. A dropdown card's tabs go in a row above its panel on a phone.
|
|
59
|
+
|
|
60
|
+
New, `--sheet`: on a phone, an action list, a dropdown card, a modal or a panel rises from the window's bottom, its full width, over the dimmed page; on a wider screen it opens as usual. In React, the `sheet` prop of `ActionList.Dropdown`, `DropdownCard.Dropdown` and `Modal`. Use it for large ones, such as filters, a date or a row's details; keep a small menu beside its button.
|
|
61
|
+
|
|
62
|
+
The toasts' container no longer takes the taps and clicks meant for the page between and around its toasts.
|
|
63
|
+
|
|
64
|
+
- f45a50e: Phones, continued: tables, settings lists, page headers and a few components.
|
|
65
|
+
|
|
66
|
+
- A table on a phone scrolls sideways in its box when its set widths add up to more than the window; a column without a set width, such as a title, takes what they leave, even when a row spans the hidden columns (a group's title). Hiding the selection column on a phone no longer shifts the cells after it into the columns before them (a title could end up in a 24px column).
|
|
67
|
+
- New: `data-priority="secondary"` on a column's `<col>` and its cells hides that column on a phone, such as an identifier or a date beside a title. In React, `priority="secondary"` on `Table.Cell` and `Table.HeadCell`, and `{ width, priority }` in `Table`'s `columns`.
|
|
68
|
+
- In a table on a phone, a spread row (`roaster-stack--spread`) stays a row, wrapping what doesn't fit: a group's title keeps its button at the end, and a long name puts its tags under it, ending in an ellipsis; those tags wrap too.
|
|
69
|
+
- Settings rows (`roaster-descriptive-list--settings`) put their title over their value on a phone; the value made a second, narrow column.
|
|
70
|
+
- A page header shows its title first on a phone, then its actions, which wrap.
|
|
71
|
+
- Elsewhere, `--spread` stacks its children from the start on a phone, each at most the column's width, so a long text ends in an ellipsis instead of overflowing on both sides.
|
|
72
|
+
- A table toolbar's rows wrap when they don't fit, such as on a tablet.
|
|
73
|
+
- A tooltip callout opens under its host on a phone, at most the window's width; a file field's hint wraps there; the visualizer's bar on a phone is the window's width; the visualizer beside the page is at most 45% of the window on a tablet.
|
|
74
|
+
|
|
75
|
+
- b19575d: Phones, touch: small controls take a finger, nothing needs a hover, and the drawer closes from a button.
|
|
76
|
+
|
|
77
|
+
- Small controls take a tap at least 24px square around them (WCAG 2.5.8), without changing their layout or their look: icon buttons (such as the close buttons of alerts and toasts), info buttons in stat cards, tables and settings lists, a callout's close button, plain buttons, and the menu button of the phone bar. A color swatch takes a tap on its whole box, and a range field anywhere 24px around its track (its track is now drawn in the browser's track part, the same to the pixel).
|
|
78
|
+
- New: the sidebar's close button (`roaster-sidebar__close`), first in the sidebar, beside the drawer on a phone and hidden on a wider screen. In React, the Sidebar renders it, named by `labels.close` ('Close the menu').
|
|
79
|
+
- Scalar: a table's row checkboxes show on a touch screen, which has no hover to reveal them.
|
|
80
|
+
- A menu that several buttons open is anchored to the one that opens it before it shows: it could show for a frame beside the button that opened it before.
|
|
81
|
+
|
|
82
|
+
## 2.1.0
|
|
83
|
+
|
|
84
|
+
### Minor Changes
|
|
85
|
+
|
|
86
|
+
- b8d04b1: One file per theme, and no default theme. `theme.css` is split into `roaster.css`, every element and component without a theme, and `themes/coffee.css`, `themes/azoth.css` and `themes/scalar.css`, each a theme's tokens and its own rules. A page loads `roaster.css`, then the theme it shows, and only downloads that theme: a coffee page loads 35 KB of CSS (gzip) instead of 60 KB.
|
|
87
|
+
|
|
88
|
+
**Breaking**, though no one uses 2.0 yet, which is why this is 2.1.0:
|
|
89
|
+
|
|
90
|
+
- `theme.css` is gone. Load `roaster.css`, then one theme's file: in HTML `<link rel="stylesheet" href=".../roaster.css" />` and `<link rel="stylesheet" href=".../themes/coffee.css" />`, in React `import '@trellixio/roaster-react/roaster.css'` and `import '@trellixio/roaster-react/themes/coffee.css'`. To switch themes, load each one's file.
|
|
91
|
+
- The theme class is required. Without one, a page no longer falls back to coffee: it gets no tokens. Put `roaster-theme-coffee` (or another theme's class) on `<html>`, next to `roaster`.
|
|
92
|
+
- The reduced-motion setting moved to a layer of its own, `roaster.preferences`, between `roaster.tokens` and `roaster.base`, so it wins over every theme wherever its file is loaded. CSS that declares Roaster's layer order itself should add it.
|
|
93
|
+
|
|
94
|
+
The icons and images the CSS draws are inlined once per file, and SVGs as text instead of base64, which compresses several times better: they now weigh 2 to 3 KB per file (gzip), down from 16 KB in `theme.css`.
|
|
95
|
+
|
|
96
|
+
`@trellixio/roaster-react` now ships JetBrains Mono, Scalar's code font, which 2.0 left out of the package: code in Scalar showed in a fallback font in React apps.
|
|
97
|
+
|
|
98
|
+
See [Upgrading to 2.1](https://cdn.trellix.io/roaster/storybook/2.1.0/index.html?path=/docs/upgrading-to-2-1--docs).
|
|
99
|
+
|
|
100
|
+
## 2.0.0
|
|
101
|
+
|
|
102
|
+
### Major Changes
|
|
103
|
+
|
|
104
|
+
- Roaster 2.0: every class and token is renamed (the `roaster-` prefix), components move to native HTML (`<dialog>`, `popover`, `<details>`), and the React components are accessible by default, with new prop names (`tone`, `variant`, `onValueChange`, `asChild`…). A page now names its look with the root and theme classes on `<html>` (`<html class="roaster roaster-theme-coffee">`). Follow the [Upgrading to 2.0](https://cdn.trellix.io/roaster/storybook/2.0.0/index.html?path=/docs/upgrading-to-2-0--docs) guide; from theme-coffee or roaster-coffee, start with [Upgrading to 1.x](https://cdn.trellix.io/roaster/storybook/2.0.0/index.html?path=/docs/upgrading-to-1-x--docs).
|
|
105
|
+
|
|
106
|
+
### Minor Changes
|
|
107
|
+
|
|
108
|
+
- b5e8cae: Add the Azoth theme: `roaster-theme-azoth`, with `roaster-dark` for its dark look or `roaster-auto`, which follows the system's light or dark setting (`<html class="roaster roaster-theme-azoth roaster-dark">`). Coffee stays the default and doesn't change. A theme is its tokens, and a stylesheet of its own for what it lays out or draws differently (`assets/css/themes/azoth.css`, part of the bundle). Button gets a `size` prop: `size="large"` (`roaster-button--large`), which the buttons of modal footers and `FormActions` take by themselves.
|
|
109
|
+
|
|
110
|
+
New in both packages, for pages like an activity log or a settings page (coffee's existing components don't change):
|
|
111
|
+
|
|
112
|
+
- `Timeline` (`roaster-timeline`): events in groups such as days, along a rail.
|
|
113
|
+
- Button `variant="chip"` (`roaster-button--chip`): a filter or a toggle; `aria-pressed` turns it on.
|
|
114
|
+
- DescriptiveList `variant="settings"` (`roaster-descriptive-list--settings`): settings rows. Items take a `description` and `actions`.
|
|
115
|
+
- Select `rich` (`roaster-select--rich`): the select draws its own list where the browser allows it (Chrome, Edge, Safari), with a check on the chosen option and the options' `description`. Firefox shows its own list.
|
|
116
|
+
- IconBadge `tone="neutral"` (`roaster-icon-badge--neutral`).
|
|
117
|
+
- Tag `variant="outline"` (`roaster-tag--outline`): an edge instead of a fill.
|
|
118
|
+
- Tag `variant="solid"` (`roaster-tag--solid`): the inverted color, such as for a plan name.
|
|
119
|
+
- `TopBar` (`roaster-top-bar`): the bar at the top of the main frame, with a search, actions and the account.
|
|
120
|
+
- Sidebar: labeled sections (`{ title, items }`, `roaster-sidebar__section` and `__label`), items without icons, a tag after an item's text, the account button at the top as a workspace switcher, and `Sidebar.Back` (`roaster-sidebar__back`) for the way out of a nested navigation.
|
|
121
|
+
- Alert `tone="primary"` (`roaster-alert--primary`), a prompt that asks for a decision, and an `icon` of the page's own (`roaster-alert__icon`).
|
|
122
|
+
- Descriptive list parts: an info button after a title (`__info`) and a quieter line under a value (`__detail`). A plain button in the actions, such as one that opens a dialog, looks like their links.
|
|
123
|
+
- `<strong>` takes the theme's strong weight (the same 700 in coffee).
|
|
124
|
+
- `ActionCard.Group` (`roaster-action-card-group`, `--framed` for an edge): action cards as the rows of one list, split by lines, such as an account's addresses with their actions.
|
|
125
|
+
- Modal `description` (`roaster-modal__description`), a line under the title, and `size="medium"` (`roaster-modal--medium`). A modal without a header keeps the header's room above its body; a title or body given `tabindex="-1" autofocus` takes the focus when the dialog opens, without a ring.
|
|
126
|
+
- Switch `labelPosition="end"` (`roaster-switch__label`): the label beside the toggle, in a choice's colors.
|
|
127
|
+
- Button `size="small"` (`roaster-button--small`) and, for plain buttons, `tone="neutral"` (`roaster-button--neutral`): a quiet action, such as one under a form.
|
|
128
|
+
- FileField `hint` (`roaster-file__hint`): a line under the upload label. The file input now covers the whole upload area, so a click or a dropped file anywhere on it chooses the file (it covered 90px of the button).
|
|
129
|
+
- Page `size="small"` (`roaster-main--small`): a 560px column, such as for a one-step flow.
|
|
130
|
+
- Stack: `roaster-stack--gap-0`, `--gap-1`, `--gap-3` and `--gap-6` (none, 4, 12 and 24px), and `roaster-stack--fields`, a column of a form's fields the theme's room apart.
|
|
131
|
+
- A select can start merged inputs, such as a phone number's country code, and a rich select centers an image in its field, such as a flag.
|
|
132
|
+
|
|
133
|
+
For tables like a transaction list:
|
|
134
|
+
|
|
135
|
+
- Tables: column widths from `<colgroup><col style="width: …" />` (kept exactly, the table scrolls sideways when they add up to more); sortable column titles (`roaster-table__sort`, the arrow on the `aria-sort` column); cents in a `<sup>` in currency cells; an icon before an enum cell's text; `roaster-table--bleed`, which reaches the edges of a full-width `main`; `roaster-table__summary`, a band of totals over the rows; a count (`<p>`) before the pagination.
|
|
136
|
+
- `roaster-stat-card-group--compact`: figures in a row without frames, such as totals.
|
|
137
|
+
- Avatar tints (`roaster-avatar--tint-1` to `--tint-7`) and a corner badge (`roaster-avatar__badge`).
|
|
138
|
+
- Tooltip `--callout`: stays open beside its host, with a title, a close button and a link, pointing at the host.
|
|
139
|
+
- A button's caret (`roaster-button__caret`), such as a chip's chevron; chips draw their icons in boxes of their own width in Azoth.
|
|
140
|
+
- Sidebar: a count at an item's end (`roaster-sidebar__end` with text), a line under an item (`roaster-sidebar__detail`), a button in a section's label.
|
|
141
|
+
- `roaster-separator--vertical`, an input group's button suffix (such as a clear button), outline tags in a tone, and `roaster-text-success`.
|
|
142
|
+
|
|
143
|
+
For menus like a transaction list's toolbar (CSS and `theme.js`):
|
|
144
|
+
|
|
145
|
+
- Action list: `--start` (under its button, left edges aligned), submenus (an item with `popovertarget` naming a `roaster-action-list--submenu`, which opens beside it and stays open with its menu), a detail at an item's end (`roaster-action-list__detail`), an on/off item (a switch whose input is the `menuitemcheckbox`, which leaves the menu open), and `menuitemradio` items. Choosing an item in a submenu closes its menus.
|
|
146
|
+
- Dropdown card: `--start`, `--compact` (a row of fields in a menu's frame), and `--tabs`, a list of tabs beside the content (`roaster-dropdown-card__tabs`, `__tab`, a `__content` per tab as its panel), which `theme.js` switches, with the arrow keys, Home and End.
|
|
147
|
+
- Choice groups: `--list` (the legend ruled off, `roaster-choice-group__action` beside it; `data-roaster-select-all` checks or unchecks every box), `--nested` (the choices under a checkbox, kept in step with it, mixed when some are checked), and a choice's `__description` and `__detail`.
|
|
148
|
+
- Date picker: a grid of months (`roaster-date-picker__grid--months`, `__year`), which chooses a range of months in two clicks and writes its first and last days in the inputs it names; range cells (`__cell--in-range`, `--range-start`, `--range-end`).
|
|
149
|
+
- `roaster-stack--end`: a row aligned on its bottom edges, such as fields with and without a label.
|
|
150
|
+
- Tokens: `--roaster-border-width-floating` (menus and popups; 0 in Azoth), the dropdown card's offset, content width and padding, and its tabs' sizes. Azoth places an icon prefix (such as a search field's magnifier) and its text as its search fields do; table cells keep their own.
|
|
151
|
+
|
|
152
|
+
The React components take these parts:
|
|
153
|
+
|
|
154
|
+
- Table: `columns` (the widths), `bleed`, `toolbar`, `summary`, a pagination `count`; a column's `sort` (`aria-sort` and its arrow) and `Table.SortButton`, its title as a button, such as a sort menu's trigger.
|
|
155
|
+
- `StatCard.Group` (`variant="compact"`), Avatar `initials`, `tint` and `badge`, Button `caret`, `Tooltip.Callout`.
|
|
156
|
+
- Sidebar: an item's `suffix` (a count or a tag) and `detail`, a section's `action`.
|
|
157
|
+
- ActionList: `ActionList.SwitchItem` (an on/off setting), `ActionList.Submenu` (an item with choices of its own, with a `detail`), and an item's `detail` and `checked` (`menuitemradio`). `placement="bottom-start"` is the CSS's `--start`.
|
|
158
|
+
- DropdownCard: `variant="compact"` and `variant="tabs"` on `DropdownCard.Dropdown`, with `DropdownCard.Tabs`, `TabList`, `Tab` and `Panel`.
|
|
159
|
+
- Checkbox and Radio `description` and `detail`; a Checkbox's children are the checkboxes under it, in a `Checkbox.Group`, which takes `variant="list"` and `selectAll` (its text in `labels`).
|
|
160
|
+
- `DatePicker.MonthGrid`: a range of whole months in two clicks (`value`, `onValueChange`, `minDate`, `maxDate`, `locale`).
|
|
161
|
+
- ActionList and DropdownCard open as far from their trigger as the theme says (`--roaster-action-list-offset`, `--roaster-dropdown-card-offset`), instead of 8px.
|
|
162
|
+
|
|
163
|
+
A row's details, beside the list:
|
|
164
|
+
|
|
165
|
+
- Modal `--panel` (`roaster-modal--panel`): a panel docked at the window's end, a popover rather than a modal dialog, so the page stays usable, such as a transaction's details. Its body can be split into sections (`roaster-modal__section`), the first starting with a figure (`roaster-modal__figure`, cents in a `<sup>`). Its title is quieter than a dialog's in Azoth, its lines and paddings its own.
|
|
166
|
+
- Table: a browsable row's opener (`roaster-table__open`), its link or a button that opens its details; `theme.js` passes it a click anywhere else on the row, and marks the row while its panel is open (`aria-expanded` on the opener).
|
|
167
|
+
- Timeline `--steps`: a short path, such as a payment's from and to, the current step (`aria-current="step"`) in the primary color.
|
|
168
|
+
- `<kbd>` is drawn as a key; a one-row textarea (`rows="1"`) keeps one line, such as a comment box.
|
|
169
|
+
- Cards: `--raised` on a block, action, stat, chart or preview card gives it a clickable card's shadow, for a card the page sets apart (`--roaster-card-raised-shadow`; Azoth's other cards have none, its clickable cards keep theirs). React: `raised` on BlockCard, ActionCard and StatCard.
|
|
170
|
+
|
|
171
|
+
For a dashboard and a report, such as a home page and an insights page:
|
|
172
|
+
|
|
173
|
+
- Chart (`roaster-chart`), new: the look of a chart the app draws as inline SVG. Series as lines (`__line`, `--bold`), areas (`__area`), bars (`__bar`, their top `__edge`) and points (`__point`), in the chart's color or a `__series--neutral`, `--negative` or `--secondary` one; fills that fade through a `__fill` gradient of `__stop`s; a dotted `__grid`, the `__baseline` at zero, axis `__label`s (`--strong`, `--muted`); a time axis's `__tick`s, its selected `__range` with `__handle`s and a `__range-label`, and a `__marker` such as today; a `__header` over the plot and a `__legend` of `__key`s. `--large` fills part of a page; `--bleed` reaches the window's edges in a full-width `main`; `__plot--inline` keeps its own size. Tokens: `--roaster-chart-*`.
|
|
174
|
+
- Choice group `--segmented` (`--large`): a radio group drawn as one segmented control, such as a chart's mode.
|
|
175
|
+
- Block card: a quiet `__label` for a card that leads with a `__figure` (`--large`, cents in a `<sup>`), `__section` (ruled off from the next part), `__stats` (figures side by side, a `<dl>`), `__list` of `__item` links with an avatar, a name and their `__end`, and `__footer` (a band across the card's end). A chart that ends the card reaches its edges; the header centers its title beside its actions.
|
|
176
|
+
- Progress `--start` (a bar that starts along the track, such as a share after the ones before it), `--small` and `__value`.
|
|
177
|
+
- Stat card group `--headline`: a report's head figures, the lead one larger. Action card group `--plain`: notes such as a report's findings, without lines.
|
|
178
|
+
- Avatar `--small` (28px) and `--neutral`; tag `--inline` (a pill in a sentence); separator `--flush`; button `--flush` (its label in line with the text before it); page header `--section`; table `--compact`.
|
|
179
|
+
- Utilities: `roaster-stack--even` (children share the row), `--aside` (a third and two thirds), `--gap-10`, and `roaster-text-danger`.
|
|
180
|
+
- Azoth: a table that doesn't reach the window's edges starts flush with its first cell, and in a card it ends flush too.
|
|
181
|
+
- Demo pages: Dashboard and Insights.
|
|
182
|
+
|
|
183
|
+
The React components take these parts:
|
|
184
|
+
|
|
185
|
+
- `Chart`, new: `Chart.Header`, `Chart.Plot` (`inline`), and one component per SVG element, each with its class and a `series`: `Chart.Series`, `Fill` (`direction`), `Line` (`bold`), `Area`, `Bar` (`edge`, `edgeWidth`), `Point`, `Grid`, `Baseline`, `Label` (`variant` strong or muted), `Tick`, `Marker`, `Range`, `Handle`, `RangeLabel`, `Legend` and `LegendItem` (`swatch`). `size="large"` and `bleed` on the chart. It draws nothing by itself: the app gives each part its coordinates, by hand or with a library such as d3-shape.
|
|
186
|
+
- BlockCard `label`, `figure` and `figureSize`, and `BlockCard.Section`, `Stats` (`ruled`) of `Stat` (`term`, `icon`), `List` of `Item` (`avatar`, `end`), and `Footer`.
|
|
187
|
+
- `Radio.Group variant="segmented"` (`size="large"`); a segment that is an icon takes an `aria-label`.
|
|
188
|
+
- Progress `start`, `size="small"` and `figure`; `StatCard.Group variant="headline"`; `ActionCard.Group variant="plain"`; Avatar `size="small"`, `tint="neutral"` and `icon`; Tag `variant="inline"`; Button `flush`; Table `compact`; Page `titleAction` and `Page.Section` (`title`, `actions`).
|
|
189
|
+
- Showcases: the dashboard and insights pages. The transactions page's showcase had its column titles in a row of their own inside the header row (a `Table.Row` in `Table.Head`, which makes its own row): fixed, and its callout now sits over its column.
|
|
190
|
+
|
|
191
|
+
Dark and color fixes, and card titles:
|
|
192
|
+
|
|
193
|
+
- Azoth's card titles take its card title size (19/28), apart from section titles. Tokens: `--roaster-block-card-title-size`, `-weight`, `-line-height`.
|
|
194
|
+
- The breadcrumbs' arrow, a linked card's and the settings navigation's chevrons, a link cell's arrow, the points icon and the footer's store icon are drawn as masks in the icon colors, so they follow the theme and its dark version (coffee looks the same).
|
|
195
|
+
- The code editor (`assets/scripts/codeEditor.js`) takes the theme's colors, its syntax colors among them, so it reads in a dark version; coffee's editor now uses coffee's colors instead of CodeMirror's. The rich text editor's links take the link color.
|
|
196
|
+
- A browsable table's row is lined above and below while it has the focus (from the keyboard or a click), as a focus ring, instead of while its details are open; the open row keeps its fill. `--roaster-table-row-line-current` is `--roaster-table-row-line-focus`.
|
|
197
|
+
- Charts: in Azoth dark, fills are stronger (from 28% to 8%), and a selected span's label keeps the primary fill.
|
|
198
|
+
|
|
199
|
+
Motion and the last details of Azoth's look:
|
|
200
|
+
|
|
201
|
+
- Table `--sticky` (`roaster-table--sticky`; React: `sticky`): the column titles stay in view while the rows scroll under them, in a box no taller than the window. The transactions page uses it.
|
|
202
|
+
- Table `--floating-actions` (`roaster-table--floating-actions`; React: `floatingActions`): the bulk-action bar floats low in the window, in the middle of the content beside the sidebar, and rises into place, while the column titles stay. Any theme draws it from its tokens (`--roaster-table-bulk-actions-floating-bottom`, `-floating-padding`, `-duration`, `-easing`). The transactions page uses it.
|
|
203
|
+
- A panel modal slides in from the window's end, fading in (`--roaster-modal-panel-duration`, `-easing`, `-slide-distance`; coffee doesn't animate).
|
|
204
|
+
- `theme.js` marks the button of an open menu or dropdown card `aria-expanded`; Azoth turns its caret over.
|
|
205
|
+
- Azoth: a breadcrumb link is underlined on hover, a closed sidebar group shows a chevron in place of its icon on hover, and groups slide open and closed where the browser can animate a `<details>` (`--roaster-sidebar-group-duration`, `-easing`).
|
|
206
|
+
- Bare headings take their text style from tokens (`--roaster-heading-h1-*` to `-h4-*`: font family, size, weight, line height, tracking). Coffee's keep their styles, and its bare `h1` now has one too: title-xl (24px, where the browser drew 28px). Azoth's are a step down: `h1` the page title size, `h2` to `h4` one step smaller (`h4` is body text at the strong weight). Inline `code` is 0.8em in Azoth (`--roaster-code-size`); the code editor keeps the text's size.
|
|
207
|
+
- Every new duration is 0s when the user asks for reduced motion.
|
|
208
|
+
|
|
209
|
+
Azoth's type, compared with the typeface its sizes were measured in:
|
|
210
|
+
|
|
211
|
+
- Azoth's text is `'Inter Azoth'`, Inter Variable drawn at 96.84% (`size-adjust`), so its capitals are as tall as that typeface's and its lines as long; the sizes keep their numbers, and icons beside the text keep their size.
|
|
212
|
+
- Weights that read as dark: 420 for text and titles (`--roaster-font-weight-regular`, `--roaster-text-title-xl-weight`, `--roaster-text-title-lg-weight`) and 510 for strong and medium text. The page title is tracked −0.35px, as Inter's display cut is wider.
|
|
213
|
+
- The body's weight goes on `<body>` with its size, and on form controls (`--roaster-text-body-weight`, 400 in coffee, which looks the same), so text without a style of its own takes the theme's weight.
|
|
214
|
+
|
|
215
|
+
The demo pages' theme select and main colors tester are now a widget fixed at the bottom left of every demo page, beside the sidebar, which opens and minimizes (`src/theme-switcher.js`); `assets/scripts/misc/colorTest.js` is gone.
|
|
216
|
+
|
|
217
|
+
- 771f759: Add the Scalar theme: `roaster-theme-scalar`, with `roaster-dark` for its dark look or `roaster-auto`, which follows the system's light or dark setting (`<html class="roaster roaster-theme-scalar roaster-dark">`). Neutral grays and indigo, Inter with JetBrains Mono for code, dense 13px controls (28px buttons, 32px fields), and the main frame as a panel inset beside the sidebar (`assets/css/themes/scalar.css`, part of the bundle). Coffee and Azoth don't change.
|
|
218
|
+
|
|
219
|
+
Two opt-in variants, in any theme:
|
|
220
|
+
|
|
221
|
+
- `roaster-table--inset-rows` (`<Table insetRows>`): a row's fill (hovered, pressed, open or checked) inset from the table's sides with rounded ends, as in a list (`table.row.inset`, `table.row.radius`); checked rows next to each other join into one block, and the row with the focus is ringed.
|
|
222
|
+
- `roaster-chart--grid-lines` (`<Chart grid="lines">`): the grid as dashed lines, one for each axis label, instead of dots (`chart.grid-line-width`, `chart.grid-dash`, `chart.grid-dash-gap`).
|
|
223
|
+
|
|
224
|
+
New parts and variants, in any theme (a new demo page, `src/pages/scalar/project.html`, shows them together):
|
|
225
|
+
|
|
226
|
+
- `roaster-table__group`: rows in groups, each a `<tbody>` headed by a `<th class="roaster-table__group-title" colspan="…" scope="rowgroup">` band, such as the tasks of one status (`table.group.*`). A row's opener shortens beside tags in its cell, which stay on one line.
|
|
227
|
+
- `roaster-main--tight`: a full-width page with little room around it, such as a list and its tools; a bleeding table in it reaches its edges (`main.tight.padding`).
|
|
228
|
+
- `roaster-block-card--compact`: a small card, such as in a side column, with a quiet title and an unframed descriptive list (`block-card.compact.*`).
|
|
229
|
+
- `roaster-top-bar__title`: the page's name in the top bar, on a page without a title of its own (`top-bar.title.*`).
|
|
230
|
+
- `roaster-stack--aside-end` (two thirds, then a third), `roaster-text-warning` and `roaster-text-info`, and icon colors apart from the text's: `roaster-icon-muted`, `roaster-icon-warning`, `roaster-icon-primary`.
|
|
231
|
+
- `roaster-tag__dot`: a colored dot before a tag's text, in the current color (`tag.dot-size`).
|
|
232
|
+
- `roaster-action-list__search`: a search row on top of a long menu (`action-list.search.height`). theme.js focuses it when the menu opens, hides the items that don't match as you type, and the down arrow goes on to the items.
|
|
233
|
+
- `data-roaster-toggle`: a disclosure button. With `aria-controls`, it shows or hides the element it names, such as a details panel, and keeps `aria-expanded` in step; an aside row whose side is hidden gives the row to the other. A chip that toggles looks pressed while open.
|
|
234
|
+
- `Roaster.toast(message, { tone })`: shows a toast from a page's own code, and removes it after a few seconds (`toast.icon-color`: the tone's icon on a toast that isn't inverted).
|
|
235
|
+
- In a menu, a `menuitemradio` is checked when chosen and its set's others not, and a `menuitemcheckbox` button switches. `roaster-action-list__check` shows a check at a chosen item's end, and `roaster-action-list__label` labels a group.
|
|
236
|
+
- `roaster-stack--sticky`: the side column of an aside row stays in view as the page scrolls, and scrolls on its own.
|
|
237
|
+
- A compact dropdown card lets its field open more, such as a date picker's calendar. A small icon-only button is square.
|
|
238
|
+
- `roaster-field--inline`: the label at the start of a row, the control at its end at its own width, such as a setting in a menu.
|
|
239
|
+
- The `hidden` attribute now hides any element in the theme, whatever its display.
|
|
240
|
+
- A chip that is a link takes its pressed look with `aria-current="page"`, for pill tabs.
|
|
241
|
+
|
|
242
|
+
New tokens, which coffee and Azoth set to what they already drew, for a theme of your own:
|
|
243
|
+
|
|
244
|
+
- `code.weight`: inline code's weight.
|
|
245
|
+
- `button.label.size`, `button.large.label.size`, and `button.secondary.shadow`, `-shadow-hover` and `-border-color-hover`.
|
|
246
|
+
- `choice.box.radius`, `-border-width` and `-border-color-hover`: a checkbox's corners and edge.
|
|
247
|
+
- `input.border-color-hover`: the edge of a hovered input, textarea or select.
|
|
248
|
+
- `select.background`, `-background-hover`, `-border-color`, `-border-color-hover`, `-shadow` and `-shadow-hover`, to draw the select as a button.
|
|
249
|
+
- `sidebar.padding-inline`, `sidebar.item.weight`, `sidebar.label.weight` and `-color`, `sidebar.profile.shadow` and `-weight`.
|
|
250
|
+
- `action-list.item.padding-block` and `-background-hover`.
|
|
251
|
+
- `table.row.background-hover`, `top-bar.padding-inline-end`, `button.ghost.icon-color` and `-hover`, `block-card.compact.row-padding-top` and `-bottom`; `avatar.tint-color` and `avatar.small.size`; `button.chip.shadow` and `chip.pressed.shadow`; `sidebar.label.padding-inline-start` and `-padding-block`, `sidebar.end.font-size`, `sidebar.subitem.gap`; `table.open.weight` and `-color`.
|
|
252
|
+
- `block-card.label.size`, `-weight`, `-line-height` and `-color`: the name of a card that leads with a figure.
|
|
253
|
+
- `chart.label-size` and `chart.label-size-large`: the axes' labels.
|
|
254
|
+
- `table.row.line-color`: the line between two rows (the line under the column titles stays).
|
|
255
|
+
- `timeline.meta-color`: a group's date and an event's time.
|
|
256
|
+
- `tooltip.padding-block` and `tooltip.radius`.
|
|
257
|
+
- `main.readable-width`: `roaster-readable`, a column of text at a reading width, centered.
|
|
258
|
+
- `timeline.feed.event-height`, `gap`, `icon-width` and `card-background`, `card-border-color`, `card-shadow`, `card-gap`, `card-outset`: `roaster-timeline--feed`, events without groups or rail, cards among them.
|
|
259
|
+
- `stack.aside-width`: `roaster-stack--aside-fixed`, the side column of `--aside-end` at a set width.
|
|
260
|
+
- `button.row.label-size`, `padding-inline-start`, `padding-inline-end`: `roaster-button--row`, a value in a column of rows, cut short with an ellipsis.
|
|
261
|
+
- `block-card.plain.padding-top`, `gap`, `title-inset`: `roaster-block-card--plain`.
|
|
262
|
+
- `tag.inline.background`, `text-color`, `border-color`, `radius`, `padding-block`, `padding-inline`: the look of `roaster-tag--inline`, which now wraps with its sentence.
|
|
263
|
+
- `tag.small.height` and `padding-inline`: `roaster-tag--small`.
|
|
264
|
+
- `timeline.feed.card-footer-padding-block`: the footer of a card among the events, such as a reply's field.
|
|
265
|
+
- `toast.close.size` and `toast.close.background-hover`: the close button's box, its icon centered in it. `toast.close.line-height` is gone: the box centers the icon.
|
|
266
|
+
|
|
267
|
+
A reveal button (`data-roaster-toggle="reveal"`) shows the elements it names and goes, such as "Show 5 events"; `aria-controls` of a toggle may name several. A field in a card's footer takes the room (`roaster-block-card__footer > .roaster-input`), `roaster-input--plain` also fits a text area, and an avatar no longer shrinks in a row.
|
|
268
|
+
|
|
269
|
+
Also new: `roaster-text-label` (label text, emphasized), `roaster-text-large` (body-lg text, its paragraphs, headings and lists spaced), `roaster-breadcrumbs--trail` (where the page is, a chevron between items), `roaster-block-card--plain` (no frame) and `roaster-input--plain` (no edge or fill). A tag's dot shows inside inline text.
|
|
270
|
+
|
|
271
|
+
A link drawn as a button (`<a class="roaster-button">`) now takes the body size, as a `<button>` does, instead of the text's around it. In a date picker's month grid, a chosen or hovered month now takes the chosen or hover text color, as days do.
|
|
272
|
+
|
|
273
|
+
Scalar has a purple dark variant: `<html class="roaster roaster-theme-scalar roaster-purple">`, its dark scheme on a purple-tinted base with a violet accent. A theme with a dark version can have such dark color variants, `tokens/themes/<name>-<variant>.json` beside `<name>-dark.json`, which set only the colors they change, on `roaster-<variant>`.
|
|
274
|
+
|
|
275
|
+
Tables: `roaster-table--roomy` gives rows more room above and below, such as rows of two lines (`table.roomy.padding-block`); a ghost button in a cell takes the table's room and text (`table.button.padding-inline`, `label-size`, `label-weight`); the line under the column titles is `table.header.line-color` (Scalar's is none). New utilities: `roaster-text-subtle` (tertiary text), `roaster-text-truncate`, `roaster-icon-info`, `roaster-icon-success`, `roaster-icon-danger`.
|
|
276
|
+
|
|
277
|
+
Grouped tables in coffee: a group's title row is a 40px cream band across the table (`table.group.height`, `table.group.background`), rows' fills reach the table's sides (`table.row.inset` 0; Azoth and Scalar keep 8px). An inset-rows table centers its rows' contents, and a cell holding only an icon shows it whole.
|
|
278
|
+
|
|
279
|
+
React, for the same parts:
|
|
280
|
+
|
|
281
|
+
- `ActionList.Search`: a search row at the top of a long menu (it takes the focus, the down arrow goes on to the items; filter the items from its value), with a `shortcut` hint. `ActionList.Group` takes a `label`. `ActionList.Item` takes `multiple` (`menuitemcheckbox`, with `checked`) and `checkMark` (a check at its end while chosen).
|
|
282
|
+
- `BlockCard`: `compact` and `plain`, which combine.
|
|
283
|
+
- `Button`: `row`, a value in a column of rows, cut short with an ellipsis.
|
|
284
|
+
- `Table`: `roomy`, and `Table.Group`, rows in a `<tbody>` under a title row across the table (`title`, `colSpan`).
|
|
285
|
+
- `Timeline`: `variant="feed"`, and `Timeline.Card` for a card among its events.
|
|
286
|
+
- `Tag`: `size="small"`, and `Tag.Dot`, a colored dot before the text.
|
|
287
|
+
- `TextField` and `Textarea`: `variant="plain"`; `TextField` and `Select`: `inline`.
|
|
288
|
+
- `Page`: `tight`; `TopBar`: `title`; `Breadcrumbs`: a trail of where the page is, the page itself last.
|
|
289
|
+
|
|
290
|
+
Also: `roaster-branch`, a row that hangs from the one above it (indented, a line from under the parent's icon curving into it, `branch.*` tokens), such as a project's milestone. Scalar centers an action card's icon, text and actions on one line, as Azoth does.
|
|
291
|
+
|
|
292
|
+
The demo pages and stories use a neutral demo brand, Northwind (`assets/images/northwind-logo.svg`); `assets/images/beans-logo.svg` is gone. The package's root `index.html` redirects to the demo pages' index, `src/index.html`.
|
|
293
|
+
|
|
294
|
+
## 1.1.1
|
|
295
|
+
|
|
296
|
+
### Patch Changes
|
|
297
|
+
|
|
298
|
+
- Validate automated npm publishing with GitHub Actions.
|
|
299
|
+
|
|
300
|
+
## 1.1.0
|
|
301
|
+
|
|
302
|
+
### Minor Changes
|
|
303
|
+
|
|
304
|
+
- e163884: Bug fixes, some of which change behavior (see below), and a new `ToastOptions` type.
|
|
305
|
+
|
|
306
|
+
React:
|
|
307
|
+
|
|
308
|
+
- Toasts leave the screen when they time out or are closed. They used to stay forever.
|
|
309
|
+
- `<Toast closable={false}>` hides the close button. `closable` defaults to `true`.
|
|
310
|
+
- The table's select-all checkbox can be clicked, and rows show as selected when every item is selected.
|
|
311
|
+
- A modal's `onClose` runs once, also in StrictMode.
|
|
312
|
+
- `DatePicker` shows dates in its `dateFormat`, reads typed `DD-MM-YYYY` dates, reads typed dates as local dates (they
|
|
313
|
+
landed a day early west of UTC), and follows a controlled `value`.
|
|
314
|
+
- `DescriptiveList.Item` shows `0` instead of a dash.
|
|
315
|
+
- `Select` keeps the `style` it is given.
|
|
316
|
+
- A `className` or `style` on `ActionList.Dropdown` or `DropdownCard.Dropdown` adds to the dropdown's own instead of
|
|
317
|
+
replacing it, and `DropdownCard.Dropdown`'s `width` no longer appears as a DOM attribute.
|
|
318
|
+
- `FileField` releases the memory of its image previews.
|
|
319
|
+
- `TextField` accepts text as its `rightSection`.
|
|
320
|
+
- `useModal()` and `ToastsContext` report the current state instead of the first one.
|
|
321
|
+
- The published types no longer import paths that can't be resolved, which made some of them `any`.
|
|
322
|
+
- New `ToastOptions` type for what `showToast()` takes.
|
|
323
|
+
- `react-transition-group` is no longer a dependency.
|
|
324
|
+
|
|
325
|
+
CSS:
|
|
326
|
+
|
|
327
|
+
- Tooltips have a valid text color.
|
|
328
|
+
- `Actions.open()` and `Actions.close()` work with the bundled `theme.js`.
|
|
329
|
+
|
|
330
|
+
## 1.0.0
|
|
331
|
+
|
|
332
|
+
### Major Changes
|
|
333
|
+
|
|
334
|
+
First release under the new name. It replaces `@trellixio/roaster-coffee` 0.3.1, which gets no more updates.
|
|
335
|
+
|
|
336
|
+
#### Package
|
|
337
|
+
|
|
338
|
+
- The package is now `@trellixio/roaster-react`. Replace `@trellixio/roaster-coffee` in your `package.json` and
|
|
339
|
+
imports.
|
|
340
|
+
- The stylesheet is `@trellixio/roaster-react/theme.css` (was `@trellixio/roaster-coffee/theme-coffee.css`).
|
|
341
|
+
- The package has an `exports` map: import from `@trellixio/roaster-react` and `@trellixio/roaster-react/theme.css`
|
|
342
|
+
only. Deep imports into `cjs/`, `esm/` or `lib/` no longer resolve.
|
|
343
|
+
- `react` is a peer dependency only (it was also a regular dependency, which could install a second copy of React).
|
|
344
|
+
- The components are marked `'use client'`, so they work in Next.js App Router server components.
|
|
345
|
+
- Supports React 18.2+ and 19.
|
|
346
|
+
|
|
347
|
+
#### Behavior changes
|
|
348
|
+
|
|
349
|
+
- `Alert` only shows its close button when `closable` is set. It used to always show.
|
|
350
|
+
- `RangeField` calls `onChange` with a number (it was a string), keeps the value between `min` and `max`, and can be
|
|
351
|
+
controlled with `value`.
|
|
352
|
+
- `Switch` can be controlled with `checked`. `defaultChecked` still works.
|
|
353
|
+
- `Radio` works on its own with `checked` and `onChange(value)`, not only inside a `Radio.Group`.
|
|
354
|
+
- `TextField` calls `onChange(value, event)`: the event is a new second argument.
|
|
355
|
+
- `Tooltip` opens on hover and closes when the pointer leaves or on Escape. Before, it only showed when `opened` was
|
|
356
|
+
set.
|
|
357
|
+
- `DatePicker` calls `onMonthChange` (it was ignored and leaked to the `<input>`). Its `selected`, `isOpen` and
|
|
358
|
+
`onClose` props are removed: they were internal; use `value` for the selected date.
|
|
359
|
+
- `Tag` accepts `color="grey"` and `color="info"`. `color="default"` now renders grey; it used to render unstyled.
|
|
360
|
+
- `Sidebar` `Menu.Item` adds your `className` to `menu-item` instead of replacing it.
|
|
361
|
+
- `BlockCard` shows its header when only `actions` is passed.
|
|
362
|
+
- `CodeBlock` formats code asynchronously and shows the raw code if it cannot be formatted.
|
|
363
|
+
- Generated ids (labels, inputs) are set on the first render and match between server and client.
|
|
364
|
+
|
|
365
|
+
#### Types
|
|
366
|
+
|
|
367
|
+
- `Icon` props and ref are typed as the `<span>` it renders (`HTMLSpanElement`, was `HTMLDivElement`).
|
|
368
|
+
- `SelectionType`, `SELECT_ALL_ITEMS`, `TableSelectedItems` and `HandleSelectionChange` are exported, and there is a
|
|
369
|
+
single `SelectionType` (the `Table` callback and `useSelectableResourceState` used two incompatible ones).
|
|
370
|
+
- `SelectItem` is a type alias instead of an empty interface.
|
|
371
|
+
- `Table`'s `nextPageButtonProps` and `previousPageButtonProps` are optional, and they and `Pagination`'s button props
|
|
372
|
+
accept partial `Button` props.
|
|
373
|
+
|
|
374
|
+
#### New
|
|
375
|
+
|
|
376
|
+
- `Button`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`, `RangeField`, `ColorField` and `FileField` accept and
|
|
377
|
+
forward the native element props (`id`, `name`, `aria-*`, `data-*`, ...).
|
|
378
|
+
- `Textarea` and `Select` can be controlled with `value`.
|
|
379
|
+
- Every component example in Storybook shows the HTML it renders, for people using only the CSS. Storybook also
|
|
380
|
+
publishes `llms.txt` and one small markdown file per component and docs page, for AI agents:
|
|
381
|
+
`https://cdn.trellix.io/roaster/storybook/<version>/llms.txt`.
|
|
382
|
+
- The usage documentation is part of Storybook (pages "Getting started", "Use in React", "Use in plain HTML", and more), so it
|
|
383
|
+
is public and versioned with every release. `https://cdn.trellix.io/roaster/` always opens the latest release.
|
package/LICENSE.md
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
Copyright (c) Trellix. All rights reserved.
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
3
|
+
The icons Roaster draws, in `packages/roaster-css/assets/css/icons/lucide/` and inlined in `roaster.css`, and the demo
|
|
4
|
+
pages' icons, in `packages/roaster-css/src/demo-icons.css`, are Lucide's (https://lucide.dev), at a line width of 1.75
|
|
5
|
+
instead of 2, under the ISC License below. Some of them derive from Feather (https://feathericons.com), under the MIT
|
|
6
|
+
License below.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
ISC License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
13
|
+
|
|
14
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,
|
|
15
|
+
provided that the above copyright notice and this permission notice appear in all copies.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
20
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
21
|
+
THIS SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The MIT License (MIT)
|
|
26
|
+
|
|
27
|
+
Copyright (c) 2013-present Cole Bemis
|
|
28
|
+
|
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
30
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
31
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
32
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
35
|
+
Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
38
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
39
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
40
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,10 +4,11 @@ Accessible React components on the Roaster design system. They render the same m
|
|
|
4
4
|
so one class on `<html>` restyles the whole app: change the theme, or follow the system's light or dark mode, without
|
|
5
5
|
touching a component.
|
|
6
6
|
|
|
7
|
-
- **Storybook** (every component, its props, live demos): https://cdn.trellix.io/roaster/storybook/2.
|
|
8
|
-
- **Documentation** (setup, plain HTML, CDN files, migration, versions): https://cdn.trellix.io/roaster/storybook/2.
|
|
7
|
+
- **Storybook** (every component, its props, live demos): https://cdn.trellix.io/roaster/storybook/2.2.0/index.html
|
|
8
|
+
- **Documentation** (setup, plain HTML, CDN files, migration, versions): https://cdn.trellix.io/roaster/storybook/2.2.0/index.html?path=/docs/use-in-react--docs
|
|
9
|
+
- **Changelog** (what changed in each release): https://cdn.trellix.io/roaster/storybook/2.2.0/index.html?path=/docs/changelog--docs
|
|
9
10
|
- **Latest release:** https://cdn.trellix.io/roaster/
|
|
10
|
-
- **For AI agents:** https://cdn.trellix.io/roaster/storybook/2.
|
|
11
|
+
- **For AI agents:** https://cdn.trellix.io/roaster/storybook/2.2.0/llms.txt (small markdown files, one per component)
|
|
11
12
|
- **Source code, bugs and questions:** https://github.com/trellixio/roaster
|
|
12
13
|
|
|
13
14
|
## Quick start
|
|
@@ -27,11 +28,10 @@ import '@trellixio/roaster-react/roaster.css';
|
|
|
27
28
|
import '@trellixio/roaster-react/themes/coffee.css';
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
**3.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```
|
|
31
|
+
**3. Your app's icons.** The components draw their own icons (close buttons, chevrons, arrows), with no icon font.
|
|
32
|
+
Your app's own icons come from the icon set it loads, such as Font Awesome (a Font Awesome Kit, or the
|
|
33
|
+
`@fortawesome/fontawesome-free` package): pass its element, such as
|
|
34
|
+
`<i className="fa-regular fa-house" aria-hidden="true" />`.
|
|
35
35
|
|
|
36
36
|
You do not need `theme.js` from the CDN: the components handle their own behavior.
|
|
37
37
|
|
|
@@ -72,7 +72,7 @@ export function Example() {
|
|
|
72
72
|
|
|
73
73
|
2.0 renames props for consistency (`tone`, `onValueChange`, `open`/`onOpenChange`, `labels`), forwards every native
|
|
74
74
|
prop, and renders native elements (`<dialog>`, `popover`, `<details>`). The
|
|
75
|
-
[Upgrading to 2.0](https://cdn.trellix.io/roaster/storybook/2.
|
|
75
|
+
[Upgrading to 2.0](https://cdn.trellix.io/roaster/storybook/2.2.0/index.html?path=/docs/upgrading-to-2-0--docs) page
|
|
76
76
|
lists every change, component by component.
|
|
77
77
|
|
|
78
78
|
## Coming from @trellixio/roaster-coffee
|
|
@@ -86,7 +86,7 @@ This package replaces `@trellixio/roaster-coffee`, which stays at 0.3.1 and gets
|
|
|
86
86
|
4. Import only from `@trellixio/roaster-react` and its stylesheets: deep imports no longer resolve.
|
|
87
87
|
5. Check the behavior changes in `Alert`, `RangeField`, `Switch`, `Radio`, `TextField`, `Tooltip`, `DatePicker`,
|
|
88
88
|
`Tag`, `BlockCard` and `CodeBlock`, listed in the
|
|
89
|
-
[changelog](https://
|
|
89
|
+
[changelog](https://cdn.trellix.io/roaster/storybook/2.2.0/index.html?path=/docs/changelog--docs).
|
|
90
90
|
|
|
91
91
|
## Development
|
|
92
92
|
|
|
@@ -6,8 +6,9 @@ var react = require('@floating-ui/react');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactDom = require('react-dom');
|
|
8
8
|
var ActionList_context = require('../ActionList.context.js');
|
|
9
|
-
var index = require('../../../utils/
|
|
10
|
-
var index$1 = require('../../../utils/
|
|
9
|
+
var index = require('../../../utils/useMergeRefs/index.js');
|
|
10
|
+
var index$1 = require('../../../utils/useMediaQuery/index.js');
|
|
11
|
+
var index$2 = require('../../../utils/classNames/index.js');
|
|
11
12
|
|
|
12
13
|
function _interopNamespaceDefault(e) {
|
|
13
14
|
var n = Object.create(null);
|
|
@@ -25,8 +26,8 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
25
26
|
const ActionListDropdown = React__namespace.forwardRef(
|
|
26
27
|
({ className, style, children, sheet = false, ...props }, propRef) => {
|
|
27
28
|
const { context: floatingContext, ...context } = ActionList_context.useActionListContext();
|
|
28
|
-
const ref =
|
|
29
|
-
const asSheet = index.useMediaQuery(index.PHONE_QUERY) && sheet;
|
|
29
|
+
const ref = index.useMergeRefs([context.refs.setFloating, propRef]);
|
|
30
|
+
const asSheet = index$1.useMediaQuery(index$1.PHONE_QUERY) && sheet;
|
|
30
31
|
const [returnFocus, setReturnFocus] = React__namespace.useState(true);
|
|
31
32
|
React__namespace.useEffect(() => {
|
|
32
33
|
if (context.open) setReturnFocus(true);
|
|
@@ -49,7 +50,7 @@ const ActionListDropdown = React__namespace.forwardRef(
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}),
|
|
52
|
-
className: index$
|
|
53
|
+
className: index$2.classNames(
|
|
53
54
|
"roaster-action-list",
|
|
54
55
|
"roaster-action-list--floating",
|
|
55
56
|
sheet && "roaster-action-list--sheet",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListDropdown.js","sources":["../../../../../src/components/ActionList/components/ActionListDropdown.tsx"],"sourcesContent":["import { FloatingFocusManager, FloatingList
|
|
1
|
+
{"version":3,"file":"ActionListDropdown.js","sources":["../../../../../src/components/ActionList/components/ActionListDropdown.tsx"],"sourcesContent":["import { FloatingFocusManager, FloatingList } from '@floating-ui/react';\nimport * as React from 'react';\nimport { flushSync } from 'react-dom';\nimport { PHONE_QUERY, classNames, useMediaQuery, useMergeRefs } from '@/utils';\nimport { useActionListContext } from '../ActionList.context';\n\n/** Every native `<div>` prop (`aria-label`, `className`, `style`...) is accepted and forwarded to the menu. */\nexport interface ActionListDropdownProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * On a phone (480px wide at most), the menu rises from the window's bottom as a sheet, its full width, over the\n * dimmed page; on a wider screen it opens under its trigger as usual. Guidance: keep a menu beside its trigger; a\n * sheet suits a long one, such as a list of filters with a search.\n * @defaultValue false\n */\n sheet?: boolean;\n}\n\n/** The menu: its groups, dividers and items. Rendered while the action list is open. */\nexport const ActionListDropdown = React.forwardRef<HTMLDivElement, ActionListDropdownProps>(\n ({ className, style, children, sheet = false, ...props }, propRef) => {\n const { context: floatingContext, ...context } = useActionListContext();\n const ref = useMergeRefs([context.refs.setFloating, propRef]);\n // A sheet on a phone is placed by the CSS, at the window's bottom, not beside its trigger.\n const asSheet = useMediaQuery(PHONE_QUERY) && sheet;\n // Closing gives the focus back to the trigger, except when tabbing away: then it moves on from the trigger.\n const [returnFocus, setReturnFocus] = React.useState(true);\n React.useEffect(() => {\n if (context.open) setReturnFocus(true);\n }, [context.open]);\n if (!context.open) return null;\n\n return (\n // The list navigation moves the focus to the first item.\n <FloatingFocusManager context={floatingContext} modal={false} initialFocus={-1} returnFocus={returnFocus}>\n <div\n ref={ref}\n {...context.getFloatingProps({\n ...props,\n onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n props.onKeyDown?.(event);\n // Tabbing away closes the menu, and Tab moves on from the trigger, as if the menu weren't there.\n if (event.key === 'Tab') {\n flushSync(() => setReturnFocus(false));\n (context.refs.domReference.current as HTMLElement | null)?.focus();\n context.setOpen(false);\n }\n },\n })}\n // After the spread, so a caller's className and style add to these instead of replacing them.\n className={classNames(\n 'roaster-action-list',\n 'roaster-action-list--floating',\n sheet && 'roaster-action-list--sheet',\n className\n )}\n style={asSheet ? style : { ...context.floatingStyles, ...style }}\n >\n <FloatingList elementsRef={context.elementsRef} labelsRef={context.labelsRef}>\n {children}\n </FloatingList>\n </div>\n </FloatingFocusManager>\n );\n }\n);\n\nActionListDropdown.displayName = 'ActionListDropdown';\n"],"names":["React","useActionListContext","useMergeRefs","useMediaQuery","PHONE_QUERY","jsx","FloatingFocusManager","flushSync","classNames","FloatingList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,kBAAkB,GAAGA,gBAAK,CAAC,UAAU;AAClD,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,OAAO,KAAK;AACxE,IAAI,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,GAAGC,uCAAoB,EAAE;AAC3E,IAAI,MAAM,GAAG,GAAGC,kBAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACjE,IAAI,MAAM,OAAO,GAAGC,qBAAa,CAACC,mBAAW,CAAC,IAAI,KAAK;AACvD,IAAI,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGJ,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9D,IAAIA,gBAAK,CAAC,SAAS,CAAC,MAAM;AAC1B,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;AAC5C,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACtB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI;AAClC,IAAI;AACJ;AACA,sBAAsBK,cAAG,CAACC,0BAAoB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,kBAAkBD,cAAG;AACtJ,QAAQ,KAAK;AACb,QAAQ;AACR,UAAU,GAAG;AACb,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACtC,YAAY,GAAG,KAAK;AACpB,YAAY,SAAS,CAAC,KAAK,EAAE;AAC7B,cAAc,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;AACtC,cAAc,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE;AACvC,gBAAgBE,kBAAS,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;AACtD,gBAAgB,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE;AAC1D,gBAAgB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;AACtC,cAAc;AACd,YAAY;AACZ,WAAW,CAAC;AACZ,UAAU,SAAS,EAAEC,kBAAU;AAC/B,YAAY,qBAAqB;AACjC,YAAY,+BAA+B;AAC3C,YAAY,KAAK,IAAI,4BAA4B;AACjD,YAAY;AACZ,WAAW;AACX,UAAU,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,EAAE;AAC1E,UAAU,QAAQ,kBAAkBH,cAAG,CAACI,kBAAY,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE;AAClI;AACA,OAAO,EAAE;AACT;AACA,EAAE;AACF;AACA,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;"}
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var react = require('@floating-ui/react');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
|
|
7
|
+
require('../../Icon/Icon.js');
|
|
8
|
+
var RoasterIcon = require('../../Icon/RoasterIcon.js');
|
|
8
9
|
var ActionList_context = require('../ActionList.context.js');
|
|
9
|
-
var index = require('../../../utils/
|
|
10
|
-
var index$1 = require('../../../utils/
|
|
10
|
+
var index = require('../../../utils/useMergeRefs/index.js');
|
|
11
|
+
var index$1 = require('../../../utils/Slot/index.js');
|
|
12
|
+
var index$2 = require('../../../utils/classNames/index.js');
|
|
11
13
|
|
|
12
14
|
function _interopNamespaceDefault(e) {
|
|
13
15
|
var n = Object.create(null);
|
|
@@ -38,8 +40,8 @@ const ActionListItem = React__namespace.forwardRef(
|
|
|
38
40
|
}, propRef) => {
|
|
39
41
|
const context = ActionList_context.useActionListContext();
|
|
40
42
|
const item = react.useListItem();
|
|
41
|
-
const ref =
|
|
42
|
-
const Component = asChild ? index.Slot : "button";
|
|
43
|
+
const ref = index.useMergeRefs([item.ref, propRef]);
|
|
44
|
+
const Component = asChild ? index$1.Slot : "button";
|
|
43
45
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
46
|
Component,
|
|
45
47
|
{
|
|
@@ -55,14 +57,14 @@ const ActionListItem = React__namespace.forwardRef(
|
|
|
55
57
|
}),
|
|
56
58
|
ref,
|
|
57
59
|
tabIndex: context.activeIndex === item.index ? 0 : -1,
|
|
58
|
-
className: index$
|
|
60
|
+
className: index$2.classNames(
|
|
59
61
|
"roaster-action-list__item",
|
|
60
62
|
{ "roaster-action-list__item--danger": tone === "danger" },
|
|
61
63
|
className
|
|
62
64
|
),
|
|
63
65
|
children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
64
66
|
children,
|
|
65
|
-
checkMark && /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
checkMark && /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "check", className: "roaster-action-list__check roaster-action-list__check--end" }),
|
|
66
68
|
detail != null && detail !== false && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "roaster-action-list__detail", children: detail })
|
|
67
69
|
] })
|
|
68
70
|
}
|