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
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- banner:start -->
|
|
2
|
-
<a href="https://rift-ds.com"><img src="https://raw.githubusercontent.com/robritacca-dotcom/rift-ds/main/.github/readme-banner.jpg" alt="Rift DS, the AI-
|
|
2
|
+
<a href="https://rift-ds.com"><img src="https://raw.githubusercontent.com/robritacca-dotcom/rift-ds/main/.github/readme-banner.jpg" alt="Rift DS, the open-source, AI-native design system" width="100%"></a>
|
|
3
3
|
<!-- banner:end -->
|
|
4
4
|
|
|
5
5
|
# Rift DS
|
|
@@ -153,4 +153,8 @@ Designed and built by [Robert Ritacca](https://robertritacca.com).
|
|
|
153
153
|
|
|
154
154
|
## License
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
The package is MIT: the components, the tokens, the chat widget, the command-line tool and everything else published to npm as `rift-ds`, with the scripts that build them. Use it in anything. See [`LICENSE`](LICENSE) for the full terms.
|
|
157
|
+
|
|
158
|
+
The website is not. Its code, pages, writing and design are all rights reserved, apart from the files it publishes for use with the package, which are MIT too. See [`website/LICENSE`](website/LICENSE).
|
|
159
|
+
|
|
160
|
+
The Rift DS name, the logo, the mark and the brand's other assets are not licensed under either. A fork or a product built on the package needs its own name and logo. See [`TRADEMARKS.md`](TRADEMARKS.md).
|
|
@@ -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
|
+
};
|
package/behaviors/shell.css
CHANGED
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
something, so it is the chat's alone: an
|
|
29
29
|
app layout or a template is always the
|
|
30
30
|
floor of its page and stays solid.
|
|
31
|
-
- floating: the rail is a
|
|
32
|
-
the edges by the float gap,
|
|
33
|
-
floating shadow; the content
|
|
34
|
-
|
|
31
|
+
- floating: the rail is a card on the shell
|
|
32
|
+
colour held off the edges by the float gap,
|
|
33
|
+
hairline and floating shadow; the content
|
|
34
|
+
is crisp on the app surface around it.
|
|
35
35
|
- inset: the rail runs flush on the shell
|
|
36
36
|
plane and the content is a raised surface,
|
|
37
37
|
hairline and floating shadow, held off the
|
|
@@ -58,12 +58,10 @@
|
|
|
58
58
|
--ds-shell-gap: var(--ds-shell-inset, 10px);
|
|
59
59
|
--ds-shell-float-gap: var(--ds-sidebar-float-inset, 20px);
|
|
60
60
|
|
|
61
|
-
/* The raised edge
|
|
61
|
+
/* The raised edge, shared by floating and inset. */
|
|
62
62
|
--ds-shell-radius: var(--radius-600);
|
|
63
|
-
--ds-shell-edge-border: var(--color-bg-
|
|
63
|
+
--ds-shell-edge-border: var(--color-bg-app-shell-border);
|
|
64
64
|
--ds-shell-edge-shadow: var(--shadow-floating);
|
|
65
|
-
--ds-shell-glass: var(--color-bg-glass);
|
|
66
|
-
--ds-shell-glass-blur: blur(24px);
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
:where([data-ds-shell='flush']) {
|
|
@@ -88,9 +86,9 @@
|
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
:where([data-ds-shell='floating']) {
|
|
91
|
-
--ds-shell-plane: var(--color-bg-
|
|
92
|
-
--ds-shell-surface: var(--color-bg-
|
|
93
|
-
--ds-shell-rail-bg: var(--
|
|
89
|
+
--ds-shell-plane: var(--color-bg-app-surface);
|
|
90
|
+
--ds-shell-surface: var(--color-bg-app-surface);
|
|
91
|
+
--ds-shell-rail-bg: var(--color-bg-app-shell);
|
|
94
92
|
--ds-shell-rail-divider: transparent;
|
|
95
93
|
--ds-shell-surface-border: transparent;
|
|
96
94
|
--ds-shell-surface-shadow: none;
|
|
@@ -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
|
+
}
|