@ignite-ember/ui-react 0.2.0 → 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.
Files changed (127) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +56 -13
  3. package/dist/CopySource.d.ts.map +1 -1
  4. package/dist/CopySource.js +16 -2
  5. package/dist/CopySource.js.map +1 -1
  6. package/dist/DataTable.d.ts +17 -1
  7. package/dist/DataTable.d.ts.map +1 -1
  8. package/dist/DataTable.js +17 -1
  9. package/dist/DataTable.js.map +1 -1
  10. package/dist/Dialog.d.ts +41 -0
  11. package/dist/Dialog.d.ts.map +1 -0
  12. package/dist/Dialog.js +94 -0
  13. package/dist/Dialog.js.map +1 -0
  14. package/dist/ErrorBoundary.d.ts +31 -2
  15. package/dist/ErrorBoundary.d.ts.map +1 -1
  16. package/dist/ErrorBoundary.js +38 -4
  17. package/dist/ErrorBoundary.js.map +1 -1
  18. package/dist/LiveRegion.d.ts +7 -1
  19. package/dist/LiveRegion.d.ts.map +1 -1
  20. package/dist/LiveRegion.js +7 -1
  21. package/dist/LiveRegion.js.map +1 -1
  22. package/dist/Markdown.d.ts +4 -0
  23. package/dist/Markdown.d.ts.map +1 -1
  24. package/dist/Markdown.js +4 -0
  25. package/dist/Markdown.js.map +1 -1
  26. package/dist/MarkdownInline.d.ts +13 -4
  27. package/dist/MarkdownInline.d.ts.map +1 -1
  28. package/dist/MarkdownInline.js +20 -5
  29. package/dist/MarkdownInline.js.map +1 -1
  30. package/dist/MenuIcon.d.ts +10 -4
  31. package/dist/MenuIcon.d.ts.map +1 -1
  32. package/dist/MenuIcon.js +8 -2
  33. package/dist/MenuIcon.js.map +1 -1
  34. package/dist/Mermaid.d.ts +2 -0
  35. package/dist/Mermaid.d.ts.map +1 -1
  36. package/dist/Mermaid.js +2 -0
  37. package/dist/Mermaid.js.map +1 -1
  38. package/dist/Monogram.d.ts +7 -3
  39. package/dist/Monogram.d.ts.map +1 -1
  40. package/dist/Monogram.js +14 -6
  41. package/dist/Monogram.js.map +1 -1
  42. package/dist/OverflowMenu.d.ts +6 -1
  43. package/dist/OverflowMenu.d.ts.map +1 -1
  44. package/dist/OverflowMenu.js +10 -2
  45. package/dist/OverflowMenu.js.map +1 -1
  46. package/dist/Shell.d.ts +13 -0
  47. package/dist/Shell.d.ts.map +1 -1
  48. package/dist/Shell.js +13 -0
  49. package/dist/Shell.js.map +1 -1
  50. package/dist/Skeleton.d.ts +30 -0
  51. package/dist/Skeleton.d.ts.map +1 -1
  52. package/dist/Skeleton.js +30 -0
  53. package/dist/Skeleton.js.map +1 -1
  54. package/dist/Split.d.ts +24 -5
  55. package/dist/Split.d.ts.map +1 -1
  56. package/dist/Split.js +27 -4
  57. package/dist/Split.js.map +1 -1
  58. package/dist/Tabs.d.ts +77 -0
  59. package/dist/Tabs.d.ts.map +1 -0
  60. package/dist/Tabs.js +91 -0
  61. package/dist/Tabs.js.map +1 -0
  62. package/dist/Toast.d.ts +12 -1
  63. package/dist/Toast.d.ts.map +1 -1
  64. package/dist/Toast.js +11 -0
  65. package/dist/Toast.js.map +1 -1
  66. package/dist/Tooltip.d.ts +12 -3
  67. package/dist/Tooltip.d.ts.map +1 -1
  68. package/dist/Tooltip.js +29 -7
  69. package/dist/Tooltip.js.map +1 -1
  70. package/dist/controls.d.ts +117 -0
  71. package/dist/controls.d.ts.map +1 -0
  72. package/dist/controls.js +59 -0
  73. package/dist/controls.js.map +1 -0
  74. package/dist/fenceInfo.d.ts +4 -1
  75. package/dist/fenceInfo.d.ts.map +1 -1
  76. package/dist/fenceInfo.js +4 -1
  77. package/dist/fenceInfo.js.map +1 -1
  78. package/dist/formControls.d.ts +143 -0
  79. package/dist/formControls.d.ts.map +1 -0
  80. package/dist/formControls.js +108 -0
  81. package/dist/formControls.js.map +1 -0
  82. package/dist/index.d.ts +5 -9
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +5 -9
  85. package/dist/index.js.map +1 -1
  86. package/dist/layout.d.ts +95 -0
  87. package/dist/layout.d.ts.map +1 -0
  88. package/dist/layout.js +93 -0
  89. package/dist/layout.js.map +1 -0
  90. package/dist/primitives.d.ts +10 -360
  91. package/dist/primitives.d.ts.map +1 -1
  92. package/dist/primitives.js +31 -338
  93. package/dist/primitives.js.map +1 -1
  94. package/dist/progress.d.ts +64 -0
  95. package/dist/progress.d.ts.map +1 -0
  96. package/dist/progress.js +51 -0
  97. package/dist/progress.js.map +1 -0
  98. package/dist/text.d.ts +63 -0
  99. package/dist/text.d.ts.map +1 -0
  100. package/dist/text.js +61 -0
  101. package/dist/text.js.map +1 -0
  102. package/package.json +4 -4
  103. package/src/CopySource.tsx +17 -2
  104. package/src/DataTable.tsx +17 -1
  105. package/src/Dialog.tsx +158 -0
  106. package/src/ErrorBoundary.tsx +39 -4
  107. package/src/LiveRegion.tsx +7 -1
  108. package/src/Markdown.tsx +4 -0
  109. package/src/MarkdownInline.tsx +20 -7
  110. package/src/MenuIcon.tsx +10 -4
  111. package/src/Mermaid.tsx +2 -0
  112. package/src/Monogram.tsx +14 -5
  113. package/src/OverflowMenu.tsx +9 -2
  114. package/src/Shell.tsx +13 -0
  115. package/src/Skeleton.tsx +30 -0
  116. package/src/Split.tsx +32 -7
  117. package/src/Tabs.tsx +194 -0
  118. package/src/Toast.tsx +12 -1
  119. package/src/Tooltip.tsx +33 -8
  120. package/src/controls.tsx +159 -0
  121. package/src/fenceInfo.ts +5 -2
  122. package/src/formControls.tsx +249 -0
  123. package/src/index.ts +5 -9
  124. package/src/layout.tsx +141 -0
  125. package/src/primitives.tsx +10 -864
  126. package/src/progress.tsx +129 -0
  127. package/src/text.tsx +99 -0
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cx } from "./cx.js";
3
+ /**
4
+ * A button.
5
+ *
6
+ * The variant is a prop rather than a class name you spell:
7
+ * `btn-primery` is a typo that renders as a plain button and looks
8
+ * like nothing at all, which is exactly why the name is one the
9
+ * compiler checks.
10
+ *
11
+ * @param variant — how it reads: plain, the one action on the panel,
12
+ * the one that destroys something, a warning, or one that should not
13
+ * be the first thing the eye lands on.
14
+ * @param size — its size: `md` unless the row is dense, in which case
15
+ * `sm` or `xs`.
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 button.
19
+ */
20
+ export function Button({ variant = "default", size = "md", className, ...rest }) {
21
+ return (_jsx("button", { type: "button", ...rest, className: cx("btn", variant !== "default" && `btn-${variant}`, size !== "md" && `btn-${size}`, className) }));
22
+ }
23
+ /**
24
+ * A single-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 input.
29
+ */
30
+ export function Input({ className, ...rest }) {
31
+ return _jsx("input", { ...rest, className: cx("panel-input", className) });
32
+ }
33
+ /**
34
+ * A tag the reader can scan past. See {@link ChipProps} for when to
35
+ * reach for a chip and when for a badge.
36
+ *
37
+ * @param tone — how loud it is: `neutral` for a state nothing is wrong
38
+ * with, and the three that mean something.
39
+ * @param className — added to the element's classes, beside the one the
40
+ * theme gives it.
41
+ * @param rest — the remaining props, spread onto the span.
42
+ */
43
+ export function Chip({ tone = "neutral", className, ...rest }) {
44
+ return _jsx("span", { ...rest, "data-tone": tone, className: cx("chip", className) });
45
+ }
46
+ /**
47
+ * A state the reader is meant to notice. See {@link BadgeProps} for
48
+ * what the tone does and does not say.
49
+ *
50
+ * @param tone — how loud it is: `neutral` for a state nothing is wrong
51
+ * with, and the three that mean something.
52
+ * @param className — added to the element's classes, beside the one the
53
+ * theme gives it.
54
+ * @param rest — the remaining props, spread onto the span.
55
+ */
56
+ export function Badge({ tone = "neutral", className, ...rest }) {
57
+ return (_jsx("span", { ...rest, "data-tone": tone, className: cx("ui-badge", className) }));
58
+ }
59
+ //# sourceMappingURL=controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAuB7B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,GAAG,IAAI,EACK;IACZ,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,KACT,IAAI,EACR,SAAS,EAAE,EAAE,CACX,KAAK,EACL,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,EAAE,EACzC,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,EAAE,EAC9B,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC;AAKD;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAc;IACtD,OAAO,mBAAW,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,GAAI,CAAC;AACtE,CAAC;AA4BD;;;;;;;;;GASG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,EAAa;IACtE,OAAO,kBAAU,IAAI,eAAa,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,GAAI,CAAC;AAC/E,CAAC;AAkBD;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,EAAc;IACxE,OAAO,CACL,kBAAU,IAAI,eAAa,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,GAAI,CAC1E,CAAC;AACJ,CAAC"}
@@ -8,7 +8,7 @@
8
8
  import type { ReactNode } from "react";
9
9
  /** The language on a fenced block, and the block's source. */
10
10
  export interface Fence {
11
- /** The language, lower-cased. `mermaid`, `ts`, `python`. */
11
+ /** The language, lower-cased. `mermaid`, `ts`, `python`, `c++`. */
12
12
  lang: string;
13
13
  /** The text inside the fence. */
14
14
  source: string;
@@ -18,6 +18,9 @@ export interface Fence {
18
18
  *
19
19
  * Null when the child is not a code element, or carries no
20
20
  * `language-` class — an unfenced block, or a fence with no language.
21
+ *
22
+ * @param children — the `<pre>` a fenced block renders as; its `<code>`
23
+ * child carries the language class.
21
24
  */
22
25
  export declare function fenceInfo(children: ReactNode): Fence | null;
23
26
  //# sourceMappingURL=fenceInfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fenceInfo.d.ts","sourceRoot":"","sources":["../src/fenceInfo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,8DAA8D;AAC9D,MAAM,WAAW,KAAK;IACpB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI,CAQ3D"}
1
+ {"version":3,"file":"fenceInfo.d.ts","sourceRoot":"","sources":["../src/fenceInfo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,8DAA8D;AAC9D,MAAM,WAAW,KAAK;IACpB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI,CAQ3D"}
package/dist/fenceInfo.js CHANGED
@@ -4,13 +4,16 @@ import { isValidElement } from "react";
4
4
  *
5
5
  * Null when the child is not a code element, or carries no
6
6
  * `language-` class — an unfenced block, or a fence with no language.
7
+ *
8
+ * @param children — the `<pre>` a fenced block renders as; its `<code>`
9
+ * child carries the language class.
7
10
  */
8
11
  export function fenceInfo(children) {
9
12
  const only = Array.isArray(children) ? children[0] : children;
10
13
  if (!isValidElement(only))
11
14
  return null;
12
15
  const props = only.props;
13
- const match = /\blanguage-([\w-]+)\b/.exec(props.className ?? "");
16
+ const match = /\blanguage-([\w+#.-]+)/.exec(props.className ?? "");
14
17
  if (!match)
15
18
  return null;
16
19
  const source = typeof props.children === "string" ? props.children : "";
@@ -1 +1 @@
1
- {"version":3,"file":"fenceInfo.js","sourceRoot":"","sources":["../src/fenceInfo.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAUvC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAAmB;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAqD,CAAC;IACzE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;AAC7E,CAAC"}
1
+ {"version":3,"file":"fenceInfo.js","sourceRoot":"","sources":["../src/fenceInfo.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAUvC;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,QAAmB;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAqD,CAAC;IACzE,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;AAC7E,CAAC"}
@@ -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,EAAE,GAAG,IAAI,EAAiB;IAC5D,OAAO,sBAAc,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,GAAI,CAAC;AACzE,CAAC;AAQD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAiB;IACnE,OAAO,CACL,iBAAO,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACzC,mBAAW,IAAI,EAAE,IAAI,EAAC,UAAU,GAAG,EACnC,yBAAO,KAAK,GAAQ,IACd,CACT,CAAC;AACJ,CAAC;AAQD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAc;IAC7D,OAAO,CACL,iBAAO,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACzC,mBAAW,IAAI,EAAE,IAAI,EAAC,OAAO,GAAG,EAChC,yBAAO,KAAK,GAAQ,IACd,CACT,CAAC;AACJ,CAAC;AAqB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AU,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 CHANGED
@@ -2,27 +2,23 @@
2
2
  * @ignite-ember/ui-react — the components an extension is allowed to build on.
3
3
  *
4
4
  * This list is not a guess at what an extension might want. It is
5
- * what the first two extensions actually import. CodeIndex needs
6
- * none of it — its only app dependency is the client type, which is
7
- * why porting its panel behind the bridge cost one line. Artifacts
8
- * is 7,737 lines and imports exactly seven of the app's components,
9
- * measured rather than estimated.
5
+ * what the extensions actually import, measured rather than estimated.
10
6
  *
11
- * Seven was never the whole floor, though. Artifacts also writes
7
+ * Those components were never the whole floor, though. An extension also writes
12
8
  * `className="btn btn-primary"` by hand, and so would every
13
- * extension — the primitives existed as CSS and not as an API, which
9
+ * other — the primitives existed as CSS and not as an API, which
14
10
  * is no autocomplete, no way to learn a variant name short of
15
11
  * reading `theme.css`, and nothing to stop `btn-primery` shipping as
16
12
  * an invisible bug. `./primitives` closes that: thin typed wrappers
17
13
  * over classes the app already uses.
18
14
  *
19
- * They are React, not web components, because six of the seven are
15
+ * They are React, not web components, because most of them are
20
16
  * worse as web components: `MarkdownInline` and `RichFences` are a
21
17
  * react-markdown pipeline with remark and rehype plugins, and
22
18
  * `Tooltip` and `OverflowMenu` are positioning behaviour that wants
23
19
  * the light DOM. Rewriting those inside a shadow root would mean
24
20
  * maintaining a second implementation of something the app already
25
- * has — the drift this repository has been bitten by twice.
21
+ * has — the drift this repository has been bitten by.
26
22
  *
27
23
  * An extension runs in its own frame and bundles its own React, so
28
24
  * consuming a React package costs it nothing it was not already
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;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,MAAM,EACN,KAAK,WAAW,EAChB,OAAO,EACP,KAAK,YAAY,EACjB,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,IAAI,EACJ,KAAK,SAAS,EACd,IAAI,EACJ,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,IAAI,EACT,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,O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OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,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,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -2,27 +2,23 @@
2
2
  * @ignite-ember/ui-react — the components an extension is allowed to build on.
3
3
  *
4
4
  * This list is not a guess at what an extension might want. It is
5
- * what the first two extensions actually import. CodeIndex needs
6
- * none of it — its only app dependency is the client type, which is
7
- * why porting its panel behind the bridge cost one line. Artifacts
8
- * is 7,737 lines and imports exactly seven of the app's components,
9
- * measured rather than estimated.
5
+ * what the extensions actually import, measured rather than estimated.
10
6
  *
11
- * Seven was never the whole floor, though. Artifacts also writes
7
+ * Those components were never the whole floor, though. An extension also writes
12
8
  * `className="btn btn-primary"` by hand, and so would every
13
- * extension — the primitives existed as CSS and not as an API, which
9
+ * other — the primitives existed as CSS and not as an API, which
14
10
  * is no autocomplete, no way to learn a variant name short of
15
11
  * reading `theme.css`, and nothing to stop `btn-primery` shipping as
16
12
  * an invisible bug. `./primitives` closes that: thin typed wrappers
17
13
  * over classes the app already uses.
18
14
  *
19
- * They are React, not web components, because six of the seven are
15
+ * They are React, not web components, because most of them are
20
16
  * worse as web components: `MarkdownInline` and `RichFences` are a
21
17
  * react-markdown pipeline with remark and rehype plugins, and
22
18
  * `Tooltip` and `OverflowMenu` are positioning behaviour that wants
23
19
  * the light DOM. Rewriting those inside a shadow root would mean
24
20
  * maintaining a second implementation of something the app already
25
- * has — the drift this repository has been bitten by twice.
21
+ * has — the drift this repository has been bitten by.
26
22
  *
27
23
  * An extension runs in its own frame and bundles its own React, so
28
24
  * consuming a React package costs it nothing it was not already
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;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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AO,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"}
@@ -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":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI7E;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,+BAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,cAAc,CAAC,+BAEhC;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,+BAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,cAAc,CAAC,+BAEhC;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,+BAE1E;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EACnB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,+BAIzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,gBAAgB,CAAC,+BAElC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,gEAAgE;IAChE,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,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