@stack-spot/portal-components 1.3.2-rc → 1.3.2
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 +14 -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 +39 -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 +37 -5
- 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 +7 -6
- 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 +55 -16
- package/src/components/Notifications/NotificationItem.tsx +51 -12
- 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,
|
|
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;AACzG,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,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,M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,EAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,aAChH,KAAC,kBAAkB,IAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,GAAG,EACrH,KAAC,mBAAmB,IAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAI,EACxE,YAAY,CAAC,cAAc,IAAI,KAAC,kBAAkB,IAAC,cAAc,EAAE,YAAY,CAAC,cAAc,EAC7F,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,GAAI,IACtF,CACR,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,cAAc;QAC1B,YAAY,EAAE,gBAAgB;KAC/B;IACD,EAAE,EAAE;QACF,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,YAAY;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":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAatC,MAAM,aAAa,GAA0B;IAC3C,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,oBAAoB;CAC9B,CAAA;AAED;;;;;;GAM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AM,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.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,14 +14,10 @@
|
|
|
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
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
|
|
22
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
23
|
-
"check-tree-shaking": "agadoo"
|
|
24
|
-
},
|
|
25
21
|
"peerDependencies": {
|
|
26
22
|
"@citric/core": "^6.0.0",
|
|
27
23
|
"@citric/icons": "^5.4.0 || ^6.0.0",
|
|
@@ -64,5 +60,10 @@
|
|
|
64
60
|
"reactour": "^1.19.3",
|
|
65
61
|
"rehype-raw": "^7.0.0",
|
|
66
62
|
"remark-gfm": "^4.0.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
|
|
66
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
67
|
+
"check-tree-shaking": "agadoo"
|
|
67
68
|
}
|
|
68
69
|
}
|
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}
|
|
@@ -4,6 +4,7 @@ import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
5
|
import { ReactElement, useState } from 'react'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
|
+
import { IconButton } from '@citric/ui'
|
|
7
8
|
import { AsyncContent, ErrorProps } from '../AsyncContent'
|
|
8
9
|
import { InfiniteScroll } from '../InfiniteScroll'
|
|
9
10
|
import { ScrollView } from '../ScrollView'
|
|
@@ -20,10 +21,10 @@ const MAX_HEIGHT_TRANSITION = `max-height ease-in ${ANIMATION_DURATION_MS / 1000
|
|
|
20
21
|
|
|
21
22
|
const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
22
23
|
max-height: 0;
|
|
23
|
-
z-index:
|
|
24
|
+
z-index: 2;
|
|
24
25
|
visibility: hidden;
|
|
25
26
|
position: absolute;
|
|
26
|
-
top: calc(var(--header-height) +
|
|
27
|
+
top: calc(var(--header-height) + 4px);
|
|
27
28
|
right: -270%;
|
|
28
29
|
width: 400px;
|
|
29
30
|
|
|
@@ -46,17 +47,28 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
46
47
|
&::after {
|
|
47
48
|
content: '';
|
|
48
49
|
position: absolute;
|
|
49
|
-
border-width:
|
|
50
|
+
border-width: 8px 32px;
|
|
50
51
|
border-style: solid;
|
|
51
52
|
border-color: transparent;
|
|
52
53
|
bottom: 100%;
|
|
53
|
-
left:
|
|
54
|
+
left: 74%;
|
|
54
55
|
margin-left: -5px;
|
|
55
56
|
transform: rotate(180deg);
|
|
56
57
|
border-top-color: ${theme.color.light[400]};
|
|
57
58
|
}
|
|
58
59
|
`
|
|
59
60
|
|
|
61
|
+
const Overlay = styled.div`
|
|
62
|
+
position: fixed;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
background-color: ${theme.color.primary.contrastText};
|
|
68
|
+
opacity: 0.6;
|
|
69
|
+
z-index: 1;
|
|
70
|
+
`
|
|
71
|
+
|
|
60
72
|
const StyledBox = styled(Box)`
|
|
61
73
|
width: 100%;
|
|
62
74
|
> div:first-child{
|
|
@@ -75,6 +87,11 @@ interface NotificationFilterButtonProps extends NotificationsFilterProps {
|
|
|
75
87
|
enumType: NotificationTypeFilters,
|
|
76
88
|
}
|
|
77
89
|
|
|
90
|
+
/**
|
|
91
|
+
* NotificationFilterButton component that renders a button to be used in quick filters for notifications.
|
|
92
|
+
*
|
|
93
|
+
* @param props the component's props {@link NotificationFilterButtonProps}.
|
|
94
|
+
*/
|
|
78
95
|
const NotificationFilterButton = (props: NotificationFilterButtonProps) => {
|
|
79
96
|
const { type, onChangeFilterType, ariaLabel, label, enumType } = props
|
|
80
97
|
return (<Button
|
|
@@ -92,6 +109,11 @@ const NotificationFilterButton = (props: NotificationFilterButtonProps) => {
|
|
|
92
109
|
)
|
|
93
110
|
}
|
|
94
111
|
|
|
112
|
+
/**
|
|
113
|
+
* NotificationsFilter component that renders the filter options for notifications.
|
|
114
|
+
*
|
|
115
|
+
* @param props the component's props {@link NotificationsFilterProps}.
|
|
116
|
+
*/
|
|
95
117
|
const NotificationsFilter = ({ type, onChangeFilterType }: NotificationsFilterProps) => {
|
|
96
118
|
const t = useTranslate(dictionary)
|
|
97
119
|
|
|
@@ -143,6 +165,12 @@ interface Props {
|
|
|
143
165
|
isSummary: boolean,
|
|
144
166
|
}
|
|
145
167
|
|
|
168
|
+
/**
|
|
169
|
+
* NotificationComponent component that renders the notifications panel.
|
|
170
|
+
* It render the notification icon and when clicked the notification modal is opened.
|
|
171
|
+
*
|
|
172
|
+
* @param props the component's props {@link Props}.
|
|
173
|
+
*/
|
|
146
174
|
export const NotificationComponent = ({
|
|
147
175
|
hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error,
|
|
148
176
|
type, onUpdateType,
|
|
@@ -157,17 +185,21 @@ export const NotificationComponent = ({
|
|
|
157
185
|
}
|
|
158
186
|
|
|
159
187
|
return (<Flex sx={{ position: 'relative' }}>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
188
|
+
<IconButton aria-label={t.openNotifications} onClick={() => {
|
|
189
|
+
onClickViewNotifications()
|
|
190
|
+
setVisible(true)
|
|
191
|
+
}} sx={{ border: 'none', bg: 'transparent' }}>
|
|
192
|
+
<IconBox size="md"
|
|
193
|
+
className="notificationsTour" >
|
|
194
|
+
<Bell />
|
|
195
|
+
</IconBox>
|
|
196
|
+
</IconButton>
|
|
197
|
+
{hasUnreadNotification && <Box sx={{ position: 'absolute', right: '2px' }} aria-label={t.hasUnread}>
|
|
168
198
|
<StatusCircle status={'danger'} />
|
|
169
199
|
</Box>}
|
|
170
200
|
|
|
201
|
+
{visible && <Overlay />}
|
|
202
|
+
|
|
171
203
|
<NotificationsComponent
|
|
172
204
|
className={listToClass(['selection-list', visible ? 'visible' : undefined])}
|
|
173
205
|
$scroll={true}
|
|
@@ -179,10 +211,11 @@ export const NotificationComponent = ({
|
|
|
179
211
|
<Text appearance="h4">
|
|
180
212
|
{t.notifications}
|
|
181
213
|
</Text>
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
214
|
+
<IconButton onClick={() => setVisible(false)} aria-label={t.close}>
|
|
215
|
+
<IconBox size="xs">
|
|
216
|
+
<TimesMini />
|
|
217
|
+
</IconBox>
|
|
218
|
+
</IconButton>
|
|
186
219
|
</Flex>
|
|
187
220
|
|
|
188
221
|
<NotificationsFilter type={type} onChangeFilterType={updateType} />
|
|
@@ -246,6 +279,9 @@ const dictionary = {
|
|
|
246
279
|
medium: 'Medium',
|
|
247
280
|
low: 'Low',
|
|
248
281
|
seeAll: 'See all notifications',
|
|
282
|
+
openNotifications: 'View notifications',
|
|
283
|
+
hasUnread: 'Has Unread notifications',
|
|
284
|
+
close: 'Close',
|
|
249
285
|
},
|
|
250
286
|
pt: {
|
|
251
287
|
notifications: 'Notificações',
|
|
@@ -260,5 +296,8 @@ const dictionary = {
|
|
|
260
296
|
medium: 'Médio',
|
|
261
297
|
low: 'Baixo',
|
|
262
298
|
seeAll: 'Ver todas as notificações',
|
|
299
|
+
openNotifications: 'Visualizar notificações',
|
|
300
|
+
hasUnread: 'Existem notificações não lidas',
|
|
301
|
+
close: 'Fechar',
|
|
263
302
|
},
|
|
264
303
|
} satisfies Dictionary
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Button, Flex, IconBox, OneOfColorSchemesWithVariants, SxProp, Text } from '@citric/core'
|
|
1
|
+
import { Button, Flex, IconBox, OneOfColorSchemesWithVariants, Styles, SxProp, Text } from '@citric/core'
|
|
2
2
|
import { Envelope, EnvelopeOpen } from '@citric/icons'
|
|
3
|
-
import { Tooltip } from '@citric/ui'
|
|
4
|
-
import { theme } from '@stack-spot/portal-theme'
|
|
3
|
+
import { IconButton, Tooltip } from '@citric/ui'
|
|
5
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
5
|
import { differenceInDays, parseISO } from 'date-fns'
|
|
7
6
|
import { useAnchorTag } from '../../context/anchor'
|
|
@@ -27,32 +26,61 @@ interface Props {
|
|
|
27
26
|
isSummary: boolean,
|
|
28
27
|
}
|
|
29
28
|
|
|
29
|
+
const style: Styles = {
|
|
30
|
+
tooltip: {
|
|
31
|
+
'&::after':{
|
|
32
|
+
top: '25%',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* NotificationHeader component that renders the header of a notification.
|
|
39
|
+
*
|
|
40
|
+
* @param props the component's props {@link NotificationItemProps}.
|
|
41
|
+
*/
|
|
30
42
|
const NotificationHeader = ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => {
|
|
31
43
|
const t = useTranslate(dictionary)
|
|
32
44
|
return (
|
|
33
|
-
<Flex justifyContent="space-between" mb={2} sx={{ maxWidth: isSummary ? '
|
|
45
|
+
<Flex justifyContent="space-between" mb={2} sx={{ maxWidth: isSummary ? '330px' : '100%' }} flexWrap="nowrap">
|
|
34
46
|
<Text appearance={isSummary ? 'body2' : 'body1'} nowrapEllipsis>
|
|
35
47
|
{notification.title}
|
|
36
48
|
</Text>
|
|
37
|
-
<Tooltip text={notification.committed ? t.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
<Tooltip text={notification.committed ? t.markAsUnread : t.markAsRead} position="left"
|
|
50
|
+
id={`tooltip-${notification.title}`} role="tooltip"
|
|
51
|
+
sx={style.tooltip}>
|
|
52
|
+
<IconButton aria-describedby={`tooltip-${notification.title}`}>
|
|
53
|
+
<IconBox
|
|
54
|
+
size="xs"
|
|
55
|
+
onClick={() => {
|
|
56
|
+
onClickMarkReadUnread(!notification.committed, 'icon')
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{notification.committed ? <Envelope /> : <EnvelopeOpen />}
|
|
60
|
+
</IconBox>
|
|
61
|
+
</IconButton>
|
|
45
62
|
</Tooltip>
|
|
46
63
|
</Flex>
|
|
47
64
|
)
|
|
48
65
|
}
|
|
49
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Get the number of days ago from the given date string.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} dateString - The date string to calculate the days ago.
|
|
71
|
+
* @returns {number} The number of days ago.
|
|
72
|
+
*/
|
|
50
73
|
const getDaysAgo = (dateString: string): number => {
|
|
51
74
|
const givenDate = parseISO(dateString)
|
|
52
75
|
const today = new Date()
|
|
53
76
|
return differenceInDays(today, givenDate)
|
|
54
77
|
}
|
|
55
78
|
|
|
79
|
+
/**
|
|
80
|
+
* NotificationContent component that renders the content of a notification.
|
|
81
|
+
*
|
|
82
|
+
* @param props the component's props {@link Props}.
|
|
83
|
+
*/
|
|
56
84
|
const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
57
85
|
const { formatDate } = useDateFormatter()
|
|
58
86
|
const t = useTranslate(dictionary)
|
|
@@ -86,11 +114,17 @@ const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
|
86
114
|
</>
|
|
87
115
|
)
|
|
88
116
|
}
|
|
117
|
+
|
|
89
118
|
interface NotificationFooterProps {
|
|
90
119
|
call_to_action: string,
|
|
91
120
|
onClickMarkReadUnread: (type: 'callToAction' | 'icon') => void,
|
|
92
121
|
}
|
|
93
122
|
|
|
123
|
+
/**
|
|
124
|
+
* NotificationFooter component that renders the footer of a notification.
|
|
125
|
+
*
|
|
126
|
+
* @param props the component's props {@link NotificationFooterProps}.
|
|
127
|
+
*/
|
|
94
128
|
const NotificationFooter = ({ call_to_action, onClickMarkReadUnread }: NotificationFooterProps) => {
|
|
95
129
|
const t = useTranslate(dictionary)
|
|
96
130
|
const Link = useAnchorTag()
|
|
@@ -112,6 +146,11 @@ interface NotificationItemProps extends Props {
|
|
|
112
146
|
onClickMarkReadUnread: (read: boolean, type: 'callToAction' | 'icon') => void,
|
|
113
147
|
}
|
|
114
148
|
|
|
149
|
+
/**
|
|
150
|
+
* NotificationItem component that renders a notification item.
|
|
151
|
+
*
|
|
152
|
+
* @param props the component's props {@link NotificationItemProps}.
|
|
153
|
+
*/
|
|
115
154
|
export const NotificationItem = ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => (
|
|
116
155
|
<Flex bg="light.400" p="3 3 3 5" r="xs"
|
|
117
156
|
flexDirection="column" w="100%" sx={styles.item(statusToColor[notification.criticality], notification.committed)}>
|
|
@@ -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'
|