@brightlocal/ui-components 2.24.0 → 2.25.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/component-meta.json +93 -79
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +17 -17
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +9 -9
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +43 -46
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.js +14 -14
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.js +11 -11
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +10 -10
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +12 -12
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +7 -7
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +7 -7
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/data-table.d.ts +29 -0
- package/dist/data-table.d.ts.map +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +61 -61
- package/dist/field.cjs +1 -1
- package/dist/field.js +1 -1
- package/dist/height-transition.cjs +1 -0
- package/dist/height-transition.d.ts +44 -0
- package/dist/height-transition.d.ts.map +1 -0
- package/dist/height-transition.js +63 -0
- 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 +326 -324
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +2 -2
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +15 -15
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/lib/motion.cjs +1 -0
- package/dist/lib/motion.d.ts +70 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +25 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +12 -4
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +17 -16
- package/dist/list.cjs +1 -1
- package/dist/list.js +10 -10
- package/dist/loading.cjs +1 -1
- package/dist/loading.d.ts.map +1 -1
- package/dist/loading.js +45 -47
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +2 -2
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +5 -5
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +13 -13
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +21 -25
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +12 -12
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.js +11 -11
- package/dist/select.cjs +1 -1
- package/dist/select.js +12 -12
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +54 -50
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +13 -13
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +4 -4
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +5 -5
- package/dist/table.cjs +1 -1
- package/dist/table.js +2 -2
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +77 -79
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +5 -5
- package/package.json +10 -13
- package/src/blocks/input-list.tsx +3 -6
- package/src/blocks/sidebar.tsx +14 -14
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/badge.tsx +1 -1
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +2 -2
- package/src/components/card.tsx +1 -1
- package/src/components/carousel.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +2 -2
- package/src/components/combobox.tsx +1 -1
- package/src/components/data-table.tsx +29 -0
- package/src/components/dialog.tsx +3 -3
- package/src/components/field.tsx +1 -1
- package/src/components/height-transition.tsx +164 -0
- package/src/components/input-chip.tsx +2 -2
- package/src/components/input-group.tsx +2 -2
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/link.tsx +4 -3
- package/src/components/list.tsx +1 -1
- package/src/components/loading.tsx +2 -15
- package/src/components/map.tsx +3 -2
- package/src/components/menubar.tsx +5 -5
- package/src/components/navigation-menu.tsx +6 -6
- package/src/components/pagination.tsx +1 -1
- package/src/components/progress.tsx +2 -10
- package/src/components/radio-group.tsx +1 -1
- package/src/components/scroll-area.tsx +2 -2
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.tsx +9 -5
- package/src/components/slider.tsx +1 -1
- package/src/components/stepper.tsx +4 -4
- package/src/components/switch.tsx +2 -2
- package/src/components/table.tsx +2 -2
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +3 -8
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/motion.ts +75 -0
- package/src/lib/utils.ts +14 -2
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -482,7 +482,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
482
482
|
<div
|
|
483
483
|
ref={ref}
|
|
484
484
|
className={cn(
|
|
485
|
-
"group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width]
|
|
485
|
+
"group text-sidebar-foreground duration-base flex h-full shrink-0 flex-col overflow-hidden transition-[width] ease-linear",
|
|
486
486
|
state === "expanded" && "w-(--sidebar-width)",
|
|
487
487
|
collapsible === SidebarCollapsible.ICON &&
|
|
488
488
|
state === "collapsed" &&
|
|
@@ -591,7 +591,7 @@ const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
|
|
|
591
591
|
ref={ref}
|
|
592
592
|
aria-label={resolvedLabel}
|
|
593
593
|
className={cn(
|
|
594
|
-
"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-0.5 sm:flex",
|
|
594
|
+
"hover:after:bg-sidebar-border duration-base 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-0.5 sm:flex",
|
|
595
595
|
"cursor-w-resize",
|
|
596
596
|
"in-data-[state=collapsed]:cursor-e-resize",
|
|
597
597
|
"group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
@@ -859,7 +859,7 @@ SidebarGroup.displayName = "SidebarGroup";
|
|
|
859
859
|
|
|
860
860
|
const sidebarGroupLabelVariants = cva(
|
|
861
861
|
[
|
|
862
|
-
"flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-
|
|
862
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-base ease-linear [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
863
863
|
SIDEBAR_FOCUS_RING,
|
|
864
864
|
],
|
|
865
865
|
{
|
|
@@ -982,7 +982,7 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
982
982
|
{variant === SidebarGroupLabelVariant.COLLAPSIBLE && (
|
|
983
983
|
<ChevronDown
|
|
984
984
|
className={cn(
|
|
985
|
-
"shrink-0 transition-transform
|
|
985
|
+
"duration-base shrink-0 transition-transform ease-in-out",
|
|
986
986
|
isOpen && "rotate-180"
|
|
987
987
|
)}
|
|
988
988
|
size={16}
|
|
@@ -1017,7 +1017,7 @@ const SidebarGroupAction = React.forwardRef<
|
|
|
1017
1017
|
<Comp
|
|
1018
1018
|
ref={ref}
|
|
1019
1019
|
className={cn(
|
|
1020
|
-
"text-sidebar-foreground 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 [&>svg]:shrink-0",
|
|
1020
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-base absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1021
1021
|
SIDEBAR_FOCUS_RING,
|
|
1022
1022
|
// Increases the hit area of the button on mobile.
|
|
1023
1023
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
@@ -1126,7 +1126,7 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
1126
1126
|
const iconProps = {
|
|
1127
1127
|
ref,
|
|
1128
1128
|
className: cn(
|
|
1129
|
-
"shrink-0 transition-transform",
|
|
1129
|
+
"shrink-0 transition-transform duration-base ease-in-out",
|
|
1130
1130
|
isActive && type === SidebarCollapseIconType.CARET && "rotate-90",
|
|
1131
1131
|
className
|
|
1132
1132
|
),
|
|
@@ -1155,7 +1155,7 @@ SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
|
|
|
1155
1155
|
|
|
1156
1156
|
const sidebarMenuButtonVariants = cva(
|
|
1157
1157
|
[
|
|
1158
|
-
"peer/menu-button flex w-full items-center gap-3 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-
|
|
1158
|
+
"peer/menu-button flex w-full items-center gap-3 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-base ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:not([data-slot])]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
|
|
1159
1159
|
SIDEBAR_FOCUS_RING,
|
|
1160
1160
|
],
|
|
1161
1161
|
{
|
|
@@ -1165,7 +1165,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1165
1165
|
simple: "",
|
|
1166
1166
|
// Collapsible - has a chevron indicator that rotates when open
|
|
1167
1167
|
collapsible:
|
|
1168
|
-
"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",
|
|
1168
|
+
"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform [&>[data-collapse-icon]]:duration-base [&>[data-collapse-icon]]:ease-in-out data-[state=open]:[&>[data-collapse-icon]]:rotate-90",
|
|
1169
1169
|
// Dropdown - has action menu (dots) on hover
|
|
1170
1170
|
dropdown: "group-has-[[data-slot=sidebar-menu-action]]/menu-item:pr-8",
|
|
1171
1171
|
// Badge - has a number badge on the right (handled via SidebarMenuBadge)
|
|
@@ -1312,7 +1312,7 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
1312
1312
|
<Comp
|
|
1313
1313
|
ref={ref}
|
|
1314
1314
|
className={cn(
|
|
1315
|
-
"text-sidebar-foreground 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 [&>svg]:shrink-0",
|
|
1315
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground duration-base absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1316
1316
|
SIDEBAR_FOCUS_RING,
|
|
1317
1317
|
// Increases the hit area of the button on mobile.
|
|
1318
1318
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
@@ -1519,7 +1519,7 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1519
1519
|
<Comp
|
|
1520
1520
|
ref={ref}
|
|
1521
1521
|
className={cn(
|
|
1522
|
-
"text-sidebar-foreground 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 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity]
|
|
1522
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground duration-fast flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
|
|
1523
1523
|
SIDEBAR_FOCUS_RING,
|
|
1524
1524
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1525
1525
|
size === SidebarMenuSubButtonSize.SM && "text-xs",
|
|
@@ -1621,7 +1621,7 @@ const SidebarMenuCollapsibleTrigger = React.forwardRef<
|
|
|
1621
1621
|
{children}
|
|
1622
1622
|
<ChevronRight
|
|
1623
1623
|
data-collapse-icon
|
|
1624
|
-
className="opacity-100! transition-transform
|
|
1624
|
+
className="duration-base opacity-100! transition-transform ease-in-out group-data-[collapsible=icon]:hidden"
|
|
1625
1625
|
size={12}
|
|
1626
1626
|
/>
|
|
1627
1627
|
</SidebarMenuButton>
|
|
@@ -1811,7 +1811,7 @@ const SidebarPopoverTrigger = React.forwardRef<
|
|
|
1811
1811
|
ref={ref}
|
|
1812
1812
|
aria-label={triggerAriaLabel ?? "Switch workspace"}
|
|
1813
1813
|
className={cn(
|
|
1814
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex items-center gap-2 rounded-md px-1.5 py-2 text-sm font-semibold transition-colors
|
|
1814
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-fast flex items-center gap-2 rounded-md px-1.5 py-2 text-sm font-semibold transition-colors ease-out outline-none",
|
|
1815
1815
|
SIDEBAR_FOCUS_RING,
|
|
1816
1816
|
className
|
|
1817
1817
|
)}
|
|
@@ -1863,7 +1863,7 @@ const SidebarPopoverMenuItem = React.forwardRef<
|
|
|
1863
1863
|
<button
|
|
1864
1864
|
ref={ref}
|
|
1865
1865
|
className={cn(
|
|
1866
|
-
"text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex h-10 w-full items-center gap-2 rounded-xs p-2 text-sm transition-colors
|
|
1866
|
+
"text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground duration-fast flex h-10 w-full items-center gap-2 rounded-xs p-2 text-sm transition-colors ease-out outline-none",
|
|
1867
1867
|
SIDEBAR_FOCUS_RING,
|
|
1868
1868
|
className
|
|
1869
1869
|
)}
|
|
@@ -2230,7 +2230,7 @@ const SidebarInboxItem = React.forwardRef<
|
|
|
2230
2230
|
<button
|
|
2231
2231
|
ref={ref}
|
|
2232
2232
|
className={cn(
|
|
2233
|
-
"border-sidebar-border text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent flex w-full flex-col gap-2 border-b p-4 text-left transition-colors
|
|
2233
|
+
"border-sidebar-border text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent duration-fast flex w-full flex-col gap-2 border-b p-4 text-left transition-colors ease-out outline-none",
|
|
2234
2234
|
SIDEBAR_FOCUS_RING,
|
|
2235
2235
|
className
|
|
2236
2236
|
)}
|
|
@@ -178,14 +178,14 @@ const AccordionTrigger = React.forwardRef<
|
|
|
178
178
|
<AccordionPrimitive.Trigger
|
|
179
179
|
ref={ref}
|
|
180
180
|
className={cn(
|
|
181
|
-
"focus-visible:border-ring focus-visible:shadow-default flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-shadow outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
181
|
+
"focus-visible:border-ring focus-visible:shadow-default duration-fast flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
182
182
|
className
|
|
183
183
|
)}
|
|
184
184
|
data-slot="accordion-trigger"
|
|
185
185
|
{...props}
|
|
186
186
|
>
|
|
187
187
|
{children}
|
|
188
|
-
<ChevronDown className="text-muted-foreground pointer-events-none shrink-0 translate-y-0.5 transition-transform
|
|
188
|
+
<ChevronDown className="text-muted-foreground duration-base pointer-events-none shrink-0 translate-y-0.5 transition-transform ease-in-out" />
|
|
189
189
|
</AccordionPrimitive.Trigger>
|
|
190
190
|
</AccordionPrimitive.Header>
|
|
191
191
|
));
|
|
@@ -71,7 +71,7 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
71
71
|
<AlertDialogPrimitive.Overlay
|
|
72
72
|
ref={ref}
|
|
73
73
|
className={cn(
|
|
74
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
74
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in",
|
|
75
75
|
className
|
|
76
76
|
)}
|
|
77
77
|
data-slot="alert-dialog-overlay"
|
|
@@ -94,7 +94,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
94
94
|
<AlertDialogPrimitive.Content
|
|
95
95
|
ref={ref}
|
|
96
96
|
className={cn(
|
|
97
|
-
"border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-
|
|
97
|
+
"border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:duration-slow fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in sm:max-w-lg",
|
|
98
98
|
className
|
|
99
99
|
)}
|
|
100
100
|
data-slot="alert-dialog-content"
|
package/src/components/badge.tsx
CHANGED
|
@@ -15,7 +15,7 @@ const badgeVariants = cva(
|
|
|
15
15
|
// Icons
|
|
16
16
|
"[&>svg]:size-3 [&>svg]:pointer-events-none",
|
|
17
17
|
// Transition
|
|
18
|
-
"transition-[color,background-color,border-color,box-shadow] duration-
|
|
18
|
+
"transition-[color,background-color,border-color,box-shadow] duration-fast ease-out",
|
|
19
19
|
// Focus
|
|
20
20
|
"focus-visible:outline-none",
|
|
21
21
|
"focus-visible:shadow-[0_0_0_1px_white,0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(0,0,0,0.1)]",
|
|
@@ -123,7 +123,7 @@ const BrandIllustrationMotif = React.forwardRef<
|
|
|
123
123
|
>
|
|
124
124
|
<div
|
|
125
125
|
aria-hidden="true"
|
|
126
|
-
className={cn("absolute inset-0", spinning && "animate-
|
|
126
|
+
className={cn("absolute inset-0", spinning && "animate-ambient-spin")}
|
|
127
127
|
>
|
|
128
128
|
<MotifIcon className="size-full" size="100%" />
|
|
129
129
|
</div>
|
|
@@ -109,7 +109,7 @@ const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(
|
|
|
109
109
|
<Comp
|
|
110
110
|
ref={ref}
|
|
111
111
|
className={cn(
|
|
112
|
-
"hover:text-foreground focus-visible:shadow-default rounded-sm transition-colors outline-none",
|
|
112
|
+
"hover:text-foreground focus-visible:shadow-default duration-fast rounded-sm transition-colors ease-out outline-none",
|
|
113
113
|
className
|
|
114
114
|
)}
|
|
115
115
|
data-slot="breadcrumb-link"
|
|
@@ -43,8 +43,8 @@ const ButtonVariants = cva(
|
|
|
43
43
|
"gap-2",
|
|
44
44
|
"whitespace-nowrap",
|
|
45
45
|
"transition-[color,background-color,border-color,box-shadow,opacity]",
|
|
46
|
-
"duration-
|
|
47
|
-
"ease-
|
|
46
|
+
"duration-fast",
|
|
47
|
+
"ease-out",
|
|
48
48
|
"cursor-pointer",
|
|
49
49
|
"disabled:pointer-events-none",
|
|
50
50
|
"disabled:cursor-not-allowed",
|
package/src/components/card.tsx
CHANGED
|
@@ -586,7 +586,7 @@ function CarouselDots({
|
|
|
586
586
|
: `Go to slide ${index + 1}`
|
|
587
587
|
}
|
|
588
588
|
className={cn(
|
|
589
|
-
"focus-visible:shadow-default size-3 rounded-full transition-[width,background-color]
|
|
589
|
+
"focus-visible:shadow-default duration-base size-3 rounded-full transition-[width,background-color] ease-in-out outline-none",
|
|
590
590
|
index === selectedIndex
|
|
591
591
|
? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9"
|
|
592
592
|
: "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"
|
|
@@ -10,7 +10,7 @@ const checkboxVariants = cva(
|
|
|
10
10
|
// Layout & Size
|
|
11
11
|
"size-[18px] shrink-0 self-start mt-0.5",
|
|
12
12
|
// Appearance
|
|
13
|
-
"bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none",
|
|
13
|
+
"bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors duration-fast ease-out outline-none",
|
|
14
14
|
// Checked State
|
|
15
15
|
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary",
|
|
16
16
|
// Focus States
|
package/src/components/chip.tsx
CHANGED
|
@@ -34,8 +34,8 @@ const chipVariants = cva(
|
|
|
34
34
|
"text-foreground",
|
|
35
35
|
// Transitions
|
|
36
36
|
"transition-[color,background-color,box-shadow]",
|
|
37
|
-
"duration-
|
|
38
|
-
"ease-
|
|
37
|
+
"duration-fast",
|
|
38
|
+
"ease-out",
|
|
39
39
|
// Hover state
|
|
40
40
|
"hover:bg-secondary/80",
|
|
41
41
|
// Focus state - direct focus on chip (for keyboard navigation)
|
|
@@ -399,7 +399,7 @@ const comboboxTriggerVariants = cva([
|
|
|
399
399
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
400
400
|
|
|
401
401
|
// Transitions
|
|
402
|
-
"transition-[background-color,border-color,box-shadow] duration-
|
|
402
|
+
"transition-[background-color,border-color,box-shadow] duration-fast ease-out",
|
|
403
403
|
|
|
404
404
|
// Icon styles
|
|
405
405
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
@@ -447,9 +447,33 @@ export interface DataTableProps<TData> {
|
|
|
447
447
|
* the table primitives. Keep it focused on rendering — toolbars, search,
|
|
448
448
|
* pagination, etc. are composed around it.
|
|
449
449
|
*
|
|
450
|
+
* **Compose as one slot.** The table and its companions — `DataTableToolbar`
|
|
451
|
+
* rows (search, filters, pagination, counters), `DataTableBulkActions` — form
|
|
452
|
+
* a single unit. When the parent lays out its children with a gap (e.g.
|
|
453
|
+
* `DialogContent` with `gap-8`, a Card body, a page section), wrap the whole
|
|
454
|
+
* unit in one flex-column container so the parent's gap applies around the
|
|
455
|
+
* table block, not between the toolbars and the table. Vertical rhythm inside
|
|
456
|
+
* the block comes from the toolbars' built-in padding — don't add custom
|
|
457
|
+
* margins between the parts.
|
|
458
|
+
*
|
|
450
459
|
* @example
|
|
451
460
|
* const table = useDataTable({ columns, data, enableSorting: true });
|
|
452
461
|
* return <DataTable table={table} dataHook="my-table" />;
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* // One slot inside a gapped parent (dialog, card, page section).
|
|
465
|
+
* // min-h-0/flex-1 keep the table scrollable in height-capped parents.
|
|
466
|
+
* <div className="flex min-h-0 flex-1 flex-col">
|
|
467
|
+
* <DataTableToolbar dataHook="toolbar-top">
|
|
468
|
+
* <DataTableToolbarLeft>{heading or search}</DataTableToolbarLeft>
|
|
469
|
+
* <DataTableToolbarRight>{filters}</DataTableToolbarRight>
|
|
470
|
+
* </DataTableToolbar>
|
|
471
|
+
* <DataTable table={table} dataHook="my-table" className="min-h-0 flex-1 overflow-y-auto" />
|
|
472
|
+
* <DataTableToolbar dataHook="toolbar-bottom">
|
|
473
|
+
* <DataTableToolbarLeft>{selection counter}</DataTableToolbarLeft>
|
|
474
|
+
* <DataTableToolbarRight>{pagination}</DataTableToolbarRight>
|
|
475
|
+
* </DataTableToolbar>
|
|
476
|
+
* </div>
|
|
453
477
|
*/
|
|
454
478
|
export function DataTable<TData>({
|
|
455
479
|
table,
|
|
@@ -1792,6 +1816,11 @@ export interface DataTableToolbarProps {
|
|
|
1792
1816
|
* row on `sm:` and up. Layout-only — no dependency on a TanStack Table
|
|
1793
1817
|
* instance, so it works for table footers or any search-plus-pagination row.
|
|
1794
1818
|
*
|
|
1819
|
+
* Toolbars belong in the same flex-column container as their `DataTable` so
|
|
1820
|
+
* the group reads as one slot inside gapped parents — see the composition
|
|
1821
|
+
* note on `DataTable`. The built-in vertical padding provides the spacing
|
|
1822
|
+
* between a toolbar and its table; don't add custom margins or padding.
|
|
1823
|
+
*
|
|
1795
1824
|
* @example
|
|
1796
1825
|
* <DataTableToolbar dataHook="locations-toolbar">
|
|
1797
1826
|
* <DataTableToolbarLeft>
|
|
@@ -77,7 +77,7 @@ const DialogOverlay = React.forwardRef<
|
|
|
77
77
|
<DialogPrimitive.Overlay
|
|
78
78
|
ref={ref}
|
|
79
79
|
className={cn(
|
|
80
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
80
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in",
|
|
81
81
|
className
|
|
82
82
|
)}
|
|
83
83
|
data-slot="dialog-overlay"
|
|
@@ -137,7 +137,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
137
137
|
<DialogPrimitive.Content
|
|
138
138
|
ref={ref}
|
|
139
139
|
className={cn(
|
|
140
|
-
"bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-
|
|
140
|
+
"bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border data-[state=open]:duration-slow fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in sm:max-w-lg",
|
|
141
141
|
className
|
|
142
142
|
)}
|
|
143
143
|
data-hook={dataHook}
|
|
@@ -147,7 +147,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
147
147
|
{...props}
|
|
148
148
|
>
|
|
149
149
|
{children}
|
|
150
|
-
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2
|
|
150
|
+
<DialogPrimitive.Close className="ring-offset-background focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground duration-fast absolute top-8 right-8 rounded-xs opacity-70 outline-hidden transition-opacity ease-out hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
|
|
151
151
|
<X />
|
|
152
152
|
<span className="sr-only">{closeLabel ?? "Close"}</span>
|
|
153
153
|
</DialogPrimitive.Close>
|
package/src/components/field.tsx
CHANGED
|
@@ -118,7 +118,7 @@ const fieldVariants = cva(
|
|
|
118
118
|
box: [
|
|
119
119
|
"relative cursor-pointer gap-3",
|
|
120
120
|
"rounded-lg border border-border bg-background p-3",
|
|
121
|
-
"transition-colors",
|
|
121
|
+
"transition-colors duration-fast ease-out",
|
|
122
122
|
"[&_[data-slot=field-label]]:after:absolute [&_[data-slot=field-label]]:after:inset-0 [&_[data-slot=field-label]]:after:cursor-pointer",
|
|
123
123
|
// Focus ring when a child control receives focus
|
|
124
124
|
"has-[:focus-visible]:shadow-default has-[:focus-visible]:border-ring",
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Result of {@link useHeightTransition}: attach `contentRef` to the element
|
|
9
|
+
* whose natural height should be tracked, and apply `height` (px) to the
|
|
10
|
+
* clipping wrapper around it.
|
|
11
|
+
*/
|
|
12
|
+
interface UseHeightTransitionResult {
|
|
13
|
+
/** Ref for the inner content element the hook measures. */
|
|
14
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Measured content height in pixels, or `undefined` before the first
|
|
17
|
+
* measurement (render `auto` until then so mounting never animates).
|
|
18
|
+
*/
|
|
19
|
+
height: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Measures an element's natural height with a ResizeObserver so a wrapper
|
|
24
|
+
* can set an explicit pixel height and CSS-transition between values —
|
|
25
|
+
* the same idea the Accordion uses (`--radix-accordion-content-height`),
|
|
26
|
+
* generalized to arbitrary content changes.
|
|
27
|
+
*
|
|
28
|
+
* Module-private on purpose: no external consumer exists yet, and keeping it
|
|
29
|
+
* out of the public API leaves the ref/height contract free to change.
|
|
30
|
+
*/
|
|
31
|
+
function useHeightTransition(): UseHeightTransitionResult {
|
|
32
|
+
const contentRef = React.useRef<HTMLDivElement>(null);
|
|
33
|
+
const [height, setHeight] = React.useState<number>();
|
|
34
|
+
|
|
35
|
+
React.useLayoutEffect(() => {
|
|
36
|
+
const node = contentRef.current;
|
|
37
|
+
if (!node) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Missing in some non-browser runtimes (e.g. jsdom without a polyfill);
|
|
41
|
+
// height stays undefined there, so the wrapper renders `auto` with no
|
|
42
|
+
// animation instead of throwing.
|
|
43
|
+
if (typeof ResizeObserver === "undefined") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const observer = new ResizeObserver((entries) => {
|
|
47
|
+
// A display:none ancestor reports size 0 — keep the last real height
|
|
48
|
+
// so re-showing doesn't animate the content open from 0px.
|
|
49
|
+
if (node.offsetParent === null) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const entry = entries[0];
|
|
53
|
+
const next =
|
|
54
|
+
entry?.borderBoxSize?.[0]?.blockSize ??
|
|
55
|
+
node.getBoundingClientRect().height;
|
|
56
|
+
setHeight(next);
|
|
57
|
+
});
|
|
58
|
+
// No manual first measurement: observe() always delivers an initial
|
|
59
|
+
// entry, and getBoundingClientRect would bake ancestor entrance
|
|
60
|
+
// transforms (e.g. the Dialog's zoom-in-95) into the recorded height —
|
|
61
|
+
// the observer's borderBoxSize doesn't.
|
|
62
|
+
observer.observe(node);
|
|
63
|
+
return () => observer.disconnect();
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
return { contentRef, height };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Props for the HeightTransition component.
|
|
71
|
+
* Extends native `<div>` props with testing and analytics attributes.
|
|
72
|
+
*/
|
|
73
|
+
export interface HeightTransitionProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
74
|
+
/**
|
|
75
|
+
* Data hook for automated testing (required).
|
|
76
|
+
* @example "suggest-prompts-list-height"
|
|
77
|
+
*/
|
|
78
|
+
dataHook: string;
|
|
79
|
+
/** Tracking element identifier for analytics. */
|
|
80
|
+
trackingEl?: string;
|
|
81
|
+
/** Tracking label for analytics context. */
|
|
82
|
+
trackingLabel?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Smoothly transitions its own height whenever the children's natural
|
|
87
|
+
* height changes (content swap, filtering, inline expansion). A
|
|
88
|
+
* ResizeObserver measures the content and the wrapper transitions an
|
|
89
|
+
* explicit pixel height over `duration-base` with `ease-out` (matching the
|
|
90
|
+
* Accordion's reveal timing), clipping overflow while the transition runs.
|
|
91
|
+
*
|
|
92
|
+
* The anchor point of the resize comes from the surrounding layout, not from
|
|
93
|
+
* this component: in normal flow the top edge is pinned and growth extends
|
|
94
|
+
* downward; inside a vertically centered parent (a Dialog's
|
|
95
|
+
* `top-[50%] translate-y-[-50%]`, or `grid place-items-center`) the same
|
|
96
|
+
* transition reshapes around the center with both edges moving. Pick the
|
|
97
|
+
* parent positioning to pick the motion.
|
|
98
|
+
*
|
|
99
|
+
* Reduced motion is handled by the DS global kill-switch — no
|
|
100
|
+
* component-level handling needed or allowed.
|
|
101
|
+
*
|
|
102
|
+
* Note: animating `height` reflows on every frame — reserve this for
|
|
103
|
+
* occasional content swaps (dialogs, panels), not for anything that
|
|
104
|
+
* resizes continuously.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* <HeightTransition dataHook="results-height">
|
|
108
|
+
* {loading ? <ResultsSkeleton /> : <Results items={items} />}
|
|
109
|
+
* </HeightTransition>
|
|
110
|
+
*/
|
|
111
|
+
export const HeightTransition = React.forwardRef<
|
|
112
|
+
HTMLDivElement,
|
|
113
|
+
HeightTransitionProps
|
|
114
|
+
>(
|
|
115
|
+
(
|
|
116
|
+
{
|
|
117
|
+
className,
|
|
118
|
+
style,
|
|
119
|
+
dataHook,
|
|
120
|
+
trackingEl,
|
|
121
|
+
trackingLabel,
|
|
122
|
+
children,
|
|
123
|
+
...props
|
|
124
|
+
},
|
|
125
|
+
ref
|
|
126
|
+
) => {
|
|
127
|
+
const { contentRef, height } = useHeightTransition();
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div
|
|
131
|
+
ref={ref}
|
|
132
|
+
className={cn(
|
|
133
|
+
"duration-base overflow-hidden transition-[height] ease-out",
|
|
134
|
+
className
|
|
135
|
+
)}
|
|
136
|
+
data-hook={dataHook}
|
|
137
|
+
data-slot="height-transition"
|
|
138
|
+
data-tracking-el={trackingEl || "height-transition"}
|
|
139
|
+
data-tracking-label={trackingLabel}
|
|
140
|
+
// Managed height last: the component's one job is controlling
|
|
141
|
+
// height, so a consumer style={{height}} must not silently
|
|
142
|
+
// disable the transition (and clip content).
|
|
143
|
+
style={{
|
|
144
|
+
...style,
|
|
145
|
+
height,
|
|
146
|
+
}}
|
|
147
|
+
{...props}
|
|
148
|
+
>
|
|
149
|
+
{/* flow-root keeps children's vertical margins inside the measured
|
|
150
|
+
border-box — otherwise they collapse through this div and the
|
|
151
|
+
wrapper's overflow-hidden clips the uncounted space. */}
|
|
152
|
+
<div
|
|
153
|
+
ref={contentRef}
|
|
154
|
+
className="flow-root"
|
|
155
|
+
data-slot="height-transition-content"
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
HeightTransition.displayName = "HeightTransition";
|
|
@@ -251,8 +251,8 @@ const inputChipInputVariants = cva(
|
|
|
251
251
|
"has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50",
|
|
252
252
|
// Transition
|
|
253
253
|
"transition-[color,box-shadow,border-color]",
|
|
254
|
-
"duration-
|
|
255
|
-
"ease-
|
|
254
|
+
"duration-fast",
|
|
255
|
+
"ease-out",
|
|
256
256
|
],
|
|
257
257
|
{
|
|
258
258
|
variants: {
|
|
@@ -8,7 +8,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
|
8
8
|
import { Input, type InputProps } from "./input";
|
|
9
9
|
|
|
10
10
|
const inputGroupVariants = cva(
|
|
11
|
-
"relative flex w-full items-center rounded-sm border border-input bg-background transition-
|
|
11
|
+
"relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
|
|
12
12
|
{
|
|
13
13
|
variants: {
|
|
14
14
|
size: {
|
|
@@ -137,7 +137,7 @@ InputGroupAddon.displayName = "InputGroupAddon";
|
|
|
137
137
|
const inputGroupButtonVariants = cva(
|
|
138
138
|
[
|
|
139
139
|
"inline-flex items-center justify-center gap-2",
|
|
140
|
-
"text-sm font-medium transition-colors",
|
|
140
|
+
"text-sm font-medium transition-colors duration-fast ease-out",
|
|
141
141
|
"outline-none focus-visible:shadow-default rounded-sm",
|
|
142
142
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
143
143
|
"text-muted-foreground hover:text-foreground",
|
|
@@ -137,7 +137,7 @@ function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {
|
|
|
137
137
|
// Base styles
|
|
138
138
|
"relative flex h-9 w-9 items-center justify-center",
|
|
139
139
|
"border-input bg-background border-y border-r",
|
|
140
|
-
"text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none",
|
|
140
|
+
"text-foreground duration-fast text-base font-normal transition-[border-color,box-shadow] ease-out outline-none",
|
|
141
141
|
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
142
142
|
// Focus state
|
|
143
143
|
"data-[active=true]:border-ring data-[active=true]:z-10",
|
package/src/components/input.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export const inputVariants = cva(
|
|
|
14
14
|
"flex w-full min-w-0 h-9",
|
|
15
15
|
// Appearance
|
|
16
16
|
"border border-input bg-background rounded-sm",
|
|
17
|
-
"outline-none transition-[border-color,box-shadow,background-color]",
|
|
17
|
+
"outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
18
18
|
// Typography
|
|
19
19
|
"text-base font-sans",
|
|
20
20
|
"text-foreground",
|
package/src/components/link.tsx
CHANGED
|
@@ -22,8 +22,8 @@ const buttonStyledBase = [
|
|
|
22
22
|
"[&_svg]:pointer-events-none",
|
|
23
23
|
"[&_svg]:shrink-0",
|
|
24
24
|
"transition-[color,background-color,border-color,box-shadow]",
|
|
25
|
-
"duration-
|
|
26
|
-
"ease-
|
|
25
|
+
"duration-fast",
|
|
26
|
+
"ease-out",
|
|
27
27
|
"focus-visible:shadow-default",
|
|
28
28
|
];
|
|
29
29
|
|
|
@@ -48,7 +48,8 @@ const linkVariants = cva(
|
|
|
48
48
|
"visited:dark:text-link-visited-dark",
|
|
49
49
|
// Transitions
|
|
50
50
|
"transition-[text-decoration,text-decoration-color,text-underline-offset,color]",
|
|
51
|
-
"duration-
|
|
51
|
+
"duration-fast",
|
|
52
|
+
"ease-out",
|
|
52
53
|
// Focus state
|
|
53
54
|
"focus-visible:shadow-default",
|
|
54
55
|
],
|
package/src/components/list.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { animate } from "framer-motion";
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion";
|
|
9
|
-
import { SETTLE_REST_DELTA } from "../lib/
|
|
9
|
+
import { SETTLE_REST_DELTA, SPRING_SETTLE } from "../lib/motion";
|
|
10
10
|
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
// Shape paths (500×500 viewBox)
|
|
@@ -46,16 +46,6 @@ const LOADING_SHAPES: string[] = [
|
|
|
46
46
|
|
|
47
47
|
/** Pause (ms) each shape holds before morphing to the next */
|
|
48
48
|
const HOLD_MS = 150;
|
|
49
|
-
/** Spring stiffness for the morph + rotation */
|
|
50
|
-
const STIFFNESS = 30;
|
|
51
|
-
/**
|
|
52
|
-
* Spring damping — higher = less oscillation.
|
|
53
|
-
* Must stay ≥ 2×√(STIFFNESS×MASS) (≈7.75) so the spring never overshoots —
|
|
54
|
-
* the settle trick below depends on it (see SETTLE_REST_DELTA).
|
|
55
|
-
*/
|
|
56
|
-
const DAMPING = 9;
|
|
57
|
-
/** Spring mass — higher = more inertia */
|
|
58
|
-
const MASS = 0.5;
|
|
59
49
|
/** Degrees of rotation per morph cycle (clockwise) */
|
|
60
50
|
const ROTATION_DEG = 360;
|
|
61
51
|
/** Rendered size of the loader in pixels (width and height) */
|
|
@@ -254,10 +244,7 @@ const Loading = React.forwardRef<SVGSVGElement, LoadingProps>(
|
|
|
254
244
|
return;
|
|
255
245
|
}
|
|
256
246
|
const controls = animate(0, 1 + SETTLE_REST_DELTA, {
|
|
257
|
-
|
|
258
|
-
stiffness: STIFFNESS,
|
|
259
|
-
damping: DAMPING,
|
|
260
|
-
mass: MASS,
|
|
247
|
+
...SPRING_SETTLE,
|
|
261
248
|
restDelta: SETTLE_REST_DELTA,
|
|
262
249
|
onUpdate: (v: number) => {
|
|
263
250
|
if (signal.cancelled) {
|