@usefragments/ui 1.3.3 → 1.5.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/dist/assets/ui.css +1212 -798
- package/dist/chart.cjs +60 -24
- package/dist/chart.js +38 -24
- package/dist/colorpicker.cjs +56 -9
- package/dist/colorpicker.js +34 -9
- package/dist/components/Badge/Badge.module.scss.cjs +23 -16
- package/dist/components/Badge/Badge.module.scss.js +23 -16
- package/dist/components/Badge/index.cjs +8 -1
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +8 -1
- package/dist/components/Button/Button.module.scss.cjs +16 -13
- package/dist/components/Button/Button.module.scss.js +16 -13
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Card/index.cjs +2 -2
- package/dist/components/Card/index.d.ts +4 -1
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Card/index.js +2 -2
- package/dist/components/Chart/index.d.ts +3 -0
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
- package/dist/components/Combobox/Combobox.module.scss.js +23 -23
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +13 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +14 -11
- package/dist/components/ConversationList/index.cjs +26 -22
- package/dist/components/ConversationList/index.d.ts +5 -1
- package/dist/components/ConversationList/index.d.ts.map +1 -1
- package/dist/components/ConversationList/index.js +27 -23
- package/dist/components/DataTable/index.d.ts +4 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +3 -0
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Editor/index.d.ts +4 -1
- package/dist/components/Editor/index.d.ts.map +1 -1
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +1 -1
- package/dist/components/Markdown/index.d.ts +16 -0
- package/dist/components/Markdown/index.d.ts.map +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +14 -14
- package/dist/components/Menu/Menu.module.scss.js +14 -14
- package/dist/components/Message/Message.module.scss.cjs +23 -20
- package/dist/components/Message/Message.module.scss.js +24 -21
- package/dist/components/Message/index.cjs +5 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +5 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
- package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
- package/dist/components/Pagination/Pagination.module.scss.js +7 -7
- package/dist/components/Progress/Progress.module.scss.cjs +28 -25
- package/dist/components/Progress/Progress.module.scss.js +28 -25
- package/dist/components/Progress/index.cjs +3 -0
- package/dist/components/Progress/index.d.ts +8 -8
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +3 -0
- package/dist/components/Prompt/Prompt.module.scss.cjs +52 -22
- package/dist/components/Prompt/Prompt.module.scss.js +52 -22
- package/dist/components/Prompt/index.cjs +197 -2
- package/dist/components/Prompt/index.d.ts +98 -3
- package/dist/components/Prompt/index.d.ts.map +1 -1
- package/dist/components/Prompt/index.js +198 -3
- package/dist/components/Select/Select.module.scss.cjs +29 -17
- package/dist/components/Select/Select.module.scss.js +30 -18
- package/dist/components/Select/index.cjs +45 -8
- package/dist/components/Select/index.d.ts +17 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +45 -8
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +45 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +45 -42
- package/dist/components/Sidebar/index.cjs +2 -0
- package/dist/components/Sidebar/index.d.ts +6 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Text/Text.module.scss.cjs +63 -51
- package/dist/components/Text/Text.module.scss.js +63 -51
- package/dist/components/Text/index.d.ts +4 -2
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/data-table.cjs +210 -28
- package/dist/data-table.js +189 -29
- package/dist/datepicker.cjs +63 -14
- package/dist/datepicker.js +41 -14
- package/dist/editor.cjs +67 -16
- package/dist/editor.js +45 -16
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/markdown.cjs +63 -19
- package/dist/markdown.js +41 -19
- package/fragments.json +1 -1
- package/package.json +2 -2
- package/src/components/Badge/Badge.contract.json +28 -5
- package/src/components/Badge/Badge.module.scss +21 -0
- package/src/components/Badge/index.tsx +10 -1
- package/src/components/Button/Button.contract.json +9 -3
- package/src/components/Button/Button.module.scss +34 -0
- package/src/components/Button/index.tsx +11 -1
- package/src/components/Card/Card.contract.json +5 -0
- package/src/components/Card/index.tsx +6 -3
- package/src/components/Chart/Chart.contract.json +7 -0
- package/src/components/Chart/index.tsx +44 -27
- package/src/components/CodeBlock/CodeBlock.contract.json +7 -0
- package/src/components/CodeBlock/CodeBlock.module.scss +7 -2
- package/src/components/ColorPicker/ColorPicker.contract.json +9 -1
- package/src/components/ColorPicker/index.tsx +42 -12
- package/src/components/Combobox/Combobox.module.scss +4 -13
- package/src/components/ConversationList/ConversationList.contract.json +16 -1
- package/src/components/ConversationList/ConversationList.module.scss +12 -0
- package/src/components/ConversationList/index.tsx +40 -26
- package/src/components/DataTable/DataTable.contract.json +8 -1
- package/src/components/DataTable/index.tsx +282 -51
- package/src/components/DatePicker/DatePicker.contract.json +8 -1
- package/src/components/DatePicker/index.tsx +51 -22
- package/src/components/Editor/Editor.contract.json +19 -1
- package/src/components/Editor/index.tsx +67 -23
- package/src/components/Listbox/Listbox.module.scss +3 -11
- package/src/components/Markdown/Markdown.contract.json +15 -1
- package/src/components/Markdown/Markdown.module.scss +18 -1
- package/src/components/Markdown/index.tsx +58 -24
- package/src/components/Menu/Menu.module.scss +12 -2
- package/src/components/Message/Message.contract.json +3 -0
- package/src/components/Message/Message.module.scss +33 -4
- package/src/components/Message/index.tsx +7 -1
- package/src/components/Pagination/Pagination.contract.json +1 -0
- package/src/components/Pagination/Pagination.module.scss +5 -4
- package/src/components/Progress/Progress.contract.json +9 -27
- package/src/components/Progress/Progress.module.scss +5 -1
- package/src/components/Progress/index.tsx +56 -62
- package/src/components/Prompt/Prompt.contract.json +40 -1
- package/src/components/Prompt/Prompt.module.scss +351 -4
- package/src/components/Prompt/index.tsx +324 -0
- package/src/components/Select/Select.contract.json +11 -1
- package/src/components/Select/Select.module.scss +80 -13
- package/src/components/Select/index.tsx +73 -7
- package/src/components/Sidebar/Sidebar.contract.json +1 -0
- package/src/components/Sidebar/Sidebar.module.scss +10 -0
- package/src/components/Sidebar/index.tsx +7 -0
- package/src/components/Text/Text.contract.json +7 -4
- package/src/components/Text/Text.module.scss +18 -0
- package/src/components/Text/index.tsx +4 -2
- package/src/index.ts +1 -0
- package/src/tokens/_mixins.scss +39 -4
- package/src/tokens/_variables.scss +30 -0
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
"name": "Progress",
|
|
4
4
|
"description": "Visual indicator of task completion or loading state. Available in linear and circular variants.",
|
|
5
5
|
"category": "feedback",
|
|
6
|
-
"tags": [
|
|
7
|
-
"progress",
|
|
8
|
-
"loading",
|
|
9
|
-
"indicator",
|
|
10
|
-
"percentage",
|
|
11
|
-
"status"
|
|
12
|
-
],
|
|
6
|
+
"tags": ["progress", "loading", "indicator", "percentage", "status"],
|
|
13
7
|
"status": "stable",
|
|
14
8
|
"sourcePath": "src/components/Progress/index.tsx",
|
|
15
9
|
"exportName": "Progress",
|
|
@@ -18,7 +12,8 @@
|
|
|
18
12
|
"min: number (default: 0)",
|
|
19
13
|
"max: number (default: 100)",
|
|
20
14
|
"size: sm|md|lg (default: md)",
|
|
21
|
-
"variant: default|success|warning|danger (default: default)",
|
|
15
|
+
"variant: default|neutral|success|warning|danger (default: default)",
|
|
16
|
+
"role: progressbar|meter (default: progressbar)",
|
|
22
17
|
"label: string",
|
|
23
18
|
"showValue: boolean (default: false)",
|
|
24
19
|
"formatValue: function"
|
|
@@ -47,23 +42,14 @@
|
|
|
47
42
|
"description": "Size of the progress bar",
|
|
48
43
|
"default": "md",
|
|
49
44
|
"required": false,
|
|
50
|
-
"values": [
|
|
51
|
-
"sm",
|
|
52
|
-
"md",
|
|
53
|
-
"lg"
|
|
54
|
-
]
|
|
45
|
+
"values": ["sm", "md", "lg"]
|
|
55
46
|
},
|
|
56
47
|
"variant": {
|
|
57
48
|
"type": "enum",
|
|
58
49
|
"description": "Color variant",
|
|
59
50
|
"default": "default",
|
|
60
51
|
"required": false,
|
|
61
|
-
"values": [
|
|
62
|
-
"default",
|
|
63
|
-
"success",
|
|
64
|
-
"warning",
|
|
65
|
-
"danger"
|
|
66
|
-
]
|
|
52
|
+
"values": ["default", "neutral", "success", "warning", "danger"]
|
|
67
53
|
},
|
|
68
54
|
"label": {
|
|
69
55
|
"type": "string",
|
|
@@ -99,10 +85,12 @@
|
|
|
99
85
|
"Use indeterminate for unknown durations",
|
|
100
86
|
"Include a label for context when the purpose isnt obvious",
|
|
101
87
|
"Use appropriate color variants for success/warning/danger states",
|
|
88
|
+
"Use variant=\"neutral\" with role=\"meter\" for magnitude or distribution values where reaching the maximum is not a success state",
|
|
102
89
|
"Determinate values are clamped to the min/max range for display"
|
|
103
90
|
],
|
|
104
91
|
"accessibility": [
|
|
105
92
|
"Uses role=\"progressbar\" with aria-valuenow",
|
|
93
|
+
"Accepts role=\"meter\" for scalar measurements within a known range",
|
|
106
94
|
"Label is associated with the progress bar",
|
|
107
95
|
"State changes are announced to screen readers"
|
|
108
96
|
]
|
|
@@ -155,17 +143,11 @@
|
|
|
155
143
|
"showValue: boolean - display percentage",
|
|
156
144
|
"Determinate display values are clamped (and invalid min/max ranges render as 0%)"
|
|
157
145
|
],
|
|
158
|
-
"a11yRules": [
|
|
159
|
-
"A11Y_PROGRESS_ROLE",
|
|
160
|
-
"A11Y_PROGRESS_VALUE"
|
|
161
|
-
]
|
|
146
|
+
"a11yRules": ["A11Y_PROGRESS_ROLE", "A11Y_PROGRESS_VALUE"]
|
|
162
147
|
},
|
|
163
148
|
"ai": {
|
|
164
149
|
"compositionPattern": "compound",
|
|
165
|
-
"subComponents": [
|
|
166
|
-
"Root",
|
|
167
|
-
"Circular"
|
|
168
|
-
]
|
|
150
|
+
"subComponents": ["Root", "Circular"]
|
|
169
151
|
},
|
|
170
152
|
"provenance": {
|
|
171
153
|
"source": "migrated",
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Color variants
|
|
66
|
+
.indicatorNeutral {
|
|
67
|
+
background-color: var(--fui-text-tertiary, $fui-text-tertiary);
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
.indicatorSuccess {
|
|
67
71
|
background-color: var(--fui-color-success-text, $fui-color-success-text);
|
|
68
72
|
}
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
// Complete state
|
|
97
|
-
.root[data-complete] .indicator {
|
|
101
|
+
.root[data-complete] .indicator:not(.indicatorNeutral) {
|
|
98
102
|
background-color: var(--fui-color-success-text, $fui-color-success-text);
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import { Progress as BaseProgress } from
|
|
5
|
-
import styles from
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Progress as BaseProgress } from "@base-ui/react/progress";
|
|
5
|
+
import styles from "./Progress.module.scss";
|
|
6
6
|
|
|
7
7
|
// ============================================
|
|
8
8
|
// Types
|
|
9
9
|
// ============================================
|
|
10
10
|
|
|
11
|
-
export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
11
|
+
export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue"> {
|
|
12
12
|
/** Current progress value (0-100). Null for indeterminate. */
|
|
13
13
|
value?: number | null;
|
|
14
14
|
/** Minimum value */
|
|
@@ -16,9 +16,9 @@ export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
16
16
|
/** Maximum value */
|
|
17
17
|
max?: number;
|
|
18
18
|
/** Size of the progress bar */
|
|
19
|
-
size?:
|
|
19
|
+
size?: "sm" | "md" | "lg";
|
|
20
20
|
/** Color variant */
|
|
21
|
-
variant?:
|
|
21
|
+
variant?: "default" | "neutral" | "success" | "warning" | "danger";
|
|
22
22
|
/** Label text */
|
|
23
23
|
label?: string;
|
|
24
24
|
/** Show percentage value */
|
|
@@ -31,9 +31,9 @@ export interface CircularProgressProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
31
31
|
/** Current progress value (0-100). Null for indeterminate. */
|
|
32
32
|
value?: number | null;
|
|
33
33
|
/** Size of the circular progress */
|
|
34
|
-
size?:
|
|
34
|
+
size?: "sm" | "md" | "lg";
|
|
35
35
|
/** Color variant */
|
|
36
|
-
variant?:
|
|
36
|
+
variant?: "default" | "success" | "warning" | "danger";
|
|
37
37
|
/** Show percentage in center */
|
|
38
38
|
showValue?: boolean;
|
|
39
39
|
/** Stroke width */
|
|
@@ -48,52 +48,51 @@ function ProgressRoot({
|
|
|
48
48
|
value = null,
|
|
49
49
|
min = 0,
|
|
50
50
|
max = 100,
|
|
51
|
-
size =
|
|
52
|
-
variant =
|
|
51
|
+
size = "md",
|
|
52
|
+
variant = "default",
|
|
53
53
|
label,
|
|
54
54
|
showValue = false,
|
|
55
55
|
formatValue,
|
|
56
56
|
className,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
role,
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
"aria-valuetext": ariaValueText,
|
|
59
60
|
...htmlProps
|
|
60
61
|
}: ProgressProps) {
|
|
61
62
|
const isIndeterminate = value === null;
|
|
62
63
|
const range = max - min;
|
|
63
|
-
const normalizedPercentage = isIndeterminate
|
|
64
|
-
? 0
|
|
65
|
-
: range <= 0
|
|
66
|
-
? 0
|
|
67
|
-
: ((value - min) / range) * 100;
|
|
64
|
+
const normalizedPercentage = isIndeterminate ? 0 : range <= 0 ? 0 : ((value - min) / range) * 100;
|
|
68
65
|
const percentage = isIndeterminate
|
|
69
66
|
? 0
|
|
70
67
|
: Math.round(Math.min(100, Math.max(0, normalizedPercentage)));
|
|
71
68
|
|
|
72
69
|
const trackClasses = [
|
|
73
70
|
styles.track,
|
|
74
|
-
size ===
|
|
75
|
-
size ===
|
|
76
|
-
size ===
|
|
77
|
-
]
|
|
71
|
+
size === "sm" && styles.trackSm,
|
|
72
|
+
size === "md" && styles.trackMd,
|
|
73
|
+
size === "lg" && styles.trackLg,
|
|
74
|
+
]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(" ");
|
|
78
77
|
|
|
79
78
|
const indicatorClasses = [
|
|
80
79
|
styles.indicator,
|
|
81
|
-
variant ===
|
|
82
|
-
variant ===
|
|
83
|
-
variant ===
|
|
80
|
+
variant === "neutral" && styles.indicatorNeutral,
|
|
81
|
+
variant === "success" && styles.indicatorSuccess,
|
|
82
|
+
variant === "warning" && styles.indicatorWarning,
|
|
83
|
+
variant === "danger" && styles.indicatorDanger,
|
|
84
84
|
isIndeterminate && styles.indicatorIndeterminate,
|
|
85
|
-
]
|
|
85
|
+
]
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.join(" ");
|
|
86
88
|
|
|
87
|
-
const rootClasses = [styles.root, className].filter(Boolean).join(
|
|
89
|
+
const rootClasses = [styles.root, className].filter(Boolean).join(" ");
|
|
88
90
|
|
|
89
|
-
const displayValue = formatValue
|
|
90
|
-
? formatValue(percentage)
|
|
91
|
-
: `${percentage}%`;
|
|
91
|
+
const displayValue = formatValue ? formatValue(percentage) : `${percentage}%`;
|
|
92
92
|
|
|
93
93
|
// Default value text for screen readers
|
|
94
|
-
const effectiveValueText =
|
|
95
|
-
isIndeterminate ?
|
|
96
|
-
);
|
|
94
|
+
const effectiveValueText =
|
|
95
|
+
ariaValueText || (isIndeterminate ? "Loading" : `${percentage} percent`);
|
|
97
96
|
|
|
98
97
|
return (
|
|
99
98
|
<BaseProgress.Root
|
|
@@ -102,20 +101,15 @@ function ProgressRoot({
|
|
|
102
101
|
min={min}
|
|
103
102
|
max={max}
|
|
104
103
|
className={rootClasses}
|
|
105
|
-
|
|
104
|
+
role={role ?? "progressbar"}
|
|
105
|
+
aria-label={ariaLabel || (label ? undefined : "Progress")}
|
|
106
106
|
aria-valuetext={effectiveValueText}
|
|
107
107
|
aria-busy={isIndeterminate}
|
|
108
108
|
>
|
|
109
109
|
{(label || showValue) && (
|
|
110
110
|
<div className={styles.header}>
|
|
111
|
-
{label &&
|
|
112
|
-
|
|
113
|
-
{label}
|
|
114
|
-
</BaseProgress.Label>
|
|
115
|
-
)}
|
|
116
|
-
{showValue && !isIndeterminate && (
|
|
117
|
-
<span className={styles.value}>{displayValue}</span>
|
|
118
|
-
)}
|
|
111
|
+
{label && <BaseProgress.Label className={styles.label}>{label}</BaseProgress.Label>}
|
|
112
|
+
{showValue && !isIndeterminate && <span className={styles.value}>{displayValue}</span>}
|
|
119
113
|
</div>
|
|
120
114
|
)}
|
|
121
115
|
<BaseProgress.Track className={trackClasses}>
|
|
@@ -140,14 +134,14 @@ const CIRCLE_SIZES = {
|
|
|
140
134
|
|
|
141
135
|
function CircularProgressRoot({
|
|
142
136
|
value = null,
|
|
143
|
-
size =
|
|
144
|
-
variant =
|
|
137
|
+
size = "md",
|
|
138
|
+
variant = "default",
|
|
145
139
|
showValue = false,
|
|
146
140
|
strokeWidth: customStrokeWidth,
|
|
147
141
|
className,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
"aria-label": ariaLabel,
|
|
143
|
+
"aria-labelledby": ariaLabelledBy,
|
|
144
|
+
"aria-valuetext": ariaValueText,
|
|
151
145
|
...htmlProps
|
|
152
146
|
}: CircularProgressProps) {
|
|
153
147
|
const isIndeterminate = value === null;
|
|
@@ -160,26 +154,24 @@ function CircularProgressRoot({
|
|
|
160
154
|
const circumference = 2 * Math.PI * radius;
|
|
161
155
|
const offset = circumference - (percentage / 100) * circumference;
|
|
162
156
|
|
|
163
|
-
const sizeClass =
|
|
164
|
-
: size ===
|
|
165
|
-
: styles.circularMd;
|
|
157
|
+
const sizeClass =
|
|
158
|
+
size === "sm" ? styles.circularSm : size === "lg" ? styles.circularLg : styles.circularMd;
|
|
166
159
|
|
|
167
160
|
const indicatorClasses = [
|
|
168
161
|
styles.circularIndicator,
|
|
169
|
-
variant ===
|
|
170
|
-
variant ===
|
|
171
|
-
variant ===
|
|
162
|
+
variant === "success" && styles.circularIndicatorSuccess,
|
|
163
|
+
variant === "warning" && styles.circularIndicatorWarning,
|
|
164
|
+
variant === "danger" && styles.circularIndicatorDanger,
|
|
172
165
|
isIndeterminate && styles.circularIndicatorIndeterminate,
|
|
173
|
-
]
|
|
174
|
-
|
|
175
|
-
const rootClasses = [styles.circular, sizeClass, className]
|
|
166
|
+
]
|
|
176
167
|
.filter(Boolean)
|
|
177
|
-
.join(
|
|
168
|
+
.join(" ");
|
|
169
|
+
|
|
170
|
+
const rootClasses = [styles.circular, sizeClass, className].filter(Boolean).join(" ");
|
|
178
171
|
|
|
179
172
|
// Default value text for screen readers
|
|
180
|
-
const effectiveValueText =
|
|
181
|
-
isIndeterminate ?
|
|
182
|
-
);
|
|
173
|
+
const effectiveValueText =
|
|
174
|
+
ariaValueText || (isIndeterminate ? "Loading" : `${Math.round(percentage)} percent`);
|
|
183
175
|
|
|
184
176
|
return (
|
|
185
177
|
<BaseProgress.Root
|
|
@@ -220,11 +212,13 @@ function CircularProgressRoot({
|
|
|
220
212
|
strokeWidth={strokeWidth}
|
|
221
213
|
strokeDasharray={circumference}
|
|
222
214
|
strokeDashoffset={isIndeterminate ? undefined : offset}
|
|
223
|
-
style={isIndeterminate ? { transformOrigin:
|
|
215
|
+
style={isIndeterminate ? { transformOrigin: "center" } : undefined}
|
|
224
216
|
/>
|
|
225
217
|
</svg>
|
|
226
218
|
{showValue && !isIndeterminate && (
|
|
227
|
-
<span className={styles.circularValue} aria-hidden="true">
|
|
219
|
+
<span className={styles.circularValue} aria-hidden="true">
|
|
220
|
+
{Math.round(percentage)}%
|
|
221
|
+
</span>
|
|
228
222
|
)}
|
|
229
223
|
</BaseProgress.Root>
|
|
230
224
|
);
|
|
@@ -27,7 +27,10 @@
|
|
|
27
27
|
"maxRows: number (default: 8)",
|
|
28
28
|
"autoResize: boolean (default: true)",
|
|
29
29
|
"submitOnEnter: boolean (default: true)",
|
|
30
|
-
"variant: default|fixed|sticky (default: default)"
|
|
30
|
+
"variant: default|fixed|sticky (default: default)",
|
|
31
|
+
"appearance: panel|seamless (default: panel)",
|
|
32
|
+
"onFiles: function",
|
|
33
|
+
"accept: string"
|
|
31
34
|
],
|
|
32
35
|
"props": {
|
|
33
36
|
"children": {
|
|
@@ -108,6 +111,26 @@
|
|
|
108
111
|
"fixed",
|
|
109
112
|
"sticky"
|
|
110
113
|
]
|
|
114
|
+
},
|
|
115
|
+
"onFiles": {
|
|
116
|
+
"type": "function",
|
|
117
|
+
"description": "Called with files added by the attach button, a paste, or a drop anywhere on the card. Providing it enables all three.",
|
|
118
|
+
"required": false
|
|
119
|
+
},
|
|
120
|
+
"accept": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "accept filter for the attach button's picker, e.g. \"image/*\"",
|
|
123
|
+
"required": false
|
|
124
|
+
},
|
|
125
|
+
"appearance": {
|
|
126
|
+
"type": "enum",
|
|
127
|
+
"description": "How the card is divided up. \"panel\" keeps the toolbar as a filled footer under a rule; \"seamless\" makes the whole card one writing surface with the controls floating on it.",
|
|
128
|
+
"default": "panel",
|
|
129
|
+
"required": false,
|
|
130
|
+
"values": [
|
|
131
|
+
"panel",
|
|
132
|
+
"seamless"
|
|
133
|
+
]
|
|
111
134
|
}
|
|
112
135
|
},
|
|
113
136
|
"usage": {
|
|
@@ -126,6 +149,14 @@
|
|
|
126
149
|
"Use loading state during API calls",
|
|
127
150
|
"Prompt.Textarea forwards native textarea props (autoComplete, inputMode, aria-*, data-*, handlers)",
|
|
128
151
|
"Prompt.Textarea composes your onChange/onKeyDown handlers with built-in submit and auto-resize behavior",
|
|
152
|
+
"Use appearance=\"seamless\" for agent composers where the controls should float on the writing surface rather than sit in a footer",
|
|
153
|
+
"Seamless controls share the dense 32px token scale with body-sized labels and standard glyphs so mixed Prompt.Select, Prompt.Attach and Prompt.Submit rows remain optically aligned",
|
|
154
|
+
"Seamless secondary controls keep transparent hover and open states so they read as inline tools; only Prompt.Submit carries a persistent filled shape",
|
|
155
|
+
"Seamless Prompt.Submit mirrors the trailing ink gutter established by Prompt.Attach at the leading edge",
|
|
156
|
+
"Prompt.Submit uses a neutral inverse surface by default so the primary action stays visible without consuming semantic brand color",
|
|
157
|
+
"Use Prompt.ModeButton for a setting you toggle and Prompt.Select for one you pick from a list",
|
|
158
|
+
"Wire onFiles once: the attach button, pasting a screenshot and dropping on the card all go through it",
|
|
159
|
+
"Render Prompt.Attachments above Prompt.Textarea — attachments are part of the message, not a setting on it",
|
|
129
160
|
"Consider showing usage/token limits for AI contexts"
|
|
130
161
|
],
|
|
131
162
|
"accessibility": [
|
|
@@ -150,6 +181,11 @@
|
|
|
150
181
|
"description": "Shows token usage indicator",
|
|
151
182
|
"code": "<Prompt onSubmit={(value) => console.log(value)}>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.ActionButton aria-label=\"Add attachment\">\n +\n </Prompt.ActionButton>\n <Prompt.ModeButton active>Auto</Prompt.ModeButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Usage>52% used</Prompt.Usage>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
152
183
|
},
|
|
184
|
+
{
|
|
185
|
+
"name": "Agent Composer",
|
|
186
|
+
"description": "Seamless surface with the scope of the run chosen on the toolbar",
|
|
187
|
+
"code": "<Prompt\n appearance=\"seamless\"\n submitOnEnter={false}\n minRows={3}\n onSubmit={(value) => console.log(value)}\n>\n <Prompt.Textarea placeholder=\"What should be true when this is done?\" />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.Select\n aria-label=\"Model\"\n defaultValue=\"claude-opus-4-8\"\n options={[{ value: 'claude-opus-4-8', label: 'Opus 4.8' }, { value: 'claude-sonnet-5', label: 'Sonnet 5' }]}\n />\n <Prompt.ModeButton>Plan</Prompt.ModeButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
188
|
+
},
|
|
153
189
|
{
|
|
154
190
|
"name": "Loading State",
|
|
155
191
|
"description": "During API submission",
|
|
@@ -200,6 +236,9 @@
|
|
|
200
236
|
"Info",
|
|
201
237
|
"ActionButton",
|
|
202
238
|
"ModeButton",
|
|
239
|
+
"Select",
|
|
240
|
+
"Attach",
|
|
241
|
+
"Attachments",
|
|
203
242
|
"Usage",
|
|
204
243
|
"Submit"
|
|
205
244
|
]
|