@molecule/app-contact-display-react 3.0.0 → 4.0.1
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 +13 -6
- package/dist/ContactDisplay.d.ts +8 -2
- package/dist/ContactDisplay.d.ts.map +1 -1
- package/dist/ContactDisplay.js +20 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-11-16T21:24:37.524Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-contact-display-react
|
|
@@ -76,7 +76,13 @@ interface ContactDisplayProps {
|
|
|
76
76
|
layout?: 'card' | 'row' | 'compact'
|
|
77
77
|
/** Optional right-side actions. */
|
|
78
78
|
actions?: ReactNode
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Activates the contact: the whole row becomes clickable through a
|
|
81
|
+
* transparent native button covering it, named by the contact name (the
|
|
82
|
+
* name span), so Enter and Space activate it natively. The row's inner
|
|
83
|
+
* controls — the mail/tel links and the `actions` slot — sit above that
|
|
84
|
+
* button and keep their own clicks.
|
|
85
|
+
*/
|
|
80
86
|
onClick?: () => void
|
|
81
87
|
/** Extra classes. */
|
|
82
88
|
className?: string
|
|
@@ -109,9 +115,9 @@ function ContactDisplay({
|
|
|
109
115
|
|
|
110
116
|
Peer dependencies:
|
|
111
117
|
|
|
112
|
-
- `@molecule/app-react` ^
|
|
118
|
+
- `@molecule/app-react` ^4.0.0
|
|
113
119
|
- `@molecule/app-ui` ^1.0.1
|
|
114
|
-
- `@molecule/app-ui-react` ^
|
|
120
|
+
- `@molecule/app-ui-react` ^4.0.0
|
|
115
121
|
- `react` ^18.0.0 || ^19.0.0
|
|
116
122
|
|
|
117
123
|
### Runtime Dependencies
|
|
@@ -126,5 +132,6 @@ Peer dependencies:
|
|
|
126
132
|
address markers are text glyphs (✉ ☎ ⌂), not themed SVG icons. `role`,
|
|
127
133
|
`address`, and `company` accept ReactNodes — pass translated strings via
|
|
128
134
|
`t()` where needed. When `onClick` is provided the whole row becomes
|
|
129
|
-
clickable
|
|
130
|
-
|
|
135
|
+
clickable through a transparent native button covering it, named by the
|
|
136
|
+
contact name (the name span); the mail/tel links and the `actions` slot sit
|
|
137
|
+
above that button and keep their own clicks.
|
package/dist/ContactDisplay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type JSX, type ReactNode } from 'react';
|
|
2
2
|
/** Fields describing a contact rendered by ContactDisplay. */
|
|
3
3
|
export interface ContactFields {
|
|
4
4
|
name: string;
|
|
@@ -16,7 +16,13 @@ export interface ContactDisplayProps {
|
|
|
16
16
|
layout?: 'card' | 'row' | 'compact';
|
|
17
17
|
/** Optional right-side actions. */
|
|
18
18
|
actions?: ReactNode;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Activates the contact: the whole row becomes clickable through a
|
|
21
|
+
* transparent native button covering it, named by the contact name (the
|
|
22
|
+
* name span), so Enter and Space activate it natively. The row's inner
|
|
23
|
+
* controls — the mail/tel links and the `actions` slot — sit above that
|
|
24
|
+
* button and keep their own clicks.
|
|
25
|
+
*/
|
|
20
26
|
onClick?: () => void;
|
|
21
27
|
/** Extra classes. */
|
|
22
28
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactDisplay.d.ts","sourceRoot":"","sources":["../src/ContactDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ContactDisplay.d.ts","sourceRoot":"","sources":["../src/ContactDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAA;AAKvD,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,aAAa,CAAA;IACtB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;IACnC,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAe,EACf,OAAO,EACP,OAAO,EACP,SAAS,GACV,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAoFnC"}
|
package/dist/ContactDisplay.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
2
3
|
import { getClassMap } from '@molecule/app-ui';
|
|
3
4
|
import { Avatar } from '@molecule/app-ui-react';
|
|
4
5
|
/**
|
|
@@ -9,12 +10,29 @@ import { Avatar } from '@molecule/app-ui-react';
|
|
|
9
10
|
*/
|
|
10
11
|
export function ContactDisplay({ contact, layout = 'card', actions, onClick, className, }) {
|
|
11
12
|
const cm = getClassMap();
|
|
13
|
+
const nameId = useId();
|
|
12
14
|
const { name, email, phone, role, avatarSrc, address, company } = contact;
|
|
13
15
|
const isCompact = layout === 'compact';
|
|
14
16
|
const direction = layout === 'card' ? 'col' : 'row';
|
|
15
|
-
|
|
17
|
+
const nameClass = cm.cn(cm.textSize(isCompact ? 'sm' : 'base'), cm.fontWeight('semibold'));
|
|
18
|
+
// The row's open control: a transparent native button covering the row
|
|
19
|
+
// (Enter / Space activate it natively), named by the contact name. The
|
|
20
|
+
// first child of the root, and a sibling — not a wrapper — of the row's
|
|
21
|
+
// inner controls, so those stay reachable controls (a button's children
|
|
22
|
+
// are presentational).
|
|
23
|
+
const openButton = onClick ? (_jsx("button", { type: "button", "aria-labelledby": nameId, "data-mol-id": "contact-display-open", onClick: () => onClick(),
|
|
24
|
+
/* mol-bespoke-button: the whole row is the hit area, not a CTA — an empty,
|
|
25
|
+
transparent button over the row; the inline background/border/padding are
|
|
26
|
+
native resets. */
|
|
27
|
+
className: cm.cn(cm.position('absolute'), cm.inset0, cm.cursorPointer), style: { background: 'transparent', border: 'none', padding: '0' } })) : null;
|
|
28
|
+
// The mail/tel links are controls: when the open button covers the row,
|
|
29
|
+
// their line paints above it so a click on the link keeps its own action.
|
|
30
|
+
const raisedControlLineClass = onClick
|
|
31
|
+
? cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.textSize('sm'), cm.position('relative'))
|
|
32
|
+
: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.textSize('sm'));
|
|
33
|
+
return (_jsxs("div", { className: cm.cn(cm.flex({
|
|
16
34
|
align: layout === 'card' ? 'start' : 'center',
|
|
17
35
|
gap: isCompact ? 'sm' : 'md',
|
|
18
36
|
direction,
|
|
19
|
-
}), onClick ? cm.
|
|
37
|
+
}), onClick ? cm.position('relative') : undefined, className), children: [openButton, _jsx("div", { className: cm.shrink0, children: _jsx(Avatar, { src: avatarSrc, alt: name, name: name, size: isCompact ? 'sm' : 'md' }) }), _jsxs("div", { className: cm.cn(cm.flex1, cm.stack(1)), children: [_jsxs("div", { className: cm.flex({ align: 'baseline', gap: 'sm' }), children: [_jsx("span", { id: onClick ? nameId : undefined, className: nameClass, children: name }), role && _jsx("span", { className: cm.textSize('xs'), children: role })] }), company && _jsx("div", { className: cm.textSize('sm'), children: company }), !isCompact && email && (_jsxs("div", { className: raisedControlLineClass, children: [_jsx("span", { "aria-hidden": true, children: "\u2709" }), _jsx("a", { href: `mailto:${email}`, className: cm.link, children: email })] })), !isCompact && phone && (_jsxs("div", { className: raisedControlLineClass, children: [_jsx("span", { "aria-hidden": true, children: "\u260E" }), _jsx("a", { href: `tel:${phone}`, className: cm.link, children: phone })] })), !isCompact && address && (_jsxs("div", { className: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.textSize('sm')), children: [_jsx("span", { "aria-hidden": true, children: "\u2302" }), _jsx("span", { children: address })] }))] }), onClick && actions ? (_jsx("div", { className: cm.position('relative'), children: actions })) : ((actions ?? null))] }));
|
|
20
38
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
* address markers are text glyphs (✉ ☎ ⌂), not themed SVG icons. `role`,
|
|
27
27
|
* `address`, and `company` accept ReactNodes — pass translated strings via
|
|
28
28
|
* `t()` where needed. When `onClick` is provided the whole row becomes
|
|
29
|
-
* clickable
|
|
30
|
-
*
|
|
29
|
+
* clickable through a transparent native button covering it, named by the
|
|
30
|
+
* contact name (the name span); the mail/tel links and the `actions` slot sit
|
|
31
|
+
* above that button and keep their own clicks.
|
|
31
32
|
*
|
|
32
33
|
* @module
|
|
33
34
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
* address markers are text glyphs (✉ ☎ ⌂), not themed SVG icons. `role`,
|
|
27
27
|
* `address`, and `company` accept ReactNodes — pass translated strings via
|
|
28
28
|
* `t()` where needed. When `onClick` is provided the whole row becomes
|
|
29
|
-
* clickable
|
|
30
|
-
*
|
|
29
|
+
* clickable through a transparent native button covering it, named by the
|
|
30
|
+
* contact name (the name span); the mail/tel links and the `actions` slot sit
|
|
31
|
+
* above that button and keep their own clicks.
|
|
31
32
|
*
|
|
32
33
|
* @module
|
|
33
34
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-contact-display-react",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"description": "Contact info display row/card — name, role, email/phone as mailto:/tel: links with leading text glyphs",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-contact-display-react",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"directory": "packages/app/features/contact-display-react"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@molecule/app-react": "^
|
|
36
|
+
"@molecule/app-react": "^4.0.0",
|
|
37
37
|
"@molecule/app-ui": "^1.0.1",
|
|
38
|
-
"@molecule/app-ui-react": "^
|
|
38
|
+
"@molecule/app-ui-react": "^4.0.0",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@molecule/app-react": "
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
44
|
-
"@molecule/app-ui-react": "
|
|
42
|
+
"@molecule/app-react": "4.7.2",
|
|
43
|
+
"@molecule/app-ui": "1.4.0",
|
|
44
|
+
"@molecule/app-ui-react": "4.1.5",
|
|
45
45
|
"@types/node": "26.6.5",
|
|
46
46
|
"@types/react": "19.3.0",
|
|
47
47
|
"@types/react-dom": "19.3.0",
|