@utrecht/form-toggle-css 1.0.0 → 1.2.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/CHANGELOG.md +19 -0
- package/design.md +7 -0
- package/dist/index.css +164 -0
- package/dist/index.js +1 -0
- package/package.json +19 -4
- package/src/_mixin.scss +133 -0
- package/src/index.scss +108 -0
- package/src/tokens.json +372 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @utrecht/form-toggle-css
|
|
2
|
+
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9196935: Added metadata for form-toggle tokens.
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 62f1157: Add SCSS files to `src/` directory of CSS component packages.
|
|
14
|
+
|
|
15
|
+
## 1.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- 856d996: Switch from alpha releases to semantic versioning.
|
package/design.md
ADDED
package/dist/index.css
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @license EUPL-1.2
|
|
7
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @license EUPL-1.2
|
|
11
|
+
* Copyright (c) 2021 Gemeente Utrecht
|
|
12
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
13
|
+
*/
|
|
14
|
+
/* stylelint-disable-next-line block-no-empty */
|
|
15
|
+
.utrecht-form-toggle {
|
|
16
|
+
align-items: center;
|
|
17
|
+
block-size: var(--utrecht-form-toggle-height, 2em);
|
|
18
|
+
border-color: var(--utrecht-form-toggle-border-color, currentColor);
|
|
19
|
+
border-radius: var(--utrecht-form-toggle-border-radius, 999rem);
|
|
20
|
+
border-style: var(--utrecht-form-toggle-border-style, solid);
|
|
21
|
+
border-width: var(--utrecht-form-toggle-border-width, 1px);
|
|
22
|
+
color: var(--utrecht-form-toggle-color);
|
|
23
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
24
|
+
display: flex;
|
|
25
|
+
inline-size: var(--utrecht-form-toggle-width, 6em);
|
|
26
|
+
padding-block-end: var(--utrecht-form-toggle-padding-block-end);
|
|
27
|
+
padding-block-start: var(--utrecht-form-toggle-padding-block-start);
|
|
28
|
+
padding-inline-end: var(--utrecht-form-toggle-padding-inline-end);
|
|
29
|
+
padding-inline-start: var(--utrecht-form-toggle-padding-inline-start);
|
|
30
|
+
position: relative;
|
|
31
|
+
-webkit-user-select: none;
|
|
32
|
+
user-select: none;
|
|
33
|
+
}
|
|
34
|
+
@media screen and (-ms-high-contrast: active), screen and (forced-colors: active) {
|
|
35
|
+
.utrecht-form-toggle {
|
|
36
|
+
--utrecht-form-toggle-background-color: ButtonFace;
|
|
37
|
+
--utrecht-form-toggle-border-color: buttonborder;
|
|
38
|
+
--utrecht-form-toggle-border-width: 1px;
|
|
39
|
+
--utrecht-form-toggle-border-radius: var(--utrecht-form-toggle-track-border-radius);
|
|
40
|
+
--utrecht-form-toggle-thumb-background-color: ButtonText;
|
|
41
|
+
--utrecht-form-toggle-thumb-disabled-background-color: GrayText;
|
|
42
|
+
/* TODO: Apply `GrayText` to the border-color */
|
|
43
|
+
border-color: var(--utrecht-form-toggle-track-disabled-border-color, var(--utrecht-form-toggle-track-border-color));
|
|
44
|
+
border-width: min(var(--utrecht-form-toggle-border-width, 1px), 1px);
|
|
45
|
+
/* TODO: Find a way to express the `pressed` state */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.utrecht-form-toggle--focus-visible, .utrecht-form-toggle--html-div:focus-visible {
|
|
50
|
+
/* - The browser default focus ring should apply when these CSS custom properties are not set.
|
|
51
|
+
* - Make the `box-shadow` value available, so components that have their own `box-shadow`
|
|
52
|
+
* can combine it with the focus ring box shadow.
|
|
53
|
+
*/
|
|
54
|
+
--_utrecht-focus-ring-box-shadow: 0 0 0 var(--utrecht-focus-outline-width, 0)
|
|
55
|
+
var(--utrecht-focus-inverse-outline-color, transparent);
|
|
56
|
+
box-shadow: var(--_utrecht-focus-ring-box-shadow);
|
|
57
|
+
outline-color: var(--utrecht-focus-outline-color, revert);
|
|
58
|
+
outline-offset: var(--utrecht-focus-outline-offset, revert);
|
|
59
|
+
outline-style: var(--utrecht-focus-outline-style, revert);
|
|
60
|
+
outline-width: var(--utrecht-focus-outline-width, revert);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.utrecht-form-toggle--hover {
|
|
64
|
+
background-color: var(--utrecht-form-toggle-hover-background-color, var(--utrecht-form-toggle-background-color));
|
|
65
|
+
color: var(--utrecht-form-toggle-hover-color, var(--utrecht-form-toggle-color));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.utrecht-form-toggle--disabled, .utrecht-form-toggle--html-div:disabled {
|
|
69
|
+
border-color: var(--utrecht-form-toggle-disabled-border-color, var(--utrecht-form-toggle-border-color, currentColor));
|
|
70
|
+
border-style: var(--utrecht-form-toggle-disabled-border-style, var(--utrecht-form-toggle-border-style, solid));
|
|
71
|
+
border-width: var(--utrecht-form-toggle-disabled-border-width, var(--utrecht-form-toggle-border-width, 1px));
|
|
72
|
+
cursor: var(--utrecht-action-disabled-cursor, not-allowed);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.utrecht-form-toggle__thumb {
|
|
76
|
+
/* To have a circle or square by default (1:1 aspect ratio) we use the `min-inline-size` design token for both `inline` and `block` direction. */
|
|
77
|
+
background-color: var(--utrecht-form-toggle-thumb-background-color, currentColor);
|
|
78
|
+
border-radius: var(--utrecht-form-toggle-thumb-border-radius, 50%);
|
|
79
|
+
box-shadow: var(--utrecht-form-toggle-thumb-box-shadow);
|
|
80
|
+
margin-inline-end: var(--utrecht-form-toggle-thumb-margin-inline-end, 0);
|
|
81
|
+
margin-inline-start: var(--utrecht-form-toggle-thumb-margin-inline-start, 0);
|
|
82
|
+
min-block-size: var(--utrecht-form-toggle-thumb-min-inline-size, 1.5em);
|
|
83
|
+
min-inline-size: var(--utrecht-form-toggle-thumb-min-inline-size, 1.5em);
|
|
84
|
+
z-index: 20;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.utrecht-form-toggle__thumb--checked, .utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:checked ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
88
|
+
margin-inline-start: auto;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.utrecht-form-toggle__thumb--not-checked, .utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:not(:checked) ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
92
|
+
margin-inline-end: auto;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.utrecht-form-toggle__thumb--disabled, .utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:disabled ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
96
|
+
background-color: var(--utrecht-form-toggle-thumb-disabled-background-color, #aaa);
|
|
97
|
+
box-shadow: var(--utrecht-form-toggle-thumb-disabled-box-shadow, 0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.utrecht-form-toggle__track {
|
|
101
|
+
align-items: center;
|
|
102
|
+
background-color: var(--utrecht-form-toggle-accent-color);
|
|
103
|
+
block-size: 100%;
|
|
104
|
+
border-radius: var(--utrecht-form-toggle-track-border-radius, var(--utrecht-form-toggle-border-radius));
|
|
105
|
+
display: flex;
|
|
106
|
+
inline-size: 100%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.utrecht-form-toggle__track--html-label {
|
|
110
|
+
cursor: inherit;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.utrecht-form-toggle__track--checked, .utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:checked ~ .utrecht-form-toggle__track {
|
|
114
|
+
background-color: var(--utrecht-form-toggle-checked-accent-color, var(--utrecht-form-toggle-accent-color));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.utrecht-form-toggle__track--disabled, .utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:disabled ~ .utrecht-form-toggle__track {
|
|
118
|
+
background-color: var(--utrecht-form-toggle-background-disabled-background-color, #ddd);
|
|
119
|
+
color: var(--utrecht-form-toggle-disabled-color, black);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.utrecht-form-toggle__track--focus-visible {
|
|
123
|
+
/* - The browser default focus ring should apply when these CSS custom properties are not set.
|
|
124
|
+
* - Make the `box-shadow` value available, so components that have their own `box-shadow`
|
|
125
|
+
* can combine it with the focus ring box shadow.
|
|
126
|
+
*/
|
|
127
|
+
--_utrecht-focus-ring-box-shadow: 0 0 0 var(--utrecht-focus-outline-width, 0)
|
|
128
|
+
var(--utrecht-focus-inverse-outline-color, transparent);
|
|
129
|
+
box-shadow: var(--_utrecht-focus-ring-box-shadow);
|
|
130
|
+
outline-color: var(--utrecht-focus-outline-color, revert);
|
|
131
|
+
outline-offset: var(--utrecht-focus-outline-offset, revert);
|
|
132
|
+
outline-style: var(--utrecht-focus-outline-style, revert);
|
|
133
|
+
outline-width: var(--utrecht-focus-outline-width, revert);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox {
|
|
137
|
+
/* Source: https://kittygiraudel.com/snippets/sr-only-class/ */
|
|
138
|
+
block-size: 1px !important;
|
|
139
|
+
border: 0 !important;
|
|
140
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
141
|
+
-webkit-clip-path: inset(50%) !important;
|
|
142
|
+
clip-path: inset(50%) !important;
|
|
143
|
+
inline-size: 1px !important;
|
|
144
|
+
/* stylelint-disable-next-line property-disallowed-list */
|
|
145
|
+
margin: -1px !important;
|
|
146
|
+
overflow: hidden !important;
|
|
147
|
+
/* stylelint-disable-next-line property-disallowed-list */
|
|
148
|
+
padding: 0 !important;
|
|
149
|
+
position: absolute !important;
|
|
150
|
+
white-space: nowrap !important;
|
|
151
|
+
}
|
|
152
|
+
.utrecht-form-toggle--html-checkbox .utrecht-form-toggle__checkbox:focus-visible ~ .utrecht-form-toggle__track {
|
|
153
|
+
/* - The browser default focus ring should apply when these CSS custom properties are not set.
|
|
154
|
+
* - Make the `box-shadow` value available, so components that have their own `box-shadow`
|
|
155
|
+
* can combine it with the focus ring box shadow.
|
|
156
|
+
*/
|
|
157
|
+
--_utrecht-focus-ring-box-shadow: 0 0 0 var(--utrecht-focus-outline-width, 0)
|
|
158
|
+
var(--utrecht-focus-inverse-outline-color, transparent);
|
|
159
|
+
box-shadow: var(--_utrecht-focus-ring-box-shadow);
|
|
160
|
+
outline-color: var(--utrecht-focus-outline-color, revert);
|
|
161
|
+
outline-offset: var(--utrecht-focus-outline-offset, revert);
|
|
162
|
+
outline-style: var(--utrecht-focus-outline-style, revert);
|
|
163
|
+
outline-width: var(--utrecht-focus-outline-width, revert);
|
|
164
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var undefined$1 = undefined;export{undefined$1 as default};
|
package/package.json
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.2.0",
|
|
3
3
|
"author": "Community for NL Design System",
|
|
4
4
|
"description": "Form toggle component for the Municipality of Utrecht based on the NL Design System architecture",
|
|
5
5
|
"license": "EUPL-1.2",
|
|
6
6
|
"name": "@utrecht/form-toggle-css",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist/"
|
|
8
|
+
"dist/",
|
|
9
|
+
"docs/",
|
|
10
|
+
"src/",
|
|
11
|
+
"*.md"
|
|
9
12
|
],
|
|
10
|
-
"
|
|
13
|
+
"main": "dist/index.css",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"rollup": "4.18.0",
|
|
16
|
+
"@utrecht/focus-ring-css": "1.1.0"
|
|
17
|
+
},
|
|
11
18
|
"keywords": [
|
|
12
19
|
"nl-design-system"
|
|
13
20
|
],
|
|
14
21
|
"publishConfig": {
|
|
15
22
|
"access": "public"
|
|
16
23
|
},
|
|
17
|
-
"
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git+ssh",
|
|
26
|
+
"url": "git@github.com:nl-design-system/utrecht.git",
|
|
27
|
+
"directory": "components/form-toggle"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "rollup -c ../rollup.config.mjs",
|
|
31
|
+
"clean": "rimraf dist"
|
|
32
|
+
}
|
|
18
33
|
}
|
package/src/_mixin.scss
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import "~@utrecht/focus-ring-css/src/mixin";
|
|
7
|
+
|
|
8
|
+
@mixin invisible-but-focusable {
|
|
9
|
+
/* Source: https://kittygiraudel.com/snippets/sr-only-class/ */
|
|
10
|
+
block-size: 1px !important;
|
|
11
|
+
border: 0 !important;
|
|
12
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
13
|
+
-webkit-clip-path: inset(50%) !important;
|
|
14
|
+
clip-path: inset(50%) !important;
|
|
15
|
+
inline-size: 1px !important;
|
|
16
|
+
/* stylelint-disable-next-line property-disallowed-list */
|
|
17
|
+
margin: -1px !important;
|
|
18
|
+
overflow: hidden !important;
|
|
19
|
+
/* stylelint-disable-next-line property-disallowed-list */
|
|
20
|
+
padding: 0 !important;
|
|
21
|
+
position: absolute !important;
|
|
22
|
+
white-space: nowrap !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin utrecht-form-toggle {
|
|
26
|
+
align-items: center;
|
|
27
|
+
block-size: var(--utrecht-form-toggle-height, 2em);
|
|
28
|
+
border-color: var(--utrecht-form-toggle-border-color, currentColor);
|
|
29
|
+
border-radius: var(--utrecht-form-toggle-border-radius, 999rem);
|
|
30
|
+
border-style: var(--utrecht-form-toggle-border-style, solid);
|
|
31
|
+
border-width: var(--utrecht-form-toggle-border-width, 1px);
|
|
32
|
+
color: var(--utrecht-form-toggle-color);
|
|
33
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
34
|
+
display: flex;
|
|
35
|
+
inline-size: var(--utrecht-form-toggle-width, 6em);
|
|
36
|
+
padding-block-end: var(--utrecht-form-toggle-padding-block-end);
|
|
37
|
+
padding-block-start: var(--utrecht-form-toggle-padding-block-start);
|
|
38
|
+
padding-inline-end: var(--utrecht-form-toggle-padding-inline-end);
|
|
39
|
+
padding-inline-start: var(--utrecht-form-toggle-padding-inline-start);
|
|
40
|
+
position: relative;
|
|
41
|
+
-webkit-user-select: none;
|
|
42
|
+
user-select: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@mixin utrecht-form-toggle--media-query-forced-colors {
|
|
46
|
+
@media screen and (-ms-high-contrast: active), screen and (forced-colors: active) {
|
|
47
|
+
--utrecht-form-toggle-background-color: ButtonFace;
|
|
48
|
+
--utrecht-form-toggle-border-color: buttonborder;
|
|
49
|
+
--utrecht-form-toggle-border-width: 1px;
|
|
50
|
+
--utrecht-form-toggle-border-radius: var(--utrecht-form-toggle-track-border-radius);
|
|
51
|
+
--utrecht-form-toggle-thumb-background-color: ButtonText;
|
|
52
|
+
--utrecht-form-toggle-thumb-disabled-background-color: GrayText;
|
|
53
|
+
|
|
54
|
+
/* TODO: Apply `GrayText` to the border-color */
|
|
55
|
+
border-color: var(--utrecht-form-toggle-track-disabled-border-color, var(--utrecht-form-toggle-track-border-color));
|
|
56
|
+
border-width: min(var(--utrecht-form-toggle-border-width, 1px), 1px);
|
|
57
|
+
|
|
58
|
+
/* TODO: Find a way to express the `pressed` state */
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@mixin utrecht-form-toggle--disabled {
|
|
63
|
+
border-color: var(--utrecht-form-toggle-disabled-border-color, var(--utrecht-form-toggle-border-color, currentColor));
|
|
64
|
+
border-style: var(--utrecht-form-toggle-disabled-border-style, var(--utrecht-form-toggle-border-style, solid));
|
|
65
|
+
border-width: var(--utrecht-form-toggle-disabled-border-width, var(--utrecht-form-toggle-border-width, 1px));
|
|
66
|
+
cursor: var(--utrecht-action-disabled-cursor, not-allowed);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@mixin utrecht-form-toggle--focus {
|
|
70
|
+
// border-color: var(--utrecht-form-toggle-focus-border-color, var(--utrecht-form-toggle-border-color, currentColor));
|
|
71
|
+
// border-style: var(--utrecht-form-toggle-focus-border-style, var(--utrecht-form-toggle-border-style, solid));
|
|
72
|
+
// border-width: var(--utrecht-form-toggle-focus-border-width, var(--utrecht-form-toggle-border-width, 1px));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@mixin utrecht-form-toggle--focus-visible {
|
|
76
|
+
@include utrecht-focus-visible;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@mixin utrecht-form-toggle--hover {
|
|
80
|
+
background-color: var(--utrecht-form-toggle-hover-background-color, var(--utrecht-form-toggle-background-color));
|
|
81
|
+
color: var(--utrecht-form-toggle-hover-color, var(--utrecht-form-toggle-color));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@mixin utrecht-form-toggle__thumb {
|
|
85
|
+
/* To have a circle or square by default (1:1 aspect ratio) we use the `min-inline-size` design token for both `inline` and `block` direction. */
|
|
86
|
+
background-color: var(--utrecht-form-toggle-thumb-background-color, currentColor);
|
|
87
|
+
border-radius: var(--utrecht-form-toggle-thumb-border-radius, 50%);
|
|
88
|
+
box-shadow: var(--utrecht-form-toggle-thumb-box-shadow);
|
|
89
|
+
margin-inline-end: var(--utrecht-form-toggle-thumb-margin-inline-end, 0);
|
|
90
|
+
margin-inline-start: var(--utrecht-form-toggle-thumb-margin-inline-start, 0);
|
|
91
|
+
min-block-size: var(--utrecht-form-toggle-thumb-min-inline-size, 1.5em);
|
|
92
|
+
min-inline-size: var(--utrecht-form-toggle-thumb-min-inline-size, 1.5em);
|
|
93
|
+
z-index: 20;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@mixin utrecht-form-toggle__track--html-label {
|
|
97
|
+
cursor: inherit;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@mixin utrecht-form-toggle__thumb--checked {
|
|
101
|
+
margin-inline-start: auto;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@mixin utrecht-form-toggle__track {
|
|
105
|
+
align-items: center;
|
|
106
|
+
background-color: var(--utrecht-form-toggle-accent-color);
|
|
107
|
+
block-size: 100%;
|
|
108
|
+
border-radius: var(--utrecht-form-toggle-track-border-radius, var(--utrecht-form-toggle-border-radius));
|
|
109
|
+
display: flex;
|
|
110
|
+
inline-size: 100%;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@mixin utrecht-form-toggle__track--checked {
|
|
114
|
+
background-color: var(--utrecht-form-toggle-checked-accent-color, var(--utrecht-form-toggle-accent-color));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@mixin utrecht-form-toggle__track--disabled {
|
|
118
|
+
background-color: var(--utrecht-form-toggle-background-disabled-background-color, #ddd);
|
|
119
|
+
color: var(--utrecht-form-toggle-disabled-color, black);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@mixin utrecht-form-toggle__track--focus-visible {
|
|
123
|
+
@include utrecht-focus-ring;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@mixin utrecht-form-toggle__thumb--not-checked {
|
|
127
|
+
margin-inline-end: auto;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@mixin utrecht-form-toggle__thumb--disabled {
|
|
131
|
+
background-color: var(--utrecht-form-toggle-thumb-disabled-background-color, #aaa);
|
|
132
|
+
box-shadow: var(--utrecht-form-toggle-thumb-disabled-box-shadow, 0);
|
|
133
|
+
}
|
package/src/index.scss
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import "./mixin";
|
|
7
|
+
|
|
8
|
+
.utrecht-form-toggle {
|
|
9
|
+
@include utrecht-form-toggle;
|
|
10
|
+
@include utrecht-form-toggle--media-query-forced-colors;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.utrecht-form-toggle--focus {
|
|
14
|
+
@include utrecht-form-toggle--focus;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.utrecht-form-toggle--focus-visible {
|
|
18
|
+
@include utrecht-form-toggle--focus-visible;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.utrecht-form-toggle--hover {
|
|
22
|
+
@include utrecht-form-toggle--hover;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.utrecht-form-toggle--disabled {
|
|
26
|
+
@include utrecht-form-toggle--disabled;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.utrecht-form-toggle__thumb {
|
|
30
|
+
@include utrecht-form-toggle__thumb;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.utrecht-form-toggle__thumb--checked {
|
|
34
|
+
@include utrecht-form-toggle__thumb--checked;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.utrecht-form-toggle__thumb--not-checked {
|
|
38
|
+
@include utrecht-form-toggle__thumb--not-checked;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.utrecht-form-toggle__thumb--disabled {
|
|
42
|
+
@include utrecht-form-toggle__thumb--disabled;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.utrecht-form-toggle__track {
|
|
46
|
+
@include utrecht-form-toggle__track;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.utrecht-form-toggle__track--html-label {
|
|
50
|
+
@include utrecht-form-toggle__track--html-label;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.utrecht-form-toggle__track--checked {
|
|
54
|
+
@include utrecht-form-toggle__track--checked;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.utrecht-form-toggle__track--disabled {
|
|
58
|
+
@include utrecht-form-toggle__track--disabled;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.utrecht-form-toggle__track--focus-visible {
|
|
62
|
+
@include utrecht-form-toggle__track--focus-visible;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.utrecht-form-toggle--html-checkbox {
|
|
66
|
+
.utrecht-form-toggle__checkbox {
|
|
67
|
+
@include invisible-but-focusable;
|
|
68
|
+
|
|
69
|
+
&:focus-visible ~ .utrecht-form-toggle__track {
|
|
70
|
+
@include utrecht-form-toggle__track--focus-visible;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:checked ~ .utrecht-form-toggle__track {
|
|
74
|
+
@extend .utrecht-form-toggle__track--checked;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:checked ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
78
|
+
@extend .utrecht-form-toggle__thumb--checked;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:not(:checked) ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
82
|
+
@extend .utrecht-form-toggle__thumb--not-checked;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled ~ .utrecht-form-toggle__track {
|
|
86
|
+
@extend .utrecht-form-toggle__track--disabled;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:disabled ~ .utrecht-form-toggle__track .utrecht-form-toggle__thumb {
|
|
90
|
+
@extend .utrecht-form-toggle__thumb--disabled;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.utrecht-form-toggle--html-div {
|
|
96
|
+
&:focus {
|
|
97
|
+
@extend .utrecht-form-toggle--focus;
|
|
98
|
+
}
|
|
99
|
+
&:focus-visible {
|
|
100
|
+
@extend .utrecht-form-toggle--focus-visible;
|
|
101
|
+
}
|
|
102
|
+
&:hover {
|
|
103
|
+
@extend .utrecht-form-toggle--focus;
|
|
104
|
+
}
|
|
105
|
+
&:disabled {
|
|
106
|
+
@extend .utrecht-form-toggle--disabled;
|
|
107
|
+
}
|
|
108
|
+
}
|
package/src/tokens.json
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"form-toggle": {
|
|
4
|
+
"accent-color": {
|
|
5
|
+
"$extensions": {
|
|
6
|
+
"nl.nldesignsystem.css.property": {
|
|
7
|
+
"syntax": "<color>",
|
|
8
|
+
"inherits": true
|
|
9
|
+
},
|
|
10
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
11
|
+
},
|
|
12
|
+
"type": "color"
|
|
13
|
+
},
|
|
14
|
+
"background-color": {
|
|
15
|
+
"$extensions": {
|
|
16
|
+
"nl.nldesignsystem.css.property": {
|
|
17
|
+
"syntax": "<color>",
|
|
18
|
+
"inherits": true
|
|
19
|
+
},
|
|
20
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
21
|
+
},
|
|
22
|
+
"type": "color"
|
|
23
|
+
},
|
|
24
|
+
"border-color": {
|
|
25
|
+
"$extensions": {
|
|
26
|
+
"nl.nldesignsystem.css.property": {
|
|
27
|
+
"syntax": "<color>",
|
|
28
|
+
"inherits": true
|
|
29
|
+
},
|
|
30
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
31
|
+
},
|
|
32
|
+
"type": "color"
|
|
33
|
+
},
|
|
34
|
+
"border-style": {
|
|
35
|
+
"$extensions": {
|
|
36
|
+
"nl.nldesignsystem.css.property": {
|
|
37
|
+
"syntax": "*",
|
|
38
|
+
"inherits": true
|
|
39
|
+
},
|
|
40
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
41
|
+
},
|
|
42
|
+
"type": "other"
|
|
43
|
+
},
|
|
44
|
+
"border-radius": {
|
|
45
|
+
"$extensions": {
|
|
46
|
+
"nl.nldesignsystem.css.property": {
|
|
47
|
+
"syntax": "<length-percentage>",
|
|
48
|
+
"inherits": true
|
|
49
|
+
},
|
|
50
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
51
|
+
},
|
|
52
|
+
"type": "borderRadius"
|
|
53
|
+
},
|
|
54
|
+
"border-width": {
|
|
55
|
+
"$extensions": {
|
|
56
|
+
"nl.nldesignsystem.css.property": {
|
|
57
|
+
"syntax": "<length>",
|
|
58
|
+
"inherits": true
|
|
59
|
+
},
|
|
60
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
61
|
+
},
|
|
62
|
+
"type": "borderWidth"
|
|
63
|
+
},
|
|
64
|
+
"color": {
|
|
65
|
+
"$extensions": {
|
|
66
|
+
"nl.nldesignsystem.css.property": {
|
|
67
|
+
"syntax": "<color>",
|
|
68
|
+
"inherits": true
|
|
69
|
+
},
|
|
70
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
71
|
+
},
|
|
72
|
+
"type": "color"
|
|
73
|
+
},
|
|
74
|
+
"height": {
|
|
75
|
+
"$extensions": {
|
|
76
|
+
"nl.nldesignsystem.css.property": {
|
|
77
|
+
"syntax": "<length>",
|
|
78
|
+
"inherits": true
|
|
79
|
+
},
|
|
80
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
81
|
+
},
|
|
82
|
+
"type": "sizing"
|
|
83
|
+
},
|
|
84
|
+
"padding-inline-end": {
|
|
85
|
+
"$extensions": {
|
|
86
|
+
"nl.nldesignsystem.css.property": {
|
|
87
|
+
"syntax": "<length>",
|
|
88
|
+
"inherits": true
|
|
89
|
+
},
|
|
90
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
91
|
+
},
|
|
92
|
+
"type": "spacing"
|
|
93
|
+
},
|
|
94
|
+
"padding-inline-start": {
|
|
95
|
+
"$extensions": {
|
|
96
|
+
"nl.nldesignsystem.css.property": {
|
|
97
|
+
"syntax": "<length>",
|
|
98
|
+
"inherits": true
|
|
99
|
+
},
|
|
100
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
101
|
+
},
|
|
102
|
+
"type": "spacing"
|
|
103
|
+
},
|
|
104
|
+
"padding-block-end": {
|
|
105
|
+
"$extensions": {
|
|
106
|
+
"nl.nldesignsystem.css.property": {
|
|
107
|
+
"syntax": "<length>",
|
|
108
|
+
"inherits": true
|
|
109
|
+
},
|
|
110
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
111
|
+
},
|
|
112
|
+
"type": "spacing"
|
|
113
|
+
},
|
|
114
|
+
"padding-block-start": {
|
|
115
|
+
"$extensions": {
|
|
116
|
+
"nl.nldesignsystem.css.property": {
|
|
117
|
+
"syntax": "<length>",
|
|
118
|
+
"inherits": true
|
|
119
|
+
},
|
|
120
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
121
|
+
},
|
|
122
|
+
"type": "spacing"
|
|
123
|
+
},
|
|
124
|
+
"width": {
|
|
125
|
+
"$extensions": {
|
|
126
|
+
"nl.nldesignsystem.css.property": {
|
|
127
|
+
"syntax": "<length>",
|
|
128
|
+
"inherits": true
|
|
129
|
+
},
|
|
130
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
131
|
+
},
|
|
132
|
+
"type": "sizing"
|
|
133
|
+
},
|
|
134
|
+
"track": {
|
|
135
|
+
"border-color": {
|
|
136
|
+
"$extensions": {
|
|
137
|
+
"nl.nldesignsystem.css.property": {
|
|
138
|
+
"syntax": "<color>",
|
|
139
|
+
"inherits": true
|
|
140
|
+
},
|
|
141
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
142
|
+
},
|
|
143
|
+
"type": "color"
|
|
144
|
+
},
|
|
145
|
+
"border-radius": {
|
|
146
|
+
"$extensions": {
|
|
147
|
+
"nl.nldesignsystem.css.property": {
|
|
148
|
+
"syntax": "<length-percentage>",
|
|
149
|
+
"inherits": true
|
|
150
|
+
},
|
|
151
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
152
|
+
},
|
|
153
|
+
"type": "borderRadius"
|
|
154
|
+
},
|
|
155
|
+
"disabled": {
|
|
156
|
+
"background-color": {
|
|
157
|
+
"$extensions": {
|
|
158
|
+
"nl.nldesignsystem.css.property": {
|
|
159
|
+
"syntax": "<color>",
|
|
160
|
+
"inherits": true
|
|
161
|
+
},
|
|
162
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
163
|
+
},
|
|
164
|
+
"type": "color"
|
|
165
|
+
},
|
|
166
|
+
"border-color": {
|
|
167
|
+
"$extensions": {
|
|
168
|
+
"nl.nldesignsystem.css.property": {
|
|
169
|
+
"syntax": "<color>",
|
|
170
|
+
"inherits": true
|
|
171
|
+
},
|
|
172
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
173
|
+
},
|
|
174
|
+
"type": "color"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"thumb": {
|
|
179
|
+
"background-color": {
|
|
180
|
+
"$extensions": {
|
|
181
|
+
"nl.nldesignsystem.css.property": {
|
|
182
|
+
"syntax": "<color>",
|
|
183
|
+
"inherits": true
|
|
184
|
+
},
|
|
185
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
186
|
+
},
|
|
187
|
+
"type": "color"
|
|
188
|
+
},
|
|
189
|
+
"border-radius": {
|
|
190
|
+
"$extensions": {
|
|
191
|
+
"nl.nldesignsystem.css.property": {
|
|
192
|
+
"syntax": "<length-percentage>",
|
|
193
|
+
"inherits": true
|
|
194
|
+
},
|
|
195
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
196
|
+
},
|
|
197
|
+
"type": "borderRadius"
|
|
198
|
+
},
|
|
199
|
+
"box-shadow": {
|
|
200
|
+
"$extensions": {
|
|
201
|
+
"nl.nldesignsystem.css.property": {
|
|
202
|
+
"syntax": "*",
|
|
203
|
+
"inherits": true
|
|
204
|
+
},
|
|
205
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
206
|
+
},
|
|
207
|
+
"type": "boxShadow"
|
|
208
|
+
},
|
|
209
|
+
"margin-inline-start": {
|
|
210
|
+
"$extensions": {
|
|
211
|
+
"nl.nldesignsystem.css.property": {
|
|
212
|
+
"syntax": "<length>",
|
|
213
|
+
"inherits": true
|
|
214
|
+
},
|
|
215
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
216
|
+
},
|
|
217
|
+
"type": "spacing"
|
|
218
|
+
},
|
|
219
|
+
"margin-inline-end": {
|
|
220
|
+
"$extensions": {
|
|
221
|
+
"nl.nldesignsystem.css.property": {
|
|
222
|
+
"syntax": "<length>",
|
|
223
|
+
"inherits": true
|
|
224
|
+
},
|
|
225
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
226
|
+
},
|
|
227
|
+
"type": "spacing"
|
|
228
|
+
},
|
|
229
|
+
"min-inline-size": {
|
|
230
|
+
"$extensions": {
|
|
231
|
+
"nl.nldesignsystem.css.property": {
|
|
232
|
+
"syntax": "<length>",
|
|
233
|
+
"inherits": true
|
|
234
|
+
},
|
|
235
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
236
|
+
},
|
|
237
|
+
"type": "sizing"
|
|
238
|
+
},
|
|
239
|
+
"disabled": {
|
|
240
|
+
"box-shadow": {
|
|
241
|
+
"$extensions": {
|
|
242
|
+
"nl.nldesignsystem.css.property": {
|
|
243
|
+
"syntax": "*",
|
|
244
|
+
"inherits": true
|
|
245
|
+
},
|
|
246
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
247
|
+
},
|
|
248
|
+
"type": "boxShadow"
|
|
249
|
+
},
|
|
250
|
+
"background-color": {
|
|
251
|
+
"$extensions": {
|
|
252
|
+
"nl.nldesignsystem.css.property": {
|
|
253
|
+
"syntax": "<color>",
|
|
254
|
+
"inherits": true
|
|
255
|
+
},
|
|
256
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
257
|
+
},
|
|
258
|
+
"type": "color"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"checked": {
|
|
263
|
+
"accent-color": {
|
|
264
|
+
"$extensions": {
|
|
265
|
+
"nl.nldesignsystem.css.property": {
|
|
266
|
+
"syntax": "<color>",
|
|
267
|
+
"inherits": true
|
|
268
|
+
},
|
|
269
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
270
|
+
},
|
|
271
|
+
"type": "color"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"disabled": {
|
|
275
|
+
"border-color": {
|
|
276
|
+
"$extensions": {
|
|
277
|
+
"nl.nldesignsystem.css.property": {
|
|
278
|
+
"syntax": "<color>",
|
|
279
|
+
"inherits": true
|
|
280
|
+
},
|
|
281
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
282
|
+
},
|
|
283
|
+
"type": "color"
|
|
284
|
+
},
|
|
285
|
+
"border-style": {
|
|
286
|
+
"$extensions": {
|
|
287
|
+
"nl.nldesignsystem.css.property": {
|
|
288
|
+
"syntax": "*",
|
|
289
|
+
"inherits": true
|
|
290
|
+
},
|
|
291
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
292
|
+
},
|
|
293
|
+
"type": "other"
|
|
294
|
+
},
|
|
295
|
+
"border-width": {
|
|
296
|
+
"$extensions": {
|
|
297
|
+
"nl.nldesignsystem.css.property": {
|
|
298
|
+
"syntax": "<length>",
|
|
299
|
+
"inherits": true
|
|
300
|
+
},
|
|
301
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
302
|
+
},
|
|
303
|
+
"type": "borderWidth"
|
|
304
|
+
},
|
|
305
|
+
"color": {
|
|
306
|
+
"$extensions": {
|
|
307
|
+
"nl.nldesignsystem.css.property": {
|
|
308
|
+
"syntax": "<color>",
|
|
309
|
+
"inherits": true
|
|
310
|
+
},
|
|
311
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
312
|
+
},
|
|
313
|
+
"type": "color"
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"focus": {
|
|
317
|
+
"border-color": {
|
|
318
|
+
"$extensions": {
|
|
319
|
+
"nl.nldesignsystem.css.property": {
|
|
320
|
+
"syntax": "<color>",
|
|
321
|
+
"inherits": true
|
|
322
|
+
},
|
|
323
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
324
|
+
},
|
|
325
|
+
"type": "color"
|
|
326
|
+
},
|
|
327
|
+
"border-style": {
|
|
328
|
+
"$extensions": {
|
|
329
|
+
"nl.nldesignsystem.css.property": {
|
|
330
|
+
"syntax": "*",
|
|
331
|
+
"inherits": true
|
|
332
|
+
},
|
|
333
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
334
|
+
},
|
|
335
|
+
"type": "other"
|
|
336
|
+
},
|
|
337
|
+
"border-width": {
|
|
338
|
+
"$extensions": {
|
|
339
|
+
"nl.nldesignsystem.css.property": {
|
|
340
|
+
"syntax": "<length>",
|
|
341
|
+
"inherits": true
|
|
342
|
+
},
|
|
343
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
344
|
+
},
|
|
345
|
+
"type": "borderWidth"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"hover": {
|
|
349
|
+
"background-color": {
|
|
350
|
+
"$extensions": {
|
|
351
|
+
"nl.nldesignsystem.css.property": {
|
|
352
|
+
"syntax": "<color>",
|
|
353
|
+
"inherits": true
|
|
354
|
+
},
|
|
355
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
356
|
+
},
|
|
357
|
+
"type": "color"
|
|
358
|
+
},
|
|
359
|
+
"color": {
|
|
360
|
+
"$extensions": {
|
|
361
|
+
"nl.nldesignsystem.css.property": {
|
|
362
|
+
"syntax": "<color>",
|
|
363
|
+
"inherits": true
|
|
364
|
+
},
|
|
365
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
366
|
+
},
|
|
367
|
+
"type": "color"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|