@molecule/app-announcement-bar-react 1.0.0 → 1.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 +144 -0
- package/package.json +16 -9
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:50:02.930Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-announcement-bar-react
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
React announcement / promo bar.
|
|
16
|
+
|
|
17
|
+
Exports `<AnnouncementBar>` — persistent top-of-page banner with icon,
|
|
18
|
+
message, optional action (link or button), and optional dismiss (×).
|
|
19
|
+
Long-lived and prominent, unlike a Toast; carries an action slot +
|
|
20
|
+
dismiss, unlike an Alert.
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { AnnouncementBar } from '@molecule/app-announcement-bar-react'
|
|
26
|
+
|
|
27
|
+
;<AnnouncementBar
|
|
28
|
+
kind="promo"
|
|
29
|
+
icon={<span>🎉</span>}
|
|
30
|
+
action={{ label: 'Learn more', href: '/pricing' }}
|
|
31
|
+
onDismiss={() => console.log('dismissed')}
|
|
32
|
+
dataMolId="promo-bar"
|
|
33
|
+
>
|
|
34
|
+
New Pro plan — 3 months free for early adopters.
|
|
35
|
+
</AnnouncementBar>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Type
|
|
39
|
+
|
|
40
|
+
`feature`
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @molecule/app-announcement-bar-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
|
|
46
|
+
npm install -D @types/react
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API
|
|
50
|
+
|
|
51
|
+
### Interfaces
|
|
52
|
+
|
|
53
|
+
#### `AnnouncementBarProps`
|
|
54
|
+
|
|
55
|
+
Props for {@link AnnouncementBar}.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
interface AnnouncementBarProps {
|
|
59
|
+
/** Primary message. */
|
|
60
|
+
children: ReactNode
|
|
61
|
+
/** Optional leading icon. */
|
|
62
|
+
icon?: ReactNode
|
|
63
|
+
/** Optional call-to-action (link or button). */
|
|
64
|
+
action?: { label: ReactNode; href?: string; onClick?: () => void }
|
|
65
|
+
/** Semantic kind — emitted as `data-kind` on the root (style via CSS/`className`). Defaults to `'info'`. */
|
|
66
|
+
kind?: AnnouncementKind
|
|
67
|
+
/** Show a dismiss (×) button. Defaults to true. */
|
|
68
|
+
dismissible?: boolean
|
|
69
|
+
/** Called when the bar is dismissed. */
|
|
70
|
+
onDismiss?: () => void
|
|
71
|
+
/** Controlled visibility — when provided, overrides internal state. */
|
|
72
|
+
visible?: boolean
|
|
73
|
+
/** Extra classes. */
|
|
74
|
+
className?: string
|
|
75
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
76
|
+
dataMolId?: string
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Types
|
|
81
|
+
|
|
82
|
+
#### `AnnouncementKind`
|
|
83
|
+
|
|
84
|
+
Semantic kind, exposed as a `data-kind` attribute for per-kind styling (no built-in style change).
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
type AnnouncementKind = 'info' | 'success' | 'warning' | 'error' | 'promo'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Functions
|
|
91
|
+
|
|
92
|
+
#### `AnnouncementBar(props)`
|
|
93
|
+
|
|
94
|
+
Persistent announcement banner — product updates, promos, outage
|
|
95
|
+
notices, feature callouts. Different from `<Toast>` in being
|
|
96
|
+
long-lived and prominent (top-of-page), and from `<Alert>` in
|
|
97
|
+
including an action slot + dismiss.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
function AnnouncementBar({
|
|
101
|
+
children,
|
|
102
|
+
icon,
|
|
103
|
+
action,
|
|
104
|
+
kind = 'info',
|
|
105
|
+
dismissible = true,
|
|
106
|
+
onDismiss,
|
|
107
|
+
visible,
|
|
108
|
+
className,
|
|
109
|
+
dataMolId,
|
|
110
|
+
}: AnnouncementBarProps): JSX.Element | null
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- `props` — Component props (see {@link AnnouncementBarProps}).
|
|
114
|
+
|
|
115
|
+
## Injection Notes
|
|
116
|
+
|
|
117
|
+
### Requirements
|
|
118
|
+
|
|
119
|
+
Peer dependencies:
|
|
120
|
+
|
|
121
|
+
- `@molecule/app-react` ^1.0.1
|
|
122
|
+
- `@molecule/app-ui` ^1.0.1
|
|
123
|
+
- `@molecule/app-ui-react` ^1.0.1
|
|
124
|
+
- `react` ^18.0.0 || ^19.0.0
|
|
125
|
+
|
|
126
|
+
### Runtime Dependencies
|
|
127
|
+
|
|
128
|
+
- `@molecule/app-react`
|
|
129
|
+
- `@molecule/app-ui`
|
|
130
|
+
- `@molecule/app-ui-react`
|
|
131
|
+
- `react`
|
|
132
|
+
|
|
133
|
+
`kind` is exposed as a `data-kind` attribute on the root — it does NOT
|
|
134
|
+
change the bar's colors by itself; style per-kind via `className` or a
|
|
135
|
+
`[data-kind="…"]` selector. Dismissal is uncontrolled by default
|
|
136
|
+
(internal state; the bar stays hidden until remount) — pass `visible`
|
|
137
|
+
to control it, e.g. to persist dismissal per user. `dismissible`
|
|
138
|
+
defaults to `true`. There is no default `data-mol-id`; pass `dataMolId`
|
|
139
|
+
so agents/E2E can target the bar. Translations come from the companion
|
|
140
|
+
`@molecule/app-locales-announcement-bar` locale bond.
|
|
141
|
+
|
|
142
|
+
## Translations
|
|
143
|
+
|
|
144
|
+
Translation strings are provided by `@molecule/app-locales-announcement-bar`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-announcement-bar-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Persistent banner for announcements, promos, feature callouts, with dismiss + CTA",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-announcement-bar-react",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +18,8 @@
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
|
-
"dist"
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
21
23
|
],
|
|
22
24
|
"keywords": [
|
|
23
25
|
"molecule",
|
|
@@ -25,22 +27,27 @@
|
|
|
25
27
|
"react"
|
|
26
28
|
],
|
|
27
29
|
"license": "Apache-2.0",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
33
|
+
"directory": "packages/app/features/announcement-bar-react"
|
|
34
|
+
},
|
|
28
35
|
"peerDependencies": {
|
|
29
|
-
"@molecule/app-react": "^1.0.
|
|
30
|
-
"@molecule/app-ui": "^1.0.
|
|
31
|
-
"@molecule/app-ui-react": "^1.0.
|
|
36
|
+
"@molecule/app-react": "^1.0.1",
|
|
37
|
+
"@molecule/app-ui": "^1.0.1",
|
|
38
|
+
"@molecule/app-ui-react": "^1.0.1",
|
|
32
39
|
"react": "^18.0.0 || ^19.0.0"
|
|
33
40
|
},
|
|
34
41
|
"devDependencies": {
|
|
35
|
-
"@molecule/app-react": "1.
|
|
36
|
-
"@molecule/app-ui": "1.
|
|
37
|
-
"@molecule/app-ui-react": "1.0.
|
|
42
|
+
"@molecule/app-react": "1.5.1",
|
|
43
|
+
"@molecule/app-ui": "1.1.1",
|
|
44
|
+
"@molecule/app-ui-react": "1.0.2",
|
|
38
45
|
"@types/node": "26.1.2",
|
|
39
46
|
"@types/react": "19.2.17",
|
|
40
47
|
"@types/react-dom": "19.2.3",
|
|
41
48
|
"react": "19.2.8",
|
|
42
49
|
"react-dom": "19.2.8",
|
|
43
50
|
"typescript": "6.0.3",
|
|
44
|
-
"vitest": "4.1.
|
|
51
|
+
"vitest": "4.1.11"
|
|
45
52
|
}
|
|
46
53
|
}
|