@manakind/ui-core 0.4.0 → 0.6.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 +4 -0
- package/dist/alert/alert.css +90 -0
- package/dist/alert/alert.css.d.ts +2 -0
- package/dist/alert/alert.d.ts +45 -0
- package/dist/alert/alert.d.ts.map +1 -0
- package/dist/alert/alert.js +24 -0
- package/dist/alert/alert.js.map +1 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +2 -0
- package/dist/alert/index.js.map +1 -0
- package/dist/dialog/dialog-close.d.ts +24 -0
- package/dist/dialog/dialog-close.d.ts.map +1 -0
- package/dist/dialog/dialog-close.js +24 -0
- package/dist/dialog/dialog-close.js.map +1 -0
- package/dist/dialog/dialog.css +127 -0
- package/dist/dialog/dialog.css.d.ts +2 -0
- package/dist/dialog/dialog.d.ts +104 -0
- package/dist/dialog/dialog.d.ts.map +1 -0
- package/dist/dialog/dialog.js +82 -0
- package/dist/dialog/dialog.js.map +1 -0
- package/dist/dialog/index.d.ts +5 -0
- package/dist/dialog/index.d.ts.map +1 -0
- package/dist/dialog/index.js +3 -0
- package/dist/dialog/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/portal-container.d.ts +12 -0
- package/dist/portal-container.d.ts.map +1 -0
- package/dist/portal-container.js +12 -0
- package/dist/portal-container.js.map +1 -0
- package/dist/select/select.d.ts +3 -1
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +7 -3
- package/dist/select/select.js.map +1 -1
- package/package.json +18 -2
package/README.md
CHANGED
|
@@ -57,18 +57,22 @@ separately, so an app can load only what it renders.
|
|
|
57
57
|
| Entry | Contents |
|
|
58
58
|
|---|---|
|
|
59
59
|
| `@manakind/ui-core` | Everything below, plus every prop type and the `cx` helper |
|
|
60
|
+
| `@manakind/ui-core/alert` | `Alert` |
|
|
60
61
|
| `@manakind/ui-core/badge` | `Badge` |
|
|
61
62
|
| `@manakind/ui-core/button` | `Button` + `IconButton` |
|
|
62
63
|
| `@manakind/ui-core/card` | `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter` |
|
|
64
|
+
| `@manakind/ui-core/dialog` | `Dialog` + `DialogClose` |
|
|
63
65
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
64
66
|
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
65
67
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
66
68
|
| `@manakind/ui-core/select` | `Select` |
|
|
67
69
|
| `@manakind/ui-core/switch` | `Switch` |
|
|
68
70
|
| `@manakind/ui-core/tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` |
|
|
71
|
+
| `@manakind/ui-core/css/alert` | Alert structural CSS; its icon also needs `css/icon` |
|
|
69
72
|
| `@manakind/ui-core/css/badge` | Badge structural CSS |
|
|
70
73
|
| `@manakind/ui-core/css/button` | Button + IconButton structural CSS |
|
|
71
74
|
| `@manakind/ui-core/css/card` | Card structural CSS |
|
|
75
|
+
| `@manakind/ui-core/css/dialog` | Dialog structural CSS; its close button also needs `css/button` and `css/icon` |
|
|
72
76
|
| `@manakind/ui-core/css/icon` | Icon structural CSS |
|
|
73
77
|
| `@manakind/ui-core/css/illustration` | Illustration structural CSS, including the paint roles |
|
|
74
78
|
| `@manakind/ui-core/css/progress` | Progress structural CSS |
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-alert {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
/*
|
|
7
|
+
* The gap between the plate and the text is the padding, so the plate
|
|
8
|
+
* sits the same distance from the alert's edge as from the text: one
|
|
9
|
+
* value, not two tokens that can drift apart.
|
|
10
|
+
*/
|
|
11
|
+
gap: var(--ds-alert-padding);
|
|
12
|
+
padding: var(--ds-alert-padding);
|
|
13
|
+
/*
|
|
14
|
+
* The border is the variant's text colour, not a lighter tint of it: the
|
|
15
|
+
* fills are pale washes in both products, so the text colour is what
|
|
16
|
+
* bounds the box against the page, and it is already the contrast-checked
|
|
17
|
+
* colour of the variant.
|
|
18
|
+
*/
|
|
19
|
+
border: 1px solid var(--_alert-border);
|
|
20
|
+
border-radius: var(--ds-alert-radius);
|
|
21
|
+
background-color: var(--_alert-bg);
|
|
22
|
+
color: var(--_alert-text);
|
|
23
|
+
font-size: var(--ds-alert-font-size);
|
|
24
|
+
line-height: var(--ds-alert-line-height);
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* The icon has a column of its own, centred against the text beside it in
|
|
28
|
+
* both directions, on a round plate of the raised surface. Its size is the
|
|
29
|
+
* alert's, not the icon scale's: the glyph names the variant at a glance,
|
|
30
|
+
* so it is drawn larger than an inline icon, and the plate lifts it off the
|
|
31
|
+
* wash.
|
|
32
|
+
*/
|
|
33
|
+
& .ds-alert__icon {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex: 0 0 auto;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
padding: var(--ds-alert-icon-padding);
|
|
39
|
+
border: var(--ds-alert-icon-border-width) solid currentColor;
|
|
40
|
+
border-radius: var(--ds-alert-icon-radius);
|
|
41
|
+
background-color: var(--ds-alert-icon-bg);
|
|
42
|
+
|
|
43
|
+
& .ds-icon {
|
|
44
|
+
width: var(--ds-alert-icon-size);
|
|
45
|
+
height: var(--ds-alert-icon-size);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& .ds-alert__body {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex: 1 1 auto;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: var(--ds-alert-body-gap);
|
|
54
|
+
min-width: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
& .ds-alert__title {
|
|
58
|
+
margin: 0;
|
|
59
|
+
font-weight: var(--ds-alert-title-font-weight);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
& .ds-alert__description {
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.ds-alert--info {
|
|
67
|
+
--_alert-bg: var(--ds-alert-info-bg);
|
|
68
|
+
--_alert-border: var(--ds-alert-info-border);
|
|
69
|
+
--_alert-text: var(--ds-alert-info-text);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.ds-alert--success {
|
|
73
|
+
--_alert-bg: var(--ds-alert-success-bg);
|
|
74
|
+
--_alert-border: var(--ds-alert-success-border);
|
|
75
|
+
--_alert-text: var(--ds-alert-success-text);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.ds-alert--warning {
|
|
79
|
+
--_alert-bg: var(--ds-alert-warning-bg);
|
|
80
|
+
--_alert-border: var(--ds-alert-warning-border);
|
|
81
|
+
--_alert-text: var(--ds-alert-warning-text);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.ds-alert--danger {
|
|
85
|
+
--_alert-bg: var(--ds-alert-danger-bg);
|
|
86
|
+
--_alert-border: var(--ds-alert-danger-border);
|
|
87
|
+
--_alert-text: var(--ds-alert-danger-text);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import './alert.css';
|
|
3
|
+
import { type IconSource } from '../icon';
|
|
4
|
+
export type AlertVariant = 'info' | 'success' | 'warning' | 'danger';
|
|
5
|
+
/**
|
|
6
|
+
* `alert` interrupts, and is announced when the element is inserted. `status`
|
|
7
|
+
* waits until the reader is idle, and assistive tech announces only changes
|
|
8
|
+
* inside a region it already knows about: a `status` alert mounted with its
|
|
9
|
+
* content may go unannounced, so keep it mounted and change its text, or use
|
|
10
|
+
* `alert`. Warnings and failures interrupt by default, the other two do not.
|
|
11
|
+
*/
|
|
12
|
+
export type AlertRole = 'status' | 'alert';
|
|
13
|
+
export type AlertProps = Omit<ComponentProps<'div'>, 'role' | 'title'> & {
|
|
14
|
+
/**
|
|
15
|
+
* Tone and colour. `info` is the default; `warning` and `danger` also change
|
|
16
|
+
* the live-region role (see {@link AlertRole}).
|
|
17
|
+
*/
|
|
18
|
+
variant?: AlertVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Live-region role. Leave it unset and the variant picks one.
|
|
21
|
+
*/
|
|
22
|
+
role?: AlertRole;
|
|
23
|
+
/** The one-line headline. Keep it to what happened. */
|
|
24
|
+
title?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Glyph before the text. Decorative: the variant's role and text say what
|
|
27
|
+
* kind of message this is. `ui-core` ships no icons, so a product passes
|
|
28
|
+
* one of its own.
|
|
29
|
+
*/
|
|
30
|
+
icon?: IconSource;
|
|
31
|
+
/** The message body: what to do about it. */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* An inline message about the surrounding content: a failed save, a setting
|
|
36
|
+
* that needs attention, a result worth confirming. It stays in the flow of the
|
|
37
|
+
* page; a message about the whole app is a toast, and a question is a Dialog.
|
|
38
|
+
*
|
|
39
|
+
* Give it a `title`, `children`, or both. A title alone is a short notice; a
|
|
40
|
+
* body alone is a sentence of explanation. The variant's text colour clears
|
|
41
|
+
* 4.5:1 on its own fill in both themes, and the border is that same colour,
|
|
42
|
+
* so the box is bounded on any surface.
|
|
43
|
+
*/
|
|
44
|
+
export declare function Alert({ variant, role, title, icon, children, className, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/alert/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,aAAa,CAAC;AAErB,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAS3C,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;IACvE;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uDAAuD;IACvD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAgB,EAChB,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,UAAU,2CAkBZ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './alert.css';
|
|
3
|
+
import { cx } from '../cx';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
const DEFAULT_ROLE = {
|
|
6
|
+
info: 'status',
|
|
7
|
+
success: 'status',
|
|
8
|
+
warning: 'alert',
|
|
9
|
+
danger: 'alert',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An inline message about the surrounding content: a failed save, a setting
|
|
13
|
+
* that needs attention, a result worth confirming. It stays in the flow of the
|
|
14
|
+
* page; a message about the whole app is a toast, and a question is a Dialog.
|
|
15
|
+
*
|
|
16
|
+
* Give it a `title`, `children`, or both. A title alone is a short notice; a
|
|
17
|
+
* body alone is a sentence of explanation. The variant's text colour clears
|
|
18
|
+
* 4.5:1 on its own fill in both themes, and the border is that same colour,
|
|
19
|
+
* so the box is bounded on any surface.
|
|
20
|
+
*/
|
|
21
|
+
export function Alert({ variant = 'info', role, title, icon, children, className, ...rest }) {
|
|
22
|
+
return (_jsxs("div", { role: role ?? DEFAULT_ROLE[variant], className: cx('ds-alert', `ds-alert--${variant}`, className), ...rest, children: [icon && (_jsx("span", { className: "ds-alert__icon", children: _jsx(Icon, { source: icon, decorative: true }) })), _jsxs("div", { className: "ds-alert__body", children: [title != null && _jsx("p", { className: "ds-alert__title", children: title }), children != null && _jsx("div", { className: "ds-alert__description", children: children })] })] }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/alert/alert.tsx"],"names":[],"mappings":";AACA,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,SAAS,CAAC;AAahD,MAAM,YAAY,GAAoC;IACpD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;CAChB,CAAC;AAwBF;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,GAAG,MAAM,EAChB,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACI;IACX,OAAO,CACL,eACE,IAAI,EAAE,IAAI,IAAI,YAAY,CAAC,OAAO,CAAC,EACnC,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,aAAa,OAAO,EAAE,EAAE,SAAS,CAAC,KACxD,IAAI,aAEP,IAAI,IAAI,CACP,eAAM,SAAS,EAAC,gBAAgB,YAC9B,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,UAAU,SAAG,GAC5B,CACR,EACD,eAAK,SAAS,EAAC,gBAAgB,aAC5B,KAAK,IAAI,IAAI,IAAI,YAAG,SAAS,EAAC,iBAAiB,YAAE,KAAK,GAAK,EAC3D,QAAQ,IAAI,IAAI,IAAI,cAAK,SAAS,EAAC,uBAAuB,YAAE,QAAQ,GAAO,IACxE,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
export interface DialogCloseProps {
|
|
3
|
+
/**
|
|
4
|
+
* The one element that closes the dialog, usually a `Button`. It keeps its
|
|
5
|
+
* own look, label and `ref`; DialogClose adds the closing click.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Makes its child close the enclosing `Dialog` when activated.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <DialogClose>
|
|
14
|
+
* <Button variant="secondary">Cancel</Button>
|
|
15
|
+
* </DialogClose>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Use it for the dismissive action, or for a committing one that should
|
|
19
|
+
* close at once. Closing goes through the dialog's `onOpenChange`, so a
|
|
20
|
+
* controlled dialog decides, as it does for Escape. Must be rendered inside
|
|
21
|
+
* a `Dialog` — in its `actions` or its body.
|
|
22
|
+
*/
|
|
23
|
+
export declare function DialogClose({ children }: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=dialog-close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-close.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog-close.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CASzD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as ArkDialog } from '@ark-ui/react/dialog';
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Makes its child close the enclosing `Dialog` when activated.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <DialogClose>
|
|
9
|
+
* <Button variant="secondary">Cancel</Button>
|
|
10
|
+
* </DialogClose>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Use it for the dismissive action, or for a committing one that should
|
|
14
|
+
* close at once. Closing goes through the dialog's `onOpenChange`, so a
|
|
15
|
+
* controlled dialog decides, as it does for Escape. Must be rendered inside
|
|
16
|
+
* a `Dialog` — in its `actions` or its body.
|
|
17
|
+
*/
|
|
18
|
+
export function DialogClose({ children }) {
|
|
19
|
+
// Ark gives every close trigger in a dialog the same id; a dialog with a
|
|
20
|
+
// close button and a Cancel would otherwise carry it twice.
|
|
21
|
+
const id = useId();
|
|
22
|
+
return (_jsx(ArkDialog.CloseTrigger, { asChild: true, id: id, children: children }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=dialog-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-close.js","sourceRoot":"","sources":["../../src/dialog/dialog-close.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAqB,KAAK,EAAE,MAAM,OAAO,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IACxD,yEAAyE;IACzE,4DAA4D;IAC5D,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,OAAO,CACL,KAAC,SAAS,CAAC,YAAY,IAAC,OAAO,QAAC,EAAE,EAAE,EAAE,YACnC,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* The backdrop and positioner portal into `<body>` as siblings of the page,
|
|
4
|
+
* so they are styled at the top level rather than under `.ds-dialog`.
|
|
5
|
+
*
|
|
6
|
+
* Both sit at 50, the layer the product apps give their own popovers,
|
|
7
|
+
* dialogs and sticky headers, so the dialog covers all of the page. The
|
|
8
|
+
* positioner comes after the backdrop in the DOM and so paints above it at
|
|
9
|
+
* the same index. Select's listbox sits at 60 and opens above a dialog.
|
|
10
|
+
*/
|
|
11
|
+
.ds-dialog__backdrop {
|
|
12
|
+
position: fixed;
|
|
13
|
+
inset: 0;
|
|
14
|
+
z-index: 50;
|
|
15
|
+
background-color: var(--ds-dialog-backdrop-bg);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-dialog__positioner {
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0;
|
|
21
|
+
z-index: 50;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
padding: var(--ds-dialog-positioner-padding);
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* The border carries the separation in dark themes, where a shadow on a
|
|
31
|
+
* dark page barely reads; the shadow carries it in light. Both are always
|
|
32
|
+
* drawn, so neither theme depends on the other's cue.
|
|
33
|
+
*/
|
|
34
|
+
.ds-dialog {
|
|
35
|
+
/*
|
|
36
|
+
* The focus ring of a control, stated once as Tabs does: the body's own
|
|
37
|
+
* ring draws it, and the body leaves room for its controls' rings.
|
|
38
|
+
*/
|
|
39
|
+
--_dialog-ring-width: 2px;
|
|
40
|
+
--_dialog-ring-offset: 3px;
|
|
41
|
+
--_dialog-ring-reach: calc(var(--_dialog-ring-width) + var(--_dialog-ring-offset));
|
|
42
|
+
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--ds-dialog-gap);
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
inline-size: 100%;
|
|
48
|
+
max-inline-size: var(--ds-dialog-max-inline-size);
|
|
49
|
+
max-block-size: 100%;
|
|
50
|
+
padding: var(--ds-dialog-padding);
|
|
51
|
+
border: 1px solid var(--ds-dialog-border);
|
|
52
|
+
border-radius: var(--ds-dialog-radius);
|
|
53
|
+
background-color: var(--ds-dialog-bg);
|
|
54
|
+
box-shadow: var(--ds-dialog-shadow);
|
|
55
|
+
color: var(--ds-dialog-text);
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* The panel takes focus only as the focus trap's fallback, when nothing
|
|
59
|
+
* inside it can, as while every action is disabled mid-commit. It is not
|
|
60
|
+
* a control and is never in the tab order, so it draws no ring.
|
|
61
|
+
*/
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
outline: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
& .ds-dialog__header {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: flex-start;
|
|
69
|
+
gap: var(--ds-dialog-header-gap);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
& .ds-dialog__heading {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex: 1;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
gap: var(--ds-dialog-header-gap);
|
|
77
|
+
min-inline-size: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
& .ds-dialog__title {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-family: var(--ds-dialog-title-font-family);
|
|
83
|
+
font-size: var(--ds-dialog-title-font-size);
|
|
84
|
+
font-weight: var(--ds-dialog-title-font-weight);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& .ds-dialog__description {
|
|
88
|
+
margin: 0;
|
|
89
|
+
color: var(--ds-dialog-text-muted);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& .ds-dialog__close {
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* Only the body scrolls. `min-block-size: 0` lets it shrink below its
|
|
98
|
+
* content inside the column, which is what keeps the title and the
|
|
99
|
+
* actions in view when the content is taller than the viewport.
|
|
100
|
+
*
|
|
101
|
+
* A scroll container clips whatever is drawn past its padding, and a
|
|
102
|
+
* full-width control's focus ring is drawn past the body. So the body is
|
|
103
|
+
* larger than its content by the ring's reach and takes that back with a
|
|
104
|
+
* negative margin, as TabsList's scroller does. The panel's own padding
|
|
105
|
+
* is wider than the reach, so nothing moves.
|
|
106
|
+
*/
|
|
107
|
+
& .ds-dialog__body {
|
|
108
|
+
flex: 1 1 auto;
|
|
109
|
+
min-block-size: 0;
|
|
110
|
+
margin: calc(-1 * var(--_dialog-ring-reach));
|
|
111
|
+
padding: var(--_dialog-ring-reach);
|
|
112
|
+
overflow-y: auto;
|
|
113
|
+
|
|
114
|
+
&:focus-visible {
|
|
115
|
+
outline: var(--_dialog-ring-width) solid var(--ds-dialog-focus-ring);
|
|
116
|
+
outline-offset: var(--_dialog-ring-offset);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
& .ds-dialog__actions {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
justify-content: flex-end;
|
|
124
|
+
gap: var(--ds-dialog-actions-gap);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import type { IconSource } from '../icon/icon';
|
|
3
|
+
import './dialog.css';
|
|
4
|
+
export type DialogRole = 'dialog' | 'alertdialog';
|
|
5
|
+
export interface DialogProps {
|
|
6
|
+
/**
|
|
7
|
+
* The dialog's name: rendered as its `<h2>` heading and announced when it
|
|
8
|
+
* opens (`aria-labelledby`). Write it as a short statement or question —
|
|
9
|
+
* "Remove “Site foreman”?".
|
|
10
|
+
*/
|
|
11
|
+
title: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* One or two sentences under the title, announced with it
|
|
14
|
+
* (`aria-describedby`). For a confirmation, say what the action does and
|
|
15
|
+
* what it leaves alone.
|
|
16
|
+
*/
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
/** Body content. Scrolls inside the panel when it outgrows the viewport. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The footer's buttons, end-aligned, in reading order: the dismissive one
|
|
22
|
+
* first, the committing one last. They wrap onto a second line on a narrow
|
|
23
|
+
* screen. Wrap a dismissive button in `DialogClose` to make it close.
|
|
24
|
+
*/
|
|
25
|
+
actions?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* The one element that opens the dialog, such as a `Button`. Focus returns
|
|
28
|
+
* to it when the dialog closes. Leave it out to open the dialog with
|
|
29
|
+
* `open` from elsewhere.
|
|
30
|
+
*/
|
|
31
|
+
trigger?: ReactElement;
|
|
32
|
+
/** Controlled open state. Pair with `onOpenChange`. */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Initial open state when uncontrolled. */
|
|
35
|
+
defaultOpen?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Fired with the requested state whenever the dialog asks to open (its
|
|
38
|
+
* trigger) or close (a `DialogClose`, the close button, Escape, or for
|
|
39
|
+
* `role="dialog"` a click outside). A controlled dialog stays as it is
|
|
40
|
+
* until `open` changes.
|
|
41
|
+
*/
|
|
42
|
+
onOpenChange?: (open: boolean) => void;
|
|
43
|
+
/**
|
|
44
|
+
* `dialog` (default) shows a close button and closes on Escape and on a
|
|
45
|
+
* click outside. `alertdialog` is for confirmations: no close button, and a
|
|
46
|
+
* click outside does nothing, so the explicit cancel action is the way
|
|
47
|
+
* out. Escape still cancels.
|
|
48
|
+
*/
|
|
49
|
+
role?: DialogRole;
|
|
50
|
+
/**
|
|
51
|
+
* Where focus lands when the dialog opens. Defaults to the first focusable
|
|
52
|
+
* element: the close button of a `dialog`, the first action of an
|
|
53
|
+
* `alertdialog` with no focusable body. Point an alertdialog at its least
|
|
54
|
+
* destructive action.
|
|
55
|
+
*/
|
|
56
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
57
|
+
/** Accessible name of the close button. Translate it with the rest of the UI. */
|
|
58
|
+
closeLabel?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Glyph for the close button. Defaults to a plain built-in cross so
|
|
61
|
+
* `@manakind/ui-core` renders on its own; products pass their own icon set,
|
|
62
|
+
* as they do for Select's indicators.
|
|
63
|
+
*/
|
|
64
|
+
closeIcon?: IconSource;
|
|
65
|
+
/** Extra class names appended to the panel's `ds-dialog`. */
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A modal dialog: a raised panel over a dimmed page, built on Ark UI.
|
|
70
|
+
*
|
|
71
|
+
* Ark owns the behaviour: the focus trap, focus returning to the trigger,
|
|
72
|
+
* Escape, the page's scroll lock, `aria-modal`, and the title and
|
|
73
|
+
* description wiring. This wrapper adds the `ds-` classes, the
|
|
74
|
+
* `--ds-dialog-*` bindings, and a slot API in place of Ark's anatomy.
|
|
75
|
+
*
|
|
76
|
+
* ```tsx
|
|
77
|
+
* <Dialog
|
|
78
|
+
* role="alertdialog"
|
|
79
|
+
* title="Remove “Site foreman”?"
|
|
80
|
+
* description="2 people and 1 Landfall lose this type; nothing else is deleted."
|
|
81
|
+
* trigger={<Button variant="secondary">Remove</Button>}
|
|
82
|
+
* initialFocusRef={cancelRef}
|
|
83
|
+
* actions={
|
|
84
|
+
* <>
|
|
85
|
+
* <DialogClose>
|
|
86
|
+
* <Button ref={cancelRef} variant="secondary">Cancel</Button>
|
|
87
|
+
* </DialogClose>
|
|
88
|
+
* <Button onClick={remove}>Remove</Button>
|
|
89
|
+
* </>
|
|
90
|
+
* }
|
|
91
|
+
* />
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* The committing action is the consumer's own button. To close after it
|
|
95
|
+
* runs, control the dialog with `open` and set it false in the handler, or
|
|
96
|
+
* wrap the button in `DialogClose` when closing at once is right.
|
|
97
|
+
*
|
|
98
|
+
* The backdrop and panel portal into `<body>` at `z-index: 50`, the layer
|
|
99
|
+
* the product apps use for their own overlays. A Select inside the dialog
|
|
100
|
+
* portals into its panel (see `PortalContainerContext`) and opens at 60,
|
|
101
|
+
* above it. Nothing is mounted while the dialog is closed.
|
|
102
|
+
*/
|
|
103
|
+
export declare function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role, initialFocusRef, closeLabel, closeIcon, className, }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
104
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC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portal } from '@ark-ui/react/portal';
|
|
4
|
+
import { useCallback, useRef, useState, } from 'react';
|
|
5
|
+
import { IconButton } from '../button/icon-button';
|
|
6
|
+
import { PortalContainerContext } from '../portal-container';
|
|
7
|
+
import './dialog.css';
|
|
8
|
+
import { cx } from '../cx';
|
|
9
|
+
/**
|
|
10
|
+
* A modal dialog: a raised panel over a dimmed page, built on Ark UI.
|
|
11
|
+
*
|
|
12
|
+
* Ark owns the behaviour: the focus trap, focus returning to the trigger,
|
|
13
|
+
* Escape, the page's scroll lock, `aria-modal`, and the title and
|
|
14
|
+
* description wiring. This wrapper adds the `ds-` classes, the
|
|
15
|
+
* `--ds-dialog-*` bindings, and a slot API in place of Ark's anatomy.
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Dialog
|
|
19
|
+
* role="alertdialog"
|
|
20
|
+
* title="Remove “Site foreman”?"
|
|
21
|
+
* description="2 people and 1 Landfall lose this type; nothing else is deleted."
|
|
22
|
+
* trigger={<Button variant="secondary">Remove</Button>}
|
|
23
|
+
* initialFocusRef={cancelRef}
|
|
24
|
+
* actions={
|
|
25
|
+
* <>
|
|
26
|
+
* <DialogClose>
|
|
27
|
+
* <Button ref={cancelRef} variant="secondary">Cancel</Button>
|
|
28
|
+
* </DialogClose>
|
|
29
|
+
* <Button onClick={remove}>Remove</Button>
|
|
30
|
+
* </>
|
|
31
|
+
* }
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The committing action is the consumer's own button. To close after it
|
|
36
|
+
* runs, control the dialog with `open` and set it false in the handler, or
|
|
37
|
+
* wrap the button in `DialogClose` when closing at once is right.
|
|
38
|
+
*
|
|
39
|
+
* The backdrop and panel portal into `<body>` at `z-index: 50`, the layer
|
|
40
|
+
* the product apps use for their own overlays. A Select inside the dialog
|
|
41
|
+
* portals into its panel (see `PortalContainerContext`) and opens at 60,
|
|
42
|
+
* above it. Nothing is mounted while the dialog is closed.
|
|
43
|
+
*/
|
|
44
|
+
export function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role = 'dialog', initialFocusRef, closeLabel = 'Close', closeIcon = Cross, className, }) {
|
|
45
|
+
const dismissible = role === 'dialog';
|
|
46
|
+
const panelRef = useRef(null);
|
|
47
|
+
const handleOpenChange = (details) => onOpenChange?.(details.open);
|
|
48
|
+
// Zag types this as returning `HTMLElement | null`, but its focus trap
|
|
49
|
+
// reads undefined as "the first focusable element" and, given null, fails
|
|
50
|
+
// to start at all, leaving the page reachable by Tab.
|
|
51
|
+
const initialFocusEl = (() => initialFocusRef?.current ?? undefined);
|
|
52
|
+
return (_jsxs(ArkDialog.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: handleOpenChange, role: role, closeOnInteractOutside: dismissible, initialFocusEl: initialFocusEl, lazyMount: true, unmountOnExit: true, children: [trigger && _jsx(ArkDialog.Trigger, { asChild: true, children: trigger }), _jsxs(Portal, { children: [_jsx(ArkDialog.Backdrop, { className: "ds-dialog__backdrop" }), _jsx(ArkDialog.Positioner, { className: "ds-dialog__positioner", children: _jsx(ArkDialog.Content, { ref: panelRef, className: cx('ds-dialog', className), children: _jsxs(PortalContainerContext.Provider, { value: panelRef, children: [_jsxs("div", { className: "ds-dialog__header", children: [_jsxs("div", { className: "ds-dialog__heading", children: [_jsx(ArkDialog.Title, { className: "ds-dialog__title", children: title }), description && (_jsx(ArkDialog.Description, { className: "ds-dialog__description", children: description }))] }), dismissible && (_jsx(ArkDialog.CloseTrigger, { asChild: true, children: _jsx(IconButton, { icon: closeIcon, "aria-label": closeLabel, variant: "tertiary", size: "sm", className: "ds-dialog__close" }) }))] }), children && _jsx(DialogBody, { children: children }), actions && _jsx("div", { className: "ds-dialog__actions", children: actions })] }) }) })] })] }));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The scrolling body. While its content overflows it joins the tab order, so
|
|
56
|
+
* a keyboard user can focus it and scroll; a body with nothing to scroll
|
|
57
|
+
* stays out of the way.
|
|
58
|
+
*
|
|
59
|
+
* Two boxes are observed because either can change the answer: the outer one
|
|
60
|
+
* resizes with the viewport, the inner one with the content.
|
|
61
|
+
*/
|
|
62
|
+
function DialogBody({ children }) {
|
|
63
|
+
const [scrollable, setScrollable] = useState(false);
|
|
64
|
+
const observe = useCallback((scroller) => {
|
|
65
|
+
const content = scroller?.firstElementChild;
|
|
66
|
+
if (!scroller || !content)
|
|
67
|
+
return;
|
|
68
|
+
const observer = new ResizeObserver(() => setScrollable(scroller.scrollHeight > scroller.clientHeight));
|
|
69
|
+
observer.observe(scroller);
|
|
70
|
+
observer.observe(content);
|
|
71
|
+
return () => observer.disconnect();
|
|
72
|
+
}, []);
|
|
73
|
+
return (_jsx("div", { ref: observe, className: "ds-dialog__body", tabIndex: scrollable ? 0 : undefined, children: _jsx("div", { className: "ds-dialog__body-content", children: children }) }));
|
|
74
|
+
}
|
|
75
|
+
/*
|
|
76
|
+
* Fallback glyph, inlined for the reason Select's are: ui-core is public and
|
|
77
|
+
* may not reference the private icon package, so a default that ships inside
|
|
78
|
+
* it cannot be a licensed icon. Products override it via `closeIcon`.
|
|
79
|
+
*/
|
|
80
|
+
const Cross = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m4 4 8 8m0-8-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }));
|
|
81
|
+
Cross.displayName = 'DialogCross';
|
|
82
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/dialog/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAIL,WAAW,EACX,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf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F,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,cAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,iBAAiB,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YACjF,cAAK,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAO,GACrD,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,KAAK,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CACnC,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,kBAAkB,EACpB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
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,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
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,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
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,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,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,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Where a ui-core popup portals to. Unset, popups portal into `<body>`.
|
|
4
|
+
*
|
|
5
|
+
* A modal `Dialog` sets it to its panel. While a modal is open, Ark hides
|
|
6
|
+
* every sibling of the panel in `<body>` from assistive tech, once, when it
|
|
7
|
+
* opens; a popup portalled there afterwards, such as a Select's listbox,
|
|
8
|
+
* would be focused but hidden. Rendered inside the panel, it stays readable,
|
|
9
|
+
* inside the focus trap, and inside the area a click does not dismiss.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PortalContainerContext: import("react").Context<RefObject<HTMLElement | null> | undefined>;
|
|
12
|
+
//# sourceMappingURL=portal-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-container.d.ts","sourceRoot":"","sources":["../src/portal-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,oEAElC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Where a ui-core popup portals to. Unset, popups portal into `<body>`.
|
|
4
|
+
*
|
|
5
|
+
* A modal `Dialog` sets it to its panel. While a modal is open, Ark hides
|
|
6
|
+
* every sibling of the panel in `<body>` from assistive tech, once, when it
|
|
7
|
+
* opens; a popup portalled there afterwards, such as a Select's listbox,
|
|
8
|
+
* would be focused but hidden. Rendered inside the panel, it stays readable,
|
|
9
|
+
* inside the focus trap, and inside the area a click does not dismiss.
|
|
10
|
+
*/
|
|
11
|
+
export const PortalContainerContext = createContext(undefined);
|
|
12
|
+
//# sourceMappingURL=portal-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-container.js","sourceRoot":"","sources":["../src/portal-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,SAAS,CACV,CAAC"}
|
package/dist/select/select.d.ts
CHANGED
|
@@ -131,7 +131,9 @@ export interface SelectProps {
|
|
|
131
131
|
* The listbox renders in a portal, so it escapes ancestor `overflow: hidden`
|
|
132
132
|
* rather than being clipped inside a card. It sits at `z-index: 60`, a step
|
|
133
133
|
* above the products' overlay layer (50), so it paints above the page or
|
|
134
|
-
* dialog it opens from.
|
|
134
|
+
* dialog it opens from. Inside a ui-core `Dialog` it portals into the
|
|
135
|
+
* dialog's panel instead of `<body>`, so the modal does not hide it from
|
|
136
|
+
* assistive tech.
|
|
135
137
|
*/
|
|
136
138
|
export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator, itemIndicator, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
137
139
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,
|
|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;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,gGAAgG;IAChG,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,YAAY,EACZ,aAAa,EACb,IAAW,EACX,QAAQ,EACR,OAAe,EACf,WAAwB,EACxB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAwB,EACxB,aAAqB,EACrB,YAAY,EAAE,SAAS,GACxB,EAAE,WAAW,2CA8Fb"}
|
package/dist/select/select.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Portal } from '@ark-ui/react/portal';
|
|
3
3
|
import { Select as ArkSelect, createListCollection } from '@ark-ui/react/select';
|
|
4
|
-
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
5
5
|
import { Icon } from '../icon/icon';
|
|
6
|
+
import { PortalContainerContext } from '../portal-container';
|
|
6
7
|
import './select.css';
|
|
7
8
|
import { cx } from '../cx';
|
|
8
9
|
/**
|
|
@@ -30,7 +31,9 @@ import { cx } from '../cx';
|
|
|
30
31
|
* The listbox renders in a portal, so it escapes ancestor `overflow: hidden`
|
|
31
32
|
* rather than being clipped inside a card. It sits at `z-index: 60`, a step
|
|
32
33
|
* above the products' overlay layer (50), so it paints above the page or
|
|
33
|
-
* dialog it opens from.
|
|
34
|
+
* dialog it opens from. Inside a ui-core `Dialog` it portals into the
|
|
35
|
+
* dialog's panel instead of `<body>`, so the modal does not hide it from
|
|
36
|
+
* assistive tech.
|
|
34
37
|
*/
|
|
35
38
|
export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator = ChevronRight, itemIndicator = Check, 'aria-label': ariaLabel, }) {
|
|
36
39
|
const collection = useMemo(() => createListCollection({
|
|
@@ -65,8 +68,9 @@ export function Select({ items, label, placeholder, value, defaultValue, onValue
|
|
|
65
68
|
return undefined;
|
|
66
69
|
return items.some((item) => item.value === defaultValue) ? [defaultValue] : [];
|
|
67
70
|
}, [defaultValue, items]);
|
|
71
|
+
const portalContainer = useContext(PortalContainerContext);
|
|
68
72
|
const handleValueChange = useCallback((details) => onValueChange?.(details.value[0]), [onValueChange]);
|
|
69
|
-
return (_jsxs(ArkSelect.Root, { collection: collection, className: cx('ds-select', `ds-select--${size}`, className), value: controlledValue, defaultValue: initialValue, onValueChange: handleValueChange, disabled: disabled || loading, invalid: invalid, name: name, positioning: { sameWidth: true }, children: [label && _jsx(ArkSelect.Label, { className: "ds-select__label", children: label }), _jsx(ArkSelect.Control, { children: _jsxs(ArkSelect.Trigger, { className: "ds-select__trigger", "aria-label": ariaLabel, "aria-busy": loading || undefined, children: [_jsx(ArkSelect.ValueText, { placeholder: loading ? loadingText : placeholder, className: "ds-select__value-text" }), _jsx(ArkSelect.Indicator, { className: "ds-select__indicator", children: _jsx(Icon, { source: indicator, size: "sm", decorative: true }) })] }) }), _jsx(Portal, { children: _jsx(ArkSelect.Positioner, { children: _jsx(ArkSelect.Content, { className: "ds-select__content", children: items.map((item) => (_jsxs(ArkSelect.Item, { item: item, className: "ds-select__item", children: [_jsx(ArkSelect.ItemText, { children: renderItem ? renderItem(item) : item.label }), _jsx(ArkSelect.ItemIndicator, { className: "ds-select__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value))) }) }) }), _jsx(ArkSelect.HiddenSelect, {})] }));
|
|
73
|
+
return (_jsxs(ArkSelect.Root, { collection: collection, className: cx('ds-select', `ds-select--${size}`, className), value: controlledValue, defaultValue: initialValue, onValueChange: handleValueChange, disabled: disabled || loading, invalid: invalid, name: name, positioning: { sameWidth: true }, children: [label && _jsx(ArkSelect.Label, { className: "ds-select__label", children: label }), _jsx(ArkSelect.Control, { children: _jsxs(ArkSelect.Trigger, { className: "ds-select__trigger", "aria-label": ariaLabel, "aria-busy": loading || undefined, children: [_jsx(ArkSelect.ValueText, { placeholder: loading ? loadingText : placeholder, className: "ds-select__value-text" }), _jsx(ArkSelect.Indicator, { className: "ds-select__indicator", children: _jsx(Icon, { source: indicator, size: "sm", decorative: true }) })] }) }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkSelect.Positioner, { children: _jsx(ArkSelect.Content, { className: "ds-select__content", children: items.map((item) => (_jsxs(ArkSelect.Item, { item: item, className: "ds-select__item", children: [_jsx(ArkSelect.ItemText, { children: renderItem ? renderItem(item) : item.label }), _jsx(ArkSelect.ItemIndicator, { className: "ds-select__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value))) }) }) }), _jsx(ArkSelect.HiddenSelect, {})] }));
|
|
70
74
|
}
|
|
71
75
|
/*
|
|
72
76
|
* Fallback glyphs, inlined on purpose.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,E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AChB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEhD,MAAM,KAAK,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CACnC,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,kBAAkB,EACpB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"import": "./dist/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./alert": {
|
|
28
|
+
"types": "./dist/alert/index.d.ts",
|
|
29
|
+
"import": "./dist/alert/index.js"
|
|
30
|
+
},
|
|
27
31
|
"./badge": {
|
|
28
32
|
"types": "./dist/badge/index.d.ts",
|
|
29
33
|
"import": "./dist/badge/index.js"
|
|
@@ -36,6 +40,14 @@
|
|
|
36
40
|
"types": "./dist/card/index.d.ts",
|
|
37
41
|
"import": "./dist/card/index.js"
|
|
38
42
|
},
|
|
43
|
+
"./dialog": {
|
|
44
|
+
"types": "./dist/dialog/index.d.ts",
|
|
45
|
+
"import": "./dist/dialog/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./css/alert": {
|
|
48
|
+
"types": "./dist/alert/alert.css.d.ts",
|
|
49
|
+
"default": "./dist/alert/alert.css"
|
|
50
|
+
},
|
|
39
51
|
"./css/badge": {
|
|
40
52
|
"types": "./dist/badge/badge.css.d.ts",
|
|
41
53
|
"default": "./dist/badge/badge.css"
|
|
@@ -48,6 +60,10 @@
|
|
|
48
60
|
"types": "./dist/card/card.css.d.ts",
|
|
49
61
|
"default": "./dist/card/card.css"
|
|
50
62
|
},
|
|
63
|
+
"./css/dialog": {
|
|
64
|
+
"types": "./dist/dialog/dialog.css.d.ts",
|
|
65
|
+
"default": "./dist/dialog/dialog.css"
|
|
66
|
+
},
|
|
51
67
|
"./css/icon": {
|
|
52
68
|
"types": "./dist/icon/icon.css.d.ts",
|
|
53
69
|
"default": "./dist/icon/icon.css"
|
|
@@ -114,7 +130,7 @@
|
|
|
114
130
|
},
|
|
115
131
|
"devDependencies": {
|
|
116
132
|
"@manakind/ds-config": "*",
|
|
117
|
-
"@manakind/manuia-tokens": "0.
|
|
133
|
+
"@manakind/manuia-tokens": "0.6.0",
|
|
118
134
|
"@testing-library/jest-dom": "^6.9.1",
|
|
119
135
|
"@testing-library/react": "^16.3.2",
|
|
120
136
|
"@testing-library/user-event": "^14.6.1",
|