@pcoi/components 0.1.1 → 0.1.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/dist/components.css +1 -1
- package/dist/index.d.ts +45 -7
- package/dist/index.js +2 -2
- package/dist/index.mjs +495 -470
- package/package.json +3 -3
- package/src/Callout/Callout.css +5 -0
- package/src/Callout/Callout.tsx +14 -10
- package/src/ChatInterface/ChatInterface.css +1 -0
- package/src/ChatInterface/ChatInterface.integration.test.tsx +1 -1
- package/src/ChatInterface/ChatInterface.tsx +6 -1
- package/src/ChatMessageList/ChatMessageList.test.tsx +9 -13
- package/src/ChatMessageList/ChatMessageList.tsx +7 -2
- package/src/CitedExcerpt/CitedExcerpt.tsx +2 -0
- package/src/ComparisonTable/ComparisonTable.tsx +6 -0
- package/src/ContactForm/ContactForm.tsx +1 -0
- package/src/DocumentOverlay/DocumentOverlay.tsx +2 -1
- package/src/Footer/Footer.tsx +5 -2
- package/src/LogoMark/LogoMark.tsx +2 -2
- package/src/Modal/Modal.tsx +100 -95
- package/src/Nav/Nav.tsx +6 -2
- package/src/SignalsPanel/SignalsPanel.tsx +2 -0
- package/src/Toast/Toast.tsx +49 -44
- package/src/TypingIndicator/TypingIndicator.tsx +2 -2
- package/src/index.ts +2 -0
- package/src/styles.css +1 -0
- package/src/types.ts +1 -0
package/src/Toast/Toast.tsx
CHANGED
|
@@ -23,55 +23,60 @@ export interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
* text/primary, text/success|error|warning|info,
|
|
24
24
|
* shadow/elevated, zIndex/toast, radius-md
|
|
25
25
|
*/
|
|
26
|
-
export const Toast
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
export const Toast = React.forwardRef<HTMLDivElement, ToastProps>(
|
|
27
|
+
(
|
|
28
|
+
{
|
|
29
|
+
message,
|
|
30
|
+
variant = "info",
|
|
31
|
+
open,
|
|
32
|
+
onClose,
|
|
33
|
+
duration = 5000,
|
|
34
|
+
className = "",
|
|
35
|
+
...rest
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const handleClose = useCallback(() => {
|
|
40
|
+
onClose?.();
|
|
41
|
+
}, [onClose]);
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!open || duration === 0) return;
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
const timer = setTimeout(handleClose, duration);
|
|
47
|
+
return () => clearTimeout(timer);
|
|
48
|
+
}, [open, duration, handleClose]);
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
if (!open) return null;
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const wrapperClasses = [
|
|
53
|
+
"pcoi-toast",
|
|
54
|
+
`pcoi-toast--${variant}`,
|
|
55
|
+
className,
|
|
56
|
+
]
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.join(" ");
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
60
|
+
return createPortal(
|
|
61
|
+
<div ref={ref} className={wrapperClasses} role="alert" {...rest}>
|
|
62
|
+
<div className="pcoi-toast__content">
|
|
63
|
+
<span className="pcoi-toast__message">{message}</span>
|
|
64
|
+
{onClose && (
|
|
65
|
+
<button
|
|
66
|
+
type="button"
|
|
67
|
+
className="pcoi-toast__close"
|
|
68
|
+
onClick={handleClose}
|
|
69
|
+
aria-label="Dismiss notification"
|
|
70
|
+
>
|
|
71
|
+
<CloseIcon size={16} />
|
|
72
|
+
</button>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
</div>,
|
|
76
|
+
document.body
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
75
80
|
|
|
76
81
|
Toast.displayName = "Toast";
|
|
77
82
|
export default Toast;
|
|
@@ -20,11 +20,11 @@ export const TypingIndicator = React.forwardRef<
|
|
|
20
20
|
.join(" ");
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<div ref={ref} className={classes} {...rest}>
|
|
23
|
+
<div ref={ref} className={classes} role="status" aria-live="polite" aria-label={`${label} is typing`} {...rest}>
|
|
24
24
|
<div className="pcoi-typing-indicator__header">
|
|
25
25
|
<Badge>{label}</Badge>
|
|
26
26
|
</div>
|
|
27
|
-
<div className="pcoi-typing-indicator__dots" aria-
|
|
27
|
+
<div className="pcoi-typing-indicator__dots" aria-hidden="true">
|
|
28
28
|
<span className="pcoi-typing-indicator__dot" />
|
|
29
29
|
<span className="pcoi-typing-indicator__dot" />
|
|
30
30
|
<span className="pcoi-typing-indicator__dot" />
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,8 @@ export { Badge, type BadgeProps, type BadgeVariant } from "./Badge";
|
|
|
25
25
|
export { Modal, type ModalProps } from "./Modal";
|
|
26
26
|
export { Toast, type ToastProps, type ToastVariant } from "./Toast";
|
|
27
27
|
|
|
28
|
+
export { CitationMark, type CitationMarkProps } from "./CitationMark";
|
|
29
|
+
|
|
28
30
|
// Chat Interface components
|
|
29
31
|
export { SuggestionCard, type SuggestionCardProps } from "./SuggestionCard";
|
|
30
32
|
export { CitedExcerpt, type CitedExcerptProps } from "./CitedExcerpt";
|
package/src/styles.css
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
@import "./DataTable/DataTable.css";
|
|
22
22
|
@import "./Modal/Modal.css";
|
|
23
23
|
@import "./Toast/Toast.css";
|
|
24
|
+
@import "./CitationMark/CitationMark.css";
|
|
24
25
|
@import "./SuggestionCard/SuggestionCard.css";
|
|
25
26
|
@import "./SuggestionCards/SuggestionCards.css";
|
|
26
27
|
@import "./CitedExcerpt/CitedExcerpt.css";
|