rift-ds 1.30.0 → 1.32.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 -4
- package/behaviors/chat-card.css +4 -1
- package/behaviors/deferComponent.d.ts +43 -0
- package/behaviors/deferComponent.js +35 -0
- package/behaviors/locale.d.ts +7 -0
- package/behaviors/locale.js +5 -0
- package/behaviors/shell.css +33 -0
- package/bin/rift-ds.mjs +35 -9
- 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/components/blocks/AppShell.module.css +10 -1
- package/bin/templates/blocks/registry.json +14 -0
- package/bin/templates/chat/app/api/chat/route.actions.ts +108 -0
- 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 +52 -29
- package/chat/ChatProvider.d.ts +19 -2
- package/chat/ChatProvider.js +26 -3
- package/chat/ChatWidget.css +23 -4
- package/chat/ChatWidget.d.ts +2 -1
- package/chat/ChatWidget.js +23 -21
- 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/deferredChatWidget.d.ts +10 -0
- package/chat/deferredChatWidget.js +10 -0
- package/chat/index.d.ts +3 -2
- package/chat/index.js +7 -1
- package/chat/registry.json.d.ts +4 -3
- 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/Accordion/Accordion.css +8 -0
- package/components/AgentPlan/AgentPlan.css +8 -0
- package/components/AgentRail/AgentRail.css +3 -3
- package/components/AiButton/AiButton.css +19 -0
- package/components/AiButton/AiButton.d.ts +10 -1
- package/components/AiButton/AiButton.js +6 -1
- package/components/AppSidebar/AppSidebar.css +12 -0
- package/components/ArtifactPanel/ArtifactPanel.js +5 -5
- package/components/Attachment/AttachmentViewer.js +7 -7
- package/components/BentoTile/BentoTile.css +1 -1
- package/components/BentoTile/BentoTile.js +5 -5
- package/components/Button/Button.css +28 -1
- package/components/Button/Button.d.ts +7 -2
- package/components/Button/Button.js +7 -3
- package/components/ButtonGroup/ButtonGroup.css +10 -1
- package/components/Chart/RadarChart.js +24 -10
- package/components/ChatHeader/ChatHeader.d.ts +1 -1
- package/components/ChatThread/ChatThread.css +1 -1
- package/components/Chip/Chip.css +26 -0
- package/components/CircularButton/CircularButton.d.ts +16 -96
- package/components/CircularButton/CircularButton.js +11 -94
- package/components/Combobox/Combobox.css +12 -0
- package/components/CommandPalette/CommandPalette.css +1 -1
- package/components/CommandPalette/CommandPalette.js +3 -3
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +9 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +10 -2
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +7 -2
- package/components/Composer/Composer.css +3 -3
- package/components/Composer/Composer.js +9 -9
- package/components/ContextMenu/ContextMenu.css +24 -0
- package/components/DataTable/DataTable.css +19 -4
- package/components/DataTable/DataTable.d.ts +14 -2
- package/components/DataTable/DataTable.js +28 -17
- package/components/DataTable/periodColumns.d.ts +37 -0
- package/components/DataTable/periodColumns.js +48 -0
- package/components/DateInput/DateInput.css +20 -0
- 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/DescriptionListCopy.d.ts +1 -1
- package/components/DescriptionList/DescriptionListCopy.js +3 -3
- package/components/Dialog/Dialog.css +1 -1
- package/components/Dialog/Dialog.js +3 -3
- package/components/DocumentChip/DocumentChip.css +12 -0
- package/components/DocumentViewer/DocumentViewer.js +10 -10
- package/components/Drawer/Drawer.css +1 -1
- package/components/Drawer/Drawer.js +3 -3
- package/components/Dropdown/Dropdown.css +30 -0
- package/components/DropdownMenu/DropdownMenu.css +24 -0
- package/components/EventCalendar/EventCalendar.css +54 -0
- package/components/EventCalendar/EventCalendar.d.ts +27 -5
- package/components/EventCalendar/EventCalendar.js +50 -15
- package/components/FileInput/FileInput.css +9 -0
- package/components/FilterBar/FilterBar.css +12 -0
- package/components/FunnelChart/FunnelChart.js +33 -22
- package/components/Globe/Globe.css +7 -0
- package/components/Globe/Globe.js +1 -1
- package/components/{CircularButton/CircularButton.css → IconButton/IconButton.css} +91 -81
- package/components/IconButton/IconButton.d.ts +108 -0
- package/components/IconButton/IconButton.js +101 -0
- package/components/Input/Input.css +53 -0
- package/components/Input/Input.js +3 -3
- package/components/MaskedInput/MaskedInput.js +3 -3
- package/components/ModelPicker/ModelPicker.css +12 -1
- package/components/NavList/NavList.css +1 -1
- package/components/Pagination/Pagination.css +1 -1
- package/components/QuestionCard/QuestionCard.js +3 -3
- package/components/RadioButton/RadioButton.css +14 -12
- package/components/RichDropdown/RichDropdown.css +7 -0
- package/components/SegmentedControl/SegmentedControl.css +16 -5
- package/components/SegmentedControl/SegmentedControl.js +7 -4
- package/components/SiteHeader/SiteHeader.css +12 -5
- package/components/SiteHeader/SiteHeader.js +3 -3
- package/components/SourceTrail/SourceTrail.css +8 -0
- package/components/SplitButton/SplitButton.css +14 -14
- package/components/SplitButton/SplitButton.js +3 -3
- package/components/Table/Table.css +7 -0
- package/components/Table/Table.js +1 -1
- package/components/TableToolbar/TableToolbar.css +2 -2
- package/components/TableToolbar/TableToolbar.js +36 -37
- package/components/Tabs/Tabs.css +21 -3
- package/components/ThreadPanel/ThreadPanel.css +8 -0
- package/components/ThreadTabs/ThreadTabs.css +7 -0
- package/components/TimePicker/TimePicker.css +12 -0
- package/components/Timeline/Timeline.css +8 -0
- package/components/ToolCall/ToolCall.css +8 -0
- package/components/Tooltip/Tooltip.js +3 -2
- package/components/Widget/Widget.css +2 -0
- package/components/WorldMap/WorldMap.css +15 -0
- package/components/WorldMap/WorldMap.js +61 -6
- package/components/registry.d.ts +3 -1
- package/components/registry.json +39 -13
- package/components/registry.json.d.ts +39 -13
- package/components/registry.json.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +8 -0
- package/package.json +6 -2
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import React, { useCallback, useId } from "react";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useCallback, useId, useState } from "react";
|
|
4
4
|
import { ResponsiveContainer, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Tooltip, Radar, Legend } from "recharts";
|
|
5
5
|
import { readTokenPx, getChartSeriesColors } from "./palette.js";
|
|
6
6
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
@@ -48,6 +48,26 @@ const RadarChart = React.forwardRef(({
|
|
|
48
48
|
const textSize = readTokenPx("--font-caption-size", "12px");
|
|
49
49
|
const gridColor = getCSSVar("--color-divider", "rgba(214, 214, 214, 0.8)");
|
|
50
50
|
const seriesColors = getChartSeriesColors();
|
|
51
|
+
const [bodyWidth, setBodyWidth] = useState(0);
|
|
52
|
+
const charWidth = textSize * 0.6;
|
|
53
|
+
const labelRoom = Math.ceil(Math.max(0, ...data.map((d) => String(d[categoryKey] ?? "").length)) * charWidth) + 12;
|
|
54
|
+
const half = Math.min(bodyWidth, height) / 2;
|
|
55
|
+
const outerRadius = bodyWidth > 0 ? Math.min(half * 0.7, Math.max(half * 0.45, bodyWidth / 2 - labelRoom)) : "70%";
|
|
56
|
+
const renderAngleTick = useCallback(
|
|
57
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
58
|
+
(props) => {
|
|
59
|
+
const { x, y, payload, textAnchor } = props;
|
|
60
|
+
const full = String(payload?.value ?? "");
|
|
61
|
+
const room = bodyWidth <= 0 ? Infinity : textAnchor === "end" ? x - 2 : textAnchor === "start" ? bodyWidth - x - 2 : 2 * Math.min(x, bodyWidth - x) - 4;
|
|
62
|
+
const fits = Math.max(1, Math.floor(room / charWidth));
|
|
63
|
+
const text = full.length > fits ? `${full.slice(0, Math.max(1, fits - 1))}…` : full;
|
|
64
|
+
return /* @__PURE__ */ jsxs("text", { x, y, textAnchor, dominantBaseline: "central", fill: textSecondary, fontSize: textSize, children: [
|
|
65
|
+
text !== full && /* @__PURE__ */ jsx("title", { children: full }),
|
|
66
|
+
text
|
|
67
|
+
] });
|
|
68
|
+
},
|
|
69
|
+
[bodyWidth, charWidth, textSecondary, textSize]
|
|
70
|
+
);
|
|
51
71
|
const renderTooltip = useCallback(
|
|
52
72
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
53
73
|
(props) => /* @__PURE__ */ jsx(RadarTooltip, { ...props, locale }),
|
|
@@ -73,15 +93,9 @@ const RadarChart = React.forwardRef(({
|
|
|
73
93
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
74
94
|
] }, i)) })
|
|
75
95
|
] }),
|
|
76
|
-
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(RadarChart$1, { data, cx: "50%", cy: "50%", outerRadius
|
|
96
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, onResize: (width) => setBodyWidth(width), children: /* @__PURE__ */ jsxs(RadarChart$1, { data, cx: "50%", cy: "50%", outerRadius, children: [
|
|
77
97
|
/* @__PURE__ */ jsx(PolarGrid, { stroke: gridColor }),
|
|
78
|
-
/* @__PURE__ */ jsx(
|
|
79
|
-
PolarAngleAxis,
|
|
80
|
-
{
|
|
81
|
-
dataKey: categoryKey,
|
|
82
|
-
tick: { fill: textSecondary, fontSize: textSize }
|
|
83
|
-
}
|
|
84
|
-
),
|
|
98
|
+
/* @__PURE__ */ jsx(PolarAngleAxis, { dataKey: categoryKey, tick: renderAngleTick }),
|
|
85
99
|
/* @__PURE__ */ jsx(
|
|
86
100
|
PolarRadiusAxis,
|
|
87
101
|
{
|
|
@@ -8,7 +8,7 @@ type ChatHeaderOwnProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
title?: React.ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
* Trailing controls: a new-chat
|
|
11
|
+
* Trailing controls: a new-chat IconButton, a view switcher, a close
|
|
12
12
|
* button. The slot only lays them out — each control owns its behaviour.
|
|
13
13
|
*/
|
|
14
14
|
actions?: React.ReactNode;
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
display: flex;
|
|
124
124
|
align-items: center;
|
|
125
125
|
justify-content: center;
|
|
126
|
-
/* The send button's exact footprint —
|
|
126
|
+
/* The send button's exact footprint — IconButton's default size,
|
|
127
127
|
a raw value there too (icon-button sizes are not on a token scale). */
|
|
128
128
|
width: 40px;
|
|
129
129
|
height: 40px;
|
package/components/Chip/Chip.css
CHANGED
|
@@ -73,6 +73,32 @@
|
|
|
73
73
|
padding: var(--padding-050) var(--padding-200); /* 2px 8px */
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/* ============================================
|
|
77
|
+
ICON SIDE PADDING
|
|
78
|
+
Button's rule: beside the label an icon's box
|
|
79
|
+
carries its own side bearing, so a side that
|
|
80
|
+
holds the leading icon or the remove glyph
|
|
81
|
+
takes the step below the text side (12 → 8,
|
|
82
|
+
large 20 → 16). Compact stays at 8, the floor: closer, the glyph
|
|
83
|
+
sits in the pill's cap.
|
|
84
|
+
============================================ */
|
|
85
|
+
|
|
86
|
+
.ds-chip:has(.ds-chip__icon) {
|
|
87
|
+
padding-inline-start: var(--padding-200);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-chip:has(.ds-chip__remove) {
|
|
91
|
+
padding-inline-end: var(--padding-200);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ds-chip--large:has(.ds-chip__icon) {
|
|
95
|
+
padding-inline-start: var(--padding-400);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-chip--large:has(.ds-chip__remove) {
|
|
99
|
+
padding-inline-end: var(--padding-400);
|
|
100
|
+
}
|
|
101
|
+
|
|
76
102
|
/* ============================================
|
|
77
103
|
ICON (leading)
|
|
78
104
|
============================================ */
|
|
@@ -1,103 +1,23 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
variant?: 'primary' | 'secondary' | 'tertiary' | 'neutral';
|
|
13
|
-
/**
|
|
14
|
-
* Colour, independent of emphasis: `default` carries the action colour,
|
|
15
|
-
* `neutral` the greys, `destructive` the danger colour. Tertiary is
|
|
16
|
-
* already grey, so `neutral` leaves it unchanged; a tertiary
|
|
17
|
-
* `destructive` takes the outlined look, since a danger action needs a
|
|
18
|
-
* visible edge.
|
|
19
|
-
*/
|
|
20
|
-
tone?: 'default' | 'neutral' | 'destructive';
|
|
21
|
-
/**
|
|
22
|
-
* Legacy alias for `variant`.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated Use `variant` instead.
|
|
25
|
-
*/
|
|
26
|
-
priority?: 'primary' | 'secondary' | 'tertiary';
|
|
27
|
-
/** Whether the button is disabled */
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Documentation-only interaction state.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Use `disabled` for the disabled state.
|
|
33
|
-
*
|
|
34
|
-
* Documentation-only affordance for rendering a *static* interaction state in
|
|
35
|
-
* Storybook and the showcase site. Real hover/active styling comes from CSS
|
|
36
|
-
* pseudo-classes and needs no prop — for docs, prefer
|
|
37
|
-
* `className="ds-circular-button--hover"`.
|
|
38
|
-
*/
|
|
39
|
-
state?: 'default' | 'hover' | 'active' | 'disabled';
|
|
40
|
-
/** Button size */
|
|
41
|
-
size?: 'default' | 'compact';
|
|
42
|
-
/**
|
|
43
|
-
* Shows a spinner in place of the icon and blocks interaction while an
|
|
44
|
-
* async action runs. Keeps the variant's full-colour appearance (unlike
|
|
45
|
-
* the disabled state) and sets `aria-busy` on the rendered element.
|
|
46
|
-
*/
|
|
47
|
-
loading?: boolean;
|
|
48
|
-
/** Accessible label — required, because the button has no visible text */
|
|
2
|
+
import { IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
/**
|
|
4
|
+
* Props of the deprecated CircularButton: IconButton's, with the name under
|
|
5
|
+
* its old spelling.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use `IconButtonProps`, whose `label` replaces `ariaLabel`.
|
|
8
|
+
*/
|
|
9
|
+
export interface CircularButtonProps extends Omit<IconButtonProps, 'label'> {
|
|
10
|
+
/** Accessible label, required because the button has no visible text. IconButton calls it `label`. */
|
|
49
11
|
ariaLabel: string;
|
|
50
|
-
/**
|
|
51
|
-
* The hover/focus tooltip. An icon-only control names itself: by default
|
|
52
|
-
* the button wears a Tooltip carrying `ariaLabel`. Pass a string to show
|
|
53
|
-
* different wording, or `false` to opt out — for a host that labels the
|
|
54
|
-
* control another way, or one that owns the button's box directly
|
|
55
|
-
* (SplitButton's trigger stretches to its sibling segment, which the
|
|
56
|
-
* tooltip wrapper would block).
|
|
57
|
-
*/
|
|
58
|
-
tooltip?: string | false;
|
|
59
|
-
/** Which side the tooltip opens on. `start` and `end` follow the reading direction. */
|
|
60
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end';
|
|
61
|
-
/** Optional href — renders as <a> instead of <button> */
|
|
62
|
-
href?: string;
|
|
63
|
-
/** Optional target attribute for links */
|
|
64
|
-
target?: string;
|
|
65
|
-
/** Optional rel attribute for links */
|
|
66
|
-
rel?: string;
|
|
67
|
-
/** A mark on the button's top-end corner, as BottomNav draws one: a count (a notification bell's unread), or `true` for a dot with no number. */
|
|
68
|
-
badge?: number | string | true;
|
|
69
|
-
/** The highest count the badge spells out; a larger one reads "99+". Defaults to 99. */
|
|
70
|
-
badgeMax?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Text read after `ariaLabel` while the button carries a badge, given the
|
|
73
|
-
* badge. Defaults to ", new" for a dot and ", 3 new" for a count; the
|
|
74
|
-
* leading comma and space are part of the text. The tooltip keeps
|
|
75
|
-
* `ariaLabel` alone.
|
|
76
|
-
*/
|
|
77
|
-
badgeLabel?: (badge: number | string | true) => string;
|
|
78
|
-
/** The BCP 47 locale a numeric badge is written in, such as `ar-EG`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
|
|
79
|
-
locale?: string;
|
|
80
|
-
/** Additional CSS classes */
|
|
81
|
-
className?: string;
|
|
82
|
-
/**
|
|
83
|
-
* The component the link renders with, such as Next.js's `Link`, so it
|
|
84
|
-
* navigates through the app's router; a plain `<a>` when unset. This
|
|
85
|
-
* component can render on the server, so it never reads a LinkProvider:
|
|
86
|
-
* pass the prop even under one.
|
|
87
|
-
*/
|
|
88
|
-
linkComponent?: LinkComponent;
|
|
89
|
-
};
|
|
90
|
-
export interface CircularButtonProps extends CircularButtonOwnProps, Omit<React.ComponentPropsWithoutRef<'button'>, keyof CircularButtonOwnProps | 'type'> {
|
|
91
12
|
}
|
|
92
13
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
14
|
+
* IconButton under its old name. It renders the same button, passes
|
|
15
|
+
* `ariaLabel` on as `label`, and adds the old `ds-circular-button` base
|
|
16
|
+
* class beside the new ones, so a rule written against the base still
|
|
17
|
+
* matches. The old modifier and element classes are gone: a rule written
|
|
18
|
+
* against one moves to its `ds-icon-button` twin.
|
|
98
19
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
20
|
+
* @deprecated Use `IconButton` with `label`. The button was renamed because
|
|
21
|
+
* its shape is the theme's: a square theme draws it square.
|
|
101
22
|
*/
|
|
102
23
|
export declare const CircularButton: React.ForwardRefExoticComponent<CircularButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
103
|
-
export {};
|
|
@@ -1,101 +1,18 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
5
|
-
import "./CircularButton.css";
|
|
6
|
-
import "../../fonts/material-symbols.css";
|
|
7
|
-
import { mirrorClass } from "../../behaviors/direction.js";
|
|
8
|
-
import { formatNumber, DEFAULT_LOCALE } from "../../behaviors/locale.js";
|
|
9
|
-
function resolveCircularButtonCell(variant, tone) {
|
|
10
|
-
const emphasis = variant === "neutral" ? "primary" : variant;
|
|
11
|
-
const resolvedTone = tone ?? (variant === "neutral" ? "neutral" : "default");
|
|
12
|
-
if (resolvedTone === "destructive") {
|
|
13
|
-
return emphasis === "primary" ? "primary-destructive" : "destructive";
|
|
14
|
-
}
|
|
15
|
-
if (resolvedTone === "neutral" && emphasis !== "tertiary") {
|
|
16
|
-
return emphasis === "primary" ? "neutral" : "secondary-neutral";
|
|
17
|
-
}
|
|
18
|
-
return emphasis;
|
|
19
|
-
}
|
|
3
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
20
4
|
const CircularButton = React.forwardRef(
|
|
21
|
-
({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ariaLabel,
|
|
31
|
-
tooltip,
|
|
32
|
-
tooltipPosition = "top",
|
|
33
|
-
href,
|
|
34
|
-
target,
|
|
35
|
-
rel,
|
|
36
|
-
badge,
|
|
37
|
-
badgeMax = 99,
|
|
38
|
-
badgeLabel = defaultBadgeLabel,
|
|
39
|
-
locale = DEFAULT_LOCALE,
|
|
40
|
-
className = "",
|
|
41
|
-
linkComponent,
|
|
42
|
-
...rest
|
|
43
|
-
}, ref) => {
|
|
44
|
-
const baseClass = "ds-circular-button";
|
|
45
|
-
const Link = linkComponent ?? "a";
|
|
46
|
-
const resolvedVariant = resolveCircularButtonCell(variant ?? priority ?? "primary", tone);
|
|
47
|
-
const isDisabled = disabled ?? state === "disabled";
|
|
48
|
-
const resolvedState = state ?? (isDisabled ? "disabled" : "default");
|
|
49
|
-
const isLoading = Boolean(loading);
|
|
50
|
-
const classes = [
|
|
51
|
-
baseClass,
|
|
52
|
-
`${baseClass}--${resolvedVariant}`,
|
|
53
|
-
`${baseClass}--${resolvedState}`,
|
|
54
|
-
`${baseClass}--${size}`,
|
|
55
|
-
isLoading && `${baseClass}--loading`,
|
|
56
|
-
badge !== void 0 && `${baseClass}--badged`,
|
|
57
|
-
className
|
|
58
|
-
].filter(Boolean).join(" ");
|
|
59
|
-
const glyph = isLoading ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: size === "compact" ? "sm" : "md", tone: "inherit" }) }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon${typeof icon === "string" ? ` material-symbols-rounded ${mirrorClass(icon)}` : ""}`, "aria-hidden": "true", children: icon });
|
|
60
|
-
const badgeText = badge === void 0 || badge === true ? null : typeof badge === "number" ? badge > badgeMax ? `${formatNumber(badgeMax, locale)}+` : formatNumber(badge, locale) : badge;
|
|
61
|
-
const children = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
|
-
glyph,
|
|
63
|
-
badge === true && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge ${baseClass}__badge--dot`, "aria-hidden": "true" }),
|
|
64
|
-
badgeText !== null && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge`, "aria-hidden": "true", children: badgeText })
|
|
65
|
-
] });
|
|
66
|
-
const accessibleName = badge === void 0 ? ariaLabel : `${ariaLabel}${badgeLabel(badge)}`;
|
|
67
|
-
const control = href && !isDisabled && !isLoading ? /* @__PURE__ */ jsx(
|
|
68
|
-
Link,
|
|
69
|
-
{
|
|
70
|
-
...rest,
|
|
71
|
-
ref,
|
|
72
|
-
className: classes,
|
|
73
|
-
href,
|
|
74
|
-
target,
|
|
75
|
-
rel,
|
|
76
|
-
"aria-label": accessibleName,
|
|
77
|
-
children
|
|
78
|
-
}
|
|
79
|
-
) : /* @__PURE__ */ jsx(
|
|
80
|
-
"button",
|
|
81
|
-
{
|
|
82
|
-
...rest,
|
|
83
|
-
ref,
|
|
84
|
-
type: "button",
|
|
85
|
-
className: classes,
|
|
86
|
-
disabled: isDisabled || isLoading,
|
|
87
|
-
"aria-busy": isLoading || void 0,
|
|
88
|
-
"aria-label": accessibleName,
|
|
89
|
-
children
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
const tooltipContent = tooltip === false ? null : tooltip ?? ariaLabel;
|
|
93
|
-
if (!tooltipContent) return control;
|
|
94
|
-
return /* @__PURE__ */ jsx(Tooltip, { content: tooltipContent, position: tooltipPosition, children: control });
|
|
95
|
-
}
|
|
5
|
+
({ ariaLabel, className, ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
IconButton,
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
9
|
+
ref,
|
|
10
|
+
label: ariaLabel,
|
|
11
|
+
className: ["ds-circular-button", className].filter(Boolean).join(" ")
|
|
12
|
+
}
|
|
13
|
+
)
|
|
96
14
|
);
|
|
97
15
|
CircularButton.displayName = "CircularButton";
|
|
98
|
-
const defaultBadgeLabel = (badge) => badge === true ? ", new" : `, ${badge} new`;
|
|
99
16
|
export {
|
|
100
17
|
CircularButton
|
|
101
18
|
};
|
|
@@ -391,3 +391,15 @@
|
|
|
391
391
|
.ds-combobox .material-symbols-rounded {
|
|
392
392
|
color: inherit;
|
|
393
393
|
}
|
|
394
|
+
|
|
395
|
+
/* Icon side padding, Button's rule: a glyph's box carries its own side
|
|
396
|
+
bearing, so a side that holds one takes the step below the text side. The
|
|
397
|
+
control always leads with the search glyph and ends on the chevron
|
|
398
|
+
(16 → 12, compact 12 → 8). A chip's 8px is already the floor. */
|
|
399
|
+
.ds-combobox__control {
|
|
400
|
+
padding-inline: var(--padding-300);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.ds-combobox--compact .ds-combobox__control {
|
|
404
|
+
padding-inline: var(--padding-200);
|
|
405
|
+
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
color: var(--color-input-text-placeholder);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/* The close is the library's
|
|
117
|
+
/* The close is the library's IconButton (tertiary, compact); the
|
|
118
118
|
header only seats it. */
|
|
119
119
|
.ds-command-palette__close {
|
|
120
120
|
flex-shrink: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useState, useRef, useCallback, useId, useMemo, useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
6
|
import { Kbd } from "../Kbd/Kbd.js";
|
|
7
7
|
import "./CommandPalette.css";
|
|
@@ -182,14 +182,14 @@ const CommandPalette = React.forwardRef(({
|
|
|
182
182
|
}
|
|
183
183
|
),
|
|
184
184
|
/* @__PURE__ */ jsx(
|
|
185
|
-
|
|
185
|
+
IconButton,
|
|
186
186
|
{
|
|
187
187
|
className: `${baseClass}__close`,
|
|
188
188
|
icon: "close",
|
|
189
189
|
variant: "tertiary",
|
|
190
190
|
size: "compact",
|
|
191
191
|
tooltip: false,
|
|
192
|
-
|
|
192
|
+
label: closeLabel,
|
|
193
193
|
onClick: () => onOpenChange(false)
|
|
194
194
|
}
|
|
195
195
|
)
|
|
@@ -98,3 +98,12 @@
|
|
|
98
98
|
border-color: var(--color-bg-container-border);
|
|
99
99
|
background-color: var(--color-bg-container-secondary);
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
/* Icon side padding, Button's rule: the search glyph leads and the keycaps
|
|
103
|
+
end the field, and each box carries its own side bearing, so both ends
|
|
104
|
+
take the step below a text edge (12 → 8). Compact is already at
|
|
105
|
+
8, the floor: closer, the glyph sits in the pill's cap. The icon-only
|
|
106
|
+
circle keeps its centred glyph. */
|
|
107
|
+
.ds-command-palette-trigger:not(.ds-command-palette-trigger--icon-only) {
|
|
108
|
+
padding-inline: var(--padding-200);
|
|
109
|
+
}
|
|
@@ -19,8 +19,16 @@ type CommandPaletteTriggerOwnProps = {
|
|
|
19
19
|
icon?: string | React.ReactNode;
|
|
20
20
|
/** Control size, on the row-control scale: `default` is 40px, `compact` 32px. */
|
|
21
21
|
size?: 'default' | 'compact';
|
|
22
|
-
/** Fold to the icon alone,
|
|
22
|
+
/** Fold to the icon alone, an even box the row height across, for a row with no room for the field. The label stays the accessible name. */
|
|
23
23
|
iconOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The hover and focus tooltip of the icon-only form, which names itself as
|
|
26
|
+
* IconButton does: by default it carries `label`. Pass a string to show
|
|
27
|
+
* different wording, or `false` to opt out.
|
|
28
|
+
*/
|
|
29
|
+
tooltip?: string | false;
|
|
30
|
+
/** Which side the tooltip opens on; below by default, since the trigger usually sits in a top bar. `start` and `end` follow the reading direction. */
|
|
31
|
+
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end';
|
|
24
32
|
/** Additional CSS classes */
|
|
25
33
|
className?: string;
|
|
26
34
|
};
|
|
@@ -30,7 +38,7 @@ export interface CommandPaletteTriggerProps extends CommandPaletteTriggerOwnProp
|
|
|
30
38
|
* The entry point to a command palette: a button dressed as a search field
|
|
31
39
|
* (icon, prompt and the shortcut's keycaps), because typing happens in the
|
|
32
40
|
* palette itself. It sits on the row-control height, so it lines up with
|
|
33
|
-
* the buttons and pickers beside it, and folds to
|
|
41
|
+
* the buttons and pickers beside it, and folds to its icon alone with
|
|
34
42
|
* `iconOnly`. Pair it with CommandPalette: the trigger's `onClick` opens
|
|
35
43
|
* the palette, and the palette owns the shortcut. `aria-keyshortcuts`
|
|
36
44
|
* defaults to the shortcut it draws.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Kbd } from "../Kbd/Kbd.js";
|
|
4
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
4
5
|
import { shortcutAriaAnyPlatform } from "../../behaviors/shortcut-keys.js";
|
|
5
6
|
import "./CommandPaletteTrigger.css";
|
|
6
7
|
import "../../fonts/material-symbols.css";
|
|
@@ -14,6 +15,8 @@ const CommandPaletteTrigger = React.forwardRef(
|
|
|
14
15
|
icon = "search",
|
|
15
16
|
size = "default",
|
|
16
17
|
iconOnly = false,
|
|
18
|
+
tooltip,
|
|
19
|
+
tooltipPosition = "bottom",
|
|
17
20
|
className = "",
|
|
18
21
|
...rest
|
|
19
22
|
}, ref) => {
|
|
@@ -31,12 +34,11 @@ const CommandPaletteTrigger = React.forwardRef(
|
|
|
31
34
|
} else {
|
|
32
35
|
announced = shortcutAriaAnyPlatform(keys) ?? "";
|
|
33
36
|
}
|
|
34
|
-
|
|
37
|
+
const control = /* @__PURE__ */ jsxs(
|
|
35
38
|
"button",
|
|
36
39
|
{
|
|
37
40
|
"aria-label": label,
|
|
38
41
|
"aria-keyshortcuts": announced || void 0,
|
|
39
|
-
title: iconOnly ? label : void 0,
|
|
40
42
|
...rest,
|
|
41
43
|
ref,
|
|
42
44
|
type: "button",
|
|
@@ -50,6 +52,9 @@ const CommandPaletteTrigger = React.forwardRef(
|
|
|
50
52
|
]
|
|
51
53
|
}
|
|
52
54
|
);
|
|
55
|
+
const tooltipContent = !iconOnly || tooltip === false ? null : tooltip ?? label;
|
|
56
|
+
if (!tooltipContent) return control;
|
|
57
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: tooltipContent, position: tooltipPosition, children: control });
|
|
53
58
|
}
|
|
54
59
|
);
|
|
55
60
|
CommandPaletteTrigger.displayName = "CommandPaletteTrigger";
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: column;
|
|
22
22
|
width: 100%;
|
|
23
|
-
/* The send button's diameter —
|
|
24
|
-
a raw value in
|
|
23
|
+
/* The send button's diameter — IconButton's default size, which is
|
|
24
|
+
a raw value in IconButton.css too (icon-button sizes are not on
|
|
25
25
|
a token scale). Everything concentric derives from it. */
|
|
26
26
|
--ds-composer-send-size: 40px;
|
|
27
27
|
/* The shell's concentric corner, derived rather than frozen: the send
|
|
@@ -748,7 +748,7 @@
|
|
|
748
748
|
padding: var(--padding-050);
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
-
.ds-composer--inline .ds-composer__footer .ds-
|
|
751
|
+
.ds-composer--inline .ds-composer__footer .ds-icon-button {
|
|
752
752
|
width: var(--ds-composer-send-size);
|
|
753
753
|
height: var(--ds-composer-send-size);
|
|
754
754
|
}
|
|
@@ -3,7 +3,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useRef, useState, useId, useLayoutEffect, useEffect } from "react";
|
|
4
4
|
import { AttachmentTile } from "../Attachment/AttachmentTile.js";
|
|
5
5
|
import { formatBytes } from "../Attachment/fileTypes.js";
|
|
6
|
-
import {
|
|
6
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
7
7
|
import { MentionText, MentionMenu } from "../Mention/Mention.js";
|
|
8
8
|
import "../../fonts/material-symbols.css";
|
|
9
9
|
import "./Composer.css";
|
|
@@ -389,13 +389,13 @@ const Composer = React.forwardRef(
|
|
|
389
389
|
contextIcon && /* @__PURE__ */ jsx("span", { className: `${baseClass}__context-icon`, "aria-hidden": "true", children: typeof contextIcon === "string" ? /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(contextIcon)}`, children: contextIcon }) : contextIcon }),
|
|
390
390
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__context-text`, children: context }),
|
|
391
391
|
onContextClear && /* @__PURE__ */ jsx(
|
|
392
|
-
|
|
392
|
+
IconButton,
|
|
393
393
|
{
|
|
394
394
|
icon: "close",
|
|
395
395
|
variant: "tertiary",
|
|
396
396
|
tone: "neutral",
|
|
397
397
|
size: "compact",
|
|
398
|
-
|
|
398
|
+
label: contextClearLabel,
|
|
399
399
|
tooltip: false,
|
|
400
400
|
className: `${baseClass}__context-clear`,
|
|
401
401
|
onClick: (event) => {
|
|
@@ -489,12 +489,12 @@ const Composer = React.forwardRef(
|
|
|
489
489
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__footer`, children: [
|
|
490
490
|
(actions || armed && attachButton) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__actions`, children: [
|
|
491
491
|
armed && attachButton && /* @__PURE__ */ jsx(
|
|
492
|
-
|
|
492
|
+
IconButton,
|
|
493
493
|
{
|
|
494
494
|
icon: "add",
|
|
495
495
|
variant: "tertiary",
|
|
496
496
|
size,
|
|
497
|
-
|
|
497
|
+
label: attachLabel,
|
|
498
498
|
disabled,
|
|
499
499
|
onClick: () => fileInputRef.current?.click()
|
|
500
500
|
}
|
|
@@ -504,22 +504,22 @@ const Composer = React.forwardRef(
|
|
|
504
504
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__trailing`, children: [
|
|
505
505
|
trailingActions,
|
|
506
506
|
streaming ? /* @__PURE__ */ jsx(
|
|
507
|
-
|
|
507
|
+
IconButton,
|
|
508
508
|
{
|
|
509
509
|
icon: "stop",
|
|
510
510
|
variant: "primary",
|
|
511
511
|
size,
|
|
512
|
-
|
|
512
|
+
label: stopLabel,
|
|
513
513
|
disabled,
|
|
514
514
|
onClick: onStop
|
|
515
515
|
}
|
|
516
516
|
) : /* @__PURE__ */ jsx(
|
|
517
|
-
|
|
517
|
+
IconButton,
|
|
518
518
|
{
|
|
519
519
|
icon: "arrow_upward",
|
|
520
520
|
variant: "primary",
|
|
521
521
|
size,
|
|
522
|
-
|
|
522
|
+
label: sendLabel,
|
|
523
523
|
disabled: !canSend,
|
|
524
524
|
onClick: submit
|
|
525
525
|
}
|
|
@@ -287,3 +287,27 @@
|
|
|
287
287
|
transform: scale(1);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
+
|
|
291
|
+
/* Icon side padding, Button's rule (design.md): a glyph's box carries its
|
|
292
|
+
own side bearing, so a side that holds one takes the step below the text
|
|
293
|
+
side. A row that leads with an icon, or ends on a trailing icon or the
|
|
294
|
+
submenu chevron, steps that side down (16 → 12, compact 12 → 8). The
|
|
295
|
+
compact rules carry the panel class, so the compact chevron side keeps
|
|
296
|
+
its trim instead of losing it to the compact row's padding. */
|
|
297
|
+
.ds-context-menu__item:has(.ds-context-menu__item-label > .ds-context-menu__item-icon:first-child) {
|
|
298
|
+
padding-inline-start: var(--padding-300);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.ds-context-menu__item:has(.ds-context-menu__item-icon-right),
|
|
302
|
+
.ds-context-menu__item--has-submenu {
|
|
303
|
+
padding-inline-end: var(--padding-300);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.ds-context-menu__panel--compact .ds-context-menu__item:has(.ds-context-menu__item-label > .ds-context-menu__item-icon:first-child) {
|
|
307
|
+
padding-inline-start: var(--padding-200);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.ds-context-menu__panel--compact .ds-context-menu__item:has(.ds-context-menu__item-icon-right),
|
|
311
|
+
.ds-context-menu__panel--compact .ds-context-menu__item--has-submenu {
|
|
312
|
+
padding-inline-end: var(--padding-200);
|
|
313
|
+
}
|
|
@@ -153,6 +153,15 @@
|
|
|
153
153
|
overflow: hidden;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/* A word wider than its fixed column wraps before the clip, so it is never
|
|
157
|
+
cut mid-word with nothing to say so. `anywhere` rather than
|
|
158
|
+
`break-word`: the cell content is a flex box, and its text's automatic
|
|
159
|
+
minimum is the longest word unless the break counts toward it. The
|
|
160
|
+
widths here are already fixed, so nothing else is resized by it. */
|
|
161
|
+
.ds-data-table__grid--fixed .ds-table__cell-content {
|
|
162
|
+
overflow-wrap: anywhere;
|
|
163
|
+
}
|
|
164
|
+
|
|
156
165
|
.ds-data-table__filler {
|
|
157
166
|
padding: 0;
|
|
158
167
|
}
|
|
@@ -679,11 +688,11 @@
|
|
|
679
688
|
}
|
|
680
689
|
|
|
681
690
|
/* Save and Cancel say which is which by colour as well as by shape. */
|
|
682
|
-
.ds-data-table__save .ds-
|
|
691
|
+
.ds-data-table__save .ds-icon-button__icon {
|
|
683
692
|
color: var(--color-status-positive-icon);
|
|
684
693
|
}
|
|
685
694
|
|
|
686
|
-
.ds-data-table__cancel .ds-
|
|
695
|
+
.ds-data-table__cancel .ds-icon-button__icon {
|
|
687
696
|
color: var(--color-status-error-icon);
|
|
688
697
|
}
|
|
689
698
|
|
|
@@ -1057,16 +1066,22 @@
|
|
|
1057
1066
|
rotate: 90deg;
|
|
1058
1067
|
}
|
|
1059
1068
|
|
|
1069
|
+
/* The group's value gives way first in a narrow column (a pinned row
|
|
1070
|
+
header on a phone): it ends in an ellipsis rather than running under its
|
|
1071
|
+
count and past the column's edge. The group toggle names it in full. */
|
|
1060
1072
|
.ds-data-table__group-value {
|
|
1061
|
-
display:
|
|
1062
|
-
|
|
1073
|
+
display: block;
|
|
1074
|
+
flex: 0 1 auto;
|
|
1063
1075
|
min-width: 0;
|
|
1076
|
+
overflow: hidden;
|
|
1077
|
+
text-overflow: ellipsis;
|
|
1064
1078
|
font-family: var(--font-paragraph-emphasis-family);
|
|
1065
1079
|
font-weight: var(--font-paragraph-emphasis-weight);
|
|
1066
1080
|
}
|
|
1067
1081
|
|
|
1068
1082
|
.ds-data-table__group-count,
|
|
1069
1083
|
.ds-data-table__group-total {
|
|
1084
|
+
flex: none;
|
|
1070
1085
|
font-family: var(--font-caption-family);
|
|
1071
1086
|
font-size: var(--font-caption-size);
|
|
1072
1087
|
font-weight: var(--font-caption-weight);
|