@newtone-dev/ui-react-web 0.34.0 → 0.35.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/dist/action/action.css +29 -1
- package/dist/action/action.d.ts +44 -19
- package/dist/action/action.d.ts.map +1 -1
- package/dist/action/action.js +10 -8
- package/dist/action/action.js.map +1 -1
- package/package.json +1 -1
package/dist/action/action.css
CHANGED
|
@@ -77,7 +77,9 @@
|
|
|
77
77
|
/* PUBLISHED, NEVER DECLARED -- issues/open/156. `sm` comes to 48, which is Button's `lg`, and a
|
|
78
78
|
* row holding one of each can now read both instead of a consumer tuning one until it matches.
|
|
79
79
|
* Read it; writing it changes no geometry, because the box is the padding. */
|
|
80
|
-
--newtone-action-height: calc(
|
|
80
|
+
--newtone-action-height: calc(
|
|
81
|
+
var(--newtone-action-text-leading) + 2 * var(--newtone-action-pad-y)
|
|
82
|
+
);
|
|
81
83
|
|
|
82
84
|
border: 1px solid;
|
|
83
85
|
border-radius: var(--newtone-action-radius);
|
|
@@ -143,3 +145,29 @@
|
|
|
143
145
|
display: flex;
|
|
144
146
|
inline-size: 100%;
|
|
145
147
|
}
|
|
148
|
+
|
|
149
|
+
/* ---- the secondary tier: a glyph in a circle, from 2026-10-10 --------------
|
|
150
|
+
*
|
|
151
|
+
* Square at the rung's height, so `999px` draws a circle: the inline size is the published height,
|
|
152
|
+
* and the padding is the block padding on all four sides, a lone glyph at the box's own clearance,
|
|
153
|
+
* which is `Control`'s rule. No word, no fill, an ink outline: it stands beside the ask at the ask's
|
|
154
|
+
* height and cannot become a second one. components/action.md, *The secondary tier*.
|
|
155
|
+
*
|
|
156
|
+
* IT READS THE ROLES AND HAS NO SLICE -- DECISIONS/2026-10-09-a-component-reads-the-roles-and-a-
|
|
157
|
+
* slice-is-earned.md. With no fill, its ink sits on the page's ground, which is what
|
|
158
|
+
* `role.text.primary` is for. Pressed equals hover because no role holds a darker step; a call site
|
|
159
|
+
* that needs to see it pressed is the trigger for a slice. */
|
|
160
|
+
.newtone-action--secondary {
|
|
161
|
+
inline-size: var(--newtone-action-height);
|
|
162
|
+
padding: calc(var(--newtone-action-pad-y) - 1px);
|
|
163
|
+
background: none;
|
|
164
|
+
color: var(--newtone-role-text-primary);
|
|
165
|
+
border-color: currentColor;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.newtone-action--secondary:hover,
|
|
169
|
+
.newtone-action--secondary:active {
|
|
170
|
+
background: var(--newtone-role-surface-secondary);
|
|
171
|
+
color: var(--newtone-role-text-primary);
|
|
172
|
+
border-color: currentColor;
|
|
173
|
+
}
|
package/dist/action/action.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
|
3
3
|
* Two rungs of the ladder's five: **48 and 56**, the top of it.
|
|
4
4
|
*
|
|
5
5
|
* AN ACTION IS ABOVE A BUTTON AT BOTH, which is the whole of what this component is -- *a pill,
|
|
6
|
-
* larger than a Button*,
|
|
6
|
+
* larger than a Button*, asking for one thing; its `secondary` tier is a glyph with no word.
|
|
7
7
|
* contracts/button.md, *Sizes*.
|
|
8
8
|
*
|
|
9
9
|
* `sm` IS 48, WHICH IS ALSO BUTTON'S `lg`, ON PURPOSE. adenario_website's hero holds one of each
|
|
@@ -11,7 +11,28 @@ import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
|
11
11
|
* issues/open/156. They now agree because both name a rung, and both publish their height.
|
|
12
12
|
*/
|
|
13
13
|
export type ActionSize = 'sm' | 'lg';
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `primary`, the pill with words, is the ask. `secondary`, from 2026-10-10, is a circle with one
|
|
16
|
+
* glyph and no word, so it can sit beside the ask without becoming a second one.
|
|
17
|
+
* components/action.md, *The secondary tier*.
|
|
18
|
+
*/
|
|
19
|
+
export type ActionVariant = 'primary' | 'secondary';
|
|
20
|
+
interface ActionShared {
|
|
21
|
+
/**
|
|
22
|
+
* Which rung: 48 or 56. Defaults to `lg`, which is 56 -- where the one existing call site
|
|
23
|
+
* already was, so nothing on any page moves by more than half a pixel.
|
|
24
|
+
*
|
|
25
|
+
* **The label moves a lot even though the box does not.** It was `typography.size.lg` on a
|
|
26
|
+
* ratio -- 18/21.6 -- and is now the 16/24 step at both rungs. A reader sees that and not the
|
|
27
|
+
* 0.4px the box gained.
|
|
28
|
+
*/
|
|
29
|
+
size?: ActionSize;
|
|
30
|
+
/** Stretch to the container's inline size -- a phone's call to action, a card's footer. */
|
|
31
|
+
fill?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The ask: a pill with words. */
|
|
34
|
+
interface ActionPrimary extends ActionShared {
|
|
35
|
+
variant?: 'primary';
|
|
15
36
|
/** The action's words. Required and always rendered -- an action is a specific, named ask. */
|
|
16
37
|
label: string;
|
|
17
38
|
/** Overrides the accessible name where the visible words are not the whole of it. */
|
|
@@ -25,19 +46,22 @@ interface ActionCommon {
|
|
|
25
46
|
* `action.css` and governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md.
|
|
26
47
|
*/
|
|
27
48
|
iconEnd?: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
icon?: undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Beside the ask: one glyph in a circle, no word. **No words is what keeps it from being a second
|
|
53
|
+
* ask**, so the type refuses `label`, and requires the name the missing words would have carried.
|
|
54
|
+
*/
|
|
55
|
+
interface ActionSecondary extends ActionShared {
|
|
56
|
+
variant: 'secondary';
|
|
57
|
+
/** The glyph, by name. Sized by the rung, 24 at both. */
|
|
58
|
+
icon: string;
|
|
59
|
+
/** Its accessible name, required because nothing visible names it. */
|
|
60
|
+
ariaLabel: string;
|
|
61
|
+
label?: undefined;
|
|
62
|
+
iconEnd?: undefined;
|
|
39
63
|
}
|
|
40
|
-
export type ActionProps =
|
|
64
|
+
export type ActionProps = (ActionPrimary | ActionSecondary) & ((Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
41
65
|
href?: undefined;
|
|
42
66
|
}) | (Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href' | 'aria-label'> & {
|
|
43
67
|
/** Where it goes. Its presence turns the rendered element into an `<a>`. */
|
|
@@ -46,12 +70,13 @@ export type ActionProps = ActionCommon & ((Omit<ButtonHTMLAttributes<HTMLButtonE
|
|
|
46
70
|
/**
|
|
47
71
|
* The one thing a page is asking for.
|
|
48
72
|
*
|
|
49
|
-
* ---- it
|
|
73
|
+
* ---- it asks for one thing, and its second tier cannot ask ---------------
|
|
50
74
|
*
|
|
51
75
|
* A `Button` offers three tiers because a page has many buttons and they need an order. This offers
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
76
|
+
* one ask, because **a second action would mean neither is the action**. `variant="secondary"`, from
|
|
77
|
+
* 2026-10-10, is a glyph in an unfilled circle with no word, so it stands beside the ask at the
|
|
78
|
+
* ask's height without competing with it. A worded companion is still an ordinary `Button`, which is
|
|
79
|
+
* what `adenario_website`'s hero does with its two doors. components/action.md.
|
|
55
80
|
*
|
|
56
81
|
* ---- what makes it reserved is shape, not hue -----------------------------
|
|
57
82
|
*
|
|
@@ -78,6 +103,6 @@ export type ActionProps = ActionCommon & ((Omit<ButtonHTMLAttributes<HTMLButtonE
|
|
|
78
103
|
* does nothing, which is an honest placeholder and not a form control: `type="button"` is
|
|
79
104
|
* hardcoded, so it cannot submit a form it happens to be standing in.
|
|
80
105
|
*/
|
|
81
|
-
export declare function Action({ label, ariaLabel, iconEnd, size, fill, className, ...rest }: ActionProps): import("react").JSX.Element;
|
|
106
|
+
export declare function Action({ variant, label, icon, ariaLabel, iconEnd, size, fill, className, ...rest }: ActionProps): import("react").JSX.Element;
|
|
82
107
|
export {};
|
|
83
108
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAGvE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAGvE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,CAAA;AAgBnD,UAAU,YAAY;IAClB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,kCAAkC;AAClC,UAAU,aAAc,SAAQ,YAAY;IACxC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB;AAED;;;GAGG;AACH,UAAU,eAAgB,SAAQ,YAAY;IAC1C,OAAO,EAAE,WAAW,CAAA;IACpB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,aAAa,GAAG,eAAe,CAAC,GACvD,CACM,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG;IACxE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACF,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IACjF,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CACP,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,MAAM,CAAC,EACnB,OAAmB,EACnB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAW,EACX,IAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EAAE,WAAW,+BAiDb"}
|
package/dist/action/action.js
CHANGED
|
@@ -16,12 +16,13 @@ const GLYPH = { sm: 'md', lg: 'md' };
|
|
|
16
16
|
/**
|
|
17
17
|
* The one thing a page is asking for.
|
|
18
18
|
*
|
|
19
|
-
* ---- it
|
|
19
|
+
* ---- it asks for one thing, and its second tier cannot ask ---------------
|
|
20
20
|
*
|
|
21
21
|
* A `Button` offers three tiers because a page has many buttons and they need an order. This offers
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* one ask, because **a second action would mean neither is the action**. `variant="secondary"`, from
|
|
23
|
+
* 2026-10-10, is a glyph in an unfilled circle with no word, so it stands beside the ask at the
|
|
24
|
+
* ask's height without competing with it. A worded companion is still an ordinary `Button`, which is
|
|
25
|
+
* what `adenario_website`'s hero does with its two doors. components/action.md.
|
|
25
26
|
*
|
|
26
27
|
* ---- what makes it reserved is shape, not hue -----------------------------
|
|
27
28
|
*
|
|
@@ -48,22 +49,23 @@ const GLYPH = { sm: 'md', lg: 'md' };
|
|
|
48
49
|
* does nothing, which is an honest placeholder and not a form control: `type="button"` is
|
|
49
50
|
* hardcoded, so it cannot submit a form it happens to be standing in.
|
|
50
51
|
*/
|
|
51
|
-
export function Action({ label, ariaLabel, iconEnd, size = 'lg', fill = false, className, ...rest }) {
|
|
52
|
+
export function Action({ variant = 'primary', label, icon, ariaLabel, iconEnd, size = 'lg', fill = false, className, ...rest }) {
|
|
52
53
|
// `--icon-end` is keyed on the glyph being PRESENT and not on the prop being declared, because
|
|
53
54
|
// the class does one thing -- take a gap off the padding on the glyph's side -- and a pill with
|
|
54
55
|
// no glyph in it would be 16px short on one side for nothing. See action.css.
|
|
55
56
|
const classes = [
|
|
56
57
|
'newtone-action',
|
|
57
58
|
`newtone-action--${size}`,
|
|
59
|
+
variant === 'secondary' ? 'newtone-action--secondary' : null,
|
|
58
60
|
iconEnd === undefined ? null : 'newtone-action--icon-end',
|
|
59
61
|
fill ? 'newtone-action--fill' : null,
|
|
60
62
|
className,
|
|
61
63
|
]
|
|
62
64
|
.filter(Boolean)
|
|
63
65
|
.join(' ');
|
|
64
|
-
//
|
|
65
|
-
// `Icon` writes its own `aria-hidden`.
|
|
66
|
-
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "newtone-action-label", children: label }), iconEnd === undefined ? null : _jsx(Icon, { name: iconEnd, size: GLYPH[size] })] }));
|
|
66
|
+
// A primary's label is always present, so it always has a name and the glyph is decorative. A
|
|
67
|
+
// secondary's name is its required `ariaLabel`. `Icon` writes its own `aria-hidden`.
|
|
68
|
+
const content = variant === 'secondary' ? (_jsx(Icon, { name: icon, size: GLYPH[size] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "newtone-action-label", children: label }), iconEnd === undefined ? null : _jsx(Icon, { name: iconEnd, size: GLYPH[size] })] }));
|
|
67
69
|
if (rest.href !== undefined) {
|
|
68
70
|
const { href, ...anchor } = rest;
|
|
69
71
|
return (_jsx("a", { href: href, className: classes, "aria-label": ariaLabel, ...anchor, children: content }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,kBAAkB,CAAA;AAsBtD;;;;;;;;;;;GAWG;AACH,MAAM,KAAK,GAAiC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AA4DlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,MAAM,CAAC,EACnB,OAAO,GAAG,SAAS,EACnB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,GAAG,IAAI,EACX,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,GAAG,IAAI,EACG;IACV,+FAA+F;IAC/F,gGAAgG;IAChG,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACZ,gBAAgB;QAChB,mBAAmB,IAAI,EAAE;QACzB,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI;QAC5D,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B;QACzD,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;QACpC,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,8FAA8F;IAC9F,qFAAqF;IACrF,MAAM,OAAO,GACT,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,CACtB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAc,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAI,CACpD,CAAC,CAAC,CAAC,CACA,8BACI,eAAM,SAAS,EAAC,sBAAsB,YAAE,KAAK,GAAQ,EACpD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAI,IAC3E,CACN,CAAA;IAEL,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,IAG3B,CAAA;QACD,OAAO,CACH,YAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,gBAAc,SAAS,KAAM,MAAM,YAC/D,OAAO,GACR,CACP,CAAA;IACL,CAAC;IAED,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,gBACN,SAAS,KAChB,IAAgD,YAEpD,OAAO,GACH,CACZ,CAAA;AACL,CAAC"}
|