rift-ds 1.41.0 → 1.43.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 +2 -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/useFocusScope.d.ts +3 -1
- package/behaviors/useFocusScope.js +4 -6
- package/bin/rift-ds.mjs +2 -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.module.css +2 -2
- 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/notifications/Inbox.tsx +13 -45
- package/bin/templates/blocks/app/notifications/page.module.css +5 -0
- package/bin/templates/blocks/app/planner/page.tsx +2 -2
- 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/settings/Settings.tsx +4 -4
- 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 +51 -132
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
- package/bin/templates/blocks/registry.json +49 -6
- package/chat/ChatWidget.js +2 -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 +6 -0
- package/components/AppLayout/AppLayout.d.ts +4 -0
- package/components/AppLayout/AppLayout.js +5 -1
- package/components/AppSidebar/AppSidebar.css +17 -2
- package/components/AppSidebar/AppSidebar.js +9 -2
- package/components/AppToolbar/AppToolbar.d.ts +5 -2
- package/components/AppToolbar/AppToolbar.js +3 -1
- 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 +57 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +134 -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 +67 -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 +39 -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 +52 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +57 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- package/components/ChatMessage/ChatMessage.css +6 -0
- 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 +34 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +8 -2
- 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/Dropdown/Dropdown.js +8 -0
- package/components/EmptyState/EmptyState.css +8 -1
- package/components/EventCalendar/EventCalendar.css +12 -0
- 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 +15 -1
- package/components/Inspector/Inspector.css +4 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +152 -27
- package/components/NotificationCenter/NotificationCenter.d.ts +71 -8
- package/components/NotificationCenter/NotificationCenter.js +120 -13
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/Popover/Popover.css +3 -0
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +9 -1
- package/components/Prose/Prose.css +1 -1
- package/components/QuestionCard/QuestionCard.css +7 -4
- 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/SegmentedControl/SegmentedControl.css +5 -0
- 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 +39 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/Table/Table.css +106 -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 +13 -5
- 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/Toolbar/Toolbar.d.ts +6 -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/Wizard/Wizard.d.ts +8 -3
- package/components/Wizard/Wizard.js +4 -1
- package/components/registry.json +15 -6
- package/components/registry.json.d.ts +15 -6
- 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 +11 -13
- 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 +24 -4
- package/tokens/values.js +25 -6
- package/tokens/values.json.js +1 -1
package/README.md
CHANGED
|
@@ -103,8 +103,8 @@ import 'rift-ds/tokens/presets/presets.css';
|
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
- **Dark mode**: `data-theme="dark"` on the root element; light is the default.
|
|
106
|
-
- **Theme names**: a preset's id is its `data-brand` value and stylesheet name, and a theme shown under another name answers to that name in lowercase too (Signal, id `plum`, also applies as `data-brand="signal"` and `tokens/presets/signal.css`). `SHIPPED_THEMES` from `rift-ds/tokens/values` lists every theme with its name and attribute, and `shippedThemeOptions()` hands ThemePicker the same list with each theme's swatch. To apply a stored theme before first paint, pass `colorModeScript({ brandStorageKey })` the key you keep it under.
|
|
107
|
-
- **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page.
|
|
106
|
+
- **Theme names**: a preset's id is its `data-brand` value and stylesheet name, and a theme shown under another name answers to that name in lowercase too (Signal, id `plum`, also applies as `data-brand="signal"` and `tokens/presets/signal.css`). `SHIPPED_THEMES` from `rift-ds/tokens/values` lists every theme with its name and attribute, and `shippedThemeOptions()` hands ThemePicker the same list with each theme's swatch, corner and faces. To apply a stored theme before first paint, pass `colorModeScript({ brandStorageKey })` the key you keep it under.
|
|
107
|
+
- **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page. `rift-ds/tokens/base.css`, imported after the tokens, does exactly that along with the reset the components are tuned against, so an app that imports it has nothing to paint.
|
|
108
108
|
- **Your own brand**: every semantic token chains to a primitive, so overriding one primitive re-themes everything built on it. The [playground](https://rift-ds.com/playground) restyles the system live and copies out a complete, paste-ready override.
|
|
109
109
|
- **One part of a shipped theme**: the token and theme stylesheets sit in cascade layers (`rift.tokens`, then `rift.preset`), so any rule of your own outranks them whatever its selector. A plain `:root { --font-family-primary: … }` keeps a preset's colours with your face, in light and dark alike. To set a default that a preset still replaces, declare it inside `@layer rift.tokens { … }`.
|
|
110
110
|
- **Overriding component styles**: component styles sit in a third layer, `rift.components`, after the two token layers, so your own CSS outside a layer always beats them, whatever its selector and in whatever order your bundler loads the sheets. `className` is the supported hook: `.my-table { … }` on `<Table className="my-table" />` holds in development and production alike. That reaches your resets too: a bare `* { margin: 0 }` would strip the components' spacing, so put a reset inside `@layer rift.tokens { … }`, or import `tokens/base.css`, which is already there.
|
|
@@ -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,8 @@ 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 shipped theme brings its own faces: once you pick one, drop the font.css and riftFont lines above, or the app ships a font it never shows.`);
|
|
316
|
+
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
317
|
console.log(`\nThen add a first page: npx ${PACKAGE_NAME} init block dashboard (no name lists them).`);
|
|
316
318
|
console.log(`Setup and theming: ${SITE_ORIGIN}/docs/get-started`);
|
|
317
319
|
}
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* The dashboard's grid. Four stats across on a desktop, two from the
|
|
2
|
-
laptop width down to a phone,
|
|
3
|
-
|
|
2
|
+
laptop width down to a phone, each stat keeping its delta beside its
|
|
3
|
+
value (deltaPlacement="inline") so the row reads as one shape; the two panels sit
|
|
4
4
|
side by side until the tablet width, then stack. */
|
|
5
5
|
|
|
6
6
|
.stats {
|
|
@@ -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>
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The notifications block's inbox: the page header's actions, the filters
|
|
5
|
-
* and the list share one record of what is read and what is left
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* and the list share one record of what is read and what is left with the
|
|
6
|
+
* bell in the shell's toolbar (`useNotifications` in components/blocks/notifications.ts), so a
|
|
7
|
+
* count reads the same in both. Swap that record for your notifications and
|
|
8
|
+
* your server's read state, and the `onSelect` of each row for where it
|
|
9
|
+
* should take the reader.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import { useState } from 'react';
|
|
@@ -14,35 +15,10 @@ import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
|
|
|
14
15
|
import { EmptyState } from 'rift-ds/components/EmptyState/EmptyState';
|
|
15
16
|
import { NotificationItem } from 'rift-ds/components/NotificationCenter/NotificationCenter';
|
|
16
17
|
import { Tabs } from 'rift-ds/components/Tabs/Tabs';
|
|
17
|
-
import { AppShell } from '../../components/blocks/AppShell';
|
|
18
|
+
import { AppShell, PRODUCT_NAME } from '../../components/blocks/AppShell';
|
|
19
|
+
import { useNotifications } from '../../components/blocks/notifications';
|
|
18
20
|
import styles from './page.module.css';
|
|
19
21
|
|
|
20
|
-
type Category = 'payments' | 'cards' | 'team' | 'approvals';
|
|
21
|
-
|
|
22
|
-
interface Notification {
|
|
23
|
-
id: string;
|
|
24
|
-
/** Which day group the row sits under. */
|
|
25
|
-
group: 'Today' | 'This week' | 'Earlier';
|
|
26
|
-
category: Category;
|
|
27
|
-
icon: string;
|
|
28
|
-
title: string;
|
|
29
|
-
text: string;
|
|
30
|
-
/** When it happened, already written for the reader. */
|
|
31
|
-
time: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const INBOX: Notification[] = [
|
|
35
|
-
{ id: 'n1', group: 'Today', category: 'payments', icon: 'payments', title: 'Payment received', text: 'Northwind Supply paid invoice 1042 for $4,180.00.', time: '2m' },
|
|
36
|
-
{ id: 'n2', group: 'Today', category: 'approvals', icon: 'approval', title: 'Approval needed', text: 'Jordan Reyes asked to spend $1,632.42 from the Software budget.', time: '1h' },
|
|
37
|
-
{ id: 'n3', group: 'Today', category: 'cards', icon: 'credit_card_off', title: 'Card frozen', text: 'The card ending in 7781 is frozen until you unfreeze it.', time: '3h' },
|
|
38
|
-
{ id: 'n4', group: 'This week', category: 'team', icon: 'person_add', title: 'Invite accepted', text: 'Sam Patel joined Acme as an admin.', time: 'Tue' },
|
|
39
|
-
{ id: 'n5', group: 'This week', category: 'payments', icon: 'schedule', title: 'Payment scheduled', text: '$5,000.00 to Bright Studio goes out on Friday.', time: 'Mon' },
|
|
40
|
-
{ id: 'n6', group: 'This week', category: 'approvals', icon: 'receipt_long', title: 'Receipt missing', text: 'Add a receipt for $375.87 at Harbor Bistro.', time: 'Mon' },
|
|
41
|
-
{ id: 'n7', group: 'Earlier', category: 'cards', icon: 'credit_card', title: 'New card requested', text: 'Lee Chen asked for a card with a $5,000 limit.', time: 'Nov 18' },
|
|
42
|
-
{ id: 'n8', group: 'Earlier', category: 'team', icon: 'shield_person', title: 'Two admins required', text: 'Sensitive changes now need a second admin to approve.', time: 'Nov 14' },
|
|
43
|
-
{ id: 'n9', group: 'Earlier', category: 'payments', icon: 'description', title: 'Statement ready', text: 'Your October statement is ready to download.', time: 'Nov 1' },
|
|
44
|
-
];
|
|
45
|
-
|
|
46
22
|
const GROUPS = ['Today', 'This week', 'Earlier'] as const;
|
|
47
23
|
|
|
48
24
|
const CATEGORY_OPTIONS = [
|
|
@@ -54,17 +30,10 @@ const CATEGORY_OPTIONS = [
|
|
|
54
30
|
];
|
|
55
31
|
|
|
56
32
|
export function Inbox() {
|
|
57
|
-
const
|
|
58
|
-
const [unread, setUnread] = useState<string[]>(['n1', 'n2', 'n3', 'n4']);
|
|
33
|
+
const { items, unread, read, readAll, dismiss, clear } = useNotifications();
|
|
59
34
|
const [show, setShow] = useState('all');
|
|
60
35
|
const [category, setCategory] = useState('all');
|
|
61
36
|
|
|
62
|
-
const read = (id: string) => setUnread((ids) => ids.filter((other) => other !== id));
|
|
63
|
-
const dismiss = (id: string) => {
|
|
64
|
-
setItems((list) => list.filter((item) => item.id !== id));
|
|
65
|
-
read(id);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
37
|
const shown = items.filter(
|
|
69
38
|
(item) =>
|
|
70
39
|
(show === 'all' || unread.includes(item.id)) && (category === 'all' || item.category === category),
|
|
@@ -73,26 +42,25 @@ export function Inbox() {
|
|
|
73
42
|
return (
|
|
74
43
|
<AppShell
|
|
75
44
|
activeKey="inbox"
|
|
76
|
-
breadcrumb={[{ label:
|
|
45
|
+
breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Notifications' }]}
|
|
77
46
|
title="Notifications"
|
|
78
47
|
actions={
|
|
79
48
|
<>
|
|
80
49
|
<Button
|
|
81
50
|
label="Mark all as read"
|
|
82
51
|
variant="secondary"
|
|
52
|
+
size="compact"
|
|
83
53
|
iconLeft="done_all"
|
|
84
54
|
disabled={unread.length === 0}
|
|
85
|
-
onClick={
|
|
55
|
+
onClick={readAll}
|
|
86
56
|
/>
|
|
87
57
|
<Button
|
|
88
58
|
label="Clear all"
|
|
89
59
|
variant="tertiary"
|
|
60
|
+
size="compact"
|
|
90
61
|
tone="destructive"
|
|
91
62
|
disabled={items.length === 0}
|
|
92
|
-
onClick={
|
|
93
|
-
setItems([]);
|
|
94
|
-
setUnread([]);
|
|
95
|
-
}}
|
|
63
|
+
onClick={clear}
|
|
96
64
|
/>
|
|
97
65
|
</>
|
|
98
66
|
}
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
border-top: var(--border-025) solid var(--color-divider);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/* A ruled row is square: a rule drawn on a curved corner bows at both ends. */
|
|
60
|
+
.list > :global(.ds-notification-item) {
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
59
64
|
@media (max-width: 480px) {
|
|
60
65
|
.category {
|
|
61
66
|
width: 100%;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { Button } from 'rift-ds/components/Button/Button';
|
|
10
10
|
import { Widget } from 'rift-ds/components/Widget/Widget';
|
|
11
|
-
import { AppShell } from '../../components/blocks/AppShell';
|
|
11
|
+
import { AppShell, PRODUCT_NAME } from '../../components/blocks/AppShell';
|
|
12
12
|
import { PlannerGrid } from './PlannerGrid';
|
|
13
13
|
import { Requests } from './Requests';
|
|
14
14
|
import styles from './page.module.css';
|
|
@@ -17,7 +17,7 @@ export default function PlannerPage() {
|
|
|
17
17
|
return (
|
|
18
18
|
<AppShell
|
|
19
19
|
activeKey="projects"
|
|
20
|
-
breadcrumb={[{ label:
|
|
20
|
+
breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Planner' }]}
|
|
21
21
|
title="Planner"
|
|
22
22
|
actions={<Button label="Add a row" variant="secondary" iconLeft="add" />}
|
|
23
23
|
>
|
|
@@ -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[] = [
|
|
@@ -36,7 +36,7 @@ import { RadioGroup } from 'rift-ds/components/RadioButton/RadioButton';
|
|
|
36
36
|
import { SegmentedControl } from 'rift-ds/components/SegmentedControl/SegmentedControl';
|
|
37
37
|
import { Slider } from 'rift-ds/components/Slider/Slider';
|
|
38
38
|
import { ToggleSwitch } from 'rift-ds/components/ToggleSwitch/ToggleSwitch';
|
|
39
|
-
import { AppShell, SETTINGS_SECTIONS } from '../../components/blocks/AppShell';
|
|
39
|
+
import { AppShell, PRODUCT_NAME, SETTINGS_SECTIONS } from '../../components/blocks/AppShell';
|
|
40
40
|
import styles from './page.module.css';
|
|
41
41
|
|
|
42
42
|
type SectionId = (typeof SETTINGS_SECTIONS)[number]['id'];
|
|
@@ -69,7 +69,7 @@ const HOURS = ['18:00', '20:00', '22:00', '06:00', '08:00'].map((hour) => ({ val
|
|
|
69
69
|
type FieldKey = 'workspaceName' | 'workspaceUrl' | 'name' | 'email' | 'phone' | 'password';
|
|
70
70
|
|
|
71
71
|
const INITIAL: Record<FieldKey, string> = {
|
|
72
|
-
workspaceName:
|
|
72
|
+
workspaceName: PRODUCT_NAME,
|
|
73
73
|
workspaceUrl: 'acme',
|
|
74
74
|
name: 'Alex Morgan',
|
|
75
75
|
email: 'alex@example.com',
|
|
@@ -297,7 +297,7 @@ export function Settings() {
|
|
|
297
297
|
<AppShell
|
|
298
298
|
activeKey="settings"
|
|
299
299
|
activeSubKey={active}
|
|
300
|
-
breadcrumb={[{ label:
|
|
300
|
+
breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Settings', href: '#general' }, { label: section.label }]}
|
|
301
301
|
title={section.label}
|
|
302
302
|
description={section.description}
|
|
303
303
|
>
|
|
@@ -362,7 +362,7 @@ export function Settings() {
|
|
|
362
362
|
<Row
|
|
363
363
|
label="Delete this workspace"
|
|
364
364
|
description="Removes the workspace and everything in it for every member. This cannot be undone."
|
|
365
|
-
control={<Button size="compact" variant="
|
|
365
|
+
control={<Button size="compact" variant="secondary" tone="destructive" label="Delete workspace" />}
|
|
366
366
|
/>
|
|
367
367
|
</Group>
|
|
368
368
|
</>
|
|
@@ -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>
|