@stack-spot/portal-components 2.0.2 → 2.1.0

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/AnimatedHeight.d.ts +59 -0
  3. package/dist/components/AnimatedHeight.d.ts.map +1 -0
  4. package/dist/components/AnimatedHeight.js +105 -0
  5. package/dist/components/AnimatedHeight.js.map +1 -0
  6. package/dist/components/Placeholder.d.ts +6 -4
  7. package/dist/components/Placeholder.d.ts.map +1 -1
  8. package/dist/components/Placeholder.js +5 -4
  9. package/dist/components/Placeholder.js.map +1 -1
  10. package/dist/components/TimelineSection.d.ts +25 -0
  11. package/dist/components/TimelineSection.d.ts.map +1 -0
  12. package/dist/components/TimelineSection.js +27 -0
  13. package/dist/components/TimelineSection.js.map +1 -0
  14. package/dist/components/error/ErrorFeedback.d.ts +9 -1
  15. package/dist/components/error/ErrorFeedback.d.ts.map +1 -1
  16. package/dist/components/error/ErrorFeedback.js +41 -4
  17. package/dist/components/error/ErrorFeedback.js.map +1 -1
  18. package/dist/components/form/SearchInput.d.ts +9 -0
  19. package/dist/components/form/SearchInput.d.ts.map +1 -0
  20. package/dist/components/form/SearchInput.js +28 -0
  21. package/dist/components/form/SearchInput.js.map +1 -0
  22. package/dist/components/form/Select.d.ts +69 -0
  23. package/dist/components/form/Select.d.ts.map +1 -0
  24. package/dist/components/form/Select.js +161 -0
  25. package/dist/components/form/Select.js.map +1 -0
  26. package/dist/components/{Notifications → notification}/NotificationComponent.d.ts +2 -1
  27. package/dist/components/notification/NotificationComponent.d.ts.map +1 -0
  28. package/dist/components/{Notifications → notification}/NotificationComponent.js +12 -4
  29. package/dist/components/notification/NotificationComponent.js.map +1 -0
  30. package/dist/components/notification/NotificationItem.d.ts +42 -0
  31. package/dist/components/notification/NotificationItem.d.ts.map +1 -0
  32. package/dist/components/{Notifications → notification}/NotificationItem.js +27 -12
  33. package/dist/components/notification/NotificationItem.js.map +1 -0
  34. package/dist/components/notification/NotificationList.d.ts +39 -0
  35. package/dist/components/notification/NotificationList.d.ts.map +1 -0
  36. package/dist/components/notification/NotificationList.js +82 -0
  37. package/dist/components/notification/NotificationList.js.map +1 -0
  38. package/dist/components/notification/NotificationPlaceholder.d.ts +12 -0
  39. package/dist/components/notification/NotificationPlaceholder.d.ts.map +1 -0
  40. package/dist/components/notification/NotificationPlaceholder.js +22 -0
  41. package/dist/components/notification/NotificationPlaceholder.js.map +1 -0
  42. package/dist/components/{Notifications → notification}/types.d.ts +16 -0
  43. package/dist/components/notification/types.d.ts.map +1 -0
  44. package/dist/components/{Notifications → notification}/types.js +3 -0
  45. package/dist/components/notification/types.js.map +1 -0
  46. package/dist/containers/NotificationsPage.d.ts +2 -0
  47. package/dist/containers/NotificationsPage.d.ts.map +1 -0
  48. package/dist/containers/NotificationsPage.js +58 -0
  49. package/dist/containers/NotificationsPage.js.map +1 -0
  50. package/dist/context/notification/LazyNotificationList.d.ts +28 -0
  51. package/dist/context/notification/LazyNotificationList.d.ts.map +1 -0
  52. package/dist/context/notification/LazyNotificationList.js +128 -0
  53. package/dist/context/notification/LazyNotificationList.js.map +1 -0
  54. package/dist/context/notification/NotificationController.d.ts +24 -0
  55. package/dist/context/notification/NotificationController.d.ts.map +1 -0
  56. package/dist/context/notification/NotificationController.js +136 -0
  57. package/dist/context/notification/NotificationController.js.map +1 -0
  58. package/dist/context/notification/context.d.ts +9 -0
  59. package/dist/context/notification/context.d.ts.map +1 -0
  60. package/dist/context/notification/context.js +12 -0
  61. package/dist/context/notification/context.js.map +1 -0
  62. package/dist/context/notification/hooks.d.ts +13 -0
  63. package/dist/context/notification/hooks.d.ts.map +1 -0
  64. package/dist/context/notification/hooks.js +77 -0
  65. package/dist/context/notification/hooks.js.map +1 -0
  66. package/dist/context/notification/types.d.ts +57 -0
  67. package/dist/context/notification/types.d.ts.map +1 -0
  68. package/dist/context/notification/types.js +2 -0
  69. package/dist/context/notification/types.js.map +1 -0
  70. package/dist/hooks/manual-render.d.ts +8 -0
  71. package/dist/hooks/manual-render.d.ts.map +1 -0
  72. package/dist/hooks/manual-render.js +10 -0
  73. package/dist/hooks/manual-render.js.map +1 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -0
  77. package/dist/index.js.map +1 -1
  78. package/dist/notifications.d.ts +11 -0
  79. package/dist/notifications.d.ts.map +1 -0
  80. package/dist/notifications.js +10 -0
  81. package/dist/notifications.js.map +1 -0
  82. package/dist/svg/GenericPlaceholder.d.ts +5 -0
  83. package/dist/svg/GenericPlaceholder.d.ts.map +1 -0
  84. package/dist/svg/GenericPlaceholder.js +4 -0
  85. package/dist/svg/GenericPlaceholder.js.map +1 -0
  86. package/dist/svg/index.d.ts +1 -0
  87. package/dist/svg/index.d.ts.map +1 -1
  88. package/dist/svg/index.js +1 -0
  89. package/dist/svg/index.js.map +1 -1
  90. package/dist/utils/promise.d.ts +2 -0
  91. package/dist/utils/promise.d.ts.map +1 -0
  92. package/dist/utils/promise.js +6 -0
  93. package/dist/utils/promise.js.map +1 -0
  94. package/package.json +8 -4
  95. package/src/components/AnimatedHeight.tsx +174 -0
  96. package/src/components/Placeholder.tsx +13 -8
  97. package/src/components/TimelineSection.tsx +54 -0
  98. package/src/components/error/ErrorFeedback.tsx +93 -55
  99. package/src/components/form/SearchInput.tsx +69 -0
  100. package/src/components/form/Select.tsx +264 -0
  101. package/src/components/{Notifications → notification}/NotificationComponent.tsx +13 -5
  102. package/src/components/{Notifications → notification}/NotificationItem.tsx +76 -34
  103. package/src/components/notification/NotificationList.tsx +167 -0
  104. package/src/components/notification/NotificationPlaceholder.tsx +40 -0
  105. package/src/components/{Notifications → notification}/types.ts +21 -0
  106. package/src/containers/NotificationsPage.tsx +98 -0
  107. package/src/context/notification/LazyNotificationList.ts +95 -0
  108. package/src/context/notification/NotificationController.ts +104 -0
  109. package/src/context/notification/context.tsx +23 -0
  110. package/src/context/notification/hooks.ts +82 -0
  111. package/src/context/notification/types.ts +64 -0
  112. package/src/hooks/manual-render.tsx +10 -0
  113. package/src/index.ts +2 -1
  114. package/src/notifications.ts +11 -0
  115. package/src/svg/GenericPlaceholder.tsx +19 -0
  116. package/src/svg/index.ts +1 -0
  117. package/src/utils/promise.ts +5 -0
  118. package/dist/components/Notifications/NotificationComponent.d.ts.map +0 -1
  119. package/dist/components/Notifications/NotificationComponent.js.map +0 -1
  120. package/dist/components/Notifications/NotificationItem.d.ts +0 -17
  121. package/dist/components/Notifications/NotificationItem.d.ts.map +0 -1
  122. package/dist/components/Notifications/NotificationItem.js.map +0 -1
  123. package/dist/components/Notifications/index.d.ts +0 -4
  124. package/dist/components/Notifications/index.d.ts.map +0 -1
  125. package/dist/components/Notifications/index.js +0 -4
  126. package/dist/components/Notifications/index.js.map +0 -1
  127. package/dist/components/Notifications/types.d.ts.map +0 -1
  128. package/dist/components/Notifications/types.js.map +0 -1
  129. package/src/components/Notifications/index.tsx +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.0.3...portal-components@v2.1.0) (2024-07-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * notification changes ([e817a67](https://github.com/stack-spot/portal-commons/commit/e817a67cb91b151a48a484594fe8095a4dbb07fa))
9
+ * notifications page and all its dependencies ([e817a67](https://github.com/stack-spot/portal-commons/commit/e817a67cb91b151a48a484594fe8095a4dbb07fa))
10
+
11
+ ## [2.0.3](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.0.2...portal-components@v2.0.3) (2024-07-04)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add animation to notification menu ([d800e92](https://github.com/stack-spot/portal-commons/commit/d800e92e11399d45958b09e7ffcbc2acdb5749a9))
17
+
3
18
  ## [2.0.2](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.0.1...portal-components@v2.0.2) (2024-07-04)
4
19
 
5
20
 
@@ -0,0 +1,59 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ /**
4
+ * A header with fixed height.
5
+ */
6
+ header?: React.ReactElement;
7
+ /**
8
+ * The content. This may change its height whenever. When the height changes, the animation will play making a fluid transition from the
9
+ * previous height to the next.
10
+ */
11
+ children: React.ReactElement;
12
+ /**
13
+ * A footer with fixed height.
14
+ */
15
+ footer?: React.ReactElement;
16
+ /**
17
+ * Whether or not this panel is visible. Changing this value, animates the panel's height.
18
+ * @default true
19
+ */
20
+ visible?: boolean;
21
+ /**
22
+ * The duration of the animations in milliseconds.
23
+ * @default 300
24
+ */
25
+ duration?: number;
26
+ /**
27
+ * This component wraps its content in a div that changes its height from zero to the size of its content. It is not recommended to add
28
+ * styles to it, but if you need to, use this property.
29
+ */
30
+ outerStyle?: React.CSSProperties;
31
+ /**
32
+ * This component wraps its content in a div that changes its height from zero to the size of its content. It is not recommended to add
33
+ * classes to it, but if you need to, use this property.
34
+ */
35
+ outerClassName?: string;
36
+ /**
37
+ * The style to apply to the whole panel.
38
+ *
39
+ * Attention: this is not the outer-most div, use `outerStyle` if you need to style it.
40
+ */
41
+ style?: React.CSSProperties;
42
+ /**
43
+ * The class to apply to the whole panel.
44
+ *
45
+ * Attention: this is not the outer-most div, use `outerClassName` if you need to add a class to it.
46
+ */
47
+ className?: string;
48
+ }
49
+ /**
50
+ * This is a generic component for animating the height of a panel whenever its content changes.
51
+ *
52
+ * You can provide a header and a footer with fixed height, these won't change during the animations and will always be visible.
53
+ *
54
+ * This panel can also be hidden or visible and transitions between these two state will be animated.
55
+ * @param props the React props for this component. {@link Props}.
56
+ */
57
+ export declare const AnimatedHeight: ({ children, footer, header, visible, duration, className, style, outerClassName, outerStyle }: Props) => import("react/jsx-runtime").JSX.Element;
58
+ export {};
59
+ //# sourceMappingURL=AnimatedHeight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedHeight.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedHeight.tsx"],"names":[],"mappings":";AAKA,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsDD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,kGACoF,KAAK,4CA2DnH,CAAA"}
@@ -0,0 +1,105 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { listToClass } from '@stack-spot/portal-theme';
3
+ import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
4
+ import styled from 'styled-components';
5
+ import { useManualRender } from '../hooks/manual-render.js';
6
+ const Box = styled.div `
7
+ overflow-y: clip; // <-- do not use hidden, it's buggy in Chrome.
8
+ transition: height ease-in-out ${({ $animationMs }) => $animationMs / 1000}s;
9
+
10
+ .wrapper {
11
+ display: flex;
12
+ flex-direction: column;
13
+ }
14
+
15
+ &.initial {
16
+ opacity: 0;
17
+ pointer-events: none;
18
+ overflow: inherit;
19
+ transition: none;
20
+
21
+ &.content {
22
+ overflow: inherit;
23
+ transition: none;
24
+ }
25
+ }
26
+
27
+ .content {
28
+ overflow: hidden;
29
+ transition: height ease-in-out ${({ $animationMs }) => $animationMs / 1000}s;
30
+ }
31
+ `;
32
+ function getActualContent(wrapper) {
33
+ const firstChild = wrapper.firstChild;
34
+ if (!firstChild || !('tagName' in firstChild))
35
+ throw new Error('AnimatedHeight could not find any content to animate');
36
+ return firstChild;
37
+ }
38
+ function onChangeHeight(element, callback) {
39
+ const resizeObserver = new ResizeObserver((entries) => {
40
+ const entry = entries[0];
41
+ const newHeight = entry.borderBoxSize[0].blockSize;
42
+ callback(newHeight);
43
+ });
44
+ resizeObserver.observe(element);
45
+ return () => resizeObserver.disconnect();
46
+ }
47
+ /**
48
+ * This is a generic component for animating the height of a panel whenever its content changes.
49
+ *
50
+ * You can provide a header and a footer with fixed height, these won't change during the animations and will always be visible.
51
+ *
52
+ * This panel can also be hidden or visible and transitions between these two state will be animated.
53
+ * @param props the React props for this component. {@link Props}.
54
+ */
55
+ export const AnimatedHeight = ({ children, footer, header, visible = true, duration = 300, className, style, outerClassName, outerStyle }) => {
56
+ const { repaint } = useManualRender();
57
+ const boxRef = useRef(null);
58
+ const wrapperRef = useRef(null);
59
+ const headerRef = useRef(null);
60
+ const contentRef = useRef(null);
61
+ const footerRef = useRef(null);
62
+ const heights = useRef({ content: 0, footer: 0, header: 0, extra: 0 });
63
+ const status = useRef('initial');
64
+ const updateHeight = useCallback(() => {
65
+ if (boxRef.current) {
66
+ boxRef.current.style.height = `${heights.current.content + heights.current.header + heights.current.footer + heights.current.extra}px`;
67
+ }
68
+ if (contentRef.current)
69
+ contentRef.current.style.height = `${heights.current.content}px`;
70
+ }, []);
71
+ useLayoutEffect(() => {
72
+ let unsubscribe;
73
+ if (headerRef.current)
74
+ heights.current.header = headerRef.current.getBoundingClientRect().height;
75
+ if (contentRef.current) {
76
+ heights.current.content = contentRef.current.getBoundingClientRect().height;
77
+ unsubscribe = onChangeHeight(getActualContent(contentRef.current), (height) => {
78
+ heights.current.content = height;
79
+ if (status.current === 'visible' && boxRef.current)
80
+ updateHeight();
81
+ });
82
+ }
83
+ if (footerRef.current)
84
+ heights.current.footer = footerRef.current.getBoundingClientRect().height;
85
+ if (wrapperRef.current)
86
+ heights.current.extra = wrapperRef.current.getBoundingClientRect().height
87
+ - heights.current.header
88
+ - heights.current.footer
89
+ - heights.current.content;
90
+ status.current = visible ? 'visible' : 'hidden';
91
+ repaint();
92
+ return unsubscribe;
93
+ }, []);
94
+ useEffect(() => {
95
+ if (status.current === 'initial')
96
+ return;
97
+ status.current = visible ? 'visible' : 'hidden';
98
+ if (visible)
99
+ updateHeight();
100
+ else if (boxRef.current)
101
+ boxRef.current.style.height = '0';
102
+ }, [visible]);
103
+ return (_jsx(Box, { ref: boxRef, "$animationMs": duration, className: listToClass([outerClassName, status.current === 'initial' && 'initial']), style: outerStyle, children: _jsxs("div", { ref: wrapperRef, className: listToClass(['wrapper', className]), style: style, children: [header && _jsx("div", { ref: headerRef, children: header }), _jsx("div", { ref: contentRef, className: "content", children: children }), footer && _jsx("div", { ref: footerRef, children: footer })] }) }));
104
+ };
105
+ //# sourceMappingURL=AnimatedHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedHeight.js","sourceRoot":"","sources":["../../src/components/AnimatedHeight.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AA2DxD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAA0B;;mCAEb,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;qCAqBvC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,GAAG,IAAI;;CAE7E,CAAA;AAED,SAAS,gBAAgB,CAAC,OAAoB;IAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;IACrC,IAA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GAAO,EAC9C,cAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAO,EACzD,MAAM,IAAI,cAAK,GAAG,EAAE,SAAS,YAAG,MAAM,GAAO,IAC1C,GACF,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -3,17 +3,19 @@ import { SxProperties } from '@citric/core/dist/sx.js';
3
3
  interface Props {
4
4
  title?: string;
5
5
  description?: string;
6
- img: React.ReactElement;
6
+ img?: React.ReactElement;
7
7
  button?: React.ReactElement | null;
8
8
  show?: boolean;
9
9
  fullWidth?: boolean;
10
10
  sx?: SxProperties;
11
11
  sxCard?: SxProperties;
12
+ style?: React.CSSProperties;
13
+ className?: string;
12
14
  }
13
- interface PropsCallToACtion extends Props {
15
+ interface PropsCallToAction extends Props {
14
16
  subDescription?: string;
15
17
  }
16
- export declare const Placeholder: ({ title, description, button, img, fullWidth, show, sx }: Props) => import("react/jsx-runtime").JSX.Element | null;
17
- export declare const PlaceholderCallToAction: ({ title, description, subDescription, img, button, fullWidth, show, sx, sxCard, }: PropsCallToACtion) => import("react/jsx-runtime").JSX.Element | null;
18
+ export declare const Placeholder: ({ title, description, button, img, fullWidth, show, sx, style, className }: Props) => import("react/jsx-runtime").JSX.Element | null;
19
+ export declare const PlaceholderCallToAction: ({ title, description, subDescription, img, button, fullWidth, show, sx, sxCard, style, className, }: PropsCallToAction) => import("react/jsx-runtime").JSX.Element | null;
18
20
  export {};
19
21
  //# sourceMappingURL=Placeholder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,UAAU,iBAAkB,SAAQ,KAAK;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,6DAAqE,KAAK,mDAsBjG,CAAA;AAED,eAAO,MAAM,uBAAuB,sFAUjC,iBAAiB,mDA4BnB,CAAA"}
1
+ {"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,iBAAkB,SAAQ,KAAK;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,+EAAuF,KAAK,mDAsBnH,CAAA;AAED,eAAO,MAAM,uBAAuB,wGAYjC,iBAAiB,mDA4BnB,CAAA"}
@@ -1,16 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Flex, Text } from '@citric/core';
3
3
  import { Card, CardContent } from '@citric/ui';
4
- export const Placeholder = ({ title, description, button, img, fullWidth, show = true, sx }) => {
4
+ import { GenericPlaceholder } from '../svg/index.js';
5
+ export const Placeholder = ({ title, description, button, img, fullWidth, show = true, sx, style, className }) => {
5
6
  if (!show) {
6
7
  return null;
7
8
  }
8
- return (_jsx(Card, { sx: { ...(fullWidth ? { w: '100%' } : {}) }, children: _jsxs(CardContent, { as: Flex, py: 27, justifyContent: "center", flexDirection: "column", alignItems: "center", sx: sx, children: [img, title && _jsx(Text, { as: "label", appearance: "h4", mb: "3", pt: 5, children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), button] }) }));
9
+ return (_jsx(Card, { sx: { ...(fullWidth ? { w: '100%' } : {}) }, style: style, className: className, children: _jsxs(CardContent, { as: Flex, py: 27, justifyContent: "center", flexDirection: "column", alignItems: "center", sx: sx, children: [img ?? _jsx(GenericPlaceholder, { style: { width: '184px', height: '104px' } }), title && _jsx(Text, { as: "label", appearance: "h4", mb: "3", pt: 5, children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), button] }) }));
9
10
  };
10
- export const PlaceholderCallToAction = ({ title, description, subDescription, img, button, fullWidth, show = true, sx, sxCard, }) => {
11
+ export const PlaceholderCallToAction = ({ title, description, subDescription, img, button, fullWidth, show = true, sx, sxCard, style, className, }) => {
11
12
  if (!show) {
12
13
  return null;
13
14
  }
14
- return (_jsx(Card, { sx: { w: fullWidth ? '100%' : 'auto', bg: 'transparent', ...sxCard }, children: _jsxs(CardContent, { as: Flex, alignItems: "center", justifyContent: "center", py: 15, sx: { gap: '92px', ...sx }, children: [img, _jsxs(Box, { children: [title && _jsx(Text, { appearance: "h4", mb: "3", "aria-live": "assertive", children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: subDescription }), button] })] }) }));
15
+ return (_jsx(Card, { sx: { w: fullWidth ? '100%' : 'auto', bg: 'transparent', ...sxCard }, style: style, className: className, children: _jsxs(CardContent, { as: Flex, alignItems: "center", justifyContent: "center", py: 15, sx: { gap: '92px', ...sx }, children: [img ?? _jsx(GenericPlaceholder, { style: { width: '184px', height: '104px' } }), _jsxs(Box, { children: [title && _jsx(Text, { appearance: "h4", mb: "3", "aria-live": "assertive", children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: subDescription }), button] })] }) }));
15
16
  };
16
17
  //# sourceMappingURL=Placeholder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAiB9C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,EAAS,EAAE,EAAE;IACpG,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,YAC/C,MAAC,WAAW,IAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,cAAc,EAAC,QAAQ,EAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,EAAE,EAAE,EAAE,aACrG,GAAG,EAEH,KAAK,IAAI,KAAC,IAAI,IAAC,EAAE,EAAC,OAAO,EAAC,UAAU,EAAC,IAA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25 @@
1
+ /// <reference types="react" />
2
+ import { Month } from '@stack-spot/portal-translate';
3
+ interface Props {
4
+ /**
5
+ * The month. 0 for January, 11 for December.
6
+ */
7
+ month: Month;
8
+ /**
9
+ * The day of the month (1 - 31).
10
+ */
11
+ day: number;
12
+ /**
13
+ * The section's content.
14
+ */
15
+ children: React.ReactNode;
16
+ style?: React.CSSProperties;
17
+ className?: string;
18
+ }
19
+ /**
20
+ * Renders a section in a timeline where the left side is a header with the date and the right side is the content (children).
21
+ * @param props React props: {@link Props}.
22
+ */
23
+ export declare const TimelineSection: ({ children, day, month, className, style }: Props) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
25
+ //# sourceMappingURL=TimelineSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimelineSection.d.ts","sourceRoot":"","sources":["../../src/components/TimelineSection.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAsB,MAAM,8BAA8B,CAAA;AAGxE,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD;;;GAGG;AACH,eAAO,MAAM,eAAe,+CAAgD,KAAK,4CAahF,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from '@citric/core';
3
+ import { useMonthDictionary } from '@stack-spot/portal-translate';
4
+ import { styled } from 'styled-components';
5
+ const Styled = styled.div `
6
+ display: flex;
7
+ flex-direction: row;
8
+ align-items: start;
9
+
10
+ .timeline-section-header {
11
+ width: 80px;
12
+ }
13
+
14
+ .timeline-section-content {
15
+ min-width: 0;
16
+ flex: 1;
17
+ }
18
+ `;
19
+ /**
20
+ * Renders a section in a timeline where the left side is a header with the date and the right side is the content (children).
21
+ * @param props React props: {@link Props}.
22
+ */
23
+ export const TimelineSection = ({ children, day, month, className, style }) => {
24
+ const months = useMonthDictionary();
25
+ return (_jsxs(Styled, { style: style, className: className, children: [_jsxs("div", { className: "timeline-section-header", children: [_jsx(Text, { appearance: "h2", children: day >= 10 ? day : `0${day}` }), _jsx(Text, { appearance: "subtitle4", children: months[month].toUpperCase().substring(0, 3) })] }), _jsx("div", { className: "timeline-section-content", children: children })] }));
26
+ };
27
+ //# sourceMappingURL=TimelineSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimelineSection.js","sourceRoot":"","sources":["../../src/components/TimelineSection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAS,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAmB1C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;CAaxB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAS,EAAE,EAAE;IACnF,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAA;IACnC,OAAO,CACL,MAAC,MAAM,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,aACxC,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,IAAI,IAAC,UAAU,EAAC,IAAI,YAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,GAAQ,EAC1D,KAAC,IAAI,IAAC,UAAU,EAAC,WAAW,YAAE,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAQ,IAC7E,EACN,cAAK,SAAS,EAAC,0BAA0B,YACtC,QAAQ,GACL,IACC,CACV,CAAA;AACH,CAAC,CAAA"}
@@ -39,6 +39,14 @@ export interface ErrorDescription {
39
39
  * The image for the error. Overwrites anything preset by "code".
40
40
  */
41
41
  image?: React.ReactElement;
42
+ /**
43
+ * Whether to show the feedback horizontally (row) or vertically (column).
44
+ *
45
+ * @default 'row'
46
+ */
47
+ direction?: 'row' | 'column';
48
+ style?: React.CSSProperties;
49
+ className?: string;
42
50
  }
43
51
  /**
44
52
  * A box with an icon and an error message. This is used for giving error feedbacks to the user.
@@ -47,5 +55,5 @@ export interface ErrorDescription {
47
55
  *
48
56
  * @param options the error code, the error message and whether or not the application is in debug mode.
49
57
  */
50
- export declare const ErrorFeedback: ({ code, message, debug, title, body, image, action, description, help }: ErrorDescription) => import("react/jsx-runtime").JSX.Element;
58
+ export declare const ErrorFeedback: ({ code, message, debug, title, body, image, action, description, help, direction, style, className }: ErrorDescription) => import("react/jsx-runtime").JSX.Element;
51
59
  //# sourceMappingURL=ErrorFeedback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAoBA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,4EAAiF,gBAAgB,4CAmE1H,CAAA"}
1
+ {"version":3,"file":"ErrorFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAsBA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsCD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,yGAC0F,gBAAgB,4CA0DnI,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Box, Button, Container, Flex, LinkBox, Text } from '@citric/core';
2
+ import { Button, LinkBox, Text } from '@citric/core';
3
+ import { listToClass, theme } from '@stack-spot/portal-theme';
3
4
  import { useTranslate } from '@stack-spot/portal-translate';
4
5
  import { useState } from 'react';
6
+ import { styled } from 'styled-components';
5
7
  import { Forbidden } from '../../svg/Forbidden.js';
6
8
  import { Logo } from '../../svg/Logo.js';
7
9
  import { NotFound } from '../../svg/NotFound.js';
@@ -16,6 +18,41 @@ const imageMap = {
16
18
  403: _jsx(Forbidden, { style: imageStyle }),
17
19
  404: _jsx(NotFound, { style: imageStyle }),
18
20
  };
21
+ const FeedbackBox = styled.div `
22
+ background-color: ${theme.color.light[400]};
23
+ padding: 24px;
24
+ .content {
25
+ display: flex;
26
+ justify-content: center;
27
+ align-items: center;
28
+ &.row {
29
+ flex-direction: row;
30
+ gap: 40px;
31
+ }
32
+ &.column {
33
+ flex-direction: column;
34
+ .text-content {
35
+ align-items: center;
36
+ }
37
+ }
38
+ .text-content {
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: 12px;
42
+ }
43
+ .buttons {
44
+ display: flex;
45
+ flex-direction: row;
46
+ gap: '10px';
47
+ }
48
+ .details {
49
+ background-color: ${theme.color.danger[500]};
50
+ color: ${theme.color.danger.contrastText};
51
+ padding: 12px;
52
+ border-radius: 5px;
53
+ }
54
+ }
55
+ `;
19
56
  /**
20
57
  * A box with an icon and an error message. This is used for giving error feedbacks to the user.
21
58
  *
@@ -23,14 +60,14 @@ const imageMap = {
23
60
  *
24
61
  * @param options the error code, the error message and whether or not the application is in debug mode.
25
62
  */
26
- export const ErrorFeedback = ({ code = 0, message, debug, title, body, image, action, description, help }) => {
63
+ export const ErrorFeedback = ({ code = 0, message, debug, title, body, image, action, description, help, direction = 'row', style, className }) => {
27
64
  const t = useTranslate(dictionary);
28
65
  const [showDetails, setShowDetails] = useState(false);
29
66
  const shouldShowButtons = !!(action || (debug && message));
30
67
  function renderBody() {
31
- return typeof body === 'string' ? _jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", children: body }) : body;
68
+ return typeof body === 'string' ? _jsx(Text, { appearance: "body1", colorScheme: "inverse", className: "description", children: body }) : body;
32
69
  }
33
- return (_jsx(Box, { bg: "light.400", children: _jsx(Container, { children: _jsxs(Flex, { alignItems: "center", sx: { padding: 12 }, children: [_jsx(Box, { width: 5, sx: { display: ['block', 'none'] }, children: _jsx(Flex, { justifyContent: "flex-end", pr: 20, children: image ?? imageMap[code] ?? _jsx(ServerError, { style: imageStyle }) }) }), _jsxs(Box, { width: [7, 12], children: [_jsx(LinkBox, { href: "/", children: _jsx(Logo, { style: { width: '130px', height: '30px' } }) }), _jsxs(Box, { w: [7, 12], children: [_jsxs(Text, { appearance: "h4", mt: 5, colorScheme: "inverse", children: [(code && !title) ? `${code}. ` : '', _jsx(Text, { appearance: "h4", as: "span", colorScheme: "light.700", children: title ?? t[`${code}.title`] })] }), body ? renderBody() : (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", children: description ?? t[`${code}.description`] }), _jsx(Text, { appearance: "body1", colorScheme: "light.700", mt: 1, children: help ?? t[`${code}.help`] })] })), shouldShowButtons && (_jsxs(Flex, { flexDirection: "row", style: { gap: '10px', marginTop: '12px' }, children: [action && (_jsx(Button, { colorScheme: "inverse", onClick: action.onClick, children: action.label })), debug && message && (_jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: () => setShowDetails(v => !v), children: showDetails ? t.hideDetails : t.showDetails }))] })), showDetails && (_jsx(Box, { bg: "danger", mt: 8, p: 4, sx: { borderRadius: '5px' }, children: _jsx(Text, { appearance: "microtext1", colorScheme: "danger.contrastText", children: message }) }))] })] })] }) }) }));
70
+ return (_jsx(FeedbackBox, { style: style, className: className, children: _jsxs("div", { className: listToClass(['content', direction]), children: [_jsx("div", { className: "image", children: image ?? imageMap[code] ?? _jsx(ServerError, { style: imageStyle }) }), _jsxs("div", { className: "text-content", children: [_jsx(LinkBox, { href: "/", className: "logo", children: _jsx(Logo, { style: { width: '130px', height: '30px' } }) }), _jsxs(Text, { appearance: "h4", mt: 5, colorScheme: "inverse", className: "title", children: [(code && !title) ? `${code}. ` : '', _jsx(Text, { appearance: "h4", as: "span", colorScheme: "light.700", children: title ?? t[`${code}.title`] })] }), body ? renderBody() : (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", className: "description", children: description ?? t[`${code}.description`] }), _jsx(Text, { appearance: "body1", colorScheme: "light.700", className: "help", children: help ?? t[`${code}.help`] })] })), shouldShowButtons && (_jsxs("div", { className: "buttons", children: [action && (_jsx(Button, { colorScheme: "inverse", onClick: action.onClick, children: action.label })), debug && message && (_jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: () => setShowDetails(v => !v), children: showDetails ? t.hideDetails : t.showDetails }))] })), showDetails && (_jsx("div", { className: "details", children: _jsx(Text, { appearance: "microtext1", children: message }) }))] })] }) }));
34
71
  };
35
72
  const dictionary = {
36
73
  en: {
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorFeedback.js","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,MAAM,UAAU,GAAwB;IACtC,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;CAChB,CAAA;AAED,MAAM,QAAQ,GAAuC;IACnD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sD;QACvE,QAAQ,EAAE,6FAA6F;QACvG,WAAW,EAAE,gBAAgB;QAC7B,iBAAiB,EAAE,8DAA8D;QACjF,UAAU,EAAE,mGAAmG;QAC/G,WAAW,EAAE,gBAAgB;QAC7B,iBAAiB,EAAE,qDAAqD;QACxE,UAAU,EAAE,yDAAyD;QACrE,WAAW,EAAE,wBAAwB;QACrC,iBAAiB,EAAE,+BAA+B;QAClD,UAAU,EAAE,iEAAiE;QAC7E,WAAW,EAAE,0BAA0B;QACvC,iBAAiB,EAAE,+DAA+D;QAClF,UAAU,EAAE,sCAAsC;QAClD,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,mBAAmB;KACjC;CACmB,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const SearchInput: ({ searchText, defaultValue, disabled, onChange, style, className, }: {
2
+ searchText: string;
3
+ defaultValue?: string;
4
+ disabled?: boolean;
5
+ onChange: (value?: string) => void;
6
+ style?: React.CSSProperties;
7
+ className?: string;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=SearchInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/components/form/SearchInput.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,wEAOrB;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAsCA,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, IconBox, Input } from '@citric/core';
3
+ import { Filter, Times } from '@citric/icons';
4
+ import { FieldAddon, FieldGroup, IconButton } from '@citric/ui';
5
+ import { useTranslate } from '@stack-spot/portal-translate';
6
+ import { debounce } from 'lodash';
7
+ import { useCallback, useState } from 'react';
8
+ export const SearchInput = ({ searchText, defaultValue, disabled = false, onChange, style, className, }) => {
9
+ const [value, setValue] = useState(defaultValue);
10
+ const runOnChange = useCallback(debounce(onChange, 800), [onChange]);
11
+ const t = useTranslate(dictionary);
12
+ return (_jsxs(Box, { sx: { position: 'relative' }, style: style, className: className, children: [_jsxs(FieldGroup, { children: [_jsx(FieldAddon, { children: _jsx(IconBox, { size: "xs", colorIcon: "light.700", children: _jsx(Filter, {}) }) }), _jsx(Input, { value: value, placeholder: searchText, onChange: (e) => {
13
+ setValue(e.target.value);
14
+ runOnChange(e.target.value);
15
+ }, disabled: disabled, maxLength: 255 })] }), !!value && (_jsx(IconButton, { sx: { position: 'absolute', right: '20px', top: '50%', transform: 'translate(50%, -50%)' }, onClick: () => {
16
+ setValue('');
17
+ runOnChange('');
18
+ }, "aria-label": t.ariaClearField, children: _jsx(Times, {}) }))] }));
19
+ };
20
+ const dictionary = {
21
+ en: {
22
+ ariaClearField: 'Clear field',
23
+ },
24
+ pt: {
25
+ ariaClearField: 'Limpar campo',
26
+ },
27
+ };
28
+ //# sourceMappingURL=SearchInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/form/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,M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AAE,CAAC,CAAA;gBACjB,CAAC,gBACW,CAAC,CAAC,cAAc,YAE5B,KAAC,KAAK,KAAG,GACE,CACd,IACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,cAAc,EAAE,aAAa;KAC9B;IACD,EAAE,EAAE;QACF,cAAc,EAAE,cAAc;KAC/B;CACmB,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ interface BaseSelectProps<T> extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'value' | 'onChange'> {
3
+ /**
4
+ * The current value.
5
+ */
6
+ value: T | undefined;
7
+ /**
8
+ * The label for the empty option. This sets the value to undefined.
9
+ *
10
+ * If this is not set, there won't be an empty option for this select.
11
+ */
12
+ emptyOption?: string;
13
+ /**
14
+ * The options to render in this selection menu.
15
+ */
16
+ options: T[];
17
+ /**
18
+ * Provides the value of each option. This can be either a key of the option object or a function that receives the option and returns
19
+ * the value.
20
+ *
21
+ * This is required if the options are not strings or numbers.
22
+ *
23
+ * @example
24
+ * - `'id'`
25
+ * - `(option) => option.id`
26
+ */
27
+ renderValue?: keyof T | ((item: Exclude<T, undefined>) => string);
28
+ /**
29
+ * Provides the label of each option. This can be either a key of the option object or a function that receives the option and returns
30
+ * the label.
31
+ *
32
+ * This is required if the options are not strings or numbers.
33
+ *
34
+ * @example
35
+ * - `'name'`
36
+ * - `(option) => option.name`
37
+ */
38
+ renderLabel?: keyof T | ((item: Exclude<T, undefined>) => string);
39
+ /**
40
+ * Called when the value changes.
41
+ * @param value the new value.
42
+ */
43
+ onChange: (value: T | undefined) => void;
44
+ /**
45
+ * The maximum number of items before showing a vertical scroll bar.
46
+ * @default 6
47
+ */
48
+ maxItems?: number;
49
+ }
50
+ interface OptionalSelectProps<T> extends BaseSelectProps<T> {
51
+ emptyOption: string;
52
+ }
53
+ interface RequiredSelectProps<T> extends Omit<BaseSelectProps<T>, 'onChange'> {
54
+ emptyOption?: undefined;
55
+ value: T;
56
+ onChange: (value: T) => void;
57
+ }
58
+ type SelectProps<T> = OptionalSelectProps<T> | RequiredSelectProps<T>;
59
+ /**
60
+ * Renders a Select component using the Citric Design System.
61
+ *
62
+ * The styled version of the select component is rendered on top of the default select from the browser. Visual users will use the Citric
63
+ * version of a Select, but blind users, who interacts with the keyboard, will use the default browser select instead, which is already
64
+ * highly optimized for accessibility.
65
+ * @param props the component props: {@link SelectProps}.
66
+ */
67
+ export declare function Select<T>({ onChange, options, value, emptyOption, renderLabel, renderValue, maxItems, onFocus, onBlur, style, className, ...props }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
68
+ export {};
69
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/form/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAqD,MAAM,OAAO,CAAA;AAG9F,UAAU,eAAe,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACrG;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;IACb;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC;IAClE;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC;IAClE;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC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