@telia-ace/knowledge-widget-components-notification-list 1.0.22 → 1.0.24-next.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/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -32
- package/dist/index.js.map +1 -1
- package/dist/notification-list-component.d.ts +9 -9
- package/dist/notification-list.ba190f64.js +47 -0
- package/dist/notification-list.ba190f64.js.map +1 -0
- package/dist/notification-list.d.ts +6 -6
- package/package.json +13 -12
- package/dist/notification-list.682419d0.js +0 -192
- package/dist/notification-list.682419d0.js.map +0 -1
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
-
|
|
3
|
-
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
-
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
-
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
1
|
+
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
+
|
|
3
|
+
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
+
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
+
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
6
6
|
http://www.humany.com/legal
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# `@telia-ace/knowledge-widget-components-notification-list`
|
|
2
|
-
|
|
3
|
-
Notification list component for ACE Knowledge Widgets.
|
|
1
|
+
# `@telia-ace/knowledge-widget-components-notification-list`
|
|
2
|
+
|
|
3
|
+
Notification list component for ACE Knowledge Widgets.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import NotificationListComponent from './notification-list-component';
|
|
2
|
-
export default NotificationListComponent;
|
|
1
|
+
import NotificationListComponent from './notification-list-component';
|
|
2
|
+
export default NotificationListComponent;
|
package/dist/index.js
CHANGED
|
@@ -15,41 +15,48 @@ import { DataType as D } from "@telia-ace/knowledge-widget-types-grid";
|
|
|
15
15
|
import { createReactComponent as P } from "@telia-ace/knowledge-widget-ui";
|
|
16
16
|
const E = (t) => {
|
|
17
17
|
const { events: e } = t.get("$widget"), [i, u] = L(e);
|
|
18
|
-
return P(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
a.actions.create("fetch", ({ error: r, notificationLists: s }) => {
|
|
27
|
-
if (r)
|
|
28
|
-
return a.actions.dispatch("fetched", {
|
|
29
|
-
error: r,
|
|
18
|
+
return P(
|
|
19
|
+
t,
|
|
20
|
+
"notification-list",
|
|
21
|
+
import("./notification-list.ba190f64.js"),
|
|
22
|
+
(a) => {
|
|
23
|
+
const o = (r) => {
|
|
24
|
+
a.writeProperties(n(c({}, a.properties()), {
|
|
30
25
|
loading: !0,
|
|
26
|
+
error: void 0,
|
|
31
27
|
notificationList: void 0
|
|
32
|
-
});
|
|
33
|
-
const { category: f, notificationList: p } = a.properties(), g = {
|
|
34
|
-
notificationList: s.find((l) => l.id === f) || p
|
|
28
|
+
})), a.actions.dispatch("fetch", { params: r });
|
|
35
29
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
a.actions.create("fetch", ({ error: r, notificationLists: s }) => {
|
|
31
|
+
if (r)
|
|
32
|
+
return a.actions.dispatch("fetched", {
|
|
33
|
+
error: r,
|
|
34
|
+
loading: !0,
|
|
35
|
+
notificationList: void 0
|
|
36
|
+
});
|
|
37
|
+
const { category: f, notificationList: p } = a.properties(), g = {
|
|
38
|
+
notificationList: s.find((l) => l.id === f) || p
|
|
39
|
+
};
|
|
40
|
+
return a.actions.dispatch("fetched", n(c({}, g), {
|
|
41
|
+
loading: !0
|
|
42
|
+
}));
|
|
43
|
+
}), a.actions.create("fetched", (r) => a.writeProperties(n(c({}, r), { loading: !1 }))), t.getAsync("router").then((r) => {
|
|
44
|
+
const { params: s } = r.getRouteData();
|
|
45
|
+
o(s);
|
|
46
|
+
}), i("router:changed", (r, { current: s }) => {
|
|
47
|
+
o(s.routeData.params);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
).then(() => w(t, "notification-list", (a) => {
|
|
51
|
+
a.actions.watch("notification-list.fetch", (o, r) => t.getAsync("dataClient").then(
|
|
52
|
+
(s) => s.fetch(D.NotificationLists, {
|
|
53
|
+
categories: [
|
|
54
|
+
o.params.guideCategory,
|
|
55
|
+
o.params.contactCategory
|
|
56
|
+
].filter((f) => !!f),
|
|
57
|
+
searchPhrase: o.params.phrase
|
|
58
|
+
})
|
|
59
|
+
).then(r).catch((s) => {
|
|
53
60
|
if (s)
|
|
54
61
|
return r(s);
|
|
55
62
|
}));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/notification-list-component.ts"],"sourcesContent":["import {\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/notification-list-component.ts"],"sourcesContent":["import {\n createEventSubscriber,\n extendComponent,\n NotificationList,\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\nexport type NotificationListComponentProps = {\n category?: string;\n showHeader?: boolean;\n notificationList?: NotificationList; // internal\n};\n\ntype FetchResults = NotificationResults & { error: any };\n\nexport const NotificationListComponent = (container: Container) => {\n const { events }: Widget = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n return createReactComponent(\n container,\n 'notification-list',\n import('./notification-list'),\n (component) => {\n const fetch = (params: { [key: string]: any }) => {\n component.writeProperties({\n ...component.properties<NotificationListComponentProps>(),\n loading: true,\n error: undefined,\n notificationList: undefined,\n });\n component.actions.dispatch('fetch', { params });\n };\n\n component.actions.create('fetch', ({ error, notificationLists }: FetchResults) => {\n if (error) {\n return component.actions.dispatch('fetched', {\n error,\n loading: true,\n notificationList: undefined,\n });\n }\n\n const { category, notificationList } =\n component.properties<NotificationListComponentProps>();\n\n const properties = {\n notificationList:\n notificationLists.find((n) => n.id === category) || notificationList,\n };\n\n return component.actions.dispatch('fetched', {\n ...properties,\n loading: true,\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 )\n .then(() => {\n return extendComponent(container, 'notification-list', (component) => {\n component.actions.watch('notification-list.fetch', (input, next) => {\n return container\n .getAsync('dataClient')\n .then((dataClient: DataClient) =>\n dataClient.fetch(DataType.NotificationLists, {\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 NotificationListComponent;\n"],"names":["NotificationListComponent","container","events","subscribe","unsubscribe","createEventSubscriber","createReactComponent","component","fetch","params","__spreadProps","__spreadValues","error","notificationLists","category","notificationList","properties","n","input","router","event","current","extendComponent","next","dataClient","DataType","c"],"mappings":";;;;;;;;;;;;;;;AAiBa,MAAAA,IAA4B,CAACC,MAAyB;AAC/D,QAAM,EAAE,QAAAC,EAAmB,IAAAD,EAAU,IAAI,SAAS,GAC5C,CAACE,GAAWC,CAA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A,EACJ,EACK,KAAK,MACKC,EAAgBrB,GAAW,qBAAqB,CAACM,MAAc;AAClE,IAAAA,EAAU,QAAQ,MAAM,2BAA2B,CAACW,GAAOK,MAChDtB,EACF,SAAS,YAAY,EACrB;AAAA,MAAK,CAACuB,MACHA,EAAW,MAAMC,EAAS,mBAAmB;AAAA,QACzC,YAAY;AAAA,UACRP,EAAM,OAAO;AAAA,UACbA,EAAM,OAAO;AAAA,UACf,OAAO,CAACQ,MAAM,CAAC,CAACA,CAAC;AAAA,QACnB,cAAcR,EAAM,OAAO;AAAA,MAAA,CAC9B;AAAA,MAEJ,KAAKK,CAAI,EACT,MAAM,CAACX,MAAU;AACd,UAAIA;AACA,eAAOW,EAAKX,CAAK;AAAA,IACrB,CACH,CACR;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI,IAAAR;EAAA,CACf;AACT;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { NotificationList } from '@telia-ace/knowledge-widget-core';
|
|
2
|
-
import { Container } from '@webprovisions/platform';
|
|
3
|
-
export declare type NotificationListComponentProps = {
|
|
4
|
-
category?: string;
|
|
5
|
-
showHeader?: boolean;
|
|
6
|
-
notificationList?: NotificationList;
|
|
7
|
-
};
|
|
8
|
-
export declare const NotificationListComponent: (container: Container) => Promise<void>;
|
|
9
|
-
export default NotificationListComponent;
|
|
1
|
+
import { NotificationList } from '@telia-ace/knowledge-widget-core';
|
|
2
|
+
import { Container } from '@webprovisions/platform';
|
|
3
|
+
export declare type NotificationListComponentProps = {
|
|
4
|
+
category?: string;
|
|
5
|
+
showHeader?: boolean;
|
|
6
|
+
notificationList?: NotificationList;
|
|
7
|
+
};
|
|
8
|
+
export declare const NotificationListComponent: (container: Container) => Promise<void>;
|
|
9
|
+
export default NotificationListComponent;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var N = Object.defineProperty, y = Object.defineProperties;
|
|
2
|
+
var C = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var a = Object.getOwnPropertySymbols;
|
|
4
|
+
var f = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var m = (t, o, i) => o in t ? N(t, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[o] = i, s = (t, o) => {
|
|
6
|
+
for (var i in o || (o = {}))
|
|
7
|
+
f.call(o, i) && m(t, i, o[i]);
|
|
8
|
+
if (a)
|
|
9
|
+
for (var i of a(o))
|
|
10
|
+
p.call(o, i) && m(t, i, o[i]);
|
|
11
|
+
return t;
|
|
12
|
+
}, r = (t, o) => y(t, C(o));
|
|
13
|
+
var l = (t, o) => {
|
|
14
|
+
var i = {};
|
|
15
|
+
for (var e in t)
|
|
16
|
+
f.call(t, e) && o.indexOf(e) < 0 && (i[e] = t[e]);
|
|
17
|
+
if (t != null && a)
|
|
18
|
+
for (var e of a(t))
|
|
19
|
+
o.indexOf(e) < 0 && p.call(t, e) && (i[e] = t[e]);
|
|
20
|
+
return i;
|
|
21
|
+
};
|
|
22
|
+
import { useContainer as L, useProperties as g, createEmptyComponent as h, NotificationList as x, contentBox as E } from "@telia-ace/knowledge-widget-ui";
|
|
23
|
+
import { appendClassNames as $ } from "@telia-ace/widget-utilities";
|
|
24
|
+
import w from "react";
|
|
25
|
+
import B from "styled-components";
|
|
26
|
+
const k = (i) => {
|
|
27
|
+
var e = i, { className: t } = e, o = l(e, ["className"]);
|
|
28
|
+
const d = L(), {
|
|
29
|
+
showHeader: u,
|
|
30
|
+
notificationList: n,
|
|
31
|
+
loading: c = !1
|
|
32
|
+
} = g();
|
|
33
|
+
return !(n != null && n.notifications.length) && !c ? h(d, r(s({}, o), {
|
|
34
|
+
className: $(t, "humany-notification-list")
|
|
35
|
+
})) : /* @__PURE__ */ w.createElement(H, r(s({}, o), {
|
|
36
|
+
className: t,
|
|
37
|
+
notificationList: n,
|
|
38
|
+
loading: c,
|
|
39
|
+
showHeader: u
|
|
40
|
+
}));
|
|
41
|
+
}, H = B(x)`
|
|
42
|
+
${E}
|
|
43
|
+
`;
|
|
44
|
+
export {
|
|
45
|
+
k as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=notification-list.ba190f64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-list.ba190f64.js","sources":["../src/notification-list.tsx"],"sourcesContent":["import {\n contentBox,\n createEmptyComponent,\n NotificationList as NotificationListUi,\n useContainer,\n useProperties,\n} from '@telia-ace/knowledge-widget-ui';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { NotificationListComponentProps } from './notification-list-component';\n\ntype Props = {\n className: string;\n};\n\nconst NotificationList: React.FC<Props> = ({ className, ...other }) => {\n const container = useContainer();\n const {\n showHeader,\n notificationList,\n loading = false,\n } = useProperties<NotificationListComponentProps>();\n\n if (!notificationList?.notifications.length && !loading) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-notification-list'),\n });\n }\n\n return (\n <StyledNotificationList\n {...other}\n className={className}\n notificationList={notificationList}\n loading={loading}\n showHeader={showHeader}\n />\n );\n};\n\nconst StyledNotificationList = styled(NotificationListUi)`\n ${contentBox}\n`;\n\nexport default NotificationList;\n"],"names":["NotificationList","_a","_b","className","other","__objRest","container","useContainer","showHeader","notificationList","loading","useProperties","createEmptyComponent","__spreadProps","__spreadValues","appendClassNames","React","StyledNotificationList","styled","NotificationListUi","contentBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAoC,CAACC,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAE,MAAFD,GAAgBE,IAAAC,EAAhBH,GAAgB,CAAd;AACzC,QAAMI,IAAYC,KACZ;AAAA,IACF,YAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,MACVC,EAA8C;AAElD,SAAI,EAACF,KAAA,QAAAA,EAAkB,cAAc,WAAU,CAACC,IACrCE,EAAqBN,GAAWO,EAAAC,EAAA,IAChCV,IADgC;AAAA,IAEnC,WAAWW,EAAiBZ,GAAW,0BAA0B;AAAA,EAAA,EACpE,IAIA,gBAAAa,EAAA,cAAAC,GAAAJ,EAAAC,EAAA,IACOV,IADP;AAAA,IAEG,WAAAD;AAAA,IACA,kBAAAM;AAAA,IACA,SAAAC;AAAA,IACA,YAAAF;AAAA,EAAA,EACJ;AAER,GAEMS,IAAyBC,EAAOC,CAAkB;AAAA,MAClDC;AAAA;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type Props = {
|
|
3
|
-
className: string;
|
|
4
|
-
};
|
|
5
|
-
declare const NotificationList: React.
|
|
6
|
-
export default NotificationList;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
className: string;
|
|
4
|
+
};
|
|
5
|
+
declare const NotificationList: React.FC<Props>;
|
|
6
|
+
export default NotificationList;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-notification-list",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24-next.0",
|
|
4
4
|
"description": "Notification list component for ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"telia"
|
|
9
9
|
],
|
|
10
10
|
"main": "dist/index.js",
|
|
11
|
+
"sourceMain": "src/index.ts",
|
|
11
12
|
"type": "module",
|
|
12
13
|
"types": "dist/index.d.ts",
|
|
13
14
|
"files": [
|
|
@@ -25,21 +26,21 @@
|
|
|
25
26
|
},
|
|
26
27
|
"sideEffects": false,
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@telia-ace/knowledge-widget-core": "^1.0.
|
|
29
|
-
"@telia-ace/knowledge-widget-types-grid": "^1.0.
|
|
30
|
-
"@telia-ace/knowledge-widget-ui": "^1.0.
|
|
31
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
29
|
+
"@telia-ace/knowledge-widget-core": "^1.0.20-next.1",
|
|
30
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.31-next.1",
|
|
31
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.26-next.1",
|
|
32
|
+
"@telia-ace/widget-utilities": "^1.0.5-next.1",
|
|
32
33
|
"@webprovisions/platform": "^1.1.2"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
|
-
"react": "^
|
|
36
|
-
"react-dom": "^
|
|
37
|
-
"styled-components": "^
|
|
36
|
+
"react": "^18.2.0",
|
|
37
|
+
"react-dom": "^18.2.0",
|
|
38
|
+
"styled-components": "^5.3.6"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@types/react": "^
|
|
41
|
-
"@types/react-dom": "^
|
|
42
|
-
"@types/styled-components": "^5.1.
|
|
41
|
+
"@types/react": "^18.0.21",
|
|
42
|
+
"@types/react-dom": "^18.0.6",
|
|
43
|
+
"@types/styled-components": "^5.1.26"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a81b35116f1f922623477a03097a1435db43a5ff"
|
|
45
46
|
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
var Y = Object.defineProperty, D = Object.defineProperties;
|
|
2
|
-
var H = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var m = Object.getOwnPropertySymbols;
|
|
4
|
-
var x = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var w = (t, e, a) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a, h = (t, e) => {
|
|
6
|
-
for (var a in e || (e = {}))
|
|
7
|
-
x.call(e, a) && w(t, a, e[a]);
|
|
8
|
-
if (m)
|
|
9
|
-
for (var a of m(e))
|
|
10
|
-
E.call(e, a) && w(t, a, e[a]);
|
|
11
|
-
return t;
|
|
12
|
-
}, f = (t, e) => D(t, H(e));
|
|
13
|
-
var v = (t, e) => {
|
|
14
|
-
var a = {};
|
|
15
|
-
for (var n in t)
|
|
16
|
-
x.call(t, n) && e.indexOf(n) < 0 && (a[n] = t[n]);
|
|
17
|
-
if (t != null && m)
|
|
18
|
-
for (var n of m(t))
|
|
19
|
-
e.indexOf(n) < 0 && E.call(t, n) && (a[n] = t[n]);
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
import { useContainer as N, useProperties as P, createEmptyComponent as j, DateFormats as F, Loader as M, Button as O, borderTabStyle as _, ItemList as R, loadingOpacity as q, contentBox as A, itemList as G, headingElement as J, Paragraph as K, genericHtml as Q, SymbolBadge as U, Timestamp as V } from "@telia-ace/knowledge-widget-ui";
|
|
23
|
-
import { appendClassNames as S } from "@telia-ace/widget-utilities";
|
|
24
|
-
import o, { useState as W } from "react";
|
|
25
|
-
import l, { css as s } from "styled-components";
|
|
26
|
-
const re = (a) => {
|
|
27
|
-
var n = a, { className: t } = n, e = v(n, ["className"]);
|
|
28
|
-
const [r, z] = W(null), L = N(), {
|
|
29
|
-
showHeader: y,
|
|
30
|
-
notificationList: k,
|
|
31
|
-
loading: d = !1
|
|
32
|
-
} = P(), {
|
|
33
|
-
id: B,
|
|
34
|
-
title: C,
|
|
35
|
-
symbol: I,
|
|
36
|
-
notifications: g = [],
|
|
37
|
-
defaultHeaderOptions: T = { visible: !0 }
|
|
38
|
-
} = k || {};
|
|
39
|
-
return !g.length && !d ? j(L, f(h({}, e), {
|
|
40
|
-
className: S(t, "humany-notification-list")
|
|
41
|
-
})) : /* @__PURE__ */ o.createElement(Z, f(h({}, e), {
|
|
42
|
-
"data-loading": d,
|
|
43
|
-
"data-show-header": typeof y == "boolean" ? y : T.visible,
|
|
44
|
-
className: S(t, "humany-notification-list"),
|
|
45
|
-
"data-notification-category": B,
|
|
46
|
-
header: C,
|
|
47
|
-
symbol: I,
|
|
48
|
-
items: g,
|
|
49
|
-
renderItem: ({ id: i, title: p, body: u, modified: $, expandable: b }) => /* @__PURE__ */ o.createElement(ee, {
|
|
50
|
-
key: i,
|
|
51
|
-
"data-notification": i,
|
|
52
|
-
"data-expanded": b ? r === i : !0
|
|
53
|
-
}, b ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(X, {
|
|
54
|
-
title: p,
|
|
55
|
-
"aria-label": p,
|
|
56
|
-
"aria-expanded": r === i,
|
|
57
|
-
onClick: () => z(r === i ? null : i)
|
|
58
|
-
}, /* @__PURE__ */ o.createElement("span", null, p), /* @__PURE__ */ o.createElement(te, {
|
|
59
|
-
size: 11,
|
|
60
|
-
symbol: {
|
|
61
|
-
type: "Svg",
|
|
62
|
-
content: `caret-${r === i ? "up" : "down"}`
|
|
63
|
-
}
|
|
64
|
-
})), /* @__PURE__ */ o.createElement(c, {
|
|
65
|
-
html: u
|
|
66
|
-
}), $ && /* @__PURE__ */ o.createElement(ae, {
|
|
67
|
-
format: F.YYYY_MM_DD,
|
|
68
|
-
timestamp: $
|
|
69
|
-
})) : /* @__PURE__ */ o.createElement(c, {
|
|
70
|
-
html: u
|
|
71
|
-
}))
|
|
72
|
-
}), /* @__PURE__ */ o.createElement(M, {
|
|
73
|
-
loading: d
|
|
74
|
-
}));
|
|
75
|
-
}, X = l(O)`
|
|
76
|
-
display: flex;
|
|
77
|
-
justify-content: space-between;
|
|
78
|
-
align-items: center;
|
|
79
|
-
width: 100%;
|
|
80
|
-
text-align: left;
|
|
81
|
-
svg,
|
|
82
|
-
i {
|
|
83
|
-
color: ${(t) => {
|
|
84
|
-
var e;
|
|
85
|
-
return (e = t.theme.colors) == null ? void 0 : e.primary;
|
|
86
|
-
}};
|
|
87
|
-
}
|
|
88
|
-
span {
|
|
89
|
-
color: ${(t) => {
|
|
90
|
-
var e;
|
|
91
|
-
return (e = t.theme.colors) == null ? void 0 : e.text;
|
|
92
|
-
}};
|
|
93
|
-
font-size: ${(t) => {
|
|
94
|
-
var e;
|
|
95
|
-
return (e = t.theme.fonts) == null ? void 0 : e.normal;
|
|
96
|
-
}};
|
|
97
|
-
overflow: hidden;
|
|
98
|
-
text-overflow: ellipsis;
|
|
99
|
-
flex: 1;
|
|
100
|
-
white-space: nowrap;
|
|
101
|
-
}
|
|
102
|
-
&:focus {
|
|
103
|
-
${(t) => {
|
|
104
|
-
var e, a;
|
|
105
|
-
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && s`
|
|
106
|
-
${_}
|
|
107
|
-
span {
|
|
108
|
-
color: ${(a = t.theme.colors) == null ? void 0 : a.primary};
|
|
109
|
-
text-decoration: underline;
|
|
110
|
-
}
|
|
111
|
-
`;
|
|
112
|
-
}};
|
|
113
|
-
}
|
|
114
|
-
`, Z = l(R)`
|
|
115
|
-
${q}
|
|
116
|
-
${A}
|
|
117
|
-
${G}
|
|
118
|
-
overflow: hidden;
|
|
119
|
-
justify-content: flex-start;
|
|
120
|
-
padding: ${(t) => {
|
|
121
|
-
var e;
|
|
122
|
-
return (e = t.theme.sizes) == null ? void 0 : e.large;
|
|
123
|
-
}};
|
|
124
|
-
${(t) => !t["data-show-header"] && s`
|
|
125
|
-
> div {
|
|
126
|
-
${J("h1", s`
|
|
127
|
-
display: none;
|
|
128
|
-
`)}
|
|
129
|
-
}
|
|
130
|
-
`}
|
|
131
|
-
|
|
132
|
-
@media (hover: hover) {
|
|
133
|
-
button:hover {
|
|
134
|
-
text-decoration: underline;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`, c = l(K)`
|
|
138
|
-
${Q}
|
|
139
|
-
font-weight: 300;
|
|
140
|
-
|
|
141
|
-
p {
|
|
142
|
-
white-space: normal;
|
|
143
|
-
}
|
|
144
|
-
`, ee = l.li`
|
|
145
|
-
${c} {
|
|
146
|
-
display: none;
|
|
147
|
-
&:not(:only-child) {
|
|
148
|
-
${(t) => {
|
|
149
|
-
var e, a, n;
|
|
150
|
-
return ((e = t.theme.sizes) == null ? void 0 : e.cardinal) && ((a = t.theme.sizes) == null ? void 0 : a.normal) && s`
|
|
151
|
-
margin: ${(n = t.theme.sizes) == null ? void 0 : n.normal} 0;
|
|
152
|
-
`;
|
|
153
|
-
}}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
${(t) => t["data-expanded"] && s`
|
|
158
|
-
${c} {
|
|
159
|
-
display: block;
|
|
160
|
-
}
|
|
161
|
-
`}
|
|
162
|
-
|
|
163
|
-
> span {
|
|
164
|
-
display: block;
|
|
165
|
-
font-weight: 300;
|
|
166
|
-
color: ${(t) => {
|
|
167
|
-
var e;
|
|
168
|
-
return (e = t.theme.colors) == null ? void 0 : e.accent;
|
|
169
|
-
}};
|
|
170
|
-
}
|
|
171
|
-
`, te = l(U)`
|
|
172
|
-
margin: 0 0 0 ${(t) => {
|
|
173
|
-
var e;
|
|
174
|
-
return (e = t.theme.sizes) == null ? void 0 : e.small;
|
|
175
|
-
}};
|
|
176
|
-
line {
|
|
177
|
-
stroke: ${(t) => {
|
|
178
|
-
var e;
|
|
179
|
-
return (e = t.theme.colors) == null ? void 0 : e.primary;
|
|
180
|
-
}};
|
|
181
|
-
}
|
|
182
|
-
`, ae = l(V)`
|
|
183
|
-
font-size: ${(t) => {
|
|
184
|
-
var e;
|
|
185
|
-
return (e = t.theme.fonts) == null ? void 0 : e.small;
|
|
186
|
-
}};
|
|
187
|
-
font-weight: 300;
|
|
188
|
-
`;
|
|
189
|
-
export {
|
|
190
|
-
re as default
|
|
191
|
-
};
|
|
192
|
-
//# sourceMappingURL=notification-list.682419d0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list.682419d0.js","sources":["../src/notification-list.tsx"],"sourcesContent":["import { Notification } from '@telia-ace/knowledge-widget-core';\r\nimport {\r\n borderTabStyle,\r\n Button,\r\n contentBox,\r\n createEmptyComponent,\r\n DateFormats,\r\n genericHtml,\r\n headingElement,\r\n ItemList,\r\n itemList,\r\n Loader,\r\n loadingOpacity,\r\n Paragraph,\r\n SymbolBadge,\r\n Timestamp,\r\n useContainer,\r\n useProperties,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React, { useState } from 'react';\r\nimport styled, { css } from 'styled-components';\r\nimport { NotificationListComponentProps } from './notification-list-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst NotificationList: React.SFC<Props> = ({ className, ...other }) => {\r\n const [expanded, setExpanded] = useState<string | null>(null);\r\n const container = useContainer();\r\n const {\r\n showHeader,\r\n notificationList,\r\n loading = false,\r\n } = useProperties<NotificationListComponentProps>();\r\n\r\n const {\r\n id,\r\n title,\r\n symbol,\r\n notifications = [],\r\n defaultHeaderOptions = { visible: true },\r\n } = notificationList || {};\r\n\r\n if (!notifications.length && !loading) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-notification-list'),\r\n });\r\n }\r\n\r\n return (\r\n <StyledItemList\r\n {...other}\r\n data-loading={loading}\r\n data-show-header={\r\n typeof showHeader === 'boolean' ? showHeader : defaultHeaderOptions.visible\r\n }\r\n className={appendClassNames(className, 'humany-notification-list')}\r\n data-notification-category={id}\r\n header={title}\r\n symbol={symbol}\r\n items={notifications}\r\n renderItem={({ id, title, body, modified, expandable }: Notification) => (\r\n <StyledItem\r\n key={id}\r\n data-notification={id}\r\n data-expanded={expandable ? expanded === id : true}\r\n >\r\n {expandable ? (\r\n <>\r\n <StyledButton\r\n title={title}\r\n aria-label={title}\r\n aria-expanded={expanded === id}\r\n onClick={() => setExpanded(expanded === id ? null : id)}\r\n >\r\n <span>{title}</span>\r\n <StyledSymbolBadge\r\n size={11}\r\n symbol={{\r\n type: 'Svg',\r\n content: `caret-${expanded === id ? 'up' : 'down'}`,\r\n }}\r\n />\r\n </StyledButton>\r\n <StyledParagraph html={body} />\r\n {modified && (\r\n <StyledTimestamp\r\n format={DateFormats.YYYY_MM_DD}\r\n timestamp={modified}\r\n />\r\n )}\r\n </>\r\n ) : (\r\n <StyledParagraph html={body} />\r\n )}\r\n </StyledItem>\r\n )}\r\n >\r\n <Loader loading={loading} />\r\n </StyledItemList>\r\n );\r\n};\r\n\r\nconst StyledButton = styled(Button)`\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n width: 100%;\r\n text-align: left;\r\n svg,\r\n i {\r\n color: ${(p) => p.theme.colors?.primary};\r\n }\r\n span {\r\n color: ${(p) => p.theme.colors?.text};\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n flex: 1;\r\n white-space: nowrap;\r\n }\r\n &:focus {\r\n ${(p) =>\r\n p.theme.accessibility?.isTabbing &&\r\n css`\r\n ${borderTabStyle}\r\n span {\r\n color: ${p.theme.colors?.primary};\r\n text-decoration: underline;\r\n }\r\n `};\r\n }\r\n`;\r\n\r\nconst StyledItemList = styled(ItemList)<\r\n {\r\n 'data-loading': boolean;\r\n 'data-show-header': boolean;\r\n } & any\r\n>`\r\n ${loadingOpacity}\r\n ${contentBox}\r\n ${itemList}\r\n overflow: hidden;\r\n justify-content: flex-start;\r\n padding: ${(p) => p.theme.sizes?.large};\r\n ${(p) =>\r\n !p['data-show-header'] &&\r\n css`\r\n > div {\r\n ${headingElement(\r\n 'h1',\r\n css`\r\n display: none;\r\n `\r\n )}\r\n }\r\n `}\r\n\r\n @media (hover: hover) {\r\n button:hover {\r\n text-decoration: underline;\r\n }\r\n }\r\n`;\r\n\r\nconst StyledParagraph = styled(Paragraph)`\r\n ${genericHtml}\r\n font-weight: 300;\r\n\r\n p {\r\n white-space: normal;\r\n }\r\n`;\r\n\r\nconst StyledItem = styled.li<{ 'data-expanded': boolean }>`\r\n ${StyledParagraph} {\r\n display: none;\r\n &:not(:only-child) {\r\n ${(p) =>\r\n p.theme.sizes?.cardinal &&\r\n p.theme.sizes?.normal &&\r\n css`\r\n margin: ${p.theme.sizes?.normal} 0;\r\n `}\r\n }\r\n }\r\n\r\n ${(p) =>\r\n p['data-expanded'] &&\r\n css`\r\n ${StyledParagraph} {\r\n display: block;\r\n }\r\n `}\r\n\r\n > span {\r\n display: block;\r\n font-weight: 300;\r\n color: ${(p) => p.theme.colors?.accent};\r\n }\r\n`;\r\n\r\nconst StyledSymbolBadge = styled(SymbolBadge)`\r\n margin: 0 0 0 ${(p) => p.theme.sizes?.small};\r\n line {\r\n stroke: ${(p) => p.theme.colors?.primary};\r\n }\r\n`;\r\n\r\nconst StyledTimestamp = styled(Timestamp)`\r\n font-size: ${(p) => p.theme.fonts?.small};\r\n font-weight: 300;\r\n`;\r\n\r\nexport default NotificationList;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,KAAqC,CAAC,MAA4B;AAA5B,aAAE,mBAAF,GAAgB,MAAhB,GAAgB,CAAd;AAC1C,QAAM,CAAC,GAAU,KAAe,EAAwB,IAAI,GACtD,IAAY,KACZ;AAAA,IACF;AAAA,IACA;AAAA,IACA,aAAU;AAAA,MACV,EAA8C,GAE5C;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAgB,CAAC;AAAA,IACjB,0BAAuB,EAAE,SAAS,GAAK;AAAA,MACvC,KAAoB,CAAA;AAExB,SAAI,CAAC,EAAc,UAAU,CAAC,IACnB,EAAqB,GAAW,QAChC,IADgC;AAAA,IAEnC,WAAW,EAAiB,GAAW,0BAA0B;AAAA,EAAA,EACpE,IAIA,kBAAA,cAAA,GAAA,QACO,IADP;AAAA,IAEG,gBAAc;AAAA,IACd,oBACI,OAAO,KAAe,YAAY,IAAa,EAAqB;AAAA,IAExE,WAAW,EAAiB,GAAW,0BAA0B;AAAA,IACjE,8BAA4B;AAAA,IAC5B,QAAQ;AAAA,IACR;AAAA,IACA,OAAO;AAAA,IACP,YAAY,CAAC,EAAE,IAAA,GAAI,UAAO,SAAM,aAAU,oBACrC,kBAAA,cAAA,IAAA;AAAA,MACG,KAAK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