@telia-ace/knowledge-widget-components-notification-row 1.0.38-experimental.0 → 1.0.38-experimental.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/dist/index.js CHANGED
@@ -1,80 +1,16 @@
1
- var m = Object.defineProperty, b = Object.defineProperties;
2
- var C = Object.getOwnPropertyDescriptors;
3
- var g = Object.getOwnPropertySymbols;
4
- var y = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
5
- var p = (t, e, i) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, h = (t, e) => {
6
- for (var i in e || (e = {}))
7
- y.call(e, i) && p(t, i, e[i]);
8
- if (g)
9
- for (var i of g(e))
10
- R.call(e, i) && p(t, i, e[i]);
11
- return t;
12
- }, d = (t, e) => b(t, C(e));
13
- import { createEventSubscriber as v, extendComponent as x } from "@telia-ace/knowledge-widget-core";
14
- import { DataType as D } from "@telia-ace/knowledge-widget-types-grid";
15
- import { createReactComponent as N } from "@telia-ace/knowledge-widget-ui";
16
- const O = (t) => {
17
- const { events: e } = t.get("$widget"), [i, u] = v(e);
18
- return N(
19
- t,
1
+ import { createEventSubscriber as e } from "@telia-ace/knowledge-widget-core";
2
+ import { createWebComponent as n } from "@telia-ace/widget-ui";
3
+ const i = (o) => {
4
+ const { events: t } = o.get("$widget");
5
+ return e(t), n(
6
+ o,
20
7
  "notification-row",
21
- import("./notification-row.5162cdbf.js"),
8
+ import("./notification-row-wrapper.297e86c1.js"),
22
9
  (r) => {
23
- const s = (a) => {
24
- r.writeProperties(d(h({}, r.properties()), {
25
- loading: !0,
26
- error: void 0,
27
- notifications: []
28
- })), r.actions.dispatch("fetch", { params: a });
29
- };
30
- return r.actions.create(
31
- "fetch",
32
- ({
33
- error: a,
34
- topNotifications: o,
35
- bottomNotifications: f,
36
- middleNotifications: l
37
- }) => {
38
- if (a)
39
- return r.actions.dispatch("fetched", {
40
- error: a,
41
- loading: !0,
42
- notifications: []
43
- });
44
- let n = [];
45
- const { notifications: w, types: c = [] } = r.properties();
46
- return c.length ? (c.indexOf("top") > -1 && (n = n.concat(o)), c.indexOf("middle") > -1 && (n = n.concat(l)), c.indexOf("bottom") > -1 && (n = n.concat(f))) : n = o, r.actions.dispatch("fetched", {
47
- notifications: n.length ? n : w,
48
- loading: !1
49
- });
50
- }
51
- ), r.actions.create("fetched", (a) => r.writeProperties(d(h({}, a), { loading: !1 }))), t.getAsync("router").then((a) => {
52
- const { params: o } = a.getRouteData();
53
- s(o);
54
- }), i("router:changed", (a, { current: o }) => {
55
- s(o.routeData.params);
56
- }), () => {
57
- u();
58
- };
59
10
  }
60
- ).then(() => x(t, "notification-row", (r) => {
61
- r.actions.watch("notification-row.fetch", (s, a) => t.getAsync("dataClient").then(
62
- (o) => o.fetch(D.RowNotifications, {
63
- categories: [
64
- s.params.guideCategory,
65
- s.params.contactCategory
66
- ].filter((f) => !!f),
67
- searchPhrase: s.params.phrase
68
- })
69
- ).then(a).catch((o) => {
70
- if (o)
71
- return a(o);
72
- }));
73
- })).then(() => {
74
- u();
75
- });
76
- }, S = O;
11
+ );
12
+ }, p = i;
77
13
  export {
78
- S as default
14
+ p as default
79
15
  };
80
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/notification-row-component.ts"],"sourcesContent":["import {\n createEventSubscriber,\n extendComponent,\n Notification,\n} from '@telia-ace/knowledge-widget-core';\nimport { DataClient, DataType, NotificationResults } from '@telia-ace/knowledge-widget-types-grid';\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\nimport { Container, Widget } from '@webprovisions/platform';\n\ntype NotificationType = 'top' | 'middle' | 'bottom';\nexport type NotificationRowComponentProps = {\n types: NotificationType[];\n allowPaging?: boolean;\n notifications?: Notification[]; // internal\n expandable?: boolean;\n pageNextAriaLabel?: string;\n pagePreviousAriaLabel?: string;\n closeAriaLabel?: string;\n expandAriaLabel?: string;\n};\n\ntype FetchResults = NotificationResults & { error: any };\n\nexport const NotificationRowComponent = (container: Container) => {\n const { events }: Widget = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n return createReactComponent(\n container,\n 'notification-row',\n import('./notification-row'),\n (component) => {\n const fetch = (params: { [key: string]: any }) => {\n component.writeProperties({\n ...component.properties<NotificationRowComponentProps>(),\n loading: true,\n error: undefined,\n notifications: [],\n });\n component.actions.dispatch('fetch', { params });\n };\n\n component.actions.create(\n 'fetch',\n ({\n error,\n topNotifications,\n bottomNotifications,\n middleNotifications,\n }: FetchResults) => {\n if (error) {\n return component.actions.dispatch('fetched', {\n error,\n loading: true,\n notifications: [],\n });\n }\n\n let newNotifications: Notification[] = [];\n const { notifications, types = [] } =\n component.properties<NotificationRowComponentProps>();\n if (types.length) {\n if (types.indexOf('top') > -1) {\n newNotifications = newNotifications.concat(topNotifications);\n }\n if (types.indexOf('middle') > -1) {\n newNotifications = newNotifications.concat(middleNotifications);\n }\n if (types.indexOf('bottom') > -1) {\n newNotifications = newNotifications.concat(bottomNotifications);\n }\n } else {\n newNotifications = topNotifications;\n }\n\n return component.actions.dispatch('fetched', {\n notifications: newNotifications.length ? newNotifications : notifications,\n loading: false,\n });\n }\n );\n\n component.actions.create('fetched', (input) => {\n return component.writeProperties({ ...input, loading: false });\n });\n\n container.getAsync('router').then((router) => {\n const { params } = router.getRouteData();\n fetch(params);\n });\n\n subscribe('router:changed', (event: any, { current }: any) => {\n fetch(current.routeData.params);\n });\n\n return () => {\n unsubscribe();\n };\n }\n )\n .then(() => {\n return extendComponent(container, 'notification-row', (component) => {\n component.actions.watch('notification-row.fetch', (input, next) => {\n return container\n .getAsync('dataClient')\n .then((dataClient: DataClient) =>\n dataClient.fetch(DataType.RowNotifications, {\n categories: [\n input.params.guideCategory,\n input.params.contactCategory,\n ].filter((c) => !!c),\n searchPhrase: input.params.phrase,\n })\n )\n .then(next)\n .catch((error) => {\n if (error) {\n return next(error);\n }\n });\n });\n });\n })\n .then(() => {\n unsubscribe();\n });\n};\n\nexport default NotificationRowComponent;\n"],"names":["NotificationRowComponent","container","events","subscribe","unsubscribe","createEventSubscriber","createReactComponent","component","fetch","params","__spreadProps","__spreadValues","error","topNotifications","bottomNotifications","middleNotifications","newNotifications","notifications","types","input","router","event","current","extendComponent","next","dataClient","DataType","c","NotificationRowComponent$1"],"mappings":";;;;;;;;;;;;;;;AAuBa,MAAAA,IAA2B,CAACC,MAAyB;AAC9D,QAAM,EAAE,QAAAC,EAAmB,IAAAD,EAAU,IAAI,SAAS,GAC5C,CAACE,GAAWC,CAAW,IAAIC,EAAsBH,CAAM;AAEtD,SAAAI;AAAA,IACHL;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,CAACM,MAAc;AACL,YAAAC,IAAQ,CAACC,MAAmC;AAC9C,QAAAF,EAAU,gBAAgBG,EAAAC,EAAA,IACnBJ,EAAU,WAA0C,IADjC;AAAA,UAEtB,SAAS;AAAA,UACT,OAAO;AAAA,UACP,eAAe,CAAC;AAAA,QAAA,EACnB,GACDA,EAAU,QAAQ,SAAS,SAAS,EAAE,QAAAE,EAAQ,CAAA;AAAA,MAAA;AAGlD,aAAAF,EAAU,QAAQ;AAAA,QACd;AAAA,QACA,CAAC;AAAA,UACG,OAAAK;AAAA,UACA,kBAAAC;AAAA,UACA,qBAAAC;AAAA,UACA,qBAAAC;AAAA,QAAA,MACgB;AAChB,cAAIH;AACO,mBAAAL,EAAU,QAAQ,SAAS,WAAW;AAAA,cACzC,OAAAK;AAAA,cACA,SAAS;AAAA,cACT,eAAe,CAAC;AAAA,YAAA,CACnB;AAGL,cAAII,IAAmC,CAAA;AACvC,gBAAM,EAAE,eAAAC,GAAe,OAAAC,IAAQ,CAAG,EAAA,IAC9BX,EAAU;AACd,iBAAIW,EAAM,UACFA,EAAM,QAAQ,KAAK,IAAI,OACJF,IAAAA,EAAiB,OAAOH,CAAgB,IAE3DK,EAAM,QAAQ,QAAQ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ACT,GAEAwB,IAAe5B;"}
1
+ {"version":3,"file":"index.js","sources":["../src/notification-row-component.ts"],"sourcesContent":["import { createEventSubscriber } from '@telia-ace/knowledge-widget-core';\nimport { createWebComponent } from '@telia-ace/widget-ui';\n// import { createWebComponent } from '@telia-ace/knowledge-widget-ui';\nimport { Container, Widget } from '@webprovisions/platform';\n\n// const NotificationRowComponent = (container: Container) => {\n// return createWebComponent(\n// container,\n// 'notification-row',\n// import('./notification-row-wrapper')\n// );\n// };\n\ntype NotificationType = 'top' | 'middle' | 'bottom';\nexport type NotificationRowComponentProps = {\n types: NotificationType[];\n allowPaging?: boolean;\n notifications?: Notification[]; // internal\n expandable?: boolean;\n pageNextAriaLabel?: string;\n pagePreviousAriaLabel?: string;\n closeAriaLabel?: string;\n expandAriaLabel?: string;\n};\n\nexport const NotificationRowComponent = (container: Container) => {\n const { events }: Widget = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n return createWebComponent(\n container,\n 'notification-row',\n import('./notification-row-wrapper'),\n (component: any) => {}\n );\n};\n\nexport default NotificationRowComponent;\n\n// import {\n// createEventSubscriber,\n// extendComponent,\n// Notification,\n// } from '@telia-ace/knowledge-widget-core';\n// import { DataClient, DataType, NotificationResults } from '@telia-ace/knowledge-widget-types-grid';\n// import { createReactComponent } from '@telia-ace/knowledge-widget-ui';\n// import { Container, Widget } from '@webprovisions/platform';\n\n// type NotificationType = 'top' | 'middle' | 'bottom';\n// export type NotificationRowComponentProps = {\n// types: NotificationType[];\n// allowPaging?: boolean;\n// notifications?: Notification[]; // internal\n// expandable?: boolean;\n// pageNextAriaLabel?: string;\n// pagePreviousAriaLabel?: string;\n// closeAriaLabel?: string;\n// expandAriaLabel?: string;\n// };\n\n// type FetchResults = NotificationResults & { error: any };\n\n// export const NotificationRowComponent = (container: Container) => {\n// const { events }: Widget = container.get('$widget');\n// const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n// return createReactComponent(\n// container,\n// 'notification-row',\n// import('./notification-row'),\n// (component) => {\n// const fetch = (params: { [key: string]: any }) => {\n// component.writeProperties({\n// ...component.properties<NotificationRowComponentProps>(),\n// loading: true,\n// error: undefined,\n// notifications: [],\n// });\n// component.actions.dispatch('fetch', { params });\n// };\n\n// component.actions.create(\n// 'fetch',\n// ({\n// error,\n// topNotifications,\n// bottomNotifications,\n// middleNotifications,\n// }: FetchResults) => {\n// if (error) {\n// return component.actions.dispatch('fetched', {\n// error,\n// loading: true,\n// notifications: [],\n// });\n// }\n\n// let newNotifications: Notification[] = [];\n// const { notifications, types = [] } =\n// component.properties<NotificationRowComponentProps>();\n// if (types.length) {\n// if (types.indexOf('top') > -1) {\n// newNotifications = newNotifications.concat(topNotifications);\n// }\n// if (types.indexOf('middle') > -1) {\n// newNotifications = newNotifications.concat(middleNotifications);\n// }\n// if (types.indexOf('bottom') > -1) {\n// newNotifications = newNotifications.concat(bottomNotifications);\n// }\n// } else {\n// newNotifications = topNotifications;\n// }\n\n// return component.actions.dispatch('fetched', {\n// notifications: newNotifications.length ? newNotifications : notifications,\n// loading: false,\n// });\n// }\n// );\n\n// component.actions.create('fetched', (input) => {\n// return component.writeProperties({ ...input, loading: false });\n// });\n\n// container.getAsync('router').then((router) => {\n// const { params } = router.getRouteData();\n// fetch(params);\n// });\n\n// subscribe('router:changed', (event: any, { current }: any) => {\n// fetch(current.routeData.params);\n// });\n\n// return () => {\n// unsubscribe();\n// };\n// }\n// )\n// .then(() => {\n// return extendComponent(container, 'notification-row', (component) => {\n// component.actions.watch('notification-row.fetch', (input, next) => {\n// return container\n// .getAsync('dataClient')\n// .then((dataClient: DataClient) =>\n// dataClient.fetch(DataType.RowNotifications, {\n// categories: [\n// input.params.guideCategory,\n// input.params.contactCategory,\n// ].filter((c) => !!c),\n// searchPhrase: input.params.phrase,\n// })\n// )\n// .then(next)\n// .catch((error) => {\n// if (error) {\n// return next(error);\n// }\n// });\n// });\n// });\n// })\n// .then(() => {\n// unsubscribe();\n// });\n// };\n\n// export default NotificationRowComponent;\n"],"names":["NotificationRowComponent","container","events","createEventSubscriber","createWebComponent","component","NotificationRowComponent$1"],"mappings":";;AAyBa,MAAAA,IAA2B,CAACC,MAAyB;AAC9D,QAAM,EAAE,QAAAC,EAAmB,IAAAD,EAAU,IAAI,SAAS;AACjB,SAAAE,EAAsBD,CAAM,GAEtDE;AAAA,IACHH;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,CAACI,MAAmB;AAAA,IAAC;AAAA,EAAA;AAE7B,GAEAC,IAAeN;"}
@@ -1,4 +1,3 @@
1
- import { Notification } from '@telia-ace/knowledge-widget-core';
2
1
  import { Container } from '@webprovisions/platform';
3
2
  type NotificationType = 'top' | 'middle' | 'bottom';
4
3
  export type NotificationRowComponentProps = {
@@ -0,0 +1,20 @@
1
+ import { ReactiveControllerHost } from 'lit';
2
+ import { ComponentNode } from '@telia-ace/knowledge-widget-core';
3
+ import { Container } from '@webprovisions/platform';
4
+ declare class DataProvider {
5
+ private _host;
6
+ node: ComponentNode | undefined;
7
+ nodeId: string;
8
+ container: Container | undefined;
9
+ constructor(elem: HTMLElement);
10
+ initialize(): Promise<void>;
11
+ _requestInstance(key: string): any;
12
+ }
13
+ export declare class NotificationRowDataProvider extends DataProvider {
14
+ host: ReactiveControllerHost;
15
+ constructor(host: ReactiveControllerHost);
16
+ hostConnected(): void;
17
+ initialize(): Promise<void>;
18
+ _fetch(): Promise<void>;
19
+ }
20
+ export {};
@@ -0,0 +1,366 @@
1
+ var P = Object.defineProperty, C = Object.defineProperties;
2
+ var A = Object.getOwnPropertyDescriptors;
3
+ var y = Object.getOwnPropertySymbols, k = Object.getPrototypeOf, L = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, O = Reflect.get;
4
+ var w = (a, t, e) => t in a ? P(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, b = (a, t) => {
5
+ for (var e in t || (t = {}))
6
+ L.call(t, e) && w(a, e, t[e]);
7
+ if (y)
8
+ for (var e of y(t))
9
+ z.call(t, e) && w(a, e, t[e]);
10
+ return a;
11
+ }, f = (a, t) => C(a, A(t));
12
+ var m = (a, t, e) => O(k(a), e, t);
13
+ var h = (a, t, e) => new Promise((o, i) => {
14
+ var l = (d) => {
15
+ try {
16
+ c(e.next(d));
17
+ } catch (u) {
18
+ i(u);
19
+ }
20
+ }, n = (d) => {
21
+ try {
22
+ c(e.throw(d));
23
+ } catch (u) {
24
+ i(u);
25
+ }
26
+ }, c = (d) => d.done ? o(d.value) : Promise.resolve(d.value).then(l, n);
27
+ c((e = e.apply(a, t)).next());
28
+ });
29
+ import { ComponentPlatform as I } from "@telia-ace/knowledge-widget-core";
30
+ import { WidgetComponentMixin as E, NodeConnector as N } from "@telia-ace/widget-ui";
31
+ import { LitElement as S, nothing as v, html as g, css as D } from "lit";
32
+ import { property as p, state as $ } from "lit/decorators.js";
33
+ import { classMap as _ } from "lit/directives/class-map.js";
34
+ class B {
35
+ constructor(t) {
36
+ this.nodeId = "", this._host = t;
37
+ }
38
+ initialize() {
39
+ return h(this, null, function* () {
40
+ if (this.nodeId = this._host.getAttribute("nodeId"), !this.nodeId) {
41
+ console.warn("Could not get node id in DataProvider.");
42
+ return;
43
+ }
44
+ if (this.container = this._requestInstance("container"), !this.container) {
45
+ console.warn("Could not get data in DataProvider. Container was not defined.");
46
+ return;
47
+ }
48
+ const t = yield I.getInstance(this.container);
49
+ if (this.node = t.nodes.get(this.nodeId), !this.node) {
50
+ console.warn(`Could not get component node with ID: ${this.nodeId}.`);
51
+ return;
52
+ }
53
+ });
54
+ }
55
+ _requestInstance(t) {
56
+ const e = new CustomEvent("request-instance", {
57
+ detail: { key: t },
58
+ bubbles: !0,
59
+ composed: !0,
60
+ cancelable: !0
61
+ });
62
+ return this._host.dispatchEvent(e), e.detail.instance;
63
+ }
64
+ }
65
+ class x extends B {
66
+ constructor(t) {
67
+ super(t), (this.host = t).addController(this);
68
+ }
69
+ hostConnected() {
70
+ this.initialize();
71
+ }
72
+ initialize() {
73
+ return h(this, null, function* () {
74
+ yield m(x.prototype, this, "initialize").call(this), this._fetch();
75
+ });
76
+ }
77
+ _fetch() {
78
+ return h(this, null, function* () {
79
+ var c;
80
+ if (!this.node)
81
+ return;
82
+ this.node.writeProperties(f(b({}, this.node.attributes.properties), {
83
+ loading: !0,
84
+ error: void 0,
85
+ notifications: []
86
+ }));
87
+ const {
88
+ topNotifications: t = [],
89
+ bottomNotifications: e = [],
90
+ middleNotifications: o = []
91
+ } = yield (c = this.container) == null ? void 0 : c.getAsync("dataClient").then((d) => d.fetch("row-notices", {}));
92
+ let i = [];
93
+ const { notifications: l, types: n = [] } = this.node.attributes.properties;
94
+ n.length ? (n.indexOf("top") > -1 && (i = i.concat(t)), n.indexOf("middle") > -1 && (i = i.concat(o)), n.indexOf("bottom") > -1 && (i = i.concat(e))) : i = t, this.node.writeProperties(f(b({}, this.node.attributes.properties), {
95
+ loading: !1,
96
+ error: void 0,
97
+ notifications: i.length ? i : l
98
+ }));
99
+ });
100
+ }
101
+ }
102
+ var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (a, t, e, o) => {
103
+ for (var i = o > 1 ? void 0 : o ? q(t, e) : t, l = a.length - 1, n; l >= 0; l--)
104
+ (n = a[l]) && (i = (o ? n(t, e, i) : n(i)) || i);
105
+ return o && i && j(t, e, i), i;
106
+ };
107
+ class r extends S {
108
+ constructor() {
109
+ super(...arguments), this._allowPaging = !1, this._expandable = !1, this._closeAriaLabel = "", this._pageNextAriaLabel = "", this._expandAriaLabel = "", this._pagePreviousAriaLabel = "", this._types = [], this._notifications = [], this.closed = [], this.expanded = !1, this.index = 0;
110
+ }
111
+ connectedCallback() {
112
+ super.connectedCallback();
113
+ }
114
+ _toggleExpand() {
115
+ this.expanded = !this.expanded;
116
+ }
117
+ getBackgroundColor() {
118
+ return this._types.length ? this._types.indexOf("top") > -1 ? "--colors-warning" : this._types.indexOf("bottom") > -1 ? "--colors-transparent" : "--colors-primary" : "--colors-warning";
119
+ }
120
+ render() {
121
+ this.style.setProperty(
122
+ "--notification-row-background-default",
123
+ `var(${this.getBackgroundColor()})`
124
+ );
125
+ const t = this._notifications.filter(({ id: o }) => this.closed.indexOf(o) === -1);
126
+ if (!t.length)
127
+ return v;
128
+ const e = {
129
+ "humany-notification-row": !0,
130
+ "notification-row": !0,
131
+ expandable: this._expandable,
132
+ expanded: this.expanded,
133
+ "not-expandable": this._expandable && !this.expanded
134
+ };
135
+ if (this._allowPaging = !0, this._allowPaging) {
136
+ const o = t[this.index] || t[this.index + 1] || t[this.index - 1], { id: i, body: l } = o || {};
137
+ return g`
138
+ <!-- onKeyDown={(e: React.KeyboardEvent) => {
139
+ if (e.key === 'Enter') {
140
+ toggleExpand();
141
+ }
142
+ }}
143
+ onClick={toggleExpand} -->
144
+ <div
145
+ class=${_(e)}
146
+ part="container"
147
+ data-expandable=${this._expandable}
148
+ data-allow-paging=${this._allowPaging}
149
+ aria-expanded=${this._expandable ? this.expanded : !0}
150
+ aria-label=${this._expandAriaLabel}
151
+ tabindex=${this._expandable ? 0 : -1}
152
+ @click=${() => {
153
+ this._toggleExpand();
154
+ }}
155
+ >
156
+ <ui-button
157
+ class="notification-row-close-button"
158
+ part="close-button"
159
+ aria-label=${this._closeAriaLabel}
160
+ @click=${() => {
161
+ this.index = t.indexOf(o), this.closed = [...this.closed, i];
162
+ }}
163
+ >
164
+ <ui-symbol-badge .symbol=${{ type: "Svg", content: "close" }} />
165
+ </ui-button>
166
+ <ui-html
167
+ data-pageable=${length > 1}
168
+ data-notification=${i}
169
+ data-expandable=${this._expandable}
170
+ data-expanded=${this.expanded}
171
+ .html=${l}
172
+ />
173
+ <div class="notification-row-pager" part="pager">
174
+ <ui-button
175
+ aria-label=${this._pagePreviousAriaLabel}
176
+ data-disabled=${this.index === 0}
177
+ @click=${(n) => {
178
+ n.stopPropagation(), this.index > 0 && (this.index -= 1);
179
+ }}
180
+ part="arrow-button"
181
+ >
182
+ <ui-symbol-badge
183
+ .size=${10}
184
+ .symbol=${{ type: "Svg", content: "caret-left" }}
185
+ part="arrow-icon"
186
+ />
187
+ </ui-button>
188
+ <span> ${this.index + 1}/${t.length} </span>
189
+ <ui-button
190
+ aria-label=${this._pageNextAriaLabel}
191
+ data-disabled=${this.index + 1 >= t.length}
192
+ @click=${(n) => {
193
+ n.stopPropagation(), this.index < t.length - 1 && (this.index += 1);
194
+ }}
195
+ part="arrow-button"
196
+ >
197
+ <ui-symbol-badge
198
+ .size=${10}
199
+ .symbol=${{ type: "Svg", content: "caret-right" }}
200
+ part="arrow-icon"
201
+ />
202
+ </ui-button>
203
+ </div>
204
+ </div>
205
+ `;
206
+ }
207
+ return g`
208
+ <div part="container" class=${_(e)} data-expandable=${this._expandable}>
209
+ ${t.map((o) => o ? g` <ui-html .html=${o.body} /> ` : v)}
210
+ </div>
211
+ `;
212
+ }
213
+ }
214
+ r.styles = [
215
+ D`
216
+ :host::part(close-button) {
217
+ position: absolute;
218
+ top: 7.5px;
219
+ right: 7.5px;
220
+ width: 25px;
221
+ height: auto;
222
+ padding: calc(var(--size-small) / 2) var(--size-small);
223
+ }
224
+
225
+ :host::part(pager) {
226
+ text-align: center;
227
+ width: 100%;
228
+ }
229
+
230
+ :host::part(pager) span {
231
+ font-size: var(--fonts-small);
232
+ display: inline-block;
233
+ width: 30px;
234
+ text-align: center;
235
+ }
236
+
237
+ i {
238
+ color: var(--colors-text);
239
+ }
240
+
241
+ a {
242
+ color: var(--colors-link);
243
+ }
244
+
245
+ .notification-row {
246
+ padding: var(--size-normal) calc(var(--cardinal) * 12);
247
+ text-align: center;
248
+ display: flex;
249
+ flex-direction: column;
250
+ position: relative;
251
+ overflow: hidden;
252
+ background-color: var(
253
+ --notification-row-background,
254
+ var(--notification-row-background-default)
255
+ );
256
+ color: var(--colors-text);
257
+ border-radius: var(--borderRadius);
258
+ }
259
+
260
+ .notification-row.expandable {
261
+ cursor: pointer;
262
+ }
263
+
264
+ .notification-row.not-expandable ui-html {
265
+ max-width: 100%;
266
+ }
267
+
268
+ .notification-row.not-expandable ui-html p {
269
+ display: none;
270
+ }
271
+ .notification-row.not-expandable ui-html p:first-child {
272
+ display: block;
273
+ margin-bottom: 0;
274
+ white-space: nowrap;
275
+ overflow: hidden;
276
+ text-overflow: ellipsis;
277
+ }
278
+
279
+ .notification-row[data-allow-paging='false'] {
280
+ flex-wrap: wrap;
281
+ }
282
+ .notification-row[data-allow-paging='false'] > div {
283
+ min-width: 100%;
284
+ margin: var(--cardinal * 2);
285
+ }
286
+
287
+ ui-html {
288
+ flex: 1;
289
+ font-size: var(--fonts-normal);
290
+ line-height: 1.6em;
291
+ font-weight: 300;
292
+ }
293
+
294
+ ui-button::part(container) {
295
+ background-color: transparent;
296
+ border: none;
297
+ cursor: pointer;
298
+ transition: opacity 200ms ease-out;
299
+ justify-self: flex-end;
300
+ align-self: flex-start;
301
+ padding: var(--size-small);
302
+ }
303
+
304
+ ui-button::part(container):focus-visible {
305
+ outline: var(--accessibility-border);
306
+ color: var(--accessibility-colors-inactiveText);
307
+ border-color: transparent;
308
+ }
309
+
310
+ ui-button::part(container[data-disabled]) {
311
+ display: none;
312
+ }
313
+
314
+ ui-button[data-disabled='true']::part(container) {
315
+ opacity: 0.8;
316
+ }
317
+
318
+ @media (hover: hover) {
319
+ ui-button[data-disabled='false']:hover::part(container) {
320
+ opacity: 0.5;
321
+ }
322
+ }
323
+ `
324
+ ];
325
+ s([
326
+ p({ type: Boolean })
327
+ ], r.prototype, "_allowPaging", 2);
328
+ s([
329
+ p({ type: Boolean })
330
+ ], r.prototype, "_expandable", 2);
331
+ s([
332
+ p({ type: String })
333
+ ], r.prototype, "_closeAriaLabel", 2);
334
+ s([
335
+ p({ type: String })
336
+ ], r.prototype, "_pageNextAriaLabel", 2);
337
+ s([
338
+ p({ type: String })
339
+ ], r.prototype, "_expandAriaLabel", 2);
340
+ s([
341
+ p({ type: String })
342
+ ], r.prototype, "_pagePreviousAriaLabel", 2);
343
+ s([
344
+ p({ type: Array })
345
+ ], r.prototype, "_types", 2);
346
+ s([
347
+ p({ type: Array })
348
+ ], r.prototype, "_notifications", 2);
349
+ s([
350
+ $()
351
+ ], r.prototype, "closed", 2);
352
+ s([
353
+ p({ reflect: !0 })
354
+ ], r.prototype, "expanded", 2);
355
+ s([
356
+ $()
357
+ ], r.prototype, "index", 2);
358
+ class G extends E(r) {
359
+ constructor() {
360
+ super(), this.connector = new N(this), this.dataProvider = new x(this);
361
+ }
362
+ }
363
+ export {
364
+ G as default
365
+ };
366
+ //# sourceMappingURL=notification-row-wrapper.297e86c1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-row-wrapper.297e86c1.js","sources":["../src/notification-row-data-provider.ts","../src/notification-row.ts","../src/notification-row-wrapper.ts"],"sourcesContent":["import { ReactiveControllerHost } from 'lit';\n// import { DataProvider } from 'types-web';\nimport { ComponentNode, ComponentPlatform } from '@telia-ace/knowledge-widget-core';\nimport { Container } from '@webprovisions/platform';\n\nclass DataProvider {\n private _host: HTMLElement;\n node: ComponentNode | undefined;\n nodeId: string = '';\n container: Container | undefined;\n\n constructor(elem: HTMLElement) {\n this._host = elem;\n }\n\n async initialize() {\n this.nodeId = (this._host as any).getAttribute('nodeId');\n\n if (!this.nodeId) {\n console.warn('Could not get node id in DataProvider.');\n return;\n }\n\n this.container = this._requestInstance('container');\n\n if (!this.container) {\n console.warn('Could not get data in DataProvider. Container was not defined.');\n return;\n }\n const platform = await ComponentPlatform.getInstance(this.container);\n this.node = platform.nodes.get(this.nodeId);\n\n if (!this.node) {\n console.warn(`Could not get component node with ID: ${this.nodeId}.`);\n return;\n }\n }\n\n _requestInstance(key: string) {\n const event = new CustomEvent<{ key: string; instance?: any }>('request-instance', {\n detail: { key },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n (this._host as any).dispatchEvent(event);\n\n return event.detail.instance;\n }\n}\n\nexport class NotificationRowDataProvider extends DataProvider {\n host;\n\n constructor(host: ReactiveControllerHost) {\n super(host as any);\n (this.host = host).addController(this);\n }\n\n hostConnected() {\n this.initialize();\n }\n\n async initialize() {\n await super.initialize();\n\n this._fetch();\n }\n\n async _fetch() {\n if (!this.node) {\n return;\n }\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: true,\n error: undefined,\n notifications: [],\n });\n\n const {\n topNotifications = [],\n bottomNotifications = [],\n middleNotifications = [],\n } = await this.container?.getAsync('dataClient').then((dataClient) => {\n return dataClient.fetch('row-notices', {\n // categories: [ TODO: missing\n // input.params.guideCategory,\n // input.params.contactCategory,\n // ].filter((c) => !!c),\n // searchPhrase: input.params.phrase,\n });\n });\n\n let newNotifications: Notification[] = [];\n const { notifications, types = [] } = this.node.attributes.properties;\n if (types.length) {\n if (types.indexOf('top') > -1) {\n newNotifications = newNotifications.concat(topNotifications);\n }\n if (types.indexOf('middle') > -1) {\n newNotifications = newNotifications.concat(middleNotifications);\n }\n if (types.indexOf('bottom') > -1) {\n newNotifications = newNotifications.concat(bottomNotifications);\n }\n } else {\n newNotifications = topNotifications;\n }\n\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: false,\n error: undefined,\n notifications: newNotifications.length ? newNotifications : notifications,\n });\n }\n}\n","import { css, html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport default class NotificationRow extends LitElement {\n @property({ type: Boolean })\n _allowPaging = false;\n\n @property({ type: Boolean })\n _expandable = false;\n\n @property({ type: String })\n _closeAriaLabel = '';\n\n @property({ type: String })\n _pageNextAriaLabel = '';\n\n @property({ type: String })\n _expandAriaLabel = '';\n\n @property({ type: String })\n _pagePreviousAriaLabel = '';\n\n @property({ type: Array })\n _types: string[] = [];\n\n @property({ type: Array })\n _notifications: any[] = []; // TODO: no any\n\n @state() closed: string[] = [];\n\n @property({ reflect: true }) expanded = false;\n\n @state() index = 0;\n\n // const CloseButton = styled(StyledButton)`\n // svg {\n // vertical-align: middle;\n // line,\n // path {\n // stroke: ${(p) => p.theme.colors?.text};\n // }\n // }\n // `;\n\n static styles = [\n // genericHtml,\n css`\n :host::part(close-button) {\n position: absolute;\n top: 7.5px;\n right: 7.5px;\n width: 25px;\n height: auto;\n padding: calc(var(--size-small) / 2) var(--size-small);\n }\n\n :host::part(pager) {\n text-align: center;\n width: 100%;\n }\n\n :host::part(pager) span {\n font-size: var(--fonts-small);\n display: inline-block;\n width: 30px;\n text-align: center;\n }\n\n i {\n color: var(--colors-text);\n }\n\n a {\n color: var(--colors-link);\n }\n\n .notification-row {\n padding: var(--size-normal) calc(var(--cardinal) * 12);\n text-align: center;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n background-color: var(\n --notification-row-background,\n var(--notification-row-background-default)\n );\n color: var(--colors-text);\n border-radius: var(--borderRadius);\n }\n\n .notification-row.expandable {\n cursor: pointer;\n }\n\n .notification-row.not-expandable ui-html {\n max-width: 100%;\n }\n\n .notification-row.not-expandable ui-html p {\n display: none;\n }\n .notification-row.not-expandable ui-html p:first-child {\n display: block;\n margin-bottom: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .notification-row[data-allow-paging='false'] {\n flex-wrap: wrap;\n }\n .notification-row[data-allow-paging='false'] > div {\n min-width: 100%;\n margin: var(--cardinal * 2);\n }\n\n ui-html {\n flex: 1;\n font-size: var(--fonts-normal);\n line-height: 1.6em;\n font-weight: 300;\n }\n\n ui-button::part(container) {\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: opacity 200ms ease-out;\n justify-self: flex-end;\n align-self: flex-start;\n padding: var(--size-small);\n }\n\n ui-button::part(container):focus-visible {\n outline: var(--accessibility-border);\n color: var(--accessibility-colors-inactiveText);\n border-color: transparent;\n }\n\n ui-button::part(container[data-disabled]) {\n display: none;\n }\n\n ui-button[data-disabled='true']::part(container) {\n opacity: 0.8;\n }\n\n @media (hover: hover) {\n ui-button[data-disabled='false']:hover::part(container) {\n opacity: 0.5;\n }\n }\n `,\n ];\n\n connectedCallback() {\n super.connectedCallback();\n }\n\n private _toggleExpand() {\n this.expanded = !this.expanded;\n }\n\n private getBackgroundColor() {\n if (this._types.length) {\n if (this._types.indexOf('top') > -1) {\n return '--colors-warning';\n } else if (this._types.indexOf('bottom') > -1) {\n return '--colors-transparent';\n }\n return '--colors-primary';\n }\n return '--colors-warning';\n }\n\n render() {\n this.style.setProperty(\n '--notification-row-background-default',\n `var(${this.getBackgroundColor()})`\n );\n\n const filtered = this._notifications.filter(({ id }) => this.closed.indexOf(id) === -1);\n\n if (!filtered.length) {\n return nothing;\n }\n const classes = {\n 'humany-notification-row': true,\n 'notification-row': true,\n expandable: this._expandable,\n expanded: this.expanded,\n 'not-expandable': this._expandable && !this.expanded,\n };\n\n this._allowPaging = true;\n\n if (this._allowPaging) {\n const notification =\n filtered[this.index] || filtered[this.index + 1] || filtered[this.index - 1];\n\n const { id, body } = notification || {};\n\n return html`\n <!-- onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n toggleExpand();\n }\n }}\n onClick={toggleExpand} -->\n <div\n class=${classMap(classes)}\n part=\"container\"\n data-expandable=${this._expandable}\n data-allow-paging=${this._allowPaging}\n aria-expanded=${this._expandable ? this.expanded : true}\n aria-label=${this._expandAriaLabel}\n tabindex=${this._expandable ? 0 : -1}\n @click=${() => {\n this._toggleExpand();\n }}\n >\n <ui-button\n class=\"notification-row-close-button\"\n part=\"close-button\"\n aria-label=${this._closeAriaLabel}\n @click=${() => {\n this.index = filtered.indexOf(notification);\n this.closed = [...this.closed, id];\n }}\n >\n <ui-symbol-badge .symbol=${{ type: 'Svg', content: 'close' }} />\n </ui-button>\n <ui-html\n data-pageable=${length > 1}\n data-notification=${id}\n data-expandable=${this._expandable}\n data-expanded=${this.expanded}\n .html=${body}\n />\n <div class=\"notification-row-pager\" part=\"pager\">\n <ui-button\n aria-label=${this._pagePreviousAriaLabel}\n data-disabled=${this.index === 0}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index > 0) {\n this.index -= 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-left' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n <span> ${this.index + 1}/${filtered.length} </span>\n <ui-button\n aria-label=${this._pageNextAriaLabel}\n data-disabled=${this.index + 1 >= filtered.length}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index < filtered.length - 1) {\n this.index += 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-right' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n </div>\n </div>\n `;\n }\n\n // data-pageable=\"false\"\n // data-types=${types}\n // data-allow-paging=\"false\"\n // className={appendClassNames(className, 'humany-notification-row')}\n return html`\n <div part=\"container\" class=${classMap(classes)} data-expandable=${this._expandable}>\n ${filtered.map((notification) => {\n if (!notification) {\n return nothing;\n }\n\n return html` <ui-html .html=${notification.body} /> `;\n })}\n </div>\n `;\n }\n}\n","// import { NodeConnector, WidgetComponentMixin } from '@telia-ace/knowledge-widget-ui';\n// import NotificationRow from './notification-row';\nimport { NotificationRowDataProvider } from './notification-row-data-provider';\n\nimport { NodeConnector, WidgetComponentMixin } from '@telia-ace/widget-ui';\nimport NotificationRow from './notification-row';\n\n// type Constructor<T = {}> = new (...args: any[]) => T;\n// type TestType = <T extends Constructor<LitElement>>(Base: T);\n\nexport default class NotificationRowWrapper extends WidgetComponentMixin(NotificationRow) {\n connector = new NodeConnector(this);\n dataProvider = new NotificationRowDataProvider(this);\n\n constructor() {\n super();\n }\n}\n"],"names":["DataProvider","elem","__async","platform","ComponentPlatform","key","event","NotificationRowDataProvider","host","__superGet","__spreadProps","__spreadValues","topNotifications","bottomNotifications","middleNotifications","_a","dataClient","newNotifications","notifications","types","NotificationRow","LitElement","filtered","id","nothing","classes","notification","body","html","classMap","e","css","__decorateClass","property","state","NotificationRowWrapper","WidgetComponentMixin","NodeConnector"],"mappings":";;;;;;;;;;;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3BVb,EA2BY,WAAA,YAAA,CAAA;AAEpBY,EAAA;AAAA,EAARE,EAAM;AAAA,GA7BUd,EA6BR,WAAA,SAAA,CAAA;ACvBQ,MAAAe,UAA+BC,EAAqBhB,CAAe,EAAE;AAAA,EAItF,cAAc;AACJ,aAJE,KAAA,YAAA,IAAIiB,EAAc,IAAI,GACnB,KAAA,eAAA,IAAI9B,EAA4B,IAAI;AAAA,EAInD;AACJ;"}
@@ -0,0 +1,10 @@
1
+ import { NotificationRowDataProvider } from './notification-row-data-provider';
2
+ import { NodeConnector } from '@telia-ace/widget-ui';
3
+ import NotificationRow from './notification-row';
4
+ declare const NotificationRowWrapper_base: import("@telia-ace/widget-ui").WidgetComponentConstructor<import("@telia-ace/widget-ui/dist/mixins/widget-component").WidgetComponentInterface> & typeof NotificationRow;
5
+ export default class NotificationRowWrapper extends NotificationRowWrapper_base {
6
+ connector: NodeConnector;
7
+ dataProvider: NotificationRowDataProvider;
8
+ constructor();
9
+ }
10
+ export {};
@@ -1,6 +1,19 @@
1
- import React from 'react';
2
- type Props = {
3
- className: string;
4
- };
5
- declare const NotificationRow: React.FC<Props>;
6
- export default NotificationRow;
1
+ import { LitElement, nothing } from 'lit';
2
+ export default class NotificationRow extends LitElement {
3
+ _allowPaging: boolean;
4
+ _expandable: boolean;
5
+ _closeAriaLabel: string;
6
+ _pageNextAriaLabel: string;
7
+ _expandAriaLabel: string;
8
+ _pagePreviousAriaLabel: string;
9
+ _types: string[];
10
+ _notifications: any[];
11
+ closed: string[];
12
+ expanded: boolean;
13
+ index: number;
14
+ static styles: import("lit").CSSResult[];
15
+ connectedCallback(): void;
16
+ private _toggleExpand;
17
+ private getBackgroundColor;
18
+ render(): typeof nothing | import("lit").TemplateResult<1>;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-notification-row",
3
- "version": "1.0.38-experimental.0",
3
+ "version": "1.0.38-experimental.1",
4
4
  "description": "Notification row component for ACE Knowledge Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -21,16 +21,18 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@telia-ace/knowledge-widget-core": "^1.0.34-experimental.0",
25
- "@telia-ace/knowledge-widget-types-grid": "^1.0.45-experimental.0",
26
- "@telia-ace/knowledge-widget-ui": "^1.0.40-experimental.0",
27
- "@telia-ace/widget-services": "^1.0.21-experimental.0",
28
- "@telia-ace/widget-utilities": "^1.0.10-experimental.0",
24
+ "@telia-ace/knowledge-widget-core": "1.0.34-experimental.1",
25
+ "@telia-ace/knowledge-widget-types-grid": "1.0.45-experimental.1",
26
+ "@telia-ace/knowledge-widget-ui": "1.0.40-experimental.1",
27
+ "@telia-ace/widget-services": "^1.0.21-experimental.13",
28
+ "@telia-ace/widget-ui": "^1.0.28-experimental.13",
29
+ "@telia-ace/widget-utilities": "^1.0.10-experimental.13",
29
30
  "@webprovisions/platform": "^1.1.2"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "@emotion/react": "^11.10.5",
33
34
  "@emotion/styled": "^11.10.5",
35
+ "lit": "^2.6.0",
34
36
  "react": "^18.2.0",
35
37
  "react-dom": "^18.2.0"
36
38
  },
@@ -39,6 +41,7 @@
39
41
  "@emotion/styled": "^11.10.5",
40
42
  "@types/react": "^18.0.26",
41
43
  "@types/react-dom": "^18.0.10",
44
+ "lit": "^2.6.0",
42
45
  "react": "^18.2.0",
43
46
  "react-dom": "^18.2.0"
44
47
  },
@@ -1,325 +0,0 @@
1
- var V = Object.defineProperty, X = Object.defineProperties;
2
- var Z = Object.getOwnPropertyDescriptors;
3
- var y = Object.getOwnPropertySymbols;
4
- var I = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
5
- var H = (e, t, a) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, f = (e, t) => {
6
- for (var a in t || (t = {}))
7
- I.call(t, a) && H(e, a, t[a]);
8
- if (y)
9
- for (var a of y(t))
10
- L.call(t, a) && H(e, a, t[a]);
11
- return e;
12
- }, g = (e, t) => X(e, Z(t));
13
- var k = (e, t) => {
14
- var a = {};
15
- for (var n in e)
16
- I.call(e, n) && t.indexOf(n) < 0 && (a[n] = e[n]);
17
- if (e != null && y)
18
- for (var n of y(e))
19
- t.indexOf(n) < 0 && L.call(e, n) && (a[n] = e[n]);
20
- return a;
21
- };
22
- import { css as b } from "@emotion/react";
23
- import c from "@emotion/styled";
24
- import { useProperties as ee, useContainer as te, createEmptyComponent as N, SymbolBadge as F, genericHtml as ae, linkTabStyle as ne, borderTabStyle as G, Html as oe, Button as ie } from "@telia-ace/knowledge-widget-ui";
25
- import { readStorage as R, StorageMedium as T, createStorageWriter as le, StorageCategory as re } from "@telia-ace/widget-services";
26
- import { appendClassNames as w } from "@telia-ace/widget-utilities";
27
- import i, { useState as $, useEffect as W } from "react";
28
- const z = "closed-notifications", se = {
29
- transform: {
30
- a: (a) => {
31
- var n = a, { children: e } = n, t = k(n, ["children"]);
32
- return /* @__PURE__ */ i.createElement("a", g(f({}, t), { tabIndex: -1 }), e);
33
- }
34
- }
35
- }, xe = (a) => {
36
- var n = a, { className: e } = n, t = k(n, ["className"]);
37
- const {
38
- types: P = [],
39
- allowPaging: O = !0,
40
- notifications: M = [],
41
- expandable: m = !1,
42
- closeAriaLabel: Y = "",
43
- pageNextAriaLabel: _ = "",
44
- pagePreviousAriaLabel: q = "",
45
- expandAriaLabel: J = ""
46
- } = ee(), [h, Q] = $(!1), [x, A] = $([]), [l, v] = $(0), r = te(), [E, U] = $();
47
- W(() => {
48
- r && (R(r, z, T.Session).then(
49
- (o = []) => A(o)
50
- ), le(r, z, re.Functional).then(
51
- (o) => U(() => o)
52
- ));
53
- }, [r]), W(() => {
54
- r && R(r, z, T.Session).then(
55
- (o = []) => {
56
- x.forEach(
57
- (s) => o.indexOf(s) === -1 && o.push(s)
58
- ), E && E(o);
59
- }
60
- );
61
- }, [x, r, E]);
62
- const d = M.filter(({ id: o }) => x.indexOf(o) === -1), { length: p } = d;
63
- if (!d.length)
64
- return N(r, g(f({}, t), {
65
- className: w(e, "humany-notification-row")
66
- }));
67
- if (O) {
68
- const o = d[l] || d[l + 1] || d[l - 1];
69
- if (!o)
70
- return N(r, g(f({}, t), {
71
- className: w(e, "humany-notification-row")
72
- }));
73
- const { id: s, body: S } = o || {}, B = () => Q(!h);
74
- return /* @__PURE__ */ i.createElement(
75
- K,
76
- g(f({}, t), {
77
- "aria-expanded": m ? h : !0,
78
- "aria-label": J,
79
- tabIndex: m ? 0 : -1,
80
- className: w(e, "humany-notification-row"),
81
- "data-pageable": p > 1,
82
- "data-types": P,
83
- "data-allow-paging": O,
84
- "data-expandable": m,
85
- onKeyDown: (u) => {
86
- u.key === "Enter" && B();
87
- },
88
- onClick: B
89
- }),
90
- /* @__PURE__ */ i.createElement(
91
- ce,
92
- {
93
- "aria-label": Y,
94
- onClick: () => {
95
- v(d.indexOf(o)), A([...x, s]);
96
- }
97
- },
98
- /* @__PURE__ */ i.createElement(F, { symbol: { type: "Svg", content: "close" } })
99
- ),
100
- /* @__PURE__ */ i.createElement(
101
- j,
102
- {
103
- htmlParseInstruction: !m || h ? void 0 : se,
104
- "data-pageable": p > 1,
105
- "data-notification": s,
106
- "data-expandable": m,
107
- "data-expanded": h,
108
- html: S
109
- }
110
- ),
111
- p > 1 && /* @__PURE__ */ i.createElement(de, null, /* @__PURE__ */ i.createElement(
112
- C,
113
- {
114
- "aria-label": q,
115
- "data-disabled": l === 0,
116
- onClick: (u) => {
117
- u.stopPropagation(), l > 0 && v(l - 1);
118
- }
119
- },
120
- /* @__PURE__ */ i.createElement(
121
- D,
122
- {
123
- size: 10,
124
- symbol: { type: "Svg", content: "caret-left" }
125
- }
126
- )
127
- ), /* @__PURE__ */ i.createElement("span", null, l + 1, "/", p), /* @__PURE__ */ i.createElement(
128
- C,
129
- {
130
- "aria-label": _,
131
- "data-disabled": l + 1 >= p,
132
- onClick: (u) => {
133
- u.stopPropagation(), l < p - 1 && v(l + 1);
134
- }
135
- },
136
- /* @__PURE__ */ i.createElement(
137
- D,
138
- {
139
- size: 10,
140
- symbol: { type: "Svg", content: "caret-right" }
141
- }
142
- )
143
- ))
144
- );
145
- }
146
- return /* @__PURE__ */ i.createElement(
147
- K,
148
- g(f({}, t), {
149
- className: w(e, "humany-notification-row"),
150
- "data-pageable": !1,
151
- "data-types": P,
152
- "data-allow-paging": !1
153
- }),
154
- d.map((o) => {
155
- if (!o)
156
- return null;
157
- const { id: s, body: S } = o;
158
- return /* @__PURE__ */ i.createElement(
159
- j,
160
- {
161
- key: s,
162
- "data-pageable": !1,
163
- "data-expandable": m,
164
- "data-expanded": h,
165
- "data-notification": s,
166
- html: S
167
- }
168
- );
169
- })
170
- );
171
- }, K = c.div`
172
- ${ae}
173
- padding: ${(e) => {
174
- var t;
175
- return (t = e.theme.sizes) == null ? void 0 : t.normal;
176
- }} ${(e) => {
177
- var t;
178
- return ((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 12;
179
- }}px;
180
- background-color: ${(e) => {
181
- var t, a, n;
182
- return e["data-types"].length ? e["data-types"].indexOf("top") > -1 ? (t = e.theme.colors) == null ? void 0 : t.warning : e["data-types"].indexOf("bottom") > -1 ? "transparent" : (a = e.theme.colors) == null ? void 0 : a.primary : (n = e.theme.colors) == null ? void 0 : n.warning;
183
- }};
184
- color: ${(e) => {
185
- var t;
186
- return (t = e.theme.colors) == null ? void 0 : t.text;
187
- }};
188
- border-radius: ${(e) => e.theme.borderRadius};
189
- text-align: center;
190
- display: flex;
191
- flex-direction: column;
192
- position: relative;
193
- cursor: ${(e) => e["data-expandable"] ? "pointer" : "default"};
194
- overflow: hidden;
195
-
196
- i {
197
- color: ${(e) => {
198
- var t;
199
- return (t = e.theme.colors) == null ? void 0 : t.text;
200
- }};
201
- }
202
-
203
- a {
204
- color: ${(e) => {
205
- var t;
206
- return (t = e.theme.colors) == null ? void 0 : t.link;
207
- }};
208
- &:focus-visible {
209
- ${ne}
210
- }
211
- }
212
-
213
- ${(e) => {
214
- var t;
215
- return !e["data-allow-paging"] && b`
216
- flex-wrap: wrap;
217
-
218
- > div {
219
- min-width: 100%;
220
- margin: ${((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 2}px;
221
- }
222
- `;
223
- }};
224
-
225
- ${(e) => b`
226
- &:focus-visible {
227
- .humany-html {
228
- ${G(e)}
229
- }
230
- }
231
- `}
232
- `, j = c(oe)`
233
- flex: 1;
234
- font-size: ${(e) => {
235
- var t;
236
- return (t = e.theme.fonts) == null ? void 0 : t.normal;
237
- }};
238
- line-height: 1.6em;
239
- font-weight: 300;
240
-
241
- ${(e) => e["data-expandable"] && !e["data-expanded"] && b`
242
- max-width: 100%;
243
-
244
- p {
245
- display: none;
246
- &:first-child {
247
- display: block;
248
- margin-bottom: 0;
249
- white-space: nowrap;
250
- overflow: hidden;
251
- text-overflow: ellipsis;
252
- }
253
- }
254
- `}
255
- `, de = c.div`
256
- text-align: center;
257
- width: 100%;
258
- span {
259
- font-size: ${(e) => {
260
- var t;
261
- return (t = e.theme.fonts) == null ? void 0 : t.small;
262
- }};
263
- display: inline-block;
264
- width: 30px;
265
- text-align: center;
266
- }
267
- `, C = c(ie)`
268
- background-color: transparent;
269
- border: none;
270
- cursor: pointer;
271
- transition: opacity 200ms ease-out;
272
- justify-self: flex-end;
273
- align-self: flex-start;
274
- padding: ${(e) => {
275
- var t;
276
- return (t = e.theme.sizes) == null ? void 0 : t.small;
277
- }} svg {
278
- display: block;
279
- }
280
-
281
- &:focus-visible {
282
- ${G}
283
- }
284
-
285
- ${(e) => e["data-disabled"] ? b`
286
- opacity: 0.8;
287
- ` : b`
288
- @media (hover) {
289
- &:hover {
290
- opacity: 0.5;
291
- }
292
- }
293
- `}
294
- `, ce = c(C)`
295
- position: absolute;
296
- top: 7.5px;
297
- right: 7.5px;
298
- width: 25px;
299
- height: auto;
300
- padding: ${(e) => {
301
- var t, a;
302
- return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(a = e.theme.sizes) == null ? void 0 : a.small}`;
303
- }};
304
- svg {
305
- vertical-align: middle;
306
- line,
307
- path {
308
- stroke: ${(e) => {
309
- var t;
310
- return (t = e.theme.colors) == null ? void 0 : t.text;
311
- }};
312
- }
313
- }
314
- `, D = c(F)`
315
- line {
316
- stroke: #ffffff;
317
- }
318
- `;
319
- c.div`
320
- display: none;
321
- `;
322
- export {
323
- xe as default
324
- };
325
- //# sourceMappingURL=notification-row.5162cdbf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-row.5162cdbf.js","sources":["../src/notification-row.tsx"],"sourcesContent":["import { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport {\n borderTabStyle,\n Button,\n createEmptyComponent,\n genericHtml,\n Html,\n linkTabStyle,\n SymbolBadge,\n useContainer,\n useProperties,\n} from '@telia-ace/knowledge-widget-ui';\nimport {\n createStorageWriter,\n readStorage,\n StorageCategory,\n StorageMedium,\n StorageWriter,\n} from '@telia-ace/widget-services';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React, { useEffect, useState } from 'react';\nimport { NotificationRowComponentProps } from './notification-row-component';\n\ntype Props = {\n className: string;\n};\n\nconst STORAGE_KEY = 'closed-notifications';\n\nconst infocusableHtml = {\n transform: {\n a: ({ children, ...props }: React.ComponentProps<'a'>) => (\n <a {...props} tabIndex={-1}>\n {children}\n </a>\n ),\n },\n};\n\nconst NotificationRow: React.FC<Props> = ({ className, ...other }) => {\n const {\n types = [],\n allowPaging = true,\n notifications = [],\n expandable = false,\n closeAriaLabel = '',\n pageNextAriaLabel = '',\n pagePreviousAriaLabel = '',\n expandAriaLabel = '',\n } = useProperties<NotificationRowComponentProps>();\n const [expanded, setExpanded] = useState(false);\n const [closed, setClosed] = useState<string[]>([]);\n const [index, setIndex] = useState(0);\n\n const container = useContainer();\n const [write, setWriter] = useState<StorageWriter | undefined>();\n\n useEffect(() => {\n if (container) {\n readStorage<string[]>(container, STORAGE_KEY, StorageMedium.Session).then(\n (closed = []) => setClosed(closed)\n );\n\n createStorageWriter(container, STORAGE_KEY, StorageCategory.Functional).then((writer) =>\n setWriter(() => writer)\n );\n }\n }, [container]);\n\n useEffect(() => {\n if (container) {\n readStorage<string[]>(container, STORAGE_KEY, StorageMedium.Session).then(\n (storedClosed = []) => {\n closed.forEach(\n (id) => storedClosed.indexOf(id) === -1 && storedClosed.push(id)\n );\n if (write) {\n write(storedClosed);\n }\n }\n );\n }\n }, [closed, container, write]);\n\n const filtered = notifications.filter(({ id }) => closed.indexOf(id) === -1);\n\n const { length } = filtered;\n\n if (!filtered.length) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-notification-row'),\n });\n }\n\n if (allowPaging) {\n const notification = filtered[index] || filtered[index + 1] || filtered[index - 1];\n\n if (!notification) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-notification-row'),\n });\n }\n\n const { id, body } = notification || {};\n const toggleExpand = () => setExpanded(!expanded);\n\n return (\n <Wrapper\n {...other}\n aria-expanded={expandable ? expanded : true}\n aria-label={expandAriaLabel}\n tabIndex={expandable ? 0 : -1}\n className={appendClassNames(className, 'humany-notification-row')}\n data-pageable={length > 1}\n data-types={types}\n data-allow-paging={allowPaging}\n data-expandable={expandable}\n onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n toggleExpand();\n }\n }}\n onClick={toggleExpand}\n >\n <CloseButton\n aria-label={closeAriaLabel}\n onClick={() => {\n setIndex(filtered.indexOf(notification));\n setClosed([...closed, id]);\n }}\n >\n <SymbolBadge symbol={{ type: 'Svg', content: 'close' }} />\n </CloseButton>\n <StyledHtml\n htmlParseInstruction={!expandable || expanded ? undefined : infocusableHtml}\n data-pageable={length > 1}\n data-notification={id}\n data-expandable={expandable}\n data-expanded={expanded}\n html={body}\n />\n {length > 1 && (\n <Pager>\n <StyledButton\n aria-label={pagePreviousAriaLabel}\n data-disabled={index === 0}\n onClick={(e) => {\n e.stopPropagation();\n if (index > 0) {\n setIndex(index - 1);\n }\n }}\n >\n <StyledSymbolBadge\n size={10}\n symbol={{ type: 'Svg', content: 'caret-left' }}\n />\n </StyledButton>\n <span>\n {index + 1}/{length}\n </span>\n <StyledButton\n aria-label={pageNextAriaLabel}\n data-disabled={index + 1 >= length}\n onClick={(e) => {\n e.stopPropagation();\n if (index < length - 1) {\n setIndex(index + 1);\n }\n }}\n >\n <StyledSymbolBadge\n size={10}\n symbol={{ type: 'Svg', content: 'caret-right' }}\n />\n </StyledButton>\n </Pager>\n )}\n </Wrapper>\n );\n }\n\n return (\n <Wrapper\n {...other}\n className={appendClassNames(className, 'humany-notification-row')}\n data-pageable={false}\n data-types={types}\n data-allow-paging={false}\n >\n {filtered.map((notification) => {\n if (!notification) {\n return null;\n }\n\n const { id, body } = notification;\n\n return (\n <StyledHtml\n key={id}\n data-pageable={false}\n data-expandable={expandable}\n data-expanded={expanded}\n data-notification={id}\n html={body}\n />\n );\n })}\n </Wrapper>\n );\n};\n\nconst Wrapper = styled.div<{ 'data-types': string[]; 'data-allow-paging': boolean } & any>`\n ${genericHtml}\n padding: ${(p) => p.theme.sizes?.normal} ${(p) => p.theme.sizes?.cardinal * 12}px;\n background-color: ${(p) => {\n if (p['data-types'].length) {\n if (p['data-types'].indexOf('top') > -1) {\n return p.theme.colors?.warning;\n }\n if (p['data-types'].indexOf('bottom') > -1) {\n return 'transparent';\n }\n\n return p.theme.colors?.primary;\n }\n return p.theme.colors?.warning;\n }};\n color: ${(p) => p.theme.colors?.text};\n border-radius: ${(p) => p.theme.borderRadius};\n text-align: center;\n display: flex;\n flex-direction: column;\n position: relative;\n cursor: ${(p) => (p['data-expandable'] ? 'pointer' : 'default')};\n overflow: hidden;\n\n i {\n color: ${(p) => p.theme.colors?.text};\n }\n\n a {\n color: ${(p) => p.theme.colors?.link};\n &:focus-visible {\n ${linkTabStyle}\n }\n }\n\n ${(p) =>\n !p['data-allow-paging'] &&\n css`\n flex-wrap: wrap;\n\n > div {\n min-width: 100%;\n margin: ${p.theme.sizes?.cardinal * 2}px;\n }\n `};\n\n ${(p) =>\n css`\n &:focus-visible {\n .humany-html {\n ${borderTabStyle(p)}\n }\n }\n `}\n`;\n\nconst StyledHtml = styled(Html)<{\n 'data-pageable': boolean;\n 'data-expandable': boolean;\n 'data-expanded': boolean;\n}>`\n flex: 1;\n font-size: ${(p) => p.theme.fonts?.normal};\n line-height: 1.6em;\n font-weight: 300;\n\n ${(p) =>\n p['data-expandable'] &&\n !p['data-expanded'] &&\n css`\n max-width: 100%;\n\n p {\n display: none;\n &:first-child {\n display: block;\n margin-bottom: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n `}\n`;\n\nconst Pager = styled.div`\n text-align: center;\n width: 100%;\n span {\n font-size: ${(p) => p.theme.fonts?.small};\n display: inline-block;\n width: 30px;\n text-align: center;\n }\n`;\n\nconst StyledButton = styled(Button)<{ 'data-disabled'?: boolean }>`\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: opacity 200ms ease-out;\n justify-self: flex-end;\n align-self: flex-start;\n padding: ${(p) => p.theme.sizes?.small} svg {\n display: block;\n }\n\n &:focus-visible {\n ${borderTabStyle}\n }\n\n ${(p) =>\n p['data-disabled']\n ? css`\n opacity: 0.8;\n `\n : css`\n @media (hover) {\n &:hover {\n opacity: 0.5;\n }\n }\n `}\n`;\n\nconst CloseButton = styled(StyledButton)`\n position: absolute;\n top: 7.5px;\n right: 7.5px;\n width: 25px;\n height: auto;\n padding: ${(p) => `calc(${p.theme.sizes?.small}/2) ${p.theme.sizes?.small}`};\n svg {\n vertical-align: middle;\n line,\n path {\n stroke: ${(p) => p.theme.colors?.text};\n }\n }\n`;\n\nconst StyledSymbolBadge = styled(SymbolBadge)`\n line {\n stroke: #ffffff;\n }\n`;\n\nconst Empty = styled.div`\n display: none;\n`;\n\nexport default NotificationRow;\n"],"names":["STORAGE_KEY","infocusableHtml","_a","_b","children","props","__objRest","React","__spreadProps","__spreadValues","NotificationRow","className","other","types","allowPaging","notifications","expandable","closeAriaLabel","pageNextAriaLabel","pagePreviousAriaLabel","expandAriaLabel","useProperties","expanded","setExpanded","useState","closed","setClosed","index","setIndex","container","useContainer","write","setWriter","useEffect","readStorage","StorageMedium","createStorageWriter","StorageCategory","writer","storedClosed","id","filtered","length","createEmptyComponent","appendClassNames","notification","body","toggleExpand","Wrapper","e","CloseButton","SymbolBadge","StyledHtml","Pager","StyledButton","StyledSymbolBadge","styled","genericHtml","p","_c","linkTabStyle","css","borderTabStyle","Html","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,IAAc,wBAEdC,KAAkB;AAAA,EACpB,WAAW;AAAA,IACP,GAAG,CAACC,MACC;AADD,UAAAC,IAAAD,GAAE,YAAAE,MAAFD,GAAeE,IAAAC,EAAfH,GAAe,CAAb;AACD,6BAAAI,EAAA,cAAA,KAAAC,EAAAC,EAAA,IAAMJ,IAAN,EAAa,UAAU,GAAA,IACnBD,CACL;AAAA;AAAA,EAER;AACJ,GAEMM,KAAmC,CAACR,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAS,MAAFR,GAAgBS,IAAAN,EAAhBH,GAAgB,CAAd;AAClC,QAAA;AAAA,IACF,OAAAU,IAAQ,CAAC;AAAA,IACT,aAAAC,IAAc;AAAA,IACd,eAAAC,IAAgB,CAAC;AAAA,IACjB,YAAAC,IAAa;AAAA,IACb,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC,IAAoB;AAAA,IACpB,uBAAAC,IAAwB;AAAA,IACxB,iBAAAC,IAAkB;AAAA,MAClBC,GAA6C,GAC3C,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxC,CAACC,GAAQC,CAAS,IAAIF,EAAmB,CAAE,CAAA,GAC3C,CAACG,GAAOC,CAAQ,IAAIJ,EAAS,CAAC,GAE9BK,IAAYC,MACZ,CAACC,GAAOC,C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