@syscore/ui-library 2.0.0-beta-publish-workflow-beta.3 → 2.0.0-beta-publish-workflow-beta.5
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/client/components/ui/copy.tsx +68 -0
- package/client/components/ui/credit-card-preview.tsx +118 -0
- package/client/components/ui/drop-zone.tsx +127 -0
- package/client/components/ui/field-group.tsx +103 -0
- package/client/components/ui/file-upload-trigger.tsx +98 -0
- package/client/components/ui/inline-notice.tsx +39 -0
- package/client/components/ui/labeled-divider.tsx +32 -0
- package/client/components/ui/meta-row.tsx +39 -0
- package/client/components/ui/modal-panel.tsx +164 -0
- package/client/components/ui/pill-button.tsx +116 -0
- package/client/components/ui/profile-avatar.tsx +176 -0
- package/client/components/ui/resource-thumbnail.tsx +20 -0
- package/client/components/ui/social-button.tsx +70 -0
- package/client/components/ui/status-pill.tsx +58 -0
- package/client/components/ui/table.tsx +30 -0
- package/client/components/ui/text-link.tsx +63 -0
- package/client/global.css +2779 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +81 -0
- package/dist/index.es.js +614 -0
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
interface ModalOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
zIndex?: number;
|
|
6
|
+
onScrimClick?: () => void;
|
|
7
|
+
align?: "center" | "top";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ModalOverlay = React.forwardRef<HTMLDivElement, ModalOverlayProps>(
|
|
11
|
+
(
|
|
12
|
+
{ zIndex = 50, onScrimClick, align = "center", children, className, style, ...props },
|
|
13
|
+
ref,
|
|
14
|
+
) => (
|
|
15
|
+
<div
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn("modal-overlay", align === "top" && "modal-overlay--top", className)}
|
|
18
|
+
style={{ zIndex, ...style }}
|
|
19
|
+
onClick={
|
|
20
|
+
onScrimClick
|
|
21
|
+
? (event) => {
|
|
22
|
+
if (event.target === event.currentTarget) onScrimClick();
|
|
23
|
+
}
|
|
24
|
+
: undefined
|
|
25
|
+
}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
);
|
|
32
|
+
ModalOverlay.displayName = "ModalOverlay";
|
|
33
|
+
|
|
34
|
+
interface ModalContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
35
|
+
as?: React.ElementType;
|
|
36
|
+
width?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const ModalContainer = React.forwardRef<HTMLDivElement, ModalContainerProps>(
|
|
40
|
+
({ as: Component = "div", width = 420, className, style, ...props }, ref) => (
|
|
41
|
+
<Component
|
|
42
|
+
ref={ref}
|
|
43
|
+
role="dialog"
|
|
44
|
+
aria-modal="true"
|
|
45
|
+
className={cn("modal-container", className)}
|
|
46
|
+
style={{ width, ...style }}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
ModalContainer.displayName = "ModalContainer";
|
|
52
|
+
|
|
53
|
+
interface ModalCloseRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
54
|
+
onClose?: () => void;
|
|
55
|
+
label?: string;
|
|
56
|
+
icon?: React.ReactNode;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const ModalCloseRow = React.forwardRef<HTMLDivElement, ModalCloseRowProps>(
|
|
60
|
+
({ onClose, label = "Close", icon, className, ...props }, ref) => (
|
|
61
|
+
<div ref={ref} className={cn("modal-close-row", className)} {...props}>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
className="modal-close"
|
|
65
|
+
onClick={onClose}
|
|
66
|
+
aria-label={label}
|
|
67
|
+
>
|
|
68
|
+
{icon}
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
ModalCloseRow.displayName = "ModalCloseRow";
|
|
74
|
+
|
|
75
|
+
type PanelTone = "default" | "accent" | "dark";
|
|
76
|
+
type PanelAlign = "start" | "center";
|
|
77
|
+
|
|
78
|
+
interface ModalPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
79
|
+
as?: React.ElementType;
|
|
80
|
+
tone?: PanelTone;
|
|
81
|
+
align?: PanelAlign;
|
|
82
|
+
angle?: number;
|
|
83
|
+
height?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const ModalPanel = React.forwardRef<HTMLDivElement, ModalPanelProps>(
|
|
87
|
+
(
|
|
88
|
+
{
|
|
89
|
+
as: Component = "div",
|
|
90
|
+
tone = "default",
|
|
91
|
+
align = "start",
|
|
92
|
+
angle = 114.72731273771963,
|
|
93
|
+
height,
|
|
94
|
+
className,
|
|
95
|
+
style,
|
|
96
|
+
...props
|
|
97
|
+
},
|
|
98
|
+
ref,
|
|
99
|
+
) => (
|
|
100
|
+
<Component
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn(
|
|
103
|
+
"modal-panel",
|
|
104
|
+
`modal-panel--${tone}`,
|
|
105
|
+
`modal-panel--align-${align}`,
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
style={
|
|
109
|
+
{
|
|
110
|
+
...(tone === "accent"
|
|
111
|
+
? { ["--panel-gradient-angle" as string]: `${angle}deg` }
|
|
112
|
+
: null),
|
|
113
|
+
...(height !== undefined ? { height } : null),
|
|
114
|
+
...style,
|
|
115
|
+
} as React.CSSProperties
|
|
116
|
+
}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
ModalPanel.displayName = "ModalPanel";
|
|
122
|
+
|
|
123
|
+
interface ModalTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
124
|
+
as?: React.ElementType;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const ModalTitle = React.forwardRef<HTMLHeadingElement, ModalTitleProps>(
|
|
128
|
+
({ as: Component = "h2", children, className, ...props }, ref) => (
|
|
129
|
+
<div className={cn("modal-title", className)}>
|
|
130
|
+
<Component ref={ref} className="modal-title__text heading-xxsmall" {...props}>
|
|
131
|
+
{children}
|
|
132
|
+
</Component>
|
|
133
|
+
</div>
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
ModalTitle.displayName = "ModalTitle";
|
|
137
|
+
|
|
138
|
+
interface ModalPromptRowProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
139
|
+
|
|
140
|
+
const ModalPromptRow = React.forwardRef<HTMLDivElement, ModalPromptRowProps>(
|
|
141
|
+
({ className, ...props }, ref) => (
|
|
142
|
+
<div ref={ref} className={cn("modal-prompt-row", className)} {...props} />
|
|
143
|
+
),
|
|
144
|
+
);
|
|
145
|
+
ModalPromptRow.displayName = "ModalPromptRow";
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
ModalOverlay,
|
|
149
|
+
ModalContainer,
|
|
150
|
+
ModalCloseRow,
|
|
151
|
+
ModalPanel,
|
|
152
|
+
ModalTitle,
|
|
153
|
+
ModalPromptRow,
|
|
154
|
+
};
|
|
155
|
+
export type {
|
|
156
|
+
PanelTone,
|
|
157
|
+
PanelAlign,
|
|
158
|
+
ModalOverlayProps,
|
|
159
|
+
ModalContainerProps,
|
|
160
|
+
ModalCloseRowProps,
|
|
161
|
+
ModalPanelProps,
|
|
162
|
+
ModalTitleProps,
|
|
163
|
+
ModalPromptRowProps,
|
|
164
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* PillButton — a large (48px) pill CTA in a tone the DS `Button` cannot express.
|
|
6
|
+
*
|
|
7
|
+
* `buttonVariants` in the DS is a closed cva map, so an unknown `variant` string
|
|
8
|
+
* emits no class at all and the button renders unstyled. Any fill the DS does
|
|
9
|
+
* not already ship therefore needs a primitive rather than a call-site override
|
|
10
|
+
* (RULE #-6). Use the DS `Button` for `primary-gradient` and `tertiary-light`;
|
|
11
|
+
* use this for the three the auth modals need and the DS lacks:
|
|
12
|
+
*
|
|
13
|
+
* gradient the brand gradient EXACTLY as Figma specifies it —
|
|
14
|
+
* `linear-gradient(90deg, rgba(15,116,138,0.6) …)` over
|
|
15
|
+
* `linear-gradient(142.25319251189774deg, #41d5f6 3.3929%,
|
|
16
|
+
* #3eecd1 57.857%, #66fcd9 112.32%)`. The DS
|
|
17
|
+
* `.button--primary-gradient` uses the same colours at
|
|
18
|
+
* DIFFERENT angles (0deg / 99deg), so the DS Button cannot
|
|
19
|
+
* render these frames faithfully. See the note below.
|
|
20
|
+
* plum plum-600 (#aa6a9b) fill, white label — the "sends you an
|
|
21
|
+
* email" action ("Reset password", "Send verification link").
|
|
22
|
+
* Figma names these instances `button_large_primary_gradient`
|
|
23
|
+
* but overrides the fill to plum in both places, so the plum is
|
|
24
|
+
* deliberate, not a stray override.
|
|
25
|
+
* on-accent white fill, cyan-700 (#128ba6) label — a primary action
|
|
26
|
+
* sitting ON the gradient panel (ModalPanel tone="accent").
|
|
27
|
+
* on-accent-muted rgba(0,0,0,0.2) fill, white label — its secondary pair.
|
|
28
|
+
* tertiary blue-50 (#fbfdfe) fill, blue-200 (#cbe0f1) border, blue-600
|
|
29
|
+
* (#2e74ad) label. Same values as the DS `tertiary-light`, but
|
|
30
|
+
* needed here because these instances are `flex: 1 0 0` in a row
|
|
31
|
+
* and the DS Button cannot be made to flex without a className.
|
|
32
|
+
* blue blue-600 (#2e74ad) fill, white label. Same values as the DS
|
|
33
|
+
* `general-primary`, for the same `fill` reason.
|
|
34
|
+
* on-dark-muted rgba(255,255,255,0.08) fill, white label — the secondary
|
|
35
|
+
* action on the dark crop panel (12772:28330).
|
|
36
|
+
* emerald emerald-700 (#17aa8d) fill, white label — its confirm pair
|
|
37
|
+
* (12772:28331).
|
|
38
|
+
*
|
|
39
|
+
* `fill` makes it `flex: 1 0 0` for the side-by-side pair in the confirmation
|
|
40
|
+
* modal; the default is full width.
|
|
41
|
+
*
|
|
42
|
+
* ⚠️ On the `gradient` tone: this deliberately does NOT reuse the DS
|
|
43
|
+
* `.button--primary-gradient`, whose gradient angles differ from the design file
|
|
44
|
+
* (0deg/99deg vs Figma's 90deg/142.25deg). Correcting the DS variant instead
|
|
45
|
+
* would restyle every gradient button in the product, which is a product-wide
|
|
46
|
+
* decision and not this task's to make — so the exact Figma value lives here and
|
|
47
|
+
* the divergence is reported rather than silently absorbed. If the DS variant is
|
|
48
|
+
* fixed, this tone should be deleted and the DS Button used again.
|
|
49
|
+
*
|
|
50
|
+
* Disabled opacity is 0.4, per Figma's `opacity-40` on the disabled CTAs — the
|
|
51
|
+
* DS `.button:disabled` uses 0.5.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
type PillTone =
|
|
55
|
+
| "gradient"
|
|
56
|
+
| "plum"
|
|
57
|
+
| "on-accent"
|
|
58
|
+
| "on-accent-muted"
|
|
59
|
+
| "tertiary"
|
|
60
|
+
| "blue"
|
|
61
|
+
| "on-dark-muted"
|
|
62
|
+
| "emerald";
|
|
63
|
+
|
|
64
|
+
interface PillButtonProps extends React.ComponentProps<"button"> {
|
|
65
|
+
tone?: PillTone;
|
|
66
|
+
/** Share a row equally with sibling PillButtons instead of filling the width. */
|
|
67
|
+
fill?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Angle of the `gradient` tone's colour sweep, in degrees.
|
|
70
|
+
*
|
|
71
|
+
* Figma derives this per instance from the frame's aspect ratio, so it is real
|
|
72
|
+
* design data rather than a style tweak: the auth CTAs are 142.25319251189774
|
|
73
|
+
* and the 320px account tray's CTA is 133.36342079191522. Defaults to the auth
|
|
74
|
+
* value; pass the frame's own number when it differs.
|
|
75
|
+
*/
|
|
76
|
+
angle?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const PillButton = React.forwardRef<HTMLButtonElement, PillButtonProps>(
|
|
80
|
+
(
|
|
81
|
+
{
|
|
82
|
+
tone = "gradient",
|
|
83
|
+
fill = false,
|
|
84
|
+
angle = 142.25319251189774,
|
|
85
|
+
children,
|
|
86
|
+
className,
|
|
87
|
+
type = "button",
|
|
88
|
+
style,
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
ref,
|
|
92
|
+
) => (
|
|
93
|
+
<button
|
|
94
|
+
ref={ref}
|
|
95
|
+
type={type}
|
|
96
|
+
className={cn(
|
|
97
|
+
"pill-button",
|
|
98
|
+
`pill-button--${tone}`,
|
|
99
|
+
fill && "pill-button--fill",
|
|
100
|
+
className,
|
|
101
|
+
)}
|
|
102
|
+
style={
|
|
103
|
+
tone === "gradient"
|
|
104
|
+
? { ["--pill-gradient-angle" as string]: `${angle}deg`, ...style }
|
|
105
|
+
: style
|
|
106
|
+
}
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
<span className="pill-button__label">{children}</span>
|
|
110
|
+
</button>
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
PillButton.displayName = "PillButton";
|
|
114
|
+
|
|
115
|
+
export { PillButton };
|
|
116
|
+
export type { PillButtonProps, PillTone };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ProfileAvatar — the 88px account disc with its gradient ring and edit badge.
|
|
6
|
+
*
|
|
7
|
+
* Figma: an 88px circle (cyan-800 fill when there is no photo), initials in
|
|
8
|
+
* FT Made 38.5px white at 40% opacity, a 2.8px conic-gradient ring, and a 28px
|
|
9
|
+
* white edit button overlapping the bottom edge by 28px.
|
|
10
|
+
*
|
|
11
|
+
* The ring is a CSS `conic-gradient` masked to a 2.8px annulus, using the eight
|
|
12
|
+
* stops verbatim from the design context. The Figma export was tried first and
|
|
13
|
+
* does not work: it renders the gradient with an SVG `foreignObject`, which
|
|
14
|
+
* browsers refuse to draw inside an `<img>` (SVG-as-image is "secure static
|
|
15
|
+
* mode"), leaving only a stray fragment of the fallback stroke visible. These
|
|
16
|
+
* are exact gradient stops, not reconstructed path data.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface ProfileAvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
/** Photo URL; falls back to `initials` on the cyan-800 disc when absent. */
|
|
21
|
+
src?: string;
|
|
22
|
+
initials?: string;
|
|
23
|
+
alt?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Disc diameter in px. Figma uses 88 in the tray and modals (12705:28051) and
|
|
26
|
+
* 32 for the nav trigger (12695:28116); both are the same component scaled, so
|
|
27
|
+
* the ring width and initials scale with it from the 88px spec.
|
|
28
|
+
*/
|
|
29
|
+
size?: number;
|
|
30
|
+
/** Renders the 28px edit badge. Omit for a display-only avatar. */
|
|
31
|
+
onEdit?: () => void;
|
|
32
|
+
editLabel?: string;
|
|
33
|
+
editIcon?: React.ReactNode;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const ProfileAvatar = React.forwardRef<HTMLDivElement, ProfileAvatarProps>(
|
|
37
|
+
(
|
|
38
|
+
{
|
|
39
|
+
src,
|
|
40
|
+
initials,
|
|
41
|
+
alt,
|
|
42
|
+
size = 88,
|
|
43
|
+
onEdit,
|
|
44
|
+
editLabel = "Change profile image",
|
|
45
|
+
editIcon,
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
},
|
|
49
|
+
ref,
|
|
50
|
+
) => (
|
|
51
|
+
<div
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn(
|
|
54
|
+
"profile-avatar",
|
|
55
|
+
// The disc is pulled up 28px to sit behind the edit badge. Without a
|
|
56
|
+
// badge that offset would just eat the gap to whatever follows.
|
|
57
|
+
onEdit && "profile-avatar--editable",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
style={
|
|
61
|
+
{
|
|
62
|
+
["--avatar-size" as string]: `${size}px`,
|
|
63
|
+
// 2.8px ring on the 88px disc; the 32px instance is the same
|
|
64
|
+
// component scaled, so the stroke scales with it.
|
|
65
|
+
["--avatar-ring" as string]: `${(size * 2.8) / 88}px`,
|
|
66
|
+
["--avatar-initials" as string]: `${(size * 38.5) / 88}px`,
|
|
67
|
+
...props.style,
|
|
68
|
+
} as React.CSSProperties
|
|
69
|
+
}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
<span className="profile-avatar__disc">
|
|
73
|
+
{src ? (
|
|
74
|
+
<img className="profile-avatar__photo" src={src} alt={alt ?? ""} />
|
|
75
|
+
) : (
|
|
76
|
+
<>
|
|
77
|
+
<span className="profile-avatar__bg" aria-hidden="true" />
|
|
78
|
+
<span className="profile-avatar__initials" aria-hidden="true">
|
|
79
|
+
{initials}
|
|
80
|
+
</span>
|
|
81
|
+
</>
|
|
82
|
+
)}
|
|
83
|
+
<span className="profile-avatar__ring" aria-hidden="true" />
|
|
84
|
+
</span>
|
|
85
|
+
{onEdit ? (
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className="profile-avatar__edit"
|
|
89
|
+
onClick={onEdit}
|
|
90
|
+
aria-label={editLabel}
|
|
91
|
+
>
|
|
92
|
+
{editIcon}
|
|
93
|
+
</button>
|
|
94
|
+
) : null}
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
ProfileAvatar.displayName = "ProfileAvatar";
|
|
99
|
+
|
|
100
|
+
/* -------------------------------------------------------------------------- */
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* ProfileRow — the avatar-beside-name block at the top of the sign-up and
|
|
104
|
+
* create-account modals.
|
|
105
|
+
*
|
|
106
|
+
* Figma: 24px gap, centre-aligned, name in FT Made 20/22 at -0.2px tracking.
|
|
107
|
+
* The name's colour carries state: gray-400 while it is still the placeholder
|
|
108
|
+
* ("Firstname Lastname"), gray-600 once a real name has been entered.
|
|
109
|
+
*/
|
|
110
|
+
type IdentityTone = "placeholder" | "value";
|
|
111
|
+
|
|
112
|
+
interface ProfileRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
113
|
+
name?: React.ReactNode;
|
|
114
|
+
tone?: IdentityTone;
|
|
115
|
+
children?: React.ReactNode;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const ProfileRow = React.forwardRef<HTMLDivElement, ProfileRowProps>(
|
|
119
|
+
({ name, tone = "value", children, className, ...props }, ref) => (
|
|
120
|
+
<div ref={ref} className={cn("profile-row", className)} {...props}>
|
|
121
|
+
{children}
|
|
122
|
+
<span className="profile-row__name">
|
|
123
|
+
<span
|
|
124
|
+
className={cn(
|
|
125
|
+
"profile-row__name-text heading-xxsmall",
|
|
126
|
+
`profile-row__name-text--${tone}`,
|
|
127
|
+
)}
|
|
128
|
+
>
|
|
129
|
+
{name}
|
|
130
|
+
</span>
|
|
131
|
+
</span>
|
|
132
|
+
</div>
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
ProfileRow.displayName = "ProfileRow";
|
|
136
|
+
|
|
137
|
+
/* -------------------------------------------------------------------------- */
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* AvatarButton — the 32px account disc in the top bar (Figma 12695:28116).
|
|
141
|
+
*
|
|
142
|
+
* A button wrapping the same ProfileAvatar at 32px, with no edit badge. Exists
|
|
143
|
+
* so the nav does not have to wrap an avatar in a raw <button> itself.
|
|
144
|
+
*/
|
|
145
|
+
interface AvatarButtonProps extends Omit<React.ComponentProps<"button">, "children"> {
|
|
146
|
+
src?: string;
|
|
147
|
+
initials?: string;
|
|
148
|
+
label?: string;
|
|
149
|
+
size?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const AvatarButton = React.forwardRef<HTMLButtonElement, AvatarButtonProps>(
|
|
153
|
+
(
|
|
154
|
+
{ src, initials, label = "Your account", size = 32, className, type = "button", ...props },
|
|
155
|
+
ref,
|
|
156
|
+
) => (
|
|
157
|
+
<button
|
|
158
|
+
ref={ref}
|
|
159
|
+
type={type}
|
|
160
|
+
className={cn("avatar-button", className)}
|
|
161
|
+
aria-label={label}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
<ProfileAvatar src={src} initials={initials} size={size} alt="" />
|
|
165
|
+
</button>
|
|
166
|
+
),
|
|
167
|
+
);
|
|
168
|
+
AvatarButton.displayName = "AvatarButton";
|
|
169
|
+
|
|
170
|
+
export { ProfileAvatar, ProfileRow, AvatarButton };
|
|
171
|
+
export type {
|
|
172
|
+
ProfileAvatarProps,
|
|
173
|
+
ProfileRowProps,
|
|
174
|
+
IdentityTone,
|
|
175
|
+
AvatarButtonProps,
|
|
176
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface ResourceThumbnailProps {
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function ResourceThumbnail({
|
|
9
|
+
src,
|
|
10
|
+
alt = "",
|
|
11
|
+
}: ResourceThumbnailProps) {
|
|
12
|
+
return (
|
|
13
|
+
<img
|
|
14
|
+
className="resource-thumbnail"
|
|
15
|
+
src={src}
|
|
16
|
+
alt={alt}
|
|
17
|
+
loading="lazy"
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SocialButton — a full-width pill for a third-party identity provider.
|
|
6
|
+
*
|
|
7
|
+
* Figma (`button_large_secondary_light` in the auth modals): white fill,
|
|
8
|
+
* 1px gray-200 (#dedfe3) border, 48px tall, 32px horizontal padding, 100px
|
|
9
|
+
* radius, 16px gap between a 24px icon slot and a semibold 16/21 blue-600
|
|
10
|
+
* (#2e74ad) label.
|
|
11
|
+
*
|
|
12
|
+
* This is NOT the DS `Button variant="secondary-light"`: that variant's label is
|
|
13
|
+
* cyan-800 (#0f748a), and `buttonVariants` is a closed cva map, so a new label
|
|
14
|
+
* colour cannot be added from outside the DS package. Hence a primitive of its
|
|
15
|
+
* own rather than a call-site override (RULE #-6).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface SocialButtonProps extends React.ComponentProps<"button"> {
|
|
19
|
+
/** URL of the provider mark, rendered in the 24px slot. */
|
|
20
|
+
iconSrc?: string;
|
|
21
|
+
/** Intrinsic size of that mark — the Apple glyph is 21x24, not square. */
|
|
22
|
+
iconWidth?: number;
|
|
23
|
+
iconHeight?: number;
|
|
24
|
+
/** Escape hatch for a mark that is not an image (e.g. an icon component). */
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const SocialButton = React.forwardRef<HTMLButtonElement, SocialButtonProps>(
|
|
29
|
+
(
|
|
30
|
+
{
|
|
31
|
+
iconSrc,
|
|
32
|
+
iconWidth = 24,
|
|
33
|
+
iconHeight = 24,
|
|
34
|
+
icon,
|
|
35
|
+
children,
|
|
36
|
+
className,
|
|
37
|
+
type = "button",
|
|
38
|
+
...props
|
|
39
|
+
},
|
|
40
|
+
ref,
|
|
41
|
+
) => {
|
|
42
|
+
const mark =
|
|
43
|
+
icon ??
|
|
44
|
+
(iconSrc ? (
|
|
45
|
+
<img src={iconSrc} alt="" width={iconWidth} height={iconHeight} />
|
|
46
|
+
) : null);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<button
|
|
50
|
+
ref={ref}
|
|
51
|
+
type={type}
|
|
52
|
+
className={cn("social-button", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
<span className="social-button__content">
|
|
56
|
+
{mark ? (
|
|
57
|
+
<span className="social-button__icon" aria-hidden="true">
|
|
58
|
+
{mark}
|
|
59
|
+
</span>
|
|
60
|
+
) : null}
|
|
61
|
+
<span className="social-button__label">{children}</span>
|
|
62
|
+
</span>
|
|
63
|
+
</button>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
SocialButton.displayName = "SocialButton";
|
|
68
|
+
|
|
69
|
+
export { SocialButton };
|
|
70
|
+
export type { SocialButtonProps };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* StatusPill — a small, static status badge (UNPAID / PAID / VOID …).
|
|
6
|
+
*
|
|
7
|
+
* The DS has nothing for this. `Badge` is listed in
|
|
8
|
+
* `.ai/design-system/component-registry.json` as published, but it is NOT in
|
|
9
|
+
* `@syscore/ui-library`'s `index.d.ts` — only the achievement/provider badge
|
|
10
|
+
* ICONS are exported, so importing it fails. `Tag` does exist, but it renders a
|
|
11
|
+
* `<button>` and its statuses are task states ("todo" | "low" | "medium" |
|
|
12
|
+
* "high" | "done"), which is both the wrong semantics and the wrong vocabulary
|
|
13
|
+
* for an invoice.
|
|
14
|
+
*
|
|
15
|
+
* So this owns its own appearance per RULE #-3A row 4: the tone is a prop, the
|
|
16
|
+
* colour lives in `DS_PENDING_CSS:StatusPill` in `src/index.css`, and no caller
|
|
17
|
+
* ever passes a class.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/* The four invoice states in `Invoice::STATUS_*`, no more — an unknown status
|
|
21
|
+
falls back to `neutral` rather than inventing a colour for it. */
|
|
22
|
+
type StatusPillTone = "unpaid" | "paid" | "waived" | "void" | "neutral";
|
|
23
|
+
|
|
24
|
+
interface StatusPillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
25
|
+
tone?: StatusPillTone;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const TONES: readonly StatusPillTone[] = [
|
|
30
|
+
"unpaid",
|
|
31
|
+
"paid",
|
|
32
|
+
"waived",
|
|
33
|
+
"void",
|
|
34
|
+
"neutral",
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
/** Maps an API status string onto a tone, defaulting to `neutral`. */
|
|
38
|
+
function toneForStatus(status?: string | null): StatusPillTone {
|
|
39
|
+
const value = String(status ?? "").toLowerCase() as StatusPillTone;
|
|
40
|
+
|
|
41
|
+
return TONES.includes(value) ? value : "neutral";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const StatusPill = React.forwardRef<HTMLSpanElement, StatusPillProps>(
|
|
45
|
+
({ tone = "neutral", children, className, ...props }, ref) => (
|
|
46
|
+
<span
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn("status-pill", `status-pill--${tone}`, className)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</span>
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
StatusPill.displayName = "StatusPill";
|
|
56
|
+
|
|
57
|
+
export { StatusPill, toneForStatus };
|
|
58
|
+
export type { StatusPillProps, StatusPillTone };
|
|
@@ -141,6 +141,19 @@ const TableHeaderCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
|
141
141
|
);
|
|
142
142
|
TableHeaderCell.displayName = "TableHeaderCell";
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Compatibility alias for the shadcn table's `TableHead`, which this component
|
|
146
|
+
* set replaced. Identical to `TableHeaderCell` — the label may be passed as
|
|
147
|
+
* `label` or as children — so existing markup keeps compiling. Prefer
|
|
148
|
+
* `TableHeaderCell` in new code.
|
|
149
|
+
*
|
|
150
|
+
* @deprecated Use `TableHeaderCell`.
|
|
151
|
+
*/
|
|
152
|
+
const TableHead = React.forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
153
|
+
(props, ref) => <TableHeaderCell ref={ref} {...props} />,
|
|
154
|
+
);
|
|
155
|
+
TableHead.displayName = "TableHead";
|
|
156
|
+
|
|
144
157
|
/**
|
|
145
158
|
* Figma `Placement=Intermediates | Bottom`: white fill, Mazzard Medium 16/21.
|
|
146
159
|
*
|
|
@@ -204,6 +217,21 @@ const TableAction = React.forwardRef<
|
|
|
204
217
|
));
|
|
205
218
|
TableAction.displayName = "TableAction";
|
|
206
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Compatibility component for the shadcn table's `TableCaption`. Figma does not
|
|
222
|
+
* specify a caption, so it is styled as quiet gray/500 body text below the
|
|
223
|
+
* table. Kept so existing markup keeps compiling.
|
|
224
|
+
*
|
|
225
|
+
* @deprecated Not part of the Figma component set.
|
|
226
|
+
*/
|
|
227
|
+
const TableCaption = React.forwardRef<
|
|
228
|
+
HTMLTableCaptionElement,
|
|
229
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
230
|
+
>(({ className, ...props }, ref) => (
|
|
231
|
+
<caption ref={ref} className={cn("table-caption", className)} {...props} />
|
|
232
|
+
));
|
|
233
|
+
TableCaption.displayName = "TableCaption";
|
|
234
|
+
|
|
207
235
|
export {
|
|
208
236
|
Table,
|
|
209
237
|
TableHeader,
|
|
@@ -214,6 +242,8 @@ export {
|
|
|
214
242
|
TableCell,
|
|
215
243
|
TableTag,
|
|
216
244
|
TableAction,
|
|
245
|
+
TableHead,
|
|
246
|
+
TableCaption,
|
|
217
247
|
};
|
|
218
248
|
|
|
219
249
|
export type {
|