rift-ds 1.41.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/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/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 +39 -115
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/registry.json +44 -6
- 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/AppSidebar/AppSidebar.css +13 -2
- package/components/AppSidebar/AppSidebar.js +7 -2
- package/components/Attachment/AttachmentGroup.js +2 -1
- package/components/Attachment/AttachmentTile.js +2 -1
- 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 +28 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +5 -0
- 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/Dropdown/Dropdown.css +3 -1
- package/components/EmptyState/EmptyState.css +8 -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/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/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/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/Table/Table.css +101 -16
- package/components/Table/Table.d.ts +4 -0
- package/components/Table/Table.js +43 -28
- 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 +4 -1
- package/components/registry.json.d.ts +4 -1
- package/components/registry.json.js +1 -1
- package/package.json +7 -2
- package/tokens/presets/contrast.css +4 -4
- package/tokens/presets/coral.css +3 -4
- package/tokens/presets/forest.css +16 -4
- package/tokens/presets/gold.css +4 -3
- package/tokens/presets/marquee.css +2 -3
- package/tokens/presets/mono.css +28 -28
- package/tokens/presets/pink.css +5 -4
- package/tokens/presets/terminal.css +4 -3
- package/tokens/presets/violet.css +3 -4
- package/tokens/presets/warm.css +16 -4
- package/tokens/presets/zest.css +2 -2
- package/tokens/registry.json +1 -0
- package/tokens/registry.json.d.ts +1 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -0
- package/tokens/tokens-light.css +4 -0
- package/tokens/values.d.ts +14 -1
- package/tokens/values.js +14 -1
- package/tokens/values.json.js +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import "./loading-image.css";
|
|
5
|
+
function LoadingImage({ className, src, onLoad, onError, ...rest }) {
|
|
6
|
+
const [settledSrc, setSettledSrc] = useState(void 0);
|
|
7
|
+
const attach = useCallback(
|
|
8
|
+
(node) => {
|
|
9
|
+
if (node?.complete) setSettledSrc(src);
|
|
10
|
+
},
|
|
11
|
+
[src]
|
|
12
|
+
);
|
|
13
|
+
const classes = [settledSrc === src ? "" : "ds-image--loading", className].filter(Boolean).join(" ");
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
"img",
|
|
16
|
+
{
|
|
17
|
+
...rest,
|
|
18
|
+
ref: attach,
|
|
19
|
+
src,
|
|
20
|
+
className: classes || void 0,
|
|
21
|
+
onLoad: (event) => {
|
|
22
|
+
setSettledSrc(src);
|
|
23
|
+
onLoad?.(event);
|
|
24
|
+
},
|
|
25
|
+
onError: (event) => {
|
|
26
|
+
setSettledSrc(src);
|
|
27
|
+
onError?.(event);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
LoadingImage
|
|
34
|
+
};
|
|
@@ -26,12 +26,25 @@ function ScrollRegion({
|
|
|
26
26
|
if (!caption.id) caption.id = captionId;
|
|
27
27
|
setLabelledBy(caption.id);
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const mark = () => {
|
|
30
|
+
const hidden = node.scrollWidth - node.clientWidth;
|
|
31
|
+
const from = Math.abs(node.scrollLeft);
|
|
32
|
+
node.toggleAttribute("data-scroll-start", hidden > 1 && from > 1);
|
|
33
|
+
node.toggleAttribute("data-scroll-end", hidden > 1 && from < hidden - 1);
|
|
34
|
+
};
|
|
35
|
+
const measure = () => {
|
|
36
|
+
setOverflows(node.scrollWidth > node.clientWidth + 1);
|
|
37
|
+
mark();
|
|
38
|
+
};
|
|
30
39
|
measure();
|
|
31
40
|
const observer = new ResizeObserver(measure);
|
|
32
41
|
observer.observe(node);
|
|
33
42
|
if (node.firstElementChild) observer.observe(node.firstElementChild);
|
|
34
|
-
|
|
43
|
+
node.addEventListener("scroll", mark, { passive: true });
|
|
44
|
+
return () => {
|
|
45
|
+
observer.disconnect();
|
|
46
|
+
node.removeEventListener("scroll", mark);
|
|
47
|
+
};
|
|
35
48
|
}, [captionId]);
|
|
36
49
|
return /* @__PURE__ */ jsx(
|
|
37
50
|
"div",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* VisuallyHidden
|
|
4
|
+
*
|
|
5
|
+
* Text that is read but not seen: a status for a live region, a spoken
|
|
6
|
+
* name beside an icon, a column's heading that sighted readers get from
|
|
7
|
+
* the layout. It renders its children in the library's one visually-hidden
|
|
8
|
+
* recipe (`ds-visually-hidden`, in visually-hidden.css), the same class
|
|
9
|
+
* every component uses, so an app never writes the clip recipe a second
|
|
10
|
+
* time.
|
|
11
|
+
*
|
|
12
|
+
* Presentational, so it renders from a Server Component. It is not for a
|
|
13
|
+
* native input that must stay focusable while hidden; that keeps its own
|
|
14
|
+
* rule (see FileInput).
|
|
15
|
+
*/
|
|
16
|
+
/** Props owned by VisuallyHidden itself; everything else falls through to the element. */
|
|
17
|
+
type VisuallyHiddenOwnProps = {
|
|
18
|
+
/** The element to render: a `span` inside a line of text (the default), a `div` around blocks. */
|
|
19
|
+
as?: 'span' | 'div';
|
|
20
|
+
/** The text a screen reader announces and the page does not show. */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** A ref to the rendered element. */
|
|
25
|
+
ref?: React.Ref<HTMLElement>;
|
|
26
|
+
};
|
|
27
|
+
export interface VisuallyHiddenProps extends VisuallyHiddenOwnProps, Omit<React.ComponentPropsWithoutRef<'span'>, keyof VisuallyHiddenOwnProps> {
|
|
28
|
+
}
|
|
29
|
+
export declare function VisuallyHidden({ as: Element, className, children, ref, ...rest }: VisuallyHiddenProps): React.JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./visually-hidden.css";
|
|
4
|
+
function VisuallyHidden({ as: Element = "span", className = "", children, ref, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
Element,
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
9
|
+
ref,
|
|
10
|
+
className: ["ds-visually-hidden", className].filter(Boolean).join(" "),
|
|
11
|
+
children
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
VisuallyHidden
|
|
17
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
LOADING IMAGE
|
|
3
|
+
The one placeholder for a picture that is
|
|
4
|
+
still downloading: the Skeleton fill in the
|
|
5
|
+
image's own box, pulsing, until the file has
|
|
6
|
+
loaded (LoadingImage.tsx sets and clears the
|
|
7
|
+
class). Behind `scripting: enabled`, because
|
|
8
|
+
only a script can clear it.
|
|
9
|
+
============================================ */
|
|
10
|
+
|
|
11
|
+
@layer rift.tokens, rift.preset, rift.components;
|
|
12
|
+
|
|
13
|
+
@layer rift.components {
|
|
14
|
+
|
|
15
|
+
@media (scripting: enabled) {
|
|
16
|
+
.ds-image--loading {
|
|
17
|
+
background-color: var(--color-bg-container-secondary);
|
|
18
|
+
/* ds-allow(motion): the pulse needs a symmetric in-out curve and no
|
|
19
|
+
--motion-ease-* token provides one; the duration is tokenized. */
|
|
20
|
+
animation: ds-image-pulse var(--motion-duration-loop-shimmer) ease-in-out infinite alternate;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@keyframes ds-image-pulse {
|
|
25
|
+
to {
|
|
26
|
+
opacity: 0.5;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
} /* @layer rift.components */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Focus `element` on a script's behalf: a hint that opens on focus stays closed for it. */
|
|
2
|
+
export declare function focusQuietly(element: HTMLElement, options?: FocusOptions): void;
|
|
3
|
+
/** Whether `element` holds focus a script gave it through `focusQuietly`. */
|
|
4
|
+
export declare const isQuietFocus: (element: Element | null) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const quiet = /* @__PURE__ */ new WeakSet();
|
|
2
|
+
function focusQuietly(element, options) {
|
|
3
|
+
if (document.activeElement !== element) {
|
|
4
|
+
quiet.add(element);
|
|
5
|
+
element.addEventListener("blur", () => quiet.delete(element), { once: true });
|
|
6
|
+
}
|
|
7
|
+
element.focus(options);
|
|
8
|
+
if (document.activeElement !== element) quiet.delete(element);
|
|
9
|
+
}
|
|
10
|
+
const isQuietFocus = (element) => element !== null && quiet.has(element);
|
|
11
|
+
export {
|
|
12
|
+
focusQuietly,
|
|
13
|
+
isQuietFocus
|
|
14
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Focus containment for modal overlays: initial focus, Tab wrapping, focus
|
|
3
|
-
* restore, and background isolation.
|
|
3
|
+
* restore, and background isolation. The initial focus and the restore are
|
|
4
|
+
* moved quietly (src/behaviors/quietFocus.ts), so a Tooltip on the control
|
|
5
|
+
* that receives them does not open.
|
|
4
6
|
*
|
|
5
7
|
* Restore is guarded twice. The element that opened a dialog can be gone by
|
|
6
8
|
* the time it closes (a row the dialog itself deleted), and it can still be in
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
3
|
import { getInitialFocus, getFocusable } from "./focusable.js";
|
|
4
|
+
import { focusQuietly } from "./quietFocus.js";
|
|
4
5
|
const inertScopes = [];
|
|
5
6
|
const inerted = /* @__PURE__ */ new Set();
|
|
6
7
|
const applyInert = () => {
|
|
@@ -48,7 +49,7 @@ function useFocusScope(ref, options) {
|
|
|
48
49
|
let focusAttempts = 0;
|
|
49
50
|
const tryInitialFocus = () => {
|
|
50
51
|
const initial = optionsRef.current.initialFocus?.() ?? getInitialFocus(panel) ?? panel;
|
|
51
|
-
initial
|
|
52
|
+
focusQuietly(initial);
|
|
52
53
|
if (document.activeElement === initial) return;
|
|
53
54
|
focusAttempts += 1;
|
|
54
55
|
if (focusAttempts < 5) focusRaf = requestAnimationFrame(tryInitialFocus);
|
|
@@ -84,11 +85,8 @@ function useFocusScope(ref, options) {
|
|
|
84
85
|
}
|
|
85
86
|
const restore = optionsRef.current.restoreFocus;
|
|
86
87
|
const chosen = typeof restore === "function" ? restore() : null;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} else if (restore !== false && previousFocus) {
|
|
90
|
-
restoreTarget(previousFocus)?.focus();
|
|
91
|
-
}
|
|
88
|
+
const back = chosen ?? (restore !== false && previousFocus ? restoreTarget(previousFocus) : null);
|
|
89
|
+
if (back) focusQuietly(back);
|
|
92
90
|
};
|
|
93
91
|
}, [active, ref]);
|
|
94
92
|
}
|
package/bin/rift-ds.mjs
CHANGED
|
@@ -312,6 +312,7 @@ function initApp({ app, dryRun }) {
|
|
|
312
312
|
console.log(`\nPick a shipped theme before the first screen: the base theme is a neutral starting point, not a look.`);
|
|
313
313
|
console.log(`Import ${PACKAGE_NAME}/tokens/presets/<id>.css after tokens.css and set data-brand="<id>" on <html>.`);
|
|
314
314
|
console.log(`Compare them at ${SITE_ORIGIN}/playground.`);
|
|
315
|
+
console.log(`A project with a theme.css from the playground already has its look: skip this, and follow that file's own steps for the font.`);
|
|
315
316
|
console.log(`\nThen add a first page: npx ${PACKAGE_NAME} init block dashboard (no name lists them).`);
|
|
316
317
|
console.log(`Setup and theming: ${SITE_ORIGIN}/docs/get-started`);
|
|
317
318
|
}
|
|
@@ -7,7 +7,9 @@ import { colorModeScript, type ColorModeScriptOptions } from 'rift-ds/components
|
|
|
7
7
|
*
|
|
8
8
|
* If your app lets the visitor pick a theme, store the preset id under a key
|
|
9
9
|
* of your own and pass it as `brandStorageKey`: the script then applies that
|
|
10
|
-
* theme before first paint too.
|
|
10
|
+
* theme before first paint too. For a dark-first app pass
|
|
11
|
+
* `defaultMode="dark"` here and to RiftRoot: a first-time visitor then opens
|
|
12
|
+
* in dark, and their own choice still wins.
|
|
11
13
|
*/
|
|
12
14
|
export function ColorModeScript(options: ColorModeScriptOptions) {
|
|
13
15
|
return <script dangerouslySetInnerHTML={{ __html: colorModeScript(options) }} />;
|
|
@@ -1,13 +1,52 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import Link from 'next/link';
|
|
4
5
|
import { LinkProvider } from 'rift-ds/behaviors/LinkProvider';
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_COLOR_MODE_STORAGE_KEY,
|
|
8
|
+
isColorModeSetting,
|
|
9
|
+
type ColorModeSetting,
|
|
10
|
+
} from 'rift-ds/components/ThemeToggle/colorMode';
|
|
11
|
+
|
|
12
|
+
export interface RiftRootProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/** The key the colour mode is stored under. Pass the one ColorModeScript takes, if you changed it. */
|
|
15
|
+
storageKey?: string;
|
|
16
|
+
/** The mode a first-time visitor opens in. Pass the one ColorModeScript takes, if you set it. */
|
|
17
|
+
defaultMode?: ColorModeSetting;
|
|
18
|
+
}
|
|
5
19
|
|
|
6
20
|
/**
|
|
7
21
|
* The app's root for rift-ds: hands Next's Link to every rift-ds component
|
|
8
22
|
* that renders a link, so they navigate through the router instead of
|
|
9
23
|
* reloading the page. Wrap your root layout's body content in it.
|
|
24
|
+
*
|
|
25
|
+
* It also puts the colour mode back where the head's script never ran. On a
|
|
26
|
+
* page Next renders in the browser alone (the shell it serves for a dynamic
|
|
27
|
+
* notFound() or a thrown error), <html> arrives with no data-theme, so a
|
|
28
|
+
* dark-mode visitor would see a light page. When the attribute is missing
|
|
29
|
+
* on mount, the stored choice is applied again, as ColorModeScript does.
|
|
10
30
|
*/
|
|
11
|
-
export function RiftRoot({
|
|
31
|
+
export function RiftRoot({
|
|
32
|
+
children,
|
|
33
|
+
storageKey = DEFAULT_COLOR_MODE_STORAGE_KEY,
|
|
34
|
+
defaultMode = 'system',
|
|
35
|
+
}: RiftRootProps) {
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const root = document.documentElement;
|
|
38
|
+
if (root.hasAttribute('data-theme')) return;
|
|
39
|
+
let saved: string | null = null;
|
|
40
|
+
try {
|
|
41
|
+
saved = localStorage.getItem(storageKey);
|
|
42
|
+
} catch {
|
|
43
|
+
// Storage unavailable: fall through to the default mode.
|
|
44
|
+
}
|
|
45
|
+
const setting = isColorModeSetting(saved) ? saved : defaultMode;
|
|
46
|
+
const dark = setting === 'system' ? window.matchMedia('(prefers-color-scheme: dark)').matches : setting === 'dark';
|
|
47
|
+
root.setAttribute('data-theme-setting', setting);
|
|
48
|
+
root.setAttribute('data-theme', dark ? 'dark' : 'light');
|
|
49
|
+
}, [storageKey, defaultMode]);
|
|
50
|
+
|
|
12
51
|
return <LinkProvider linkComponent={Link}>{children}</LinkProvider>;
|
|
13
52
|
}
|
|
@@ -23,7 +23,8 @@ const STATS = [
|
|
|
23
23
|
{ label: 'Open tasks', value: '128', delta: '+12', trend: 'up' },
|
|
24
24
|
{ label: 'Due this week', value: '24', delta: '-3', trend: 'down' },
|
|
25
25
|
{ label: 'Completed', value: '342', delta: '+18%', trend: 'up' },
|
|
26
|
-
|
|
26
|
+
// Lower is better here: the arrow says which way it went, the colour that it is good news.
|
|
27
|
+
{ label: 'Avg. cycle time', value: '3.2d', delta: '-0.4d', trend: 'down', sentiment: 'positive' },
|
|
27
28
|
] as const;
|
|
28
29
|
|
|
29
30
|
const PROGRESS = [
|
|
@@ -79,20 +80,21 @@ export default function DashboardPage() {
|
|
|
79
80
|
>
|
|
80
81
|
<div className={styles.stats}>
|
|
81
82
|
{STATS.map((stat) => (
|
|
82
|
-
<Panel key={stat.label}>
|
|
83
|
+
<Panel key={stat.label} bordered>
|
|
83
84
|
<Stat
|
|
84
85
|
label={stat.label}
|
|
85
86
|
value={stat.value}
|
|
86
87
|
delta={stat.delta}
|
|
87
88
|
trend={stat.trend}
|
|
88
|
-
|
|
89
|
+
sentiment={'sentiment' in stat ? stat.sentiment : undefined}
|
|
90
|
+
deltaPlacement="inline"
|
|
89
91
|
/>
|
|
90
92
|
</Panel>
|
|
91
93
|
))}
|
|
92
94
|
</div>
|
|
93
95
|
|
|
94
96
|
<div className={styles.panels}>
|
|
95
|
-
<Panel>
|
|
97
|
+
<Panel bordered>
|
|
96
98
|
<h2 className={styles.panelTitle}>Progress by project</h2>
|
|
97
99
|
<ul className={styles.list}>
|
|
98
100
|
{PROGRESS.map((row) => (
|
|
@@ -107,7 +109,7 @@ export default function DashboardPage() {
|
|
|
107
109
|
</ul>
|
|
108
110
|
</Panel>
|
|
109
111
|
|
|
110
|
-
<Panel>
|
|
112
|
+
<Panel bordered>
|
|
111
113
|
<h2 className={styles.panelTitle}>Recent activity</h2>
|
|
112
114
|
<ul className={styles.list}>
|
|
113
115
|
{ACTIVITY.map((row) => (
|
|
@@ -97,7 +97,7 @@ export default function LandingPage() {
|
|
|
97
97
|
<Grid minColumnWidth="280px" gap="500" as="ul" className={styles.plainList}>
|
|
98
98
|
{FEATURES.map((feature) => (
|
|
99
99
|
<li key={feature.title}>
|
|
100
|
-
<Panel className={styles.feature}>
|
|
100
|
+
<Panel bordered className={styles.feature}>
|
|
101
101
|
<Icon name={feature.icon} size="800" tile />
|
|
102
102
|
<Heading level={3}>{feature.title}</Heading>
|
|
103
103
|
<Text tone="neutral">{feature.body}</Text>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* The pricing page's own layout is
|
|
1
|
+
/* The pricing page's own layout is a few rules. The plans' grid, the cards
|
|
2
2
|
and the table come from the components. */
|
|
3
3
|
|
|
4
4
|
/* A plan's button runs the width of its card. */
|
|
@@ -13,3 +13,17 @@
|
|
|
13
13
|
display: inline-flex;
|
|
14
14
|
margin-block: calc(-1 * (var(--padding-050) + var(--border-025)));
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/* The compare table's "included" mark is the feature lists' tick: List's
|
|
18
|
+
check marker, at its size and in the positive icon colour. */
|
|
19
|
+
.included {
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
color: var(--color-status-positive-icon);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tick {
|
|
25
|
+
inline-size: var(--icon-size-500);
|
|
26
|
+
block-size: var(--icon-size-500);
|
|
27
|
+
padding: var(--padding-050);
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { useState } from 'react';
|
|
12
12
|
import { Badge } from 'rift-ds/components/Badge/Badge';
|
|
13
13
|
import { Button } from 'rift-ds/components/Button/Button';
|
|
14
|
+
import { CheckIcon } from 'rift-ds/components/Checkbox/Checkbox';
|
|
14
15
|
import { Grid } from 'rift-ds/components/Grid/Grid';
|
|
15
16
|
import { Heading } from 'rift-ds/components/Heading/Heading';
|
|
16
17
|
import { Icon } from 'rift-ds/components/Icon/Icon';
|
|
@@ -70,7 +71,13 @@ const PLANS: Plan[] = [
|
|
|
70
71
|
},
|
|
71
72
|
];
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
/* "Included" is drawn one way on the page: the tick a plan's feature list
|
|
75
|
+
wears in its card, at the same size and in the same colour. */
|
|
76
|
+
const yes = (
|
|
77
|
+
<span className={styles.included} role="img" aria-label="Included">
|
|
78
|
+
<CheckIcon className={styles.tick} />
|
|
79
|
+
</span>
|
|
80
|
+
);
|
|
74
81
|
const no = <Icon name="remove" size="500" tone="neutral" label="Not included" />;
|
|
75
82
|
|
|
76
83
|
const COMPARE_COLUMNS: TableColumn[] = [
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* The sign-in block: a centred card with email and password, a remember-me
|
|
5
5
|
* choice and a single sign-on route. It checks the fields in the browser
|
|
6
|
-
* and goes no further; connect `signIn` to your auth provider.
|
|
6
|
+
* and goes no further; connect `signIn` to your auth provider. It links to
|
|
7
|
+
* the sign-up block's page, which `init block sign-in` writes beside it.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { useState, type FormEvent } from 'react';
|
|
@@ -16,6 +17,13 @@ import styles from './page.module.css';
|
|
|
16
17
|
const PRODUCT_NAME = 'Acme';
|
|
17
18
|
const EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Where "Create an account" goes: the sign-up block's page. Relative, so it
|
|
22
|
+
* resolves beside this page (`sign-up` from /sign-in is /sign-up). Make it
|
|
23
|
+
* absolute ('/sign-up') if your pages nest.
|
|
24
|
+
*/
|
|
25
|
+
const SIGN_UP_ROUTE = 'sign-up';
|
|
26
|
+
|
|
19
27
|
export default function SignInPage() {
|
|
20
28
|
const [email, setEmail] = useState('');
|
|
21
29
|
const [password, setPassword] = useState('');
|
|
@@ -87,7 +95,7 @@ export default function SignInPage() {
|
|
|
87
95
|
/>
|
|
88
96
|
|
|
89
97
|
<p className={styles.footer}>
|
|
90
|
-
New here? <Button variant="tertiary" size="compact" label="Create an account" href=
|
|
98
|
+
New here? <Button variant="tertiary" size="compact" label="Create an account" href={SIGN_UP_ROUTE} />
|
|
91
99
|
</p>
|
|
92
100
|
</main>
|
|
93
101
|
</div>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* The sign-in block's card, so the two pages read as one flow: centred at
|
|
2
|
+
every width, 400px wide on a desktop, the full width less the gutter on
|
|
3
|
+
a phone, where it drops its fill and sits straight on the page. */
|
|
4
|
+
|
|
5
|
+
.page {
|
|
6
|
+
min-height: 100dvh;
|
|
7
|
+
display: grid;
|
|
8
|
+
place-items: center;
|
|
9
|
+
padding: var(--padding-1000) var(--padding-500);
|
|
10
|
+
background-color: var(--color-bg-page-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.card {
|
|
14
|
+
width: 100%;
|
|
15
|
+
max-width: 400px;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: var(--gap-500);
|
|
19
|
+
padding: var(--padding-1000);
|
|
20
|
+
border-radius: var(--radius-600);
|
|
21
|
+
background-color: var(--color-bg-container-primary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.intro {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: var(--gap-200);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.product {
|
|
31
|
+
font-family: var(--font-title-body-family);
|
|
32
|
+
font-size: var(--font-title-body-size);
|
|
33
|
+
font-weight: var(--font-title-body-weight);
|
|
34
|
+
line-height: var(--font-title-body-line-height);
|
|
35
|
+
color: var(--color-text-primary);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.title {
|
|
39
|
+
margin: 0;
|
|
40
|
+
font-family: var(--font-heading-2-family);
|
|
41
|
+
font-size: var(--font-heading-2-size);
|
|
42
|
+
font-weight: var(--font-heading-2-weight);
|
|
43
|
+
line-height: var(--font-heading-2-line-height);
|
|
44
|
+
letter-spacing: var(--font-heading-2-letter-spacing);
|
|
45
|
+
color: var(--color-text-primary);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.subhead,
|
|
49
|
+
.footer {
|
|
50
|
+
margin: 0;
|
|
51
|
+
font-size: var(--font-paragraph-sm-size);
|
|
52
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
53
|
+
color: var(--color-text-secondary);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.form {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: var(--gap-400);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.full {
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.footer {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
gap: var(--gap-100);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (max-width: 600px) {
|
|
74
|
+
.page {
|
|
75
|
+
place-items: start center;
|
|
76
|
+
padding: var(--padding-1000) var(--padding-400);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.card {
|
|
80
|
+
padding: 0;
|
|
81
|
+
background-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The sign-up block: the sign-in block's card with a name, an email and a
|
|
5
|
+
* new password, an agreement to the terms and a single sign-on route. It
|
|
6
|
+
* checks the fields in the browser and goes no further; connect `signUp`
|
|
7
|
+
* to your auth provider. It links back to the sign-in block's page, which
|
|
8
|
+
* `init block sign-up` writes beside it.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useState, type FormEvent } from 'react';
|
|
12
|
+
import { Button } from 'rift-ds/components/Button/Button';
|
|
13
|
+
import { Checkbox } from 'rift-ds/components/Checkbox/Checkbox';
|
|
14
|
+
import { Divider } from 'rift-ds/components/Divider/Divider';
|
|
15
|
+
import { Input } from 'rift-ds/components/Input/Input';
|
|
16
|
+
import styles from './page.module.css';
|
|
17
|
+
|
|
18
|
+
const PRODUCT_NAME = 'Acme';
|
|
19
|
+
const EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
20
|
+
/** The shortest password the form takes. Match your auth provider's rule. */
|
|
21
|
+
const PASSWORD_MIN = 8;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Where "Sign in" goes: the sign-in block's page. Relative, so it resolves
|
|
25
|
+
* beside this page (`sign-in` from /sign-up is /sign-in). Make it absolute
|
|
26
|
+
* ('/sign-in') if your pages nest.
|
|
27
|
+
*/
|
|
28
|
+
const SIGN_IN_ROUTE = 'sign-in';
|
|
29
|
+
|
|
30
|
+
export default function SignUpPage() {
|
|
31
|
+
const [name, setName] = useState('');
|
|
32
|
+
const [email, setEmail] = useState('');
|
|
33
|
+
const [password, setPassword] = useState('');
|
|
34
|
+
const [agreed, setAgreed] = useState(false);
|
|
35
|
+
const [nameError, setNameError] = useState<string>();
|
|
36
|
+
const [emailError, setEmailError] = useState<string>();
|
|
37
|
+
const [passwordError, setPasswordError] = useState<string>();
|
|
38
|
+
const [agreedError, setAgreedError] = useState<string>();
|
|
39
|
+
|
|
40
|
+
const signUp = () => {
|
|
41
|
+
const nextNameError = name.trim() ? undefined : 'Enter your name.';
|
|
42
|
+
const nextEmailError = EMAIL_SHAPE.test(email.trim()) ? undefined : 'Enter an email we can reach you at.';
|
|
43
|
+
const nextPasswordError =
|
|
44
|
+
password.length >= PASSWORD_MIN ? undefined : `Use at least ${PASSWORD_MIN} characters.`;
|
|
45
|
+
const nextAgreedError = agreed ? undefined : 'Agree to the terms to continue.';
|
|
46
|
+
setNameError(nextNameError);
|
|
47
|
+
setEmailError(nextEmailError);
|
|
48
|
+
setPasswordError(nextPasswordError);
|
|
49
|
+
setAgreedError(nextAgreedError);
|
|
50
|
+
if (nextNameError || nextEmailError || nextPasswordError || nextAgreedError) return;
|
|
51
|
+
// Hand { name, email, password } to your auth provider here.
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/* The Create account button is the form's submit button, so a click and
|
|
55
|
+
Enter in a field both arrive here. */
|
|
56
|
+
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
signUp();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={styles.page}>
|
|
63
|
+
<main className={styles.card}>
|
|
64
|
+
<div className={styles.intro}>
|
|
65
|
+
<span className={styles.product}>{PRODUCT_NAME}</span>
|
|
66
|
+
<h1 className={styles.title}>Create your account</h1>
|
|
67
|
+
<p className={styles.subhead}>Free for your first five people. No card needed.</p>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<form className={styles.form} onSubmit={handleSubmit} noValidate>
|
|
71
|
+
<Input
|
|
72
|
+
label="Name"
|
|
73
|
+
name="name"
|
|
74
|
+
autoComplete="name"
|
|
75
|
+
value={name}
|
|
76
|
+
onValueChange={setName}
|
|
77
|
+
error={Boolean(nameError)}
|
|
78
|
+
helperText={nameError}
|
|
79
|
+
/>
|
|
80
|
+
<Input
|
|
81
|
+
label="Work email"
|
|
82
|
+
type="email"
|
|
83
|
+
name="email"
|
|
84
|
+
autoComplete="email"
|
|
85
|
+
value={email}
|
|
86
|
+
onValueChange={setEmail}
|
|
87
|
+
error={Boolean(emailError)}
|
|
88
|
+
helperText={emailError}
|
|
89
|
+
/>
|
|
90
|
+
<Input
|
|
91
|
+
label="Password"
|
|
92
|
+
type="password"
|
|
93
|
+
name="password"
|
|
94
|
+
autoComplete="new-password"
|
|
95
|
+
value={password}
|
|
96
|
+
onValueChange={setPassword}
|
|
97
|
+
error={Boolean(passwordError)}
|
|
98
|
+
helperText={passwordError ?? `At least ${PASSWORD_MIN} characters.`}
|
|
99
|
+
/>
|
|
100
|
+
<Checkbox
|
|
101
|
+
label="I agree to the terms and the privacy policy"
|
|
102
|
+
checked={agreed}
|
|
103
|
+
onCheckedChange={setAgreed}
|
|
104
|
+
error={Boolean(agreedError)}
|
|
105
|
+
helperText={agreedError}
|
|
106
|
+
/>
|
|
107
|
+
<Button type="submit" variant="primary" label="Create account" className={styles.full} />
|
|
108
|
+
</form>
|
|
109
|
+
|
|
110
|
+
<Divider label="or" labelPosition="center" spacing="none" />
|
|
111
|
+
|
|
112
|
+
<Button
|
|
113
|
+
variant="secondary"
|
|
114
|
+
tone="neutral"
|
|
115
|
+
label="Continue with single sign-on"
|
|
116
|
+
iconLeft="key"
|
|
117
|
+
className={styles.full}
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<p className={styles.footer}>
|
|
121
|
+
Have an account? <Button variant="tertiary" size="compact" label="Sign in" href={SIGN_IN_ROUTE} />
|
|
122
|
+
</p>
|
|
123
|
+
</main>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -18,7 +18,7 @@ export default function StarterPage() {
|
|
|
18
18
|
title="Home"
|
|
19
19
|
actions={<Button variant="primary" size="compact" label="New project" iconLeft="add" />}
|
|
20
20
|
>
|
|
21
|
-
<Panel className={styles.empty}>
|
|
21
|
+
<Panel bordered className={styles.empty}>
|
|
22
22
|
<EmptyState
|
|
23
23
|
icon="dashboard_customize"
|
|
24
24
|
title="Your page starts here"
|
|
@@ -11,13 +11,3 @@
|
|
|
11
11
|
.shell[data-width='narrow'] {
|
|
12
12
|
--ds-shell-contained-width: 960px; /* a slim centred column */
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
/* A theme's swatch in the Appearance rows: its action colour in a dot the
|
|
16
|
-
size of the icons beside it. */
|
|
17
|
-
.swatch {
|
|
18
|
-
display: inline-block;
|
|
19
|
-
width: var(--icon-size-500);
|
|
20
|
-
height: var(--icon-size-500);
|
|
21
|
-
border-radius: var(--radius-pill);
|
|
22
|
-
border: var(--border-025) solid var(--color-bg-container-border);
|
|
23
|
-
}
|