@charcuterie/ui 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/AdaptiveGrid/AdaptiveGrid.d.ts +94 -0
- package/dist/AdaptiveGrid/AdaptiveGrid.d.ts.map +1 -0
- package/dist/AdaptiveGrid/AdaptiveGrid.js +73 -0
- package/dist/AdaptiveGrid/AdaptiveGrid.js.map +1 -0
- package/dist/AdaptiveGrid/chooseColumns.d.ts +206 -0
- package/dist/AdaptiveGrid/chooseColumns.d.ts.map +1 -0
- package/dist/AdaptiveGrid/chooseColumns.js +156 -0
- package/dist/AdaptiveGrid/chooseColumns.js.map +1 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.d.ts +155 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.d.ts.map +1 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.js +153 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.js.map +1 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -6
- package/dist/Button/Button.js.map +1 -1
- package/dist/ButtonLink/ButtonLink.d.ts +59 -0
- package/dist/ButtonLink/ButtonLink.d.ts.map +1 -0
- package/dist/ButtonLink/ButtonLink.js +69 -0
- package/dist/ButtonLink/ButtonLink.js.map +1 -0
- package/dist/Combobox/Combobox.d.ts.map +1 -1
- package/dist/Combobox/Combobox.js +1 -1
- package/dist/Combobox/Combobox.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +1 -1
- package/dist/Field/Field.js.map +1 -1
- package/dist/Field/FieldGroup.d.ts.map +1 -1
- package/dist/Field/FieldGroup.js +1 -1
- package/dist/Field/FieldGroup.js.map +1 -1
- package/dist/LogViewer/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer/LogViewer.js +33 -1
- package/dist/LogViewer/LogViewer.js.map +1 -1
- package/dist/RouterLink/AnchorLink.d.ts +17 -0
- package/dist/RouterLink/AnchorLink.d.ts.map +1 -0
- package/dist/RouterLink/AnchorLink.js +16 -0
- package/dist/RouterLink/AnchorLink.js.map +1 -0
- package/dist/RouterLink/RouterLinkProvider.d.ts +13 -0
- package/dist/RouterLink/RouterLinkProvider.d.ts.map +1 -0
- package/dist/RouterLink/RouterLinkProvider.js +47 -0
- package/dist/RouterLink/RouterLinkProvider.js.map +1 -0
- package/dist/RouterLink/routerLink.d.ts +45 -0
- package/dist/RouterLink/routerLink.d.ts.map +1 -0
- package/dist/RouterLink/routerLink.js +31 -0
- package/dist/RouterLink/routerLink.js.map +1 -0
- package/dist/SortableTableHeader/SortableTableHeader.d.ts.map +1 -1
- package/dist/SortableTableHeader/SortableTableHeader.js +7 -1
- package/dist/SortableTableHeader/SortableTableHeader.js.map +1 -1
- package/dist/TextLink/TextLink.d.ts +69 -0
- package/dist/TextLink/TextLink.d.ts.map +1 -0
- package/dist/TextLink/TextLink.js +79 -0
- package/dist/TextLink/TextLink.js.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -1
- package/dist/Tooltip/Tooltip.js.map +1 -1
- package/dist/controlStyles.d.ts +36 -1
- package/dist/controlStyles.d.ts.map +1 -1
- package/dist/controlStyles.js +30 -0
- package/dist/controlStyles.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/intentStyles.d.ts +17 -0
- package/dist/intentStyles.d.ts.map +1 -1
- package/dist/intentStyles.js +17 -0
- package/dist/intentStyles.js.map +1 -1
- package/dist/mountStory.testHelpers.d.ts.map +1 -1
- package/dist/mountStory.testHelpers.js +56 -0
- package/dist/mountStory.testHelpers.js.map +1 -1
- package/dist/reactRouter/ReactRouterLink.d.ts +23 -0
- package/dist/reactRouter/ReactRouterLink.d.ts.map +1 -0
- package/dist/reactRouter/ReactRouterLink.js +23 -0
- package/dist/reactRouter/ReactRouterLink.js.map +1 -0
- package/dist/reactRouter/index.d.ts +29 -0
- package/dist/reactRouter/index.d.ts.map +1 -0
- package/dist/reactRouter/index.js +29 -0
- package/dist/reactRouter/index.js.map +1 -0
- package/package.json +15 -3
- package/src/AdaptiveGrid/AdaptiveGrid.mdx +169 -0
- package/src/AdaptiveGrid/AdaptiveGrid.stories.tsx +240 -0
- package/src/AdaptiveGrid/AdaptiveGrid.test.tsx +243 -0
- package/src/AdaptiveGrid/AdaptiveGrid.tsx +150 -0
- package/src/AdaptiveGrid/chooseColumns.test.ts +253 -0
- package/src/AdaptiveGrid/chooseColumns.ts +270 -0
- package/src/AdaptiveGrid/useAdaptiveColumns.ts +355 -0
- package/src/Button/Button.tsx +10 -22
- package/src/ButtonLink/ButtonLink.mdx +75 -0
- package/src/ButtonLink/ButtonLink.stories.tsx +281 -0
- package/src/ButtonLink/ButtonLink.test.tsx +203 -0
- package/src/ButtonLink/ButtonLink.tsx +149 -0
- package/src/Combobox/Combobox.tsx +4 -1
- package/src/Dialog/Dialog.tsx +18 -2
- package/src/Field/Field.tsx +10 -2
- package/src/Field/FieldGroup.tsx +4 -2
- package/src/LogViewer/LogViewer.test.tsx +47 -0
- package/src/LogViewer/LogViewer.tsx +35 -1
- package/src/RouterLink/AnchorLink.tsx +23 -0
- package/src/RouterLink/RouterLink.mdx +178 -0
- package/src/RouterLink/RouterLinkProvider.tsx +68 -0
- package/src/RouterLink/routerLink.ts +56 -0
- package/src/SortableTableHeader/SortableTableHeader.tsx +6 -1
- package/src/TextLink/TextLink.mdx +93 -0
- package/src/TextLink/TextLink.stories.tsx +260 -0
- package/src/TextLink/TextLink.test.tsx +230 -0
- package/src/TextLink/TextLink.tsx +194 -0
- package/src/Tooltip/Tooltip.tsx +5 -1
- package/src/controlStyles.ts +69 -1
- package/src/icons.storyHelpers.tsx +32 -0
- package/src/index.ts +41 -0
- package/src/intentStyles.ts +19 -0
- package/src/mountStory.testHelpers.ts +63 -0
- package/src/reactRouter/ReactRouterLink.tsx +30 -0
- package/src/reactRouter/index.ts +29 -0
- package/src/sourceRules.test.ts +41 -6
package/dist/Field/Field.js
CHANGED
|
@@ -121,6 +121,6 @@ export const Field = ({ children, className, description, error, isRequired = fa
|
|
|
121
121
|
id: controlId,
|
|
122
122
|
required: isRequired || undefined,
|
|
123
123
|
}));
|
|
124
|
-
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-
|
|
124
|
+
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-sm", id: descriptionId, children: description })), error === undefined ? null : (_jsx("p", { className: "text-intent-danger-content text-sm", id: errorId, children: error }))] }));
|
|
125
125
|
};
|
|
126
126
|
//# sourceMappingURL=Field.js.map
|
package/dist/Field/Field.js.map
CHANGED
|
@@ -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;AAI3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA2B/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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","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,
|
|
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,SAuEpB,CAAA"}
|
package/dist/Field/FieldGroup.js
CHANGED
|
@@ -60,6 +60,6 @@ export const FieldGroup = ({ children, className, description, error, isRequired
|
|
|
60
60
|
// last of which makes it refuse to shrink inside a flex or
|
|
61
61
|
// grid parent, which is the reason design systems avoid the
|
|
62
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-
|
|
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-sm", id: descriptionId, children: description })), error === undefined ? null : (_jsx("p", { className: "text-intent-danger-content text-sm", id: errorId, children: error }))] }));
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=FieldGroup.js.map
|
|
@@ -1 +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,C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,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,
|
|
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,SAgMnB,CAAA"}
|
|
@@ -141,7 +141,39 @@ export const LogViewer = ({ className, isAnnounced = false, label, lines, maxLin
|
|
|
141
141
|
observer.disconnect();
|
|
142
142
|
};
|
|
143
143
|
}, [isFollowing]);
|
|
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",
|
|
144
|
+
return (_jsxs("div", { className: toClassName("relative flex flex-col", className), children: [_jsx("div", { "aria-label": label, "aria-live": isAnnounced ? "polite" : "off", className: toClassName("max-h-64 overflow-y-auto rounded-md border border-border-subtle bg-surface-sunken p-2 font-mono text-content-secondary text-xs",
|
|
145
|
+
// A sixth defect, and this one is nobody's code: scroll
|
|
146
|
+
// anchoring is the browser quietly *undoing* the follow
|
|
147
|
+
// above, and only sometimes.
|
|
148
|
+
//
|
|
149
|
+
// Chromium picks an anchor node in a scroll container and
|
|
150
|
+
// adjusts `scrollTop` to hold it still across a relayout.
|
|
151
|
+
// That is right for an article and wrong for a log: the
|
|
152
|
+
// whole contract here is "the bottom stays the bottom".
|
|
153
|
+
// `@charcuterie/tokens` ships Victor Mono `font-display:
|
|
154
|
+
// swap`, so a pane that mounts before the face arrives is
|
|
155
|
+
// laid out in the fallback and re-laid-out a moment later —
|
|
156
|
+
// and the anchor drags a followed pane off the end.
|
|
157
|
+
// Measured on the 60-line `Interactive` story, holding the
|
|
158
|
+
// font request back:
|
|
159
|
+
//
|
|
160
|
+
// anchoring on, font before mount : scrollTop 722, at the end
|
|
161
|
+
// anchoring on, font after mount : scrollTop 721, a pixel short
|
|
162
|
+
// anchoring off, either : scrollTop 722, at the end
|
|
163
|
+
//
|
|
164
|
+
// Whether the swap beats the mount is a race, so the pane
|
|
165
|
+
// followed correctly on some renders and not others. It
|
|
166
|
+
// read as visual-regression flake for a week — one story,
|
|
167
|
+
// `components-logviewer--interactive`, shifted a pixel —
|
|
168
|
+
// because a race is what it is. The DOM test missed it: its
|
|
169
|
+
// four pixels of slack are there for fractional device
|
|
170
|
+
// pixel ratios, and one pixel fits inside them.
|
|
171
|
+
//
|
|
172
|
+
// Only while following. A user who scrolled up to read an
|
|
173
|
+
// error *wants* the anchor — `maxLines` drops old lines off
|
|
174
|
+
// the top, and anchoring is what stops that shoving the
|
|
175
|
+
// line they are reading up the pane.
|
|
176
|
+
isFollowing ? "[overflow-anchor:none]" : null), onScroll: (scrollEvent) => {
|
|
145
177
|
const pane = scrollEvent.currentTarget;
|
|
146
178
|
// A few pixels of slack, because a fractional device pixel
|
|
147
179
|
// ratio means `scrollTop + clientHeight` never lands
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;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,cAAc,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAEpD,MAAM,UAAU,GACd,KAAK,CAAC,MAAM,GAAG,QAAQ;QACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;QACtC,CAAC,CAAC,KAA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ACf,IAAI,CAAC,SAAS;wBACd,IAAI,CAAC,YAAY;wBACnB,CAAC,CAAA;oBAEH,cAAc,CAAC,gBAAgB,CAAC,CAAA;gBAClC,CAAC,EACD,GAAG,EAAE,OAAO,EACZ,IAAI,EAAC,KAAK;gBACV,wXAAwX;gBACxX,QAAQ,EAAE,CAAC,YAEV,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,YAAG,SAAS,EAAC,oBAAoB,yCAE7B,CACL,CAAC,CAAC,CAAC,CACF,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,YACE,SAAS,EAAE,WAAW,CACpB,+BAA+B,EAC/B,IAAI,CAAC,MAAM,KAAK,SAAS;wBACvB,CAAC,CAAC,IAAI;wBACN,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CACtC,YAGA,IAAI,CAAC,IAAI,IAFL,IAAI,CAAC,GAAG,CAGX,CACL,CAAC,CACH,GACG,EAEL,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACpB,KAAC,MAAM,IACL,UAAU,EAAC,MAAM,EACjB,SAAS,EAAC,2CAA2C,EACrD,MAAM,EAAC,SAAS,EAChB,OAAO,EAAE,GAAG,EAAE;oBACZ,cAAc,CAAC,IAAI,CAAC,CAAA;gBACtB,CAAC,EACD,IAAI,EAAC,IAAI,+BAGF,CACV,IACG,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { RouterLinkProps } from "./routerLink.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A plain `<a href>`, and the default every link component falls
|
|
5
|
+
* back to.
|
|
6
|
+
*
|
|
7
|
+
* It is the context's default value rather than a `null` check at
|
|
8
|
+
* each call site, which is what makes "no router installed" a
|
|
9
|
+
* configuration rather than a code path: `TextLink` and `ButtonLink`
|
|
10
|
+
* render `useRouterLink()` unconditionally and behave identically
|
|
11
|
+
* with and without a provider.
|
|
12
|
+
*
|
|
13
|
+
* It is also what a routed component falls back *to* for a
|
|
14
|
+
* destination the router must not intercept — see `getIsRoutedHref`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AnchorLink: ({ href, ...anchorProps }: RouterLinkProps) => ReactNode;
|
|
17
|
+
//# sourceMappingURL=AnchorLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorLink.d.ts","sourceRoot":"","sources":["../../src/RouterLink/AnchorLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,0BAGxB,eAAe,KAAG,SAEpB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A plain `<a href>`, and the default every link component falls
|
|
4
|
+
* back to.
|
|
5
|
+
*
|
|
6
|
+
* It is the context's default value rather than a `null` check at
|
|
7
|
+
* each call site, which is what makes "no router installed" a
|
|
8
|
+
* configuration rather than a code path: `TextLink` and `ButtonLink`
|
|
9
|
+
* render `useRouterLink()` unconditionally and behave identically
|
|
10
|
+
* with and without a provider.
|
|
11
|
+
*
|
|
12
|
+
* It is also what a routed component falls back *to* for a
|
|
13
|
+
* destination the router must not intercept — see `getIsRoutedHref`.
|
|
14
|
+
*/
|
|
15
|
+
export const AnchorLink = ({ href, ...anchorProps }) => (_jsx("a", { ...anchorProps, href: href }));
|
|
16
|
+
//# sourceMappingURL=AnchorLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorLink.js","sourceRoot":"","sources":["../../src/RouterLink/AnchorLink.tsx"],"names":[],"mappings":";AAIA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,IAAI,EACJ,GAAG,WAAW,EACE,EAAa,EAAE,CAAC,CAChC,eAAO,WAAW,EAAE,IAAI,EAAE,IAAI,GAAI,CACnC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { RouterLinkComponent } from "./routerLink.ts";
|
|
3
|
+
export declare const useRouterLink: () => RouterLinkComponent;
|
|
4
|
+
export declare const RouterLinkProvider: ({ children, link, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The app's link component, taking `href`. `ReactRouterLink` from
|
|
8
|
+
* `@charcuterie/ui/react-router`, or the app's own four-line
|
|
9
|
+
* wrapper around whatever it routes with.
|
|
10
|
+
*/
|
|
11
|
+
link: RouterLinkComponent;
|
|
12
|
+
}) => ReactNode;
|
|
13
|
+
//# sourceMappingURL=RouterLinkProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouterLinkProvider.d.ts","sourceRoot":"","sources":["../../src/RouterLink/RouterLinkProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AA6C1D,eAAO,MAAM,aAAa,QAAO,mBACF,CAAA;AAE/B,eAAO,MAAM,kBAAkB,GAAI,qBAGhC;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;OAIG;IACH,IAAI,EAAE,mBAAmB,CAAA;CAC1B,KAAG,SAIH,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { AnchorLink } from "./AnchorLink.js";
|
|
4
|
+
/**
|
|
5
|
+
* The router seam: one injection at the app root, and every
|
|
6
|
+
* `TextLink` / `ButtonLink` in the tree navigates the app's own way.
|
|
7
|
+
*
|
|
8
|
+
* ### Why the library cannot just pick a router
|
|
9
|
+
*
|
|
10
|
+
* The fleet has five answers at once — react-router v8 (mux-magic),
|
|
11
|
+
* react-router-dom v7 (bambuddy), wouter-preact (spoolbuddy), two
|
|
12
|
+
* hand-rolled routers, and five apps with no router at all. A
|
|
13
|
+
* dependency on any one of them would be wrong for four of the five,
|
|
14
|
+
* and `@charcuterie/ui` taking a router as a runtime dependency is a
|
|
15
|
+
* thing every consumer inherits.
|
|
16
|
+
*
|
|
17
|
+
* So the shape is the one `ColorSchemeSwitcher` already uses for the
|
|
18
|
+
* browser: **the seam has a working default**. Nothing injected means
|
|
19
|
+
* `AnchorLink` — a real `<a href>` that navigates by reloading, which
|
|
20
|
+
* is correct, just not soft. An app that wants soft navigation
|
|
21
|
+
* injects its router's link once:
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { RouterLinkProvider } from "@charcuterie/ui"
|
|
25
|
+
* import { ReactRouterLink } from "@charcuterie/ui/react-router"
|
|
26
|
+
*
|
|
27
|
+
* <RouterLinkProvider link={ReactRouterLink}>
|
|
28
|
+
* <App />
|
|
29
|
+
* </RouterLinkProvider>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* A router with no adapter here needs no adapter *from* here — the
|
|
33
|
+
* contract is a component taking `href`, so a four-line wrapper in
|
|
34
|
+
* the app is the whole integration. `Guides/Routing` shows both.
|
|
35
|
+
*
|
|
36
|
+
* ### It is deliberately not a hook the app calls
|
|
37
|
+
*
|
|
38
|
+
* `useNavigate` + `onClick` is what mux-magic and plex-channels do
|
|
39
|
+
* today, and it is how a nav item stops being a link: no middle-click,
|
|
40
|
+
* no ctrl-click, no "open in new tab", no status bar, nothing to copy.
|
|
41
|
+
* Injecting a *component* keeps the `<a href>` — the router only gets
|
|
42
|
+
* to intercept the plain-left-click that it can actually improve.
|
|
43
|
+
*/
|
|
44
|
+
const RouterLinkContext = createContext(AnchorLink);
|
|
45
|
+
export const useRouterLink = () => useContext(RouterLinkContext);
|
|
46
|
+
export const RouterLinkProvider = ({ children, link, }) => (_jsx(RouterLinkContext.Provider, { value: link, children: children }));
|
|
47
|
+
//# sourceMappingURL=RouterLinkProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouterLinkProvider.js","sourceRoot":"","sources":["../../src/RouterLink/RouterLinkProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,iBAAiB,GACrB,aAAa,CAAsB,UAAU,CAAC,CAAA;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAwB,EAAE,CACrD,UAAU,CAAC,iBAAiB,CAAC,CAAA;AAE/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,QAAQ,EACR,IAAI,GASL,EAAa,EAAE,CAAC,CACf,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACpC,QAAQ,GACkB,CAC9B,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the thing a router injects, and the one question the
|
|
3
|
+
* link components ask before they use it.
|
|
4
|
+
*
|
|
5
|
+
* Types live here rather than beside either implementation so
|
|
6
|
+
* `AnchorLink` (the default) and `RouterLinkProvider` (which defaults
|
|
7
|
+
* to it) can both name them without importing each other.
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentPropsWithRef, ComponentType } from "react";
|
|
10
|
+
/**
|
|
11
|
+
* `href`, not `to`.
|
|
12
|
+
*
|
|
13
|
+
* The library is router-agnostic and the platform's word for a
|
|
14
|
+
* destination is `href` — so the contract is the DOM's, and each
|
|
15
|
+
* adapter renames it on the way in (`ReactRouterLink` maps `href` to
|
|
16
|
+
* react-router's `to`). Injecting a component whose prop is `to`
|
|
17
|
+
* would make `@charcuterie/ui`'s own API a mirror of one router's.
|
|
18
|
+
*/
|
|
19
|
+
export type RouterLinkProps = Omit<ComponentPropsWithRef<"a">, "href"> & {
|
|
20
|
+
href: string;
|
|
21
|
+
};
|
|
22
|
+
export type RouterLinkComponent = ComponentType<RouterLinkProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether this destination is the injected router's to handle.
|
|
25
|
+
*
|
|
26
|
+
* A router's `<Link>` intercepts the click and pushes history, which
|
|
27
|
+
* is right for `/settings` and wrong for three cases it cannot serve:
|
|
28
|
+
*
|
|
29
|
+
* - **Another origin or another scheme** — `https://…`, `mailto:`,
|
|
30
|
+
* `tel:`, protocol-relative `//cdn…`. Pushing those onto the
|
|
31
|
+
* history stack navigates the SPA to a route that does not exist.
|
|
32
|
+
* - **A same-page fragment** — `#credits`. The browser's own
|
|
33
|
+
* scroll-to-id is the behaviour a reader expects; a router turns
|
|
34
|
+
* it into a route change.
|
|
35
|
+
*
|
|
36
|
+
* Everything else — `/x`, `x`, `?sort=name` — is the router's.
|
|
37
|
+
*
|
|
38
|
+
* Deliberately a *destination* test rather than a prop: a component
|
|
39
|
+
* that routed whatever it was given would make `isExternal` a
|
|
40
|
+
* correctness switch instead of a presentation one, and an app that
|
|
41
|
+
* forgot it would ship a broken link rather than a slightly plain
|
|
42
|
+
* one.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getIsRoutedHref: (href: string) => boolean;
|
|
45
|
+
//# sourceMappingURL=routerLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerLink.d.ts","sourceRoot":"","sources":["../../src/RouterLink/routerLink.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACd,MAAM,OAAO,CAAA;AAEd;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,qBAAqB,CAAC,GAAG,CAAC,EAC1B,MAAM,CACP,GAAG;IACF,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,mBAAmB,GAC7B,aAAa,CAAC,eAAe,CAAC,CAAA;AAEhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OACA,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the thing a router injects, and the one question the
|
|
3
|
+
* link components ask before they use it.
|
|
4
|
+
*
|
|
5
|
+
* Types live here rather than beside either implementation so
|
|
6
|
+
* `AnchorLink` (the default) and `RouterLinkProvider` (which defaults
|
|
7
|
+
* to it) can both name them without importing each other.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Whether this destination is the injected router's to handle.
|
|
11
|
+
*
|
|
12
|
+
* A router's `<Link>` intercepts the click and pushes history, which
|
|
13
|
+
* is right for `/settings` and wrong for three cases it cannot serve:
|
|
14
|
+
*
|
|
15
|
+
* - **Another origin or another scheme** — `https://…`, `mailto:`,
|
|
16
|
+
* `tel:`, protocol-relative `//cdn…`. Pushing those onto the
|
|
17
|
+
* history stack navigates the SPA to a route that does not exist.
|
|
18
|
+
* - **A same-page fragment** — `#credits`. The browser's own
|
|
19
|
+
* scroll-to-id is the behaviour a reader expects; a router turns
|
|
20
|
+
* it into a route change.
|
|
21
|
+
*
|
|
22
|
+
* Everything else — `/x`, `x`, `?sort=name` — is the router's.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately a *destination* test rather than a prop: a component
|
|
25
|
+
* that routed whatever it was given would make `isExternal` a
|
|
26
|
+
* correctness switch instead of a presentation one, and an app that
|
|
27
|
+
* forgot it would ship a broken link rather than a slightly plain
|
|
28
|
+
* one.
|
|
29
|
+
*/
|
|
30
|
+
export const getIsRoutedHref = (href) => !/^(?:[a-z][a-z\d+\-.]*:|\/\/|#)/i.test(href);
|
|
31
|
+
//# sourceMappingURL=routerLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerLink.js","sourceRoot":"","sources":["../../src/RouterLink/routerLink.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAW,EAAE,CACvD,CAAC,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTableHeader.d.ts","sourceRoot":"","sources":["../../src/SortableTableHeader/SortableTableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,CAAA;AAEtD,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,iEAAiE;IACjE,MAAM,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAA;CAC3C,CAAA;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,mBAAmB,GAAI,6CAKjC,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"SortableTableHeader.d.ts","sourceRoot":"","sources":["../../src/SortableTableHeader/SortableTableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,CAAA;AAEtD,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,iEAAiE;IACjE,MAAM,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAA;CAC3C,CAAA;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,mBAAmB,GAAI,6CAKjC,wBAAwB,KAAG,SA2D7B,CAAA"}
|
|
@@ -48,7 +48,13 @@ const NEXT_DIRECTION = {
|
|
|
48
48
|
* `getByRole("columnheader", { name: "Name" })` stops matching the
|
|
49
49
|
* moment somebody sorts it.
|
|
50
50
|
*/
|
|
51
|
-
export const SortableTableHeader = ({ children, className, direction, onSort, }) => (_jsx("th", { "aria-sort": direction ?? "none", className: toClassName("border-border-subtle border-b p-0 text-start", className), scope: "col", children: _jsxs("button", { className: toClassName(
|
|
51
|
+
export const SortableTableHeader = ({ children, className, direction, onSort, }) => (_jsx("th", { "aria-sort": direction ?? "none", className: toClassName("border-border-subtle border-b p-0 text-start", className), scope: "col", children: _jsxs("button", { className: toClassName(
|
|
52
|
+
// `text-sm` since 2026-08-10. This was the single most
|
|
53
|
+
// fragile combination in the package: `text-xs` at 12px,
|
|
54
|
+
// uppercased and letterspaced, which strips the word shapes
|
|
55
|
+
// readers use at small sizes. A column header is the label
|
|
56
|
+
// for everything under it, so it is content.
|
|
57
|
+
"flex w-full cursor-pointer items-center gap-1.5 bg-transparent px-3 py-2 text-start font-medium text-content-secondary text-sm uppercase tracking-wide transition-colors duration-(--duration-fast) ease-standard", "hover:text-content-primary", FOCUS_RING_CLASS), onClick: () => {
|
|
52
58
|
onSort(direction === undefined
|
|
53
59
|
? "ascending"
|
|
54
60
|
: NEXT_DIRECTION[direction]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTableHeader.js","sourceRoot":"","sources":["../../src/SortableTableHeader/SortableTableHeader.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAmB/C,MAAM,cAAc,GAClB;IACE,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE,WAAW;CACxB,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,MAAM,GACmB,EAAa,EAAE,CAAC,CACzC,0BAMa,SAAS,IAAI,MAAM,EAC9B,SAAS,EAAE,WAAW,CACpB,8CAA8C,EAC9C,SAAS,CACV,EACD,KAAK,EAAC,KAAK,YAEX,kBACE,SAAS,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"SortableTableHeader.js","sourceRoot":"","sources":["../../src/SortableTableHeader/SortableTableHeader.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAmB/C,MAAM,cAAc,GAClB;IACE,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE,WAAW;CACxB,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,MAAM,GACmB,EAAa,EAAE,CAAC,CACzC,0BAMa,SAAS,IAAI,MAAM,EAC9B,SAAS,EAAE,WAAW,CACpB,8CAA8C,EAC9C,SAAS,CACV,EACD,KAAK,EAAC,KAAK,YAEX,kBACE,SAAS,EAAE,WAAW;QACpB,uDAAuD;QACvD,yDAAyD;QACzD,4DAA4D;QAC5D,2DAA2D;QAC3D,6CAA6C;QAC7C,mNAAmN,EACnN,4BAA4B,EAC5B,gBAAgB,CACjB,EACD,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CACJ,SAAS,KAAK,SAAS;gBACrB,CAAC,CAAC,WAAW;gBACb,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAC9B,CAAA;QACH,CAAC,EACD,IAAI,EAAC,QAAQ,aAEZ,QAAQ,EAET,6BAIc,MAAM,EAClB,SAAS,EAAE,WAAW,CACpB,2FAA2F,EAC3F,SAAS,KAAK,SAAS,IAAI,WAAW,EACtC,SAAS,KAAK,YAAY,IAAI,YAAY,CAC3C,EACD,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,KAAK,EAChB,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAE,CAAC,EACd,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,YAElC,eAAM,CAAC,EAAC,eAAe,GAAG,GACtB,IACC,GACN,CACN,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IntentName } from "@charcuterie/tokens";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Two ways a link sits in a layout, and the difference is real rather
|
|
5
|
+
* than decorative.
|
|
6
|
+
*
|
|
7
|
+
* - `inline` lives **inside a sentence**. It is `display: inline`, so
|
|
8
|
+
* it wraps across lines with the prose around it, it inherits the
|
|
9
|
+
* surrounding font size rather than declaring one, and it is
|
|
10
|
+
* underlined — because inside a paragraph, colour alone is the
|
|
11
|
+
* thing WCAG 1.4.1 says cannot carry the meaning on its own.
|
|
12
|
+
* - `standalone` is **its own element**: a back-link, a nav item, a
|
|
13
|
+
* "view all" beside a heading. It is an inline flex box so an
|
|
14
|
+
* `iconStart` sits on the text's centre line with a real gap, and
|
|
15
|
+
* it underlines on hover instead of permanently — a column of
|
|
16
|
+
* permanently-underlined nav items reads as a mistake.
|
|
17
|
+
*/
|
|
18
|
+
export type TextLinkAppearance = "inline" | "standalone";
|
|
19
|
+
export type TextLinkProps = Omit<ComponentPropsWithRef<"a">, "href"> & {
|
|
20
|
+
appearance?: TextLinkAppearance;
|
|
21
|
+
/**
|
|
22
|
+
* Required, and required even when disabled — a navigation that
|
|
23
|
+
* cannot say where it goes is a button wearing a link's clothes.
|
|
24
|
+
*/
|
|
25
|
+
href: string;
|
|
26
|
+
iconEnd?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The back-arrow, supplied by the app. The library ships no glyphs
|
|
29
|
+
* — see
|
|
30
|
+
* `docs/decisions/2026-07-29-ship-no-icons-and-no-symbol-glyphs.md`
|
|
31
|
+
* — and the seven repos that hand-roll a `← Back` today already own
|
|
32
|
+
* the character they want.
|
|
33
|
+
*/
|
|
34
|
+
iconStart?: ReactNode;
|
|
35
|
+
intent?: IntentName;
|
|
36
|
+
isDisabled?: boolean;
|
|
37
|
+
isExternal?: boolean;
|
|
38
|
+
/** What `isExternal` announces. Not shown. */
|
|
39
|
+
newTabLabel?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Navigation that looks like a link.
|
|
43
|
+
*
|
|
44
|
+
* The fleet has **seven repos** hand-rolling a back-link — each with
|
|
45
|
+
* its own `←`, its own hover rule, and its own idea of whether focus
|
|
46
|
+
* is visible — and points-market's header title is a clickable
|
|
47
|
+
* `<div>`. This is the thing to reach for instead, and the reason the
|
|
48
|
+
* split with `ButtonLink` exists at all: the two differ in **paint,
|
|
49
|
+
* not semantics**. Both render a real `<a href>`; picking between
|
|
50
|
+
* them is picking how it looks, which is a decision an agent can make
|
|
51
|
+
* correctly from the name alone
|
|
52
|
+
* ([decision](../../../docs/decisions/2026-08-10-buttons-are-actions-links-are-navigation.md)).
|
|
53
|
+
*
|
|
54
|
+
* What it does not do is as load-bearing as what it does:
|
|
55
|
+
*
|
|
56
|
+
* - **No `onClick`-only mode.** If it does not navigate, it is a
|
|
57
|
+
* `Button` with `appearance="ghost"`, not a link.
|
|
58
|
+
* - **No `size`.** Text takes the size of the text around it. A
|
|
59
|
+
* standalone link that wants `text-sm` gets it from the block it
|
|
60
|
+
* sits in, or from `className`.
|
|
61
|
+
* - **No colour change on hover.** See `TEXT_LINK_BASE_CLASS`.
|
|
62
|
+
*
|
|
63
|
+
* `isDisabled` drops `href` rather than shipping a focusable anchor
|
|
64
|
+
* that ignores clicks; `role="link"` + `aria-disabled` keeps it
|
|
65
|
+
* announced. Rarer here than on `ButtonLink` — a dead link in a
|
|
66
|
+
* sentence is usually better written as plain text.
|
|
67
|
+
*/
|
|
68
|
+
export declare const TextLink: ({ appearance, children, className, href, iconEnd, iconStart, intent, isDisabled, isExternal, newTabLabel, ...anchorProps }: TextLinkProps) => ReactNode;
|
|
69
|
+
//# sourceMappingURL=TextLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextLink.d.ts","sourceRoot":"","sources":["../../src/TextLink/TextLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAA;AAWd;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,YAAY,CAAA;AAExD,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,qBAAqB,CAAC,GAAG,CAAC,EAC1B,MAAM,CACP,GAAG;IACF,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAuCD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,QAAQ,GAAI,4HAYtB,aAAa,KAAG,SA2DlB,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FOCUS_RING_CLASS, INTENT_CONTENT_CLASS, } from "../intentStyles.js";
|
|
3
|
+
import { useRouterLink } from "../RouterLink/RouterLinkProvider.js";
|
|
4
|
+
import { getIsRoutedHref } from "../RouterLink/routerLink.js";
|
|
5
|
+
import { toClassName } from "../toClassName.js";
|
|
6
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
7
|
+
const TEXT_LINK_APPEARANCE_CLASS = {
|
|
8
|
+
// No `text-*` of its own: an inline link that resized itself would
|
|
9
|
+
// be a hole in whatever type scale the paragraph is set in.
|
|
10
|
+
inline: "underline decoration-1 underline-offset-2 hover:decoration-2",
|
|
11
|
+
standalone: "inline-flex items-center gap-1 font-medium no-underline underline-offset-2 hover:underline",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Hover changes the **underline**, never the colour, and there is no
|
|
15
|
+
* hover-tinted background either.
|
|
16
|
+
*
|
|
17
|
+
* A text link has no box to fill, so `INTENT_HOVER_CLASS` — which
|
|
18
|
+
* lands on the intent's tinted surface — would paint a coloured
|
|
19
|
+
* rectangle around a word mid-sentence. And there is no
|
|
20
|
+
* `intent.*.content-hover` token to shift the text to: the ramp goes
|
|
21
|
+
* `surface` / `surface-hover` / `border` / `content` / `solid` /
|
|
22
|
+
* `solid-hover` / `on-solid`, so a hover colour here would have to be
|
|
23
|
+
* invented, and an invented colour is one the contrast gate has never
|
|
24
|
+
* measured. Underline weight is free of both problems and shifts no
|
|
25
|
+
* layout.
|
|
26
|
+
*/
|
|
27
|
+
const TEXT_LINK_BASE_CLASS = "cursor-pointer rounded-xs";
|
|
28
|
+
/**
|
|
29
|
+
* The disabled paint, keyed off `aria-disabled` because an `<a>` has
|
|
30
|
+
* no `:disabled` to match. See `ARIA_DISABLED_CLASS` — this is its
|
|
31
|
+
* text-shaped twin, minus the box treatment a run of prose has no
|
|
32
|
+
* room for.
|
|
33
|
+
*/
|
|
34
|
+
const TEXT_LINK_ARIA_DISABLED_CLASS = "aria-disabled:pointer-events-none aria-disabled:text-content-disabled aria-disabled:no-underline";
|
|
35
|
+
/**
|
|
36
|
+
* Navigation that looks like a link.
|
|
37
|
+
*
|
|
38
|
+
* The fleet has **seven repos** hand-rolling a back-link — each with
|
|
39
|
+
* its own `←`, its own hover rule, and its own idea of whether focus
|
|
40
|
+
* is visible — and points-market's header title is a clickable
|
|
41
|
+
* `<div>`. This is the thing to reach for instead, and the reason the
|
|
42
|
+
* split with `ButtonLink` exists at all: the two differ in **paint,
|
|
43
|
+
* not semantics**. Both render a real `<a href>`; picking between
|
|
44
|
+
* them is picking how it looks, which is a decision an agent can make
|
|
45
|
+
* correctly from the name alone
|
|
46
|
+
* ([decision](../../../docs/decisions/2026-08-10-buttons-are-actions-links-are-navigation.md)).
|
|
47
|
+
*
|
|
48
|
+
* What it does not do is as load-bearing as what it does:
|
|
49
|
+
*
|
|
50
|
+
* - **No `onClick`-only mode.** If it does not navigate, it is a
|
|
51
|
+
* `Button` with `appearance="ghost"`, not a link.
|
|
52
|
+
* - **No `size`.** Text takes the size of the text around it. A
|
|
53
|
+
* standalone link that wants `text-sm` gets it from the block it
|
|
54
|
+
* sits in, or from `className`.
|
|
55
|
+
* - **No colour change on hover.** See `TEXT_LINK_BASE_CLASS`.
|
|
56
|
+
*
|
|
57
|
+
* `isDisabled` drops `href` rather than shipping a focusable anchor
|
|
58
|
+
* that ignores clicks; `role="link"` + `aria-disabled` keeps it
|
|
59
|
+
* announced. Rarer here than on `ButtonLink` — a dead link in a
|
|
60
|
+
* sentence is usually better written as plain text.
|
|
61
|
+
*/
|
|
62
|
+
export const TextLink = ({ appearance = "inline", children, className, href, iconEnd, iconStart, intent = "accent", isDisabled = false, isExternal = false, newTabLabel = "(opens in a new tab)", ...anchorProps }) => {
|
|
63
|
+
const RouterLink = useRouterLink();
|
|
64
|
+
// An external destination or a fragment is never the router's, and
|
|
65
|
+
// a disabled one goes nowhere at all — each falls back to the plain
|
|
66
|
+
// anchor below rather than through the injected component.
|
|
67
|
+
const LinkElement = isExternal || !getIsRoutedHref(href) ? "a" : RouterLink;
|
|
68
|
+
const linkClassName = toClassName(TEXT_LINK_BASE_CLASS, TEXT_LINK_APPEARANCE_CLASS[appearance], INTENT_CONTENT_CLASS[intent], FOCUS_RING_CLASS, TEXT_LINK_ARIA_DISABLED_CLASS, className);
|
|
69
|
+
const content = (_jsxs(_Fragment, { children: [iconStart, children, iconEnd, isExternal ? (_jsx(VisuallyHidden, { children: newTabLabel })) : null] }));
|
|
70
|
+
if (isDisabled) {
|
|
71
|
+
return (_jsx("a", { ...anchorProps, "aria-disabled": "true", className: linkClassName, role: "link", children: content }));
|
|
72
|
+
}
|
|
73
|
+
return (_jsx(LinkElement, { ...anchorProps, className: linkClassName, href: href,
|
|
74
|
+
// `noreferrer` alongside `noopener` on purpose: `noopener`
|
|
75
|
+
// closes the `window.opener` hole, and `noreferrer` is what
|
|
76
|
+
// keeps a private app's URL out of the destination's logs.
|
|
77
|
+
rel: isExternal ? "noopener noreferrer" : undefined, target: isExternal ? "_blank" : undefined, children: content }));
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=TextLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextLink.js","sourceRoot":"","sources":["../../src/TextLink/TextLink.tsx"],"names":[],"mappings":";AAMA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAsC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CA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AC;QACf,OAAO,CACL,eACM,WAAW,mBACD,MAAM,EACpB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAC,MAAM,YAEV,OAAO,GACN,CACL,CAAA;IACH,CAAC;IAED,OAAO,CACL,KAAC,WAAW,OACN,WAAW,EACf,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,IAAI;QACV,2DAA2D;QAC3D,4DAA4D;QAC5D,2DAA2D;QAC3D,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACnD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAExC,OAAO,GACI,CACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -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;AAcnD,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,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAcnD,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,SA0FjB,CAAA"}
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -105,7 +105,11 @@ export const Tooltip = ({ children, className, delay = 200, label, placement = "
|
|
|
105
105
|
// 2.9:1. The `solid`/`on-solid` roles exist precisely to
|
|
106
106
|
// be a guaranteed couple, and the contrast gate checks
|
|
107
107
|
// them as one.
|
|
108
|
-
|
|
108
|
+
// `text-sm`, not `text-xs`: a tooltip body is the only
|
|
109
|
+
// copy explaining the control it points at, so it is
|
|
110
|
+
// content rather than fine print. It was the whole
|
|
111
|
+
// tooltip at 12px before 2026-08-10.
|
|
112
|
+
"z-[var(--layer-tooltip)] max-w-xs rounded-md bg-intent-neutral-solid px-2 py-1 text-intent-neutral-on-solid text-sm shadow-medium", className),
|
|
109
113
|
// Portalled to `document.body`, the same reversal as the
|
|
110
114
|
// other overlays: `strategy: "fixed"` alone still let an
|
|
111
115
|
// `overflow: hidden` ancestor clip the tip, and a portal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"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,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACtC,CAAC,CAAA;IAEJ,MAAM,aAAa,GAAG,cAAc,CAClC,QAAQ;IACR,iDAAiD;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,KAAC,cAAc,cACb,iBACM,gBAAgB,EAAE,EACtB,SAAS,EAAE,WAAW;oBACpB,sDAAsD;oBACtD,oDAAoD;oBACpD,sDAAsD;oBACtD,0DAA0D;oBAC1D,oDAAoD;oBACpD,yDAAyD;oBACzD,uDAAuD;oBACvD,eAAe;oBACf,uDAAuD;oBACvD,qDAAqD;oBACrD,mDAAmD;oBACnD,qCAAqC;oBACrC,mIAAmI,EACnI,SAAS,CACV;oBACD,yDAAyD;oBACzD,yDAAyD;oBACzD,yDAAyD;oBACzD,0DAA0D;oBAC1D,2DAA2D;oBAC3D,yDAAyD;oBACzD,iBAAiB;oBACjB,GAAG,EAAE,IAAI,CAAC,WAAW;oBACrB,yDAAyD;oBACzD,oDAAoD;oBACpD,0DAA0D;oBAC1D,2DAA2D;oBAC3D,+BAA+B;oBAC/B,IAAI,EAAC,SAAS,EACd,KAAK,EAAE,cAAc,YAEpB,KAAK,GACF,GACS,CAClB,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAA;AACH,CAAC,CAAA"}
|
package/dist/controlStyles.d.ts
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* density axis also scales. See
|
|
16
16
|
* `packages/tokens/src/tailwindCollisions.test.ts`.
|
|
17
17
|
*/
|
|
18
|
-
import type { ControlSize } from "@charcuterie/tokens";
|
|
18
|
+
import type { ControlSize, IntentName } from "@charcuterie/tokens";
|
|
19
|
+
import type { IntentAppearance } from "./intentStyles.ts";
|
|
19
20
|
export declare const CONTROL_SIZE_CLASS: Record<ControlSize, string>;
|
|
20
21
|
/**
|
|
21
22
|
* Square, and sized by the *height* token on both axes so an icon
|
|
@@ -38,6 +39,40 @@ export declare const ICON_CONTROL_SIZE_CLASS: Record<ControlSize, string>;
|
|
|
38
39
|
* `docs/decisions/2026-08-05-controls-share-one-height-no-per-component-touch-floor.md`.
|
|
39
40
|
*/
|
|
40
41
|
export declare const MIN_TOUCH_TARGET_CLASS = "min-h-(--control-min-touch-target) min-w-(--control-min-touch-target)";
|
|
42
|
+
/**
|
|
43
|
+
* Everything a pressable control looks like before an intent, a size,
|
|
44
|
+
* or a state is applied to it.
|
|
45
|
+
*
|
|
46
|
+
* Pulled out of `Button` the day `ButtonLink` shipped. Those two must
|
|
47
|
+
* paint **identically** — the whole point of `ButtonLink` is that a
|
|
48
|
+
* navigation can read as a primary button — and "identically" spelled
|
|
49
|
+
* as two copies of the same string is a promise that survives exactly
|
|
50
|
+
* one edit.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CONTROL_BASE_CLASS = "inline-flex cursor-pointer items-center justify-center rounded-md border font-medium whitespace-nowrap transition-colors duration-(--duration-fast) ease-standard select-none";
|
|
53
|
+
/**
|
|
54
|
+
* The one class list a button-shaped control wears, assembled once.
|
|
55
|
+
*
|
|
56
|
+
* `Button` and `ButtonLink` call this with the same arguments and get
|
|
57
|
+
* the same string back, so a new appearance, a changed radius, or a
|
|
58
|
+
* different hover ramp reaches both or neither. `ButtonLink.test.tsx`
|
|
59
|
+
* asserts the resulting *computed styles* match, which is the version
|
|
60
|
+
* of this claim a class-name refactor cannot quietly break.
|
|
61
|
+
*
|
|
62
|
+
* The disabled treatment is the caller's, because it is the one thing
|
|
63
|
+
* that genuinely differs: a `<button>` has a real `disabled`
|
|
64
|
+
* attribute and gets `DISABLED_CLASS`, while an `<a>` has no such
|
|
65
|
+
* concept and gets `ARIA_DISABLED_CLASS` keyed off `aria-disabled`.
|
|
66
|
+
*/
|
|
67
|
+
export declare const getControlClassName: ({ appearance, className, disabledClass, intent, isFullWidth, size, sizing, }: {
|
|
68
|
+
appearance: IntentAppearance;
|
|
69
|
+
className?: string;
|
|
70
|
+
disabledClass: string;
|
|
71
|
+
intent: IntentName;
|
|
72
|
+
isFullWidth: boolean;
|
|
73
|
+
size: ControlSize;
|
|
74
|
+
sizing: "control" | "icon";
|
|
75
|
+
}) => string;
|
|
41
76
|
/**
|
|
42
77
|
* Non-control sizing: badges, indicator dots, spinners. These are
|
|
43
78
|
* type-relative on purpose — a badge beside `text-sm` prose that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlStyles.d.ts","sourceRoot":"","sources":["../src/controlStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"controlStyles.d.ts","sourceRoot":"","sources":["../src/controlStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAQzD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACrC,WAAW,EACX,MAAM,CAKP,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,WAAW,EACX,MAAM,CAKP,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,0EACsC,CAAA;AAEzE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,kLACkJ,CAAA;AAEjL;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,8EAQjC;IACD,UAAU,EAAE,gBAAgB,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,UAAU,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,SAAS,GAAG,MAAM,CAAA;CAC3B,KAAG,MAYD,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAErD,eAAO,MAAM,cAAc;;;;CAIjB,CAAA;AAEV,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACrC,WAAW,EACX,MAAM,CAKP,CAAA"}
|