@digigov/react-core 0.21.0 → 0.22.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/AccessibilityIcon/__snapshots__/index.test.tsx.snap +626 -0
- package/AccessibilityIcon/index.d.ts +15 -0
- package/AccessibilityIcon/index.js +52 -0
- package/AccessibilityIcon/index.test.d.ts +1 -0
- package/AccessibilityIcon/index.test.js +137 -0
- package/AccessibilityTextIcon/__snapshots__/index.test.tsx.snap +511 -0
- package/AccessibilityTextIcon/index.d.ts +15 -0
- package/AccessibilityTextIcon/index.js +34 -0
- package/AccessibilityTextIcon/index.test.d.ts +1 -0
- package/AccessibilityTextIcon/index.test.js +129 -0
- package/CHANGELOG.md +21 -1
- package/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/CheckboxItem/index.d.ts +5 -0
- package/CheckboxItem/index.js +6 -3
- package/CheckboxItem/index.test.js +18 -0
- package/DetailsSummary/index.d.ts +2 -1
- package/DetailsSummary/index.js +4 -3
- package/FieldContainer/index.js +10 -3
- package/Nav/index.d.ts +16 -1
- package/Nav/index.js +8 -2
- package/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/RadioItem/index.d.ts +5 -0
- package/RadioItem/index.js +6 -3
- package/RadioItem/index.test.js +18 -0
- package/SectionBreak/index.d.ts +1 -1
- package/SectionBreak/index.js +4 -2
- package/SvgIcon/index.d.ts +1 -1
- package/es/AccessibilityIcon/__snapshots__/index.test.tsx.snap +626 -0
- package/es/AccessibilityIcon/index.js +36 -0
- package/es/AccessibilityIcon/index.test.js +131 -0
- package/es/AccessibilityTextIcon/__snapshots__/index.test.tsx.snap +511 -0
- package/es/AccessibilityTextIcon/index.js +21 -0
- package/es/AccessibilityTextIcon/index.test.js +123 -0
- package/es/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/es/CheckboxItem/index.js +6 -3
- package/es/CheckboxItem/index.test.js +18 -0
- package/es/DetailsSummary/index.js +4 -3
- package/es/FieldContainer/index.js +8 -3
- package/es/Nav/index.js +8 -2
- package/es/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/es/RadioItem/index.js +6 -3
- package/es/RadioItem/index.test.js +18 -0
- package/es/SectionBreak/index.js +4 -2
- package/es/index.js +2 -0
- package/es/registry.js +4 -0
- package/esm/AccessibilityIcon/__snapshots__/index.test.tsx.snap +626 -0
- package/esm/AccessibilityIcon/index.js +36 -0
- package/esm/AccessibilityIcon/index.test.js +131 -0
- package/esm/AccessibilityTextIcon/__snapshots__/index.test.tsx.snap +511 -0
- package/esm/AccessibilityTextIcon/index.js +21 -0
- package/esm/AccessibilityTextIcon/index.test.js +123 -0
- package/esm/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/esm/CheckboxItem/index.js +6 -3
- package/esm/CheckboxItem/index.test.js +18 -0
- package/esm/DetailsSummary/index.js +4 -3
- package/esm/FieldContainer/index.js +8 -3
- package/esm/Nav/index.js +8 -2
- package/esm/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/esm/RadioItem/index.js +6 -3
- package/esm/RadioItem/index.test.js +18 -0
- package/esm/SectionBreak/index.js +4 -2
- package/esm/index.js +3 -1
- package/esm/registry.js +4 -0
- package/index.d.ts +2 -0
- package/index.js +26 -0
- package/package.json +2 -2
- package/registry.d.ts +2 -0
- package/registry.js +6 -0
- package/src/AccessibilityIcon/__snapshots__/index.test.tsx.snap +626 -0
- package/src/AccessibilityIcon/index.test.tsx +53 -0
- package/src/AccessibilityIcon/index.tsx +41 -0
- package/src/AccessibilityTextIcon/__snapshots__/index.test.tsx.snap +511 -0
- package/src/AccessibilityTextIcon/index.test.tsx +50 -0
- package/src/AccessibilityTextIcon/index.tsx +28 -0
- package/src/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/src/CheckboxItem/index.test.tsx +14 -0
- package/src/CheckboxItem/index.tsx +11 -1
- package/src/DetailsSummary/index.tsx +8 -2
- package/src/FieldContainer/index.tsx +2 -1
- package/src/Nav/index.tsx +29 -2
- package/src/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/src/RadioItem/index.test.tsx +14 -0
- package/src/RadioItem/index.tsx +11 -1
- package/src/SectionBreak/index.tsx +5 -2
- package/src/SvgIcon/index.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/registry.js +4 -0
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders the CheckboxItem with \`disabled\` prop 1`] = `
|
|
4
|
+
<ForwardRef(CheckboxItem)
|
|
5
|
+
disabled={true}
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="govgr-checkboxes__item"
|
|
9
|
+
>
|
|
10
|
+
<label
|
|
11
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
12
|
+
>
|
|
13
|
+
hello
|
|
14
|
+
<ForwardRef(Base)
|
|
15
|
+
as="input"
|
|
16
|
+
className="govgr-checkboxes__input"
|
|
17
|
+
disabled={true}
|
|
18
|
+
type="checkbox"
|
|
19
|
+
>
|
|
20
|
+
<input
|
|
21
|
+
className="govgr-checkboxes__input"
|
|
22
|
+
disabled={true}
|
|
23
|
+
type="checkbox"
|
|
24
|
+
/>
|
|
25
|
+
</ForwardRef(Base)>
|
|
26
|
+
</label>
|
|
27
|
+
</div>
|
|
28
|
+
</ForwardRef(CheckboxItem)>
|
|
29
|
+
`;
|
|
30
|
+
|
|
3
31
|
exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
4
32
|
<ForwardRef(CheckboxItem)
|
|
5
33
|
name="example"
|
|
@@ -14,13 +42,49 @@ exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
|
14
42
|
<ForwardRef(Base)
|
|
15
43
|
as="input"
|
|
16
44
|
className="govgr-checkboxes__input"
|
|
45
|
+
disabled={false}
|
|
46
|
+
name="example"
|
|
47
|
+
type="checkbox"
|
|
48
|
+
>
|
|
49
|
+
<input
|
|
50
|
+
className="govgr-checkboxes__input"
|
|
51
|
+
disabled={false}
|
|
52
|
+
name="example"
|
|
53
|
+
type="checkbox"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(CheckboxItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports[`renders the CheckboxItem with \`value\` \`name\` and \`disabled\` props 1`] = `
|
|
62
|
+
<ForwardRef(CheckboxItem)
|
|
63
|
+
disabled={true}
|
|
64
|
+
name="example"
|
|
65
|
+
value="example"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
className="govgr-checkboxes__item"
|
|
69
|
+
>
|
|
70
|
+
<label
|
|
71
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
72
|
+
>
|
|
73
|
+
hello
|
|
74
|
+
<ForwardRef(Base)
|
|
75
|
+
as="input"
|
|
76
|
+
className="govgr-checkboxes__input"
|
|
77
|
+
disabled={true}
|
|
17
78
|
name="example"
|
|
18
79
|
type="checkbox"
|
|
80
|
+
value="example"
|
|
19
81
|
>
|
|
20
82
|
<input
|
|
21
83
|
className="govgr-checkboxes__input"
|
|
84
|
+
disabled={true}
|
|
22
85
|
name="example"
|
|
23
86
|
type="checkbox"
|
|
87
|
+
value="example"
|
|
24
88
|
/>
|
|
25
89
|
</ForwardRef(Base)>
|
|
26
90
|
</label>
|
|
@@ -42,11 +106,13 @@ exports[`renders the CheckboxItem with \`value\` prop 1`] = `
|
|
|
42
106
|
<ForwardRef(Base)
|
|
43
107
|
as="input"
|
|
44
108
|
className="govgr-checkboxes__input"
|
|
109
|
+
disabled={false}
|
|
45
110
|
type="checkbox"
|
|
46
111
|
value="example"
|
|
47
112
|
>
|
|
48
113
|
<input
|
|
49
114
|
className="govgr-checkboxes__input"
|
|
115
|
+
disabled={false}
|
|
50
116
|
type="checkbox"
|
|
51
117
|
value="example"
|
|
52
118
|
/>
|
|
@@ -68,10 +134,12 @@ exports[`renders the CheckboxItem with no props 1`] = `
|
|
|
68
134
|
<ForwardRef(Base)
|
|
69
135
|
as="input"
|
|
70
136
|
className="govgr-checkboxes__input"
|
|
137
|
+
disabled={false}
|
|
71
138
|
type="checkbox"
|
|
72
139
|
>
|
|
73
140
|
<input
|
|
74
141
|
className="govgr-checkboxes__input"
|
|
142
|
+
disabled={false}
|
|
75
143
|
type="checkbox"
|
|
76
144
|
/>
|
|
77
145
|
</ForwardRef(Base)>
|
|
@@ -17,3 +17,17 @@ it('renders the CheckboxItem with `value` prop', () => {
|
|
|
17
17
|
mount(<CheckboxItem value="example">hello</CheckboxItem>)
|
|
18
18
|
).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
it('renders the CheckboxItem with `disabled` prop', () => {
|
|
22
|
+
expect(mount(<CheckboxItem disabled>hello</CheckboxItem>)).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('renders the CheckboxItem with `value` `name` and `disabled` props', () => {
|
|
26
|
+
expect(
|
|
27
|
+
mount(
|
|
28
|
+
<CheckboxItem value="example" name="example" disabled>
|
|
29
|
+
hello
|
|
30
|
+
</CheckboxItem>
|
|
31
|
+
)
|
|
32
|
+
).toMatchSnapshot();
|
|
33
|
+
});
|
|
@@ -12,6 +12,11 @@ export interface CheckboxItemProps extends BaseProps<'input'> {
|
|
|
12
12
|
* Value property is optional and it specifies the value of an <input> element.
|
|
13
13
|
*/
|
|
14
14
|
value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* disabled prop disables the checkbox input.
|
|
17
|
+
* disabled property is optional and it is false by default.
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* Details for the CheckboxItem.
|
|
@@ -21,7 +26,10 @@ export interface CheckboxItemProps extends BaseProps<'input'> {
|
|
|
21
26
|
export const CheckboxItem = React.forwardRef<
|
|
22
27
|
HTMLInputElement,
|
|
23
28
|
CheckboxItemProps
|
|
24
|
-
>(function CheckboxItem(
|
|
29
|
+
>(function CheckboxItem(
|
|
30
|
+
{ name, value, className, disabled = false, children, ...props },
|
|
31
|
+
ref
|
|
32
|
+
) {
|
|
25
33
|
return (
|
|
26
34
|
<div
|
|
27
35
|
className={clsx(className, {
|
|
@@ -31,6 +39,7 @@ export const CheckboxItem = React.forwardRef<
|
|
|
31
39
|
<label
|
|
32
40
|
className={clsx({
|
|
33
41
|
'govgr-label govgr-checkboxes__label': true,
|
|
42
|
+
'govgr-checkboxes__label--disabled': disabled === true,
|
|
34
43
|
})}
|
|
35
44
|
>
|
|
36
45
|
{children}
|
|
@@ -43,6 +52,7 @@ export const CheckboxItem = React.forwardRef<
|
|
|
43
52
|
className={clsx({
|
|
44
53
|
'govgr-checkboxes__input': true,
|
|
45
54
|
})}
|
|
55
|
+
disabled={disabled}
|
|
46
56
|
{...props}
|
|
47
57
|
/>
|
|
48
58
|
</label>
|
|
@@ -2,20 +2,26 @@ import React from 'react';
|
|
|
2
2
|
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
export interface DetailsSummaryProps extends BaseProps<'summary'> {
|
|
5
|
+
export interface DetailsSummaryProps extends BaseProps<'summary'> {
|
|
6
|
+
/*
|
|
7
|
+
** size is optional. Default value is 'm'.
|
|
8
|
+
*/
|
|
9
|
+
size?: 'm' | 'l';
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
12
|
* Use this inside Details.DetailsSummary will be the text to click on.
|
|
8
13
|
*/
|
|
9
14
|
export const DetailsSummary = React.forwardRef<
|
|
10
15
|
HTMLElement,
|
|
11
16
|
DetailsSummaryProps
|
|
12
|
-
>(function DetailsSummary({ className, children, ...props }, ref) {
|
|
17
|
+
>(function DetailsSummary({size, className, children, ...props }, ref) {
|
|
13
18
|
return (
|
|
14
19
|
<Base
|
|
15
20
|
as="summary"
|
|
16
21
|
ref={ref}
|
|
17
22
|
className={clsx(className, {
|
|
18
23
|
'govgr-details__summary': true,
|
|
24
|
+
'govgr-details__summary--l': size==='l',
|
|
19
25
|
})}
|
|
20
26
|
{...props}
|
|
21
27
|
>
|
|
@@ -15,7 +15,7 @@ export const FieldContainer = React.forwardRef<
|
|
|
15
15
|
HTMLDivElement,
|
|
16
16
|
FieldContainerProps
|
|
17
17
|
>(function FieldContainer(
|
|
18
|
-
{ error, className, children, xs = 12, md = 12, lg = 12, xl = 12 },
|
|
18
|
+
{ error, className, children, xs = 12, md = 12, lg = 12, xl = 12, ...props },
|
|
19
19
|
ref
|
|
20
20
|
) {
|
|
21
21
|
return (
|
|
@@ -30,6 +30,7 @@ export const FieldContainer = React.forwardRef<
|
|
|
30
30
|
md={md}
|
|
31
31
|
lg={lg}
|
|
32
32
|
xl={xl}
|
|
33
|
+
{...props}
|
|
33
34
|
>
|
|
34
35
|
{children}
|
|
35
36
|
</Grid>
|
package/src/Nav/index.tsx
CHANGED
|
@@ -14,13 +14,37 @@ export interface NavProps extends BaseProps<'nav'> {
|
|
|
14
14
|
* layout is horizontal by default.
|
|
15
15
|
*/
|
|
16
16
|
layout?: 'vertical' | 'horizontal';
|
|
17
|
+
/**
|
|
18
|
+
* hidden is optional.
|
|
19
|
+
* hidden prop hides the nav element when it is called from a navItem.
|
|
20
|
+
*/
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* fixed is optional.
|
|
24
|
+
* fixed prop allows element to be positioned relative to the viewport
|
|
25
|
+
*/
|
|
26
|
+
fixed?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* border is optional.
|
|
29
|
+
* border prop contains border-bottom styling.
|
|
30
|
+
*/
|
|
31
|
+
border?: boolean;
|
|
17
32
|
}
|
|
18
33
|
/**
|
|
19
34
|
* Nav is mainly used under the Header.
|
|
20
35
|
* This is a wrapper for the NavList component.
|
|
21
36
|
*/
|
|
22
37
|
export const Nav = React.forwardRef<HTMLElement, NavProps>(function Nav(
|
|
23
|
-
{
|
|
38
|
+
{
|
|
39
|
+
className,
|
|
40
|
+
open = false,
|
|
41
|
+
layout = 'horizontal',
|
|
42
|
+
hidden = false,
|
|
43
|
+
fixed = true,
|
|
44
|
+
border = true,
|
|
45
|
+
children,
|
|
46
|
+
...props
|
|
47
|
+
},
|
|
24
48
|
ref
|
|
25
49
|
) {
|
|
26
50
|
return (
|
|
@@ -29,8 +53,11 @@ export const Nav = React.forwardRef<HTMLElement, NavProps>(function Nav(
|
|
|
29
53
|
ref={ref}
|
|
30
54
|
className={clsx(className, {
|
|
31
55
|
'govgr-horizontal-nav': true,
|
|
32
|
-
'govgr-nav
|
|
56
|
+
'govgr-horizontal-nav--order': layout === 'horizontal',
|
|
57
|
+
'govgr-nav-horizontal--fixed': fixed,
|
|
58
|
+
'govgr-nav-horizontal--border': border,
|
|
33
59
|
'govgr-horizontal-nav--open': open,
|
|
60
|
+
'govgr-horizontal-nav--hidden': hidden,
|
|
34
61
|
})}
|
|
35
62
|
{...props}
|
|
36
63
|
>
|
|
@@ -14,11 +14,13 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
14
14
|
<ForwardRef(Base)
|
|
15
15
|
as="input"
|
|
16
16
|
className="govgr-radios__input"
|
|
17
|
+
disabled={false}
|
|
17
18
|
type="radio"
|
|
18
19
|
value="someValue"
|
|
19
20
|
>
|
|
20
21
|
<input
|
|
21
22
|
className="govgr-radios__input"
|
|
23
|
+
disabled={false}
|
|
22
24
|
type="radio"
|
|
23
25
|
value="someValue"
|
|
24
26
|
/>
|
|
@@ -28,6 +30,34 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
28
30
|
</ForwardRef(RadioItem)>
|
|
29
31
|
`;
|
|
30
32
|
|
|
33
|
+
exports[`renders the RadioItem with disabled prop 1`] = `
|
|
34
|
+
<ForwardRef(RadioItem)
|
|
35
|
+
disabled={true}
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
className="govgr-radios__item"
|
|
39
|
+
>
|
|
40
|
+
<label
|
|
41
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
42
|
+
>
|
|
43
|
+
hello
|
|
44
|
+
<ForwardRef(Base)
|
|
45
|
+
as="input"
|
|
46
|
+
className="govgr-radios__input"
|
|
47
|
+
disabled={true}
|
|
48
|
+
type="radio"
|
|
49
|
+
>
|
|
50
|
+
<input
|
|
51
|
+
className="govgr-radios__input"
|
|
52
|
+
disabled={true}
|
|
53
|
+
type="radio"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(RadioItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
31
61
|
exports[`renders the RadioItem with name props 1`] = `
|
|
32
62
|
<ForwardRef(RadioItem)
|
|
33
63
|
name="name"
|
|
@@ -42,11 +72,13 @@ exports[`renders the RadioItem with name props 1`] = `
|
|
|
42
72
|
<ForwardRef(Base)
|
|
43
73
|
as="input"
|
|
44
74
|
className="govgr-radios__input"
|
|
75
|
+
disabled={false}
|
|
45
76
|
name="name"
|
|
46
77
|
type="radio"
|
|
47
78
|
>
|
|
48
79
|
<input
|
|
49
80
|
className="govgr-radios__input"
|
|
81
|
+
disabled={false}
|
|
50
82
|
name="name"
|
|
51
83
|
type="radio"
|
|
52
84
|
/>
|
|
@@ -71,12 +103,48 @@ exports[`renders the RadioItem with name and value props 1`] = `
|
|
|
71
103
|
<ForwardRef(Base)
|
|
72
104
|
as="input"
|
|
73
105
|
className="govgr-radios__input"
|
|
106
|
+
disabled={false}
|
|
107
|
+
name="name"
|
|
108
|
+
type="radio"
|
|
109
|
+
value="someValue"
|
|
110
|
+
>
|
|
111
|
+
<input
|
|
112
|
+
className="govgr-radios__input"
|
|
113
|
+
disabled={false}
|
|
114
|
+
name="name"
|
|
115
|
+
type="radio"
|
|
116
|
+
value="someValue"
|
|
117
|
+
/>
|
|
118
|
+
</ForwardRef(Base)>
|
|
119
|
+
</label>
|
|
120
|
+
</div>
|
|
121
|
+
</ForwardRef(RadioItem)>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`renders the RadioItem with name disabled and value props 1`] = `
|
|
125
|
+
<ForwardRef(RadioItem)
|
|
126
|
+
disabled={true}
|
|
127
|
+
name="name"
|
|
128
|
+
value="someValue"
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
className="govgr-radios__item"
|
|
132
|
+
>
|
|
133
|
+
<label
|
|
134
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
135
|
+
>
|
|
136
|
+
hello
|
|
137
|
+
<ForwardRef(Base)
|
|
138
|
+
as="input"
|
|
139
|
+
className="govgr-radios__input"
|
|
140
|
+
disabled={true}
|
|
74
141
|
name="name"
|
|
75
142
|
type="radio"
|
|
76
143
|
value="someValue"
|
|
77
144
|
>
|
|
78
145
|
<input
|
|
79
146
|
className="govgr-radios__input"
|
|
147
|
+
disabled={true}
|
|
80
148
|
name="name"
|
|
81
149
|
type="radio"
|
|
82
150
|
value="someValue"
|
|
@@ -99,10 +167,12 @@ exports[`renders the RadioItem with no props 1`] = `
|
|
|
99
167
|
<ForwardRef(Base)
|
|
100
168
|
as="input"
|
|
101
169
|
className="govgr-radios__input"
|
|
170
|
+
disabled={false}
|
|
102
171
|
type="radio"
|
|
103
172
|
>
|
|
104
173
|
<input
|
|
105
174
|
className="govgr-radios__input"
|
|
175
|
+
disabled={false}
|
|
106
176
|
type="radio"
|
|
107
177
|
/>
|
|
108
178
|
</ForwardRef(Base)>
|
|
@@ -26,3 +26,17 @@ it('renders the RadioItem with name and value props', () => {
|
|
|
26
26
|
)
|
|
27
27
|
).toMatchSnapshot();
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
it('renders the RadioItem with disabled prop', () => {
|
|
31
|
+
expect(mount(<RadioItem disabled>hello</RadioItem>)).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders the RadioItem with name disabled and value props', () => {
|
|
35
|
+
expect(
|
|
36
|
+
mount(
|
|
37
|
+
<RadioItem name={'name'} value={'someValue'} disabled>
|
|
38
|
+
hello
|
|
39
|
+
</RadioItem>
|
|
40
|
+
)
|
|
41
|
+
).toMatchSnapshot();
|
|
42
|
+
});
|
package/src/RadioItem/index.tsx
CHANGED
|
@@ -12,13 +12,21 @@ export interface RadioItemProps extends BaseProps<'input'> {
|
|
|
12
12
|
* Value property is optional and it specifies the value of an <input> element.
|
|
13
13
|
*/
|
|
14
14
|
value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* disabled prop disables the radio input.
|
|
17
|
+
* disabled property is optional and it is false by default.
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* RadioItem component is used for display radio buttons.
|
|
18
23
|
* RadioItem component must be included inside Radio component, as a children component.
|
|
19
24
|
*/
|
|
20
25
|
export const RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(
|
|
21
|
-
function RadioItem(
|
|
26
|
+
function RadioItem(
|
|
27
|
+
{ name, value, className, disabled = false, children, ...props },
|
|
28
|
+
ref
|
|
29
|
+
) {
|
|
22
30
|
return (
|
|
23
31
|
<div
|
|
24
32
|
className={clsx(className, {
|
|
@@ -28,6 +36,7 @@ export const RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(
|
|
|
28
36
|
<label
|
|
29
37
|
className={clsx({
|
|
30
38
|
'govgr-label govgr-radios__label': true,
|
|
39
|
+
'govgr-radios__label--disabled': disabled === true,
|
|
31
40
|
})}
|
|
32
41
|
>
|
|
33
42
|
{children}
|
|
@@ -40,6 +49,7 @@ export const RadioItem = React.forwardRef<HTMLInputElement, RadioItemProps>(
|
|
|
40
49
|
className={clsx({
|
|
41
50
|
'govgr-radios__input': true,
|
|
42
51
|
})}
|
|
52
|
+
disabled={disabled}
|
|
43
53
|
{...props}
|
|
44
54
|
/>
|
|
45
55
|
</label>
|
|
@@ -12,13 +12,16 @@ export interface SectionBreakProps extends BaseProps<'hr'> {
|
|
|
12
12
|
/**
|
|
13
13
|
* size is optional and it is about the different size margins.
|
|
14
14
|
*/
|
|
15
|
-
size?: 'xl' | 'l' | 'm';
|
|
15
|
+
size?: 'xl' | 'l' | 'm' | 's';
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* SectionBreak is used to create a thematic break between sections of content.
|
|
19
19
|
*/
|
|
20
20
|
export const SectionBreak = React.forwardRef<HTMLHRElement, SectionBreakProps>(
|
|
21
|
-
function SectionBreak(
|
|
21
|
+
function SectionBreak(
|
|
22
|
+
{ visible = true, size = 's', className, ...props },
|
|
23
|
+
ref
|
|
24
|
+
) {
|
|
22
25
|
return (
|
|
23
26
|
<Base
|
|
24
27
|
as="hr"
|
package/src/SvgIcon/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ export interface SvgIconProps extends BaseProps<'svg'> {
|
|
|
7
7
|
* size prop declares the size of the svg icon.
|
|
8
8
|
* size is optional. The default value is 'm'.
|
|
9
9
|
*/
|
|
10
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
10
|
+
size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* variant property styles svg icon with Gov.gr palette's basic colors.
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from '@digigov/react-core/AccessibilityIcon';
|
|
2
|
+
export * from '@digigov/react-core/AccessibilityTextIcon';
|
|
1
3
|
export * from '@digigov/react-core/Accordion';
|
|
2
4
|
export * from '@digigov/react-core/AccordionControls';
|
|
3
5
|
export * from '@digigov/react-core/AccordionSection';
|
package/src/registry.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
import * as _digigov_react_core_AccessibilityIcon from '@digigov/react-core/AccessibilityIcon';
|
|
3
|
+
import * as _digigov_react_core_AccessibilityTextIcon from '@digigov/react-core/AccessibilityTextIcon';
|
|
2
4
|
import * as _digigov_react_core_Accordion from '@digigov/react-core/Accordion';
|
|
3
5
|
import * as _digigov_react_core_AccordionControls from '@digigov/react-core/AccordionControls';
|
|
4
6
|
import * as _digigov_react_core_AccordionSection from '@digigov/react-core/AccordionSection';
|
|
@@ -176,6 +178,8 @@ function lazyImport(pkgImport) {
|
|
|
176
178
|
)
|
|
177
179
|
}
|
|
178
180
|
export default {
|
|
181
|
+
'@digigov/react-core/AccessibilityIcon': lazyImport(_digigov_react_core_AccessibilityIcon),
|
|
182
|
+
'@digigov/react-core/AccessibilityTextIcon': lazyImport(_digigov_react_core_AccessibilityTextIcon),
|
|
179
183
|
'@digigov/react-core/Accordion': lazyImport(_digigov_react_core_Accordion),
|
|
180
184
|
'@digigov/react-core/AccordionControls': lazyImport(_digigov_react_core_AccordionControls),
|
|
181
185
|
'@digigov/react-core/AccordionSection': lazyImport(_digigov_react_core_AccordionSection),
|