rift-ds 1.40.0 → 1.42.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.
- package/README.md +6 -2
- package/behaviors/LoadingImage.d.ts +2 -0
- package/behaviors/LoadingImage.js +34 -0
- package/behaviors/ScrollRegion.js +15 -2
- package/behaviors/VisuallyHidden.d.ts +30 -0
- package/behaviors/VisuallyHidden.js +17 -0
- package/behaviors/loading-image.css +30 -0
- package/behaviors/quietFocus.d.ts +4 -0
- package/behaviors/quietFocus.js +14 -0
- package/behaviors/shell.css +9 -11
- package/behaviors/useFocusScope.d.ts +3 -1
- package/behaviors/useFocusScope.js +4 -6
- package/bin/rift-ds.mjs +1 -0
- package/bin/templates/app/components/rift/ColorModeScript.tsx +3 -1
- package/bin/templates/app/components/rift/RiftRoot.tsx +40 -1
- package/bin/templates/blocks/app/dashboard/page.tsx +7 -5
- package/bin/templates/blocks/app/landing/page.tsx +1 -1
- package/bin/templates/blocks/app/pricing/page.module.css +15 -1
- package/bin/templates/blocks/app/pricing/page.tsx +8 -1
- package/bin/templates/blocks/app/sign-in/page.tsx +10 -2
- package/bin/templates/blocks/app/sign-up/page.module.css +83 -0
- package/bin/templates/blocks/app/sign-up/page.tsx +126 -0
- package/bin/templates/blocks/app/starter/page.tsx +1 -1
- package/bin/templates/blocks/components/blocks/AppShell.module.css +0 -10
- package/bin/templates/blocks/components/blocks/AppShell.tsx +41 -116
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/registry.json +44 -6
- package/chat/ChatLauncher.d.ts +2 -2
- package/chat/ChatWidget.css +7 -7
- package/chat/ChatWidget.d.ts +1 -1
- package/components/AgentPlan/AgentPlan.css +1 -1
- package/components/AlertDialog/AlertDialog.css +14 -0
- package/components/AlertDialog/AlertDialog.d.ts +35 -3
- package/components/AlertDialog/AlertDialog.js +16 -5
- package/components/AppLayout/AppLayout.css +1 -1
- package/components/AppLayout/AppLayout.d.ts +2 -2
- package/components/AppSidebar/AppSidebar.css +25 -17
- package/components/AppSidebar/AppSidebar.d.ts +4 -4
- package/components/AppSidebar/AppSidebar.js +14 -5
- package/components/Attachment/AttachmentGroup.js +2 -1
- package/components/Attachment/AttachmentTile.js +2 -1
- package/components/Avatar/Avatar.css +18 -5
- package/components/Avatar/Avatar.d.ts +2 -0
- package/components/Avatar/Avatar.js +2 -1
- package/components/AvatarGroup/AvatarGroup.css +8 -1
- package/components/AvatarGroup/AvatarGroup.d.ts +6 -0
- package/components/AvatarGroup/AvatarGroup.js +2 -2
- package/components/Badge/Badge.css +6 -0
- package/components/Breadcrumb/Breadcrumb.css +4 -1
- package/components/Button/Button.css +20 -1
- package/components/Button/Button.js +6 -1
- package/components/Card/Card.css +11 -0
- package/components/Card/Card.d.ts +9 -3
- package/components/Card/Card.js +21 -2
- package/components/Chart/AreaChart.d.ts +7 -0
- package/components/Chart/AreaChart.js +51 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +122 -1
- package/components/Chart/ChartSkeleton.d.ts +32 -0
- package/components/Chart/ChartSkeleton.js +149 -0
- package/components/Chart/ComboChart.d.ts +7 -0
- package/components/Chart/ComboChart.js +80 -74
- package/components/Chart/LineChart.d.ts +17 -3
- package/components/Chart/LineChart.js +61 -39
- package/components/Chart/PieChart.d.ts +7 -0
- package/components/Chart/PieChart.js +41 -34
- package/components/Chart/RadarChart.d.ts +7 -0
- package/components/Chart/RadarChart.js +38 -32
- package/components/Chart/RadialChart.d.ts +7 -0
- package/components/Chart/RadialChart.js +5 -1
- package/components/Chart/ScatterChart.d.ts +7 -0
- package/components/Chart/ScatterChart.js +46 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +51 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- package/components/Checkbox/Checkbox.css +25 -1
- package/components/Checkbox/Checkbox.d.ts +8 -4
- package/components/Checkbox/Checkbox.js +17 -8
- package/components/Chip/Chip.css +5 -3
- package/components/ContactCard/ContactCard.css +4 -3
- package/components/ContributionGraph/ContributionGraph.css +20 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +4 -0
- package/components/ContributionGraph/ContributionGraph.js +11 -6
- package/components/DataTable/DataTable.css +91 -4
- package/components/DataTable/DataTable.d.ts +42 -4
- package/components/DataTable/DataTable.js +121 -90
- package/components/DateInput/DateInput.css +3 -1
- package/components/DatePicker/DatePicker.css +16 -0
- package/components/DatePicker/DatePicker.d.ts +13 -0
- package/components/DatePicker/DatePicker.js +21 -27
- package/components/DatePicker/MonthGrid.d.ts +2 -2
- package/components/DatePicker/MonthGrid.js +1 -1
- package/components/DatePicker/today.d.ts +15 -0
- package/components/DatePicker/today.js +17 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +14 -1
- package/components/DateRangePicker/DateRangePicker.js +18 -7
- package/components/DescriptionList/DescriptionList.css +11 -0
- package/components/DescriptionList/DescriptionList.d.ts +5 -1
- package/components/DescriptionList/DescriptionList.js +21 -6
- package/components/Dialog/Dialog.css +9 -0
- package/components/Dialog/Dialog.d.ts +9 -0
- package/components/Dialog/Dialog.js +32 -19
- package/components/DocumentChip/DocumentChip.css +1 -1
- package/components/Drawer/Drawer.d.ts +9 -0
- package/components/Drawer/Drawer.js +8 -0
- package/components/DrillMenu/DrillMenu.d.ts +2 -1
- package/components/DrillMenu/DrillMenu.js +14 -3
- package/components/Dropdown/Dropdown.css +3 -1
- package/components/EmptyState/EmptyState.css +8 -1
- package/components/EntitySwitcher/EntitySwitcher.css +2 -1
- package/components/Field/Field.css +2 -2
- package/components/FileInput/FileInput.css +1 -1
- package/components/FilterBar/FilterBar.d.ts +6 -1
- package/components/FunnelChart/FunnelChart.d.ts +7 -0
- package/components/FunnelChart/FunnelChart.js +44 -30
- package/components/GanttChart/GanttChart.css +10 -0
- package/components/GanttChart/GanttChart.d.ts +4 -0
- package/components/GanttChart/GanttChart.js +66 -33
- package/components/Gauge/Gauge.css +23 -0
- package/components/Gauge/Gauge.d.ts +4 -0
- package/components/Gauge/Gauge.js +14 -8
- package/components/Icon/Icon.css +6 -1
- package/components/Icon/Icon.d.ts +3 -1
- package/components/Icon/Icon.js +2 -0
- package/components/ImageCompare/ImageCompare.js +2 -1
- package/components/Input/Input.css +3 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +16 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +4 -0
- package/components/NotificationCenter/NotificationCenter.js +23 -1
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/PixelAvatar/PixelAvatar.css +7 -1
- package/components/PixelAvatar/PixelAvatar.d.ts +2 -0
- package/components/PixelAvatar/PixelAvatar.js +2 -1
- package/components/Prose/Prose.css +1 -1
- package/components/RadioButton/RadioButton.css +1 -1
- package/components/RadioButton/RadioButton.d.ts +4 -2
- package/components/RadioButton/RadioButton.js +5 -2
- package/components/ResourceTimeline/ResourceTimeline.css +12 -0
- package/components/ResourceTimeline/ResourceTimeline.d.ts +5 -1
- package/components/ResourceTimeline/ResourceTimeline.js +94 -52
- package/components/RichDropdown/RichDropdown.css +3 -1
- package/components/SelectionCard/SelectionCard.css +29 -0
- package/components/SelectionCard/SelectionCard.d.ts +7 -0
- package/components/SelectionCard/SelectionCard.js +25 -2
- package/components/ShaderField/useShaderField.js +2 -2
- package/components/ShaderScene/ShaderScene.js +2 -2
- package/components/SiteHeader/SiteHeader.css +0 -9
- package/components/SourceChip/SourceChip.css +2 -1
- package/components/Sparkline/Sparkline.css +20 -0
- package/components/Sparkline/Sparkline.d.ts +4 -0
- package/components/Sparkline/Sparkline.js +14 -8
- package/components/Stat/Stat.css +31 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/SubNavPanel/SubNavPanel.css +10 -9
- package/components/Table/Table.css +409 -14
- package/components/Table/Table.d.ts +32 -2
- package/components/Table/Table.js +66 -34
- package/components/Textarea/Textarea.css +4 -2
- package/components/ThemeToggle/colorMode.d.ts +10 -2
- package/components/ThemeToggle/colorMode.js +4 -2
- package/components/ThreadHistory/ThreadHistory.css +11 -0
- package/components/ThreadHistory/ThreadHistory.d.ts +5 -1
- package/components/ThreadHistory/ThreadHistory.js +6 -1
- package/components/ThreadPanel/ThreadPanel.d.ts +4 -0
- package/components/ThreadPanel/ThreadPanel.js +5 -1
- package/components/TimePicker/TimePicker.css +3 -1
- package/components/TimePicker/TimePicker.d.ts +4 -2
- package/components/TimePicker/TimePicker.js +11 -3
- package/components/Timeline/Timeline.css +15 -0
- package/components/Timeline/Timeline.d.ts +8 -0
- package/components/Timeline/Timeline.js +21 -0
- package/components/Toast/Toast.css +16 -0
- package/components/Toast/Toast.d.ts +7 -2
- package/components/ToggleGroup/ToggleGroup.css +28 -2
- package/components/ToggleSwitch/ToggleSwitch.css +1 -1
- package/components/Tooltip/Tooltip.d.ts +9 -0
- package/components/Tooltip/Tooltip.js +34 -8
- package/components/TreeView/TreeView.css +12 -0
- package/components/TreeView/TreeView.d.ts +4 -0
- package/components/TreeView/TreeView.js +20 -0
- package/components/UsageCard/UsageCard.css +11 -0
- package/components/UsageCard/UsageCard.d.ts +4 -0
- package/components/UsageCard/UsageCard.js +25 -16
- package/components/Widget/Widget.css +7 -0
- package/components/Widget/Widget.d.ts +4 -0
- package/components/Widget/Widget.js +14 -2
- package/components/registry.json +5 -2
- package/components/registry.json.d.ts +5 -2
- package/components/registry.json.js +1 -1
- package/package.json +9 -3
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/contrast.css +36 -3
- package/tokens/presets/coral.css +39 -3
- package/tokens/presets/forest.css +55 -3
- package/tokens/presets/gold.css +39 -4
- package/tokens/presets/marquee.css +42 -4
- package/tokens/presets/mono.css +107 -29
- package/tokens/presets/pink.css +41 -3
- package/tokens/presets/plum.css +41 -1
- package/tokens/presets/terminal.css +40 -4
- package/tokens/presets/violet.css +42 -3
- package/tokens/presets/warm.css +49 -5
- package/tokens/presets/zest.css +47 -3
- package/tokens/registry.json +2 -0
- package/tokens/registry.json.d.ts +2 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +5 -0
- package/tokens/tokens-light.css +9 -0
- package/tokens/values.d.ts +14 -1
- package/tokens/values.js +14 -1
- package/tokens/values.json.js +1 -1
|
@@ -11,6 +11,12 @@ type AlertDialogOwnProps = {
|
|
|
11
11
|
title: string;
|
|
12
12
|
/** Dialog description / body text */
|
|
13
13
|
description?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Content between the description and the actions: a type-to-confirm
|
|
16
|
+
* field, a checkbox, a short list of what will be removed. Keep it to what
|
|
17
|
+
* the decision needs; a form of its own belongs in a Dialog.
|
|
18
|
+
*/
|
|
19
|
+
children?: React.ReactNode;
|
|
14
20
|
/** Confirm button label */
|
|
15
21
|
confirmLabel?: string;
|
|
16
22
|
/** Cancel button label */
|
|
@@ -19,6 +25,31 @@ type AlertDialogOwnProps = {
|
|
|
19
25
|
onConfirm?: () => void;
|
|
20
26
|
/** Callback when cancel is clicked */
|
|
21
27
|
onCancel?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the confirm action is unavailable, for a decision that needs
|
|
30
|
+
* something first: the name typed into a confirm field, a box ticked.
|
|
31
|
+
*/
|
|
32
|
+
confirmDisabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the confirmed action is in flight. The confirm button shows its
|
|
35
|
+
* spinner and takes no press, and Cancel, Escape and the backdrop are held
|
|
36
|
+
* until it finishes, so the dialog cannot close under the work. Pair it
|
|
37
|
+
* with `closeOnConfirm={false}`.
|
|
38
|
+
*/
|
|
39
|
+
confirmLoading?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether pressing confirm also asks the dialog to close. `true` (the
|
|
42
|
+
* default) calls `onConfirm` and then `onOpenChange(false)`. `false` calls
|
|
43
|
+
* `onConfirm` only, so the host keeps the dialog open while the action
|
|
44
|
+
* runs (`confirmLoading`) and closes it when the action settles.
|
|
45
|
+
*/
|
|
46
|
+
closeOnConfirm?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The element that takes focus when the dialog opens: a ref to a field
|
|
49
|
+
* inside it, such as a type-to-confirm input. Without one, focus lands on
|
|
50
|
+
* Cancel, the safe action.
|
|
51
|
+
*/
|
|
52
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
22
53
|
/**
|
|
23
54
|
* Colour of the dialog's icon, title and confirm action: `destructive`
|
|
24
55
|
* for dangerous or irreversible actions.
|
|
@@ -33,13 +64,14 @@ type AlertDialogOwnProps = {
|
|
|
33
64
|
/** Additional CSS classes on the overlay container (the ref and native attributes go on the panel) */
|
|
34
65
|
className?: string;
|
|
35
66
|
};
|
|
36
|
-
export interface AlertDialogProps extends AlertDialogOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AlertDialogOwnProps | '
|
|
67
|
+
export interface AlertDialogProps extends AlertDialogOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AlertDialogOwnProps | 'role'> {
|
|
37
68
|
}
|
|
38
69
|
/**
|
|
39
70
|
* AlertDialog component for important confirmations.
|
|
40
71
|
* Renders a modal overlay with title, description,
|
|
41
|
-
*
|
|
42
|
-
* supports ESC key
|
|
72
|
+
* optional content the decision needs, and confirm /
|
|
73
|
+
* cancel actions. Traps focus and supports ESC key
|
|
74
|
+
* dismissal.
|
|
43
75
|
*/
|
|
44
76
|
export declare const AlertDialog: React.ForwardRefExoticComponent<AlertDialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
77
|
export {};
|
|
@@ -14,10 +14,15 @@ const AlertDialog = React.forwardRef(({
|
|
|
14
14
|
onOpenChange,
|
|
15
15
|
title,
|
|
16
16
|
description,
|
|
17
|
+
children,
|
|
17
18
|
confirmLabel = "Confirm",
|
|
18
19
|
cancelLabel = "Cancel",
|
|
19
20
|
onConfirm,
|
|
20
21
|
onCancel,
|
|
22
|
+
confirmDisabled = false,
|
|
23
|
+
confirmLoading = false,
|
|
24
|
+
closeOnConfirm = true,
|
|
25
|
+
initialFocus,
|
|
21
26
|
tone,
|
|
22
27
|
variant,
|
|
23
28
|
className = "",
|
|
@@ -34,17 +39,19 @@ const AlertDialog = React.forwardRef(({
|
|
|
34
39
|
const baseClass = "ds-alert-dialog";
|
|
35
40
|
const mounted = useMounted();
|
|
36
41
|
const handleCancel = useCallback(() => {
|
|
42
|
+
if (confirmLoading) return;
|
|
37
43
|
onCancel?.();
|
|
38
44
|
onOpenChange(false);
|
|
39
|
-
}, [onCancel, onOpenChange]);
|
|
45
|
+
}, [confirmLoading, onCancel, onOpenChange]);
|
|
40
46
|
const handleConfirm = useCallback(() => {
|
|
47
|
+
if (confirmDisabled || confirmLoading) return;
|
|
41
48
|
onConfirm?.();
|
|
42
|
-
onOpenChange(false);
|
|
43
|
-
}, [onConfirm, onOpenChange]);
|
|
44
|
-
const layer = useLayer({ open, onDismiss: handleCancel });
|
|
49
|
+
if (closeOnConfirm) onOpenChange(false);
|
|
50
|
+
}, [confirmDisabled, confirmLoading, closeOnConfirm, onConfirm, onOpenChange]);
|
|
51
|
+
const layer = useLayer({ open, dismissOnEscape: !confirmLoading, onDismiss: handleCancel });
|
|
45
52
|
useFocusScope(panelRef, {
|
|
46
53
|
active: open,
|
|
47
|
-
initialFocus: () => panelRef.current?.querySelector(`.${baseClass}__actions button:first-child`) ?? null
|
|
54
|
+
initialFocus: () => initialFocus?.current ?? panelRef.current?.querySelector(`.${baseClass}__actions button:first-child`) ?? null
|
|
48
55
|
});
|
|
49
56
|
useScrollLock(open);
|
|
50
57
|
const resolvedTone = tone ?? variant ?? "default";
|
|
@@ -85,12 +92,14 @@ const AlertDialog = React.forwardRef(({
|
|
|
85
92
|
/* @__PURE__ */ jsx("h2", { className: `${baseClass}__title`, id: titleId, children: title })
|
|
86
93
|
] }),
|
|
87
94
|
description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description }),
|
|
95
|
+
children != null && children !== false && /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children }),
|
|
88
96
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__actions`, children: [
|
|
89
97
|
/* @__PURE__ */ jsx(
|
|
90
98
|
Button,
|
|
91
99
|
{
|
|
92
100
|
label: cancelLabel,
|
|
93
101
|
variant: "tertiary",
|
|
102
|
+
disabled: confirmLoading,
|
|
94
103
|
onClick: handleCancel
|
|
95
104
|
}
|
|
96
105
|
),
|
|
@@ -100,6 +109,8 @@ const AlertDialog = React.forwardRef(({
|
|
|
100
109
|
label: confirmLabel,
|
|
101
110
|
variant: resolvedTone === "destructive" ? "secondary" : "primary",
|
|
102
111
|
tone: resolvedTone,
|
|
112
|
+
disabled: confirmDisabled,
|
|
113
|
+
loading: confirmLoading,
|
|
103
114
|
onClick: handleConfirm
|
|
104
115
|
}
|
|
105
116
|
)
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/* ============================================
|
|
114
|
-
FLOATING LAYOUT — the rail floats as a
|
|
114
|
+
FLOATING LAYOUT — the rail floats as a
|
|
115
115
|
card, so the main column clears its inset on
|
|
116
116
|
both sides of it
|
|
117
117
|
============================================ */
|
|
@@ -39,8 +39,8 @@ type AppLayoutOwnProps = {
|
|
|
39
39
|
* How the rail and the content meet the page, one of the three app shell
|
|
40
40
|
* modes. `flush` runs the rail edge to edge on the shell
|
|
41
41
|
* colour behind a hairline, the content centred beside it on the crisp
|
|
42
|
-
* app surface, nothing raised. `floating` floats the rail as a
|
|
43
|
-
* the content
|
|
42
|
+
* app surface, nothing raised. `floating` floats the rail as a card on the
|
|
43
|
+
* shell colour, the content centred on the crisp app surface. `inset` runs the rail flush on the shell
|
|
44
44
|
* colour and sets the content in a raised surface (hairline and floating
|
|
45
45
|
* shadow) inset from the other edges, which scrolls inside itself, and is
|
|
46
46
|
* the default. How wide the content runs is `width`, apart from the mode.
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
shell sets both; a rail standing alone takes the same look. */
|
|
32
32
|
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
33
33
|
border-inline-end: var(--border-025) solid var(--ds-shell-rail-divider, var(--color-bg-container-border));
|
|
34
|
-
/*
|
|
35
|
-
rail inherited the host's, and the mark vanished on a dark
|
|
34
|
+
/* A logo a host passes may draw in currentColor; without a colour of its
|
|
35
|
+
own the rail inherited the host's, and the mark vanished on a dark
|
|
36
|
+
host. The built-in mark wears the brand mark roles instead (below). */
|
|
36
37
|
color: var(--color-text-primary);
|
|
37
38
|
overflow: hidden;
|
|
38
39
|
transition: width var(--motion-duration-slow) var(--motion-ease-emphasized);
|
|
@@ -50,23 +51,20 @@
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/* ============================================
|
|
53
|
-
FLOATING VARIANT — the rail as a
|
|
54
|
-
inset from the viewport edges
|
|
55
|
-
recipe as the site chat panel)
|
|
54
|
+
FLOATING VARIANT — the rail as a card on the
|
|
55
|
+
shell colour, inset from the viewport edges
|
|
56
56
|
============================================ */
|
|
57
57
|
.ds-app-sidebar--floating {
|
|
58
58
|
top: var(--ds-sidebar-float-inset, 20px);
|
|
59
59
|
inset-inline-start: var(--ds-sidebar-float-inset, 20px);
|
|
60
60
|
height: calc(100dvh - var(--ds-sidebar-float-inset, 20px) * 2);
|
|
61
|
-
/* The shell recipe's
|
|
61
|
+
/* The shell recipe's floating card (src/behaviors/shell.css): the shell
|
|
62
|
+
colour, a step off the crisp surface around it, with the recipe's
|
|
62
63
|
values as fallbacks for a rail standing outside a shell host. */
|
|
63
|
-
background-color: var(--ds-shell-
|
|
64
|
-
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-
|
|
64
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
65
|
+
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-app-shell-border));
|
|
65
66
|
border-radius: var(--ds-shell-radius, var(--radius-600));
|
|
66
67
|
box-shadow: var(--ds-shell-edge-shadow, var(--shadow-floating));
|
|
67
|
-
/* The glass token is deliberately translucent; this blur is what keeps
|
|
68
|
-
content behind the rail readable through it. */
|
|
69
|
-
backdrop-filter: var(--ds-shell-glass-blur, blur(24px));
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
/* The inset layout's gap: between the content surface and the viewport
|
|
@@ -190,6 +188,16 @@
|
|
|
190
188
|
flex-shrink: 0;
|
|
191
189
|
}
|
|
192
190
|
|
|
191
|
+
/* The built-in mark's gradient: the logo's own roles, which follow the
|
|
192
|
+
action colour until a theme gives the logo a tone apart from it. */
|
|
193
|
+
.ds-app-sidebar__mark-start {
|
|
194
|
+
stop-color: var(--color-brand-mark);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.ds-app-sidebar__mark-end {
|
|
198
|
+
stop-color: var(--color-brand-mark-end);
|
|
199
|
+
}
|
|
200
|
+
|
|
193
201
|
.ds-app-sidebar__logo-text {
|
|
194
202
|
font-family: var(--font-paragraph-emphasis-family);
|
|
195
203
|
font-size: var(--font-paragraph-emphasis-size);
|
|
@@ -1139,18 +1147,18 @@
|
|
|
1139
1147
|
inset-inline-start: 280px;
|
|
1140
1148
|
}
|
|
1141
1149
|
|
|
1142
|
-
/* Floating: a second
|
|
1150
|
+
/* Floating: a second card beside the first, one gap along. */
|
|
1143
1151
|
.ds-app-sidebar__panel--floating {
|
|
1144
1152
|
top: var(--ds-sidebar-float-inset, 20px);
|
|
1145
1153
|
inset-inline-start: calc(var(--ds-sidebar-float-inset, 20px) + 64px + var(--gap-300));
|
|
1146
1154
|
height: calc(100dvh - var(--ds-sidebar-float-inset, 20px) * 2);
|
|
1147
|
-
/* The shell recipe's
|
|
1155
|
+
/* The shell recipe's floating card (src/behaviors/shell.css): the shell
|
|
1156
|
+
colour, a step off the crisp surface around it, with the recipe's
|
|
1148
1157
|
values as fallbacks for a rail standing outside a shell host. */
|
|
1149
|
-
background-color: var(--ds-shell-
|
|
1150
|
-
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-
|
|
1158
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
1159
|
+
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-app-shell-border));
|
|
1151
1160
|
border-radius: var(--ds-shell-radius, var(--radius-600));
|
|
1152
1161
|
box-shadow: var(--ds-shell-edge-shadow, var(--shadow-floating));
|
|
1153
|
-
backdrop-filter: var(--ds-shell-glass-blur, blur(24px));
|
|
1154
1162
|
}
|
|
1155
1163
|
|
|
1156
1164
|
.ds-app-sidebar__panel--floating.ds-app-sidebar__panel--panel-mode {
|
|
@@ -1465,7 +1473,7 @@
|
|
|
1465
1473
|
width: 0;
|
|
1466
1474
|
padding: 0;
|
|
1467
1475
|
overflow: hidden;
|
|
1468
|
-
/* Zero width still paints borders and the floating variant's
|
|
1476
|
+
/* Zero width still paints borders and the floating variant's raised
|
|
1469
1477
|
edge — a hairline sliver standing where the rail was. Visibility
|
|
1470
1478
|
hides every painted box in one property, whatever the variant;
|
|
1471
1479
|
the open drawer below restores it. */
|
|
@@ -199,9 +199,9 @@ type AppSidebarOwnProps = {
|
|
|
199
199
|
/**
|
|
200
200
|
* How the rail meets the page, one of the three app shell modes. `flush`
|
|
201
201
|
* runs it edge to edge on the shell colour behind a hairline divider,
|
|
202
|
-
* nothing raised. `floating` floats it off the viewport edges as a
|
|
203
|
-
*
|
|
204
|
-
*
|
|
202
|
+
* nothing raised. `floating` floats it off the viewport edges as a card on
|
|
203
|
+
* the shell colour beside the crisp app surface: inset with rounded
|
|
204
|
+
* corners, a hairline and the floating shadow (the inset defaults to 20px and is
|
|
205
205
|
* overridable via the --ds-sidebar-float-inset custom property). `inset`
|
|
206
206
|
* runs it flush on the app shell colour, beside a raised content surface
|
|
207
207
|
* inset from the edges, as AppLayout's `inset` layout draws it. Inside a
|
|
@@ -212,7 +212,7 @@ type AppSidebarOwnProps = {
|
|
|
212
212
|
*/
|
|
213
213
|
layout?: AppSidebarLayout;
|
|
214
214
|
/**
|
|
215
|
-
* Floats the rail as a
|
|
215
|
+
* Floats the rail as a card, the same as `layout="floating"`.
|
|
216
216
|
* @deprecated Use `layout="floating"`.
|
|
217
217
|
*/
|
|
218
218
|
floating?: boolean;
|
|
@@ -26,19 +26,28 @@ function isCount(badge) {
|
|
|
26
26
|
return typeof badge === "number" || /^\d+\+?$/.test(badge.trim());
|
|
27
27
|
}
|
|
28
28
|
function DefaultLogo() {
|
|
29
|
+
const gradientId = `ds-app-sidebar-mark-${useId().replace(/:/g, "")}`;
|
|
29
30
|
return /* @__PURE__ */ jsxs(
|
|
30
31
|
"svg",
|
|
31
32
|
{
|
|
32
33
|
width: "24",
|
|
33
34
|
height: "24",
|
|
34
|
-
viewBox: "
|
|
35
|
-
fill: "none",
|
|
35
|
+
viewBox: "-4 -4 104 104",
|
|
36
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37
37
|
"aria-hidden": "true",
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */ jsx("
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: "0", y1: "5", x2: "0", y2: "91", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("stop", { offset: "0", className: "ds-app-sidebar__mark-start" }),
|
|
41
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", className: "ds-app-sidebar__mark-end" })
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"path",
|
|
45
|
+
{
|
|
46
|
+
d: "M20.5 31L31.5 25L31.5 50.28L17.78 64L2.22 64L20.5 45.72ZM64.5 31L75.5 25L75.5 45.72L93.78 64L78.22 64L64.5 50.28Z",
|
|
47
|
+
fill: `url(#${gradientId})`
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx("path", { d: "M42 11L54 5L54 85L42 91Z", fill: `url(#${gradientId})` })
|
|
42
51
|
]
|
|
43
52
|
}
|
|
44
53
|
);
|
|
@@ -7,6 +7,7 @@ import { renderTypeMark } from "./typeMark.js";
|
|
|
7
7
|
import { AttachmentViewer } from "./AttachmentViewer.js";
|
|
8
8
|
import "./Attachment.css";
|
|
9
9
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
10
|
+
import { LoadingImage } from "../../behaviors/LoadingImage.js";
|
|
10
11
|
import { revokeAttachmentUrls, useAttachments } from "./useAttachments.js";
|
|
11
12
|
const isPicture = (item) => item.status === "ready" && item.kind === "image" && Boolean(item.previewSrc);
|
|
12
13
|
const AttachmentGroup = React.forwardRef(
|
|
@@ -71,7 +72,7 @@ const AttachmentGroup = React.forwardRef(
|
|
|
71
72
|
const onClick = clickHandler(single);
|
|
72
73
|
const sized = Boolean(single.width && single.height);
|
|
73
74
|
const image = /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
75
|
+
LoadingImage,
|
|
75
76
|
{
|
|
76
77
|
className: [`${baseClass}__single-image`, sized && `${baseClass}__single-image--sized`].filter(Boolean).join(" "),
|
|
77
78
|
src: single.previewSrc,
|
|
@@ -6,6 +6,7 @@ import { renderTypeMark } from "./typeMark.js";
|
|
|
6
6
|
import "../../fonts/material-symbols.css";
|
|
7
7
|
import "./Attachment.css";
|
|
8
8
|
import "../../behaviors/visually-hidden.css";
|
|
9
|
+
import { LoadingImage } from "../../behaviors/LoadingImage.js";
|
|
9
10
|
const AttachmentTile = React.forwardRef(
|
|
10
11
|
({
|
|
11
12
|
name,
|
|
@@ -107,7 +108,7 @@ const AttachmentTile = React.forwardRef(
|
|
|
107
108
|
let content = stack;
|
|
108
109
|
if (showPreview) {
|
|
109
110
|
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
+
/* @__PURE__ */ jsx(LoadingImage, { className: `${baseClass}__preview`, src: previewSrc, alt: previewAlt ?? name }),
|
|
111
112
|
(previewMark ?? kind !== "image") && /* @__PURE__ */ jsx("span", { className: `${baseClass}__corner`, children: cornerMark })
|
|
112
113
|
] });
|
|
113
114
|
} else if (showExcerpt) {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
display: inline-flex;
|
|
13
13
|
align-items: center;
|
|
14
14
|
justify-content: center;
|
|
15
|
-
|
|
15
|
+
/* --ds-mark-radius is the shared mark hook: `round`, or a container's
|
|
16
|
+
`roundMarks`, sets it to a circle; unset, the avatar keeps its token. */
|
|
17
|
+
border-radius: var(--ds-mark-radius, var(--radius-pill)); /* 999px */
|
|
16
18
|
background-color: var(--color-bg-container-secondary);
|
|
17
19
|
flex-shrink: 0;
|
|
18
20
|
}
|
|
@@ -41,9 +43,8 @@
|
|
|
41
43
|
A logo is fitted whole, never cropped to the box.
|
|
42
44
|
============================================ */
|
|
43
45
|
|
|
44
|
-
.ds-avatar--square
|
|
45
|
-
|
|
46
|
-
border-radius: var(--radius-300);
|
|
46
|
+
.ds-avatar--square {
|
|
47
|
+
border-radius: var(--ds-mark-radius, var(--radius-300));
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
.ds-avatar--square .ds-avatar__image {
|
|
@@ -59,7 +60,19 @@
|
|
|
59
60
|
height: 100%;
|
|
60
61
|
object-fit: cover;
|
|
61
62
|
display: block;
|
|
62
|
-
border-radius:
|
|
63
|
+
border-radius: inherit;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* ============================================
|
|
67
|
+
ROUND
|
|
68
|
+
A true circle whatever the theme's radius, on either shape: a theme may
|
|
69
|
+
square the pill off, and a circle is geometry, not a step on the radius
|
|
70
|
+
scale. It sets the shared mark hook, so a container's `roundMarks` and
|
|
71
|
+
an avatar's own `round` are the same rule.
|
|
72
|
+
============================================ */
|
|
73
|
+
|
|
74
|
+
.ds-avatar--round {
|
|
75
|
+
--ds-mark-radius: 50%;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
/* ============================================
|
|
@@ -12,6 +12,8 @@ type AvatarOwnProps = {
|
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
13
|
/** `circle` for a person; `square` for an organisation (a company, a bank, a vendor, an integration): rounded corners on the radius scale, a logo fitted whole rather than cropped, and a building glyph when there is no image or name. */
|
|
14
14
|
shape?: 'circle' | 'square';
|
|
15
|
+
/** Draw a true circle whatever the theme's radius, for either shape. Without it a `circle` follows the theme's pill radius, which a theme may square off, and a `square` keeps its rounded corners. A container's `roundMarks` (Table, DataTable) does the same for every avatar inside it. */
|
|
16
|
+
round?: boolean;
|
|
15
17
|
/**
|
|
16
18
|
* Which of the six fills the initials sit on. Picked from the name when
|
|
17
19
|
* unset, so a person keeps one colour everywhere; `neutral` keeps the
|
|
@@ -11,6 +11,7 @@ const Avatar = React.forwardRef(
|
|
|
11
11
|
name,
|
|
12
12
|
size = "md",
|
|
13
13
|
shape = "circle",
|
|
14
|
+
round = false,
|
|
14
15
|
fill,
|
|
15
16
|
status,
|
|
16
17
|
statusLabel,
|
|
@@ -22,7 +23,7 @@ const Avatar = React.forwardRef(
|
|
|
22
23
|
const sizeClass = `${baseClass}--${size}`;
|
|
23
24
|
const fillIndex = name?.trim() && fill !== "neutral" ? fill ?? avatarFill(name.trim()) : null;
|
|
24
25
|
const fillClass = fillIndex ? `${baseClass}--fill-${fillIndex}` : "";
|
|
25
|
-
const classes = [baseClass, sizeClass, shape === "square" ? `${baseClass}--square` : "", fillClass, className].filter(Boolean).join(" ");
|
|
26
|
+
const classes = [baseClass, sizeClass, shape === "square" ? `${baseClass}--square` : "", round ? `${baseClass}--round` : "", fillClass, className].filter(Boolean).join(" ");
|
|
26
27
|
const getInitials = (fullName) => {
|
|
27
28
|
const parts = fullName.trim().split(/\s+/);
|
|
28
29
|
if (parts.length === 1) return parts[0][0].toUpperCase();
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
.ds-avatar-group__item {
|
|
23
23
|
position: relative;
|
|
24
24
|
display: inline-flex;
|
|
25
|
-
border-radius: var(--radius-pill);
|
|
25
|
+
border-radius: var(--ds-mark-radius, var(--radius-pill));
|
|
26
26
|
box-shadow: 0 0 0 var(--border-050) var(--color-bg-page-primary);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
margin-inline-start: calc(var(--gap-200) * -1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/* Round: sets the shared mark hook, so the avatars, their rings and the
|
|
34
|
+
counter all draw a true circle whatever the theme's radius. */
|
|
35
|
+
|
|
36
|
+
.ds-avatar-group--round {
|
|
37
|
+
--ds-mark-radius: 50%;
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
/* Overflow counter */
|
|
34
41
|
|
|
35
42
|
.ds-avatar-group__overflow {
|
|
@@ -10,6 +10,12 @@ type AvatarGroupOwnProps = {
|
|
|
10
10
|
* Cloned onto the children so the group cannot render mixed sizes.
|
|
11
11
|
*/
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
/**
|
|
14
|
+
* Draw every avatar in the stack, its ring and the overflow counter as a
|
|
15
|
+
* true circle whatever the theme's radius, through the shared mark hook
|
|
16
|
+
* (`--ds-mark-radius`) the avatars read.
|
|
17
|
+
*/
|
|
18
|
+
round?: boolean;
|
|
13
19
|
/**
|
|
14
20
|
* Accessible label for the overflow counter. Defaults to "N more" (for
|
|
15
21
|
* example "4 more"), with N the number of hidden avatars. Pass a function
|
|
@@ -4,9 +4,9 @@ import "./AvatarGroup.css";
|
|
|
4
4
|
import { avatarFill } from "../Avatar/avatarFill.js";
|
|
5
5
|
import { spreadInks } from "../PixelAvatar/pixelInks.js";
|
|
6
6
|
const AvatarGroup = React.forwardRef(
|
|
7
|
-
({ children, max = 5, size = "md", overflowLabel, className = "", ...rest }, ref) => {
|
|
7
|
+
({ children, max = 5, size = "md", round = false, overflowLabel, className = "", ...rest }, ref) => {
|
|
8
8
|
const baseClass = "ds-avatar-group";
|
|
9
|
-
const classes = [baseClass, `${baseClass}--${size}`, className].filter(Boolean).join(" ");
|
|
9
|
+
const classes = [baseClass, `${baseClass}--${size}`, round ? `${baseClass}--round` : "", className].filter(Boolean).join(" ");
|
|
10
10
|
const flatten = (nodes) => React.Children.toArray(nodes).flatMap(
|
|
11
11
|
(node) => React.isValidElement(node) && node.type === React.Fragment ? flatten(node.props.children) : [node]
|
|
12
12
|
);
|
|
@@ -65,8 +65,14 @@
|
|
|
65
65
|
VARIANT — NEUTRAL
|
|
66
66
|
============================================ */
|
|
67
67
|
|
|
68
|
+
/* The neutral fill is the grey a hovered and a striped table row are
|
|
69
|
+
painted in, so on those rows the badge would lose its shape. It alone
|
|
70
|
+
colours the hairline every badge reserves, in the container border: an
|
|
71
|
+
edge, not a status signal, so the fill still carries the meaning. On a
|
|
72
|
+
selected row, which is the border's own grey, the fill shows instead. */
|
|
68
73
|
.ds-badge--neutral {
|
|
69
74
|
background-color: var(--color-status-neutral-bg);
|
|
75
|
+
border-color: var(--color-bg-container-border);
|
|
70
76
|
color: var(--color-status-neutral-text);
|
|
71
77
|
}
|
|
72
78
|
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
@layer rift.components {
|
|
9
9
|
|
|
10
|
+
/* As wide as its trail and never wider than its container, so a host can
|
|
11
|
+
centre it or set it beside something; in normal flow it still fills the
|
|
12
|
+
row, as any block does. */
|
|
10
13
|
.ds-breadcrumb {
|
|
11
|
-
width: 100%;
|
|
14
|
+
max-width: 100%;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
/* ============================================
|
|
@@ -579,7 +579,8 @@
|
|
|
579
579
|
/* ============================================
|
|
580
580
|
LOADING
|
|
581
581
|
Keeps the variant's full-colour appearance (no disabled dim);
|
|
582
|
-
the spinner occupies the left icon slot and inherits its colour
|
|
582
|
+
the spinner occupies the left icon slot and inherits its colour, or
|
|
583
|
+
sits over the label when the button has no left icon.
|
|
583
584
|
============================================ */
|
|
584
585
|
|
|
585
586
|
.ds-button--loading {
|
|
@@ -597,6 +598,24 @@
|
|
|
597
598
|
justify-content: center;
|
|
598
599
|
}
|
|
599
600
|
|
|
601
|
+
/* A button with text and no left icon keeps its width while loading: the
|
|
602
|
+
spinner sits centred over the label, and the label and any trailing icon
|
|
603
|
+
keep their room unseen. Opacity, never visibility: a hidden label would
|
|
604
|
+
leave the button with no accessible name. */
|
|
605
|
+
.ds-button--loading-over {
|
|
606
|
+
position: relative;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.ds-button--loading-over .ds-button__spinner {
|
|
610
|
+
position: absolute;
|
|
611
|
+
inset: 0;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.ds-button--loading-over .ds-button__text,
|
|
615
|
+
.ds-button--loading-over .ds-button__icon--right {
|
|
616
|
+
opacity: 0;
|
|
617
|
+
}
|
|
618
|
+
|
|
600
619
|
/* The generic icon-slot svg sizing must not distort the spinner —
|
|
601
620
|
it sizes itself from the Spinner size prop */
|
|
602
621
|
.ds-button .ds-button__icon .ds-spinner__circle {
|
|
@@ -65,13 +65,17 @@ const Button = React.forwardRef(
|
|
|
65
65
|
const resolvedState = state ?? (isDisabled ? "disabled" : "default");
|
|
66
66
|
const isLoading = Boolean(loading);
|
|
67
67
|
const spinnerSize = size === "compact" ? "sm" : "md";
|
|
68
|
-
const
|
|
68
|
+
const spinner = /* @__PURE__ */ jsx(Spinner, { size: spinnerSize, tone: "inherit" });
|
|
69
|
+
const startIcon = iconLeft || icon;
|
|
70
|
+
const spinnerOverLabel = isLoading && !startIcon && text && Boolean(label);
|
|
71
|
+
const leftIcon = isLoading && !spinnerOverLabel ? spinner : startIcon;
|
|
69
72
|
const classes = [
|
|
70
73
|
baseClass,
|
|
71
74
|
`${baseClass}--${resolvedVariant}`,
|
|
72
75
|
`${baseClass}--${resolvedState}`,
|
|
73
76
|
`${baseClass}--${size}`,
|
|
74
77
|
isLoading && `${baseClass}--loading`,
|
|
78
|
+
spinnerOverLabel && `${baseClass}--loading-over`,
|
|
75
79
|
glass && `${baseClass}--glass`,
|
|
76
80
|
text && label && leftIcon && `${baseClass}--icon-start`,
|
|
77
81
|
text && label && iconRight && `${baseClass}--icon-end`,
|
|
@@ -89,6 +93,7 @@ const Button = React.forwardRef(
|
|
|
89
93
|
const fallbackAriaLabel = needsAccessibleName && label && !rest["aria-label"] ? label : void 0;
|
|
90
94
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
95
|
leftIcon && renderIcon(leftIcon),
|
|
96
|
+
spinnerOverLabel && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon ${baseClass}__spinner`, "aria-hidden": "true", children: spinner }),
|
|
92
97
|
text && /* @__PURE__ */ jsx("span", { className: `${baseClass}__text`, children: label }),
|
|
93
98
|
iconRight && renderIcon(iconRight, "right")
|
|
94
99
|
] });
|
package/components/Card/Card.css
CHANGED
|
@@ -106,6 +106,17 @@
|
|
|
106
106
|
box-shadow: none;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/* A case-study card with no href goes nowhere, so it does not lift or
|
|
110
|
+
offer a pointer; it keeps its full colour, unlike a placeholder. */
|
|
111
|
+
.ds-card--case-study--static {
|
|
112
|
+
cursor: default;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ds-card--case-study--static:hover {
|
|
116
|
+
transform: none;
|
|
117
|
+
box-shadow: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
109
120
|
.ds-card--case-study__cover-wrap {
|
|
110
121
|
width: 100%;
|
|
111
122
|
aspect-ratio: 940 / 480;
|
|
@@ -15,7 +15,13 @@ type CardOwnProps = {
|
|
|
15
15
|
interactive?: boolean;
|
|
16
16
|
/** Additional CSS classes */
|
|
17
17
|
className?: string;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Where the card goes. With it the card renders as a link in either
|
|
20
|
+
* variant, through `linkComponent`: the default variant becomes a link
|
|
21
|
+
* named by its title and wears the interactive lift, and the case-study
|
|
22
|
+
* variant links its whole tile. A case-study card without it, or one
|
|
23
|
+
* marked `placeholder`, is a still tile that does not lift.
|
|
24
|
+
*/
|
|
19
25
|
href?: string;
|
|
20
26
|
/** Cover image src */
|
|
21
27
|
coverSrc?: string;
|
|
@@ -47,8 +53,8 @@ export interface CardProps extends CardOwnProps, Omit<React.ComponentPropsWithou
|
|
|
47
53
|
/**
|
|
48
54
|
* Card renders a preview tile, or a case-study tile when `variant="case-study"`.
|
|
49
55
|
*
|
|
50
|
-
* Renders a `<div>`, or
|
|
51
|
-
*
|
|
56
|
+
* Renders a `<div>`, or a link in either variant when `href` is supplied.
|
|
57
|
+
* Forwards a ref to whichever element it renders and spreads
|
|
52
58
|
* unrecognised props onto it.
|
|
53
59
|
*/
|
|
54
60
|
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement | HTMLAnchorElement>>;
|
package/components/Card/Card.js
CHANGED
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { useLinkComponent } from "../../behaviors/LinkProvider.js";
|
|
5
5
|
import "./Card.css";
|
|
6
6
|
import "../../fonts/material-symbols.css";
|
|
7
|
+
import { LoadingImage } from "../../behaviors/LoadingImage.js";
|
|
7
8
|
const Card = React.forwardRef(
|
|
8
9
|
({
|
|
9
10
|
variant = "default",
|
|
@@ -28,7 +29,7 @@ const Card = React.forwardRef(
|
|
|
28
29
|
if (variant === "case-study") {
|
|
29
30
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
31
|
/* @__PURE__ */ jsx("div", { className: "ds-card--case-study__cover-wrap", children: cover ? /* @__PURE__ */ jsx("div", { className: "ds-card--case-study__cover-slot", children: cover }) : coverSrc ? /* @__PURE__ */ jsx(
|
|
31
|
-
|
|
32
|
+
LoadingImage,
|
|
32
33
|
{
|
|
33
34
|
src: coverSrc,
|
|
34
35
|
alt: coverAlt ?? `${title} cover`,
|
|
@@ -55,6 +56,8 @@ const Card = React.forwardRef(
|
|
|
55
56
|
"ds-card",
|
|
56
57
|
"ds-card--case-study",
|
|
57
58
|
placeholder ? "ds-card--case-study--placeholder" : "",
|
|
59
|
+
// A card that goes nowhere stays still under the pointer.
|
|
60
|
+
!placeholder && !href ? "ds-card--case-study--static" : "",
|
|
58
61
|
className
|
|
59
62
|
].filter(Boolean).join(" ");
|
|
60
63
|
if (placeholder || !href) {
|
|
@@ -82,7 +85,23 @@ const Card = React.forwardRef(
|
|
|
82
85
|
);
|
|
83
86
|
}
|
|
84
87
|
const baseClass = "ds-card";
|
|
85
|
-
const classes = [baseClass, interactive ? `${baseClass}--interactive` : "", className].filter(Boolean).join(" ");
|
|
88
|
+
const classes = [baseClass, interactive || href ? `${baseClass}--interactive` : "", className].filter(Boolean).join(" ");
|
|
89
|
+
if (href) {
|
|
90
|
+
return /* @__PURE__ */ jsxs(
|
|
91
|
+
Link,
|
|
92
|
+
{
|
|
93
|
+
...rest,
|
|
94
|
+
ref,
|
|
95
|
+
href,
|
|
96
|
+
className: classes,
|
|
97
|
+
onClick,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__preview`, children }),
|
|
100
|
+
/* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
86
105
|
const handleKeyDown = (e) => {
|
|
87
106
|
onKeyDown?.(e);
|
|
88
107
|
if (!interactive) return;
|