fokus-styles 2.3.0 → 2.5.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/css/components.css +583 -83
  3. package/dist/css/components.css.map +1 -1
  4. package/dist/css/components.min.css +1 -1
  5. package/dist/css/components.min.css.map +1 -1
  6. package/dist/css/fokus-components.css +583 -83
  7. package/dist/css/fokus-components.css.map +1 -1
  8. package/dist/css/fokus-components.min.css +1 -1
  9. package/dist/css/fokus-components.min.css.map +1 -1
  10. package/dist/css/fokus-core.css +22 -0
  11. package/dist/css/fokus-core.css.map +1 -1
  12. package/dist/css/fokus-core.min.css +1 -1
  13. package/dist/css/fokus-core.min.css.map +1 -1
  14. package/dist/css/fokus-dark.css +10 -0
  15. package/dist/css/fokus-dark.css.map +1 -1
  16. package/dist/css/fokus-dark.min.css +1 -1
  17. package/dist/css/fokus-dark.min.css.map +1 -1
  18. package/dist/css/fokus-rtl.css +9166 -0
  19. package/dist/css/fokus-rtl.css.map +1 -0
  20. package/dist/css/fokus-rtl.min.css +2 -0
  21. package/dist/css/fokus-rtl.min.css.map +1 -0
  22. package/dist/css/fokus-utilities.css +158 -0
  23. package/dist/css/fokus-utilities.css.map +1 -1
  24. package/dist/css/fokus-utilities.min.css +1 -1
  25. package/dist/css/fokus-utilities.min.css.map +1 -1
  26. package/dist/css/fokus.css +1018 -258
  27. package/dist/css/fokus.css.map +1 -1
  28. package/dist/css/fokus.min.css +1 -1
  29. package/dist/css/fokus.min.css.map +1 -1
  30. package/dist/css/forms.css +322 -176
  31. package/dist/css/forms.css.map +1 -1
  32. package/dist/css/forms.min.css +1 -1
  33. package/dist/css/forms.min.css.map +1 -1
  34. package/dist/css/helpers.css +158 -0
  35. package/dist/css/helpers.css.map +1 -1
  36. package/dist/css/helpers.min.css +1 -1
  37. package/dist/css/helpers.min.css.map +1 -1
  38. package/dist/css/layout.css +22 -0
  39. package/dist/css/layout.css.map +1 -1
  40. package/dist/css/layout.min.css +1 -1
  41. package/dist/css/layout.min.css.map +1 -1
  42. package/dist/js/fokus.js +270 -25
  43. package/dist/js/fokus.js.map +2 -2
  44. package/dist/js/fokus.min.js +18 -18
  45. package/dist/js/fokus.min.js.map +3 -3
  46. package/docs/components/alert.md +69 -24
  47. package/docs/components/badge.md +23 -4
  48. package/docs/components/checkbox.md +16 -3
  49. package/docs/components/popover.md +20 -7
  50. package/docs/components/radio.md +11 -1
  51. package/docs/components/responsive.md +19 -0
  52. package/docs/components/switch.md +30 -8
  53. package/docs/components/tag.md +19 -4
  54. package/docs/components/toast.md +72 -59
  55. package/docs/components/tooltip.md +38 -2
  56. package/docs/guides/accessibility.md +7 -0
  57. package/docs/guides/rtl-and-system-preferences.md +28 -0
  58. package/docs/prompts/prompt-plan.md +4 -4
  59. package/docs/reference/accessibility-matrix.md +7 -7
  60. package/docs/reference/contrast-report.md +4 -0
  61. package/docs/reference/definitions.md +5 -1
  62. package/docs/reference/design-tokens.md +14 -0
  63. package/docs/reference/size-baseline.json +13 -13
  64. package/mockup/assets/example-theme.css +11 -0
  65. package/mockup/assets/showcase-contracts.js +6 -6
  66. package/mockup/examples/alerts.html +105 -31
  67. package/mockup/examples/badges-alerts.html +91 -59
  68. package/mockup/examples/check-radio-switch.html +575 -99
  69. package/mockup/examples/popover.html +81 -0
  70. package/mockup/examples/tag.html +97 -87
  71. package/mockup/examples/toast.html +113 -0
  72. package/mockup/examples/tooltip.html +68 -0
  73. package/mockup/forms.html +1 -1
  74. package/mockup/overlays-commands.html +2 -2
  75. package/package.json +2 -1
  76. package/packages/fokus-components/scss/components/_alerts.scss +128 -6
  77. package/packages/fokus-components/scss/components/_badges.scss +26 -10
  78. package/packages/fokus-components/scss/components/_index.scss +1 -0
  79. package/packages/fokus-components/scss/components/_popover.scss +131 -21
  80. package/packages/fokus-components/scss/components/_responsive.scss +23 -0
  81. package/packages/fokus-components/scss/components/_tag.scss +37 -14
  82. package/packages/fokus-components/scss/components/_toasts.scss +156 -11
  83. package/packages/fokus-components/scss/components/_tooltips.scss +70 -18
  84. package/packages/fokus-components/scss/forms/_check-radio-switch.scss +313 -215
  85. package/packages/fokus-components/scss/forms/_forms.scss +16 -0
  86. package/packages/fokus-core/scss/base/_accessibility.scss +14 -0
  87. package/packages/fokus-core/scss/tokens/_root.scss +11 -0
  88. package/packages/fokus-js/js/carousel.d.ts +4 -0
  89. package/packages/fokus-js/js/carousel.js +8 -0
  90. package/packages/fokus-js/js/core/positioning.js +18 -9
  91. package/packages/fokus-js/js/dropdown.d.ts +4 -0
  92. package/packages/fokus-js/js/dropdown.js +7 -0
  93. package/packages/fokus-js/js/popover.js +26 -1
  94. package/packages/fokus-js/js/tabs.d.ts +3 -0
  95. package/packages/fokus-js/js/tabs.js +5 -0
  96. package/packages/fokus-js/js/tag.js +17 -0
  97. package/packages/fokus-js/js/toast.js +77 -3
  98. package/packages/fokus-js/js/tooltip.d.ts +8 -1
  99. package/packages/fokus-js/js/tooltip.js +106 -13
  100. package/packages/fokus-utilities/scss/utilities/_api.scss +48 -0
  101. package/scss/entries/rtl-entry.scss +11 -0
@@ -2,41 +2,144 @@
2
2
 
3
3
  @layer components {
4
4
  .fs-toast-container {
5
+ --fs-toast-offset: 16px;
6
+ --fs-toast-gap: 8px;
7
+ --fs-toast-width: 360px;
8
+ --fs-toast-max-width: calc(100vw - 32px);
9
+
5
10
  position: fixed;
6
- right: 16px;
7
- bottom: 16px;
11
+ inset-inline-end: calc(var(--fs-toast-offset) + env(safe-area-inset-inline-end, 0px));
12
+ inset-block-end: calc(var(--fs-toast-offset) + env(safe-area-inset-bottom, 0px));
8
13
  z-index: var(--fs-z-toast);
9
14
  display: flex;
10
15
  flex-direction: column;
11
- gap: 8px;
12
- width: min(360px, 100%);
13
- max-width: calc(100vw - 2 * var(--fs-space-3));
16
+ gap: var(--fs-toast-gap);
17
+ inline-size: min(var(--fs-toast-width), 100%);
18
+ max-inline-size: var(--fs-toast-max-width);
14
19
  }
15
20
 
16
21
  .fs-toast {
22
+ --fs-toast-padding-block: 12px;
23
+ --fs-toast-padding-inline: 14px;
24
+ --fs-toast-gap: 10px;
25
+ --fs-toast-radius: var(--fs-radius-md, 6px);
26
+ --fs-toast-shadow: var(--fs-shadow-md);
27
+ --fs-toast-icon-size: 20px;
28
+ --fs-toast-title-gap: 4px;
29
+ --fs-toast-actions-gap: 8px;
30
+ --fs-toast-border-width: 1px;
31
+ --fs-toast-progress-height: 3px;
32
+
17
33
  display: flex;
18
34
  overflow: hidden;
19
35
  flex-direction: column;
20
- border: 1px solid var(--fs-color-border);
21
- border-radius: var(--fs-radius-md);
36
+ min-inline-size: 0;
37
+ border: var(--fs-toast-border-width) solid var(--fs-color-border);
38
+ border-inline-start: 4px solid var(--fs-color-border);
39
+ border-radius: var(--fs-toast-radius);
22
40
  color: var(--fs-color-text);
23
41
  background-color: var(--fs-color-surface);
24
- box-shadow: var(--fs-shadow-md);
42
+ box-shadow: var(--fs-toast-shadow);
43
+ overflow-wrap: anywhere;
25
44
  }
26
45
 
27
46
  .fs-toast-header {
28
47
  display: flex;
29
48
  align-items: center;
30
- justify-content: space-between;
31
- padding: 10px 12px;
49
+ gap: var(--fs-toast-gap);
50
+ min-inline-size: 0;
51
+ padding-block: var(--fs-toast-padding-block);
52
+ padding-inline: var(--fs-toast-padding-inline);
32
53
  border-bottom: 1px solid var(--fs-color-border);
33
54
  font-size: $font-size-sm;
34
55
  font-weight: $font-weight-medium;
35
56
  }
36
57
 
58
+ .fs-toast-icon {
59
+ display: inline-flex;
60
+ flex: 0 0 var(--fs-toast-icon-size);
61
+ align-items: center;
62
+ justify-content: center;
63
+ inline-size: var(--fs-toast-icon-size);
64
+ block-size: var(--fs-toast-icon-size);
65
+ color: currentcolor;
66
+ }
67
+
68
+ .fs-toast-icon .fs-icon,
69
+ .fs-toast-icon > svg {
70
+ inline-size: 100%;
71
+ block-size: 100%;
72
+ }
73
+
74
+ .fs-toast-heading {
75
+ display: flex;
76
+ flex: 1 1 auto;
77
+ flex-wrap: wrap;
78
+ align-items: baseline;
79
+ gap: var(--fs-toast-title-gap);
80
+ min-inline-size: 0;
81
+ }
82
+
83
+ .fs-toast-title,
84
+ .fs-toast-meta {
85
+ min-inline-size: 0;
86
+ }
87
+
88
+ .fs-toast-meta {
89
+ color: var(--fs-color-muted);
90
+ font-size: $font-size-xs;
91
+ font-weight: $font-weight-regular;
92
+ }
93
+
94
+ .fs-toast-close {
95
+ flex: 0 0 auto;
96
+ margin-inline-start: auto;
97
+ color: inherit;
98
+ }
99
+
37
100
  .fs-toast-body {
38
- padding: 12px;
101
+ min-inline-size: 0;
102
+ padding-block: var(--fs-toast-padding-block);
103
+ padding-inline: var(--fs-toast-padding-inline);
39
104
  font-size: $font-size-sm;
105
+ line-height: 1.5;
106
+ }
107
+
108
+ .fs-toast-actions {
109
+ display: flex;
110
+ flex-wrap: wrap;
111
+ gap: var(--fs-toast-actions-gap);
112
+ align-items: center;
113
+ padding-block: 0 var(--fs-toast-padding-block);
114
+ padding-inline: var(--fs-toast-padding-inline);
115
+ }
116
+
117
+ .fs-toast-link {
118
+ color: inherit;
119
+ font-weight: $font-weight-medium;
120
+ text-decoration: underline;
121
+ text-underline-offset: 2px;
122
+ }
123
+
124
+ .fs-toast-progress {
125
+ display: none;
126
+ align-self: stretch;
127
+ margin-inline-start: auto;
128
+ inline-size: 100%;
129
+ block-size: var(--fs-toast-progress-height);
130
+ background-color: currentcolor;
131
+ opacity: 0.5;
132
+ }
133
+
134
+ .fs-toast.is-progressing[data-toast-progress="true"]:not([data-autohide="false"]) .fs-toast-progress {
135
+ display: block;
136
+ inline-size: 100%;
137
+ transition: inline-size 50ms linear;
138
+ }
139
+
140
+ .fs-toast.is-paused .fs-toast-progress,
141
+ .fs-toast.is-progressing[data-toast-progress="true"]:not([data-autohide="false"]):hover .fs-toast-progress {
142
+ animation-play-state: paused;
40
143
  }
41
144
 
42
145
  @each $name, $color in $theme-colors {
@@ -44,5 +147,47 @@
44
147
  color: var(--fs-alert-#{$name}-text);
45
148
  background-color: var(--fs-alert-#{$name}-bg);
46
149
  }
150
+
151
+ .fs-toast-#{$name} {
152
+ border-inline-start-color: var(--fs-color-#{$name});
153
+ }
154
+ }
155
+
156
+ @media (width <= 480px) {
157
+ .fs-toast-container {
158
+ --fs-toast-offset: 12px;
159
+ --fs-toast-max-width: calc(100vw - 24px);
160
+ }
161
+
162
+ .fs-toast-actions {
163
+ align-items: flex-start;
164
+ }
165
+ }
166
+
167
+ @media (prefers-reduced-motion: reduce) {
168
+ .fs-toast.is-progressing[data-toast-progress="true"]:not([data-autohide="false"]) .fs-toast-progress {
169
+ animation: none;
170
+ inline-size: 100%;
171
+ transition: none;
172
+ }
173
+ }
174
+
175
+ @media (forced-colors: active) {
176
+ .fs-toast {
177
+ border-color: CanvasText;
178
+ border-inline-start-color: Highlight;
179
+ color: CanvasText;
180
+ background-color: Canvas;
181
+ box-shadow: none;
182
+ }
183
+
184
+ .fs-toast-header {
185
+ border-color: CanvasText;
186
+ background-color: Canvas;
187
+ }
188
+
189
+ .fs-toast-progress {
190
+ background-color: Highlight;
191
+ }
47
192
  }
48
193
  }
@@ -2,54 +2,106 @@
2
2
 
3
3
  @layer components {
4
4
  .fs-tooltip {
5
+ --fs-tooltip-max-width: 240px;
6
+ --fs-tooltip-padding-block: 6px;
7
+ --fs-tooltip-padding-inline: 10px;
8
+ --fs-tooltip-radius: var(--fs-radius-sm);
9
+ --fs-tooltip-offset: 8px;
10
+ --fs-tooltip-shadow: var(--fs-shadow-sm, 0 2px 8px rgb(0 0 0 / 18%));
11
+ --fs-tooltip-arrow-size: 8px;
12
+ --fs-tooltip-transition-duration: 120ms;
13
+
5
14
  position: absolute;
6
15
  z-index: var(--fs-z-tooltip);
7
16
  display: none;
8
- max-width: 220px;
17
+ max-inline-size: min(var(--fs-tooltip-max-width), calc(100vw - 16px));
18
+ min-inline-size: 0;
19
+ overflow-wrap: anywhere;
9
20
  }
10
21
 
11
22
  .fs-tooltip.is-open {
12
23
  display: block;
24
+ pointer-events: none;
25
+ animation: fs-tooltip-in var(--fs-tooltip-transition-duration) ease-out;
13
26
  }
14
27
 
15
28
  .fs-tooltip-inner {
16
- padding: 6px 10px;
17
- border-radius: var(--fs-radius-sm);
29
+ padding-block: var(--fs-tooltip-padding-block);
30
+ padding-inline: var(--fs-tooltip-padding-inline);
31
+ border: 1px solid transparent;
32
+ border-radius: var(--fs-tooltip-radius);
18
33
  color: var(--fs-tooltip-text);
19
34
  background-color: var(--fs-tooltip-bg);
35
+ box-shadow: var(--fs-tooltip-shadow);
20
36
  font-size: $font-size-xs;
21
- text-align: center;
37
+ line-height: 1.4;
38
+ text-align: start;
22
39
  }
23
40
 
24
41
  .fs-tooltip-arrow {
25
42
  position: absolute;
26
- width: 8px;
27
- height: 8px;
43
+ inline-size: var(--fs-tooltip-arrow-size);
44
+ block-size: var(--fs-tooltip-arrow-size);
28
45
  background-color: var(--fs-tooltip-bg);
29
46
  transform: rotate(45deg);
30
47
  }
31
48
 
32
49
  .fs-tooltip[data-placement="top"] .fs-tooltip-arrow {
33
- bottom: -4px;
34
- left: 50%;
35
- margin-left: -4px;
50
+ inset-block-end: -4px;
51
+ inset-inline-start: var(--fs-tooltip-arrow-offset, 50%);
52
+ margin-inline-start: -4px;
36
53
  }
37
54
 
38
55
  .fs-tooltip[data-placement="bottom"] .fs-tooltip-arrow {
39
- top: -4px;
40
- left: 50%;
41
- margin-left: -4px;
56
+ inset-block-start: -4px;
57
+ inset-inline-start: var(--fs-tooltip-arrow-offset, 50%);
58
+ margin-inline-start: -4px;
42
59
  }
43
60
 
44
61
  .fs-tooltip[data-placement="left"] .fs-tooltip-arrow {
45
- top: 50%;
46
- right: -4px;
47
- margin-top: -4px;
62
+ inset-block-start: var(--fs-tooltip-arrow-offset, 50%);
63
+ inset-inline-end: -4px;
64
+ margin-block-start: -4px;
48
65
  }
49
66
 
50
67
  .fs-tooltip[data-placement="right"] .fs-tooltip-arrow {
51
- top: 50%;
52
- left: -4px;
53
- margin-top: -4px;
68
+ inset-block-start: var(--fs-tooltip-arrow-offset, 50%);
69
+ inset-inline-start: -4px;
70
+ margin-block-start: -4px;
71
+ }
72
+
73
+ @media (prefers-reduced-motion: reduce) {
74
+ .fs-tooltip {
75
+ animation: none;
76
+ }
77
+ }
78
+
79
+ @media (forced-colors: active) {
80
+ .fs-tooltip-inner,
81
+ .fs-tooltip-arrow {
82
+ color: CanvasText;
83
+ background-color: Canvas;
84
+ border-color: CanvasText;
85
+ box-shadow: none;
86
+ }
87
+ }
88
+
89
+ @media (prefers-contrast: more) {
90
+ .fs-tooltip-inner {
91
+ border-color: currentcolor;
92
+ box-shadow: none;
93
+ }
94
+ }
95
+
96
+ @keyframes fs-tooltip-in {
97
+ from {
98
+ opacity: 0;
99
+ transform: translateY(2px);
100
+ }
101
+
102
+ to {
103
+ opacity: 1;
104
+ transform: translateY(0);
105
+ }
54
106
  }
55
107
  }