@brightlocal/ui-components 2.27.0 → 3.1.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 +7 -1
- package/component-meta.json +568 -143
- package/deprecations.json +298 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +147 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/{progress-screen.d.ts → progress-state.d.ts} +30 -18
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +160 -161
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +12 -12
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +42 -3
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +102 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +46 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +172 -157
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +100 -84
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +81 -79
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +248 -225
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +75 -10
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +346 -334
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +96 -65
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +130 -12
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -127
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -527
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +73 -72
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +62 -58
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +130 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +193 -102
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +2 -26
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +79 -118
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +92 -87
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.js +26 -26
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +40 -40
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +31 -28
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +129 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +95 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +127 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +92 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +35 -7
- package/src/blocks/empty-state.tsx +412 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
- package/src/blocks/sidebar.tsx +25 -26
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +4 -4
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +89 -19
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +103 -32
- package/src/components/chip.tsx +88 -13
- package/src/components/combobox.tsx +12 -10
- package/src/components/command.tsx +64 -13
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +135 -20
- package/src/components/date-picker.tsx +18 -7
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +89 -16
- package/src/components/global-layout.tsx +210 -39
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +24 -12
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/list.tsx +13 -9
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +286 -1
- package/src/components/progress.tsx +35 -113
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +35 -10
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +3 -3
- package/src/components/table.tsx +6 -3
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +253 -0
- package/src/components/typography-text.tsx +250 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +11 -1
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
- package/dist/blocks/progress-screen.cjs +0 -1
- package/dist/blocks/progress-screen.d.ts.map +0 -1
package/src/components/chart.tsx
CHANGED
|
@@ -124,7 +124,7 @@ const ChartContainer = React.forwardRef<HTMLDivElement, ChartContainerProps>(
|
|
|
124
124
|
<div
|
|
125
125
|
ref={ref}
|
|
126
126
|
className={cn(
|
|
127
|
-
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center
|
|
127
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background text-body-xs flex aspect-video justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
|
|
128
128
|
className
|
|
129
129
|
)}
|
|
130
130
|
data-chart={chartId}
|
|
@@ -200,6 +200,43 @@ function ChartStyle({ id, config }: { id: string; config: ChartConfig }) {
|
|
|
200
200
|
// Chart Tooltip
|
|
201
201
|
// ============================================================================
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* A single entry of the Recharts tooltip payload, as `ChartTooltipContent`
|
|
205
|
+
* receives it. This is the `item` argument given to `formatter` and the
|
|
206
|
+
* element type of the `payload` arrays given to `formatter` and
|
|
207
|
+
* `labelFormatter`, so consumers can read e.g. `item.color` or
|
|
208
|
+
* `item.payload` without hand-rolled narrowing.
|
|
209
|
+
*/
|
|
210
|
+
interface ChartTooltipPayloadItem {
|
|
211
|
+
/** The series `dataKey` this row belongs to. */
|
|
212
|
+
dataKey?: string | number;
|
|
213
|
+
/** The row's value. `undefined` when the datum carries no value. */
|
|
214
|
+
value?: number | string;
|
|
215
|
+
/** The series name Recharts resolves for this row. */
|
|
216
|
+
name?: string;
|
|
217
|
+
/** The series stroke colour Recharts injects. */
|
|
218
|
+
color?: string;
|
|
219
|
+
/** The series fill colour Recharts injects (bars, pie slices). */
|
|
220
|
+
fill?: string;
|
|
221
|
+
/** The underlying data point for this row. */
|
|
222
|
+
payload: Record<string, unknown>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Whether a tooltip row has a value worth printing. Zero is a real value and
|
|
227
|
+
* must render; NaN/Infinity (a dataKey over a non-numeric field, a ratio with
|
|
228
|
+
* a zero denominator) and blank strings have nothing to show, so the value
|
|
229
|
+
* slot stays empty rather than reading "NaN".
|
|
230
|
+
*/
|
|
231
|
+
function isRenderableValue(
|
|
232
|
+
value: number | string | null | undefined
|
|
233
|
+
): value is number | string {
|
|
234
|
+
if (value == null || value === "") {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
return typeof value === "number" ? Number.isFinite(value) : true;
|
|
238
|
+
}
|
|
239
|
+
|
|
203
240
|
/**
|
|
204
241
|
* Props for the ChartTooltip component.
|
|
205
242
|
*/
|
|
@@ -237,17 +274,33 @@ interface ChartTooltipContentProps
|
|
|
237
274
|
ChartTooltipProps,
|
|
238
275
|
"hideLabel" | "hideIndicator" | "indicator" | "nameKey" | "labelKey"
|
|
239
276
|
> {
|
|
240
|
-
/**
|
|
241
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Custom label formatter function.
|
|
279
|
+
* @param value - The resolved tooltip label (the config label when one
|
|
280
|
+
* matches, otherwise the raw axis label).
|
|
281
|
+
* @param payload - The tooltip payload entries for the hovered datum.
|
|
282
|
+
*/
|
|
283
|
+
labelFormatter?: (
|
|
284
|
+
value: React.ReactNode,
|
|
285
|
+
payload: ChartTooltipPayloadItem[]
|
|
286
|
+
) => React.ReactNode;
|
|
242
287
|
/** Additional CSS class for the label */
|
|
243
288
|
labelClassName?: string;
|
|
244
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* Custom value formatter function. Replaces the default row (indicator,
|
|
291
|
+
* name, and value) for every entry with a renderable value.
|
|
292
|
+
* @param value - The entry's value (`0` is real data and is passed through).
|
|
293
|
+
* @param name - The entry's series name.
|
|
294
|
+
* @param item - The full payload entry (colour, dataKey, data point, …).
|
|
295
|
+
* @param index - The entry's index within the tooltip payload.
|
|
296
|
+
* @param payload - All payload entries for the hovered datum.
|
|
297
|
+
*/
|
|
245
298
|
formatter?: (
|
|
246
|
-
value:
|
|
299
|
+
value: number | string,
|
|
247
300
|
name: string,
|
|
248
|
-
item:
|
|
301
|
+
item: ChartTooltipPayloadItem,
|
|
249
302
|
index: number,
|
|
250
|
-
payload:
|
|
303
|
+
payload: ChartTooltipPayloadItem[]
|
|
251
304
|
) => React.ReactNode;
|
|
252
305
|
}
|
|
253
306
|
|
|
@@ -270,13 +323,7 @@ function ChartTooltipContent({
|
|
|
270
323
|
labelKey,
|
|
271
324
|
}: ChartTooltipContentProps & {
|
|
272
325
|
active?: boolean;
|
|
273
|
-
payload?:
|
|
274
|
-
dataKey: string;
|
|
275
|
-
value: number | string;
|
|
276
|
-
name?: string;
|
|
277
|
-
color?: string;
|
|
278
|
-
payload: Record<string, unknown>;
|
|
279
|
-
}>;
|
|
326
|
+
payload?: ChartTooltipPayloadItem[];
|
|
280
327
|
label?: string;
|
|
281
328
|
color?: string;
|
|
282
329
|
}) {
|
|
@@ -330,7 +377,7 @@ function ChartTooltipContent({
|
|
|
330
377
|
return (
|
|
331
378
|
<div
|
|
332
379
|
className={cn(
|
|
333
|
-
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5
|
|
380
|
+
"border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",
|
|
334
381
|
className
|
|
335
382
|
)}
|
|
336
383
|
data-slot="chart-tooltip-content"
|
|
@@ -350,8 +397,9 @@ function ChartTooltipContent({
|
|
|
350
397
|
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",
|
|
351
398
|
indicator === "dot" && "items-center"
|
|
352
399
|
)}
|
|
400
|
+
data-slot="chart-tooltip-item"
|
|
353
401
|
>
|
|
354
|
-
{formatter && item
|
|
402
|
+
{formatter && isRenderableValue(item.value) && item.name ? (
|
|
355
403
|
formatter(item.value, item.name, item, index, payload)
|
|
356
404
|
) : (
|
|
357
405
|
<>
|
|
@@ -379,20 +427,29 @@ function ChartTooltipContent({
|
|
|
379
427
|
/>
|
|
380
428
|
)
|
|
381
429
|
)}
|
|
430
|
+
{/* gap-2 keeps the name and value apart once the row grows
|
|
431
|
+
wider than the tooltip min-width, where justify-between
|
|
432
|
+
alone would render them flush together (DS-897). */}
|
|
382
433
|
<div
|
|
383
434
|
className={cn(
|
|
384
|
-
"flex flex-1 justify-between leading-none",
|
|
435
|
+
"flex flex-1 justify-between gap-2 leading-none",
|
|
385
436
|
nestLabel ? "items-end" : "items-center"
|
|
386
437
|
)}
|
|
387
438
|
>
|
|
388
439
|
<div className="grid gap-1.5">
|
|
389
440
|
{nestLabel ? tooltipLabel : null}
|
|
390
|
-
<span
|
|
441
|
+
<span
|
|
442
|
+
className="text-muted-foreground"
|
|
443
|
+
data-slot="chart-tooltip-item-name"
|
|
444
|
+
>
|
|
391
445
|
{itemConfig?.label || item.name}
|
|
392
446
|
</span>
|
|
393
447
|
</div>
|
|
394
|
-
{item.value && (
|
|
395
|
-
<span
|
|
448
|
+
{isRenderableValue(item.value) && (
|
|
449
|
+
<span
|
|
450
|
+
className="text-foreground tabular-nums"
|
|
451
|
+
data-slot="chart-tooltip-item-value"
|
|
452
|
+
>
|
|
396
453
|
{typeof item.value === "number"
|
|
397
454
|
? item.value.toLocaleString()
|
|
398
455
|
: item.value}
|
|
@@ -874,7 +931,7 @@ function ChartRadarLabelWrapper({
|
|
|
874
931
|
|
|
875
932
|
return (
|
|
876
933
|
<text
|
|
877
|
-
className="text-xs"
|
|
934
|
+
className="text-body-xs"
|
|
878
935
|
data-slot="chart-radar-label-wrapper"
|
|
879
936
|
textAnchor={textAnchor}
|
|
880
937
|
x={x}
|
|
@@ -966,7 +1023,7 @@ function ChartPieLabelList({
|
|
|
966
1023
|
|
|
967
1024
|
return (
|
|
968
1025
|
<text
|
|
969
|
-
className="fill-foreground text-xs"
|
|
1026
|
+
className="fill-foreground text-body-xs"
|
|
970
1027
|
data-slot="chart-pie-label-list"
|
|
971
1028
|
dominantBaseline="middle"
|
|
972
1029
|
textAnchor="middle"
|
|
@@ -1024,7 +1081,7 @@ function ChartPieLabelWrapper({
|
|
|
1024
1081
|
|
|
1025
1082
|
return (
|
|
1026
1083
|
<text
|
|
1027
|
-
className="fill-foreground text-xs"
|
|
1084
|
+
className="fill-foreground text-body-xs"
|
|
1028
1085
|
data-slot="chart-pie-label-wrapper"
|
|
1029
1086
|
dominantBaseline="middle"
|
|
1030
1087
|
textAnchor={textAnchor}
|
|
@@ -1056,7 +1113,8 @@ interface ChartCenterLabelProps {
|
|
|
1056
1113
|
/** Secondary label shown beneath the primary value. */
|
|
1057
1114
|
secondary?: React.ReactNode;
|
|
1058
1115
|
/**
|
|
1059
|
-
* Size of the primary value text.
|
|
1116
|
+
* Size of the primary value text. Every size keeps the `text-metric`
|
|
1117
|
+
* identity (Inter semibold); only the figure size scales.
|
|
1060
1118
|
* @default "3xl"
|
|
1061
1119
|
*/
|
|
1062
1120
|
size?: ChartCenterLabelSize;
|
|
@@ -1064,14 +1122,20 @@ interface ChartCenterLabelProps {
|
|
|
1064
1122
|
viewBox?: unknown;
|
|
1065
1123
|
}
|
|
1066
1124
|
|
|
1125
|
+
/* Only text-metric (24/28) exists on the type scale; the larger sizes are
|
|
1126
|
+
scaled variants of it carrying the same metric identity (Inter semibold)
|
|
1127
|
+
spelled out — twMerge registers scale styles as font-size atoms, so
|
|
1128
|
+
`text-metric text-4xl` would drop text-metric. */
|
|
1067
1129
|
const chartCenterLabelPrimarySize: Record<ChartCenterLabelSize, string> = {
|
|
1068
|
-
"2xl": "text-
|
|
1069
|
-
"3xl": "text-3xl",
|
|
1070
|
-
"4xl": "text-4xl
|
|
1130
|
+
"2xl": "text-metric",
|
|
1131
|
+
"3xl": "font-sans text-3xl font-semibold",
|
|
1132
|
+
"4xl": "font-sans text-4xl font-semibold",
|
|
1071
1133
|
};
|
|
1072
1134
|
|
|
1073
1135
|
/**
|
|
1074
1136
|
* ChartCenterLabel renders a centred primary value with an optional label.
|
|
1137
|
+
* The primary value is a KPI figure in the `text-metric` type-scale style;
|
|
1138
|
+
* `size` scales the figure.
|
|
1075
1139
|
*/
|
|
1076
1140
|
function ChartCenterLabel({
|
|
1077
1141
|
primary,
|
|
@@ -1099,10 +1163,7 @@ function ChartCenterLabel({
|
|
|
1099
1163
|
y={cy}
|
|
1100
1164
|
>
|
|
1101
1165
|
<tspan
|
|
1102
|
-
className={cn(
|
|
1103
|
-
"fill-foreground font-sans font-bold",
|
|
1104
|
-
chartCenterLabelPrimarySize[size]
|
|
1105
|
-
)}
|
|
1166
|
+
className={cn("fill-foreground", chartCenterLabelPrimarySize[size])}
|
|
1106
1167
|
x={cx}
|
|
1107
1168
|
y={cy}
|
|
1108
1169
|
>
|
|
@@ -1110,7 +1171,7 @@ function ChartCenterLabel({
|
|
|
1110
1171
|
</tspan>
|
|
1111
1172
|
{secondary != null && (
|
|
1112
1173
|
<tspan
|
|
1113
|
-
className="fill-muted-foreground
|
|
1174
|
+
className="fill-muted-foreground text-body-xs"
|
|
1114
1175
|
x={cx}
|
|
1115
1176
|
y={cy + 24}
|
|
1116
1177
|
>
|
|
@@ -1147,6 +1208,7 @@ export type {
|
|
|
1147
1208
|
ChartContainerProps,
|
|
1148
1209
|
ChartTooltipProps,
|
|
1149
1210
|
ChartTooltipContentProps,
|
|
1211
|
+
ChartTooltipPayloadItem,
|
|
1150
1212
|
ChartLegendProps,
|
|
1151
1213
|
ChartLegendContentProps,
|
|
1152
1214
|
ChartDotProps,
|
|
@@ -1163,6 +1225,15 @@ export type {
|
|
|
1163
1225
|
ChartCenterLabelSize,
|
|
1164
1226
|
};
|
|
1165
1227
|
|
|
1228
|
+
/* ChartEmpty is defined in its own file so that a card showing "no data yet"
|
|
1229
|
+
need not pull Recharts in to say so — but it belongs to the chart family, so
|
|
1230
|
+
`/chart` exports it too and either import path works. It stays below the
|
|
1231
|
+
primary exports: the MCP indexer treats the file's first value export as the
|
|
1232
|
+
primary component when no export matches the file name, and `/chart`'s
|
|
1233
|
+
primary is ChartContainer. */
|
|
1234
|
+
export { ChartEmpty } from "./chart-empty";
|
|
1235
|
+
export type { ChartEmptyProps } from "./chart-empty";
|
|
1236
|
+
|
|
1166
1237
|
// Re-export Recharts components with aliases to avoid naming conflicts
|
|
1167
1238
|
export {
|
|
1168
1239
|
Area,
|
package/src/components/chip.tsx
CHANGED
|
@@ -18,6 +18,25 @@ import {
|
|
|
18
18
|
*/
|
|
19
19
|
type ChipSize = "md" | "lg";
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The event a chip removal hands to `onRemove`: a mouse event from the
|
|
23
|
+
* delete button, or a keyboard event from Backspace/Delete on the chip root.
|
|
24
|
+
*/
|
|
25
|
+
type ChipRemoveEvent =
|
|
26
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
27
|
+
| React.KeyboardEvent<HTMLDivElement>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Removal callback. Declared with the bivariance hack — the same shape React
|
|
31
|
+
* uses for its own event handlers — so handlers annotated against the
|
|
32
|
+
* pre-keyboard, mouse-only contract
|
|
33
|
+
* (`(event: React.MouseEvent<HTMLButtonElement>) => void`) stay assignable
|
|
34
|
+
* under strict function-parameter checking (DS-949).
|
|
35
|
+
*/
|
|
36
|
+
type ChipRemoveHandler = {
|
|
37
|
+
bivarianceHack(event: ChipRemoveEvent): void;
|
|
38
|
+
}["bivarianceHack"];
|
|
39
|
+
|
|
21
40
|
const chipVariants = cva(
|
|
22
41
|
[
|
|
23
42
|
// Base styles
|
|
@@ -26,7 +45,6 @@ const chipVariants = cva(
|
|
|
26
45
|
"justify-center",
|
|
27
46
|
"gap-0.5",
|
|
28
47
|
"rounded-full",
|
|
29
|
-
"font-medium",
|
|
30
48
|
"whitespace-nowrap",
|
|
31
49
|
"shrink-0",
|
|
32
50
|
"select-none",
|
|
@@ -40,7 +58,7 @@ const chipVariants = cva(
|
|
|
40
58
|
// Hover state
|
|
41
59
|
"hover:bg-secondary/80",
|
|
42
60
|
// Focus state - direct focus on chip (for keyboard navigation)
|
|
43
|
-
"
|
|
61
|
+
"outline-none",
|
|
44
62
|
"focus-visible:shadow-default",
|
|
45
63
|
// Disabled state
|
|
46
64
|
"disabled:pointer-events-none",
|
|
@@ -51,8 +69,11 @@ const chipVariants = cva(
|
|
|
51
69
|
{
|
|
52
70
|
variants: {
|
|
53
71
|
size: {
|
|
54
|
-
md: ["h-7", "pl-2.5", "pr-1", "text-
|
|
55
|
-
|
|
72
|
+
md: ["h-7", "pl-2.5", "pr-1", "text-label-sm"],
|
|
73
|
+
// A chip is a control: the bigger box steps up one label role, never
|
|
74
|
+
// onto a body size — mirrors Button (sm → label-sm, md/lg → label).
|
|
75
|
+
// Resolves the 16px off-scale flag from DS-925 (DS-966).
|
|
76
|
+
lg: ["h-8", "pl-4", "pr-2", "text-label"],
|
|
56
77
|
},
|
|
57
78
|
},
|
|
58
79
|
defaultVariants: {
|
|
@@ -117,9 +138,10 @@ interface ChipProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
|
117
138
|
*/
|
|
118
139
|
disabled?: boolean;
|
|
119
140
|
/**
|
|
120
|
-
* Callback when delete button
|
|
141
|
+
* Callback when the chip is removed — via the delete button (click) or
|
|
142
|
+
* the keyboard (Backspace/Delete while the chip is focused).
|
|
121
143
|
*/
|
|
122
|
-
onRemove?:
|
|
144
|
+
onRemove?: ChipRemoveHandler;
|
|
123
145
|
/**
|
|
124
146
|
* Data hook for automated testing (required)
|
|
125
147
|
*/
|
|
@@ -144,15 +166,33 @@ interface ChipProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
|
144
166
|
loadingLabel?: string;
|
|
145
167
|
/**
|
|
146
168
|
* Accessible label for the remove button.
|
|
147
|
-
* Supports `{name}` placeholder for interpolation.
|
|
169
|
+
* Supports `{name}` placeholder for interpolation. The default `{name}` is
|
|
170
|
+
* derived from string or number children; for a JSX label, pass this prop
|
|
171
|
+
* with the resolved name.
|
|
148
172
|
* @default "Remove {name}"
|
|
149
173
|
*/
|
|
150
174
|
removeAriaLabel?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Accessible label for the chip itself while it is keyboard-removable
|
|
177
|
+
* (focusable, with the Backspace/Delete removal hint).
|
|
178
|
+
* Supports `{name}` placeholder for interpolation. The default `{name}` is
|
|
179
|
+
* derived from string or number children; for a JSX label, pass this prop
|
|
180
|
+
* with the resolved name.
|
|
181
|
+
* @default "{name}, press Delete to remove"
|
|
182
|
+
*/
|
|
183
|
+
removableAriaLabel?: string;
|
|
151
184
|
}
|
|
152
185
|
|
|
153
186
|
/**
|
|
154
187
|
* Chip component for displaying removable tags or selections.
|
|
155
188
|
* Used for filter selections, tag lists, and multi-select values.
|
|
189
|
+
*
|
|
190
|
+
* A removable chip is a single tab stop: the chip itself takes focus and
|
|
191
|
+
* Backspace/Delete removes it (DS-949). The delete button stays mouse-only
|
|
192
|
+
* (`tabIndex={-1}`) so each chip costs one tab stop, not two. When a removal
|
|
193
|
+
* unmounts the focused chip, the consumer hands focus onward per the
|
|
194
|
+
* Filtering pattern's cascade: source control → filter trigger → results
|
|
195
|
+
* region — never `<body>`.
|
|
156
196
|
*/
|
|
157
197
|
const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
158
198
|
(
|
|
@@ -169,12 +209,32 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
169
209
|
maxWidth = 200,
|
|
170
210
|
loadingLabel,
|
|
171
211
|
removeAriaLabel,
|
|
212
|
+
removableAriaLabel,
|
|
213
|
+
onKeyDown,
|
|
172
214
|
...props
|
|
173
215
|
},
|
|
174
216
|
ref
|
|
175
217
|
) => {
|
|
176
218
|
const isDisabled = disabled || loading;
|
|
177
219
|
const iconSize = size === "lg" ? 16 : 14;
|
|
220
|
+
// The {name} fallback is derived from plain-text children only; a JSX
|
|
221
|
+
// label must supply removeAriaLabel/removableAriaLabel itself.
|
|
222
|
+
const chipName =
|
|
223
|
+
typeof children === "string" || typeof children === "number"
|
|
224
|
+
? String(children)
|
|
225
|
+
: "chip";
|
|
226
|
+
const removable = onRemove !== undefined && !isDisabled;
|
|
227
|
+
|
|
228
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
229
|
+
onKeyDown?.(event);
|
|
230
|
+
// A composing parent (InputChip's roving focus) that already handled
|
|
231
|
+
// the key marks it consumed via preventDefault.
|
|
232
|
+
if (event.defaultPrevented || !removable) return;
|
|
233
|
+
if (event.key === "Backspace" || event.key === "Delete") {
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
onRemove(event);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
178
238
|
const labelRef = React.useRef<HTMLSpanElement>(null);
|
|
179
239
|
const [isTruncated, setIsTruncated] = React.useState(false);
|
|
180
240
|
|
|
@@ -204,14 +264,32 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
204
264
|
);
|
|
205
265
|
|
|
206
266
|
return (
|
|
267
|
+
/* Keyboard removal lives on the chip root: when removable it carries
|
|
268
|
+
role="group" and tabIndex=0 below — the rule can't see the
|
|
269
|
+
conditional role. */
|
|
270
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
207
271
|
<div
|
|
208
272
|
ref={ref}
|
|
209
273
|
aria-disabled={isDisabled ? "true" : undefined}
|
|
274
|
+
// Keyboard-removable chips are focusable and announce the removal
|
|
275
|
+
// hint. A composing parent (InputChip) overrides all three via
|
|
276
|
+
// props — the spread below wins.
|
|
277
|
+
aria-label={
|
|
278
|
+
removable
|
|
279
|
+
? (removableAriaLabel ?? "{name}, press Delete to remove").replace(
|
|
280
|
+
"{name}",
|
|
281
|
+
chipName
|
|
282
|
+
)
|
|
283
|
+
: undefined
|
|
284
|
+
}
|
|
210
285
|
className={cn(chipVariants({ size }), className)}
|
|
211
286
|
data-hook={dataHook}
|
|
212
287
|
data-slot="chip"
|
|
213
288
|
data-tracking-el={trackingEl}
|
|
214
289
|
data-tracking-label={trackingLabel}
|
|
290
|
+
role={removable ? "group" : undefined}
|
|
291
|
+
tabIndex={removable ? 0 : undefined}
|
|
292
|
+
onKeyDown={handleKeyDown}
|
|
215
293
|
{...props}
|
|
216
294
|
>
|
|
217
295
|
{isTruncated ? (
|
|
@@ -239,11 +317,8 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
239
317
|
<button
|
|
240
318
|
aria-label={
|
|
241
319
|
removeAriaLabel
|
|
242
|
-
? removeAriaLabel.replace(
|
|
243
|
-
|
|
244
|
-
typeof children === "string" ? children : "chip"
|
|
245
|
-
)
|
|
246
|
-
: `Remove ${typeof children === "string" ? children : "chip"}`
|
|
320
|
+
? removeAriaLabel.replace("{name}", chipName)
|
|
321
|
+
: `Remove ${chipName}`
|
|
247
322
|
}
|
|
248
323
|
className={cn(chipDeleteButtonVariants({ size }))}
|
|
249
324
|
data-slot="chip-delete"
|
|
@@ -264,4 +339,4 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
264
339
|
Chip.displayName = "Chip";
|
|
265
340
|
|
|
266
341
|
export { Chip, chipVariants };
|
|
267
|
-
export type { ChipProps, ChipSize };
|
|
342
|
+
export type { ChipProps, ChipRemoveEvent, ChipRemoveHandler, ChipSize };
|
|
@@ -384,7 +384,7 @@ const comboboxTriggerVariants = cva([
|
|
|
384
384
|
"dark:bg-white/5 dark:border-white/15",
|
|
385
385
|
|
|
386
386
|
// Typography
|
|
387
|
-
"text-
|
|
387
|
+
"text-body text-foreground",
|
|
388
388
|
|
|
389
389
|
// Placeholder state
|
|
390
390
|
"data-[placeholder=true]:text-muted-foreground",
|
|
@@ -620,7 +620,7 @@ function ComboboxValue<T>({
|
|
|
620
620
|
return (
|
|
621
621
|
<span
|
|
622
622
|
className={cn(
|
|
623
|
-
"
|
|
623
|
+
"text-body overflow-hidden text-ellipsis whitespace-nowrap",
|
|
624
624
|
className
|
|
625
625
|
)}
|
|
626
626
|
data-slot="combobox-value"
|
|
@@ -1473,7 +1473,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1473
1473
|
return highlightText(
|
|
1474
1474
|
children,
|
|
1475
1475
|
highlight,
|
|
1476
|
-
highlightClassName || "text-
|
|
1476
|
+
highlightClassName || "text-label font-semibold"
|
|
1477
1477
|
);
|
|
1478
1478
|
}
|
|
1479
1479
|
return children;
|
|
@@ -1492,7 +1492,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1492
1492
|
aria-selected={isSelected}
|
|
1493
1493
|
aria-setsize={virtualCtx.filteredCount}
|
|
1494
1494
|
className={cn(
|
|
1495
|
-
"data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3
|
|
1495
|
+
"data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 outline-hidden select-none",
|
|
1496
1496
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
1497
1497
|
isDisabled && "pointer-events-none opacity-50",
|
|
1498
1498
|
className
|
|
@@ -1597,12 +1597,14 @@ function ComboboxLoading({
|
|
|
1597
1597
|
<div
|
|
1598
1598
|
aria-live="polite"
|
|
1599
1599
|
className={cn(
|
|
1600
|
-
// The entrance fade doubles as
|
|
1601
|
-
// holds the hidden start): a fetch that resolves
|
|
1602
|
-
//
|
|
1603
|
-
// indicator at all.
|
|
1604
|
-
|
|
1605
|
-
|
|
1600
|
+
// The entrance fade doubles as the flash-threshold appearance delay
|
|
1601
|
+
// (`both` holds the hidden start): a fetch that resolves inside the
|
|
1602
|
+
// flash zone never flashes a spinner, which would read slower than
|
|
1603
|
+
// no indicator at all. flash-delay draws the delay from
|
|
1604
|
+
// --ds-motion-flash-threshold — the same threshold useDelayedPending
|
|
1605
|
+
// mirrors in JS.
|
|
1606
|
+
"text-body-sm text-muted-foreground relative flex items-center justify-center gap-2 py-6",
|
|
1607
|
+
"animate-entrance-fade flash-delay",
|
|
1606
1608
|
className
|
|
1607
1609
|
)}
|
|
1608
1610
|
data-slot="combobox-loading"
|
|
@@ -10,6 +10,8 @@ import { Button } from "@brightlocal/ui-components/button";
|
|
|
10
10
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
11
11
|
import { useDevWarning } from "@brightlocal/ui-components/lib/use-dev-warning";
|
|
12
12
|
|
|
13
|
+
import { emptyChipStyles } from "../lib/empty-chip";
|
|
14
|
+
|
|
13
15
|
/* -------------------------------------------------------------------------------------------------
|
|
14
16
|
* Command Context — shared state between CommandInput and CommandVirtualList
|
|
15
17
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -249,7 +251,7 @@ const CommandInput = React.forwardRef<
|
|
|
249
251
|
<CommandPrimitive.Input
|
|
250
252
|
ref={inputRef}
|
|
251
253
|
className={cn(
|
|
252
|
-
"placeholder:text-muted-foreground flex w-full bg-transparent
|
|
254
|
+
"placeholder:text-muted-foreground text-body flex w-full bg-transparent outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
253
255
|
className
|
|
254
256
|
)}
|
|
255
257
|
data-slot="command-input"
|
|
@@ -262,7 +264,9 @@ const CommandInput = React.forwardRef<
|
|
|
262
264
|
{showClearButton && (
|
|
263
265
|
<Button
|
|
264
266
|
aria-label={clearSearchAriaLabel ?? "Clear search"}
|
|
265
|
-
|
|
267
|
+
/* Same square hit area as the DataTableSearch clear — a default
|
|
268
|
+
h-9 px-4 button hovers as a wide pill inside the field. */
|
|
269
|
+
className="text-muted-foreground hover:text-foreground size-6 p-0"
|
|
266
270
|
dataHook="command-input-clear"
|
|
267
271
|
variant="ghost"
|
|
268
272
|
onClick={handleClear}
|
|
@@ -326,15 +330,37 @@ export interface CommandEmptyProps extends React.ComponentProps<
|
|
|
326
330
|
* Data hook for automated testing
|
|
327
331
|
*/
|
|
328
332
|
dataHook?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Icon shown in the muted chip above the message — the same chip as
|
|
335
|
+
* EmptyState, so the popover form matches the card and page forms
|
|
336
|
+
* (Patterns/Empty States). Decorative; the message carries the state.
|
|
337
|
+
*/
|
|
338
|
+
icon?: React.ReactNode;
|
|
339
|
+
/**
|
|
340
|
+
* One quiet muted line under the message, e.g. "Try a different search."
|
|
341
|
+
*/
|
|
342
|
+
description?: React.ReactNode;
|
|
329
343
|
}
|
|
330
344
|
|
|
331
345
|
/**
|
|
332
|
-
* Empty state displayed when no results are found.
|
|
346
|
+
* Empty state displayed when no results are found. Plain `children` render
|
|
347
|
+
* the one-line form; pass `icon` and/or `description` for the compact form
|
|
348
|
+
* the Empty States pattern uses at popover scope — never hand-roll it.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```tsx
|
|
352
|
+
* <CommandEmpty
|
|
353
|
+
* description="Try a different search."
|
|
354
|
+
* icon={<SearchX />}
|
|
355
|
+
* >
|
|
356
|
+
* No locations match “{search}”
|
|
357
|
+
* </CommandEmpty>
|
|
358
|
+
* ```
|
|
333
359
|
*/
|
|
334
360
|
const CommandEmpty = React.forwardRef<
|
|
335
361
|
React.ComponentRef<typeof CommandPrimitive.Empty>,
|
|
336
362
|
CommandEmptyProps
|
|
337
|
-
>(({ dataHook, ...props }, ref) => {
|
|
363
|
+
>(({ children, dataHook, description, icon, ...props }, ref) => {
|
|
338
364
|
// cmdk hardcodes role="presentation" after spreading props, so we
|
|
339
365
|
// override it via a callback ref to satisfy the listbox a11y contract
|
|
340
366
|
// (role="listbox" requires option or group children).
|
|
@@ -352,11 +378,39 @@ const CommandEmpty = React.forwardRef<
|
|
|
352
378
|
ref={setRef}
|
|
353
379
|
aria-disabled="true"
|
|
354
380
|
aria-selected="false"
|
|
355
|
-
className="py-6 text-center
|
|
381
|
+
className="text-body-sm py-6 text-center"
|
|
356
382
|
data-hook={dataHook}
|
|
357
383
|
data-slot="command-empty"
|
|
358
384
|
{...props}
|
|
359
|
-
|
|
385
|
+
>
|
|
386
|
+
{icon || description ? (
|
|
387
|
+
/* The compact form. Inside role="option" the content is
|
|
388
|
+
presentational, so the message stays a plain line — never a
|
|
389
|
+
heading — and the chip is aria-hidden. */
|
|
390
|
+
<div className="flex flex-col items-center gap-1 px-4">
|
|
391
|
+
{icon ? (
|
|
392
|
+
<span
|
|
393
|
+
aria-hidden="true"
|
|
394
|
+
className={cn(emptyChipStyles(), "mb-1")}
|
|
395
|
+
data-slot="command-empty-icon"
|
|
396
|
+
>
|
|
397
|
+
{icon}
|
|
398
|
+
</span>
|
|
399
|
+
) : null}
|
|
400
|
+
<p data-slot="command-empty-message">{children}</p>
|
|
401
|
+
{description ? (
|
|
402
|
+
<p
|
|
403
|
+
className="text-muted-foreground"
|
|
404
|
+
data-slot="command-empty-description"
|
|
405
|
+
>
|
|
406
|
+
{description}
|
|
407
|
+
</p>
|
|
408
|
+
) : null}
|
|
409
|
+
</div>
|
|
410
|
+
) : (
|
|
411
|
+
children
|
|
412
|
+
)}
|
|
413
|
+
</CommandPrimitive.Empty>
|
|
360
414
|
);
|
|
361
415
|
});
|
|
362
416
|
CommandEmpty.displayName = "CommandEmpty";
|
|
@@ -387,7 +441,7 @@ const CommandGroup = React.forwardRef<
|
|
|
387
441
|
<CommandPrimitive.Group
|
|
388
442
|
ref={ref}
|
|
389
443
|
className={cn(
|
|
390
|
-
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground
|
|
444
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-label-sm overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5",
|
|
391
445
|
className
|
|
392
446
|
)}
|
|
393
447
|
data-hook={dataHook}
|
|
@@ -480,7 +534,7 @@ const CommandItem = React.forwardRef<
|
|
|
480
534
|
<CommandPrimitive.Item
|
|
481
535
|
ref={ref}
|
|
482
536
|
className={cn(
|
|
483
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3
|
|
537
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground text-label relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
484
538
|
className
|
|
485
539
|
)}
|
|
486
540
|
data-hook={dataHook}
|
|
@@ -526,10 +580,7 @@ const CommandShortcut = React.forwardRef<HTMLSpanElement, CommandShortcutProps>(
|
|
|
526
580
|
({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
|
|
527
581
|
<span
|
|
528
582
|
ref={ref}
|
|
529
|
-
className={cn(
|
|
530
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
531
|
-
className
|
|
532
|
-
)}
|
|
583
|
+
className={cn("text-muted-foreground text-body-xs ml-auto", className)}
|
|
533
584
|
data-hook={dataHook}
|
|
534
585
|
data-slot="command-shortcut"
|
|
535
586
|
data-tracking-el={trackingEl}
|
|
@@ -976,7 +1027,7 @@ const CommandVirtualItem = React.forwardRef<
|
|
|
976
1027
|
aria-selected={selected || undefined}
|
|
977
1028
|
aria-setsize={virtualCtx?.filteredCount}
|
|
978
1029
|
className={cn(
|
|
979
|
-
"data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3
|
|
1030
|
+
"data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none",
|
|
980
1031
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
981
1032
|
disabled && "pointer-events-none opacity-50",
|
|
982
1033
|
className
|