@panneau/ui 5.0.0-alpha.5 → 5.0.0-alpha.6
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/README.md +54 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/menu/Menu.css +84 -0
- package/dist/menu/Menu.d.ts +33 -6
- package/dist/menu/Menu.d.ts.map +1 -1
- package/dist/menu/Menu.js +110 -25
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/Menu.module.js +22 -0
- package/dist/menu/Menu.module.js.map +1 -0
- package/dist/menu/tokens.d.ts +3 -0
- package/dist/menu/tokens.d.ts.map +1 -0
- package/dist/menu/tokens.js +31 -0
- package/dist/menu/tokens.js.map +1 -0
- package/dist/number-input/NumberInput.css +18 -0
- package/dist/number-input/NumberInput.js +1 -1
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/NumberInput.module.js +3 -1
- package/dist/number-input/NumberInput.module.js.map +1 -1
- package/dist/pill-trigger/PillTrigger.css +104 -0
- package/dist/pill-trigger/PillTrigger.d.ts +20 -0
- package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
- package/dist/pill-trigger/PillTrigger.js +38 -0
- package/dist/pill-trigger/PillTrigger.js.map +1 -0
- package/dist/pill-trigger/PillTrigger.module.js +18 -0
- package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
- package/dist/pill-trigger/tokens.d.ts +3 -0
- package/dist/pill-trigger/tokens.d.ts.map +1 -0
- package/dist/pill-trigger/tokens.js +37 -0
- package/dist/pill-trigger/tokens.js.map +1 -0
- package/dist/radio-group/RadioGroup.css +90 -0
- package/dist/radio-group/RadioGroup.d.ts +22 -3
- package/dist/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/radio-group/RadioGroup.js +42 -21
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/RadioGroup.module.js +12 -2
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +2 -2
- package/dist/radio-group/tokens.d.ts.map +1 -1
- package/dist/radio-group/tokens.js +22 -2
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/select/ListBox.css +15 -0
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/slider/Slider.css +84 -0
- package/dist/slider/Slider.d.ts +20 -0
- package/dist/slider/Slider.d.ts.map +1 -0
- package/dist/slider/Slider.js +70 -0
- package/dist/slider/Slider.js.map +1 -0
- package/dist/slider/Slider.module.js +20 -0
- package/dist/slider/Slider.module.js.map +1 -0
- package/dist/tags-input/TagsInput.css +60 -0
- package/dist/tags-input/TagsInput.d.ts +32 -0
- package/dist/tags-input/TagsInput.d.ts.map +1 -0
- package/dist/tags-input/TagsInput.js +160 -0
- package/dist/tags-input/TagsInput.js.map +1 -0
- package/dist/tags-input/TagsInput.module.js +20 -0
- package/dist/tags-input/TagsInput.module.js.map +1 -0
- package/dist/theme/components.d.ts +3 -1
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +4 -0
- package/dist/theme/components.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -290,12 +290,65 @@ The theme model is described in [decision 0024](../../docs/decisions/0024-theme-
|
|
|
290
290
|
|
|
291
291
|
## Primitives
|
|
292
292
|
|
|
293
|
-
`Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `SegmentedControl`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Card`, `Disclosure` and `Icon`.
|
|
293
|
+
`Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Slider`, `TagsInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `SegmentedControl`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `PillTrigger`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Card`, `Disclosure` and `Icon`.
|
|
294
294
|
|
|
295
295
|
- Every component accepts `className`, and `xxxClassName` props for its inner elements (`labelClassName`, `inputClassName`…).
|
|
296
296
|
- Labelled controls take `label`, `description` and `errors` (a list of messages: any message makes the control invalid and describes it).
|
|
297
297
|
- They work on phones: larger touch targets on touch screens, dialogs as bottom sheets (or the whole screen, with `fullScreenOnPhone`), scrolling tabs.
|
|
298
298
|
|
|
299
|
+
### Rich choices
|
|
300
|
+
|
|
301
|
+
Picking one item among a few rich ones, such as an account (an avatar, a name, a handle), a plan or a template, takes a menu or radio cards.
|
|
302
|
+
|
|
303
|
+
- **`Menu`** groups its items in `MenuSection`s, whose `title` is a small muted eyebrow that labels the group, and takes a `footer`: a short note under the items, after a line, which describes the menu and can't be focused. With `selectionMode` (`single` or `multiple`) and `selectedKeys`, its items are radio or checkbox items, and the selected ones have a check at their end and a sunken background.
|
|
304
|
+
- **`MenuItem`** takes a leading `media` (an avatar or an image) instead of an `icon`: larger when the item has a `description`, and clipped to a circle by default (`--panneau-menu-media-radius`).
|
|
305
|
+
- **`PillTrigger`** is a compact rounded button that shows the current value, with an optional leading `media` and a chevron, for a `MenuTrigger` or a `PopoverTrigger`. Its accessible name is its value: give it an `aria-label` that contains the value when the value alone doesn't say what it picks.
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
<MenuTrigger>
|
|
309
|
+
<PillTrigger size="sm" media={<Avatar user={account} />}>
|
|
310
|
+
{account.name}
|
|
311
|
+
</PillTrigger>
|
|
312
|
+
<Menu
|
|
313
|
+
aria-label="Accounts"
|
|
314
|
+
selectionMode="single"
|
|
315
|
+
selectedKeys={[account.id]}
|
|
316
|
+
onSelectionChange={(keys) => keys !== 'all' && onChange([...keys][0])}
|
|
317
|
+
footer="Only this step changes."
|
|
318
|
+
>
|
|
319
|
+
<MenuSection title="Publish on">
|
|
320
|
+
{accounts.map((item) => (
|
|
321
|
+
<MenuItem
|
|
322
|
+
key={item.id}
|
|
323
|
+
id={item.id}
|
|
324
|
+
media={<Avatar user={item} />}
|
|
325
|
+
description={item.handle}
|
|
326
|
+
>
|
|
327
|
+
{item.name}
|
|
328
|
+
</MenuItem>
|
|
329
|
+
))}
|
|
330
|
+
</MenuSection>
|
|
331
|
+
</Menu>
|
|
332
|
+
</MenuTrigger>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
- **`RadioGroup`** with `appearance="cards"` shows its options as bordered cards in a grid of `columns` (2 by default): each card has the radio, the option's `media`, its label and its description, and the selected card has a stronger border. The grid is a size container of its own, and becomes a single column when it is narrower than 28rem. Keyboard and focus work as in a list of radios.
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
<RadioGroup
|
|
339
|
+
label="Publish on"
|
|
340
|
+
appearance="cards"
|
|
341
|
+
options={accounts.map((item) => ({
|
|
342
|
+
value: item.id,
|
|
343
|
+
label: item.name,
|
|
344
|
+
description: item.handle,
|
|
345
|
+
media: <Avatar user={item} />,
|
|
346
|
+
}))}
|
|
347
|
+
value={accountId}
|
|
348
|
+
onChange={setAccountId}
|
|
349
|
+
/>
|
|
350
|
+
```
|
|
351
|
+
|
|
299
352
|
## Icons
|
|
300
353
|
|
|
301
354
|
Components take icons as components: any Lucide icon (`icon={Pencil}`), or a component with the same props.
|
package/dist/index.d.ts
CHANGED
|
@@ -21,10 +21,13 @@ export { Icon, type IconComponent, type IconProps, type IconSize } from './icon/
|
|
|
21
21
|
export { type NamedIconLoader, getNamedIcon, loadNamedIcon } from './icon/namedIcons';
|
|
22
22
|
export { IconButton, type IconButtonProps } from './icon-button/IconButton';
|
|
23
23
|
export { usePanneauIntl } from './intl/usePanneauIntl';
|
|
24
|
-
export { Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSeparator, MenuTrigger, } from './menu/Menu';
|
|
24
|
+
export { Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, MenuTrigger, } from './menu/Menu';
|
|
25
25
|
export { NumberInput, type NumberInputProps } from './number-input/NumberInput';
|
|
26
|
+
export { Slider, type SliderProps } from './slider/Slider';
|
|
27
|
+
export { type TagSuggestion, TagsInput, type TagsInputProps } from './tags-input/TagsInput';
|
|
28
|
+
export { PillTrigger, type PillTriggerProps } from './pill-trigger/PillTrigger';
|
|
26
29
|
export { Popover, type PopoverProps, PopoverTrigger } from './popover/Popover';
|
|
27
|
-
export { RadioGroup, type RadioGroupProps } from './radio-group/RadioGroup';
|
|
30
|
+
export { RadioGroup, type RadioGroupAppearance, type RadioGroupOption, type RadioGroupProps, } from './radio-group/RadioGroup';
|
|
28
31
|
export { PanneauRoot, type PanneauRootProps, usePortalContainer } from './root/PanneauRoot';
|
|
29
32
|
export { ThemeScope, type ThemeScopeProps } from './root/ThemeScope';
|
|
30
33
|
export { SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, } from './segmented-control/SegmentedControl';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EA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E,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,WAAW,EACX,iBAAiB,EACjB,WAAW,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACH,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,UAAU,EACV,aAAa,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,QAAQ,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,8 +27,11 @@ import { DatePicker } from "./date-picker/DatePicker.js";
|
|
|
27
27
|
import { Dialog, DialogTrigger } from "./dialog/Dialog.js";
|
|
28
28
|
import { Disclosure } from "./disclosure/Disclosure.js";
|
|
29
29
|
import { Fieldset } from "./field/Fieldset.js";
|
|
30
|
-
import { Menu, MenuItem, MenuSeparator, MenuTrigger } from "./menu/Menu.js";
|
|
30
|
+
import { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger } from "./menu/Menu.js";
|
|
31
31
|
import { NumberInput } from "./number-input/NumberInput.js";
|
|
32
|
+
import { Slider } from "./slider/Slider.js";
|
|
33
|
+
import { TagsInput } from "./tags-input/TagsInput.js";
|
|
34
|
+
import { PillTrigger } from "./pill-trigger/PillTrigger.js";
|
|
32
35
|
import { RadioGroup } from "./radio-group/RadioGroup.js";
|
|
33
36
|
import { ThemeScope } from "./root/ThemeScope.js";
|
|
34
37
|
import { SegmentedControl } from "./segmented-control/SegmentedControl.js";
|
|
@@ -49,4 +52,4 @@ import { defineComponentTokens } from "./theme/componentTokens.js";
|
|
|
49
52
|
import { componentTokens } from "./theme/components.js";
|
|
50
53
|
import { SEMANTIC_TOKENS } from "./theme/semanticTokens.js";
|
|
51
54
|
import { defineTheme, findUnknownTokens, mergeThemes } from "./theme/defineTheme.js";
|
|
52
|
-
export { Alert, BREAKPOINTS, BUILT_IN_TONES, Badge, Button, CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, Card, Checkbox, ComboBox, CommandPalette, Container, DatePicker, Dialog, DialogTrigger, Disclosure, Divider, Fieldset, Grid, GridItem, Heading, Icon, IconButton, Inline, Menu, MenuItem, MenuSeparator, MenuTrigger, NumberInput, PanneauRoot, Popover, PopoverTrigger, Prose, RadioGroup, SEMANTIC_TOKENS, SegmentedControl, Select, Spinner, Stack, Switch, Tab, TabList, TabPanel, Tabs, Text, TextArea, TextInput, ThemeScope, TimeInput, Tooltip, bootstrapTheme, bootstrapTone, chartColors, checkColorDifferences, checkTheme, componentTokens, defineComponentTokens, defineTheme, deriveTone, findUnknownTokens, getNamedIcon, isApplePlatform, loadNamedIcon, matchCommands, mergeThemes, normalizeSearch, toneClassName, useCommandShortcut, usePanneauIntl, usePortalContainer, useToast };
|
|
55
|
+
export { Alert, BREAKPOINTS, BUILT_IN_TONES, Badge, Button, CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, Card, Checkbox, ComboBox, CommandPalette, Container, DatePicker, Dialog, DialogTrigger, Disclosure, Divider, Fieldset, Grid, GridItem, Heading, Icon, IconButton, Inline, Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, NumberInput, PanneauRoot, PillTrigger, Popover, PopoverTrigger, Prose, RadioGroup, SEMANTIC_TOKENS, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tab, TabList, TabPanel, Tabs, TagsInput, Text, TextArea, TextInput, ThemeScope, TimeInput, Tooltip, bootstrapTheme, bootstrapTone, chartColors, checkColorDifferences, checkTheme, componentTokens, defineComponentTokens, defineTheme, deriveTone, findUnknownTokens, getNamedIcon, isApplePlatform, loadNamedIcon, matchCommands, mergeThemes, normalizeSearch, toneClassName, useCommandShortcut, usePanneauIntl, usePortalContainer, useToast };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* Parts of menus on top of the options of ListBox.module.css: sections, footer, media, selection. */
|
|
2
|
+
|
|
3
|
+
/* A menu with a footer: the items scroll, the footer stays under them. */
|
|
4
|
+
.panneau-menu-layout {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
max-height: inherit;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.panneau-menu-layout > [role='menu'] {
|
|
11
|
+
flex: 1 1 auto;
|
|
12
|
+
min-height: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.panneau-menu-section + .panneau-menu-section {
|
|
16
|
+
margin-top: var(--panneau-space-1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.panneau-menu-header {
|
|
20
|
+
padding: var(--panneau-space-2) var(--panneau-list-box-item-padding-x, var(--panneau-space-2))
|
|
21
|
+
var(--panneau-space-1);
|
|
22
|
+
font-size: var(--panneau-menu-header-font-size, var(--panneau-font-size-xs));
|
|
23
|
+
font-weight: var(--panneau-menu-header-font-weight, var(--panneau-font-weight-medium));
|
|
24
|
+
line-height: var(--panneau-line-height-tight);
|
|
25
|
+
color: var(--panneau-menu-header-color, var(--panneau-color-text-muted));
|
|
26
|
+
text-transform: var(--panneau-menu-header-text-transform, uppercase);
|
|
27
|
+
letter-spacing: var(--panneau-menu-header-letter-spacing, 0.04em);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.panneau-menu-footer {
|
|
31
|
+
flex: 0 0 auto;
|
|
32
|
+
padding: var(--panneau-space-2)
|
|
33
|
+
calc(
|
|
34
|
+
var(--panneau-list-box-padding, var(--panneau-space-1)) +
|
|
35
|
+
var(--panneau-list-box-item-padding-x, var(--panneau-space-2))
|
|
36
|
+
);
|
|
37
|
+
font-size: var(--panneau-menu-footer-font-size, var(--panneau-font-size-xs));
|
|
38
|
+
line-height: var(--panneau-line-height-tight);
|
|
39
|
+
color: var(--panneau-menu-footer-color, var(--panneau-color-text-muted));
|
|
40
|
+
border-top: var(--panneau-border-width) solid var(--panneau-color-border);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.panneau-menu-media {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
flex: 0 0 auto;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
width: var(--panneau-menu-media-size, 1.5rem);
|
|
49
|
+
height: var(--panneau-menu-media-size, 1.5rem);
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
border-radius: var(--panneau-menu-media-radius, var(--panneau-radius-full));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.panneau-menu-item:has([slot='description']) .panneau-menu-media {
|
|
55
|
+
width: var(--panneau-menu-media-size-described, 2rem);
|
|
56
|
+
height: var(--panneau-menu-media-size-described, 2rem);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.panneau-menu-media > :is(img, svg, video, picture) {
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
object-fit: cover;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* The check of a selected item, at its end. */
|
|
66
|
+
.panneau-menu-check {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
flex: 0 0 auto;
|
|
69
|
+
justify-content: flex-end;
|
|
70
|
+
width: 1rem;
|
|
71
|
+
color: var(--panneau-color-text);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.panneau-menu-item[data-selected] {
|
|
75
|
+
background-color: var(--panneau-menu-item-bg-selected, var(--panneau-color-surface-sunken));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* A focused or hovered selected item: the hover color over the selected background. */
|
|
79
|
+
.panneau-menu-item[data-selected]:is([data-focused], [data-hovered]) {
|
|
80
|
+
background-image: linear-gradient(
|
|
81
|
+
var(--panneau-list-box-item-bg-hover, var(--panneau-color-hover)),
|
|
82
|
+
var(--panneau-list-box-item-bg-hover, var(--panneau-color-hover))
|
|
83
|
+
);
|
|
84
|
+
}
|
package/dist/menu/Menu.d.ts
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type MenuItemProps as AriaMenuItemProps, type MenuProps as AriaMenuProps } from 'react-aria-components';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type MenuItemProps as AriaMenuItemProps, type MenuProps as AriaMenuProps, type MenuSectionProps as AriaMenuSectionProps } from 'react-aria-components';
|
|
3
3
|
import { type IconComponent } from '../icon/Icon';
|
|
4
4
|
export interface MenuProps<T extends object> extends Omit<AriaMenuProps<T>, 'className' | 'style'> {
|
|
5
5
|
className?: string;
|
|
6
6
|
popoverClassName?: string;
|
|
7
7
|
placement?: 'bottom start' | 'bottom end' | 'top start' | 'top end';
|
|
8
|
+
/**
|
|
9
|
+
* A short note under the items, after a line, such as "Only this step changes.". It isn't an
|
|
10
|
+
* item and can't be focused: the menu is described by it.
|
|
11
|
+
*/
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
footerClassName?: string;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
16
|
* A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move
|
|
11
|
-
* between items, and typing a letter jumps to an item.
|
|
17
|
+
* between items, and typing a letter jumps to an item. With `selectionMode` (`single` or
|
|
18
|
+
* `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.
|
|
12
19
|
*/
|
|
13
|
-
export declare function Menu<T extends object>({ className, popoverClassName, placement, ...props }: MenuProps<T>): import("react").JSX.Element;
|
|
20
|
+
export declare function Menu<T extends object>({ className, popoverClassName, placement, footer, footerClassName, ...props }: MenuProps<T>): import("react").JSX.Element;
|
|
14
21
|
export interface MenuItemProps extends Omit<AriaMenuItemProps, 'className' | 'style' | 'children'> {
|
|
15
22
|
children?: ReactNode;
|
|
16
23
|
icon?: IconComponent;
|
|
24
|
+
/**
|
|
25
|
+
* Leading media instead of an icon, such as an avatar or an image, sized with the item: larger
|
|
26
|
+
* when the item has a description.
|
|
27
|
+
*/
|
|
28
|
+
media?: ReactNode;
|
|
17
29
|
description?: string;
|
|
18
30
|
/** Styles the item as destructive. */
|
|
19
31
|
isDanger?: boolean;
|
|
20
32
|
className?: string;
|
|
21
33
|
}
|
|
22
|
-
/**
|
|
23
|
-
|
|
34
|
+
/**
|
|
35
|
+
* An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,
|
|
36
|
+
* and the role of a radio (single) or a checkbox (multiple) item.
|
|
37
|
+
*/
|
|
38
|
+
export declare function MenuItem({ children, icon, media, description, isDanger, className, textValue, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
39
|
+
export interface MenuSectionProps<T extends object> extends Omit<AriaMenuSectionProps<T>, 'className' | 'style' | 'children' | 'items'> {
|
|
40
|
+
/**
|
|
41
|
+
* The header of the section, a small muted eyebrow above its items, such as "Publish on". It
|
|
42
|
+
* labels the group. Without it, give the section an `aria-label`.
|
|
43
|
+
*/
|
|
44
|
+
title?: ReactNode;
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
className?: string;
|
|
47
|
+
headerClassName?: string;
|
|
48
|
+
}
|
|
49
|
+
/** A group of items of a `Menu`, with a header. */
|
|
50
|
+
export declare function MenuSection<T extends object>({ title, children, className, headerClassName, ...props }: MenuSectionProps<T>): import("react").JSX.Element;
|
|
24
51
|
/** A line between groups of menu items. */
|
|
25
52
|
export declare function MenuSeparator(): import("react").JSX.Element;
|
|
26
53
|
export { MenuTrigger } from 'react-aria-components';
|
package/dist/menu/Menu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/menu/Menu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/menu/Menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAC9C,OAAO,EAGH,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,SAAS,IAAI,aAAa,EAE/B,KAAK,gBAAgB,IAAI,oBAAoB,EAIhD,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAMxD,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,EACnC,SAAS,EACT,gBAAgB,EAChB,SAA0B,EAC1B,MAAM,EACN,eAAe,EACf,GAAG,KAAK,EACX,EAAE,SAAS,CAAC,CAAC,CAAC,+BA4Bd;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;IAC9F,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACrB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACX,EAAE,aAAa,+BAkCf;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,IAAI,CAC5D,oBAAoB,CAAC,CAAC,CAAC,EACvB,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAC/C;IACG;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EAC1C,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,GAAG,KAAK,EACX,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BASrB;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,gCAE5B;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/menu/Menu.js
CHANGED
|
@@ -2,45 +2,130 @@ import { cx } from "../utils/cx.js";
|
|
|
2
2
|
import { Icon } from "../icon/Icon.js";
|
|
3
3
|
import { PopoverSurface } from "../popover/Popover.js";
|
|
4
4
|
import ListBox_module_default from "../select/ListBox.module.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import Menu_module_default from "./Menu.module.js";
|
|
6
|
+
import { Check } from "lucide-react";
|
|
7
|
+
import { Header, Menu, MenuItem, MenuSection, MenuTrigger, Separator, Text } from "react-aria-components";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useId } from "react";
|
|
7
10
|
import { c } from "react/compiler-runtime";
|
|
8
11
|
//#region src/menu/Menu.tsx
|
|
9
12
|
/**
|
|
10
13
|
* A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move
|
|
11
|
-
* between items, and typing a letter jumps to an item.
|
|
14
|
+
* between items, and typing a letter jumps to an item. With `selectionMode` (`single` or
|
|
15
|
+
* `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.
|
|
12
16
|
*/
|
|
13
|
-
function Menu$1({ className, popoverClassName, placement = "bottom start", ...props }) {
|
|
17
|
+
function Menu$1({ className, popoverClassName, placement = "bottom start", footer, footerClassName, ...props }) {
|
|
18
|
+
const footerId = useId();
|
|
19
|
+
const hasFooter = footer !== void 0 && footer !== null;
|
|
20
|
+
const menu = /* @__PURE__ */ jsx(Menu, {
|
|
21
|
+
...props,
|
|
22
|
+
"aria-describedby": hasFooter ? [props["aria-describedby"], footerId].filter(Boolean).join(" ") : props["aria-describedby"],
|
|
23
|
+
className: cx("panneau-menu", ListBox_module_default.listBox, className)
|
|
24
|
+
});
|
|
14
25
|
return /* @__PURE__ */ jsx(PopoverSurface, {
|
|
15
26
|
placement,
|
|
16
27
|
className: popoverClassName,
|
|
17
|
-
children: /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
children: hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: Menu_module_default.layout,
|
|
30
|
+
children: [menu, /* @__PURE__ */ jsx("div", {
|
|
31
|
+
id: footerId,
|
|
32
|
+
className: cx(Menu_module_default.footer, footerClassName),
|
|
33
|
+
children: footer
|
|
34
|
+
})]
|
|
35
|
+
}) : menu
|
|
21
36
|
});
|
|
22
37
|
}
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
/**
|
|
39
|
+
* An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,
|
|
40
|
+
* and the role of a radio (single) or a checkbox (multiple) item.
|
|
41
|
+
*/
|
|
42
|
+
function MenuItem$1({ children, icon, media, description, isDanger = false, className, textValue, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
26
44
|
...props,
|
|
27
45
|
textValue: textValue ?? (typeof children === "string" ? children : void 0),
|
|
28
|
-
className: cx("panneau-menu-item", ListBox_module_default.item, className),
|
|
46
|
+
className: cx("panneau-menu-item", ListBox_module_default.item, Menu_module_default.item, className),
|
|
29
47
|
"data-danger": isDanger || void 0,
|
|
30
|
-
children:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
children: ({ isSelected, selectionMode }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
media !== void 0 && media !== null ? /* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: Menu_module_default.media,
|
|
51
|
+
children: media
|
|
52
|
+
}) : icon !== void 0 ? /* @__PURE__ */ jsx(Icon, { icon }) : null,
|
|
53
|
+
/* @__PURE__ */ jsxs("span", {
|
|
54
|
+
className: ListBox_module_default.itemText,
|
|
55
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
56
|
+
slot: "label",
|
|
57
|
+
className: ListBox_module_default.itemLabel,
|
|
58
|
+
children
|
|
59
|
+
}), description !== void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
60
|
+
slot: "description",
|
|
61
|
+
className: ListBox_module_default.itemDescription,
|
|
62
|
+
children: description
|
|
63
|
+
}) : null]
|
|
64
|
+
}),
|
|
65
|
+
selectionMode !== "none" ? /* @__PURE__ */ jsx("span", {
|
|
66
|
+
className: Menu_module_default.check,
|
|
67
|
+
children: isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
68
|
+
icon: Check,
|
|
69
|
+
size: "sm"
|
|
70
|
+
}) : null
|
|
71
|
+
}) : null
|
|
72
|
+
] })
|
|
42
73
|
});
|
|
43
74
|
}
|
|
75
|
+
/** A group of items of a `Menu`, with a header. */
|
|
76
|
+
function MenuSection$1(t0) {
|
|
77
|
+
const $ = c(16);
|
|
78
|
+
let children;
|
|
79
|
+
let className;
|
|
80
|
+
let headerClassName;
|
|
81
|
+
let props;
|
|
82
|
+
let title;
|
|
83
|
+
if ($[0] !== t0) {
|
|
84
|
+
({title, children, className, headerClassName, ...props} = t0);
|
|
85
|
+
$[0] = t0;
|
|
86
|
+
$[1] = children;
|
|
87
|
+
$[2] = className;
|
|
88
|
+
$[3] = headerClassName;
|
|
89
|
+
$[4] = props;
|
|
90
|
+
$[5] = title;
|
|
91
|
+
} else {
|
|
92
|
+
children = $[1];
|
|
93
|
+
className = $[2];
|
|
94
|
+
headerClassName = $[3];
|
|
95
|
+
props = $[4];
|
|
96
|
+
title = $[5];
|
|
97
|
+
}
|
|
98
|
+
let t1;
|
|
99
|
+
if ($[6] !== className) {
|
|
100
|
+
t1 = cx(Menu_module_default.section, className);
|
|
101
|
+
$[6] = className;
|
|
102
|
+
$[7] = t1;
|
|
103
|
+
} else t1 = $[7];
|
|
104
|
+
let t2;
|
|
105
|
+
if ($[8] !== headerClassName || $[9] !== title) {
|
|
106
|
+
t2 = title !== void 0 && title !== null ? /* @__PURE__ */ jsx(Header, {
|
|
107
|
+
className: cx(Menu_module_default.header, headerClassName),
|
|
108
|
+
children: title
|
|
109
|
+
}) : null;
|
|
110
|
+
$[8] = headerClassName;
|
|
111
|
+
$[9] = title;
|
|
112
|
+
$[10] = t2;
|
|
113
|
+
} else t2 = $[10];
|
|
114
|
+
let t3;
|
|
115
|
+
if ($[11] !== children || $[12] !== props || $[13] !== t1 || $[14] !== t2) {
|
|
116
|
+
t3 = /* @__PURE__ */ jsxs(MenuSection, {
|
|
117
|
+
...props,
|
|
118
|
+
className: t1,
|
|
119
|
+
children: [t2, children]
|
|
120
|
+
});
|
|
121
|
+
$[11] = children;
|
|
122
|
+
$[12] = props;
|
|
123
|
+
$[13] = t1;
|
|
124
|
+
$[14] = t2;
|
|
125
|
+
$[15] = t3;
|
|
126
|
+
} else t3 = $[15];
|
|
127
|
+
return t3;
|
|
128
|
+
}
|
|
44
129
|
/** A line between groups of menu items. */
|
|
45
130
|
function MenuSeparator() {
|
|
46
131
|
const $ = c(1);
|
|
@@ -52,6 +137,6 @@ function MenuSeparator() {
|
|
|
52
137
|
return t0;
|
|
53
138
|
}
|
|
54
139
|
//#endregion
|
|
55
|
-
export { Menu$1 as Menu, MenuItem$1 as MenuItem, MenuSeparator, MenuTrigger };
|
|
140
|
+
export { Menu$1 as Menu, MenuItem$1 as MenuItem, MenuSection$1 as MenuSection, MenuSeparator, MenuTrigger };
|
|
56
141
|
|
|
57
142
|
//# sourceMappingURL=Menu.js.map
|
package/dist/menu/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","names":["Menu","AriaMenu","styles","MenuItem","AriaMenuItem","_c"],"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Menu.js","names":["title","children","Menu","AriaMenu","listBoxStyles","styles","MenuItem","AriaMenuItem","_Fragment","MenuSection","_c","AriaMenuSection"],"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["import { Check } from 'lucide-react';\nimport { type ReactNode, useId } from 'react';\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n type MenuItemProps as AriaMenuItemProps,\n type MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n type MenuSectionProps as AriaMenuSectionProps,\n Header,\n Separator,\n Text,\n} from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { PopoverSurface } from '../popover/Popover';\nimport listBoxStyles from '../select/ListBox.module.css';\nimport { cx } from '../utils/cx';\nimport styles from './Menu.module.css';\n\nexport interface MenuProps<T extends object> extends Omit<AriaMenuProps<T>, 'className' | 'style'> {\n className?: string;\n popoverClassName?: string;\n placement?: 'bottom start' | 'bottom end' | 'top start' | 'top end';\n /**\n * A short note under the items, after a line, such as \"Only this step changes.\". It isn't an\n * item and can't be focused: the menu is described by it.\n */\n footer?: ReactNode;\n footerClassName?: string;\n}\n\n/**\n * A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move\n * between items, and typing a letter jumps to an item. With `selectionMode` (`single` or\n * `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.\n */\nexport function Menu<T extends object>({\n className,\n popoverClassName,\n placement = 'bottom start',\n footer,\n footerClassName,\n ...props\n}: MenuProps<T>) {\n const footerId = useId();\n const hasFooter = footer !== undefined && footer !== null;\n const menu = (\n <AriaMenu\n {...props}\n aria-describedby={\n hasFooter\n ? [props['aria-describedby'], footerId].filter(Boolean).join(' ')\n : props['aria-describedby']\n }\n className={cx('panneau-menu', listBoxStyles.listBox, className)}\n />\n );\n return (\n <PopoverSurface placement={placement} className={popoverClassName}>\n {hasFooter ? (\n <div className={styles.layout}>\n {menu}\n <div id={footerId} className={cx(styles.footer, footerClassName)}>\n {footer}\n </div>\n </div>\n ) : (\n menu\n )}\n </PopoverSurface>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'className' | 'style' | 'children'> {\n children?: ReactNode;\n icon?: IconComponent;\n /**\n * Leading media instead of an icon, such as an avatar or an image, sized with the item: larger\n * when the item has a description.\n */\n media?: ReactNode;\n description?: string;\n /** Styles the item as destructive. */\n isDanger?: boolean;\n className?: string;\n}\n\n/**\n * An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,\n * and the role of a radio (single) or a checkbox (multiple) item.\n */\nexport function MenuItem({\n children,\n icon,\n media,\n description,\n isDanger = false,\n className,\n textValue,\n ...props\n}: MenuItemProps) {\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue ?? (typeof children === 'string' ? children : undefined)}\n className={cx('panneau-menu-item', listBoxStyles.item, styles.item, className)}\n data-danger={isDanger || undefined}\n >\n {({ isSelected, selectionMode }) => (\n <>\n {media !== undefined && media !== null ? (\n <span className={styles.media}>{media}</span>\n ) : icon !== undefined ? (\n <Icon icon={icon} />\n ) : null}\n <span className={listBoxStyles.itemText}>\n <Text slot=\"label\" className={listBoxStyles.itemLabel}>\n {children}\n </Text>\n {description !== undefined ? (\n <Text slot=\"description\" className={listBoxStyles.itemDescription}>\n {description}\n </Text>\n ) : null}\n </span>\n {selectionMode !== 'none' ? (\n <span className={styles.check}>\n {isSelected ? <Icon icon={Check} size=\"sm\" /> : null}\n </span>\n ) : null}\n </>\n )}\n </AriaMenuItem>\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends Omit<\n AriaMenuSectionProps<T>,\n 'className' | 'style' | 'children' | 'items'\n> {\n /**\n * The header of the section, a small muted eyebrow above its items, such as \"Publish on\". It\n * labels the group. Without it, give the section an `aria-label`.\n */\n title?: ReactNode;\n children?: ReactNode;\n className?: string;\n headerClassName?: string;\n}\n\n/** A group of items of a `Menu`, with a header. */\nexport function MenuSection<T extends object>({\n title,\n children,\n className,\n headerClassName,\n ...props\n}: MenuSectionProps<T>) {\n return (\n <AriaMenuSection {...props} className={cx(styles.section, className)}>\n {title !== undefined && title !== null ? (\n <Header className={cx(styles.header, headerClassName)}>{title}</Header>\n ) : null}\n {children}\n </AriaMenuSection>\n );\n}\n\n/** A line between groups of menu items. */\nexport function MenuSeparator() {\n return <Separator className={listBoxStyles.separator} />;\n}\n\nexport { MenuTrigger } from 'react-aria-components';\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAgBE,OAAuB,EACnC,WACA,kBACA,YAAY,gBACZ,QACA,iBACA,GAAG,SACU;CACb,MAAM,WAAW,MAAM;CACvB,MAAM,YAAY,WAAW,KAAA,KAAa,WAAW;CACrD,MAAM,OACF,oB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K1B,SAAO,gBAAA;CAAA,MAAA,IAAAD,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACI,KAAA,oBAAC,WAAD,EAAsB,WAAAN,uBAAa,UAAU,CAAA;EAAI,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAjD;AAAiD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./Menu.css";
|
|
2
|
+
//#region src/menu/Menu.module.css
|
|
3
|
+
var layout = "panneau-menu-layout";
|
|
4
|
+
var section = "panneau-menu-section";
|
|
5
|
+
var header = "panneau-menu-header";
|
|
6
|
+
var footer = "panneau-menu-footer";
|
|
7
|
+
var media = "panneau-menu-media";
|
|
8
|
+
var item = "panneau-menu-item";
|
|
9
|
+
var check = "panneau-menu-check";
|
|
10
|
+
var Menu_module_default = {
|
|
11
|
+
layout,
|
|
12
|
+
section,
|
|
13
|
+
header,
|
|
14
|
+
footer,
|
|
15
|
+
media,
|
|
16
|
+
item,
|
|
17
|
+
check
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { check, Menu_module_default as default, footer, header, item, layout, media, section };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=Menu.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.module.js","names":[],"sources":["../../src/menu/Menu.module.css"],"sourcesContent":["/* Parts of menus on top of the options of ListBox.module.css: sections, footer, media, selection. */\n\n/* A menu with a footer: the items scroll, the footer stays under them. */\n.layout {\n display: flex;\n flex-direction: column;\n max-height: inherit;\n}\n\n.layout > [role='menu'] {\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.section + .section {\n margin-top: var(--panneau-space-1);\n}\n\n.header {\n padding: var(--panneau-space-2) var(--panneau-list-box-item-padding-x, var(--panneau-space-2))\n var(--panneau-space-1);\n font-size: var(--panneau-menu-header-font-size, var(--panneau-font-size-xs));\n font-weight: var(--panneau-menu-header-font-weight, var(--panneau-font-weight-medium));\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-menu-header-color, var(--panneau-color-text-muted));\n text-transform: var(--panneau-menu-header-text-transform, uppercase);\n letter-spacing: var(--panneau-menu-header-letter-spacing, 0.04em);\n}\n\n.footer {\n flex: 0 0 auto;\n padding: var(--panneau-space-2)\n calc(\n var(--panneau-list-box-padding, var(--panneau-space-1)) +\n var(--panneau-list-box-item-padding-x, var(--panneau-space-2))\n );\n font-size: var(--panneau-menu-footer-font-size, var(--panneau-font-size-xs));\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-menu-footer-color, var(--panneau-color-text-muted));\n border-top: var(--panneau-border-width) solid var(--panneau-color-border);\n}\n\n.media {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: var(--panneau-menu-media-size, 1.5rem);\n height: var(--panneau-menu-media-size, 1.5rem);\n overflow: hidden;\n border-radius: var(--panneau-menu-media-radius, var(--panneau-radius-full));\n}\n\n.item:has([slot='description']) .media {\n width: var(--panneau-menu-media-size-described, 2rem);\n height: var(--panneau-menu-media-size-described, 2rem);\n}\n\n.media > :is(img, svg, video, picture) {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n/* The check of a selected item, at its end. */\n.check {\n display: inline-flex;\n flex: 0 0 auto;\n justify-content: flex-end;\n width: 1rem;\n color: var(--panneau-color-text);\n}\n\n.item[data-selected] {\n background-color: var(--panneau-menu-item-bg-selected, var(--panneau-color-surface-sunken));\n}\n\n/* A focused or hovered selected item: the hover color over the selected background. */\n.item[data-selected]:is([data-focused], [data-hovered]) {\n background-image: linear-gradient(\n var(--panneau-list-box-item-bg-hover, var(--panneau-color-hover)),\n var(--panneau-list-box-item-bg-hover, var(--panneau-color-hover))\n );\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Tokens of Menu: its sections, its footer, and the media and selection of its items. */
|
|
2
|
+
export declare const menuTokens: import("..").ComponentTokens<"menu", "panneau-menu-header-font-size" | "panneau-menu-header-font-weight" | "panneau-menu-header-color" | "panneau-menu-header-text-transform" | "panneau-menu-header-letter-spacing" | "panneau-menu-footer-font-size" | "panneau-menu-footer-color" | "panneau-menu-media-size" | "panneau-menu-media-size-described" | "panneau-menu-media-radius" | "panneau-menu-item-bg-selected">;
|
|
3
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/menu/tokens.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,eAAO,MAAM,UAAU,yZAuBrB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineComponentTokens } from "../theme/componentTokens.js";
|
|
2
|
+
//#region src/menu/tokens.ts
|
|
3
|
+
/** Tokens of Menu: its sections, its footer, and the media and selection of its items. */
|
|
4
|
+
var menuTokens = defineComponentTokens("menu", {
|
|
5
|
+
/** Font size of the header of a section. */
|
|
6
|
+
"header-font-size": "var(--panneau-font-size-xs)",
|
|
7
|
+
/** Font weight of the header of a section. */
|
|
8
|
+
"header-font-weight": "var(--panneau-font-weight-medium)",
|
|
9
|
+
/** Color of the header of a section. */
|
|
10
|
+
"header-color": "var(--panneau-color-text-muted)",
|
|
11
|
+
/** Case of the header of a section: `uppercase` makes it an eyebrow, `none` keeps its text. */
|
|
12
|
+
"header-text-transform": "uppercase",
|
|
13
|
+
/** Letter spacing of the header of a section. */
|
|
14
|
+
"header-letter-spacing": "0.04em",
|
|
15
|
+
/** Font size of the footer note. */
|
|
16
|
+
"footer-font-size": "var(--panneau-font-size-xs)",
|
|
17
|
+
/** Color of the footer note. */
|
|
18
|
+
"footer-color": "var(--panneau-color-text-muted)",
|
|
19
|
+
/** Size of the leading media of an item. */
|
|
20
|
+
"media-size": "1.5rem",
|
|
21
|
+
/** Size of the leading media of an item with a description, on two lines. */
|
|
22
|
+
"media-size-described": "2rem",
|
|
23
|
+
/** Corner radius of the leading media of an item: its content is clipped to it. */
|
|
24
|
+
"media-radius": "var(--panneau-radius-full)",
|
|
25
|
+
/** Background of a selected item. */
|
|
26
|
+
"item-bg-selected": "var(--panneau-color-surface-sunken)"
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { menuTokens };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/menu/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Menu: its sections, its footer, and the media and selection of its items. */\nexport const menuTokens = defineComponentTokens('menu', {\n /** Font size of the header of a section. */\n 'header-font-size': 'var(--panneau-font-size-xs)',\n /** Font weight of the header of a section. */\n 'header-font-weight': 'var(--panneau-font-weight-medium)',\n /** Color of the header of a section. */\n 'header-color': 'var(--panneau-color-text-muted)',\n /** Case of the header of a section: `uppercase` makes it an eyebrow, `none` keeps its text. */\n 'header-text-transform': 'uppercase',\n /** Letter spacing of the header of a section. */\n 'header-letter-spacing': '0.04em',\n /** Font size of the footer note. */\n 'footer-font-size': 'var(--panneau-font-size-xs)',\n /** Color of the footer note. */\n 'footer-color': 'var(--panneau-color-text-muted)',\n /** Size of the leading media of an item. */\n 'media-size': '1.5rem',\n /** Size of the leading media of an item with a description, on two lines. */\n 'media-size-described': '2rem',\n /** Corner radius of the leading media of an item: its content is clipped to it. */\n 'media-radius': 'var(--panneau-radius-full)',\n /** Background of a selected item. */\n 'item-bg-selected': 'var(--panneau-color-surface-sunken)',\n});\n"],"mappings":";;;AAGA,IAAa,aAAa,sBAAsB,QAAQ;;CAEpD,oBAAoB;;CAEpB,sBAAsB;;CAEtB,gBAAgB;;CAEhB,yBAAyB;;CAEzB,yBAAyB;;CAEzB,oBAAoB;;CAEpB,gBAAgB;;CAEhB,cAAc;;CAEd,wBAAwB;;CAExB,gBAAgB;;CAEhB,oBAAoB;AACxB,CAAC"}
|
|
@@ -3,10 +3,24 @@
|
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
/* Without steppers, the control has its padding back. */
|
|
7
|
+
.panneau-number-input-control.panneau-number-input-control[data-readonly] {
|
|
8
|
+
padding-inline-end: var(--panneau-input-padding-x, var(--panneau-control-padding-x));
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
.panneau-number-input-input {
|
|
7
12
|
font-variant-numeric: var(--panneau-font-numeric);
|
|
8
13
|
}
|
|
9
14
|
|
|
15
|
+
/* The suffix sits between the value and the steppers, which have no padding of their own. */
|
|
16
|
+
.panneau-number-input-suffix.panneau-number-input-suffix {
|
|
17
|
+
margin-inline: var(--panneau-space-2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.panneau-number-input-control[data-readonly] .panneau-number-input-suffix {
|
|
21
|
+
margin-inline-end: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
.panneau-number-input-steppers {
|
|
11
25
|
display: flex;
|
|
12
26
|
flex-direction: column;
|
|
@@ -54,4 +68,8 @@
|
|
|
54
68
|
.panneau-number-input-control.panneau-number-input-control {
|
|
55
69
|
padding-inline-end: var(--panneau-space-3);
|
|
56
70
|
}
|
|
71
|
+
|
|
72
|
+
.panneau-number-input-suffix.panneau-number-input-suffix {
|
|
73
|
+
margin-inline-end: 0;
|
|
74
|
+
}
|
|
57
75
|
}
|
|
@@ -42,7 +42,7 @@ function NumberInput({ label, description, errors = [], value, defaultValue, onC
|
|
|
42
42
|
className: cx(Field_module_default.bare, NumberInput_module_default.input, inputClassName)
|
|
43
43
|
}),
|
|
44
44
|
suffix !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
45
|
-
className: Field_module_default.adornment,
|
|
45
|
+
className: cx(Field_module_default.adornment, NumberInput_module_default.suffix),
|
|
46
46
|
children: suffix
|
|
47
47
|
}) : null,
|
|
48
48
|
isReadOnly !== true ? /* @__PURE__ */ jsxs("span", {
|