@molecule/app-announcement-bar-angular 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +387 -2
- package/dist/announcement-bar.component.d.ts +150 -0
- package/dist/announcement-bar.component.d.ts.map +1 -0
- package/dist/announcement-bar.component.js +402 -0
- package/dist/announcement-bar.component.js.map +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular announcement / promo bar.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<AnnouncementBar>` — persistent top-of-page banner with icon,
|
|
5
|
+
* message, optional action (link or button), and optional dismiss (×).
|
|
6
|
+
* Long-lived and prominent, unlike a Toast; carries an action slot +
|
|
7
|
+
* dismiss, unlike an Alert. It is the Angular counterpart of
|
|
8
|
+
* `@molecule/app-announcement-bar-react`: same props (React names), same DOM
|
|
9
|
+
* for the same input, same ClassMap tokens and i18n keys.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { AnnouncementBar } from '@molecule/app-announcement-bar-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-page',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [AnnouncementBar],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div
|
|
22
|
+
* mol-announcement-bar
|
|
23
|
+
* [kind]="'promo'"
|
|
24
|
+
* [icon]="'🎉'"
|
|
25
|
+
* [action]="{ label: 'Learn more', href: '/pricing' }"
|
|
26
|
+
* [onDismiss]="() => onDismissed()"
|
|
27
|
+
* [dataMolId]="'promo-bar'"
|
|
28
|
+
* >
|
|
29
|
+
* New Pro plan — 3 months free for early adopters.
|
|
30
|
+
* </div>
|
|
31
|
+
* `,
|
|
32
|
+
* })
|
|
33
|
+
* export class Page {
|
|
34
|
+
* onDismissed(): void {
|
|
35
|
+
* console.log('dismissed')
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* `kind` is exposed as a `data-kind` attribute on the root — it does NOT
|
|
42
|
+
* change the bar's colors by itself; style per-kind via `className` or a
|
|
43
|
+
* `[data-kind="…"]` selector. Dismissal is uncontrolled by default
|
|
44
|
+
* (internal state; the bar stays hidden until remount) — bind `visible`
|
|
45
|
+
* to control it, e.g. to persist dismissal per user. `dismissible`
|
|
46
|
+
* defaults to `true`. There is no default `data-mol-id`; bind `dataMolId`
|
|
47
|
+
* so agents/E2E can target the bar. The message is projected content and
|
|
48
|
+
* the icon is either the `icon` input (text or an `<ng-template>` ref) or
|
|
49
|
+
* `[slot=icon]` content. The dismiss label comes from the companion
|
|
50
|
+
* `@molecule/app-locales-announcement-bar` locale bond.
|
|
51
|
+
*
|
|
52
|
+
* @module
|
|
53
|
+
*/
|
|
54
|
+
export * from './announcement-bar.component.js';
|
|
55
|
+
export * from './types.js';
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,cAAc,iCAAiC,CAAA;AAC/C,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-announcement-bar-angular` — the Angular counterpart
|
|
3
|
+
* of `@molecule/app-announcement-bar-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/** Semantic kind, exposed as a `data-kind` attribute for per-kind styling (no built-in style change). */
|
|
9
|
+
export type AnnouncementKind = 'info' | 'success' | 'warning' | 'error' | 'promo';
|
|
10
|
+
/**
|
|
11
|
+
* Props accepted by the `AnnouncementBar` component.
|
|
12
|
+
*
|
|
13
|
+
* The message is projected content (`<ng-content>`), the icon is either the
|
|
14
|
+
* `icon` input (text or a template ref) or a `[slot=icon]` projection, and
|
|
15
|
+
* `onDismiss` is the `onDismiss` input.
|
|
16
|
+
*/
|
|
17
|
+
export interface AnnouncementBarProps {
|
|
18
|
+
/** Optional leading icon — text, a template ref, or `[slot=icon]` content. */
|
|
19
|
+
icon?: TemplateRef<unknown> | string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Optional call-to-action (link or button). Node props are templated
|
|
22
|
+
* content in Angular, so the label is typed `unknown`: pass a plain string
|
|
23
|
+
* or an `<ng-template>` ref.
|
|
24
|
+
*/
|
|
25
|
+
action?: {
|
|
26
|
+
/** The action's label — text or a template ref. */
|
|
27
|
+
label: unknown;
|
|
28
|
+
/** Rendering as a link: the action is an `<a href>` instead of a `<button>`. */
|
|
29
|
+
href?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Called when the action button is clicked (ignored when `href` is set).
|
|
32
|
+
* React's DOM click handler receives the click event, so the callback may
|
|
33
|
+
* take it.
|
|
34
|
+
*/
|
|
35
|
+
onClick?: (event?: MouseEvent) => void;
|
|
36
|
+
} | null;
|
|
37
|
+
/** Semantic kind — emitted as `data-kind` on the root (style via CSS/`className`). Defaults to `'info'`. */
|
|
38
|
+
kind?: AnnouncementKind;
|
|
39
|
+
/** Show a dismiss (×) button. Defaults to true. */
|
|
40
|
+
dismissible?: boolean;
|
|
41
|
+
/** Called when the bar is dismissed. */
|
|
42
|
+
onDismiss?: () => void;
|
|
43
|
+
/** Controlled visibility — when provided, overrides internal state. */
|
|
44
|
+
visible?: boolean;
|
|
45
|
+
/** Extra classes. */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
48
|
+
dataMolId?: string;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAEjF;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3C;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,mDAAmD;QACnD,KAAK,EAAE,OAAO,CAAA;QACd,gFAAgF;QAChF,IAAI,CAAC,EAAE,MAAM,CAAA;QACb;;;;WAIG;QACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;KACvC,GAAG,IAAI,CAAA;IACR,4GAA4G;IAC5G,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-announcement-bar-angular",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Persistent banner for announcements, promos, feature callouts, with dismiss + CTA",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-announcement-bar-angular",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ngc",
|
|
21
|
+
"dev": "ngc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"announcement-bar",
|
|
28
|
+
"angular"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/announcement-bar-angular"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@angular/common": "^22.0.0",
|
|
46
|
+
"@angular/core": "^22.0.0",
|
|
47
|
+
"@angular/platform-browser": "^22.0.0",
|
|
48
|
+
"@molecule/app-angular": "^3.5.0",
|
|
49
|
+
"@molecule/app-ui": "^1.0.1",
|
|
50
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@angular/common": "22.2.3",
|
|
54
|
+
"@angular/compiler": "22.2.3",
|
|
55
|
+
"@angular/compiler-cli": "22.2.3",
|
|
56
|
+
"@angular/core": "22.2.3",
|
|
57
|
+
"@angular/platform-browser": "22.2.3",
|
|
58
|
+
"@molecule/app-angular": "3.6.0",
|
|
59
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
+
"@molecule/app-i18n": "1.2.1",
|
|
61
|
+
"@molecule/app-icons": "1.0.4",
|
|
62
|
+
"@molecule/app-ui": "1.3.11",
|
|
63
|
+
"@molecule/app-ui-angular": "1.1.2",
|
|
64
|
+
"@types/node": "26.6.5",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"rxjs": "7.8.2",
|
|
67
|
+
"typescript": "6.0.3",
|
|
68
|
+
"vitest": "4.1.12",
|
|
69
|
+
"zone.js": "0.16.3"
|
|
70
|
+
}
|
|
71
|
+
}
|