@cosmicdrift/kumiko-renderer-web 0.139.0 → 0.140.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.140.0",
|
|
4
4
|
"description": "Web-platform bindings for @cosmicdrift/kumiko-renderer. HTML default-primitives, browser history-based navigation, EventSource-backed live events, and a one-call createKumikoApp that mounts the whole stack via react-dom.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"./styles.css": "./src/styles.css"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.
|
|
20
|
-
"@cosmicdrift/kumiko-headless": "0.
|
|
21
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
19
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.140.0",
|
|
20
|
+
"@cosmicdrift/kumiko-headless": "0.140.0",
|
|
21
|
+
"@cosmicdrift/kumiko-renderer": "0.140.0",
|
|
22
22
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
23
23
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
24
24
|
"@radix-ui/react-label": "^2.1.8",
|
package/src/primitives/index.tsx
CHANGED
|
@@ -124,9 +124,17 @@ function DefaultButton({
|
|
|
124
124
|
loading,
|
|
125
125
|
variant = "primary",
|
|
126
126
|
size = "md",
|
|
127
|
+
ariaLabel,
|
|
128
|
+
fullWidth,
|
|
127
129
|
children,
|
|
128
130
|
testId,
|
|
129
131
|
}: ButtonProps): ReactNode {
|
|
132
|
+
// link-Variant rendert text-artig (Inline-Link im Fließtext/Banner), nicht als
|
|
133
|
+
// gepolsterte Fläche; fullWidth streckt CTA-Buttons in Karten/Panels.
|
|
134
|
+
const className =
|
|
135
|
+
[variant === "link" ? "h-auto px-0 py-0" : "", fullWidth === true ? "w-full" : ""]
|
|
136
|
+
.filter(Boolean)
|
|
137
|
+
.join(" ") || undefined;
|
|
130
138
|
return (
|
|
131
139
|
<UiButton
|
|
132
140
|
type={type}
|
|
@@ -136,9 +144,8 @@ function DefaultButton({
|
|
|
136
144
|
data-loading={loading === true ? "true" : undefined}
|
|
137
145
|
variant={BUTTON_VARIANT[variant]}
|
|
138
146
|
size={BUTTON_SIZE[size]}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
className={variant === "link" ? "h-auto px-0 py-0" : undefined}
|
|
147
|
+
{...(ariaLabel !== undefined && { "aria-label": ariaLabel })}
|
|
148
|
+
className={className}
|
|
142
149
|
>
|
|
143
150
|
{loading === true ? <Loader2 className="size-4 animate-spin" aria-hidden="true" /> : children}
|
|
144
151
|
</UiButton>
|
|
@@ -232,6 +232,32 @@ describe("Button size", () => {
|
|
|
232
232
|
render(<SizedButton size="sm" />);
|
|
233
233
|
expect(screen.getByRole("button", { name: "X" }).className).toContain("h-8");
|
|
234
234
|
});
|
|
235
|
+
|
|
236
|
+
test("ariaLabel gibt icon-only-Buttons einen zugänglichen Namen", () => {
|
|
237
|
+
function IconBtn(): ReactNode {
|
|
238
|
+
const { Button } = usePrimitives();
|
|
239
|
+
return (
|
|
240
|
+
<Button size="icon" ariaLabel="Entfernen" onClick={() => {}}>
|
|
241
|
+
✕
|
|
242
|
+
</Button>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
render(<IconBtn />);
|
|
246
|
+
expect(screen.getByRole("button", { name: "Entfernen" })).toBeTruthy();
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test("fullWidth streckt den Button (w-full)", () => {
|
|
250
|
+
function WideBtn(): ReactNode {
|
|
251
|
+
const { Button } = usePrimitives();
|
|
252
|
+
return (
|
|
253
|
+
<Button fullWidth onClick={() => {}}>
|
|
254
|
+
Upgrade
|
|
255
|
+
</Button>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
render(<WideBtn />);
|
|
259
|
+
expect(screen.getByRole("button", { name: "Upgrade" }).className).toContain("w-full");
|
|
260
|
+
});
|
|
235
261
|
});
|
|
236
262
|
|
|
237
263
|
describe("ComparisonTable", () => {
|