@charcuterie/ui 0.2.0 → 1.0.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.
@@ -1,5 +1,6 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
- export type FieldProps = {
2
+ import type { SlotProps } from "../slotProps.ts";
3
+ export type FieldProps = SlotProps & {
3
4
  /**
4
5
  * The control. **Cloned, not wrapped** — the same slot contract
5
6
  * as `Popover`'s trigger, so a `Field` can go around an `<input>`,
@@ -25,10 +26,32 @@ export type FieldProps = {
25
26
  };
26
27
  /**
27
28
  * Sixteen files in the fleet spell a label, a control, and a hint,
28
- * and no two spell the wiring the same way. `FieldLabel` in
29
- * mux-magic renders a `<label>` with no `htmlFor` at all — which
30
- * looks correct, reads correctly to a sighted user, and gives a
31
- * screen reader an unnamed textbox.
29
+ * and no two spell the wiring the same way.
30
+ *
31
+ * ### What mux-magic's `FieldLabel` actually gets wrong
32
+ *
33
+ * An earlier version of this docstring said it "renders a `<label>`
34
+ * with no `htmlFor` at all". **That is false** — it renders
35
+ * ``htmlFor={`${stepId}-${field.name}`}``, and has since it was
36
+ * written. The defect is at the other end of the pair: **8 of its 16
37
+ * call sites never render that id on anything**. Measured on
38
+ * `mux-magic@master`, the eight that do are `BooleanField`,
39
+ * `ChapterSplitsField`, `EnumField`, `NumberField`,
40
+ * `NumberWithLookupField`, `PathField`, `StringArrayField` and
41
+ * `StringField`; the other eight either render no id at all or render
42
+ * a different one — `RegexWithFlagsField` mints its own `patternId` /
43
+ * `flagsId` / `sampleId`, and `SubtitleRulesField` spells
44
+ * ``${step.command}-hasDefaultRules`` where the label says
45
+ * ``${step.id}-…``.
46
+ *
47
+ * The outcome is the same unnamed textbox, by a worse route: a
48
+ * `<label>` that points at an id nowhere in the document reads as
49
+ * correct in the label's own file, and is only wrong in the *other*
50
+ * file. Half of them are broken and nothing says which half.
51
+ *
52
+ * That is the argument for a component rather than a convention: here
53
+ * the id is minted and consumed in one place and cannot be spelled
54
+ * twice.
32
55
  *
33
56
  * ### The ids are static, and that is why `createLinkedIds` is not here
34
57
  *
@@ -64,6 +87,18 @@ export type FieldProps = {
64
87
  * once, at the top, with the `Alert` this library already ships —
65
88
  * and then the user tabs into the field and hears the specific
66
89
  * reason.
90
+ *
91
+ * ### A slot is a pass-through
92
+ *
93
+ * A `Tooltip` between the field and its control is the obvious thing
94
+ * to write, and it is what mux-magic's `FieldLabel` does. Both
95
+ * components clone onto their one child, so everything below used to
96
+ * land on the `Tooltip` **component** and be dropped in silence —
97
+ * leaving the `<label htmlFor>` above pointing at nothing, which is
98
+ * precisely the defect this component was built to make impossible.
99
+ * `SlotProps` arriving from an outer slot is forwarded down, and
100
+ * `aria-describedby` is merged rather than replaced.
101
+ * `slotProps.ts` has the reasoning.
67
102
  */
68
- export declare const Field: ({ children, className, description, error, isRequired, label, }: FieldProps) => ReactNode;
103
+ export declare const Field: ({ children, className, description, error, isRequired, label, ...receivedSlotProps }: FieldProps) => ReactNode;
69
104
  //# sourceMappingURL=Field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIpD,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,KAAK,GAAI,iEAOnB,UAAU,KAAG,SAgFf,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAIhD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,eAAO,MAAM,KAAK,GAAI,sFAQnB,UAAU,KAAG,SA4Ff,CAAA"}
@@ -1,12 +1,35 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useClonedChild, useUniqueId, } from "@charcuterie/logic";
3
+ import { mergeSlotProps } from "../slotProps.js";
3
4
  import { toClassName } from "../toClassName.js";
4
5
  /**
5
6
  * Sixteen files in the fleet spell a label, a control, and a hint,
6
- * and no two spell the wiring the same way. `FieldLabel` in
7
- * mux-magic renders a `<label>` with no `htmlFor` at all — which
8
- * looks correct, reads correctly to a sighted user, and gives a
9
- * screen reader an unnamed textbox.
7
+ * and no two spell the wiring the same way.
8
+ *
9
+ * ### What mux-magic's `FieldLabel` actually gets wrong
10
+ *
11
+ * An earlier version of this docstring said it "renders a `<label>`
12
+ * with no `htmlFor` at all". **That is false** — it renders
13
+ * ``htmlFor={`${stepId}-${field.name}`}``, and has since it was
14
+ * written. The defect is at the other end of the pair: **8 of its 16
15
+ * call sites never render that id on anything**. Measured on
16
+ * `mux-magic@master`, the eight that do are `BooleanField`,
17
+ * `ChapterSplitsField`, `EnumField`, `NumberField`,
18
+ * `NumberWithLookupField`, `PathField`, `StringArrayField` and
19
+ * `StringField`; the other eight either render no id at all or render
20
+ * a different one — `RegexWithFlagsField` mints its own `patternId` /
21
+ * `flagsId` / `sampleId`, and `SubtitleRulesField` spells
22
+ * ``${step.command}-hasDefaultRules`` where the label says
23
+ * ``${step.id}-…``.
24
+ *
25
+ * The outcome is the same unnamed textbox, by a worse route: a
26
+ * `<label>` that points at an id nowhere in the document reads as
27
+ * correct in the label's own file, and is only wrong in the *other*
28
+ * file. Half of them are broken and nothing says which half.
29
+ *
30
+ * That is the argument for a component rather than a convention: here
31
+ * the id is minted and consumed in one place and cannot be spelled
32
+ * twice.
10
33
  *
11
34
  * ### The ids are static, and that is why `createLinkedIds` is not here
12
35
  *
@@ -42,10 +65,29 @@ import { toClassName } from "../toClassName.js";
42
65
  * once, at the top, with the `Alert` this library already ships —
43
66
  * and then the user tabs into the field and hears the specific
44
67
  * reason.
68
+ *
69
+ * ### A slot is a pass-through
70
+ *
71
+ * A `Tooltip` between the field and its control is the obvious thing
72
+ * to write, and it is what mux-magic's `FieldLabel` does. Both
73
+ * components clone onto their one child, so everything below used to
74
+ * land on the `Tooltip` **component** and be dropped in silence —
75
+ * leaving the `<label htmlFor>` above pointing at nothing, which is
76
+ * precisely the defect this component was built to make impossible.
77
+ * `SlotProps` arriving from an outer slot is forwarded down, and
78
+ * `aria-describedby` is merged rather than replaced.
79
+ * `slotProps.ts` has the reasoning.
45
80
  */
46
- export const Field = ({ children, className, description, error, isRequired = false, label, }) => {
81
+ export const Field = ({ children, className, description, error, isRequired = false, label, ...receivedSlotProps }) => {
47
82
  const baseId = useUniqueId();
48
- const controlId = `${baseId}-control`;
83
+ /**
84
+ * A caller's own `id` wins, which is what makes a `Field` usable
85
+ * where the id has to be predictable — an autofill hint, a deep
86
+ * link, a server-rendered error summary linking to the control.
87
+ * `useUniqueId` is still called: hooks are unconditional, and it
88
+ * costs one counter read.
89
+ */
90
+ const controlId = receivedSlotProps.id ?? `${baseId}-control`;
49
91
  const descriptionId = `${baseId}-description`;
50
92
  const errorId = `${baseId}-error`;
51
93
  const describedBy = [
@@ -54,7 +96,7 @@ export const Field = ({ children, className, description, error, isRequired = fa
54
96
  ]
55
97
  .filter(Boolean)
56
98
  .join(" ");
57
- const clonedControl = useClonedChild(children, {
99
+ const clonedControl = useClonedChild(children, mergeSlotProps(receivedSlotProps, {
58
100
  "aria-describedby": describedBy === "" ? undefined : describedBy,
59
101
  // `aria-invalid` is derived from the error's presence, never
60
102
  // passed. A control marked invalid with no described reason is
@@ -67,7 +109,7 @@ export const Field = ({ children, className, description, error, isRequired = fa
67
109
  "aria-required": isRequired || undefined,
68
110
  id: controlId,
69
111
  required: isRequired || undefined,
70
- });
112
+ }));
71
113
  return (_jsxs("div", { className: toClassName("flex flex-col gap-1.5", className), children: [_jsxs("label", { className: "font-medium text-content-primary text-sm", htmlFor: controlId, children: [label, isRequired ? (_jsx("span", { "aria-hidden": "true", className: "ms-1 text-intent-danger-content", children: "*" })) : null] }), clonedControl, description === undefined ? null : (_jsx("p", { className: "text-content-secondary text-xs", id: descriptionId, children: description })), error === undefined ? null : (_jsx("p", { className: "text-intent-danger-content text-xs", id: errorId, children: error }))] }));
72
114
  };
73
115
  //# sourceMappingURL=Field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA2B/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,UAAU,GAAG,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AAC,CAAA;IAEZ,MAAM,aAAa,GAAG,cAAc,CAClC,QAAQ,EACR,cAAc,CAAC,iBAAiB,EAAE;QAChC,kBAAkB,EAChB,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;QAC9C,6DAA6D;QAC7D,+DAA+D;QAC/D,iDAAiD;QACjD,cAAc,EACZ,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;QACxC,sDAAsD;QACtD,8DAA8D;QAC9D,8DAA8D;QAC9D,gDAAgD;QAChD,eAAe,EAAE,UAAU,IAAI,SAAS;QACxC,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE,UAAU,IAAI,SAAS;KAClC,CAAC,CACH,CAAA;IAED,OAAO,CACL,eACE,SAAS,EAAE,WAAW,CACpB,uBAAuB,EACvB,SAAS,CACV,aAED,iBACE,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAE,SAAS,aAEjB,KAAK,EAEL,UAAU,CAAC,CAAC,CAAC,CACZ,8BAKc,MAAM,EAClB,SAAS,EAAC,iCAAiC,kBAGtC,CACR,CAAC,CAAC,CAAC,IAAI,IACF,EAEP,aAAa,EAEb,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAClC,YACE,SAAS,EAAC,gCAAgC,EAC1C,EAAE,EAAE,aAAa,YAEhB,WAAW,GACV,CACL,EAEA,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5B,YACE,SAAS,EAAC,oCAAoC,EAC9C,EAAE,EAAE,OAAO,YAEV,KAAK,GACJ,CACL,IACG,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,58 @@
1
+ import type { ReactNode } from "react";
2
+ export type FieldGroupProps = {
3
+ /**
4
+ * The controls. **Rendered as-is, not cloned** — that is the whole
5
+ * difference from `Field`, and it is why this is a separate
6
+ * component rather than a boolean on that one.
7
+ */
8
+ children: ReactNode;
9
+ className?: string;
10
+ /** Standing help for the group as a whole. */
11
+ description?: ReactNode;
12
+ /** Present means the group is invalid. */
13
+ error?: ReactNode;
14
+ isRequired?: boolean;
15
+ label: ReactNode;
16
+ };
17
+ /**
18
+ * A label over **several** controls.
19
+ *
20
+ * `Field` mints one id and clones it onto one child, which is the
21
+ * right shape for a text input and the wrong shape the moment there
22
+ * are two of them: an `id` can only name one element, and a
23
+ * `<label htmlFor>` can only point at one. Six of mux-magic's sixteen
24
+ * field components are in that position — `RegexWithFlagsField`
25
+ * (pattern, flags, sample, and a checkbox), `NumberWithLookupField`
26
+ * (three inputs), `LanguageCodeField`, `LanguageCodesField`,
27
+ * `SubtitleTypesField` (a tag input beside a dropdown) and
28
+ * `RenameRegexField` (a row per rule) — and every one of them renders
29
+ * a `FieldLabel` whose `htmlFor` names, at best, one of them.
30
+ *
31
+ * ### `<fieldset>` and `<legend>`, not a `<label>`
32
+ *
33
+ * This is the one place in the library where `<fieldset>` is right.
34
+ * `AccordionSection` rejected it for its panel and said why — it is a
35
+ * *form-control grouping*, and dragging `<legend>` semantics onto
36
+ * prose is wrong. Here the content **is** a form-control grouping,
37
+ * so the element means what it says, `<legend>` names the group
38
+ * natively, and no `role="group"` and no `aria-labelledby` are
39
+ * needed.
40
+ *
41
+ * A `<label>` here would be the mux-magic defect deliberately: a
42
+ * label pointing at one control, or at none.
43
+ *
44
+ * ### What a group cannot carry
45
+ *
46
+ * `aria-invalid` has no group form — it belongs on the control that
47
+ * is actually invalid, and this component does not know which one
48
+ * that is. So `error` here is *described*, not *asserted*: it joins
49
+ * `aria-describedby` on the `<fieldset>`, which screen readers read
50
+ * as focus enters the group. A control inside that is itself invalid
51
+ * should say so itself, in its own `Field`.
52
+ *
53
+ * That is a real limitation and it is stated rather than papered
54
+ * over — the alternative was to clone `aria-invalid` onto every
55
+ * child, which marks the valid ones invalid.
56
+ */
57
+ export declare const FieldGroup: ({ children, className, description, error, isRequired, label, }: FieldGroupProps) => ReactNode;
58
+ //# sourceMappingURL=FieldGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../../src/Field/FieldGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,UAAU,GAAI,iEAOxB,eAAe,KAAG,SAqEpB,CAAA"}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useUniqueId } from "@charcuterie/logic";
3
+ import { toClassName } from "../toClassName.js";
4
+ /**
5
+ * A label over **several** controls.
6
+ *
7
+ * `Field` mints one id and clones it onto one child, which is the
8
+ * right shape for a text input and the wrong shape the moment there
9
+ * are two of them: an `id` can only name one element, and a
10
+ * `<label htmlFor>` can only point at one. Six of mux-magic's sixteen
11
+ * field components are in that position — `RegexWithFlagsField`
12
+ * (pattern, flags, sample, and a checkbox), `NumberWithLookupField`
13
+ * (three inputs), `LanguageCodeField`, `LanguageCodesField`,
14
+ * `SubtitleTypesField` (a tag input beside a dropdown) and
15
+ * `RenameRegexField` (a row per rule) — and every one of them renders
16
+ * a `FieldLabel` whose `htmlFor` names, at best, one of them.
17
+ *
18
+ * ### `<fieldset>` and `<legend>`, not a `<label>`
19
+ *
20
+ * This is the one place in the library where `<fieldset>` is right.
21
+ * `AccordionSection` rejected it for its panel and said why — it is a
22
+ * *form-control grouping*, and dragging `<legend>` semantics onto
23
+ * prose is wrong. Here the content **is** a form-control grouping,
24
+ * so the element means what it says, `<legend>` names the group
25
+ * natively, and no `role="group"` and no `aria-labelledby` are
26
+ * needed.
27
+ *
28
+ * A `<label>` here would be the mux-magic defect deliberately: a
29
+ * label pointing at one control, or at none.
30
+ *
31
+ * ### What a group cannot carry
32
+ *
33
+ * `aria-invalid` has no group form — it belongs on the control that
34
+ * is actually invalid, and this component does not know which one
35
+ * that is. So `error` here is *described*, not *asserted*: it joins
36
+ * `aria-describedby` on the `<fieldset>`, which screen readers read
37
+ * as focus enters the group. A control inside that is itself invalid
38
+ * should say so itself, in its own `Field`.
39
+ *
40
+ * That is a real limitation and it is stated rather than papered
41
+ * over — the alternative was to clone `aria-invalid` onto every
42
+ * child, which marks the valid ones invalid.
43
+ */
44
+ export const FieldGroup = ({ children, className, description, error, isRequired = false, label, }) => {
45
+ const baseId = useUniqueId();
46
+ const descriptionId = `${baseId}-description`;
47
+ const errorId = `${baseId}-error`;
48
+ // Description first, error second, for the reason `Field` gives:
49
+ // a screen reader reads the list in order and the two sentences
50
+ // are not interchangeable.
51
+ const describedBy = [
52
+ description === undefined ? null : descriptionId,
53
+ error === undefined ? null : errorId,
54
+ ]
55
+ .filter(Boolean)
56
+ .join(" ");
57
+ return (_jsxs("fieldset", { "aria-describedby": describedBy === "" ? undefined : describedBy, className: toClassName(
58
+ // A `<fieldset>` arrives with a border, an inline margin, a
59
+ // block padding, and `min-inline-size: min-content` — the
60
+ // last of which makes it refuse to shrink inside a flex or
61
+ // grid parent, which is the reason design systems avoid the
62
+ // element. All four are cleared here, once.
63
+ "m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0", className), children: [_jsxs("legend", { className: "mb-1.5 p-0 font-medium text-content-primary text-sm", children: [label, isRequired ? (_jsx("span", { "aria-hidden": "true", className: "ms-1 text-intent-danger-content", children: "*" })) : null] }), children, description === undefined ? null : (_jsx("p", { className: "text-content-secondary text-xs", id: descriptionId, children: description })), error === undefined ? null : (_jsx("p", { className: "text-intent-danger-content text-xs", id: errorId, children: error }))] }));
64
+ };
65
+ //# sourceMappingURL=FieldGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../src/Field/FieldGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAkB/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,UAAU,GAAG,KAAK,EAClB,KAAK,GACW,EAAa,EAAE;IAC/B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;IAE5B,MAAM,aAAa,GAAG,GAAG,MAAM,cAAc,CAAA;IAE7C,MAAM,OAAO,GAAG,GAAG,MAAM,QAAQ,CAAA;IAEjC,iEAAiE;IACjE,gEAAgE;IAChE,2BAA2B;IAC3B,MAAM,WAAW,GAAG;QAClB,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa;QAChD,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;KACrC;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEZ,OAAO,CACL,wCAEI,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAE9C,SAAS,EAAE,WAAW;QACpB,4DAA4D;QAC5D,0DAA0D;QAC1D,2DAA2D;QAC3D,4DAA4D;QAC5D,4CAA4C;QAC5C,gDAAgD,EAChD,SAAS,CACV,aAED,kBAAQ,SAAS,EAAC,qDAAqD,aACpE,KAAK,EAEL,UAAU,CAAC,CAAC,CAAC,CACZ,8BAIc,MAAM,EAClB,SAAS,EAAC,iCAAiC,kBAGtC,CACR,CAAC,CAAC,CAAC,IAAI,IACD,EAER,QAAQ,EAER,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAClC,YACE,SAAS,EAAC,gCAAgC,EAC1C,EAAE,EAAE,aAAa,YAEhB,WAAW,GACV,CACL,EAEA,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5B,YACE,SAAS,EAAC,oCAAoC,EAC9C,EAAE,EAAE,OAAO,YAEV,KAAK,GACJ,CACL,IACQ,CACZ,CAAA;AACH,CAAC,CAAA"}
@@ -27,7 +27,9 @@ export type LogViewerProps = {
27
27
  * Three repos render a scrolling log pane —
28
28
  * mux-magic's `JobLogsDisclosure` and `StepLogs`, rip-deck's
29
29
  * `LogModal` — and between them they have four defects that this
30
- * component exists to not have.
30
+ * component exists to not have. A fifth, below the effects, is not
31
+ * theirs: it is defect 1 coming back through the front door, in this
32
+ * component, found by the first app to consume it.
31
33
  *
32
34
  * ### 1. The one that follows nothing
33
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"LogViewer.d.ts","sourceRoot":"","sources":["../../src/LogViewer/LogViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,eAAO,MAAM,SAAS,GAAI,qDAMvB,cAAc,KAAG,SA8FnB,CAAA"}
1
+ {"version":3,"file":"LogViewer.d.ts","sourceRoot":"","sources":["../../src/LogViewer/LogViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,eAAO,MAAM,SAAS,GAAI,qDAMvB,cAAc,KAAG,SA8JnB,CAAA"}
@@ -7,7 +7,9 @@ import { toClassName } from "../toClassName.js";
7
7
  * Three repos render a scrolling log pane —
8
8
  * mux-magic's `JobLogsDisclosure` and `StepLogs`, rip-deck's
9
9
  * `LogModal` — and between them they have four defects that this
10
- * component exists to not have.
10
+ * component exists to not have. A fifth, below the effects, is not
11
+ * theirs: it is defect 1 coming back through the front door, in this
12
+ * component, found by the first app to consume it.
11
13
  *
12
14
  * ### 1. The one that follows nothing
13
15
  *
@@ -80,6 +82,65 @@ export const LogViewer = ({ className, isAnnounced = false, label, lines, maxLin
80
82
  // `shownLines` rather than an empty array — this is the whole fix
81
83
  // for defect 1, and the dependency *is* the fix.
82
84
  }, [isFollowing, shownLines]);
85
+ /**
86
+ * Defect 1 again, and the effect above cannot see it: **a pane can
87
+ * be measured before it has a box.**
88
+ *
89
+ * `AccordionSection` renders its panel with `hidden` rather than
90
+ * unmounting it, deliberately — "a panel that unmounts loses a
91
+ * scroll position, a partially typed form, and any subscription its
92
+ * content opened — and the fleet's log panes are exactly that." A
93
+ * `hidden` subtree has no layout, so the effect above runs on mount
94
+ * with `scrollHeight 0` and writes `scrollTop = 0`, and then never
95
+ * runs again: neither `isFollowing` nor `shownLines` changes when
96
+ * the section is opened. Measured in mux-magic on a 60-line pane:
97
+ *
98
+ * ```
99
+ * while collapsed : scrollTop 0 scrollHeight 0 clientHeight 0
100
+ * after expanding : scrollTop 0 scrollHeight 976 clientHeight 254
101
+ * ```
102
+ *
103
+ * That is this component's own `}, [])` bug, rebuilt out of two
104
+ * components whose individual decisions are both right, and
105
+ * invisible to both of their test suites — `LogViewer`'s mounted
106
+ * visible, `Accordion`'s holding content that never measures
107
+ * itself. mux-magic hit it in its first week as a consumer and
108
+ * worked around it downstream, in a `DisclosedLogViewer` that
109
+ * withheld the pane until the section had been opened once. This is
110
+ * that workaround coming into the library so it can be deleted.
111
+ *
112
+ * ### Why the box and not the viewport
113
+ *
114
+ * An `IntersectionObserver` answers "is it on screen", which is a
115
+ * different question with two wrong answers here: a pane below the
116
+ * fold on a long page is *not* intersecting and has perfectly good
117
+ * layout, and scrolling the page later would re-fire for no reason.
118
+ * `ResizeObserver` answers "does it have a box, and is that box
119
+ * still the same size" — which is the precondition the measurement
120
+ * above actually needs. Per spec it does not fire at `observe()`
121
+ * time for an element that is not being rendered, so gaining a box
122
+ * *is* the first callback, and that is the reveal.
123
+ *
124
+ * It pays for itself twice: a window resize re-wraps the lines and
125
+ * changes what is at the bottom, and a following pane should be at
126
+ * the new bottom rather than a few lines above it.
127
+ *
128
+ * Only while following. A user who scrolled up to read an error is
129
+ * not dragged back by resizing their window.
130
+ */
131
+ useEffect(() => {
132
+ const pane = paneRef.current;
133
+ if (!pane || !isFollowing) {
134
+ return;
135
+ }
136
+ const observer = new ResizeObserver(() => {
137
+ pane.scrollTop = pane.scrollHeight;
138
+ });
139
+ observer.observe(pane);
140
+ return () => {
141
+ observer.disconnect();
142
+ };
143
+ }, [isFollowing]);
83
144
  return (_jsxs("div", { className: toClassName("relative flex flex-col", className), children: [_jsx("div", { "aria-label": label, "aria-live": isAnnounced ? "polite" : "off", className: "max-h-64 overflow-y-auto rounded-md border border-border-subtle bg-surface-sunken p-2 font-mono text-content-secondary text-xs", onScroll: (scrollEvent) => {
84
145
  const pane = scrollEvent.currentTarget;
85
146
  // A few pixels of slack, because a fractional device pixel
@@ -1 +1 @@
1
- {"version":3,"file":"LogViewer.js","sourceRoot":"","sources":["../../src/LogViewer/LogViewer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAsB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA2B/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,WAAW,GAAG,KAAK,EACnB,KAAK,EACL,KAAK,EACL,QAAQ,GAAG,GAAG,GACC,EAAa,EAAE;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE5C,MAAM,CAAC,WAAW,EAAE,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ement } from "@floating-ui/react";
2
2
  import type { ReactElement, ReactNode } from "react";
3
- export type TooltipProps = {
3
+ import type { SlotProps } from "../slotProps.ts";
4
+ export type TooltipProps = SlotProps & {
4
5
  /**
5
6
  * The control the tip describes. **Cloned, not wrapped** — the
6
7
  * same slot contract as `Popover`'s trigger.
@@ -63,6 +64,19 @@ export type TooltipProps = {
63
64
  * anything a touch user *must* read belongs in a `Field`'s
64
65
  * `description` instead. Building a long-press would make the tip
65
66
  * load-bearing on exactly the surface where it is least reliable.
67
+ *
68
+ * ### A slot is a pass-through
69
+ *
70
+ * A `Tooltip` is the natural thing to put between a `Field` and its
71
+ * control — mux-magic's `FieldLabel` renders a `FieldTooltip` for
72
+ * exactly that reason. Both components clone onto their one child, so
73
+ * an outer `Field` used to hand *this component* the `id`,
74
+ * `aria-describedby`, `aria-invalid` and `required` meant for the
75
+ * `<input>`, and this component dropped all four without a word.
76
+ *
77
+ * Anything in `SlotProps` that arrives from above is forwarded to the
78
+ * trigger, and `aria-describedby` is **merged** with the tip's own id
79
+ * rather than overwriting it. `slotProps.ts` has the reasoning.
66
80
  */
67
- export declare const Tooltip: ({ children, className, delay, label, placement, }: TooltipProps) => ReactNode;
81
+ export declare const Tooltip: ({ children, className, delay, label, placement, ...receivedSlotProps }: TooltipProps) => ReactNode;
68
82
  //# sourceMappingURL=Tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAanD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIpD,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,OAAO,GAAI,mDAMrB,YAAY,KAAG,SA4EjB,CAAA"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAanD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAIhD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG;IACrC;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,eAAO,MAAM,OAAO,GAAI,wEAOrB,YAAY,KAAG,SAoFjB,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useClonedChild, useVisibility, } from "@charcuterie/logic";
3
3
  import { autoUpdate, flip, offset, shift, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from "@floating-ui/react";
4
+ import { mergeSlotProps } from "../slotProps.js";
4
5
  import { toClassName } from "../toClassName.js";
5
6
  /**
6
7
  * Replaces mux-magic's `FieldTooltip`, which is 130 lines of
@@ -44,8 +45,21 @@ import { toClassName } from "../toClassName.js";
44
45
  * anything a touch user *must* read belongs in a `Field`'s
45
46
  * `description` instead. Building a long-press would make the tip
46
47
  * load-bearing on exactly the surface where it is least reliable.
48
+ *
49
+ * ### A slot is a pass-through
50
+ *
51
+ * A `Tooltip` is the natural thing to put between a `Field` and its
52
+ * control — mux-magic's `FieldLabel` renders a `FieldTooltip` for
53
+ * exactly that reason. Both components clone onto their one child, so
54
+ * an outer `Field` used to hand *this component* the `id`,
55
+ * `aria-describedby`, `aria-invalid` and `required` meant for the
56
+ * `<input>`, and this component dropped all four without a word.
57
+ *
58
+ * Anything in `SlotProps` that arrives from above is forwarded to the
59
+ * trigger, and `aria-describedby` is **merged** with the tip's own id
60
+ * rather than overwriting it. `slotProps.ts` has the reasoning.
47
61
  */
48
- export const Tooltip = ({ children, className, delay = 200, label, placement = "top", }) => {
62
+ export const Tooltip = ({ children, className, delay = 200, label, placement = "top", ...receivedSlotProps }) => {
49
63
  const { isVisible, setIsVisible } = useVisibility();
50
64
  const { context, floatingStyles, refs } = useFloating({
51
65
  // Read-only, as everywhere: floating-ui is told what is true and
@@ -72,10 +86,16 @@ export const Tooltip = ({ children, className, delay = 200, label, placement = "
72
86
  useDismiss(context, { referencePress: false }),
73
87
  useRole(context, { role: "tooltip" }),
74
88
  ]);
75
- const clonedTrigger = useClonedChild(children, {
89
+ const clonedTrigger = useClonedChild(children,
90
+ // `mergeSlotProps` rather than a spread, because
91
+ // `getReferenceProps()` writes an `aria-describedby` of its own —
92
+ // `useRole` pointing the trigger at the tip — and an outer
93
+ // `Field` writes one naming its description and its error. A
94
+ // spread keeps whichever went last.
95
+ mergeSlotProps(receivedSlotProps, {
76
96
  ...getReferenceProps(),
77
97
  ref: refs.setReference,
78
- });
98
+ }));
79
99
  return (_jsxs(_Fragment, { children: [clonedTrigger, isVisible ? (_jsx("div", { ...getFloatingProps(), className: toClassName(
80
100
  // `intent-neutral-solid` + its own `on-solid`, rather
81
101
  // than `surface-inverse` + `content-on-accent`. The
@@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DAAiD;IACjD,kEAAkE;IAClE,2DAA2D;IAC3D,6DAA6D;IAC7D,oCAAoC;IACpC,cAAc,CAAC,iBAAiB,EAAE;QAChC,GAAG,iBAAiB,EAAE;QACtB,GAAG,EAAE,IAAI,CAAC,YAAY;KACvB,CAAC,CACH,CAAA;IAED,OAAO,CACL,8BACG,aAAa,EAEb,SAAS,CAAC,CAAC,CAAC,CACX,iBACM,gBAAgB,EAAE,EACtB,SAAS,EAAE,WAAW;gBACpB,sDAAsD;gBACtD,oDAAoD;gBACpD,sDAAsD;gBACtD,0DAA0D;gBAC1D,oDAAoD;gBACpD,yDAAyD;gBACzD,uDAAuD;gBACvD,eAAe;gBACf,yHAAyH,EACzH,SAAS,CACV;gBACD,uDAAuD;gBACvD,0DAA0D;gBAC1D,wDAAwD;gBACxD,yDAAyD;gBACzD,4CAA4C;gBAC5C,yDAAyD;gBACzD,0DAA0D;gBAC1D,GAAG,EAAE,IAAI,CAAC,WAAW;gBACrB,yDAAyD;gBACzD,oDAAoD;gBACpD,0DAA0D;gBAC1D,2DAA2D;gBAC3D,+BAA+B;gBAC/B,IAAI,EAAC,SAAS,EACd,KAAK,EAAE,cAAc,YAEpB,KAAK,GACF,CACP,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAA;AACH,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -46,6 +46,8 @@ export type { EmptyStateProps, EmptyStateSize, } from "./EmptyState/EmptyState.t
46
46
  export { EmptyState } from "./EmptyState/EmptyState.tsx";
47
47
  export type { FieldProps } from "./Field/Field.tsx";
48
48
  export { Field } from "./Field/Field.tsx";
49
+ export type { FieldGroupProps } from "./Field/FieldGroup.tsx";
50
+ export { FieldGroup } from "./Field/FieldGroup.tsx";
49
51
  export type { FileDropZoneProps } from "./FileDropZone/FileDropZone.tsx";
50
52
  export { FileDropZone } from "./FileDropZone/FileDropZone.tsx";
51
53
  export type { IconButtonProps } from "./IconButton/IconButton.tsx";
@@ -80,6 +82,8 @@ export type { SortableTableHeaderProps, SortDirection, } from "./SortableTableHe
80
82
  export { SortableTableHeader } from "./SortableTableHeader/SortableTableHeader.tsx";
81
83
  export type { SpinnerProps } from "./Spinner/Spinner.tsx";
82
84
  export { Spinner } from "./Spinner/Spinner.tsx";
85
+ export type { SlotProps } from "./slotProps.ts";
86
+ export { mergeSlotProps } from "./slotProps.ts";
83
87
  export { getAsyncIntent, getAsyncLabel, getConnectionIntent, getConnectionLabel, getIsConnectionBusy, } from "./statusIntent.ts";
84
88
  export type { TabItem, TabsActivation, TabsOrientation, TabsProps, } from "./Tabs/Tabs.tsx";
85
89
  export { Tabs } from "./Tabs/Tabs.tsx";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,cAAc,GACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,YAAY,EACV,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EACV,WAAW,EACX,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,k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M,uBAAuB,CAAA;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,OAAO,EACP,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,YAAY,EACV,WAAW,EACX,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA"}
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ export { Card } from "./Card/Card.js";
38
38
  export { BADGE_SIZE_CLASS, CONTROL_SIZE_CLASS, DOT_SIZE_CLASS, ICON_CONTROL_SIZE_CLASS, MIN_TOUCH_TARGET_CLASS, SPINNER_SIZE_CLASS, } from "./controlStyles.js";
39
39
  export { EmptyState } from "./EmptyState/EmptyState.js";
40
40
  export { Field } from "./Field/Field.js";
41
+ export { FieldGroup } from "./Field/FieldGroup.js";
41
42
  export { FileDropZone } from "./FileDropZone/FileDropZone.js";
42
43
  export { IconButton } from "./IconButton/IconButton.js";
43
44
  export { DISABLED_CLASS, FOCUS_RING_CLASS, INTENT_APPEARANCE_CLASS, INTENT_CONTENT_CLASS, INTENT_HOVER_CLASS, INTENT_SOLID_FILL_CLASS, } from "./intentStyles.js";
@@ -55,6 +56,7 @@ export { Select } from "./Select/Select.js";
55
56
  export { Skeleton } from "./Skeleton/Skeleton.js";
56
57
  export { SortableTableHeader } from "./SortableTableHeader/SortableTableHeader.js";
57
58
  export { Spinner } from "./Spinner/Spinner.js";
59
+ export { mergeSlotProps } from "./slotProps.js";
58
60
  export { getAsyncIntent, getAsyncLabel, getConnectionIntent, getConnectionLabel, getIsConnectionBusy, } from "./statusIntent.js";
59
61
  export { Tabs } from "./Tabs/Tabs.js";
60
62
  export { Toast } from "./Toast/Toast.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAOH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA2B,CAAA;AAKrD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAmB,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAmB,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAqB,CAAA;AAM5C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAiB,CAAA;AAEtC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA6B,CAAA;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAmB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAiC,CAAA;AAE9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