@molecule/app-typing-indicator-react 4.0.1 → 4.1.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/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-25T09:31:36.791Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-typing-indicator-react
@@ -49,11 +49,14 @@ Props for the {@link TypingIndicator} component.
49
49
  interface TypingIndicatorProps {
50
50
  /** Whether to render. Defaults to true. */
51
51
  visible?: boolean
52
- /** Dot diameter in pixels. Defaults to 6. */
52
+ /** Dot diameter in CSS pixels or native dp. Defaults to 6. */
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
@@ -64,16 +67,15 @@ interface TypingIndicatorProps {
64
67
 
65
68
  #### `TypingIndicator(props)`
66
69
 
67
- Three-dot "typing…" animation. CSS-only (no library dependency) —
68
- uses `@keyframes` defined via inline style tag. Renders three dots
69
- that pulse in sequence.
70
+ Three-dot "typing…" status. The dots pulse in sequence and stay still when
71
+ the browser or device requests reduced motion.
70
72
 
71
73
  ```typescript
72
74
  function TypingIndicator({
73
75
  visible = true,
74
76
  dotSize = 6,
75
77
  durationMs = 1200,
76
- ariaLabel = 'Typing…',
78
+ ariaLabel,
77
79
  className,
78
80
  }: TypingIndicatorProps): JSX.Element | null
79
81
  ```
@@ -87,8 +89,8 @@ function TypingIndicator({
87
89
  Peer dependencies:
88
90
 
89
91
  - `@molecule/app-react` ^4.0.0
90
- - `@molecule/app-ui` ^1.0.1
91
- - `@molecule/app-ui-react` ^4.0.0
92
+ - `@molecule/app-ui` ^1.9.0
93
+ - `@molecule/app-ui-react` ^4.7.0
92
94
  - `react` ^18.0.0 || ^19.0.0
93
95
 
94
96
  ### Runtime Dependencies
@@ -100,9 +102,13 @@ Peer dependencies:
100
102
 
101
103
  Dots use `currentColor`, so the indicator inherits the surrounding text
102
104
  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.
105
+ `ariaLabel` is the translated `typingIndicator.aria.label` (English
106
+ `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
107
+ prop overrides it. Each instance injects its own `<style>` tag for the
108
+ keyframes (fine for a chat view; avoid hundreds at once). Props (documented
109
+ on the exported `TypingIndicatorProps` interface): visible (default true),
110
+ dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
111
+
112
+ ## Translations
113
+
114
+ Translation strings are provided by `@molecule/app-locales-typing-indicator`.
@@ -3,19 +3,21 @@ import type { JSX } from 'react';
3
3
  export interface TypingIndicatorProps {
4
4
  /** Whether to render. Defaults to true. */
5
5
  visible?: boolean;
6
- /** Dot diameter in pixels. Defaults to 6. */
6
+ /** Dot diameter in CSS pixels or native dp. Defaults to 6. */
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;
14
17
  }
15
18
  /**
16
- * Three-dot "typing…" animation. CSS-only (no library dependency) —
17
- * uses `@keyframes` defined via inline style tag. Renders three dots
18
- * that pulse in sequence.
19
+ * Three-dot "typing…" status. The dots pulse in sequence and stay still when
20
+ * the browser or device requests reduced motion.
19
21
  * @param props - Component props (see {@link TypingIndicatorProps}).
20
22
  */
21
23
  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,CA8B3C"}
1
+ {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAMhC,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8DAA8D;IAC9D,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;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAc,EACd,OAAW,EACX,UAAiB,EACjB,SAAS,EACT,SAAS,GACV,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAe3C"}
@@ -1,25 +1,17 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
2
3
  import { getClassMap } from '@molecule/app-ui';
4
+ import { Box, PulseDots } from '@molecule/app-ui-react/elements';
3
5
  /**
4
- * Three-dot "typing…" animation. CSS-only (no library dependency) —
5
- * uses `@keyframes` defined via inline style tag. Renders three dots
6
- * that pulse in sequence.
6
+ * Three-dot "typing…" status. The dots pulse in sequence and stay still when
7
+ * the browser or device requests reduced motion.
7
8
  * @param props - Component props (see {@link TypingIndicatorProps}).
8
9
  */
9
- export function TypingIndicator({ visible = true, dotSize = 6, durationMs = 1200, ariaLabel = 'Typing…', className, }) {
10
+ export function TypingIndicator({ visible = true, dotSize = 6, durationMs = 1200, ariaLabel, className, }) {
11
+ const { t } = useTranslation();
10
12
  const cm = getClassMap();
11
13
  if (!visible)
12
14
  return null;
13
- 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: {
16
- display: 'inline-block',
17
- width: dotSize,
18
- height: dotSize,
19
- borderRadius: '50%',
20
- background: 'currentColor',
21
- // One shorthand carries the stagger: mixing it with an `animationDelay`
22
- // longhand makes React warn when `durationMs` changes.
23
- animation: `${keyName} ${durationMs}ms ease-in-out ${(i * durationMs) / 6}ms infinite`,
24
- } }, i)))] }));
15
+ const label = ariaLabel ?? t('typingIndicator.aria.label', undefined, { defaultValue: 'Typing…' });
16
+ return (_jsx(Box, { as: "span", role: "status", "aria-label": label, className: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), className), children: _jsx(PulseDots, { size: dotSize, durationMs: durationMs }) }));
25
17
  }
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.1",
3
+ "version": "4.1.0",
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",
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@molecule/app-react": "^4.0.0",
37
- "@molecule/app-ui": "^1.0.1",
38
- "@molecule/app-ui-react": "^4.0.0",
37
+ "@molecule/app-ui": "^1.9.0",
38
+ "@molecule/app-ui-react": "^4.7.0",
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/app-react": "4.7.1",
43
- "@molecule/app-ui": "1.4.0",
44
- "@molecule/app-ui-react": "4.1.4",
42
+ "@molecule/app-react": "4.17.0",
43
+ "@molecule/app-ui": "1.13.0",
44
+ "@molecule/app-ui-react": "4.11.0",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",