@ignite-ember/ui-react 0.0.0-stage → 0.2.1
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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +260 -2
- package/dist/CopySource.d.ts +4 -0
- package/dist/CopySource.d.ts.map +1 -0
- package/dist/CopySource.js +50 -0
- package/dist/CopySource.js.map +1 -0
- package/dist/DataTable.d.ts +77 -0
- package/dist/DataTable.d.ts.map +1 -0
- package/dist/DataTable.js +45 -0
- package/dist/DataTable.js.map +1 -0
- package/dist/Dialog.d.ts +41 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +94 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +97 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +97 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/LiveRegion.d.ts +41 -0
- package/dist/LiveRegion.d.ts.map +1 -0
- package/dist/LiveRegion.js +76 -0
- package/dist/LiveRegion.js.map +1 -0
- package/dist/Markdown.d.ts +22 -0
- package/dist/Markdown.d.ts.map +1 -0
- package/dist/Markdown.js +56 -0
- package/dist/Markdown.js.map +1 -0
- package/dist/MarkdownInline.d.ts +53 -0
- package/dist/MarkdownInline.d.ts.map +1 -0
- package/dist/MarkdownInline.js +159 -0
- package/dist/MarkdownInline.js.map +1 -0
- package/dist/MenuIcon.d.ts +60 -0
- package/dist/MenuIcon.d.ts.map +1 -0
- package/dist/MenuIcon.js +102 -0
- package/dist/MenuIcon.js.map +1 -0
- package/dist/Mermaid.d.ts +40 -0
- package/dist/Mermaid.d.ts.map +1 -0
- package/dist/Mermaid.js +121 -0
- package/dist/Mermaid.js.map +1 -0
- package/dist/Monogram.d.ts +46 -0
- package/dist/Monogram.d.ts.map +1 -0
- package/dist/Monogram.js +96 -0
- package/dist/Monogram.js.map +1 -0
- package/dist/OverflowMenu.d.ts +60 -0
- package/dist/OverflowMenu.d.ts.map +1 -0
- package/dist/OverflowMenu.js +149 -0
- package/dist/OverflowMenu.js.map +1 -0
- package/dist/Shell.d.ts +67 -0
- package/dist/Shell.d.ts.map +1 -0
- package/dist/Shell.js +44 -0
- package/dist/Shell.js.map +1 -0
- package/dist/Skeleton.d.ts +62 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/Skeleton.js +56 -0
- package/dist/Skeleton.js.map +1 -0
- package/dist/Split.d.ts +85 -0
- package/dist/Split.d.ts.map +1 -0
- package/dist/Split.js +156 -0
- package/dist/Split.js.map +1 -0
- package/dist/Tabs.d.ts +77 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +91 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Toast.d.ts +98 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +129 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Tooltip.d.ts +24 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +166 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/controls.d.ts +117 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +59 -0
- package/dist/controls.js.map +1 -0
- package/dist/cx.d.ts +3 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +5 -0
- package/dist/cx.js.map +1 -0
- package/dist/fenceInfo.d.ts +26 -0
- package/dist/fenceInfo.d.ts.map +1 -0
- package/dist/fenceInfo.js +22 -0
- package/dist/fenceInfo.js.map +1 -0
- package/dist/formControls.d.ts +143 -0
- package/dist/formControls.d.ts.map +1 -0
- package/dist/formControls.js +108 -0
- package/dist/formControls.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +95 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +93 -0
- package/dist/layout.js.map +1 -0
- package/dist/primitives.d.ts +33 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +33 -0
- package/dist/primitives.js.map +1 -0
- package/dist/progress.d.ts +64 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +51 -0
- package/dist/progress.js.map +1 -0
- package/dist/text.d.ts +63 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +61 -0
- package/dist/text.js.map +1 -0
- package/package.json +56 -4
- package/src/CopySource.tsx +67 -0
- package/src/DataTable.tsx +120 -0
- package/src/Dialog.tsx +158 -0
- package/src/ErrorBoundary.tsx +137 -0
- package/src/LiveRegion.tsx +127 -0
- package/src/Markdown.tsx +75 -0
- package/src/MarkdownInline.tsx +177 -0
- package/src/MenuIcon.tsx +209 -0
- package/src/Mermaid.tsx +144 -0
- package/src/Monogram.tsx +112 -0
- package/src/OverflowMenu.tsx +359 -0
- package/src/Shell.tsx +99 -0
- package/src/Skeleton.tsx +98 -0
- package/src/Split.tsx +267 -0
- package/src/Tabs.tsx +194 -0
- package/src/Toast.tsx +269 -0
- package/src/Tooltip.tsx +213 -0
- package/src/controls.tsx +159 -0
- package/src/cx.ts +4 -0
- package/src/fenceInfo.ts +36 -0
- package/src/formControls.tsx +249 -0
- package/src/index.ts +149 -0
- package/src/layout.tsx +141 -0
- package/src/primitives.tsx +33 -0
- package/src/progress.tsx +129 -0
- package/src/text.tsx +99 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The form controls: a drop-down, a multi-line field, a checkbox, a
|
|
3
|
+
* radio, a switch, and the field that labels any of them.
|
|
4
|
+
*
|
|
5
|
+
* Part of the primitives; see `primitives.tsx`. **Under the
|
|
6
|
+
* compatibility floor.**
|
|
7
|
+
*/
|
|
8
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, ReactNode, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
9
|
+
/** What a {@link Select} takes. */
|
|
10
|
+
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A drop-down.
|
|
14
|
+
*
|
|
15
|
+
* @param className — added to the element's classes, beside the one the
|
|
16
|
+
* theme gives it.
|
|
17
|
+
* @param rest — the remaining props, spread onto the select.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Select({ className, ...rest }: SelectProps): import("react").JSX.Element;
|
|
20
|
+
/** What a {@link Textarea} takes. */
|
|
21
|
+
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A multi-line text field.
|
|
25
|
+
*
|
|
26
|
+
* @param className — added to the element's classes, beside the one the
|
|
27
|
+
* theme gives it.
|
|
28
|
+
* @param rest — the remaining props, spread onto the textarea.
|
|
29
|
+
*/
|
|
30
|
+
export declare function Textarea({ className, ...rest }: TextareaProps): import("react").JSX.Element;
|
|
31
|
+
/** What a {@link Checkbox} takes. */
|
|
32
|
+
export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
33
|
+
/** The text beside the box. It is the accessible name too. */
|
|
34
|
+
label: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A native checkbox, wrapped in its own label.
|
|
38
|
+
*
|
|
39
|
+
* Wrapped rather than associated by `id`, because an `id` an
|
|
40
|
+
* extension forgets to make unique is a label that checks somebody
|
|
41
|
+
* else's box — and nothing about the page looks wrong when it does.
|
|
42
|
+
*
|
|
43
|
+
* @param label — the text beside the box, and the accessible name too.
|
|
44
|
+
* @param className — added to the label's classes, beside the one the
|
|
45
|
+
* theme gives it.
|
|
46
|
+
* @param rest — the remaining props, spread onto the input inside the
|
|
47
|
+
* label.
|
|
48
|
+
*/
|
|
49
|
+
export declare function Checkbox({ label, className, ...rest }: CheckboxProps): import("react").JSX.Element;
|
|
50
|
+
/** What a {@link Radio} takes. */
|
|
51
|
+
export interface RadioProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
52
|
+
/** The text beside the box. It is the accessible name too. */
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A native radio, wrapped in its own label.
|
|
57
|
+
*
|
|
58
|
+
* Wrapped for the same reason a {@link Checkbox} is: an `id` an
|
|
59
|
+
* extension forgets to make unique is a label that picks somebody
|
|
60
|
+
* else's radio.
|
|
61
|
+
*
|
|
62
|
+
* @param label — the text beside the box, and the accessible name too.
|
|
63
|
+
* @param className — added to the label's classes, beside the one the
|
|
64
|
+
* theme gives it.
|
|
65
|
+
* @param rest — the remaining props, spread onto the input inside the
|
|
66
|
+
* label.
|
|
67
|
+
*/
|
|
68
|
+
export declare function Radio({ label, className, ...rest }: RadioProps): import("react").JSX.Element;
|
|
69
|
+
/** What a {@link Switch} takes. */
|
|
70
|
+
export interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
|
|
71
|
+
/** Whether it is on. */
|
|
72
|
+
checked: boolean;
|
|
73
|
+
/** Called with the next value. It takes effect at once. */
|
|
74
|
+
onChange: (next: boolean) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Shown beside the switch, and used as its accessible name.
|
|
77
|
+
*
|
|
78
|
+
* Visible, like `Checkbox.label` and `Radio.label`, so the one prop
|
|
79
|
+
* name means the same thing on all three and a sighted user reads
|
|
80
|
+
* what the toggle is for.
|
|
81
|
+
*/
|
|
82
|
+
label: ReactNode;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A switch, which is a button rather than a checkbox.
|
|
86
|
+
*
|
|
87
|
+
* The difference is not cosmetic. A checkbox is a value you submit; a
|
|
88
|
+
* switch takes effect the moment it moves. `role="switch"` is what
|
|
89
|
+
* tells a screen reader which of those it is looking at.
|
|
90
|
+
*
|
|
91
|
+
* @param checked — whether it is on.
|
|
92
|
+
* @param onChange — called with the next value; it takes effect at
|
|
93
|
+
* once.
|
|
94
|
+
* @param label — shown beside the switch, and used as its accessible
|
|
95
|
+
* name.
|
|
96
|
+
* @param className — added to the element's classes, beside the one the
|
|
97
|
+
* theme gives it.
|
|
98
|
+
* @param rest — the remaining props, spread onto the button.
|
|
99
|
+
*/
|
|
100
|
+
export declare function Switch({ checked, onChange, label, className, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* A label, a control, and room for the reason it is wrong.
|
|
103
|
+
*
|
|
104
|
+
* The error slot is the part that gets left out, and a form that
|
|
105
|
+
* rejects input without saying why is the one people abandon. When
|
|
106
|
+
* `htmlFor` is set and the control is a single element, `error` (or
|
|
107
|
+
* `hint`) is wired to it through `aria-describedby`, and an `error`
|
|
108
|
+
* also sets `aria-invalid`, so it is announced rather than merely
|
|
109
|
+
* shown. Without `htmlFor` the note is shown and nothing points at it.
|
|
110
|
+
*/
|
|
111
|
+
export interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
112
|
+
/** The label. It is visible, not a placeholder. */
|
|
113
|
+
label: ReactNode;
|
|
114
|
+
/** A sentence under the control, for when nothing is wrong. */
|
|
115
|
+
hint?: ReactNode;
|
|
116
|
+
/** Why the control is wrong. It replaces the hint while it is set. */
|
|
117
|
+
error?: ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* The id of the control, so the label points at it. Also what wires
|
|
120
|
+
* `error` and `hint` to the control: without it, nothing does.
|
|
121
|
+
*/
|
|
122
|
+
htmlFor?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A label, a control, and room for the reason it is wrong.
|
|
126
|
+
*
|
|
127
|
+
* See {@link FieldProps}. The error slot is the part that gets left
|
|
128
|
+
* out, and a form that rejects input without saying why is the one
|
|
129
|
+
* people abandon.
|
|
130
|
+
*
|
|
131
|
+
* @param label — the label, which is visible rather than a placeholder.
|
|
132
|
+
* @param hint — a sentence under the control, for when nothing is
|
|
133
|
+
* wrong.
|
|
134
|
+
* @param error — why the control is wrong; it replaces the hint while
|
|
135
|
+
* it is set.
|
|
136
|
+
* @param htmlFor — the id of the control, so the label points at it.
|
|
137
|
+
* @param children — the control the label is for.
|
|
138
|
+
* @param className — added to the element's classes, beside the one the
|
|
139
|
+
* theme gives it.
|
|
140
|
+
* @param rest — the remaining props, spread onto the element.
|
|
141
|
+
*/
|
|
142
|
+
export declare function Field({ label, hint, error, htmlFor, children, className, ...rest }: FieldProps): import("react").JSX.Element;
|
|
143
|
+
//# sourceMappingURL=formControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formControls.d.ts","sourceRoot":"","sources":["../src/formControls.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EAEnB,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,OAAO,CAAC;AAKf,mCAAmC;AACnC,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAE/E;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAEzD;AAED,qCAAqC;AACrC,MAAM,WAAW,aAAc,SAAQ,sBAAsB,CAAC,mBAAmB,CAAC;CAAG;AAErF;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,+BAE7D;AAED,qCAAqC;AACrC,MAAM,WAAW,aAAc,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC1E,8DAA8D;IAC9D,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,+BAOpE;AAED,kCAAkC;AAClC,MAAM,WAAW,UAAW,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACvE,8DAA8D;IAC9D,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,+BAO9D;AAED,mCAAmC;AACnC,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,CACX;IACC,wBAAwB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,GAAG,IAAI,EACR,EAAE,WAAW,+BAoBb;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,mDAAmD;IACnD,KAAK,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,UAAU,+BA8BZ"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, isValidElement, useId } from "react";
|
|
3
|
+
import { cx } from "./cx.js";
|
|
4
|
+
/**
|
|
5
|
+
* A drop-down.
|
|
6
|
+
*
|
|
7
|
+
* @param className — added to the element's classes, beside the one the
|
|
8
|
+
* theme gives it.
|
|
9
|
+
* @param rest — the remaining props, spread onto the select.
|
|
10
|
+
*/
|
|
11
|
+
export function Select({ className, ...rest }) {
|
|
12
|
+
return _jsx("select", { ...rest, className: cx("ui-select", className) });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A multi-line text field.
|
|
16
|
+
*
|
|
17
|
+
* @param className — added to the element's classes, beside the one the
|
|
18
|
+
* theme gives it.
|
|
19
|
+
* @param rest — the remaining props, spread onto the textarea.
|
|
20
|
+
*/
|
|
21
|
+
export function Textarea({ className, ...rest }) {
|
|
22
|
+
return _jsx("textarea", { ...rest, className: cx("ui-textarea", className) });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A native checkbox, wrapped in its own label.
|
|
26
|
+
*
|
|
27
|
+
* Wrapped rather than associated by `id`, because an `id` an
|
|
28
|
+
* extension forgets to make unique is a label that checks somebody
|
|
29
|
+
* else's box — and nothing about the page looks wrong when it does.
|
|
30
|
+
*
|
|
31
|
+
* @param label — the text beside the box, and the accessible name too.
|
|
32
|
+
* @param className — added to the label's classes, beside the one the
|
|
33
|
+
* theme gives it.
|
|
34
|
+
* @param rest — the remaining props, spread onto the input inside the
|
|
35
|
+
* label.
|
|
36
|
+
*/
|
|
37
|
+
export function Checkbox({ label, className, ...rest }) {
|
|
38
|
+
return (_jsxs("label", { className: cx("ui-check", className), children: [_jsx("input", { ...rest, type: "checkbox" }), _jsx("span", { children: label })] }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A native radio, wrapped in its own label.
|
|
42
|
+
*
|
|
43
|
+
* Wrapped for the same reason a {@link Checkbox} is: an `id` an
|
|
44
|
+
* extension forgets to make unique is a label that picks somebody
|
|
45
|
+
* else's radio.
|
|
46
|
+
*
|
|
47
|
+
* @param label — the text beside the box, and the accessible name too.
|
|
48
|
+
* @param className — added to the label's classes, beside the one the
|
|
49
|
+
* theme gives it.
|
|
50
|
+
* @param rest — the remaining props, spread onto the input inside the
|
|
51
|
+
* label.
|
|
52
|
+
*/
|
|
53
|
+
export function Radio({ label, className, ...rest }) {
|
|
54
|
+
return (_jsxs("label", { className: cx("ui-check", className), children: [_jsx("input", { ...rest, type: "radio" }), _jsx("span", { children: label })] }));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A switch, which is a button rather than a checkbox.
|
|
58
|
+
*
|
|
59
|
+
* The difference is not cosmetic. A checkbox is a value you submit; a
|
|
60
|
+
* switch takes effect the moment it moves. `role="switch"` is what
|
|
61
|
+
* tells a screen reader which of those it is looking at.
|
|
62
|
+
*
|
|
63
|
+
* @param checked — whether it is on.
|
|
64
|
+
* @param onChange — called with the next value; it takes effect at
|
|
65
|
+
* once.
|
|
66
|
+
* @param label — shown beside the switch, and used as its accessible
|
|
67
|
+
* name.
|
|
68
|
+
* @param className — added to the element's classes, beside the one the
|
|
69
|
+
* theme gives it.
|
|
70
|
+
* @param rest — the remaining props, spread onto the button.
|
|
71
|
+
*/
|
|
72
|
+
export function Switch({ checked, onChange, label, className, ...rest }) {
|
|
73
|
+
const id = useId();
|
|
74
|
+
return (_jsxs("span", { className: "ui-check", children: [_jsx("button", { ...rest, type: "button", role: "switch", "aria-checked": checked, "aria-labelledby": id, onClick: () => onChange(!checked), className: cx("ui-switch", className) }), _jsx("span", { id: id, children: label })] }));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A label, a control, and room for the reason it is wrong.
|
|
78
|
+
*
|
|
79
|
+
* See {@link FieldProps}. The error slot is the part that gets left
|
|
80
|
+
* out, and a form that rejects input without saying why is the one
|
|
81
|
+
* people abandon.
|
|
82
|
+
*
|
|
83
|
+
* @param label — the label, which is visible rather than a placeholder.
|
|
84
|
+
* @param hint — a sentence under the control, for when nothing is
|
|
85
|
+
* wrong.
|
|
86
|
+
* @param error — why the control is wrong; it replaces the hint while
|
|
87
|
+
* it is set.
|
|
88
|
+
* @param htmlFor — the id of the control, so the label points at it.
|
|
89
|
+
* @param children — the control the label is for.
|
|
90
|
+
* @param className — added to the element's classes, beside the one the
|
|
91
|
+
* theme gives it.
|
|
92
|
+
* @param rest — the remaining props, spread onto the element.
|
|
93
|
+
*/
|
|
94
|
+
export function Field({ label, hint, error, htmlFor, children, className, ...rest }) {
|
|
95
|
+
const describedBy = htmlFor ? `${htmlFor}-note` : undefined;
|
|
96
|
+
// Cloned, not merely rendered beside: the control has to point at
|
|
97
|
+
// the note through `aria-describedby` for the note to be announced,
|
|
98
|
+
// and a Field cannot set an attribute on an opaque child any other
|
|
99
|
+
// way.
|
|
100
|
+
const control = isValidElement(children) && describedBy && (error || hint)
|
|
101
|
+
? cloneElement(children, {
|
|
102
|
+
"aria-describedby": describedBy,
|
|
103
|
+
...(error ? { "aria-invalid": true } : {}),
|
|
104
|
+
})
|
|
105
|
+
: children;
|
|
106
|
+
return (_jsxs("div", { ...rest, className: cx("ui-field", className), children: [_jsx("label", { className: "ui-label", htmlFor: htmlFor, children: label }), control, error ? (_jsx("span", { className: "ui-error", id: describedBy, role: "alert", children: error })) : hint ? (_jsx("span", { className: "ui-hint", id: describedBy, children: hint })) : null] }));
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=formControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formControls.js","sourceRoot":"","sources":["../src/formControls.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAK7B;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAe;IACxD,OAAO,oBAAY,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,GAAI,CAAC;AACrE,CAAC;AAKD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,SAAS,EA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,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACI;IACX,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,kEAAkE;IAClE,oEAAoE;IACpE,mEAAmE;IACnE,OAAO;IACP,MAAM,OAAO,GACX,cAAc,CAAC,QAAQ,CAAC,IAAI,WAAW,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QACxD,CAAC,CAAC,YAAY,CAAC,QAAiD,EAAE;YAC9D,kBAAkB,EAAE,WAAW;YAC/B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3C,CAAC;QACJ,CAAC,CAAC,QAAQ,CAAC;IACf,OAAO,CACL,kBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACjD,gBAAO,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YACzC,KAAK,GACA,EACP,OAAO,EACP,KAAK,CAAC,CAAC,CAAC,CACP,eAAM,SAAS,EAAC,UAAU,EAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAC,OAAO,YACrD,KAAK,GACD,CACR,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,eAAM,SAAS,EAAC,SAAS,EAAC,EAAE,EAAE,WAAW,YACtC,IAAI,GACA,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignite-ember/ui-react — the components an extension is allowed to build on.
|
|
3
|
+
*
|
|
4
|
+
* This list is not a guess at what an extension might want. It is
|
|
5
|
+
* what the extensions actually import, measured rather than estimated.
|
|
6
|
+
*
|
|
7
|
+
* Those components were never the whole floor, though. An extension also writes
|
|
8
|
+
* `className="btn btn-primary"` by hand, and so would every
|
|
9
|
+
* other — the primitives existed as CSS and not as an API, which
|
|
10
|
+
* is no autocomplete, no way to learn a variant name short of
|
|
11
|
+
* reading `theme.css`, and nothing to stop `btn-primery` shipping as
|
|
12
|
+
* an invisible bug. `./primitives` closes that: thin typed wrappers
|
|
13
|
+
* over classes the app already uses.
|
|
14
|
+
*
|
|
15
|
+
* They are React, not web components, because most of them are
|
|
16
|
+
* worse as web components: `MarkdownInline` and `RichFences` are a
|
|
17
|
+
* react-markdown pipeline with remark and rehype plugins, and
|
|
18
|
+
* `Tooltip` and `OverflowMenu` are positioning behaviour that wants
|
|
19
|
+
* the light DOM. Rewriting those inside a shadow root would mean
|
|
20
|
+
* maintaining a second implementation of something the app already
|
|
21
|
+
* has — the drift this repository has been bitten by.
|
|
22
|
+
*
|
|
23
|
+
* An extension runs in its own frame and bundles its own React, so
|
|
24
|
+
* consuming a React package costs it nothing it was not already
|
|
25
|
+
* paying.
|
|
26
|
+
*
|
|
27
|
+
* **Everything exported here is under the compatibility floor.**
|
|
28
|
+
* Removing one, renaming it, or changing a prop's meaning is a
|
|
29
|
+
* breaking change under EXTENSIBILITY.md §8. Anything in the app
|
|
30
|
+
* that is not exported here stays ours to change — which is why this
|
|
31
|
+
* file is short and should be argued over before it grows.
|
|
32
|
+
*
|
|
33
|
+
* ## The two rules an export has to pass
|
|
34
|
+
*
|
|
35
|
+
* **It must render outside this repository.** A component whose CSS
|
|
36
|
+
* lives only in ``theme.css`` is unstyled in the one place it is
|
|
37
|
+
* promised for, because an extension runs on its own origin under
|
|
38
|
+
* ``default-src 'self'`` and cannot link ours. ``styled.test.ts``
|
|
39
|
+
* checks every class named here against ``clients/ui/igni-ui.css``
|
|
40
|
+
* and fails on the first one that is missing. This was not a
|
|
41
|
+
* hypothetical: seven components shipped under the floor naming
|
|
42
|
+
* thirty-two classes that no published stylesheet defined, and the
|
|
43
|
+
* reference extension did not catch it because it happens to import
|
|
44
|
+
* only from ``primitives``, which is the half that was covered.
|
|
45
|
+
*
|
|
46
|
+
* **It must not drag the app behind it.** ``boundary.test.ts``
|
|
47
|
+
* fails on an import — static or dynamic — that leaves this
|
|
48
|
+
* directory for anywhere but ``react`` and the published
|
|
49
|
+
* dependencies. ``SpecBlock`` left the floor for this reason: it
|
|
50
|
+
* loaded ``../components/JsonRenderView``, a path that does not
|
|
51
|
+
* exist in a published package, through a dynamic import that no
|
|
52
|
+
* compiler would flag. ``visualizationStream`` left for the same
|
|
53
|
+
* reason — it types its return as the app's ``ChatItem``, which
|
|
54
|
+
* would have put the chat model under the floor by transitivity.
|
|
55
|
+
*
|
|
56
|
+
* Helpers that only their own tests imported — ``closeOpenMarks``,
|
|
57
|
+
* ``dropEchoedTitle``, ``hexOf``, ``hueOf``, ``initialsOf`` — are
|
|
58
|
+
* gone from here too. They were exported to be tested, and tests in
|
|
59
|
+
* this repository can import them from their own module. Putting
|
|
60
|
+
* them here promised them to extensions for two releases.
|
|
61
|
+
*/
|
|
62
|
+
export { Actions, Badge, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type BadgeProps, Card, Chip, type ChipProps, Dialog, type DialogProps, Empty, type EmptyProps, Input, type InputProps, Item, List, Row, Checkbox, type CheckboxProps, Code, Divider, Field, type FieldProps, Heading, type HeadingProps, Progress, type ProgressProps, Radio, type RadioProps, Select, type SelectProps, Spinner, type SpinnerProps, Switch, type SwitchProps, Table, TabPanel, type TabPanelProps, Tabs, type TabsProps, Text, type TextProps, type TextTone, Textarea, type TextareaProps, type Tone, Toolbar, } from "./primitives.js";
|
|
63
|
+
export { AppShell, type AppShellProps, Scroll, type ScrollProps } from "./Shell.js";
|
|
64
|
+
export { SortableTh, type SortableThProps, type SortDirection, Status, type StatusProps, } from "./DataTable.js";
|
|
65
|
+
export { ErrorBoundary, type ErrorBoundaryProps } from "./ErrorBoundary.js";
|
|
66
|
+
export { Banner, type BannerProps, type Toast, type ToastApi, ToastHost, type ToastOptions, useToast, } from "./Toast.js";
|
|
67
|
+
export { type Announcer, LiveRegion, type LiveRegionProps, useAnnounce, type Urgency, } from "./LiveRegion.js";
|
|
68
|
+
export { Markdown, type MarkdownProps } from "./Markdown.js";
|
|
69
|
+
export { MarkdownInline } from "./MarkdownInline.js";
|
|
70
|
+
export { Split, type SplitProps } from "./Split.js";
|
|
71
|
+
export { MenuIcon, type MenuIconName, type MenuIconProps } from "./MenuIcon.js";
|
|
72
|
+
export { Monogram } from "./Monogram.js";
|
|
73
|
+
export { OverflowMenu, type OverflowAction } from "./OverflowMenu.js";
|
|
74
|
+
export { fenceInfo } from "./fenceInfo.js";
|
|
75
|
+
export { MermaidBlock, loadMermaid } from "./Mermaid.js";
|
|
76
|
+
export { Skeleton } from "./Skeleton.js";
|
|
77
|
+
export { Tooltip, type TooltipProps } from "./Tooltip.js";
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,EACL,OAAO,EACP,KAAK,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,IAAI,EACJ,IAAI,EACJ,KAAK,SAAS,EACd,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,EACL,KAAK,UAAU,EACf,KAAK,EACL,KAAK,UAAU,EACf,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,KAAK,aAAa,EAClB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,YAAY,EACjB,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,EACL,KAAK,UAAU,EACf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AE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignite-ember/ui-react — the components an extension is allowed to build on.
|
|
3
|
+
*
|
|
4
|
+
* This list is not a guess at what an extension might want. It is
|
|
5
|
+
* what the extensions actually import, measured rather than estimated.
|
|
6
|
+
*
|
|
7
|
+
* Those components were never the whole floor, though. An extension also writes
|
|
8
|
+
* `className="btn btn-primary"` by hand, and so would every
|
|
9
|
+
* other — the primitives existed as CSS and not as an API, which
|
|
10
|
+
* is no autocomplete, no way to learn a variant name short of
|
|
11
|
+
* reading `theme.css`, and nothing to stop `btn-primery` shipping as
|
|
12
|
+
* an invisible bug. `./primitives` closes that: thin typed wrappers
|
|
13
|
+
* over classes the app already uses.
|
|
14
|
+
*
|
|
15
|
+
* They are React, not web components, because most of them are
|
|
16
|
+
* worse as web components: `MarkdownInline` and `RichFences` are a
|
|
17
|
+
* react-markdown pipeline with remark and rehype plugins, and
|
|
18
|
+
* `Tooltip` and `OverflowMenu` are positioning behaviour that wants
|
|
19
|
+
* the light DOM. Rewriting those inside a shadow root would mean
|
|
20
|
+
* maintaining a second implementation of something the app already
|
|
21
|
+
* has — the drift this repository has been bitten by.
|
|
22
|
+
*
|
|
23
|
+
* An extension runs in its own frame and bundles its own React, so
|
|
24
|
+
* consuming a React package costs it nothing it was not already
|
|
25
|
+
* paying.
|
|
26
|
+
*
|
|
27
|
+
* **Everything exported here is under the compatibility floor.**
|
|
28
|
+
* Removing one, renaming it, or changing a prop's meaning is a
|
|
29
|
+
* breaking change under EXTENSIBILITY.md §8. Anything in the app
|
|
30
|
+
* that is not exported here stays ours to change — which is why this
|
|
31
|
+
* file is short and should be argued over before it grows.
|
|
32
|
+
*
|
|
33
|
+
* ## The two rules an export has to pass
|
|
34
|
+
*
|
|
35
|
+
* **It must render outside this repository.** A component whose CSS
|
|
36
|
+
* lives only in ``theme.css`` is unstyled in the one place it is
|
|
37
|
+
* promised for, because an extension runs on its own origin under
|
|
38
|
+
* ``default-src 'self'`` and cannot link ours. ``styled.test.ts``
|
|
39
|
+
* checks every class named here against ``clients/ui/igni-ui.css``
|
|
40
|
+
* and fails on the first one that is missing. This was not a
|
|
41
|
+
* hypothetical: seven components shipped under the floor naming
|
|
42
|
+
* thirty-two classes that no published stylesheet defined, and the
|
|
43
|
+
* reference extension did not catch it because it happens to import
|
|
44
|
+
* only from ``primitives``, which is the half that was covered.
|
|
45
|
+
*
|
|
46
|
+
* **It must not drag the app behind it.** ``boundary.test.ts``
|
|
47
|
+
* fails on an import — static or dynamic — that leaves this
|
|
48
|
+
* directory for anywhere but ``react`` and the published
|
|
49
|
+
* dependencies. ``SpecBlock`` left the floor for this reason: it
|
|
50
|
+
* loaded ``../components/JsonRenderView``, a path that does not
|
|
51
|
+
* exist in a published package, through a dynamic import that no
|
|
52
|
+
* compiler would flag. ``visualizationStream`` left for the same
|
|
53
|
+
* reason — it types its return as the app's ``ChatItem``, which
|
|
54
|
+
* would have put the chat model under the floor by transitivity.
|
|
55
|
+
*
|
|
56
|
+
* Helpers that only their own tests imported — ``closeOpenMarks``,
|
|
57
|
+
* ``dropEchoedTitle``, ``hexOf``, ``hueOf``, ``initialsOf`` — are
|
|
58
|
+
* gone from here too. They were exported to be tested, and tests in
|
|
59
|
+
* this repository can import them from their own module. Putting
|
|
60
|
+
* them here promised them to extensions for two releases.
|
|
61
|
+
*/
|
|
62
|
+
export { Actions, Badge, Button, Card, Chip, Dialog, Empty, Input, Item, List, Row, Checkbox, Code, Divider, Field, Heading, Progress, Radio, Select, Spinner, Switch, Table, TabPanel, Tabs, Text, Textarea, Toolbar, } from "./primitives.js";
|
|
63
|
+
export { AppShell, Scroll } from "./Shell.js";
|
|
64
|
+
export { SortableTh, Status, } from "./DataTable.js";
|
|
65
|
+
export { ErrorBoundary } from "./ErrorBoundary.js";
|
|
66
|
+
export { Banner, ToastHost, useToast, } from "./Toast.js";
|
|
67
|
+
export { LiveRegion, useAnnounce, } from "./LiveRegion.js";
|
|
68
|
+
export { Markdown } from "./Markdown.js";
|
|
69
|
+
export { MarkdownInline } from "./MarkdownInline.js";
|
|
70
|
+
export { Split } from "./Split.js";
|
|
71
|
+
export { MenuIcon } from "./MenuIcon.js";
|
|
72
|
+
export { Monogram } from "./Monogram.js";
|
|
73
|
+
export { OverflowMenu } from "./OverflowMenu.js";
|
|
74
|
+
export { fenceInfo } from "./fenceInfo.js";
|
|
75
|
+
export { MermaidBlock, loadMermaid } from "./Mermaid.js";
|
|
76
|
+
export { Skeleton } from "./Skeleton.js";
|
|
77
|
+
export { Tooltip } from "./Tooltip.js";
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,EACL,OAAO,EACP,KAAK,EACL,MAAM,EAKN,IAAI,EACJ,IAAI,EAEJ,MAAM,EAEN,KAAK,EAEL,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,QAAQ,EAER,IAAI,EACJ,OAAO,EACP,KAAK,EAEL,OAAO,EAEP,QAAQ,EAER,KAAK,EAEL,MAAM,EAEN,OAAO,EAEP,MAAM,EAEN,KAAK,EACL,QAAQ,EAER,IAAI,EAEJ,IAAI,EAGJ,QAAQ,EAGR,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAsB,MAAM,EAAoB,MAAM,YAAY,CAAC;AACpF,OAAO,EACL,UAAU,EAGV,MAAM,GAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,MAAM,EAIN,SAAS,EAET,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,UAAU,EAEV,WAAW,GAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAyC,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boxes a panel is laid out in: rows, stacks, a toolbar, a card,
|
|
3
|
+
* a selectable item, a table and an empty state.
|
|
4
|
+
*
|
|
5
|
+
* Part of the primitives; see `primitives.tsx`. **Under the
|
|
6
|
+
* compatibility floor.**
|
|
7
|
+
*/
|
|
8
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";
|
|
9
|
+
/**
|
|
10
|
+
* A horizontal run of things, vertically centred.
|
|
11
|
+
*
|
|
12
|
+
* @param className — added to the element's classes, beside the one the
|
|
13
|
+
* theme gives it.
|
|
14
|
+
* @param rest — the remaining props, spread onto the row.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Row({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
17
|
+
/** A horizontal run of buttons. Separate from `Row` because it is
|
|
18
|
+
* what a reader looks for at the foot of a panel.
|
|
19
|
+
*
|
|
20
|
+
* @param className — added to the element's classes, beside the one the
|
|
21
|
+
* theme gives it.
|
|
22
|
+
* @param rest — the remaining props, spread onto the row of actions.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Actions({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* A vertical stack.
|
|
27
|
+
*
|
|
28
|
+
* @param className — added to the element's classes, beside the one the
|
|
29
|
+
* theme gives it.
|
|
30
|
+
* @param rest — the remaining props, spread onto the list.
|
|
31
|
+
*/
|
|
32
|
+
export declare function List({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* A row of controls at the top of a panel: what the panel is, and what
|
|
35
|
+
* you can do to it.
|
|
36
|
+
*
|
|
37
|
+
* @param className — added to the element's classes, beside the one the
|
|
38
|
+
* theme gives it.
|
|
39
|
+
* @param rest — the remaining props, spread onto the toolbar.
|
|
40
|
+
*/
|
|
41
|
+
export declare function Toolbar({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* A surface: background, border, radius, padding.
|
|
44
|
+
*
|
|
45
|
+
* @param className — added to the element's classes, beside the one the
|
|
46
|
+
* theme gives it.
|
|
47
|
+
* @param rest — the remaining props, spread onto the card.
|
|
48
|
+
*/
|
|
49
|
+
export declare function Card({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
50
|
+
/** One selectable row inside a list. Renders a button, because
|
|
51
|
+
* something clickable that is not a button is a keyboard trap.
|
|
52
|
+
*
|
|
53
|
+
* @param className — added to the element's classes, beside the one the
|
|
54
|
+
* theme gives it.
|
|
55
|
+
* @param rest — the remaining props, spread onto the button.
|
|
56
|
+
*/
|
|
57
|
+
export declare function Item({ className, ...rest }: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* A table.
|
|
60
|
+
*
|
|
61
|
+
* The class only; the head, the rows and the cells are yours, because
|
|
62
|
+
* a table that decides its own columns is a table you cannot use for
|
|
63
|
+
* anything the app has not already seen.
|
|
64
|
+
*
|
|
65
|
+
* @param className — added to the element's classes, beside the one the
|
|
66
|
+
* theme gives it.
|
|
67
|
+
* @param rest — the remaining props, spread onto the table.
|
|
68
|
+
*/
|
|
69
|
+
export declare function Table({ className, ...rest }: HTMLAttributes<HTMLTableElement>): import("react").JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* What to show where there is nothing.
|
|
72
|
+
*
|
|
73
|
+
* Its own component rather than a paragraph with a class, because an
|
|
74
|
+
* empty state that says only "nothing here" is the commonest way a
|
|
75
|
+
* panel wastes the one moment it had the reader's attention. The
|
|
76
|
+
* `action` slot is a nudge to say what to do next.
|
|
77
|
+
*/
|
|
78
|
+
export interface EmptyProps extends HTMLAttributes<HTMLDivElement> {
|
|
79
|
+
/** A button, usually: the one thing to do about being empty. */
|
|
80
|
+
action?: ReactNode;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* What to show where there is nothing.
|
|
84
|
+
*
|
|
85
|
+
* See {@link EmptyProps} for why the `action` slot exists.
|
|
86
|
+
*
|
|
87
|
+
* @param children — what to show where there is nothing.
|
|
88
|
+
* @param action — a button, usually: the one thing to do about being
|
|
89
|
+
* empty.
|
|
90
|
+
* @param className — added to the element's classes, beside the one the
|
|
91
|
+
* theme gives it.
|
|
92
|
+
* @param rest — the remaining props, spread onto the element.
|
|
93
|
+
*/
|
|
94
|
+
export declare function Empty({ children, action, className, ...rest }: EmptyProps): import("react").JSX.Element;
|
|
95
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
/**
|
|
4
|
+
* A horizontal run of things, vertically centred.
|
|
5
|
+
*
|
|
6
|
+
* @param className — added to the element's classes, beside the one the
|
|
7
|
+
* theme gives it.
|
|
8
|
+
* @param rest — the remaining props, spread onto the row.
|
|
9
|
+
*/
|
|
10
|
+
export function Row({ className, ...rest }) {
|
|
11
|
+
return _jsx("div", { ...rest, className: cx("ui-row", className) });
|
|
12
|
+
}
|
|
13
|
+
/** A horizontal run of buttons. Separate from `Row` because it is
|
|
14
|
+
* what a reader looks for at the foot of a panel.
|
|
15
|
+
*
|
|
16
|
+
* @param className — added to the element's classes, beside the one the
|
|
17
|
+
* theme gives it.
|
|
18
|
+
* @param rest — the remaining props, spread onto the row of actions.
|
|
19
|
+
*/
|
|
20
|
+
export function Actions({ className, ...rest }) {
|
|
21
|
+
return _jsx("div", { ...rest, className: cx("ui-actions", className) });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A vertical stack.
|
|
25
|
+
*
|
|
26
|
+
* @param className — added to the element's classes, beside the one the
|
|
27
|
+
* theme gives it.
|
|
28
|
+
* @param rest — the remaining props, spread onto the list.
|
|
29
|
+
*/
|
|
30
|
+
export function List({ className, ...rest }) {
|
|
31
|
+
return _jsx("div", { ...rest, className: cx("ui-list", className) });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A row of controls at the top of a panel: what the panel is, and what
|
|
35
|
+
* you can do to it.
|
|
36
|
+
*
|
|
37
|
+
* @param className — added to the element's classes, beside the one the
|
|
38
|
+
* theme gives it.
|
|
39
|
+
* @param rest — the remaining props, spread onto the toolbar.
|
|
40
|
+
*/
|
|
41
|
+
export function Toolbar({ className, ...rest }) {
|
|
42
|
+
return _jsx("div", { ...rest, className: cx("ui-toolbar", className) });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A surface: background, border, radius, padding.
|
|
46
|
+
*
|
|
47
|
+
* @param className — added to the element's classes, beside the one the
|
|
48
|
+
* theme gives it.
|
|
49
|
+
* @param rest — the remaining props, spread onto the card.
|
|
50
|
+
*/
|
|
51
|
+
export function Card({ className, ...rest }) {
|
|
52
|
+
return _jsx("div", { ...rest, className: cx("ui-card", className) });
|
|
53
|
+
}
|
|
54
|
+
/** One selectable row inside a list. Renders a button, because
|
|
55
|
+
* something clickable that is not a button is a keyboard trap.
|
|
56
|
+
*
|
|
57
|
+
* @param className — added to the element's classes, beside the one the
|
|
58
|
+
* theme gives it.
|
|
59
|
+
* @param rest — the remaining props, spread onto the button.
|
|
60
|
+
*/
|
|
61
|
+
export function Item({ className, ...rest }) {
|
|
62
|
+
return (_jsx("button", { type: "button", ...rest, className: cx("ui-item", className) }));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A table.
|
|
66
|
+
*
|
|
67
|
+
* The class only; the head, the rows and the cells are yours, because
|
|
68
|
+
* a table that decides its own columns is a table you cannot use for
|
|
69
|
+
* anything the app has not already seen.
|
|
70
|
+
*
|
|
71
|
+
* @param className — added to the element's classes, beside the one the
|
|
72
|
+
* theme gives it.
|
|
73
|
+
* @param rest — the remaining props, spread onto the table.
|
|
74
|
+
*/
|
|
75
|
+
export function Table({ className, ...rest }) {
|
|
76
|
+
return _jsx("table", { ...rest, className: cx("ui-table", className) });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* What to show where there is nothing.
|
|
80
|
+
*
|
|
81
|
+
* See {@link EmptyProps} for why the `action` slot exists.
|
|
82
|
+
*
|
|
83
|
+
* @param children — what to show where there is nothing.
|
|
84
|
+
* @param action — a button, usually: the one thing to do about being
|
|
85
|
+
* empty.
|
|
86
|
+
* @param className — added to the element's classes, beside the one the
|
|
87
|
+
* theme gives it.
|
|
88
|
+
* @param rest — the remaining props, spread onto the element.
|
|
89
|
+
*/
|
|
90
|
+
export function Empty({ children, action, className, ...rest }) {
|
|
91
|
+
return (_jsxs("div", { ...rest, className: cx("ui-empty", className), children: [children, action] }));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAkC;IACxE,OAAO,iBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAI,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,IAAI,EACwB;IAC/B,OAAO,iBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,GAAI,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAkC;IACzE,OAAO,iBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,GAAI,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,IAAI,EACwB;IAC/B,OAAO,iBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,GAAI,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAkC;IACzE,OAAO,iBAAS,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,GAAI,CAAC;AAChE,CAAC;AAED;;;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