@utrecht/form-label-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/dist/index.css +34 -0
- package/dist/index.js +1 -0
- package/package.json +18 -4
- package/src/_mixin.scss +31 -0
- package/src/html/_mixin.scss +20 -0
- package/src/html/index.scss +8 -0
- package/src/index.scss +26 -0
- package/src/story-template.jsx +58 -0
- package/src/tokens.json +108 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @utrecht/form-label-css
|
|
2
|
+
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4c13489: Added metadata for form-label 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/dist/index.css
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
.utrecht-form-label {
|
|
10
|
+
color: var(--utrecht-form-label-color);
|
|
11
|
+
font-size: var(--utrecht-form-label-font-size);
|
|
12
|
+
font-weight: var(--utrecht-form-label-font-weight);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.utrecht-form-label--checkbox {
|
|
16
|
+
color: var(--utrecht-form-label-checkbox-color, var(--utrecht-form-label-color));
|
|
17
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
18
|
+
font-weight: var(--utrecht-form-label-checkbox-font-weight, var(--utrecht-form-label-font-weight));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.utrecht-form-label--checked {
|
|
22
|
+
font-weight: var(--utrecht-form-label-checked-font-weight, var(--utrecht-form-label-font-weight));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.utrecht-form-label--disabled {
|
|
26
|
+
color: var(--utrecht-form-label-disabled-color, var(--utrecht-form-label-color));
|
|
27
|
+
cursor: var(--utrecht-action-disabled-cursor, revert);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.utrecht-form-label--radio {
|
|
31
|
+
color: var(--utrecht-form-label-checkbox-color, var(--utrecht-form-label-color));
|
|
32
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
33
|
+
font-weight: var(--utrecht-form-label-radio-font-weight, var(--utrecht-form-label-font-weight));
|
|
34
|
+
}
|
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,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.2.0",
|
|
3
3
|
"author": "Community for NL Design System",
|
|
4
4
|
"description": "Form label component for the Municipality of Utrecht based on the NL Design System architecture",
|
|
5
5
|
"license": "EUPL-1.2",
|
|
6
6
|
"name": "@utrecht/form-label-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
|
+
},
|
|
11
17
|
"keywords": [
|
|
12
18
|
"nl-design-system"
|
|
13
19
|
],
|
|
14
20
|
"publishConfig": {
|
|
15
21
|
"access": "public"
|
|
16
22
|
},
|
|
17
|
-
"
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git+ssh",
|
|
25
|
+
"url": "git@github.com:nl-design-system/utrecht.git",
|
|
26
|
+
"directory": "components/form-label"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "rollup -c ../rollup.config.mjs",
|
|
30
|
+
"clean": "rimraf dist"
|
|
31
|
+
}
|
|
18
32
|
}
|
package/src/_mixin.scss
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@mixin utrecht-form-label {
|
|
7
|
+
color: var(--utrecht-form-label-color);
|
|
8
|
+
font-size: var(--utrecht-form-label-font-size);
|
|
9
|
+
font-weight: var(--utrecht-form-label-font-weight);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin utrecht-form-label--checkbox {
|
|
13
|
+
color: var(--utrecht-form-label-checkbox-color, var(--utrecht-form-label-color));
|
|
14
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
15
|
+
font-weight: var(--utrecht-form-label-checkbox-font-weight, var(--utrecht-form-label-font-weight));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin utrecht-form-label--checked {
|
|
19
|
+
font-weight: var(--utrecht-form-label-checked-font-weight, var(--utrecht-form-label-font-weight));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@mixin utrecht-form-label--disabled {
|
|
23
|
+
color: var(--utrecht-form-label-disabled-color, var(--utrecht-form-label-color));
|
|
24
|
+
cursor: var(--utrecht-action-disabled-cursor, revert);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin utrecht-form-label--radio {
|
|
28
|
+
color: var(--utrecht-form-label-checkbox-color, var(--utrecht-form-label-color));
|
|
29
|
+
cursor: var(--utrecht-action-activate-cursor, revert);
|
|
30
|
+
font-weight: var(--utrecht-form-label-radio-font-weight, var(--utrecht-form-label-font-weight));
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import "../mixin";
|
|
7
|
+
|
|
8
|
+
@mixin utrecht-html-label {
|
|
9
|
+
label {
|
|
10
|
+
@include utrecht-form-label;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
input[type="checkbox" i] ~ label {
|
|
14
|
+
@include utrecht-form-label--checkbox;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input[type="radio" i] ~ label {
|
|
18
|
+
@include utrecht-form-label--radio;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.scss
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import "./mixin";
|
|
7
|
+
|
|
8
|
+
.utrecht-form-label {
|
|
9
|
+
@include utrecht-form-label;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.utrecht-form-label--checkbox {
|
|
13
|
+
@include utrecht-form-label--checkbox;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.utrecht-form-label--checked {
|
|
17
|
+
@include utrecht-form-label--checked;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.utrecht-form-label--disabled {
|
|
21
|
+
@include utrecht-form-label--disabled;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.utrecht-form-label--radio {
|
|
25
|
+
@include utrecht-form-label--radio;
|
|
26
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2020-2022 Gemeente Utrecht
|
|
4
|
+
* Copyright (c) 2020-2022 Frameless B.V.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
export const argTypes = {
|
|
11
|
+
textContent: {
|
|
12
|
+
description: 'Set the content of the label',
|
|
13
|
+
control: 'text',
|
|
14
|
+
},
|
|
15
|
+
type: {
|
|
16
|
+
description: 'Set the type of the form control',
|
|
17
|
+
options: ['default', 'checkbox', 'radio'],
|
|
18
|
+
control: { type: 'radio' },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const defaultArgs = {
|
|
23
|
+
checked: false,
|
|
24
|
+
disabled: false,
|
|
25
|
+
textContent: '',
|
|
26
|
+
type: null,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const exampleArgs = {
|
|
30
|
+
textContent: 'Username',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const FormLabel = ({
|
|
34
|
+
checked = defaultArgs.checked,
|
|
35
|
+
disabled = defaultArgs.disabled,
|
|
36
|
+
textContent = defaultArgs.textContent,
|
|
37
|
+
type = defaultArgs.type,
|
|
38
|
+
className,
|
|
39
|
+
children,
|
|
40
|
+
...restProps
|
|
41
|
+
}) => (
|
|
42
|
+
<label
|
|
43
|
+
{...restProps}
|
|
44
|
+
className={clsx(
|
|
45
|
+
'utrecht-form-label',
|
|
46
|
+
type === 'checkbox' && 'utrecht-form-label--checkbox',
|
|
47
|
+
checked && 'utrecht-form-label--checked',
|
|
48
|
+
disabled && 'utrecht-form-label--disabled',
|
|
49
|
+
type === 'radio' && 'utrecht-form-label--radio',
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
>
|
|
53
|
+
{textContent}
|
|
54
|
+
{children}
|
|
55
|
+
</label>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export default FormLabel;
|
package/src/tokens.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"form-label": {
|
|
4
|
+
"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
|
+
"font-weight": {
|
|
15
|
+
"$extensions": {
|
|
16
|
+
"nl.nldesignsystem.css.property": {
|
|
17
|
+
"syntax": "<number>",
|
|
18
|
+
"inherits": true
|
|
19
|
+
},
|
|
20
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
21
|
+
},
|
|
22
|
+
"type": "fontWeights"
|
|
23
|
+
},
|
|
24
|
+
"font-size": {
|
|
25
|
+
"$extensions": {
|
|
26
|
+
"nl.nldesignsystem.css.property": {
|
|
27
|
+
"syntax": "<length>",
|
|
28
|
+
"inherits": true
|
|
29
|
+
},
|
|
30
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
31
|
+
},
|
|
32
|
+
"type": "fontSizes"
|
|
33
|
+
},
|
|
34
|
+
"checkbox": {
|
|
35
|
+
"color": {
|
|
36
|
+
"$extensions": {
|
|
37
|
+
"nl.nldesignsystem.css.property": {
|
|
38
|
+
"syntax": "<color>",
|
|
39
|
+
"inherits": true
|
|
40
|
+
},
|
|
41
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
42
|
+
},
|
|
43
|
+
"type": "color"
|
|
44
|
+
},
|
|
45
|
+
"font-weight": {
|
|
46
|
+
"$extensions": {
|
|
47
|
+
"nl.nldesignsystem.css.property": {
|
|
48
|
+
"syntax": "<number>",
|
|
49
|
+
"inherits": true
|
|
50
|
+
},
|
|
51
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
52
|
+
},
|
|
53
|
+
"type": "fontWeights"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"checked": {
|
|
57
|
+
"font-weight": {
|
|
58
|
+
"$extensions": {
|
|
59
|
+
"nl.nldesignsystem.css.property": {
|
|
60
|
+
"syntax": "<number>",
|
|
61
|
+
"inherits": true
|
|
62
|
+
},
|
|
63
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.font-weight"],
|
|
64
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
65
|
+
},
|
|
66
|
+
"type": "fontWeights"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"disabled": {
|
|
70
|
+
"color": {
|
|
71
|
+
"$extensions": {
|
|
72
|
+
"nl.nldesignsystem.css.property": {
|
|
73
|
+
"syntax": "<color>",
|
|
74
|
+
"inherits": true
|
|
75
|
+
},
|
|
76
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.color"],
|
|
77
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
78
|
+
},
|
|
79
|
+
"type": "color"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"radio": {
|
|
83
|
+
"color": {
|
|
84
|
+
"$extensions": {
|
|
85
|
+
"nl.nldesignsystem.css.property": {
|
|
86
|
+
"syntax": "<color>",
|
|
87
|
+
"inherits": true
|
|
88
|
+
},
|
|
89
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.checkbox.color", "utrecht.form-label.color"],
|
|
90
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
91
|
+
},
|
|
92
|
+
"type": "color"
|
|
93
|
+
},
|
|
94
|
+
"font-weight": {
|
|
95
|
+
"$extensions": {
|
|
96
|
+
"nl.nldesignsystem.css.property": {
|
|
97
|
+
"syntax": "<number>",
|
|
98
|
+
"inherits": true
|
|
99
|
+
},
|
|
100
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.checkbox.font-weight", "utrecht.form-label.font-weight"],
|
|
101
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
102
|
+
},
|
|
103
|
+
"type": "fontWeights"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|