summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/dropdown-menu.css
blob: cfbfd1cf0e19c842c8b521f288e5e4c8b2d3126d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[data-component="dropdown-menu-content"],
[data-component="dropdown-menu-sub-content"] {
	min-width: 8rem;
	overflow: hidden;
	border: none;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs-border);
	background-clip: padding-box;
	background-color: var(--surface-raised-stronger-non-alpha);
	padding: 4px;
	z-index: 100;
	transform-origin: var(--kb-menu-content-transform-origin);

	&:focus-within,
	&:focus {
		outline: none;
	}

	animation: dropdownMenuContentHide var(--transition-duration)
		var(--transition-easing) forwards;

	@starting-style {
		animation: none;
	}

	&[data-expanded] {
		pointer-events: auto;
		animation: dropdownMenuContentShow var(--transition-duration)
			var(--transition-easing) forwards;
	}
}

[data-component="dropdown-menu-content"],
[data-component="dropdown-menu-sub-content"] {
	[data-slot="dropdown-menu-item"],
	[data-slot="dropdown-menu-checkbox-item"],
	[data-slot="dropdown-menu-radio-item"],
	[data-slot="dropdown-menu-sub-trigger"] {
		position: relative;
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 4px 8px;
		border-radius: var(--radius-sm);
		cursor: default;
		outline: none;

		font-family: var(--font-family-sans);
		font-size: var(--font-size-base);
		font-weight: var(--font-weight-medium);
		line-height: var(--line-height-large);
		letter-spacing: var(--letter-spacing-normal);
		color: var(--text-strong);

		transition-property: background-color, color;
		transition-duration: var(--transition-duration);
		transition-timing-function: var(--transition-easing);
		user-select: none;

		&:hover {
			background-color: var(--surface-raised-base-hover);
		}

		&[data-disabled] {
			color: var(--text-weak);
			pointer-events: none;
		}
	}

	[data-slot="dropdown-menu-sub-trigger"] {
		&[data-expanded] {
			background: var(--surface-raised-base-hover);
			outline: none;
			border: none;
		}
	}

	[data-slot="dropdown-menu-item-indicator"] {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 16px;
		height: 16px;
	}

	[data-slot="dropdown-menu-item-label"] {
		flex: 1;
	}

	[data-slot="dropdown-menu-item-description"] {
		font-size: var(--font-size-x-small);
		color: var(--text-weak);
	}

	[data-slot="dropdown-menu-separator"] {
		height: 1px;
		margin: 4px -4px;
		border-top-color: var(--border-weak-base);
	}

	[data-slot="dropdown-menu-group-label"] {
		padding: 4px 8px;
		font-family: var(--font-family-sans);
		font-size: var(--font-size-x-small);
		font-weight: var(--font-weight-medium);
		line-height: var(--line-height-large);
		letter-spacing: var(--letter-spacing-normal);
		color: var(--text-weak);
	}

	[data-slot="dropdown-menu-arrow"] {
		fill: var(--surface-raised-stronger-non-alpha);
	}
}

@keyframes dropdownMenuContentShow {
	from {
		opacity: 0;
		transform: scaleY(0.95);
	}
	to {
		opacity: 1;
		transform: scaleY(1);
	}
}

@keyframes dropdownMenuContentHide {
	from {
		opacity: 1;
		transform: scaleY(1);
	}
	to {
		opacity: 0;
		transform: scaleY(0.95);
	}
}