@utrecht/form-field-description-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/dist/index.css +37 -0
- package/dist/index.js +1 -0
- package/package.json +16 -4
- package/src/_mixin.scss +48 -0
- package/src/index.scss +26 -0
- package/src/story-template.jsx +63 -0
- package/src/tokens.json +109 -0
package/dist/index.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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-field-description {
|
|
10
|
+
--utrecht-document-color: currentColor;
|
|
11
|
+
color: var(--utrecht-form-field-description-color);
|
|
12
|
+
font-family: var(--utrecht-document-font-family, inherit);
|
|
13
|
+
font-size: var(--utrecht-form-field-description-font-size, inherit);
|
|
14
|
+
font-style: var(--utrecht-form-field-description-font-style);
|
|
15
|
+
line-height: var(--utrecht-form-field-description-line-height);
|
|
16
|
+
margin-block-end: calc(var(--utrecht-space-around, 0) * var(--utrecht-form-field-description-margin-block-end, var(--utrecht-paragraph-margin-block-end, 0)));
|
|
17
|
+
margin-block-start: calc(var(--utrecht-space-around, 0) * var(--utrecht-form-field-description-margin-block-start, var(--utrecht-paragraph-margin-block-start, 0)));
|
|
18
|
+
}
|
|
19
|
+
.utrecht-form-field-description > * {
|
|
20
|
+
--utrecht-space-around: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.utrecht-form-field-description--distanced {
|
|
24
|
+
--utrecht-space-around: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.utrecht-form-field-description--invalid {
|
|
28
|
+
color: var(--utrecht-form-field-description-invalid-color, var(--utrecht-feedback-invalid-color, var(--utrecht-feedback-danger-color)));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.utrecht-form-field-description--valid {
|
|
32
|
+
color: var(--utrecht-form-field-description-valid-color, var(--utrecht-feedback-valid-color, var(--utrecht-feedback-safe-color)));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.utrecht-form-field-description--warning {
|
|
36
|
+
color: var(--utrecht-form-field-description-warning-color, var(--utrecht-feedback-warning-color));
|
|
37
|
+
}
|
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,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.2.0",
|
|
3
3
|
"author": "Community for NL Design System",
|
|
4
4
|
"description": "Form field description component for the Municipality of Utrecht based on the NL Design System architecture",
|
|
5
5
|
"license": "EUPL-1.2",
|
|
6
6
|
"name": "@utrecht/form-field-description-css",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist/"
|
|
8
|
+
"dist/",
|
|
9
|
+
"src/"
|
|
9
10
|
],
|
|
10
|
-
"
|
|
11
|
+
"main": "dist/index.css",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"rollup": "4.18.0"
|
|
14
|
+
},
|
|
11
15
|
"keywords": [
|
|
12
16
|
"nl-design-system"
|
|
13
17
|
],
|
|
14
18
|
"publishConfig": {
|
|
15
19
|
"access": "public"
|
|
16
20
|
},
|
|
17
|
-
"
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git+ssh",
|
|
23
|
+
"url": "git@github.com:nl-design-system/utrecht.git",
|
|
24
|
+
"directory": "components/form-field-description"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup -c ../rollup.config.mjs",
|
|
28
|
+
"clean": "rimraf dist"
|
|
29
|
+
}
|
|
18
30
|
}
|
package/src/_mixin.scss
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@mixin utrecht-form-field-description {
|
|
7
|
+
--utrecht-document-color: currentColor;
|
|
8
|
+
|
|
9
|
+
color: var(--utrecht-form-field-description-color);
|
|
10
|
+
font-family: var(--utrecht-document-font-family, inherit);
|
|
11
|
+
font-size: var(--utrecht-form-field-description-font-size, inherit);
|
|
12
|
+
font-style: var(--utrecht-form-field-description-font-style);
|
|
13
|
+
line-height: var(--utrecht-form-field-description-line-height);
|
|
14
|
+
margin-block-end: calc(
|
|
15
|
+
var(--utrecht-space-around, 0) *
|
|
16
|
+
var(--utrecht-form-field-description-margin-block-end, var(--utrecht-paragraph-margin-block-end, 0))
|
|
17
|
+
);
|
|
18
|
+
margin-block-start: calc(
|
|
19
|
+
var(--utrecht-space-around, 0) *
|
|
20
|
+
var(--utrecht-form-field-description-margin-block-start, var(--utrecht-paragraph-margin-block-start, 0))
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
& > * {
|
|
24
|
+
--utrecht-space-around: 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@mixin utrecht-form-field-description--distanced {
|
|
29
|
+
--utrecht-space-around: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@mixin utrecht-form-field-description--invalid {
|
|
33
|
+
color: var(
|
|
34
|
+
--utrecht-form-field-description-invalid-color,
|
|
35
|
+
var(--utrecht-feedback-invalid-color, var(--utrecht-feedback-danger-color))
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@mixin utrecht-form-field-description--valid {
|
|
40
|
+
color: var(
|
|
41
|
+
--utrecht-form-field-description-valid-color,
|
|
42
|
+
var(--utrecht-feedback-valid-color, var(--utrecht-feedback-safe-color))
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@mixin utrecht-form-field-description--warning {
|
|
47
|
+
color: var(--utrecht-form-field-description-warning-color, var(--utrecht-feedback-warning-color));
|
|
48
|
+
}
|
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-field-description {
|
|
9
|
+
@include utrecht-form-field-description;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.utrecht-form-field-description--distanced {
|
|
13
|
+
@include utrecht-form-field-description--distanced;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.utrecht-form-field-description--invalid {
|
|
17
|
+
@include utrecht-form-field-description--invalid;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.utrecht-form-field-description--valid {
|
|
21
|
+
@include utrecht-form-field-description--valid;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.utrecht-form-field-description--warning {
|
|
25
|
+
@include utrecht-form-field-description--warning;
|
|
26
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 parse from 'html-react-parser';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
export const argTypes = {
|
|
12
|
+
id: {
|
|
13
|
+
description: 'Unique identifier to associate it with a form input',
|
|
14
|
+
control: 'text',
|
|
15
|
+
},
|
|
16
|
+
innerHTML: {
|
|
17
|
+
description: 'Set the content of the description',
|
|
18
|
+
control: 'text',
|
|
19
|
+
},
|
|
20
|
+
status: {
|
|
21
|
+
type: {
|
|
22
|
+
name: 'enum',
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
description: 'Status',
|
|
26
|
+
options: ['', 'invalid', 'valid'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const defaultArgs = {
|
|
31
|
+
id: null,
|
|
32
|
+
innerHTML: '',
|
|
33
|
+
status: '',
|
|
34
|
+
distanced: false,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const exampleArgs = {};
|
|
38
|
+
|
|
39
|
+
export const FormFieldDescription = ({
|
|
40
|
+
id = defaultArgs.id,
|
|
41
|
+
innerHTML = defaultArgs.innerHTML,
|
|
42
|
+
status = defaultArgs.status,
|
|
43
|
+
distanced = defaultArgs.distanced,
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
}) => (
|
|
47
|
+
<div
|
|
48
|
+
id={id}
|
|
49
|
+
className={clsx(
|
|
50
|
+
'utrecht-form-field-description',
|
|
51
|
+
distanced && 'utrecht-form-field-description--distanced',
|
|
52
|
+
status === 'invalid' && 'utrecht-form-field-description--invalid',
|
|
53
|
+
status === 'valid' && 'utrecht-form-field-description--valid',
|
|
54
|
+
status === 'warning' && 'utrecht-form-field-description--warning',
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
{parse(innerHTML)}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export default FormFieldDescription;
|
package/src/tokens.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"form-field-description": {
|
|
4
|
+
"color": {
|
|
5
|
+
"$extensions": {
|
|
6
|
+
"nl.nldesignsystem.css.property": {
|
|
7
|
+
"syntax": "<color>",
|
|
8
|
+
"inherits": true
|
|
9
|
+
},
|
|
10
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
11
|
+
},
|
|
12
|
+
"type": "color"
|
|
13
|
+
},
|
|
14
|
+
"font-family": {
|
|
15
|
+
"$extensions": {
|
|
16
|
+
"nl.nldesignsystem.css.property": {
|
|
17
|
+
"syntax": "*",
|
|
18
|
+
"inherits": true
|
|
19
|
+
},
|
|
20
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
21
|
+
},
|
|
22
|
+
"type": "fontFamilies"
|
|
23
|
+
},
|
|
24
|
+
"font-size": {
|
|
25
|
+
"$extensions": {
|
|
26
|
+
"nl.nldesignsystem.css.property": {
|
|
27
|
+
"syntax": "<length>",
|
|
28
|
+
"inherits": true
|
|
29
|
+
},
|
|
30
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
31
|
+
},
|
|
32
|
+
"type": "fontSizes"
|
|
33
|
+
},
|
|
34
|
+
"font-style": {
|
|
35
|
+
"$extensions": {
|
|
36
|
+
"nl.nldesignsystem.css.property": {
|
|
37
|
+
"syntax": "italic",
|
|
38
|
+
"inherits": true
|
|
39
|
+
},
|
|
40
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"line-height": {
|
|
44
|
+
"$extensions": {
|
|
45
|
+
"nl.nldesignsystem.css.property": {
|
|
46
|
+
"syntax": "<length>",
|
|
47
|
+
"inherits": true
|
|
48
|
+
},
|
|
49
|
+
"nl.nldesignsystem.figma.supports-token": true
|
|
50
|
+
},
|
|
51
|
+
"type": "lineHeights"
|
|
52
|
+
},
|
|
53
|
+
"margin-block-start": {
|
|
54
|
+
"$extensions": {
|
|
55
|
+
"nl.nldesignsystem.css.property": {
|
|
56
|
+
"syntax": "<length>",
|
|
57
|
+
"inherits": true
|
|
58
|
+
},
|
|
59
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
60
|
+
},
|
|
61
|
+
"type": "sizing"
|
|
62
|
+
},
|
|
63
|
+
"margin-block-end": {
|
|
64
|
+
"$extensions": {
|
|
65
|
+
"nl.nldesignsystem.css.property": {
|
|
66
|
+
"syntax": "<length>",
|
|
67
|
+
"inherits": true
|
|
68
|
+
},
|
|
69
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
70
|
+
},
|
|
71
|
+
"type": "sizing"
|
|
72
|
+
},
|
|
73
|
+
"invalid": {
|
|
74
|
+
"font-weight": {
|
|
75
|
+
"$extensions": {
|
|
76
|
+
"nl.nldesignsystem.css.property": {
|
|
77
|
+
"syntax": "<number>",
|
|
78
|
+
"inherits": true
|
|
79
|
+
},
|
|
80
|
+
"nl.nldesignsystem.deprecated": true,
|
|
81
|
+
"nl.nldesignsystem.redirect": "utrecht.form-field-error-message.font-weight",
|
|
82
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"color": {
|
|
86
|
+
"$extensions": {
|
|
87
|
+
"nl.nldesignsystem.css.property": {
|
|
88
|
+
"syntax": "<color>",
|
|
89
|
+
"inherits": true
|
|
90
|
+
},
|
|
91
|
+
"nl.nldesignsystem.deprecated": true,
|
|
92
|
+
"nl.nldesignsystem.redirect": "utrecht.form-field-error-message.color",
|
|
93
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"valid": {
|
|
98
|
+
"color": {
|
|
99
|
+
"$extensions": {
|
|
100
|
+
"nl.nldesignsystem.css.property": {
|
|
101
|
+
"syntax": "<color>",
|
|
102
|
+
"inherits": true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|