@ahrowe/ui 0.47.3 → 0.49.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 +25 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/cjs-types/common/actionIcon/actionIcon.types.d.ts +1 -1
- package/dist/cjs-types/common/button/button.types.d.ts +6 -1
- package/dist/cjs-types/common/hooks/useHotkeys.d.ts +11 -0
- package/dist/cjs-types/common/menu/menu.types.d.ts +5 -0
- package/dist/cjs-types/common/menu/menuHotkeys.d.ts +2 -2
- package/dist/cjs-types/common/menu/menuItem.d.ts +10 -0
- package/dist/esm/common/button/button.mjs +1 -1
- package/dist/esm/common/button/button.mjs.map +1 -1
- package/dist/esm/common/button/button.module.mjs +1 -1
- package/dist/esm/common/button/button.module.mjs.map +1 -1
- package/dist/esm/common/button/button.types.mjs.map +1 -1
- package/dist/esm/common/commandPalette/commandPalette.mjs +1 -1
- package/dist/esm/common/commandPalette/commandPalette.mjs.map +1 -1
- package/dist/esm/common/hooks/useHotkeys.mjs +1 -1
- package/dist/esm/common/hooks/useHotkeys.mjs.map +1 -1
- package/dist/esm/common/menu/menu.mjs +1 -1
- package/dist/esm/common/menu/menu.mjs.map +1 -1
- package/dist/esm/common/menu/menu.module.mjs.map +1 -1
- package/dist/esm/common/menu/menu.types.mjs.map +1 -1
- package/dist/esm/common/menu/menuHotkeys.mjs +1 -1
- package/dist/esm/common/menu/menuHotkeys.mjs.map +1 -1
- package/dist/esm/common/menu/menuItem.mjs +2 -0
- package/dist/esm/common/menu/menuItem.mjs.map +1 -0
- package/dist/esm/common/radioGroup/radioGroup.module.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/common/actionIcon/actionIcon.types.d.ts +1 -1
- package/dist/types/common/button/button.types.d.ts +6 -1
- package/dist/types/common/hooks/useHotkeys.d.ts +11 -0
- package/dist/types/common/menu/menu.types.d.ts +5 -0
- package/dist/types/common/menu/menuHotkeys.d.ts +2 -2
- package/dist/types/common/menu/menuItem.d.ts +10 -0
- package/docs/ActionIcon.md +2 -2
- package/docs/Button.md +18 -2
- package/docs/CommandPalette.md +1 -1
- package/docs/Hooks.md +23 -4
- package/docs/InteractableDiv.md +1 -1
- package/docs/Menu.md +7 -6
- package/docs/ProgressBar.md +1 -1
- package/docs/RadioGroup.md +1 -1
- package/docs/ThemeProvider.md +1 -1
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ export type ActionIconSlots = 'root' | 'icon';
|
|
|
6
6
|
* A Button with only an icon, sized by that icon, so every Button prop applies except the ones
|
|
7
7
|
* that describe a label or a size.
|
|
8
8
|
*/
|
|
9
|
-
export interface ActionIconProps extends Omit<ButtonProps, 'icon' | 'size' | 'children' | 'isLoading' | 'classNames' | 'styles'> {
|
|
9
|
+
export interface ActionIconProps extends Omit<ButtonProps, 'icon' | 'size' | 'children' | 'isLoading' | 'shortcut' | 'classNames' | 'styles'> {
|
|
10
10
|
icon: IconContent;
|
|
11
11
|
classNames?: SlotClassNames<ActionIconSlots>;
|
|
12
12
|
styles?: SlotStyles<ActionIconSlots>;
|
|
@@ -26,7 +26,7 @@ export declare enum ButtonType {
|
|
|
26
26
|
Reset = "reset",
|
|
27
27
|
Submit = "submit"
|
|
28
28
|
}
|
|
29
|
-
export type ButtonSlots = 'background' | 'content' | 'loadingContainer' | 'label';
|
|
29
|
+
export type ButtonSlots = 'background' | 'content' | 'loadingContainer' | 'label' | 'shortcut';
|
|
30
30
|
/**
|
|
31
31
|
* `DataProps` supplies the `data-*` index signature, which `ButtonHTMLAttributes` doesn't cover.
|
|
32
32
|
* `type`, `color` and `onClick` below deliberately narrow their inherited counterparts.
|
|
@@ -43,6 +43,11 @@ export interface ButtonProps extends DataProps, React.ButtonHTMLAttributes<HTMLB
|
|
|
43
43
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void> | void;
|
|
44
44
|
children?: React.ReactNode;
|
|
45
45
|
icon?: IconContent;
|
|
46
|
+
/**
|
|
47
|
+
* A shortcut drawn after the label, in `useHotkeys` spelling (`'mod+s'`): `⌘S` on Apple
|
|
48
|
+
* platforms, `Ctrl+S` elsewhere. Drawn only; bind it with `useHotkeys`.
|
|
49
|
+
*/
|
|
50
|
+
shortcut?: string;
|
|
46
51
|
isLoading?: boolean;
|
|
47
52
|
disabled?: boolean;
|
|
48
53
|
title?: string;
|
|
@@ -18,6 +18,11 @@ export interface UseHotkeysOptions {
|
|
|
18
18
|
* Default `true`.
|
|
19
19
|
*/
|
|
20
20
|
preventDefault?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Fire again for each repeat while the combo is held. Default `false`, so holding `mod+s` saves
|
|
23
|
+
* once. Turn it on for keys that step through something, such as arrows or zoom.
|
|
24
|
+
*/
|
|
25
|
+
repeat?: boolean;
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
23
28
|
* A combo written for the reader: `'mod+shift+k'` reads `⇧⌘K` on an Apple platform and
|
|
@@ -30,6 +35,12 @@ export interface UseHotkeysOptions {
|
|
|
30
35
|
* Resolved from the platform at call time, so a server-rendered page renders the non-Apple form.
|
|
31
36
|
*/
|
|
32
37
|
export declare function formatHotkey(combo: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* A combo as `aria-keyshortcuts` spells it: `'mod+shift+k'` is `Control+Shift+K`, or
|
|
40
|
+
* `Meta+Shift+K` on an Apple platform. Resolved from the platform like `formatHotkey`, so the two
|
|
41
|
+
* always name the same keys.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ariaKeyshortcuts(combo: string | undefined): string | undefined;
|
|
33
44
|
/**
|
|
34
45
|
* Keyboard shortcuts, for a whole app or for one element.
|
|
35
46
|
*
|
|
@@ -25,6 +25,11 @@ export interface MenuAction {
|
|
|
25
25
|
disabled?: boolean;
|
|
26
26
|
/** Renders in the destructive colour. For deleting, discarding, revoking. */
|
|
27
27
|
danger?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Followed after `onClick` and `onAction`. In `Menu` a real `<a>`, so Ctrl/⌘-click opens a new tab.
|
|
30
|
+
* Loads the whole page: with a client-side router, navigate in `onClick` instead.
|
|
31
|
+
*/
|
|
32
|
+
href?: string;
|
|
28
33
|
onClick?: () => void;
|
|
29
34
|
}
|
|
30
35
|
/** A line between groups of actions. */
|
|
@@ -14,7 +14,7 @@ import { MenuEntry } from './menu.types.js';
|
|
|
14
14
|
* useHotkeys(menuHotkeys(items, run), { enabled: isOpen }); // only while the menu is open
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
-
* Runs each entry the way clicking it does: its own `onClick`, then `onAction
|
|
18
|
-
* entry, and an entry with no `shortcut`, is left out.
|
|
17
|
+
* Runs each entry the way clicking it does: its own `onClick`, then `onAction`, then its `href`.
|
|
18
|
+
* A `disabled` entry, and an entry with no `shortcut`, is left out.
|
|
19
19
|
*/
|
|
20
20
|
export declare function menuHotkeys(items: MenuEntry[], onAction?: (id: string) => void): HotkeyMap;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { MenuAction, MenuEntry } from './menu.types.js';
|
|
3
|
+
export declare function hasAnyIcon(items: MenuEntry[]): boolean;
|
|
4
|
+
/** The action's icon, or an empty cell as wide when another action has one, so the labels line up. */
|
|
5
|
+
export declare function renderItemIcon(icon: MenuAction['icon'], reserveCell: boolean, props: {
|
|
6
|
+
className: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}): ReactNode;
|
|
9
|
+
/** Runs an action the way clicking it does: its own `onClick`, then `onAction`, then its `href`. */
|
|
10
|
+
export declare function runMenuAction(action: MenuAction, onAction?: (id: string) => void): void;
|
package/docs/ActionIcon.md
CHANGED
|
@@ -38,8 +38,8 @@ import { faTrash, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
|
38
38
|
| `ref` | `Ref<HTMLButtonElement>` | Ref to the button |
|
|
39
39
|
|
|
40
40
|
Every other Button prop and native `<button>` attribute passes through, except `size`,
|
|
41
|
-
`children` and `
|
|
42
|
-
for a different one.
|
|
41
|
+
`children`, `isLoading` and `shortcut`. The box is the icon plus `4px` on each side; set `width`
|
|
42
|
+
and `height` for a different one.
|
|
43
43
|
|
|
44
44
|
**Slots:** `root` `icon`
|
|
45
45
|
|
package/docs/Button.md
CHANGED
|
@@ -11,7 +11,7 @@ works with any colour. The colours are the library-wide `ThemeColor`s or any CSS
|
|
|
11
11
|
[ThemeColor.md](ThemeColor.md).
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import { Button, ButtonStyleType, ButtonSize, ButtonType, ThemeColor } from '@ahrowe/ui';
|
|
14
|
+
import { Button, ButtonStyleType, ButtonSize, ButtonType, ThemeColor, useHotkeys } from '@ahrowe/ui';
|
|
15
15
|
import { faPlus, faSave, faTrash, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
16
16
|
|
|
17
17
|
// The main action
|
|
@@ -52,6 +52,10 @@ import { faPlus, faSave, faTrash, faXmark } from '@fortawesome/free-solid-svg-ic
|
|
|
52
52
|
// Small
|
|
53
53
|
<Button size={ButtonSize.Small}>Cancel</Button>
|
|
54
54
|
|
|
55
|
+
// A keyboard shortcut: the button draws it, useHotkeys binds it
|
|
56
|
+
useHotkeys({ 'mod+s': handleSave });
|
|
57
|
+
<Button styleType={ButtonStyleType.Filled} shortcut='mod+s' onClick={handleSave}>Save</Button>
|
|
58
|
+
|
|
55
59
|
// Press-and-hold: act on press rather than release
|
|
56
60
|
<Button
|
|
57
61
|
icon={faPlus}
|
|
@@ -81,6 +85,7 @@ import { faPlus, faSave, faTrash, faXmark } from '@fortawesome/free-solid-svg-ic
|
|
|
81
85
|
| `size` | `ButtonSize` | Size variant. `Icon` strips all padding, inherits the surrounding text size, and centres a lone icon — set the width/height yourself |
|
|
82
86
|
| `type` | `ButtonType` | HTML button type |
|
|
83
87
|
| `icon` | `IconDefinition \| ReactElement` | FontAwesome icon or any React element, shown before label |
|
|
88
|
+
| `shortcut` | `string` | A combo in [useHotkeys](Hooks.md) spelling, e.g. `'mod+s'`. Shown after the label, written for the platform. Binding it is yours, see below |
|
|
84
89
|
| `isLoading` | `boolean` | Replaces content with a [Loader](Loader.md) in the button's text colour. Blocks clicks like `disabled` but keeps full colour |
|
|
85
90
|
| `disabled` | `boolean` | Fades the button to half opacity |
|
|
86
91
|
| `onClick` | `(e: MouseEvent) => void \| Promise<void>` | |
|
|
@@ -92,6 +97,17 @@ press-and-hold controls that act on press rather than release), `onContextMenu`,
|
|
|
92
97
|
takes the `ButtonType` enum, and `onClick` may return a promise. `color` is Button's own prop, not
|
|
93
98
|
the obsolete HTML attribute.
|
|
94
99
|
|
|
100
|
+
**Shortcuts are drawn, not bound.** `shortcut` writes the combo in a pill after the label,
|
|
101
|
+
`⌘S` on an Apple platform and `Ctrl+S` elsewhere. It also sets `aria-keyshortcuts`, so a screen
|
|
102
|
+
reader announces it apart from the button's name. It is hidden on a touch screen
|
|
103
|
+
(`pointer: coarse`), which usually has no keyboard to press it on.
|
|
104
|
+
|
|
105
|
+
Listening for it is yours, with `useHotkeys` and the same string, because only your app knows
|
|
106
|
+
when the action is available. A button cannot tell: it would still fire while hidden in an
|
|
107
|
+
inactive tab, behind an open Modal, or twice when the same action has a button in the toolbar and
|
|
108
|
+
another in the footer. Turn the binding off wherever the button is disabled:
|
|
109
|
+
`useHotkeys({ 'mod+s': handleSave }, { enabled: !isSaving })`.
|
|
110
|
+
|
|
95
111
|
**Theming:** each colour reads the theme variables listed in [ThemeColor.md](ThemeColor.md). The
|
|
96
112
|
`Filled` `Primary` button also paints `--primary-gradient` when the theme sets one. See
|
|
97
113
|
[ThemeProvider.md](ThemeProvider.md).
|
|
@@ -112,7 +128,7 @@ sits inside the edge, in `--focus-border-color`, or in the text colour on a `Fil
|
|
|
112
128
|
ripple is in the text colour too. Every button reserves a `1px` border, so switching style never
|
|
113
129
|
shifts layout or changes its height.
|
|
114
130
|
|
|
115
|
-
**Slots:** `background` `content` `loadingContainer` `label`
|
|
131
|
+
**Slots:** `background` `content` `loadingContainer` `label` `shortcut`
|
|
116
132
|
|
|
117
133
|
**Sizing in a flex row:** a Button never shrinks below its own content (`min-width: min-content`),
|
|
118
134
|
so an icon is never cut off by a flexible sibling. A multi-word label still wraps above that floor.
|
package/docs/CommandPalette.md
CHANGED
|
@@ -73,7 +73,7 @@ On a small touch screen it can present as a bottom sheet like every `Modal`: pas
|
|
|
73
73
|
| `isLoading` | `boolean` | Shows the `loading` label instead of `empty` while nothing matches |
|
|
74
74
|
| `presentation` | `Presentation` | Centred dialog (default), bottom sheet, or a sheet only on a small touch screen |
|
|
75
75
|
|
|
76
|
-
A command is a `MenuAction`: `id`, `label`, `icon`, `shortcut`, `keywords`, `disabled`, `danger` and `onClick`. See [Menu.md](Menu.md).
|
|
76
|
+
A command is a `MenuAction`: `id`, `label`, `icon`, `shortcut`, `keywords`, `disabled`, `danger`, `href` and `onClick`. A command with an `href` goes there after running. See [Menu.md](Menu.md).
|
|
77
77
|
|
|
78
78
|
**Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ CommandPalette: { presentation: Presentation.Auto } }}`. See [ConfigProvider.md](ConfigProvider.md).
|
|
79
79
|
|
package/docs/Hooks.md
CHANGED
|
@@ -59,6 +59,7 @@ Two rules worth knowing:
|
|
|
59
59
|
| `target` | `RefObject<HTMLElement \| null>` | window | Scope the shortcuts to one element |
|
|
60
60
|
| `enableInFields` | `boolean` | `false` | Let a combo fire while a text field or `contenteditable` has focus. Only combos the field would otherwise consume are held back: a single character, or an editing key (`arrowup`, `home`, `backspace`, `enter`, `tab`, …). Anything carrying Ctrl, Cmd or Alt fires regardless, and so do `f2`, `escape` and the other keys a field does not use |
|
|
61
61
|
| `preventDefault` | `boolean` | `true` | Call `preventDefault()` on a match, so `mod+s` does not also open the browser's save dialog |
|
|
62
|
+
| `repeat` | `boolean` | `false` | Fire again for each repeat while the combo is held. Off, holding `mod+s` saves once; turn it on for keys that step through something |
|
|
62
63
|
|
|
63
64
|
Shortcuts keep firing while a `Modal` or `Drawer` is open, which is usually what a command palette
|
|
64
65
|
wants. Pass `enabled` for the ones that should not:
|
|
@@ -67,7 +68,14 @@ wants. Pass `enabled` for the ones that should not:
|
|
|
67
68
|
useHotkeys({ n: createRecord }, { enabled: !isModalOpen });
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
A held
|
|
71
|
+
A held combo fires once, where the browser's key repeat would save over and over or flicker a
|
|
72
|
+
toggle. The skipped repeats are still `preventDefault()`-ed. Where a repeat is the point, as with
|
|
73
|
+
arrows or zoom, ask for it, in a call of its own if the page also has actions:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
useHotkeys({ 'mod+s': save, '?': toggleHelp });
|
|
77
|
+
useHotkeys({ j: selectNext, k: selectPrevious }, { repeat: true });
|
|
78
|
+
```
|
|
71
79
|
|
|
72
80
|
### formatHotkey
|
|
73
81
|
|
|
@@ -79,9 +87,10 @@ formatHotkey('mod+shift+k'); // '⇧⌘K' on an Apple platform, 'Ctrl+Shift+K' e
|
|
|
79
87
|
formatHotkey('f2'); // 'F2'
|
|
80
88
|
```
|
|
81
89
|
|
|
82
|
-
This is what `Menu`
|
|
83
|
-
|
|
84
|
-
time, so a server-rendered page renders the
|
|
90
|
+
This is what `Menu`, `CommandPalette` and `Button` use to draw a shortcut, from the same string
|
|
91
|
+
`useHotkeys` binds, see [Menu.md](Menu.md) and [Button.md](Button.md). A combo it cannot parse is
|
|
92
|
+
handed back unchanged. The platform is read at call time, so a server-rendered page renders the
|
|
93
|
+
non-Apple spelling.
|
|
85
94
|
|
|
86
95
|
## useMediaQuery
|
|
87
96
|
|
|
@@ -266,3 +275,13 @@ Hooks documented with the thing they belong to:
|
|
|
266
275
|
- `useComponentDefaults`, `useLabels` — see [ConfigProvider.md](ConfigProvider.md)
|
|
267
276
|
- `useFormValidator` — see [FormValidator.md](FormValidator.md)
|
|
268
277
|
- `useFormValidatorGroup` — see [FormValidatorGroup.md](FormValidatorGroup.md)
|
|
278
|
+
|
|
279
|
+
## Migration from repeating hotkeys
|
|
280
|
+
|
|
281
|
+
Before 0.49, a held `useHotkeys` combo fired its handler for every repeat the browser sent. It now
|
|
282
|
+
fires once. Nothing fails to compile, so look for shortcuts that are meant to be held:
|
|
283
|
+
|
|
284
|
+
| Before | After |
|
|
285
|
+
|--------|-------|
|
|
286
|
+
| `useHotkeys({ arrowdown: next })`, relying on the repeat | `useHotkeys({ arrowdown: next }, { repeat: true })` |
|
|
287
|
+
| `if (event.repeat) return;` at the top of a handler | nothing: drop the check |
|
package/docs/InteractableDiv.md
CHANGED
|
@@ -23,4 +23,4 @@ import { InteractableDiv } from '@ahrowe/ui';
|
|
|
23
23
|
</InteractableDiv>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
**Note:** Check [package/common/interactableDiv/](https://github.com/
|
|
26
|
+
**Note:** Check [package/common/interactableDiv/](https://github.com/ahrowe-dev/ahrowe-ui/tree/master/package/common/interactableDiv) for full prop details.
|
package/docs/Menu.md
CHANGED
|
@@ -27,14 +27,14 @@ const items: MenuEntry[] = [
|
|
|
27
27
|
**Entries** are one of three shapes, and the list is read in the order you give it:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
{ id: 'edit', label: 'Edit', icon, shortcut, keywords, disabled, danger, onClick } // an action
|
|
31
|
-
{ separator: true }
|
|
32
|
-
{ heading: 'This document' }
|
|
30
|
+
{ id: 'edit', label: 'Edit', icon, shortcut, keywords, disabled, danger, href, onClick } // an action, or a link with `href`
|
|
31
|
+
{ separator: true } // a line
|
|
32
|
+
{ heading: 'This document' } // a label over what follows
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
`keywords` are extra search terms for [CommandPalette](CommandPalette.md), which takes the same entries. The menu ignores them.
|
|
36
36
|
|
|
37
|
-
**Shortcuts are drawn, not bound.** A `shortcut` is a combo in [useHotkeys](Hooks.md) spelling, and the menu writes it on the trailing edge for the platform the reader is on: `mod+s` shows as `⌘S` on an Apple one and `Ctrl+S` everywhere else. So there is one spelling per shortcut and a hand-written `'⌘S'` can no longer be wrong on Windows.
|
|
37
|
+
**Shortcuts are drawn, not bound.** A `shortcut` is a combo in [useHotkeys](Hooks.md) spelling, and the menu writes it on the trailing edge for the platform the reader is on: `mod+s` shows as `⌘S` on an Apple one and `Ctrl+S` everywhere else. So there is one spelling per shortcut and a hand-written `'⌘S'` can no longer be wrong on Windows. Screen readers get it through `aria-keyshortcuts`, not as part of the item's name.
|
|
38
38
|
|
|
39
39
|
Listening for it is yours, because only your app knows what else is listening: if it already binds `⌘S` and the menu bound it too, both would fire and the action would run twice. `menuHotkeys` turns the same entries into a map for `useHotkeys`, so the one spelling covers the hint and the binding:
|
|
40
40
|
|
|
@@ -54,7 +54,7 @@ useHotkeys(menuHotkeys(items, run));
|
|
|
54
54
|
useHotkeys(menuHotkeys(items, run), { enabled: isOpen });
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
It runs each entry the way clicking it does, its own `onClick` then `onAction`, and leaves out a `disabled` entry and any entry with no `shortcut`. Bind them yourself instead if the actions already live in a keymap of your own; the menu does not mind either way.
|
|
57
|
+
It runs each entry the way clicking it does, its own `onClick` then `onAction` then its `href`, and leaves out a `disabled` entry and any entry with no `shortcut`. Bind them yourself instead if the actions already live in a keymap of your own; the menu does not mind either way.
|
|
58
58
|
|
|
59
59
|
An action runs its own `onClick` first, then `onAction` on the menu, then the menu closes. Use whichever of the two fits: a handler per entry when they are unrelated, `onAction` when they funnel into one place.
|
|
60
60
|
|
|
@@ -116,10 +116,11 @@ Separators and headings are never focused. The trigger is given `aria-haspopup`,
|
|
|
116
116
|
|-------|------|-------------|
|
|
117
117
|
| `id` | `string` | Stable id, also what `onAction` reports |
|
|
118
118
|
| `label` | `ReactNode` | What the entry says |
|
|
119
|
-
| `icon` | `IconContent` | Leading icon |
|
|
119
|
+
| `icon` | `IconContent` | Leading icon. Entries without one keep its space while any other has one, so the labels line up. Same in `CommandPalette` |
|
|
120
120
|
| `shortcut` | `string` | A combo in `useHotkeys` spelling, e.g. `'mod+k'`. Shown on the trailing edge, written for the platform. Binding it is yours, see `menuHotkeys` |
|
|
121
121
|
| `disabled` | `boolean` | Not clickable, and skipped by the arrow keys |
|
|
122
122
|
| `danger` | `boolean` | Renders in the destructive colour |
|
|
123
|
+
| `href` | `string` | Makes the entry a real `<a>`, so Ctrl/⌘-click and a middle click open it in a new tab. A click runs `onClick` and `onAction` first, a middle click neither. The browser loads the page, so with a client-side router navigate in `onClick` instead. A `disabled` entry stays a button |
|
|
123
124
|
| `onClick` | `() => void` | Runs before `onAction` |
|
|
124
125
|
|
|
125
126
|
**Slots:** `root` `trigger` `menu` `item` `itemIcon` `itemLabel` `itemShortcut` `separator` `heading`
|
package/docs/ProgressBar.md
CHANGED
|
@@ -49,7 +49,7 @@ when unset. A label on a coloured segment is black or white, whichever reads on
|
|
|
49
49
|
|
|
50
50
|
| Variable | Falls back to |
|
|
51
51
|
|----------|---------------|
|
|
52
|
-
| `--progress-bar-track-color` | `var(--background-accent)` |
|
|
52
|
+
| `--progress-bar-track-color` | `var(--background-accent-light)` |
|
|
53
53
|
|
|
54
54
|
```tsx
|
|
55
55
|
// Theme-wide, via ThemeProvider
|
package/docs/RadioGroup.md
CHANGED
|
@@ -79,6 +79,6 @@ interface RadioOption {
|
|
|
79
79
|
|
|
80
80
|
## Sizing
|
|
81
81
|
|
|
82
|
-
The group is sized by its font, so the radios, the spacing between options and the gap to each label all scale with the text. `--radio-size` and `--radio-gap` override the circle and the label spacing; they fall back to `1.125em` and `0.625em`, i.e. 18px and 10px at a 16px base. The dot is
|
|
82
|
+
The group is sized by its font, so the radios, the spacing between options and the gap to each label all scale with the text. `--radio-size` and `--radio-gap` override the circle and the label spacing; they fall back to `1.125em` and `0.625em`, i.e. 18px and 10px at a 16px base. The dot is about half the circle.
|
|
83
83
|
|
|
84
84
|
The `size` prop still wins where it is given, for a radio that must match a fixed layout rather than the text around it.
|
package/docs/ThemeProvider.md
CHANGED
|
@@ -92,7 +92,7 @@ interface Theme {
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
**Key CSS variables** (
|
|
95
|
+
**Key CSS variables** (`ThemeVariables` is the full list, in `node_modules/@ahrowe/ui/dist/types/common/themeProvider/theme.types.d.ts`):
|
|
96
96
|
|
|
97
97
|
| Variable | Purpose |
|
|
98
98
|
|----------|---------|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahrowe/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "A React UI component library with theming, CSS Modules, and TypeScript support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
],
|
|
19
19
|
"homepage": "https://ahrowe.com/packages/ui/demo/",
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/
|
|
21
|
+
"url": "https://github.com/ahrowe-dev/ahrowe-ui/issues"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"author": "ahrowe <dev@ahrowe.com>",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/
|
|
27
|
+
"url": "git+https://github.com/ahrowe-dev/ahrowe-ui.git"
|
|
28
28
|
},
|
|
29
29
|
"style": "./dist/style.css",
|
|
30
30
|
"bin": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"scripts": {
|
|
78
78
|
"dev": "vite",
|
|
79
79
|
"build": "vite build",
|
|
80
|
-
"build:demo": "vite build --base
|
|
80
|
+
"build:demo": "vite build --base=./ --outDir dist-demo",
|
|
81
81
|
"build:lib": "vite build --config vite.lib.config.ts",
|
|
82
82
|
"build:mcp": "vite build --config vite.mcp.config.ts",
|
|
83
83
|
"preview": "vite preview",
|