@dnanpm/styleguide 3.9.7 → 3.9.8

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 (37) hide show
  1. package/build/cjs/components/Button/Button.d.ts +13 -1
  2. package/build/cjs/components/Button/Button.js +5 -5
  3. package/build/cjs/components/ButtonArrow/ButtonArrow.d.ts +8 -2
  4. package/build/cjs/components/ButtonArrow/ButtonArrow.js +2 -2
  5. package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +11 -1
  6. package/build/cjs/components/ButtonIcon/ButtonIcon.js +4 -4
  7. package/build/cjs/components/Checkbox/Checkbox.js +65 -4
  8. package/build/cjs/components/Input/Input.d.ts +14 -0
  9. package/build/cjs/components/Input/Input.js +22 -5
  10. package/build/cjs/components/Label/Label.d.ts +7 -0
  11. package/build/cjs/components/Label/Label.js +3 -1
  12. package/build/cjs/components/Modal/Modal.d.ts +51 -27
  13. package/build/cjs/components/Modal/Modal.js +92 -16
  14. package/build/cjs/components/RadioButton/RadioButton.js +61 -4
  15. package/build/cjs/components/Search/Search.d.ts +12 -0
  16. package/build/cjs/components/Search/Search.js +9 -3
  17. package/build/cjs/themes/globalStyles.d.ts +0 -166
  18. package/build/cjs/themes/globalStyles.js +0 -59
  19. package/build/es/components/Button/Button.d.ts +13 -1
  20. package/build/es/components/Button/Button.js +5 -5
  21. package/build/es/components/ButtonArrow/ButtonArrow.d.ts +8 -2
  22. package/build/es/components/ButtonArrow/ButtonArrow.js +2 -2
  23. package/build/es/components/ButtonIcon/ButtonIcon.d.ts +11 -1
  24. package/build/es/components/ButtonIcon/ButtonIcon.js +5 -5
  25. package/build/es/components/Checkbox/Checkbox.js +65 -4
  26. package/build/es/components/Input/Input.d.ts +14 -0
  27. package/build/es/components/Input/Input.js +22 -5
  28. package/build/es/components/Label/Label.d.ts +7 -0
  29. package/build/es/components/Label/Label.js +3 -1
  30. package/build/es/components/Modal/Modal.d.ts +51 -27
  31. package/build/es/components/Modal/Modal.js +93 -17
  32. package/build/es/components/RadioButton/RadioButton.js +61 -4
  33. package/build/es/components/Search/Search.d.ts +12 -0
  34. package/build/es/components/Search/Search.js +9 -3
  35. package/build/es/themes/globalStyles.d.ts +0 -166
  36. package/build/es/themes/globalStyles.js +3 -61
  37. package/package.json +6 -5
@@ -78,10 +78,22 @@ export interface Props {
78
78
  * Allows to pass testid string for testing purposes
79
79
  */
80
80
  'data-testid'?: string;
81
+ /**
82
+ * Allows to pass a screen reader label for the button
83
+ */
84
+ 'aria-label'?: string;
81
85
  /**
82
86
  * Allows to pass any data-* attribute
83
87
  */
84
88
  dataAttributes?: Record<`data-${string}`, string>;
89
+ /**
90
+ * Allows to pass a screen reader label for the loading indicator
91
+ */
92
+ loadingLabel?: string;
93
+ /**
94
+ * Ref for the button element
95
+ */
96
+ ref?: React.Ref<HTMLButtonElement>;
85
97
  }
86
98
  export declare const shade: {
87
99
  pink: {
@@ -100,6 +112,6 @@ export declare const shade: {
100
112
  };
101
113
  };
102
114
  /** @visibleName Button */
103
- declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
115
+ declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
104
116
  /** @component */
105
117
  export default Button;
@@ -52,7 +52,7 @@ const Element = styled__default.default.button `
52
52
  display: inline-flex;
53
53
  }
54
54
 
55
- &:focus {
55
+ &:focus-visible {
56
56
  color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
57
57
  background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
58
58
  border: 2px solid
@@ -66,7 +66,7 @@ const Element = styled__default.default.button `
66
66
  color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
67
67
  background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
68
68
 
69
- &:focus {
69
+ &:focus-visible {
70
70
  border: 2px solid
71
71
  ${({ darkBg }) => (darkBg ? theme.default.color.focus.dark : theme.default.color.focus.light)};
72
72
  box-shadow: 0px 0px 0px 2px
@@ -122,11 +122,11 @@ const Element = styled__default.default.button `
122
122
  `;
123
123
  /** @visibleName Button */
124
124
  const Button = (_a) => {
125
- var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value']);
126
- return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue }, props.dataAttributes, (!props.href && {
125
+ var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
126
+ return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
127
127
  name: props.name,
128
128
  disabled: props.disabled,
129
- })), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
129
+ })), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum, label: props.loadingLabel })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
130
130
  };
131
131
 
132
132
  exports.default = Button;
@@ -24,7 +24,7 @@ type Props = ({
24
24
  */
25
25
  icon: ReactNode;
26
26
  direction?: never;
27
- }) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close'> & {
27
+ }) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close' | 'href' | 'loadingLabel'> & {
28
28
  /**
29
29
  * Allows to change the styling of component
30
30
  *
@@ -34,8 +34,14 @@ type Props = ({
34
34
  * @default 'primary'
35
35
  */
36
36
  variant?: ButtonArrowVariant;
37
+ /**
38
+ * Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
39
+ *
40
+ * @deprecated Use `Button` component for href support
41
+ */
42
+ href?: string;
37
43
  };
38
44
  /** @visibleName Button Arrow */
39
- declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
45
+ declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
40
46
  /** @component */
41
47
  export default ButtonArrow;
@@ -71,9 +71,9 @@ const buttonsMap = {
71
71
  };
72
72
  /** @visibleName Button Arrow */
73
73
  const ButtonArrow = (_a) => {
74
- var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value']);
74
+ var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
75
75
  const Element = buttonsMap[variant];
76
- return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem" })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
76
+ return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem", "aria-hidden": true })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
77
77
  };
78
78
 
79
79
  exports.default = ButtonArrow;
@@ -26,8 +26,18 @@ interface Props extends Omit<ButtonProps, 'fullWidth'> {
26
26
  * @default undefined
27
27
  */
28
28
  ariaExpanded?: boolean;
29
+ /**
30
+ * Allows to pass aria hidden to the icon element for screen readers
31
+ *
32
+ * @default undefined
33
+ */
34
+ ariaHidden?: boolean;
35
+ /**
36
+ * Screen reader label describing the purpose of the ButtonIcon,
37
+ */
38
+ ariaLabel?: string;
29
39
  }
30
40
  /** @visibleName Button Icon */
31
- declare const ButtonIcon: ({ icon, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
41
+ declare const ButtonIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;
32
42
  /** @component */
33
43
  export default ButtonIcon;
@@ -89,12 +89,12 @@ const ButtonElement = styled__default.default.button `
89
89
  `}
90
90
  `;
91
91
  /** @visibleName Button Icon */
92
- const ButtonIcon = (_a) => {
92
+ const ButtonIcon = React.forwardRef((_a, ref) => {
93
93
  var { icon = icons.EditUnderline, 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["icon", 'data-testid', 'data-no-close', 'data-track-value']);
94
94
  const position = props.isReversed ? 'right' : 'left';
95
- return (React__default.default.createElement(ButtonElement, Object.assign({ id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
96
- React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined }),
95
+ return (React__default.default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
96
+ React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": props.ariaHidden }),
97
97
  props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
98
- };
98
+ });
99
99
 
100
100
  exports.default = ButtonIcon;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
6
  var React = require('react');
7
- var globalStyles = require('../../themes/globalStyles.js');
8
7
  var styled = require('../../themes/styled.js');
9
8
  var theme = require('../../themes/theme.js');
10
9
  var styledUtils = require('../../utils/styledUtils.js');
@@ -26,17 +25,78 @@ const Container = styled.default.div `
26
25
  line-height: ${theme.default.lineHeight.default};
27
26
  margin-bottom: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)};
28
27
  `;
29
- const Input = styled.default(globalStyles.CheckboxAndRadioInputCore) `
28
+ const Input = styled.default.input `
29
+ display: inline-grid;
30
+ appearance: none;
31
+ place-content: center;
32
+ float: left;
33
+ margin: 0;
34
+ cursor: pointer;
35
+ font-family: ${theme.default.fontFamily.default};
36
+ font-size: ${theme.default.fontSize.default};
37
+ line-height: ${theme.default.lineHeight.default};
38
+ min-width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
39
+ width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
40
+ height: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
41
+ color: ${theme.default.color.line.L01};
42
+ border: 2px solid ${theme.default.color.line.L01};
43
+ background-color: ${theme.default.color.background.white.default};
30
44
  position: relative;
31
45
  top: ${styledUtils.getDividedSize(theme.default.base.baseWidth, 5)};
46
+ border-radius: ${theme.default.radius.s};
47
+
48
+ & + label {
49
+ cursor: pointer;
50
+ color: ${theme.default.color.text.black};
51
+ font-weight: ${theme.default.fontWeight.medium};
52
+ padding-left: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
53
+ }
54
+
55
+ &::before {
56
+ content: '';
57
+ transform: scale(0);
58
+ background-color: currentColor;
59
+ }
32
60
 
33
61
  &:checked {
62
+ color: ${theme.default.color.default.pink};
63
+ border-color: ${theme.default.color.default.pink};
64
+
34
65
  &::before {
66
+ transform: scale(1);
35
67
  width: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
36
68
  height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
37
69
  background-image: url('${SVGIconData}');
38
70
  }
39
71
  }
72
+
73
+ &:disabled {
74
+ cursor: not-allowed;
75
+ color: ${theme.default.color.text.gray};
76
+ background-color: ${theme.default.color.line.L02 + theme.default.color.transparency.T40};
77
+ border-color: ${theme.default.color.line.L01 + theme.default.color.transparency.T40};
78
+
79
+ & + label {
80
+ cursor: not-allowed;
81
+ color: ${theme.default.color.text.gray};
82
+ }
83
+ }
84
+
85
+ &:disabled:checked {
86
+ color: ${theme.default.color.background.pink.E02};
87
+ border-color: ${theme.default.color.background.pink.E02};
88
+ background-color: ${theme.default.color.background.white.default};
89
+
90
+ &::before {
91
+ background-color: ${theme.default.color.background.pink.E02};
92
+ }
93
+ }
94
+
95
+ &:focus-visible {
96
+ outline: none;
97
+ box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
98
+ 0px 0px 0px 4px ${theme.default.color.focus.dark};
99
+ }
40
100
  `;
41
101
  const Mandatory = styled.default.span `
42
102
  color: ${theme.default.color.default.pink};
@@ -50,6 +110,7 @@ const ErrorMessage = styled.default.div `
50
110
  `;
51
111
  const Checkbox = (_a) => {
52
112
  var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
113
+ const errorId = `${props.id}-error`;
53
114
  const handleChange = () => {
54
115
  if (props.onChange && !props.disabled) {
55
116
  props.onChange(!props.value);
@@ -57,11 +118,11 @@ const Checkbox = (_a) => {
57
118
  };
58
119
  return (React__default.default.createElement(React__default.default.Fragment, null,
59
120
  React__default.default.createElement(Container, null,
60
- React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), "aria-checked": Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId }),
121
+ React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId, "aria-required": props.required, "aria-invalid": props.error ? 'true' : undefined, "aria-errormessage": props.error && props.errorMessage ? errorId : undefined }),
61
122
  React__default.default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
62
123
  props.label,
63
124
  props.required && React__default.default.createElement(Mandatory, null, "*"))),
64
- props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage))));
125
+ props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error`, id: errorId, role: "alert" }, props.errorMessage))));
65
126
  };
66
127
 
67
128
  exports.default = Checkbox;
@@ -129,6 +129,20 @@ interface Props {
129
129
  * Allows to pass a custom className
130
130
  */
131
131
  className?: string;
132
+ /**
133
+ * Screen reader label describing the purpose of the Input
134
+ *
135
+ * @default id
136
+ */
137
+ ariaLabel?: string;
138
+ /**
139
+ * Screen reader label describing the password toggle
140
+ */
141
+ passwordToggleLabel?: string;
142
+ /**
143
+ * Screen reader label describing the clear button
144
+ */
145
+ clearButtonLabel?: string;
132
146
  /**
133
147
  * Allows to pass testid string for testing purposes
134
148
  */
@@ -32,6 +32,7 @@ const FieldWrapper = styled.default.div `
32
32
  height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 4)};
33
33
  padding: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
34
34
  background-color: ${theme.default.color.background.white.default};
35
+ align-items: center;
35
36
 
36
37
  ${({ status }) => status === 'error' &&
37
38
  `
@@ -106,6 +107,11 @@ const StyledInput = styled.default.input `
106
107
  color: ${theme.default.color.text.black}${theme.default.color.transparency.T40};
107
108
  }
108
109
  `;
110
+ const StyledButtonIcon = styled.default(ButtonIcon.default) `
111
+ .dnasg-icon svg {
112
+ fill: ${theme.default.color.text.black};
113
+ }
114
+ `;
109
115
  const Message = styled.default.div `
110
116
  font-size: ${theme.default.fontSize.s};
111
117
  font-weight: ${theme.default.fontWeight.book};
@@ -118,6 +124,7 @@ const ErrorMessage = styled.default(Message) `
118
124
  color: ${theme.default.color.notification.error};
119
125
  `;
120
126
  const Input = (_a) => {
127
+ var _b;
121
128
  var { type = 'text', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
122
129
  const inputRef = React.useRef(null);
123
130
  const [showPassword, setShowPassword] = React.useState(false);
@@ -147,22 +154,32 @@ const Input = (_a) => {
147
154
  inputRef.current.focus();
148
155
  }
149
156
  };
157
+ const getDescribedBy = () => {
158
+ if (props.status === 'error' && props.errorMessage) {
159
+ return `${props.id}-error`;
160
+ }
161
+ if (props.status === 'comment' && props.commentMessage) {
162
+ return `${props.id}-comment`;
163
+ }
164
+ return undefined;
165
+ };
150
166
  return (React__default.default.createElement(FieldContainer, { className: props.className },
151
167
  props.label && (React__default.default.createElement(LabelText.default, { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, status: props.status === 'error' ? props.status : undefined, isMandatory: props.required }, props.label)),
152
168
  React__default.default.createElement(FieldWrapper, { status: props.status, "$type": type, "$disabled": props.disabled },
153
- React__default.default.createElement(StyledInput, { id: props.id, name: props.name, type: type, value: props.value, placeholder: props.placeholder, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, autoComplete: props.autocomplete, "aria-disabled": props.disabled, "aria-label": props.id, ref: inputRef, tabIndex: props.tabIndex, "data-testid": dataTestId, readOnly: props.readonly }),
169
+ React__default.default.createElement(StyledInput, { id: props.id, name: props.name, type: props.readonly ? 'hidden' : type, value: props.value, placeholder: props.placeholder, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, autoComplete: props.autocomplete, "aria-disabled": props.disabled, "aria-label": !props.label ? (_b = props.ariaLabel) !== null && _b !== void 0 ? _b : props.id : undefined, ref: inputRef, tabIndex: props.tabIndex, "aria-describedby": getDescribedBy(), "data-testid": dataTestId, readOnly: props.readonly }),
170
+ props.readonly && React__default.default.createElement("div", null, props.value),
154
171
  ((props.status && props.status !== 'comment') ||
155
172
  props.showPasswordToggle ||
156
173
  props.disabled ||
157
174
  props.onClearableButtonClick) && (React__default.default.createElement(IconWrapper, null,
158
- props.showPasswordToggle && (React__default.default.createElement(Icon.default, { icon: showPassword ? icons.EyeOpen : icons.EyeClosed, onClick: togglePasswordVisibility })),
175
+ props.showPasswordToggle && (React__default.default.createElement(StyledButtonIcon, { icon: showPassword ? icons.EyeOpen : icons.EyeClosed, onClick: togglePasswordVisibility, ariaLabel: props.passwordToggleLabel, ariaHidden: true })),
159
176
  (props.status === 'success' || props.status === 'error') && (React__default.default.createElement(Icon.default, { icon: iconsMap[props.status], color: theme.default.color.notification[props.status] })),
160
177
  props.disabled && React__default.default.createElement(Icon.default, { icon: icons.Lock }),
161
178
  props.onClearableButtonClick &&
162
179
  Boolean(props.value) &&
163
- !props.disabled && (React__default.default.createElement(ButtonIcon.default, { icon: icons.Close, onClick: props.onClearableButtonClick }))))),
164
- props.status === 'error' && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
165
- props.status === 'comment' && props.commentMessage && (React__default.default.createElement(Message, { "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
180
+ !props.disabled && (React__default.default.createElement(ButtonIcon.default, { icon: icons.Close, onClick: props.onClearableButtonClick, ariaLabel: props.clearButtonLabel, ariaHidden: true }))))),
181
+ props.status === 'error' && props.errorMessage && (React__default.default.createElement(ErrorMessage, { id: `${props.id}-error`, "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
182
+ props.status === 'comment' && props.commentMessage && (React__default.default.createElement(Message, { id: `${props.id}-comment`, "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
166
183
  };
167
184
 
168
185
  exports.default = Input;
@@ -1,7 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  type LabelType = 'campaign' | 'new' | 'presale' | 'other';
4
+ type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4
5
  interface Props {
6
+ /**
7
+ * Enables the Label component to be rendered as a heading element
8
+ *
9
+ * @default 'span'
10
+ */
11
+ headingLevel?: HeadingLevel;
5
12
  /**
6
13
  * Allows to change the background color of component
7
14
  */
@@ -30,10 +30,12 @@ const StyledLabel = styled.default.span `
30
30
  text-align: center;
31
31
  text-transform: uppercase;
32
32
  border-radius: ${theme.default.radius.pill};
33
+ margin: 0;
33
34
  `;
34
35
  const Label = (_a) => {
35
36
  var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
36
- return (React__default.default.createElement(StyledLabel, { type: props.type, className: props.className, "data-testid": dataTestId }, props.children));
37
+ const HeadingTag = props.headingLevel || 'span';
38
+ return (React__default.default.createElement(StyledLabel, { as: HeadingTag, type: props.type, className: props.className, "data-testid": dataTestId }, props.children));
37
39
  };
38
40
 
39
41
  exports.default = Label;
@@ -1,15 +1,21 @@
1
- import type { ReactNode } from 'react';
2
1
  import React from 'react';
2
+ import type { ReactNode } from 'react';
3
3
  import type { Props as ReactModalProps } from 'react-modal';
4
+ type Variant = 'light' | 'dark';
5
+ type Size = 'small' | 'medium' | 'large';
4
6
  interface Props {
5
- /**
6
- * Allows to control the state of component
7
- */
8
- isOpen: boolean;
9
7
  /**
10
8
  * Unique ID for the component
11
9
  */
12
10
  id?: string;
11
+ /**
12
+ * Allows to pass a custom className
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Allows to pass testid string for testing purposes
17
+ */
18
+ 'data-testid'?: string;
13
19
  /**
14
20
  * Modal title
15
21
  */
@@ -18,6 +24,10 @@ interface Props {
18
24
  * Content of the component
19
25
  */
20
26
  children?: ReactNode;
27
+ /**
28
+ * Allows to display custom footer
29
+ */
30
+ footer?: ReactNode;
21
31
  /**
22
32
  * Allows to hide application from assistive screenreaders and other assistive technologies while the modal is open
23
33
  *
@@ -25,45 +35,59 @@ interface Props {
25
35
  */
26
36
  appElement?: string;
27
37
  /**
28
- * Allows to change CSS property `max-width` for Modal content wrapper element.
29
- * Width in mobile view is always 100% of the window size
38
+ * Allows to control the state of component
39
+ */
40
+ isOpen: boolean;
41
+ /**
42
+ * Allows to disable all closing handlers.
43
+ * When set to `false`, modal can be closed only by setting `isOpen` flag to `false`
30
44
  *
31
- * @default '37.5rem'
45
+ * @default true
32
46
  */
33
- maxWidth?: string;
47
+ isClosable?: boolean;
34
48
  /**
35
- * On overlay or close button click callback
49
+ * Allows to show and hide close button
50
+ *
51
+ * @default true
36
52
  */
37
- onRequestClose?: ReactModalProps['onRequestClose'];
53
+ closeButton?: boolean;
38
54
  /**
39
- * Allows to set property `aria-label` for content element
55
+ * On overlay or close button click callback
40
56
  */
41
- contentLabel?: string;
57
+ onRequestClose?: ReactModalProps['onRequestClose'];
42
58
  /**
43
59
  * Allows to set property `aria-label` for `ButtonClose` element
44
60
  */
45
61
  closeLabel?: string;
46
62
  /**
47
- * Allows to show and hide close button
48
- *
49
- * @default true
63
+ * Allows to set property `aria-label` for content element
50
64
  */
51
- closeButton?: boolean;
65
+ contentLabel?: string;
52
66
  /**
53
- * Allows to disable all closing handlers.
54
- * When set to `false`, modal can be closed only by setting `isOpen` flag to `false`
55
- *
56
- * @default true
67
+ * Allows changing CSS property `max-width` for Modal content wrapper element.
68
+ * @deprecated Replaced with 'size' property
57
69
  */
58
- isClosable?: boolean;
70
+ maxWidth?: string;
59
71
  /**
60
- * Allows to pass a custom className
72
+ * Allows to change the size of the component.
73
+ * Size in mobile view is always 100% of the window size
74
+ *
75
+ * @param {Size} small Renders component with 'max-width' of 480px
76
+ * @param {Size} medium Renders component with 'max-width' of 768px
77
+ * @param {Size} large Renders component with 960px fixed width
78
+ *
79
+ * @default 'medium'
61
80
  */
62
- className?: string;
81
+ size?: Size;
63
82
  /**
64
- * Allows to pass testid string for testing purposes
83
+ * Allows to change the color scheme of the component
84
+ *
85
+ * @param {Variant} light Sets header background color to `theme.color.background.white.default`
86
+ * @param {Variant} dark Sets header background color to `theme.color.background.plum.E02`
87
+ *
88
+ * @default 'light'
65
89
  */
66
- 'data-testid'?: string;
90
+ variant?: Variant;
67
91
  }
68
- declare const Modal: ({ appElement, maxWidth, closeButton, isClosable, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
92
+ declare const Modal: ({ appElement, size, variant, closeButton, isClosable, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
69
93
  export default Modal;