@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.
@@ -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: React.FC<ToastProps> = ({
27
- message,
28
- variant = "info",
29
- open,
30
- onClose,
31
- duration = 5000,
32
- className = "",
33
- ...rest
34
- }) => {
35
- const handleClose = useCallback(() => {
36
- onClose?.();
37
- }, [onClose]);
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
- useEffect(() => {
40
- if (!open || duration === 0) return;
43
+ useEffect(() => {
44
+ if (!open || duration === 0) return;
41
45
 
42
- const timer = setTimeout(handleClose, duration);
43
- return () => clearTimeout(timer);
44
- }, [open, duration, handleClose]);
46
+ const timer = setTimeout(handleClose, duration);
47
+ return () => clearTimeout(timer);
48
+ }, [open, duration, handleClose]);
45
49
 
46
- if (!open) return null;
50
+ if (!open) return null;
47
51
 
48
- const wrapperClasses = [
49
- "pcoi-toast",
50
- `pcoi-toast--${variant}`,
51
- className,
52
- ]
53
- .filter(Boolean)
54
- .join(" ");
52
+ const wrapperClasses = [
53
+ "pcoi-toast",
54
+ `pcoi-toast--${variant}`,
55
+ className,
56
+ ]
57
+ .filter(Boolean)
58
+ .join(" ");
55
59
 
56
- return createPortal(
57
- <div className={wrapperClasses} role="alert" {...rest}>
58
- <div className="pcoi-toast__content">
59
- <span className="pcoi-toast__message">{message}</span>
60
- {onClose && (
61
- <button
62
- type="button"
63
- className="pcoi-toast__close"
64
- onClick={handleClose}
65
- aria-label="Dismiss notification"
66
- >
67
- <CloseIcon size={16} />
68
- </button>
69
- )}
70
- </div>
71
- </div>,
72
- document.body
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-label="Typing">
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";
package/src/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // @pcoi/components — Shared Types
2
+ import type React from "react";
2
3
 
3
4
  /** Semantic heading level for document outline (h1–h6) */
4
5
  export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";