rift-ds 1.24.0 → 1.26.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 +5 -4
- package/chat/ChatThreads.d.ts +3 -1
- package/chat/ChatThreads.js +3 -1
- package/chat/ChatWidget.css +166 -15
- package/chat/ChatWidget.d.ts +6 -2
- package/chat/ChatWidget.js +17 -3
- package/components/ActionCard/ActionCard.d.ts +1 -1
- package/components/Attachment/Attachment.css +8 -0
- package/components/Attachment/AttachmentViewer.js +26 -5
- package/components/Attachment/fileTypes.d.ts +4 -0
- package/components/ContextMenu/ContextMenu.css +11 -0
- package/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/components/ContextMenu/ContextMenu.js +3 -1
- package/components/CurrencyInput/CurrencyInput.css +12 -0
- package/components/CurrencyInput/CurrencyInput.d.ts +51 -0
- package/components/CurrencyInput/CurrencyInput.js +158 -0
- package/components/DataTable/columnTypes.js +4 -16
- package/components/DatePicker/DatePicker.d.ts +2 -0
- package/components/DatePicker/DatePicker.js +44 -131
- package/components/DatePicker/MonthGrid.d.ts +56 -0
- package/components/DatePicker/MonthGrid.js +65 -0
- package/components/DatePicker/calendar.d.ts +42 -0
- package/components/DatePicker/calendar.js +108 -0
- package/components/DateRangePicker/DateRangePicker.css +92 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +86 -0
- package/components/DateRangePicker/DateRangePicker.js +294 -0
- package/components/Deadline/Deadline.css +82 -0
- package/components/Deadline/Deadline.d.ts +44 -0
- package/components/Deadline/Deadline.js +94 -0
- package/components/Deadline/deadlineStatus.d.ts +15 -0
- package/components/Deadline/deadlineStatus.js +13 -0
- package/components/DescriptionList/DescriptionList.css +184 -0
- package/components/DescriptionList/DescriptionList.d.ts +64 -0
- package/components/DescriptionList/DescriptionList.js +100 -0
- package/components/DescriptionList/DescriptionListCopy.d.ts +18 -0
- package/components/DescriptionList/DescriptionListCopy.js +45 -0
- package/components/DocumentViewer/DocumentViewer.css +188 -0
- package/components/DocumentViewer/DocumentViewer.d.ts +59 -0
- package/components/DocumentViewer/DocumentViewer.js +185 -0
- package/components/DropdownMenu/DropdownMenu.css +38 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +4 -0
- package/components/DropdownMenu/DropdownMenu.js +11 -5
- package/components/DropdownMenu/ShortcutHint.d.ts +9 -0
- package/components/DropdownMenu/ShortcutHint.js +6 -0
- package/components/ErrorSummary/ErrorSummary.css +94 -0
- package/components/ErrorSummary/ErrorSummary.d.ts +34 -0
- package/components/ErrorSummary/ErrorSummary.js +70 -0
- package/components/ErrorSummary/fieldErrors.d.ts +36 -0
- package/components/ErrorSummary/fieldErrors.js +19 -0
- package/components/Field/Field.css +12 -0
- package/components/Field/Field.d.ts +10 -2
- package/components/Field/Field.js +12 -5
- package/components/Heading/Heading.css +129 -0
- package/components/Heading/Heading.d.ts +31 -0
- package/components/Heading/Heading.js +39 -0
- package/components/Input/Input.css +120 -0
- package/components/Input/Input.d.ts +20 -1
- package/components/Input/Input.js +70 -5
- package/components/InterruptCard/InterruptCard.d.ts +1 -1
- package/components/Link/Link.css +84 -0
- package/components/Link/Link.d.ts +43 -0
- package/components/Link/Link.js +74 -0
- package/components/List/List.css +173 -0
- package/components/List/List.d.ts +44 -0
- package/components/List/List.js +60 -0
- package/components/MaskedInput/MaskedInput.css +16 -0
- package/components/MaskedInput/MaskedInput.d.ts +57 -0
- package/components/MaskedInput/MaskedInput.js +142 -0
- package/components/MaskedInput/mask.d.ts +58 -0
- package/components/MaskedInput/mask.js +106 -0
- package/components/MessageCard/MessageCard.css +17 -6
- package/components/MessageCard/MessageCard.d.ts +1 -1
- package/components/ShaderScene/ShaderScene.css +19 -0
- package/components/ShaderScene/ShaderScene.d.ts +82 -0
- package/components/ShaderScene/ShaderScene.js +167 -0
- package/components/ShaderScene/assemble.d.ts +5 -0
- package/components/ShaderScene/assemble.js +76 -0
- package/components/ShaderScene/common.glsl.d.ts +6 -0
- package/components/ShaderScene/common.glsl.js +49 -0
- package/components/ShaderScene/passes.d.ts +2 -0
- package/components/ShaderScene/passes.js +93 -0
- package/components/ShaderScene/renderer.d.ts +39 -0
- package/components/ShaderScene/renderer.js +170 -0
- package/components/ShaderScene/scenes.d.ts +76 -0
- package/components/ShaderScene/scenes.js +752 -0
- package/components/ShaderScene/types.d.ts +83 -0
- package/components/ShaderScene/types.js +8 -0
- package/components/SignaturePad/SignaturePad.css +141 -0
- package/components/SignaturePad/SignaturePad.d.ts +68 -0
- package/components/SignaturePad/SignaturePad.js +287 -0
- package/components/SignaturePad/signature.d.ts +32 -0
- package/components/SignaturePad/signature.js +46 -0
- package/components/Text/Text.css +129 -0
- package/components/Text/Text.d.ts +36 -0
- package/components/Text/Text.js +36 -0
- package/components/ThreadPanel/ThreadPanel.css +29 -0
- package/components/ThreadPanel/ThreadPanel.d.ts +2 -0
- package/components/ThreadPanel/ThreadPanel.js +13 -2
- package/components/Widget/Widget.css +111 -0
- package/components/Widget/Widget.d.ts +15 -1
- package/components/Widget/Widget.js +63 -11
- package/components/Widget/WidgetDisclosure.d.ts +30 -0
- package/components/Widget/WidgetDisclosure.js +52 -0
- package/components/registry.json +111 -2
- package/components/registry.json.d.ts +111 -2
- package/components/registry.json.js +2 -2
- package/format/index.d.ts +15 -0
- package/format/index.js +17 -0
- package/format/money.d.ts +89 -0
- package/format/money.js +187 -0
- package/format/relative.d.ts +49 -0
- package/format/relative.js +50 -0
- package/index.d.ts +13 -0
- package/index.js +48 -1
- package/package.json +9 -2
- package/tokens/motion.d.ts +4 -0
- package/tokens/motion.js +4 -0
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ 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 -->178<!-- /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
|
+
- **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.
|
|
17
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.
|
|
18
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.
|
|
19
20
|
- **Ready for coding agents.** One command installs the agent skills, and a public MCP endpoint serves every component's props, so your agent builds with the library as it actually is. No key, no account.
|
|
@@ -107,13 +108,13 @@ import 'rift-ds/tokens/presets/presets.css';
|
|
|
107
108
|
|
|
108
109
|
## Components
|
|
109
110
|
|
|
110
|
-
<!-- component-count -->
|
|
111
|
+
<!-- component-count -->178<!-- /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).
|
|
111
112
|
|
|
112
113
|
<details>
|
|
113
114
|
<summary>The full list</summary>
|
|
114
115
|
|
|
115
116
|
<!-- component-list:start -->
|
|
116
|
-
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 · Data table · Date input · Date picker · Dialog · Divider · Document chip · Drawer · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Event calendar · Field · Figure · File input · Filter bar · Funnel chart · Gantt chart · Gauge · Globe · 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 list · Map callout · Map legend · 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 · Sidebar panel · 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 · 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
|
|
117
|
+
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
|
|
117
118
|
<!-- component-list:end -->
|
|
118
119
|
|
|
119
120
|
</details>
|
|
@@ -124,7 +125,7 @@ Accordion · Action card · Action readout · Agent plan · Agent rail · Agent
|
|
|
124
125
|
- **Vite 7**: dev server and library build
|
|
125
126
|
- **Next.js 16**: the documentation site
|
|
126
127
|
- **Storybook 10**: component explorer
|
|
127
|
-
- **Vitest + Playwright + axe**: every Storybook story runs as a render test in headless Chromium, with an accessibility audit on each
|
|
128
|
+
- **Vitest + Playwright + axe**: every Storybook story runs as a render test in headless Chromium, with an accessibility audit on each, and the pure helpers have unit tests in Node
|
|
128
129
|
- **TanStack Table + TanStack Virtual**: the headless engine and the windowing under `DataTable`, the package's runtime dependencies
|
|
129
130
|
- **CSS custom properties**: all theming via semantic tokens, no CSS-in-JS
|
|
130
131
|
|
package/chat/ChatThreads.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface ChatThreadsProps {
|
|
|
13
13
|
profile?: ThreadPanelProfile;
|
|
14
14
|
/** Rendered in the rail's footer in both seats (above the profile row on the inline rail; the sheet has none): a theme toggle, a link out. Fades out while the inline rail is collapsed. */
|
|
15
15
|
footerSlot?: ReactNode;
|
|
16
|
+
/** Rendered in the inline rail's footer while it is collapsed, in `footerSlot`'s place: the same controls at their smallest, stacked on the rail's axis, crossfading with the full form. The sheet never collapses, so it never shows. */
|
|
17
|
+
collapsedFooterSlot?: ReactNode;
|
|
16
18
|
/** Whether the inline rail can collapse to its icon strip. */
|
|
17
19
|
collapsible?: boolean;
|
|
18
20
|
/**
|
|
@@ -40,4 +42,4 @@ export interface ChatThreadsProps {
|
|
|
40
42
|
* thread lifecycle (`useThreads`). The widget seats it inline on a wide
|
|
41
43
|
* host and as a slide-over sheet on a narrow one, and tells it which.
|
|
42
44
|
*/
|
|
43
|
-
export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, collapsible, defaultExpanded, historyLabel, threadPanelLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
|
|
45
|
+
export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, collapsedFooterSlot, collapsible, defaultExpanded, historyLabel, threadPanelLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
|
package/chat/ChatThreads.js
CHANGED
|
@@ -10,6 +10,7 @@ function ChatThreads({
|
|
|
10
10
|
logoText,
|
|
11
11
|
profile,
|
|
12
12
|
footerSlot,
|
|
13
|
+
collapsedFooterSlot,
|
|
13
14
|
collapsible = true,
|
|
14
15
|
defaultExpanded = false,
|
|
15
16
|
historyLabel = "Chat history",
|
|
@@ -67,7 +68,8 @@ function ChatThreads({
|
|
|
67
68
|
expanded: overlay || !collapsible ? true : expanded,
|
|
68
69
|
onExpandedChange: overlay || !collapsible ? void 0 : setExpanded,
|
|
69
70
|
profile: overlay ? void 0 : profile,
|
|
70
|
-
footerSlot
|
|
71
|
+
footerSlot,
|
|
72
|
+
collapsedFooterSlot: overlay ? void 0 : collapsedFooterSlot
|
|
71
73
|
}
|
|
72
74
|
);
|
|
73
75
|
}
|
package/chat/ChatWidget.css
CHANGED
|
@@ -247,6 +247,77 @@
|
|
|
247
247
|
padding: var(--gap-1000) var(--ds-chat-widget-inset) var(--padding-400);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/* ============================================
|
|
251
|
+
THE WELCOME'S ENTRANCE
|
|
252
|
+
A fresh welcome arrives rather than appears: the composer rises in at
|
|
253
|
+
once, the thing to type into first; then the greeting, and then the
|
|
254
|
+
widget board's tiles pop in one after another, a dashboard assembling
|
|
255
|
+
itself. The overlay and the slot mount afresh on every new chat, so it
|
|
256
|
+
plays each time. The greeting and the tiles wait a short beat first
|
|
257
|
+
(--ds-chat-widget-welcome-hold, the deliberate duration by default), the
|
|
258
|
+
composer alone standing on the ground, so the ground itself (a shader
|
|
259
|
+
scene, the page) registers before the board lands on it; a host sets
|
|
260
|
+
the property on the widget or an ancestor to lengthen the wait or zero
|
|
261
|
+
it. The composer is read through the overlay's presence, since it stays
|
|
262
|
+
mounted into the conversation. Every length is a motion token or a
|
|
263
|
+
multiple of one, so reduced motion collapses the sequence to an instant.
|
|
264
|
+
The fill is backwards only: hidden through the hold, and once in, no
|
|
265
|
+
filled frame is left behind, so no transform lingers to become a
|
|
266
|
+
containing block under the composer's popovers.
|
|
267
|
+
============================================ */
|
|
268
|
+
|
|
269
|
+
.ds-chat-widget:has(.ds-chat-widget__welcome) .ds-chat-widget__composer {
|
|
270
|
+
animation: ds-chat-widget-welcome-in var(--motion-duration-slower) var(--motion-ease-entrance) backwards;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.ds-chat-widget__greeting {
|
|
274
|
+
animation: ds-chat-widget-welcome-in var(--motion-duration-slow) var(--motion-ease-entrance) backwards;
|
|
275
|
+
animation-delay: var(--ds-chat-widget-welcome-hold, var(--motion-duration-deliberate));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@keyframes ds-chat-widget-welcome-in {
|
|
279
|
+
from {
|
|
280
|
+
opacity: 0;
|
|
281
|
+
transform: translateY(var(--gap-200));
|
|
282
|
+
}
|
|
283
|
+
to {
|
|
284
|
+
opacity: 1;
|
|
285
|
+
transform: none;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* The tiles, each a quick step after the last, starting as the greeting
|
|
290
|
+
is still rising, on the same structural duration as the greeting, so
|
|
291
|
+
the board snaps together; anything in the slot that is not a tile grid
|
|
292
|
+
arrives as one piece. */
|
|
293
|
+
.ds-chat-widget__widgets .ds-widget-grid > *,
|
|
294
|
+
.ds-chat-widget__widgets > :not(.ds-widget-grid) {
|
|
295
|
+
--ds-chat-widget-tile: 0;
|
|
296
|
+
animation: ds-chat-widget-tile-in var(--motion-duration-slow) var(--motion-ease-entrance) backwards;
|
|
297
|
+
animation-delay: calc(
|
|
298
|
+
var(--ds-chat-widget-welcome-hold, var(--motion-duration-deliberate)) + var(--motion-duration-base) +
|
|
299
|
+
var(--ds-chat-widget-tile) * var(--motion-duration-fast) * 0.6
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(2) { --ds-chat-widget-tile: 1; }
|
|
304
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(3) { --ds-chat-widget-tile: 2; }
|
|
305
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(4) { --ds-chat-widget-tile: 3; }
|
|
306
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(5) { --ds-chat-widget-tile: 4; }
|
|
307
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(6) { --ds-chat-widget-tile: 5; }
|
|
308
|
+
.ds-chat-widget__widgets .ds-widget-grid > :nth-child(n + 7) { --ds-chat-widget-tile: 6; }
|
|
309
|
+
|
|
310
|
+
@keyframes ds-chat-widget-tile-in {
|
|
311
|
+
from {
|
|
312
|
+
opacity: 0;
|
|
313
|
+
transform: translateY(var(--gap-400)) scale(0.94);
|
|
314
|
+
}
|
|
315
|
+
to {
|
|
316
|
+
opacity: 1;
|
|
317
|
+
transform: none;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
250
321
|
/* With widgets the composer holds the same dead centre the starters give
|
|
251
322
|
it: the region keeps the zero basis, so the slack splits evenly and the
|
|
252
323
|
widgets hang below the composer. Its content is its floor (a flex item's
|
|
@@ -769,11 +840,12 @@
|
|
|
769
840
|
gives it back before the conversation drops under its floor (the 320px
|
|
770
841
|
mirrors ARTIFACT_MIN_COLUMN_WIDTH in queries.ts). */
|
|
771
842
|
.ds-chat-widget__rails[data-artifact-sized] > .ds-chat-widget__artifact-rail--open {
|
|
772
|
-
flex: 0 1 var(--ds-chat-artifact-width);
|
|
843
|
+
flex: 0 1 min(var(--ds-chat-artifact-width), var(--ds-chat-artifact-room, var(--ds-chat-artifact-width)));
|
|
773
844
|
}
|
|
774
845
|
|
|
775
846
|
.ds-chat-widget__rails[data-artifact-sized] > .ds-chat-widget {
|
|
776
|
-
flex: 1 0
|
|
847
|
+
flex: 1 0 0;
|
|
848
|
+
min-width: 320px;
|
|
777
849
|
}
|
|
778
850
|
|
|
779
851
|
/* The pointer drives the width frame by frame, so the glides stand down
|
|
@@ -830,16 +902,44 @@
|
|
|
830
902
|
background: var(--color-text-secondary);
|
|
831
903
|
}
|
|
832
904
|
|
|
833
|
-
/* Expanded, the artifact
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
.
|
|
837
|
-
|
|
838
|
-
|
|
905
|
+
/* Expanded, the artifact takes the conversation's room: the conversation
|
|
906
|
+
folds to nothing beside it (fading first, so its reflow is never seen,
|
|
907
|
+
then leaving the tab order once the fold has finished) while the card
|
|
908
|
+
glides across and takes an inset on its leading edge too. The history
|
|
909
|
+
rail keeps its place. Collapsing runs the same glide back, the
|
|
910
|
+
conversation fading in once it has its room again.
|
|
911
|
+
Only the two grow shares move (the conversation's from 1 to 0, the
|
|
912
|
+
card's from 0 to 1, in the expanded seat rule further down); both bases hold
|
|
913
|
+
still, since a basis gliding against a share bows the split and the
|
|
914
|
+
conversation swells before it folds. The grip's floor for the
|
|
915
|
+
conversation steps aside at once on the way out and returns only once
|
|
916
|
+
the way back has finished, so it never shoves the glide. */
|
|
917
|
+
.ds-chat-widget__rails > .ds-chat-widget {
|
|
918
|
+
transition:
|
|
919
|
+
flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
920
|
+
opacity var(--motion-duration-base) var(--motion-ease-standard) calc(var(--motion-duration-slow) - var(--motion-duration-base)),
|
|
921
|
+
/* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
|
|
922
|
+
|
|
923
|
+
min-width 0s linear var(--motion-duration-slow),
|
|
924
|
+
visibility 0s linear 0s;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget {
|
|
928
|
+
flex-grow: 0;
|
|
929
|
+
min-width: 0;
|
|
930
|
+
opacity: 0;
|
|
931
|
+
visibility: hidden;
|
|
932
|
+
overflow: hidden;
|
|
933
|
+
transition:
|
|
934
|
+
flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
935
|
+
opacity var(--motion-duration-fast) var(--motion-ease-standard),
|
|
936
|
+
/* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
|
|
937
|
+
|
|
938
|
+
min-width 0s linear 0s,
|
|
939
|
+
visibility 0s linear var(--motion-duration-slow);
|
|
839
940
|
}
|
|
840
941
|
|
|
841
942
|
.ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
|
|
842
|
-
flex: 1 1 0;
|
|
843
943
|
margin-inline-start: var(--padding-500);
|
|
844
944
|
}
|
|
845
945
|
|
|
@@ -1340,10 +1440,16 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
|
|
|
1340
1440
|
(held to the room), so the open is the same glide every time; the
|
|
1341
1441
|
grip's width takes over once the reader drags it, and the expanded
|
|
1342
1442
|
state still takes the whole row. */
|
|
1343
|
-
.ds-chat-widget__rails:not([data-artifact-sized]
|
|
1443
|
+
.ds-chat-widget__rails:not([data-artifact-sized]) > .ds-chat-widget__artifact-rail--open {
|
|
1344
1444
|
flex: 0 1 min(var(--ds-chat-artifact-rest-width), var(--ds-chat-artifact-room, var(--ds-chat-artifact-rest-width)));
|
|
1345
1445
|
}
|
|
1346
1446
|
|
|
1447
|
+
/* Expanded, the seat keeps its basis (resting or the grip's) and takes a
|
|
1448
|
+
grow share, so the glide is the shares trading and nothing else. */
|
|
1449
|
+
.ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
|
|
1450
|
+
flex-grow: 1;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1347
1453
|
/* ============================================
|
|
1348
1454
|
SHELL MODES (the layout prop)
|
|
1349
1455
|
A host where the chat is the page seats it in one of the three app
|
|
@@ -1422,6 +1528,15 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
|
|
|
1422
1528
|
overflow: hidden;
|
|
1423
1529
|
}
|
|
1424
1530
|
|
|
1531
|
+
/* The raised surface clips to its corners, but the scrolling welcome page
|
|
1532
|
+
is the surface itself scrolling (the scroll layout above makes the root
|
|
1533
|
+
the scroller), so inset keeps the clip on the inline axis and lets the
|
|
1534
|
+
block axis scroll; otherwise a long dashboard sits cut off at the foot
|
|
1535
|
+
with no way to reach the rest of it. */
|
|
1536
|
+
.ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget[data-widgets='scroll'] {
|
|
1537
|
+
overflow-y: auto;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1425
1540
|
/* The seats hold the gap above and below in both states, so the glide is
|
|
1426
1541
|
the width alone. */
|
|
1427
1542
|
.ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__aside-rail,
|
|
@@ -1434,6 +1549,39 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
|
|
|
1434
1549
|
margin-inline-end: var(--ds-shell-gap);
|
|
1435
1550
|
}
|
|
1436
1551
|
|
|
1552
|
+
/* Expanded, the raised conversation folds its gap and hairline away with
|
|
1553
|
+
its width, and the card takes the conversation's exact seat: flush to
|
|
1554
|
+
the history rail, as the conversation was, with no inset of its own. */
|
|
1555
|
+
.ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget {
|
|
1556
|
+
transition:
|
|
1557
|
+
flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1558
|
+
margin var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1559
|
+
border-width var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1560
|
+
opacity var(--motion-duration-base) var(--motion-ease-standard) calc(var(--motion-duration-slow) - var(--motion-duration-base)),
|
|
1561
|
+
/* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
|
|
1562
|
+
|
|
1563
|
+
min-width 0s linear var(--motion-duration-slow),
|
|
1564
|
+
visibility 0s linear 0s;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
.ds-chat-widget__rails[data-ds-shell='inset'][data-artifact-expanded] > .ds-chat-widget {
|
|
1568
|
+
margin-inline-end: 0;
|
|
1569
|
+
border-inline-width: 0;
|
|
1570
|
+
transition:
|
|
1571
|
+
flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1572
|
+
margin var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1573
|
+
border-width var(--motion-duration-slow) var(--motion-ease-emphasized),
|
|
1574
|
+
opacity var(--motion-duration-fast) var(--motion-ease-standard),
|
|
1575
|
+
/* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
|
|
1576
|
+
|
|
1577
|
+
min-width 0s linear 0s,
|
|
1578
|
+
visibility 0s linear var(--motion-duration-slow);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
.ds-chat-widget__rails[data-ds-shell='inset'][data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
|
|
1582
|
+
margin-inline-start: 0;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1437
1585
|
.ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__aside-rail-inner,
|
|
1438
1586
|
.ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner {
|
|
1439
1587
|
background-color: var(--ds-shell-surface);
|
|
@@ -1460,12 +1608,15 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
|
|
|
1460
1608
|
display: none;
|
|
1461
1609
|
}
|
|
1462
1610
|
|
|
1463
|
-
/* The artifact header keeps room at its end for the
|
|
1464
|
-
default
|
|
1465
|
-
|
|
1466
|
-
|
|
1611
|
+
/* The artifact header keeps room at its end for the floating controls (as
|
|
1612
|
+
many default controls as the cluster holds, each with the controls' own
|
|
1613
|
+
gap), so its view toggle and expand sit beside them as one cluster and
|
|
1614
|
+
never pass under them as the card arrives; its close is the header
|
|
1615
|
+
toggle's action, so it goes. */
|
|
1467
1616
|
.ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner .ds-artifact-panel__header {
|
|
1468
|
-
padding-inline-end: calc(
|
|
1617
|
+
padding-inline-end: calc(
|
|
1618
|
+
var(--padding-300) + var(--ds-chat-action-count, 2) * (var(--control-height-default) + var(--gap-100))
|
|
1619
|
+
);
|
|
1469
1620
|
}
|
|
1470
1621
|
|
|
1471
1622
|
.ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner .ds-artifact-panel__controls > :last-child {
|
package/chat/ChatWidget.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface ChatWidgetProps {
|
|
|
159
159
|
}) => ReactNode;
|
|
160
160
|
/** The built-in agent pane: who the agent is and what it has been doing. Seated like `aside`. */
|
|
161
161
|
agent?: ChatAgentOptions;
|
|
162
|
-
/** Seat the artifact panel: a reply that carries an artifact draws a tile in the thread, and the tile (or the header's artifact button) opens the artifact beside the conversation on a wide host and as a bottom sheet on a narrow one. The trailing seat holds one panel at a time, so an open artifact stands in for the agent pane. Off, none of it exists: no header button, no tile, no panel. */
|
|
162
|
+
/** Seat the artifact panel: a reply that carries an artifact draws a tile in the thread, and the tile (or the header's artifact button) opens the artifact beside the conversation on a wide host and as a bottom sheet on a narrow one. The trailing seat holds one panel at a time, so an open artifact stands in for the agent pane. The panel's expand toggle gives it the conversation's room, never the history's: the history rail keeps its place, and Escape steps back. Off, none of it exists: no header button, no tile, no panel. */
|
|
163
163
|
artifacts?: boolean;
|
|
164
164
|
/** What the chat is looking at, named on the composer's context note: a page, a selection, a passage. Omit for none. A host whose context follows the reader (rows they ticked, text they highlighted) updates it as they go, and can offer a way back and repeat it on each message sent. */
|
|
165
165
|
context?: ChatContext | null;
|
|
@@ -255,6 +255,10 @@ export interface ChatWidgetProps {
|
|
|
255
255
|
composerLabels?: Pick<ComposerProps, 'attachLabel' | 'dropLabel' | 'filesLabel' | 'attachmentTileLabels' | 'stopLabel' | 'aria-label' | 'formatFileAnnouncement' | 'formatMentionAnnouncement'>;
|
|
256
256
|
/** The drop overlay's headline when a file is dragged over the chat with attachments on, over AttachmentDropZone's "Drop files to attach". Its second line is `attachHint`. */
|
|
257
257
|
attachmentDropZoneLabels?: Pick<AttachmentDropZoneProps, 'label'>;
|
|
258
|
+
/** Draws a sent file in the viewer its tile opens, in place of the built-in view: a document renderer of the host's own, a spreadsheet. Return nothing to keep the built-in view, which shows pictures, pasted text, and a PDF or a text file that carries a `fileUrl`. */
|
|
259
|
+
renderAttachmentPreview?: AttachmentGroupProps['renderPreview'];
|
|
260
|
+
/** Called with a sent file when the viewer's Download is pressed. Its presence renders the button. */
|
|
261
|
+
onAttachmentDownload?: AttachmentGroupProps['onDownload'];
|
|
258
262
|
/** The words of the files on a sent message, over AttachmentGroup's English defaults: the list's name ("Attachments"), the overflow buttons ("Show 3 more", "Show fewer"), the tiles' status lines (`attachmentTileLabels`) and the viewer a pressed file opens in (`attachmentViewerLabels`). */
|
|
259
263
|
attachmentGroupLabels?: Pick<AttachmentGroupProps, 'label' | 'showMoreLabel' | 'showLessLabel' | 'attachmentTileLabels' | 'attachmentViewerLabels'>;
|
|
260
264
|
/** The conversation's names, over ChatThread's English defaults: the scrolling region ("Conversation") and the scroll-to-latest control ("Scroll to the latest message"). */
|
|
@@ -282,4 +286,4 @@ export interface ChatWidgetProps {
|
|
|
282
286
|
* a stage card, a whole page). It reads all of its state from ChatProvider,
|
|
283
287
|
* so the conversation is the same object wherever it shows.
|
|
284
288
|
*/
|
|
285
|
-
export declare function ChatWidget({ fullscreenEnabled, layout, backdrop, closeEnabled, placementEnabled, compact, phone, title, flow, placeholder, questionsPlaceholder, showStarters, logo, tagline, starters: startersInput, startersKey, startersPending, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, context: contextProp, contextClearLabel, contextLabel, contextNote, contextPlacement, attachHint: attachHintText, greetings, placementLabels, agentStatus, artifactPanelTitle, artifactEmptyTitle, artifactEmptyDescription, widgets, widgetsLayout, widgetsWidth, disclaimer, startersLabel, newChatLabel, showAgentLabel, hideAgentLabel, closeAgentLabel, showArtifactLabel, hideArtifactLabel, closeArtifactLabel, placementLabel, enterFullscreenLabel, exitFullscreenLabel, closeLabel, openThreadsLabel, closeThreadsLabel, modelPickerLabel, sendLabel, copyResponseLabel, copiedResponseLabel, copiedAnnouncementLabel, goodResponseLabel, badResponseLabel, followupsLabel, pastedTextLabel, reasoningLabel, tabsProps, composerLabels, attachmentDropZoneLabels, attachmentGroupLabels, chatThreadLabels, modelPickerLabels, artifactPanelLabels, agentRailLabels, questionCardLabels, questionSummaryLabels, codeBlockLabels, promptSuggestionsLabels, }: ChatWidgetProps): import("react").JSX.Element;
|
|
289
|
+
export declare function ChatWidget({ fullscreenEnabled, layout, backdrop, closeEnabled, placementEnabled, compact, phone, title, flow, placeholder, questionsPlaceholder, showStarters, logo, tagline, starters: startersInput, startersKey, startersPending, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, context: contextProp, contextClearLabel, contextLabel, contextNote, contextPlacement, attachHint: attachHintText, greetings, placementLabels, agentStatus, artifactPanelTitle, artifactEmptyTitle, artifactEmptyDescription, widgets, widgetsLayout, widgetsWidth, disclaimer, startersLabel, newChatLabel, showAgentLabel, hideAgentLabel, closeAgentLabel, showArtifactLabel, hideArtifactLabel, closeArtifactLabel, placementLabel, enterFullscreenLabel, exitFullscreenLabel, closeLabel, openThreadsLabel, closeThreadsLabel, modelPickerLabel, sendLabel, copyResponseLabel, copiedResponseLabel, copiedAnnouncementLabel, goodResponseLabel, badResponseLabel, followupsLabel, pastedTextLabel, reasoningLabel, tabsProps, composerLabels, attachmentDropZoneLabels, attachmentGroupLabels, renderAttachmentPreview, onAttachmentDownload, chatThreadLabels, modelPickerLabels, artifactPanelLabels, agentRailLabels, questionCardLabels, questionSummaryLabels, codeBlockLabels, promptSuggestionsLabels, }: ChatWidgetProps): import("react").JSX.Element;
|
package/chat/ChatWidget.js
CHANGED
|
@@ -120,6 +120,8 @@ function ChatWidget({
|
|
|
120
120
|
composerLabels,
|
|
121
121
|
attachmentDropZoneLabels,
|
|
122
122
|
attachmentGroupLabels,
|
|
123
|
+
renderAttachmentPreview,
|
|
124
|
+
onAttachmentDownload,
|
|
123
125
|
chatThreadLabels,
|
|
124
126
|
modelPickerLabels,
|
|
125
127
|
artifactPanelLabels,
|
|
@@ -384,7 +386,7 @@ function ChatWidget({
|
|
|
384
386
|
}
|
|
385
387
|
}, [artifacts, turns, openArtifact]);
|
|
386
388
|
const trailingUp = artifactInline || Boolean(renderAside) && asideOpen && asideWide;
|
|
387
|
-
const threadsInline = threadsWide && !(trailingUp &&
|
|
389
|
+
const threadsInline = threadsWide && !(trailingUp && !asideRoomy);
|
|
388
390
|
useEffect(() => {
|
|
389
391
|
if (!artifacts) return;
|
|
390
392
|
const host = railsHostRef.current;
|
|
@@ -642,7 +644,16 @@ function ChatWidget({
|
|
|
642
644
|
ChatMessage,
|
|
643
645
|
{
|
|
644
646
|
role: "user",
|
|
645
|
-
attachments: turn.attachments ? /* @__PURE__ */ jsx(
|
|
647
|
+
attachments: turn.attachments ? /* @__PURE__ */ jsx(
|
|
648
|
+
AttachmentGroup,
|
|
649
|
+
{
|
|
650
|
+
...attachmentGroupLabels,
|
|
651
|
+
align: "end",
|
|
652
|
+
items: turn.attachments,
|
|
653
|
+
renderPreview: renderAttachmentPreview,
|
|
654
|
+
onDownload: onAttachmentDownload
|
|
655
|
+
}
|
|
656
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
646
657
|
turn.content,
|
|
647
658
|
turnCards(turn).map((card, index) => /* @__PURE__ */ jsx(TurnCard, { card }, index))
|
|
648
659
|
] }),
|
|
@@ -735,7 +746,10 @@ function ChatWidget({
|
|
|
735
746
|
"data-artifact-expanded": artifactExpanded || void 0,
|
|
736
747
|
"data-artifact-sized": artifactWidth !== null || artifactResizing || void 0,
|
|
737
748
|
"data-artifact-resizing": artifactResizing || void 0,
|
|
738
|
-
style:
|
|
749
|
+
style: {
|
|
750
|
+
"--ds-chat-action-count": actionCount,
|
|
751
|
+
...artifactWidth !== null ? { "--ds-chat-artifact-width": `${artifactWidth}px` } : {}
|
|
752
|
+
},
|
|
739
753
|
onKeyDown: (event) => {
|
|
740
754
|
if (event.key === "Escape" && artifactExpanded && !event.defaultPrevented) {
|
|
741
755
|
event.stopPropagation();
|
|
@@ -10,7 +10,7 @@ type ActionCardOwnProps = {
|
|
|
10
10
|
detail?: React.ReactNode;
|
|
11
11
|
/** What the change will do, a line each, as ActionReadout lists what one did: shown over Confirm, then kept, under the receipt, by the confirmed record. A dismissed or undone card is one row and shows none. Write them for the state the card is in. */
|
|
12
12
|
facts?: ActionReadoutFact[];
|
|
13
|
-
/** The
|
|
13
|
+
/** The mark trailing the title: a Material Symbol name, or your own element. */
|
|
14
14
|
icon?: string | React.ReactNode;
|
|
15
15
|
/** Where the change stands. Fully controlled by design: the host makes the change, so it owns whether it was made. `proposed` offers Confirm and Dismiss; the others are the card's record. Defaults to `proposed`. */
|
|
16
16
|
status?: ActionCardStatus;
|
|
@@ -812,6 +812,14 @@ button.ds-attachment-group__single:focus-visible {
|
|
|
812
812
|
background-size: 26px 26px;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
+
.ds-attachment-viewer__document {
|
|
816
|
+
align-self: stretch;
|
|
817
|
+
flex: 1 1 auto;
|
|
818
|
+
min-width: 0;
|
|
819
|
+
border-radius: var(--radius-200);
|
|
820
|
+
background-color: var(--color-bg-container-primary);
|
|
821
|
+
}
|
|
822
|
+
|
|
815
823
|
.ds-attachment-viewer__image {
|
|
816
824
|
display: block;
|
|
817
825
|
max-width: 100%;
|
|
@@ -5,6 +5,7 @@ import ReactDOM from "react-dom";
|
|
|
5
5
|
import { Button } from "../Button/Button.js";
|
|
6
6
|
import { CircularButton } from "../CircularButton/CircularButton.js";
|
|
7
7
|
import { formatBytes } from "./fileTypes.js";
|
|
8
|
+
import { DocumentViewer } from "../DocumentViewer/DocumentViewer.js";
|
|
8
9
|
import { renderTypeMark } from "./typeMark.js";
|
|
9
10
|
import { useMounted } from "../../behaviors/useMounted.js";
|
|
10
11
|
import { useLayer } from "../../behaviors/useLayer.js";
|
|
@@ -80,10 +81,15 @@ const AttachmentViewer = React.forwardRef(
|
|
|
80
81
|
if (item) {
|
|
81
82
|
const failed = item.status === "error" || item.status === "unavailable";
|
|
82
83
|
const custom = failed ? void 0 : renderPreview?.(item);
|
|
83
|
-
const imageSrc = item.src ?? item.previewSrc;
|
|
84
|
-
|
|
84
|
+
const imageSrc = item.src ?? item.previewSrc ?? (item.kind === "image" ? item.fileUrl : void 0);
|
|
85
|
+
const documentKind = item.kind === "pdf" || item.kind === "text" || item.kind === "code";
|
|
86
|
+
const showDocument = !failed && documentKind && Boolean(item.fileUrl);
|
|
87
|
+
const hasCustom = custom !== void 0 && custom !== null && custom !== false;
|
|
88
|
+
let emptyStage = null;
|
|
89
|
+
if (hasCustom) {
|
|
85
90
|
stage = custom;
|
|
86
|
-
} else if (
|
|
91
|
+
} else if (showDocument) ;
|
|
92
|
+
else if (!failed && imageSrc) {
|
|
87
93
|
stage = /* @__PURE__ */ jsx(
|
|
88
94
|
"img",
|
|
89
95
|
{
|
|
@@ -94,8 +100,9 @@ const AttachmentViewer = React.forwardRef(
|
|
|
94
100
|
);
|
|
95
101
|
} else if (!failed && item.excerpt) {
|
|
96
102
|
stage = /* @__PURE__ */ jsx("p", { className: `${baseClass}__text`, children: item.excerpt });
|
|
97
|
-
}
|
|
98
|
-
|
|
103
|
+
}
|
|
104
|
+
if (!hasCustom && stage === null) {
|
|
105
|
+
emptyStage = /* @__PURE__ */ jsxs("div", { className: `${baseClass}__empty`, children: [
|
|
99
106
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__empty-mark`, children: renderTypeMark(item.name, item.kind, { typeLabel: item.typeLabel }) }),
|
|
100
107
|
/* @__PURE__ */ jsx("p", { className: `${baseClass}__empty-title`, children: failed ? failedLabel : noPreviewLabel }),
|
|
101
108
|
/* @__PURE__ */ jsx("p", { className: `${baseClass}__empty-detail`, children: failed ? item.error ?? failedDescription : [item.name, sizeText].filter(Boolean).join(" · ") }),
|
|
@@ -121,6 +128,20 @@ const AttachmentViewer = React.forwardRef(
|
|
|
121
128
|
)
|
|
122
129
|
] })
|
|
123
130
|
] });
|
|
131
|
+
stage = showDocument ? /* @__PURE__ */ jsx(
|
|
132
|
+
DocumentViewer,
|
|
133
|
+
{
|
|
134
|
+
className: `${baseClass}__document`,
|
|
135
|
+
bare: true,
|
|
136
|
+
src: item.fileUrl ?? "",
|
|
137
|
+
title: item.name,
|
|
138
|
+
fileName: item.name,
|
|
139
|
+
mimeType: item.mimeType,
|
|
140
|
+
download: false,
|
|
141
|
+
openInNewTab: false,
|
|
142
|
+
fallback: emptyStage
|
|
143
|
+
}
|
|
144
|
+
) : emptyStage;
|
|
124
145
|
}
|
|
125
146
|
}
|
|
126
147
|
const viewer = /* @__PURE__ */ jsxs("div", { className: containerClasses, children: [
|
|
@@ -102,6 +102,10 @@ export interface AttachmentItem {
|
|
|
102
102
|
/** Full-size image for the viewer, when the preview is a thumbnail.
|
|
103
103
|
Defaults to `previewSrc`. */
|
|
104
104
|
src?: string;
|
|
105
|
+
/** The file itself, for the viewer to show a PDF or a text file in place
|
|
106
|
+
(through DocumentViewer) and for a picture with no `src`. Distinct
|
|
107
|
+
from `src`, which is always an image. */
|
|
108
|
+
fileUrl?: string;
|
|
105
109
|
/** Intrinsic width of the preview, to reserve its shape before it loads. */
|
|
106
110
|
width?: number;
|
|
107
111
|
/** Intrinsic height of the preview. */
|
|
@@ -163,6 +163,17 @@
|
|
|
163
163
|
line-height: 1;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/* A trailing icon (an external link's open_in_new), as in DropdownMenu. */
|
|
167
|
+
.ds-context-menu__item-icon-right {
|
|
168
|
+
--icon-size: var(--icon-size-500);
|
|
169
|
+
color: var(--color-icon-secondary);
|
|
170
|
+
flex-shrink: 0;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
margin-inline-start: auto;
|
|
174
|
+
line-height: 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
166
177
|
/* ============================================
|
|
167
178
|
KEYBOARD SHORTCUT
|
|
168
179
|
============================================ */
|
|
@@ -3,7 +3,7 @@ import { DropdownMenuEntry } from '../DropdownMenu/DropdownMenu';
|
|
|
3
3
|
import { ShortcutKeyLabels } from '../../behaviors/shortcut-keys';
|
|
4
4
|
/** Props owned by ContextMenu itself — everything else falls through to the wrapper div. */
|
|
5
5
|
type ContextMenuOwnProps = {
|
|
6
|
-
/** Menu entries —
|
|
6
|
+
/** Menu entries — DropdownMenu's model (items, groups, separators). A context menu draws an item's label, icon, shortcut, selected and destructive states; it does not draw `description` or `checked`, and `closeOnSelect` is not read. */
|
|
7
7
|
items: DropdownMenuEntry[];
|
|
8
8
|
/** Component size */
|
|
9
9
|
size?: 'default' | 'compact';
|
|
@@ -6,7 +6,7 @@ import { useLayer } from "../../behaviors/useLayer.js";
|
|
|
6
6
|
import { MOTION_HOVER_HIDE_DELAY_MS } from "../../tokens/motion.js";
|
|
7
7
|
import "./ContextMenu.css";
|
|
8
8
|
import "../../fonts/material-symbols.css";
|
|
9
|
-
import { MenuKeyLabelsContext, MenuShortcutHint } from "../DropdownMenu/ShortcutHint.js";
|
|
9
|
+
import { MenuKeyLabelsContext, MenuShortcutHint, MenuIconRight } from "../DropdownMenu/ShortcutHint.js";
|
|
10
10
|
import { shortcutAriaAnyPlatform } from "../../behaviors/shortcut-keys.js";
|
|
11
11
|
import { mirrorClass } from "../../behaviors/direction.js";
|
|
12
12
|
function collectItems(entries) {
|
|
@@ -152,6 +152,7 @@ const SubEntry = ({
|
|
|
152
152
|
entry.label
|
|
153
153
|
] }),
|
|
154
154
|
/* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
|
|
155
|
+
/* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
|
|
155
156
|
entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
|
|
156
157
|
]
|
|
157
158
|
}
|
|
@@ -361,6 +362,7 @@ const ContextMenu = React.forwardRef(
|
|
|
361
362
|
entry.label
|
|
362
363
|
] }),
|
|
363
364
|
/* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
|
|
365
|
+
/* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
|
|
364
366
|
entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
|
|
365
367
|
]
|
|
366
368
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
CURRENCY INPUT
|
|
3
|
+
An Input with the currency as its prefix or
|
|
4
|
+
suffix; the field itself, its affixes and its
|
|
5
|
+
states are Input's. The amount sets in tabular
|
|
6
|
+
figures, so the digits hold still as they are
|
|
7
|
+
grouped on blur.
|
|
8
|
+
============================================ */
|
|
9
|
+
|
|
10
|
+
.ds-currency-input .ds-input__field {
|
|
11
|
+
font-variant-numeric: tabular-nums;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DecimalString } from '../../format/money';
|
|
3
|
+
/** Props owned by CurrencyInput itself; everything else falls through to the visible `<input>`. */
|
|
4
|
+
type CurrencyInputOwnProps = {
|
|
5
|
+
/** Label text above the field. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** The amount as a decimal string (`"1234.50"`), or `null` for none (controlled). Pair with `onValueChange`. */
|
|
8
|
+
value?: DecimalString | null;
|
|
9
|
+
/** The amount the field starts with (uncontrolled). */
|
|
10
|
+
defaultValue?: DecimalString | null;
|
|
11
|
+
/** Called with the amount as a normalised decimal string as the reader types, or `null` while the field holds no number. Fires alongside the native `onChange`. */
|
|
12
|
+
onValueChange?: (value: DecimalString | null) => void;
|
|
13
|
+
/** The ISO 4217 code of the currency, such as `USD`, `EUR` or `JPY`. Defaults to `USD`. */
|
|
14
|
+
currency?: string;
|
|
15
|
+
/** How the currency shows inside the field: its symbol, its code, or nothing (when the label already says it). The side it sits on follows the locale. */
|
|
16
|
+
currencyDisplay?: 'symbol' | 'code' | 'none';
|
|
17
|
+
/** Digits after the point. Defaults to the currency's own: 0 for JPY, 2 for USD, 3 for KWD. */
|
|
18
|
+
fractionDigits?: number;
|
|
19
|
+
/** Accept a negative amount (a refund, an adjustment). Defaults to false. */
|
|
20
|
+
allowNegative?: boolean;
|
|
21
|
+
/** The smallest amount, as a decimal string. A value below it is raised to it when the field loses focus. */
|
|
22
|
+
min?: DecimalString;
|
|
23
|
+
/** The largest amount, as a decimal string. A value above it is lowered to it when the field loses focus. */
|
|
24
|
+
max?: DecimalString;
|
|
25
|
+
/** How much the Up and Down arrow keys add or take away, as a decimal string. Defaults to `"1"`. */
|
|
26
|
+
step?: DecimalString;
|
|
27
|
+
/** The BCP 47 locale the amount is read and written in, such as `de-DE`. Defaults to the nearest LocaleProvider's, else `en-US`. */
|
|
28
|
+
locale?: string;
|
|
29
|
+
/** Component size (not the native character-width `size` attribute). */
|
|
30
|
+
size?: 'default' | 'compact';
|
|
31
|
+
/** Helper text below the field. */
|
|
32
|
+
helperText?: string;
|
|
33
|
+
/** The error message under the field; setting it marks the field invalid. */
|
|
34
|
+
errorText?: React.ReactNode;
|
|
35
|
+
/** Error state without a message of its own. */
|
|
36
|
+
error?: boolean;
|
|
37
|
+
/** The form field name. The form receives the normalised decimal string through a hidden input, never the formatted text. */
|
|
38
|
+
name?: string;
|
|
39
|
+
/** Additional CSS classes, applied to the wrapper. */
|
|
40
|
+
className?: string;
|
|
41
|
+
};
|
|
42
|
+
export interface CurrencyInputProps extends CurrencyInputOwnProps, Omit<React.ComponentPropsWithRef<'input'>, keyof CurrencyInputOwnProps | 'type' | 'prefix'> {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An amount of money. The value is a decimal string, never a float, so a
|
|
46
|
+
* cent is never lost; the field reads the locale's own marks and a pasted
|
|
47
|
+
* amount in any convention, groups the digits once the reader moves on, and
|
|
48
|
+
* places the currency where the locale writes it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function CurrencyInput({ label, value: valueProp, defaultValue, onValueChange, currency, currencyDisplay, fractionDigits, allowNegative, min, max, step, locale: localeProp, size, helperText, errorText, error, name, disabled, className, onChange, onFocus, onBlur, onKeyDown, onPaste, ref, ...rest }: CurrencyInputProps): React.JSX.Element;
|
|
51
|
+
export {};
|