@bpmn-io/form-js-carbon-styles 1.3.2 → 1.4.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,1177 +1,1177 @@
1
- // todo(pinussilvestrus): consider moving away from styled-components,
2
- // cf. https://github.com/bpmn-io/form-js/issues/633
3
- import { css, createGlobalStyle } from 'styled-components';
4
- import { rem } from '@carbon/elements';
5
-
6
- function getSelectArrowSvg(color) {
7
- return `url('data:image/svg+xml;base64,${window.btoa(
8
- `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z"></path></svg>`,
9
- )}')`;
10
- }
11
-
12
- function getNumberInputMinusSvg(color) {
13
- return `url('data:image/svg+xml;base64,${window.btoa(
14
- `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><path d="M8 15H24V17H8z" /></svg>`,
15
- )}')`;
16
- }
17
-
18
- function getNumberInputPlusSvg(color) {
19
- return `url('data:image/svg+xml;base64,${window.btoa(
20
- `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><path d="M17 15L17 8 15 8 15 15 8 15 8 17 15 17 15 24 17 24 17 17 24 17 24 15z" /></svg>`,
21
- )}')`;
22
- }
23
-
24
- const getBaseInputStyles = ({ height }) => css`
25
- color: var(--cds-text-primary);
26
- border-radius: 0;
27
- border: none;
28
- border-bottom: 1px solid var(--cds-border-strong);
29
- height: ${height};
30
- font-size: var(--cds-body-short-01-font-size);
31
- font-weight: var(--cds-body-short-01-font-weight);
32
- line-height: var(--cds-body-short-01-line-height);
33
- letter-spacing: var(--cds-body-short-01-letter-spacing);
34
-
35
- &:focus {
36
- outline: 2px solid var(--cds-focus);
37
- outline-offset: -2px;
38
- }
39
-
40
- &::placeholder {
41
- color: var(--cds-text-placeholder);
42
- }
43
- `;
44
-
45
- const getSelectArrowStyles = ({ arrowRightPosition, color }) => css`
46
- color: var(--cds-text-primary);
47
- background-color: var(--cds-field);
48
- cursor: pointer;
49
- appearance: none;
50
- background-image: ${getSelectArrowSvg(color)};
51
- background-repeat: no-repeat;
52
- background-position: right ${arrowRightPosition} bottom 50%;
53
- `;
54
-
55
- const MARKDOWN_STYLES = css`
56
- .fjs-container .fjs-form-field.fjs-form-field-text .markup {
57
- & {
58
- font-size: var(--cds-body-long-01-font-size);
59
- font-weight: var(--cds-body-long-01-font-weight);
60
- line-height: var(--cds-body-long-01-line-height);
61
- letter-spacing: var(--cds-body-long-01-letter-spacing);
62
- }
63
-
64
- & h1 {
65
- font-size: var(--cds-productive-heading-06-font-size);
66
- font-weight: var(--cds-productive-heading-06-font-weight);
67
- line-height: var(--cds-productive-heading-06-line-height);
68
- letter-spacing: var(--cds-productive-heading-06-letter-spacing);
69
- }
70
-
71
- & h2 {
72
- font-size: var(--cds-productive-heading-05-font-size);
73
- font-weight: var(--cds-productive-heading-05-font-weight);
74
- line-height: var(--cds-productive-heading-05-line-height);
75
- letter-spacing: var(--cds-productive-heading-05-letter-spacing);
76
- }
77
-
78
- & h3 {
79
- font-size: var(--cds-productive-heading-04-font-size);
80
- font-weight: var(--cds-productive-heading-04-font-weight);
81
- line-height: var(--cds-productive-heading-04-line-height);
82
- letter-spacing: var(--cds-productive-heading-04-letter-spacing);
83
- }
84
- & h4 {
85
- font-size: var(--cds-productive-heading-03-font-size);
86
- font-weight: var(--cds-productive-heading-03-font-weight);
87
- line-height: var(--cds-productive-heading-03-line-height);
88
- letter-spacing: var(--cds-productive-heading-03-letter-spacing);
89
- }
90
- & h5 {
91
- font-size: var(--cds-productive-heading-02-font-size);
92
- font-weight: var(--cds-productive-heading-02-font-weight);
93
- line-height: var(--cds-productive-heading-02-line-height);
94
- letter-spacing: var(--cds-productive-heading-02-letter-spacing);
95
- }
96
- & h6 {
97
- font-size: var(--cds-productive-heading-01-font-size);
98
- font-weight: var(--cds-productive-heading-01-font-weight);
99
- line-height: var(--cds-productive-heading-01-line-height);
100
- letter-spacing: var(--cds-productive-heading-01-letter-spacing);
101
- }
102
-
103
- & code {
104
- font-family: var(--cds-code-02-font-family);
105
- font-size: var(--cds-code-02-font-size);
106
- font-weight: var(--cds-code-02-font-weight);
107
- line-height: var(--cds-code-02-line-height);
108
- letter-spacing: var(--cds-code-02-letter-spacing);
109
- white-space: pre-wrap;
110
- }
111
-
112
- & blockquote {
113
- font-family: var(--cds-quotation-02-font-family);
114
- font-size: var(--cds-quotation-02-font-size);
115
- font-weight: var(--cds-quotation-02-font-weight);
116
- line-height: var(--cds-quotation-02-line-height);
117
- letter-spacing: var(--cds-quotation-02-letter-spacing);
118
- }
119
-
120
- & ul,
121
- & ol {
122
- box-sizing: border-box;
123
- padding: 0;
124
- border: 0;
125
- margin: 0;
126
- list-style: none;
127
- }
128
-
129
- & ul {
130
- margin-left: var(--cds-spacing-05);
131
- }
132
-
133
- & ol {
134
- margin-left: var(--cds-spacing-05);
135
- }
136
-
137
- & ul li {
138
- position: relative;
139
-
140
- &:before {
141
- position: absolute;
142
- left: calc(-1 * var(--cds-spacing-05));
143
- content: '–';
144
- }
145
- }
146
-
147
- & ol li {
148
- position: relative;
149
- counter-increment: item;
150
-
151
- &:before {
152
- position: absolute;
153
- left: calc(-1 * var(--cds-spacing-05));
154
- content: counter(item) '.';
155
- }
156
- }
157
- }
158
- `;
159
-
160
- const ANCHOR_STYLES = css`
161
- .fjs-container .fjs-form-field-text a {
162
- color: var(--cds-link-primary);
163
- outline: none;
164
- text-decoration: underline;
165
- font-size: inherit;
166
- font-weight: inherit;
167
- line-height: var(--cds-body-compact-01-line-height);
168
- letter-spacing: var(--cds-body-compact-01-letter-spacing);
169
-
170
- &:hover {
171
- color: var(--cds-link-primary-hover);
172
- }
173
-
174
- &:focus {
175
- outline: 1px solid var(--cds-focus);
176
- }
177
-
178
- &:active,
179
- &:active:visited,
180
- &:active:visited:hover {
181
- color: var(--cds-text-primary);
182
- }
183
-
184
- &:visited {
185
- color: var(--cds-link-primary);
186
- }
187
-
188
- &:visited:hover {
189
- color: var(--cds-link-primary-hover);
190
- }
191
- }
192
- `;
193
-
194
- const READONLY_STYLES = css`
195
- ${({ theme }) => css`
196
- .fjs-container {
197
- .fjs-readonly {
198
- .fjs-input:read-only:not(:disabled),
199
- .fjs-textarea:read-only:not(:disabled),
200
- .fjs-select:read-only:not(:disabled),
201
- &.fjs-taglist,
202
- .fjs-input-group {
203
- background-color: transparent;
204
- }
205
-
206
- &.fjs-form-field {
207
- .fjs-input-group {
208
- border-bottom: 1px solid var(--cds-border-subtle);
209
- }
210
- }
211
-
212
- &.fjs-form-field-number {
213
- .fjs-input-group .fjs-number-arrow-container {
214
- background-color: transparent;
215
-
216
- .fjs-number-arrow-up,
217
- .fjs-number-arrow-down {
218
- background-color: transparent;
219
- pointer-events: none;
220
- }
221
- }
222
- }
223
-
224
- &.fjs-form-field:not(.fjs-form-field-datetime) {
225
- .fjs-input-group .fjs-input-adornment {
226
- background: transparent;
227
- }
228
- }
229
-
230
- &.fjs-form-field-select {
231
- .fjs-input-group {
232
- cursor: unset;
233
- background-image: ${getSelectArrowSvg(theme.iconDisabled)};
234
- background-color: transparent;
235
-
236
- .fjs-input:read-only:not(:disabled) {
237
- border-color: transparent;
238
- }
239
-
240
- .fjs-select-display {
241
- color: var(--cds-text-primary);
242
- }
243
- }
244
- }
245
-
246
- &.fjs-form-field-datetime {
247
- .fjs-input-group {
248
- cursor: unset;
249
-
250
- .fjs-input-adornment {
251
- background-color: transparent;
252
- }
253
-
254
- .flatpickr-input {
255
- cursor: unset;
256
- }
257
-
258
- .fjs-input-adornment svg {
259
- cursor: unset;
260
- }
261
- }
262
- }
263
-
264
- &.fjs-form-field-checkbox,
265
- &.fjs-form-field-radio,
266
- &.fjs-form-field-checklist {
267
- .fjs-input:read-only {
268
- opacity: 1;
269
- background-color: transparent;
270
-
271
- &:before {
272
- border-color: var(--cds-icon-disabled);
273
- }
274
- }
275
-
276
- &.fjs-checked .fjs-input[type='checkbox'],
277
- .fjs-form-field-label.fjs-checked .fjs-input[type='checkbox'] {
278
- &:before {
279
- border: 1px solid var(--cds-icon-disabled);
280
- background: transparent;
281
- }
282
-
283
- &:after {
284
- border-bottom: 2px solid var(--cds-icon-primary);
285
- border-left: 2px solid var(--cds-icon-primary);
286
- }
287
- }
288
- }
289
-
290
- &.fjs-taglist .fjs-taglist-tag {
291
- .fjs-taglist-tag-label {
292
- padding: 2px 0px;
293
- }
294
- }
295
- }
296
- }
297
- `}
298
- `;
299
-
300
- const DISABLED_STYLES = css`
301
- .fjs-container {
302
- .fjs-disabled {
303
- &.fjs-form-field-textfield .fjs-input,
304
- &.fjs-form-field-datetime .fjs-input,
305
- & .fjs-textarea:disabled,
306
- & .fjs-taglist.fjs-disabled,
307
- & .fjs-taglist.fjs-disabled .fjs-taglist-input,
308
- &.fjs-form-field-select .fjs-input-group.disabled,
309
- &.fjs-form-field-select .fjs-input-group.disabled .fjs-select-display,
310
- &.fjs-form-field-select .fjs-input-group.disabled .fjs-input,
311
- &.fjs-form-field .fjs-form-field-label,
312
- &.fjs-form-field.fjs-form-field-radio .fjs-form-field-label,
313
- &.fjs-form-field.fjs-form-field-checklist .fjs-form-field-label,
314
- & .fjs-form-field-description {
315
- /* todo(pinussilvestrus): mitigate https://github.com/carbon-design-system/carbon/issues/13286 */
316
- color: var(--cds-text-disabled);
317
- cursor: var(--cursor-disabled, not-allowed);
318
- }
319
-
320
- &.fjs-form-field-textfield .fjs-input-group,
321
- &.fjs-form-field-datetime .fjs-input-group,
322
- & .fjs-textarea:disabled,
323
- & .fjs-taglist.fjs-disabled,
324
- & .fjs-taglist.fjs-disabled .fjs-taglist-input,
325
- &.fjs-form-field-select .fjs-input-group.disabled,
326
- &.fjs-form-field-select .fjs-input-group.disabled .fjs-select-display,
327
- &.fjs-form-field-select .fjs-input-group.disabled .fjs-input {
328
- border: none;
329
- }
330
- }
331
-
332
- .fjs-disabled.fjs-form-field-number .fjs-input-group {
333
- border: none;
334
- cursor: var(--cursor-disabled, not-allowed);
335
- }
336
-
337
- .fjs-disabled.fjs-form-field-number .fjs-input-group .fjs-input {
338
- cursor: var(--cursor-disabled, not-allowed);
339
- }
340
-
341
- .fjs-form-field.fjs-disabled.fjs-checked .fjs-input[type='checkbox'] {
342
- cursor: var(--cursor-disabled, not-allowed);
343
- &:before {
344
- border-color: var(--cds-icon-disabled);
345
- background-color: var(--cds-icon-disabled);
346
- cursor: var(--cursor-disabled, not-allowed);
347
- }
348
-
349
- &:after {
350
- cursor: var(--cursor-disabled, not-allowed);
351
- }
352
- }
353
-
354
- .fjs-form-field.fjs-disabled .fjs-input[type='checkbox'] {
355
- cursor: var(--cursor-disabled, not-allowed);
356
- &:before {
357
- border-color: var(--cds-icon-disabled);
358
- cursor: var(--cursor-disabled, not-allowed);
359
- }
360
- }
361
-
362
- .fjs-form-field-datetime.fjs-disabled
363
- .fjs-input-group
364
- .fjs-input-adornment
365
- svg {
366
- color: var(--cds-icon-disabled);
367
- cursor: var(--cursor-disabled, not-allowed);
368
- }
369
-
370
- .fjs-taglist.fjs-disabled .fjs-taglist-tag {
371
- background-color: var(--cds-layer-01);
372
-
373
- .fjs-taglist-tag-label {
374
- padding: 2px 0px;
375
- opacity: 0.7;
376
- color: var(--cds-text-on-color-disabled);
377
- }
378
- }
379
- }
380
- `;
381
-
382
- const LABEL_DESCRIPTION_ERROR_STYLES = css`
383
- .fjs-container {
384
- .fjs-form-field-label {
385
- font-size: var(--cds-label-01-font-size);
386
- font-weight: var(--cds-label-01-font-weight);
387
- line-height: var(--cds-label-01-line-height);
388
- letter-spacing: var(--cds-label-01-letter-spacing);
389
- }
390
-
391
- .fjs-form-field:not(.fjs-form-field-checkbox, .fjs-form-field-group)
392
- .fjs-form-field-label:first-child {
393
- margin: 0;
394
- margin-bottom: var(--cds-spacing-03);
395
- }
396
-
397
- .fjs-form-field.fjs-form-field-radio
398
- .fjs-form-field-label:not(:first-of-type),
399
- .fjs-form-field.fjs-form-field-checklist
400
- .fjs-form-field-label:not(:first-of-type) {
401
- margin: 0;
402
- margin-bottom: 0.1875rem;
403
- }
404
-
405
- .fjs-form-field.fjs-form-field-radio
406
- .fjs-form-field-label:not(:first-of-type) {
407
- min-height: ${rem(27)};
408
- }
409
-
410
- .fjs-form-field-description {
411
- margin: 0;
412
- margin-top: var(--cds-spacing-02);
413
- font-size: var(--cds-helper-text-01-font-size);
414
- font-weight: var(--cds-helper-text-01-font-weight);
415
- line-height: var(--cds-helper-text-01-line-height);
416
- letter-spacing: var(--cds-helper-text-01-letter-spacing);
417
- }
418
-
419
- .fjs-form-field-error {
420
- margin: 0;
421
- margin-top: var(--cds-spacing-02);
422
- font-size: var(--cds-label-01-font-size);
423
- font-weight: var(--cds-label-01-font-weight);
424
- line-height: var(--cds-label-01-line-height);
425
- letter-spacing: var(--cds-label-01-letter-spacing);
426
- }
427
-
428
- .fjs-has-errors .fjs-form-field-description {
429
- display: none;
430
- }
431
- }
432
- `;
433
-
434
- const CHECKBOX_STYLES = css`
435
- .fjs-container {
436
- .fjs-input[type='checkbox'],
437
- .fjs-input[type='checkbox']:focus {
438
- all: unset;
439
- width: ${rem(6)};
440
- }
441
-
442
- .fjs-form-field .fjs-input[type='checkbox'] {
443
- position: relative;
444
- display: flex;
445
- min-height: ${rem(24)};
446
- padding-top: ${rem(3)};
447
- padding-left: ${rem(20)};
448
- cursor: pointer;
449
- user-select: none;
450
- font-size: var(--cds-body-short-01-font-size);
451
- font-weight: var(--cds-body-short-01-font-weight);
452
- line-height: var(--cds-body-short-01-line-height);
453
- letter-spacing: var(--cds-body-short-01-letter-spacing);
454
-
455
- &:before,
456
- &:after {
457
- box-sizing: border-box;
458
- }
459
-
460
- &:before {
461
- position: absolute;
462
- top: ${rem(3)};
463
- left: 0;
464
- width: ${rem(16)};
465
- height: ${rem(16)};
466
- border: 1px solid var(--cds-icon-primary);
467
- margin: ${rem(2)} ${rem(2)} ${rem(2)} ${rem(3)};
468
- background-color: transparent;
469
- border-radius: 1px;
470
- content: '';
471
- }
472
-
473
- &:after {
474
- position: absolute;
475
- top: ${rem(9)};
476
- left: ${rem(7)};
477
- width: ${rem(9)};
478
- height: ${rem(5)};
479
- border-bottom: 2px solid var(--cds-icon-inverse);
480
- border-left: 2px solid var(--cds-icon-inverse);
481
- margin-top: ${rem(-3)};
482
- background: 0 0;
483
- content: '';
484
- transform: scale(0) rotate(-45deg);
485
- transform-origin: bottom right;
486
- }
487
- }
488
-
489
- .fjs-form-field .fjs-input[type='checkbox']:focus {
490
- &:before {
491
- outline: 2px solid var(--cds-focus);
492
- outline-offset: 1px;
493
- }
494
- }
495
-
496
- .fjs-form-field.fjs-checked .fjs-input[type='checkbox'],
497
- .fjs-form-field
498
- .fjs-form-field-label.fjs-checked
499
- .fjs-input[type='checkbox'] {
500
- &:before {
501
- border: none;
502
- border-width: 1px;
503
- background-color: var(--cds-icon-primary);
504
- }
505
-
506
- &:after {
507
- transform: scale(1) rotate(-45deg);
508
- }
509
- }
510
-
511
- .fjs-form-field-checklist .fjs-form-field-label:not(:first-of-type) {
512
- font-size: var(--cds-body-short-01-font-size);
513
- font-weight: var(--cds-body-short-01-font-weight);
514
- line-height: var(--cds-body-short-01-line-height);
515
- letter-spacing: var(--cds-body-short-01-letter-spacing);
516
- color: var(--cds-text-primary);
517
- }
518
-
519
- .fjs-form-field-checkbox .fjs-form-field-label {
520
- font-size: var(--cds-body-short-01-font-size);
521
- font-weight: var(--cds-body-short-01-font-weight);
522
- line-height: var(--cds-body-short-01-line-height);
523
- letter-spacing: var(--cds-body-short-01-letter-spacing);
524
- color: var(--cds-text-primary);
525
- }
526
- }
527
- `;
528
-
529
- const TAGLIST_STYLES = css`
530
- .fjs-container {
531
- .fjs-taglist {
532
- display: flex;
533
- align-items: center;
534
- min-height: 2.5rem;
535
- height: unset !important;
536
- }
537
-
538
- .fjs-taglist:focus-within {
539
- outline: 2px solid var(--cds-focus);
540
- outline-offset: -2px;
541
- }
542
-
543
- .fjs-taglist .fjs-taglist-input {
544
- &,
545
- &::placeholder {
546
- color: var(--cds-text-primary);
547
- }
548
- }
549
-
550
- .fjs-taglist .fjs-taglist-tag {
551
- font-size: var(--cds-label-01-font-size);
552
- font-weight: var(--cds-label-01-font-weight);
553
- line-height: var(--cds-label-01-line-height);
554
- letter-spacing: var(--cds-label-01-letter-spacing);
555
- max-width: 100%;
556
- padding: 0 0.5rem;
557
- border-radius: 0.9375rem;
558
- word-break: break-word;
559
- min-width: auto;
560
- display: inline-flex;
561
- align-items: center;
562
- justify-content: center;
563
-
564
- & .fjs-taglist-tag-label {
565
- padding: 0;
566
- max-width: 100%;
567
- text-overflow: ellipsis;
568
- white-space: nowrap;
569
- }
570
-
571
- & .fjs-taglist-tag-remove {
572
- all: unset;
573
- width: 1.5rem;
574
- height: 1.5rem;
575
- border-radius: 50%;
576
- display: flex;
577
- flex-shrink: 0;
578
- align-items: center;
579
- justify-content: center;
580
- padding: 0;
581
- border: 0;
582
- margin: 0 ${rem(-8)} 0 0.125rem;
583
- cursor: pointer;
584
- }
585
-
586
- & .fjs-taglist-tag-remove svg {
587
- all: unset;
588
- color: var(--cds-icon-inverse);
589
- }
590
-
591
- & .fjs-taglist-tag-remove:focus {
592
- background-color: transparent;
593
- outline: 1px solid var(--cds-focus-inverse);
594
- }
595
- }
596
- }
597
- `;
598
-
599
- const RADIO_STYLES = css`
600
- .fjs-container .fjs-form-field-radio {
601
- .fjs-input {
602
- appearance: none;
603
- width: 0;
604
- margin: 0;
605
- margin-right: calc(${rem(18)} + var(--cds-spacing-03));
606
- position: relative;
607
- height: ${rem(18)};
608
- outline: none;
609
-
610
- &:focus:before {
611
- outline: 2px solid var(--cds-focus);
612
- outline-offset: 1.5px;
613
- }
614
-
615
- &:before {
616
- position: absolute;
617
- top: 0;
618
- left: 0;
619
- width: ${rem(18)};
620
- height: ${rem(18)};
621
- border: 1px solid var(--cds-icon-primary);
622
- background-color: transparent;
623
- border-radius: 50%;
624
- content: '';
625
- }
626
- }
627
-
628
- .fjs-checked .fjs-input:after {
629
- position: relative;
630
- top: 0;
631
- left: 0;
632
- display: inline-block;
633
- width: ${rem(18)};
634
- height: ${rem(18)};
635
- background-color: var(--cds-icon-primary);
636
- border-radius: 50%;
637
- content: '';
638
- transform: scale(0.5);
639
- }
640
-
641
- &.fjs-disabled .fjs-input:before {
642
- border-color: var(--cds-icon-disabled);
643
- }
644
-
645
- &.fjs-disabled .fjs-checked .fjs-input:after {
646
- background-color: var(--cds-icon-disabled);
647
- }
648
-
649
- .fjs-form-field-label:not(:first-of-type) {
650
- font-size: var(--cds-body-short-01-font-size);
651
- font-weight: var(--cds-body-short-01-font-weight);
652
- line-height: var(--cds-body-short-01-line-height);
653
- letter-spacing: var(--cds-body-short-01-letter-spacing);
654
- color: var(--cds-text-primary);
655
- }
656
- }
657
- `;
658
-
659
- const BUTTON_STYLES = css`
660
- .fjs-container {
661
- .fjs-form-field.fjs-form-field-button .fjs-button {
662
- font-size: var(--cds-body-short-01-font-size);
663
- font-weight: var(--cds-body-short-01-font-weight);
664
- line-height: var(--cds-body-short-01-line-height);
665
- letter-spacing: var(--cds-body-short-01-letter-spacing);
666
- min-height: ${rem(32)};
667
- padding: calc(0.375rem - 3px) 60px calc(0.375rem - 3px) 12px;
668
- text-align: left;
669
- color: var(--cds-button-tertiary);
670
- border: 1px solid var(--cds-button-tertiary);
671
- border-radius: 0;
672
- background-color: transparent;
673
- cursor: pointer;
674
- }
675
-
676
- .fjs-form-field.fjs-form-field-button .fjs-button:hover {
677
- color: var(--cds-text-inverse);
678
- background-color: var(--cds-button-tertiary-hover);
679
- }
680
-
681
- .fjs-form-field.fjs-form-field-button .fjs-button:focus {
682
- border-color: var(--cds-focus);
683
- box-shadow: inset 0 0 0 1px var(--cds-focus),
684
- inset 0 0 0 2px var(--cds-background);
685
- color: var(--cds-text-inverse);
686
- background-color: var(--cds-button-tertiary);
687
- }
688
-
689
- .fjs-form-field.fjs-form-field-button .fjs-button:active {
690
- border-color: transparent;
691
- background-color: var(--cds-button-tertiary-active);
692
- color: var(--cds-text-inverse);
693
- }
694
-
695
- .fjs-form-field.fjs-form-field-button .fjs-button:disabled {
696
- border: 1px solid var(--cds-button-disabled);
697
- background: transparent;
698
- box-shadow: none;
699
- color: var(--cds-text-on-color-disabled);
700
- cursor: var(--cursor-disabled, not-allowed);
701
- outline: none;
702
- }
703
-
704
- .fjs-form-field.fjs-form-field-button .fjs-button[type='submit'] {
705
- background-color: var(--cds-button-primary);
706
- border: 1px solid transparent;
707
- color: var(--cds-text-on-color);
708
- }
709
-
710
- .fjs-form-field.fjs-form-field-button .fjs-button[type='submit']:disabled {
711
- background: var(--cds-button-disabled);
712
- }
713
- }
714
- `;
715
-
716
- const NUMBER_INPUTS = css`
717
- ${({ theme }) => css`
718
- .fjs-container .fjs-form-field-number .fjs-input-group {
719
- border-radius: 0;
720
- border: none;
721
- border-bottom: 1px solid var(--cds-border-strong);
722
- height: 2.5rem;
723
- box-sizing: border-box;
724
-
725
- &:focus-within {
726
- outline: 2px solid var(--cds-focus);
727
- outline-offset: -2px;
728
- }
729
-
730
- & .fjs-input {
731
- border-radius: 0;
732
- border: none;
733
- font-size: var(--cds-body-short-01-font-size);
734
- font-weight: var(--cds-body-short-01-font-weight);
735
- line-height: var(--cds-body-short-01-line-height);
736
- letter-spacing: var(--cds-body-short-01-letter-spacing);
737
- }
738
-
739
- & .fjs-number-arrow-container {
740
- all: unset;
741
- border: none;
742
- border-radius: 0;
743
- display: flex;
744
- flex-direction: row-reverse;
745
- align-items: center;
746
- background-color: var(--cds-field);
747
- }
748
-
749
- & .fjs-number-arrow-container .fjs-number-arrow-up,
750
- & .fjs-number-arrow-container .fjs-number-arrow-down {
751
- width: 40px;
752
- height: calc(40px - 1px);
753
- background-color: var(--cds-field);
754
- color: transparent;
755
-
756
- &:hover {
757
- background-color: var(--cds-field-hover);
758
- cursor: pointer;
759
- }
760
- }
761
-
762
- &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-up:hover,
763
- &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-down:hover {
764
- background-color: var(--cds-field);
765
- cursor: not-allowed;
766
- }
767
-
768
- & .fjs-number-arrow-container .fjs-number-arrow-separator {
769
- width: 0.0625rem;
770
- height: 1rem;
771
- background-color: var(--cds-border-subtle);
772
- }
773
-
774
- & .fjs-number-arrow-container .fjs-number-arrow-down {
775
- background-image: ${getNumberInputMinusSvg(theme.iconPrimary)};
776
- background-repeat: no-repeat;
777
- background-position: right 50% bottom 50%;
778
- }
779
-
780
- & .fjs-number-arrow-container .fjs-number-arrow-up {
781
- background-image: ${getNumberInputPlusSvg(theme.iconPrimary)};
782
- background-repeat: no-repeat;
783
- background-position: right 50% bottom 50%;
784
- }
785
-
786
- &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-up {
787
- background-image: ${getNumberInputPlusSvg(theme.iconDisabled)};
788
- }
789
-
790
- &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-down {
791
- background-image: ${getNumberInputMinusSvg(theme.iconDisabled)};
792
- }
793
- }
794
- `}
795
- `;
796
-
797
- const DATETIME_INPUTS = css`
798
- ${({ theme }) => css`
799
- .fjs-container {
800
- .fjs-form-field-datetime {
801
- .fjs-input.flatpickr-input {
802
- width: 100%;
803
- height: 100%;
804
- border: none;
805
- border-radius: 0;
806
-
807
- &,
808
- &::placeholder {
809
- color: var(--cds-text-primary);
810
- }
811
- }
812
-
813
- .fjs-input.flatpickr-input:disabled {
814
- color: var(--cds-text-disabled);
815
- }
816
-
817
- .fjs-input.flatpickr-input:disabled::placeholder {
818
- color: var(--cds-text-disabled);
819
- }
820
-
821
- .fjs-input.flatpickr-input:disabled::placeholder {
822
- color: var(--cds-text-disabled);
823
- }
824
-
825
- select {
826
- ${getBaseInputStyles({ height: '1.5rem' })};
827
- ${getSelectArrowStyles({
828
- arrowRightPosition: 'var(--cds-spacing-03)',
829
- color: theme.iconPrimary,
830
- })};
831
- border-bottom: none;
832
- padding-right: 2rem;
833
- }
834
-
835
- .fjs-input-group {
836
- display: flex;
837
- flex-direction: row-reverse;
838
- position: relative;
839
- }
840
-
841
- .fjs-input-group .fjs-input-adornment {
842
- border: none;
843
- border-radius: 0;
844
- background-color: var(--cds-field);
845
- display: flex;
846
- padding-right: var(--cds-spacing-05);
847
- }
848
-
849
- .fjs-input-group .fjs-input-adornment svg {
850
- color: var(--cds-icon-primary);
851
- cursor: pointer;
852
- }
853
-
854
- .flatpickr-wrapper {
855
- height: 100%;
856
- position: initial;
857
- }
858
-
859
- .fjs-timepicker.fjs-timepicker-anchor {
860
- position: unset;
861
- }
862
-
863
- .flatpickr-calendar.static {
864
- top: calc(100% + 3px);
865
- }
866
-
867
- .flatpickr-calendar .flatpickr-prev-month svg,
868
- .flatpickr-calendar .flatpickr-next-month svg {
869
- height: 16px;
870
- }
871
-
872
- .flatpickr-day.today {
873
- position: relative;
874
- color: var(--cds-link-primary);
875
- font-weight: 600;
876
- border-color: transparent;
877
- }
878
-
879
- .flatpickr-day.selected,
880
- .flatpickr-day.today.selected,
881
- .flatpickr-day.selected:hover,
882
- .flatpickr-day.today.selected:hover {
883
- background-color: var(--cds-button-primary);
884
- color: var(--cds-text-on-color);
885
- }
886
-
887
- .flatpickr-day:focus {
888
- outline: 2px solid var(--cds-focus);
889
- outline-offset: -2px;
890
- }
891
-
892
- .flatpickr-day.selected:focus {
893
- outline: 0.0625rem solid var(--cds-focus);
894
- outline-offset: -0.1875rem;
895
- }
896
-
897
- .flatpickr-day:hover {
898
- background: var(--cds-layer-hover);
899
- }
900
-
901
- .flatpickr-days,
902
- .flatpickr-weekdays {
903
- padding: unset;
904
- width: unset;
905
- }
906
- }
907
- }
908
- `}
909
- `;
910
-
911
- const SELECT_STYLES = css`
912
- ${({ theme }) => css`
913
- .fjs-container {
914
- .fjs-form-field-select .fjs-input-group {
915
- ${getBaseInputStyles({ height: '2.5rem' })}
916
- ${getSelectArrowStyles({
917
- arrowRightPosition: 'var(--cds-spacing-05)',
918
- color: theme.iconPrimary,
919
- })}
920
-
921
- .fjs-select-display {
922
- display: flex;
923
- align-items: center;
924
- }
925
-
926
- .fjs-select-arrow {
927
- color: transparent;
928
- }
929
-
930
- .fjs-select-cross {
931
- display: flex;
932
- align-items: center;
933
- justify-content: center;
934
- margin-right: var(--cds-spacing-04);
935
- width: 2.5rem;
936
- height: calc(2.5rem - 1px);
937
-
938
- &:hover {
939
- background-color: var(--cds-layer-hover);
940
- }
941
-
942
- svg {
943
- color: var(--cds-icon-primary);
944
- }
945
- }
946
-
947
- .fjs-input {
948
- color: var(--cds-text-primary);
949
- background-color: var(--cds-field);
950
- border-radius: 0;
951
- border: none;
952
- border-bottom: 1px solid var(--cds-border-strong);
953
- height: 2.5rem;
954
- font-size: var(--cds-body-short-01-font-size);
955
- font-weight: var(--cds-body-short-01-font-weight);
956
- line-height: var(--cds-body-short-01-line-height);
957
- letter-spacing: var(--cds-body-short-01-letter-spacing);
958
- }
959
- }
960
-
961
- .fjs-form-field-select .fjs-select-anchor .fjs-dropdownlist {
962
- position: absolute;
963
- top: -4px;
964
- }
965
-
966
- .fjs-form-field-select .fjs-input-group:focus-within {
967
- outline: 2px solid var(--cds-focus);
968
- outline-offset: -2px;
969
- }
970
-
971
- .fjs-form-field-select.fjs-disabled .fjs-input-group {
972
- ${getSelectArrowStyles({
973
- arrowRightPosition: 'var(--cds-spacing-05)',
974
- color: theme.iconDisabled,
975
- })}
976
- }
977
-
978
- .fjs-has-errors.fjs-form-field-select .fjs-input-group:focus-within {
979
- outline: 2px solid var(--cds-focus);
980
- outline-offset: -2px;
981
- }
982
-
983
- .fjs-has-errors.fjs-form-field-select .fjs-input-group {
984
- outline: 2px solid var(--cds-text-error);
985
- outline-offset: -2px;
986
- }
987
- }
988
- `}
989
- `;
990
-
991
- const REMAINING_INPUTS = css`
992
- .fjs-container {
993
- .fjs-form-field-textfield .fjs-input-group,
994
- .fjs-form-field-datetime .fjs-input-group,
995
- .fjs-textarea,
996
- .fjs-taglist,
997
- .fjs-form-field-select.fjs-disabled .fjs-input-group {
998
- ${getBaseInputStyles({ height: '2.5rem' })}
999
- }
1000
-
1001
- .fjs-form-field-textfield .fjs-input-group,
1002
- .fjs-form-field-datetime .fjs-input-group {
1003
- &:focus-within {
1004
- outline: 2px solid var(--cds-focus);
1005
- outline-offset: -2px;
1006
- }
1007
- }
1008
- .fjs-form-field-textfield .fjs-input,
1009
- .fjs-form-field-datetime .fjs-input {
1010
- background-color: var(--cds-field);
1011
- color: var(--cds-text-primary);
1012
- border-radius: 0;
1013
- }
1014
-
1015
- .fjs-has-errors.fjs-form-field-number .fjs-input-group:focus-within,
1016
- .fjs-has-errors.fjs-form-field-textarea .fjs-textarea:focus,
1017
- .fjs-form-field-textfield.fjs-has-errors .fjs-input-group:focus-within,
1018
- .fjs-form-field-textfield.fjs-has-errors .fjs-input-group:focus,
1019
- .fjs-form-field-datetime.fjs-has-errors .fjs-input-group:focus-within,
1020
- .fjs-form-field-datetime.fjs-has-errors .fjs-input-group:focus {
1021
- outline: 2px solid var(--cds-focus);
1022
- outline-offset: -2px;
1023
- }
1024
-
1025
- .fjs-has-errors.fjs-form-field-number .fjs-input-group,
1026
- .fjs-has-errors.fjs-form-field-textarea .fjs-textarea,
1027
- .fjs-form-field-textfield.fjs-has-errors .fjs-input-group,
1028
- .fjs-form-field-textfield.fjs-has-errors .fjs-input-group,
1029
- .fjs-form-field-datetime.fjs-has-errors .fjs-input-group,
1030
- .fjs-form-field-datetime.fjs-has-errors .fjs-input-group {
1031
- outline: 2px solid var(--cds-text-error);
1032
- outline-offset: -2px;
1033
- }
1034
- }
1035
- `;
1036
-
1037
- const DROPDOWN_STYLES = css`
1038
- .fjs-container {
1039
- .fjs-form-field-taglist .fjs-taglist-anchor .fjs-dropdownlist,
1040
- .fjs-form-field-datetime .fjs-timepicker-anchor .fjs-dropdownlist,
1041
- .fjs-form-field-select .fjs-select-anchor .fjs-dropdownlist {
1042
- margin: 0;
1043
- max-height: ${rem(264)};
1044
- border: none;
1045
- background-color: var(--cds-layer);
1046
- overflow-y: auto;
1047
- cursor: pointer;
1048
- border-radius: 0;
1049
- box-shadow: 0 2px 6px var(--cds-shadow);
1050
-
1051
- & .fjs-dropdownlist-item {
1052
- border: none;
1053
- box-sizing: border-box;
1054
- padding: 0;
1055
- margin: 0 var(--cds-spacing-05);
1056
- }
1057
-
1058
- & .fjs-dropdownlist-item:not(:first-of-type):not(:hover) {
1059
- border-top: 1px solid var(--cds-border-subtle);
1060
- }
1061
-
1062
- & .fjs-dropdownlist-item,
1063
- & .fjs-dropdownlist-empty {
1064
- font-size: var(--cds-body-short-01-font-size);
1065
- font-weight: var(--cds-body-short-01-font-weight);
1066
- line-height: var(--cds-body-short-01-line-height);
1067
- letter-spacing: var(--cds-body-short-01-letter-spacing);
1068
- height: ${rem(40)};
1069
- color: var(--cds-text-secondary);
1070
- cursor: pointer;
1071
- user-select: none;
1072
- display: flex;
1073
- align-items: center;
1074
- background-color: transparent;
1075
- }
1076
-
1077
- & .fjs-dropdownlist-empty {
1078
- color: var(--cds-text-disabled);
1079
- cursor: default;
1080
- }
1081
-
1082
- & .fjs-dropdownlist-item:hover,
1083
- & .fjs-dropdownlist-item.focused {
1084
- background-color: var(--cds-layer-hover);
1085
- color: var(--cds-text-primary);
1086
- margin: 0;
1087
- padding: 0 var(--cds-spacing-05);
1088
- }
1089
-
1090
- & .fjs-dropdownlist-item:not(:first-of-type):hover {
1091
- padding-top: 1px;
1092
- }
1093
-
1094
- & .fjs-dropdownlist-item.focused + .fjs-dropdownlist-item {
1095
- border: none;
1096
- padding-top: 1px;
1097
- }
1098
- }
1099
- }
1100
- `;
1101
-
1102
- const ADORNMENTS_STYLES = css`
1103
- .fjs-container .fjs-form-field:not(.fjs-form-field-datetime) {
1104
- .fjs-input-group .fjs-input-adornment {
1105
- all: unset;
1106
- display: flex;
1107
- align-items: center;
1108
- background-color: var(--cds-field);
1109
- color: var(--cds-text-secondary);
1110
- padding: 0 var(--cds-spacing-04);
1111
- cursor: default;
1112
-
1113
- &.border-right {
1114
- padding-right: 0;
1115
- }
1116
-
1117
- &.border-left {
1118
- padding-left: 0;
1119
- }
1120
- }
1121
-
1122
- &.fjs-disabled .fjs-input-group .fjs-input-adornment {
1123
- color: var(--cds-text-disabled);
1124
- }
1125
- }
1126
- `;
1127
-
1128
- const CARBON_STYLES = css`
1129
- ${MARKDOWN_STYLES}
1130
- ${ANCHOR_STYLES}
1131
- ${READONLY_STYLES}
1132
- ${DISABLED_STYLES}
1133
- ${LABEL_DESCRIPTION_ERROR_STYLES}
1134
- ${CHECKBOX_STYLES}
1135
- ${TAGLIST_STYLES}
1136
- ${RADIO_STYLES}
1137
- ${BUTTON_STYLES}
1138
- ${NUMBER_INPUTS}
1139
- ${DATETIME_INPUTS}
1140
- ${REMAINING_INPUTS}
1141
- ${ADORNMENTS_STYLES}
1142
- ${DROPDOWN_STYLES}
1143
- ${SELECT_STYLES}
1144
-
1145
- .fjs-container {
1146
- width: 100%;
1147
- height: min-content;
1148
-
1149
- .cds--grid {
1150
- padding: 0;
1151
- }
1152
-
1153
- .fjs-form {
1154
- background-color: transparent;
1155
- color: var(--cds-text-primary);
1156
- padding: 0;
1157
- }
1158
-
1159
- @media (width < 66rem) {
1160
- // Carbon lg width breakpoint
1161
- .fjs-layout-column .fjs-form-field {
1162
- margin-left: 0;
1163
- margin-right: 0;
1164
- }
1165
- }
1166
-
1167
- .fjs-input-group {
1168
- margin: 0;
1169
- }
1170
- }
1171
- `;
1172
-
1173
- const GlobalFormStyling = createGlobalStyle`
1174
- ${CARBON_STYLES}
1175
- `;
1176
-
1177
- export { CARBON_STYLES, GlobalFormStyling };
1
+ // todo(pinussilvestrus): consider moving away from styled-components,
2
+ // cf. https://github.com/bpmn-io/form-js/issues/633
3
+ import { css, createGlobalStyle } from 'styled-components';
4
+ import { rem } from '@carbon/elements';
5
+
6
+ function getSelectArrowSvg(color) {
7
+ return `url('data:image/svg+xml;base64,${window.btoa(
8
+ `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z"></path></svg>`,
9
+ )}')`;
10
+ }
11
+
12
+ function getNumberInputMinusSvg(color) {
13
+ return `url('data:image/svg+xml;base64,${window.btoa(
14
+ `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><path d="M8 15H24V17H8z" /></svg>`,
15
+ )}')`;
16
+ }
17
+
18
+ function getNumberInputPlusSvg(color) {
19
+ return `url('data:image/svg+xml;base64,${window.btoa(
20
+ `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="${color}" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><path d="M17 15L17 8 15 8 15 15 8 15 8 17 15 17 15 24 17 24 17 17 24 17 24 15z" /></svg>`,
21
+ )}')`;
22
+ }
23
+
24
+ const getBaseInputStyles = ({ height }) => css`
25
+ color: var(--cds-text-primary);
26
+ border-radius: 0;
27
+ border: none;
28
+ border-bottom: 1px solid var(--cds-border-strong);
29
+ height: ${height};
30
+ font-size: var(--cds-body-short-01-font-size);
31
+ font-weight: var(--cds-body-short-01-font-weight);
32
+ line-height: var(--cds-body-short-01-line-height);
33
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
34
+
35
+ &:focus {
36
+ outline: 2px solid var(--cds-focus);
37
+ outline-offset: -2px;
38
+ }
39
+
40
+ &::placeholder {
41
+ color: var(--cds-text-placeholder);
42
+ }
43
+ `;
44
+
45
+ const getSelectArrowStyles = ({ arrowRightPosition, color }) => css`
46
+ color: var(--cds-text-primary);
47
+ background-color: var(--cds-field);
48
+ cursor: pointer;
49
+ appearance: none;
50
+ background-image: ${getSelectArrowSvg(color)};
51
+ background-repeat: no-repeat;
52
+ background-position: right ${arrowRightPosition} bottom 50%;
53
+ `;
54
+
55
+ const MARKDOWN_STYLES = css`
56
+ .fjs-container .fjs-form-field.fjs-form-field-text .markup {
57
+ & {
58
+ font-size: var(--cds-body-long-01-font-size);
59
+ font-weight: var(--cds-body-long-01-font-weight);
60
+ line-height: var(--cds-body-long-01-line-height);
61
+ letter-spacing: var(--cds-body-long-01-letter-spacing);
62
+ }
63
+
64
+ & h1 {
65
+ font-size: var(--cds-productive-heading-06-font-size);
66
+ font-weight: var(--cds-productive-heading-06-font-weight);
67
+ line-height: var(--cds-productive-heading-06-line-height);
68
+ letter-spacing: var(--cds-productive-heading-06-letter-spacing);
69
+ }
70
+
71
+ & h2 {
72
+ font-size: var(--cds-productive-heading-05-font-size);
73
+ font-weight: var(--cds-productive-heading-05-font-weight);
74
+ line-height: var(--cds-productive-heading-05-line-height);
75
+ letter-spacing: var(--cds-productive-heading-05-letter-spacing);
76
+ }
77
+
78
+ & h3 {
79
+ font-size: var(--cds-productive-heading-04-font-size);
80
+ font-weight: var(--cds-productive-heading-04-font-weight);
81
+ line-height: var(--cds-productive-heading-04-line-height);
82
+ letter-spacing: var(--cds-productive-heading-04-letter-spacing);
83
+ }
84
+ & h4 {
85
+ font-size: var(--cds-productive-heading-03-font-size);
86
+ font-weight: var(--cds-productive-heading-03-font-weight);
87
+ line-height: var(--cds-productive-heading-03-line-height);
88
+ letter-spacing: var(--cds-productive-heading-03-letter-spacing);
89
+ }
90
+ & h5 {
91
+ font-size: var(--cds-productive-heading-02-font-size);
92
+ font-weight: var(--cds-productive-heading-02-font-weight);
93
+ line-height: var(--cds-productive-heading-02-line-height);
94
+ letter-spacing: var(--cds-productive-heading-02-letter-spacing);
95
+ }
96
+ & h6 {
97
+ font-size: var(--cds-productive-heading-01-font-size);
98
+ font-weight: var(--cds-productive-heading-01-font-weight);
99
+ line-height: var(--cds-productive-heading-01-line-height);
100
+ letter-spacing: var(--cds-productive-heading-01-letter-spacing);
101
+ }
102
+
103
+ & code {
104
+ font-family: var(--cds-code-02-font-family);
105
+ font-size: var(--cds-code-02-font-size);
106
+ font-weight: var(--cds-code-02-font-weight);
107
+ line-height: var(--cds-code-02-line-height);
108
+ letter-spacing: var(--cds-code-02-letter-spacing);
109
+ white-space: pre-wrap;
110
+ }
111
+
112
+ & blockquote {
113
+ font-family: var(--cds-quotation-02-font-family);
114
+ font-size: var(--cds-quotation-02-font-size);
115
+ font-weight: var(--cds-quotation-02-font-weight);
116
+ line-height: var(--cds-quotation-02-line-height);
117
+ letter-spacing: var(--cds-quotation-02-letter-spacing);
118
+ }
119
+
120
+ & ul,
121
+ & ol {
122
+ box-sizing: border-box;
123
+ padding: 0;
124
+ border: 0;
125
+ margin: 0;
126
+ list-style: none;
127
+ }
128
+
129
+ & ul {
130
+ margin-left: var(--cds-spacing-05);
131
+ }
132
+
133
+ & ol {
134
+ margin-left: var(--cds-spacing-05);
135
+ }
136
+
137
+ & ul li {
138
+ position: relative;
139
+
140
+ &:before {
141
+ position: absolute;
142
+ left: calc(-1 * var(--cds-spacing-05));
143
+ content: '–';
144
+ }
145
+ }
146
+
147
+ & ol li {
148
+ position: relative;
149
+ counter-increment: item;
150
+
151
+ &:before {
152
+ position: absolute;
153
+ left: calc(-1 * var(--cds-spacing-05));
154
+ content: counter(item) '.';
155
+ }
156
+ }
157
+ }
158
+ `;
159
+
160
+ const ANCHOR_STYLES = css`
161
+ .fjs-container .fjs-form-field-text a {
162
+ color: var(--cds-link-primary);
163
+ outline: none;
164
+ text-decoration: underline;
165
+ font-size: inherit;
166
+ font-weight: inherit;
167
+ line-height: var(--cds-body-compact-01-line-height);
168
+ letter-spacing: var(--cds-body-compact-01-letter-spacing);
169
+
170
+ &:hover {
171
+ color: var(--cds-link-primary-hover);
172
+ }
173
+
174
+ &:focus {
175
+ outline: 1px solid var(--cds-focus);
176
+ }
177
+
178
+ &:active,
179
+ &:active:visited,
180
+ &:active:visited:hover {
181
+ color: var(--cds-text-primary);
182
+ }
183
+
184
+ &:visited {
185
+ color: var(--cds-link-primary);
186
+ }
187
+
188
+ &:visited:hover {
189
+ color: var(--cds-link-primary-hover);
190
+ }
191
+ }
192
+ `;
193
+
194
+ const READONLY_STYLES = css`
195
+ ${({ theme }) => css`
196
+ .fjs-container {
197
+ .fjs-readonly {
198
+ .fjs-input:read-only:not(:disabled),
199
+ .fjs-textarea:read-only:not(:disabled),
200
+ .fjs-select:read-only:not(:disabled),
201
+ &.fjs-taglist,
202
+ .fjs-input-group {
203
+ background-color: transparent;
204
+ }
205
+
206
+ &.fjs-form-field {
207
+ .fjs-input-group {
208
+ border-bottom: 1px solid var(--cds-border-subtle);
209
+ }
210
+ }
211
+
212
+ &.fjs-form-field-number {
213
+ .fjs-input-group .fjs-number-arrow-container {
214
+ background-color: transparent;
215
+
216
+ .fjs-number-arrow-up,
217
+ .fjs-number-arrow-down {
218
+ background-color: transparent;
219
+ pointer-events: none;
220
+ }
221
+ }
222
+ }
223
+
224
+ &.fjs-form-field:not(.fjs-form-field-datetime) {
225
+ .fjs-input-group .fjs-input-adornment {
226
+ background: transparent;
227
+ }
228
+ }
229
+
230
+ &.fjs-form-field-select {
231
+ .fjs-input-group {
232
+ cursor: unset;
233
+ background-image: ${getSelectArrowSvg(theme.iconDisabled)};
234
+ background-color: transparent;
235
+
236
+ .fjs-input:read-only:not(:disabled) {
237
+ border-color: transparent;
238
+ }
239
+
240
+ .fjs-select-display {
241
+ color: var(--cds-text-primary);
242
+ }
243
+ }
244
+ }
245
+
246
+ &.fjs-form-field-datetime {
247
+ .fjs-input-group {
248
+ cursor: unset;
249
+
250
+ .fjs-input-adornment {
251
+ background-color: transparent;
252
+ }
253
+
254
+ .flatpickr-input {
255
+ cursor: unset;
256
+ }
257
+
258
+ .fjs-input-adornment svg {
259
+ cursor: unset;
260
+ }
261
+ }
262
+ }
263
+
264
+ &.fjs-form-field-checkbox,
265
+ &.fjs-form-field-radio,
266
+ &.fjs-form-field-checklist {
267
+ .fjs-input:read-only {
268
+ opacity: 1;
269
+ background-color: transparent;
270
+
271
+ &:before {
272
+ border-color: var(--cds-icon-disabled);
273
+ }
274
+ }
275
+
276
+ &.fjs-checked .fjs-input[type='checkbox'],
277
+ .fjs-form-field-label.fjs-checked .fjs-input[type='checkbox'] {
278
+ &:before {
279
+ border: 1px solid var(--cds-icon-disabled);
280
+ background: transparent;
281
+ }
282
+
283
+ &:after {
284
+ border-bottom: 2px solid var(--cds-icon-primary);
285
+ border-left: 2px solid var(--cds-icon-primary);
286
+ }
287
+ }
288
+ }
289
+
290
+ &.fjs-taglist .fjs-taglist-tag {
291
+ .fjs-taglist-tag-label {
292
+ padding: 2px 0px;
293
+ }
294
+ }
295
+ }
296
+ }
297
+ `}
298
+ `;
299
+
300
+ const DISABLED_STYLES = css`
301
+ .fjs-container {
302
+ .fjs-disabled {
303
+ &.fjs-form-field-textfield .fjs-input,
304
+ &.fjs-form-field-datetime .fjs-input,
305
+ & .fjs-textarea:disabled,
306
+ & .fjs-taglist.fjs-disabled,
307
+ & .fjs-taglist.fjs-disabled .fjs-taglist-input,
308
+ &.fjs-form-field-select .fjs-input-group.disabled,
309
+ &.fjs-form-field-select .fjs-input-group.disabled .fjs-select-display,
310
+ &.fjs-form-field-select .fjs-input-group.disabled .fjs-input,
311
+ &.fjs-form-field .fjs-form-field-label,
312
+ &.fjs-form-field.fjs-form-field-radio .fjs-form-field-label,
313
+ &.fjs-form-field.fjs-form-field-checklist .fjs-form-field-label,
314
+ & .fjs-form-field-description {
315
+ /* todo(pinussilvestrus): mitigate https://github.com/carbon-design-system/carbon/issues/13286 */
316
+ color: var(--cds-text-disabled);
317
+ cursor: var(--cursor-disabled, not-allowed);
318
+ }
319
+
320
+ &.fjs-form-field-textfield .fjs-input-group,
321
+ &.fjs-form-field-datetime .fjs-input-group,
322
+ & .fjs-textarea:disabled,
323
+ & .fjs-taglist.fjs-disabled,
324
+ & .fjs-taglist.fjs-disabled .fjs-taglist-input,
325
+ &.fjs-form-field-select .fjs-input-group.disabled,
326
+ &.fjs-form-field-select .fjs-input-group.disabled .fjs-select-display,
327
+ &.fjs-form-field-select .fjs-input-group.disabled .fjs-input {
328
+ border: none;
329
+ }
330
+ }
331
+
332
+ .fjs-disabled.fjs-form-field-number .fjs-input-group {
333
+ border: none;
334
+ cursor: var(--cursor-disabled, not-allowed);
335
+ }
336
+
337
+ .fjs-disabled.fjs-form-field-number .fjs-input-group .fjs-input {
338
+ cursor: var(--cursor-disabled, not-allowed);
339
+ }
340
+
341
+ .fjs-form-field.fjs-disabled.fjs-checked .fjs-input[type='checkbox'] {
342
+ cursor: var(--cursor-disabled, not-allowed);
343
+ &:before {
344
+ border-color: var(--cds-icon-disabled);
345
+ background-color: var(--cds-icon-disabled);
346
+ cursor: var(--cursor-disabled, not-allowed);
347
+ }
348
+
349
+ &:after {
350
+ cursor: var(--cursor-disabled, not-allowed);
351
+ }
352
+ }
353
+
354
+ .fjs-form-field.fjs-disabled .fjs-input[type='checkbox'] {
355
+ cursor: var(--cursor-disabled, not-allowed);
356
+ &:before {
357
+ border-color: var(--cds-icon-disabled);
358
+ cursor: var(--cursor-disabled, not-allowed);
359
+ }
360
+ }
361
+
362
+ .fjs-form-field-datetime.fjs-disabled
363
+ .fjs-input-group
364
+ .fjs-input-adornment
365
+ svg {
366
+ color: var(--cds-icon-disabled);
367
+ cursor: var(--cursor-disabled, not-allowed);
368
+ }
369
+
370
+ .fjs-taglist.fjs-disabled .fjs-taglist-tag {
371
+ background-color: var(--cds-layer-01);
372
+
373
+ .fjs-taglist-tag-label {
374
+ padding: 2px 0px;
375
+ opacity: 0.7;
376
+ color: var(--cds-text-on-color-disabled);
377
+ }
378
+ }
379
+ }
380
+ `;
381
+
382
+ const LABEL_DESCRIPTION_ERROR_STYLES = css`
383
+ .fjs-container {
384
+ .fjs-form-field-label {
385
+ font-size: var(--cds-label-01-font-size);
386
+ font-weight: var(--cds-label-01-font-weight);
387
+ line-height: var(--cds-label-01-line-height);
388
+ letter-spacing: var(--cds-label-01-letter-spacing);
389
+ }
390
+
391
+ .fjs-form-field:not(.fjs-form-field-checkbox, .fjs-form-field-group)
392
+ .fjs-form-field-label:first-child {
393
+ margin: 0;
394
+ margin-bottom: var(--cds-spacing-03);
395
+ }
396
+
397
+ .fjs-form-field.fjs-form-field-radio
398
+ .fjs-form-field-label:not(:first-of-type),
399
+ .fjs-form-field.fjs-form-field-checklist
400
+ .fjs-form-field-label:not(:first-of-type) {
401
+ margin: 0;
402
+ margin-bottom: 0.1875rem;
403
+ }
404
+
405
+ .fjs-form-field.fjs-form-field-radio
406
+ .fjs-form-field-label:not(:first-of-type) {
407
+ min-height: ${rem(27)};
408
+ }
409
+
410
+ .fjs-form-field-description {
411
+ margin: 0;
412
+ margin-top: var(--cds-spacing-02);
413
+ font-size: var(--cds-helper-text-01-font-size);
414
+ font-weight: var(--cds-helper-text-01-font-weight);
415
+ line-height: var(--cds-helper-text-01-line-height);
416
+ letter-spacing: var(--cds-helper-text-01-letter-spacing);
417
+ }
418
+
419
+ .fjs-form-field-error {
420
+ margin: 0;
421
+ margin-top: var(--cds-spacing-02);
422
+ font-size: var(--cds-label-01-font-size);
423
+ font-weight: var(--cds-label-01-font-weight);
424
+ line-height: var(--cds-label-01-line-height);
425
+ letter-spacing: var(--cds-label-01-letter-spacing);
426
+ }
427
+
428
+ .fjs-has-errors .fjs-form-field-description {
429
+ display: none;
430
+ }
431
+ }
432
+ `;
433
+
434
+ const CHECKBOX_STYLES = css`
435
+ .fjs-container {
436
+ .fjs-input[type='checkbox'],
437
+ .fjs-input[type='checkbox']:focus {
438
+ all: unset;
439
+ width: ${rem(6)};
440
+ }
441
+
442
+ .fjs-form-field .fjs-input[type='checkbox'] {
443
+ position: relative;
444
+ display: flex;
445
+ min-height: ${rem(24)};
446
+ padding-top: ${rem(3)};
447
+ padding-left: ${rem(20)};
448
+ cursor: pointer;
449
+ user-select: none;
450
+ font-size: var(--cds-body-short-01-font-size);
451
+ font-weight: var(--cds-body-short-01-font-weight);
452
+ line-height: var(--cds-body-short-01-line-height);
453
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
454
+
455
+ &:before,
456
+ &:after {
457
+ box-sizing: border-box;
458
+ }
459
+
460
+ &:before {
461
+ position: absolute;
462
+ top: ${rem(3)};
463
+ left: 0;
464
+ width: ${rem(16)};
465
+ height: ${rem(16)};
466
+ border: 1px solid var(--cds-icon-primary);
467
+ margin: ${rem(2)} ${rem(2)} ${rem(2)} ${rem(3)};
468
+ background-color: transparent;
469
+ border-radius: 1px;
470
+ content: '';
471
+ }
472
+
473
+ &:after {
474
+ position: absolute;
475
+ top: ${rem(9)};
476
+ left: ${rem(7)};
477
+ width: ${rem(9)};
478
+ height: ${rem(5)};
479
+ border-bottom: 2px solid var(--cds-icon-inverse);
480
+ border-left: 2px solid var(--cds-icon-inverse);
481
+ margin-top: ${rem(-3)};
482
+ background: 0 0;
483
+ content: '';
484
+ transform: scale(0) rotate(-45deg);
485
+ transform-origin: bottom right;
486
+ }
487
+ }
488
+
489
+ .fjs-form-field .fjs-input[type='checkbox']:focus {
490
+ &:before {
491
+ outline: 2px solid var(--cds-focus);
492
+ outline-offset: 1px;
493
+ }
494
+ }
495
+
496
+ .fjs-form-field.fjs-checked .fjs-input[type='checkbox'],
497
+ .fjs-form-field
498
+ .fjs-form-field-label.fjs-checked
499
+ .fjs-input[type='checkbox'] {
500
+ &:before {
501
+ border: none;
502
+ border-width: 1px;
503
+ background-color: var(--cds-icon-primary);
504
+ }
505
+
506
+ &:after {
507
+ transform: scale(1) rotate(-45deg);
508
+ }
509
+ }
510
+
511
+ .fjs-form-field-checklist .fjs-form-field-label:not(:first-of-type) {
512
+ font-size: var(--cds-body-short-01-font-size);
513
+ font-weight: var(--cds-body-short-01-font-weight);
514
+ line-height: var(--cds-body-short-01-line-height);
515
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
516
+ color: var(--cds-text-primary);
517
+ }
518
+
519
+ .fjs-form-field-checkbox .fjs-form-field-label {
520
+ font-size: var(--cds-body-short-01-font-size);
521
+ font-weight: var(--cds-body-short-01-font-weight);
522
+ line-height: var(--cds-body-short-01-line-height);
523
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
524
+ color: var(--cds-text-primary);
525
+ }
526
+ }
527
+ `;
528
+
529
+ const TAGLIST_STYLES = css`
530
+ .fjs-container {
531
+ .fjs-taglist {
532
+ display: flex;
533
+ align-items: center;
534
+ min-height: 2.5rem;
535
+ height: unset !important;
536
+ }
537
+
538
+ .fjs-taglist:focus-within {
539
+ outline: 2px solid var(--cds-focus);
540
+ outline-offset: -2px;
541
+ }
542
+
543
+ .fjs-taglist .fjs-taglist-input {
544
+ &,
545
+ &::placeholder {
546
+ color: var(--cds-text-primary);
547
+ }
548
+ }
549
+
550
+ .fjs-taglist .fjs-taglist-tag {
551
+ font-size: var(--cds-label-01-font-size);
552
+ font-weight: var(--cds-label-01-font-weight);
553
+ line-height: var(--cds-label-01-line-height);
554
+ letter-spacing: var(--cds-label-01-letter-spacing);
555
+ max-width: 100%;
556
+ padding: 0 0.5rem;
557
+ border-radius: 0.9375rem;
558
+ word-break: break-word;
559
+ min-width: auto;
560
+ display: inline-flex;
561
+ align-items: center;
562
+ justify-content: center;
563
+
564
+ & .fjs-taglist-tag-label {
565
+ padding: 0;
566
+ max-width: 100%;
567
+ text-overflow: ellipsis;
568
+ white-space: nowrap;
569
+ }
570
+
571
+ & .fjs-taglist-tag-remove {
572
+ all: unset;
573
+ width: 1.5rem;
574
+ height: 1.5rem;
575
+ border-radius: 50%;
576
+ display: flex;
577
+ flex-shrink: 0;
578
+ align-items: center;
579
+ justify-content: center;
580
+ padding: 0;
581
+ border: 0;
582
+ margin: 0 ${rem(-8)} 0 0.125rem;
583
+ cursor: pointer;
584
+ }
585
+
586
+ & .fjs-taglist-tag-remove svg {
587
+ all: unset;
588
+ color: var(--cds-icon-inverse);
589
+ }
590
+
591
+ & .fjs-taglist-tag-remove:focus {
592
+ background-color: transparent;
593
+ outline: 1px solid var(--cds-focus-inverse);
594
+ }
595
+ }
596
+ }
597
+ `;
598
+
599
+ const RADIO_STYLES = css`
600
+ .fjs-container .fjs-form-field-radio {
601
+ .fjs-input {
602
+ appearance: none;
603
+ width: 0;
604
+ margin: 0;
605
+ margin-right: calc(${rem(18)} + var(--cds-spacing-03));
606
+ position: relative;
607
+ height: ${rem(18)};
608
+ outline: none;
609
+
610
+ &:focus:before {
611
+ outline: 2px solid var(--cds-focus);
612
+ outline-offset: 1.5px;
613
+ }
614
+
615
+ &:before {
616
+ position: absolute;
617
+ top: 0;
618
+ left: 0;
619
+ width: ${rem(18)};
620
+ height: ${rem(18)};
621
+ border: 1px solid var(--cds-icon-primary);
622
+ background-color: transparent;
623
+ border-radius: 50%;
624
+ content: '';
625
+ }
626
+ }
627
+
628
+ .fjs-checked .fjs-input:after {
629
+ position: relative;
630
+ top: 0;
631
+ left: 0;
632
+ display: inline-block;
633
+ width: ${rem(18)};
634
+ height: ${rem(18)};
635
+ background-color: var(--cds-icon-primary);
636
+ border-radius: 50%;
637
+ content: '';
638
+ transform: scale(0.5);
639
+ }
640
+
641
+ &.fjs-disabled .fjs-input:before {
642
+ border-color: var(--cds-icon-disabled);
643
+ }
644
+
645
+ &.fjs-disabled .fjs-checked .fjs-input:after {
646
+ background-color: var(--cds-icon-disabled);
647
+ }
648
+
649
+ .fjs-form-field-label:not(:first-of-type) {
650
+ font-size: var(--cds-body-short-01-font-size);
651
+ font-weight: var(--cds-body-short-01-font-weight);
652
+ line-height: var(--cds-body-short-01-line-height);
653
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
654
+ color: var(--cds-text-primary);
655
+ }
656
+ }
657
+ `;
658
+
659
+ const BUTTON_STYLES = css`
660
+ .fjs-container {
661
+ .fjs-form-field.fjs-form-field-button .fjs-button {
662
+ font-size: var(--cds-body-short-01-font-size);
663
+ font-weight: var(--cds-body-short-01-font-weight);
664
+ line-height: var(--cds-body-short-01-line-height);
665
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
666
+ min-height: ${rem(32)};
667
+ padding: calc(0.375rem - 3px) 60px calc(0.375rem - 3px) 12px;
668
+ text-align: left;
669
+ color: var(--cds-button-tertiary);
670
+ border: 1px solid var(--cds-button-tertiary);
671
+ border-radius: 0;
672
+ background-color: transparent;
673
+ cursor: pointer;
674
+ }
675
+
676
+ .fjs-form-field.fjs-form-field-button .fjs-button:hover {
677
+ color: var(--cds-text-inverse);
678
+ background-color: var(--cds-button-tertiary-hover);
679
+ }
680
+
681
+ .fjs-form-field.fjs-form-field-button .fjs-button:focus {
682
+ border-color: var(--cds-focus);
683
+ box-shadow: inset 0 0 0 1px var(--cds-focus),
684
+ inset 0 0 0 2px var(--cds-background);
685
+ color: var(--cds-text-inverse);
686
+ background-color: var(--cds-button-tertiary);
687
+ }
688
+
689
+ .fjs-form-field.fjs-form-field-button .fjs-button:active {
690
+ border-color: transparent;
691
+ background-color: var(--cds-button-tertiary-active);
692
+ color: var(--cds-text-inverse);
693
+ }
694
+
695
+ .fjs-form-field.fjs-form-field-button .fjs-button:disabled {
696
+ border: 1px solid var(--cds-button-disabled);
697
+ background: transparent;
698
+ box-shadow: none;
699
+ color: var(--cds-text-on-color-disabled);
700
+ cursor: var(--cursor-disabled, not-allowed);
701
+ outline: none;
702
+ }
703
+
704
+ .fjs-form-field.fjs-form-field-button .fjs-button[type='submit'] {
705
+ background-color: var(--cds-button-primary);
706
+ border: 1px solid transparent;
707
+ color: var(--cds-text-on-color);
708
+ }
709
+
710
+ .fjs-form-field.fjs-form-field-button .fjs-button[type='submit']:disabled {
711
+ background: var(--cds-button-disabled);
712
+ }
713
+ }
714
+ `;
715
+
716
+ const NUMBER_INPUTS = css`
717
+ ${({ theme }) => css`
718
+ .fjs-container .fjs-form-field-number .fjs-input-group {
719
+ border-radius: 0;
720
+ border: none;
721
+ border-bottom: 1px solid var(--cds-border-strong);
722
+ height: 2.5rem;
723
+ box-sizing: border-box;
724
+
725
+ &:focus-within {
726
+ outline: 2px solid var(--cds-focus);
727
+ outline-offset: -2px;
728
+ }
729
+
730
+ & .fjs-input {
731
+ border-radius: 0;
732
+ border: none;
733
+ font-size: var(--cds-body-short-01-font-size);
734
+ font-weight: var(--cds-body-short-01-font-weight);
735
+ line-height: var(--cds-body-short-01-line-height);
736
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
737
+ }
738
+
739
+ & .fjs-number-arrow-container {
740
+ all: unset;
741
+ border: none;
742
+ border-radius: 0;
743
+ display: flex;
744
+ flex-direction: row-reverse;
745
+ align-items: center;
746
+ background-color: var(--cds-field);
747
+ }
748
+
749
+ & .fjs-number-arrow-container .fjs-number-arrow-up,
750
+ & .fjs-number-arrow-container .fjs-number-arrow-down {
751
+ width: 40px;
752
+ height: calc(40px - 1px);
753
+ background-color: var(--cds-field);
754
+ color: transparent;
755
+
756
+ &:hover {
757
+ background-color: var(--cds-field-hover);
758
+ cursor: pointer;
759
+ }
760
+ }
761
+
762
+ &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-up:hover,
763
+ &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-down:hover {
764
+ background-color: var(--cds-field);
765
+ cursor: not-allowed;
766
+ }
767
+
768
+ & .fjs-number-arrow-container .fjs-number-arrow-separator {
769
+ width: 0.0625rem;
770
+ height: 1rem;
771
+ background-color: var(--cds-border-subtle);
772
+ }
773
+
774
+ & .fjs-number-arrow-container .fjs-number-arrow-down {
775
+ background-image: ${getNumberInputMinusSvg(theme.iconPrimary)};
776
+ background-repeat: no-repeat;
777
+ background-position: right 50% bottom 50%;
778
+ }
779
+
780
+ & .fjs-number-arrow-container .fjs-number-arrow-up {
781
+ background-image: ${getNumberInputPlusSvg(theme.iconPrimary)};
782
+ background-repeat: no-repeat;
783
+ background-position: right 50% bottom 50%;
784
+ }
785
+
786
+ &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-up {
787
+ background-image: ${getNumberInputPlusSvg(theme.iconDisabled)};
788
+ }
789
+
790
+ &.fjs-disabled .fjs-number-arrow-container .fjs-number-arrow-down {
791
+ background-image: ${getNumberInputMinusSvg(theme.iconDisabled)};
792
+ }
793
+ }
794
+ `}
795
+ `;
796
+
797
+ const DATETIME_INPUTS = css`
798
+ ${({ theme }) => css`
799
+ .fjs-container {
800
+ .fjs-form-field-datetime {
801
+ .fjs-input.flatpickr-input {
802
+ width: 100%;
803
+ height: 100%;
804
+ border: none;
805
+ border-radius: 0;
806
+
807
+ &,
808
+ &::placeholder {
809
+ color: var(--cds-text-primary);
810
+ }
811
+ }
812
+
813
+ .fjs-input.flatpickr-input:disabled {
814
+ color: var(--cds-text-disabled);
815
+ }
816
+
817
+ .fjs-input.flatpickr-input:disabled::placeholder {
818
+ color: var(--cds-text-disabled);
819
+ }
820
+
821
+ .fjs-input.flatpickr-input:disabled::placeholder {
822
+ color: var(--cds-text-disabled);
823
+ }
824
+
825
+ select {
826
+ ${getBaseInputStyles({ height: '1.5rem' })};
827
+ ${getSelectArrowStyles({
828
+ arrowRightPosition: 'var(--cds-spacing-03)',
829
+ color: theme.iconPrimary,
830
+ })};
831
+ border-bottom: none;
832
+ padding-right: 2rem;
833
+ }
834
+
835
+ .fjs-input-group {
836
+ display: flex;
837
+ flex-direction: row-reverse;
838
+ position: relative;
839
+ }
840
+
841
+ .fjs-input-group .fjs-input-adornment {
842
+ border: none;
843
+ border-radius: 0;
844
+ background-color: var(--cds-field);
845
+ display: flex;
846
+ padding-right: var(--cds-spacing-05);
847
+ }
848
+
849
+ .fjs-input-group .fjs-input-adornment svg {
850
+ color: var(--cds-icon-primary);
851
+ cursor: pointer;
852
+ }
853
+
854
+ .flatpickr-wrapper {
855
+ height: 100%;
856
+ position: initial;
857
+ }
858
+
859
+ .fjs-timepicker.fjs-timepicker-anchor {
860
+ position: unset;
861
+ }
862
+
863
+ .flatpickr-calendar.static {
864
+ top: calc(100% + 3px);
865
+ }
866
+
867
+ .flatpickr-calendar .flatpickr-prev-month svg,
868
+ .flatpickr-calendar .flatpickr-next-month svg {
869
+ height: 16px;
870
+ }
871
+
872
+ .flatpickr-day.today {
873
+ position: relative;
874
+ color: var(--cds-link-primary);
875
+ font-weight: 600;
876
+ border-color: transparent;
877
+ }
878
+
879
+ .flatpickr-day.selected,
880
+ .flatpickr-day.today.selected,
881
+ .flatpickr-day.selected:hover,
882
+ .flatpickr-day.today.selected:hover {
883
+ background-color: var(--cds-button-primary);
884
+ color: var(--cds-text-on-color);
885
+ }
886
+
887
+ .flatpickr-day:focus {
888
+ outline: 2px solid var(--cds-focus);
889
+ outline-offset: -2px;
890
+ }
891
+
892
+ .flatpickr-day.selected:focus {
893
+ outline: 0.0625rem solid var(--cds-focus);
894
+ outline-offset: -0.1875rem;
895
+ }
896
+
897
+ .flatpickr-day:hover {
898
+ background: var(--cds-layer-hover);
899
+ }
900
+
901
+ .flatpickr-days,
902
+ .flatpickr-weekdays {
903
+ padding: unset;
904
+ width: unset;
905
+ }
906
+ }
907
+ }
908
+ `}
909
+ `;
910
+
911
+ const SELECT_STYLES = css`
912
+ ${({ theme }) => css`
913
+ .fjs-container {
914
+ .fjs-form-field-select .fjs-input-group {
915
+ ${getBaseInputStyles({ height: '2.5rem' })}
916
+ ${getSelectArrowStyles({
917
+ arrowRightPosition: 'var(--cds-spacing-05)',
918
+ color: theme.iconPrimary,
919
+ })}
920
+
921
+ .fjs-select-display {
922
+ display: flex;
923
+ align-items: center;
924
+ }
925
+
926
+ .fjs-select-arrow {
927
+ color: transparent;
928
+ }
929
+
930
+ .fjs-select-cross {
931
+ display: flex;
932
+ align-items: center;
933
+ justify-content: center;
934
+ margin-right: var(--cds-spacing-04);
935
+ width: 2.5rem;
936
+ height: calc(2.5rem - 1px);
937
+
938
+ &:hover {
939
+ background-color: var(--cds-layer-hover);
940
+ }
941
+
942
+ svg {
943
+ color: var(--cds-icon-primary);
944
+ }
945
+ }
946
+
947
+ .fjs-input {
948
+ color: var(--cds-text-primary);
949
+ background-color: var(--cds-field);
950
+ border-radius: 0;
951
+ border: none;
952
+ border-bottom: 1px solid var(--cds-border-strong);
953
+ height: 2.5rem;
954
+ font-size: var(--cds-body-short-01-font-size);
955
+ font-weight: var(--cds-body-short-01-font-weight);
956
+ line-height: var(--cds-body-short-01-line-height);
957
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
958
+ }
959
+ }
960
+
961
+ .fjs-form-field-select .fjs-select-anchor .fjs-dropdownlist {
962
+ position: absolute;
963
+ top: -4px;
964
+ }
965
+
966
+ .fjs-form-field-select .fjs-input-group:focus-within {
967
+ outline: 2px solid var(--cds-focus);
968
+ outline-offset: -2px;
969
+ }
970
+
971
+ .fjs-form-field-select.fjs-disabled .fjs-input-group {
972
+ ${getSelectArrowStyles({
973
+ arrowRightPosition: 'var(--cds-spacing-05)',
974
+ color: theme.iconDisabled,
975
+ })}
976
+ }
977
+
978
+ .fjs-has-errors.fjs-form-field-select .fjs-input-group:focus-within {
979
+ outline: 2px solid var(--cds-focus);
980
+ outline-offset: -2px;
981
+ }
982
+
983
+ .fjs-has-errors.fjs-form-field-select .fjs-input-group {
984
+ outline: 2px solid var(--cds-text-error);
985
+ outline-offset: -2px;
986
+ }
987
+ }
988
+ `}
989
+ `;
990
+
991
+ const REMAINING_INPUTS = css`
992
+ .fjs-container {
993
+ .fjs-form-field-textfield .fjs-input-group,
994
+ .fjs-form-field-datetime .fjs-input-group,
995
+ .fjs-textarea,
996
+ .fjs-taglist,
997
+ .fjs-form-field-select.fjs-disabled .fjs-input-group {
998
+ ${getBaseInputStyles({ height: '2.5rem' })}
999
+ }
1000
+
1001
+ .fjs-form-field-textfield .fjs-input-group,
1002
+ .fjs-form-field-datetime .fjs-input-group {
1003
+ &:focus-within {
1004
+ outline: 2px solid var(--cds-focus);
1005
+ outline-offset: -2px;
1006
+ }
1007
+ }
1008
+ .fjs-form-field-textfield .fjs-input,
1009
+ .fjs-form-field-datetime .fjs-input {
1010
+ background-color: var(--cds-field);
1011
+ color: var(--cds-text-primary);
1012
+ border-radius: 0;
1013
+ }
1014
+
1015
+ .fjs-has-errors.fjs-form-field-number .fjs-input-group:focus-within,
1016
+ .fjs-has-errors.fjs-form-field-textarea .fjs-textarea:focus,
1017
+ .fjs-form-field-textfield.fjs-has-errors .fjs-input-group:focus-within,
1018
+ .fjs-form-field-textfield.fjs-has-errors .fjs-input-group:focus,
1019
+ .fjs-form-field-datetime.fjs-has-errors .fjs-input-group:focus-within,
1020
+ .fjs-form-field-datetime.fjs-has-errors .fjs-input-group:focus {
1021
+ outline: 2px solid var(--cds-focus);
1022
+ outline-offset: -2px;
1023
+ }
1024
+
1025
+ .fjs-has-errors.fjs-form-field-number .fjs-input-group,
1026
+ .fjs-has-errors.fjs-form-field-textarea .fjs-textarea,
1027
+ .fjs-form-field-textfield.fjs-has-errors .fjs-input-group,
1028
+ .fjs-form-field-textfield.fjs-has-errors .fjs-input-group,
1029
+ .fjs-form-field-datetime.fjs-has-errors .fjs-input-group,
1030
+ .fjs-form-field-datetime.fjs-has-errors .fjs-input-group {
1031
+ outline: 2px solid var(--cds-text-error);
1032
+ outline-offset: -2px;
1033
+ }
1034
+ }
1035
+ `;
1036
+
1037
+ const DROPDOWN_STYLES = css`
1038
+ .fjs-container {
1039
+ .fjs-form-field-taglist .fjs-taglist-anchor .fjs-dropdownlist,
1040
+ .fjs-form-field-datetime .fjs-timepicker-anchor .fjs-dropdownlist,
1041
+ .fjs-form-field-select .fjs-select-anchor .fjs-dropdownlist {
1042
+ margin: 0;
1043
+ max-height: ${rem(264)};
1044
+ border: none;
1045
+ background-color: var(--cds-layer);
1046
+ overflow-y: auto;
1047
+ cursor: pointer;
1048
+ border-radius: 0;
1049
+ box-shadow: 0 2px 6px var(--cds-shadow);
1050
+
1051
+ & .fjs-dropdownlist-item {
1052
+ border: none;
1053
+ box-sizing: border-box;
1054
+ padding: 0;
1055
+ margin: 0 var(--cds-spacing-05);
1056
+ }
1057
+
1058
+ & .fjs-dropdownlist-item:not(:first-of-type):not(:hover) {
1059
+ border-top: 1px solid var(--cds-border-subtle);
1060
+ }
1061
+
1062
+ & .fjs-dropdownlist-item,
1063
+ & .fjs-dropdownlist-empty {
1064
+ font-size: var(--cds-body-short-01-font-size);
1065
+ font-weight: var(--cds-body-short-01-font-weight);
1066
+ line-height: var(--cds-body-short-01-line-height);
1067
+ letter-spacing: var(--cds-body-short-01-letter-spacing);
1068
+ height: ${rem(40)};
1069
+ color: var(--cds-text-secondary);
1070
+ cursor: pointer;
1071
+ user-select: none;
1072
+ display: flex;
1073
+ align-items: center;
1074
+ background-color: transparent;
1075
+ }
1076
+
1077
+ & .fjs-dropdownlist-empty {
1078
+ color: var(--cds-text-disabled);
1079
+ cursor: default;
1080
+ }
1081
+
1082
+ & .fjs-dropdownlist-item:hover,
1083
+ & .fjs-dropdownlist-item.focused {
1084
+ background-color: var(--cds-layer-hover);
1085
+ color: var(--cds-text-primary);
1086
+ margin: 0;
1087
+ padding: 0 var(--cds-spacing-05);
1088
+ }
1089
+
1090
+ & .fjs-dropdownlist-item:not(:first-of-type):hover {
1091
+ padding-top: 1px;
1092
+ }
1093
+
1094
+ & .fjs-dropdownlist-item.focused + .fjs-dropdownlist-item {
1095
+ border: none;
1096
+ padding-top: 1px;
1097
+ }
1098
+ }
1099
+ }
1100
+ `;
1101
+
1102
+ const ADORNMENTS_STYLES = css`
1103
+ .fjs-container .fjs-form-field:not(.fjs-form-field-datetime) {
1104
+ .fjs-input-group .fjs-input-adornment {
1105
+ all: unset;
1106
+ display: flex;
1107
+ align-items: center;
1108
+ background-color: var(--cds-field);
1109
+ color: var(--cds-text-secondary);
1110
+ padding: 0 var(--cds-spacing-04);
1111
+ cursor: default;
1112
+
1113
+ &.border-right {
1114
+ padding-right: 0;
1115
+ }
1116
+
1117
+ &.border-left {
1118
+ padding-left: 0;
1119
+ }
1120
+ }
1121
+
1122
+ &.fjs-disabled .fjs-input-group .fjs-input-adornment {
1123
+ color: var(--cds-text-disabled);
1124
+ }
1125
+ }
1126
+ `;
1127
+
1128
+ const CARBON_STYLES = css`
1129
+ ${MARKDOWN_STYLES}
1130
+ ${ANCHOR_STYLES}
1131
+ ${READONLY_STYLES}
1132
+ ${DISABLED_STYLES}
1133
+ ${LABEL_DESCRIPTION_ERROR_STYLES}
1134
+ ${CHECKBOX_STYLES}
1135
+ ${TAGLIST_STYLES}
1136
+ ${RADIO_STYLES}
1137
+ ${BUTTON_STYLES}
1138
+ ${NUMBER_INPUTS}
1139
+ ${DATETIME_INPUTS}
1140
+ ${REMAINING_INPUTS}
1141
+ ${ADORNMENTS_STYLES}
1142
+ ${DROPDOWN_STYLES}
1143
+ ${SELECT_STYLES}
1144
+
1145
+ .fjs-container {
1146
+ width: 100%;
1147
+ height: min-content;
1148
+
1149
+ .cds--grid {
1150
+ padding: 0;
1151
+ }
1152
+
1153
+ .fjs-form {
1154
+ background-color: transparent;
1155
+ color: var(--cds-text-primary);
1156
+ padding: 0;
1157
+ }
1158
+
1159
+ @media (width < 66rem) {
1160
+ // Carbon lg width breakpoint
1161
+ .fjs-layout-column .fjs-form-field {
1162
+ margin-left: 0;
1163
+ margin-right: 0;
1164
+ }
1165
+ }
1166
+
1167
+ .fjs-input-group {
1168
+ margin: 0;
1169
+ }
1170
+ }
1171
+ `;
1172
+
1173
+ const GlobalFormStyling = createGlobalStyle`
1174
+ ${CARBON_STYLES}
1175
+ `;
1176
+
1177
+ export { CARBON_STYLES, GlobalFormStyling };