@tangle-network/ui 11.28.0 → 11.28.2
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/CHANGELOG.md +12 -0
- package/dist/markdown/markdown.js +1 -0
- package/dist/primitives/input.js +1 -1
- package/package.json +1 -1
- package/src/markdown/markdown.test.tsx +6 -0
- package/src/markdown/markdown.tsx +8 -1
- package/src/primitives/control-presentation.test.tsx +7 -0
- package/src/primitives/input.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @tangle-network/ui
|
|
2
2
|
|
|
3
|
+
## 11.28.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9f4d5b8: A file `Input`'s selector button inherits the field's text size, so `sm`, `lg` and coarse-pointer file inputs no longer keep a 14px button.
|
|
8
|
+
|
|
9
|
+
## 11.28.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 084cd75: A Markdown image without alt text now gives its full-size link the accessible name "Open image full size".
|
|
14
|
+
|
|
3
15
|
## 11.28.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/primitives/input.js
CHANGED
|
@@ -8,7 +8,7 @@ import { cva } from "class-variance-authority";
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/primitives/input.tsx
|
|
11
|
-
const inputVariants = cva(cn("flex w-full border py-1 placeholder:text-[var(--text-dim)] disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:font-medium
|
|
11
|
+
const inputVariants = cva(cn("flex w-full border py-1 placeholder:text-[var(--text-dim)] disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:font-medium", fieldPresentation, fieldTouchText), {
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
14
14
|
default: "",
|
package/package.json
CHANGED
|
@@ -114,6 +114,12 @@ describe("Markdown", () => {
|
|
|
114
114
|
expect(ad.closest("a")).toHaveAttribute("target", "_blank");
|
|
115
115
|
expect(ad.closest("a")).toHaveAttribute("rel", "noopener noreferrer");
|
|
116
116
|
|
|
117
|
+
render(<Markdown>{""}</Markdown>);
|
|
118
|
+
expect(screen.getByRole("link", { name: "Open image full size" })).toHaveAttribute(
|
|
119
|
+
"href",
|
|
120
|
+
"https://example.com/decorative.png",
|
|
121
|
+
);
|
|
122
|
+
|
|
117
123
|
const badge = screen.getByRole("img", { name: "Badge" });
|
|
118
124
|
expect(badge.closest("a")).toHaveAttribute("href", "https://example.com/docs");
|
|
119
125
|
expect(badge.closest("a")?.parentElement?.closest("a")).toBeNull();
|
|
@@ -113,7 +113,14 @@ function MarkdownImage({ node: _node, src, alt, className, ...props }: Component
|
|
|
113
113
|
);
|
|
114
114
|
if (insideLink) return image;
|
|
115
115
|
return (
|
|
116
|
-
<a
|
|
116
|
+
<a
|
|
117
|
+
href={url}
|
|
118
|
+
target="_blank"
|
|
119
|
+
rel="noopener noreferrer"
|
|
120
|
+
// An image without alt text would otherwise leave the link unnamed.
|
|
121
|
+
aria-label={alt ? undefined : "Open image full size"}
|
|
122
|
+
className="inline-block max-w-full"
|
|
123
|
+
>
|
|
117
124
|
{image}
|
|
118
125
|
</a>
|
|
119
126
|
);
|
|
@@ -63,6 +63,13 @@ describe("shared control presentation", () => {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
it("lets a file input's selector button take the field's text size", () => {
|
|
67
|
+
render(<Input type="file" size="lg" aria-label="Upload" />);
|
|
68
|
+
const classes = screen.getByLabelText("Upload").className.split(" ");
|
|
69
|
+
expect(classes).toContain("text-[length:var(--control-text-lg,1rem)]");
|
|
70
|
+
expect(classes.filter((name) => name.startsWith("file:text-"))).toEqual([]);
|
|
71
|
+
});
|
|
72
|
+
|
|
66
73
|
it("gives icon buttons squares on the same heights", () => {
|
|
67
74
|
render(<><Button size="icon-sm" aria-label="Small" /><Button size="icon" aria-label="Medium" /><Button size="icon-lg" aria-label="Large" /></>);
|
|
68
75
|
expect(screen.getByLabelText("Small").className).toContain("size-[var(--control-height-sm,2rem)]");
|
package/src/primitives/input.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
13
13
|
// and a Button at the same size share a height, text size and corner.
|
|
14
14
|
const inputVariants = cva(
|
|
15
15
|
cn(
|
|
16
|
-
"flex w-full border py-1 placeholder:text-[var(--text-dim)] disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:font-medium
|
|
16
|
+
"flex w-full border py-1 placeholder:text-[var(--text-dim)] disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:font-medium",
|
|
17
17
|
fieldPresentation,
|
|
18
18
|
fieldTouchText,
|
|
19
19
|
),
|