@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 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` | red bold | red bold |
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` sits 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.
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
 
@@ -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: Garnet solid for the primary, a Charcoal outline for the
11
- * secondary, bare text for the third. One primary per view. With an `href` it
12
- * renders a link. The guidelines' Actions pattern does not bind yet. */
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 {};
@@ -1,8 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from './cn.js';
3
- /** An action: Garnet solid for the primary, a Charcoal outline for the
4
- * secondary, bare text for the third. One primary per view. With an `href` it
5
- * renders a link. The guidelines' Actions pattern does not bind yet. */
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)
@@ -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;;yEAEyE;AACzE,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"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metacensus/library-ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "MetaCensus brand layer and UI tools for React.",
5
5
  "license": "AGPL-3.0-only AND LicenseRef-MetaCensus-Marks",
6
6
  "repository": {
@@ -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);
@@ -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-red-bold);
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))