@telia-ace/knowledge-widget-components-notification-list 1.0.16 → 1.0.19

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,82 +1,63 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { createEventSubscriber, extendComponent } from "@telia-ace/knowledge-widget-core";
21
- import { DataType } from "@telia-ace/knowledge-widget-types-grid";
22
- import { createReactComponent } from "@telia-ace/knowledge-widget-ui";
23
- const NotificationListComponent = (container) => {
24
- const { events } = container.get("$widget");
25
- const [subscribe, unsubscribe] = createEventSubscriber(events);
26
- return createReactComponent(container, "notification-list", import("./notification-list.js"), (component) => {
27
- const fetch = (params) => {
28
- component.writeProperties(__spreadProps(__spreadValues({}, component.properties()), {
29
- loading: true,
1
+ var m = Object.defineProperty, b = Object.defineProperties;
2
+ var v = Object.getOwnPropertyDescriptors;
3
+ var h = Object.getOwnPropertySymbols;
4
+ var y = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
+ var d = (t, e, i) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, c = (t, e) => {
6
+ for (var i in e || (e = {}))
7
+ y.call(e, i) && d(t, i, e[i]);
8
+ if (h)
9
+ for (var i of h(e))
10
+ C.call(e, i) && d(t, i, e[i]);
11
+ return t;
12
+ }, n = (t, e) => b(t, v(e));
13
+ import { createEventSubscriber as L, extendComponent as w } from "@telia-ace/knowledge-widget-core";
14
+ import { DataType as D } from "@telia-ace/knowledge-widget-types-grid";
15
+ import { createReactComponent as P } from "@telia-ace/knowledge-widget-ui";
16
+ const E = (t) => {
17
+ const { events: e } = t.get("$widget"), [i, u] = L(e);
18
+ return P(t, "notification-list", import("./notification-list.682419d0.js"), (a) => {
19
+ const o = (r) => {
20
+ a.writeProperties(n(c({}, a.properties()), {
21
+ loading: !0,
30
22
  error: void 0,
31
23
  notificationList: void 0
32
- }));
33
- component.actions.dispatch("fetch", { params });
24
+ })), a.actions.dispatch("fetch", { params: r });
34
25
  };
35
- component.actions.create("fetch", ({ error, notificationLists }) => {
36
- if (error) {
37
- return component.actions.dispatch("fetched", {
38
- error,
39
- loading: true,
26
+ a.actions.create("fetch", ({ error: r, notificationLists: s }) => {
27
+ if (r)
28
+ return a.actions.dispatch("fetched", {
29
+ error: r,
30
+ loading: !0,
40
31
  notificationList: void 0
41
32
  });
42
- }
43
- const { category, notificationList } = component.properties();
44
- const properties = {
45
- notificationList: notificationLists.find((n) => n.id === category) || notificationList
33
+ const { category: f, notificationList: p } = a.properties(), g = {
34
+ notificationList: s.find((l) => l.id === f) || p
46
35
  };
47
- return component.actions.dispatch("fetched", __spreadProps(__spreadValues({}, properties), {
48
- loading: true
36
+ return a.actions.dispatch("fetched", n(c({}, g), {
37
+ loading: !0
49
38
  }));
39
+ }), a.actions.create("fetched", (r) => a.writeProperties(n(c({}, r), { loading: !1 }))), t.getAsync("router").then((r) => {
40
+ const { params: s } = r.getRouteData();
41
+ o(s);
42
+ }), i("router:changed", (r, { current: s }) => {
43
+ o(s.routeData.params);
50
44
  });
51
- component.actions.create("fetched", (input) => {
52
- return component.writeProperties(__spreadProps(__spreadValues({}, input), { loading: false }));
53
- });
54
- container.getAsync("router").then((router) => {
55
- const { params } = router.getRouteData();
56
- fetch(params);
57
- });
58
- subscribe("router:changed", (event, { current }) => {
59
- fetch(current.routeData.params);
60
- });
61
- }).then(() => {
62
- return extendComponent(container, "notification-list", (component) => {
63
- component.actions.watch("notification-list.fetch", (input, next) => {
64
- return container.getAsync("dataClient").then((dataClient) => dataClient.fetch(DataType.NotificationLists, {
65
- categories: [
66
- input.params.guideCategory,
67
- input.params.contactCategory
68
- ].filter((c) => !!c),
69
- searchPhrase: input.params.phrase
70
- })).then(next).catch((error) => {
71
- if (error) {
72
- return next(error);
73
- }
74
- });
75
- });
76
- });
77
- }).then(() => {
78
- unsubscribe();
45
+ }).then(() => w(t, "notification-list", (a) => {
46
+ a.actions.watch("notification-list.fetch", (o, r) => t.getAsync("dataClient").then((s) => s.fetch(D.NotificationLists, {
47
+ categories: [
48
+ o.params.guideCategory,
49
+ o.params.contactCategory
50
+ ].filter((f) => !!f),
51
+ searchPhrase: o.params.phrase
52
+ })).then(r).catch((s) => {
53
+ if (s)
54
+ return r(s);
55
+ }));
56
+ })).then(() => {
57
+ u();
79
58
  });
80
59
  };
81
- export { NotificationListComponent as default };
60
+ export {
61
+ E as default
62
+ };
82
63
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/notification-list-component.ts"],"sourcesContent":["import {\r\n createEventSubscriber,\r\n extendComponent,\r\n NotificationList,\r\n} from '@telia-ace/knowledge-widget-core';\r\nimport { DataClient, DataType, NotificationResults } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container, Widget } from '@webprovisions/platform';\r\n\r\nexport type NotificationListComponentProps = {\r\n category?: string;\r\n showHeader?: boolean;\r\n notificationList?: NotificationList; // internal\r\n};\r\n\r\ntype FetchResults = NotificationResults & { error: any };\r\n\r\nexport const NotificationListComponent = (container: Container) => {\r\n const { events }: Widget = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n return createReactComponent(\r\n container,\r\n 'notification-list',\r\n import('./notification-list'),\r\n (component) => {\r\n const fetch = (params: { [key: string]: any }) => {\r\n component.writeProperties({\r\n ...component.properties<NotificationListComponentProps>(),\r\n loading: true,\r\n error: undefined,\r\n notificationList: undefined,\r\n });\r\n component.actions.dispatch('fetch', { params });\r\n };\r\n\r\n component.actions.create('fetch', ({ error, notificationLists }: FetchResults) => {\r\n if (error) {\r\n return component.actions.dispatch('fetched', {\r\n error,\r\n loading: true,\r\n notificationList: undefined,\r\n });\r\n }\r\n\r\n const { category, notificationList } =\r\n component.properties<NotificationListComponentProps>();\r\n\r\n const properties = {\r\n notificationList:\r\n notificationLists.find((n) => n.id === category) || notificationList,\r\n };\r\n\r\n return component.actions.dispatch('fetched', {\r\n ...properties,\r\n loading: true,\r\n });\r\n });\r\n\r\n component.actions.create('fetched', (input) => {\r\n return component.writeProperties({ ...input, loading: false });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n\r\n subscribe('router:changed', (event: any, { current }: any) => {\r\n fetch(current.routeData.params);\r\n });\r\n }\r\n )\r\n .then(() => {\r\n return extendComponent(container, 'notification-list', (component) => {\r\n component.actions.watch('notification-list.fetch', (input, next) => {\r\n return container\r\n .getAsync('dataClient')\r\n .then((dataClient: DataClient) =>\r\n dataClient.fetch(DataType.NotificationLists, {\r\n categories: [\r\n input.params.guideCategory,\r\n input.params.contactCategory,\r\n ].filter((c) => !!c),\r\n searchPhrase: input.params.phrase,\r\n })\r\n )\r\n .then(next)\r\n .catch((error) => {\r\n if (error) {\r\n return next(error);\r\n }\r\n });\r\n });\r\n });\r\n })\r\n .then(() => {\r\n unsubscribe();\r\n });\r\n};\r\n\r\nexport default NotificationListComponent;\r\n"],"names":[],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M;AACR,WAAO,gBAAgB,WAAW,qBAAqB,CAAC,cAAc;AAClE,gBAAU,QAAQ,MAAM,2BAA2B,CAAC,OAAO,SAAS;AACzD,eAAA,UACF,SAAS,YAAY,EACrB,KAAK,CAAC,eACH,WAAW,MAAM,SAAS,mBAAmB;AAAA,UACzC,YAAY;AAAA,YACR,MAAM,OAAO;AAAA,YACb,MAAM,OAAO;AAAA,YACf,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAAA,UACnB,cAAc,MAAM,OAAO;AAAA,QAAA,CAC9B,CACL,EACC,KAAK,IAAI,EACT,MAAM,CAAC,UAAU;AACd,cAAI,OAAO;AACP,mBAAO,KAAK,KAAK;AAAA,UACrB;AAAA,QAAA,CACH;AAAA,MAAA,CACR;AAAA,IAAA,CACJ;AAAA,EAAA,CACJ,EACA,KAAK,MAAM;AACI;EAAA,CACf;AACT;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/notification-list-component.ts"],"sourcesContent":["import {\r\n createEventSubscriber,\r\n extendComponent,\r\n NotificationList,\r\n} from '@telia-ace/knowledge-widget-core';\r\nimport { DataClient, DataType, NotificationResults } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container, Widget } from '@webprovisions/platform';\r\n\r\nexport type NotificationListComponentProps = {\r\n category?: string;\r\n showHeader?: boolean;\r\n notificationList?: NotificationList; // internal\r\n};\r\n\r\ntype FetchResults = NotificationResults & { error: any };\r\n\r\nexport const NotificationListComponent = (container: Container) => {\r\n const { events }: Widget = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n return createReactComponent(\r\n container,\r\n 'notification-list',\r\n import('./notification-list'),\r\n (component) => {\r\n const fetch = (params: { [key: string]: any }) => {\r\n component.writeProperties({\r\n ...component.properties<NotificationListComponentProps>(),\r\n loading: true,\r\n error: undefined,\r\n notificationList: undefined,\r\n });\r\n component.actions.dispatch('fetch', { params });\r\n };\r\n\r\n component.actions.create('fetch', ({ error, notificationLists }: FetchResults) => {\r\n if (error) {\r\n return component.actions.dispatch('fetched', {\r\n error,\r\n loading: true,\r\n notificationList: undefined,\r\n });\r\n }\r\n\r\n const { category, notificationList } =\r\n component.properties<NotificationListComponentProps>();\r\n\r\n const properties = {\r\n notificationList:\r\n notificationLists.find((n) => n.id === category) || notificationList,\r\n };\r\n\r\n return component.actions.dispatch('fetched', {\r\n ...properties,\r\n loading: true,\r\n });\r\n });\r\n\r\n component.actions.create('fetched', (input) => {\r\n return component.writeProperties({ ...input, loading: false });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n\r\n subscribe('router:changed', (event: any, { current }: any) => {\r\n fetch(current.routeData.params);\r\n });\r\n }\r\n )\r\n .then(() => {\r\n return extendComponent(container, 'notification-list', (component) => {\r\n component.actions.watch('notification-list.fetch', (input, next) => {\r\n return container\r\n .getAsync('dataClient')\r\n .then((dataClient: DataClient) =>\r\n dataClient.fetch(DataType.NotificationLists, {\r\n categories: [\r\n input.params.guideCategory,\r\n input.params.contactCategory,\r\n ].filter((c) => !!c),\r\n searchPhrase: input.params.phrase,\r\n })\r\n )\r\n .then(next)\r\n .catch((error) => {\r\n if (error) {\r\n return next(error);\r\n }\r\n });\r\n });\r\n });\r\n })\r\n .then(() => {\r\n unsubscribe();\r\n });\r\n};\r\n\r\nexport default NotificationListComponent;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiBa,MAAA,IAA4B,CAAC,MAAyB;AAC/D,QAAM,EAAE,cAAmB,EAAU,IAAI,SAAS,GAC5C,CAAC,GAAW,KAAe,EAAsB,CAAM;AAE7D,SAAO,EACH,GACA,qBACA,OAAO,oCACP,CAAC,MAAc;AACL,UAAA,IAAQ,CAAC,MAAmC;AAC9C,QAAU,gBAAgB,QACnB,EAAU,WAA2C,IADlC;AAAA,QAEtB,SAAS;AAAA,QACT,OAAO;AAAA,QACP,kBAAkB;A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ACrB,CACH,CACR;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI;EAAA,CACf;AACT;"}
@@ -0,0 +1,192 @@
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
@@ -0,0 +1 @@
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,E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EAAO,CAAS;AAAA,iBACvB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;"}
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  declare type Props = {
3
3
  className: string;
4
4
  };
5
- declare const NotificationList: React.FC<Props>;
5
+ declare const NotificationList: React.SFC<Props>;
6
6
  export default NotificationList;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-notification-list",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "description": "Notification list component for ACE Knowledge Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
7
7
  "keywords": [
8
8
  "telia"
9
9
  ],
10
- "source": "src/index.ts",
11
- "module": "dist/index.js",
10
+ "main": "dist/index.js",
11
+ "type": "module",
12
12
  "types": "dist/index.d.ts",
13
13
  "files": [
14
14
  "LICENSE.txt",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "dependencies": {
28
- "@telia-ace/knowledge-widget-core": "^1.0.13",
29
- "@telia-ace/knowledge-widget-types-grid": "^1.0.22",
30
- "@telia-ace/knowledge-widget-ui": "^1.0.19",
28
+ "@telia-ace/knowledge-widget-core": "^1.0.17",
29
+ "@telia-ace/knowledge-widget-types-grid": "^1.0.26",
30
+ "@telia-ace/knowledge-widget-ui": "^1.0.23",
31
31
  "@telia-ace/widget-utilities": "^1.0.2",
32
32
  "@webprovisions/platform": "^1.1.2"
33
33
  },
@@ -41,5 +41,5 @@
41
41
  "@types/react-dom": "^16.8.0",
42
42
  "@types/styled-components": "^5.1.7"
43
43
  },
44
- "gitHead": "43581cc2553504251c952d927cc6c6743d2412ec"
44
+ "gitHead": "44efbdca7f57d6997132792020922c89b013c44d"
45
45
  }
@@ -1,60 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- import { useContainer, useProperties, createEmptyComponent, NotificationList as NotificationList$1, contentBox } from "@telia-ace/knowledge-widget-ui";
33
- import { appendClassNames } from "@telia-ace/widget-utilities";
34
- import React from "react";
35
- import styled from "styled-components";
36
- const NotificationList = (_a) => {
37
- var _b = _a, { className } = _b, other = __objRest(_b, ["className"]);
38
- const container = useContainer();
39
- const {
40
- showHeader,
41
- notificationList,
42
- loading = false
43
- } = useProperties();
44
- if (!(notificationList == null ? void 0 : notificationList.notifications.length) && !loading) {
45
- return createEmptyComponent(container, __spreadProps(__spreadValues({}, other), {
46
- className: appendClassNames(className, "humany-notification-list")
47
- }));
48
- }
49
- return /* @__PURE__ */ React.createElement(StyledNotificationList, __spreadProps(__spreadValues({}, other), {
50
- className,
51
- notificationList,
52
- loading,
53
- showHeader
54
- }));
55
- };
56
- const StyledNotificationList = styled(NotificationList$1)`
57
- ${contentBox}
58
- `;
59
- export { NotificationList as default };
60
- //# sourceMappingURL=notification-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-list.js","sources":["../src/notification-list.tsx"],"sourcesContent":["import {\r\n contentBox,\r\n createEmptyComponent,\r\n NotificationList as NotificationListUi,\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 from 'react';\r\nimport styled 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.FC<Props> = ({ className, ...other }) => {\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 if (!notificationList?.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 <StyledNotificationList\r\n {...other}\r\n className={className}\r\n notificationList={notificationList}\r\n loading={loading}\r\n showHeader={showHeader}\r\n />\r\n );\r\n};\r\n\r\nconst StyledNotificationList = styled(NotificationListUi)`\r\n ${contentBox}\r\n`;\r\n\r\nexport default NotificationList;\r\n"],"names":["NotificationListUi"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,mBAAoC,CAAC,OAA4B;AAA5B,eAAE,gBAAF,IAAgB,kBAAhB,IAAgB,CAAd;AACzC,QAAM,YAAY;AACZ,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACV,cAA8C;AAElD,MAAI,CAAC,sDAAkB,cAAc,WAAU,CAAC,SAAS;AACrD,WAAO,qBAAqB,WAAW,iCAChC,QADgC;AAAA,MAEnC,WAAW,iBAAiB,WAAW,0BAA0B;AAAA,IAAA,EACpE;AAAA,EACL;AAEA,SACK,sBAAA,cAAA,wBAAA,iCACO,QADP;AAAA,IAEG;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACJ;AAER;AAEA,MAAM,yBAAyB,OAAOA,kBAAkB;AAAA,MAClD;AAAA;;"}