@scottish-government/designsystem-react 1.0.1 → 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.
Files changed (83) hide show
  1. package/.storybook/sgdsArgTypes.ts +19 -3
  2. package/CHANGELOG.md +19 -0
  3. package/dist/common/AbstractNotificationMessage/AbstractNotificationMessage.d.ts +6 -0
  4. package/dist/common/AbstractNotificationMessage/AbstractNotificationMessage.jsx +34 -0
  5. package/dist/common/AbstractNotificationMessage/index.d.ts +1 -0
  6. package/dist/common/AbstractNotificationMessage/index.js +8 -0
  7. package/dist/common/AbstractNotificationMessage/types.d.ts +9 -0
  8. package/dist/common/AbstractNotificationMessage/types.js +2 -0
  9. package/dist/common/WrapperTag/WrapperTag.d.ts +11 -11
  10. package/dist/components/ConfirmationMessage/ConfirmationMessage.d.ts +18 -2
  11. package/dist/components/ConfirmationMessage/ConfirmationMessage.jsx +21 -17
  12. package/dist/components/ConfirmationNotification/ConfirmationNotification.d.ts +6 -0
  13. package/dist/components/ConfirmationNotification/ConfirmationNotification.jsx +26 -0
  14. package/dist/components/ConfirmationNotification/index.d.ts +1 -0
  15. package/dist/components/ConfirmationNotification/index.js +8 -0
  16. package/dist/components/ErrorNotification/ErrorNotification.d.ts +6 -0
  17. package/dist/components/ErrorNotification/ErrorNotification.jsx +26 -0
  18. package/dist/components/ErrorNotification/index.d.ts +1 -0
  19. package/dist/components/ErrorNotification/index.js +8 -0
  20. package/dist/components/FileUpload/FileUpload.d.ts +6 -0
  21. package/dist/components/FileUpload/FileUpload.jsx +55 -0
  22. package/dist/components/FileUpload/index.d.ts +1 -0
  23. package/dist/components/FileUpload/index.js +8 -0
  24. package/dist/components/FileUpload/types.d.ts +24 -0
  25. package/dist/components/FileUpload/types.js +2 -0
  26. package/dist/components/InfoNotification/InfoNotification.d.ts +6 -0
  27. package/dist/components/InfoNotification/InfoNotification.jsx +26 -0
  28. package/dist/components/InfoNotification/index.d.ts +1 -0
  29. package/dist/components/InfoNotification/index.js +8 -0
  30. package/dist/components/NotificationBanner/NotificationBanner.jsx +1 -1
  31. package/dist/components/WarningNotification/WarningNotification.d.ts +6 -0
  32. package/dist/components/WarningNotification/WarningNotification.jsx +26 -0
  33. package/dist/components/WarningNotification/index.d.ts +1 -0
  34. package/dist/components/WarningNotification/index.js +8 -0
  35. package/dist/components/WarningText/WarningText.jsx +4 -1
  36. package/dist/images/icons/index.d.ts +2 -0
  37. package/dist/images/icons/index.js +5 -1
  38. package/dist/images/icons/info.d.ts +4 -0
  39. package/dist/images/icons/info.jsx +40 -0
  40. package/dist/images/icons/warning.d.ts +4 -0
  41. package/dist/images/icons/warning.jsx +40 -0
  42. package/dist/shared-types.d.ts +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +22 -16
  45. package/src/common/AbstractNotificationMessage/AbstractNotificationMessage.test.tsx +101 -0
  46. package/src/common/AbstractNotificationMessage/AbstractNotificationMessage.tsx +56 -0
  47. package/src/common/AbstractNotificationMessage/index.ts +1 -0
  48. package/src/common/AbstractNotificationMessage/types.ts +10 -0
  49. package/src/components/Button/Button.stories.tsx +1 -1
  50. package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +11 -3
  51. package/src/components/ConfirmationMessage/ConfirmationMessage.test.tsx +58 -23
  52. package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +32 -25
  53. package/src/components/ConfirmationMessage/confirmationmessage.mdx +17 -0
  54. package/src/components/ConfirmationNotification/ConfirmationNotification.stories.tsx +47 -0
  55. package/src/components/ConfirmationNotification/ConfirmationNotification.test.tsx +101 -0
  56. package/src/components/ConfirmationNotification/ConfirmationNotification.tsx +46 -0
  57. package/src/components/ConfirmationNotification/index.ts +1 -0
  58. package/src/components/ErrorNotification/ErrorNotification.stories.tsx +47 -0
  59. package/src/components/ErrorNotification/ErrorNotification.test.tsx +101 -0
  60. package/src/components/ErrorNotification/ErrorNotification.tsx +46 -0
  61. package/src/components/ErrorNotification/index.ts +1 -0
  62. package/src/components/FileDownload/FileDownload.test.tsx +1 -1
  63. package/src/components/FileUpload/FileUpload.stories.tsx +77 -0
  64. package/src/components/FileUpload/FileUpload.test.tsx +185 -0
  65. package/src/components/FileUpload/FileUpload.tsx +87 -0
  66. package/src/components/FileUpload/index.ts +1 -0
  67. package/src/components/FileUpload/types.ts +25 -0
  68. package/src/components/InfoNotification/InfoNotification.stories.tsx +47 -0
  69. package/src/components/InfoNotification/InfoNotification.test.tsx +101 -0
  70. package/src/components/InfoNotification/InfoNotification.tsx +46 -0
  71. package/src/components/InfoNotification/index.ts +1 -0
  72. package/src/components/NotificationBanner/NotificationBanner.tsx +1 -1
  73. package/src/components/TextInput/TextInput.stories.tsx +1 -1
  74. package/src/components/WarningNotification/WarningNotification.stories.tsx +47 -0
  75. package/src/components/WarningNotification/WarningNotification.test.tsx +101 -0
  76. package/src/components/WarningNotification/WarningNotification.tsx +46 -0
  77. package/src/components/WarningNotification/index.ts +1 -0
  78. package/src/components/WarningText/WarningText.tsx +4 -1
  79. package/src/images/icons/index.ts +2 -0
  80. package/src/images/icons/info.tsx +14 -0
  81. package/src/images/icons/warning.tsx +14 -0
  82. package/src/shared-types.ts +1 -1
  83. 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
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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.FormEventHandler<HTMLElement> | undefined;
238
- onChangeCapture?: React.FormEventHandler<HTMLElement> | undefined;
237
+ onChange?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
238
+ onChangeCapture?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
239
239
  onBeforeInput?: React.InputEventHandler<HTMLElement> | undefined;
240
- onBeforeInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
241
- onInput?: React.FormEventHandler<HTMLElement> | undefined;
242
- onInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
243
- onReset?: React.FormEventHandler<HTMLElement> | undefined;
244
- onResetCapture?: React.FormEventHandler<HTMLElement> | undefined;
245
- onSubmit?: React.FormEventHandler<HTMLElement> | undefined;
246
- onSubmitCapture?: React.FormEventHandler<HTMLElement> | undefined;
247
- onInvalid?: React.FormEventHandler<HTMLElement> | undefined;
248
- onInvalidCapture?: React.FormEventHandler<HTMLElement> | undefined;
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
- import { ConfirmationMessageProps } from './types';
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 }: ConfirmationMessageProps): import("react").JSX.Element;
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 Icon_1 = __importDefault(require("../../common/Icon"));
7
- const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
8
- const clsx_1 = __importDefault(require("clsx"));
9
- const ConfirmationMessage = ({ ariaLive = 'polite', children, className, headingLevel = 'h3', title, ...props }) => {
10
- return (<div aria-live={ariaLive} className={(0, clsx_1.default)([
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; } });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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 ? "PriorityHigh" : undefined} hasColourIcon={hasColourIcon} hasInverseIcon={hasInverseIcon} ref={ref} title={title} {...props}>
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
  };
@@ -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"></strong>
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}
@@ -11,7 +11,9 @@ export { default as DoubleChevronRight } from "./double_chevron_right";
11
11
  export { default as Error } from "./error";
12
12
  export { default as ExpandLess } from "./expand_less";
13
13
  export { default as ExpandMore } from "./expand_more";
14
+ export { default as Info } from "./info";
14
15
  export { default as List } from "./list";
15
16
  export { default as Menu } from "./menu";
16
17
  export { default as PriorityHigh } from "./priority_high";
17
18
  export { default as Search } from "./search";
19
+ export { default as Warning } from "./warning";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Search = exports.PriorityHigh = exports.Menu = exports.List = exports.ExpandMore = exports.ExpandLess = exports.Error = exports.DoubleChevronRight = exports.DoubleChevronLeft = exports.Description = exports.Close = exports.ChevronRight = exports.ChevronLeft = exports.CheckCircle = exports.Cancel = exports.CalendarToday = exports.ArrowUpward = void 0;
6
+ exports.Warning = exports.Search = exports.PriorityHigh = exports.Menu = exports.List = exports.Info = exports.ExpandMore = exports.ExpandLess = exports.Error = exports.DoubleChevronRight = exports.DoubleChevronLeft = exports.Description = exports.Close = exports.ChevronRight = exports.ChevronLeft = exports.CheckCircle = exports.Cancel = exports.CalendarToday = exports.ArrowUpward = void 0;
7
7
  var arrow_upward_1 = require("./arrow_upward");
8
8
  Object.defineProperty(exports, "ArrowUpward", { enumerable: true, get: function () { return __importDefault(arrow_upward_1).default; } });
9
9
  var calendar_today_1 = require("./calendar_today");
@@ -30,6 +30,8 @@ var expand_less_1 = require("./expand_less");
30
30
  Object.defineProperty(exports, "ExpandLess", { enumerable: true, get: function () { return __importDefault(expand_less_1).default; } });
31
31
  var expand_more_1 = require("./expand_more");
32
32
  Object.defineProperty(exports, "ExpandMore", { enumerable: true, get: function () { return __importDefault(expand_more_1).default; } });
33
+ var info_1 = require("./info");
34
+ Object.defineProperty(exports, "Info", { enumerable: true, get: function () { return __importDefault(info_1).default; } });
33
35
  var list_1 = require("./list");
34
36
  Object.defineProperty(exports, "List", { enumerable: true, get: function () { return __importDefault(list_1).default; } });
35
37
  var menu_1 = require("./menu");
@@ -38,3 +40,5 @@ var priority_high_1 = require("./priority_high");
38
40
  Object.defineProperty(exports, "PriorityHigh", { enumerable: true, get: function () { return __importDefault(priority_high_1).default; } });
39
41
  var search_1 = require("./search");
40
42
  Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return __importDefault(search_1).default; } });
43
+ var warning_1 = require("./warning");
44
+ Object.defineProperty(exports, "Warning", { enumerable: true, get: function () { return __importDefault(warning_1).default; } });
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import type { SVGProps } from "react";
3
+ declare const SvgInfo: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgInfo;