summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/button.css
blob: 794002888a111e05fd8834e5f4cf80454c993129 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
[data-component="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-style: solid;
  border-width: 1px;
  border-radius: var(--radius-md);
  text-decoration: none;
  user-select: none;
  cursor: default;
  outline: none;
  white-space: nowrap;

  &[data-variant="primary"] {
    background-color: var(--button-primary-base);
    border-color: var(--border-weak-base);
    color: var(--icon-invert-base);

    [data-slot="icon-svg"] {
      color: var(--icon-invert-base);
    }

    &:hover:not(:disabled) {
      background-color: var(--icon-strong-hover);
    }
    &:focus:not(:disabled) {
      background-color: var(--icon-strong-focus);
    }
    &:active:not(:disabled) {
      background-color: var(--icon-strong-active);
    }
    &:disabled {
      background-color: var(--icon-strong-disabled);

      [data-slot="icon-svg"] {
        color: var(--icon-invert-base);
      }
    }
  }

  &[data-variant="ghost"] {
    border-color: transparent;
    background-color: transparent;
    color: var(--text-strong);

    [data-slot="icon-svg"] {
      color: var(--icon-base);
    }

    &:hover:not(:disabled) {
      background-color: var(--surface-raised-base-hover);
    }
    &:focus-visible:not(:disabled) {
      background-color: var(--surface-raised-base-hover);
    }
    &:active:not(:disabled) {
      background-color: var(--surface-raised-base-active);
    }
    &:disabled {
      color: var(--text-weak);
      cursor: not-allowed;

      [data-slot="icon-svg"] {
        color: var(--icon-disabled);
      }
    }
    &[data-selected="true"]:not(:disabled) {
      background-color: var(--surface-raised-base-hover);
    }
    &[data-active="true"] {
      background-color: var(--surface-raised-base-active);
    }
  }

  &[data-variant="secondary"] {
    border: transparent;
    background-color: var(--button-secondary-base);
    color: var(--text-strong);
    box-shadow: var(--shadow-xs-border);

    &:hover:not(:disabled) {
      background-color: var(--button-secondary-hover);
    }
    &:focus:not(:disabled) {
      background-color: var(--button-secondary-base);
    }
    &:focus-visible:not(:active) {
      background-color: var(--button-secondary-base);
      box-shadow: var(--shadow-xs-border-focus);
    }
    &:focus-visible:active {
      box-shadow: none;
    }
    &:active:not(:disabled) {
      background-color: var(--button-secondary-base);
      scale: 0.99;
      transition: all 150ms ease-out;
    }
    &:disabled {
      border-color: var(--border-disabled);
      background-color: var(--surface-disabled);
      color: var(--text-weak);
      cursor: not-allowed;
    }

    [data-slot="icon-svg"] {
      color: var(--icon-strong-base);
    }
  }

  &[data-size="small"] {
    height: 24px;
    padding: 0 8px;
    &[data-icon] {
      padding: 0 12px 0 4px;
    }

    font-size: var(--font-size-small);
    line-height: var(--line-height-large);
    gap: 4px;

    /* text-12-medium */
    font-family: var(--font-family-sans);
    font-size: var(--font-size-small);
    font-style: normal;
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-large); /* 166.667% */
    letter-spacing: var(--letter-spacing-normal);
  }

  &[data-size="normal"] {
    height: 28px;
    line-height: 28px;
    padding: 0 6px;
    &[data-icon] {
      padding: 0 12px 0 4px;
    }

    font-size: var(--font-size-small);
    gap: 6px;

    /* text-12-medium */
    font-family: var(--font-family-sans);
    font-size: var(--font-size-small);
    font-style: normal;
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-normal);
  }

  &[data-size="large"] {
    height: 32px;
    padding: 6px 12px;

    &[data-icon] {
      padding: 0 12px 0 8px;
    }

    gap: 4px;

    /* text-14-medium */
    font-family: var(--font-family-sans);
    font-size: 14px;
    font-style: normal;
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-large); /* 142.857% */
    letter-spacing: var(--letter-spacing-normal);
  }

  &:focus {
    outline: none;
  }
}

[data-component="button"].titlebar-icon[data-variant="ghost"]:hover:not(:disabled) {
  background-color: var(--surface-raised-base-active);
}

[data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"] {
  background-color: var(--surface-base-active);
}

[data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"] [data-slot="icon-svg"] {
  color: var(--icon-strong-base);
}

[data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"]:hover:not(:disabled) {
  background-color: var(--surface-base-active);
}