@manakind/ui-core 0.17.1 → 0.19.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/README.md +6 -2
- package/dist/avatar/avatar.css +42 -0
- package/dist/avatar/avatar.css.d.ts +2 -0
- package/dist/avatar/avatar.d.ts +55 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +41 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/index.js.map +1 -0
- package/dist/combobox/combobox.css +155 -0
- package/dist/combobox/combobox.css.d.ts +2 -0
- package/dist/combobox/combobox.d.ts +84 -0
- package/dist/combobox/combobox.d.ts.map +1 -0
- package/dist/combobox/combobox.js +70 -0
- package/dist/combobox/combobox.js.map +1 -0
- package/dist/combobox/index.d.ts +3 -0
- package/dist/combobox/index.d.ts.map +1 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/menu/action-menu.d.ts +120 -0
- package/dist/menu/action-menu.d.ts.map +1 -0
- package/dist/menu/action-menu.js +80 -0
- package/dist/menu/action-menu.js.map +1 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +1 -0
- package/dist/menu/index.js.map +1 -1
- package/dist/menu/menu.css +62 -8
- package/dist/menu/menu.d.ts +1 -1
- package/dist/menu/menu.d.ts.map +1 -1
- package/dist/menu/menu.js +1 -1
- package/dist/menu/menu.js.map +1 -1
- package/package.json +18 -2
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ separately, so an app can load only what it renders.
|
|
|
58
58
|
|---|---|
|
|
59
59
|
| `@manakind/ui-core` | Everything below, plus every prop type, the `cx` helper, and the built-in fallback glyphs (`FallbackChevronLeft`, `FallbackChevronRight`, `FallbackCheck`, `FallbackCross`) for compositions that want the same defaults |
|
|
60
60
|
| `@manakind/ui-core/alert` | `Alert` |
|
|
61
|
+
| `@manakind/ui-core/avatar` | `Avatar` + `initialsOf` |
|
|
61
62
|
| `@manakind/ui-core/badge` | `Badge` |
|
|
62
63
|
| `@manakind/ui-core/button` | `Button` + `IconButton` |
|
|
63
64
|
| `@manakind/ui-core/calendar` | `Calendar` |
|
|
@@ -65,9 +66,10 @@ separately, so an app can load only what it renders.
|
|
|
65
66
|
| `@manakind/ui-core/dialog` | `Dialog` + `DialogClose` |
|
|
66
67
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
67
68
|
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
68
|
-
| `@manakind/ui-core/menu` | `Menu`, `MenuTrigger` |
|
|
69
|
+
| `@manakind/ui-core/menu` | `Menu`, `MenuTrigger`, `ActionMenu` |
|
|
69
70
|
| `@manakind/ui-core/popover` | `Popover` |
|
|
70
71
|
| `@manakind/ui-core/checkbox` | `Checkbox` |
|
|
72
|
+
| `@manakind/ui-core/combobox` | `Combobox` |
|
|
71
73
|
| `@manakind/ui-core/date-input` | `DateInput` |
|
|
72
74
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
73
75
|
| `@manakind/ui-core/reorder-control` | `ReorderControl` |
|
|
@@ -77,6 +79,7 @@ separately, so an app can load only what it renders.
|
|
|
77
79
|
| `@manakind/ui-core/field` | `Field`, `Input`, `Textarea`, `useFieldControl` |
|
|
78
80
|
| `@manakind/ui-core/tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` |
|
|
79
81
|
| `@manakind/ui-core/css/alert` | Alert structural CSS; its icon also needs `css/icon` |
|
|
82
|
+
| `@manakind/ui-core/css/avatar` | Avatar structural CSS; its fallback glyph also needs `css/icon` |
|
|
80
83
|
| `@manakind/ui-core/css/badge` | Badge structural CSS |
|
|
81
84
|
| `@manakind/ui-core/css/button` | Button + IconButton structural CSS |
|
|
82
85
|
| `@manakind/ui-core/css/calendar` | Calendar structural CSS; its paging buttons also need `css/button` and `css/icon` |
|
|
@@ -84,9 +87,10 @@ separately, so an app can load only what it renders.
|
|
|
84
87
|
| `@manakind/ui-core/css/dialog` | Dialog structural CSS; its close button also needs `css/button` and `css/icon` |
|
|
85
88
|
| `@manakind/ui-core/css/icon` | Icon structural CSS |
|
|
86
89
|
| `@manakind/ui-core/css/illustration` | Illustration structural CSS, including the paint roles |
|
|
87
|
-
| `@manakind/ui-core/css/menu` | Menu structural CSS |
|
|
90
|
+
| `@manakind/ui-core/css/menu` | Menu and ActionMenu structural CSS; an ActionMenu's glyphs also need `css/icon` |
|
|
88
91
|
| `@manakind/ui-core/css/popover` | Popover structural CSS |
|
|
89
92
|
| `@manakind/ui-core/css/checkbox` | Checkbox structural CSS |
|
|
93
|
+
| `@manakind/ui-core/css/combobox` | Combobox structural CSS |
|
|
90
94
|
| `@manakind/ui-core/css/date-input` | DateInput structural CSS |
|
|
91
95
|
| `@manakind/ui-core/css/progress` | Progress structural CSS |
|
|
92
96
|
| `@manakind/ui-core/css/reorder-control` | ReorderControl structural CSS; its handle and input also need `css/button`, `css/icon` and `css/field` |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-avatar {
|
|
3
|
+
/*
|
|
4
|
+
* Explicit, as Badge's is: the size keys measure the whole disc, border
|
|
5
|
+
* included, or the border stacks on top and the disc outgrows its token.
|
|
6
|
+
*/
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
/*
|
|
12
|
+
* A disc beside a name in a flex row. It never gives: a long name wraps
|
|
13
|
+
* or truncates on its own terms, and the disc keeps its diameter.
|
|
14
|
+
*/
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
inline-size: var(--ds-avatar-size-md);
|
|
17
|
+
block-size: var(--ds-avatar-size-md);
|
|
18
|
+
border: 1px solid var(--ds-avatar-border);
|
|
19
|
+
border-radius: var(--ds-avatar-radius);
|
|
20
|
+
background-color: var(--ds-avatar-bg);
|
|
21
|
+
color: var(--ds-avatar-text);
|
|
22
|
+
font-size: var(--ds-avatar-font-size-md);
|
|
23
|
+
font-weight: var(--ds-avatar-font-weight);
|
|
24
|
+
line-height: inherit;
|
|
25
|
+
/* Two letters, never a word: nothing here can wrap, so the box clips instead. */
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
overflow-wrap: anywhere;
|
|
28
|
+
user-select: none;
|
|
29
|
+
|
|
30
|
+
&.ds-avatar--sm {
|
|
31
|
+
inline-size: var(--ds-avatar-size-sm);
|
|
32
|
+
block-size: var(--ds-avatar-size-sm);
|
|
33
|
+
font-size: var(--ds-avatar-font-size-sm);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.ds-avatar--lg {
|
|
37
|
+
inline-size: var(--ds-avatar-size-lg);
|
|
38
|
+
block-size: var(--ds-avatar-size-lg);
|
|
39
|
+
font-size: var(--ds-avatar-font-size-lg);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { type IconSource } from '../icon/icon';
|
|
3
|
+
import './avatar.css';
|
|
4
|
+
export type AvatarSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/**
|
|
6
|
+
* An avatar beside the name it stands for is decorative; one standing alone,
|
|
7
|
+
* such as the content of a menu trigger whose button has no name of its
|
|
8
|
+
* own, needs a label. The pairing is a compile error rather than a
|
|
9
|
+
* convention, mirroring `IconProps`.
|
|
10
|
+
*/
|
|
11
|
+
type AvatarA11y = {
|
|
12
|
+
label: string;
|
|
13
|
+
decorative?: never;
|
|
14
|
+
} | {
|
|
15
|
+
decorative: true;
|
|
16
|
+
label?: never;
|
|
17
|
+
};
|
|
18
|
+
export type AvatarProps = Omit<ComponentProps<'span'>, 'children' | 'aria-label' | 'aria-hidden' | 'role'> & AvatarA11y & {
|
|
19
|
+
/**
|
|
20
|
+
* The person's name. The avatar shows its initials: the first letter of
|
|
21
|
+
* the first and last words, or the first two letters of a single word.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
/**
|
|
25
|
+
* Glyph shown when the name yields no initials, such as a person glyph for
|
|
26
|
+
* an account without a name. Decorative; without it the avatar is a bare
|
|
27
|
+
* disc.
|
|
28
|
+
*/
|
|
29
|
+
icon?: IconSource;
|
|
30
|
+
/** `sm` fits a toolbar, `md` a row, `lg` a profile heading. */
|
|
31
|
+
size?: AvatarSize;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The letters an `Avatar` shows for a name: the first letter of the first
|
|
35
|
+
* and last words ("Pål Taule Brentebråten" → "PB"), the first two letters of
|
|
36
|
+
* a single word ("Manuia" → "MA"), nothing for an empty name. Upper-cased
|
|
37
|
+
* with the runtime's locale rules, so an initial that changes case by
|
|
38
|
+
* length comes out right.
|
|
39
|
+
*/
|
|
40
|
+
export declare function initialsOf(name: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* A person, as initials in a disc.
|
|
43
|
+
*
|
|
44
|
+
* Renders a `span`. Labelled, it is `role="img"` named by `label`; decorative,
|
|
45
|
+
* it is hidden from assistive technology and the text beside it carries the
|
|
46
|
+
* name. The look comes from the `--ds-avatar-*` keys.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Avatar name={user.name} icon={PersonGlyph} decorative />
|
|
50
|
+
* <span>{user.name}</span>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function Avatar({ name, icon, size, label, decorative, className, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAEtB,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C;;;;;GAKG;AACH,KAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9F,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,cAAc,CAAC,MAAM,CAAC,EACtB,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,MAAM,CACnD,GACC,UAAU,GAAG;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEJ;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,IAAI,EACJ,IAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CAUb"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from '../cx';
|
|
3
|
+
import { Icon } from '../icon/icon';
|
|
4
|
+
import './avatar.css';
|
|
5
|
+
/**
|
|
6
|
+
* The letters an `Avatar` shows for a name: the first letter of the first
|
|
7
|
+
* and last words ("Pål Taule Brentebråten" → "PB"), the first two letters of
|
|
8
|
+
* a single word ("Manuia" → "MA"), nothing for an empty name. Upper-cased
|
|
9
|
+
* with the runtime's locale rules, so an initial that changes case by
|
|
10
|
+
* length comes out right.
|
|
11
|
+
*/
|
|
12
|
+
export function initialsOf(name) {
|
|
13
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
14
|
+
const first = words[0];
|
|
15
|
+
if (first === undefined)
|
|
16
|
+
return '';
|
|
17
|
+
const last = words.length > 1 ? words[words.length - 1] : undefined;
|
|
18
|
+
const letters = last === undefined
|
|
19
|
+
? Array.from(first).slice(0, 2)
|
|
20
|
+
: [Array.from(first)[0], Array.from(last)[0]];
|
|
21
|
+
return letters.join('').toLocaleUpperCase();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A person, as initials in a disc.
|
|
25
|
+
*
|
|
26
|
+
* Renders a `span`. Labelled, it is `role="img"` named by `label`; decorative,
|
|
27
|
+
* it is hidden from assistive technology and the text beside it carries the
|
|
28
|
+
* name. The look comes from the `--ds-avatar-*` keys.
|
|
29
|
+
*
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Avatar name={user.name} icon={PersonGlyph} decorative />
|
|
32
|
+
* <span>{user.name}</span>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function Avatar({ name, icon, size = 'md', label, decorative, className, ...props }) {
|
|
36
|
+
const initials = initialsOf(name);
|
|
37
|
+
const fallback = icon ? _jsx(Icon, { source: icon, size: size, decorative: true }) : null;
|
|
38
|
+
const a11y = decorative ? { 'aria-hidden': true } : { role: 'img', 'aria-label': label };
|
|
39
|
+
return (_jsx("span", { className: cx('ds-avatar', `ds-avatar--${size}`, className), ...a11y, ...props, children: initials || fallback }));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":";AAC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AAE,IAAI,EAAE,UAAU,SAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAEzF,OAAO,CACL,eAAM,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,cAAc,IAAI,EAAE,EAAE,SAAS,CAAC,KAAM,IAAI,KAAM,KAAK,YACnF,QAAQ,IAAI,QAAQ,GAChB,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/avatar/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/avatar/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* The list renders in a portal, so it is not a descendant of `.ds-combobox`
|
|
4
|
+
* and is styled at the top level. It reads the `--ds-select-*` keys: an
|
|
5
|
+
* open list of options is the same surface whichever control opened it.
|
|
6
|
+
*
|
|
7
|
+
* Ark marks the closed list with `hidden`; any author `display` beats the
|
|
8
|
+
* UA's `[hidden] { display: none }`, so the pair below stays together (the
|
|
9
|
+
* same trap `select.css` documents).
|
|
10
|
+
*/
|
|
11
|
+
.ds-combobox__content[hidden] {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-combobox__content {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
padding: var(--ds-select-content-padding);
|
|
19
|
+
border: 1px solid var(--ds-select-content-border);
|
|
20
|
+
border-radius: var(--ds-select-content-radius);
|
|
21
|
+
background-color: var(--ds-select-content-bg);
|
|
22
|
+
max-height: 20rem;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
overflow-wrap: anywhere;
|
|
25
|
+
/* The `popup` layer in ds-config/scripts/stacking.ts, as Select's list. */
|
|
26
|
+
z-index: 60;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-combobox__item {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
padding: var(--ds-select-item-padding-block) var(--ds-select-item-padding-inline);
|
|
33
|
+
/* Nested radius, derived the same way as Select's items. */
|
|
34
|
+
border-radius: max(
|
|
35
|
+
0px,
|
|
36
|
+
calc(var(--ds-select-content-radius) - var(--ds-select-content-padding) - 1px)
|
|
37
|
+
);
|
|
38
|
+
color: var(--ds-select-item-text);
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
|
|
41
|
+
&[data-highlighted] {
|
|
42
|
+
background-color: var(--ds-select-item-bg-highlighted);
|
|
43
|
+
color: var(--ds-select-item-text-highlighted);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-disabled] {
|
|
47
|
+
opacity: var(--ds-opacity-disabled);
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-combobox__item-description {
|
|
53
|
+
color: var(--ds-field-hint-text);
|
|
54
|
+
font-size: var(--ds-field-hint-font-size);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* A highlighted row takes the highlighted text colour, which the hint
|
|
59
|
+
* colour was never measured against; the description follows the row.
|
|
60
|
+
*/
|
|
61
|
+
.ds-combobox__item[data-highlighted] .ds-combobox__item-description {
|
|
62
|
+
color: inherit;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-combobox__empty {
|
|
66
|
+
padding: var(--ds-select-item-padding-block) var(--ds-select-item-padding-inline);
|
|
67
|
+
color: var(--ds-field-hint-text);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-combobox {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: var(--ds-field-gap);
|
|
74
|
+
overflow-wrap: anywhere;
|
|
75
|
+
|
|
76
|
+
& .ds-combobox__label {
|
|
77
|
+
color: var(--ds-field-label-text);
|
|
78
|
+
font-size: var(--ds-field-label-font-size);
|
|
79
|
+
font-weight: var(--ds-field-label-font-weight);
|
|
80
|
+
|
|
81
|
+
&[data-disabled] {
|
|
82
|
+
opacity: var(--ds-opacity-disabled);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* The input is `Input`'s: the same keys and the same state signals. */
|
|
87
|
+
& .ds-combobox__input {
|
|
88
|
+
display: block;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
width: 100%;
|
|
91
|
+
border: 1px solid var(--ds-input-border);
|
|
92
|
+
border-radius: var(--ds-input-radius);
|
|
93
|
+
background-color: var(--ds-input-bg);
|
|
94
|
+
color: var(--ds-input-text);
|
|
95
|
+
font-family: inherit;
|
|
96
|
+
font-weight: inherit;
|
|
97
|
+
line-height: inherit;
|
|
98
|
+
transition:
|
|
99
|
+
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
100
|
+
border-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
101
|
+
box-shadow 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
102
|
+
|
|
103
|
+
&::placeholder {
|
|
104
|
+
color: var(--ds-input-placeholder);
|
|
105
|
+
opacity: 100%;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&[data-invalid] {
|
|
109
|
+
border-color: var(--ds-input-border-invalid);
|
|
110
|
+
box-shadow: 0 0 0 1px var(--ds-input-border-invalid);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:hover:not(:disabled) {
|
|
114
|
+
background-color: var(--ds-input-bg-hover);
|
|
115
|
+
|
|
116
|
+
&:not([data-invalid]) {
|
|
117
|
+
border-color: var(--ds-input-border-hover);
|
|
118
|
+
box-shadow: 0 0 0 1px var(--ds-input-border-hover);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:focus-visible {
|
|
123
|
+
outline: 2px solid var(--ds-input-focus-ring);
|
|
124
|
+
outline-offset: 3px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:disabled {
|
|
128
|
+
opacity: var(--ds-opacity-disabled);
|
|
129
|
+
cursor: not-allowed;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/*
|
|
134
|
+
* Single-line, so no block padding: like `Input`, the text centres in the
|
|
135
|
+
* control height, which keeps the field level with a Select beside it.
|
|
136
|
+
*/
|
|
137
|
+
&.ds-combobox--sm .ds-combobox__input {
|
|
138
|
+
min-height: var(--ds-input-size-sm-height);
|
|
139
|
+
padding-inline: var(--ds-input-size-sm-padding-inline);
|
|
140
|
+
font-size: var(--ds-input-size-sm-font-size);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&.ds-combobox--md .ds-combobox__input {
|
|
144
|
+
min-height: var(--ds-input-size-md-height);
|
|
145
|
+
padding-inline: var(--ds-input-size-md-padding-inline);
|
|
146
|
+
font-size: var(--ds-input-size-md-font-size);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.ds-combobox--lg .ds-combobox__input {
|
|
150
|
+
min-height: var(--ds-input-size-lg-height);
|
|
151
|
+
padding-inline: var(--ds-input-size-lg-padding-inline);
|
|
152
|
+
font-size: var(--ds-input-size-lg-font-size);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import './combobox.css';
|
|
3
|
+
export type ComboboxSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface ComboboxItem {
|
|
5
|
+
/** Stable value reported by `onSelect`. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Option text, also what typeahead and screen readers use. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Optional secondary line under the label, shown muted. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Individually disable this option without removing it. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ComboboxProps {
|
|
15
|
+
/**
|
|
16
|
+
* Suggestions for the current text.
|
|
17
|
+
*
|
|
18
|
+
* The caller filters them; the component does not. What counts as a match
|
|
19
|
+
* (a prefix, a substring, anything not already chosen) is the product's
|
|
20
|
+
* call, and the list it passes is the list that shows.
|
|
21
|
+
*/
|
|
22
|
+
items: ComboboxItem[];
|
|
23
|
+
/** Controlled text in the input. */
|
|
24
|
+
inputValue: string;
|
|
25
|
+
/** Fired with the new text on every keystroke, and with `''` after a choice. */
|
|
26
|
+
onInputValueChange: (value: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* A suggestion was chosen. The input then clears (`onInputValueChange('')`)
|
|
29
|
+
* and the field holds no value: this is the "add to a list" pattern. A
|
|
30
|
+
* field that keeps its choice is a `Select`.
|
|
31
|
+
*/
|
|
32
|
+
onSelect: (value: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Visible label. Strongly preferred over `aria-label` — a visible label
|
|
35
|
+
* helps everyone, not only screen reader users.
|
|
36
|
+
*/
|
|
37
|
+
label?: ReactNode;
|
|
38
|
+
/** Accessible name when no visible `label` is supplied. */
|
|
39
|
+
'aria-label'?: string;
|
|
40
|
+
/** Text shown in the empty input. */
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/** Shown in the open list when `items` is empty. */
|
|
43
|
+
emptyText?: ReactNode;
|
|
44
|
+
/** Control height and type scale. */
|
|
45
|
+
size?: ComboboxSize;
|
|
46
|
+
/** Disable the whole control. */
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/** Marks the field invalid for assistive tech and styling. */
|
|
49
|
+
invalid?: boolean;
|
|
50
|
+
/** Extra class names appended after `ds-combobox` modifiers. */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** The text input, for moving focus back to the field, e.g. after removing an item it added. */
|
|
53
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A text input that suggests options as you type, built on Ark UI.
|
|
57
|
+
*
|
|
58
|
+
* Choosing a suggestion reports it through `onSelect` and empties the input,
|
|
59
|
+
* so the field is ready for the next one: the control for adding items to a
|
|
60
|
+
* list one at a time. It never holds a selection itself; the caller keeps
|
|
61
|
+
* the list. For a field that keeps one choice, use `Select`.
|
|
62
|
+
*
|
|
63
|
+
* Ark owns the combobox semantics, keyboard navigation (the first suggestion
|
|
64
|
+
* is highlighted as you type, so Enter takes it) and dismiss behaviour. This
|
|
65
|
+
* wrapper contributes `ds-` classes, binds the input to the `--ds-input-*`
|
|
66
|
+
* keys and the list to the `--ds-select-*` keys, so it reads as one family
|
|
67
|
+
* with `Input` and `Select`, and offers a flat `items` API.
|
|
68
|
+
*
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Combobox
|
|
71
|
+
* label="Add an action"
|
|
72
|
+
* items={matches}
|
|
73
|
+
* inputValue={query}
|
|
74
|
+
* onInputValueChange={setQuery}
|
|
75
|
+
* onSelect={(value) => setPicked((list) => [...list, value])}
|
|
76
|
+
* emptyText="No matching actions"
|
|
77
|
+
* />
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* The list portals like `Select`'s: into `<body>`, or into the panel of the
|
|
81
|
+
* ui-core `Dialog` it opens in, at `z-index: 60`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function Combobox({ items, inputValue, onInputValueChange, onSelect, label, 'aria-label': ariaLabel, placeholder, emptyText, size, disabled, invalid, className, inputRef, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAoC,MAAM,OAAO,CAAC;AAGnF,OAAO,gBAAgB,CAAC;AAGxB,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,qCAAqC;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAClC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,WAAW,EACX,SAAS,EACT,IAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,QAAQ,GACT,EAAE,aAAa,2CA6Ff"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox as ArkCombobox, createListCollection } from '@ark-ui/react/combobox';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
4
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
5
|
+
import { flushSync } from 'react-dom';
|
|
6
|
+
import { PortalContainerContext } from '../portal-container';
|
|
7
|
+
import './combobox.css';
|
|
8
|
+
import { cx } from '../cx';
|
|
9
|
+
const NO_VALUE = [];
|
|
10
|
+
/**
|
|
11
|
+
* A text input that suggests options as you type, built on Ark UI.
|
|
12
|
+
*
|
|
13
|
+
* Choosing a suggestion reports it through `onSelect` and empties the input,
|
|
14
|
+
* so the field is ready for the next one: the control for adding items to a
|
|
15
|
+
* list one at a time. It never holds a selection itself; the caller keeps
|
|
16
|
+
* the list. For a field that keeps one choice, use `Select`.
|
|
17
|
+
*
|
|
18
|
+
* Ark owns the combobox semantics, keyboard navigation (the first suggestion
|
|
19
|
+
* is highlighted as you type, so Enter takes it) and dismiss behaviour. This
|
|
20
|
+
* wrapper contributes `ds-` classes, binds the input to the `--ds-input-*`
|
|
21
|
+
* keys and the list to the `--ds-select-*` keys, so it reads as one family
|
|
22
|
+
* with `Input` and `Select`, and offers a flat `items` API.
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Combobox
|
|
26
|
+
* label="Add an action"
|
|
27
|
+
* items={matches}
|
|
28
|
+
* inputValue={query}
|
|
29
|
+
* onInputValueChange={setQuery}
|
|
30
|
+
* onSelect={(value) => setPicked((list) => [...list, value])}
|
|
31
|
+
* emptyText="No matching actions"
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The list portals like `Select`'s: into `<body>`, or into the panel of the
|
|
36
|
+
* ui-core `Dialog` it opens in, at `z-index: 60`.
|
|
37
|
+
*/
|
|
38
|
+
export function Combobox({ items, inputValue, onInputValueChange, onSelect, label, 'aria-label': ariaLabel, placeholder, emptyText, size = 'md', disabled, invalid, className, inputRef, }) {
|
|
39
|
+
const collection = useMemo(() => createListCollection({
|
|
40
|
+
items,
|
|
41
|
+
itemToValue: (item) => item.value,
|
|
42
|
+
itemToString: (item) => item.label,
|
|
43
|
+
isItemDisabled: (item) => item.disabled ?? false,
|
|
44
|
+
}), [items]);
|
|
45
|
+
const portalContainer = useContext(PortalContainerContext);
|
|
46
|
+
/*
|
|
47
|
+
* An option, not Ark's `Empty` (role="presentation"): a listbox with no
|
|
48
|
+
* option in it fails axe's aria-required-children, and a disabled option
|
|
49
|
+
* is how a screen reader hears that nothing matched — the pattern GOV.UK's
|
|
50
|
+
* accessible-autocomplete uses. Zag navigates by its collection, so it
|
|
51
|
+
* never lands on this row.
|
|
52
|
+
*/
|
|
53
|
+
const emptyOption = items.length === 0 && emptyText !== undefined && (_jsx("div", { role: "option", "aria-disabled": "true", "aria-selected": "false", className: "ds-combobox__empty", children: emptyText }));
|
|
54
|
+
const handleValueChange = useCallback((details) => {
|
|
55
|
+
const chosen = details.value[0];
|
|
56
|
+
if (chosen !== undefined)
|
|
57
|
+
onSelect(chosen);
|
|
58
|
+
}, [onSelect]);
|
|
59
|
+
/*
|
|
60
|
+
* Flushed, so the new text is rendered before the next keystroke arrives.
|
|
61
|
+
* Zag writes the input's value back from its state after every change; left
|
|
62
|
+
* to React's scheduler, that render could land after a later keystroke and
|
|
63
|
+
* overwrite it ("vis" then "a" came out as "via"), which a fast typist or a
|
|
64
|
+
* busy page can trigger, since browsers run input events ahead of other
|
|
65
|
+
* tasks.
|
|
66
|
+
*/
|
|
67
|
+
const handleInputValueChange = useCallback((details) => flushSync(() => onInputValueChange(details.inputValue)), [onInputValueChange]);
|
|
68
|
+
return (_jsxs(ArkCombobox.Root, { collection: collection, className: cx('ds-combobox', `ds-combobox--${size}`, className), value: NO_VALUE, onValueChange: handleValueChange, inputValue: inputValue, onInputValueChange: handleInputValueChange, selectionBehavior: "clear", inputBehavior: "autohighlight", openOnClick: true, disabled: disabled, invalid: invalid, positioning: { sameWidth: true }, children: [label && _jsx(ArkCombobox.Label, { className: "ds-combobox__label", children: label }), _jsx(ArkCombobox.Control, { children: _jsx(ArkCombobox.Input, { ref: inputRef, className: "ds-combobox__input", placeholder: placeholder, "aria-label": ariaLabel }) }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkCombobox.Positioner, { children: _jsxs(ArkCombobox.Content, { className: "ds-combobox__content", children: [items.map((item) => (_jsxs(ArkCombobox.Item, { item: item, className: "ds-combobox__item", children: [_jsx(ArkCombobox.ItemText, { className: "ds-combobox__item-label", children: item.label }), item.description && (_jsx("span", { className: "ds-combobox__item-description", children: item.description }))] }, item.value))), emptyOption] }) }) })] }));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA4B,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,WA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AAS,EAAC,yBAAyB,YACtD,IAAI,CAAC,KAAK,GACU,EACtB,IAAI,CAAC,WAAW,IAAI,CACnB,eAAM,SAAS,EAAC,+BAA+B,YAAE,IAAI,CAAC,WAAW,GAAQ,CAC1E,KANoB,IAAI,CAAC,KAAK,CAOd,CACpB,CAAC,EACD,WAAW,IACQ,GACC,GAClB,IACQ,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/combobox/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/combobox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './alert';
|
|
2
|
+
export * from './avatar';
|
|
2
3
|
export * from './badge';
|
|
3
4
|
export * from './button';
|
|
4
5
|
export * from './calendar';
|
|
5
6
|
export * from './card';
|
|
6
7
|
export * from './checkbox';
|
|
8
|
+
export * from './combobox';
|
|
7
9
|
export { cx } from './cx';
|
|
8
10
|
export * from './date-input';
|
|
9
11
|
export * from './dialog';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,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,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './alert';
|
|
2
|
+
export * from './avatar';
|
|
2
3
|
export * from './badge';
|
|
3
4
|
export * from './button';
|
|
4
5
|
export * from './calendar';
|
|
5
6
|
export * from './card';
|
|
6
7
|
export * from './checkbox';
|
|
8
|
+
export * from './combobox';
|
|
7
9
|
export { cx } from './cx';
|
|
8
10
|
export * from './date-input';
|
|
9
11
|
export * from './dialog';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type ElementType, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type IconSource } from '../icon/icon';
|
|
3
|
+
import './menu.css';
|
|
4
|
+
export interface ActionMenuItem {
|
|
5
|
+
/** Stable value reported by `onSelect`. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Text shown in the menu. Also what typeahead matches against. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Glyph before the label. Decorative: the label says what the item does. */
|
|
10
|
+
icon?: IconSource;
|
|
11
|
+
/**
|
|
12
|
+
* Makes the item a link to this address, rendered through `linkComponent`.
|
|
13
|
+
* Choosing it follows the link, with the keyboard too; `onSelect` still
|
|
14
|
+
* reports its value.
|
|
15
|
+
*/
|
|
16
|
+
href?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Marks the link to the page the user is on: `aria-current="page"`, and
|
|
19
|
+
* the `itemIndicator` glyph after the label so the mark is not colour alone.
|
|
20
|
+
*/
|
|
21
|
+
current?: boolean;
|
|
22
|
+
/** Individually disable this item without removing it. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether choosing the item closes the menu. Defaults to `true`. Keep an
|
|
26
|
+
* item open when its outcome shows in the `footer`, so a failure appears
|
|
27
|
+
* where the click happened.
|
|
28
|
+
*/
|
|
29
|
+
closeOnSelect?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The props a `linkComponent` receives. A plain `'a'` and a router's link
|
|
33
|
+
* component both accept them; Ark adds the menu item's role, id, state
|
|
34
|
+
* attributes and handlers on top, so the component must pass unknown props
|
|
35
|
+
* and its `ref` on to the anchor it renders.
|
|
36
|
+
*/
|
|
37
|
+
export interface ActionMenuLinkProps {
|
|
38
|
+
href: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
'aria-current'?: 'page';
|
|
42
|
+
}
|
|
43
|
+
export interface ActionMenuProps {
|
|
44
|
+
/**
|
|
45
|
+
* The element that opens the menu: a `<button>`, or a component that
|
|
46
|
+
* passes its props and `ref` on to one, such as `IconButton` or
|
|
47
|
+
* `MenuTrigger`. Ark renders it as the trigger, adding `aria-haspopup`,
|
|
48
|
+
* `aria-expanded`, `aria-controls`, the open and close handlers and
|
|
49
|
+
* `data-state`. Give it an accessible name that says what the menu holds,
|
|
50
|
+
* such as "Account menu" or "Main navigation": the menu takes its name
|
|
51
|
+
* from the trigger.
|
|
52
|
+
*/
|
|
53
|
+
trigger: ReactElement;
|
|
54
|
+
/** The actions and links, in order. */
|
|
55
|
+
items: ActionMenuItem[];
|
|
56
|
+
/** Fired with the item's `value` when one is chosen, a link included. */
|
|
57
|
+
onSelect?: (value: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Content above the items that says whose menu this is, such as the
|
|
60
|
+
* signed-in user's name and email. It names the group of items for
|
|
61
|
+
* assistive technology, so keep it to text and decorative elements.
|
|
62
|
+
*/
|
|
63
|
+
header?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* A line under the items about the last action, such as "Couldn't sign
|
|
66
|
+
* out. Check your connection, then try again." It is announced when it
|
|
67
|
+
* appears, and a press on it leaves the menu open. It is not an item and
|
|
68
|
+
* sits beside the `menu` element, which may own only items, so keep it to
|
|
69
|
+
* text and a decorative glyph rather than an `Alert`.
|
|
70
|
+
*/
|
|
71
|
+
footer?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Renders an item with an `href`. Defaults to `'a'`; pass a router's link
|
|
74
|
+
* component for client-side navigation.
|
|
75
|
+
*/
|
|
76
|
+
linkComponent?: ElementType<ActionMenuLinkProps>;
|
|
77
|
+
/**
|
|
78
|
+
* Glyph marking the `current` link. Defaults to a plain built-in check so
|
|
79
|
+
* `@manakind/ui-core` renders on its own; products pass their own icon.
|
|
80
|
+
*/
|
|
81
|
+
itemIndicator?: IconSource;
|
|
82
|
+
/** Controlled open state. Pair with `onOpenChange`. */
|
|
83
|
+
open?: boolean;
|
|
84
|
+
/** Fired with the requested state whenever the menu asks to open or close. */
|
|
85
|
+
onOpenChange?: (open: boolean) => void;
|
|
86
|
+
/** Extra class names on the menu's popup: the frame around the items and the footer. */
|
|
87
|
+
className?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A menu of actions and links, opened from a trigger, built on Ark UI's
|
|
91
|
+
* Menu. The counterpart of `Menu`, whose items are mutually exclusive
|
|
92
|
+
* choices: here every item does something or goes somewhere.
|
|
93
|
+
*
|
|
94
|
+
* Ark owns the hard parts: `menu` / `menuitem` semantics, roving highlight
|
|
95
|
+
* with the arrow keys, Home/End, typeahead, Escape and click outside to
|
|
96
|
+
* dismiss, following a link on Enter, and focus returning to the trigger on
|
|
97
|
+
* close. This wrapper contributes the `ds-menu` classes and `--ds-menu-*`
|
|
98
|
+
* bindings it shares with `Menu`, a flat `items` API, and the header and
|
|
99
|
+
* footer slots.
|
|
100
|
+
*
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <ActionMenu
|
|
103
|
+
* trigger={<IconButton icon={MenuGlyph} variant="tertiary" aria-label="Main navigation" />}
|
|
104
|
+
* linkComponent={Link}
|
|
105
|
+
* items={[
|
|
106
|
+
* { value: 'dashboard', label: 'Dashboard', href: '/dashboard', current: true },
|
|
107
|
+
* { value: 'goals', label: 'Goals', href: '/goals' },
|
|
108
|
+
* ]}
|
|
109
|
+
* />
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* Reach for this for an account menu, a row's overflow actions, or a
|
|
113
|
+
* navigation that folds into a button on a phone. A set of choices where
|
|
114
|
+
* exactly one is in effect is a `Menu`; a form field is a `Select`.
|
|
115
|
+
*
|
|
116
|
+
* The popup renders in a portal, at the same `z-index: 60` as Select's
|
|
117
|
+
* listbox, and is mounted only while open, as `Menu`'s is.
|
|
118
|
+
*/
|
|
119
|
+
export declare function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent, itemIndicator, open, onOpenChange, className, }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
120
|
+
//# sourceMappingURL=action-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-menu.d.ts","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH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ment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Menu as ArkMenu } from '@ark-ui/react/menu';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
4
|
+
import { useContext, useRef } from 'react';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
import { Check } from '../fallback-glyphs';
|
|
7
|
+
import { Icon } from '../icon/icon';
|
|
8
|
+
import { PortalContainerContext } from '../portal-container';
|
|
9
|
+
import './menu.css';
|
|
10
|
+
function ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }) {
|
|
11
|
+
const body = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "ds-menu__item-body", children: [item.icon && (_jsx(Icon, { source: item.icon, size: "sm", decorative: true, className: "ds-menu__item-icon" })), _jsx(ArkMenu.ItemText, { children: item.label })] }), item.current && (_jsx("span", { className: "ds-menu__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) }))] }));
|
|
12
|
+
const itemProps = {
|
|
13
|
+
value: item.value,
|
|
14
|
+
valueText: item.label,
|
|
15
|
+
disabled: item.disabled,
|
|
16
|
+
closeOnSelect: item.closeOnSelect,
|
|
17
|
+
className: 'ds-menu__item',
|
|
18
|
+
};
|
|
19
|
+
if (item.href === undefined) {
|
|
20
|
+
return _jsx(ArkMenu.Item, { ...itemProps, children: body });
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(ArkMenu.Item, { ...itemProps, asChild: true, children: _jsx(LinkComponent, { href: item.href, "aria-current": item.current ? 'page' : undefined, children: body }) }));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A menu of actions and links, opened from a trigger, built on Ark UI's
|
|
26
|
+
* Menu. The counterpart of `Menu`, whose items are mutually exclusive
|
|
27
|
+
* choices: here every item does something or goes somewhere.
|
|
28
|
+
*
|
|
29
|
+
* Ark owns the hard parts: `menu` / `menuitem` semantics, roving highlight
|
|
30
|
+
* with the arrow keys, Home/End, typeahead, Escape and click outside to
|
|
31
|
+
* dismiss, following a link on Enter, and focus returning to the trigger on
|
|
32
|
+
* close. This wrapper contributes the `ds-menu` classes and `--ds-menu-*`
|
|
33
|
+
* bindings it shares with `Menu`, a flat `items` API, and the header and
|
|
34
|
+
* footer slots.
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <ActionMenu
|
|
38
|
+
* trigger={<IconButton icon={MenuGlyph} variant="tertiary" aria-label="Main navigation" />}
|
|
39
|
+
* linkComponent={Link}
|
|
40
|
+
* items={[
|
|
41
|
+
* { value: 'dashboard', label: 'Dashboard', href: '/dashboard', current: true },
|
|
42
|
+
* { value: 'goals', label: 'Goals', href: '/goals' },
|
|
43
|
+
* ]}
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Reach for this for an account menu, a row's overflow actions, or a
|
|
48
|
+
* navigation that folds into a button on a phone. A set of choices where
|
|
49
|
+
* exactly one is in effect is a `Menu`; a form field is a `Select`.
|
|
50
|
+
*
|
|
51
|
+
* The popup renders in a portal, at the same `z-index: 60` as Select's
|
|
52
|
+
* listbox, and is mounted only while open, as `Menu`'s is.
|
|
53
|
+
*/
|
|
54
|
+
export function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent = 'a', itemIndicator = Check, open, onOpenChange, className, }) {
|
|
55
|
+
const portalContainer = useContext(PortalContainerContext);
|
|
56
|
+
const handleSelect = (details) => onSelect?.(details.value);
|
|
57
|
+
const handleOpenChange = (details) => onOpenChange?.(details.open);
|
|
58
|
+
/*
|
|
59
|
+
* Enter on a link item. Zag's default dispatches a click that does not
|
|
60
|
+
* bubble, which the browser follows as a document load but React never
|
|
61
|
+
* sees, so a router's link component could not take it over. `click()`
|
|
62
|
+
* bubbles, and the link navigates the way a pointer click would.
|
|
63
|
+
*/
|
|
64
|
+
const navigate = (details) => queueMicrotask(() => details.node.click());
|
|
65
|
+
/*
|
|
66
|
+
* The footer sits beside the `menu` element, not in it, because a menu may
|
|
67
|
+
* own only items. To Zag that makes it outside, so a press on the message
|
|
68
|
+
* would dismiss the menu; this keeps it open.
|
|
69
|
+
*/
|
|
70
|
+
const footerRef = useRef(null);
|
|
71
|
+
const keepOpenForFooter = (event) => {
|
|
72
|
+
const target = event.detail.originalEvent.target;
|
|
73
|
+
if (target instanceof Node && footerRef.current?.contains(target))
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
};
|
|
76
|
+
const rows = items.map((item) => (_jsx(ActionMenuRow, { item: item, linkComponent: linkComponent, itemIndicator: itemIndicator }, item.value)));
|
|
77
|
+
const list = header === undefined ? (rows) : (_jsxs(ArkMenu.ItemGroup, { children: [_jsx(ArkMenu.ItemGroupLabel, { className: "ds-menu__header", children: header }), rows] }));
|
|
78
|
+
return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: handleOpenChange, onSelect: handleSelect, navigate: navigate, onInteractOutside: keepOpenForFooter, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsxs("div", { className: cx('ds-menu__popup', className), children: [_jsx(ArkMenu.Content, { className: "ds-menu__content", children: list }), _jsx("div", { ref: footerRef, className: "ds-menu__footer", "aria-live": "polite", children: footer })] }) }) })] }));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=action-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-menu.js","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAuD,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EA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,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CACrB,IAAI,CACL,CAAC,CAAC,CAAC,CACF,MAAC,OAAO,CAAC,SAAS,eAChB,KAAC,OAAO,CAAC,cAAc,IAAC,SAAS,EAAC,iBAAiB,YAAE,MAAM,GAA0B,EACpF,IAAI,IACa,CACrB,CAAC;IAEJ,OAAO,CACL,MAAC,OAAO,CAAC,IAAI,IACX,SAAS,QACT,aAAa,QACb,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,aAEpC,KAAC,OAAO,CAAC,OAAO,IAAC,OAAO,kBAAE,OAAO,GAAmB,EAEpD,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,OAAO,CAAC,UAAU,cACjB,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAC7C,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,YAAE,IAAI,GAAmB,EACtE,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,iBAAiB,eAAW,QAAQ,YAChE,MAAM,GACH,IACF,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC"}
|
package/dist/menu/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ActionMenuItem, ActionMenuLinkProps, ActionMenuProps } from './action-menu';
|
|
2
|
+
export { ActionMenu } from './action-menu';
|
|
1
3
|
export type { MenuItem, MenuProps, MenuTriggerProps } from './menu';
|
|
2
4
|
export { Menu, MenuTrigger } from './menu';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/menu/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/menu/index.js
CHANGED
package/dist/menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/menu/menu.css
CHANGED
|
@@ -54,9 +54,12 @@
|
|
|
54
54
|
|
|
55
55
|
/*
|
|
56
56
|
* The popup renders in a portal, so it is not a descendant of the trigger
|
|
57
|
-
* in the DOM and is styled at the top level, as Select's listbox is.
|
|
57
|
+
* in the DOM and is styled at the top level, as Select's listbox is. It is
|
|
58
|
+
* the frame around the `menu` element (`.ds-menu__content`) and, for an
|
|
59
|
+
* ActionMenu, the footer beside it: a menu may own only items, so anything
|
|
60
|
+
* else in the frame is its sibling.
|
|
58
61
|
*/
|
|
59
|
-
.ds-
|
|
62
|
+
.ds-menu__popup {
|
|
60
63
|
padding: var(--ds-menu-content-padding);
|
|
61
64
|
border: 1px solid var(--ds-menu-content-border);
|
|
62
65
|
border-radius: var(--ds-menu-content-radius);
|
|
@@ -72,22 +75,28 @@
|
|
|
72
75
|
overflow-wrap: anywhere;
|
|
73
76
|
/*
|
|
74
77
|
* The `popup` stacking layer (ds-config/scripts/stacking.ts), as Select's
|
|
75
|
-
* listbox: Zag copies
|
|
76
|
-
* `<body>`, so the menu paints above
|
|
77
|
-
* page content positioned under it.
|
|
78
|
+
* listbox: Zag copies the positioner's first child's value onto the
|
|
79
|
+
* positioner, a sibling of the page in `<body>`, so the menu paints above
|
|
80
|
+
* the products' overlay layer and the page content positioned under it.
|
|
78
81
|
*/
|
|
79
82
|
z-index: 60;
|
|
80
83
|
|
|
81
84
|
/*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
85
|
+
* Keyboard focus sits on the `menu` element inside; the ring is drawn on
|
|
86
|
+
* the frame, inset like Select's listbox ring: an outer ring on a
|
|
87
|
+
* portalled popup is cropped by anything that sizes to it and can clip
|
|
88
|
+
* against the viewport.
|
|
84
89
|
*/
|
|
85
|
-
&:focus-visible {
|
|
90
|
+
&:has(> .ds-menu__content:focus-visible) {
|
|
86
91
|
outline: 2px solid var(--ds-menu-focus-ring);
|
|
87
92
|
outline-offset: -2px;
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
.ds-menu__content {
|
|
97
|
+
outline: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
91
100
|
/*
|
|
92
101
|
* Names the group of choices for assistive technology only. The trigger
|
|
93
102
|
* already says what the menu chooses, so showing it again would repeat it.
|
|
@@ -124,6 +133,51 @@
|
|
|
124
133
|
opacity: var(--ds-opacity-disabled);
|
|
125
134
|
cursor: not-allowed;
|
|
126
135
|
}
|
|
136
|
+
|
|
137
|
+
/* An ActionMenu link is an anchor with the item's role; it reads as a row, not a link. */
|
|
138
|
+
&:is(a) {
|
|
139
|
+
text-decoration: none;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* The glyph and label of an ActionMenu item, kept together ahead of the indicator. */
|
|
144
|
+
.ds-menu__item-body {
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: var(--ds-menu-item-gap);
|
|
148
|
+
min-width: 0;
|
|
149
|
+
max-width: 100%;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.ds-menu__item-icon {
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/*
|
|
157
|
+
* An ActionMenu's header names the group of items (Ark's group label), so
|
|
158
|
+
* it sits in the item's inset and is ruled off from the items under it.
|
|
159
|
+
*/
|
|
160
|
+
.ds-menu__header {
|
|
161
|
+
padding: var(--ds-menu-item-padding-block) var(--ds-menu-item-padding-inline);
|
|
162
|
+
margin-block-end: var(--ds-menu-content-padding);
|
|
163
|
+
border-block-end: 1px solid var(--ds-menu-content-border);
|
|
164
|
+
color: var(--ds-menu-item-text);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
* A line under the items about the last action; not an item. Always in the
|
|
169
|
+
* DOM so that a message arriving later is announced (a live region created
|
|
170
|
+
* with its content is not), and taking no room while it is empty.
|
|
171
|
+
*/
|
|
172
|
+
.ds-menu__footer {
|
|
173
|
+
margin-block-start: var(--ds-menu-content-padding);
|
|
174
|
+
padding: var(--ds-menu-item-padding-block) var(--ds-menu-item-padding-inline);
|
|
175
|
+
border-block-start: 1px solid var(--ds-menu-content-border);
|
|
176
|
+
color: var(--ds-menu-item-text);
|
|
177
|
+
|
|
178
|
+
&:empty {
|
|
179
|
+
display: none;
|
|
180
|
+
}
|
|
127
181
|
}
|
|
128
182
|
|
|
129
183
|
/*
|
package/dist/menu/menu.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface MenuProps<V extends string = string> {
|
|
|
53
53
|
* they do Select's `itemIndicator`.
|
|
54
54
|
*/
|
|
55
55
|
itemIndicator?: IconSource;
|
|
56
|
-
/** Extra class names on the menu's popup. */
|
|
56
|
+
/** Extra class names on the menu's popup: the frame around the items. */
|
|
57
57
|
className?: string;
|
|
58
58
|
}
|
|
59
59
|
export interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'> {
|
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":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA2B,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACjD,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC;IACT,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAClD;;;;;;;;;;OAUG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;;;OAIG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,E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AAa,EACb,aAAqB,EACrB,SAAS,GACV,EAAE,SAAS,CAAC,CAAC,CAAC,2CA+Cd"}
|
package/dist/menu/menu.js
CHANGED
|
@@ -74,6 +74,6 @@ export function Menu({ trigger, label, items, value, onValueChange, itemIndicato
|
|
|
74
74
|
onValueChange(chosen.value);
|
|
75
75
|
}, [items, value, onValueChange]);
|
|
76
76
|
const portalContainer = useContext(PortalContainerContext);
|
|
77
|
-
return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsx(
|
|
77
|
+
return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsx("div", { className: cx('ds-menu__popup', className), children: _jsx(ArkMenu.Content, { className: "ds-menu__content", children: _jsxs(ArkMenu.RadioItemGroup, { value: value, onValueChange: handleValueChange, children: [_jsx(ArkMenu.ItemGroupLabel, { className: "ds-menu__label", children: label }), items.map((item) => (_jsxs(ArkMenu.RadioItem, { value: item.value, valueText: item.label, disabled: item.disabled, className: "ds-menu__item", children: [_jsx(ArkMenu.ItemText, { children: item.label }), _jsx(ArkMenu.ItemIndicator, { className: "ds-menu__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value)))] }) }) }) }) })] }));
|
|
78
78
|
}
|
|
79
79
|
//# sourceMappingURL=menu.js.map
|
package/dist/menu/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C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AAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,eAAe,aAEzB,KAAC,OAAO,CAAC,QAAQ,cAAE,IAAI,CAAC,KAAK,GAAoB,EACjD,KAAC,OAAO,CAAC,aAAa,IAAC,SAAS,EAAC,yBAAyB,YACxD,KAAC,IAAI,IAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC9B,KATnB,IAAI,CAAC,KAAK,CAUG,CACrB,CAAC,IACqB,GACT,GACd,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/alert/index.d.ts",
|
|
29
29
|
"import": "./dist/alert/index.js"
|
|
30
30
|
},
|
|
31
|
+
"./avatar": {
|
|
32
|
+
"types": "./dist/avatar/index.d.ts",
|
|
33
|
+
"import": "./dist/avatar/index.js"
|
|
34
|
+
},
|
|
31
35
|
"./badge": {
|
|
32
36
|
"types": "./dist/badge/index.d.ts",
|
|
33
37
|
"import": "./dist/badge/index.js"
|
|
@@ -48,6 +52,10 @@
|
|
|
48
52
|
"types": "./dist/checkbox/index.d.ts",
|
|
49
53
|
"import": "./dist/checkbox/index.js"
|
|
50
54
|
},
|
|
55
|
+
"./combobox": {
|
|
56
|
+
"types": "./dist/combobox/index.d.ts",
|
|
57
|
+
"import": "./dist/combobox/index.js"
|
|
58
|
+
},
|
|
51
59
|
"./date-input": {
|
|
52
60
|
"types": "./dist/date-input/index.d.ts",
|
|
53
61
|
"import": "./dist/date-input/index.js"
|
|
@@ -104,6 +112,10 @@
|
|
|
104
112
|
"types": "./dist/alert/alert.css.d.ts",
|
|
105
113
|
"default": "./dist/alert/alert.css"
|
|
106
114
|
},
|
|
115
|
+
"./css/avatar": {
|
|
116
|
+
"types": "./dist/avatar/avatar.css.d.ts",
|
|
117
|
+
"default": "./dist/avatar/avatar.css"
|
|
118
|
+
},
|
|
107
119
|
"./css/badge": {
|
|
108
120
|
"types": "./dist/badge/badge.css.d.ts",
|
|
109
121
|
"default": "./dist/badge/badge.css"
|
|
@@ -124,6 +136,10 @@
|
|
|
124
136
|
"types": "./dist/checkbox/checkbox.css.d.ts",
|
|
125
137
|
"default": "./dist/checkbox/checkbox.css"
|
|
126
138
|
},
|
|
139
|
+
"./css/combobox": {
|
|
140
|
+
"types": "./dist/combobox/combobox.css.d.ts",
|
|
141
|
+
"default": "./dist/combobox/combobox.css"
|
|
142
|
+
},
|
|
127
143
|
"./css/date-input": {
|
|
128
144
|
"types": "./dist/date-input/date-input.css.d.ts",
|
|
129
145
|
"default": "./dist/date-input/date-input.css"
|
|
@@ -195,7 +211,7 @@
|
|
|
195
211
|
},
|
|
196
212
|
"devDependencies": {
|
|
197
213
|
"@manakind/ds-config": "*",
|
|
198
|
-
"@manakind/manuia-tokens": "0.
|
|
214
|
+
"@manakind/manuia-tokens": "0.18.0",
|
|
199
215
|
"@testing-library/jest-dom": "^6.9.1",
|
|
200
216
|
"@testing-library/react": "^16.3.2",
|
|
201
217
|
"@testing-library/user-event": "^14.6.1",
|