@digigov/react-core 1.0.0-8ae63a77 → 1.0.0-8bbf3ef2

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 (222) hide show
  1. package/AccessibilityMenuHeaderButton/index.d.ts +1 -1
  2. package/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
  3. package/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
  4. package/Button/__snapshots__/index.test.tsx.snap +18 -0
  5. package/Button/index.d.ts +8 -1
  6. package/Button/index.js +3 -2
  7. package/Button/index.test.js +17 -9
  8. package/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
  9. package/Checkbox/index.d.ts +8 -1
  10. package/Checkbox/index.js +3 -2
  11. package/Checkbox/index.test.js +8 -0
  12. package/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
  13. package/CloseButton/index.d.ts +7 -1
  14. package/CloseButton/index.js +4 -3
  15. package/CloseButton/index.test.js +8 -0
  16. package/Container/__snapshots__/index.test.tsx.snap +14 -4
  17. package/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
  18. package/CopyToClipboardContainer/index.d.ts +9 -1
  19. package/CopyToClipboardContainer/index.js +3 -2
  20. package/CopyToClipboardContainer/index.spec.js +8 -0
  21. package/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
  22. package/DateInputContainer/index.d.ts +8 -1
  23. package/DateInputContainer/index.js +4 -3
  24. package/DateInputContainer/index.test.js +8 -0
  25. package/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
  26. package/ErrorSummary/index.d.ts +8 -1
  27. package/ErrorSummary/index.js +4 -2
  28. package/ErrorSummary/index.test.js +8 -0
  29. package/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
  30. package/ModalContainer/index.d.ts +8 -1
  31. package/ModalContainer/index.js +3 -2
  32. package/Nav/__snapshots__/index.test.tsx.snap +91 -4
  33. package/Nav/index.d.ts +30 -15
  34. package/Nav/index.js +18 -9
  35. package/Nav/index.test.js +42 -0
  36. package/NavListItemAction/index.d.ts +1 -1
  37. package/NavListItemButton/index.d.ts +1 -1
  38. package/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
  39. package/NavMenuContainer/index.test.js +24 -0
  40. package/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
  41. package/NotificationBannerContainer/index.d.ts +8 -1
  42. package/NotificationBannerContainer/index.js +3 -2
  43. package/NotificationBannerContainer/index.test.js +8 -0
  44. package/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
  45. package/RadioContainer/index.d.ts +8 -1
  46. package/RadioContainer/index.js +5 -4
  47. package/RadioContainer/index.test.js +8 -0
  48. package/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
  49. package/SearchButton/index.d.ts +1 -1
  50. package/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
  51. package/SelectContainer/index.d.ts +8 -1
  52. package/SelectContainer/index.js +4 -3
  53. package/SelectContainer/index.test.js +9 -1
  54. package/SingleCharacterInput/index.d.ts +1 -1
  55. package/StepNav/__snapshots__/index.test.tsx.snap +2 -2
  56. package/Tabs/index.d.ts +2 -1
  57. package/Tabs/index.js +4 -3
  58. package/TaskList/__snapshots__/index.test.tsx.snap +2 -2
  59. package/TextArea/__snapshots__/index.test.tsx.snap +19 -0
  60. package/TextArea/index.d.ts +8 -1
  61. package/TextArea/index.js +6 -5
  62. package/TextArea/index.test.js +8 -0
  63. package/TextInput/__snapshots__/index.test.tsx.snap +17 -0
  64. package/TextInput/index.d.ts +8 -1
  65. package/TextInput/index.js +3 -2
  66. package/TextInput/index.test.js +91 -83
  67. package/WarningText/__snapshots__/index.test.tsx.snap +31 -0
  68. package/WarningText/index.d.ts +8 -1
  69. package/WarningText/index.js +3 -2
  70. package/WarningText/index.test.js +8 -0
  71. package/es/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
  72. package/es/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
  73. package/es/Button/__snapshots__/index.test.tsx.snap +18 -0
  74. package/es/Button/index.js +3 -2
  75. package/es/Button/index.test.js +17 -9
  76. package/es/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
  77. package/es/Checkbox/index.js +3 -2
  78. package/es/Checkbox/index.test.js +8 -0
  79. package/es/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
  80. package/es/CloseButton/index.js +4 -3
  81. package/es/CloseButton/index.test.js +8 -0
  82. package/es/Container/__snapshots__/index.test.tsx.snap +14 -4
  83. package/es/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
  84. package/es/CopyToClipboardContainer/index.js +3 -2
  85. package/es/CopyToClipboardContainer/index.spec.js +8 -0
  86. package/es/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
  87. package/es/DateInputContainer/index.js +4 -3
  88. package/es/DateInputContainer/index.test.js +8 -0
  89. package/es/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
  90. package/es/ErrorSummary/index.js +4 -2
  91. package/es/ErrorSummary/index.test.js +8 -0
  92. package/es/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
  93. package/es/ModalContainer/index.js +3 -2
  94. package/es/Nav/__snapshots__/index.test.tsx.snap +91 -4
  95. package/es/Nav/index.js +17 -9
  96. package/es/Nav/index.test.js +42 -0
  97. package/es/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
  98. package/es/NavMenuContainer/index.test.js +24 -0
  99. package/es/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
  100. package/es/NotificationBannerContainer/index.js +3 -2
  101. package/es/NotificationBannerContainer/index.test.js +8 -0
  102. package/es/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
  103. package/es/RadioContainer/index.js +5 -4
  104. package/es/RadioContainer/index.test.js +8 -0
  105. package/es/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
  106. package/es/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
  107. package/es/SelectContainer/index.js +4 -3
  108. package/es/SelectContainer/index.test.js +9 -1
  109. package/es/StepNav/__snapshots__/index.test.tsx.snap +2 -2
  110. package/es/Tabs/index.js +4 -3
  111. package/es/TaskList/__snapshots__/index.test.tsx.snap +2 -2
  112. package/es/TextArea/__snapshots__/index.test.tsx.snap +19 -0
  113. package/es/TextArea/index.js +6 -5
  114. package/es/TextArea/index.test.js +8 -0
  115. package/es/TextInput/__snapshots__/index.test.tsx.snap +17 -0
  116. package/es/TextInput/index.js +3 -2
  117. package/es/TextInput/index.test.js +91 -83
  118. package/es/WarningText/__snapshots__/index.test.tsx.snap +31 -0
  119. package/es/WarningText/index.js +3 -2
  120. package/es/WarningText/index.test.js +8 -0
  121. package/esm/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
  122. package/esm/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
  123. package/esm/Button/__snapshots__/index.test.tsx.snap +18 -0
  124. package/esm/Button/index.js +3 -2
  125. package/esm/Button/index.test.js +17 -9
  126. package/esm/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
  127. package/esm/Checkbox/index.js +3 -2
  128. package/esm/Checkbox/index.test.js +8 -0
  129. package/esm/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
  130. package/esm/CloseButton/index.js +4 -3
  131. package/esm/CloseButton/index.test.js +8 -0
  132. package/esm/Container/__snapshots__/index.test.tsx.snap +14 -4
  133. package/esm/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
  134. package/esm/CopyToClipboardContainer/index.js +3 -2
  135. package/esm/CopyToClipboardContainer/index.spec.js +8 -0
  136. package/esm/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
  137. package/esm/DateInputContainer/index.js +4 -3
  138. package/esm/DateInputContainer/index.test.js +8 -0
  139. package/esm/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
  140. package/esm/ErrorSummary/index.js +4 -2
  141. package/esm/ErrorSummary/index.test.js +8 -0
  142. package/esm/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
  143. package/esm/ModalContainer/index.js +3 -2
  144. package/esm/Nav/__snapshots__/index.test.tsx.snap +91 -4
  145. package/esm/Nav/index.js +17 -9
  146. package/esm/Nav/index.test.js +42 -0
  147. package/esm/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
  148. package/esm/NavMenuContainer/index.test.js +24 -0
  149. package/esm/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
  150. package/esm/NotificationBannerContainer/index.js +3 -2
  151. package/esm/NotificationBannerContainer/index.test.js +8 -0
  152. package/esm/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
  153. package/esm/RadioContainer/index.js +5 -4
  154. package/esm/RadioContainer/index.test.js +8 -0
  155. package/esm/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
  156. package/esm/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
  157. package/esm/SelectContainer/index.js +4 -3
  158. package/esm/SelectContainer/index.test.js +9 -1
  159. package/esm/StepNav/__snapshots__/index.test.tsx.snap +2 -2
  160. package/esm/Tabs/index.js +4 -3
  161. package/esm/TaskList/__snapshots__/index.test.tsx.snap +2 -2
  162. package/esm/TextArea/__snapshots__/index.test.tsx.snap +19 -0
  163. package/esm/TextArea/index.js +6 -5
  164. package/esm/TextArea/index.test.js +8 -0
  165. package/esm/TextInput/__snapshots__/index.test.tsx.snap +17 -0
  166. package/esm/TextInput/index.js +3 -2
  167. package/esm/TextInput/index.test.js +91 -83
  168. package/esm/WarningText/__snapshots__/index.test.tsx.snap +31 -0
  169. package/esm/WarningText/index.js +3 -2
  170. package/esm/WarningText/index.test.js +8 -0
  171. package/esm/index.js +1 -1
  172. package/package.json +3 -3
  173. package/src/BottomInfo/__snapshots__/index.test.tsx.snap +7 -2
  174. package/src/BottomInfoContainer/__snapshots__/index.test.tsx.snap +7 -2
  175. package/src/Button/__snapshots__/index.test.tsx.snap +18 -0
  176. package/src/Button/index.test.tsx +3 -0
  177. package/src/Button/index.tsx +9 -0
  178. package/src/Checkbox/__snapshots__/index.test.tsx.snap +76 -0
  179. package/src/Checkbox/index.test.tsx +10 -0
  180. package/src/Checkbox/index.tsx +9 -1
  181. package/src/CloseButton/__snapshots__/index.test.tsx.snap +53 -0
  182. package/src/CloseButton/index.test.tsx +3 -0
  183. package/src/CloseButton/index.tsx +10 -3
  184. package/src/Container/__snapshots__/index.test.tsx.snap +14 -4
  185. package/src/CopyToClipboardContainer/__snapshots__/index.spec.tsx.snap +21 -0
  186. package/src/CopyToClipboardContainer/index.spec.tsx +8 -2
  187. package/src/CopyToClipboardContainer/index.tsx +10 -1
  188. package/src/DateInputContainer/__snapshots__/index.test.tsx.snap +17 -0
  189. package/src/DateInputContainer/index.test.tsx +5 -0
  190. package/src/DateInputContainer/index.tsx +11 -2
  191. package/src/ErrorSummary/__snapshots__/index.test.tsx.snap +39 -0
  192. package/src/ErrorSummary/index.test.tsx +4 -0
  193. package/src/ErrorSummary/index.tsx +12 -5
  194. package/src/ImageLogo/__snapshots__/index.test.tsx.snap +5 -3
  195. package/src/ModalContainer/index.tsx +9 -1
  196. package/src/Nav/__snapshots__/index.test.tsx.snap +91 -4
  197. package/src/Nav/index.test.tsx +15 -0
  198. package/src/Nav/index.tsx +53 -20
  199. package/src/NavMenuContainer/__snapshots__/index.test.tsx.snap +104 -0
  200. package/src/NavMenuContainer/index.test.tsx +9 -0
  201. package/src/NotificationBannerContainer/__snapshots__/index.test.tsx.snap +23 -0
  202. package/src/NotificationBannerContainer/index.test.tsx +7 -0
  203. package/src/NotificationBannerContainer/index.tsx +9 -1
  204. package/src/RadioContainer/__snapshots__/index.test.tsx.snap +17 -0
  205. package/src/RadioContainer/index.test.tsx +3 -0
  206. package/src/RadioContainer/index.tsx +9 -1
  207. package/src/RadioItem/__snapshots__/index.test.tsx.snap +2 -2
  208. package/src/SelectContainer/__snapshots__/index.test.tsx.snap +17 -0
  209. package/src/SelectContainer/index.test.tsx +5 -0
  210. package/src/SelectContainer/index.tsx +11 -2
  211. package/src/StepNav/__snapshots__/index.test.tsx.snap +2 -2
  212. package/src/Tabs/index.tsx +5 -2
  213. package/src/TaskList/__snapshots__/index.test.tsx.snap +2 -2
  214. package/src/TextArea/__snapshots__/index.test.tsx.snap +19 -0
  215. package/src/TextArea/index.test.tsx +3 -0
  216. package/src/TextArea/index.tsx +11 -2
  217. package/src/TextInput/__snapshots__/index.test.tsx.snap +17 -0
  218. package/src/TextInput/index.test.tsx +3 -0
  219. package/src/TextInput/index.tsx +9 -0
  220. package/src/WarningText/__snapshots__/index.test.tsx.snap +31 -0
  221. package/src/WarningText/index.test.tsx +3 -0
  222. package/src/WarningText/index.tsx +9 -1
@@ -1,13 +1,100 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the Nav with border prop 1`] = `
4
+ <ForwardRef(Nav)
5
+ border={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ as="nav"
9
+ className="govgr-nav--border govgr-nav"
10
+ >
11
+ <nav
12
+ className="govgr-nav--border govgr-nav"
13
+ >
14
+ hello
15
+ </nav>
16
+ </ForwardRef(Base)>
17
+ </ForwardRef(Nav)>
18
+ `;
19
+
20
+ exports[`renders the Nav with drawer="always" prop 1`] = `
21
+ <ForwardRef(Nav)
22
+ drawer="always"
23
+ >
24
+ <ForwardRef(Base)
25
+ as="nav"
26
+ className="govgr-nav--drawer govgr-nav--hidden govgr-nav--border govgr-nav"
27
+ >
28
+ <nav
29
+ className="govgr-nav--drawer govgr-nav--hidden govgr-nav--border govgr-nav"
30
+ >
31
+ hello
32
+ </nav>
33
+ </ForwardRef(Base)>
34
+ </ForwardRef(Nav)>
35
+ `;
36
+
37
+ exports[`renders the Nav with drawer="always", border and open props 1`] = `
38
+ <ForwardRef(Nav)
39
+ border={true}
40
+ drawer="always"
41
+ open={true}
42
+ >
43
+ <ForwardRef(Base)
44
+ as="nav"
45
+ className="govgr-nav--drawer govgr-nav--border govgr-nav"
46
+ >
47
+ <nav
48
+ className="govgr-nav--drawer govgr-nav--border govgr-nav"
49
+ >
50
+ hello
51
+ </nav>
52
+ </ForwardRef(Base)>
53
+ </ForwardRef(Nav)>
54
+ `;
55
+
56
+ exports[`renders the Nav with drawer="mdDown" prop 1`] = `
57
+ <ForwardRef(Nav)
58
+ drawer="mdDown"
59
+ >
60
+ <ForwardRef(Base)
61
+ as="nav"
62
+ className="govgr-nav--drawer-mdDown govgr-nav--hidden govgr-nav--border govgr-nav"
63
+ >
64
+ <nav
65
+ className="govgr-nav--drawer-mdDown govgr-nav--hidden govgr-nav--border govgr-nav"
66
+ >
67
+ hello
68
+ </nav>
69
+ </ForwardRef(Base)>
70
+ </ForwardRef(Nav)>
71
+ `;
72
+
73
+ exports[`renders the Nav with drawer="never" prop 1`] = `
74
+ <ForwardRef(Nav)
75
+ drawer="never"
76
+ >
77
+ <ForwardRef(Base)
78
+ as="nav"
79
+ className="govgr-nav--border govgr-nav"
80
+ >
81
+ <nav
82
+ className="govgr-nav--border govgr-nav"
83
+ >
84
+ hello
85
+ </nav>
86
+ </ForwardRef(Base)>
87
+ </ForwardRef(Nav)>
88
+ `;
89
+
3
90
  exports[`renders the Nav with no props 1`] = `
4
91
  <ForwardRef(Nav)>
5
92
  <ForwardRef(Base)
6
93
  as="nav"
7
- className="govgr-nav--border govgr-nav--fixed govgr-nav"
94
+ className="govgr-nav--border govgr-nav"
8
95
  >
9
96
  <nav
10
- className="govgr-nav--border govgr-nav--fixed govgr-nav"
97
+ className="govgr-nav--border govgr-nav"
11
98
  >
12
99
  hello
13
100
  </nav>
@@ -21,10 +108,10 @@ exports[`renders the Nav with open prop 1`] = `
21
108
  >
22
109
  <ForwardRef(Base)
23
110
  as="nav"
24
- className="govgr-nav--border govgr-nav--fixed govgr-nav govgr-nav--open"
111
+ className="govgr-nav--border govgr-nav"
25
112
  >
26
113
  <nav
27
- className="govgr-nav--border govgr-nav--fixed govgr-nav govgr-nav--open"
114
+ className="govgr-nav--border govgr-nav"
28
115
  >
29
116
  hello
30
117
  </nav>
@@ -10,3 +10,18 @@ it('renders the Nav with no props', () => {
10
10
  it('renders the Nav with open prop', () => {
11
11
  expect(mount(<Nav open>hello</Nav>)).toMatchSnapshot();
12
12
  });
13
+ it('renders the Nav with border prop', () => {
14
+ expect(mount(<Nav border>hello</Nav>)).toMatchSnapshot();
15
+ });
16
+ it('renders the Nav with drawer="never" prop', () => {
17
+ expect(mount(<Nav drawer="never">hello</Nav>)).toMatchSnapshot();
18
+ });
19
+ it('renders the Nav with drawer="mdDown" prop', () => {
20
+ expect(mount(<Nav drawer="mdDown">hello</Nav>)).toMatchSnapshot();
21
+ });
22
+ it('renders the Nav with drawer="always" prop', () => {
23
+ expect(mount(<Nav drawer="always">hello</Nav>)).toMatchSnapshot();
24
+ });
25
+ it('renders the Nav with drawer="always", border and open props', () => {
26
+ expect(mount(<Nav open border drawer="always">hello</Nav>)).toMatchSnapshot();
27
+ });
package/src/Nav/index.tsx CHANGED
@@ -1,32 +1,53 @@
1
1
  import React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import Base, { BaseProps } from '@digigov/react-core/Base';
4
+ import CloseButton from '@digigov/react-core/CloseButton';
4
5
 
5
6
  export interface NavProps extends BaseProps<'nav'> {
6
7
  /**
7
8
  * open is optional.
8
- * use this prop to show the navigation at mobile view;
9
+ * use this prop to control the navigation's visibility when it's a drawer.
9
10
  * @value true
10
11
  * @value false
11
12
  * @default false
12
13
  */
13
14
  open?: boolean;
14
15
  /**
15
- * fixed is optional.
16
- * fixed prop allows element to be positioned relative to the viewport
17
- * @value true
18
- * @value false
19
- * @default true
20
- */
21
- fixed?: boolean;
16
+ * border is optional.
17
+ * border prop contains border-bottom styling.
18
+ * @value true
19
+ * @value false
20
+ * @default true
21
+ */
22
+ border?: boolean;
23
+
22
24
  /**
23
- * border is optional.
24
- * border prop contains border-bottom styling.
25
- * @value true
26
- * @value false
27
- * @default true
25
+ * drawer is optional.
26
+ * drawer prop allows element to be positioned relative to the viewport.
27
+ * Use this prop only if you want to implement responsive drawer navigation and you have a button to toggle the drawer open and closed.
28
+ * @value 'never' the navigation will never be drawer
29
+ * @value 'smDown' the navigation will be drawer on small screens only
30
+ * @value 'mdDown' the navigation will be drawer on medium screens and below
31
+ * @value 'lgDown' the navigation will be drawer on large screens and below
32
+ * @value 'always' the navigation will be drawer on all screen sizes
33
+ * @default 'never'
34
+ */
35
+ drawer?: 'never' | 'smDown' | 'mdDown' | 'lgDown' | 'always';
36
+
37
+ /**
38
+ * onClose makes a CloseButton component visible when the Nav is drawer.
39
+ * Use this prop to close the drawer when close button is clicked, passing a callback function.
40
+ * Make sure that the drawer prop is not 'never'.
28
41
  */
29
- border?: boolean;
42
+ onClose?: (
43
+ e: React.MouseEvent<HTMLButtonElement, MouseEvent>
44
+ ) => void;
45
+
46
+ /**
47
+ * closeButtonLabel is optional.
48
+ * Use this prop to add text beside the close icon. For example: 'Κλείσιμο'.
49
+ */
50
+ closeButtonLabel?: string;
30
51
  }
31
52
  /**
32
53
  * Nav is mainly used under the Header.
@@ -35,9 +56,10 @@ export interface NavProps extends BaseProps<'nav'> {
35
56
  export const Nav = React.forwardRef<HTMLElement, NavProps>(function Nav(
36
57
  {
37
58
  className,
38
- open = false,
39
- hidden = false,
40
- fixed = true,
59
+ open,
60
+ drawer = 'never',
61
+ onClose,
62
+ closeButtonLabel,
41
63
  border = true,
42
64
  children,
43
65
  ...props
@@ -50,13 +72,24 @@ export const Nav = React.forwardRef<HTMLElement, NavProps>(function Nav(
50
72
  ref={ref}
51
73
  className={clsx(className, {
52
74
  'govgr-nav': true,
53
- 'govgr-nav--fixed': fixed,
54
75
  'govgr-nav--border': border,
55
- 'govgr-nav--open': open,
56
- 'govgr-nav--hidden': hidden,
76
+ 'govgr-nav--hidden': drawer != 'never' && !open,
77
+ 'govgr-nav--drawer-smDown': drawer === 'smDown',
78
+ 'govgr-nav--drawer-mdDown': drawer === 'mdDown',
79
+ 'govgr-nav--drawer-lgDown': drawer === 'lgDown',
80
+ 'govgr-nav--drawer': drawer === 'always',
57
81
  })}
58
82
  {...props}
59
83
  >
84
+ {(onClose && drawer !== 'never') && (
85
+ <CloseButton
86
+ smUpHidden={drawer === 'smDown'}
87
+ mdUpHidden={drawer === 'mdDown'}
88
+ lgUpHidden={drawer === 'lgDown'}
89
+ onClick={(e) => onClose(e)}
90
+ label={closeButtonLabel}
91
+ />
92
+ )}
60
93
  {children}
61
94
  </Base>
62
95
  );
@@ -1,5 +1,109 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the NavMenuContainer with active prop 1`] = `
4
+ <ForwardRef(NavMenuContainer)
5
+ active={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ aria-hidden={false}
9
+ as="div"
10
+ className="govgr-nav-menu--horizontal govgr-nav-menu"
11
+ >
12
+ <div
13
+ aria-hidden={false}
14
+ className="govgr-nav-menu--horizontal govgr-nav-menu"
15
+ >
16
+ <ForwardRef(Container)
17
+ grid={true}
18
+ >
19
+ <ForwardRef(Base)
20
+ as="div"
21
+ className="govgr-container"
22
+ >
23
+ <div
24
+ className="govgr-container"
25
+ >
26
+ <div
27
+ className="govgr-main-wrapper"
28
+ >
29
+ hello
30
+ </div>
31
+ </div>
32
+ </ForwardRef(Base)>
33
+ </ForwardRef(Container)>
34
+ </div>
35
+ </ForwardRef(Base)>
36
+ </ForwardRef(NavMenuContainer)>
37
+ `;
38
+
39
+ exports[`renders the NavMenuContainer with layout="horizontal" prop 1`] = `
40
+ <ForwardRef(NavMenuContainer)
41
+ layout="horizontal"
42
+ >
43
+ <ForwardRef(Base)
44
+ aria-hidden={true}
45
+ as="div"
46
+ className="govgr-nav-menu--horizontal govgr-nav-menu--hidden govgr-nav-menu"
47
+ >
48
+ <div
49
+ aria-hidden={true}
50
+ className="govgr-nav-menu--horizontal govgr-nav-menu--hidden govgr-nav-menu"
51
+ >
52
+ <ForwardRef(Container)
53
+ grid={true}
54
+ >
55
+ <ForwardRef(Base)
56
+ as="div"
57
+ className="govgr-container"
58
+ >
59
+ <div
60
+ className="govgr-container"
61
+ >
62
+ <div
63
+ className="govgr-main-wrapper"
64
+ >
65
+ hello
66
+ </div>
67
+ </div>
68
+ </ForwardRef(Base)>
69
+ </ForwardRef(Container)>
70
+ </div>
71
+ </ForwardRef(Base)>
72
+ </ForwardRef(NavMenuContainer)>
73
+ `;
74
+
75
+ exports[`renders the NavMenuContainer with layout="vertical" prop 1`] = `
76
+ <ForwardRef(NavMenuContainer)
77
+ layout="vertical"
78
+ >
79
+ <ForwardRef(Base)
80
+ aria-hidden={true}
81
+ as="div"
82
+ className="govgr-nav-menu--vertical govgr-nav-menu--hidden govgr-nav-menu"
83
+ >
84
+ <div
85
+ aria-hidden={true}
86
+ className="govgr-nav-menu--vertical govgr-nav-menu--hidden govgr-nav-menu"
87
+ >
88
+ <ForwardRef(Container)
89
+ grid={false}
90
+ >
91
+ <ForwardRef(Base)
92
+ as="div"
93
+ className="govgr-container"
94
+ >
95
+ <div
96
+ className="govgr-container"
97
+ >
98
+ hello
99
+ </div>
100
+ </ForwardRef(Base)>
101
+ </ForwardRef(Container)>
102
+ </div>
103
+ </ForwardRef(Base)>
104
+ </ForwardRef(NavMenuContainer)>
105
+ `;
106
+
3
107
  exports[`renders the NavMenuContainer with no props 1`] = `
4
108
  <ForwardRef(NavMenuContainer)>
5
109
  <ForwardRef(Base)
@@ -5,3 +5,12 @@ import NavMenuContainer from '@digigov/react-core/NavMenuContainer';
5
5
  it('renders the NavMenuContainer with no props', () => {
6
6
  expect(mount(<NavMenuContainer>hello</NavMenuContainer>)).toMatchSnapshot();
7
7
  });
8
+ it('renders the NavMenuContainer with active prop', () => {
9
+ expect(mount(<NavMenuContainer active>hello</NavMenuContainer>)).toMatchSnapshot();
10
+ });
11
+ it('renders the NavMenuContainer with layout="vertical" prop', () => {
12
+ expect(mount(<NavMenuContainer layout="vertical">hello</NavMenuContainer>)).toMatchSnapshot();
13
+ });
14
+ it('renders the NavMenuContainer with layout="horizontal" prop', () => {
15
+ expect(mount(<NavMenuContainer layout="horizontal">hello</NavMenuContainer>)).toMatchSnapshot();
16
+ });
@@ -1,5 +1,28 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the NotificationBannerContainer with dense=true 1`] = `
4
+ <ForwardRef(NotificationBannerContainer)
5
+ dense={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ aria-labelledby="govgr-notification-banner-title"
9
+ as="div"
10
+ className="govgr-notification-banner--info govgr-notification-banner--dense govgr-notification-banner"
11
+ data-module="govgr-notification-banner"
12
+ role="region"
13
+ >
14
+ <div
15
+ aria-labelledby="govgr-notification-banner-title"
16
+ className="govgr-notification-banner--info govgr-notification-banner--dense govgr-notification-banner"
17
+ data-module="govgr-notification-banner"
18
+ role="region"
19
+ >
20
+ hello
21
+ </div>
22
+ </ForwardRef(Base)>
23
+ </ForwardRef(NotificationBannerContainer)>
24
+ `;
25
+
3
26
  exports[`renders the NotificationBannerContainer with no props 1`] = `
4
27
  <ForwardRef(NotificationBannerContainer)>
5
28
  <ForwardRef(Base)
@@ -19,3 +19,10 @@ it('renders the NotificationBannerContainer with variant=success', () => {
19
19
  ).toMatchSnapshot();
20
20
  });
21
21
 
22
+ it('renders the NotificationBannerContainer with dense=true', () => {
23
+ expect(
24
+ mount(
25
+ <NotificationBannerContainer dense>hello</NotificationBannerContainer>
26
+ )
27
+ ).toMatchSnapshot();
28
+ });
@@ -12,6 +12,13 @@ export interface NotificationBannerContainerProps extends BaseProps<'div'> {
12
12
  * @default 'info'.
13
13
  */
14
14
  variant?: 'info' | 'success' | 'error';
15
+ /**
16
+ * dense is optional.
17
+ * @value true NotificationBannerContainer will be dense.
18
+ * @value false
19
+ * @default false
20
+ * */
21
+ dense?: boolean;
15
22
  }
16
23
  /**
17
24
  * Details for the NotificationBannerContainer.
@@ -24,7 +31,7 @@ export const NotificationBannerContainer = React.forwardRef<
24
31
  HTMLDivElement,
25
32
  NotificationBannerContainerProps
26
33
  >(function NotificationBannerContainer(
27
- { variant = 'info', className, children, ...props },
34
+ { variant = 'info', className, dense, children, ...props },
28
35
  ref
29
36
  ) {
30
37
  return (
@@ -37,6 +44,7 @@ export const NotificationBannerContainer = React.forwardRef<
37
44
  className={clsx(className, {
38
45
  'govgr-notification-banner': true,
39
46
  [`govgr-notification-banner--${variant}`]: variant !== undefined,
47
+ 'govgr-notification-banner--dense': dense,
40
48
  })}
41
49
  {...props}
42
50
  >
@@ -1,5 +1,22 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the RadioContainer with dense prop 1`] = `
4
+ <ForwardRef(RadioContainer)
5
+ dense={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ as="div"
9
+ className="govgr-radios--dense govgr-radios"
10
+ >
11
+ <div
12
+ className="govgr-radios--dense govgr-radios"
13
+ >
14
+ hello
15
+ </div>
16
+ </ForwardRef(Base)>
17
+ </ForwardRef(RadioContainer)>
18
+ `;
19
+
3
20
  exports[`renders the RadioContainer with layout=horizontal 1`] = `
4
21
  <ForwardRef(RadioContainer)
5
22
  layout="horizontal"
@@ -9,3 +9,6 @@ it('renders the RadioContainer with no props', () => {
9
9
  it('renders the RadioContainer with layout=horizontal', () => {
10
10
  expect(mount(<RadioContainer layout='horizontal'>hello</RadioContainer>)).toMatchSnapshot();
11
11
  });
12
+ it('renders the RadioContainer with dense prop', () => {
13
+ expect(mount(<RadioContainer dense>hello</RadioContainer>)).toMatchSnapshot();
14
+ });
@@ -10,6 +10,13 @@ export interface RadioContainerProps extends BaseProps<'div'> {
10
10
  * @default 'vertical'
11
11
  */
12
12
  layout?: 'horizontal' | 'vertical';
13
+ /**
14
+ * dense is optional.
15
+ * @value true Radios will be dense.
16
+ * @value false
17
+ * @default false
18
+ */
19
+ dense?: boolean;
13
20
  }
14
21
  /**
15
22
  * RadioContainer component is uses when users can only select one option from a list.
@@ -18,13 +25,14 @@ export interface RadioContainerProps extends BaseProps<'div'> {
18
25
  export const RadioContainer = React.forwardRef<
19
26
  HTMLDivElement,
20
27
  RadioContainerProps
21
- >(function RadioContainer({ className, children, layout, ...props }, ref) {
28
+ >(function RadioContainer({ layout, dense, className, children, ...props }, ref) {
22
29
  return (
23
30
  <Base
24
31
  as="div"
25
32
  ref={ref}
26
33
  className={clsx(className, {
27
34
  'govgr-radios': true,
35
+ 'govgr-radios--dense': dense,
28
36
  'govgr-radios--horizontal': layout === 'horizontal',
29
37
  })}
30
38
  {...props}
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`renders the RadioItem \`divider\` props 1`] = `
3
+ exports[`renders the RadioItem \`dividerText\` props 1`] = `
4
4
  <ForwardRef(RadioItem)
5
5
  dividerText="ή"
6
6
  >
@@ -88,7 +88,7 @@ exports[`renders the RadioItem value props 1`] = `
88
88
  </ForwardRef(RadioItem)>
89
89
  `;
90
90
 
91
- exports[`renders the RadioItem with \`name\`, \`disabled\`, \`divider\` and \`value\` props 1`] = `
91
+ exports[`renders the RadioItem with \`name\`, \`disabled\`, \`dividerText\` and \`value\` props 1`] = `
92
92
  <ForwardRef(RadioItem)
93
93
  disabled={true}
94
94
  dividerText="ή"
@@ -1,5 +1,22 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the SelectContainer with dense prop 1`] = `
4
+ <ForwardRef(SelectContainer)
5
+ dense={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ as="select"
9
+ className="govgr-select--dense govgr-select"
10
+ >
11
+ <select
12
+ className="govgr-select--dense govgr-select"
13
+ >
14
+ hello
15
+ </select>
16
+ </ForwardRef(Base)>
17
+ </ForwardRef(SelectContainer)>
18
+ `;
19
+
3
20
  exports[`renders the SelectContainer with name and defaultValue 1`] = `
4
21
  <ForwardRef(SelectContainer)
5
22
  defaultValue="some-value"
@@ -12,6 +12,11 @@ it('renders the SelectContainer with name props', () => {
12
12
  mount(<SelectContainer name={'some-name'}>hello</SelectContainer>)
13
13
  ).toMatchSnapshot();
14
14
  });
15
+ it('renders the SelectContainer with dense prop', () => {
16
+ expect(
17
+ mount(<SelectContainer dense>hello</SelectContainer>)
18
+ ).toMatchSnapshot();
19
+ });
15
20
 
16
21
  it('renders the SelectContainer with name and defaultValue', () => {
17
22
  expect(
@@ -2,7 +2,15 @@ import React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import Base, { BaseProps } from '@digigov/react-core/Base';
4
4
 
5
- export interface SelectContainerProps extends BaseProps<'select'> {}
5
+ export interface SelectContainerProps extends BaseProps<'select'> {
6
+ /**
7
+ * dense is optional.
8
+ * @value true Select will be dense.
9
+ * @value false
10
+ * @default false
11
+ */
12
+ dense?: boolean;
13
+ }
6
14
  /**
7
15
  * The SelectContainer component allows users to choose an option from a long list.
8
16
  * It is used as a parent component to wrap SelectOption component.
@@ -10,13 +18,14 @@ export interface SelectContainerProps extends BaseProps<'select'> {}
10
18
  export const SelectContainer = React.forwardRef<
11
19
  HTMLSelectElement,
12
20
  SelectContainerProps
13
- >(function SelectContainer({ className, children, ...props }, ref) {
21
+ >(function SelectContainer({ dense, className, children, ...props }, ref) {
14
22
  return (
15
23
  <Base
16
24
  as="select"
17
25
  ref={ref}
18
26
  className={clsx(className, {
19
27
  'govgr-select': true,
28
+ 'govgr-select--dense': dense,
20
29
  })}
21
30
  {...props}
22
31
  >
@@ -6,10 +6,10 @@ exports[`renders the StepNav with dense props 1`] = `
6
6
  >
7
7
  <ForwardRef(Base)
8
8
  as="div"
9
- className="govgr-step--dense govgr-step-nav"
9
+ className="govgr-step-nav--dense govgr-step-nav"
10
10
  >
11
11
  <div
12
- className="govgr-step--dense govgr-step-nav"
12
+ className="govgr-step-nav--dense govgr-step-nav"
13
13
  >
14
14
  hello
15
15
  </div>
@@ -2,13 +2,15 @@ import React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import Base, { BaseProps } from '@digigov/react-core/Base';
4
4
 
5
- export interface TabsProps extends BaseProps<'div'> {}
5
+ export interface TabsProps extends BaseProps<'div'> {
6
+ direction?: 'vertical' | 'horizontal'
7
+ }
6
8
  /**
7
9
  * Tabs is the main component for tabs.
8
10
  * This component must contain TabsHeading, TabsList, and a list of TabsPanel component.
9
11
  */
10
12
  export const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(function Tabs(
11
- { className, children, ...props },
13
+ { direction, className, children, ...props },
12
14
  ref
13
15
  ) {
14
16
  return (
@@ -17,6 +19,7 @@ export const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(function Tabs(
17
19
  ref={ref}
18
20
  className={clsx(className, {
19
21
  'govgr-tabs': true,
22
+ 'govgr-tabs--vertical': direction ==='vertical',
20
23
  })}
21
24
  {...props}
22
25
  >
@@ -6,10 +6,10 @@ exports[`renders the TaskList with dense prop 1`] = `
6
6
  >
7
7
  <ForwardRef(Base)
8
8
  as="ol"
9
- className="govgr-task--dense govgr-task-list"
9
+ className="govgr-task-list--dense govgr-task-list"
10
10
  >
11
11
  <ol
12
- className="govgr-task--dense govgr-task-list"
12
+ className="govgr-task-list--dense govgr-task-list"
13
13
  >
14
14
  hello
15
15
  </ol>
@@ -1,5 +1,24 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`renders the TextArea with dense prop 1`] = `
4
+ <ForwardRef(TextArea)
5
+ dense={true}
6
+ >
7
+ <ForwardRef(Base)
8
+ as="textarea"
9
+ className="govgr-textarea--dense govgr-textarea"
10
+ rows={3}
11
+ >
12
+ <textarea
13
+ className="govgr-textarea--dense govgr-textarea"
14
+ rows={3}
15
+ >
16
+ hello
17
+ </textarea>
18
+ </ForwardRef(Base)>
19
+ </ForwardRef(TextArea)>
20
+ `;
21
+
3
22
  exports[`renders the TextArea with no props 1`] = `
4
23
  <ForwardRef(TextArea)>
5
24
  <ForwardRef(Base)
@@ -26,3 +26,6 @@ it('renders the TextArea with rows=7', () => {
26
26
  it('renders the TextArea with rows=8', () => {
27
27
  expect(mount(<TextArea rows={8}>hello</TextArea>)).toMatchSnapshot();
28
28
  });
29
+ it('renders the TextArea with dense prop', () => {
30
+ expect(mount(<TextArea dense>hello</TextArea>)).toMatchSnapshot();
31
+ });