@newtone-dev/ui-react-web 0.32.1 → 0.33.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/button/button.css
CHANGED
|
@@ -113,6 +113,11 @@
|
|
|
113
113
|
padding-inline-end: calc(var(--newtone-button-pad-y) - 1px);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/* THE MIRROR, for a leading glyph that points back (react-web 0.33.0). Same expression, other side. */
|
|
117
|
+
.newtone-button--icon-start {
|
|
118
|
+
padding-inline-start: calc(var(--newtone-button-pad-y) - 1px);
|
|
119
|
+
}
|
|
120
|
+
|
|
116
121
|
/* :focus-visible, not :focus -- the contract is explicit, and focus is not optional.
|
|
117
122
|
The ring is per variant: it sits against that variant's own fill, and area decides
|
|
118
123
|
how much contrast it needs. */
|
package/dist/button/button.d.ts
CHANGED
|
@@ -28,15 +28,24 @@ interface ButtonCommon {
|
|
|
28
28
|
size?: ButtonSize;
|
|
29
29
|
/** The `label` slot. Required. */
|
|
30
30
|
children: ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* A trailing glyph, by name. There is no leading slot: a glyph on a button points ONWARD, at
|
|
33
|
-
* what pressing it leads to -- `Action`'s spelling and its reason. **Its presence takes one gap
|
|
34
|
-
* off the padding on its own side**, so the glyph sits `padding-block` from the rim and the word
|
|
35
|
-
* `padding-block + gap`. Sized by the rung. Since 2026-10-01, react-web 0.22.0;
|
|
36
|
-
* contracts/button.md, *Slots*, and governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md.
|
|
37
|
-
*/
|
|
38
|
-
iconEnd?: string;
|
|
39
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* At most one glyph, on the side it points to. `iconEnd` points onward, at what pressing leads to;
|
|
34
|
+
* `iconStart` (react-web 0.33.0) points back, so it goes before the word. **The union refuses both
|
|
35
|
+
* together**: two glyphs would make the label one item in a row of three. Either one takes one gap
|
|
36
|
+
* off the padding on its own side, so the glyph sits `padding-block` from the rim and the word
|
|
37
|
+
* `padding-block + gap`. Sized by the rung. contracts/button.md, *Slots*, and
|
|
38
|
+
* governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md.
|
|
39
|
+
*/
|
|
40
|
+
type ButtonGlyph = {
|
|
41
|
+
/** A trailing glyph, by name, pointing onward. Since 2026-10-01, react-web 0.22.0. */
|
|
42
|
+
iconEnd?: string;
|
|
43
|
+
iconStart?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
/** A leading glyph, by name, pointing back. Since 2026-10-09, react-web 0.33.0. */
|
|
46
|
+
iconStart?: string;
|
|
47
|
+
iconEnd?: undefined;
|
|
48
|
+
};
|
|
40
49
|
/**
|
|
41
50
|
* The two halves of the contract's **Action / Destination** pair, typed so that exactly one can be
|
|
42
51
|
* present. A caller that passes `href` gets an anchor's attributes and no `type` or `onClick`; a
|
|
@@ -44,10 +53,10 @@ interface ButtonCommon {
|
|
|
44
53
|
* contract states in prose**, and it is the reason this is one component rather than two: the
|
|
45
54
|
* paint, the variants and the tokens do not move, and `href` is the only thing that does.
|
|
46
55
|
*/
|
|
47
|
-
export type ButtonProps = (ButtonCommon & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
56
|
+
export type ButtonProps = (ButtonCommon & ButtonGlyph & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
48
57
|
/** Absent on this arm. A Button with no destination is a button. */
|
|
49
58
|
href?: undefined;
|
|
50
|
-
}) | (ButtonCommon & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href'> & {
|
|
59
|
+
}) | (ButtonCommon & ButtonGlyph & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href'> & {
|
|
51
60
|
/**
|
|
52
61
|
* Where pressing it goes. Its presence turns the rendered element into an `<a>` --
|
|
53
62
|
* see contracts/button.md, *Destination*. Nothing else about the component changes.
|
|
@@ -62,6 +71,6 @@ export type ButtonProps = (ButtonCommon & Omit<ButtonHTMLAttributes<HTMLButtonEl
|
|
|
62
71
|
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
63
72
|
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
64
73
|
*/
|
|
65
|
-
export declare function Button({ variant, size, children, iconEnd, className, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
74
|
+
export declare function Button({ variant, size, children, iconStart, iconEnd, className, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
66
75
|
export {};
|
|
67
76
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGlF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAK3C,UAAU,YAAY;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,kCAAkC;IAClC,QAAQ,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGlF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAK3C,UAAU,YAAY;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,kCAAkC;IAClC,QAAQ,EAAE,SAAS,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,KAAK,WAAW,GACV;IACI,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,SAAS,CAAA;CACxB,GACD;IACI,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAEP;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACjB,CAAC,YAAY,GACT,WAAW,GACX,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,GAAG;IACxD,oEAAoE;IACpE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACN,CAAC,YAAY,GACT,WAAW,GACX,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IACjE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEZ;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACnB,OAAmB,EACnB,IAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACV,EAAE,WAAW,+BAwDb"}
|
package/dist/button/button.js
CHANGED
|
@@ -10,7 +10,7 @@ const GLYPH = { sm: 'sm', md: 'sm', lg: 'md' };
|
|
|
10
10
|
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
11
11
|
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
12
12
|
*/
|
|
13
|
-
export function Button({ variant = 'primary', size = 'md', children, iconEnd, className, ...rest }) {
|
|
13
|
+
export function Button({ variant = 'primary', size = 'md', children, iconStart, iconEnd, className, ...rest }) {
|
|
14
14
|
// One class list, both arms. The whole of the destination change is which element wears it --
|
|
15
15
|
// no token moves, no variant is added, and `button.*` stays the only group this file reads.
|
|
16
16
|
//
|
|
@@ -23,14 +23,15 @@ export function Button({ variant = 'primary', size = 'md', children, iconEnd, cl
|
|
|
23
23
|
`newtone-button--${variant}`,
|
|
24
24
|
`newtone-button--${size}`,
|
|
25
25
|
// Keyed on the glyph being PRESENT, as `Action`'s is: a button with no glyph keeps both sides.
|
|
26
|
+
iconStart === undefined ? null : 'newtone-button--icon-start',
|
|
26
27
|
iconEnd === undefined ? null : 'newtone-button--icon-end',
|
|
27
28
|
className,
|
|
28
29
|
]
|
|
29
30
|
.filter(Boolean)
|
|
30
31
|
.join(' ');
|
|
31
|
-
// With a glyph the label is wrapped, so the glyph is the one element
|
|
32
|
+
// With a glyph the label is wrapped, so the glyph is the one element beside it. `Icon` writes its
|
|
32
33
|
// own `aria-hidden`, so the button's name is still the label.
|
|
33
|
-
const content = iconEnd === undefined ? (children) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "newtone-button-label", children: children }), _jsx(Icon, { name: iconEnd, size: GLYPH[size] })] }));
|
|
34
|
+
const content = iconStart === undefined && iconEnd === undefined ? (children) : (_jsxs(_Fragment, { children: [iconStart !== undefined && _jsx(Icon, { name: iconStart, size: GLYPH[size] }), _jsx("span", { className: "newtone-button-label", children: children }), iconEnd !== undefined && _jsx(Icon, { name: iconEnd, size: GLYPH[size] })] }));
|
|
34
35
|
if (rest.href !== undefined) {
|
|
35
36
|
const { href, ...anchor } = rest;
|
|
36
37
|
return (_jsx("a", { href: href, className: classes, ...anchor, children: content }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,kBAAkB,CAAA;AAkBtD,iGAAiG;AACjG,MAAM,KAAK,GAAiC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EA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