@scottish-government/designsystem-react 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/.storybook/sgdsArgTypes.ts +19 -3
- package/CHANGELOG.md +19 -0
- package/README.md +1 -5
- package/dist/common/AbstractNotificationMessage/AbstractNotificationMessage.d.ts +6 -0
- package/dist/common/AbstractNotificationMessage/AbstractNotificationMessage.jsx +34 -0
- package/dist/common/AbstractNotificationMessage/index.d.ts +1 -0
- package/dist/common/AbstractNotificationMessage/index.js +8 -0
- package/dist/common/AbstractNotificationMessage/types.d.ts +9 -0
- package/dist/common/AbstractNotificationMessage/types.js +2 -0
- package/dist/common/WrapperTag/WrapperTag.d.ts +11 -11
- package/dist/components/ConfirmationMessage/ConfirmationMessage.d.ts +18 -2
- package/dist/components/ConfirmationMessage/ConfirmationMessage.jsx +21 -17
- package/dist/components/ConfirmationNotification/ConfirmationNotification.d.ts +6 -0
- package/dist/components/ConfirmationNotification/ConfirmationNotification.jsx +26 -0
- package/dist/components/ConfirmationNotification/index.d.ts +1 -0
- package/dist/components/ConfirmationNotification/index.js +8 -0
- package/dist/components/CookieBanner/CookieBanner.jsx +2 -2
- package/dist/components/ErrorNotification/ErrorNotification.d.ts +6 -0
- package/dist/components/ErrorNotification/ErrorNotification.jsx +26 -0
- package/dist/components/ErrorNotification/index.d.ts +1 -0
- package/dist/components/ErrorNotification/index.js +8 -0
- package/dist/components/FileUpload/FileUpload.d.ts +6 -0
- package/dist/components/FileUpload/FileUpload.jsx +55 -0
- package/dist/components/FileUpload/index.d.ts +1 -0
- package/dist/components/FileUpload/index.js +8 -0
- package/dist/components/FileUpload/types.d.ts +24 -0
- package/dist/components/FileUpload/types.js +2 -0
- package/dist/components/InfoNotification/InfoNotification.d.ts +6 -0
- package/dist/components/InfoNotification/InfoNotification.jsx +26 -0
- package/dist/components/InfoNotification/index.d.ts +1 -0
- package/dist/components/InfoNotification/index.js +8 -0
- package/dist/components/NotificationBanner/NotificationBanner.jsx +1 -1
- package/dist/components/SummaryList/SummaryList.d.ts +1 -1
- package/dist/components/WarningNotification/WarningNotification.d.ts +6 -0
- package/dist/components/WarningNotification/WarningNotification.jsx +26 -0
- package/dist/components/WarningNotification/index.d.ts +1 -0
- package/dist/components/WarningNotification/index.js +8 -0
- package/dist/components/WarningText/WarningText.jsx +4 -1
- package/dist/images/icons/index.d.ts +2 -0
- package/dist/images/icons/index.js +5 -1
- package/dist/images/icons/info.d.ts +4 -0
- package/dist/images/icons/info.jsx +40 -0
- package/dist/images/icons/warning.d.ts +4 -0
- package/dist/images/icons/warning.jsx +40 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +40 -0
- package/dist/shared-types.d.ts +35 -0
- package/dist/shared-types.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +22 -16
- package/src/common/AbstractNotificationMessage/AbstractNotificationMessage.test.tsx +101 -0
- package/src/common/AbstractNotificationMessage/AbstractNotificationMessage.tsx +56 -0
- package/src/common/AbstractNotificationMessage/index.ts +1 -0
- package/src/common/AbstractNotificationMessage/types.ts +10 -0
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +11 -3
- package/src/components/ConfirmationMessage/ConfirmationMessage.test.tsx +58 -23
- package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +32 -25
- package/src/components/ConfirmationMessage/confirmationmessage.mdx +17 -0
- package/src/components/ConfirmationNotification/ConfirmationNotification.stories.tsx +47 -0
- package/src/components/ConfirmationNotification/ConfirmationNotification.test.tsx +101 -0
- package/src/components/ConfirmationNotification/ConfirmationNotification.tsx +46 -0
- package/src/components/ConfirmationNotification/index.ts +1 -0
- package/src/components/CookieBanner/CookieBanner.tsx +1 -1
- package/src/components/ErrorNotification/ErrorNotification.stories.tsx +47 -0
- package/src/components/ErrorNotification/ErrorNotification.test.tsx +101 -0
- package/src/components/ErrorNotification/ErrorNotification.tsx +46 -0
- package/src/components/ErrorNotification/index.ts +1 -0
- package/src/components/FileDownload/FileDownload.test.tsx +1 -1
- package/src/components/FileUpload/FileUpload.stories.tsx +77 -0
- package/src/components/FileUpload/FileUpload.test.tsx +185 -0
- package/src/components/FileUpload/FileUpload.tsx +87 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/FileUpload/types.ts +25 -0
- package/src/components/InfoNotification/InfoNotification.stories.tsx +47 -0
- package/src/components/InfoNotification/InfoNotification.test.tsx +101 -0
- package/src/components/InfoNotification/InfoNotification.tsx +46 -0
- package/src/components/InfoNotification/index.ts +1 -0
- package/src/components/NotificationBanner/NotificationBanner.tsx +1 -1
- package/src/components/SummaryList/SummaryList.tsx +1 -1
- package/src/components/TextInput/TextInput.stories.tsx +1 -1
- package/src/components/WarningNotification/WarningNotification.stories.tsx +47 -0
- package/src/components/WarningNotification/WarningNotification.test.tsx +101 -0
- package/src/components/WarningNotification/WarningNotification.tsx +46 -0
- package/src/components/WarningNotification/index.ts +1 -0
- package/src/components/WarningText/WarningText.tsx +4 -1
- package/src/images/icons/arrow_upward.tsx +10 -10
- package/src/images/icons/calendar_today.tsx +10 -10
- package/src/images/icons/cancel.tsx +8 -8
- package/src/images/icons/check_circle.tsx +10 -10
- package/src/images/icons/chevron_left.tsx +10 -10
- package/src/images/icons/chevron_right.tsx +10 -10
- package/src/images/icons/close.tsx +10 -10
- package/src/images/icons/description.tsx +10 -10
- package/src/images/icons/double_chevron_left.tsx +8 -8
- package/src/images/icons/double_chevron_right.tsx +8 -8
- package/src/images/icons/error.tsx +10 -10
- package/src/images/icons/expand_less.tsx +10 -10
- package/src/images/icons/expand_more.tsx +10 -10
- package/src/images/icons/index.ts +2 -0
- package/src/images/icons/info.tsx +14 -0
- package/src/images/icons/list.tsx +13 -13
- package/src/images/icons/menu.tsx +10 -10
- package/src/images/icons/priority_high.tsx +11 -11
- package/src/images/icons/search.tsx +10 -10
- package/src/images/icons/warning.tsx +14 -0
- package/src/shared-types.ts +1 -1
- package/src/components/ConfirmationMessage/types.ts +0 -7
|
@@ -79,7 +79,10 @@ const SGDSArgTypes = {
|
|
|
79
79
|
errorMessage: (options?: ArgType) => {
|
|
80
80
|
return Object.assign({
|
|
81
81
|
description: 'Text to use for an error message',
|
|
82
|
-
type: 'string'
|
|
82
|
+
type: 'string',
|
|
83
|
+
table: {
|
|
84
|
+
type: { summary: 'string' }
|
|
85
|
+
}
|
|
83
86
|
}, options) as InputType;
|
|
84
87
|
},
|
|
85
88
|
hasError: (options?: ArgType) => {
|
|
@@ -96,10 +99,20 @@ const SGDSArgTypes = {
|
|
|
96
99
|
type: 'string'
|
|
97
100
|
}, options) as InputType;
|
|
98
101
|
},
|
|
102
|
+
hidden: (options?: ArgType) => {
|
|
103
|
+
return Object.assign({
|
|
104
|
+
table: {
|
|
105
|
+
disable: true
|
|
106
|
+
}
|
|
107
|
+
}, options) as InputType;
|
|
108
|
+
},
|
|
99
109
|
hintText: (options?: ArgType) => {
|
|
100
110
|
return Object.assign({
|
|
101
111
|
description: 'Text to use for the field\'s hint text',
|
|
102
|
-
type: 'string'
|
|
112
|
+
type: 'string',
|
|
113
|
+
table: {
|
|
114
|
+
type: { summary: 'string' }
|
|
115
|
+
}
|
|
103
116
|
}, options) as InputType;
|
|
104
117
|
},
|
|
105
118
|
href: (options?: ArgType) => {
|
|
@@ -190,7 +203,10 @@ const SGDSArgTypes = {
|
|
|
190
203
|
control: { type: 'select' },
|
|
191
204
|
options: params.options,
|
|
192
205
|
description: params.description,
|
|
193
|
-
type: typeof params.options[0]
|
|
206
|
+
type: typeof params.options[0],
|
|
207
|
+
table: {
|
|
208
|
+
type: { summary: typeof params.options[0] }
|
|
209
|
+
}
|
|
194
210
|
} as InputType;
|
|
195
211
|
},
|
|
196
212
|
tagColour: (options?: ArgType) => {
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ Changes are grouped under the labels: `Added`, `Changed`, `Deprecated`, `Fixed`,
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.1.0] - 2026-06-17
|
|
11
|
+
### Added
|
|
12
|
+
- FileUpload component
|
|
13
|
+
- Components to represent each of the notification message states
|
|
14
|
+
- Confirmation notification
|
|
15
|
+
- Error notification
|
|
16
|
+
- Information notification
|
|
17
|
+
- Warning notification
|
|
18
|
+
### Changed
|
|
19
|
+
- Allow hintText and errorMessage props to accept either string or React.ReactNode in: Checkbox, DatePicker, Question, Radio, Select, Textarea, TextInput
|
|
20
|
+
- NotificationBanner and WarningText use updated warning icon
|
|
21
|
+
- Updated to use v4.1.1 of SG Design System
|
|
22
|
+
### Deprecated
|
|
23
|
+
- Confirmation message is deprecated, use confirmation notification instead
|
|
24
|
+
|
|
25
|
+
## [1.0.1] - 2026-04-22
|
|
26
|
+
### Fixed
|
|
27
|
+
- Broken paths on cookie banner and summary list
|
|
28
|
+
|
|
10
29
|
## [1.0.0] - 2026-04-21
|
|
11
30
|
|
|
12
31
|
### Added
|
package/README.md
CHANGED
|
@@ -7,10 +7,6 @@ This repository contains a React implementation of the [Scottish Government Desi
|
|
|
7
7
|
|
|
8
8
|
There is a documentation site showing what is in this implementation and how to use it here: https://designsystem-react.vercel.app/
|
|
9
9
|
|
|
10
|
-
## 🚧 Under construction 🚧
|
|
11
|
-
|
|
12
|
-
Warning: This project is in an alpha state and could potentially receive large breaking changes with little warning while it is being developed.
|
|
13
|
-
|
|
14
10
|
## Feedback, help or support
|
|
15
11
|
|
|
16
12
|
If you need any help or want to give any feedback you can e-mail the Design System team at: [designsystem@gov.scot](mailto:designsystem@gov.scot).
|
|
@@ -29,7 +25,7 @@ Compile the source code from TypeScript/TSX into JavaScript/JSX files, located i
|
|
|
29
25
|
`npm run test`
|
|
30
26
|
Run unit tests
|
|
31
27
|
|
|
32
|
-
`npm run coverage`
|
|
28
|
+
`npm run test:coverage`
|
|
33
29
|
Run unit tests and output a coverage report, located in `/coverage`
|
|
34
30
|
|
|
35
31
|
`npm run storybook`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractNotificationMessageProps } from './types';
|
|
2
|
+
declare const AbstractNotificationMessage: {
|
|
3
|
+
({ ariaLive, children, className, headingLevel, icon, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default AbstractNotificationMessage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Icon_1 = __importDefault(require("../Icon"));
|
|
7
|
+
const ScreenReaderText_1 = __importDefault(require("../ScreenReaderText"));
|
|
8
|
+
const WrapperTag_1 = __importDefault(require("../WrapperTag"));
|
|
9
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const AbstractNotificationMessage = ({ ariaLive = 'polite', children, className, headingLevel = 'h3', icon, isDismissable, title, ...props }) => {
|
|
11
|
+
return (<div aria-live={ariaLive} className={(0, clsx_1.default)([
|
|
12
|
+
'ds_notification-message',
|
|
13
|
+
className
|
|
14
|
+
])} data-module="ds-notification-message" {...props}>
|
|
15
|
+
{icon &&
|
|
16
|
+
<Icon_1.default icon={icon} className="ds_notification-message__icon" iconSize="24"/>}
|
|
17
|
+
<WrapperTag_1.default className="ds_notification-message__title" tagName={headingLevel}>
|
|
18
|
+
{title}
|
|
19
|
+
</WrapperTag_1.default>
|
|
20
|
+
|
|
21
|
+
{children &&
|
|
22
|
+
<div className="ds_notification-message__body">
|
|
23
|
+
{children}
|
|
24
|
+
</div>}
|
|
25
|
+
|
|
26
|
+
{isDismissable &&
|
|
27
|
+
<button type="button" className="ds_notification-message__close js-close-notification-message">
|
|
28
|
+
<ScreenReaderText_1.default>Close this notification</ScreenReaderText_1.default>
|
|
29
|
+
<Icon_1.default isFilled icon="Close" aria-hidden="true"/>
|
|
30
|
+
</button>}
|
|
31
|
+
</div>);
|
|
32
|
+
};
|
|
33
|
+
AbstractNotificationMessage.displayName = 'AbstractNotificationMessage';
|
|
34
|
+
exports.default = AbstractNotificationMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AbstractNotificationMessage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var AbstractNotificationMessage_1 = require("./AbstractNotificationMessage");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(AbstractNotificationMessage_1).default; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HeadingLevel, IconName } from '../../shared-types';
|
|
2
|
+
export interface AbstractNotificationMessageProps extends React.AllHTMLAttributes<HTMLDivElement> {
|
|
3
|
+
ariaLive?: React.AriaAttributes['aria-live'];
|
|
4
|
+
headingLevel?: HeadingLevel;
|
|
5
|
+
icon?: IconName;
|
|
6
|
+
isDismissable?: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
+
}
|
|
@@ -234,18 +234,18 @@ declare const WrapperTag: {
|
|
|
234
234
|
onFocusCapture?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
235
235
|
onBlur?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
236
236
|
onBlurCapture?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
237
|
-
onChange?: React.
|
|
238
|
-
onChangeCapture?: React.
|
|
237
|
+
onChange?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
|
|
238
|
+
onChangeCapture?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
|
|
239
239
|
onBeforeInput?: React.InputEventHandler<HTMLElement> | undefined;
|
|
240
|
-
onBeforeInputCapture?: React.
|
|
241
|
-
onInput?: React.
|
|
242
|
-
onInputCapture?: React.
|
|
243
|
-
onReset?: React.
|
|
244
|
-
onResetCapture?: React.
|
|
245
|
-
onSubmit?: React.
|
|
246
|
-
onSubmitCapture?: React.
|
|
247
|
-
onInvalid?: React.
|
|
248
|
-
onInvalidCapture?: React.
|
|
240
|
+
onBeforeInputCapture?: React.InputEventHandler<HTMLElement> | undefined;
|
|
241
|
+
onInput?: React.InputEventHandler<HTMLElement> | undefined;
|
|
242
|
+
onInputCapture?: React.InputEventHandler<HTMLElement> | undefined;
|
|
243
|
+
onReset?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
244
|
+
onResetCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
245
|
+
onSubmit?: React.SubmitEventHandler<HTMLElement> | undefined;
|
|
246
|
+
onSubmitCapture?: React.SubmitEventHandler<HTMLElement> | undefined;
|
|
247
|
+
onInvalid?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
248
|
+
onInvalidCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
249
249
|
onLoad?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
250
250
|
onLoadCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
251
251
|
onError?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated
|
|
3
|
+
*
|
|
4
|
+
* This component has been deprecated, please use ConfirmationNotification instead
|
|
5
|
+
*
|
|
6
|
+
* Before:
|
|
7
|
+
*
|
|
8
|
+
* `<ConfirmationMessage />`
|
|
9
|
+
*
|
|
10
|
+
* After:
|
|
11
|
+
*
|
|
12
|
+
* `<ConfirmationNotification />`
|
|
13
|
+
*
|
|
14
|
+
* @deprecatedSince 1.1.0
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
import { AbstractNotificationMessageProps } from '../../common/AbstractNotificationMessage/types';
|
|
2
18
|
declare const ConfirmationMessage: {
|
|
3
|
-
({ ariaLive, children, className, headingLevel, title, ...props }:
|
|
19
|
+
({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
20
|
displayName: string;
|
|
5
21
|
};
|
|
6
22
|
export default ConfirmationMessage;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*
|
|
5
|
+
* This component has been deprecated, please use ConfirmationNotification instead
|
|
6
|
+
*
|
|
7
|
+
* Before:
|
|
8
|
+
*
|
|
9
|
+
* `<ConfirmationMessage />`
|
|
10
|
+
*
|
|
11
|
+
* After:
|
|
12
|
+
*
|
|
13
|
+
* `<ConfirmationNotification />`
|
|
14
|
+
*
|
|
15
|
+
* @deprecatedSince 1.1.0
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
2
18
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
20
|
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'ds_confirmation-message',
|
|
12
|
-
className
|
|
13
|
-
])} {...props}>
|
|
14
|
-
<Icon_1.default className="ds_confirmation-message__icon" icon="CheckCircle" iconSize="24"/>
|
|
15
|
-
|
|
16
|
-
<WrapperTag_1.default className="ds_confirmation-message__title" tagName={headingLevel}>
|
|
17
|
-
{title}
|
|
18
|
-
</WrapperTag_1.default>
|
|
19
|
-
{children && <div className="ds_confirmation-message__body">
|
|
20
|
-
{children}
|
|
21
|
-
</div>}
|
|
22
|
-
</div>);
|
|
22
|
+
const ConfirmationNotification_1 = __importDefault(require("..//ConfirmationNotification"));
|
|
23
|
+
const ConfirmationMessage = ({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }) => {
|
|
24
|
+
return (<ConfirmationNotification_1.default ariaLive={ariaLive} className={className} headingLevel={headingLevel} isDismissable={isDismissable} title={title} {...props}>
|
|
25
|
+
{children}
|
|
26
|
+
</ConfirmationNotification_1.default>);
|
|
23
27
|
};
|
|
24
28
|
ConfirmationMessage.displayName = 'ConfirmationMessage';
|
|
25
29
|
exports.default = ConfirmationMessage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractNotificationMessageProps } from '../../common/AbstractNotificationMessage/types';
|
|
2
|
+
declare const ConfirmationNotification: {
|
|
3
|
+
({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default ConfirmationNotification;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AbstractNotificationMessage_1 = __importDefault(require("../../common/AbstractNotificationMessage"));
|
|
8
|
+
const notification_message_1 = __importDefault(require("@scottish-government/design-system/src/components/notification-message/notification-message"));
|
|
9
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const ConfirmationNotification = ({ ariaLive, children, className, headingLevel = 'h3', isDismissable, title, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
/* istanbul ignore else */
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
new notification_message_1.default(ref.current).init();
|
|
16
|
+
}
|
|
17
|
+
}, [ref]);
|
|
18
|
+
return (<AbstractNotificationMessage_1.default ariaLive={ariaLive} className={(0, clsx_1.default)([
|
|
19
|
+
'ds_notification-message--success',
|
|
20
|
+
className
|
|
21
|
+
])} headingLevel={headingLevel} icon="CheckCircle" isDismissable={isDismissable} ref={ref} title={title} {...props}>
|
|
22
|
+
{children}
|
|
23
|
+
</AbstractNotificationMessage_1.default>);
|
|
24
|
+
};
|
|
25
|
+
ConfirmationNotification.displayName = 'ConfirmationNotification';
|
|
26
|
+
exports.default = ConfirmationNotification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ConfirmationNotification';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ConfirmationNotification_1 = require("./ConfirmationNotification");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ConfirmationNotification_1).default; } });
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const AbstractNotificationBanner_1 = __importDefault(require("../../common/AbstractNotificationBanner"));
|
|
8
|
-
const
|
|
8
|
+
const cookie_notification_1 = __importDefault(require("@scottish-government/design-system/src/components/cookie-notification/cookie-notification"));
|
|
9
9
|
const clsx_1 = __importDefault(require("clsx"));
|
|
10
10
|
const CookieBanner = ({ children, className, title = 'Information', ...props }) => {
|
|
11
11
|
const ref = (0, react_1.useRef)(null);
|
|
12
12
|
(0, react_1.useEffect)(() => {
|
|
13
13
|
/* istanbul ignore else */
|
|
14
14
|
if (ref.current) {
|
|
15
|
-
new
|
|
15
|
+
new cookie_notification_1.default(ref.current).init();
|
|
16
16
|
}
|
|
17
17
|
}, [ref]);
|
|
18
18
|
return (<>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractNotificationMessageProps } from '../../common/AbstractNotificationMessage/types';
|
|
2
|
+
declare const ErrorNotification: {
|
|
3
|
+
({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default ErrorNotification;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AbstractNotificationMessage_1 = __importDefault(require("../../common/AbstractNotificationMessage"));
|
|
8
|
+
const notification_message_1 = __importDefault(require("@scottish-government/design-system/src/components/notification-message/notification-message"));
|
|
9
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const ErrorNotification = ({ ariaLive, children, className, headingLevel = 'h3', isDismissable, title, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
/* istanbul ignore else */
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
new notification_message_1.default(ref.current).init();
|
|
16
|
+
}
|
|
17
|
+
}, [ref]);
|
|
18
|
+
return (<AbstractNotificationMessage_1.default ariaLive={ariaLive} className={(0, clsx_1.default)([
|
|
19
|
+
'ds_notification-message--error',
|
|
20
|
+
className
|
|
21
|
+
])} headingLevel={headingLevel} icon="Error" isDismissable={isDismissable} ref={ref} title={title} {...props}>
|
|
22
|
+
{children}
|
|
23
|
+
</AbstractNotificationMessage_1.default>);
|
|
24
|
+
};
|
|
25
|
+
ErrorNotification.displayName = 'ErrorNotification';
|
|
26
|
+
exports.default = ErrorNotification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ErrorNotification';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ErrorNotification_1 = require("./ErrorNotification");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ErrorNotification_1).default; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FileUploadProps } from './types';
|
|
2
|
+
declare const FileUpload: {
|
|
3
|
+
({ accept, capture, className, errorMessage, hasError, hintText, id, isMultiple, label, name, onBlur, onChange, text, ...props }: FileUploadProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default FileUpload;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const ErrorMessage_1 = __importDefault(require("../ErrorMessage"));
|
|
8
|
+
const HintText_1 = __importDefault(require("../../common/HintText"));
|
|
9
|
+
const file_upload_1 = __importDefault(require("@scottish-government/design-system/src/components/file-upload/file-upload"));
|
|
10
|
+
const FileUpload = ({ accept, capture, className, errorMessage, hasError, hintText, id, isMultiple, label, name, onBlur, onChange, text, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
const errorMessageId = `error-message-${id}`;
|
|
13
|
+
const hintTextId = `hint-text-${id}`;
|
|
14
|
+
const describedbys = [];
|
|
15
|
+
if (hintText) {
|
|
16
|
+
describedbys.push(hintTextId);
|
|
17
|
+
}
|
|
18
|
+
;
|
|
19
|
+
if (errorMessage) {
|
|
20
|
+
describedbys.push(errorMessageId);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const options = {
|
|
24
|
+
text: text
|
|
25
|
+
};
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
if (ref.current) {
|
|
28
|
+
new file_upload_1.default(ref.current, options).init();
|
|
29
|
+
}
|
|
30
|
+
}, [ref]);
|
|
31
|
+
function handleBlur(event) {
|
|
32
|
+
if (typeof onBlur === 'function') {
|
|
33
|
+
onBlur(event);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function handleChange(event) {
|
|
37
|
+
if (typeof onChange === 'function') {
|
|
38
|
+
onChange(event);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return (<div className={[
|
|
42
|
+
'ds_file-upload',
|
|
43
|
+
className
|
|
44
|
+
].join(' ')} ref={ref} {...props}>
|
|
45
|
+
<label className="ds_label" htmlFor={id}>{label}</label>
|
|
46
|
+
{hintText && <HintText_1.default id={hintTextId}>{hintText}</HintText_1.default>}
|
|
47
|
+
{errorMessage && <ErrorMessage_1.default id={errorMessageId}>{errorMessage}</ErrorMessage_1.default>}
|
|
48
|
+
<input accept={accept} aria-describedby={describedbys.length ? describedbys.join(' ') : undefined} aria-invalid={hasError} capture={capture} className={[
|
|
49
|
+
'ds_file-upload__input',
|
|
50
|
+
hasError ? 'ds_file-upload__input--error' : ''
|
|
51
|
+
].join(' ')} id={id} multiple={isMultiple} name={name || id} onBlur={handleBlur} onChange={handleChange} type="file"/>
|
|
52
|
+
</div>);
|
|
53
|
+
};
|
|
54
|
+
FileUpload.displayName = 'FileUpload';
|
|
55
|
+
exports.default = FileUpload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FileUpload';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var FileUpload_1 = require("./FileUpload");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(FileUpload_1).default; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FormFieldBase } from '../../shared-types';
|
|
2
|
+
type TextArgs = {
|
|
3
|
+
buttonText: string;
|
|
4
|
+
buttonTextPlural: string;
|
|
5
|
+
defaultStatusText: string;
|
|
6
|
+
defaultStatusTextPlural: string;
|
|
7
|
+
enteredDropzone: string;
|
|
8
|
+
filesAddedText: string;
|
|
9
|
+
filesListHeading: string;
|
|
10
|
+
instructionText: string;
|
|
11
|
+
instructionTextPlural: string;
|
|
12
|
+
leftDropzone: string;
|
|
13
|
+
};
|
|
14
|
+
export interface FileUploadProps extends FormFieldBase<HTMLElement> {
|
|
15
|
+
accept?: string;
|
|
16
|
+
capture?: boolean | 'user' | 'environment';
|
|
17
|
+
className?: string;
|
|
18
|
+
files?: File[];
|
|
19
|
+
id: string;
|
|
20
|
+
isMultiple?: boolean;
|
|
21
|
+
name?: string;
|
|
22
|
+
text?: Partial<TextArgs>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractNotificationMessageProps } from '../../common/AbstractNotificationMessage/types';
|
|
2
|
+
declare const InfoNotification: {
|
|
3
|
+
({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default InfoNotification;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AbstractNotificationMessage_1 = __importDefault(require("../../common/AbstractNotificationMessage"));
|
|
8
|
+
const notification_message_1 = __importDefault(require("@scottish-government/design-system/src/components/notification-message/notification-message"));
|
|
9
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const InfoNotification = ({ ariaLive, children, className, headingLevel = 'h3', isDismissable, title, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
/* istanbul ignore else */
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
new notification_message_1.default(ref.current).init();
|
|
16
|
+
}
|
|
17
|
+
}, [ref]);
|
|
18
|
+
return (<AbstractNotificationMessage_1.default ariaLive={ariaLive} className={(0, clsx_1.default)([
|
|
19
|
+
'ds_notification-message--info',
|
|
20
|
+
className
|
|
21
|
+
])} headingLevel={headingLevel} icon="Info" isDismissable={isDismissable} ref={ref} title={title} {...props}>
|
|
22
|
+
{children}
|
|
23
|
+
</AbstractNotificationMessage_1.default>);
|
|
24
|
+
};
|
|
25
|
+
InfoNotification.displayName = 'InfoNotification';
|
|
26
|
+
exports.default = InfoNotification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './InfoNotification';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var InfoNotification_1 = require("./InfoNotification");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InfoNotification_1).default; } });
|
|
@@ -18,7 +18,7 @@ const NotificationBanner = ({ children, className, hasColourIcon, hasIcon, hasIn
|
|
|
18
18
|
return (<AbstractNotificationBanner_1.default className={(0, clsx_1.default)([
|
|
19
19
|
'ds_reversed',
|
|
20
20
|
className
|
|
21
|
-
])} isDismissable={isDismissable} icon={hasIcon ? "
|
|
21
|
+
])} isDismissable={isDismissable} icon={hasIcon ? "Warning" : undefined} hasColourIcon={hasColourIcon} hasInverseIcon={hasInverseIcon} ref={ref} title={title} {...props}>
|
|
22
22
|
{children}
|
|
23
23
|
</AbstractNotificationBanner_1.default>);
|
|
24
24
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SummaryListItemProps, SummaryListProps } from './types';
|
|
3
|
-
import { ActionLinkProps } from '
|
|
3
|
+
import { ActionLinkProps } from '../../common/ActionLink/types';
|
|
4
4
|
declare const SummaryList: {
|
|
5
5
|
({ children, className, isBorderless, ...props }: SummaryListProps): React.JSX.Element;
|
|
6
6
|
Action: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractNotificationMessageProps } from '../../common/AbstractNotificationMessage/types';
|
|
2
|
+
declare const WarningNotification: {
|
|
3
|
+
({ ariaLive, children, className, headingLevel, isDismissable, title, ...props }: AbstractNotificationMessageProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default WarningNotification;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AbstractNotificationMessage_1 = __importDefault(require("../../common/AbstractNotificationMessage"));
|
|
8
|
+
const notification_message_1 = __importDefault(require("@scottish-government/design-system/src/components/notification-message/notification-message"));
|
|
9
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const WarningNotification = ({ ariaLive, children, className, headingLevel = 'h3', isDismissable, title, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
/* istanbul ignore else */
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
new notification_message_1.default(ref.current).init();
|
|
16
|
+
}
|
|
17
|
+
}, [ref]);
|
|
18
|
+
return (<AbstractNotificationMessage_1.default ariaLive={ariaLive} className={(0, clsx_1.default)([
|
|
19
|
+
'ds_notification-message--warning',
|
|
20
|
+
className
|
|
21
|
+
])} headingLevel={headingLevel} icon="Warning" isDismissable={isDismissable} ref={ref} title={title} {...props}>
|
|
22
|
+
{children}
|
|
23
|
+
</AbstractNotificationMessage_1.default>);
|
|
24
|
+
};
|
|
25
|
+
WarningNotification.displayName = 'WarningNotification';
|
|
26
|
+
exports.default = WarningNotification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './WarningNotification';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var WarningNotification_1 = require("./WarningNotification");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(WarningNotification_1).default; } });
|
|
@@ -4,12 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const clsx_1 = __importDefault(require("clsx"));
|
|
7
|
+
const common_1 = require("../../common");
|
|
7
8
|
const WarningText = ({ children, className, ...props }) => {
|
|
8
9
|
return (<div className={(0, clsx_1.default)([
|
|
9
10
|
'ds_warning-text',
|
|
10
11
|
className
|
|
11
12
|
])} {...props}>
|
|
12
|
-
<strong className="ds_warning-text__icon" aria-hidden="true"
|
|
13
|
+
<strong className="ds_warning-text__icon" aria-hidden="true">
|
|
14
|
+
<common_1.Icon isFilled icon='Warning'/>
|
|
15
|
+
</strong>
|
|
13
16
|
<strong className="visually-hidden">Warning</strong>
|
|
14
17
|
<div className="ds_warning-text__text">
|
|
15
18
|
{children}
|