@newtone-dev/ui-react-web 0.20.0 → 0.22.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/avatar/avatar.d.ts +5 -1
- package/dist/avatar/avatar.d.ts.map +1 -1
- package/dist/avatar/avatar.js +7 -0
- package/dist/avatar/avatar.js.map +1 -1
- package/dist/button/button.css +11 -1
- package/dist/button/button.d.ts +10 -2
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +12 -4
- package/dist/button/button.js.map +1 -1
- package/package.json +1 -1
package/dist/avatar/avatar.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ImgHTMLAttributes } from 'react';
|
|
2
2
|
export interface AvatarProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'alt'> {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Omitted, the avatar is its plate alone: no picture, no initials, no icon. For a person whose
|
|
5
|
+
* photograph has not arrived. Since 2026-10-01, react-web 0.21.0; avatar.md.
|
|
6
|
+
*/
|
|
7
|
+
src?: string;
|
|
4
8
|
/**
|
|
5
9
|
* Required, and by the type rather than by a runtime check -- the same strictness `Link` puts
|
|
6
10
|
* on `href`. A face with no name is the one thing this component must not let through, and an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE7D,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACjF,GAAG,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE7D,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACjF;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAmE1F"}
|
package/dist/avatar/avatar.js
CHANGED
|
@@ -33,6 +33,13 @@ export function Avatar({ src, alt, size, hoverSrc, className, style, ...rest })
|
|
|
33
33
|
// The diameter, written here since 2026-09-26 rather than declared by the caller's sheet: a
|
|
34
34
|
// consuming site declares no `--newtone-*` property (issue 201).
|
|
35
35
|
const sized = size === undefined ? style : { '--newtone-avatar-size': size, ...style };
|
|
36
|
+
// NO PICTURE IS A SPAN AND NOT AN `<img>` WITHOUT A SOURCE: each engine draws a sourceless
|
|
37
|
+
// `<img>` its own way -- an empty box, a broken-image glyph, nothing -- and none of them is the
|
|
38
|
+
// plate. `alt` keeps its meaning: a name makes the span an image named by it, and `""` hides it.
|
|
39
|
+
// `hoverSrc` has no rest picture to swap from, so it is ignored. avatar.md, *the plate alone*.
|
|
40
|
+
if (src === undefined) {
|
|
41
|
+
return (_jsx("span", { className: ['newtone-avatar', className].filter(Boolean).join(' '), style: sized, role: alt ? 'img' : undefined, "aria-label": alt || undefined, "aria-hidden": alt ? undefined : true }));
|
|
42
|
+
}
|
|
36
43
|
// TWO PICTURES ARE A SPAN, AND ONE IS STILL THE `<img>`, so every call site without `hoverSrc`
|
|
37
44
|
// renders exactly what it did. The plate moves to the span so it sits behind both; the caller's
|
|
38
45
|
// attributes stay on the rest picture, which is the one that carries the name. The hover picture
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":";AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAe;IACvF,4FAA4F;IAC5F,iEAAiE;IACjE,MAAM,KAAK,GACP,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,KAAK,EAAoB,CAAA;IAE/F,2FAA2F;IAC3F,gGAAgG;IAChG,iGAAiG;IACjG,+FAA+F;IAC/F,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,OAAO,CACH,eACI,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAClE,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBACjB,GAAG,IAAI,SAAS,iBACf,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GACrC,CACL,CAAA;IACL,CAAC;IAED,+FAA+F;IAC/F,gGAAgG;IAChG,iGAAiG;IACjG,8FAA8F;IAC9F,+EAA+E;IAC/E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,CACH,gBACI,SAAS,EAAE,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,SAAS,CAAC;iBAC3D,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,KAAK,aAEZ,cACI,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAC,sBAAsB,KAC5B,IAAI,GACV,EACF,cACI,GAAG,EAAE,QAAQ,EACb,GAAG,EAAC,EAAE,EACN,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,GACrB,IACC,CACV,CAAA;IACL,CAAC;IAED,OAAO,CACH,cACI,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAClE,mFAAmF;QACnF,iFAAiF;QACjF,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,KAAK,EAAE,KAAK,KACR,IAAI,GACV,CACL,CAAA;AACL,CAAC"}
|
package/dist/button/button.css
CHANGED
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
keeping them level. A row can now read both and compare them.
|
|
53
53
|
|
|
54
54
|
READ IT; DO NOT WRITE IT. Setting this changes no geometry -- the box is the padding. */
|
|
55
|
-
--newtone-button-height: calc(
|
|
55
|
+
--newtone-button-height: calc(
|
|
56
|
+
var(--newtone-button-text-leading) + 2 * var(--newtone-button-pad-y)
|
|
57
|
+
);
|
|
56
58
|
|
|
57
59
|
border: 1px solid;
|
|
58
60
|
border-radius: var(--newtone-button-radius);
|
|
@@ -103,6 +105,14 @@
|
|
|
103
105
|
--newtone-button-text-leading: var(--newtone-button-size-lg-label-line-height);
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
/* WITH A TRAILING GLYPH THE GLYPH'S SIDE IS THE RUNG'S BLOCK PADDING, and the word's side keeps
|
|
109
|
+
* `pad-y + gap`. One rule for every rung because it reads the rung's own variable, and it is
|
|
110
|
+
* `Action`'s `--icon-end` with this component's name in it. contracts/button.md, *Slots*;
|
|
111
|
+
* governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md. */
|
|
112
|
+
.newtone-button--icon-end {
|
|
113
|
+
padding-inline-end: calc(var(--newtone-button-pad-y) - 1px);
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
/* :focus-visible, not :focus -- the contract is explicit, and focus is not optional.
|
|
107
117
|
The ring is per variant: it sits against that variant's own fill, and area decides
|
|
108
118
|
how much contrast it needs. */
|
package/dist/button/button.d.ts
CHANGED
|
@@ -26,8 +26,16 @@ interface ButtonCommon {
|
|
|
26
26
|
* side effect.
|
|
27
27
|
*/
|
|
28
28
|
size?: ButtonSize;
|
|
29
|
-
/** The `label` slot. Required
|
|
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;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* The two halves of the contract's **Action / Destination** pair, typed so that exactly one can be
|
|
@@ -54,6 +62,6 @@ export type ButtonProps = (ButtonCommon & Omit<ButtonHTMLAttributes<HTMLButtonEl
|
|
|
54
62
|
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
55
63
|
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
56
64
|
*/
|
|
57
|
-
export declare function Button({ variant, size, children, className, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
65
|
+
export declare function Button({ variant, size, children, iconEnd, className, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
58
66
|
export {};
|
|
59
67
|
//# 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;
|
|
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;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACjB,CAAC,YAAY,GACT,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,GAAG;IACxD,oEAAoE;IACpE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACN,CAAC,YAAY,GACT,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,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACV,EAAE,WAAW,+BAsDb"}
|
package/dist/button/button.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../icon/index.js';
|
|
3
|
+
// THE GLYPH IS THE RUNG'S, from contracts/button.md's *glyph* column: 20 at 40 and 44, 24 at 48.
|
|
4
|
+
const GLYPH = { sm: 'sm', md: 'sm', lg: 'md' };
|
|
2
5
|
/**
|
|
3
6
|
* Discharges blueprints/newtone/contracts/button.md.
|
|
4
7
|
*
|
|
@@ -7,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
10
|
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
8
11
|
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
9
12
|
*/
|
|
10
|
-
export function Button({ variant = 'primary', size = 'md', children, className, ...rest }) {
|
|
13
|
+
export function Button({ variant = 'primary', size = 'md', children, iconEnd, className, ...rest }) {
|
|
11
14
|
// One class list, both arms. The whole of the destination change is which element wears it --
|
|
12
15
|
// no token moves, no variant is added, and `button.*` stays the only group this file reads.
|
|
13
16
|
//
|
|
@@ -19,16 +22,21 @@ export function Button({ variant = 'primary', size = 'md', children, className,
|
|
|
19
22
|
'newtone-button',
|
|
20
23
|
`newtone-button--${variant}`,
|
|
21
24
|
`newtone-button--${size}`,
|
|
25
|
+
// Keyed on the glyph being PRESENT, as `Action`'s is: a button with no glyph keeps both sides.
|
|
26
|
+
iconEnd === undefined ? null : 'newtone-button--icon-end',
|
|
22
27
|
className,
|
|
23
28
|
]
|
|
24
29
|
.filter(Boolean)
|
|
25
30
|
.join(' ');
|
|
31
|
+
// With a glyph the label is wrapped, so the glyph is the one element after it. `Icon` writes its
|
|
32
|
+
// 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] })] }));
|
|
26
34
|
if (rest.href !== undefined) {
|
|
27
35
|
const { href, ...anchor } = rest;
|
|
28
|
-
return (_jsx("a", { href: href, className: classes, ...anchor, children:
|
|
36
|
+
return (_jsx("a", { href: href, className: classes, ...anchor, children: content }));
|
|
29
37
|
}
|
|
30
38
|
// `type="button"` stays FIRST so a caller inside a form can still say `submit` -- the contract
|
|
31
39
|
// defers `type` as a prop, and this is the spread already doing it rather than a new one.
|
|
32
|
-
return (_jsx("button", { type: "button", className: classes, ...rest, children:
|
|
40
|
+
return (_jsx("button", { type: "button", className: classes, ...rest, children: content }));
|
|
33
41
|
}
|
|
34
42
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";
|
|
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,EAAE,EAAE,IAAI,EAAE,CAAA;AAiD5E;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,EACnB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACG;IACV,8FAA8F;IAC9F,4FAA4F;IAC5F,EAAE;IACF,gGAAgG;IAChG,6FAA6F;IAC7F,8FAA8F;IAC9F,0DAA0D;IAC1D,MAAM,OAAO,GAAG;QACZ,gBAAgB;QAChB,mBAAmB,OAAO,EAAE;QAC5B,mBAAmB,IAAI,EAAE;QACzB,+FAA+F;QAC/F,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B;QACzD,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,iGAAiG;IACjG,8DAA8D;IAC9D,MAAM,OAAO,GACT,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACpB,QAAQ,CACX,CAAC,CAAC,CAAC,CACA,8BACI,eAAM,SAAS,EAAC,sBAAsB,YAAE,QAAQ,GAAQ,EACxD,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAI,IAC3C,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,KAAM,MAAM,YACxC,OAAO,GACR,CACP,CAAA;IACL,CAAC;IAED,+FAA+F;IAC/F,0FAA0F;IAC1F,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACb,IAAgD,YAEpD,OAAO,GACH,CACZ,CAAA;AACL,CAAC"}
|