@utrecht/form-field-description-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 +36 -0
- package/dist/index.js +1 -0
- package/package.json +11 -4
- package/src/_mixin.scss +47 -0
- package/src/index.scss +26 -0
- package/src/story-template.jsx +63 -0
- package/src/tokens.json +89 -0
package/dist/index.css
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
margin-block-end: calc(var(--utrecht-space-around, 0) * var(--utrecht-form-field-description-margin-block-end, var(--utrecht-paragraph-margin-block-end, 0)));
|
|
16
|
+
margin-block-start: calc(var(--utrecht-space-around, 0) * var(--utrecht-form-field-description-margin-block-start, var(--utrecht-paragraph-margin-block-start, 0)));
|
|
17
|
+
}
|
|
18
|
+
.utrecht-form-field-description > * {
|
|
19
|
+
--utrecht-space-around: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.utrecht-form-field-description--distanced {
|
|
23
|
+
--utrecht-space-around: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.utrecht-form-field-description--invalid {
|
|
27
|
+
color: var(--utrecht-form-field-description-invalid-color, var(--utrecht-feedback-invalid-color, var(--utrecht-feedback-danger-color)));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.utrecht-form-field-description--valid {
|
|
31
|
+
color: var(--utrecht-form-field-description-valid-color, var(--utrecht-feedback-valid-color, var(--utrecht-feedback-safe-color)));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.utrecht-form-field-description--warning {
|
|
35
|
+
color: var(--utrecht-form-field-description-warning-color, var(--utrecht-feedback-warning-color));
|
|
36
|
+
}
|
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 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": "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,47 @@
|
|
|
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
|
+
margin-block-end: calc(
|
|
14
|
+
var(--utrecht-space-around, 0) *
|
|
15
|
+
var(--utrecht-form-field-description-margin-block-end, var(--utrecht-paragraph-margin-block-end, 0))
|
|
16
|
+
);
|
|
17
|
+
margin-block-start: calc(
|
|
18
|
+
var(--utrecht-space-around, 0) *
|
|
19
|
+
var(--utrecht-form-field-description-margin-block-start, var(--utrecht-paragraph-margin-block-start, 0))
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
& > * {
|
|
23
|
+
--utrecht-space-around: 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin utrecht-form-field-description--distanced {
|
|
28
|
+
--utrecht-space-around: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@mixin utrecht-form-field-description--invalid {
|
|
32
|
+
color: var(
|
|
33
|
+
--utrecht-form-field-description-invalid-color,
|
|
34
|
+
var(--utrecht-feedback-invalid-color, var(--utrecht-feedback-danger-color))
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@mixin utrecht-form-field-description--valid {
|
|
39
|
+
color: var(
|
|
40
|
+
--utrecht-form-field-description-valid-color,
|
|
41
|
+
var(--utrecht-feedback-valid-color, var(--utrecht-feedback-safe-color))
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@mixin utrecht-form-field-description--warning {
|
|
46
|
+
color: var(--utrecht-form-field-description-warning-color, var(--utrecht-feedback-warning-color));
|
|
47
|
+
}
|
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,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"form-field-description": {
|
|
4
|
+
"color": {
|
|
5
|
+
"$extensions": {
|
|
6
|
+
"nl.nldesignsystem.css.property": {
|
|
7
|
+
"syntax": "<color>",
|
|
8
|
+
"inherits": true
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"type": "color"
|
|
12
|
+
},
|
|
13
|
+
"font-family": {
|
|
14
|
+
"$extensions": {
|
|
15
|
+
"nl.nldesignsystem.css.property": {
|
|
16
|
+
"syntax": "*",
|
|
17
|
+
"inherits": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"type": "fontFamilies"
|
|
21
|
+
},
|
|
22
|
+
"font-size": {
|
|
23
|
+
"$extensions": {
|
|
24
|
+
"nl.nldesignsystem.css.property": {
|
|
25
|
+
"syntax": "<length>",
|
|
26
|
+
"inherits": true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"type": "fontSizes"
|
|
30
|
+
},
|
|
31
|
+
"font-style": {
|
|
32
|
+
"$extensions": {
|
|
33
|
+
"nl.nldesignsystem.css.property": {
|
|
34
|
+
"syntax": "italic",
|
|
35
|
+
"inherits": true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"margin-block-start": {
|
|
40
|
+
"$extensions": {
|
|
41
|
+
"nl.nldesignsystem.css.property": {
|
|
42
|
+
"syntax": "<length>",
|
|
43
|
+
"inherits": true
|
|
44
|
+
},
|
|
45
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
46
|
+
},
|
|
47
|
+
"type": "sizing"
|
|
48
|
+
},
|
|
49
|
+
"margin-block-end": {
|
|
50
|
+
"$extensions": {
|
|
51
|
+
"nl.nldesignsystem.css.property": {
|
|
52
|
+
"syntax": "<length>",
|
|
53
|
+
"inherits": true
|
|
54
|
+
},
|
|
55
|
+
"nl.nldesignsystem.figma.supports-token": false
|
|
56
|
+
},
|
|
57
|
+
"type": "sizing"
|
|
58
|
+
},
|
|
59
|
+
"invalid": {
|
|
60
|
+
"font-weight": {
|
|
61
|
+
"$extensions": {
|
|
62
|
+
"nl.nldesignsystem.css.property": {
|
|
63
|
+
"syntax": "<number>",
|
|
64
|
+
"inherits": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"color": {
|
|
69
|
+
"$extensions": {
|
|
70
|
+
"nl.nldesignsystem.css.property": {
|
|
71
|
+
"syntax": "<color>",
|
|
72
|
+
"inherits": true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"valid": {
|
|
78
|
+
"color": {
|
|
79
|
+
"$extensions": {
|
|
80
|
+
"nl.nldesignsystem.css.property": {
|
|
81
|
+
"syntax": "<color>",
|
|
82
|
+
"inherits": true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|