@metacensus/library-ui 0.2.0 → 0.3.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 +5 -2
- package/dist/tools/Button.d.ts +6 -4
- package/dist/tools/Button.js +5 -3
- package/dist/tools/Button.js.map +1 -1
- package/package.json +1 -1
- package/src/css/styles.css +7 -0
- package/src/css/theme.css +1 -0
- package/src/css/tokens.css +2 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ Components render on the server: no router, auth or API client, and no browser g
|
|
|
31
31
|
- Marks take `variant`: `auto` (the default: solid on light, reversed on dark), `solid` or `reversed`, and `gradient` on the lockup, which needs a white or very light ground. Mark usage is in [TRADEMARKS.md](TRADEMARKS.md).
|
|
32
32
|
- `LogoArrowMorph` is a pure function of `progress`, 0 the mark and 1 the arrow; whatever places it owns the timing. Keep it horizontal.
|
|
33
33
|
- `Nav`'s mobile menu is a checkbox and CSS, so it works without JS.
|
|
34
|
+
- `Button` takes `variant`: `primary` (the default; one per view), `secondary`, `text` or `danger`. A solid Garnet fill marks only a risky action: one that destroys, discards, revokes or cannot be undone. A vote, a filter or a choice between options is not risky.
|
|
34
35
|
- `Button` and `Notice` follow the guidelines' illustrated Actions and Callout patterns. Those patterns do not bind yet: the guidelines have yet to state their shape.
|
|
35
36
|
- Theme: inline `themeScript` in `<head>` so a stored override is on `<html>` before first paint. `useTheme` and `ThemeToggle` read and set it: `system` (the OS), `light` or `dark`.
|
|
36
37
|
|
|
@@ -45,6 +46,7 @@ import { Header, Nav, Button, themeScript } from '@metacensus/library-ui'
|
|
|
45
46
|
<Nav slot="nav" links={[{ href: '/research', label: 'Research' }]} />
|
|
46
47
|
<Button slot="actions" href="/join">Join</Button>
|
|
47
48
|
</Header>
|
|
49
|
+
<Button variant="danger">Delete account</Button>
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
In `.astro` files, pass `Header`'s `nav` and `actions` as named slots; JSX props there fail the build.
|
|
@@ -91,13 +93,14 @@ A step is `--mc-<family>-<step>`, as `--mc-purple-bold`. `--mc-white` and `--mc-
|
|
|
91
93
|
| `--mc-line-accent` | purple mid | purple mid |
|
|
92
94
|
| `--mc-fill-solid` | purple bold | purple bold |
|
|
93
95
|
| `--mc-fill-emphasis` | purple tint | purple bold into the ground |
|
|
94
|
-
| `--mc-action` |
|
|
96
|
+
| `--mc-action` | purple bold | purple bold |
|
|
97
|
+
| `--mc-action-risk` | red bold | red bold |
|
|
95
98
|
| `--mc-alert-fill` | red tint | red bold into the ground |
|
|
96
99
|
| `--mc-alert-ink` | red bold | red mid |
|
|
97
100
|
| `--mc-alert-border` | red bold | red bold |
|
|
98
101
|
| `--mc-signal` | red mid | red mid |
|
|
99
102
|
|
|
100
|
-
`--mc-fill-solid`
|
|
103
|
+
`--mc-fill-solid`, `--mc-action` and `--mc-action-risk` sit under white text. `--mc-signal` is Coral: one use per surface, never in the logo, headings, chrome or an action. On dark, `--mc-alert-ink` and `--mc-tint-red-ink` resolve to Coral too, but are not the signal.
|
|
101
104
|
|
|
102
105
|
### Tint fills
|
|
103
106
|
|
package/dist/tools/Button.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
2
|
type Own = {
|
|
3
|
-
variant?: 'primary' | 'secondary' | 'text';
|
|
3
|
+
variant?: 'primary' | 'secondary' | 'text' | 'danger';
|
|
4
4
|
};
|
|
5
5
|
type ButtonProps = Own & (({
|
|
6
6
|
href?: undefined;
|
|
7
7
|
} & ButtonHTMLAttributes<HTMLButtonElement>) | ({
|
|
8
8
|
href: string;
|
|
9
9
|
} & AnchorHTMLAttributes<HTMLAnchorElement>));
|
|
10
|
-
/** An action:
|
|
11
|
-
* secondary, bare text for the third. One primary per view.
|
|
12
|
-
*
|
|
10
|
+
/** An action: Royal Purple solid for the primary, a Charcoal outline for the
|
|
11
|
+
* secondary, bare text for the third. One primary per view. A solid Garnet
|
|
12
|
+
* fill, `danger`, marks only a risky action: one that destroys, discards,
|
|
13
|
+
* revokes or cannot be undone. With an `href` it renders a link. The
|
|
14
|
+
* guidelines' Actions pattern does not bind yet. */
|
|
13
15
|
export declare function Button({ variant, className, ...props }: ButtonProps): import("react").JSX.Element;
|
|
14
16
|
export {};
|
package/dist/tools/Button.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from './cn.js';
|
|
3
|
-
/** An action:
|
|
4
|
-
* secondary, bare text for the third. One primary per view.
|
|
5
|
-
*
|
|
3
|
+
/** An action: Royal Purple solid for the primary, a Charcoal outline for the
|
|
4
|
+
* secondary, bare text for the third. One primary per view. A solid Garnet
|
|
5
|
+
* fill, `danger`, marks only a risky action: one that destroys, discards,
|
|
6
|
+
* revokes or cannot be undone. With an `href` it renders a link. The
|
|
7
|
+
* guidelines' Actions pattern does not bind yet. */
|
|
6
8
|
export function Button({ variant = 'primary', className, ...props }) {
|
|
7
9
|
const classes = cn('mc-button', `mc-button-${variant}`, className);
|
|
8
10
|
if (props.href !== undefined)
|
package/dist/tools/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/tools/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAU5B
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/tools/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAU5B;;;;qDAIqD;AACrD,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,GAAG,SAAS,EACnB,SAAS,EACT,GAAG,KAAK,EACI;IACZ,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,EAAE,aAAa,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IAClE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,YAAG,SAAS,EAAE,OAAO,KAAM,KAAK,GAAI,CAAA;IACzE,OAAO,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,OAAO,KAAM,KAAK,GAAI,CAAA;AAChE,CAAC"}
|
package/package.json
CHANGED
package/src/css/styles.css
CHANGED
|
@@ -175,6 +175,13 @@
|
|
|
175
175
|
.mc-button-primary:hover:not(:disabled) {
|
|
176
176
|
background: color-mix(in srgb, var(--mc-action) 85%, black);
|
|
177
177
|
}
|
|
178
|
+
.mc-button-danger {
|
|
179
|
+
background: var(--mc-action-risk);
|
|
180
|
+
color: var(--mc-white);
|
|
181
|
+
}
|
|
182
|
+
.mc-button-danger:hover:not(:disabled) {
|
|
183
|
+
background: color-mix(in srgb, var(--mc-action-risk) 85%, black);
|
|
184
|
+
}
|
|
178
185
|
.mc-button-secondary {
|
|
179
186
|
border-color: var(--mc-ink);
|
|
180
187
|
background: transparent;
|
package/src/css/theme.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
--color-mc-fill-solid: var(--mc-fill-solid);
|
|
13
13
|
--color-mc-fill-emphasis: var(--mc-fill-emphasis);
|
|
14
14
|
--color-mc-action: var(--mc-action);
|
|
15
|
+
--color-mc-action-risk: var(--mc-action-risk);
|
|
15
16
|
--color-mc-alert-fill: var(--mc-alert-fill);
|
|
16
17
|
--color-mc-alert-ink: var(--mc-alert-ink);
|
|
17
18
|
--color-mc-alert-border: var(--mc-alert-border);
|
package/src/css/tokens.css
CHANGED
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
var(--mc-purple-tint),
|
|
49
49
|
color-mix(in srgb, var(--mc-purple-bold) 60%, var(--mc-ground))
|
|
50
50
|
);
|
|
51
|
-
--mc-action: var(--mc-
|
|
51
|
+
--mc-action: var(--mc-purple-bold);
|
|
52
|
+
--mc-action-risk: var(--mc-red-bold);
|
|
52
53
|
--mc-alert-fill: light-dark(
|
|
53
54
|
var(--mc-red-tint),
|
|
54
55
|
color-mix(in srgb, var(--mc-red-bold) 40%, var(--mc-ground))
|