@utrecht/form-label-css 1.0.0 → 1.1.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/dist/index.css +34 -0
- package/dist/index.js +1 -0
- package/package.json +11 -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 +90 -0
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,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.1.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
|
+
"src/"
|
|
9
10
|
],
|
|
10
|
-
"
|
|
11
|
+
"main": "dist/index.css",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"rollup": "3.29.4"
|
|
14
|
+
},
|
|
11
15
|
"keywords": [
|
|
12
16
|
"nl-design-system"
|
|
13
17
|
],
|
|
14
18
|
"publishConfig": {
|
|
15
19
|
"access": "public"
|
|
16
20
|
},
|
|
17
|
-
"scripts": {
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rollup -c ../rollup.config.mjs",
|
|
23
|
+
"clean": "rimraf dist"
|
|
24
|
+
}
|
|
18
25
|
}
|
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,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"form-label": {
|
|
4
|
+
"color": {
|
|
5
|
+
"$extensions": {
|
|
6
|
+
"nl.nldesignsystem.css.property": {
|
|
7
|
+
"syntax": "<color>",
|
|
8
|
+
"inherits": true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"font-weight": {
|
|
13
|
+
"$extensions": {
|
|
14
|
+
"nl.nldesignsystem.css.property": {
|
|
15
|
+
"syntax": "<number>",
|
|
16
|
+
"inherits": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"font-size": {
|
|
21
|
+
"$extensions": {
|
|
22
|
+
"nl.nldesignsystem.css.property": {
|
|
23
|
+
"syntax": "<length>",
|
|
24
|
+
"inherits": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"checkbox": {
|
|
29
|
+
"color": {
|
|
30
|
+
"$extensions": {
|
|
31
|
+
"nl.nldesignsystem.css.property": {
|
|
32
|
+
"syntax": "<color>",
|
|
33
|
+
"inherits": true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"font-weight": {
|
|
38
|
+
"$extensions": {
|
|
39
|
+
"nl.nldesignsystem.css.property": {
|
|
40
|
+
"syntax": "<number>",
|
|
41
|
+
"inherits": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"checked": {
|
|
47
|
+
"font-weight": {
|
|
48
|
+
"$extensions": {
|
|
49
|
+
"nl.nldesignsystem.css.property": {
|
|
50
|
+
"syntax": "<number>",
|
|
51
|
+
"inherits": true
|
|
52
|
+
},
|
|
53
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.font-weight"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"disabled": {
|
|
58
|
+
"color": {
|
|
59
|
+
"$extensions": {
|
|
60
|
+
"nl.nldesignsystem.css.property": {
|
|
61
|
+
"syntax": "<color>",
|
|
62
|
+
"inherits": true
|
|
63
|
+
},
|
|
64
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.color"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"radio": {
|
|
69
|
+
"color": {
|
|
70
|
+
"$extensions": {
|
|
71
|
+
"nl.nldesignsystem.css.property": {
|
|
72
|
+
"syntax": "<color>",
|
|
73
|
+
"inherits": true
|
|
74
|
+
},
|
|
75
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.checkbox.color", "utrecht.form-label.color"]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"font-weight": {
|
|
79
|
+
"$extensions": {
|
|
80
|
+
"nl.nldesignsystem.css.property": {
|
|
81
|
+
"syntax": "<number>",
|
|
82
|
+
"inherits": true
|
|
83
|
+
},
|
|
84
|
+
"nl.nldesignsystem.fallback": ["utrecht.form-label.checkbox.font-weight", "utrecht.form-label.font-weight"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|