rift-ds 1.29.0 → 1.30.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 +4 -3
- package/bin/rift-ds.mjs +1 -1
- package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
- package/bin/templates/blocks/app/settings/ProfileForm.tsx +98 -0
- package/bin/templates/blocks/app/settings/page.module.css +11 -0
- package/bin/templates/blocks/app/settings/page.tsx +84 -0
- package/bin/templates/blocks/components/blocks/AppShell.module.css +8 -41
- package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
- package/bin/templates/blocks/registry.json +13 -0
- package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
- package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
- package/bin/templates/chat/app/api/chat/route.ts +0 -2
- package/chat/ChatLauncher.d.ts +9 -1
- package/chat/ChatLauncher.js +3 -1
- package/components/Alert/Alert.css +12 -0
- package/components/Alert/Alert.d.ts +2 -0
- package/components/Alert/Alert.js +3 -1
- package/components/Attachment/Attachment.css +92 -0
- package/components/Attachment/FileRow.d.ts +47 -0
- package/components/Attachment/FileRow.js +38 -0
- package/components/Avatar/Avatar.css +14 -0
- package/components/Avatar/Avatar.d.ts +3 -1
- package/components/Avatar/Avatar.js +3 -2
- package/components/Chart/AreaChart.d.ts +2 -0
- package/components/Chart/AreaChart.js +2 -1
- package/components/Chart/BarChart.d.ts +2 -0
- package/components/Chart/BarChart.js +2 -1
- package/components/Chart/ComboChart.d.ts +4 -0
- package/components/Chart/ComboChart.js +4 -2
- package/components/Chart/LineChart.d.ts +2 -0
- package/components/Chart/LineChart.js +2 -1
- package/components/Chart/PieChart.d.ts +4 -4
- package/components/Chart/PieChart.js +1 -1
- package/components/Chart/ScatterChart.d.ts +2 -0
- package/components/Chart/ScatterChart.js +2 -1
- package/components/Checklist/Checklist.css +123 -0
- package/components/Checklist/Checklist.d.ts +66 -0
- package/components/Checklist/Checklist.js +115 -0
- package/components/CircularButton/CircularButton.css +39 -0
- package/components/CircularButton/CircularButton.d.ts +13 -0
- package/components/CircularButton/CircularButton.js +18 -4
- package/components/ColourSwatch/ColourSwatch.css +3 -1
- package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
- package/components/ColourSwatch/ColourSwatch.js +5 -0
- package/components/Combobox/Combobox.d.ts +4 -2
- package/components/Combobox/Combobox.js +7 -3
- package/components/DataTable/DataTable.css +35 -0
- package/components/DataTable/DataTable.d.ts +34 -2
- package/components/DataTable/DataTable.js +58 -5
- package/components/DataTable/columnTypes.d.ts +1 -1
- package/components/DataTable/columnTypes.js +1 -1
- package/components/DateInput/DateInput.d.ts +4 -2
- package/components/DateInput/DateInput.js +7 -3
- package/components/DescriptionList/DescriptionList.css +28 -0
- package/components/DescriptionList/DescriptionList.d.ts +3 -1
- package/components/DescriptionList/DescriptionList.js +4 -3
- package/components/DescriptionList/DescriptionListCopy.js +2 -0
- package/components/Dropdown/Dropdown.d.ts +4 -2
- package/components/Dropdown/Dropdown.js +7 -3
- package/components/EmptyState/EmptyState.css +12 -0
- package/components/EmptyState/EmptyState.d.ts +7 -0
- package/components/EmptyState/EmptyState.js +2 -0
- package/components/EventCalendar/EventCalendar.css +59 -0
- package/components/EventCalendar/EventCalendar.d.ts +24 -2
- package/components/EventCalendar/EventCalendar.js +104 -19
- package/components/FormSection/FormSection.css +70 -0
- package/components/FormSection/FormSection.d.ts +35 -0
- package/components/FormSection/FormSection.js +35 -0
- package/components/Grid/Grid.css +52 -0
- package/components/Grid/Grid.d.ts +30 -0
- package/components/Grid/Grid.js +36 -0
- package/components/Icon/Icon.css +55 -0
- package/components/Icon/Icon.d.ts +27 -0
- package/components/Icon/Icon.js +42 -0
- package/components/NumberInput/NumberInput.d.ts +4 -2
- package/components/NumberInput/NumberInput.js +7 -3
- package/components/OrgChart/OrgChart.css +143 -0
- package/components/OrgChart/OrgChart.d.ts +44 -0
- package/components/OrgChart/OrgChart.js +26 -0
- package/components/PageHeader/PageHeader.css +74 -0
- package/components/PageHeader/PageHeader.d.ts +39 -0
- package/components/PageHeader/PageHeader.js +33 -0
- package/components/Panel/Panel.css +7 -0
- package/components/Panel/Panel.d.ts +5 -2
- package/components/Panel/Panel.js +2 -1
- package/components/ResourceTimeline/ResourceTimeline.css +194 -0
- package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
- package/components/ResourceTimeline/ResourceTimeline.js +129 -0
- package/components/ShaderField/useShaderField.js +13 -1
- package/components/ShaderScene/ShaderScene.d.ts +3 -2
- package/components/ShaderScene/ShaderScene.js +47 -4
- package/components/Stack/Stack.css +68 -0
- package/components/Stack/Stack.d.ts +37 -0
- package/components/Stack/Stack.js +39 -0
- package/components/Stat/Stat.css +65 -0
- package/components/Stat/Stat.d.ts +7 -1
- package/components/Stat/Stat.js +16 -1
- package/components/Table/Table.css +11 -0
- package/components/Table/Table.d.ts +2 -0
- package/components/Table/Table.js +5 -1
- package/components/Tabs/Tabs.css +23 -0
- package/components/Tabs/Tabs.d.ts +9 -8
- package/components/Tabs/Tabs.js +38 -5
- package/components/Textarea/Textarea.d.ts +4 -2
- package/components/Textarea/Textarea.js +7 -3
- package/components/ThemeToggle/colorMode.d.ts +17 -1
- package/components/ThemeToggle/colorMode.js +11 -2
- package/components/Widget/Widget.css +21 -0
- package/components/Widget/Widget.d.ts +4 -0
- package/components/Widget/Widget.js +13 -5
- package/components/Wizard/Wizard.css +67 -0
- package/components/Wizard/Wizard.d.ts +54 -0
- package/components/Wizard/Wizard.js +71 -0
- package/components/registry.d.ts +25 -0
- package/components/registry.js +8 -0
- package/components/registry.json +233 -32
- package/components/registry.json.d.ts +233 -32
- package/components/registry.json.js +1 -1
- package/index.d.ts +10 -0
- package/index.js +20 -0
- package/package.json +1 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/values.d.ts +31 -0
- package/tokens/values.js +16 -0
- package/tokens/values.json.js +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
WIZARD
|
|
3
|
+
The Stepper, the step under its heading, and
|
|
4
|
+
a footer: a running summary at the start, Back
|
|
5
|
+
and Continue at the end, above a rule.
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
/* Base */
|
|
9
|
+
.ds-wizard {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--gap-500);
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Step */
|
|
17
|
+
.ds-wizard__body {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--gap-400);
|
|
21
|
+
min-width: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-wizard__title {
|
|
25
|
+
margin: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Focus lands on the heading when the step changes; it is a target for the
|
|
29
|
+
reader, not a control, so it shows the ring only to the keyboard. */
|
|
30
|
+
.ds-wizard__title:focus {
|
|
31
|
+
outline: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-wizard__title:focus-visible {
|
|
35
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
36
|
+
outline-offset: 2px;
|
|
37
|
+
border-radius: var(--radius-100);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Footer */
|
|
41
|
+
.ds-wizard__footer {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
gap: var(--gap-400);
|
|
47
|
+
padding-block-start: var(--padding-400);
|
|
48
|
+
border-block-start: var(--border-025) solid var(--color-divider);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ds-wizard__summary {
|
|
52
|
+
min-width: 0;
|
|
53
|
+
font-family: var(--font-paragraph-family);
|
|
54
|
+
font-size: var(--font-paragraph-size);
|
|
55
|
+
font-weight: var(--font-paragraph-weight);
|
|
56
|
+
line-height: var(--font-paragraph-line-height);
|
|
57
|
+
letter-spacing: var(--font-paragraph-letter-spacing);
|
|
58
|
+
color: var(--color-text-secondary);
|
|
59
|
+
font-variant-numeric: tabular-nums;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ds-wizard__actions {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: var(--gap-200);
|
|
66
|
+
margin-inline-start: auto;
|
|
67
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** One step of a wizard. */
|
|
3
|
+
export interface WizardStep {
|
|
4
|
+
/** A stable id for the step. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The step's name, in the stepper and as the heading of its content. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** A line under the label in the stepper. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** What the step asks for. */
|
|
11
|
+
content: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Props owned by Wizard itself; everything else falls through to the root `<section>`. */
|
|
14
|
+
type WizardOwnProps = {
|
|
15
|
+
/** The steps, in order. */
|
|
16
|
+
steps: WizardStep[];
|
|
17
|
+
/** The index of the step shown, for a controlled wizard. Leave it undefined to let the wizard keep its own, seeded from `defaultStep`. */
|
|
18
|
+
step?: number;
|
|
19
|
+
/** The step shown on first render when the wizard is uncontrolled. Defaults to 0. */
|
|
20
|
+
defaultStep?: number;
|
|
21
|
+
/** Fires with the index of the step the reader moves to, by Back, Continue or a completed step in the stepper. */
|
|
22
|
+
onStepChange?: (step: number) => void;
|
|
23
|
+
/** Called when the reader presses the last step's finish button. */
|
|
24
|
+
onFinish?: () => void;
|
|
25
|
+
/** Whether the reader can move on from the step shown: false holds Continue and Finish, while the step's own fields say what is missing. Defaults to true. */
|
|
26
|
+
canAdvance?: boolean;
|
|
27
|
+
/** A running figure at the start of the footer, kept in view as the steps change: a total, a count of what is chosen. */
|
|
28
|
+
summary?: React.ReactNode;
|
|
29
|
+
/** Lets the reader go back to a completed step from the stepper. Defaults to true. */
|
|
30
|
+
allowStepClick?: boolean;
|
|
31
|
+
/** The back button's text. Defaults to "Back". */
|
|
32
|
+
backLabel?: string;
|
|
33
|
+
/** The next button's text. Defaults to "Continue". */
|
|
34
|
+
nextLabel?: string;
|
|
35
|
+
/** The last step's button text. Defaults to "Finish". */
|
|
36
|
+
finishLabel?: string;
|
|
37
|
+
/** The BCP 47 locale the stepper's step numbers are written in. Defaults to the nearest LocaleProvider's, else `en-US`. */
|
|
38
|
+
locale?: string;
|
|
39
|
+
/** The step heading's place in the outline. Defaults to 2, a section of a page. */
|
|
40
|
+
headingLevel?: 2 | 3 | 4;
|
|
41
|
+
/** Additional CSS classes */
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
44
|
+
export interface WizardProps extends WizardOwnProps, Omit<React.ComponentPropsWithRef<'section'>, keyof WizardOwnProps | 'children'> {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A task in steps: the Stepper above, the step shown under its own heading,
|
|
48
|
+
* and a footer with Back and Continue (Finish on the last step) and a running
|
|
49
|
+
* summary. Moving to a step moves focus to its heading, so a screen reader
|
|
50
|
+
* hears where it landed. The step's own fields own their validation; the
|
|
51
|
+
* host holds Continue with `canAdvance` until they pass.
|
|
52
|
+
*/
|
|
53
|
+
export declare function Wizard({ steps, step: stepProp, defaultStep, onStepChange, onFinish, canAdvance, summary, allowStepClick, backLabel, nextLabel, finishLabel, locale, headingLevel, className, ref, ...rest }: WizardProps): React.JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import { Button } from "../Button/Button.js";
|
|
5
|
+
import { Heading } from "../Heading/Heading.js";
|
|
6
|
+
import { Stepper } from "../Stepper/Stepper.js";
|
|
7
|
+
import "./Wizard.css";
|
|
8
|
+
function Wizard({
|
|
9
|
+
steps,
|
|
10
|
+
step: stepProp,
|
|
11
|
+
defaultStep = 0,
|
|
12
|
+
onStepChange,
|
|
13
|
+
onFinish,
|
|
14
|
+
canAdvance = true,
|
|
15
|
+
summary,
|
|
16
|
+
allowStepClick = true,
|
|
17
|
+
backLabel = "Back",
|
|
18
|
+
nextLabel = "Continue",
|
|
19
|
+
finishLabel = "Finish",
|
|
20
|
+
locale,
|
|
21
|
+
headingLevel = 2,
|
|
22
|
+
className = "",
|
|
23
|
+
ref,
|
|
24
|
+
...rest
|
|
25
|
+
}) {
|
|
26
|
+
const [internal, setInternal] = useState(defaultStep);
|
|
27
|
+
const current = Math.min(Math.max(stepProp ?? internal, 0), Math.max(steps.length - 1, 0));
|
|
28
|
+
const headingRef = useRef(null);
|
|
29
|
+
const moved = useRef(false);
|
|
30
|
+
const go = (next) => {
|
|
31
|
+
if (next < 0 || next >= steps.length || next === current) return;
|
|
32
|
+
moved.current = true;
|
|
33
|
+
if (stepProp === void 0) setInternal(next);
|
|
34
|
+
onStepChange?.(next);
|
|
35
|
+
};
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!moved.current) return;
|
|
38
|
+
moved.current = false;
|
|
39
|
+
headingRef.current?.focus();
|
|
40
|
+
}, [current]);
|
|
41
|
+
const isLast = current === steps.length - 1;
|
|
42
|
+
const shown = steps[current];
|
|
43
|
+
const hasSummary = summary != null && summary !== false && summary !== "";
|
|
44
|
+
const classes = ["ds-wizard", className].filter(Boolean).join(" ");
|
|
45
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": shown?.label, ...rest, ref, className: classes, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Stepper,
|
|
48
|
+
{
|
|
49
|
+
steps: steps.map(({ label, description }) => ({ label, description })),
|
|
50
|
+
activeStep: current,
|
|
51
|
+
onStepClick: allowStepClick ? (index) => index < current && go(index) : void 0,
|
|
52
|
+
locale,
|
|
53
|
+
className: "ds-wizard__stepper"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
shown && /* @__PURE__ */ jsxs("div", { className: "ds-wizard__body", children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Heading, { ref: headingRef, level: headingLevel, tier: "heading-3", tabIndex: -1, className: "ds-wizard__title", children: shown.label }),
|
|
58
|
+
/* @__PURE__ */ jsx("div", { className: "ds-wizard__content", children: shown.content })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-wizard__footer", children: [
|
|
61
|
+
hasSummary && /* @__PURE__ */ jsx("div", { className: "ds-wizard__summary", children: summary }),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-wizard__actions", children: [
|
|
63
|
+
current > 0 && /* @__PURE__ */ jsx(Button, { label: backLabel, variant: "secondary", onClick: () => go(current - 1) }),
|
|
64
|
+
isLast ? /* @__PURE__ */ jsx(Button, { label: finishLabel, disabled: !canAdvance, onClick: () => onFinish?.() }) : /* @__PURE__ */ jsx(Button, { label: nextLabel, disabled: !canAdvance, onClick: () => go(current + 1) })
|
|
65
|
+
] })
|
|
66
|
+
] })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
Wizard
|
|
71
|
+
};
|
package/components/registry.d.ts
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* (recharts is an optional peer). Held to the actual imports
|
|
26
26
|
* by scripts/generate-library-barrel.mjs on every build.
|
|
27
27
|
*
|
|
28
|
+
* alternatives set where a reader could mistake the component for another:
|
|
29
|
+
* each names the other component and the condition that picks
|
|
30
|
+
* it instead. Printed on the page, in the markdown contract
|
|
31
|
+
* and the schema, and served by the MCP get_component tool.
|
|
32
|
+
*
|
|
28
33
|
* `docOnlyHelpers` names the internal documentation helpers that are
|
|
29
34
|
* deliberately excluded from the public count.
|
|
30
35
|
*
|
|
@@ -68,6 +73,13 @@ export interface ComponentMeta {
|
|
|
68
73
|
note?: string;
|
|
69
74
|
see?: string;
|
|
70
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* The components a reader could mistake this one for, each with the condition that picks it instead. `when` completes the sentence "Use <label> instead when …", so it starts lower case and carries no full stop. Every pair is named from both sides.
|
|
78
|
+
*/
|
|
79
|
+
alternatives?: {
|
|
80
|
+
name: string;
|
|
81
|
+
when: string;
|
|
82
|
+
}[];
|
|
71
83
|
}
|
|
72
84
|
/** One row of a keyboard pattern: the keys, and what pressing them does. */
|
|
73
85
|
export interface KeyboardRow {
|
|
@@ -127,5 +139,18 @@ export interface ComponentKeyboard extends KeyboardPattern {
|
|
|
127
139
|
}
|
|
128
140
|
/** Every keyboard pattern a component is tested against, the whole component's first; empty when it names none. */
|
|
129
141
|
export declare const keyboardFor: (name: string) => ComponentKeyboard[];
|
|
142
|
+
/** One alternative as a page prints it: the other component, where its page is, and when to pick it. */
|
|
143
|
+
export interface ComponentAlternative {
|
|
144
|
+
/** The other component's exported name */
|
|
145
|
+
name: string;
|
|
146
|
+
/** Its display name */
|
|
147
|
+
label: string;
|
|
148
|
+
/** Its route segment under /components */
|
|
149
|
+
slug: string;
|
|
150
|
+
/** The condition that picks it, completing "Use <label> instead when …" */
|
|
151
|
+
when: string;
|
|
152
|
+
}
|
|
153
|
+
/** The components a reader could mistake `name` for, with the condition that picks each; empty when it names none. */
|
|
154
|
+
export declare const alternativesFor: (name: string) => ComponentAlternative[];
|
|
130
155
|
/** The official public component count. */
|
|
131
156
|
export declare const COMPONENT_COUNT: number;
|
package/components/registry.js
CHANGED
|
@@ -13,9 +13,17 @@ const keyboardFor = (name) => {
|
|
|
13
13
|
...component.partPatterns ?? []
|
|
14
14
|
].map(({ pattern, part }) => ({ id: pattern, ...part ? { part } : {}, ...keyboardPatterns[pattern] }));
|
|
15
15
|
};
|
|
16
|
+
const alternativesFor = (name) => {
|
|
17
|
+
const component = registry.components.find((c) => c.name === name);
|
|
18
|
+
return (component?.alternatives ?? []).flatMap(({ name: other, when }) => {
|
|
19
|
+
const target = registry.components.find((c) => c.name === other);
|
|
20
|
+
return target ? [{ name: other, label: target.label, slug: target.slug, when }] : [];
|
|
21
|
+
});
|
|
22
|
+
};
|
|
16
23
|
const COMPONENT_COUNT = registry.components.length;
|
|
17
24
|
export {
|
|
18
25
|
COMPONENT_COUNT,
|
|
26
|
+
alternativesFor,
|
|
19
27
|
componentCategories,
|
|
20
28
|
componentCategoryMetadata,
|
|
21
29
|
componentMetadata,
|