rift-ds 1.29.0 → 1.31.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 -3
- package/behaviors/locale.d.ts +7 -0
- package/behaviors/locale.js +5 -0
- package/behaviors/shell.css +33 -0
- package/bin/rift-ds.mjs +36 -10
- package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
- package/bin/templates/blocks/app/planner/PlannerGrid.tsx +58 -0
- package/bin/templates/blocks/app/planner/Requests.tsx +42 -0
- package/bin/templates/blocks/app/planner/page.module.css +17 -0
- package/bin/templates/blocks/app/planner/page.tsx +32 -0
- 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 +27 -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.actions.ts +108 -0
- package/bin/templates/chat/app/api/chat/route.ts +0 -2
- package/bin/templates/chat/components/chat/ChatMount.actions.tsx +55 -0
- package/bin/templates/chat/components/chat/ChatMount.tsx +14 -1
- package/bin/templates/chat/components/chat/proposals/ProposalCard.tsx +81 -0
- package/bin/templates/chat/components/chat/proposals/actions.ts +60 -0
- package/bin/templates/chat/components/chat/proposals/confirmation.ts +9 -0
- package/bin/templates/chat/components/chat/proposals/renderers.tsx +9 -0
- package/chat/ChatLauncher.d.ts +13 -2
- package/chat/ChatLauncher.js +9 -2
- package/chat/ChatProvider.d.ts +19 -2
- package/chat/ChatProvider.js +26 -3
- package/chat/ChatWidget.css +10 -0
- package/chat/ChatWidget.d.ts +2 -1
- package/chat/ChatWidget.js +8 -6
- package/chat/actions.d.ts +52 -6
- package/chat/actions.js +53 -5
- package/chat/contextSchema.d.ts +76 -0
- package/chat/contextSchema.js +58 -0
- package/chat/index.d.ts +2 -2
- package/chat/index.js +5 -1
- package/chat/registry.json.d.ts +2 -2
- package/chat/registry.json.js +1 -1
- package/chat/server.d.ts +18 -2
- package/chat/server.js +10 -1
- package/chat/suggestions.d.ts +7 -0
- package/chat/suggestions.js +13 -1
- package/chat/types.d.ts +23 -0
- package/chat/useChat.d.ts +2 -2
- package/chat/useChat.js +15 -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/AppSidebar/AppSidebar.css +12 -0
- 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/ButtonGroup/ButtonGroup.css +10 -1
- 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/RadarChart.js +24 -10
- 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 +52 -2
- package/components/DataTable/DataTable.d.ts +47 -3
- package/components/DataTable/DataTable.js +71 -7
- package/components/DataTable/columnTypes.d.ts +1 -1
- package/components/DataTable/columnTypes.js +1 -1
- package/components/DataTable/periodColumns.d.ts +37 -0
- package/components/DataTable/periodColumns.js +48 -0
- package/components/DateInput/DateInput.d.ts +4 -2
- package/components/DateInput/DateInput.js +7 -3
- package/components/DatePicker/DatePicker.css +22 -6
- package/components/DatePicker/DatePicker.d.ts +2 -1
- package/components/DatePicker/DatePicker.js +2 -2
- package/components/DateRangePicker/DateRangePicker.js +2 -2
- package/components/DecisionRow/DecisionRow.css +46 -0
- package/components/DecisionRow/DecisionRow.d.ts +62 -0
- package/components/DecisionRow/DecisionRow.js +93 -0
- 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 +113 -0
- package/components/EventCalendar/EventCalendar.d.ts +48 -4
- package/components/EventCalendar/EventCalendar.js +145 -25
- package/components/FormSection/FormSection.css +70 -0
- package/components/FormSection/FormSection.d.ts +35 -0
- package/components/FormSection/FormSection.js +35 -0
- package/components/FunnelChart/FunnelChart.js +33 -22
- package/components/Globe/Globe.css +7 -0
- package/components/Globe/Globe.js +1 -1
- 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 +18 -0
- package/components/Table/Table.d.ts +2 -0
- package/components/Table/Table.js +6 -2
- package/components/Tabs/Tabs.css +44 -3
- 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/Timeline/Timeline.css +8 -0
- package/components/Widget/Widget.css +23 -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/WorldMap/WorldMap.css +15 -0
- package/components/WorldMap/WorldMap.js +56 -1
- package/components/registry.d.ts +25 -0
- package/components/registry.js +8 -0
- package/components/registry.json +251 -33
- package/components/registry.json.d.ts +251 -33
- package/components/registry.json.js +1 -1
- package/index.d.ts +11 -0
- package/index.js +26 -0
- package/package.json +1 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/blueprint.css +9 -0
- package/tokens/presets/bubblegum.css +9 -0
- package/tokens/presets/contrast.css +3 -3
- package/tokens/presets/coral.css +3 -3
- package/tokens/presets/ember.css +9 -0
- package/tokens/presets/getaway.css +9 -0
- package/tokens/presets/gold.css +3 -3
- package/tokens/presets/mono.css +3 -3
- package/tokens/presets/pink.css +3 -3
- package/tokens/presets/plum.css +3 -3
- package/tokens/presets/signal.css +9 -0
- package/tokens/presets/smoke.css +9 -0
- package/tokens/presets/velvet.css +9 -0
- package/tokens/presets/violet.css +3 -3
- package/tokens/presets/volt.css +9 -0
- package/tokens/presets/warm.css +3 -3
- package/tokens/values.d.ts +31 -0
- package/tokens/values.js +16 -0
- package/tokens/values.json.js +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ An open source React design system built for AI products and coding agents: comp
|
|
|
13
13
|
|
|
14
14
|
## Why Rift DS
|
|
15
15
|
|
|
16
|
-
- **<!-- component-count -->
|
|
16
|
+
- **<!-- component-count -->189<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
|
|
17
17
|
- **A matching <!-- figma-kit-link -->[Figma kit](https://www.figma.com/community/file/1701820123445795117)<!-- /figma-kit-link -->.** Every component has a page in it, with a sticker sheet of its states, built on variables named after the same tokens. Duplicate it from the Figma Community to design with the same system.
|
|
18
18
|
- **AI patterns, the whole chat and templates, ready to use.** Composer, streaming chat thread, tool calls, reasoning and thread panel are in the box, the complete AI chat ships assembled as one widget that one command scaffolds, and the docs site has complete template screens built from them.
|
|
19
19
|
- **Fully themeable.** The shipped themes are complete looks to start from, each in light and dark. One `data-brand` attribute applies a theme, and a few CSS overrides make your own.
|
|
@@ -54,6 +54,8 @@ The whole AI chat ships as one widget: the panel with its docked, overlay and ta
|
|
|
54
54
|
npx rift-ds init chat
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Add `--actions` for a chat that proposes changes to the page's records and applies one only when the reader confirms it on the card.
|
|
58
|
+
|
|
57
59
|
The panel alone, with no route behind it, is three imports:
|
|
58
60
|
|
|
59
61
|
```tsx
|
|
@@ -101,6 +103,7 @@ import 'rift-ds/tokens/presets/presets.css';
|
|
|
101
103
|
```
|
|
102
104
|
|
|
103
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.
|
|
104
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.
|
|
105
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.
|
|
106
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 { … }`.
|
|
@@ -109,13 +112,13 @@ import 'rift-ds/tokens/presets/presets.css';
|
|
|
109
112
|
|
|
110
113
|
## Components
|
|
111
114
|
|
|
112
|
-
<!-- component-count -->
|
|
115
|
+
<!-- component-count -->189<!-- /component-count --> components, including a chat set for AI products (Chat thread, Composer, Tool call, Reasoning, Thread panel) and Shader field, a WebGL2 ambient background whose light sources read your colour tokens at runtime, so it re-themes with everything else. Details and live examples are on the [docs site](https://rift-ds.com/components).
|
|
113
116
|
|
|
114
117
|
<details>
|
|
115
118
|
<summary>The full list</summary>
|
|
116
119
|
|
|
117
120
|
<!-- component-list:start -->
|
|
118
|
-
Accordion · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Chip · Circular button · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · Filter bar · Funnel chart · Gantt chart · Gauge · Globe · Heading · Hover card · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Message actions · Message card · Meter · Model picker · Nav · Nav list · Notification centre · Number input · Pagination · Panel · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Sidebar panel · Signature pad · Site header · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · World map
|
|
121
|
+
Accordion · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Checklist · Chip · Circular button · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Decision row · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · File row · Filter bar · Form section · Funnel chart · Gantt chart · Gauge · Globe · Grid · Heading · Hover card · Icon · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Message actions · Message card · Meter · Model picker · Nav · Nav list · Notification centre · Number input · Org chart · Page header · Pagination · Panel · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Resource timeline · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Sidebar panel · Signature pad · Site header · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stack · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · Wizard · World map
|
|
119
122
|
<!-- component-list:end -->
|
|
120
123
|
|
|
121
124
|
</details>
|
package/behaviors/locale.d.ts
CHANGED
|
@@ -28,6 +28,13 @@ export declare function rotateWeek<T>(sundayFirst: readonly T[], start: Weekday)
|
|
|
28
28
|
export declare const weekdayOffset: (day: number, start: Weekday) => number;
|
|
29
29
|
/** The seven weekday names in `locale`, Sunday first, at the given width. */
|
|
30
30
|
export declare function weekdayNamesIn(locale: string, width: 'long' | 'short' | 'narrow'): string[];
|
|
31
|
+
/**
|
|
32
|
+
* The weekday names a seven-column calendar heads its columns with: the
|
|
33
|
+
* locale's short names where they are abbreviations (`Mo.`, `lun.`, `пн`),
|
|
34
|
+
* and its narrow ones where its short names are whole words (Arabic's
|
|
35
|
+
* `الأربعاء`), which would widen a column past the day under it on a phone.
|
|
36
|
+
*/
|
|
37
|
+
export declare function weekdayHeadersIn(locale: string): string[];
|
|
31
38
|
/** Whether `locale` is written in English, the language every built-in label defaults to. */
|
|
32
39
|
export declare function isEnglish(locale: string): boolean;
|
|
33
40
|
/** Whether `locale` writes times on a 12-hour clock (en-US) rather than a 24-hour one (en-GB, de-DE). */
|
package/behaviors/locale.js
CHANGED
|
@@ -31,6 +31,10 @@ function weekdayNamesIn(locale, width) {
|
|
|
31
31
|
const format = new Intl.DateTimeFormat(locale, { weekday: width, timeZone: "UTC" });
|
|
32
32
|
return Array.from({ length: 7 }, (_, day) => format.format(Date.UTC(2023, 0, 1 + day)));
|
|
33
33
|
}
|
|
34
|
+
function weekdayHeadersIn(locale) {
|
|
35
|
+
const short = weekdayNamesIn(locale, "short");
|
|
36
|
+
return short.some((name) => Array.from(name).length > 4) ? weekdayNamesIn(locale, "narrow") : short;
|
|
37
|
+
}
|
|
34
38
|
function isEnglish(locale) {
|
|
35
39
|
try {
|
|
36
40
|
return new Intl.Locale(locale).language === "en";
|
|
@@ -82,6 +86,7 @@ export {
|
|
|
82
86
|
rotateWeek,
|
|
83
87
|
uses12HourClock,
|
|
84
88
|
weekStartOf,
|
|
89
|
+
weekdayHeadersIn,
|
|
85
90
|
weekdayNamesIn,
|
|
86
91
|
weekdayOffset
|
|
87
92
|
};
|
package/behaviors/shell.css
CHANGED
|
@@ -117,3 +117,36 @@
|
|
|
117
117
|
background-color: var(--ds-shell-backdrop-fill);
|
|
118
118
|
backdrop-filter: var(--ds-shell-backdrop-filter);
|
|
119
119
|
}
|
|
120
|
+
|
|
121
|
+
/* Room for a docked chat. ChatLauncher marks <html> with data-chat="docked"
|
|
122
|
+
(or "docked-left") while its panel is docked, and keeps the panel's width
|
|
123
|
+
in --ds-chat-width and its gap off the window edge in --ds-chat-inset
|
|
124
|
+
(src/chat/ChatWidget.css). The outermost app shell gives up that width
|
|
125
|
+
plus that gap on the docked side, so in every mode the content ends one
|
|
126
|
+
gap short of the panel, as the panel ends one gap short of the window,
|
|
127
|
+
and no host writes its own rule. The plane still runs under the panel,
|
|
128
|
+
so the gap shows the plane. A chat seated as the page (its rails carry
|
|
129
|
+
the marker too) never pads for itself. A host that already makes room
|
|
130
|
+
on its own (a site that pads its body) sets --ds-shell-chat-room to 0px
|
|
131
|
+
on <html> to opt out. The dock is a screen edge the reader picks, not a
|
|
132
|
+
reading direction. */
|
|
133
|
+
:root {
|
|
134
|
+
--ds-shell-chat-room: calc(var(--ds-chat-width, 420px) + var(--ds-chat-inset, 20px));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
html[data-chat='docked'] :where([data-ds-shell]:not(.ds-chat-widget__rails)):not(:where([data-ds-shell] *)) {
|
|
138
|
+
padding-right: var(--ds-shell-chat-room); /* ds-allow(physical): the panel docks to the screen edge the reader picked */
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
html[data-chat='docked-left'] :where([data-ds-shell]:not(.ds-chat-widget__rails)):not(:where([data-ds-shell] *)) {
|
|
142
|
+
padding-left: var(--ds-shell-chat-room); /* ds-allow(physical): the panel docks to the screen edge the reader picked */
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where([data-ds-shell]) {
|
|
146
|
+
transition: padding var(--motion-duration-slow) var(--motion-ease-emphasized);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* The widen grip drives the width frame by frame, so the room follows it at once. */
|
|
150
|
+
html[data-chat-resizing] :where([data-ds-shell]) {
|
|
151
|
+
transition: none;
|
|
152
|
+
}
|
package/bin/rift-ds.mjs
CHANGED
|
@@ -67,6 +67,17 @@ const MANIFEST_URL = `${SITE_ORIGIN}/skill/manifest.json`;
|
|
|
67
67
|
const DEFAULT_DIR = join('.claude', 'skills');
|
|
68
68
|
const TEMPLATES_ROOT = join(dirname(fileURLToPath(import.meta.url)), 'templates');
|
|
69
69
|
const TEMPLATES_DIR = join(TEMPLATES_ROOT, 'chat');
|
|
70
|
+
/*
|
|
71
|
+
* The chat templates' propose-and-confirm files, written only by
|
|
72
|
+
* `init chat --actions`: a `<name>.actions.<ext>` file takes the place of
|
|
73
|
+
* `<name>.<ext>`, and the proposals/ folder is added. They live beside the
|
|
74
|
+
* plain chat's so their imports resolve and the library build type-checks
|
|
75
|
+
* them; scripts/validate-chat-widget.mjs holds them to the docs page's
|
|
76
|
+
* ACTIONS_SCAFFOLD_FILES.
|
|
77
|
+
*/
|
|
78
|
+
const ACTIONS_VARIANT = /\.actions(?=\.[a-z]+$)/;
|
|
79
|
+
const ACTIONS_FOLDER = 'components/chat/proposals/';
|
|
80
|
+
const isActionsOnly = (file) => ACTIONS_VARIANT.test(file) || file.startsWith(ACTIONS_FOLDER);
|
|
70
81
|
const APP_TEMPLATES_DIR = join(TEMPLATES_ROOT, 'app');
|
|
71
82
|
const BLOCKS_DIR = join(TEMPLATES_ROOT, 'blocks');
|
|
72
83
|
|
|
@@ -84,7 +95,7 @@ const CHAT_PEERS = [
|
|
|
84
95
|
|
|
85
96
|
const USAGE = `Usage: npx ${PACKAGE_NAME} init [--skill <name>] [--dir <dir>]
|
|
86
97
|
npx ${PACKAGE_NAME} init app [--app <dir>] [--dry-run]
|
|
87
|
-
npx ${PACKAGE_NAME} init chat [--app <dir>] [--dry-run]
|
|
98
|
+
npx ${PACKAGE_NAME} init chat [--actions] [--app <dir>] [--dry-run]
|
|
88
99
|
npx ${PACKAGE_NAME} init block [<name>] [--app <dir>] [--dry-run]
|
|
89
100
|
|
|
90
101
|
init
|
|
@@ -116,12 +127,16 @@ init chat
|
|
|
116
127
|
them, the mount and its model list under components/chat/, and an
|
|
117
128
|
.env.chat.example. Existing files are never overwritten.
|
|
118
129
|
|
|
130
|
+
--actions Write the propose-and-confirm example instead of a plain
|
|
131
|
+
chat: changes defined once for the page and the route, a
|
|
132
|
+
tool that proposes them on a card, the card that confirms,
|
|
133
|
+
and the record the reply opens with
|
|
119
134
|
--app <dir> The app router folder (default: app/ or src/app/, whichever exists)
|
|
120
135
|
--dry-run Print what would be written and write nothing
|
|
121
136
|
|
|
122
137
|
init block [<name>]
|
|
123
138
|
Copies a block into a Next.js app router project: a whole starting page
|
|
124
|
-
(an app shell, a dashboard, a
|
|
139
|
+
(an app shell, a dashboard, a settings page and more) built from the
|
|
125
140
|
library, its page under app/ and any shared parts under
|
|
126
141
|
components/blocks/. The files are yours from then on. With no name,
|
|
127
142
|
lists the blocks. Run init app first. Existing files are never
|
|
@@ -233,11 +248,11 @@ function findAppDir(app) {
|
|
|
233
248
|
* Writes every template under `base` (or only `files`, paths relative to
|
|
234
249
|
* it) that does not exist yet; returns what was written and skipped.
|
|
235
250
|
*/
|
|
236
|
-
function scaffold(base, appDir, dryRun, files = templateFiles(base)) {
|
|
251
|
+
function scaffold(base, appDir, dryRun, files = templateFiles(base), targetOf = (file) => file) {
|
|
237
252
|
const written = [];
|
|
238
253
|
const skipped = [];
|
|
239
254
|
for (const file of files) {
|
|
240
|
-
const dest = destinationFor(file, appDir);
|
|
255
|
+
const dest = destinationFor(targetOf(file), appDir);
|
|
241
256
|
if (existsSync(dest)) {
|
|
242
257
|
skipped.push(dest);
|
|
243
258
|
continue;
|
|
@@ -327,12 +342,17 @@ function ignoresEnvExample() {
|
|
|
327
342
|
return ignored;
|
|
328
343
|
}
|
|
329
344
|
|
|
330
|
-
function initChat({ app, dryRun }) {
|
|
345
|
+
function initChat({ app, dryRun, actions }) {
|
|
331
346
|
if (!existsSync(TEMPLATES_DIR)) {
|
|
332
347
|
fail('this copy carries no chat templates: run the published bin (npx ' + PACKAGE_NAME + ' init chat).');
|
|
333
348
|
}
|
|
334
349
|
const appDir = findAppDir(app);
|
|
335
|
-
const
|
|
350
|
+
const all = templateFiles(TEMPLATES_DIR);
|
|
351
|
+
const plainName = (file) => file.replace(ACTIONS_VARIANT, '');
|
|
352
|
+
/* With --actions, a variant replaces its plain file and the proposals are added; without it, neither is written. */
|
|
353
|
+
const replaced = new Set(actions ? all.filter((file) => ACTIONS_VARIANT.test(file)).map(plainName) : []);
|
|
354
|
+
const files = all.filter((file) => (actions ? !replaced.has(file) : !isActionsOnly(file)));
|
|
355
|
+
const { written, skipped } = scaffold(TEMPLATES_DIR, appDir, dryRun, files, plainName);
|
|
336
356
|
|
|
337
357
|
console.log(
|
|
338
358
|
dryRun
|
|
@@ -340,14 +360,20 @@ function initChat({ app, dryRun }) {
|
|
|
340
360
|
: `\n✓ Chat scaffolded: ${written.length} files written, ${skipped.length} left alone.`
|
|
341
361
|
);
|
|
342
362
|
console.log(`\nNext:`);
|
|
343
|
-
|
|
363
|
+
/* The actions mount plays no demo, so it needs no recharts. */
|
|
364
|
+
const peers = actions ? CHAT_PEERS.filter((peer) => peer !== 'recharts') : CHAT_PEERS;
|
|
365
|
+
console.log(` 1. Install the peers the chat imports:\n npm install ${peers.join(' ')}`);
|
|
344
366
|
console.log(
|
|
345
367
|
` 2. Render <ChatMount /> at the end of your root layout's body, after the page content:\n` +
|
|
346
368
|
` import { ChatMount } from '${relative(appDir, join(dirname(appDir), 'components', 'chat', 'ChatMount')).split('\\').join('/')}';`
|
|
347
369
|
);
|
|
348
370
|
console.log(
|
|
349
|
-
|
|
350
|
-
`
|
|
371
|
+
actions
|
|
372
|
+
? ` 3. Copy .env.chat.example into .env.local and set ANTHROPIC_API_KEY and CHAT_ENABLED=true: the\n` +
|
|
373
|
+
` propose-and-confirm mount talks to the route, with no scripted demo. Then replace the sample\n` +
|
|
374
|
+
` records and applyPlan in components/chat/proposals/ with your own.`
|
|
375
|
+
: ` 3. Copy .env.chat.example into .env.local. With NEXT_PUBLIC_CHAT_DEMO=true the widget plays a scripted\n` +
|
|
376
|
+
` conversation and needs no key; set ANTHROPIC_API_KEY and CHAT_ENABLED=true to go live.`
|
|
351
377
|
);
|
|
352
378
|
if (ignoresEnvExample()) {
|
|
353
379
|
console.log(
|
|
@@ -415,7 +441,7 @@ function option(flag, what) {
|
|
|
415
441
|
if (args[1] === 'chat' || args[1] === 'app' || args[1] === 'block') {
|
|
416
442
|
const appFlag = option('--app', 'a directory');
|
|
417
443
|
const scaffoldArgs = { app: appFlag ? resolve(appFlag) : undefined, dryRun: args.includes('--dry-run') };
|
|
418
|
-
if (args[1] === 'chat') initChat(scaffoldArgs);
|
|
444
|
+
if (args[1] === 'chat') initChat({ ...scaffoldArgs, actions: args.includes('--actions') });
|
|
419
445
|
else if (args[1] === 'app') initApp(scaffoldArgs);
|
|
420
446
|
else initBlock({ ...scaffoldArgs, name: args[2] && !args[2].startsWith('--') ? args[2] : undefined });
|
|
421
447
|
} else {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { colorModeScript } from 'rift-ds/components/ThemeToggle/colorMode';
|
|
1
|
+
import { colorModeScript, type ColorModeScriptOptions } from 'rift-ds/components/ThemeToggle/colorMode';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Applies the visitor's stored colour mode before first paint, so a
|
|
5
5
|
* returning visitor never sees the wrong mode flash. Render it in your root
|
|
6
6
|
* layout's <head>. ThemeToggle reads and changes the same setting.
|
|
7
|
+
*
|
|
8
|
+
* If your app lets the visitor pick a theme, store the preset id under a key
|
|
9
|
+
* of your own and pass it as `brandStorageKey`: the script then applies that
|
|
10
|
+
* theme before first paint too.
|
|
7
11
|
*/
|
|
8
|
-
export function ColorModeScript() {
|
|
9
|
-
return <script dangerouslySetInnerHTML={{ __html: colorModeScript() }} />;
|
|
12
|
+
export function ColorModeScript(options: ColorModeScriptOptions) {
|
|
13
|
+
return <script dangerouslySetInnerHTML={{ __html: colorModeScript(options) }} />;
|
|
10
14
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The plan: rows of work grouped by team, one editable column per week from
|
|
5
|
+
* periodColumns, a row total from totalOf, each team's subtotal on its group
|
|
6
|
+
* row and the sum of every week in the totals row. Edits are kept in this
|
|
7
|
+
* component's state; save them to your own store in onCellEdit.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useState } from 'react';
|
|
11
|
+
import { DataTable, periodColumns, totalOf, type DataTableColumn, type DataTableRow } from 'rift-ds/components/DataTable/DataTable';
|
|
12
|
+
|
|
13
|
+
/** The first week shown, as YYYY-MM-DD. Yours is probably this week's Monday. */
|
|
14
|
+
const START = '2026-03-02';
|
|
15
|
+
const WEEKS = periodColumns({
|
|
16
|
+
start: START,
|
|
17
|
+
count: 6,
|
|
18
|
+
unit: 'week',
|
|
19
|
+
keyPrefix: 'w:',
|
|
20
|
+
column: { type: 'number', align: 'end', editable: true, aggregate: 'sum', minWidth: 88 },
|
|
21
|
+
});
|
|
22
|
+
const WEEK_KEYS = WEEKS.map((column) => column.key);
|
|
23
|
+
|
|
24
|
+
const COLUMNS: DataTableColumn[] = [
|
|
25
|
+
{ key: 'work', header: 'Work', rowHeader: true, pin: 'start', minWidth: 180 },
|
|
26
|
+
{ key: 'team', header: 'Team', groupable: true },
|
|
27
|
+
...WEEKS,
|
|
28
|
+
{ key: 'total', header: 'Total', type: 'number', align: 'end', compute: totalOf(WEEK_KEYS), aggregate: 'sum', pin: 'end' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const PLAN: [string, string, number[]][] = [
|
|
32
|
+
['Checkout redesign', 'Design', [4, 5, 5, 3, 2, 0]],
|
|
33
|
+
['Help centre refresh', 'Design', [1, 1, 2, 3, 3, 2]],
|
|
34
|
+
['Payments migration', 'Engineering', [8, 8, 10, 10, 6, 4]],
|
|
35
|
+
['Search indexing', 'Engineering', [3, 3, 2, 2, 4, 5]],
|
|
36
|
+
['Spring launch', 'Marketing', [2, 2, 3, 5, 6, 6]],
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const ROWS: DataTableRow[] = PLAN.map(([work, team, days], index) => ({
|
|
40
|
+
id: `p${index + 1}`,
|
|
41
|
+
values: { work, team, ...Object.fromEntries(WEEK_KEYS.map((key, i) => [key, days[i]])) },
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
export function PlannerGrid() {
|
|
45
|
+
const [rows, setRows] = useState(ROWS);
|
|
46
|
+
return (
|
|
47
|
+
<DataTable
|
|
48
|
+
caption="Days planned by week"
|
|
49
|
+
columns={COLUMNS}
|
|
50
|
+
rows={rows}
|
|
51
|
+
defaultGrouping={['team']}
|
|
52
|
+
totalsRow
|
|
53
|
+
onCellEdit={({ row, key, value }) =>
|
|
54
|
+
setRows((current) => current.map((r) => (r.id === row.id ? { ...r, values: { ...r.values, [key]: value } } : r)))
|
|
55
|
+
}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Requests waiting on a decision, each a DecisionRow that settles to the
|
|
5
|
+
* answer and offers Undo. The statuses live here; send each decision to your
|
|
6
|
+
* own store in onStatusChange.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { Avatar } from 'rift-ds/components/Avatar/Avatar';
|
|
11
|
+
import { DecisionRow, type DecisionRowStatus } from 'rift-ds/components/DecisionRow/DecisionRow';
|
|
12
|
+
import { Widget } from 'rift-ds/components/Widget/Widget';
|
|
13
|
+
|
|
14
|
+
const REQUESTS = [
|
|
15
|
+
{ id: 'r1', name: 'Priya Natarajan', what: 'Two more days on search', when: '10m ago' },
|
|
16
|
+
{ id: 'r2', name: 'Tom Okafor', what: 'Move the launch a week', when: 'Yesterday' },
|
|
17
|
+
{ id: 'r3', name: 'Lena Fischer', what: 'A designer for help centre', when: 'Mon' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export function Requests({ className }: { className?: string }) {
|
|
21
|
+
const [statuses, setStatuses] = useState<Record<string, DecisionRowStatus>>({});
|
|
22
|
+
return (
|
|
23
|
+
<Widget className={className} title="Waiting on you" count={REQUESTS.filter((r) => (statuses[r.id] ?? 'pending') === 'pending').length}>
|
|
24
|
+
{REQUESTS.map((request) => (
|
|
25
|
+
<DecisionRow
|
|
26
|
+
key={request.id}
|
|
27
|
+
title={request.name}
|
|
28
|
+
description={request.what}
|
|
29
|
+
meta={request.when}
|
|
30
|
+
leading={<Avatar name={request.name} size="sm" />}
|
|
31
|
+
status={statuses[request.id] ?? 'pending'}
|
|
32
|
+
onStatusChange={(status) => setStatuses((current) => ({ ...current, [request.id]: status }))}
|
|
33
|
+
onUndo={() => {}}
|
|
34
|
+
acceptLabel="Approve"
|
|
35
|
+
declineLabel="Deny"
|
|
36
|
+
acceptedLabel="Approved"
|
|
37
|
+
declinedLabel="Denied"
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</Widget>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* The plan takes the column's whole width, so as many weeks show as the
|
|
2
|
+
screen has room for before the table scrolls; the queue sits under it at
|
|
3
|
+
a reading width, where a name, a fact and two buttons fit on one line. */
|
|
4
|
+
|
|
5
|
+
.layout {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--gap-400);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.plan {
|
|
12
|
+
min-width: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.queue {
|
|
16
|
+
max-width: 560px; /* the queue's reading width */
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The planner block: the app shell with a plan laid out across weeks, one
|
|
3
|
+
* editable column per week, a total for each row, a subtotal for each team
|
|
4
|
+
* and a sum for each week, beside a queue of requests waiting on a yes or a
|
|
5
|
+
* no. The figures are placeholders; read and write your own (PlannerGrid.tsx
|
|
6
|
+
* and Requests.tsx beside this page hold them).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Button } from 'rift-ds/components/Button/Button';
|
|
10
|
+
import { Widget } from 'rift-ds/components/Widget/Widget';
|
|
11
|
+
import { AppShell } from '../../components/blocks/AppShell';
|
|
12
|
+
import { PlannerGrid } from './PlannerGrid';
|
|
13
|
+
import { Requests } from './Requests';
|
|
14
|
+
import styles from './page.module.css';
|
|
15
|
+
|
|
16
|
+
export default function PlannerPage() {
|
|
17
|
+
return (
|
|
18
|
+
<AppShell
|
|
19
|
+
activeKey="projects"
|
|
20
|
+
breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Planner' }]}
|
|
21
|
+
title="Planner"
|
|
22
|
+
actions={<Button label="Add a row" variant="secondary" iconLeft="add" />}
|
|
23
|
+
>
|
|
24
|
+
<div className={styles.layout}>
|
|
25
|
+
<Widget title="Days planned by week" padding="none" className={styles.plan}>
|
|
26
|
+
<PlannerGrid />
|
|
27
|
+
</Widget>
|
|
28
|
+
<Requests className={styles.queue} />
|
|
29
|
+
</div>
|
|
30
|
+
</AppShell>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The settings block's profile section: a form that checks every field in
|
|
5
|
+
* one pass when it is saved. The checks write one record of messages by
|
|
6
|
+
* field name; fieldErrorsFrom turns it into ErrorSummary's list and each
|
|
7
|
+
* field's errorText, so the summary and the fields can never disagree.
|
|
8
|
+
* Replace `check` with your own rules, or with the errors your server
|
|
9
|
+
* returns.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { Button } from 'rift-ds/components/Button/Button';
|
|
14
|
+
import { ErrorSummary, fieldErrorsFrom } from 'rift-ds/components/ErrorSummary/ErrorSummary';
|
|
15
|
+
import { FormSection } from 'rift-ds/components/FormSection/FormSection';
|
|
16
|
+
import { Input } from 'rift-ds/components/Input/Input';
|
|
17
|
+
|
|
18
|
+
const FIELDS = ['firstName', 'lastName', 'email'] as const;
|
|
19
|
+
type Field = (typeof FIELDS)[number];
|
|
20
|
+
|
|
21
|
+
function check(values: Record<Field, string>): Partial<Record<Field, string>> {
|
|
22
|
+
const errors: Partial<Record<Field, string>> = {};
|
|
23
|
+
if (!values.firstName.trim()) errors.firstName = 'Enter your first name.';
|
|
24
|
+
if (!values.lastName.trim()) errors.lastName = 'Enter your last name.';
|
|
25
|
+
if (!/^\S+@\S+\.\S+$/.test(values.email)) errors.email = 'Enter an email address like name@example.com.';
|
|
26
|
+
return errors;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function ProfileForm() {
|
|
30
|
+
const [values, setValues] = useState<Record<Field, string>>({
|
|
31
|
+
firstName: 'Ada',
|
|
32
|
+
lastName: 'Lovelace',
|
|
33
|
+
email: 'ada@example.com',
|
|
34
|
+
});
|
|
35
|
+
const [submitted, setSubmitted] = useState(false);
|
|
36
|
+
const [saved, setSaved] = useState(false);
|
|
37
|
+
|
|
38
|
+
const { errors, errorText } = fieldErrorsFrom(submitted ? check(values) : {}, {
|
|
39
|
+
order: [...FIELDS],
|
|
40
|
+
idFor: (name) => `profile-${name}`,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const set = (field: Field) => (value: string) => {
|
|
44
|
+
setSaved(false);
|
|
45
|
+
setValues((current) => ({ ...current, [field]: value }));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const save = () => {
|
|
49
|
+
setSubmitted(true);
|
|
50
|
+
// Save here when the check passes, and show what your server returns.
|
|
51
|
+
setSaved(Object.keys(check(values)).length === 0);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<form
|
|
56
|
+
noValidate
|
|
57
|
+
onSubmit={(event) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
save();
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<ErrorSummary errors={errors} />
|
|
63
|
+
<FormSection
|
|
64
|
+
layout="aside"
|
|
65
|
+
columns={2}
|
|
66
|
+
title="Profile"
|
|
67
|
+
description="How you appear to the people you work with."
|
|
68
|
+
actions={<Button label={saved ? 'Saved' : 'Save profile'} onClick={save} />}
|
|
69
|
+
>
|
|
70
|
+
<Input
|
|
71
|
+
id="profile-firstName"
|
|
72
|
+
label="First name"
|
|
73
|
+
value={values.firstName}
|
|
74
|
+
onValueChange={set('firstName')}
|
|
75
|
+
errorText={errorText.firstName}
|
|
76
|
+
required
|
|
77
|
+
/>
|
|
78
|
+
<Input
|
|
79
|
+
id="profile-lastName"
|
|
80
|
+
label="Last name"
|
|
81
|
+
value={values.lastName}
|
|
82
|
+
onValueChange={set('lastName')}
|
|
83
|
+
errorText={errorText.lastName}
|
|
84
|
+
required
|
|
85
|
+
/>
|
|
86
|
+
<Input
|
|
87
|
+
id="profile-email"
|
|
88
|
+
label="Email"
|
|
89
|
+
type="email"
|
|
90
|
+
value={values.email}
|
|
91
|
+
onValueChange={set('email')}
|
|
92
|
+
errorText={errorText.email}
|
|
93
|
+
required
|
|
94
|
+
/>
|
|
95
|
+
</FormSection>
|
|
96
|
+
</form>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* The settings column: one section under another, held to a reading width
|
|
2
|
+
so a row of fields never stretches across a wide screen. Each section
|
|
3
|
+
lays its heading beside its fields once it has the room, and stacks them
|
|
4
|
+
on a phone. */
|
|
5
|
+
|
|
6
|
+
.column {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--gap-1000);
|
|
10
|
+
max-width: 880px;
|
|
11
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings block: the app shell with a column of FormSections, each a
|
|
3
|
+
* heading and a sentence beside its fields, and each saving on its own. The
|
|
4
|
+
* values are placeholders; read and write your own.
|
|
5
|
+
*
|
|
6
|
+
* The profile section is a client form (ProfileForm.tsx beside this page)
|
|
7
|
+
* that checks every field in one pass on save: the errors go to an
|
|
8
|
+
* ErrorSummary at the top of the form and to each field's errorText, both
|
|
9
|
+
* from one record through fieldErrorsFrom. The other sections render from
|
|
10
|
+
* this server page.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Button } from 'rift-ds/components/Button/Button';
|
|
14
|
+
import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
|
|
15
|
+
import { FormSection } from 'rift-ds/components/FormSection/FormSection';
|
|
16
|
+
import { ToggleSwitch } from 'rift-ds/components/ToggleSwitch/ToggleSwitch';
|
|
17
|
+
import { AppShell } from '../../components/blocks/AppShell';
|
|
18
|
+
import { ProfileForm } from './ProfileForm';
|
|
19
|
+
import styles from './page.module.css';
|
|
20
|
+
|
|
21
|
+
export default function SettingsPage() {
|
|
22
|
+
return (
|
|
23
|
+
<AppShell
|
|
24
|
+
activeKey="settings"
|
|
25
|
+
breadcrumb={[{ label: 'Workspace', href: '#' }, { label: 'Settings' }]}
|
|
26
|
+
title="Settings"
|
|
27
|
+
>
|
|
28
|
+
<div className={styles.column}>
|
|
29
|
+
<ProfileForm />
|
|
30
|
+
|
|
31
|
+
<FormSection
|
|
32
|
+
layout="aside"
|
|
33
|
+
divider
|
|
34
|
+
title="Notifications"
|
|
35
|
+
description="What we email you about. Changes apply from the next message."
|
|
36
|
+
actions={<Button label="Save notifications" />}
|
|
37
|
+
>
|
|
38
|
+
<ToggleSwitch label="A weekly summary" defaultChecked />
|
|
39
|
+
<ToggleSwitch label="When someone mentions you" defaultChecked />
|
|
40
|
+
<ToggleSwitch label="Product news" />
|
|
41
|
+
</FormSection>
|
|
42
|
+
|
|
43
|
+
<FormSection
|
|
44
|
+
layout="aside"
|
|
45
|
+
divider
|
|
46
|
+
columns={2}
|
|
47
|
+
title="Region"
|
|
48
|
+
description="How dates, times and numbers are written for you."
|
|
49
|
+
actions={<Button label="Save region" />}
|
|
50
|
+
>
|
|
51
|
+
<Dropdown
|
|
52
|
+
label="Language"
|
|
53
|
+
defaultValue="en"
|
|
54
|
+
options={[
|
|
55
|
+
{ value: 'en', label: 'English' },
|
|
56
|
+
{ value: 'de', label: 'Deutsch' },
|
|
57
|
+
{ value: 'fr', label: 'Français' },
|
|
58
|
+
]}
|
|
59
|
+
/>
|
|
60
|
+
<Dropdown
|
|
61
|
+
label="Time zone"
|
|
62
|
+
defaultValue="utc"
|
|
63
|
+
options={[
|
|
64
|
+
{ value: 'utc', label: 'UTC' },
|
|
65
|
+
{ value: 'cet', label: 'Central European' },
|
|
66
|
+
{ value: 'pt', label: 'Pacific' },
|
|
67
|
+
]}
|
|
68
|
+
/>
|
|
69
|
+
</FormSection>
|
|
70
|
+
|
|
71
|
+
<FormSection
|
|
72
|
+
layout="aside"
|
|
73
|
+
divider
|
|
74
|
+
title="Delete workspace"
|
|
75
|
+
description="Removes the workspace and everything in it. This cannot be undone."
|
|
76
|
+
>
|
|
77
|
+
<div>
|
|
78
|
+
<Button label="Delete workspace" variant="secondary" tone="destructive" />
|
|
79
|
+
</div>
|
|
80
|
+
</FormSection>
|
|
81
|
+
</div>
|
|
82
|
+
</AppShell>
|
|
83
|
+
);
|
|
84
|
+
}
|