@fluid-topics/ft-button 2.0.37 → 2.1.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.
@@ -1,485 +0,0 @@
1
- import { css, } from "lit";
2
- import { noTextSelect, setVariable, FtCssVariableFactory } from "@fluid-topics/ft-wc-utils";
3
- import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.styles";
4
- import { FtLoaderCssVariables } from "@fluid-topics/ft-loader/build/ft-loader.styles";
5
- import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.styles";
6
- import { button } from "@fluid-topics/design-system-variables";
7
- export const FtdsButtonCssVariables = {
8
- ...button,
9
- iconOnlyScale: FtCssVariableFactory.create("--ft-button-icon-only-scale", "", "NUMBER", "1"),
10
- };
11
- //language=css
12
- export const designSystemStyles = [
13
- css `
14
- :host {
15
- display: inline-block;
16
- max-width: 100%;
17
- pointer-events: none;
18
- }
19
-
20
- /** Remove default button styles **/
21
-
22
- .ft-button {
23
- box-shadow: 0 0 0 transparent;
24
- border: 0 solid transparent;
25
- text-shadow: 0 0 0 transparent;
26
- text-decoration: none;
27
- }
28
-
29
- .ft-button:hover {
30
- box-shadow: 0 0 0 transparent;
31
- text-shadow: 0 0 0 transparent;
32
- }
33
-
34
- .ft-button:active {
35
- outline: none;
36
- }
37
-
38
- .ft-button:focus {
39
- outline: 0;
40
- }
41
-
42
- /** Base styles **/
43
-
44
- .ft-button {
45
- position: relative;
46
- display: flex;
47
- justify-content: center;
48
- align-items: center;
49
- width: 100%;
50
- overflow: hidden;
51
- box-sizing: border-box;
52
- pointer-events: auto;
53
- }
54
-
55
- .ft-button:not([disabled]):hover {
56
- cursor: pointer;
57
- }
58
-
59
- .ft-button:focus {
60
- outline: none;
61
- }
62
-
63
- .ft-button:focus-visible {
64
- outline-color: ${button.focusFocusRingColor};
65
- outline-style: solid;
66
- }
67
-
68
- ft-icon {
69
- flex-shrink: 0;
70
- position: relative;
71
- }
72
-
73
- .ft-button:not(.ft-button--trailing-icon) ft-icon,
74
- .ft-button:not(.ft-button--trailing-icon) ft-loader {
75
- order: -1;
76
- }
77
-
78
- .ft-button--label {
79
- position: relative;
80
- overflow: hidden;
81
- white-space: nowrap;
82
- text-overflow: ellipsis;
83
- display: block;
84
- }
85
-
86
- .ft-button--label[hidden] {
87
- display: none;
88
- }
89
-
90
- .ft-button.ft-button--icon-only {
91
- padding: unset;
92
- border-radius: 50%;
93
- }
94
-
95
- .ft-button.ft-button--icon-only ft-icon {
96
- transform: scale(${FtdsButtonCssVariables.iconOnlyScale});
97
- }
98
-
99
- /** Brand Primary styles **/
100
-
101
- .ftds--family-brand.ft-button--primary {
102
- ${setVariable(FtLoaderCssVariables.color, button.primaryBrandIconColor)};
103
-
104
- ${setVariable(FtRippleCssVariables.color, button.primaryBrandStateLayerColor)};
105
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.primaryBrandHoverStateLayerOpacity)};
106
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.primaryBrandFocusStateLayerOpacity)};
107
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.primaryBrandActiveStateLayerOpacity)};
108
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.primaryBrandActiveStateLayerOpacity)};
109
-
110
- background-color: ${button.primaryBrandBackgroundColor};
111
- color: ${button.primaryBrandColor};
112
- border-style: none;
113
- }
114
-
115
- .ftds--family-brand.ft-button--primary[disabled] {
116
- opacity: ${button.primaryBrandDisabledComponentOpacity};
117
- }
118
-
119
- .ftds--family-brand.ft-button--primary ft-icon {
120
- color: ${button.primaryBrandIconColor};
121
- }
122
-
123
- /** Brand Secondary styles **/
124
-
125
- .ftds--family-brand.ft-button--secondary {
126
- ${setVariable(FtLoaderCssVariables.color, button.secondaryBrandIconColor)};
127
-
128
- ${setVariable(FtRippleCssVariables.color, button.secondaryBrandStateLayerColor)};
129
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryBrandHoverStateLayerOpacity)};
130
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryBrandFocusStateLayerOpacity)};
131
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryBrandActiveStateLayerOpacity)};
132
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryBrandActiveStateLayerOpacity)};
133
-
134
- background-color: ${button.secondaryBrandBackgroundColor};
135
- color: ${button.secondaryBrandColor};
136
- border-color: ${button.secondaryBrandBorderColor};
137
- border-style: solid;
138
- }
139
-
140
- .ftds--family-brand.ft-button--secondary[disabled] {
141
- opacity: ${button.secondaryBrandDisabledComponentOpacity};
142
- }
143
-
144
- .ftds--family-brand.ft-button--secondary ft-icon {
145
- color: ${button.secondaryBrandIconColor};
146
- }
147
-
148
- /** Brand Tertiary styles **/
149
-
150
- .ftds--family-brand.ft-button--tertiary {
151
- ${setVariable(FtLoaderCssVariables.color, button.tertiaryBrandIconColor)};
152
-
153
- ${setVariable(FtRippleCssVariables.color, button.tertiaryBrandStateLayerColor)};
154
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryBrandHoverStateLayerOpacity)};
155
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryBrandFocusStateLayerOpacity)};
156
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryBrandActiveStateLayerOpacity)};
157
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryBrandActiveStateLayerOpacity)};
158
-
159
- background-color: ${button.tertiaryBrandBackgroundColor};
160
- color: ${button.tertiaryBrandColor};
161
- border-style: none;
162
- }
163
-
164
- .ftds--family-brand.ft-button--tertiary[disabled] {
165
- opacity: ${button.tertiaryBrandDisabledComponentOpacity};
166
- }
167
-
168
- .ftds--family-brand.ft-button--tertiary ft-icon {
169
- color: ${button.tertiaryBrandIconColor};
170
- }
171
-
172
- /** Neutral Secondary styles **/
173
-
174
- .ftds--family-neutral.ft-button--secondary {
175
- ${setVariable(FtLoaderCssVariables.color, button.secondaryNeutralIconColor)};
176
-
177
- ${setVariable(FtRippleCssVariables.backgroundColor, button.secondaryNeutralStateLayerColor)};
178
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryNeutralHoverStateLayerOpacity)};
179
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryNeutralFocusStateLayerOpacity)};
180
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryNeutralActiveStateLayerOpacity)};
181
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryNeutralActiveStateLayerOpacity)};
182
-
183
- background-color: ${button.secondaryNeutralBackgroundColor};
184
- color: ${button.secondaryNeutralColor};
185
- border-color: ${button.secondaryNeutralBorderColor};
186
- border-style: solid;
187
- }
188
-
189
- .ftds--family-neutral.ft-button--secondary[disabled] {
190
- opacity: ${button.secondaryNeutralDisabledComponentOpacity};
191
- }
192
-
193
- .ftds--family-neutral.ft-button--secondary ft-icon {
194
- color: ${button.secondaryNeutralIconColor};
195
- }
196
-
197
- /** Neutral Tertiary styles **/
198
-
199
- .ftds--family-neutral.ft-button--tertiary {
200
- ${setVariable(FtLoaderCssVariables.color, button.tertiaryNeutralIconColor)};
201
-
202
- ${setVariable(FtRippleCssVariables.backgroundColor, button.tertiaryNeutralStateLayerColor)};
203
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryNeutralHoverStateLayerOpacity)};
204
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryNeutralFocusStateLayerOpacity)};
205
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryNeutralActiveStateLayerOpacity)};
206
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryNeutralActiveStateLayerOpacity)};
207
-
208
- background-color: ${button.tertiaryNeutralBackgroundColor};
209
- color: ${button.tertiaryNeutralColor};
210
- border-style: none;
211
- }
212
-
213
- .ftds--family-neutral.ft-button--tertiary[disabled] {
214
- opacity: ${button.tertiaryNeutralDisabledComponentOpacity};
215
- }
216
-
217
- .ftds--family-neutral.ft-button--tertiary ft-icon {
218
- color: ${button.tertiaryNeutralIconColor};
219
- }
220
-
221
- /** Info Secondary styles **/
222
-
223
- .ftds--family-info.ft-button--secondary {
224
- ${setVariable(FtLoaderCssVariables.color, button.secondaryInfoIconColor)};
225
-
226
- ${setVariable(FtRippleCssVariables.backgroundColor, button.secondaryInfoStateLayerColor)};
227
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryInfoHoverStateLayerOpacity)};
228
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryInfoFocusStateLayerOpacity)};
229
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryInfoActiveStateLayerOpacity)};
230
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryInfoActiveStateLayerOpacity)};
231
-
232
- background-color: ${button.secondaryInfoBackgroundColor};
233
- color: ${button.secondaryInfoColor};
234
- border-color: ${button.secondaryInfoBorderColor};
235
- border-style: solid;
236
- }
237
-
238
- .ftds--family-info.ft-button--secondary[disabled] {
239
- opacity: ${button.secondaryInfoDisabledComponentOpacity};
240
- }
241
-
242
- .ftds--family-info.ft-button--secondary ft-icon {
243
- color: ${button.secondaryInfoIconColor};
244
- }
245
-
246
- /** Info Tertiary styles **/
247
-
248
- .ftds--family-info.ft-button--tertiary {
249
- ${setVariable(FtLoaderCssVariables.color, button.tertiaryInfoIconColor)};
250
-
251
- ${setVariable(FtRippleCssVariables.backgroundColor, button.tertiaryInfoStateLayerColor)};
252
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryInfoHoverStateLayerOpacity)};
253
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryInfoFocusStateLayerOpacity)};
254
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryInfoActiveStateLayerOpacity)};
255
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryInfoActiveStateLayerOpacity)};
256
-
257
- background-color: ${button.tertiaryInfoBackgroundColor};
258
- color: ${button.tertiaryInfoColor};
259
- border-style: none;
260
- }
261
-
262
- .ftds--family-info.ft-button--tertiary[disabled] {
263
- opacity: ${button.tertiaryInfoDisabledComponentOpacity};
264
- }
265
-
266
- .ftds--family-info.ft-button--tertiary ft-icon {
267
- color: ${button.tertiaryInfoIconColor};
268
- }
269
-
270
- /** Success Secondary styles **/
271
-
272
- .ftds--family-success.ft-button--secondary {
273
- ${setVariable(FtLoaderCssVariables.color, button.secondarySuccessIconColor)};
274
-
275
- ${setVariable(FtRippleCssVariables.backgroundColor, button.secondarySuccessStateLayerColor)};
276
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondarySuccessHoverStateLayerOpacity)};
277
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondarySuccessFocusStateLayerOpacity)};
278
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondarySuccessActiveStateLayerOpacity)};
279
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondarySuccessActiveStateLayerOpacity)};
280
-
281
- background-color: ${button.secondarySuccessBackgroundColor};
282
- color: ${button.secondarySuccessColor};
283
- border-color: ${button.secondarySuccessBorderColor};
284
- border-style: solid;
285
- }
286
-
287
- .ftds--family-success.ft-button--secondary[disabled] {
288
- opacity: ${button.secondarySuccessDisabledComponentOpacity};
289
- }
290
-
291
- .ftds--family-success.ft-button--secondary ft-icon {
292
- color: ${button.secondarySuccessIconColor};
293
- }
294
-
295
- /** Success Tertiary styles **/
296
-
297
- .ftds--family-success.ft-button--tertiary {
298
- ${setVariable(FtLoaderCssVariables.color, button.tertiarySuccessIconColor)};
299
-
300
- ${setVariable(FtRippleCssVariables.backgroundColor, button.tertiarySuccessStateLayerColor)};
301
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiarySuccessHoverStateLayerOpacity)};
302
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiarySuccessFocusStateLayerOpacity)};
303
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiarySuccessActiveStateLayerOpacity)};
304
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiarySuccessActiveStateLayerOpacity)};
305
-
306
- background-color: ${button.tertiarySuccessBackgroundColor};
307
- color: ${button.tertiarySuccessColor};
308
- border-style: none;
309
- }
310
-
311
- .ftds--family-success.ft-button--tertiary[disabled] {
312
- opacity: ${button.tertiarySuccessDisabledComponentOpacity};
313
- }
314
-
315
- .ftds--family-success.ft-button--tertiary ft-icon {
316
- color: ${button.tertiarySuccessIconColor};
317
- }
318
-
319
- /** Warning Secondary styles **/
320
-
321
- .ftds--family-warning.ft-button--secondary {
322
- ${setVariable(FtLoaderCssVariables.color, button.secondaryWarningIconColor)};
323
-
324
- ${setVariable(FtRippleCssVariables.backgroundColor, button.secondaryWarningStateLayerColor)};
325
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryWarningHoverStateLayerOpacity)};
326
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryWarningFocusStateLayerOpacity)};
327
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryWarningActiveStateLayerOpacity)};
328
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryWarningActiveStateLayerOpacity)};
329
-
330
- background-color: ${button.secondaryWarningBackgroundColor};
331
- color: ${button.secondaryWarningColor};
332
- border-color: ${button.secondaryWarningBorderColor};
333
- border-style: solid;
334
- }
335
-
336
- .ftds--family-warning.ft-button--secondary[disabled] {
337
- opacity: ${button.secondaryWarningDisabledComponentOpacity};
338
- }
339
-
340
- .ftds--family-warning.ft-button--secondary ft-icon {
341
- color: ${button.secondaryWarningIconColor};
342
- }
343
-
344
- /** Warning Tertiary styles **/
345
-
346
- .ftds--family-warning.ft-button--tertiary {
347
- ${setVariable(FtLoaderCssVariables.color, button.tertiaryWarningIconColor)};
348
-
349
- ${setVariable(FtRippleCssVariables.backgroundColor, button.tertiaryWarningStateLayerColor)};
350
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryWarningHoverStateLayerOpacity)};
351
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryWarningFocusStateLayerOpacity)};
352
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryWarningActiveStateLayerOpacity)};
353
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryWarningActiveStateLayerOpacity)};
354
-
355
- background-color: ${button.tertiaryWarningBackgroundColor};
356
- color: ${button.tertiaryWarningColor};
357
- border-style: none;
358
- }
359
-
360
- .ftds--family-warning.ft-button--tertiary[disabled] {
361
- opacity: ${button.tertiaryWarningDisabledComponentOpacity};
362
- }
363
-
364
- .ftds--family-warning.ft-button--tertiary ft-icon {
365
- color: ${button.tertiaryWarningIconColor};
366
- }
367
-
368
- /** Error Secondary styles **/
369
-
370
- .ftds--family-error.ft-button--secondary {
371
- ${setVariable(FtLoaderCssVariables.color, button.secondaryErrorIconColor)};
372
-
373
- ${setVariable(FtRippleCssVariables.backgroundColor, button.secondaryErrorStateLayerColor)};
374
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryErrorHoverStateLayerOpacity)};
375
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryErrorFocusStateLayerOpacity)};
376
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryErrorActiveStateLayerOpacity)};
377
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryErrorActiveStateLayerOpacity)};
378
-
379
- background-color: ${button.secondaryErrorBackgroundColor};
380
- color: ${button.secondaryErrorColor};
381
- border-color: ${button.secondaryErrorBorderColor};
382
- border-style: solid;
383
- }
384
-
385
- .ftds--family-error.ft-button--secondary[disabled] {
386
- opacity: ${button.secondaryErrorDisabledComponentOpacity};
387
- }
388
-
389
- .ftds--family-error.ft-button--secondary ft-icon {
390
- color: ${button.secondaryErrorIconColor};
391
- }
392
-
393
- /** Error Tertiary styles **/
394
-
395
- .ftds--family-error.ft-button--tertiary {
396
- ${setVariable(FtLoaderCssVariables.color, button.tertiaryErrorIconColor)};
397
-
398
- ${setVariable(FtRippleCssVariables.backgroundColor, button.tertiaryErrorStateLayerColor)};
399
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryErrorHoverStateLayerOpacity)};
400
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryErrorFocusStateLayerOpacity)};
401
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryErrorActiveStateLayerOpacity)};
402
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryErrorActiveStateLayerOpacity)};
403
-
404
- background-color: ${button.tertiaryErrorBackgroundColor};
405
- color: ${button.tertiaryErrorColor};
406
- border-style: none;
407
- }
408
-
409
- .ftds--family-error.ft-button--tertiary[disabled] {
410
- opacity: ${button.tertiaryErrorDisabledComponentOpacity};
411
- }
412
-
413
- .ftds--family-error.ft-button--tertiary ft-icon {
414
- color: ${button.tertiaryErrorIconColor};
415
- }
416
-
417
- /** Large styles **/
418
-
419
- .ftds--size-large {
420
- ${setVariable(FtIconCssVariables.size, button.largeIconSize)};
421
- ${setVariable(FtLoaderCssVariables.size, button.largeIconSize)};
422
-
423
- height: ${button.largeHeight};
424
- padding: 0 ${button.largeHorizontalPadding};
425
- gap: ${button.largeGap};
426
- border-radius: ${button.largeBorderRadius};
427
- border-width: ${button.largeBorderWidth};
428
- }
429
-
430
- .ftds--size-large:focus-visible {
431
- outline-width: ${button.largeFocusOutlineWidth};
432
- outline-offset: ${button.largeFocusOutlineOffset};
433
- }
434
-
435
- .ftds--size-large.ft-button--icon-only {
436
- width: ${button.largeIconOnlyWidth};
437
- }
438
-
439
- /** Small styles **/
440
-
441
- .ftds--size-medium {
442
- ${setVariable(FtIconCssVariables.size, button.mediumIconSize)};
443
- ${setVariable(FtLoaderCssVariables.size, button.mediumIconSize)};
444
-
445
- height: ${button.mediumHeight};
446
- padding: 0 ${button.mediumHorizontalPadding};
447
- gap: ${button.mediumGap};
448
- border-radius: ${button.mediumBorderRadius};
449
- border-width: ${button.mediumBorderWidth};
450
- }
451
-
452
- .ftds--size-medium:focus-visible {
453
- outline-width: ${button.mediumFocusOutlineWidth};
454
- outline-offset: ${button.mediumFocusOutlineOffset};
455
- }
456
-
457
- .ftds--size-medium.ft-button--icon-only {
458
- width: ${button.mediumIconOnlyWidth};
459
- }
460
-
461
-
462
- /** Small styles **/
463
-
464
- .ftds--size-small {
465
- ${setVariable(FtIconCssVariables.size, button.smallIconSize)};
466
- ${setVariable(FtLoaderCssVariables.size, button.smallIconSize)};
467
-
468
- height: ${button.smallHeight};
469
- padding: 0 ${button.smallHorizontalPadding};
470
- gap: ${button.smallGap};
471
- border-radius: ${button.smallBorderRadius};
472
- border-width: ${button.smallBorderWidth};
473
- }
474
-
475
- .ftds--size-small:focus-visible {
476
- outline-width: ${button.smallFocusOutlineWidth};
477
- outline-offset: ${button.smallFocusOutlineOffset};
478
- }
479
-
480
- .ftds--size-small.ft-button--icon-only {
481
- width: ${button.smallIconOnlyWidth};
482
- }
483
- `,
484
- noTextSelect
485
- ];