@digigov/react-core 1.0.0-8ae63a77 → 1.0.0-8bbf3ef2
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/AccessibilityMenuHeaderButton/index.d.ts +1 -1
- package/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
- package/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
- package/Button/__snapshots__/index.test.tsx.snap +18 -0
- package/Button/index.d.ts +8 -1
- package/Button/index.js +3 -2
- package/Button/index.test.js +17 -9
- package/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
- package/Checkbox/index.d.ts +8 -1
- package/Checkbox/index.js +3 -2
- package/Checkbox/index.test.js +8 -0
- package/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
- package/CloseButton/index.d.ts +7 -1
- package/CloseButton/index.js +4 -3
- package/CloseButton/index.test.js +8 -0
- package/Container/__snapshots__/index.test.tsx.snap +14 -4
- package/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
- package/CopyToClipboardContainer/index.d.ts +9 -1
- package/CopyToClipboardContainer/index.js +3 -2
- package/CopyToClipboardContainer/index.spec.js +8 -0
- package/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/DateInputContainer/index.d.ts +8 -1
- package/DateInputContainer/index.js +4 -3
- package/DateInputContainer/index.test.js +8 -0
- package/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
- package/ErrorSummary/index.d.ts +8 -1
- package/ErrorSummary/index.js +4 -2
- package/ErrorSummary/index.test.js +8 -0
- package/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
- package/ModalContainer/index.d.ts +8 -1
- package/ModalContainer/index.js +3 -2
- package/Nav/__snapshots__/index.test.tsx.snap +91 -4
- package/Nav/index.d.ts +30 -15
- package/Nav/index.js +18 -9
- package/Nav/index.test.js +42 -0
- package/NavListItemAction/index.d.ts +1 -1
- package/NavListItemButton/index.d.ts +1 -1
- package/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
- package/NavMenuContainer/index.test.js +24 -0
- package/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
- package/NotificationBannerContainer/index.d.ts +8 -1
- package/NotificationBannerContainer/index.js +3 -2
- package/NotificationBannerContainer/index.test.js +8 -0
- package/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/RadioContainer/index.d.ts +8 -1
- package/RadioContainer/index.js +5 -4
- package/RadioContainer/index.test.js +8 -0
- package/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
- package/SearchButton/index.d.ts +1 -1
- package/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/SelectContainer/index.d.ts +8 -1
- package/SelectContainer/index.js +4 -3
- package/SelectContainer/index.test.js +9 -1
- package/SingleCharacterInput/index.d.ts +1 -1
- package/StepNav/__snapshots__/index.test.tsx.snap +2 -2
- package/Tabs/index.d.ts +2 -1
- package/Tabs/index.js +4 -3
- package/TaskList/__snapshots__/index.test.tsx.snap +2 -2
- package/TextArea/__snapshots__/index.test.tsx.snap +19 -0
- package/TextArea/index.d.ts +8 -1
- package/TextArea/index.js +6 -5
- package/TextArea/index.test.js +8 -0
- package/TextInput/__snapshots__/index.test.tsx.snap +17 -0
- package/TextInput/index.d.ts +8 -1
- package/TextInput/index.js +3 -2
- package/TextInput/index.test.js +91 -83
- package/WarningText/__snapshots__/index.test.tsx.snap +31 -0
- package/WarningText/index.d.ts +8 -1
- package/WarningText/index.js +3 -2
- package/WarningText/index.test.js +8 -0
- package/es/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
- package/es/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
- package/es/Button/__snapshots__/index.test.tsx.snap +18 -0
- package/es/Button/index.js +3 -2
- package/es/Button/index.test.js +17 -9
- package/es/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
- package/es/Checkbox/index.js +3 -2
- package/es/Checkbox/index.test.js +8 -0
- package/es/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
- package/es/CloseButton/index.js +4 -3
- package/es/CloseButton/index.test.js +8 -0
- package/es/Container/__snapshots__/index.test.tsx.snap +14 -4
- package/es/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
- package/es/CopyToClipboardContainer/index.js +3 -2
- package/es/CopyToClipboardContainer/index.spec.js +8 -0
- package/es/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/es/DateInputContainer/index.js +4 -3
- package/es/DateInputContainer/index.test.js +8 -0
- package/es/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
- package/es/ErrorSummary/index.js +4 -2
- package/es/ErrorSummary/index.test.js +8 -0
- package/es/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
- package/es/ModalContainer/index.js +3 -2
- package/es/Nav/__snapshots__/index.test.tsx.snap +91 -4
- package/es/Nav/index.js +17 -9
- package/es/Nav/index.test.js +42 -0
- package/es/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
- package/es/NavMenuContainer/index.test.js +24 -0
- package/es/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
- package/es/NotificationBannerContainer/index.js +3 -2
- package/es/NotificationBannerContainer/index.test.js +8 -0
- package/es/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/es/RadioContainer/index.js +5 -4
- package/es/RadioContainer/index.test.js +8 -0
- package/es/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
- package/es/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/es/SelectContainer/index.js +4 -3
- package/es/SelectContainer/index.test.js +9 -1
- package/es/StepNav/__snapshots__/index.test.tsx.snap +2 -2
- package/es/Tabs/index.js +4 -3
- package/es/TaskList/__snapshots__/index.test.tsx.snap +2 -2
- package/es/TextArea/__snapshots__/index.test.tsx.snap +19 -0
- package/es/TextArea/index.js +6 -5
- package/es/TextArea/index.test.js +8 -0
- package/es/TextInput/__snapshots__/index.test.tsx.snap +17 -0
- package/es/TextInput/index.js +3 -2
- package/es/TextInput/index.test.js +91 -83
- package/es/WarningText/__snapshots__/index.test.tsx.snap +31 -0
- package/es/WarningText/index.js +3 -2
- package/es/WarningText/index.test.js +8 -0
- package/esm/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
- package/esm/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
- package/esm/Button/__snapshots__/index.test.tsx.snap +18 -0
- package/esm/Button/index.js +3 -2
- package/esm/Button/index.test.js +17 -9
- package/esm/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
- package/esm/Checkbox/index.js +3 -2
- package/esm/Checkbox/index.test.js +8 -0
- package/esm/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
- package/esm/CloseButton/index.js +4 -3
- package/esm/CloseButton/index.test.js +8 -0
- package/esm/Container/__snapshots__/index.test.tsx.snap +14 -4
- package/esm/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
- package/esm/CopyToClipboardContainer/index.js +3 -2
- package/esm/CopyToClipboardContainer/index.spec.js +8 -0
- package/esm/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/esm/DateInputContainer/index.js +4 -3
- package/esm/DateInputContainer/index.test.js +8 -0
- package/esm/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
- package/esm/ErrorSummary/index.js +4 -2
- package/esm/ErrorSummary/index.test.js +8 -0
- package/esm/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
- package/esm/ModalContainer/index.js +3 -2
- package/esm/Nav/__snapshots__/index.test.tsx.snap +91 -4
- package/esm/Nav/index.js +17 -9
- package/esm/Nav/index.test.js +42 -0
- package/esm/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
- package/esm/NavMenuContainer/index.test.js +24 -0
- package/esm/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
- package/esm/NotificationBannerContainer/index.js +3 -2
- package/esm/NotificationBannerContainer/index.test.js +8 -0
- package/esm/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/esm/RadioContainer/index.js +5 -4
- package/esm/RadioContainer/index.test.js +8 -0
- package/esm/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/esm/SelectContainer/index.js +4 -3
- package/esm/SelectContainer/index.test.js +9 -1
- package/esm/StepNav/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/Tabs/index.js +4 -3
- package/esm/TaskList/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/TextArea/__snapshots__/index.test.tsx.snap +19 -0
- package/esm/TextArea/index.js +6 -5
- package/esm/TextArea/index.test.js +8 -0
- package/esm/TextInput/__snapshots__/index.test.tsx.snap +17 -0
- package/esm/TextInput/index.js +3 -2
- package/esm/TextInput/index.test.js +91 -83
- package/esm/WarningText/__snapshots__/index.test.tsx.snap +31 -0
- package/esm/WarningText/index.js +3 -2
- package/esm/WarningText/index.test.js +8 -0
- package/esm/index.js +1 -1
- package/package.json +3 -3
- package/src/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
- package/src/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
- package/src/Button/__snapshots__/index.test.tsx.snap +18 -0
- package/src/Button/index.test.tsx +3 -0
- package/src/Button/index.tsx +9 -0
- package/src/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
- package/src/Checkbox/index.test.tsx +10 -0
- package/src/Checkbox/index.tsx +9 -1
- package/src/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
- package/src/CloseButton/index.test.tsx +3 -0
- package/src/CloseButton/index.tsx +10 -3
- package/src/Container/__snapshots__/index.test.tsx.snap +14 -4
- package/src/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
- package/src/CopyToClipboardContainer/index.spec.tsx +8 -2
- package/src/CopyToClipboardContainer/index.tsx +10 -1
- package/src/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/src/DateInputContainer/index.test.tsx +5 -0
- package/src/DateInputContainer/index.tsx +11 -2
- package/src/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
- package/src/ErrorSummary/index.test.tsx +4 -0
- package/src/ErrorSummary/index.tsx +12 -5
- package/src/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
- package/src/ModalContainer/index.tsx +9 -1
- package/src/Nav/__snapshots__/index.test.tsx.snap +91 -4
- package/src/Nav/index.test.tsx +15 -0
- package/src/Nav/index.tsx +53 -20
- package/src/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
- package/src/NavMenuContainer/index.test.tsx +9 -0
- package/src/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
- package/src/NotificationBannerContainer/index.test.tsx +7 -0
- package/src/NotificationBannerContainer/index.tsx +9 -1
- package/src/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/src/RadioContainer/index.test.tsx +3 -0
- package/src/RadioContainer/index.tsx +9 -1
- package/src/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
- package/src/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
- package/src/SelectContainer/index.test.tsx +5 -0
- package/src/SelectContainer/index.tsx +11 -2
- package/src/StepNav/__snapshots__/index.test.tsx.snap +2 -2
- package/src/Tabs/index.tsx +5 -2
- package/src/TaskList/__snapshots__/index.test.tsx.snap +2 -2
- package/src/TextArea/__snapshots__/index.test.tsx.snap +19 -0
- package/src/TextArea/index.test.tsx +3 -0
- package/src/TextArea/index.tsx +11 -2
- package/src/TextInput/__snapshots__/index.test.tsx.snap +17 -0
- package/src/TextInput/index.test.tsx +3 -0
- package/src/TextInput/index.tsx +9 -0
- package/src/WarningText/__snapshots__/index.test.tsx.snap +31 -0
- package/src/WarningText/index.test.tsx +3 -0
- package/src/WarningText/index.tsx +9 -1
package/src/TextArea/index.tsx
CHANGED
|
@@ -10,6 +10,13 @@ export interface TextAreaProps extends BaseProps<'textarea'> {
|
|
|
10
10
|
* @value false
|
|
11
11
|
*/
|
|
12
12
|
error?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* dense is optional.
|
|
15
|
+
* @value true TextArea will be dense.
|
|
16
|
+
* @value false
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
dense?: boolean;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
22
|
* Textarea component is used when you need to let users enter an
|
|
@@ -17,17 +24,19 @@ export interface TextAreaProps extends BaseProps<'textarea'> {
|
|
|
17
24
|
*/
|
|
18
25
|
export const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(
|
|
19
26
|
function TextArea(
|
|
20
|
-
{ name, rows
|
|
27
|
+
{ name, rows, error, dense, className, children, ...props },
|
|
21
28
|
ref
|
|
22
29
|
) {
|
|
30
|
+
const defaultRows = dense? 3 : 6;
|
|
23
31
|
return (
|
|
24
32
|
<Base
|
|
25
33
|
as="textarea"
|
|
26
34
|
name={name}
|
|
27
|
-
rows={rows}
|
|
35
|
+
rows={rows || defaultRows}
|
|
28
36
|
ref={ref}
|
|
29
37
|
className={clsx(className, {
|
|
30
38
|
'govgr-textarea': true,
|
|
39
|
+
'govgr-textarea--dense': dense,
|
|
31
40
|
'govgr-input--error': error,
|
|
32
41
|
})}
|
|
33
42
|
{...props}
|
|
@@ -108,6 +108,23 @@ exports[`renders the TextInput with with maxWidth="5-char" with width=two-third
|
|
|
108
108
|
</ForwardRef(TextInput)>
|
|
109
109
|
`;
|
|
110
110
|
|
|
111
|
+
exports[`renders the TextInput with dense prop 1`] = `
|
|
112
|
+
<ForwardRef(TextInput)
|
|
113
|
+
dense={true}
|
|
114
|
+
>
|
|
115
|
+
<ForwardRef(Base)
|
|
116
|
+
as="input"
|
|
117
|
+
className="govgr-input--dense govgr-input"
|
|
118
|
+
type="text"
|
|
119
|
+
>
|
|
120
|
+
<input
|
|
121
|
+
className="govgr-input--dense govgr-input"
|
|
122
|
+
type="text"
|
|
123
|
+
/>
|
|
124
|
+
</ForwardRef(Base)>
|
|
125
|
+
</ForwardRef(TextInput)>
|
|
126
|
+
`;
|
|
127
|
+
|
|
111
128
|
exports[`renders the TextInput with maxWidth="2-char" 1`] = `
|
|
112
129
|
<ForwardRef(TextInput)
|
|
113
130
|
maxWidth="2-char"
|
|
@@ -6,6 +6,9 @@ import TextInput from '@digigov/react-core/TextInput';
|
|
|
6
6
|
it('renders the TextInput with no props', () => {
|
|
7
7
|
expect(mount(<TextInput></TextInput>)).toMatchSnapshot();
|
|
8
8
|
});
|
|
9
|
+
it('renders the TextInput with dense prop', () => {
|
|
10
|
+
expect(mount(<TextInput dense></TextInput>)).toMatchSnapshot();
|
|
11
|
+
});
|
|
9
12
|
|
|
10
13
|
it('renders the TextInput with maxWidth="2-char"', () => {
|
|
11
14
|
expect(mount(<TextInput maxWidth='2-char'></TextInput>)).toMatchSnapshot();
|
package/src/TextInput/index.tsx
CHANGED
|
@@ -34,6 +34,13 @@ export interface TextInputProps extends BaseProps<'input'> {
|
|
|
34
34
|
* @value false
|
|
35
35
|
*/
|
|
36
36
|
error?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* dense is optional.
|
|
39
|
+
* @value true TextInput will be dense.
|
|
40
|
+
* @value false
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
dense?: boolean;
|
|
37
44
|
}
|
|
38
45
|
/**
|
|
39
46
|
* TextInput component when you need to let users enter text that’s no
|
|
@@ -46,6 +53,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
46
53
|
maxWidth,
|
|
47
54
|
width,
|
|
48
55
|
error,
|
|
56
|
+
dense,
|
|
49
57
|
className,
|
|
50
58
|
children,
|
|
51
59
|
...props
|
|
@@ -60,6 +68,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
60
68
|
className={clsx(className, {
|
|
61
69
|
'govgr-input': true,
|
|
62
70
|
'govgr-input--error': error,
|
|
71
|
+
'govgr-input--dense': dense,
|
|
63
72
|
[`govgr-input--width-${maxWidth}`]: maxWidth !== undefined,
|
|
64
73
|
'govgr-!-width-one-quarter': width === '25%',
|
|
65
74
|
'govgr-!-width-one-third': width === '33.3%',
|
|
@@ -31,6 +31,37 @@ exports[`renders the WarningText with assistive text 1`] = `
|
|
|
31
31
|
</ForwardRef(WarningText)>
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
+
exports[`renders the WarningText with dense=true 1`] = `
|
|
35
|
+
<ForwardRef(WarningText)
|
|
36
|
+
dense={true}
|
|
37
|
+
>
|
|
38
|
+
<ForwardRef(Base)
|
|
39
|
+
as="div"
|
|
40
|
+
className="govgr-warning-text--dense govgr-warning-text"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
className="govgr-warning-text--dense govgr-warning-text"
|
|
44
|
+
>
|
|
45
|
+
<span
|
|
46
|
+
className="govgr-warning-text__icon"
|
|
47
|
+
>
|
|
48
|
+
!
|
|
49
|
+
</span>
|
|
50
|
+
<strong
|
|
51
|
+
className="govgr-warning-text__text"
|
|
52
|
+
>
|
|
53
|
+
<span
|
|
54
|
+
className="govgr-warning-text__assistive"
|
|
55
|
+
>
|
|
56
|
+
Προσοχή
|
|
57
|
+
</span>
|
|
58
|
+
hello
|
|
59
|
+
</strong>
|
|
60
|
+
</div>
|
|
61
|
+
</ForwardRef(Base)>
|
|
62
|
+
</ForwardRef(WarningText)>
|
|
63
|
+
`;
|
|
64
|
+
|
|
34
65
|
exports[`renders the WarningText with no props 1`] = `
|
|
35
66
|
<ForwardRef(WarningText)>
|
|
36
67
|
<ForwardRef(Base)
|
|
@@ -9,3 +9,6 @@ it('renders the WarningText with no props', () => {
|
|
|
9
9
|
it('renders the WarningText with assistive text', () => {
|
|
10
10
|
expect(mount(<WarningText assistiveText='alert'>hello</WarningText>)).toMatchSnapshot();
|
|
11
11
|
});
|
|
12
|
+
it('renders the WarningText with dense=true', () => {
|
|
13
|
+
expect(mount(<WarningText dense>hello</WarningText>)).toMatchSnapshot();
|
|
14
|
+
});
|
|
@@ -9,6 +9,13 @@ export interface WarningTextProps extends BaseProps<'div'> {
|
|
|
9
9
|
* assistiveText is used to provide a textual warning for assistive technologies like screen readers.
|
|
10
10
|
*/
|
|
11
11
|
assistiveText?: string;
|
|
12
|
+
/**
|
|
13
|
+
* dense is optional.
|
|
14
|
+
* @value true WarningText will be dense.
|
|
15
|
+
* @value false
|
|
16
|
+
* @default false
|
|
17
|
+
* */
|
|
18
|
+
dense?: boolean;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* WarningText.
|
|
@@ -17,7 +24,7 @@ export interface WarningTextProps extends BaseProps<'div'> {
|
|
|
17
24
|
*/
|
|
18
25
|
export const WarningText = React.forwardRef<HTMLDivElement, WarningTextProps>(
|
|
19
26
|
function WarningText(
|
|
20
|
-
{ className, assistiveText = 'Προσοχή', children, ...props },
|
|
27
|
+
{ className, assistiveText = 'Προσοχή', dense, children, ...props },
|
|
21
28
|
ref
|
|
22
29
|
) {
|
|
23
30
|
return (
|
|
@@ -26,6 +33,7 @@ export const WarningText = React.forwardRef<HTMLDivElement, WarningTextProps>(
|
|
|
26
33
|
ref={ref}
|
|
27
34
|
className={clsx(className, {
|
|
28
35
|
'govgr-warning-text': true,
|
|
36
|
+
'govgr-warning-text--dense': dense,
|
|
29
37
|
})}
|
|
30
38
|
{...props}
|
|
31
39
|
>
|