@scottish-government/designsystem-react 0.1.0 → 0.1.2
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/@types/components/InsetText.d.ts +5 -0
- package/@types/components/WarningText.d.ts +5 -0
- package/README.md +26 -0
- package/dist/components/accordion/accordion.jsx +10 -4
- package/dist/components/aspect-box/aspect-box.jsx +3 -2
- package/dist/components/back-to-top/back-to-top.jsx +5 -2
- package/dist/components/breadcrumbs/breadcrumbs.jsx +2 -2
- package/dist/components/button/button.jsx +3 -2
- package/dist/components/checkbox/checkbox.jsx +6 -2
- package/dist/components/confirmation-message/confirmation-message.jsx +5 -2
- package/dist/components/contents-nav/contents-nav.jsx +6 -3
- package/dist/components/date-picker/date-picker.jsx +3 -2
- package/dist/components/details/details.jsx +2 -1
- package/dist/components/error-message/error-message.jsx +2 -1
- package/dist/components/inset-text/inset-text.jsx +5 -2
- package/dist/components/notification-banner/notification-banner.jsx +6 -2
- package/dist/components/notification-panel/notification-panel.jsx +5 -2
- package/dist/components/page-header/page-header.jsx +5 -2
- package/dist/components/page-metadata/page-metadata.jsx +7 -3
- package/dist/components/phase-banner/phase-banner.jsx +5 -2
- package/dist/components/question/question.jsx +3 -2
- package/dist/components/radio-button/radio-button.jsx +3 -2
- package/dist/components/select/select.jsx +2 -1
- package/dist/components/sequential-navigation/sequential-navigation.jsx +5 -2
- package/dist/components/side-navigation/side-navigation.jsx +5 -2
- package/dist/components/site-navigation/site-navigation.jsx +5 -2
- package/dist/components/site-search/site-search.jsx +3 -2
- package/dist/components/task-list/task-list.jsx +13 -7
- package/dist/components/textarea/textarea.jsx +2 -1
- package/dist/components/warning-text/warning-text.jsx +5 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/common/icon.test.tsx +1 -1
- package/src/components/accordion/accordion.test.tsx +25 -1
- package/src/components/accordion/accordion.tsx +10 -2
- package/src/components/aspect-box/aspect-box.test.tsx +12 -0
- package/src/components/aspect-box/aspect-box.tsx +3 -1
- package/src/components/back-to-top/back-to-top.test.tsx +10 -0
- package/src/components/back-to-top/back-to-top.tsx +5 -1
- package/src/components/breadcrumbs/breadcrumbs.test.tsx +12 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +2 -0
- package/src/components/button/button.test.tsx +9 -0
- package/src/components/button/button.tsx +4 -2
- package/src/components/checkbox/checkbox.test.tsx +13 -0
- package/src/components/checkbox/checkbox.tsx +6 -1
- package/src/components/confirmation-message/confirmation-message.test.tsx +22 -0
- package/src/components/confirmation-message/confirmation-message.tsx +8 -2
- package/src/components/contents-nav/contents-nav.test.tsx +13 -0
- package/src/components/contents-nav/contents-nav.tsx +8 -4
- package/src/components/date-picker/date-picker.test.tsx +13 -0
- package/src/components/date-picker/date-picker.tsx +4 -2
- package/src/components/details/details.test.tsx +12 -0
- package/src/components/details/details.tsx +2 -0
- package/src/components/error-message/error-message.test.tsx +9 -0
- package/src/components/error-message/error-message.tsx +2 -0
- package/src/components/inset-text/inset-text.test.tsx +11 -0
- package/src/components/inset-text/inset-text.tsx +6 -2
- package/src/components/notification-banner/notification-banner.test.tsx +11 -0
- package/src/components/notification-banner/notification-banner.tsx +6 -1
- package/src/components/notification-panel/notification-panel.test.tsx +12 -0
- package/src/components/notification-panel/notification-panel.tsx +5 -1
- package/src/components/page-header/page-header.test.tsx +9 -0
- package/src/components/page-header/page-header.tsx +5 -1
- package/src/components/page-metadata/page-metadata.test.tsx +15 -0
- package/src/components/page-metadata/page-metadata.tsx +7 -1
- package/src/components/phase-banner/phase-banner.test.tsx +11 -0
- package/src/components/phase-banner/phase-banner.tsx +5 -1
- package/src/components/question/question.test.tsx +10 -0
- package/src/components/question/question.tsx +3 -1
- package/src/components/radio-button/radio-button.test.tsx +13 -0
- package/src/components/radio-button/radio-button.tsx +3 -1
- package/src/components/select/select.test.tsx +15 -0
- package/src/components/select/select.tsx +2 -0
- package/src/components/sequential-navigation/sequential-navigation.test.tsx +13 -0
- package/src/components/sequential-navigation/sequential-navigation.tsx +5 -1
- package/src/components/side-navigation/side-navigation.test.tsx +18 -0
- package/src/components/side-navigation/side-navigation.tsx +5 -1
- package/src/components/site-navigation/site-navigation.test.tsx +9 -0
- package/src/components/site-navigation/site-navigation.tsx +5 -1
- package/src/components/site-search/site-search.test.tsx +10 -0
- package/src/components/site-search/site-search.tsx +3 -1
- package/src/components/tag/tag.test.tsx +7 -7
- package/src/components/task-list/task-list.test.tsx +46 -0
- package/src/components/task-list/task-list.tsx +18 -5
- package/src/components/text-input/text-input.test.tsx +13 -0
- package/src/components/textarea/textarea.test.tsx +13 -0
- package/src/components/textarea/textarea.tsx +2 -0
- package/src/components/warning-text/warning-text.test.tsx +11 -0
- package/src/components/warning-text/warning-text.tsx +6 -2
- package/.editorconfig +0 -12
|
@@ -305,3 +305,16 @@ test('passing additional props', () => {
|
|
|
305
305
|
const textInput = screen.getByRole('textbox');
|
|
306
306
|
expect(textInput?.dataset.test).toEqual('foo');
|
|
307
307
|
});
|
|
308
|
+
|
|
309
|
+
test('passing additional CSS classes', () => {
|
|
310
|
+
render(
|
|
311
|
+
<TextInput
|
|
312
|
+
id={id}
|
|
313
|
+
label={labelText}
|
|
314
|
+
className="foo"
|
|
315
|
+
/>
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
const textInput = screen.getByRole('textbox');
|
|
319
|
+
expect(textInput).toHaveClass('foo', 'ds_input');
|
|
320
|
+
});
|
|
@@ -210,3 +210,16 @@ test('passing additional props', () => {
|
|
|
210
210
|
const textarea = screen.getByRole('textbox');
|
|
211
211
|
expect(textarea?.dataset.test).toEqual('foo');
|
|
212
212
|
});
|
|
213
|
+
|
|
214
|
+
test('passing additional CSS classes', () => {
|
|
215
|
+
render(
|
|
216
|
+
<Textarea
|
|
217
|
+
id={id}
|
|
218
|
+
label={labelText}
|
|
219
|
+
className="foo"
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
const textarea = screen.getByRole('textbox');
|
|
224
|
+
expect(textarea).toHaveClass('foo');
|
|
225
|
+
});
|
|
@@ -6,6 +6,7 @@ import ErrorMessage from '../error-message/error-message';
|
|
|
6
6
|
import HintText from '../../common/hint-text';
|
|
7
7
|
|
|
8
8
|
const Textarea: React.FC<SGDS.Component.Textarea> = ({
|
|
9
|
+
className,
|
|
9
10
|
countThreshold,
|
|
10
11
|
error,
|
|
11
12
|
errorMessage,
|
|
@@ -61,6 +62,7 @@ const Textarea: React.FC<SGDS.Component.Textarea> = ({
|
|
|
61
62
|
className={[
|
|
62
63
|
'ds_input',
|
|
63
64
|
error && 'ds_input--error',
|
|
65
|
+
className
|
|
64
66
|
].join(' ')}
|
|
65
67
|
defaultValue={value}
|
|
66
68
|
id={id}
|
|
@@ -38,3 +38,14 @@ test('passing additional props', () => {
|
|
|
38
38
|
const warningTextOuter = document.querySelector('.ds_warning-text');
|
|
39
39
|
expect(warningTextOuter?.dataset.test).toEqual('foo');
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
test('passing additional CSS classes', () => {
|
|
43
|
+
render(
|
|
44
|
+
<WarningText className="foo">
|
|
45
|
+
{text}
|
|
46
|
+
</WarningText>
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const warningTextOuter = document.querySelector('.ds_warning-text');
|
|
50
|
+
expect(warningTextOuter).toHaveClass('foo');
|
|
51
|
+
});
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
const WarningText: React.FC<
|
|
1
|
+
const WarningText: React.FC<SGDS.Component.WarningText> = ({
|
|
2
2
|
children,
|
|
3
|
+
className,
|
|
3
4
|
...props
|
|
4
5
|
}) => {
|
|
5
6
|
return (
|
|
6
7
|
<div
|
|
7
|
-
className=
|
|
8
|
+
className={[
|
|
9
|
+
'ds_warning-text',
|
|
10
|
+
className
|
|
11
|
+
].join(' ')}
|
|
8
12
|
{...props}
|
|
9
13
|
>
|
|
10
14
|
<strong className="ds_warning-text__icon" aria-hidden="true"></strong>
|
package/.editorconfig
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
root = true
|
|
5
|
-
|
|
6
|
-
[*]
|
|
7
|
-
indent_size = 4
|
|
8
|
-
indent_style = space
|
|
9
|
-
end_of_line = lf
|
|
10
|
-
charset = utf-8
|
|
11
|
-
trim_trailing_whitespace = true
|
|
12
|
-
insert_final_newline = true
|