@stack-spot/portal-components 2.10.4 → 2.11.1

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.11.1](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.11.0...portal-components@v2.11.1) (2025-01-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * banner style adjustments" ([c2263b4](https://github.com/stack-spot/portal-commons/commit/c2263b4c3befacdedb592afba688d8f31d48c524))
9
+ * Code Cleanup & adjustments ([2d0b4a8](https://github.com/stack-spot/portal-commons/commit/2d0b4a80c2eb9ddad7b91fabb4e5e39707f26239))
10
+ * lyout update libs banner ([#631](https://github.com/stack-spot/portal-commons/issues/631)) ([6d4ee46](https://github.com/stack-spot/portal-commons/commit/6d4ee46878395607d8cbf80d58c38a22681ece74))
11
+
12
+ ## [2.11.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.10.4...portal-components@v2.11.0) (2024-12-27)
13
+
14
+
15
+ ### Features
16
+
17
+ * update libs banner ([#604](https://github.com/stack-spot/portal-commons/issues/604)) ([f2bc440](https://github.com/stack-spot/portal-commons/commit/f2bc440db6c65461a2b1228d0efc08ed3d883d67))
18
+
3
19
  ## [2.10.4](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.10.3...portal-components@v2.10.4) (2024-12-12)
4
20
 
5
21
 
@@ -1,10 +1,10 @@
1
1
  /**
2
- * A styled and non-dismissible alert box for showing important warnings for the user.
2
+ * A styled and dismissible alert box for showing important warnings for the user.
3
3
  *
4
4
  * This renders a yellow box with an exclamation icon. The content passed as parameter is placed on the right of the icon.
5
5
  * @param props an object containing the content (children) to show inside the alert box.
6
6
  */
7
7
  export declare const BannerWarning: ({ children }: {
8
8
  children: React.ReactNode;
9
- }) => import("react/jsx-runtime").JSX.Element;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
10
10
  //# sourceMappingURL=BannerWarning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BannerWarning.d.ts","sourceRoot":"","sources":["../../src/components/BannerWarning.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,iBAAkB;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,4CAgBxE,CAAA"}
1
+ {"version":3,"file":"BannerWarning.d.ts","sourceRoot":"","sources":["../../src/components/BannerWarning.tsx"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,iBAAkB;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,mDA2ExE,CAAA"}
@@ -1,12 +1,47 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Flex, IconBox, Text } from '@citric/core';
3
- import { ExclamationTriangle } from '@citric/icons';
2
+ import { Button, Flex, IconBox, Text } from '@citric/core';
3
+ import { ExclamationTriangle, TimesCircleFill } from '@citric/icons';
4
4
  import { Alert } from '@citric/ui';
5
+ import { useState } from 'react';
6
+ import { getCookie, setCookie } from '../utils/cookie.js';
5
7
  /**
6
- * A styled and non-dismissible alert box for showing important warnings for the user.
8
+ * A styled and dismissible alert box for showing important warnings for the user.
7
9
  *
8
10
  * This renders a yellow box with an exclamation icon. The content passed as parameter is placed on the right of the icon.
9
11
  * @param props an object containing the content (children) to show inside the alert box.
10
12
  */
11
- export const BannerWarning = ({ children }) => (_jsx(Flex, { sx: { position: 'fixed', top: 0, zIndex: '999', w: 12, left: 0 }, children: _jsxs(Alert, { colorScheme: "warning", sx: { p: 2, w: 12, justifyContent: 'center', height: ['60px', '100px'] }, children: [_jsx(IconBox, { size: "md", colorIcon: "light.500", sx: { display: ['block', 'none'] }, children: _jsx(ExclamationTriangle, {}) }), _jsx(Flex, { sx: { py: [5, 3] }, children: _jsx(Text, { sx: { fontSize: ['16px', '14px'], whiteSpace: 'pre-line' }, colorScheme: "warning.contrastText", children: children }) }), _jsx(IconBox, { size: "md", colorIcon: "light.500", sx: { display: ['block', 'none'] }, children: _jsx(ExclamationTriangle, {}) })] }) }));
13
+ export const BannerWarning = ({ children }) => {
14
+ const bannerKey = 'bannerClosed';
15
+ const [isVisible, setIsVisible] = useState(() => {
16
+ if (typeof window !== 'undefined') {
17
+ const isBannerClosed = getCookie(bannerKey) === 'true';
18
+ return !isBannerClosed;
19
+ }
20
+ return false;
21
+ });
22
+ const handleClose = () => {
23
+ setCookie(bannerKey, 'true');
24
+ setIsVisible(false);
25
+ };
26
+ if (!isVisible) {
27
+ return null;
28
+ }
29
+ return (_jsx(Flex, { sx: { zIndex: '1', w: '12', mb: 7 }, children: _jsxs(Alert, { colorScheme: "warning", sx: {
30
+ position: 'relative',
31
+ px: 3,
32
+ py: 1,
33
+ alignItems: 'center',
34
+ display: 'flex',
35
+ justifyContent: 'space-between',
36
+ height: 'auto',
37
+ }, children: [_jsxs(Flex, { sx: {
38
+ alignItems: 'center',
39
+ flexWrap: 'nowrap',
40
+ }, children: [_jsx(IconBox, { size: "sm", colorIcon: "light.500", children: _jsx(ExclamationTriangle, {}) }), _jsx(Text, { sx: {
41
+ ml: 5,
42
+ }, appearance: "body2", colorScheme: "warning.contrastText", children: children })] }), _jsx(Button, { appearance: 'text', onClick: handleClose, sx: {
43
+ p: 0,
44
+ ml: 2,
45
+ }, children: _jsx(IconBox, { size: "lg", colorIcon: "light.500", children: _jsx(TimesCircleFill, {}) }) })] }) }));
46
+ };
12
47
  //# sourceMappingURL=BannerWarning.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BannerWarning.js","sourceRoot":"","sources":["../../src/components/BannerWarning.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC;;;;;GA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AAE,QAAQ;wBACpB,QAAQ,EAAE,QAAQ;qBACnB,aAED,KAAC,OAAO,IACN,IAAI,EAAC,IAAI,EACT,SAAS,EAAC,WAAW,YAErB,KAAC,mBAAmB,KAAG,GACf,EACV,KAAC,IAAI,IACH,EAAE,EAAE;gCACF,EAAE,EAAC,CAAC;6BACL,EACD,UAAU,EAAC,OAAO,EAClB,WAAW,EAAC,sBAAsB,YAEjC,QAAQ,GACJ,IACF,EAEP,KAAC,MAAM,IACL,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE;wBACF,CAAC,EAAE,CAAC;wBACJ,EAAE,EAAE,CAAC;qBACN,YAED,KAAC,OAAO,IACN,IAAI,EAAC,IAAI,EACT,SAAS,EAAC,WAAW,YAErB,KAAC,eAAe,KAAG,GACX,GACH,IACH,GACH,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -19,6 +19,7 @@ export type GetTenantNotificationsResponse = {
19
19
  last_until?: string;
20
20
  trigger_at: string;
21
21
  created_at?: string;
22
+ isBanner?: boolean;
22
23
  };
23
24
  export type ResponseModelGetTenantNotificationsResponse = {
24
25
  items: GetTenantNotificationsResponse[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/notification/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAExD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,IAAI,CAAA;AAI3E,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,CAAC;KAC5C,CAAC;IACF,eAAe,EAA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AC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;CACpB;AAID,oBAAY,UAAU;IACpB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CAChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/notification/types.ts"],"names":[],"mappings":"AAiDA,iIAAiI;AACjI,gDAAgD;AAChD,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,+BAAiB,CAAA;AACnB,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/notification/types.ts"],"names":[],"mappings":"AAkDA,iIAAiI;AACjI,gDAAgD;AAChD,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,+BAAiB,CAAA;AACnB,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
@@ -7,9 +7,11 @@ export interface LoadNotificationsFilters {
7
7
  search?: string;
8
8
  context?: NotificationContext;
9
9
  size?: number;
10
+ isBanner?: boolean;
10
11
  }
11
12
  export interface LoadNotificationsOptions extends LoadNotificationsFilters {
12
13
  page: number;
14
+ isBanner?: boolean;
13
15
  }
14
16
  export type LazyNotificationListener = (notifications: GetTenantNotificationsResponse[], hasMore: boolean) => void;
15
17
  export interface NotificationConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/context/notification/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BA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O,KAAK,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/portal-components",
3
- "version": "2.10.4",
3
+ "version": "2.11.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,27 +1,89 @@
1
- import { Flex, IconBox, Text } from '@citric/core'
2
- import { ExclamationTriangle } from '@citric/icons'
1
+
2
+ import { Button, Flex, IconBox, Text } from '@citric/core'
3
+ import { ExclamationTriangle, TimesCircleFill } from '@citric/icons'
3
4
  import { Alert } from '@citric/ui'
5
+ import { useState } from 'react'
6
+ import { getCookie, setCookie } from '../utils/cookie'
4
7
 
5
8
  /**
6
- * A styled and non-dismissible alert box for showing important warnings for the user.
7
- *
8
- * This renders a yellow box with an exclamation icon. The content passed as parameter is placed on the right of the icon.
9
+ * A styled and dismissible alert box for showing important warnings for the user.
10
+ *
11
+ * This renders a yellow box with an exclamation icon. The content passed as parameter is placed on the right of the icon.
9
12
  * @param props an object containing the content (children) to show inside the alert box.
10
13
  */
11
- export const BannerWarning = ({ children }: { children: React.ReactNode }) => (
12
- <Flex sx={{ position: 'fixed', top: 0, zIndex: '999', w: 12, left: 0 }}>
13
- <Alert colorScheme="warning" sx={{ p: 2, w: 12, justifyContent: 'center', height: ['60px', '100px'] }}>
14
- <IconBox size="md" colorIcon="light.500" sx={{ display: ['block', 'none'] }}>
15
- <ExclamationTriangle />
16
- </IconBox>
17
- <Flex sx={{ py: [5, 3] }}>
18
- <Text sx={{ fontSize: ['16px', '14px'], whiteSpace: 'pre-line' }} colorScheme="warning.contrastText">
19
- {children}
20
- </Text>
21
- </Flex>
22
- <IconBox size="md" colorIcon="light.500" sx={{ display: ['block', 'none'] }}>
23
- <ExclamationTriangle />
24
- </IconBox>
25
- </Alert>
26
- </Flex>
27
- )
14
+ export const BannerWarning = ({ children }: { children: React.ReactNode }) => {
15
+ const bannerKey = 'bannerClosed'
16
+
17
+ const [isVisible, setIsVisible] = useState(() => {
18
+ if (typeof window !== 'undefined') {
19
+ const isBannerClosed = getCookie(bannerKey) === 'true'
20
+ return !isBannerClosed
21
+ }
22
+ return false
23
+ })
24
+
25
+ const handleClose = () => {
26
+ setCookie(bannerKey, 'true')
27
+ setIsVisible(false)
28
+ }
29
+
30
+ if (!isVisible) {
31
+ return null
32
+ }
33
+
34
+ return (
35
+ <Flex sx={{ zIndex: '1', w: '12', mb: 7 }}>
36
+ <Alert
37
+ colorScheme="warning"
38
+ sx={{
39
+ position: 'relative',
40
+ px: 3,
41
+ py: 1,
42
+ alignItems: 'center',
43
+ display: 'flex',
44
+ justifyContent: 'space-between',
45
+ height: 'auto',
46
+ }}
47
+ >
48
+ <Flex
49
+ sx={{
50
+ alignItems: 'center',
51
+ flexWrap: 'nowrap',
52
+ }}
53
+ >
54
+ <IconBox
55
+ size="sm"
56
+ colorIcon="light.500"
57
+ >
58
+ <ExclamationTriangle />
59
+ </IconBox>
60
+ <Text
61
+ sx={{
62
+ ml:5,
63
+ }}
64
+ appearance="body2"
65
+ colorScheme="warning.contrastText"
66
+ >
67
+ {children}
68
+ </Text>
69
+ </Flex>
70
+
71
+ <Button
72
+ appearance={'text'}
73
+ onClick={handleClose}
74
+ sx={{
75
+ p: 0,
76
+ ml: 2,
77
+ }}
78
+ >
79
+ <IconBox
80
+ size="lg"
81
+ colorIcon="light.500"
82
+ >
83
+ <TimesCircleFill />
84
+ </IconBox>
85
+ </Button>
86
+ </Alert>
87
+ </Flex>
88
+ )
89
+ }
@@ -24,6 +24,7 @@ export type GetTenantNotificationsResponse = {
24
24
  last_until?: string,
25
25
  trigger_at: string,
26
26
  created_at?: string,
27
+ isBanner?: boolean,
27
28
  }
28
29
 
29
30
  export type ResponseModelGetTenantNotificationsResponse = {
@@ -10,10 +10,12 @@ export interface LoadNotificationsFilters {
10
10
  search?: string,
11
11
  context?: NotificationContext,
12
12
  size?: number,
13
+ isBanner?: boolean,
13
14
  }
14
15
 
15
16
  export interface LoadNotificationsOptions extends LoadNotificationsFilters {
16
17
  page: number,
18
+ isBanner?: boolean,
17
19
  }
18
20
 
19
21
  export type LazyNotificationListener = (notifications: GetTenantNotificationsResponse[], hasMore: boolean) => void