@telia-ace/knowledge-widget-components-notification-list 1.0.21 → 1.0.22
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
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":[],"mappings":";;;;;;;;;;;;;;;AAiBa,MAAA,IAA4B,CAAC,MAAyB;AAC/D,QAAM,EAAE,cAAm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;AAAA,MACzC,YAAY;AAAA,QACR,EAAM,OAAO;AAAA,QACb,EAAM,OAAO;AAAA,QACf,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAAA,MACnB,cAAc,EAAM,OAAO;AAAA,IAAA,CAC9B,CACL,EACC,KAAK,CAAI,EACT,MAAM,CAAC,MAAU;AACd,UAAI;AACA,eAAO,EAAK,CAAK;AAAA,IACrB,CACH,CACR;AAAA,EAAA,CACJ,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;AAAA,MAAA,EACrB,GACD,EAAU,QAAQ,SAAS,SAAS,EAAE,UAAQ,CAAA;AAAA,IAAA;AAGlD,MAAU,QAAQ,OAAO,SAAS,CAAC,EAAE,UAAO,2BAAsC;AAC9E,UAAI;AACO,eAAA,EAAU,QAAQ,SAAS,WAAW;AAAA,UACzC;AAAA,UACA,SAAS;AAAA,UACT,kBAAkB;AAAA,QAAA,CACrB;AAGL,YAAM,EAAE,aAAU,wBACd,EAAU,WAA2C,GAEnD,IAAa;AAAA,QACf,kBACI,EAAkB,KAAK,CAAC,MAAM,EAAE,OAAO,CAAQ,KAAK;AAAA,MAAA;AAGrD,aAAA,EAAU,QAAQ,SAAS,WAAW,QACtC,IADsC;AAAA,QAEzC,SAAS;AAAA,MAAA,EACZ;AAAA,IAAA,CACJ,GAED,EAAU,QAAQ,OAAO,WAAW,CAAC,MAC1B,EAAU,gBAAgB,QAAK,IAAL,EAAY,SAAS,KAAO,CAChE,GAED,EAAU,SAAS,QAAQ,EAAE,KAAK,CAAC,MAAW;AACpC,YAAA,EAAE,cAAW,EAAO,aAAa;AACvC,QAAM,CAAM;AAAA,IAAA,CACf,GAED,EAAU,kBAAkB,CAAC,GAAY,EAAE,iBAAmB;AACpD,QAAA,EAAQ,UAAU,MAAM;AAAA,IAAA,CACjC;AAAA,EAAA,CAET,EACK,KAAK,MACK,EAAgB,GAAW,qBAAqB,CAAC,MAAc;AAClE,MAAU,QAAQ,MAAM,2BAA2B,CAAC,GAAO,MAChD,EACF,SAAS,YAAY,EACrB,KAAK,CAAC,MACH,EAAW,MAAM,EAAS,mBAAmB;AAAA,MACzC,YAAY;AAAA,QACR,EAAM,OAAO;AAAA,QACb,EAAM,OAAO;AAAA,QACf,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAAA,MACnB,cAAc,EAAM,OAAO;AAAA,IAAA,CAC9B,CACL,EACC,KAAK,CAAI,EACT,MAAM,CAAC,MAAU;AACd,UAAI;AACA,eAAO,EAAK,CAAK;AAAA,IACrB,CACH,CACR;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI;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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list.682419d0.js","sources":["../src/notification-list.tsx"],"sourcesContent":["import { Notification } from '@telia-ace/knowledge-widget-core';\nimport {\n borderTabStyle,\n Button,\n contentBox,\n createEmptyComponent,\n DateFormats,\n genericHtml,\n headingElement,\n ItemList,\n itemList,\n Loader,\n loadingOpacity,\n Paragraph,\n SymbolBadge,\n Timestamp,\n useContainer,\n useProperties,\n} from '@telia-ace/knowledge-widget-ui';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React, { useState } from 'react';\nimport styled, { css } from 'styled-components';\nimport { NotificationListComponentProps } from './notification-list-component';\n\ntype Props = {\n className: string;\n};\n\nconst NotificationList: React.SFC<Props> = ({ className, ...other }) => {\n const [expanded, setExpanded] = useState<string | null>(null);\n const container = useContainer();\n const {\n showHeader,\n notificationList,\n loading = false,\n } = useProperties<NotificationListComponentProps>();\n\n const {\n id,\n title,\n symbol,\n notifications = [],\n defaultHeaderOptions = { visible: true },\n } = notificationList || {};\n\n if (!notifications.length && !loading) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-notification-list'),\n });\n }\n\n return (\n <StyledItemList\n {...other}\n data-loading={loading}\n data-show-header={\n typeof showHeader === 'boolean' ? showHeader : defaultHeaderOptions.visible\n }\n className={appendClassNames(className, 'humany-notification-list')}\n data-notification-category={id}\n header={title}\n symbol={symbol}\n items={notifications}\n renderItem={({ id, title, body, modified, expandable }: Notification) => (\n <StyledItem\n key={id}\n data-notification={id}\n data-expanded={expandable ? expanded === id : true}\n >\n {expandable ? (\n <>\n <StyledButton\n title={title}\n aria-label={title}\n aria-expanded={expanded === id}\n onClick={() => setExpanded(expanded === id ? null : id)}\n >\n <span>{title}</span>\n <StyledSymbolBadge\n size={11}\n symbol={{\n type: 'Svg',\n content: `caret-${expanded === id ? 'up' : 'down'}`,\n }}\n />\n </StyledButton>\n <StyledParagraph html={body} />\n {modified && (\n <StyledTimestamp\n format={DateFormats.YYYY_MM_DD}\n timestamp={modified}\n />\n )}\n </>\n ) : (\n <StyledParagraph html={body} />\n )}\n </StyledItem>\n )}\n >\n <Loader loading={loading} />\n </StyledItemList>\n );\n};\n\nconst StyledButton = styled(Button)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n text-align: left;\n svg,\n i {\n color: ${(p) => p.theme.colors?.primary};\n }\n span {\n color: ${(p) => p.theme.colors?.text};\n font-size: ${(p) => p.theme.fonts?.normal};\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 1;\n white-space: nowrap;\n }\n &:focus {\n ${(p) =>\n p.theme.accessibility?.isTabbing &&\n css`\n ${borderTabStyle}\n span {\n color: ${p.theme.colors?.primary};\n text-decoration: underline;\n }\n `};\n }\n`;\n\nconst StyledItemList = styled(ItemList)<\n {\n 'data-loading': boolean;\n 'data-show-header': boolean;\n } & any\n>`\n ${loadingOpacity}\n ${contentBox}\n ${itemList}\n overflow: hidden;\n justify-content: flex-start;\n padding: ${(p) => p.theme.sizes?.large};\n ${(p) =>\n !p['data-show-header'] &&\n css`\n > div {\n ${headingElement(\n 'h1',\n css`\n display: none;\n `\n )}\n }\n `}\n\n @media (hover: hover) {\n button:hover {\n text-decoration: underline;\n }\n }\n`;\n\nconst StyledParagraph = styled(Paragraph)`\n ${genericHtml}\n font-weight: 300;\n\n p {\n white-space: normal;\n }\n`;\n\nconst StyledItem = styled.li<{ 'data-expanded': boolean }>`\n ${StyledParagraph} {\n display: none;\n &:not(:only-child) {\n ${(p) =>\n p.theme.sizes?.cardinal &&\n p.theme.sizes?.normal &&\n css`\n margin: ${p.theme.sizes?.normal} 0;\n `}\n }\n }\n\n ${(p) =>\n p['data-expanded'] &&\n css`\n ${StyledParagraph} {\n display: block;\n }\n `}\n\n > span {\n display: block;\n font-weight: 300;\n color: ${(p) => p.theme.colors?.accent};\n }\n`;\n\nconst StyledSymbolBadge = styled(SymbolBadge)`\n margin: 0 0 0 ${(p) => p.theme.sizes?.small};\n line {\n stroke: ${(p) => p.theme.colors?.primary};\n }\n`;\n\nconst StyledTimestamp = styled(Timestamp)`\n font-size: ${(p) => p.theme.fonts?.small};\n font-weight: 300;\n`;\n\nexport default NotificationList;\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,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kBAAR,kBAAuB,cACvB;AAAA,kBACM;AAAA;AAAA,6BAEW,OAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOvC,IAAiB,EAAO,CAAQ;AAAA,MAMhC;AAAA,MACA;AAAA,IACF;AAAA;AAAA;AAAA,eAGW,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,MAC/B,CAAC,MACC,CAAC,EAAE,uBACH;AAAA;AAAA,kBAEU,EACE,MACA;AAAA;AAAA,qBAGJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWV,IAAkB,EAAO,CAAS;AAAA,MAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQA,KAAa,EAAO;AAAA,MACpB;AAAA;AAAA;AAAA,cAGQ,CAAC;;AACC,iBAAE,MAAM,UAAR,kBAAe,aACf,QAAE,MAAM,UAAR,kBAAe,WACf;AAAA,8BACc,OAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAKvC,CAAC,MACC,EAAE,oBACF;AAAA,cACM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAQG,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA,GAIlC,KAAoB,EAAO,CAAW;AAAA,oBACxB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA,kBAExB,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA,GAInC,KAAkB,EAAO,CAAS;AAAA,iBACvB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;"}
|
|
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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AAA,6BAEW,OAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOvC,IAAiB,EAAO,CAAQ;AAAA,MAMhC;AAAA,MACA;AAAA,IACF;AAAA;AAAA;AAAA,eAGW,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,MAC/B,CAAC,MACC,CAAC,EAAE,uBACH;AAAA;AAAA,kBAEU,EACE,MACA;AAAA;AAAA,qBAGJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWV,IAAkB,EAAO,CAAS;AAAA,MAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQA,KAAa,EAAO;AAAA,MACpB;AAAA;AAAA;AAAA,cAGQ,CAAC;;AACC,iBAAE,MAAM,UAAR,kBAAe,aACf,QAAE,MAAM,UAAR,kBAAe,WACf;AAAA,8BACc,OAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAKvC,CAAC,MACC,EAAE,oBACF;AAAA,cACM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAQG,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA,GAIlC,KAAoB,EAAO,CAAW;AAAA,oBACxB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA,kBAExB,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA,GAInC,KAAkB,EAAO,CAAS;AAAA,iBACvB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type Props = {
|
|
3
|
-
className: string;
|
|
4
|
-
};
|
|
5
|
-
declare const NotificationList: React.SFC<Props>;
|
|
6
|
-
export default NotificationList;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
className: string;
|
|
4
|
+
};
|
|
5
|
+
declare const NotificationList: React.SFC<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.22",
|
|
4
4
|
"description": "Notification list component for ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"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.
|
|
28
|
+
"@telia-ace/knowledge-widget-core": "^1.0.18",
|
|
29
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.29",
|
|
30
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.24",
|
|
31
|
+
"@telia-ace/widget-utilities": "^1.0.3",
|
|
32
32
|
"@webprovisions/platform": "^1.1.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@types/react-dom": "^16.8.0",
|
|
42
42
|
"@types/styled-components": "^5.1.7"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b30b55cc433567b8f9de20d83b840919ffc0d58a"
|
|
45
45
|
}
|