Skip to content

Commit dfdafdb

Browse files
🖌️ feat: add animation styles for popovers and tooltips (#8831)
* feat: Update client version to 0.2.2 and add animation styles for popovers and tooltips * refactor: Remove focus outline styles from Dropdown component * feat: Update client version to 0.2.3 and add Select component export --------- Co-authored-by: Danny Avila <[email protected]>
1 parent 33834cd commit dfdafdb

File tree

12 files changed

+133
-3
lines changed

12 files changed

+133
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@librechat/client",
3-
"version": "0.2.1",
3+
"version": "0.2.3",
44
"description": "React components for LibreChat",
55
"main": "dist/index.js",
66
"module": "dist/index.es.js",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.animate-popover {
2+
transform-origin: top;
3+
opacity: 0;
4+
transition:
5+
opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
6+
transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
7+
transform: scale(0.95) translateY(-0.5rem);
8+
}
9+
10+
.animate-popover[data-enter] {
11+
opacity: 1;
12+
transform: scale(1) translateY(0);
13+
}
14+
15+
.animate-popover-left {
16+
transform-origin: left;
17+
opacity: 0;
18+
transition:
19+
opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
20+
transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
21+
transform: scale(0.95) translateX(-0.5rem);
22+
}
23+
24+
.animate-popover-left[data-enter] {
25+
opacity: 1;
26+
transform: scale(1) translateX(0);
27+
}

packages/client/src/components/ControlCombobox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Search, ChevronDown } from 'lucide-react';
44
import { useMemo, useState, useRef, memo, useEffect } from 'react';
55
import { SelectRenderer } from '@ariakit/react-core/select/select-renderer';
66
import type { OptionWithIcon } from '~/common';
7+
import './AnimatePopover.css';
78
import { cn } from '~/utils';
89

910
interface ControlComboboxProps {
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
.popover-ui {
2+
display: flex;
3+
max-height: min(var(--popover-available-height, 1700px), 1700px);
4+
flex-direction: column;
5+
overflow: auto;
6+
overscroll-behavior: contain;
7+
border-radius: 1rem;
8+
border-width: 1px;
9+
border-style: solid;
10+
border-color: var(--border-light);
11+
background-color: var(--surface-primary);
12+
padding: 0.5rem;
13+
color: var(--text-primary);
14+
box-shadow:
15+
0 10px 15px -3px rgb(0 0 0 / 0.1),
16+
0 4px 6px -4px rgb(0 0 0 / 0.1);
17+
transform-origin: top;
18+
opacity: 0;
19+
transition-property: opacity, scale, translate;
20+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
21+
transition-duration: 150ms;
22+
scale: 0.95;
23+
translate: 0 -0.5rem;
24+
margin-top: 4px;
25+
margin-right: -2px;
26+
}
27+
28+
.popover-animate {
29+
opacity: 0;
30+
transform: scale(0.95) translateY(-0.5rem);
31+
transition:
32+
opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
33+
transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
34+
}
35+
.popover-animate[data-enter] {
36+
opacity: 1;
37+
transform: scale(1) translateY(0);
38+
}
39+
40+
.popover-ui:focus-visible,
41+
.popover-ui[data-focus-visible] {
42+
outline: var(--bg-surface-hover);
43+
outline-offset: -1px;
44+
}
45+
46+
.popover-ui:where(.dark, .dark *) {
47+
background-color: var(--surface-secondary);
48+
color: var(--text-secondary);
49+
box-shadow:
50+
0 10px 15px -3px rgb(0 0 0 / 0.25),
51+
0 4px 6px -4px rgb(0 0 0 / 0.1);
52+
}
53+
54+
.select-item {
55+
display: flex;
56+
cursor: pointer;
57+
scroll-margin: 0.5rem;
58+
align-items: center;
59+
gap: 0.5rem;
60+
border-radius: 0.5rem;
61+
padding: 0.5rem;
62+
outline: none !important;
63+
}
64+
65+
.select-item[aria-disabled='true'] {
66+
opacity: 0.5;
67+
}
68+
69+
.select-item[data-active-item] {
70+
background-color: var(--surface-hover);
71+
color: var(--text-primary);
72+
}
73+
74+
.popover-ui[data-enter] {
75+
opacity: 1;
76+
scale: 1;
77+
translate: 0;
78+
}

packages/client/src/components/Dropdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import * as Select from '@ariakit/react/select';
33
import type { Option } from '~/common';
44
import { cn } from '~/utils/';
5+
import './Dropdown.css';
56

67
interface DropdownProps {
78
value?: string;

packages/client/src/components/DropdownPopup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import * as Ariakit from '@ariakit/react';
33
import type * as t from '~/common';
44
import { cn } from '~/utils';
5+
import './Dropdown.css';
56

67
interface DropdownProps {
78
keyPrefix?: string;

packages/client/src/components/MultiSelect.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
SelectPopover,
99
SelectProvider,
1010
} from '@ariakit/react';
11+
import './AnimatePopover.css';
1112
import { cn } from '~/utils';
1213

1314
interface MultiSelectProps<T extends string> {

packages/client/src/components/Select.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import * as SelectPrimitive from '@radix-ui/react-select';
33
import { CaretSortIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@radix-ui/react-icons';
4-
54
import { cn } from '~/utils';
65

76
// @ts-ignore - Radix UI type conflicts with React types
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.tooltip {
2+
z-index: 50;
3+
cursor: pointer;
4+
border-radius: 0.275rem;
5+
background-color: var(--surface-primary);
6+
padding-top: 0.25rem;
7+
padding-bottom: 0.25rem;
8+
padding-left: 0.5rem;
9+
padding-right: 0.5rem;
10+
font-size: 1rem;
11+
line-height: 1.5rem;
12+
color: black;
13+
box-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.25);
14+
}
15+
16+
.tooltip:where(.dark, .dark *) {
17+
background-color: var(--surface-primary);
18+
color: white;
19+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.35);
20+
}

0 commit comments

Comments
 (0)