@jonmilner/ui 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Badge/Badge.css.mjs
CHANGED
|
@@ -10,11 +10,13 @@ var t = "_1ixfil10", n = e({
|
|
|
10
10
|
variant: {
|
|
11
11
|
neutral: "_1ixfil12",
|
|
12
12
|
accent: "_1ixfil13",
|
|
13
|
-
|
|
13
|
+
success: "_1ixfil14",
|
|
14
|
+
warning: "_1ixfil15",
|
|
15
|
+
danger: "_1ixfil16"
|
|
14
16
|
},
|
|
15
17
|
size: {
|
|
16
|
-
sm: "
|
|
17
|
-
med: "
|
|
18
|
+
sm: "_1ixfil17",
|
|
19
|
+
med: "_1ixfil18"
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
22
|
defaultVariants: {},
|
package/dist/Badge/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { ComponentPropsWithRef } from "react";
|
|
|
4
4
|
//#region src/Badge/index.d.ts
|
|
5
5
|
export type BadgeOwnProps = {
|
|
6
6
|
size?: "sm" | "med";
|
|
7
|
-
variant?: "neutral" | "accent" | "danger";
|
|
7
|
+
variant?: "neutral" | "accent" | "success" | "warning" | "danger";
|
|
8
8
|
};
|
|
9
9
|
export type BadgeProps = StyleProps & BadgeOwnProps & OmitEach<ComponentPropsWithRef<"span">, keyof StyleProps | keyof BadgeOwnProps>;
|
|
10
10
|
export declare function Badge({ variant, size, display, paddingInline, paddingBlock, borderRadius, backgroundColor, color, className, children, ...props }: BadgeProps): import("react").JSX.Element | null;
|
package/dist/Badge/index.mjs
CHANGED
|
@@ -13,6 +13,14 @@ var o = {
|
|
|
13
13
|
backgroundColor: "accent",
|
|
14
14
|
color: "accentFg"
|
|
15
15
|
},
|
|
16
|
+
success: {
|
|
17
|
+
backgroundColor: "success",
|
|
18
|
+
color: "successFg"
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
backgroundColor: "warning",
|
|
22
|
+
color: "warningFg"
|
|
23
|
+
},
|
|
16
24
|
danger: {
|
|
17
25
|
backgroundColor: "danger",
|
|
18
26
|
color: "dangerFg"
|
package/dist/docs/Badge.md
CHANGED
|
@@ -20,13 +20,13 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
20
20
|
|
|
21
21
|
## Rules
|
|
22
22
|
|
|
23
|
-
- `variant`: `neutral` (default, `fgMuted` on `bgMuted`) for most statuses and facts; `accent` (`accentFg` on `accent`) to draw the eye; `
|
|
23
|
+
- `variant`: `neutral` (default, `fgMuted` on `bgMuted`) for most statuses and facts; `accent` (`accentFg` on `accent`) to draw the eye; `success` (`successFg` on `success`) for a done or healthy state; `warning` (`warningFg` on `warning`) for one that needs attention soon; `danger` (`dangerFg` on `danger`) for a failure or a blocked state.
|
|
24
24
|
- `size`: `sm` or `med` (default), the label's `fontSize` step.
|
|
25
|
-
- The label states the state. Color is never the only cue (WCAG 1.4.1): under forced colors every variant is the same outlined box, and some readers cannot tell the fills apart. Write "Failed", not a red badge reading "3".
|
|
25
|
+
- The label states the state. Color is never the only cue (WCAG 1.4.1): under forced colors every variant, `success` and `warning` included, is the same outlined box, and some readers cannot tell the fills apart (green from red above all). Write "Failed" or "Passed", not a red or green badge reading "3".
|
|
26
26
|
- Keep it to one or two words; it never wraps. With no children it renders nothing.
|
|
27
27
|
- Fill, text color, padding, radius and `display` (`inline-block`) are default style props on the outer `span`; a consumer's win. `className`, `style` and `ref` go to it, `className` last. The box holds inside a `Text` or `Heading` too.
|
|
28
28
|
- The module has no hooks, so a server component can render it.
|
|
29
|
-
- Migrating from the inbox's `Pill`: `Pill tone=…` is `Badge variant
|
|
29
|
+
- Migrating from the inbox's `Pill`: `Pill tone=…` is `Badge variant=…`, with `good` as `success`, `warn` as `warning` and `bad` as `danger`; `pillLink` has no Badge equivalent (compose `Clickable`).
|
|
30
30
|
|
|
31
31
|
## Do
|
|
32
32
|
|
|
@@ -60,7 +60,7 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
60
60
|
- It is plain text in a `span`: screen readers read the label in line with what is around it, so the label must make sense there ("Quarterly report Draft").
|
|
61
61
|
- No role, no `aria-live`: a badge that changes is not announced. If a status change matters right away, announce it elsewhere (a toast).
|
|
62
62
|
- Each variant's text and fill pass AA (4.5:1) in light and dark mode; the pairs are in `contrastPairs` (ADR 0033).
|
|
63
|
-
- Under forced colors every badge is `CanvasText` on `Canvas` with a `CanvasText` outline, so the box survives and the variants look alike; the label carries the meaning. The role fills are not kept: `accent` would take the link color, on something that is not a link, and the browser's backplate would hide the filled variants' text.
|
|
63
|
+
- Under forced colors every badge is `CanvasText` on `Canvas` with a `CanvasText` outline, so the box survives and the variants look alike; the label carries the meaning. The role fills are not kept: `accent` would take the link color, on something that is not a link, and the browser's backplate would hide the filled variants' text. `success`, `warning` and `danger` map to the same system pair (ADR 0104), so only the label tells them apart.
|
|
64
64
|
|
|
65
65
|
## Props
|
|
66
66
|
|
|
@@ -71,6 +71,6 @@ Generated from the TypeScript types.
|
|
|
71
71
|
| Prop | Type | Required | Description |
|
|
72
72
|
| --- | --- | --- | --- |
|
|
73
73
|
| `size` | `"med" \| "sm"` | no | |
|
|
74
|
-
| `variant` | `"accent" \| "danger" \| "neutral"` | no | |
|
|
74
|
+
| `variant` | `"accent" \| "danger" \| "neutral" \| "success" \| "warning"` | no | |
|
|
75
75
|
|
|
76
76
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./manifest.schema.json",
|
|
3
3
|
"package": "@jonmilner/ui",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "AlertDialog",
|
|
@@ -143,12 +143,14 @@
|
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
"name": "variant",
|
|
146
|
-
"type": "\"accent\" | \"danger\" | \"neutral\"",
|
|
146
|
+
"type": "\"accent\" | \"danger\" | \"neutral\" | \"success\" | \"warning\"",
|
|
147
147
|
"required": false,
|
|
148
148
|
"values": [
|
|
149
149
|
"accent",
|
|
150
150
|
"danger",
|
|
151
|
-
"neutral"
|
|
151
|
+
"neutral",
|
|
152
|
+
"success",
|
|
153
|
+
"warning"
|
|
152
154
|
]
|
|
153
155
|
}
|
|
154
156
|
],
|