@molecule/app-typing-indicator-react 4.0.0 → 4.0.2

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 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-12T04:41:50.795Z
6
+ Generated: 2026-11-21T12:47:41.371Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-typing-indicator-react
@@ -53,7 +53,10 @@ interface TypingIndicatorProps {
53
53
  dotSize?: number
54
54
  /** Animation duration in ms. Defaults to 1200. */
55
55
  durationMs?: number
56
- /** Accessible label. */
56
+ /**
57
+ * Accessible label. Overrides the translated / `defaultValue` `'Typing…'`
58
+ * (prop > `t()` > default).
59
+ */
57
60
  ariaLabel?: string
58
61
  /** Extra classes. */
59
62
  className?: string
@@ -66,14 +69,16 @@ interface TypingIndicatorProps {
66
69
 
67
70
  Three-dot "typing…" animation. CSS-only (no library dependency) —
68
71
  uses `@keyframes` defined via inline style tag. Renders three dots
69
- that pulse in sequence.
72
+ that pulse in sequence. The stylesheet also turns the pulse off under
73
+ `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
74
+ for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
70
75
 
71
76
  ```typescript
72
77
  function TypingIndicator({
73
78
  visible = true,
74
79
  dotSize = 6,
75
80
  durationMs = 1200,
76
- ariaLabel = 'Typing…',
81
+ ariaLabel,
77
82
  className,
78
83
  }: TypingIndicatorProps): JSX.Element | null
79
84
  ```
@@ -100,9 +105,13 @@ Peer dependencies:
100
105
 
101
106
  Dots use `currentColor`, so the indicator inherits the surrounding text
102
107
  color — wrap it in a muted-text container to dim it. The default
103
- `ariaLabel` is hardcoded English 'Typing…' and there is no companion
104
- locale bond: pass a translated `ariaLabel` in non-English apps. Each
105
- instance injects its own `<style>` tag for the keyframes (fine for a chat
106
- view; avoid hundreds at once). Props (documented on the exported
107
- `TypingIndicatorProps` interface): visible (default true), dotSize (px,
108
- default 6), durationMs (default 1200), ariaLabel, className.
108
+ `ariaLabel` is the translated `typingIndicator.aria.label` (English
109
+ `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
110
+ prop overrides it. Each instance injects its own `<style>` tag for the
111
+ keyframes (fine for a chat view; avoid hundreds at once). Props (documented
112
+ on the exported `TypingIndicatorProps` interface): visible (default true),
113
+ dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
114
+
115
+ ## Translations
116
+
117
+ Translation strings are provided by `@molecule/app-locales-typing-indicator`.
@@ -7,7 +7,10 @@ export interface TypingIndicatorProps {
7
7
  dotSize?: number;
8
8
  /** Animation duration in ms. Defaults to 1200. */
9
9
  durationMs?: number;
10
- /** Accessible label. */
10
+ /**
11
+ * Accessible label. Overrides the translated / `defaultValue` `'Typing…'`
12
+ * (prop > `t()` > default).
13
+ */
11
14
  ariaLabel?: string;
12
15
  /** Extra classes. */
13
16
  className?: string;
@@ -15,7 +18,9 @@ export interface TypingIndicatorProps {
15
18
  /**
16
19
  * Three-dot "typing…" animation. CSS-only (no library dependency) —
17
20
  * uses `@keyframes` defined via inline style tag. Renders three dots
18
- * that pulse in sequence.
21
+ * that pulse in sequence. The stylesheet also turns the pulse off under
22
+ * `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
23
+ * for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
19
24
  * @param props - Component props (see {@link TypingIndicatorProps}).
20
25
  */
21
26
  export declare function TypingIndicator({ visible, dotSize, durationMs, ariaLabel, className, }: TypingIndicatorProps): JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAIhC,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAc,EACd,OAAW,EACX,UAAiB,EACjB,SAAqB,EACrB,SAAS,GACV,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA6B3C"}
1
+ {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAKhC,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAc,EACd,OAAW,EACX,UAAiB,EACjB,SAAS,EACT,SAAS,GACV,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAqC3C"}
@@ -1,24 +1,34 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
2
3
  import { getClassMap } from '@molecule/app-ui';
3
4
  /**
4
5
  * Three-dot "typing…" animation. CSS-only (no library dependency) —
5
6
  * uses `@keyframes` defined via inline style tag. Renders three dots
6
- * that pulse in sequence.
7
+ * that pulse in sequence. The stylesheet also turns the pulse off under
8
+ * `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
9
+ * for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
7
10
  * @param props - Component props (see {@link TypingIndicatorProps}).
8
11
  */
9
- export function TypingIndicator({ visible = true, dotSize = 6, durationMs = 1200, ariaLabel = 'Typing…', className, }) {
12
+ export function TypingIndicator({ visible = true, dotSize = 6, durationMs = 1200, ariaLabel, className, }) {
13
+ const { t } = useTranslation();
10
14
  const cm = getClassMap();
11
15
  if (!visible)
12
16
  return null;
17
+ const label = ariaLabel ?? t('typingIndicator.aria.label', undefined, { defaultValue: 'Typing…' });
13
18
  const keyName = 'molecule-typing-pulse';
14
- const css = `@keyframes ${keyName} { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }`;
15
- return (_jsxs("span", { role: "status", "aria-label": ariaLabel, className: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), className), children: [_jsx("style", { children: css }), [0, 1, 2].map((i) => (_jsx("span", { "aria-hidden": true, style: {
19
+ // The pulse honours `prefers-reduced-motion` in the component's own
20
+ // stylesheet: the host stylesheet's global 0.01ms collapse still leaves the
21
+ // per-dot stagger delay, so the dots flash in sequence for a reduced-motion
22
+ // user and the rendered frame depends on when it is painted.
23
+ const css = `@keyframes ${keyName} { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } } @media (prefers-reduced-motion: reduce) { [data-typing-dot] { animation: none !important; } }`;
24
+ return (_jsxs("span", { role: "status", "aria-label": label, className: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), className), children: [_jsx("style", { children: css }), [0, 1, 2].map((i) => (_jsx("span", { "aria-hidden": true, "data-typing-dot": "", style: {
16
25
  display: 'inline-block',
17
26
  width: dotSize,
18
27
  height: dotSize,
19
28
  borderRadius: '50%',
20
29
  background: 'currentColor',
21
- animation: `${keyName} ${durationMs}ms ease-in-out infinite`,
22
- animationDelay: `${(i * durationMs) / 6}ms`,
30
+ // One shorthand carries the stagger: mixing it with an `animationDelay`
31
+ // longhand makes React warn when `durationMs` changes.
32
+ animation: `${keyName} ${durationMs}ms ease-in-out ${(i * durationMs) / 6}ms infinite`,
23
33
  } }, i)))] }));
24
34
  }
package/dist/index.d.ts CHANGED
@@ -15,12 +15,12 @@
15
15
  * @remarks
16
16
  * Dots use `currentColor`, so the indicator inherits the surrounding text
17
17
  * color — wrap it in a muted-text container to dim it. The default
18
- * `ariaLabel` is hardcoded English 'Typing…' and there is no companion
19
- * locale bond: pass a translated `ariaLabel` in non-English apps. Each
20
- * instance injects its own `<style>` tag for the keyframes (fine for a chat
21
- * view; avoid hundreds at once). Props (documented on the exported
22
- * `TypingIndicatorProps` interface): visible (default true), dotSize (px,
23
- * default 6), durationMs (default 1200), ariaLabel, className.
18
+ * `ariaLabel` is the translated `typingIndicator.aria.label` (English
19
+ * `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
20
+ * prop overrides it. Each instance injects its own `<style>` tag for the
21
+ * keyframes (fine for a chat view; avoid hundreds at once). Props (documented
22
+ * on the exported `TypingIndicatorProps` interface): visible (default true),
23
+ * dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
24
24
  *
25
25
  * @module
26
26
  */
package/dist/index.js CHANGED
@@ -15,12 +15,12 @@
15
15
  * @remarks
16
16
  * Dots use `currentColor`, so the indicator inherits the surrounding text
17
17
  * color — wrap it in a muted-text container to dim it. The default
18
- * `ariaLabel` is hardcoded English 'Typing…' and there is no companion
19
- * locale bond: pass a translated `ariaLabel` in non-English apps. Each
20
- * instance injects its own `<style>` tag for the keyframes (fine for a chat
21
- * view; avoid hundreds at once). Props (documented on the exported
22
- * `TypingIndicatorProps` interface): visible (default true), dotSize (px,
23
- * default 6), durationMs (default 1200), ariaLabel, className.
18
+ * `ariaLabel` is the translated `typingIndicator.aria.label` (English
19
+ * `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
20
+ * prop overrides it. Each instance injects its own `<style>` tag for the
21
+ * keyframes (fine for a chat view; avoid hundreds at once). Props (documented
22
+ * on the exported `TypingIndicatorProps` interface): visible (default true),
23
+ * dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
24
24
  *
25
25
  * @module
26
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-typing-indicator-react",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Three-dot animated typing indicator for chat UIs",
5
5
  "homepage": "https://www.molecule.dev/packages/app-typing-indicator-react",
6
6
  "type": "module",
@@ -39,9 +39,9 @@
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/app-react": "4.0.0",
43
- "@molecule/app-ui": "1.3.9",
44
- "@molecule/app-ui-react": "4.0.0",
42
+ "@molecule/app-react": "4.10.1",
43
+ "@molecule/app-ui": "1.5.0",
44
+ "@molecule/app-ui-react": "4.2.0",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",