@molecule/app-presence-indicator-solid 1.1.0 → 1.1.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 +10 -4
- package/dist/PresenceDot.d.ts +4 -2
- package/dist/PresenceDot.d.ts.map +1 -1
- package/dist/PresenceDot.jsx +45 -12
- package/dist/PresenceDot.jsx.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
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-11-
|
|
6
|
+
Generated: 2026-11-21T12:46:57.463Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-presence-indicator-solid
|
|
@@ -77,7 +77,7 @@ interface PresenceDotProps {
|
|
|
77
77
|
position?: 'inline' | 'overlay'
|
|
78
78
|
/** Overlay corner when `position="overlay"`. Defaults to `'bottom-right'`. */
|
|
79
79
|
corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'
|
|
80
|
-
/** Accessible label override
|
|
80
|
+
/** Accessible label override; defaults to `t('presenceIndicator.aria.presence', …)`. */
|
|
81
81
|
ariaLabel?: string
|
|
82
82
|
/** Extra classes. */
|
|
83
83
|
className?: string
|
|
@@ -133,8 +133,10 @@ function AvatarWithPresence(props: AvatarWithPresenceProps): JSX.Element
|
|
|
133
133
|
Small colored circle indicating user presence. Use inline next to a name,
|
|
134
134
|
or with `position="overlay"` attached to the corner of an avatar.
|
|
135
135
|
|
|
136
|
-
The default aria-label
|
|
137
|
-
`
|
|
136
|
+
The default aria-label resolves through `t()` with the
|
|
137
|
+
`presenceIndicator.aria.presence` key (an explicitly translated status word
|
|
138
|
+
per `presenceIndicator.status.*` key), so it follows the active locale;
|
|
139
|
+
`ariaLabel` overrides it.
|
|
138
140
|
|
|
139
141
|
```typescript
|
|
140
142
|
function PresenceDot(props: PresenceDotProps): JSX.Element
|
|
@@ -169,3 +171,7 @@ a relatively-positioned parent — `AvatarWithPresence` provides that
|
|
|
169
171
|
wrapper. Status colors are fixed semantic hues (green/yellow/red/gray),
|
|
170
172
|
identical in both themes; the overlay ring color follows
|
|
171
173
|
`var(--color-surface)`.
|
|
174
|
+
|
|
175
|
+
## Translations
|
|
176
|
+
|
|
177
|
+
Translation strings are provided by `@molecule/app-locales-presence-indicator`.
|
package/dist/PresenceDot.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ import type { PresenceDotProps } from './types.js';
|
|
|
13
13
|
* Small colored circle indicating user presence. Use inline next to a name,
|
|
14
14
|
* or with `position="overlay"` attached to the corner of an avatar.
|
|
15
15
|
*
|
|
16
|
-
* The default aria-label
|
|
17
|
-
* `
|
|
16
|
+
* The default aria-label resolves through `t()` with the
|
|
17
|
+
* `presenceIndicator.aria.presence` key (an explicitly translated status word
|
|
18
|
+
* per `presenceIndicator.status.*` key), so it follows the active locale;
|
|
19
|
+
* `ariaLabel` overrides it.
|
|
18
20
|
*
|
|
19
21
|
* @param props - Component props (see {@link PresenceDotProps}).
|
|
20
22
|
* @returns The rendered presence dot.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresenceDot.d.ts","sourceRoot":"","sources":["../src/PresenceDot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"PresenceDot.d.ts","sourceRoot":"","sources":["../src/PresenceDot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,UAAU,CAAA;AAK9C,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAA;AA0BlE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,gBAAgB,CAmDnD,CAAA"}
|
package/dist/PresenceDot.jsx
CHANGED
|
@@ -7,26 +7,57 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
+
import { useTranslation } from '@molecule/app-solid';
|
|
10
11
|
import { getClassMap } from '@molecule/app-ui';
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The translated word for one presence state: one literal `t()` call per value
|
|
14
|
+
* of {@link PresenceStatus}, so molecule's i18n gate sees each key exist (a
|
|
15
|
+
* runtime-built key such as `` t(`presenceIndicator.status.${status}`) `` is
|
|
16
|
+
* invisible to it). Every `presenceIndicator.status.*` key ships in the
|
|
17
|
+
* `@molecule/app-locales-presence-indicator` bond.
|
|
18
|
+
*
|
|
19
|
+
* @param status - The presence state to name.
|
|
20
|
+
* @param t - The translation function from `useTranslation()`.
|
|
21
|
+
* @returns The status's word in the active locale (e.g. `'online'` in English).
|
|
22
|
+
*/
|
|
23
|
+
function statusLabel(status, t) {
|
|
24
|
+
switch (status) {
|
|
25
|
+
case 'online':
|
|
26
|
+
return t('presenceIndicator.status.online', undefined, { defaultValue: 'online' });
|
|
27
|
+
case 'away':
|
|
28
|
+
return t('presenceIndicator.status.away', undefined, { defaultValue: 'away' });
|
|
29
|
+
case 'busy':
|
|
30
|
+
return t('presenceIndicator.status.busy', undefined, { defaultValue: 'busy' });
|
|
31
|
+
case 'offline':
|
|
32
|
+
return t('presenceIndicator.status.offline', undefined, { defaultValue: 'offline' });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
18
35
|
/**
|
|
19
36
|
* Small colored circle indicating user presence. Use inline next to a name,
|
|
20
37
|
* or with `position="overlay"` attached to the corner of an avatar.
|
|
21
38
|
*
|
|
22
|
-
* The default aria-label
|
|
23
|
-
* `
|
|
39
|
+
* The default aria-label resolves through `t()` with the
|
|
40
|
+
* `presenceIndicator.aria.presence` key (an explicitly translated status word
|
|
41
|
+
* per `presenceIndicator.status.*` key), so it follows the active locale;
|
|
42
|
+
* `ariaLabel` overrides it.
|
|
24
43
|
*
|
|
25
44
|
* @param props - Component props (see {@link PresenceDotProps}).
|
|
26
45
|
* @returns The rendered presence dot.
|
|
27
46
|
*/
|
|
28
47
|
export const PresenceDot = (props) => {
|
|
29
48
|
const cm = getClassMap();
|
|
49
|
+
const { t } = useTranslation();
|
|
50
|
+
// The dot's fill is the theme's colour for the state, never a hardcoded hex:
|
|
51
|
+
// online/away/busy are the solid success/warning/error tones —
|
|
52
|
+
// `cm.progressColor`, the solid tone fill the package's app-ui peer floor
|
|
53
|
+
// (^1.0.1) already declares (`bgTone` is newer and would raise that floor) —
|
|
54
|
+
// offline the theme's neutral border grey.
|
|
55
|
+
const statusClass = {
|
|
56
|
+
online: cm.progressColor('success'),
|
|
57
|
+
away: cm.progressColor('warning'),
|
|
58
|
+
busy: cm.progressColor('error'),
|
|
59
|
+
offline: cm.bgBorder,
|
|
60
|
+
};
|
|
30
61
|
const size = () => props.size ?? 10;
|
|
31
62
|
const position = () => props.position ?? 'inline';
|
|
32
63
|
const corner = () => props.corner ?? 'bottom-right';
|
|
@@ -36,10 +67,9 @@ export const PresenceDot = (props) => {
|
|
|
36
67
|
width: `${size()}px`,
|
|
37
68
|
height: `${size()}px`,
|
|
38
69
|
'border-radius': '50%',
|
|
39
|
-
background: STATUS_COLOR[props.status],
|
|
40
70
|
};
|
|
41
71
|
if (position() === 'overlay') {
|
|
42
|
-
styles['box-shadow'] = '0 0 0 2px var(--color-surface
|
|
72
|
+
styles['box-shadow'] = '0 0 0 2px var(--color-surface)';
|
|
43
73
|
styles.position = 'absolute';
|
|
44
74
|
if (corner().includes('top'))
|
|
45
75
|
styles.top = '0px';
|
|
@@ -52,6 +82,9 @@ export const PresenceDot = (props) => {
|
|
|
52
82
|
}
|
|
53
83
|
return styles;
|
|
54
84
|
};
|
|
55
|
-
return (<span role="status" aria-label={props.ariaLabel ??
|
|
85
|
+
return (<span role="status" aria-label={props.ariaLabel ??
|
|
86
|
+
t('presenceIndicator.aria.presence', { status: statusLabel(props.status, t) }, {
|
|
87
|
+
defaultValue: 'Presence: {{status}}',
|
|
88
|
+
})} class={cm.cn(statusClass[props.status], props.className)} style={style()}/>);
|
|
56
89
|
};
|
|
57
90
|
//# sourceMappingURL=PresenceDot.jsx.map
|
package/dist/PresenceDot.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresenceDot.jsx","sourceRoot":"","sources":["../src/PresenceDot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,
|
|
1
|
+
{"version":3,"file":"PresenceDot.jsx","sourceRoot":"","sources":["../src/PresenceDot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAAC,MAAsB,EAAE,CAAyC;IACpF,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,iCAAiC,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAA;QACpF,KAAK,MAAM;YACT,OAAO,CAAC,CAAC,+BAA+B,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAA;QAChF,KAAK,MAAM;YACT,OAAO,CAAC,CAAC,+BAA+B,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAA;QAChF,KAAK,SAAS;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C,QAAQ,CAAC,KAAK,CAAC;gBAAE,MAAM,CAAC,GAAG,GAAG,KAAK,CAAA;YAChD,IAAI,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;YACtD,IAAI,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;YACpD,IAAI,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,MAAM,CAAC,IAAI,GAAG,KAAK,CAAA;QACpD,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IACD,OAAO,CACL,CAAC,IAAI,CACH,IAAI,CAAC,QAAQ,CACb,UAAU,CAAC,CACT,KAAK,CAAC,SAAS;YACf,CAAC,CACC,iCAAiC,EACjC,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EACxC;gBACE,YAAY,EAAE,sBAAsB;aACrC,CAEL,CAAC,CACD,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CACzD,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EACf,CACH,CAAA;AACH,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface PresenceDotProps {
|
|
|
16
16
|
position?: 'inline' | 'overlay';
|
|
17
17
|
/** Overlay corner when `position="overlay"`. Defaults to `'bottom-right'`. */
|
|
18
18
|
corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
|
|
19
|
-
/** Accessible label override
|
|
19
|
+
/** Accessible label override; defaults to `t('presenceIndicator.aria.presence', …)`. */
|
|
20
20
|
ariaLabel?: string;
|
|
21
21
|
/** Extra classes. */
|
|
22
22
|
className?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-presence-indicator-solid",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Online/offline dot + presence overlay for avatars and user chips",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-presence-indicator-solid",
|
|
6
6
|
"type": "module",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
52
52
|
"@molecule/app-i18n": "1.2.2",
|
|
53
53
|
"@molecule/app-icons": "1.0.4",
|
|
54
|
-
"@molecule/app-solid": "3.
|
|
55
|
-
"@molecule/app-ui": "1.
|
|
56
|
-
"@molecule/app-ui-solid": "1.1
|
|
54
|
+
"@molecule/app-solid": "3.9.0",
|
|
55
|
+
"@molecule/app-ui": "1.5.0",
|
|
56
|
+
"@molecule/app-ui-solid": "1.2.1",
|
|
57
57
|
"@types/node": "26.6.5",
|
|
58
58
|
"jsdom": "30.1.3",
|
|
59
59
|
"solid-js": "1.9.17",
|