@dnanpm/styleguide 3.9.7 → 3.9.9

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 (61) 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/Carousel/Carousel.d.ts +188 -0
  8. package/build/cjs/components/Carousel/Carousel.js +23 -10
  9. package/build/cjs/components/Checkbox/Checkbox.js +65 -4
  10. package/build/cjs/components/Divider/Divider.d.ts +4 -0
  11. package/build/cjs/components/Divider/Divider.js +2 -1
  12. package/build/cjs/components/InfoDialog/InfoDialog.d.ts +4 -0
  13. package/build/cjs/components/InfoDialog/InfoDialog.js +1 -1
  14. package/build/cjs/components/Input/Input.d.ts +14 -0
  15. package/build/cjs/components/Input/Input.js +21 -5
  16. package/build/cjs/components/Label/Label.d.ts +7 -0
  17. package/build/cjs/components/Label/Label.js +3 -1
  18. package/build/cjs/components/LabelText/LabelText.d.ts +5 -3
  19. package/build/cjs/components/LabelText/LabelText.js +1 -1
  20. package/build/cjs/components/Modal/Modal.d.ts +51 -27
  21. package/build/cjs/components/Modal/Modal.js +92 -16
  22. package/build/cjs/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  23. package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +13 -6
  24. package/build/cjs/components/RadioButton/RadioButton.js +61 -4
  25. package/build/cjs/components/ReadMore/ReadMore.d.ts +4 -0
  26. package/build/cjs/components/ReadMore/ReadMore.js +30 -3
  27. package/build/cjs/components/Search/Search.d.ts +12 -0
  28. package/build/cjs/components/Search/Search.js +9 -3
  29. package/build/cjs/themes/globalStyles.d.ts +0 -166
  30. package/build/cjs/themes/globalStyles.js +0 -59
  31. package/build/es/components/Button/Button.d.ts +13 -1
  32. package/build/es/components/Button/Button.js +5 -5
  33. package/build/es/components/ButtonArrow/ButtonArrow.d.ts +8 -2
  34. package/build/es/components/ButtonArrow/ButtonArrow.js +2 -2
  35. package/build/es/components/ButtonIcon/ButtonIcon.d.ts +11 -1
  36. package/build/es/components/ButtonIcon/ButtonIcon.js +5 -5
  37. package/build/es/components/Carousel/Carousel.d.ts +188 -0
  38. package/build/es/components/Carousel/Carousel.js +23 -11
  39. package/build/es/components/Checkbox/Checkbox.js +65 -4
  40. package/build/es/components/Divider/Divider.d.ts +4 -0
  41. package/build/es/components/Divider/Divider.js +2 -1
  42. package/build/es/components/InfoDialog/InfoDialog.d.ts +4 -0
  43. package/build/es/components/InfoDialog/InfoDialog.js +1 -1
  44. package/build/es/components/Input/Input.d.ts +14 -0
  45. package/build/es/components/Input/Input.js +21 -5
  46. package/build/es/components/Label/Label.d.ts +7 -0
  47. package/build/es/components/Label/Label.js +3 -1
  48. package/build/es/components/LabelText/LabelText.d.ts +5 -3
  49. package/build/es/components/LabelText/LabelText.js +1 -1
  50. package/build/es/components/Modal/Modal.d.ts +51 -27
  51. package/build/es/components/Modal/Modal.js +93 -17
  52. package/build/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  53. package/build/es/components/ProgressIndicator/ProgressIndicator.js +13 -6
  54. package/build/es/components/RadioButton/RadioButton.js +61 -4
  55. package/build/es/components/ReadMore/ReadMore.d.ts +4 -0
  56. package/build/es/components/ReadMore/ReadMore.js +31 -4
  57. package/build/es/components/Search/Search.d.ts +12 -0
  58. package/build/es/components/Search/Search.js +9 -3
  59. package/build/es/themes/globalStyles.d.ts +0 -166
  60. package/build/es/themes/globalStyles.js +3 -61
  61. package/package.json +10 -9
@@ -1,14 +1,20 @@
1
1
  import { __rest } from 'tslib';
2
- import { Close } from '@dnanpm/icons';
3
2
  import React__default from 'react';
4
3
  import ReactModal from 'react-modal';
4
+ import { Close } from '@dnanpm/icons';
5
5
  import styled, { createGlobalStyle } from '../../themes/styled.js';
6
6
  import theme from '../../themes/theme.js';
7
- import { media, getMultipliedSize } from '../../utils/styledUtils.js';
7
+ import { getMultipliedSize } from '../../utils/styledUtils.js';
8
8
  import Box from '../Box/Box.js';
9
9
  import ButtonClose from '../ButtonClose/ButtonClose.js';
10
- import Icon from '../Icon/Icon.js';
11
10
 
11
+ const sizeMap = {
12
+ mobile: '375px',
13
+ small: '480px',
14
+ medium: '768px',
15
+ large: '960px',
16
+ wide: '1535px',
17
+ };
12
18
  const GlobalStyle = createGlobalStyle `
13
19
  body.ReactModal__Body--open {
14
20
  overflow: hidden;
@@ -16,16 +22,27 @@ const GlobalStyle = createGlobalStyle `
16
22
  `;
17
23
  const StyledReactModal = styled(ReactModal) `
18
24
  position: relative;
19
- width: 100vw;
20
- height: 100dvh;
21
25
  max-width: 100vw;
22
- max-height: 100%;
26
+ width: 100vw;
27
+ max-height: 100vh;
28
+ height: 100vh;
23
29
  overflow-y: auto;
24
30
 
25
- ${({ maxWidth }) => media.sm `
26
- width: ${maxWidth};
27
- height: auto;
28
- `};
31
+ @media (min-width: ${sizeMap.mobile}) {
32
+ max-width: ${({ size }) => sizeMap[size]};
33
+ max-height: 90%;
34
+ margin: 0 ${getMultipliedSize(theme.base.baseWidth, 1)};
35
+ }
36
+
37
+ @media (min-width: ${sizeMap.small}) {
38
+ width: 90vw;
39
+ max-height: 60%;
40
+ }
41
+
42
+ @media (min-width: ${sizeMap.wide}) {
43
+ max-width: 100%;
44
+ width: 960px;
45
+ }
29
46
  `;
30
47
  const StyledOverlay = styled.div `
31
48
  display: flex;
@@ -51,16 +68,72 @@ const StyledOverlay = styled.div `
51
68
  }
52
69
  `;
53
70
  const StyledBox = styled(Box) `
71
+ display: flex;
72
+ flex-direction: column;
54
73
  height: 100%;
74
+ padding: 0;
75
+ border: none;
55
76
  overflow-y: auto;
77
+
78
+ @media (max-width: ${sizeMap.mobile}) {
79
+ border-radius: 0;
80
+ }
56
81
  `;
57
82
  const StyledContent = styled.div `
58
83
  &:focus {
59
84
  outline: none;
60
85
  }
86
+
87
+ @media (min-width: ${sizeMap.small}) {
88
+ border-radius: ${theme.radius.default};
89
+ }
90
+ `;
91
+ const ContentWrapper = styled.div `
92
+ padding-top: ${getMultipliedSize(theme.base.baseWidth, 1)};
93
+ padding-left: ${getMultipliedSize(theme.base.baseWidth, 2)};
94
+ padding-bottom: ${getMultipliedSize(theme.base.baseWidth, 2)};
95
+ padding-right: ${getMultipliedSize(theme.base.baseWidth, 2)};
96
+ `;
97
+ const Header = styled.div `
98
+ padding: ${getMultipliedSize(theme.base.baseWidth, 2)};
99
+ background-color: ${({ variant }) => variant === 'dark'
100
+ ? theme.color.background.plum.E02
101
+ : theme.color.background.white.default};
102
+ width: 100%;
103
+
104
+ h2,
105
+ p {
106
+ margin: 0;
107
+ }
61
108
  `;
62
109
  const Title = styled.h2 `
63
- margin: 0 auto ${getMultipliedSize(theme.base.baseWidth, 2)};
110
+ font-size: ${theme.fontSize.h2M};
111
+ line-height: ${theme.lineHeight.h2M};
112
+ color: ${({ variant }) => variant === 'light' ? theme.color.default.black : theme.color.default.white};
113
+
114
+ @media (max-width: ${sizeMap.small}) {
115
+ font-size: ${theme.fontSize.h2S};
116
+ line-height: ${theme.lineHeight.h2S};
117
+ }
118
+ `;
119
+ const CloseButton = styled(ButtonClose) `
120
+ margin: 0;
121
+ padding: 0.5rem;
122
+ border-radius: 0 ${theme.radius.default} 0 ${theme.radius.default};
123
+ background-color: ${({ variant }) => variant === 'light'
124
+ ? theme.color.background.sand.E01
125
+ : theme.color.background.plum.default};
126
+ @media (max-width: ${sizeMap.mobile}) {
127
+ border-radius: 0 0 0 ${theme.radius.default};
128
+ }
129
+ `;
130
+ const Footer = styled.div `
131
+ position: sticky;
132
+ bottom: 0;
133
+ width: 100%;
134
+ margin-top: auto;
135
+ padding: ${getMultipliedSize(theme.base.baseWidth, 2)};
136
+ background-color: ${theme.color.background.white.default};
64
137
  `;
65
138
  const ModalOverlay = ({ ref, onClick, onMouseDown, className }, contentElement) => (React__default.createElement(StyledOverlay, { ref: ref, onClick: onClick, onMouseDown: onMouseDown, className: className }, contentElement));
66
139
  const ModalContent = (_a, children) => {
@@ -68,15 +141,18 @@ const ModalContent = (_a, children) => {
68
141
  return (React__default.createElement(StyledContent, { ref: ref, tabIndex: tabIndex, role: role, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onClick: onClick, "aria-label": contentProps['aria-label'], "aria-modal": contentProps['aria-modal'], className: className }, children));
69
142
  };
70
143
  const Modal = (_a) => {
71
- var { appElement = '#__next', maxWidth = '37.5rem', closeButton = true, isClosable = true, 'data-testid': dataTestId } = _a, props = __rest(_a, ["appElement", "maxWidth", "closeButton", "isClosable", 'data-testid']);
144
+ var { appElement = '#__next', size = 'medium', variant = 'light', closeButton = true, isClosable = true, 'data-testid': dataTestId } = _a, props = __rest(_a, ["appElement", "size", "variant", "closeButton", "isClosable", 'data-testid']);
72
145
  ReactModal.setAppElement(appElement);
73
146
  return (React__default.createElement(React__default.Fragment, null,
74
- React__default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, maxWidth: maxWidth },
147
+ React__default.createElement(StyledReactModal, { id: props.id, size: size, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable },
75
148
  React__default.createElement(StyledBox, { elevation: "extraHigh", "data-testid": dataTestId },
76
- closeButton && isClosable && (React__default.createElement(ButtonClose, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button` },
77
- React__default.createElement(Icon, { icon: Close }))),
78
- props.title && React__default.createElement(Title, null, props.title),
79
- props.children)),
149
+ closeButton && isClosable && (React__default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
150
+ React__default.createElement(Close, { color: variant === 'light'
151
+ ? theme.color.default.plum
152
+ : theme.color.default.white }))),
153
+ React__default.createElement(Header, { variant: variant, "data-testid": dataTestId && `${dataTestId}-header` }, props.title && (React__default.createElement(Title, { size: size, variant: variant }, props.title))),
154
+ React__default.createElement(ContentWrapper, null, props.children),
155
+ props.footer && (React__default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` }, props.footer)))),
80
156
  React__default.createElement(GlobalStyle, null)));
81
157
  };
82
158
 
@@ -1,4 +1,4 @@
1
- import type { MouseEvent } from 'react';
1
+ import type { MouseEvent, KeyboardEvent } from 'react';
2
2
  import React from 'react';
3
3
  type ProgressIndicatorStatus = 'error';
4
4
  interface Props {
@@ -15,7 +15,7 @@ interface Props {
15
15
  * On Progress Indicator Item label or number click callback
16
16
  * Use `e.currentTarget.parentElement` to get Progress Indicator Item element
17
17
  */
18
- onStepClick?: (stepIndex: number, e: MouseEvent<HTMLElement>) => void;
18
+ onStepClick?: (stepIndex: number, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
19
19
  /**
20
20
  * Allows to change version of component to small
21
21
  */
@@ -118,14 +118,21 @@ const ProgressIndicator = (_a) => {
118
118
  props.onStepClick(index, e);
119
119
  }
120
120
  };
121
- return (React__default.createElement(ProgressIndicatorItem, { key: id, small: props.small, "aria-current": isActive ? 'step' : 'false' },
121
+ const handleKeyDown = (e) => {
122
+ if ((e.key === 'Enter' || e.key === ' ') && props.onStepClick) {
123
+ e.preventDefault();
124
+ props.onStepClick(index, e);
125
+ }
126
+ };
127
+ const isClickable = isCompleted && Boolean(props.onStepClick);
128
+ return (React__default.createElement(ProgressIndicatorItem, { key: id, small: props.small },
122
129
  index > 0 && (React__default.createElement(ProgressIndicatorItemConnector, { small: props.small, isActive: isActive, isCompleted: isCompleted })),
123
- React__default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, isClickable: isCompleted && Boolean(props.onStepClick) }, isCompleted || isError ? (React__default.createElement(React__default.Fragment, null,
124
- isCompleted && props.completedStepLabel && (React__default.createElement("span", { className: "visually-hidden" }, props.completedStepLabel)),
125
- React__default.createElement(Icon, { icon: isError ? Warning : Check, color: isError ? theme.color.text.white : theme.color.text.pink, size: "1rem" }))) : (stepNumber)),
126
- label && (React__default.createElement(ProgressIndicatorItemLabel, { small: props.small, onClick: handleClick, isActive: isActive, className: "visually-hidden" }, label))));
130
+ React__default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, onKeyDown: handleKeyDown, tabIndex: isClickable || isActive ? 0 : -1, isClickable: isClickable, role: "tab", "aria-current": isActive ? 'step' : 'false', "aria-label": isCompleted && props.completedStepLabel
131
+ ? `${label}, ${props.completedStepLabel}`
132
+ : label }, isCompleted || isError ? (React__default.createElement(Icon, { icon: isError ? Warning : Check, color: isError ? theme.color.text.white : theme.color.text.pink, size: "1rem", "aria-hidden": true })) : (stepNumber)),
133
+ label && (React__default.createElement(ProgressIndicatorItemLabel, { "aria-hidden": true, small: props.small, onClick: handleClick, isActive: isActive, className: "visually-hidden" }, label))));
127
134
  });
128
- return (React__default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "list" }, progressIndicatorItems));
135
+ return (React__default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "tablist" }, progressIndicatorItems));
129
136
  };
130
137
 
131
138
  export { ProgressIndicator as default };
@@ -1,6 +1,5 @@
1
1
  import { __rest } from 'tslib';
2
2
  import React__default from 'react';
3
- import { CheckboxAndRadioInputCore } from '../../themes/globalStyles.js';
4
3
  import styled from '../../themes/styled.js';
5
4
  import theme from '../../themes/theme.js';
6
5
  import { getMultipliedSize } from '../../utils/styledUtils.js';
@@ -9,13 +8,71 @@ const Container = styled.div `
9
8
  display: flex;
10
9
  margin-bottom: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
11
10
  `;
12
- const Input = styled(CheckboxAndRadioInputCore) `
11
+ const Input = styled.input `
12
+ display: inline-grid;
13
+ appearance: none;
14
+ place-content: center;
15
+ float: left;
16
+ margin: 0;
17
+ cursor: pointer;
18
+ font-family: ${theme.fontFamily.default};
19
+ font-size: ${theme.fontSize.default};
20
+ line-height: ${theme.lineHeight.default};
21
+ min-width: ${getMultipliedSize(theme.base.baseWidth, 2)};
22
+ width: ${getMultipliedSize(theme.base.baseWidth, 2)};
23
+ height: ${getMultipliedSize(theme.base.baseWidth, 2)};
24
+ color: ${theme.color.line.L01};
25
+ border: 2px solid ${theme.color.line.L01};
26
+ background-color: ${theme.color.background.white.default};
13
27
  border-radius: ${theme.radius.circle};
14
28
 
29
+ & + label {
30
+ cursor: pointer;
31
+ color: ${theme.color.text.black};
32
+ font-weight: ${theme.fontWeight.medium};
33
+ padding-left: ${getMultipliedSize(theme.base.baseWidth, 1)};
34
+ }
35
+
15
36
  &::before {
37
+ content: '';
38
+ transform: scale(0);
39
+ background-color: currentColor;
16
40
  border-radius: ${theme.radius.circle};
17
- width: ${getMultipliedSize(theme.base.baseWidth, 1)};
18
- height: ${getMultipliedSize(theme.base.baseWidth, 1)};
41
+ width: ${getMultipliedSize(theme.base.baseWidth, 1.2)};
42
+ height: ${getMultipliedSize(theme.base.baseHeight, 1.2)};
43
+ }
44
+
45
+ &:checked {
46
+ color: ${theme.color.default.pink};
47
+ border-color: ${theme.color.default.pink};
48
+
49
+ &::before {
50
+ transform: scale(1);
51
+ }
52
+ }
53
+
54
+ &:disabled {
55
+ cursor: not-allowed;
56
+ color: ${theme.color.text.gray};
57
+ background-color: ${theme.color.line.L02 + theme.color.transparency.T40};
58
+ border-color: ${theme.color.line.L01 + theme.color.transparency.T40};
59
+
60
+ & + label {
61
+ cursor: not-allowed;
62
+ color: ${theme.color.text.gray};
63
+ }
64
+ }
65
+
66
+ &:disabled:checked {
67
+ color: ${theme.color.background.pink.E02};
68
+ border-color: ${theme.color.background.pink.E02};
69
+ background-color: ${theme.color.background.white.default};
70
+ }
71
+
72
+ &:focus-visible {
73
+ outline: none;
74
+ box-shadow: 0px 0px 0px 2px ${theme.color.focus.light},
75
+ 0px 0px 0px 4px ${theme.color.focus.dark};
19
76
  }
20
77
  `;
21
78
  /** @visibleName Radio Button */
@@ -68,6 +68,10 @@ interface Props {
68
68
  * Allows to pass testid string for testing purposes
69
69
  */
70
70
  'data-testid'?: string;
71
+ /**
72
+ * Allows to pass an accessible label for the component, enhancing screen reader support.
73
+ */
74
+ ariaLabel?: string;
71
75
  }
72
76
  /** @visibleName Read More */
73
77
  declare const ReadMore: ({ collapsedSize, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { ChevronUp, ChevronDown } from '@dnanpm/icons';
3
- import React__default, { useState, useEffect } from 'react';
3
+ import React__default, { useState, useRef, useEffect, Children, isValidElement, cloneElement } from 'react';
4
4
  import styled from '../../themes/styled.js';
5
5
  import theme from '../../themes/theme.js';
6
6
  import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
@@ -37,6 +37,9 @@ const StyledButtonIcon = styled(ButtonIcon) `
37
37
  const ReadMore = (_a) => {
38
38
  var { collapsedSize = '10rem', 'data-testid': dataTestId } = _a, props = __rest(_a, ["collapsedSize", 'data-testid']);
39
39
  const [expanded, setExpanded] = useState(props.seoInitExpanded === true || false);
40
+ const contentRef = useRef(null);
41
+ const buttonRef = useRef(null);
42
+ const userInteractedRef = useRef(false);
40
43
  // TODO: Remove once https://jira.dna.fi/browse/STYLE-662 is done
41
44
  const temporaryIsStatelessFlag = typeof props.isExpanded !== 'undefined';
42
45
  const temporaryStateManagement = temporaryIsStatelessFlag ? props.isExpanded : expanded;
@@ -48,16 +51,40 @@ const ReadMore = (_a) => {
48
51
  if (!temporaryIsStatelessFlag) {
49
52
  setExpanded(!expanded);
50
53
  }
54
+ userInteractedRef.current = true;
51
55
  };
52
56
  useEffect(() => {
53
57
  if (props.seoInitExpanded) {
54
58
  setExpanded(false);
55
59
  }
56
60
  }, [props.seoInitExpanded]);
57
- return (React__default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId },
58
- React__default.createElement(Content, { isExpanded: temporaryStateManagement, collapsedSize: collapsedSize, "data-testid": dataTestId && `${dataTestId}-content` }, props.children),
61
+ useEffect(() => {
62
+ var _a, _b;
63
+ if (userInteractedRef.current) {
64
+ if (temporaryStateManagement) {
65
+ (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.focus();
66
+ }
67
+ else {
68
+ (_b = buttonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
69
+ }
70
+ }
71
+ }, [temporaryStateManagement]);
72
+ // Function to apply tabIndex to all links elements of children (since we don't control what is passed as children)
73
+ const forceTabIndexOnTextLinks = (child) => {
74
+ if (!isValidElement(child)) {
75
+ return child;
76
+ }
77
+ if (child.type === 'a') {
78
+ return cloneElement(child, {
79
+ tabIndex: temporaryStateManagement ? 0 : -1,
80
+ });
81
+ }
82
+ return child;
83
+ };
84
+ return (React__default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "region" },
85
+ React__default.createElement(Content, { ref: contentRef, isExpanded: temporaryStateManagement, collapsedSize: collapsedSize, "data-testid": dataTestId && `${dataTestId}-content`, "aria-hidden": temporaryStateManagement ? 'false' : 'true', tabIndex: temporaryStateManagement ? 0 : -1 }, Children.map(props.children, forceTabIndexOnTextLinks)),
59
86
  React__default.createElement(ButtonWrapper, { buttonPosition: props.buttonPosition },
60
- React__default.createElement(StyledButtonIcon, { icon: temporaryStateManagement ? ChevronUp : ChevronDown, onClick: handleOnClick }, temporaryButtonLabel || props.buttonLabel))));
87
+ React__default.createElement(StyledButtonIcon, { ref: buttonRef, icon: temporaryStateManagement ? ChevronUp : ChevronDown, onClick: handleOnClick, ariaHidden: true, "aria-expanded": temporaryStateManagement }, temporaryButtonLabel || props.buttonLabel))));
61
88
  };
62
89
 
63
90
  export { ReadMore as default };
@@ -53,6 +53,18 @@ interface Props {
53
53
  * Allows to pass testid string for testing purposes
54
54
  */
55
55
  'data-testid'?: string;
56
+ /**
57
+ * Allows to pass a screen reader label for the input field
58
+ */
59
+ ariaLabel?: string;
60
+ /**
61
+ * Allows to pass a screen reader label for the clear button
62
+ */
63
+ clearButtonAriaLabel?: string;
64
+ /**
65
+ * Allows to pass a screen reader label for the search button
66
+ */
67
+ searchButtonAriaLabel?: string;
56
68
  }
57
69
  declare const Search: ({ "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
58
70
  /** @component */
@@ -52,7 +52,7 @@ const Button = styled(ButtonIcon) `
52
52
  margin: 0 ${getMultipliedSize(theme.base.baseWidth, 1)};
53
53
  `;
54
54
  const Search = (_a) => {
55
- var _b;
55
+ var _b, _c;
56
56
  var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
57
57
  const inputRef = useRef(null);
58
58
  const handleButtonClick = (e) => {
@@ -63,9 +63,15 @@ const Search = (_a) => {
63
63
  props.onButtonClick(e);
64
64
  }
65
65
  };
66
+ let buttonAriaLabel = '';
67
+ if (props.clearButtonAriaLabel && props.searchButtonAriaLabel) {
68
+ buttonAriaLabel = ((_b = props.value) === null || _b === void 0 ? void 0 : _b.length)
69
+ ? props.clearButtonAriaLabel
70
+ : props.searchButtonAriaLabel;
71
+ }
66
72
  return (React__default.createElement(Container, { className: props.className, "data-testid": dataTestId },
67
- React__default.createElement(Input, { id: props.id, name: props.name, type: "search", ref: inputRef, value: props.value, onChange: props.onChange, onBlur: props.onBlur, onFocus: props.onFocus, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, placeholder: props.placeholder, autoFocus: props.autoFocus }),
68
- React__default.createElement(Button, { icon: ((_b = props.value) === null || _b === void 0 ? void 0 : _b.length) ? Close : Search$1, name: `${props.name}-button`, onClick: handleButtonClick })));
73
+ React__default.createElement(Input, { id: props.id, name: props.name, type: "search", ref: inputRef, value: props.value, onChange: props.onChange, onBlur: props.onBlur, onFocus: props.onFocus, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, placeholder: props.placeholder, autoFocus: props.autoFocus, "aria-label": props.ariaLabel }),
74
+ React__default.createElement(Button, { icon: ((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) ? Close : Search$1, name: `${props.name}-button`, onClick: handleButtonClick, ariaLabel: buttonAriaLabel || undefined })));
69
75
  };
70
76
 
71
77
  export { Search as default };
@@ -165,172 +165,6 @@ export declare const globalStyles: import("styled-components").FlattenInterpolat
165
165
  pill: string;
166
166
  };
167
167
  }>>;
168
- export declare const CheckboxAndRadioInputCore: import("styled-components").StyledComponent<"input", {
169
- base: {
170
- baseHeight: {
171
- value: number;
172
- unit: string;
173
- };
174
- baseWidth: {
175
- value: number;
176
- unit: string;
177
- };
178
- };
179
- breakpoints: import("./themeComponents/breakpoints").ViewBreakpoints;
180
- color: {
181
- default: {
182
- pink: string;
183
- plum: string;
184
- white: string;
185
- black: string;
186
- };
187
- accent: {
188
- lemon: string;
189
- sky: string;
190
- orange: string;
191
- };
192
- active: {
193
- pink: string;
194
- };
195
- hover: {
196
- pink: string;
197
- };
198
- text: {
199
- gray: string;
200
- pink: string;
201
- plum: string;
202
- white: string;
203
- black: string;
204
- };
205
- line: {
206
- L01: string;
207
- L02: string;
208
- L03: string;
209
- L04: string;
210
- };
211
- notification: {
212
- info: string;
213
- success: string;
214
- warning: string;
215
- error: string;
216
- };
217
- background: {
218
- sand: {
219
- default: string;
220
- E01: string;
221
- E02: string;
222
- };
223
- pink: {
224
- default: string;
225
- E01: string;
226
- E02: string;
227
- };
228
- plum: {
229
- default: string;
230
- E01: string;
231
- E02: string;
232
- };
233
- lemon: {
234
- default: string;
235
- E01: string;
236
- E02: string;
237
- };
238
- sky: {
239
- default: string;
240
- E01: string;
241
- E02: string;
242
- };
243
- orange: {
244
- default: string;
245
- E01: string;
246
- E02: string;
247
- };
248
- white: {
249
- default: string;
250
- };
251
- };
252
- focus: {
253
- dark: string;
254
- light: string;
255
- };
256
- transparency: {
257
- T0: string;
258
- T10: string;
259
- T20: string;
260
- T30: string;
261
- T40: string;
262
- T50: string;
263
- T60: string;
264
- T70: string;
265
- T80: string;
266
- T90: string;
267
- T100: string;
268
- };
269
- };
270
- fontFamily: {
271
- default: string;
272
- heading: string;
273
- numerals: string;
274
- };
275
- fontSize: {
276
- default: string;
277
- xl: string;
278
- l: string;
279
- s: string;
280
- xs: string;
281
- h1XL: string;
282
- h1L: string;
283
- h1M: string;
284
- h1S: string;
285
- h2M: string;
286
- h2S: string;
287
- h3: string;
288
- h4: string;
289
- h5: string;
290
- h1: string;
291
- h2: string;
292
- };
293
- fontWeight: {
294
- book: number;
295
- medium: number;
296
- bold: number;
297
- black: number;
298
- };
299
- form: {
300
- smallSelectWidth: string;
301
- smallSelectHeight: string;
302
- };
303
- grid: {
304
- gutter: string;
305
- };
306
- lineHeight: {
307
- default: string;
308
- xl: string;
309
- s: string;
310
- xs: string;
311
- xxs: string;
312
- auto: string;
313
- h1XL: string;
314
- h1L: string;
315
- h1M: string;
316
- h1S: string;
317
- h2M: string;
318
- h2S: string;
319
- h3: string;
320
- h4: string;
321
- h5: string;
322
- h1: string;
323
- h2: string;
324
- };
325
- media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
326
- radius: {
327
- default: string;
328
- s: string;
329
- xs: string;
330
- circle: string;
331
- pill: string;
332
- };
333
- }, {}, never>;
334
168
  declare const _default: import("styled-components").GlobalStyleComponent<{}, {
335
169
  base: {
336
170
  baseHeight: {
@@ -1,5 +1,5 @@
1
- import { media, getMultipliedSize } from '../utils/styledUtils.js';
2
- import styled, { css, createGlobalStyle } from './styled.js';
1
+ import { media } from '../utils/styledUtils.js';
2
+ import { css, createGlobalStyle } from './styled.js';
3
3
  import theme from './theme.js';
4
4
 
5
5
  const globalStyles = css `
@@ -185,66 +185,8 @@ const globalStyles = css `
185
185
  opacity: 0;
186
186
  }
187
187
  `;
188
- const CheckboxAndRadioInputCore = styled.input `
189
- display: inline-grid;
190
- appearance: none;
191
- place-content: center;
192
- float: left;
193
- margin: 0;
194
- cursor: pointer;
195
- font-family: ${theme.fontFamily.default};
196
- font-size: ${theme.fontSize.default};
197
- line-height: ${theme.lineHeight.default};
198
- min-width: ${getMultipliedSize(theme.base.baseWidth, 2)};
199
- width: ${getMultipliedSize(theme.base.baseWidth, 2)};
200
- height: ${getMultipliedSize(theme.base.baseWidth, 2)};
201
- color: ${theme.color.line.L01};
202
- border: 2px solid ${theme.color.line.L01};
203
- border-radius: ${theme.radius.s};
204
- background-color: ${theme.color.background.white.default};
205
-
206
- & + label {
207
- cursor: pointer;
208
- color: ${theme.color.text.black};
209
- font-weight: ${theme.fontWeight.medium};
210
- padding-left: ${getMultipliedSize(theme.base.baseWidth, 1)};
211
- }
212
-
213
- &::before {
214
- content: '';
215
- transform: scale(0);
216
- background-color: currentColor;
217
- }
218
-
219
- &:checked {
220
- color: ${theme.color.default.pink};
221
- border-color: ${theme.color.default.pink};
222
-
223
- &::before {
224
- transform: scale(1);
225
- }
226
- }
227
-
228
- &:disabled {
229
- cursor: not-allowed;
230
- color: ${theme.color.text.gray};
231
- background-color: ${theme.color.line.L02};
232
- border-color: ${theme.color.line.L01};
233
-
234
- & + label {
235
- cursor: not-allowed;
236
- color: ${theme.color.text.gray};
237
- }
238
- }
239
-
240
- &:disabled:checked {
241
- color: ${theme.color.default.pink}${theme.color.transparency.T30};
242
- border-color: ${theme.color.default.pink}${theme.color.transparency.T30};
243
- background-color: ${theme.color.background.white.default};
244
- }
245
- `;
246
188
  createGlobalStyle `
247
189
  ${globalStyles}
248
190
  `;
249
191
 
250
- export { CheckboxAndRadioInputCore, globalStyles };
192
+ export { globalStyles };