@blakesteve/roster 5.8.0 → 5.10.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 (44) hide show
  1. package/README.md +126 -23
  2. package/dist/components/atoms/Button/button-variants.js +1 -1
  3. package/dist/components/atoms/Eyebrow/eyebrow-variants.d.ts +2 -2
  4. package/dist/components/atoms/Input/input-variants.js +1 -1
  5. package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -1
  6. package/dist/components/atoms/Skeleton/Skeleton.d.ts +19 -3
  7. package/dist/components/atoms/Skeleton/Skeleton.js +38 -33
  8. package/dist/components/atoms/ThemeToggle/ThemeToggle.d.ts +1 -1
  9. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/molecules/CheckboxGroup/checkbox-group-variants.d.ts +1 -1
  11. package/dist/components/molecules/Menu/Menu.cjs +1 -0
  12. package/dist/components/molecules/Menu/Menu.d.ts +169 -0
  13. package/dist/components/molecules/Menu/Menu.js +577 -0
  14. package/dist/components/molecules/Menu/menu-typeahead.cjs +1 -0
  15. package/dist/components/molecules/Menu/menu-typeahead.d.ts +7 -0
  16. package/dist/components/molecules/Menu/menu-typeahead.js +13 -0
  17. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
  18. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +13 -4
  19. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +35 -35
  20. package/dist/components/molecules/Toast/Toaster.d.ts +1 -1
  21. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  22. package/dist/components/organisms/Navbar/Navbar.d.ts +1 -1
  23. package/dist/components/organisms/Navbar/Navbar.js +275 -302
  24. package/dist/index.d.ts +1 -0
  25. package/dist/lib/utils.cjs +1 -1
  26. package/dist/lib/utils.js +4 -1
  27. package/dist/meta.json +3 -3
  28. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +7 -7
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
  30. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +5 -5
  31. package/dist/node_modules/@headlessui/react/dist/components/portal/portal.js +6 -6
  32. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.cjs +1 -1
  33. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js +52 -61
  34. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +6 -6
  35. package/dist/roster.cjs +1 -1
  36. package/dist/roster.css +1 -1
  37. package/dist/roster.js +127 -116
  38. package/package.json +2 -1
  39. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.cjs +0 -1
  40. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.js +0 -21
  41. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.cjs +0 -1
  42. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.js +0 -120
  43. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.cjs +0 -1
  44. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.js +0 -197
@@ -0,0 +1,169 @@
1
+ import { ButtonProps } from '../../atoms/Button/Button';
2
+ import * as React from "react";
3
+ /**
4
+ * The props every link item is rendered with. `href` and `to` carry the same
5
+ * value, so `next/link`, React Router's `Link` and a plain `<a>` all work
6
+ * without a wrapper. The rest must reach the DOM: the role, the tab index and
7
+ * the handlers are what make the link an item of the menu.
8
+ */
9
+ export interface MenuLinkProps {
10
+ href: string;
11
+ to: string;
12
+ className: string;
13
+ children: React.ReactNode;
14
+ role: "menuitem";
15
+ tabIndex: -1;
16
+ "aria-disabled"?: true;
17
+ "aria-keyshortcuts"?: string;
18
+ "aria-describedby"?: string;
19
+ "data-menu-item": "";
20
+ onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;
21
+ onKeyDown: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
22
+ onPointerMove: (event: React.PointerEvent<HTMLAnchorElement>) => void;
23
+ }
24
+ export interface MenuProps {
25
+ /** The trigger (`MenuButton`) and the panel (`MenuItems`). */
26
+ children: React.ReactNode;
27
+ /**
28
+ * Controlled open state. Leave both off to let the menu keep its own. Pass
29
+ * `onOpenChange` with `open`: every way the menu closes itself (Escape,
30
+ * Tab, a press outside, a choice) is a call to it.
31
+ */
32
+ open?: boolean;
33
+ onOpenChange?: (open: boolean) => void;
34
+ /**
35
+ * Renders every link item (a `MenuItem` with an `href`). Defaults to a plain
36
+ * `<a>`, which inside a router turns each choice into a full page load: pass
37
+ * `next/link` or your router's link, from a client component.
38
+ */
39
+ linkComponent?: React.ComponentType<MenuLinkProps>;
40
+ }
41
+ /**
42
+ * A button that opens a panel of actions: the menu button pattern. Compose it:
43
+ *
44
+ * ```tsx
45
+ * <Menu>
46
+ * <MenuButton>Actions</MenuButton>
47
+ * <MenuItems>
48
+ * <MenuItem icon={<EditIcon />} shortcut="⌘E" onSelect={edit}>Edit</MenuItem>
49
+ * <MenuSeparator />
50
+ * <MenuItem destructive onSelect={remove}>Delete</MenuItem>
51
+ * </MenuItems>
52
+ * </Menu>
53
+ * ```
54
+ *
55
+ * The keyboard follows the pattern: Enter, Space or Down open it on the first
56
+ * item and Up on the last; arrows move, Home and End jump, a typed letter
57
+ * jumps to the next item starting with it; Escape closes it and puts focus
58
+ * back on the button; Tab closes it and moves on. A submenu opens with the
59
+ * arrow away from the parent and closes with the arrow back.
60
+ */
61
+ declare function Menu({ children, open: openProp, onOpenChange, linkComponent }: MenuProps): import("react/jsx-runtime").JSX.Element;
62
+ export interface MenuButtonProps extends ButtonProps {
63
+ /**
64
+ * A plain `<button>` with only your `className`, for a trigger drawn its own
65
+ * way: an avatar, an icon. Keep its target at least 44 by 44, with
66
+ * padding or a hit area, if you draw it smaller.
67
+ */
68
+ plain?: boolean;
69
+ }
70
+ declare const MenuButton: React.ForwardRefExoticComponent<MenuButtonProps & React.RefAttributes<HTMLButtonElement>>;
71
+ export interface MenuItemsProps {
72
+ children: React.ReactNode;
73
+ /** Which edge of the button the panel lines up with. */
74
+ align?: "start" | "end";
75
+ /** The gap between the button and the panel, in px. */
76
+ offset?: number;
77
+ /** Names the menu when the button's own name shouldn't. By default the button names it. */
78
+ "aria-label"?: string;
79
+ /** Applied to the panel. Its surface reads `--roster-popover-*`; set those to repaint it. */
80
+ className?: string;
81
+ }
82
+ declare function MenuItems({ children, align, offset, className, ...aria }: MenuItemsProps): import("react/jsx-runtime").JSX.Element | null;
83
+ interface ItemContent {
84
+ /** A leading icon. Decorative: the item's words name it. */
85
+ icon?: React.ReactNode;
86
+ /** A second, quieter line under the label: what the item does, or to what. Read as the item's description. */
87
+ description?: React.ReactNode;
88
+ /** A count or a status at the end of the row, read with the item's name. */
89
+ badge?: React.ReactNode;
90
+ /** A keyboard shortcut to show, right-aligned: display only. The app handles the keys. */
91
+ shortcut?: string;
92
+ /** The same shortcut in `aria-keyshortcuts` form ("Control+E"), for assistive technology. */
93
+ keyshortcuts?: string;
94
+ /** Reads as a consequence: red. The words still have to say what it does. */
95
+ destructive?: boolean;
96
+ /** Can be reached by the arrows but not chosen. */
97
+ disabled?: boolean;
98
+ /** What typeahead matches, when the item's text isn't the right thing to match. */
99
+ textValue?: string;
100
+ className?: string;
101
+ children: React.ReactNode;
102
+ }
103
+ export interface MenuItemProps extends ItemContent {
104
+ /** Called when the item is chosen: a click, Enter or Space. */
105
+ onSelect?: (event: React.SyntheticEvent) => void;
106
+ /** Makes it a link item. It navigates through the menu's `linkComponent`. */
107
+ href?: string;
108
+ /** Close the menu once chosen. On by default. */
109
+ closeOnSelect?: boolean;
110
+ }
111
+ /** One action. With `href`, a link. */
112
+ declare function MenuItem({ onSelect, href, closeOnSelect, disabled, destructive, keyshortcuts, textValue, className, ...content }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
113
+ export interface MenuCheckboxItemProps extends ItemContent {
114
+ checked: boolean;
115
+ onCheckedChange: (checked: boolean) => void;
116
+ /**
117
+ * Replaces the leading check mark with an indicator of your own at the end
118
+ * of the row: a switch's track, say. Its state still reaches assistive
119
+ * technology through `aria-checked`.
120
+ */
121
+ indicator?: React.ReactNode;
122
+ /** Close the menu once chosen by click or Enter. Space always keeps it open. */
123
+ closeOnSelect?: boolean;
124
+ }
125
+ /** An on/off choice: `menuitemcheckbox`. */
126
+ declare function MenuCheckboxItem({ checked, onCheckedChange, indicator, closeOnSelect, disabled, destructive, keyshortcuts, textValue, className, ...content }: MenuCheckboxItemProps): import("react/jsx-runtime").JSX.Element;
127
+ export interface MenuRadioGroupProps {
128
+ value: string | undefined;
129
+ onValueChange: (value: string) => void;
130
+ /** The choice's name, shown above its items and read with them. */
131
+ label?: React.ReactNode;
132
+ children: React.ReactNode;
133
+ className?: string;
134
+ }
135
+ /** One choice among several: its items are `menuitemradio`. */
136
+ declare function MenuRadioGroup({ value, onValueChange, label, children, className }: MenuRadioGroupProps): import("react/jsx-runtime").JSX.Element;
137
+ export interface MenuRadioItemProps extends ItemContent {
138
+ value: string;
139
+ /** Close the menu once chosen by click or Enter. Space always keeps it open. */
140
+ closeOnSelect?: boolean;
141
+ }
142
+ declare function MenuRadioItem({ value, closeOnSelect, disabled, destructive, keyshortcuts, textValue, className, ...content }: MenuRadioItemProps): import("react/jsx-runtime").JSX.Element;
143
+ export interface MenuGroupProps {
144
+ /** Shown above the group's items, and names the group. */
145
+ label?: React.ReactNode;
146
+ children: React.ReactNode;
147
+ className?: string;
148
+ }
149
+ /** Items that belong together, under an optional label. */
150
+ declare function MenuGroup({ label, children, className }: MenuGroupProps): import("react/jsx-runtime").JSX.Element;
151
+ /** A rule between groups of items. */
152
+ declare function MenuSeparator({ className }: {
153
+ className?: string;
154
+ }): import("react/jsx-runtime").JSX.Element;
155
+ export interface MenuSubmenuProps extends Omit<ItemContent, "shortcut" | "keyshortcuts" | "children" | "destructive" | "description" | "badge"> {
156
+ /** The item that opens it. */
157
+ label: React.ReactNode;
158
+ /** Its items. */
159
+ children: React.ReactNode;
160
+ /** Applied to the submenu's panel. */
161
+ panelClassName?: string;
162
+ }
163
+ /**
164
+ * An item that opens a menu of its own beside it. It opens with the arrow away
165
+ * from its parent, Enter, Space, a click, or the pointer resting on it; the
166
+ * arrow back, or Escape, closes it and returns to its item.
167
+ */
168
+ declare function MenuSubmenu({ label, children, icon, disabled, textValue, className, panelClassName }: MenuSubmenuProps): import("react/jsx-runtime").JSX.Element;
169
+ export { Menu, MenuButton, MenuItems, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuGroup, MenuSeparator, MenuSubmenu, };