rift-ds 1.2.0 → 1.4.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.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/components/Attachment/Attachment.css +1036 -0
  3. package/components/Attachment/AttachmentDropZone.d.ts +39 -0
  4. package/components/Attachment/AttachmentDropZone.js +76 -0
  5. package/components/Attachment/AttachmentGroup.d.ts +60 -0
  6. package/components/Attachment/AttachmentGroup.js +179 -0
  7. package/components/Attachment/AttachmentTile.d.ts +80 -0
  8. package/components/Attachment/AttachmentTile.js +143 -0
  9. package/components/Attachment/AttachmentViewer.d.ts +66 -0
  10. package/components/Attachment/AttachmentViewer.js +215 -0
  11. package/components/Attachment/fileTypes.d.ts +101 -0
  12. package/components/Attachment/fileTypes.js +182 -0
  13. package/components/Attachment/typeMark.d.ts +11 -0
  14. package/components/Attachment/typeMark.js +51 -0
  15. package/components/Attachment/useAttachments.d.ts +65 -0
  16. package/components/Attachment/useAttachments.js +201 -0
  17. package/components/Chart/BarChart.js +1 -1
  18. package/components/Chart/ComboChart.js +1 -1
  19. package/components/Chart/Treemap.js +83 -6
  20. package/components/ChatMessage/ChatMessage.css +24 -0
  21. package/components/ChatMessage/ChatMessage.d.ts +6 -0
  22. package/components/ChatMessage/ChatMessage.js +8 -5
  23. package/components/ColorPicker/ColorPicker.js +1 -1
  24. package/components/Composer/Composer.css +140 -5
  25. package/components/Composer/Composer.d.ts +71 -14
  26. package/components/Composer/Composer.js +204 -11
  27. package/components/DatePicker/DatePicker.css +1 -1
  28. package/components/DocumentChip/DocumentChip.d.ts +7 -5
  29. package/components/EventCalendar/EventCalendar.css +2 -2
  30. package/components/FileInput/FileInput.css +1 -1
  31. package/components/FileInput/FileInput.js +1 -7
  32. package/components/Globe/Globe.d.ts +5 -3
  33. package/components/Globe/Globe.js +18 -2
  34. package/components/Inspector/Inspector.css +108 -3
  35. package/components/Inspector/InspectorColorPicker.d.ts +43 -0
  36. package/components/Inspector/InspectorColorPicker.js +51 -0
  37. package/components/Instructions/Instructions.css +4 -4
  38. package/components/MessageCard/MessageCard.d.ts +1 -1
  39. package/components/Prose/Prose.css +27 -0
  40. package/components/Sparkline/Sparkline.css +2 -2
  41. package/components/Spinner/Spinner.css +1 -1
  42. package/components/Timeline/Timeline.css +1 -1
  43. package/components/WorldMap/land.d.ts +1 -1
  44. package/components/registry.json +48 -3
  45. package/components/registry.json.d.ts +48 -3
  46. package/components/registry.json.js +1 -1
  47. package/index.d.ts +5 -0
  48. package/index.js +21 -0
  49. package/package.json +9 -1
  50. package/tokens/motion.d.ts +2 -0
  51. package/tokens/motion.js +2 -0
  52. package/tokens/presets/contrast.css +2 -4
  53. package/tokens/presets/coral.css +2 -4
  54. package/tokens/presets/forest.css +2 -4
  55. package/tokens/presets/gold.css +4 -4
  56. package/tokens/presets/mono.css +0 -2
  57. package/tokens/presets/pink.css +4 -4
  58. package/tokens/presets/terminal.css +5 -4
  59. package/tokens/presets/violet.css +2 -4
  60. package/tokens/presets/warm.css +3 -4
  61. package/tokens/presets/zest.css +2 -4
  62. package/tokens/registry.json +5 -0
  63. package/tokens/registry.json.d.ts +5 -0
  64. package/tokens/registry.json.js +1 -1
  65. package/tokens/tokens-dark.css +14 -5
  66. package/tokens/tokens-light.css +16 -2
  67. package/tokens/tokens-motion.css +2 -0
  68. package/tokens/tokens-primitives.css +10 -0
@@ -4,7 +4,8 @@
4
4
  rails: each control is one bar with its name
5
5
  inside on the left and its state on the right.
6
6
  The form controls (Slider, Input, ToggleSwitch,
7
- SegmentedControl, Dropdown) keep their label
7
+ SegmentedControl, Dropdown, ColorPicker) keep
8
+ their label
8
9
  above; these are their counterparts for a
9
10
  dense panel.
10
11
 
@@ -33,7 +34,8 @@
33
34
  default 8px + 24px line + 8px = 40px, 20px sides, paragraph-emphasis
34
35
  compact 6px + 20px line + 6px = 32px, 12px sides, paragraph-sm-emphasis */
35
36
  .ds-inspector-bar,
36
- .ds-inspector-dropdown {
37
+ .ds-inspector-dropdown,
38
+ .ds-inspector-color-picker {
37
39
  --ds-inspector-height: calc(2 * var(--padding-200) + var(--font-paragraph-emphasis-line-height));
38
40
  --ds-inspector-inset: var(--padding-500);
39
41
  --ds-inspector-font-family: var(--font-paragraph-emphasis-family);
@@ -45,7 +47,8 @@
45
47
  }
46
48
 
47
49
  .ds-inspector-bar--compact,
48
- .ds-inspector-dropdown--compact {
50
+ .ds-inspector-dropdown--compact,
51
+ .ds-inspector-color-picker--compact {
49
52
  --ds-inspector-height: calc(2 * var(--padding-150) + var(--font-paragraph-sm-emphasis-line-height));
50
53
  --ds-inspector-inset: var(--padding-300);
51
54
  --ds-inspector-font-family: var(--font-paragraph-sm-emphasis-family);
@@ -424,6 +427,108 @@
424
427
  color: var(--color-icon-secondary);
425
428
  }
426
429
 
430
+ /* ============================================
431
+ COLOR PICKER — the library ColorPicker, dressed as a bar
432
+ ============================================ */
433
+
434
+ .ds-inspector-color-picker {
435
+ position: relative;
436
+ min-width: 0;
437
+ }
438
+
439
+ /* The name rides over the trigger and lets clicks through, so the whole
440
+ bar opens the panel. The reading sits at the far end, so no room needs
441
+ reserving for the name the way the dropdown's left-aligned value does. */
442
+ .ds-inspector-color-picker__label {
443
+ position: absolute;
444
+ top: calc(var(--ds-inspector-height) / 2);
445
+ left: var(--ds-inspector-inset);
446
+ z-index: 1;
447
+ transform: translateY(-50%);
448
+ white-space: nowrap;
449
+ font-family: var(--ds-inspector-font-family);
450
+ font-size: var(--ds-inspector-font-size);
451
+ font-weight: var(--ds-inspector-label-weight);
452
+ line-height: var(--ds-inspector-line-height);
453
+ letter-spacing: var(--ds-inspector-letter-spacing);
454
+ color: var(--color-text-primary);
455
+ pointer-events: none;
456
+ }
457
+
458
+ .ds-inspector-color-picker .ds-colorpicker {
459
+ display: flex;
460
+ align-items: stretch;
461
+ width: 100%;
462
+ }
463
+
464
+ /* The swatch is a circle one line tall, so its end inset is whatever
465
+ centres it in the bar: concentric with the pill's end cap. */
466
+ .ds-inspector-color-picker .ds-colorpicker__trigger {
467
+ justify-content: flex-end;
468
+ gap: var(--gap-300);
469
+ width: 100%;
470
+ box-sizing: border-box;
471
+ height: var(--ds-inspector-height);
472
+ padding: 0 calc((var(--ds-inspector-height) - var(--ds-inspector-line-height)) / 2) 0
473
+ var(--ds-inspector-inset);
474
+ border-color: transparent;
475
+ border-radius: var(--radius-pill);
476
+ background: var(--color-action-passive-bg-hover);
477
+ transition: background-color var(--motion-duration-fast) var(--motion-ease-standard);
478
+ }
479
+
480
+ .ds-inspector-color-picker .ds-colorpicker__trigger:hover:not(:disabled),
481
+ .ds-inspector-color-picker .ds-colorpicker--open .ds-colorpicker__trigger {
482
+ border-color: transparent;
483
+ background: var(--color-action-neutral-bg-hover);
484
+ }
485
+
486
+ .ds-inspector-color-picker .ds-colorpicker__trigger:active:not(:disabled) {
487
+ background: var(--color-action-neutral-bg-active);
488
+ }
489
+
490
+ /* The trigger's selected-border focus becomes the family's ring. */
491
+ .ds-inspector-color-picker .ds-colorpicker__trigger:focus-visible {
492
+ border-color: transparent;
493
+ outline: 2px solid var(--color-action-primary-bg);
494
+ outline-offset: 2px;
495
+ }
496
+
497
+ /* The reading comes before the swatch, so the colour sits at the bar's end
498
+ where the switch's track and the dropdown's chevron sit. */
499
+ .ds-inspector-color-picker .ds-colorpicker__trigger-text {
500
+ order: -1;
501
+ padding-right: 0;
502
+ font-family: var(--ds-inspector-font-family);
503
+ font-size: var(--ds-inspector-font-size);
504
+ font-weight: var(--ds-inspector-value-weight);
505
+ line-height: var(--ds-inspector-line-height);
506
+ letter-spacing: var(--ds-inspector-letter-spacing);
507
+ color: var(--color-text-secondary);
508
+ }
509
+
510
+ .ds-inspector-color-picker .ds-colorpicker__trigger-swatch {
511
+ width: var(--ds-inspector-line-height);
512
+ height: var(--ds-inspector-line-height);
513
+ border-radius: var(--radius-pill);
514
+ }
515
+
516
+ /* The panel opens under the bar and spans it. */
517
+ .ds-inspector-color-picker .ds-colorpicker__panel {
518
+ right: 0;
519
+ width: auto;
520
+ }
521
+
522
+ /* Disabled dims the whole bar, name included, rather than the trigger alone. */
523
+ .ds-inspector-color-picker--disabled {
524
+ opacity: 0.4;
525
+ cursor: not-allowed;
526
+ }
527
+
528
+ .ds-inspector-color-picker--disabled .ds-colorpicker__trigger {
529
+ opacity: 1;
530
+ }
531
+
427
532
  /* ============================================
428
533
  SECTION — a collapsible, titled run of controls
429
534
  ============================================ */
@@ -0,0 +1,43 @@
1
+ import { default as React } from 'react';
2
+ /** Props owned by InspectorColorPicker itself — everything else falls through to the wrapper. */
3
+ type InspectorColorPickerOwnProps = {
4
+ /** The setting's name, drawn inside the bar on the left. Also the start of the trigger's accessible name. */
5
+ label: string;
6
+ /** Current colour as a hex string — 3, 6 or 8 digit, with or without `#`. */
7
+ value?: string;
8
+ /** Initial colour for uncontrolled use. */
9
+ defaultValue?: string;
10
+ /**
11
+ * Called with the colour as an uppercase hex string (`#RRGGBB`, or
12
+ * `#RRGGBBAA` when `showAlpha` and alpha is below 100%). Fires live while
13
+ * dragging, as in ColorPicker.
14
+ */
15
+ onValueChange?: (value: string) => void;
16
+ /** Add an alpha (opacity) slider to the panel and emit 8-digit hex when alpha is below 100%. */
17
+ showAlpha?: boolean;
18
+ /** When set, a hidden input carries the current hex under this name, so the picker joins native form submission. */
19
+ name?: string;
20
+ /** Whether the picker is disabled. */
21
+ disabled?: boolean;
22
+ /** Component size, matching Button: `default` is 40px tall, `compact` 32px. */
23
+ size?: 'default' | 'compact';
24
+ /** Additional CSS classes, applied to the wrapper. */
25
+ className?: string;
26
+ };
27
+ export interface InspectorColorPickerProps extends InspectorColorPickerOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof InspectorColorPickerOwnProps | 'onChange' | 'defaultValue'> {
28
+ }
29
+ /**
30
+ * A one-row colour setting for inspector panels: the name on the left, the
31
+ * hex reading and a round swatch at the bar's end. It is the library
32
+ * ColorPicker with its trigger dressed as an inspector bar, so the panel,
33
+ * its saturation area, hue and alpha sliders and hex field are
34
+ * ColorPicker's own. The form counterpart, with a label above and helper
35
+ * text below, is ColorPicker itself.
36
+ *
37
+ * The whole bar is the trigger: the name is an overlay that lets clicks
38
+ * through, and the trigger is named by the name followed by the hex reading
39
+ * ("Tint colour #163300"). Forwards a ref to the wrapper and spreads
40
+ * unrecognised props onto it.
41
+ */
42
+ export declare const InspectorColorPicker: React.ForwardRefExoticComponent<InspectorColorPickerProps & React.RefAttributes<HTMLDivElement>>;
43
+ export {};
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { ColorPicker } from "../ColorPicker/ColorPicker.js";
5
+ import "./Inspector.css";
6
+ const InspectorColorPicker = React.forwardRef(
7
+ ({
8
+ label,
9
+ value,
10
+ defaultValue,
11
+ onValueChange,
12
+ showAlpha = false,
13
+ name,
14
+ disabled = false,
15
+ size = "default",
16
+ className = "",
17
+ ...rest
18
+ }, ref) => {
19
+ const baseId = React.useId();
20
+ const labelId = `${baseId}-label`;
21
+ const triggerId = `${baseId}-trigger`;
22
+ const classes = [
23
+ "ds-inspector-color-picker",
24
+ size === "compact" ? "ds-inspector-color-picker--compact" : "",
25
+ disabled ? "ds-inspector-color-picker--disabled" : "",
26
+ className
27
+ ].filter(Boolean).join(" ");
28
+ return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
29
+ /* @__PURE__ */ jsx("span", { id: labelId, className: "ds-inspector-color-picker__label", "aria-hidden": "true", children: label }),
30
+ /* @__PURE__ */ jsx(
31
+ ColorPicker,
32
+ {
33
+ id: triggerId,
34
+ "aria-labelledby": `${labelId} ${triggerId}-value`,
35
+ size,
36
+ value,
37
+ defaultValue,
38
+ onValueChange,
39
+ showAlpha,
40
+ showText: true,
41
+ name,
42
+ disabled
43
+ }
44
+ )
45
+ ] });
46
+ }
47
+ );
48
+ InspectorColorPicker.displayName = "InspectorColorPicker";
49
+ export {
50
+ InspectorColorPicker
51
+ };
@@ -64,14 +64,14 @@
64
64
  width: 32px;
65
65
  height: 32px;
66
66
  border-radius: var(--radius-pill);
67
- border: var(--border-025) solid var(--color-action-primary-border);
67
+ border: var(--border-025) solid var(--color-bg-container-border);
68
68
  background-color: transparent;
69
69
  flex-shrink: 0;
70
70
  }
71
71
 
72
72
  .ds-instructions__badge .material-symbols-rounded {
73
73
  --icon-size: var(--icon-size-600);
74
- color: var(--color-action-primary-bg);
74
+ color: var(--color-icon-primary);
75
75
  }
76
76
 
77
77
  .ds-instructions__number {
@@ -79,14 +79,14 @@
79
79
  font-size: var(--font-paragraph-sm-size);
80
80
  font-weight: var(--font-title-body-weight);
81
81
  line-height: 1;
82
- color: var(--color-action-primary-bg);
82
+ color: var(--color-text-secondary);
83
83
  }
84
84
 
85
85
  .ds-instructions__dot {
86
86
  width: 8px;
87
87
  height: 8px;
88
88
  border-radius: var(--radius-pill);
89
- background-color: var(--color-action-primary-bg);
89
+ background-color: var(--color-icon-primary);
90
90
  }
91
91
 
92
92
  .ds-instructions__connector {
@@ -18,7 +18,7 @@ type MessageCardOwnProps = {
18
18
  actions?: React.ReactNode;
19
19
  /** Additional CSS classes */
20
20
  className?: string;
21
- /** Body content between the description and the footer — rich content, a Prose block, a DocumentChip row. */
21
+ /** Body content between the description and the footer — rich content, a Prose block, an AttachmentGroup. */
22
22
  children?: React.ReactNode;
23
23
  };
24
24
  export interface MessageCardProps extends MessageCardOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof MessageCardOwnProps> {
@@ -173,6 +173,33 @@
173
173
  font-size: inherit;
174
174
  }
175
175
 
176
+ /* A renderer that maps fenced code to CodeBlock (for its copy button)
177
+ gets the same block rhythm, and the plain-pre panel and inline-code
178
+ chip step aside so CodeBlock's own chrome is the only chrome */
179
+ .ds-prose .ds-code-block {
180
+ margin: 0;
181
+ margin-block-end: var(--gap-400);
182
+ }
183
+
184
+ .ds-prose > .ds-code-block:last-child {
185
+ margin-block-end: 0;
186
+ }
187
+
188
+ .ds-prose .ds-code-block pre {
189
+ margin: 0;
190
+ padding: var(--padding-400);
191
+ overflow: auto;
192
+ background-color: transparent;
193
+ border: none;
194
+ border-radius: 0;
195
+ }
196
+
197
+ .ds-prose .ds-code-block code {
198
+ background-color: transparent;
199
+ border-radius: 0;
200
+ padding-inline: 0;
201
+ }
202
+
176
203
  /* ============================================
177
204
  BLOCKQUOTES
178
205
  Mirrors Reasoning's trace rail
@@ -12,7 +12,7 @@
12
12
  display: inline-block;
13
13
  vertical-align: middle;
14
14
  flex-shrink: 0;
15
- color: var(--color-action-primary-bg);
15
+ color: var(--color-chart-series-1);
16
16
  }
17
17
 
18
18
  /* Parts */
@@ -60,7 +60,7 @@
60
60
  /* Tones */
61
61
 
62
62
  .ds-sparkline--accent {
63
- color: var(--color-action-primary-bg);
63
+ color: var(--color-chart-series-1);
64
64
  }
65
65
 
66
66
  .ds-sparkline--positive {
@@ -52,7 +52,7 @@
52
52
  ============================================ */
53
53
 
54
54
  .ds-spinner--primary .ds-spinner__arc {
55
- stroke: var(--color-action-primary-bg);
55
+ stroke: var(--color-text-primary);
56
56
  }
57
57
 
58
58
  .ds-spinner--neutral .ds-spinner__arc {
@@ -331,7 +331,7 @@
331
331
  }
332
332
 
333
333
  .ds-timeline__role-bullets a {
334
- color: var(--color-action-primary-bg);
334
+ color: var(--color-action-primary-text-tertiary);
335
335
  font-weight: var(--font-paragraph-emphasis-weight);
336
336
  text-decoration: underline;
337
337
  text-decoration-color: transparent;