@brightlocal/ui-components 0.4.1 → 1.0.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 +2 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +2 -2
- package/dist/alert.js +64 -64
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.js +38 -38
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -2
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +23 -23
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +34 -34
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +58 -57
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +19 -40
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.js +1 -1
- package/dist/chart.cjs +2 -2
- package/dist/chart.d.ts +3 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +21 -21
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +3 -3
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +6 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +157 -149
- package/dist/command.cjs +1 -1
- package/dist/command.js +35 -35
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +7 -7
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +22 -22
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +40 -45
- 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 +133 -92
- package/dist/header.d.ts.map +1 -1
- package/dist/header.js +1 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +394 -381
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +18 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-group.js +10 -10
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -20
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +93 -134
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +16 -16
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +1 -8
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +23 -11
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +12 -12
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +15 -15
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +3 -19
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +93 -121
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +46 -50
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +19 -19
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +7 -8
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +1 -21
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +31 -100
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +10 -12
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +9 -9
- package/dist/typography.cjs +1 -0
- package/dist/typography.d.ts +176 -0
- package/dist/typography.d.ts.map +1 -0
- package/dist/typography.js +331 -0
- package/package.json +2 -2
- package/src/blocks/data-table.tsx +10 -10
- package/src/blocks/sidebar.tsx +13 -13
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert.tsx +10 -10
- package/src/components/breadcrumb.tsx +3 -3
- package/src/components/button.tsx +7 -7
- package/src/components/calendar.tsx +4 -22
- package/src/components/centred-layout.tsx +1 -1
- package/src/components/chart.tsx +5 -5
- package/src/components/checkbox.tsx +3 -3
- package/src/components/combobox.tsx +26 -10
- package/src/components/command.tsx +5 -5
- package/src/components/context-menu.tsx +2 -2
- package/src/components/date-picker.tsx +1 -1
- package/src/components/dialog.tsx +3 -3
- package/src/components/dropdown-menu.tsx +6 -11
- package/src/components/field.tsx +70 -22
- package/src/components/header.tsx +1 -4
- package/src/components/input-chip.tsx +1 -4
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +12 -92
- package/src/components/input-password.tsx +2 -10
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +1 -1
- package/src/components/link.tsx +1 -5
- package/src/components/logo.tsx +11 -5
- package/src/components/menubar.tsx +2 -2
- package/src/components/pagination.tsx +4 -8
- package/src/components/radio-group.tsx +66 -130
- package/src/components/select.tsx +8 -12
- package/src/components/sheet.tsx +5 -5
- package/src/components/sonner.tsx +4 -5
- package/src/components/switch.tsx +29 -140
- package/src/components/tabs.tsx +0 -2
- package/src/components/toggle.tsx +1 -1
- package/src/components/typography.tsx +678 -0
- package/src/index.ts +1 -0
- package/dist/link.figma.d.ts +0 -2
- package/dist/link.figma.d.ts.map +0 -1
- package/dist/switch.figma.d.ts +0 -2
- package/dist/switch.figma.d.ts.map +0 -1
- package/dist/toggle.figma.d.ts +0 -2
- package/dist/toggle.figma.d.ts.map +0 -1
- package/src/components/link.figma.tsx +0 -71
- package/src/components/switch.figma.tsx +0 -111
- package/src/components/toggle.figma.tsx +0 -75
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"sonner": "^2.0.7",
|
|
153
153
|
"tailwind-merge": "^3.4.0",
|
|
154
154
|
"vaul": "^1.1.2",
|
|
155
|
-
"@brightlocal/icons": "0.
|
|
155
|
+
"@brightlocal/icons": "2.0.0"
|
|
156
156
|
},
|
|
157
157
|
"size-limit": [
|
|
158
158
|
{
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
Row,
|
|
28
28
|
} from "@tanstack/react-table";
|
|
29
29
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
ArrowDown,
|
|
31
|
+
ArrowUp,
|
|
32
|
+
ArrowUpDown,
|
|
33
|
+
Ellipsis,
|
|
34
|
+
Search,
|
|
35
35
|
} from "@brightlocal/icons";
|
|
36
36
|
|
|
37
37
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -700,11 +700,11 @@ function DataTableColumnHeader<TData, TValue>({
|
|
|
700
700
|
className="flex size-3 items-center justify-center"
|
|
701
701
|
>
|
|
702
702
|
{sortState === "desc" ? (
|
|
703
|
-
<
|
|
703
|
+
<ArrowDown size={12} />
|
|
704
704
|
) : sortState === "asc" ? (
|
|
705
|
-
<
|
|
705
|
+
<ArrowUp size={12} />
|
|
706
706
|
) : (
|
|
707
|
-
<
|
|
707
|
+
<ArrowUpDown size={12} />
|
|
708
708
|
)}
|
|
709
709
|
</span>
|
|
710
710
|
</Button>
|
|
@@ -749,7 +749,7 @@ function DataTableRowActions<TData>({
|
|
|
749
749
|
trackingLabel={trackingLabel}
|
|
750
750
|
variant="ghost"
|
|
751
751
|
>
|
|
752
|
-
<
|
|
752
|
+
<Ellipsis />
|
|
753
753
|
</Button>
|
|
754
754
|
</DropdownMenuTrigger>
|
|
755
755
|
<DropdownMenuContent align="end" dataHook={`${dataHook}-menu`}>
|
|
@@ -967,7 +967,7 @@ function DataTableSearch<TData>({
|
|
|
967
967
|
onChange={(event) => handleFilterChange(event.target.value)}
|
|
968
968
|
/>
|
|
969
969
|
<InputGroupAddon className="pr-3">
|
|
970
|
-
<
|
|
970
|
+
<Search />
|
|
971
971
|
</InputGroupAddon>
|
|
972
972
|
</InputGroup>
|
|
973
973
|
</div>
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -510,7 +510,7 @@ const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
|
|
|
510
510
|
ref={ref}
|
|
511
511
|
aria-label="Toggle Sidebar"
|
|
512
512
|
className={cn(
|
|
513
|
-
"hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-
|
|
513
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
|
|
514
514
|
"cursor-w-resize",
|
|
515
515
|
"[[data-state=collapsed]_&]:cursor-e-resize",
|
|
516
516
|
"group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
@@ -711,7 +711,7 @@ const SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(
|
|
|
711
711
|
SidebarGroup.displayName = "SidebarGroup";
|
|
712
712
|
|
|
713
713
|
const sidebarGroupLabelVariants = cva(
|
|
714
|
-
"flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:
|
|
714
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
715
715
|
{
|
|
716
716
|
variants: {
|
|
717
717
|
size: {
|
|
@@ -739,8 +739,8 @@ const sidebarGroupLabelVariants = cva(
|
|
|
739
739
|
*/
|
|
740
740
|
interface SidebarGroupLabelProps
|
|
741
741
|
extends
|
|
742
|
-
|
|
743
|
-
|
|
742
|
+
React.ComponentProps<"div">,
|
|
743
|
+
VariantProps<typeof sidebarGroupLabelVariants> {
|
|
744
744
|
/** Data hook for automated testing */
|
|
745
745
|
dataHook?: string;
|
|
746
746
|
/**
|
|
@@ -867,7 +867,7 @@ const SidebarGroupAction = React.forwardRef<
|
|
|
867
867
|
<Comp
|
|
868
868
|
ref={ref}
|
|
869
869
|
className={cn(
|
|
870
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:
|
|
870
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0",
|
|
871
871
|
// Increases the hit area of the button on mobile.
|
|
872
872
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
873
873
|
"group-data-[collapsible=icon]:hidden",
|
|
@@ -975,7 +975,7 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
975
975
|
const iconProps = {
|
|
976
976
|
ref,
|
|
977
977
|
className: cn(
|
|
978
|
-
"
|
|
978
|
+
"shrink-0 transition-transform",
|
|
979
979
|
isActive && type === SidebarCollapseIconType.CARET && "rotate-90",
|
|
980
980
|
className
|
|
981
981
|
),
|
|
@@ -1043,8 +1043,8 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1043
1043
|
*/
|
|
1044
1044
|
interface SidebarMenuButtonProps
|
|
1045
1045
|
extends
|
|
1046
|
-
|
|
1047
|
-
|
|
1046
|
+
React.ComponentProps<"button">,
|
|
1047
|
+
VariantProps<typeof sidebarMenuButtonVariants> {
|
|
1048
1048
|
/** Data hook for automated testing */
|
|
1049
1049
|
dataHook?: string;
|
|
1050
1050
|
/**
|
|
@@ -1160,7 +1160,7 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
1160
1160
|
<Comp
|
|
1161
1161
|
ref={ref}
|
|
1162
1162
|
className={cn(
|
|
1163
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:
|
|
1163
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0",
|
|
1164
1164
|
// Increases the hit area of the button on mobile.
|
|
1165
1165
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
1166
1166
|
"peer-data-[size=sm]/menu-button:top-1",
|
|
@@ -1170,7 +1170,7 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
1170
1170
|
"peer-data-[size=tree]/menu-button:top-1.5",
|
|
1171
1171
|
"group-data-[collapsible=icon]:hidden",
|
|
1172
1172
|
showOnHover &&
|
|
1173
|
-
|
|
1173
|
+
"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
1174
1174
|
className
|
|
1175
1175
|
)}
|
|
1176
1176
|
data-slot="sidebar-menu-action"
|
|
@@ -1282,8 +1282,8 @@ const sidebarMenuSubVariants = cva(
|
|
|
1282
1282
|
*/
|
|
1283
1283
|
interface SidebarMenuSubProps
|
|
1284
1284
|
extends
|
|
1285
|
-
|
|
1286
|
-
|
|
1285
|
+
React.ComponentProps<"ul">,
|
|
1286
|
+
VariantProps<typeof sidebarMenuSubVariants> {
|
|
1287
1287
|
/** Data hook for automated testing */
|
|
1288
1288
|
dataHook?: string;
|
|
1289
1289
|
/**
|
|
@@ -1372,7 +1372,7 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1372
1372
|
<Comp
|
|
1373
1373
|
ref={ref}
|
|
1374
1374
|
className={cn(
|
|
1375
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:
|
|
1375
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
|
|
1376
1376
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1377
1377
|
size === SidebarMenuSubButtonSize.SM && "text-xs",
|
|
1378
1378
|
size === SidebarMenuSubButtonSize.MD && "text-sm",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
5
|
-
import {
|
|
5
|
+
import { ChevronDown } from "@brightlocal/icons";
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
|
|
@@ -185,7 +185,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
185
185
|
{...props}
|
|
186
186
|
>
|
|
187
187
|
{children}
|
|
188
|
-
<
|
|
188
|
+
<ChevronDown className="text-muted-foreground pointer-events-none shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
189
189
|
</AccordionPrimitive.Trigger>
|
|
190
190
|
</AccordionPrimitive.Header>
|
|
191
191
|
));
|
package/src/components/alert.tsx
CHANGED
|
@@ -5,19 +5,19 @@ import { CircleCheck, Info, CircleX, TriangleAlert } from "@brightlocal/icons";
|
|
|
5
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
|
|
7
7
|
const alertVariants = cva(
|
|
8
|
-
"relative w-full rounded-lg px-4 py-3 text-sm flex gap-3 items-start
|
|
8
|
+
"relative w-full rounded-lg px-4 py-3 text-sm flex gap-3 items-start",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
default:
|
|
13
|
-
"bg-neutral-100 text-neutral-900
|
|
13
|
+
"bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100",
|
|
14
14
|
success:
|
|
15
|
-
"bg-green-200 text-green-900
|
|
16
|
-
info: "bg-cyan-200 text-cyan-900
|
|
15
|
+
"bg-green-200 text-green-900 dark:bg-green-950 dark:text-green-200",
|
|
16
|
+
info: "bg-cyan-200 text-cyan-900 dark:bg-cyan-900 dark:text-cyan-200",
|
|
17
17
|
destructive:
|
|
18
|
-
"bg-red-300 text-red-950
|
|
18
|
+
"bg-red-300 text-red-950 dark:bg-red-950 dark:text-red-300",
|
|
19
19
|
warning:
|
|
20
|
-
"bg-orange-200 text-amber-900
|
|
20
|
+
"bg-orange-200 text-amber-900 dark:bg-amber-900 dark:text-orange-200",
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
defaultVariants: {
|
|
@@ -118,7 +118,7 @@ function AlertSuccess({
|
|
|
118
118
|
data-tracking-label={trackingLabel}
|
|
119
119
|
variant="success"
|
|
120
120
|
>
|
|
121
|
-
<CircleCheck />
|
|
121
|
+
<CircleCheck className="shrink-0 translate-y-0.5 text-green-900 dark:text-green-200" />
|
|
122
122
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
123
123
|
{title && <AlertTitle>{title}</AlertTitle>}
|
|
124
124
|
<AlertDescription>{description}</AlertDescription>
|
|
@@ -145,7 +145,7 @@ function AlertInfo({
|
|
|
145
145
|
data-tracking-label={trackingLabel}
|
|
146
146
|
variant="info"
|
|
147
147
|
>
|
|
148
|
-
<Info />
|
|
148
|
+
<Info className="shrink-0 translate-y-0.5 text-cyan-900 dark:text-cyan-200" />
|
|
149
149
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
150
150
|
{title && <AlertTitle>{title}</AlertTitle>}
|
|
151
151
|
<AlertDescription>{description}</AlertDescription>
|
|
@@ -172,7 +172,7 @@ function AlertDestructive({
|
|
|
172
172
|
data-tracking-label={trackingLabel}
|
|
173
173
|
variant="destructive"
|
|
174
174
|
>
|
|
175
|
-
<CircleX />
|
|
175
|
+
<CircleX className="shrink-0 translate-y-0.5 text-red-950 dark:text-red-300" />
|
|
176
176
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
177
177
|
{title && <AlertTitle>{title}</AlertTitle>}
|
|
178
178
|
<AlertDescription>{description}</AlertDescription>
|
|
@@ -199,7 +199,7 @@ function AlertWarning({
|
|
|
199
199
|
data-tracking-label={trackingLabel}
|
|
200
200
|
variant="warning"
|
|
201
201
|
>
|
|
202
|
-
<TriangleAlert />
|
|
202
|
+
<TriangleAlert className="shrink-0 translate-y-0.5 text-amber-900 dark:text-orange-200" />
|
|
203
203
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
204
204
|
{title && <AlertTitle>{title}</AlertTitle>}
|
|
205
205
|
<AlertDescription>{description}</AlertDescription>
|
|
@@ -141,12 +141,12 @@ const BreadcrumbSeparator = React.forwardRef<
|
|
|
141
141
|
<li
|
|
142
142
|
ref={ref}
|
|
143
143
|
aria-hidden="true"
|
|
144
|
-
className={
|
|
144
|
+
className={className}
|
|
145
145
|
data-slot="breadcrumb-separator"
|
|
146
146
|
role="presentation"
|
|
147
147
|
{...props}
|
|
148
148
|
>
|
|
149
|
-
{children ?? <ChevronRight />}
|
|
149
|
+
{children ?? <ChevronRight size={14} />}
|
|
150
150
|
</li>
|
|
151
151
|
));
|
|
152
152
|
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
@@ -167,7 +167,7 @@ const BreadcrumbEllipsis = React.forwardRef<
|
|
|
167
167
|
role="presentation"
|
|
168
168
|
{...props}
|
|
169
169
|
>
|
|
170
|
-
<MoreHorizontal
|
|
170
|
+
<MoreHorizontal />
|
|
171
171
|
<span className="sr-only">More</span>
|
|
172
172
|
</span>
|
|
173
173
|
));
|
|
@@ -39,7 +39,7 @@ const ButtonVariants = cva(
|
|
|
39
39
|
"justify-center",
|
|
40
40
|
"gap-2",
|
|
41
41
|
"whitespace-nowrap",
|
|
42
|
-
"transition-[color,background-color,border-color,box-shadow]",
|
|
42
|
+
"transition-[color,background-color,border-color,box-shadow,opacity]",
|
|
43
43
|
"duration-150",
|
|
44
44
|
"ease-in-out",
|
|
45
45
|
"cursor-pointer",
|
|
@@ -48,6 +48,7 @@ const ButtonVariants = cva(
|
|
|
48
48
|
"disabled:opacity-50",
|
|
49
49
|
"aria-disabled:opacity-50",
|
|
50
50
|
"[&_svg]:pointer-events-none",
|
|
51
|
+
"[&_svg]:shrink-0",
|
|
51
52
|
"shrink-0",
|
|
52
53
|
"outline-none",
|
|
53
54
|
"aria-invalid:ring-destructive/20",
|
|
@@ -108,8 +109,8 @@ const ButtonVariants = cva(
|
|
|
108
109
|
],
|
|
109
110
|
},
|
|
110
111
|
size: {
|
|
111
|
-
default: "px-4 py-2 h-9 text-sm
|
|
112
|
-
sm: "py-2 px-3 h-8 text-xs
|
|
112
|
+
default: "px-4 py-2 h-9 text-sm",
|
|
113
|
+
sm: "py-2 px-3 h-8 text-xs",
|
|
113
114
|
lg: "py-2 px-8 h-10 text-sm [&_svg:not([class*='size-'])]:size-5",
|
|
114
115
|
},
|
|
115
116
|
state: {
|
|
@@ -178,8 +179,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
178
179
|
// Determine actual disabled state
|
|
179
180
|
const isDisabled = disabled || loading;
|
|
180
181
|
|
|
181
|
-
// Determine content to display
|
|
182
|
-
const displayChildren = children;
|
|
183
182
|
let isSingleIconOnly = iconOnly;
|
|
184
183
|
if (
|
|
185
184
|
!isSingleIconOnly &&
|
|
@@ -191,6 +190,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
191
190
|
}>;
|
|
192
191
|
isSingleIconOnly = onlyChild.props?.children == null;
|
|
193
192
|
}
|
|
193
|
+
|
|
194
194
|
const showLoadingSpinner = loading && !asChild;
|
|
195
195
|
|
|
196
196
|
// Compute visual state class via CVA
|
|
@@ -201,7 +201,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
201
201
|
// Ensure we always have an accessible label
|
|
202
202
|
const effectiveAriaLabel =
|
|
203
203
|
ariaLabel ??
|
|
204
|
-
(loading ? `Loading: ${
|
|
204
|
+
(loading ? `Loading: ${children || "Please wait"}` : undefined);
|
|
205
205
|
|
|
206
206
|
// When asChild is used, render a simplified version that only forwards props
|
|
207
207
|
if (asChild) {
|
|
@@ -262,7 +262,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
262
262
|
<Loader2 className="animate-spin" size={BUTTON_SPINNER_SIZE} />
|
|
263
263
|
</div>
|
|
264
264
|
)}
|
|
265
|
-
{
|
|
265
|
+
{children}
|
|
266
266
|
</Comp>
|
|
267
267
|
);
|
|
268
268
|
}
|
|
@@ -130,7 +130,7 @@ function Calendar({
|
|
|
130
130
|
caption_label: cn(
|
|
131
131
|
"text-sm font-sans leading-5 text-foreground select-none",
|
|
132
132
|
captionLayout === "dropdown" ? "font-normal" : "font-medium",
|
|
133
|
-
"[&>svg]:text-muted-foreground
|
|
133
|
+
"[&>svg]:text-muted-foreground",
|
|
134
134
|
"flex h-[34px] items-center gap-1 rounded-md pl-2 pr-1",
|
|
135
135
|
defaultClassNames.caption_label
|
|
136
136
|
),
|
|
@@ -203,30 +203,12 @@ function Calendar({
|
|
|
203
203
|
...iconProps
|
|
204
204
|
}) => {
|
|
205
205
|
if (orientation === "left") {
|
|
206
|
-
return
|
|
207
|
-
<ChevronLeft
|
|
208
|
-
className={chevronClassName}
|
|
209
|
-
size={16}
|
|
210
|
-
{...iconProps}
|
|
211
|
-
/>
|
|
212
|
-
);
|
|
206
|
+
return <ChevronLeft className={chevronClassName} {...iconProps} />;
|
|
213
207
|
}
|
|
214
208
|
if (orientation === "right") {
|
|
215
|
-
return
|
|
216
|
-
<ChevronRight
|
|
217
|
-
className={chevronClassName}
|
|
218
|
-
size={16}
|
|
219
|
-
{...iconProps}
|
|
220
|
-
/>
|
|
221
|
-
);
|
|
209
|
+
return <ChevronRight className={chevronClassName} {...iconProps} />;
|
|
222
210
|
}
|
|
223
|
-
return
|
|
224
|
-
<ChevronDown
|
|
225
|
-
className={chevronClassName}
|
|
226
|
-
size={16}
|
|
227
|
-
{...iconProps}
|
|
228
|
-
/>
|
|
229
|
-
);
|
|
211
|
+
return <ChevronDown className={chevronClassName} {...iconProps} />;
|
|
230
212
|
},
|
|
231
213
|
DayButton: CalendarDayButton,
|
|
232
214
|
...components,
|
|
@@ -63,7 +63,7 @@ const CentredLayout = React.forwardRef<HTMLDivElement, CentredLayoutProps>(
|
|
|
63
63
|
ref={ref}
|
|
64
64
|
className={cn(
|
|
65
65
|
// Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
|
|
66
|
-
"bg-background flex min-h-screen w-full flex-col items-center justify-center gap-4
|
|
66
|
+
"bg-background p-section flex min-h-screen w-full flex-col items-center justify-center gap-4",
|
|
67
67
|
className
|
|
68
68
|
)}
|
|
69
69
|
data-hook={dataHook}
|
package/src/components/chart.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
|
11
11
|
export interface ChartConfig {
|
|
12
12
|
[key: string]: {
|
|
13
13
|
label?: React.ReactNode;
|
|
14
|
-
icon?: React.ComponentType
|
|
14
|
+
icon?: React.ComponentType<{ size?: number }>;
|
|
15
15
|
} & (
|
|
16
16
|
| { color?: string; theme?: never }
|
|
17
17
|
| { color?: never; theme: Record<string, string> }
|
|
@@ -309,7 +309,7 @@ function ChartTooltipContent({
|
|
|
309
309
|
<div
|
|
310
310
|
key={item.dataKey}
|
|
311
311
|
className={cn(
|
|
312
|
-
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2
|
|
312
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",
|
|
313
313
|
indicator === "dot" && "items-center"
|
|
314
314
|
)}
|
|
315
315
|
>
|
|
@@ -318,7 +318,7 @@ function ChartTooltipContent({
|
|
|
318
318
|
) : (
|
|
319
319
|
<>
|
|
320
320
|
{itemConfig?.icon && !hideIndicator ? (
|
|
321
|
-
<itemConfig.icon />
|
|
321
|
+
<itemConfig.icon size={10} />
|
|
322
322
|
) : (
|
|
323
323
|
!hideIndicator && (
|
|
324
324
|
<div
|
|
@@ -450,11 +450,11 @@ function ChartLegendContent({
|
|
|
450
450
|
<div
|
|
451
451
|
key={item.value}
|
|
452
452
|
className={cn(
|
|
453
|
-
"[&>svg]:text-muted-foreground flex items-center gap-1.5
|
|
453
|
+
"[&>svg]:text-muted-foreground flex items-center gap-1.5"
|
|
454
454
|
)}
|
|
455
455
|
>
|
|
456
456
|
{itemConfig?.icon && !hideIcon ? (
|
|
457
|
-
<itemConfig.icon />
|
|
457
|
+
<itemConfig.icon size={12} />
|
|
458
458
|
) : (
|
|
459
459
|
<div
|
|
460
460
|
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
|
-
import {
|
|
4
|
+
import { Check } from "@brightlocal/icons";
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
8
|
const checkboxVariants = cva(
|
|
9
9
|
[
|
|
10
10
|
// Layout & Size
|
|
11
|
-
"size-
|
|
11
|
+
"size-[18px] shrink-0 self-start mt-0.5",
|
|
12
12
|
// Appearance
|
|
13
13
|
"bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none",
|
|
14
14
|
// Checked State
|
|
@@ -83,7 +83,7 @@ const Checkbox = React.forwardRef<HTMLButtonElement, CheckboxProps>(
|
|
|
83
83
|
className="flex items-center justify-center text-current transition-none"
|
|
84
84
|
data-slot="checkbox-indicator"
|
|
85
85
|
>
|
|
86
|
-
<
|
|
86
|
+
<Check />
|
|
87
87
|
</CheckboxPrimitive.Indicator>
|
|
88
88
|
</CheckboxPrimitive.Root>
|
|
89
89
|
);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronsUpDown, Check } from "@brightlocal/icons";
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { defaultFilter } from "cmdk";
|
|
6
7
|
|
|
7
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
9
|
import {
|
|
@@ -34,6 +35,8 @@ interface ComboboxContextValue {
|
|
|
34
35
|
/** Map of value -> label for displaying selected value */
|
|
35
36
|
itemLabels: Map<string, string>;
|
|
36
37
|
registerItem: (value: string, label: string) => void;
|
|
38
|
+
/** Maps item value to a searchable string for filtering */
|
|
39
|
+
itemToStringValue?: (value: string) => string;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const ComboboxContext = React.createContext<ComboboxContextValue | null>(null);
|
|
@@ -63,6 +66,8 @@ export interface ComboboxProps {
|
|
|
63
66
|
shouldFilter?: boolean;
|
|
64
67
|
/** Disabled state */
|
|
65
68
|
disabled?: boolean;
|
|
69
|
+
/** Maps item value to a searchable string. When provided, filtering uses this string instead of the raw value. */
|
|
70
|
+
itemToStringValue?: (value: string) => string;
|
|
66
71
|
/** Children */
|
|
67
72
|
children: React.ReactNode;
|
|
68
73
|
}
|
|
@@ -74,6 +79,7 @@ function Combobox({
|
|
|
74
79
|
onOpenChange: controlledOnOpenChange,
|
|
75
80
|
shouldFilter = true,
|
|
76
81
|
disabled = false,
|
|
82
|
+
itemToStringValue,
|
|
77
83
|
children,
|
|
78
84
|
}: ComboboxProps) {
|
|
79
85
|
const [uncontrolledValue, setUncontrolledValue] = React.useState("");
|
|
@@ -127,6 +133,7 @@ function Combobox({
|
|
|
127
133
|
disabled,
|
|
128
134
|
itemLabels,
|
|
129
135
|
registerItem,
|
|
136
|
+
itemToStringValue,
|
|
130
137
|
}),
|
|
131
138
|
[
|
|
132
139
|
open,
|
|
@@ -137,6 +144,7 @@ function Combobox({
|
|
|
137
144
|
disabled,
|
|
138
145
|
itemLabels,
|
|
139
146
|
registerItem,
|
|
147
|
+
itemToStringValue,
|
|
140
148
|
]
|
|
141
149
|
);
|
|
142
150
|
|
|
@@ -189,7 +197,6 @@ const comboboxTriggerVariants = cva(
|
|
|
189
197
|
|
|
190
198
|
// Icon styles
|
|
191
199
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
192
|
-
"[&_svg:not([class*='size-'])]:size-4",
|
|
193
200
|
],
|
|
194
201
|
{
|
|
195
202
|
variants: {
|
|
@@ -259,10 +266,9 @@ const ComboboxTrigger = React.forwardRef<
|
|
|
259
266
|
{...props}
|
|
260
267
|
>
|
|
261
268
|
{children}
|
|
262
|
-
<
|
|
269
|
+
<ChevronsUpDown
|
|
263
270
|
aria-hidden="true"
|
|
264
271
|
className="text-muted-foreground ml-auto shrink-0"
|
|
265
|
-
size={16}
|
|
266
272
|
/>
|
|
267
273
|
</button>
|
|
268
274
|
</PopoverTrigger>
|
|
@@ -326,11 +332,18 @@ function ComboboxContent({
|
|
|
326
332
|
align = "start",
|
|
327
333
|
hideList = false,
|
|
328
334
|
}: ComboboxContentProps) {
|
|
329
|
-
const { shouldFilter } = useComboboxContext();
|
|
335
|
+
const { shouldFilter, itemToStringValue } = useComboboxContext();
|
|
336
|
+
|
|
337
|
+
const filter = React.useMemo(() => {
|
|
338
|
+
if (!itemToStringValue) return undefined;
|
|
339
|
+
return (value: string, search: string, keywords?: string[]) =>
|
|
340
|
+
defaultFilter(itemToStringValue(value), search, keywords);
|
|
341
|
+
}, [itemToStringValue]);
|
|
330
342
|
|
|
331
343
|
return (
|
|
332
344
|
<PopoverContent
|
|
333
345
|
align={align}
|
|
346
|
+
aria-label="Options"
|
|
334
347
|
className={cn("w-[var(--radix-popover-trigger-width)] p-0", className)}
|
|
335
348
|
data-slot="combobox-popover"
|
|
336
349
|
side="bottom"
|
|
@@ -338,11 +351,11 @@ function ComboboxContent({
|
|
|
338
351
|
<Command
|
|
339
352
|
className={cn(
|
|
340
353
|
"border-0 shadow-none",
|
|
341
|
-
hideList &&
|
|
342
|
-
"[&_[data-slot='command-input-wrapper']]:border-b-0"
|
|
354
|
+
hideList && "[&_[data-slot='command-input-wrapper']]:border-b-0"
|
|
343
355
|
)}
|
|
344
356
|
data-slot="combobox-command"
|
|
345
357
|
dataHook={dataHook || "combobox-command"}
|
|
358
|
+
filter={filter}
|
|
346
359
|
shouldFilter={shouldFilter}
|
|
347
360
|
>
|
|
348
361
|
{children}
|
|
@@ -457,7 +470,7 @@ export interface ComboboxItemProps extends Omit<
|
|
|
457
470
|
> {
|
|
458
471
|
/** The value of the item (required) */
|
|
459
472
|
value: string;
|
|
460
|
-
/** Display label - if not provided,
|
|
473
|
+
/** Display label - if not provided, inferred from children text content. Required when children are React elements (not plain text) to enable label-based search and trigger display. */
|
|
461
474
|
label?: string;
|
|
462
475
|
/** Data hook for automated testing */
|
|
463
476
|
dataHook?: string;
|
|
@@ -465,6 +478,8 @@ export interface ComboboxItemProps extends Omit<
|
|
|
465
478
|
highlight?: string;
|
|
466
479
|
/** Class name for highlighted text */
|
|
467
480
|
highlightClassName?: string;
|
|
481
|
+
/** Additional keywords to match against when filtering. The item label is always included automatically. */
|
|
482
|
+
keywords?: string[];
|
|
468
483
|
}
|
|
469
484
|
|
|
470
485
|
const ComboboxItem = React.forwardRef<
|
|
@@ -480,6 +495,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
480
495
|
className,
|
|
481
496
|
highlight,
|
|
482
497
|
highlightClassName,
|
|
498
|
+
keywords,
|
|
483
499
|
...props
|
|
484
500
|
},
|
|
485
501
|
ref
|
|
@@ -531,16 +547,16 @@ const ComboboxItem = React.forwardRef<
|
|
|
531
547
|
className={cn("justify-between", className)}
|
|
532
548
|
data-slot="combobox-item"
|
|
533
549
|
dataHook={dataHook}
|
|
550
|
+
keywords={keywords ? [childText, ...keywords] : [childText]}
|
|
534
551
|
value={itemValue}
|
|
535
552
|
onSelect={handleSelect}
|
|
536
553
|
{...props}
|
|
537
554
|
>
|
|
538
555
|
{renderContent()}
|
|
539
556
|
{isSelected && (
|
|
540
|
-
<
|
|
557
|
+
<Check
|
|
541
558
|
aria-hidden="true"
|
|
542
559
|
className="text-muted-foreground shrink-0"
|
|
543
|
-
size={16}
|
|
544
560
|
/>
|
|
545
561
|
)}
|
|
546
562
|
</CommandItem>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Command as CommandPrimitive } from "cmdk";
|
|
5
|
-
import {
|
|
5
|
+
import { Check, Search, X } from "@brightlocal/icons";
|
|
6
6
|
|
|
7
7
|
import { Button } from "@brightlocal/ui-components/button";
|
|
8
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -127,7 +127,7 @@ const CommandInput = React.forwardRef<
|
|
|
127
127
|
data-hook={dataHook}
|
|
128
128
|
data-slot="command-input-wrapper"
|
|
129
129
|
>
|
|
130
|
-
<
|
|
130
|
+
<Search className="shrink-0 opacity-50" />
|
|
131
131
|
<CommandPrimitive.Input
|
|
132
132
|
ref={inputRef}
|
|
133
133
|
className={cn(
|
|
@@ -149,7 +149,7 @@ const CommandInput = React.forwardRef<
|
|
|
149
149
|
variant="ghost"
|
|
150
150
|
onClick={handleClear}
|
|
151
151
|
>
|
|
152
|
-
<
|
|
152
|
+
<X />
|
|
153
153
|
</Button>
|
|
154
154
|
)}
|
|
155
155
|
</div>
|
|
@@ -326,7 +326,7 @@ const CommandItem = React.forwardRef<
|
|
|
326
326
|
<CommandPrimitive.Item
|
|
327
327
|
ref={ref}
|
|
328
328
|
className={cn(
|
|
329
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground
|
|
329
|
+
"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 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
330
330
|
className
|
|
331
331
|
)}
|
|
332
332
|
data-hook={dataHook}
|
|
@@ -337,7 +337,7 @@ const CommandItem = React.forwardRef<
|
|
|
337
337
|
{...props}
|
|
338
338
|
>
|
|
339
339
|
{children}
|
|
340
|
-
{selected && <
|
|
340
|
+
{selected && <Check className="text-foreground ml-auto" />}
|
|
341
341
|
</CommandPrimitive.Item>
|
|
342
342
|
)
|
|
343
343
|
);
|
|
@@ -175,7 +175,7 @@ const ContextMenuSubTrigger = React.forwardRef<
|
|
|
175
175
|
{...props}
|
|
176
176
|
>
|
|
177
177
|
{children}
|
|
178
|
-
<ChevronRight className="ml-auto"
|
|
178
|
+
<ChevronRight className="ml-auto" />
|
|
179
179
|
</ContextMenuPrimitive.SubTrigger>
|
|
180
180
|
)
|
|
181
181
|
);
|
|
@@ -341,7 +341,7 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
341
341
|
>
|
|
342
342
|
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
343
343
|
<ContextMenuPrimitive.ItemIndicator>
|
|
344
|
-
<Check
|
|
344
|
+
<Check />
|
|
345
345
|
</ContextMenuPrimitive.ItemIndicator>
|
|
346
346
|
</span>
|
|
347
347
|
{children}
|