summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/select.css
blob: c5ad67e33a2133bb4dd538fb5c37d36d42c35254 (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="select"] {
  [data-slot="select-select-trigger"] {
    padding: 6px 6px 6px 12px;
    box-shadow: none;
    border-radius: 6px;
    min-width: 160px;
    height: 32px;
    justify-content: flex-end;
    gap: 12px;
    background-color: transparent;

    [data-slot="select-select-trigger-value"] {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: var(--font-size-base);
      font-weight: var(--font-weight-regular);
    }
    [data-slot="select-select-trigger-icon"] {
      width: 16px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      color: var(--text-weak);
      background-color: var(--surface-raised-base);
      border-radius: 4px;
      transition: transform 0.1s ease-in-out;
    }

    &[data-slot="select-select-trigger"]:hover:not(:disabled),
    &[data-slot="select-select-trigger"][data-expanded],
    &[data-slot="select-select-trigger"][data-expanded]:hover:not(:disabled) {
      background-color: var(--input-base);
      box-shadow: var(--shadow-xs-border-base);
    }

    &:not([data-expanded]):focus {
      background-color: transparent;
      box-shadow: none;
    }
  }
}

[data-component="select-content"] {
  min-width: 160px;
  max-width: 23rem;
  overflow: hidden;
  border-radius: 8px;
  background-color: var(--surface-raised-stronger-non-alpha);
  padding: 0;
  box-shadow: var(--shadow-xs-border);
  z-index: 60;

  &[data-expanded] {
    animation: select-open 0.15s ease-out;
  }

  [data-slot="select-select-content-list"] {
    overflow-y: auto;
    max-height: 12rem;
    white-space: nowrap;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 4px;

    &:focus {
      outline: none;
    }

    > *:not([role="presentation"]) + *:not([role="presentation"]) {
      margin-top: 2px;
    }
  }

  [data-slot="select-select-item"] {
    position: relative;
    display: flex;
    align-items: center;
    padding: 2px 8px;
    gap: 12px;
    border-radius: 4px;
    cursor: default;

    /* text-14-regular */
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-style: normal;
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-large);
    letter-spacing: var(--letter-spacing-normal);

    color: var(--text-strong);

    transition:
      background-color 0.2s ease-in-out,
      color 0.2s ease-in-out;
    outline: none;
    user-select: none;

    &[data-highlighted] {
      background: var(--surface-raised-base-hover);
    }
    &[data-disabled] {
      background-color: var(--surface-raised-base);
      pointer-events: none;
    }
    [data-slot="select-select-item-indicator"] {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-left: auto;
      width: 16px;
      height: 16px;
    }
    &:focus {
      outline: none;
    }
    &:hover {
      background: var(--surface-raised-base-hover);
    }
  }
}

@keyframes select-open {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}