@robr0/design-system 0.7.0 → 0.8.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 +3 -3
- package/components/AgentPlan/AgentPlan.css +231 -0
- package/components/AgentPlan/AgentPlan.d.ts +41 -0
- package/components/AgentPlan/AgentPlan.js +99 -0
- package/components/DataTable/DataTable.css +105 -0
- package/components/DataTable/DataTable.d.ts +81 -0
- package/components/DataTable/DataTable.js +235 -0
- package/components/EventCalendar/EventCalendar.css +328 -0
- package/components/EventCalendar/EventCalendar.d.ts +51 -0
- package/components/EventCalendar/EventCalendar.js +213 -0
- package/components/ModelPicker/ModelPicker.css +238 -0
- package/components/ModelPicker/ModelPicker.d.ts +60 -0
- package/components/ModelPicker/ModelPicker.js +217 -0
- package/components/NotificationCenter/NotificationCenter.css +262 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +72 -0
- package/components/NotificationCenter/NotificationCenter.js +128 -0
- package/components/ShaderField/field.glsl.d.ts +11 -5
- package/components/ShaderField/field.glsl.js +4 -3
- package/components/ShaderField/useShaderField.d.ts +19 -2
- package/components/ShaderField/useShaderField.js +17 -3
- package/components/Timeline/Timeline.css +17 -0
- package/components/Timeline/Timeline.d.ts +2 -0
- package/components/Timeline/Timeline.js +1 -0
- package/components/registry.json +40 -0
- package/components/registry.json.d.ts +40 -0
- package/components/registry.json.js +1 -1
- package/index.d.ts +5 -0
- package/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo, useState } from "react";
|
|
3
|
+
import "./EventCalendar.css";
|
|
4
|
+
import "../../fonts/material-symbols.css";
|
|
5
|
+
const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
6
|
+
const MONTHS = [
|
|
7
|
+
"January",
|
|
8
|
+
"February",
|
|
9
|
+
"March",
|
|
10
|
+
"April",
|
|
11
|
+
"May",
|
|
12
|
+
"June",
|
|
13
|
+
"July",
|
|
14
|
+
"August",
|
|
15
|
+
"September",
|
|
16
|
+
"October",
|
|
17
|
+
"November",
|
|
18
|
+
"December"
|
|
19
|
+
];
|
|
20
|
+
function parseMonth(str) {
|
|
21
|
+
const [y, m] = str.split("-").map(Number);
|
|
22
|
+
return [y, m - 1];
|
|
23
|
+
}
|
|
24
|
+
function formatMonth(year, monthIndex) {
|
|
25
|
+
return `${year}-${String(monthIndex + 1).padStart(2, "0")}`;
|
|
26
|
+
}
|
|
27
|
+
function formatDate(date) {
|
|
28
|
+
const y = date.getFullYear();
|
|
29
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
30
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
31
|
+
return `${y}-${m}-${d}`;
|
|
32
|
+
}
|
|
33
|
+
const EventCalendar = React.forwardRef(
|
|
34
|
+
({
|
|
35
|
+
events = [],
|
|
36
|
+
month,
|
|
37
|
+
defaultMonth,
|
|
38
|
+
onMonthChange,
|
|
39
|
+
maxEventsPerDay = 3,
|
|
40
|
+
onEventClick,
|
|
41
|
+
onDateClick,
|
|
42
|
+
actions,
|
|
43
|
+
className = "",
|
|
44
|
+
...rest
|
|
45
|
+
}, ref) => {
|
|
46
|
+
const baseClass = "ds-event-calendar";
|
|
47
|
+
const today = useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
48
|
+
const isControlled = month !== void 0;
|
|
49
|
+
const [uncontrolledMonth, setUncontrolledMonth] = useState(
|
|
50
|
+
defaultMonth ?? formatMonth(today.getFullYear(), today.getMonth())
|
|
51
|
+
);
|
|
52
|
+
const currentMonth = isControlled ? month : uncontrolledMonth;
|
|
53
|
+
const [viewYear, viewMonth] = parseMonth(currentMonth);
|
|
54
|
+
const navigate = (offset) => {
|
|
55
|
+
const next = new Date(viewYear, viewMonth + offset, 1);
|
|
56
|
+
const value = formatMonth(next.getFullYear(), next.getMonth());
|
|
57
|
+
if (!isControlled) setUncontrolledMonth(value);
|
|
58
|
+
onMonthChange?.(value);
|
|
59
|
+
};
|
|
60
|
+
const eventsByDate = useMemo(() => {
|
|
61
|
+
const map = /* @__PURE__ */ new Map();
|
|
62
|
+
for (const event of events) {
|
|
63
|
+
const list = map.get(event.date) ?? [];
|
|
64
|
+
list.push(event);
|
|
65
|
+
map.set(event.date, list);
|
|
66
|
+
}
|
|
67
|
+
for (const list of map.values()) {
|
|
68
|
+
list.sort((a, b) => {
|
|
69
|
+
if (!a.time && !b.time) return 0;
|
|
70
|
+
if (!a.time) return -1;
|
|
71
|
+
if (!b.time) return 1;
|
|
72
|
+
return a.time.localeCompare(b.time);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return map;
|
|
76
|
+
}, [events]);
|
|
77
|
+
const firstDay = new Date(viewYear, viewMonth, 1).getDay();
|
|
78
|
+
const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
79
|
+
const weekCount = Math.ceil((firstDay + daysInMonth) / 7);
|
|
80
|
+
const cells = [];
|
|
81
|
+
for (let i = 0; i < weekCount * 7; i++) {
|
|
82
|
+
const date = new Date(viewYear, viewMonth, i - firstDay + 1);
|
|
83
|
+
cells.push({ date, inMonth: date.getMonth() === viewMonth });
|
|
84
|
+
}
|
|
85
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
86
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__month`, children: [
|
|
89
|
+
MONTHS[viewMonth],
|
|
90
|
+
" ",
|
|
91
|
+
viewYear
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__nav`, children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
type: "button",
|
|
98
|
+
className: `${baseClass}__nav-btn material-symbols-rounded`,
|
|
99
|
+
onClick: () => navigate(-1),
|
|
100
|
+
"aria-label": "Previous month",
|
|
101
|
+
children: "chevron_left"
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
className: `${baseClass}__nav-btn material-symbols-rounded`,
|
|
109
|
+
onClick: () => navigate(1),
|
|
110
|
+
"aria-label": "Next month",
|
|
111
|
+
children: "chevron_right"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }),
|
|
115
|
+
actions && /* @__PURE__ */ jsx("div", { className: `${baseClass}__actions`, children: actions })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__weekdays`, "aria-hidden": "true", children: DAYS.map((day) => /* @__PURE__ */ jsx("div", { className: `${baseClass}__weekday`, children: day }, day)) }),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
className: `${baseClass}__grid`,
|
|
122
|
+
role: "group",
|
|
123
|
+
"aria-label": `${MONTHS[viewMonth]} ${viewYear}`,
|
|
124
|
+
children: cells.map(({ date, inMonth }) => {
|
|
125
|
+
const dateStr = formatDate(date);
|
|
126
|
+
const dayEvents = eventsByDate.get(dateStr) ?? [];
|
|
127
|
+
const visible = dayEvents.slice(0, maxEventsPerDay);
|
|
128
|
+
const overflow = dayEvents.length - visible.length;
|
|
129
|
+
const isToday = date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
|
|
130
|
+
const dayLabel = date.toLocaleDateString(void 0, {
|
|
131
|
+
weekday: "long",
|
|
132
|
+
year: "numeric",
|
|
133
|
+
month: "long",
|
|
134
|
+
day: "numeric"
|
|
135
|
+
});
|
|
136
|
+
const cellClasses = [
|
|
137
|
+
`${baseClass}__cell`,
|
|
138
|
+
!inMonth ? `${baseClass}__cell--outside` : "",
|
|
139
|
+
isToday ? `${baseClass}__cell--today` : ""
|
|
140
|
+
].filter(Boolean).join(" ");
|
|
141
|
+
return /* @__PURE__ */ jsxs("div", { className: cellClasses, children: [
|
|
142
|
+
onDateClick ? /* @__PURE__ */ jsx(
|
|
143
|
+
"button",
|
|
144
|
+
{
|
|
145
|
+
type: "button",
|
|
146
|
+
className: `${baseClass}__day`,
|
|
147
|
+
onClick: () => onDateClick(dateStr),
|
|
148
|
+
"aria-label": dayLabel,
|
|
149
|
+
"aria-current": isToday ? "date" : void 0,
|
|
150
|
+
children: date.getDate()
|
|
151
|
+
}
|
|
152
|
+
) : /* @__PURE__ */ jsx(
|
|
153
|
+
"span",
|
|
154
|
+
{
|
|
155
|
+
className: `${baseClass}__day`,
|
|
156
|
+
"aria-label": dayLabel,
|
|
157
|
+
"aria-current": isToday ? "date" : void 0,
|
|
158
|
+
children: date.getDate()
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__events`, children: [
|
|
162
|
+
visible.map((event) => {
|
|
163
|
+
const pillClasses = [
|
|
164
|
+
`${baseClass}__event`,
|
|
165
|
+
`${baseClass}__event--${event.color ?? "neutral"}`
|
|
166
|
+
].join(" ");
|
|
167
|
+
const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
168
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
|
|
169
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, children: event.title }),
|
|
170
|
+
event.time && /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-time`, children: event.time })
|
|
171
|
+
] });
|
|
172
|
+
return onEventClick ? /* @__PURE__ */ jsx(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
className: pillClasses,
|
|
177
|
+
onClick: () => onEventClick(event),
|
|
178
|
+
"aria-label": `${event.title}${event.time ? `, ${event.time}` : ""}, ${dayLabel}`,
|
|
179
|
+
children: pillContent
|
|
180
|
+
},
|
|
181
|
+
event.id
|
|
182
|
+
) : /* @__PURE__ */ jsx("span", { className: pillClasses, children: pillContent }, event.id);
|
|
183
|
+
}),
|
|
184
|
+
overflow > 0 && (onDateClick ? /* @__PURE__ */ jsxs(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
type: "button",
|
|
188
|
+
className: `${baseClass}__more`,
|
|
189
|
+
onClick: () => onDateClick(dateStr),
|
|
190
|
+
"aria-label": `${overflow} more event${overflow === 1 ? "" : "s"}, ${dayLabel}`,
|
|
191
|
+
children: [
|
|
192
|
+
"+",
|
|
193
|
+
overflow,
|
|
194
|
+
" more"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
) : /* @__PURE__ */ jsxs("span", { className: `${baseClass}__more`, children: [
|
|
198
|
+
"+",
|
|
199
|
+
overflow,
|
|
200
|
+
" more"
|
|
201
|
+
] }))
|
|
202
|
+
] })
|
|
203
|
+
] }, dateStr);
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] });
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
EventCalendar.displayName = "EventCalendar";
|
|
211
|
+
export {
|
|
212
|
+
EventCalendar
|
|
213
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
MODEL PICKER COMPONENT
|
|
3
|
+
A quiet pill trigger showing the current
|
|
4
|
+
model, and a floating panel of models with
|
|
5
|
+
descriptions — plus an optional effort row.
|
|
6
|
+
|
|
7
|
+
Sized for Composer's action bar: the trigger
|
|
8
|
+
reads as chrome, not as a call to action, so
|
|
9
|
+
the send button keeps the only teal.
|
|
10
|
+
============================================ */
|
|
11
|
+
|
|
12
|
+
.ds-model-picker {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ============================================
|
|
18
|
+
TRIGGER
|
|
19
|
+
============================================ */
|
|
20
|
+
|
|
21
|
+
.ds-model-picker__trigger {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: var(--gap-xxs);
|
|
25
|
+
padding: var(--padding-xxs) var(--padding-sm);
|
|
26
|
+
background-color: var(--color-action-passive-bg);
|
|
27
|
+
border: none;
|
|
28
|
+
border-radius: var(--radius-full);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
color: var(--color-text-secondary);
|
|
31
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
32
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
33
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
34
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
35
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
36
|
+
transition: background-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-model-picker__trigger:hover {
|
|
40
|
+
background-color: var(--color-action-passive-bg-hover);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-model-picker__trigger:focus-visible {
|
|
44
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
45
|
+
outline-offset: 2px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-model-picker__trigger:disabled {
|
|
49
|
+
opacity: 0.4;
|
|
50
|
+
cursor: not-allowed;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ds-model-picker__trigger-label {
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ds-model-picker__chevron {
|
|
58
|
+
--icon-size: var(--icon-size-sm);
|
|
59
|
+
|
|
60
|
+
color: var(--color-icon-secondary);
|
|
61
|
+
transition: transform var(--motion-duration-slow) var(--motion-ease-standard);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-model-picker--open .ds-model-picker__chevron {
|
|
65
|
+
transform: rotate(180deg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ============================================
|
|
69
|
+
PANEL
|
|
70
|
+
============================================ */
|
|
71
|
+
|
|
72
|
+
.ds-model-picker__panel {
|
|
73
|
+
position: absolute;
|
|
74
|
+
left: 0;
|
|
75
|
+
z-index: 10;
|
|
76
|
+
min-width: 260px;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
background-color: var(--color-bg-container-primary);
|
|
80
|
+
border: var(--border-xs) solid var(--color-bg-container-border);
|
|
81
|
+
border-radius: var(--radius-md);
|
|
82
|
+
box-shadow: var(--shadow-floating);
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-model-picker--bottom .ds-model-picker__panel {
|
|
87
|
+
top: calc(100% + var(--gap-xxs));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-model-picker--top .ds-model-picker__panel {
|
|
91
|
+
bottom: calc(100% + var(--gap-xxs));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ============================================
|
|
95
|
+
MODEL LIST
|
|
96
|
+
============================================ */
|
|
97
|
+
|
|
98
|
+
.ds-model-picker__list {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: var(--gap-xxs);
|
|
102
|
+
margin: 0;
|
|
103
|
+
padding: var(--padding-xxs);
|
|
104
|
+
list-style: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ds-model-picker__option {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: var(--gap-sm);
|
|
111
|
+
padding: var(--padding-xxs) var(--padding-sm);
|
|
112
|
+
border-radius: var(--radius-sm);
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
transition: background-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ds-model-picker__option:hover,
|
|
118
|
+
.ds-model-picker__option--focused {
|
|
119
|
+
background-color: var(--color-bg-container-secondary);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ds-model-picker__option--disabled {
|
|
123
|
+
opacity: 0.4;
|
|
124
|
+
cursor: not-allowed;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ds-model-picker__option--disabled:hover {
|
|
128
|
+
background-color: transparent;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ds-model-picker__option-main {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
flex: 1 1 auto;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ds-model-picker__option-label {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: var(--gap-xs);
|
|
142
|
+
color: var(--color-text-primary);
|
|
143
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
144
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
145
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
146
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
147
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ds-model-picker__option-badge {
|
|
151
|
+
padding: 0 var(--padding-xs);
|
|
152
|
+
background-color: var(--color-status-info-bg);
|
|
153
|
+
border-radius: var(--radius-full);
|
|
154
|
+
color: var(--color-status-info-text);
|
|
155
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
156
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
157
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
158
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
159
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.ds-model-picker__option-description {
|
|
163
|
+
color: var(--color-text-tertiary);
|
|
164
|
+
font-family: var(--font-paragraph-sm-family);
|
|
165
|
+
font-size: var(--font-paragraph-sm-size);
|
|
166
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
167
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
168
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ds-model-picker__check {
|
|
172
|
+
--icon-size: var(--icon-size-sm);
|
|
173
|
+
|
|
174
|
+
flex: none;
|
|
175
|
+
color: var(--color-action-primary-text-tertiary);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* ============================================
|
|
179
|
+
EFFORT ROW
|
|
180
|
+
============================================ */
|
|
181
|
+
|
|
182
|
+
.ds-model-picker__effort {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: var(--gap-sm);
|
|
186
|
+
padding: var(--padding-xs) var(--padding-sm);
|
|
187
|
+
border-top: var(--border-xs) solid var(--color-divider);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ds-model-picker__effort-label {
|
|
191
|
+
flex: 1 1 auto;
|
|
192
|
+
color: var(--color-text-secondary);
|
|
193
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
194
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
195
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
196
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
197
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ds-model-picker__effort-options {
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
gap: var(--gap-xxs);
|
|
203
|
+
padding: var(--padding-xxxs);
|
|
204
|
+
background-color: var(--color-bg-container-secondary);
|
|
205
|
+
border-radius: var(--radius-full);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ds-model-picker__effort-option {
|
|
209
|
+
padding: var(--padding-xxxs) var(--padding-sm);
|
|
210
|
+
background: none;
|
|
211
|
+
border: none;
|
|
212
|
+
border-radius: var(--radius-full);
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
color: var(--color-text-secondary);
|
|
215
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
216
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
217
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
218
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
219
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
220
|
+
transition:
|
|
221
|
+
background-color var(--motion-duration-fast) var(--motion-ease-standard),
|
|
222
|
+
color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.ds-model-picker__effort-option:hover {
|
|
226
|
+
color: var(--color-text-primary);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.ds-model-picker__effort-option:focus-visible {
|
|
230
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
231
|
+
outline-offset: -2px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.ds-model-picker__effort-option--selected {
|
|
235
|
+
background-color: var(--color-bg-container-primary);
|
|
236
|
+
color: var(--color-text-primary);
|
|
237
|
+
box-shadow: var(--shadow-floating);
|
|
238
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ModelPickerModel {
|
|
3
|
+
/** Display name, e.g. "Fable 5". */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Stable identifier reported through `onValueChange`. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** One line on what the model is good at or how fast it is. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Small trailing tag, e.g. "New". */
|
|
10
|
+
badge?: string;
|
|
11
|
+
/** Whether this model can be chosen. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ModelPickerEffortOption {
|
|
15
|
+
/** Display label, e.g. "Medium". */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Stable identifier reported through `onEffortChange`. */
|
|
18
|
+
value: string;
|
|
19
|
+
}
|
|
20
|
+
/** Props owned by ModelPicker itself — everything else falls through to the root element. */
|
|
21
|
+
type ModelPickerOwnProps = {
|
|
22
|
+
/** The models on offer, in display order. */
|
|
23
|
+
models: ModelPickerModel[];
|
|
24
|
+
/** Selected model value for controlled use. Pair with `onValueChange`. */
|
|
25
|
+
value?: string;
|
|
26
|
+
/** Initially selected model value for uncontrolled use. Defaults to the first model. */
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
/** Fires with the newly selected model's value. */
|
|
29
|
+
onValueChange?: (value: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Selected effort level for controlled use. Setting this (or `defaultEffort`)
|
|
32
|
+
* is what makes the effort row appear at all.
|
|
33
|
+
*/
|
|
34
|
+
effort?: string;
|
|
35
|
+
/** Initially selected effort level for uncontrolled use. */
|
|
36
|
+
defaultEffort?: string;
|
|
37
|
+
/** Fires with the newly selected effort value. */
|
|
38
|
+
onEffortChange?: (effort: string) => void;
|
|
39
|
+
/** The effort levels on offer. Defaults to low, medium and high. */
|
|
40
|
+
effortOptions?: ModelPickerEffortOption[];
|
|
41
|
+
/** Which side of the trigger the panel opens on. In a composer pinned to the bottom of the screen, use `top`. */
|
|
42
|
+
placement?: 'bottom' | 'top';
|
|
43
|
+
/** Whether the whole control is disabled. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Additional CSS classes */
|
|
46
|
+
className?: string;
|
|
47
|
+
};
|
|
48
|
+
export interface ModelPickerProps extends ModelPickerOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof ModelPickerOwnProps> {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* ModelPicker is the model selector for a chat surface: a quiet pill trigger
|
|
52
|
+
* showing the current model, and a floating panel listing every model with a
|
|
53
|
+
* one-line description — plus, when an effort value is provided, a row of
|
|
54
|
+
* effort levels below a divider.
|
|
55
|
+
*
|
|
56
|
+
* Built for Composer's `actions` slot, but freestanding anywhere. Forwards a
|
|
57
|
+
* ref to the root element and spreads unrecognised props onto it.
|
|
58
|
+
*/
|
|
59
|
+
export declare const ModelPicker: React.ForwardRefExoticComponent<ModelPickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export {};
|