@vialiq/flux-ui 0.19.0 → 0.21.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.
- package/README.md +22 -0
- package/components/_accordion.scss +13 -13
- package/components/_alert.scss +7 -7
- package/components/_animation.scss +3 -3
- package/components/_badge.scss +8 -6
- package/components/_checkbox.scss +5 -4
- package/components/_chip.scss +4 -4
- package/components/_index.scss +5 -1
- package/components/_label.scss +3 -3
- package/components/_modal.scss +7 -5
- package/components/_radio.scss +7 -6
- package/components/_select.scss +6 -5
- package/components/_switch.scss +12 -11
- package/components/_tab-panel.scss +20 -0
- package/components/_tab.scss +213 -0
- package/components/_tabs.scss +574 -0
- package/components/_tag.scss +49 -66
- package/components/_tooltip.scss +10 -8
- package/flux-ui.css +1 -1
- package/flux-ui.css.map +1 -1
- package/package.json +1 -1
- package/styles/_flatpickr-core.scss +8 -7
- package/styles/_functions.scss +39 -0
- package/styles/_index.scss +1 -0
- package/styles/_layout.scss +1 -0
- package/styles/_utilities.scss +1 -1
- package/styles/_variables.scss +33 -37
package/README.md
CHANGED
|
@@ -380,6 +380,28 @@ Works with any JavaScript framework:
|
|
|
380
380
|
- ✅ Focus states built-in
|
|
381
381
|
- ✅ Semantic HTML patterns
|
|
382
382
|
- ✅ Reduced motion support ready
|
|
383
|
+
- ✅ Responsive `rem` scaling based on root font size
|
|
384
|
+
|
|
385
|
+
### Responsive Typography & Rem Scaling
|
|
386
|
+
Flux UI strictly uses `rem` units for typography and spacing to ensure accessibility. By default, it assumes a standard browser root font size of `16px`.
|
|
387
|
+
|
|
388
|
+
If your application uses a custom root font size (such as the `62.5%` or `10px` hack), you must configure Flux UI to scale its internal calculations accordingly:
|
|
389
|
+
|
|
390
|
+
```scss
|
|
391
|
+
// In your application's main SCSS file:
|
|
392
|
+
@use '@vialiq/flux-ui/styles' with (
|
|
393
|
+
$vi-rem-base: 10px
|
|
394
|
+
);
|
|
395
|
+
```
|
|
396
|
+
This ensures that a component designed to be `16px` tall will correctly output `1.6rem`, rendering exactly 16 pixels at runtime against your custom 10px root.
|
|
397
|
+
|
|
398
|
+
### CSS Unit Guidelines
|
|
399
|
+
To maintain a robust, scalable, and accessible UI, Flux UI strictly adheres to the following unit rules:
|
|
400
|
+
|
|
401
|
+
- **`rem`**: Used for **Typography**, **Spacing** (margin, padding, gap), and **Interactive Form Control Sizing** (button heights, input widths, etc.). This guarantees that everything defining the core layout grid and text hierarchy scales fluidly when a user changes their browser root font size for accessibility.
|
|
402
|
+
- **`px`**: Reserved exclusively for rigid geometries that must never scale or blur. Used for **Borders** (`1px solid`), **Shadows** (offsets and blurs), small **Optical Adjustments** (e.g. `2px` focus outline offset), and **Visually Hidden Hacks** (e.g. `1px` clipping for screen readers).
|
|
403
|
+
- **`dvh` / `dvw`** (with `vh` / `vw` fallback): Used for **Viewport-Relative Layouts**, such as full-screen modal overlays, drawer max-heights, or sticky banners that must span the entire screen regardless of the parent container size. Dynamic viewport units correctly account for mobile browser UI (like address bars) expanding and contracting.
|
|
404
|
+
- **`%`**: Used for **Container-Relative Fluidity**, such as a button being `width: 100%` of its parent column, or grid layouts.
|
|
383
405
|
|
|
384
406
|
## Contributing
|
|
385
407
|
|
|
@@ -8,8 +8,8 @@ $accordion-border-radius: var(--vi-accordion-border-radius, tokens.$border-radiu
|
|
|
8
8
|
$accordion-gap: var(--vi-accordion-gap, 0px);
|
|
9
9
|
$accordion-animation-duration: var(--vi-accordion-animation-duration, 200ms);
|
|
10
10
|
|
|
11
|
-
$accordion-item-header-padding: var(--vi-accordion-item-header-padding,
|
|
12
|
-
$accordion-item-body-padding: var(--vi-accordion-item-body-padding, 0
|
|
11
|
+
$accordion-item-header-padding: var(--vi-accordion-item-header-padding, #{tokens.$spacing-sm} #{tokens.$spacing-md});
|
|
12
|
+
$accordion-item-body-padding: var(--vi-accordion-item-body-padding, 0 #{tokens.$spacing-md} #{tokens.$spacing-md});
|
|
13
13
|
$accordion-item-header-bg: var(--vi-accordion-item-header-bg, transparent);
|
|
14
14
|
$accordion-item-header-bg-hover: var(--vi-accordion-item-header-bg-hover, tokens.$layer-hover-01);
|
|
15
15
|
$accordion-item-header-bg-open: var(--vi-accordion-item-header-bg-open, transparent);
|
|
@@ -43,8 +43,8 @@ $accordion-item-chevron-color: var(--vi-accordion-item-chevron-color, tokens.$te
|
|
|
43
43
|
padding: $accordion-item-header-padding;
|
|
44
44
|
background-color: $accordion-item-header-bg;
|
|
45
45
|
color: $accordion-item-label-color;
|
|
46
|
-
font-family: tokens.$font-family-base;
|
|
47
|
-
font-size: var(--vi-accordion-item-header-font-size, tokens.$font-size-base);
|
|
46
|
+
font-family: var(--vi-accordion-font-family, #{tokens.$font-family-base});
|
|
47
|
+
font-size: var(--vi-accordion-item-header-font-size, #{tokens.$font-size-base});
|
|
48
48
|
font-weight: $accordion-item-label-font-weight;
|
|
49
49
|
text-align: left;
|
|
50
50
|
border: none;
|
|
@@ -91,8 +91,8 @@ $accordion-item-chevron-color: var(--vi-accordion-item-chevron-color, tokens.$te
|
|
|
91
91
|
margin-inline-start: tokens.$spacing-xs;
|
|
92
92
|
|
|
93
93
|
svg {
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
94
|
+
width: #{tokens.$spacing-md};
|
|
95
|
+
height: #{tokens.$spacing-md};
|
|
96
96
|
fill: none;
|
|
97
97
|
stroke: currentColor;
|
|
98
98
|
stroke-width: 2;
|
|
@@ -112,9 +112,9 @@ $accordion-item-chevron-color: var(--vi-accordion-item-chevron-color, tokens.$te
|
|
|
112
112
|
|
|
113
113
|
.accordion-panel-inner {
|
|
114
114
|
padding: $accordion-item-body-padding;
|
|
115
|
-
font-family: tokens.$font-family-base;
|
|
116
|
-
font-size: tokens.$font-size-sm;
|
|
117
|
-
color: tokens.$text-secondary;
|
|
115
|
+
font-family: var(--vi-accordion-font-family, #{tokens.$font-family-base});
|
|
116
|
+
font-size: #{tokens.$font-size-sm};
|
|
117
|
+
color: #{tokens.$text-secondary};
|
|
118
118
|
box-sizing: border-box;
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -168,8 +168,8 @@ $accordion-item-chevron-color: var(--vi-accordion-item-chevron-color, tokens.$te
|
|
|
168
168
|
|
|
169
169
|
.accordion--sm,
|
|
170
170
|
.accordion-item--sm {
|
|
171
|
-
--vi-accordion-item-header-padding:
|
|
172
|
-
--vi-accordion-item-body-padding: 0
|
|
171
|
+
--vi-accordion-item-header-padding: #{tokens.$spacing-xs} #{tokens.$spacing-sm};
|
|
172
|
+
--vi-accordion-item-body-padding: 0 #{tokens.$spacing-sm} #{tokens.$spacing-sm};
|
|
173
173
|
--vi-accordion-item-header-font-size: #{tokens.$font-size-sm};
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -182,8 +182,8 @@ $accordion-item-chevron-color: var(--vi-accordion-item-chevron-color, tokens.$te
|
|
|
182
182
|
|
|
183
183
|
.accordion--lg,
|
|
184
184
|
.accordion-item--lg {
|
|
185
|
-
--vi-accordion-item-header-padding:
|
|
186
|
-
--vi-accordion-item-body-padding: 0
|
|
185
|
+
--vi-accordion-item-header-padding: #{tokens.$spacing-lg} #{tokens.$spacing-xl};
|
|
186
|
+
--vi-accordion-item-body-padding: 0 #{tokens.$spacing-xl} #{tokens.$spacing-xl};
|
|
187
187
|
--vi-accordion-item-header-font-size: #{tokens.$font-size-lg};
|
|
188
188
|
}
|
|
189
189
|
|
package/components/_alert.scss
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
width: 100%;
|
|
17
17
|
|
|
18
|
-
border-radius: var(--vi-alert-border-radius,
|
|
19
|
-
padding: var(--vi-alert-padding,
|
|
20
|
-
gap: var(--vi-alert-gap,
|
|
18
|
+
border-radius: var(--vi-alert-border-radius, #{tokens.$border-radius-lg});
|
|
19
|
+
padding: var(--vi-alert-padding, #{tokens.$spacing-xs} #{tokens.$spacing-md});
|
|
20
|
+
gap: var(--vi-alert-gap, #{tokens.$spacing-sm});
|
|
21
21
|
border-width: var(--vi-alert-border-width, 1px);
|
|
22
22
|
border-style: solid;
|
|
23
23
|
|
|
24
|
-
font-family: tokens.$font-family-base;
|
|
25
|
-
font-size: tokens.$font-size-sm;
|
|
26
|
-
line-height: tokens.$line-height-normal;
|
|
24
|
+
font-family: var(--vi-alert-font-family, #{tokens.$font-family-base});
|
|
25
|
+
font-size: #{tokens.$font-size-sm};
|
|
26
|
+
line-height: #{tokens.$line-height-normal};
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.alert-icon {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
.alert-title {
|
|
47
47
|
font-weight: tokens.$font-weight-semibold;
|
|
48
|
-
margin-bottom:
|
|
48
|
+
margin-bottom: #{tokens.$spacing-unit};
|
|
49
49
|
display: block;
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
--vi-animation-easing-exit: cubic-bezier(0.4, 0, 1, 1);
|
|
26
26
|
--vi-animation-easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
27
27
|
|
|
28
|
-
--vi-animation-expand-max-height:
|
|
28
|
+
--vi-animation-expand-max-height: 100dvh;
|
|
29
29
|
--vi-animation-expand-max-width: 100vw;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -186,11 +186,11 @@
|
|
|
186
186
|
// Expand & Collapse Keyframes
|
|
187
187
|
@keyframes vi-expand-vertical {
|
|
188
188
|
from { max-height: 0; opacity: 0; }
|
|
189
|
-
to { max-height: var(--vi-animation-expand-max-height,
|
|
189
|
+
to { max-height: var(--vi-animation-expand-max-height, 100dvh); opacity: 1; }
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
@keyframes vi-collapse-vertical {
|
|
193
|
-
from { max-height: var(--vi-animation-expand-max-height,
|
|
193
|
+
from { max-height: var(--vi-animation-expand-max-height, 100dvh); opacity: 1; }
|
|
194
194
|
to { max-height: 0; opacity: 0; }
|
|
195
195
|
}
|
|
196
196
|
|
package/components/_badge.scss
CHANGED
|
@@ -16,19 +16,21 @@
|
|
|
16
16
|
white-space: nowrap;
|
|
17
17
|
box-sizing: border-box;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// 20px = standard badge height (not on the spacing scale); kept explicit
|
|
20
|
+
height: var(--vi-badge-height, 20px);
|
|
21
|
+
font-size: var(--vi-badge-font-size, #{tokens.$font-size-xs});
|
|
20
22
|
font-weight: var(--vi-badge-font-weight, #{tokens.$font-weight-semibold});
|
|
21
|
-
padding: var(--vi-badge-padding,
|
|
22
|
-
border-radius: var(--vi-badge-border-radius,
|
|
23
|
-
gap: var(--vi-badge-gap,
|
|
23
|
+
padding: var(--vi-badge-padding, 0 #{tokens.$spacing-xs});
|
|
24
|
+
border-radius: var(--vi-badge-border-radius, #{tokens.$border-radius-full});
|
|
25
|
+
gap: var(--vi-badge-gap, #{tokens.$spacing-unit});
|
|
24
26
|
|
|
25
27
|
border: #{tokens.$border-width-thin} solid transparent;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
.dot {
|
|
29
31
|
display: inline-block;
|
|
30
|
-
width: var(--vi-badge-dot-size,
|
|
31
|
-
height: var(--vi-badge-dot-size,
|
|
32
|
+
width: var(--vi-badge-dot-size, #{tokens.$spacing-xs});
|
|
33
|
+
height: var(--vi-badge-dot-size, #{tokens.$spacing-xs});
|
|
32
34
|
border-radius: 50%;
|
|
33
35
|
background-color: currentColor;
|
|
34
36
|
flex-shrink: 0;
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
@use '../styles/variables' as tokens;
|
|
10
|
+
@use '../styles/functions' as func;
|
|
10
11
|
|
|
11
12
|
@layer components {
|
|
12
13
|
.checkbox-wrapper {
|
|
13
14
|
display: inline-flex;
|
|
14
15
|
align-items: flex-start;
|
|
15
|
-
gap: var(--vi-checkbox-label-gap,
|
|
16
|
+
gap: var(--vi-checkbox-label-gap, #{tokens.$spacing-xs});
|
|
16
17
|
cursor: pointer;
|
|
17
18
|
font-family: #{tokens.$font-family-base};
|
|
18
19
|
font-size: var(--vi-checkbox-label-font-size, #{tokens.$font-size-base});
|
|
@@ -41,10 +42,10 @@
|
|
|
41
42
|
display: inline-flex;
|
|
42
43
|
align-items: center;
|
|
43
44
|
justify-content: center;
|
|
44
|
-
width: var(--vi-checkbox-size,
|
|
45
|
-
height: var(--vi-checkbox-size,
|
|
45
|
+
width: var(--vi-checkbox-size, #{tokens.$spacing-md});
|
|
46
|
+
height: var(--vi-checkbox-size, #{tokens.$spacing-md});
|
|
46
47
|
border: #{tokens.$border-width-base} solid var(--vi-checkbox-border-color, #{tokens.$outline});
|
|
47
|
-
border-radius: var(--vi-checkbox-border-radius,
|
|
48
|
+
border-radius: var(--vi-checkbox-border-radius, #{func.to-rem(4px)});
|
|
48
49
|
background-color: var(--vi-checkbox-background-color, #{tokens.$color-background});
|
|
49
50
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
|
|
50
51
|
flex-shrink: 0;
|
package/components/_chip.scss
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
border-style: solid;
|
|
13
13
|
|
|
14
14
|
// Tokens mapped directly from docs
|
|
15
|
-
height: var(--vi-chip-height, var(--vi-chip-height-md,
|
|
15
|
+
height: var(--vi-chip-height, var(--vi-chip-height-md, #{tokens.$spacing-xl}));
|
|
16
16
|
padding: var(--vi-chip-padding, 0 10px);
|
|
17
|
-
border-radius: var(--vi-chip-border-radius,
|
|
17
|
+
border-radius: var(--vi-chip-border-radius, #{tokens.$border-radius-full});
|
|
18
18
|
border-width: var(--vi-chip-border-width, 1px);
|
|
19
19
|
gap: var(--vi-chip-gap, 6px);
|
|
20
|
-
font-size: var(--vi-chip-font-size,
|
|
21
|
-
font-weight: var(--vi-chip-font-weight,
|
|
20
|
+
font-size: var(--vi-chip-font-size, #{tokens.$font-size-sm});
|
|
21
|
+
font-weight: var(--vi-chip-font-weight, #{tokens.$font-weight-medium});
|
|
22
22
|
transition: all var(--vi-chip-transition, 100ms ease);
|
|
23
23
|
|
|
24
24
|
// Color tokens to be overridden by vi-chip variant
|
package/components/_index.scss
CHANGED
package/components/_label.scss
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
--vi-label-required-color: var(--vi-color-error, #{tokens.$color-error});
|
|
15
15
|
// --vi-label-optional-color: var(--vi-text-helper)
|
|
16
16
|
--vi-label-optional-color: var(--vi-text-helper, #{tokens.$text-helper});
|
|
17
|
-
// --vi-label-gap: 4px
|
|
18
|
-
--vi-label-gap:
|
|
17
|
+
// --vi-label-gap: $spacing-unit (4px)
|
|
18
|
+
--vi-label-gap: #{tokens.$spacing-unit};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.vi-label {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
font-size: var(--vi-label-font-size);
|
|
26
26
|
font-weight: var(--vi-label-font-weight);
|
|
27
27
|
color: var(--vi-label-color);
|
|
28
|
-
line-height:
|
|
28
|
+
line-height: #{tokens.$line-height-normal};
|
|
29
29
|
margin: 0;
|
|
30
30
|
|
|
31
31
|
&.size-sm {
|
package/components/_modal.scss
CHANGED
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
margin: auto;
|
|
26
26
|
width: 100%;
|
|
27
27
|
max-width: tokens.$modal-max-width-md;
|
|
28
|
-
max-height: 90vh;
|
|
28
|
+
max-height: 90vh;
|
|
29
|
+
max-height: 90dvh;
|
|
29
30
|
|
|
30
31
|
z-index: tokens.$modal-z-index;
|
|
31
32
|
|
|
32
|
-
font-family: tokens.$font-family-base;
|
|
33
|
-
font-size: tokens.$font-size-base;
|
|
34
|
-
line-height: tokens.$line-height-normal;
|
|
35
|
-
color: tokens.$text-primary;
|
|
33
|
+
font-family: var(--vi-modal-font-family, #{tokens.$font-family-base});
|
|
34
|
+
font-size: var(--vi-modal-font-size, #{tokens.$font-size-base});
|
|
35
|
+
line-height: var(--vi-modal-line-height, #{tokens.$line-height-normal});
|
|
36
|
+
color: #{tokens.$text-primary};
|
|
36
37
|
|
|
37
38
|
&[open] {
|
|
38
39
|
display: flex;
|
|
@@ -230,6 +231,7 @@
|
|
|
230
231
|
width: 100vw !important;
|
|
231
232
|
width: 100dvw !important;
|
|
232
233
|
max-height: 100vh !important;
|
|
234
|
+
max-height: 100dvh !important;
|
|
233
235
|
height: 100vh !important;
|
|
234
236
|
height: 100dvh !important;
|
|
235
237
|
border-radius: 0 !important;
|
package/components/_radio.scss
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
.radio-group-items {
|
|
36
36
|
display: flex;
|
|
37
|
-
gap: var(--vi-radio-group-gap,
|
|
37
|
+
gap: var(--vi-radio-group-gap, #{tokens.$spacing-xs});
|
|
38
38
|
|
|
39
39
|
&[orientation="vertical"] {
|
|
40
40
|
flex-direction: column;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
.radio-wrapper {
|
|
77
77
|
display: inline-flex;
|
|
78
78
|
align-items: center;
|
|
79
|
-
gap: var(--vi-radio-label-gap,
|
|
79
|
+
gap: var(--vi-radio-label-gap, #{tokens.$spacing-xs});
|
|
80
80
|
cursor: pointer;
|
|
81
81
|
font-family: #{tokens.$font-family-base};
|
|
82
82
|
font-size: var(--vi-radio-label-font-size, #{tokens.$font-size-base});
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
display: inline-flex;
|
|
105
105
|
align-items: center;
|
|
106
106
|
justify-content: center;
|
|
107
|
-
width: var(--vi-radio-size,
|
|
108
|
-
height: var(--vi-radio-size,
|
|
107
|
+
width: var(--vi-radio-size, #{tokens.$spacing-md});
|
|
108
|
+
height: var(--vi-radio-size, #{tokens.$spacing-md});
|
|
109
109
|
border: #{tokens.$border-width-base} solid var(--vi-radio-border-color, #{tokens.$outline});
|
|
110
110
|
border-radius: 50%;
|
|
111
111
|
background-color: var(--vi-radio-background-color, #{tokens.$color-background});
|
|
@@ -115,8 +115,9 @@
|
|
|
115
115
|
|
|
116
116
|
.radio-dot {
|
|
117
117
|
box-sizing: border-box;
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
// 8px dot is half of the 16px ($spacing-md) circle; this ratio is intentional
|
|
119
|
+
width: var(--vi-radio-dot-size, calc(#{tokens.$spacing-md} / 2));
|
|
120
|
+
height: var(--vi-radio-dot-size, calc(#{tokens.$spacing-md} / 2));
|
|
120
121
|
border-radius: 50%;
|
|
121
122
|
background-color: var(--vi-radio-dot-color, #{tokens.$color-primary});
|
|
122
123
|
transform: scale(0);
|
package/components/_select.scss
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
@use '../styles/variables' as tokens;
|
|
9
|
+
@use '../styles/functions' as func;
|
|
9
10
|
|
|
10
11
|
@layer components {
|
|
11
12
|
// -------------------------------------------------------------------------
|
|
@@ -38,14 +39,14 @@
|
|
|
38
39
|
justify-content: space-between;
|
|
39
40
|
box-sizing: border-box;
|
|
40
41
|
width: 100%;
|
|
41
|
-
min-height: var(--vi-select-sizing-min-height,
|
|
42
|
-
padding: var(--vi-select-spacing-padding-block, #{tokens.$spacing-
|
|
43
|
-
var(--vi-select-spacing-padding-inline, #{
|
|
42
|
+
min-height: var(--vi-select-sizing-min-height, #{tokens.$spacing-xl});
|
|
43
|
+
padding: var(--vi-select-spacing-padding-block, #{tokens.$spacing-unit})
|
|
44
|
+
var(--vi-select-spacing-padding-inline, #{func.to-rem(11px)});
|
|
44
45
|
background-color: var(--vi-select-background-color, #{tokens.$color-background});
|
|
45
46
|
border: var(--vi-select-border-width, #{tokens.$border-width-thin}) solid var(--vi-select-border-color, #{tokens.$border-03});
|
|
46
|
-
border-radius: var(--vi-select-shape-border-radius, #{
|
|
47
|
+
border-radius: var(--vi-select-shape-border-radius, #{func.to-rem(6px)});
|
|
47
48
|
font-family: inherit;
|
|
48
|
-
font-size: var(--vi-font-size-base, #{
|
|
49
|
+
font-size: var(--vi-font-size-base, #{func.to-rem(14px)});
|
|
49
50
|
color: var(--vi-select-text-color, #{tokens.$color-foreground});
|
|
50
51
|
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
51
52
|
cursor: pointer;
|
package/components/_switch.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use '../styles/variables' as tokens;
|
|
2
|
+
@use '../styles/functions' as func;
|
|
2
3
|
|
|
3
4
|
@layer components {
|
|
4
5
|
// ── Wrapper ──────────────────────────────────────────────────────────────────
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
.switch-wrapper {
|
|
11
12
|
display: inline-flex;
|
|
12
13
|
align-items: flex-start;
|
|
13
|
-
gap: var(--vi-switch-label-gap,
|
|
14
|
+
gap: var(--vi-switch-label-gap, #{tokens.$spacing-xs});
|
|
14
15
|
cursor: pointer;
|
|
15
16
|
font-family: #{tokens.$font-family-base};
|
|
16
17
|
font-size: var(--vi-switch-label-font-size, #{tokens.$font-size-base});
|
|
@@ -52,15 +53,15 @@
|
|
|
52
53
|
.switch-track {
|
|
53
54
|
box-sizing: border-box;
|
|
54
55
|
position: relative;
|
|
55
|
-
width: var(--vi-switch-track-width, 44px);
|
|
56
|
-
height: var(--vi-switch-track-height,
|
|
56
|
+
width: var(--vi-switch-track-width, func.to-rem(44px));
|
|
57
|
+
height: var(--vi-switch-track-height, func.to-rem(22px));
|
|
57
58
|
background-color: var(--vi-switch-track-color-off, #{tokens.$border-03});
|
|
58
|
-
border-radius: var(--vi-border-radius-full,
|
|
59
|
+
border-radius: var(--vi-border-radius-full, #{tokens.$border-radius-full});
|
|
59
60
|
transition: background-color var(--vi-switch-transition-duration, 150ms) ease;
|
|
60
61
|
flex-shrink: 0;
|
|
61
62
|
// Align track centre with first-line cap-height
|
|
62
63
|
margin-top: calc(
|
|
63
|
-
(1em * #{tokens.$line-height-normal} - var(--vi-switch-track-height, 24px)) / 2
|
|
64
|
+
(1em * #{tokens.$line-height-normal} - var(--vi-switch-track-height, func.to-rem(24px))) / 2
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -69,10 +70,10 @@
|
|
|
69
70
|
.switch-thumb {
|
|
70
71
|
position: absolute;
|
|
71
72
|
top: 50%;
|
|
72
|
-
left: var(--vi-switch-thumb-offset, 2px);
|
|
73
|
+
left: var(--vi-switch-thumb-offset, func.to-rem(2px));
|
|
73
74
|
transform: translateY(-50%);
|
|
74
|
-
width: var(--vi-switch-thumb-size, 18px);
|
|
75
|
-
height: var(--vi-switch-thumb-size, 18px);
|
|
75
|
+
width: var(--vi-switch-thumb-size, func.to-rem(18px));
|
|
76
|
+
height: var(--vi-switch-thumb-size, func.to-rem(18px));
|
|
76
77
|
background-color: var(--vi-switch-thumb-color, #{tokens.$text-primary-inverse});
|
|
77
78
|
border-radius: 50%;
|
|
78
79
|
box-shadow: var(--vi-switch-thumb-shadow, 0 1px 3px rgba(0, 0, 0, 0.2));
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
|
|
87
88
|
.switch-thumb {
|
|
88
89
|
left: calc(
|
|
89
|
-
100% - var(--vi-switch-thumb-size, 18px) - var(--vi-switch-thumb-offset, 2px)
|
|
90
|
+
100% - var(--vi-switch-thumb-size, func.to-rem(18px)) - var(--vi-switch-thumb-offset, func.to-rem(2px))
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
@@ -107,11 +108,11 @@
|
|
|
107
108
|
opacity: var(--vi-switch-disabled-opacity, 0.5);
|
|
108
109
|
|
|
109
110
|
.switch-track {
|
|
110
|
-
background-color: #{tokens.$border-03};
|
|
111
|
+
background-color: var(--vi-switch-track-color-disabled, #{tokens.$border-03});
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
.switch-input:checked ~ .switch-track {
|
|
114
|
-
background-color: #{tokens.$text-disabled};
|
|
115
|
+
background-color: var(--vi-switch-track-color-on-disabled, #{tokens.$text-disabled});
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use '@vialiq/flux-ui/styles/variables' as tokens;
|
|
2
|
+
@use '../styles/functions' as func;
|
|
3
|
+
|
|
4
|
+
@layer components {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// Hide inactive panels; keep them in DOM for lazy content preservation
|
|
8
|
+
|
|
9
|
+
[part='panel'] {
|
|
10
|
+
padding: var(--vi-tab-panel-padding, 16px 0);
|
|
11
|
+
outline: none;
|
|
12
|
+
|
|
13
|
+
&:focus-visible {
|
|
14
|
+
outline: 2px solid var(--vi-tabs-indicator-color, #{tokens.$color-primary});
|
|
15
|
+
outline-offset: 2px;
|
|
16
|
+
border-radius: #{func.to-rem(2px)};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
@use '@vialiq/flux-ui/styles/variables' as tokens;
|
|
2
|
+
@use '../styles/functions' as func;
|
|
3
|
+
|
|
4
|
+
@layer components {
|
|
5
|
+
|
|
6
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
// vi-tab — Individual tab button
|
|
8
|
+
//
|
|
9
|
+
// The tab host is TRANSPARENT — the sliding cursor in vi-tabs handles all bg.
|
|
10
|
+
// The tab itself is responsible for: typography, icon, badge, focus ring.
|
|
11
|
+
//
|
|
12
|
+
// Key decisions:
|
|
13
|
+
// • No background on :host — cursor does all surface work
|
|
14
|
+
// • Active: primary color + semibold + slight letterSpacing tightening
|
|
15
|
+
// • Hover: very soft inset highlight (8% opacity), scale-in animation
|
|
16
|
+
// • 48px height (M3 minimum) — tabs need body to feel clickable
|
|
17
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// ── Tab button core ───────────────────────────────────────────────────────────
|
|
21
|
+
|
|
22
|
+
.vi-tab {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
gap: var(--vi-tab-icon-gap, #{tokens.$spacing-xs});
|
|
27
|
+
padding: var(--vi-tab-padding, 0 20px);
|
|
28
|
+
min-width: var(--vi-tab-min-width, 90px);
|
|
29
|
+
max-width: var(--vi-tab-max-width, 240px);
|
|
30
|
+
min-height: var(--vi-tab-height, 40px);
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
position: relative;
|
|
34
|
+
z-index: 1; // Above the cursor element
|
|
35
|
+
border: none;
|
|
36
|
+
background: transparent;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
user-select: none;
|
|
40
|
+
-webkit-user-select: none;
|
|
41
|
+
|
|
42
|
+
// Typography — clear nav-link feel, not body text
|
|
43
|
+
font-family: inherit;
|
|
44
|
+
font-size: var(--vi-tab-font-size, #{tokens.$font-size-base});
|
|
45
|
+
font-weight: var(--vi-tab-font-weight, 500);
|
|
46
|
+
letter-spacing: 0.015em;
|
|
47
|
+
color: var(--vi-tab-color, #{tokens.$text-secondary});
|
|
48
|
+
|
|
49
|
+
transition:
|
|
50
|
+
color 180ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
51
|
+
transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
52
|
+
|
|
53
|
+
// ── Hover highlight (inset bloom effect) ──────────────────────────────────
|
|
54
|
+
|
|
55
|
+
&::before {
|
|
56
|
+
content: '';
|
|
57
|
+
position: absolute;
|
|
58
|
+
inset: 4px;
|
|
59
|
+
border-radius: #{func.to-rem(8px)};
|
|
60
|
+
background: currentColor;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transform: scale(0.85);
|
|
63
|
+
transition:
|
|
64
|
+
opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
65
|
+
transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ── Hover ──────────────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
&:not(.vi-tab--disabled):not(.vi-tab--active):hover {
|
|
72
|
+
color: var(--vi-tab-color-hover, #{tokens.$text-primary});
|
|
73
|
+
|
|
74
|
+
&::before {
|
|
75
|
+
opacity: 0.06;
|
|
76
|
+
transform: scale(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── Selected ──────────────────────────────────────────────────────────────
|
|
81
|
+
|
|
82
|
+
&.vi-tab--active {
|
|
83
|
+
color: var(--vi-tab-color-active, #{tokens.$color-primary});
|
|
84
|
+
font-weight: var(--vi-tab-font-weight-active, 600);
|
|
85
|
+
letter-spacing: 0.01em;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ── Focus visible ─────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
&:focus-visible {
|
|
91
|
+
outline: none;
|
|
92
|
+
|
|
93
|
+
&::before {
|
|
94
|
+
outline: 2px solid #{tokens.$color-primary};
|
|
95
|
+
outline-offset: 0;
|
|
96
|
+
opacity: 0.12;
|
|
97
|
+
transform: scale(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ── Disabled ───────────────────────────────────────────────────────────────
|
|
102
|
+
|
|
103
|
+
&.vi-tab--disabled {
|
|
104
|
+
color: var(--vi-tab-color-disabled, #{tokens.$text-disabled});
|
|
105
|
+
cursor: not-allowed;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
|
|
108
|
+
&::before { display: none; }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── Icon ──────────────────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
.vi-tab__icon {
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
font-size: var(--vi-tab-icon-size, #{func.to-rem(15px)});
|
|
119
|
+
opacity: 0.6;
|
|
120
|
+
position: relative;
|
|
121
|
+
z-index: 1;
|
|
122
|
+
transition: opacity 180ms ease, transform 180ms ease;
|
|
123
|
+
|
|
124
|
+
.vi-tab--active & {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
transform: scale(1.04);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ── Label ─────────────────────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
.vi-tab__label {
|
|
133
|
+
position: relative;
|
|
134
|
+
z-index: 1;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
text-overflow: ellipsis;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ── Badge ─────────────────────────────────────────────────────────────────────
|
|
141
|
+
|
|
142
|
+
.vi-tab__badge {
|
|
143
|
+
position: relative;
|
|
144
|
+
z-index: 1;
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
min-width: var(--vi-tab-close-size, 18px);
|
|
149
|
+
height: var(--vi-tab-close-size, 18px);
|
|
150
|
+
padding: var(--vi-tab-badge-padding, 0 5px);
|
|
151
|
+
border-radius: #{func.to-rem(9px)};
|
|
152
|
+
font-size: #{func.to-rem(10px)};
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
line-height: 1;
|
|
155
|
+
letter-spacing: 0;
|
|
156
|
+
background: var(--vi-tab-badge-bg, #{tokens.$color-primary});
|
|
157
|
+
color: var(--vi-tab-badge-color, #{tokens.$layer-01});
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
|
|
160
|
+
animation: vi-badge-pop 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@keyframes vi-badge-pop {
|
|
164
|
+
from { transform: scale(0.4); opacity: 0; }
|
|
165
|
+
to { transform: scale(1); opacity: 1; }
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ── Close button ──────────────────────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
.vi-tab__close {
|
|
171
|
+
position: relative;
|
|
172
|
+
z-index: 2;
|
|
173
|
+
display: inline-flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
width: var(--vi-tab-close-size, 18px);
|
|
177
|
+
height: var(--vi-tab-close-size, 18px);
|
|
178
|
+
border: none;
|
|
179
|
+
border-radius: 50%;
|
|
180
|
+
background: transparent;
|
|
181
|
+
color: currentColor;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
padding: 0;
|
|
184
|
+
margin-left: var(--vi-tab-close-margin-left, 2px);
|
|
185
|
+
flex-shrink: 0;
|
|
186
|
+
opacity: 0; // Hidden until tab is hovered
|
|
187
|
+
transform: scale(0.7);
|
|
188
|
+
transition:
|
|
189
|
+
opacity 150ms ease,
|
|
190
|
+
transform 150ms ease,
|
|
191
|
+
background-color 120ms ease;
|
|
192
|
+
|
|
193
|
+
svg { display: block; }
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Show close button on tab hover or when the tab is active
|
|
197
|
+
.vi-tab:hover .vi-tab__close,
|
|
198
|
+
.vi-tab--active .vi-tab__close {
|
|
199
|
+
opacity: 0.6;
|
|
200
|
+
transform: scale(1);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.vi-tab__close:hover {
|
|
204
|
+
opacity: 1 !important;
|
|
205
|
+
background: color-mix(in srgb, #{tokens.$text-primary} 8%, transparent);
|
|
206
|
+
transform: scale(1) !important;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// ── Overflow hidden state (overflow=menu) ─────────────────────────────────────
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
}
|