@adnap/krysalicss 0.0.1
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/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/base/global.css +141 -0
- package/dist/base/global.min.css +1 -0
- package/dist/base/reset.css +170 -0
- package/dist/base/reset.min.css +1 -0
- package/dist/element/badge.css +167 -0
- package/dist/element/badge.min.css +1 -0
- package/dist/element/button.css +250 -0
- package/dist/element/button.min.css +1 -0
- package/dist/element/checkbox.css +149 -0
- package/dist/element/checkbox.min.css +1 -0
- package/dist/element/file.css +148 -0
- package/dist/element/file.min.css +1 -0
- package/dist/element/progress.css +183 -0
- package/dist/element/progress.min.css +1 -0
- package/dist/element/radio.css +144 -0
- package/dist/element/radio.min.css +1 -0
- package/dist/element/range.css +183 -0
- package/dist/element/range.min.css +1 -0
- package/dist/element/select.css +156 -0
- package/dist/element/select.min.css +1 -0
- package/dist/element/switch.css +186 -0
- package/dist/element/switch.min.css +1 -0
- package/dist/element/text-input.css +143 -0
- package/dist/element/text-input.min.css +1 -0
- package/dist/element/textarea.css +145 -0
- package/dist/element/textarea.min.css +1 -0
- package/dist/helper/breakpoints.css +113 -0
- package/dist/helper/breakpoints.min.css +1 -0
- package/dist/helper/state.css +126 -0
- package/dist/helper/state.min.css +1 -0
- package/dist/krysalicss.css +1420 -0
- package/dist/krysalicss.css.map +1 -0
- package/dist/krysalicss.min.css +1 -0
- package/dist/layout/container.css +145 -0
- package/dist/layout/container.min.css +1 -0
- package/dist/layout/flex.css +135 -0
- package/dist/layout/flex.min.css +1 -0
- package/dist/layout/grid.css +188 -0
- package/dist/layout/grid.min.css +1 -0
- package/dist/module/alert.css +166 -0
- package/dist/module/alert.min.css +1 -0
- package/dist/module/card.css +157 -0
- package/dist/module/card.min.css +1 -0
- package/dist/module/field.css +138 -0
- package/dist/module/field.min.css +1 -0
- package/dist/module/modal.css +187 -0
- package/dist/module/modal.min.css +1 -0
- package/dist/module/navbar.css +256 -0
- package/dist/module/navbar.min.css +1 -0
- package/dist/module/tabs.css +167 -0
- package/dist/module/tabs.min.css +1 -0
- package/dist/tokens/dark.json +85 -0
- package/dist/tokens/default.json +85 -0
- package/dist/tokens/high-contrast.json +85 -0
- package/dist/typography/base.css +131 -0
- package/dist/typography/base.min.css +1 -0
- package/dist/typography/content.css +137 -0
- package/dist/typography/content.min.css +1 -0
- package/dist/typography/link.css +132 -0
- package/dist/typography/link.min.css +1 -0
- package/dist/typography/table.css +121 -0
- package/dist/typography/table.min.css +1 -0
- package/dist/typography/title.css +122 -0
- package/dist/typography/title.min.css +1 -0
- package/package.json +111 -0
- package/src/_index.scss +18 -0
- package/src/base/_index.scss +2 -0
- package/src/base/global/_index.scss +2 -0
- package/src/base/global/_plugin.scss +34 -0
- package/src/base/global/_variables.scss +11 -0
- package/src/base/reset/_index.scss +2 -0
- package/src/base/reset/_plugin.scss +70 -0
- package/src/base/reset/_variables.scss +5 -0
- package/src/element/_index.scss +11 -0
- package/src/element/badge/_index.scss +2 -0
- package/src/element/badge/_plugin.scss +44 -0
- package/src/element/badge/_variables.scss +19 -0
- package/src/element/button/_index.scss +2 -0
- package/src/element/button/_plugin.scss +173 -0
- package/src/element/button/_variables.scss +36 -0
- package/src/element/checkbox/_index.scss +2 -0
- package/src/element/checkbox/_plugin.scss +48 -0
- package/src/element/checkbox/_variables.scss +24 -0
- package/src/element/file/_index.scss +2 -0
- package/src/element/file/_plugin.scss +45 -0
- package/src/element/file/_variables.scss +27 -0
- package/src/element/progress/_index.scss +2 -0
- package/src/element/progress/_plugin.scss +96 -0
- package/src/element/progress/_variables.scss +19 -0
- package/src/element/radio/_index.scss +2 -0
- package/src/element/radio/_plugin.scss +47 -0
- package/src/element/radio/_variables.scss +16 -0
- package/src/element/range/_index.scss +2 -0
- package/src/element/range/_plugin.scss +101 -0
- package/src/element/range/_variables.scss +19 -0
- package/src/element/select/_index.scss +2 -0
- package/src/element/select/_plugin.scss +58 -0
- package/src/element/select/_variables.scss +26 -0
- package/src/element/switch/_index.scss +2 -0
- package/src/element/switch/_plugin.scss +105 -0
- package/src/element/switch/_variables.scss +28 -0
- package/src/element/text-input/_index.scss +2 -0
- package/src/element/text-input/_plugin.scss +37 -0
- package/src/element/text-input/_variables.scss +22 -0
- package/src/element/textarea/_index.scss +2 -0
- package/src/element/textarea/_plugin.scss +39 -0
- package/src/element/textarea/_variables.scss +22 -0
- package/src/helper/_breakpoints.scss +45 -0
- package/src/helper/_controls.scss +82 -0
- package/src/helper/_index.scss +3 -0
- package/src/helper/_state.scss +35 -0
- package/src/krysalicss.scss +17 -0
- package/src/layout/_index.scss +3 -0
- package/src/layout/container/_index.scss +2 -0
- package/src/layout/container/_plugin.scss +26 -0
- package/src/layout/container/_variables.scss +5 -0
- package/src/layout/flex/_index.scss +2 -0
- package/src/layout/flex/_plugin.scss +32 -0
- package/src/layout/flex/_variables.scss +9 -0
- package/src/layout/grid/_index.scss +2 -0
- package/src/layout/grid/_plugin.scss +37 -0
- package/src/layout/grid/_variables.scss +37 -0
- package/src/module/_index.scss +6 -0
- package/src/module/alert/_index.scss +2 -0
- package/src/module/alert/_plugin.scss +51 -0
- package/src/module/alert/_variables.scss +24 -0
- package/src/module/card/_index.scss +2 -0
- package/src/module/card/_plugin.scss +31 -0
- package/src/module/card/_variables.scss +13 -0
- package/src/module/field/_index.scss +2 -0
- package/src/module/field/_plugin.scss +49 -0
- package/src/module/field/_variables.scss +26 -0
- package/src/module/modal/_index.scss +2 -0
- package/src/module/modal/_plugin.scss +137 -0
- package/src/module/modal/_variables.scss +39 -0
- package/src/module/navbar/_index.scss +2 -0
- package/src/module/navbar/_plugin.scss +186 -0
- package/src/module/navbar/_variables.scss +49 -0
- package/src/module/tabs/_index.scss +2 -0
- package/src/module/tabs/_plugin.scss +106 -0
- package/src/module/tabs/_variables.scss +16 -0
- package/src/theme/_create.scss +74 -0
- package/src/theme/dark.scss +51 -0
- package/src/theme/default.scss +45 -0
- package/src/theme/high-contrast.scss +53 -0
- package/src/typography/_index.scss +5 -0
- package/src/typography/base/_index.scss +2 -0
- package/src/typography/base/_plugin.scss +21 -0
- package/src/typography/base/_variables.scss +15 -0
- package/src/typography/content/_index.scss +2 -0
- package/src/typography/content/_plugin.scss +39 -0
- package/src/typography/content/_variables.scss +1 -0
- package/src/typography/link/_index.scss +2 -0
- package/src/typography/link/_mixins.scss +29 -0
- package/src/typography/link/_plugin.scss +15 -0
- package/src/typography/link/_variables.scss +15 -0
- package/src/typography/table/_index.scss +2 -0
- package/src/typography/table/_plugin.scss +13 -0
- package/src/typography/table/_variables.scss +6 -0
- package/src/typography/title/_index.scss +2 -0
- package/src/typography/title/_plugin.scss +36 -0
- package/src/typography/title/_variables.scss +7 -0
- package/src/variables/_color.scss +66 -0
- package/src/variables/_default.scss +52 -0
- package/src/variables/_feature.scss +39 -0
- package/src/variables/_global.scss +93 -0
- package/src/variables/_index.scss +7 -0
- package/src/variables/_responsive.scss +10 -0
- package/src/variables/_selector.scss +1 -0
- package/src/variables/_size.scss +5 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
|
|
4
|
+
@if variables.$feature-element-file {
|
|
5
|
+
#{$selector} {
|
|
6
|
+
@include variables.backgroundColor(input-bg, transparent);
|
|
7
|
+
@include variables.textColor(input-fg, currentColor);
|
|
8
|
+
display: inline-block;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
padding: $padding-y $padding-x;
|
|
11
|
+
border: $border-width solid
|
|
12
|
+
color-mix(in srgb, currentColor #{$border-mix}, transparent);
|
|
13
|
+
border-radius: $border-radius;
|
|
14
|
+
font: inherit;
|
|
15
|
+
line-height: 1.4;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
|
|
18
|
+
&:focus-visible {
|
|
19
|
+
outline: $focus-outline-width $focus-outline-style
|
|
20
|
+
var(--kc-fg, currentColor);
|
|
21
|
+
outline-offset: $focus-outline-offset;
|
|
22
|
+
border-color: var(--kc-fg, currentColor);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:disabled {
|
|
26
|
+
cursor: not-allowed;
|
|
27
|
+
opacity: $disabled-opacity;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Vendor-specific button pseudo. Lives in its own rule block: listing
|
|
32
|
+
// ::file-selector-button alongside the standard selector causes browsers
|
|
33
|
+
// that don't recognise the pseudo to drop the entire selector list.
|
|
34
|
+
input[type="file"]::file-selector-button {
|
|
35
|
+
margin-inline-end: $padding-x;
|
|
36
|
+
padding: $button-padding-y $button-padding-x;
|
|
37
|
+
border: 1px solid
|
|
38
|
+
color-mix(in srgb, currentColor #{$border-mix}, transparent);
|
|
39
|
+
border-radius: $button-border-radius;
|
|
40
|
+
background-color: var(--kc-default-bg, transparent);
|
|
41
|
+
color: var(--kc-default-fg, currentColor);
|
|
42
|
+
font: inherit;
|
|
43
|
+
cursor: inherit;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use "sass:math";
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
|
|
4
|
+
$selector: 'input[type="file"]' !default;
|
|
5
|
+
|
|
6
|
+
$padding-y: variables.$size-extra-small !default;
|
|
7
|
+
$padding-x: variables.$size-small !default;
|
|
8
|
+
|
|
9
|
+
$border-radius: variables.$global-border-radius !default;
|
|
10
|
+
$border-width: variables.$global-border-width !default;
|
|
11
|
+
|
|
12
|
+
$focus-outline-width: variables.$global-focus-outline-width !default;
|
|
13
|
+
$focus-outline-style: variables.$global-focus-outline-style !default;
|
|
14
|
+
$focus-outline-offset: variables.$global-focus-outline-offset !default;
|
|
15
|
+
|
|
16
|
+
$disabled-opacity: variables.$global-disabled-opacity !default;
|
|
17
|
+
$border-mix: variables.$global-border-mix !default;
|
|
18
|
+
|
|
19
|
+
// Native UA chrome for the "Choose file" button differs (Chrome paints a
|
|
20
|
+
// styled button, Safari paints plain bare text). Style only the wrapper:
|
|
21
|
+
// portable, no surprises across browsers. Vendor pseudos (`::file-selector-
|
|
22
|
+
// button`) get optional polish in their own rule blocks. The inner button
|
|
23
|
+
// is intentionally tighter than a top-level `.button`; padding-y is half the
|
|
24
|
+
// `extra-small` size token, padding-x rounds up to `small`.
|
|
25
|
+
$button-padding-y: math.div(variables.$size-extra-small, 2) !default;
|
|
26
|
+
$button-padding-x: variables.$size-small !default;
|
|
27
|
+
$button-border-radius: variables.$global-border-radius !default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
@use "sass:selector";
|
|
3
|
+
@use "variables" as *;
|
|
4
|
+
@use "../../variables";
|
|
5
|
+
|
|
6
|
+
@if variables.$feature-element-progress {
|
|
7
|
+
#{$selector} {
|
|
8
|
+
// Native UA appearance varies wildly (bar in Chrome, ring in older Safari).
|
|
9
|
+
// Reset to a plain block so our rules below paint a consistent track.
|
|
10
|
+
appearance: none;
|
|
11
|
+
-webkit-appearance: none;
|
|
12
|
+
-moz-appearance: none;
|
|
13
|
+
display: block;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: $height;
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: $border-radius;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
// Track tint must derive from the page foreground, not currentColor:
|
|
20
|
+
// currentColor follows the combination fg (set below for .is-<combo>),
|
|
21
|
+
// and when that fg matches the page bg (e.g. white-on-white in default
|
|
22
|
+
// .is-primary, or black-on-black across every HC variant) the
|
|
23
|
+
// `color-mix(... transparent)` track collapses to the page bg and the
|
|
24
|
+
// bar disappears (WCAG 1.4.11 fails at 1:1). Using --kc-fg keeps the
|
|
25
|
+
// track aligned with the page contrast axis regardless of fill colour.
|
|
26
|
+
background-color: color-mix(
|
|
27
|
+
in srgb,
|
|
28
|
+
var(--kc-fg, currentColor) #{$track-mix},
|
|
29
|
+
transparent
|
|
30
|
+
);
|
|
31
|
+
// Bar fill resolves to combination BG (brand surface colour), not FG.
|
|
32
|
+
// Reason: FG is the text colour intended to read on top of BG; for
|
|
33
|
+
// progress the bar IS the visible surface, so BG carries the right
|
|
34
|
+
// semantic. Pre-fix, .is-primary's bar resolved to combination FG
|
|
35
|
+
// (white in default theme) and disappeared on a pale page bg
|
|
36
|
+
// (1.26:1, WCAG 1.4.11 fail). a11y audit, M2.
|
|
37
|
+
@include variables.textColor(default-bg, list.nth($default-combination, 1));
|
|
38
|
+
|
|
39
|
+
@include variables.combinations using ($label, $tuple) {
|
|
40
|
+
@include variables.textColor(#{$label}-bg, list.nth($tuple, 1));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Vendor pseudo-elements MUST live in separate rule blocks: mixing
|
|
45
|
+
// ::-webkit-* and ::-moz-* in one selector list makes the engine that
|
|
46
|
+
// doesn't recognise the other pseudo drop the whole rule. Splitting
|
|
47
|
+
// keeps each rule independently parseable.
|
|
48
|
+
//
|
|
49
|
+
// selector.append() distributes the pseudo across every entry in the
|
|
50
|
+
// selector list (`progress, .progress` + `::-webkit-progress-bar` →
|
|
51
|
+
// `progress::-webkit-progress-bar, .progress::-webkit-progress-bar`).
|
|
52
|
+
// Naive interpolation `#{$selector}::pseudo` would attach the pseudo
|
|
53
|
+
// only to the last entry and leave the rest as bare selectors.
|
|
54
|
+
#{selector.append($selector, "::-webkit-progress-bar")} {
|
|
55
|
+
background: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#{selector.append($selector, "::-webkit-progress-value")} {
|
|
59
|
+
background-color: currentColor;
|
|
60
|
+
border-radius: $border-radius;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#{selector.append($selector, "::-moz-progress-bar")} {
|
|
64
|
+
background-color: currentColor;
|
|
65
|
+
border-radius: $border-radius;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// selector.nest() distributes the child combinator across every entry
|
|
69
|
+
// in the list (`progress, .progress` + `> .progress__value` →
|
|
70
|
+
// `progress > .progress__value, .progress > .progress__value`).
|
|
71
|
+
// Naive interpolation would attach `>` only to the last entry.
|
|
72
|
+
#{selector.nest($selector, "> #{$value-selector}")} {
|
|
73
|
+
display: block;
|
|
74
|
+
height: 100%;
|
|
75
|
+
background-color: currentColor;
|
|
76
|
+
border-radius: inherit;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Forced-colors: the color-mix track collapses to a near-transparent system
|
|
80
|
+
// colour and the unfilled portion disappears. Force a solid CanvasText
|
|
81
|
+
// border so the bar boundary stays visible; bar fill maps to Highlight.
|
|
82
|
+
// WCAG 1.4.11.
|
|
83
|
+
@media (forced-colors: active) {
|
|
84
|
+
#{$selector} {
|
|
85
|
+
background-color: ButtonFace;
|
|
86
|
+
border: 1px solid CanvasText;
|
|
87
|
+
}
|
|
88
|
+
#{selector.append($selector, "::-webkit-progress-value")},
|
|
89
|
+
#{selector.nest($selector, "> #{$value-selector}")} {
|
|
90
|
+
background-color: Highlight;
|
|
91
|
+
}
|
|
92
|
+
#{selector.append($selector, "::-moz-progress-bar")} {
|
|
93
|
+
background-color: Highlight;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@use "../../variables";
|
|
2
|
+
|
|
3
|
+
// Native + class selectors. `<progress>` ships UA styles we need to override;
|
|
4
|
+
// the `.progress` class covers div-based fallbacks for cases where the
|
|
5
|
+
// consumer cannot use the native element (e.g. determinate animation control).
|
|
6
|
+
$selector: "progress, .progress" !default;
|
|
7
|
+
$value-selector: ".progress__value" !default;
|
|
8
|
+
|
|
9
|
+
$height: 0.5rem !default;
|
|
10
|
+
$border-radius: variables.$global-max-border-radius !default;
|
|
11
|
+
|
|
12
|
+
// Track defaults to the neutral combination so the bar reads against any
|
|
13
|
+
// page bg; foreground (the filled value) draws from the active combination.
|
|
14
|
+
$default-combination: variables.$color-combination-default !default;
|
|
15
|
+
|
|
16
|
+
// Track tint relative to the page foreground. `color-mix` keeps the tint
|
|
17
|
+
// theme-reactive (bg-mix derived from --kc-fg currentColor at 12 %) so the
|
|
18
|
+
// track stays subtle in both light and dark.
|
|
19
|
+
$track-mix: 12% !default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
@use "../../helper/controls" as controls;
|
|
4
|
+
|
|
5
|
+
@if variables.$feature-element-radio {
|
|
6
|
+
#{$selector} {
|
|
7
|
+
appearance: none;
|
|
8
|
+
-webkit-appearance: none;
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
width: $size;
|
|
12
|
+
height: $size;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
@include controls.borderWithMix($border-width, $border-mix);
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
|
|
21
|
+
&:checked {
|
|
22
|
+
border-color: var(--kc-primary-bg, currentColor);
|
|
23
|
+
// Radial gradient draws the inner dot without an extra pseudo-element,
|
|
24
|
+
// keeping the rule footprint tight. Hard stops at 50 % give a crisp
|
|
25
|
+
// edge without anti-aliasing fuzz.
|
|
26
|
+
background-image: radial-gradient(
|
|
27
|
+
circle,
|
|
28
|
+
var(--kc-primary-bg, currentColor) #{$dot-size},
|
|
29
|
+
transparent calc(#{$dot-size} + 1px)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus-visible {
|
|
34
|
+
@include controls.focus-ring(
|
|
35
|
+
$focus-outline-width,
|
|
36
|
+
$focus-outline-style,
|
|
37
|
+
$focus-outline-offset,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include controls.invalidControl();
|
|
42
|
+
|
|
43
|
+
&:disabled {
|
|
44
|
+
@include controls.disabledControl($disabled-opacity);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use "../../variables";
|
|
2
|
+
|
|
3
|
+
$selector: 'input[type="radio"]' !default;
|
|
4
|
+
|
|
5
|
+
$size: 1rem !default;
|
|
6
|
+
$border-width: variables.$global-border-width !default;
|
|
7
|
+
// Inner dot diameter relative to the control. 50 % gives a clearly-checked
|
|
8
|
+
// glyph without crowding the border.
|
|
9
|
+
$dot-size: 50% !default;
|
|
10
|
+
|
|
11
|
+
$focus-outline-width: variables.$global-focus-outline-width !default;
|
|
12
|
+
$focus-outline-style: variables.$global-focus-outline-style !default;
|
|
13
|
+
$focus-outline-offset: variables.$global-focus-outline-offset !default;
|
|
14
|
+
|
|
15
|
+
$disabled-opacity: variables.$global-disabled-opacity !default;
|
|
16
|
+
$border-mix: variables.$global-border-mix !default;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
@use "sass:selector";
|
|
2
|
+
@use "variables" as *;
|
|
3
|
+
@use "../../variables";
|
|
4
|
+
|
|
5
|
+
@if variables.$feature-element-range {
|
|
6
|
+
#{$selector} {
|
|
7
|
+
appearance: none;
|
|
8
|
+
-webkit-appearance: none;
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: $thumb-size;
|
|
12
|
+
background: transparent;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
outline: $focus-outline-width $focus-outline-style
|
|
17
|
+
var(--kc-fg, currentColor);
|
|
18
|
+
outline-offset: $focus-outline-offset;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:disabled {
|
|
22
|
+
cursor: not-allowed;
|
|
23
|
+
opacity: $disabled-opacity;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Vendor pseudo-elements MUST live in separate rule blocks: mixing
|
|
28
|
+
// ::-webkit-* and ::-moz-* in one selector list makes the engine that
|
|
29
|
+
// doesn't recognise the other pseudo drop the whole rule.
|
|
30
|
+
//
|
|
31
|
+
// selector.append() distributes the pseudo across every entry in
|
|
32
|
+
// `$selector` so rescoping (e.g. `'.kc-range, input.kc-range'`) keeps
|
|
33
|
+
// each entry validly paired with the pseudo. Naive interpolation
|
|
34
|
+
// `#{$selector}::pseudo` attaches the pseudo only to the last entry.
|
|
35
|
+
//
|
|
36
|
+
// The track and thumb bodies are identical across webkit/moz so we
|
|
37
|
+
// iterate over the per-engine pseudo names to keep the rules paired.
|
|
38
|
+
|
|
39
|
+
@each $track-pseudo
|
|
40
|
+
in ("::-webkit-slider-runnable-track", "::-moz-range-track") {
|
|
41
|
+
#{selector.append($selector, $track-pseudo)} {
|
|
42
|
+
height: $track-height;
|
|
43
|
+
border-radius: $track-radius;
|
|
44
|
+
background-color: color-mix(
|
|
45
|
+
in srgb,
|
|
46
|
+
currentColor #{$track-mix},
|
|
47
|
+
transparent
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Thumb fill is `--kc-fg` (not `--kc-primary-bg`). The brand primary is too
|
|
53
|
+
// dark on `#121417` (#21704f gave 1.90:1 vs the 18 %-mixed dark track:
|
|
54
|
+
// failed WCAG 1.4.11). Page-fg is the highest-contrast colour available in
|
|
55
|
+
// any theme by definition (~14.7:1 vs page bg in default, ~15.0:1 in dark),
|
|
56
|
+
// so the thumb is unambiguously distinguishable across themes and surfaces.
|
|
57
|
+
// The bg-coloured halo (`$thumb-border-width` solid `--kc-bg`) further
|
|
58
|
+
// separates the thumb from the track.
|
|
59
|
+
#{selector.append($selector, "::-webkit-slider-thumb")} {
|
|
60
|
+
appearance: none;
|
|
61
|
+
-webkit-appearance: none;
|
|
62
|
+
width: $thumb-size;
|
|
63
|
+
height: $thumb-size;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background-color: var(--kc-fg, currentColor);
|
|
66
|
+
border: $thumb-border-width solid var(--kc-bg, white);
|
|
67
|
+
// WebKit aligns thumb to the top of the track box: recenter manually.
|
|
68
|
+
margin-block-start: calc((#{$track-height} - #{$thumb-size}) / 2);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#{selector.append($selector, "::-moz-range-thumb")} {
|
|
73
|
+
width: $thumb-size;
|
|
74
|
+
height: $thumb-size;
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
background-color: var(--kc-fg, currentColor);
|
|
77
|
+
border: $thumb-border-width solid var(--kc-bg, white);
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Forced-colors: the color-mix track collapses to a near-transparent system
|
|
82
|
+
// colour and the unfilled portion disappears. Force a solid ButtonFace track
|
|
83
|
+
// with a CanvasText border so the trough stays visible; thumb maps to
|
|
84
|
+
// Highlight so the active position reads against the track. Kept in
|
|
85
|
+
// separate per-engine blocks for the same reason as above.
|
|
86
|
+
@media (forced-colors: active) {
|
|
87
|
+
@each $track-pseudo
|
|
88
|
+
in ("::-webkit-slider-runnable-track", "::-moz-range-track") {
|
|
89
|
+
#{selector.append($selector, $track-pseudo)} {
|
|
90
|
+
background-color: ButtonFace;
|
|
91
|
+
border: 1px solid CanvasText;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
@each $thumb-pseudo in ("::-webkit-slider-thumb", "::-moz-range-thumb") {
|
|
95
|
+
#{selector.append($selector, $thumb-pseudo)} {
|
|
96
|
+
background-color: Highlight;
|
|
97
|
+
border-color: HighlightText;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@use "../../variables";
|
|
2
|
+
|
|
3
|
+
$selector: 'input[type="range"]' !default;
|
|
4
|
+
|
|
5
|
+
$track-height: 0.375rem !default;
|
|
6
|
+
$track-radius: variables.$global-max-border-radius !default;
|
|
7
|
+
// Mix against currentColor so the track tint stays theme-reactive.
|
|
8
|
+
$track-mix: 18% !default;
|
|
9
|
+
|
|
10
|
+
$thumb-size: 1.125rem !default;
|
|
11
|
+
// Thicker than the global 1px because the thumb sits over the track stripe;
|
|
12
|
+
// at 1px the boundary collapses against `--kc-fg`-mixed track tints.
|
|
13
|
+
$thumb-border-width: 2px !default;
|
|
14
|
+
|
|
15
|
+
$focus-outline-width: variables.$global-focus-outline-width !default;
|
|
16
|
+
$focus-outline-style: variables.$global-focus-outline-style !default;
|
|
17
|
+
$focus-outline-offset: variables.$global-focus-outline-offset !default;
|
|
18
|
+
|
|
19
|
+
$disabled-opacity: variables.$global-disabled-opacity !default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
@use "../../helper/controls" as controls;
|
|
4
|
+
|
|
5
|
+
@if variables.$feature-element-select {
|
|
6
|
+
#{$selector} {
|
|
7
|
+
@include variables.backgroundColor(input-bg, transparent);
|
|
8
|
+
@include variables.textColor(input-fg, currentColor);
|
|
9
|
+
appearance: none;
|
|
10
|
+
-webkit-appearance: none;
|
|
11
|
+
-moz-appearance: none;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding: $padding-y $padding-x-with-caret $padding-y $padding-x;
|
|
15
|
+
@include controls.borderWithMix($border-width, $border-mix);
|
|
16
|
+
border-radius: $border-radius;
|
|
17
|
+
font: inherit;
|
|
18
|
+
line-height: 1.4;
|
|
19
|
+
background-image: $caret-image;
|
|
20
|
+
background-repeat: no-repeat;
|
|
21
|
+
// `background-position` has no logical-axis keyword. Flip on `:dir(rtl)` so
|
|
22
|
+
// the caret sits on the inline-end edge in both directions.
|
|
23
|
+
background-position: right $padding-x center;
|
|
24
|
+
background-size: 0.75rem auto;
|
|
25
|
+
|
|
26
|
+
@if variables.$global-rtl {
|
|
27
|
+
&:dir(rtl) {
|
|
28
|
+
background-position: left $padding-x center;
|
|
29
|
+
padding-inline-start: $padding-x-with-caret;
|
|
30
|
+
padding-inline-end: $padding-x;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
@include controls.focus-ring(
|
|
36
|
+
$focus-outline-width,
|
|
37
|
+
$focus-outline-style,
|
|
38
|
+
$focus-outline-offset,
|
|
39
|
+
);
|
|
40
|
+
border-color: var(--kc-fg, currentColor);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@include controls.invalidControl();
|
|
44
|
+
|
|
45
|
+
&:disabled {
|
|
46
|
+
@include controls.disabledControl($disabled-opacity);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// `[multiple]` is a list, not a dropdown. No caret, native scroll, normal
|
|
50
|
+
// horizontal padding. Native focus on individual <option> children handles
|
|
51
|
+
// keyboard reach.
|
|
52
|
+
&[multiple] {
|
|
53
|
+
padding-inline-end: $padding-x;
|
|
54
|
+
background-image: none;
|
|
55
|
+
height: auto;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use "../../variables";
|
|
2
|
+
|
|
3
|
+
$selector: "select" !default;
|
|
4
|
+
|
|
5
|
+
$padding-y: variables.$size-extra-small !default;
|
|
6
|
+
$padding-x: variables.$size-small !default;
|
|
7
|
+
// Right padding leaves room for the custom caret SVG so long option text
|
|
8
|
+
// doesn't overlap the chevron. Skipped for `[multiple]` (no caret).
|
|
9
|
+
$padding-x-with-caret: 2rem !default;
|
|
10
|
+
|
|
11
|
+
$border-radius: variables.$global-border-radius !default;
|
|
12
|
+
$border-width: variables.$global-border-width !default;
|
|
13
|
+
|
|
14
|
+
$focus-outline-width: variables.$global-focus-outline-width !default;
|
|
15
|
+
$focus-outline-style: variables.$global-focus-outline-style !default;
|
|
16
|
+
$focus-outline-offset: variables.$global-focus-outline-offset !default;
|
|
17
|
+
|
|
18
|
+
$disabled-opacity: variables.$global-disabled-opacity !default;
|
|
19
|
+
$border-mix: variables.$global-border-mix !default;
|
|
20
|
+
|
|
21
|
+
// Inline SVG chevron baked as a data URL so the framework stays asset-free.
|
|
22
|
+
// `currentColor` would be ideal but `background-image` URLs can't reference
|
|
23
|
+
// `currentColor`; the muted neutral reads acceptably in both themes against
|
|
24
|
+
// the input bg. Consumers wanting a theme-reactive caret can override.
|
|
25
|
+
$caret-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5l5 5 5-5" stroke="%23888" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>')
|
|
26
|
+
!default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
@use "../../helper/controls" as controls;
|
|
4
|
+
|
|
5
|
+
@if variables.$feature-element-switch {
|
|
6
|
+
#{$selector} {
|
|
7
|
+
appearance: none;
|
|
8
|
+
-webkit-appearance: none;
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
width: $width;
|
|
13
|
+
height: $height;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
@include controls.borderWithMix($border-width, $border-mix);
|
|
17
|
+
border-radius: variables.$global-max-border-radius;
|
|
18
|
+
background-color: color-mix(
|
|
19
|
+
in srgb,
|
|
20
|
+
currentColor #{$track-mix},
|
|
21
|
+
transparent
|
|
22
|
+
);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
vertical-align: middle;
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
transition:
|
|
27
|
+
background-color $transition-duration ease,
|
|
28
|
+
border-color $transition-duration ease;
|
|
29
|
+
|
|
30
|
+
// Thumb is a centered pseudo-element. Anchored at inline-start; toggled by a
|
|
31
|
+
// translation along the inline axis. `translateX` is physical: RTL flips the
|
|
32
|
+
// sign via the `:dir(rtl)` companion below so the thumb travels toward the
|
|
33
|
+
// visual end-edge in both directions.
|
|
34
|
+
&::before {
|
|
35
|
+
content: "";
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset-block-start: $thumb-inset;
|
|
38
|
+
inset-inline-start: $thumb-inset;
|
|
39
|
+
width: calc(#{$height} - 2 * #{$thumb-inset} - 2 * #{$border-width});
|
|
40
|
+
height: calc(#{$height} - 2 * #{$thumb-inset} - 2 * #{$border-width});
|
|
41
|
+
border-radius: 50%;
|
|
42
|
+
background-color: var(--kc-fg, currentColor);
|
|
43
|
+
transition: transform $transition-duration ease;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:checked {
|
|
47
|
+
background-color: var(--kc-primary-bg, currentColor);
|
|
48
|
+
border-color: var(--kc-primary-bg, currentColor);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:checked::before {
|
|
52
|
+
background-color: var(--kc-primary-fg, white);
|
|
53
|
+
transform: translateX(calc(#{$width} - #{$height}));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@if variables.$global-rtl {
|
|
57
|
+
&:dir(rtl):checked::before {
|
|
58
|
+
transform: translateX(calc(-1 * (#{$width} - #{$height})));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
@include controls.focus-ring(
|
|
64
|
+
$focus-outline-width,
|
|
65
|
+
$focus-outline-style,
|
|
66
|
+
$focus-outline-offset,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:disabled {
|
|
71
|
+
@include controls.disabledControl($disabled-opacity);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (prefers-reduced-motion: reduce) {
|
|
75
|
+
transition: none;
|
|
76
|
+
|
|
77
|
+
&::before {
|
|
78
|
+
transition: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Forced-colors: the color-mix track and border collapse to nearly-
|
|
83
|
+
// invisible system colours. Force solid ButtonFace track + CanvasText
|
|
84
|
+
// border for the off state; checked state maps to Highlight surface.
|
|
85
|
+
// Thumb position alone already conveys state, but we keep the colour
|
|
86
|
+
// cue in case a renderer flattens the position offset.
|
|
87
|
+
@media (forced-colors: active) {
|
|
88
|
+
background-color: ButtonFace;
|
|
89
|
+
border-color: CanvasText;
|
|
90
|
+
|
|
91
|
+
&::before {
|
|
92
|
+
background-color: CanvasText;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:checked {
|
|
96
|
+
background-color: Highlight;
|
|
97
|
+
border-color: Highlight;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:checked::before {
|
|
101
|
+
background-color: HighlightText;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@use "../../variables";
|
|
2
|
+
|
|
3
|
+
// Visually a toggle, semantically still a checkbox: opt-in via `.switch` so
|
|
4
|
+
// authors keep using `<input type="checkbox">` plus assistive-tech behaviour.
|
|
5
|
+
$selector: 'input[type="checkbox"].switch' !default;
|
|
6
|
+
|
|
7
|
+
// Pill dimensions. Width is 2x height by convention so the thumb has a full
|
|
8
|
+
// diameter of travel.
|
|
9
|
+
$height: 1.25rem !default;
|
|
10
|
+
$width: 2.25rem !default;
|
|
11
|
+
$thumb-inset: 2px !default;
|
|
12
|
+
$border-width: variables.$global-border-width !default;
|
|
13
|
+
|
|
14
|
+
$focus-outline-width: variables.$global-focus-outline-width !default;
|
|
15
|
+
$focus-outline-style: variables.$global-focus-outline-style !default;
|
|
16
|
+
$focus-outline-offset: variables.$global-focus-outline-offset !default;
|
|
17
|
+
|
|
18
|
+
$disabled-opacity: variables.$global-disabled-opacity !default;
|
|
19
|
+
$border-mix: variables.$global-border-mix !default;
|
|
20
|
+
// Track-off tint. 50 % is the smallest single value where the track itself
|
|
21
|
+
// reads as a real surface against the page bg in both themes (3.04:1 default,
|
|
22
|
+
// 4.53:1 dark) AND the thumb-on-track contrast clears 3:1 (4.85:1 default,
|
|
23
|
+
// 3.32:1 dark). The earlier 18 % was effectively invisible against either bg.
|
|
24
|
+
// At 50 % the off-state still reads distinctly off: it is darker than a
|
|
25
|
+
// disabled (60 % opacity) thumb, not a half-on intermediate.
|
|
26
|
+
$track-mix: 50% !default;
|
|
27
|
+
|
|
28
|
+
$transition-duration: variables.$global-transition-duration !default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "../../variables";
|
|
3
|
+
@use "../../helper/controls" as controls;
|
|
4
|
+
|
|
5
|
+
@if variables.$feature-element-text-input {
|
|
6
|
+
#{$selector} {
|
|
7
|
+
@include variables.backgroundColor(input-bg, transparent);
|
|
8
|
+
@include variables.textColor(input-fg, currentColor);
|
|
9
|
+
display: inline-block;
|
|
10
|
+
width: 100%;
|
|
11
|
+
padding: $padding-y $padding-x;
|
|
12
|
+
@include controls.borderWithMix($border-width, $border-mix);
|
|
13
|
+
border-radius: $border-radius;
|
|
14
|
+
font: inherit;
|
|
15
|
+
line-height: 1.4;
|
|
16
|
+
|
|
17
|
+
&:focus-visible {
|
|
18
|
+
@include controls.focus-ring(
|
|
19
|
+
$focus-outline-width,
|
|
20
|
+
$focus-outline-style,
|
|
21
|
+
$focus-outline-offset,
|
|
22
|
+
);
|
|
23
|
+
border-color: var(--kc-fg, currentColor);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include controls.invalidControl();
|
|
27
|
+
|
|
28
|
+
&:disabled {
|
|
29
|
+
@include controls.disabledControl($disabled-opacity);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::placeholder {
|
|
33
|
+
color: color-mix(in srgb, currentColor 65%, transparent);
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|