@stack-spot/portal-components 1.3.3-rc → 1.3.3
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/CHANGELOG.md +16 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.d.ts +7 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.d.ts.map +1 -1
- package/dist/components/LazyMarkdown/BlockquoteMd.js +14 -1
- package/dist/components/LazyMarkdown/BlockquoteMd.js.map +1 -1
- package/dist/components/LazyMarkdown/CodeViewer.d.ts +5 -0
- package/dist/components/LazyMarkdown/CodeViewer.d.ts.map +1 -1
- package/dist/components/LazyMarkdown/CodeViewer.js +17 -11
- package/dist/components/LazyMarkdown/CodeViewer.js.map +1 -1
- package/dist/components/LazyMarkdown/Markdown.d.ts +8 -0
- package/dist/components/LazyMarkdown/Markdown.d.ts.map +1 -1
- package/dist/components/LazyMarkdown/Markdown.js +8 -0
- package/dist/components/LazyMarkdown/Markdown.js.map +1 -1
- package/dist/components/LazyMarkdown/MarkdownButton.d.ts +11 -0
- package/dist/components/LazyMarkdown/MarkdownButton.d.ts.map +1 -1
- package/dist/components/LazyMarkdown/MarkdownButton.js +5 -0
- package/dist/components/LazyMarkdown/MarkdownButton.js.map +1 -1
- package/dist/components/LazyMarkdown/Video.d.ts +7 -0
- package/dist/components/LazyMarkdown/Video.d.ts.map +1 -1
- package/dist/components/LazyMarkdown/Video.js +7 -0
- package/dist/components/LazyMarkdown/Video.js.map +1 -1
- package/dist/components/Notifications/NotificationComponent.d.ts +6 -0
- package/dist/components/Notifications/NotificationComponent.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationComponent.js +28 -6
- package/dist/components/Notifications/NotificationComponent.js.map +1 -1
- package/dist/components/Notifications/NotificationItem.d.ts +5 -0
- package/dist/components/Notifications/NotificationItem.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationItem.js +36 -10
- package/dist/components/Notifications/NotificationItem.js.map +1 -1
- package/dist/components/StatusCircle.d.ts +2 -3
- package/dist/components/StatusCircle.d.ts.map +1 -1
- package/dist/components/StatusCircle.js +3 -5
- package/dist/components/StatusCircle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/readme.md +0 -1
- package/src/components/LazyMarkdown/BlockquoteMd.tsx +14 -1
- package/src/components/LazyMarkdown/CodeViewer.tsx +18 -11
- package/src/components/LazyMarkdown/Markdown.tsx +11 -1
- package/src/components/LazyMarkdown/MarkdownButton.tsx +11 -0
- package/src/components/LazyMarkdown/Video.tsx +7 -0
- package/src/components/Notifications/NotificationComponent.tsx +31 -7
- package/src/components/Notifications/NotificationItem.tsx +67 -35
- package/src/components/StatusCircle.tsx +3 -5
- package/src/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAiD,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAiD,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9G,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,M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;QACrB,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,kBAAkB;QAC9B,YAAY,EAAE,sBAAsB;KACrC;CACmB,CAAA"}
|
|
@@ -15,11 +15,10 @@ interface WithTooltip {
|
|
|
15
15
|
style?: React.CSSProperties;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Renders a component that displays a colored circle based on the status.
|
|
19
19
|
* It also supports an optional tooltip.
|
|
20
20
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @returns {JSX.Element} The StatusCircle component.
|
|
21
|
+
* @param props the component's props {@link Props}.
|
|
23
22
|
*/
|
|
24
23
|
export declare const StatusCircle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<WithTooltip, Props>> & string & Omit<({ tooltip, className, style }: WithTooltip) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
25
24
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusCircle.d.ts","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AAOA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9E,UAAU,KAAK;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD,UAAU,WAAW;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"StatusCircle.d.ts","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AAOA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9E,UAAU,KAAK;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD,UAAU,WAAW;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAYD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,4LAXiC,WAAW,4FAgBpE,CAAA"}
|
|
@@ -23,19 +23,17 @@ function getColorFromStatus(theme, status) {
|
|
|
23
23
|
/**
|
|
24
24
|
* CircleWithTooltip component that displays a circle with an optional tooltip.
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @returns {JSX.Element} The CircleWithTooltip component.
|
|
26
|
+
* @param props the component's props {@link WithTooltip}.
|
|
28
27
|
*/
|
|
29
28
|
const CircleWithTooltip = ({ tooltip, className, style }) => {
|
|
30
29
|
const circle = _jsx("div", { style: style, className: className });
|
|
31
30
|
return tooltip && tooltip.length ? _jsx(Tooltip, { text: tooltip, children: circle }) : circle;
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
33
|
+
* Renders a component that displays a colored circle based on the status.
|
|
35
34
|
* It also supports an optional tooltip.
|
|
36
35
|
*
|
|
37
|
-
* @param
|
|
38
|
-
* @returns {JSX.Element} The StatusCircle component.
|
|
36
|
+
* @param props the component's props {@link Props}.
|
|
39
37
|
*/
|
|
40
38
|
export const StatusCircle = styled(CircleWithTooltip) `
|
|
41
39
|
background-color: ${({ status, theme }) => getColorFromStatus(theme, status)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusCircle.js","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names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AC;AAWD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAe,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,cAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAQ,CAAA;IAC9D,OAAO,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,OAAO,YAAG,MAAM,GAAW,CAAC,CAAC,CAAC,MAAM,CAAA;AACxF,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAO;sBACtC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAY,EAAE,MAAM,CAAC;;;;CAIpF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { BannerWarning } from './components/BannerWarning.js';
|
|
2
2
|
export { ChatBot } from './components/ChatBot.js';
|
|
3
|
+
export { AsyncContent } from './components/AsyncContent.js';
|
|
3
4
|
export { useKeyboardControls } from './hooks/keyboard.js';
|
|
4
5
|
export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now.js';
|
|
5
6
|
export { useCheckTextOverflow } from './hooks/text.js';
|
|
6
7
|
export { titleEffect, useTitleEffect } from './hooks/title.js';
|
|
7
8
|
export { useEffectOnce } from './hooks/use-effect-once.js';
|
|
9
|
+
export { useDateFormatter } from './hooks/date.js';
|
|
8
10
|
export * from './utils/accessibility.js';
|
|
9
11
|
export * from './utils/cookie.js';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { BannerWarning } from './components/BannerWarning.js';
|
|
2
2
|
export { ChatBot } from './components/ChatBot.js';
|
|
3
|
+
export { AsyncContent } from './components/AsyncContent.js';
|
|
3
4
|
export { useKeyboardControls } from './hooks/keyboard.js';
|
|
4
5
|
export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now.js';
|
|
5
6
|
export { useCheckTextOverflow } from './hooks/text.js';
|
|
6
7
|
export { titleEffect, useTitleEffect } from './hooks/title.js';
|
|
7
8
|
export { useEffectOnce } from './hooks/use-effect-once.js';
|
|
9
|
+
export { useDateFormatter } from './hooks/date.js';
|
|
8
10
|
export * from './utils/accessibility.js';
|
|
9
11
|
export * from './utils/cookie.js';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/portal-components",
|
|
3
|
-
"version": "1.3.3
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./Notifications": "./dist/components/Notifications/index.js",
|
|
15
15
|
"./StatusCircle": "./dist/components/StatusCircle.js",
|
|
16
16
|
"./InfiniteScroll": "./dist/components/InfiniteScroll.js",
|
|
17
|
+
"./ScrollView": "./dist/components/ScrollView.js",
|
|
17
18
|
"./svg": "./dist/svg/index.js",
|
|
18
19
|
"./anchor": "./dist/context/anchor.js"
|
|
19
20
|
},
|
package/readme.md
CHANGED
|
@@ -6,6 +6,13 @@ import { createElement } from 'react'
|
|
|
6
6
|
|
|
7
7
|
type IconName = keyof typeof icons
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* BlockquoteMd component that renders a styled blockquote with an icon and text based on the provided props.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The props for the BlockquoteMd component.
|
|
13
|
+
* @param {any} props.props - The properties passed to the component.
|
|
14
|
+
* @returns {JSX.Element} The BlockquoteMd component.
|
|
15
|
+
*/
|
|
9
16
|
export const BlockquoteMd = ({ props }: { props: any }) => {
|
|
10
17
|
const t = useTranslate(dictionary)
|
|
11
18
|
const arrayNode = props.node
|
|
@@ -44,6 +51,12 @@ export const BlockquoteMd = ({ props }: { props: any }) => {
|
|
|
44
51
|
)
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Get the style for the blockquote based on the block rule.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} blockRule - The block rule to determine the style.
|
|
58
|
+
* @returns {{ color: OneOfColorSchemes, icon: IconName }} The style object containing color and icon.
|
|
59
|
+
*/
|
|
47
60
|
function blockquoteAlertStyle(blockRule: string) {
|
|
48
61
|
const style: Record<string, { color: OneOfColorSchemes, icon: IconName }> = {
|
|
49
62
|
'[!NOTE]': {
|
|
@@ -80,7 +93,7 @@ const dictionary = {
|
|
|
80
93
|
'[!INFO]': 'Info',
|
|
81
94
|
'[!IMPORTANT]': 'Important',
|
|
82
95
|
'[!TIP]': 'Tip',
|
|
83
|
-
'[!WARNING]': 'Warning',
|
|
96
|
+
'[!WARNING]xw': 'Warning',
|
|
84
97
|
'[!DANGER]': 'Danger',
|
|
85
98
|
},
|
|
86
99
|
pt: {
|
|
@@ -2,6 +2,7 @@ import { Box, Flex, Text } from '@citric/core'
|
|
|
2
2
|
import { getColor, getRadius } from '@citric/core/dist/utils/theme'
|
|
3
3
|
import { Copy, Refresh } from '@citric/icons'
|
|
4
4
|
import { IconButton } from '@citric/ui'
|
|
5
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
5
6
|
import { useTranslate } from '@stack-spot/portal-translate'
|
|
6
7
|
import SyntaxHighlighter from 'react-syntax-highlighter'
|
|
7
8
|
import styled from 'styled-components'
|
|
@@ -27,7 +28,7 @@ const style = {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const Wrapper = styled(Box)`
|
|
30
|
-
background-color: ${
|
|
31
|
+
background-color: ${theme.color.gray[900]};
|
|
31
32
|
border-radius: ${({ theme }) => getRadius(theme as any, 'xs')};
|
|
32
33
|
position: relative;
|
|
33
34
|
padding: 8px;
|
|
@@ -42,12 +43,12 @@ const Wrapper = styled(Box)`
|
|
|
42
43
|
height: 4px;
|
|
43
44
|
}
|
|
44
45
|
&::-webkit-scrollbar-track {
|
|
45
|
-
background: ${
|
|
46
|
+
background: ${theme.color.light[400]};
|
|
46
47
|
border-radius: 2px;
|
|
47
48
|
}
|
|
48
49
|
&::-webkit-scrollbar-thumb,
|
|
49
50
|
&::-webkit-scrollbar-thumb:hover {
|
|
50
|
-
background: ${
|
|
51
|
+
background: ${theme.color.light[700]};
|
|
51
52
|
border-radius: 2px;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -60,32 +61,32 @@ const Wrapper = styled(Box)`
|
|
|
60
61
|
margin-top: 0;
|
|
61
62
|
overflow: unset;
|
|
62
63
|
text-shadow: none;
|
|
63
|
-
color:
|
|
64
|
+
color: ${theme.color.gray[50]};
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
.hljs-string {
|
|
67
|
-
color: ${
|
|
68
|
+
color: ${theme.color.teal[300]};
|
|
68
69
|
}
|
|
69
70
|
.hljs-tag {
|
|
70
71
|
color: ${({ theme }) => getColor(theme as any, 'teal')};
|
|
71
72
|
}
|
|
72
73
|
.hljs-attr {
|
|
73
|
-
color:
|
|
74
|
+
color: ${theme.color.gray[50]};
|
|
74
75
|
}
|
|
75
76
|
.hljs-number {
|
|
76
|
-
color:
|
|
77
|
+
color: ${theme.color.gray[300]};
|
|
77
78
|
}
|
|
78
79
|
.hljs-property {
|
|
79
|
-
color:
|
|
80
|
+
color: ${theme.color.gray[50]};
|
|
80
81
|
}
|
|
81
82
|
.hljs-keyword {
|
|
82
|
-
color:
|
|
83
|
+
color: ${theme.color.blue[200]};
|
|
83
84
|
}
|
|
84
85
|
.comment {
|
|
85
|
-
color:
|
|
86
|
+
color: ${theme.color.gray[400]};
|
|
86
87
|
}
|
|
87
88
|
.hljs-expression {
|
|
88
|
-
color:
|
|
89
|
+
color: ${theme.color.orange[400]};
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
.button-group {
|
|
@@ -111,6 +112,12 @@ interface Props {
|
|
|
111
112
|
scrollable?: boolean,
|
|
112
113
|
copyButton?: boolean,
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* CodeViewer component that displays code with syntax highlighting based on application theme and optional copy and refresh buttons.
|
|
118
|
+
*
|
|
119
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
120
|
+
*/
|
|
114
121
|
export const CodeViewer = ({ language, data, onClickRefresh, scrollable = true, copyButton }: Props) => {
|
|
115
122
|
const t = useTranslate(codeViewerLocale)
|
|
116
123
|
|
|
@@ -9,6 +9,9 @@ import { CodeViewer } from './CodeViewer'
|
|
|
9
9
|
import { Video } from './Video'
|
|
10
10
|
|
|
11
11
|
interface MarkdownProps {
|
|
12
|
+
/**
|
|
13
|
+
* The markdown content to be rendered.
|
|
14
|
+
*/
|
|
12
15
|
children: string,
|
|
13
16
|
}
|
|
14
17
|
|
|
@@ -25,7 +28,6 @@ const styles: Record<string, SxProp | Record<string, SxProp>> = {
|
|
|
25
28
|
table: {
|
|
26
29
|
borderRadius: 'xs',
|
|
27
30
|
},
|
|
28
|
-
|
|
29
31
|
customScroll: {
|
|
30
32
|
height: '232px',
|
|
31
33
|
overflow: 'auto',
|
|
@@ -61,6 +63,9 @@ const styles: Record<string, SxProp | Record<string, SxProp>> = {
|
|
|
61
63
|
},
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Custom components for rendering markdown elements.
|
|
68
|
+
*/
|
|
64
69
|
const component = () => ({
|
|
65
70
|
p: (props: any) => <Text appearance="body2" {...props} />,
|
|
66
71
|
strong: (props: any) => <Text weight="bold" colorScheme="light.700" as="strong" {...props} />,
|
|
@@ -97,6 +102,11 @@ const component = () => ({
|
|
|
97
102
|
</Text>,
|
|
98
103
|
})
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Renders a component that provides markdown content visualization using citric components.
|
|
107
|
+
*
|
|
108
|
+
* @param options the props for rendering the component: {@link MarkdownProps}.
|
|
109
|
+
*/
|
|
100
110
|
const Markdown = ({ children }: MarkdownProps) => (
|
|
101
111
|
<ReactMarkdown rehypePlugins={[rehypeRaw]} remarkPlugins={[remarkGfm]} components={component()}>
|
|
102
112
|
{children}
|
|
@@ -2,10 +2,21 @@ import { IconButton } from '@citric/ui'
|
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
|
|
4
4
|
interface MarkdownButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Optional click handler for the button.
|
|
7
|
+
*/
|
|
5
8
|
onClick?: () => void,
|
|
9
|
+
/**
|
|
10
|
+
* The content to be displayed inside the button.
|
|
11
|
+
*/
|
|
6
12
|
children: ReactNode,
|
|
7
13
|
}
|
|
8
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Renders a component that provides an IconButton with custom styles and content.
|
|
17
|
+
*
|
|
18
|
+
* @param options the props for rendering the component: {@link MarkdownButtonProps}.
|
|
19
|
+
*/
|
|
9
20
|
export const MarkdownButton = ({ ...props }: MarkdownButtonProps) => (
|
|
10
21
|
<IconButton sx={{ position: 'absolute', top: '16px', right: '16px' }} onClick={props.onClick}>
|
|
11
22
|
{props.children}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video component that renders an iframe with the given source URL.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} props - The props for the Video component.
|
|
5
|
+
* @param {string} props.children - The URL to be used as the source of the iframe.
|
|
6
|
+
* @returns {JSX.Element} The rendered iframe element.
|
|
7
|
+
*/
|
|
1
8
|
export const Video = ({ children }: { children: string }) => (
|
|
2
9
|
<iframe
|
|
3
10
|
src={children}
|
|
@@ -16,12 +16,9 @@ interface Props {
|
|
|
16
16
|
hasUnreadNotification?: boolean,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const ANIMATION_DURATION_MS = 300
|
|
20
|
-
const MAX_HEIGHT_TRANSITION = `max-height ease-in ${ANIMATION_DURATION_MS / 1000}s`
|
|
21
|
-
|
|
22
19
|
const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
23
20
|
max-height: 0;
|
|
24
|
-
z-index:
|
|
21
|
+
z-index: 2;
|
|
25
22
|
visibility: hidden;
|
|
26
23
|
position: absolute;
|
|
27
24
|
top: calc(var(--header-height) + 4px);
|
|
@@ -31,7 +28,6 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
31
28
|
&.visible {
|
|
32
29
|
min-height: 802px;
|
|
33
30
|
visibility: visible;
|
|
34
|
-
transition: ${MAX_HEIGHT_TRANSITION};
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
.content {
|
|
@@ -41,7 +37,6 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
41
37
|
background-color: ${theme.color.light[300]};
|
|
42
38
|
overflow-y: ${({ $scroll }) => $scroll ? 'auto' : 'hidden'};
|
|
43
39
|
overflow-x: hidden;
|
|
44
|
-
transition: ${MAX_HEIGHT_TRANSITION}, visibility 0s ${ANIMATION_DURATION_MS / 1000}s;
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
&::after {
|
|
@@ -58,6 +53,17 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
58
53
|
}
|
|
59
54
|
`
|
|
60
55
|
|
|
56
|
+
const Overlay = styled.div`
|
|
57
|
+
position: fixed;
|
|
58
|
+
top: 0;
|
|
59
|
+
left: 0;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
background-color: ${theme.color.primary.contrastText};
|
|
63
|
+
opacity: 0.6;
|
|
64
|
+
z-index: 1;
|
|
65
|
+
`
|
|
66
|
+
|
|
61
67
|
const StyledBox = styled(Box)`
|
|
62
68
|
width: 100%;
|
|
63
69
|
> div:first-child{
|
|
@@ -76,6 +82,11 @@ interface NotificationFilterButtonProps extends NotificationsFilterProps {
|
|
|
76
82
|
enumType: NotificationTypeFilters,
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
/**
|
|
86
|
+
* NotificationFilterButton component that renders a button to be used in quick filters for notifications.
|
|
87
|
+
*
|
|
88
|
+
* @param props the component's props {@link NotificationFilterButtonProps}.
|
|
89
|
+
*/
|
|
79
90
|
const NotificationFilterButton = (props: NotificationFilterButtonProps) => {
|
|
80
91
|
const { type, onChangeFilterType, ariaLabel, label, enumType } = props
|
|
81
92
|
return (<Button
|
|
@@ -93,6 +104,11 @@ const NotificationFilterButton = (props: NotificationFilterButtonProps) => {
|
|
|
93
104
|
)
|
|
94
105
|
}
|
|
95
106
|
|
|
107
|
+
/**
|
|
108
|
+
* NotificationsFilter component that renders the filter options for notifications.
|
|
109
|
+
*
|
|
110
|
+
* @param props the component's props {@link NotificationsFilterProps}.
|
|
111
|
+
*/
|
|
96
112
|
const NotificationsFilter = ({ type, onChangeFilterType }: NotificationsFilterProps) => {
|
|
97
113
|
const t = useTranslate(dictionary)
|
|
98
114
|
|
|
@@ -144,6 +160,12 @@ interface Props {
|
|
|
144
160
|
isSummary: boolean,
|
|
145
161
|
}
|
|
146
162
|
|
|
163
|
+
/**
|
|
164
|
+
* NotificationComponent component that renders the notifications panel.
|
|
165
|
+
* It render the notification icon and when clicked the notification modal is opened.
|
|
166
|
+
*
|
|
167
|
+
* @param props the component's props {@link Props}.
|
|
168
|
+
*/
|
|
147
169
|
export const NotificationComponent = ({
|
|
148
170
|
hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error,
|
|
149
171
|
type, onUpdateType,
|
|
@@ -171,6 +193,8 @@ export const NotificationComponent = ({
|
|
|
171
193
|
<StatusCircle status={'danger'} />
|
|
172
194
|
</Box>}
|
|
173
195
|
|
|
196
|
+
{visible && <Overlay />}
|
|
197
|
+
|
|
174
198
|
<NotificationsComponent
|
|
175
199
|
className={listToClass(['selection-list', visible ? 'visible' : undefined])}
|
|
176
200
|
$scroll={true}
|
|
@@ -199,7 +223,7 @@ export const NotificationComponent = ({
|
|
|
199
223
|
hasMore={hasNextPage}
|
|
200
224
|
>
|
|
201
225
|
<ScrollView direction="vertical" style={{ maxHeight: '630px' }}>
|
|
202
|
-
<Flex sx={{ gap: '4px' }} mr="3">
|
|
226
|
+
<Flex sx={{ gap: '4px' }} mr="3" flexDirection="column">
|
|
203
227
|
{notifications?.map((item) => (
|
|
204
228
|
<NotificationItem key={item.id} notification={item}
|
|
205
229
|
isSummary={isSummary} onClickMarkReadUnread={(read, type) => onMarkAsReadUnread(item.id, read, type)} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, Flex, IconBox, OneOfColorSchemesWithVariants, Styles, SxProp, Text } from '@citric/core'
|
|
1
|
+
import { Box, Button, Flex, IconBox, OneOfColorSchemesWithVariants, Styles, SxProp, Text } from '@citric/core'
|
|
2
2
|
import { Envelope, EnvelopeOpen } from '@citric/icons'
|
|
3
3
|
import { IconButton, Tooltip } from '@citric/ui'
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
@@ -34,37 +34,36 @@ const style: Styles = {
|
|
|
34
34
|
},
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
size="xs"
|
|
50
|
-
onClick={() => {
|
|
51
|
-
onClickMarkReadUnread(!notification.committed, 'icon')
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{notification.committed ? <Envelope /> : <EnvelopeOpen />}
|
|
55
|
-
</IconBox>
|
|
56
|
-
</IconButton>
|
|
57
|
-
</Tooltip>
|
|
58
|
-
</Flex>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
37
|
+
/**
|
|
38
|
+
* NotificationHeader component that renders the header of a notification.
|
|
39
|
+
*
|
|
40
|
+
* @param props the component's props {@link NotificationItemProps}.
|
|
41
|
+
*/
|
|
42
|
+
const NotificationHeader = ({ notification, isSummary }: NotificationItemProps) => (
|
|
43
|
+
<Flex justifyContent="space-between" mb={2} sx={{ maxWidth: isSummary ? '330px' : '100%' }} flexWrap="nowrap">
|
|
44
|
+
<Text appearance={isSummary ? 'body2' : 'body1'} nowrapEllipsis>
|
|
45
|
+
{notification.title}
|
|
46
|
+
</Text>
|
|
47
|
+
</Flex>
|
|
48
|
+
)
|
|
61
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Get the number of days ago from the given date string.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} dateString - The date string to calculate the days ago.
|
|
54
|
+
* @returns {number} The number of days ago.
|
|
55
|
+
*/
|
|
62
56
|
const getDaysAgo = (dateString: string): number => {
|
|
63
57
|
const givenDate = parseISO(dateString)
|
|
64
58
|
const today = new Date()
|
|
65
59
|
return differenceInDays(today, givenDate)
|
|
66
60
|
}
|
|
67
61
|
|
|
62
|
+
/**
|
|
63
|
+
* NotificationContent component that renders the content of a notification.
|
|
64
|
+
*
|
|
65
|
+
* @param props the component's props {@link Props}.
|
|
66
|
+
*/
|
|
68
67
|
const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
69
68
|
const { formatDate } = useDateFormatter()
|
|
70
69
|
const t = useTranslate(dictionary)
|
|
@@ -85,7 +84,7 @@ const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
|
85
84
|
</Text>
|
|
86
85
|
{!isSummary && <>
|
|
87
86
|
<Text appearance="microtext1" colorScheme="light.700">
|
|
88
|
-
{formatDate(notification.
|
|
87
|
+
{formatDate(notification.trigger_at)}
|
|
89
88
|
</Text>
|
|
90
89
|
<Text appearance="microtext1" colorScheme="light.700" mx="2">
|
|
91
90
|
•
|
|
@@ -98,11 +97,17 @@ const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
|
98
97
|
</>
|
|
99
98
|
)
|
|
100
99
|
}
|
|
100
|
+
|
|
101
101
|
interface NotificationFooterProps {
|
|
102
102
|
call_to_action: string,
|
|
103
103
|
onClickMarkReadUnread: (type: 'callToAction' | 'icon') => void,
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* NotificationFooter component that renders the footer of a notification.
|
|
108
|
+
*
|
|
109
|
+
* @param props the component's props {@link NotificationFooterProps}.
|
|
110
|
+
*/
|
|
106
111
|
const NotificationFooter = ({ call_to_action, onClickMarkReadUnread }: NotificationFooterProps) => {
|
|
107
112
|
const t = useTranslate(dictionary)
|
|
108
113
|
const Link = useAnchorTag()
|
|
@@ -124,15 +129,42 @@ interface NotificationItemProps extends Props {
|
|
|
124
129
|
onClickMarkReadUnread: (read: boolean, type: 'callToAction' | 'icon') => void,
|
|
125
130
|
}
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
/**
|
|
133
|
+
* NotificationItem component that renders a notification item.
|
|
134
|
+
*
|
|
135
|
+
* @param props the component's props {@link NotificationItemProps}.
|
|
136
|
+
*/
|
|
137
|
+
export const NotificationItem = ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => {
|
|
138
|
+
const t = useTranslate(dictionary)
|
|
139
|
+
return (
|
|
140
|
+
<Box sx={{ position: 'relative' }}>
|
|
141
|
+
<Flex bg="light.400" p="3 3 3 5" r="xs"
|
|
142
|
+
flexDirection="column" w="100%" sx={styles.item(statusToColor[notification.criticality], notification.committed)}>
|
|
143
|
+
<NotificationHeader notification={notification} isSummary={isSummary} onClickMarkReadUnread={onClickMarkReadUnread}/>
|
|
144
|
+
<NotificationContent notification={notification} isSummary={isSummary} />
|
|
145
|
+
{notification.call_to_action && <NotificationFooter call_to_action={notification.call_to_action}
|
|
146
|
+
onClickMarkReadUnread={(type) => onClickMarkReadUnread(notification.committed, type)} />}
|
|
147
|
+
</Flex>
|
|
148
|
+
<Box sx={{ position: 'absolute', top: '8px', right: '8px' }}>
|
|
149
|
+
<Tooltip text={notification.committed ? t.markAsUnread : t.markAsRead} position="left"
|
|
150
|
+
id={`tooltip-${notification.title}`} role="tooltip"
|
|
151
|
+
sx={style.tooltip}>
|
|
152
|
+
<IconButton aria-describedby={`tooltip-${notification.title}`}
|
|
153
|
+
sx={{ opacity: notification.committed ? 0.5 : 1 }}>
|
|
154
|
+
<IconBox
|
|
155
|
+
size="xs"
|
|
156
|
+
onClick={() => {
|
|
157
|
+
onClickMarkReadUnread(notification.committed, 'icon')
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
{notification.committed ? <Envelope /> : <EnvelopeOpen />}
|
|
161
|
+
</IconBox>
|
|
162
|
+
</IconButton>
|
|
163
|
+
</Tooltip>
|
|
164
|
+
</Box>
|
|
165
|
+
</Box>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
136
168
|
|
|
137
169
|
const dictionary = {
|
|
138
170
|
en: {
|
|
@@ -46,8 +46,7 @@ interface WithTooltip {
|
|
|
46
46
|
/**
|
|
47
47
|
* CircleWithTooltip component that displays a circle with an optional tooltip.
|
|
48
48
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @returns {JSX.Element} The CircleWithTooltip component.
|
|
49
|
+
* @param props the component's props {@link WithTooltip}.
|
|
51
50
|
*/
|
|
52
51
|
const CircleWithTooltip = ({ tooltip, className, style }: WithTooltip) => {
|
|
53
52
|
const circle = <div style={style} className={className}></div>
|
|
@@ -55,11 +54,10 @@ const CircleWithTooltip = ({ tooltip, className, style }: WithTooltip) => {
|
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
57
|
+
* Renders a component that displays a colored circle based on the status.
|
|
59
58
|
* It also supports an optional tooltip.
|
|
60
59
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @returns {JSX.Element} The StatusCircle component.
|
|
60
|
+
* @param props the component's props {@link Props}.
|
|
63
61
|
*/
|
|
64
62
|
export const StatusCircle = styled(CircleWithTooltip)<Props>`
|
|
65
63
|
background-color: ${({ status, theme }) => getColorFromStatus(theme as any, status)};
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { BannerWarning } from './components/BannerWarning'
|
|
2
2
|
export { ChatBot } from './components/ChatBot'
|
|
3
|
+
export { AsyncContent } from './components/AsyncContent'
|
|
3
4
|
export { useKeyboardControls } from './hooks/keyboard'
|
|
4
5
|
export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now'
|
|
5
6
|
export { useCheckTextOverflow } from './hooks/text'
|
|
6
7
|
export { titleEffect, useTitleEffect } from './hooks/title'
|
|
7
8
|
export { useEffectOnce } from './hooks/use-effect-once'
|
|
9
|
+
export { useDateFormatter } from './hooks/date'
|
|
8
10
|
export * from './utils/accessibility'
|
|
9
11
|
export * from './utils/cookie'
|