@digigov/ui 0.32.0 → 0.32.2

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 (181) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/admin/AccessibilityMenu/index.d.ts +6 -0
  3. package/admin/AccessibilityMenu/index.js +85 -30
  4. package/admin/AutoComplete/index.mdx +8 -30
  5. package/admin/CopyToClipboard/index.mdx +1 -5
  6. package/admin/Dropdown/Dropdown.stories.playwright.json +53 -0
  7. package/admin/Dropdown/__stories__/AlignRight.js +1 -2
  8. package/admin/Dropdown/__stories__/Default.js +1 -3
  9. package/admin/Dropdown/__stories__/PlacementTop.js +1 -2
  10. package/admin/Dropdown/index.mdx +3 -15
  11. package/admin/Modal/Modal.stories.playwright.json +37 -0
  12. package/admin/Modal/__stories__/AlertDialog.js +36 -12
  13. package/admin/Modal/__stories__/Default.js +34 -10
  14. package/admin/Modal/index.mdx +1 -5
  15. package/app/Footer/Footer.mdx +3 -14
  16. package/app/Header/index.mdx +3 -16
  17. package/app/QrCodeViewer/index.mdx +1 -5
  18. package/core/Accordion/index.d.ts +5 -1
  19. package/core/Accordion/index.js +46 -13
  20. package/core/Accordion/index.mdx +2 -10
  21. package/core/Button/__stories__/GroupingButtons.d.ts +1 -0
  22. package/core/Button/__stories__/GroupingButtons.js +4 -2
  23. package/core/Button/__stories__/GroupingButtonsAndLinks.d.ts +1 -0
  24. package/core/Button/__stories__/GroupingButtonsAndLinks.js +4 -2
  25. package/core/Button/__stories__/Warning.d.ts +1 -0
  26. package/core/Button/__stories__/Warning.js +4 -2
  27. package/core/Button/index.mdx +4 -20
  28. package/core/Card/card.mdx +7 -35
  29. package/core/Checkbox/checkbox.mdx +6 -30
  30. package/core/DateInputContainer/index.mdx +4 -20
  31. package/core/ErrorSummary/index.mdx +3 -15
  32. package/core/FileUpload/index.mdx +1 -5
  33. package/core/Link/link.mdx +4 -20
  34. package/core/List/index.mdx +1 -5
  35. package/core/NavList/index.mdx +1 -5
  36. package/core/NotificationBanner/index.mdx +1 -5
  37. package/core/PhaseBanner/index.mdx +1 -4
  38. package/core/RadioContainer/index.mdx +6 -30
  39. package/core/SelectContainer/index.mdx +3 -15
  40. package/core/SingleCharacterInputContainer/index.mdx +7 -10
  41. package/core/SummaryList/index.mdx +2 -10
  42. package/core/Table/index.mdx +6 -30
  43. package/core/TextArea/index.mdx +6 -30
  44. package/core/TextInput/index.mdx +6 -30
  45. package/core/index.d.ts +1 -0
  46. package/core/index.js +13 -0
  47. package/es/admin/AccessibilityMenu/index.js +49 -0
  48. package/es/admin/AutoComplete/index.mdx +8 -30
  49. package/es/admin/CopyToClipboard/index.mdx +1 -5
  50. package/es/admin/Dropdown/Dropdown.stories.playwright.json +53 -0
  51. package/es/admin/Dropdown/__stories__/AlignRight.js +1 -2
  52. package/es/admin/Dropdown/__stories__/Default.js +1 -3
  53. package/es/admin/Dropdown/__stories__/PlacementTop.js +1 -2
  54. package/es/admin/Dropdown/index.mdx +3 -15
  55. package/es/admin/Modal/Modal.stories.playwright.json +37 -0
  56. package/es/admin/Modal/__stories__/AlertDialog.js +29 -12
  57. package/es/admin/Modal/__stories__/Default.js +27 -10
  58. package/es/admin/Modal/index.mdx +1 -5
  59. package/es/app/Footer/Footer.mdx +3 -14
  60. package/es/app/Header/index.mdx +3 -16
  61. package/es/app/QrCodeViewer/index.mdx +1 -5
  62. package/es/core/Accordion/index.js +40 -6
  63. package/es/core/Accordion/index.mdx +2 -10
  64. package/es/core/Button/__stories__/GroupingButtons.js +2 -1
  65. package/es/core/Button/__stories__/GroupingButtonsAndLinks.js +2 -1
  66. package/es/core/Button/__stories__/Warning.js +2 -1
  67. package/es/core/Button/index.mdx +4 -20
  68. package/es/core/Card/card.mdx +7 -35
  69. package/es/core/Checkbox/checkbox.mdx +6 -30
  70. package/es/core/DateInputContainer/index.mdx +4 -20
  71. package/es/core/ErrorSummary/index.mdx +3 -15
  72. package/es/core/FileUpload/index.mdx +1 -5
  73. package/es/core/Link/link.mdx +4 -20
  74. package/es/core/List/index.mdx +1 -5
  75. package/es/core/NavList/index.mdx +1 -5
  76. package/es/core/NotificationBanner/index.mdx +1 -5
  77. package/es/core/PhaseBanner/index.mdx +1 -4
  78. package/es/core/RadioContainer/index.mdx +6 -30
  79. package/es/core/SelectContainer/index.mdx +3 -15
  80. package/es/core/SingleCharacterInputContainer/index.mdx +7 -10
  81. package/es/core/SummaryList/index.mdx +2 -10
  82. package/es/core/Table/index.mdx +6 -30
  83. package/es/core/TextArea/index.mdx +6 -30
  84. package/es/core/TextInput/index.mdx +6 -30
  85. package/es/core/index.js +1 -0
  86. package/es/typography/HeadingCaption/index.mdx +1 -5
  87. package/es/typography/Hint/index.mdx +1 -5
  88. package/es/typography/NormalText/index.mdx +3 -15
  89. package/es/typography/Paragraph/index.mdx +3 -15
  90. package/esm/admin/AccessibilityMenu/index.js +49 -0
  91. package/esm/admin/AutoComplete/index.mdx +8 -30
  92. package/esm/admin/CopyToClipboard/index.mdx +1 -5
  93. package/esm/admin/Dropdown/Dropdown.stories.playwright.json +53 -0
  94. package/esm/admin/Dropdown/__stories__/AlignRight.js +1 -2
  95. package/esm/admin/Dropdown/__stories__/Default.js +1 -3
  96. package/esm/admin/Dropdown/__stories__/PlacementTop.js +1 -2
  97. package/esm/admin/Dropdown/index.mdx +3 -15
  98. package/esm/admin/Modal/Modal.stories.playwright.json +37 -0
  99. package/esm/admin/Modal/__stories__/AlertDialog.js +29 -12
  100. package/esm/admin/Modal/__stories__/Default.js +27 -10
  101. package/esm/admin/Modal/index.mdx +1 -5
  102. package/esm/app/Footer/Footer.mdx +3 -14
  103. package/esm/app/Header/index.mdx +3 -16
  104. package/esm/app/QrCodeViewer/index.mdx +1 -5
  105. package/esm/core/Accordion/index.js +40 -6
  106. package/esm/core/Accordion/index.mdx +2 -10
  107. package/esm/core/Button/__stories__/GroupingButtons.js +2 -1
  108. package/esm/core/Button/__stories__/GroupingButtonsAndLinks.js +2 -1
  109. package/esm/core/Button/__stories__/Warning.js +2 -1
  110. package/esm/core/Button/index.mdx +4 -20
  111. package/esm/core/Card/card.mdx +7 -35
  112. package/esm/core/Checkbox/checkbox.mdx +6 -30
  113. package/esm/core/DateInputContainer/index.mdx +4 -20
  114. package/esm/core/ErrorSummary/index.mdx +3 -15
  115. package/esm/core/FileUpload/index.mdx +1 -5
  116. package/esm/core/Link/link.mdx +4 -20
  117. package/esm/core/List/index.mdx +1 -5
  118. package/esm/core/NavList/index.mdx +1 -5
  119. package/esm/core/NotificationBanner/index.mdx +1 -5
  120. package/esm/core/PhaseBanner/index.mdx +1 -4
  121. package/esm/core/RadioContainer/index.mdx +6 -30
  122. package/esm/core/SelectContainer/index.mdx +3 -15
  123. package/esm/core/SingleCharacterInputContainer/index.mdx +7 -10
  124. package/esm/core/SummaryList/index.mdx +2 -10
  125. package/esm/core/Table/index.mdx +6 -30
  126. package/esm/core/TextArea/index.mdx +6 -30
  127. package/esm/core/TextInput/index.mdx +6 -30
  128. package/esm/core/index.js +1 -0
  129. package/esm/index.js +1 -1
  130. package/esm/typography/HeadingCaption/index.mdx +1 -5
  131. package/esm/typography/Hint/index.mdx +1 -5
  132. package/esm/typography/NormalText/index.mdx +3 -15
  133. package/esm/typography/Paragraph/index.mdx +3 -15
  134. package/package.json +3 -3
  135. package/src/admin/AccessibilityMenu/index.tsx +52 -0
  136. package/src/admin/AutoComplete/index.mdx +8 -30
  137. package/src/admin/CopyToClipboard/index.mdx +1 -5
  138. package/src/admin/Dropdown/Dropdown.stories.playwright.json +53 -0
  139. package/src/admin/Dropdown/__stories__/AlignRight.tsx +1 -1
  140. package/src/admin/Dropdown/__stories__/Default.tsx +1 -1
  141. package/src/admin/Dropdown/__stories__/PlacementTop.tsx +1 -1
  142. package/src/admin/Dropdown/index.mdx +3 -15
  143. package/src/admin/Modal/Modal.stories.playwright.json +37 -0
  144. package/src/admin/Modal/__stories__/AlertDialog.tsx +18 -3
  145. package/src/admin/Modal/__stories__/Default.tsx +18 -3
  146. package/src/admin/Modal/index.mdx +1 -5
  147. package/src/app/Footer/Footer.mdx +3 -14
  148. package/src/app/Header/index.mdx +3 -16
  149. package/src/app/QrCodeViewer/index.mdx +1 -5
  150. package/src/core/Accordion/index.mdx +2 -10
  151. package/src/core/Accordion/index.tsx +38 -4
  152. package/src/core/Button/__stories__/GroupingButtons.tsx +1 -0
  153. package/src/core/Button/__stories__/GroupingButtonsAndLinks.tsx +1 -0
  154. package/src/core/Button/__stories__/Warning.tsx +1 -0
  155. package/src/core/Button/index.mdx +4 -20
  156. package/src/core/Card/card.mdx +7 -35
  157. package/src/core/Checkbox/checkbox.mdx +6 -30
  158. package/src/core/DateInputContainer/index.mdx +4 -20
  159. package/src/core/ErrorSummary/index.mdx +3 -15
  160. package/src/core/FileUpload/index.mdx +1 -5
  161. package/src/core/Link/link.mdx +4 -20
  162. package/src/core/List/index.mdx +1 -5
  163. package/src/core/NavList/index.mdx +1 -5
  164. package/src/core/NotificationBanner/index.mdx +1 -5
  165. package/src/core/PhaseBanner/index.mdx +1 -4
  166. package/src/core/RadioContainer/index.mdx +6 -30
  167. package/src/core/SelectContainer/index.mdx +3 -15
  168. package/src/core/SingleCharacterInputContainer/index.mdx +7 -10
  169. package/src/core/SummaryList/index.mdx +2 -10
  170. package/src/core/Table/index.mdx +6 -30
  171. package/src/core/TextArea/index.mdx +6 -30
  172. package/src/core/TextInput/index.mdx +6 -30
  173. package/src/core/index.ts +1 -0
  174. package/src/typography/HeadingCaption/index.mdx +1 -5
  175. package/src/typography/Hint/index.mdx +1 -5
  176. package/src/typography/NormalText/index.mdx +3 -15
  177. package/src/typography/Paragraph/index.mdx +3 -15
  178. package/typography/HeadingCaption/index.mdx +1 -5
  179. package/typography/Hint/index.mdx +1 -5
  180. package/typography/NormalText/index.mdx +3 -15
  181. package/typography/Paragraph/index.mdx +3 -15
@@ -9,29 +9,17 @@ import NormalText from '@digigov/ui/typography/NormalText';
9
9
 
10
10
  ## How to use
11
11
 
12
- <Story
13
- packageName="@digigov/ui"
14
- component="typography/NormalText"
15
- story="Default.tsx"
16
- />
12
+ <Story packageName="@digigov/ui" component="typography/NormalText" story="Default.tsx" />
17
13
 
18
14
  ### Variants
19
15
 
20
- <Story
21
- packageName="@digigov/ui"
22
- component="typography/NormalText"
23
- story="Variants.tsx"
24
- />
16
+ <Story packageName="@digigov/ui" component="typography/NormalText" story="Variants.tsx" />
25
17
 
26
18
  ## Font override classes
27
19
 
28
20
  ### Font size
29
21
 
30
- <Story
31
- packageName="@digigov/ui"
32
- component="typography/NormalText"
33
- story="FontSizes.tsx"
34
- />
22
+ <Story packageName="@digigov/ui" component="typography/NormalText" story="FontSizes.tsx" />
35
23
 
36
24
  ### Font weight
37
25
 
@@ -17,29 +17,17 @@ import Paragraph from '@digigov/ui/typography/Paragraph';
17
17
 
18
18
  ### Lead paragraph
19
19
 
20
- <Story
21
- packageName="@digigov/ui"
22
- component="typography/Paragraph"
23
- story="LeadVariant.tsx"
24
- />
20
+ <Story packageName="@digigov/ui" component="typography/Paragraph" story="LeadVariant.tsx" />
25
21
 
26
22
  ### Small paragraph
27
23
 
28
- <Story
29
- packageName="@digigov/ui"
30
- component="typography/Paragraph"
31
- story="SmallVariant.tsx"
32
- />
24
+ <Story packageName="@digigov/ui" component="typography/Paragraph" story="SmallVariant.tsx" />
33
25
 
34
26
  ## Font override classes
35
27
 
36
28
  ### Font size
37
29
 
38
- <Story
39
- packageName="@digigov/ui"
40
- component="typography/Paragraph"
41
- story="FontSizes.tsx"
42
- />
30
+ <Story packageName="@digigov/ui" component="typography/Paragraph" story="FontSizes.tsx" />
43
31
 
44
32
  ### Font weight
45
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/ui",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
4
4
  "description": "@digigov reusable components toolkit",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -20,8 +20,8 @@
20
20
  "clsx": "1.1.1",
21
21
  "react": "^16.8.0 || ^17.0.0",
22
22
  "react-dom": "^16.8.0 || ^17.0.0",
23
- "@digigov/react-core": "0.23.0",
24
- "@digigov/react-extensions": "0.21.2"
23
+ "@digigov/react-core": "0.23.1",
24
+ "@digigov/react-extensions": "0.21.3"
25
25
  },
26
26
  "gitHead": "c903a46306f77f55ad7fc4d2e274006f39a6c871",
27
27
  "private": false,
@@ -1,3 +1,55 @@
1
+ import AccessibilityMenuOptionButtonBase, {
2
+ AccessibilityMenuOptionButtonProps as AccessibilityMenuOptionButtonBaseProps,
3
+ } from '@digigov/react-extensions/admin/AccessibilityMenuOptionButton';
4
+ import AccessibilityMenuSteps from '@digigov/react-extensions/admin/AccessibilityMenuSteps';
5
+ export interface AccessibilityMenuOptionButtonProps
6
+ extends AccessibilityMenuOptionButtonBaseProps {
7
+ steps?: 0 | 1 | 2 | 3 | 4;
8
+ }
9
+
10
+ import React, { useState } from 'react';
11
+
12
+ export const AccessibilityMenuOptionButton = React.forwardRef<
13
+ HTMLButtonElement,
14
+ AccessibilityMenuOptionButtonProps
15
+ >(function AccessibilityMenuOptionButton(
16
+ { steps = 0, children },
17
+ ref: React.Ref<HTMLButtonElement>
18
+ ) {
19
+ const [selected, setSelected] = useState(false);
20
+ const [activeStep, setActiveStep] = useState<number>(0);
21
+
22
+ const handleClick = () => {
23
+ if (!selected) {
24
+ setSelected(true);
25
+ if (steps > 0) {
26
+ setActiveStep(activeStep + 1);
27
+ }
28
+ } else {
29
+ if (steps > 0) {
30
+ if (steps > activeStep) {
31
+ setActiveStep(activeStep + 1);
32
+ } else {
33
+ setActiveStep(0);
34
+ setSelected(false);
35
+ }
36
+ } else {
37
+ setSelected(false);
38
+ }
39
+ }
40
+ };
41
+ return (
42
+ <AccessibilityMenuOptionButtonBase
43
+ onClick={handleClick}
44
+ ref={ref}
45
+ selected={selected}
46
+ >
47
+ {children}
48
+ <AccessibilityMenuSteps steps={steps} activeStep={activeStep} />
49
+ </AccessibilityMenuOptionButtonBase>
50
+ );
51
+ });
52
+
1
53
  export * from '@digigov/react-extensions/admin/AccessibilityMenu';
2
54
  export * from '@digigov/react-extensions/admin/AccessibilityMenuButton';
3
55
  export * from '@digigov/react-extensions/admin/AccessibilityMenuContent';
@@ -16,51 +16,29 @@ import AutoComplete from '@digigov/ui/admin/AutoComplete';
16
16
 
17
17
  ### AutoComplete
18
18
 
19
- <Story
20
- packageName="@digigov/ui"
21
- component="admin/AutoComplete"
22
- story="Default.tsx"
23
- />
19
+ <Story packageName="@digigov/ui"
20
+ component="admin/AutoComplete"
21
+ story="Default.tsx" />
24
22
 
25
23
  ### AutoComplete with auto select
26
24
 
27
- <Story
28
- packageName="@digigov/ui"
29
- component="admin/AutoComplete"
30
- story="WithAutoSelect.tsx"
31
- />
25
+ <Story packageName="@digigov/ui" component="admin/AutoComplete" story="WithAutoSelect.tsx" />
32
26
 
33
27
  ### AutoComplete with inline style
34
28
 
35
- <Story
36
- packageName="@digigov/ui"
37
- component="admin/AutoComplete"
38
- story="WithInLine.tsx"
39
- />
29
+ <Story packageName="@digigov/ui" component="admin/AutoComplete" story="WithInLine.tsx" />
40
30
 
41
31
  ### AutoComplete with default value
42
32
 
43
- <Story
44
- packageName="@digigov/ui"
45
- component="admin/AutoComplete"
46
- story="WithDefaultValue.tsx"
47
- />
33
+ <Story packageName="@digigov/ui" component="admin/AutoComplete" story="WithDefaultValue.tsx" />
48
34
 
49
35
  ### AutoComplete with placeholder
50
36
 
51
- <Story
52
- packageName="@digigov/ui"
53
- component="admin/AutoComplete"
54
- story="WithPlaceHolder.tsx"
55
- />
37
+ <Story packageName="@digigov/ui" component="admin/AutoComplete" story="WithPlaceHolder.tsx" />
56
38
 
57
39
  ### AutoComplete with all option's values
58
40
 
59
- <Story
60
- packageName="@digigov/ui"
61
- component="admin/AutoComplete"
62
- story="WithShowAllValues.tsx"
63
- />
41
+ <Story packageName="@digigov/ui" component="admin/AutoComplete" story="WithShowAllValues.tsx" />
64
42
 
65
43
  ### AutoComplete with min length
66
44
 
@@ -11,11 +11,7 @@ import CopyToClipboard from '@digigov/ui/admin/CopyToClipboard';
11
11
 
12
12
  ### Default
13
13
 
14
- <Story
15
- packageName="@digigov/ui"
16
- component="admin/CopyToClipboard"
17
- story="Default.tsx"
18
- />
14
+ <Story packageName="@digigov/ui" component="admin/CopyToClipboard" story="Default.tsx" />
19
15
 
20
16
  ### Banner
21
17
 
@@ -0,0 +1,53 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-ui-admin-dropdown--align-right": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "click",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>div>details>summary"
12
+ }
13
+ }
14
+ ],
15
+ "id": "lWuaZaRFFDje",
16
+ "title": "Align right action"
17
+ }
18
+ ]
19
+ },
20
+ "digigov-ui-admin-dropdown--default": {
21
+ "actionSets": [
22
+ {
23
+ "actions": [
24
+ {
25
+ "name": "click",
26
+ "args": {
27
+ "selector": "html>body>div:nth-child(5)>details>summary"
28
+ }
29
+ }
30
+ ],
31
+ "id": "jCwDDNP3O4e8",
32
+ "title": "Open dropdown action"
33
+ }
34
+ ]
35
+ },
36
+ "digigov-ui-admin-dropdown--placement-top": {
37
+ "actionSets": [
38
+ {
39
+ "actions": [
40
+ {
41
+ "name": "click",
42
+ "args": {
43
+ "selector": "html>body>div:nth-child(5)>div>details>summary"
44
+ }
45
+ }
46
+ ],
47
+ "id": "w6MaGKfzgKOG",
48
+ "title": "Placement top action"
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ }
@@ -23,7 +23,7 @@ export const AlignRight = () => (
23
23
  alignItems: 'center',
24
24
  }}
25
25
  >
26
- <Dropdown align="right" open>
26
+ <Dropdown align="right">
27
27
  <DropdownButton
28
28
  role="button"
29
29
  aria-haspopup="true"
@@ -16,7 +16,7 @@ import { NavVerticalItem } from '@digigov/ui/core/NavList/NavVerticalItem';
16
16
  import { Button } from '@digigov/ui/core/Button';
17
17
 
18
18
  export const Default = () => (
19
- <Dropdown open>
19
+ <Dropdown>
20
20
  <DropdownButton
21
21
  role="button"
22
22
  aria-haspopup="true"
@@ -23,7 +23,7 @@ export const PlacementTop = () => (
23
23
  alignItems: 'center',
24
24
  }}
25
25
  >
26
- <Dropdown placement="top" open>
26
+ <Dropdown placement="top">
27
27
  <DropdownButton
28
28
  role="button"
29
29
  aria-haspopup="true"
@@ -11,31 +11,19 @@ import Dropdown from '@digigov/ui/admin/Dropdown';
11
11
 
12
12
  ## How to use
13
13
 
14
- <Story
15
- packageName="@digigov/ui"
16
- component="admin/Dropdown"
17
- story="Default.tsx"
18
- />
14
+ <Story packageName="@digigov/ui" component="admin/Dropdown" story="Default.tsx" />
19
15
 
20
16
  ### Dropdown with align right
21
17
 
22
18
  You can display the dropdown menu to the right side of the `Dropdown` button.
23
19
 
24
- <Story
25
- packageName="@digigov/ui"
26
- component="admin/Dropdown"
27
- story="AlignRight.tsx"
28
- />
20
+ <Story packageName="@digigov/ui" component="admin/Dropdown" story="AlignRight.tsx" />
29
21
 
30
22
  ### Dropdown with placement top
31
23
 
32
24
  You can display the dropdown menu to the top of the `Dropdown` button.
33
25
 
34
- <Story
35
- packageName="@digigov/ui"
36
- component="admin/Dropdown"
37
- story="PlacementTop.tsx"
38
- />
26
+ <Story packageName="@digigov/ui" component="admin/Dropdown" story="PlacementTop.tsx" />
39
27
 
40
28
  You can read more about the accessibility patterns used in our Dropdown
41
29
  implementation in the ARIA Authoring Practices Guide (APG) at
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-ui-admin-modal--alert-dialog": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "click",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>div>button"
12
+ }
13
+ }
14
+ ],
15
+ "id": "Dk4oIFwRzm6e",
16
+ "title": "Alert dialog action"
17
+ }
18
+ ]
19
+ },
20
+ "digigov-ui-admin-modal--default": {
21
+ "actionSets": [
22
+ {
23
+ "actions": [
24
+ {
25
+ "name": "click",
26
+ "args": {
27
+ "selector": "html>body>div:nth-child(5)>div>button"
28
+ }
29
+ }
30
+ ],
31
+ "id": "YyIZkcmdBlRP",
32
+ "title": "Open modal action"
33
+ }
34
+ ]
35
+ }
36
+ }
37
+ }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import {
4
4
  Modal,
@@ -11,10 +11,18 @@ import { Button } from '@digigov/ui/core/Button';
11
11
  import { Paragraph } from '@digigov/ui/typography/Paragraph';
12
12
 
13
13
  export const AlertDialog = () => {
14
+ const [open, setOpen] = useState(false);
14
15
  return (
15
16
  <div>
17
+ <Button
18
+ onClick={() => {
19
+ setOpen(!open);
20
+ }}
21
+ >
22
+ Άνοιξε Modal
23
+ </Button>
16
24
  <Modal
17
- open
25
+ open={open}
18
26
  role="alertdialog"
19
27
  aria-labelledby="modal-label"
20
28
  aria-describedby="modal-content"
@@ -27,7 +35,14 @@ export const AlertDialog = () => {
27
35
  </ModalContent>
28
36
  <ModalAction>
29
37
  <Button>Διαγραφή</Button>
30
- <Button variant="link">Ακύρωση</Button>
38
+ <Button
39
+ variant="link"
40
+ onClick={() => {
41
+ setOpen(!open);
42
+ }}
43
+ >
44
+ Ακύρωση
45
+ </Button>
31
46
  </ModalAction>
32
47
  </Modal>
33
48
  </div>
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import {
4
4
  Modal,
@@ -13,9 +13,17 @@ import { FieldContainer } from '@digigov/ui/core/FieldContainer';
13
13
  import { LabelContainer } from '@digigov/ui/core/LabelContainer';
14
14
 
15
15
  export const Default = () => {
16
+ const [open, setOpen] = useState(false);
16
17
  return (
17
18
  <div>
18
- <Modal open aria-labelledby="modal-label">
19
+ <Button
20
+ onClick={() => {
21
+ setOpen(!open);
22
+ }}
23
+ >
24
+ Άνοιξε Modal
25
+ </Button>
26
+ <Modal open={open} aria-labelledby="modal-label">
19
27
  <ModalHeading id="modal-label">Προσθήκη τηλεφώνου</ModalHeading>
20
28
  <ModalContent>
21
29
  <FieldContainer>
@@ -27,7 +35,14 @@ export const Default = () => {
27
35
  </ModalContent>
28
36
  <ModalAction>
29
37
  <Button>Υποβολή</Button>
30
- <Button variant="link">Ακύρωση</Button>
38
+ <Button
39
+ variant="link"
40
+ onClick={() => {
41
+ setOpen(!open);
42
+ }}
43
+ >
44
+ Ακύρωση
45
+ </Button>
31
46
  </ModalAction>
32
47
  </Modal>
33
48
  </div>
@@ -15,11 +15,7 @@ import Modal, {ModalHeading, ModalContent, ModalAction} from "@digigov/ui/admin/
15
15
 
16
16
  ### As an Alert Dialog
17
17
 
18
- <Story
19
- packageName="@digigov/ui"
20
- component="admin/Modal"
21
- story="AlertDialog.tsx"
22
- />
18
+ <Story packageName="@digigov/ui" component="admin/Modal" story="AlertDialog.tsx" />
23
19
 
24
20
  ## Accessibility
25
21
 
@@ -15,26 +15,15 @@ import Footer from '@digigov/ui/app/Footer';
15
15
 
16
16
  ### Footer with logos
17
17
 
18
- <Story
19
- packageName="@digigov/ui"
20
- component="app/Footer"
21
- story="FooterWithLogo.tsx"
22
- />
18
+ <Story packageName="@digigov/ui" component="app/Footer" story="FooterWithLogo.tsx" />
23
19
 
24
20
  ### Footer with secondary navigation
25
21
 
26
- <Story
27
- packageName="@digigov/ui"
28
- component="app/Footer"
29
- story="FooterWithSecondaryNavigation.tsx"
30
- />
22
+ <Story packageName="@digigov/ui" component="app/Footer" story="FooterWithSecondaryNavigation.tsx" />
31
23
 
32
24
  ### Footer with links to meta information
33
25
 
34
- <Story
35
- packageName="@digigov/ui"
36
- component="app/Footer"
37
- story="FooterWithLink.tsx"
26
+ <Story packageName="@digigov/ui" component="app/Footer" story="FooterWithLink.tsx"
38
27
  />
39
28
 
40
29
  ### All inclusive footer
@@ -11,28 +11,15 @@ import Header from '@digigov/ui/app/Header';
11
11
 
12
12
  ### Default header
13
13
 
14
- <Story
15
- title="### Default"
16
- packageName="@digigov/ui"
17
- component="app/Header"
18
- story="Default.tsx"
19
- />
14
+ <Story title="### Default" packageName="@digigov/ui" component="app/Header" story="Default.tsx" />
20
15
 
21
16
  ### Header with service name
22
17
 
23
- <Story
24
- packageName="@digigov/ui"
25
- component="app/Header"
26
- story="WithServiceName.tsx"
27
- />
18
+ <Story packageName="@digigov/ui" component="app/Header" story="WithServiceName.tsx" />
28
19
 
29
20
  ### Header with service logo and service name
30
21
 
31
- <Story
32
- packageName="@digigov/ui"
33
- component="app/Header"
34
- story="WithServiceNameAndLogo.tsx"
35
- />
22
+ <Story packageName="@digigov/ui" component="app/Header" story="WithServiceNameAndLogo.tsx" />
36
23
 
37
24
  ### Default header with navigation
38
25
 
@@ -11,11 +11,7 @@ import QrCodeViewer from '@digigov/ui/app/QrCodeViewer';
11
11
 
12
12
  ### Default QrCodeViewer
13
13
 
14
- <Story
15
- packageName="@digigov/ui"
16
- component="app/QrCodeViewer"
17
- story="Default.tsx"
18
- />
14
+ <Story packageName="@digigov/ui" component="app/QrCodeViewer" story="Default.tsx" />
19
15
 
20
16
  ### Custom QrCodeViewer
21
17
 
@@ -15,21 +15,13 @@ import Accordion from '@digigov/ui/core/Accordion';
15
15
 
16
16
  ## How to use
17
17
 
18
- <Story
19
- packageName="@digigov/ui"
20
- component="core/Accordion"
21
- story="Default.tsx"
22
- />
18
+ <Story packageName="@digigov/ui" component="core/Accordion" story="Default.tsx" />
23
19
 
24
20
  ### Accordion with Hints
25
21
 
26
22
  Accordions hide content, so the labels need to be clear. If necessary, you can add a summary line to help users understand what is in the section.
27
23
 
28
- <Story
29
- packageName="@digigov/ui"
30
- component="core/Accordion"
31
- story="WithHints.tsx"
32
- />
24
+ <Story packageName="@digigov/ui" component="core/Accordion" story="WithHints.tsx" />
33
25
 
34
26
  ## Accessibility
35
27
 
@@ -1,9 +1,11 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import Accordion from '@digigov/react-core/Accordion';
4
4
  import AccordionSection from '@digigov/react-core/AccordionSection';
5
5
  import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
6
- import AccordionSectionSummaryHeading from '@digigov/react-core/AccordionSectionSummaryHeading';
6
+ import AccordionSectionSummaryHeadingBase, {
7
+ AccordionSectionSummaryHeadingProps as AccordionSectionSummaryHeadingBaseProps,
8
+ } from '@digigov/react-core/AccordionSectionSummaryHeading';
7
9
  import AccordionSectionSummary from '@digigov/react-core/AccordionSectionSummary';
8
10
  import AccordionControls from '@digigov/react-core/AccordionControls';
9
11
  import withDeprecation from '@digigov/ui/utils/withDeprecation';
@@ -17,13 +19,45 @@ export const AccordionItemDetails = withDeprecation(AccordionSectionContent, {
17
19
  rename: 'AccordionSectionContent',
18
20
  });
19
21
 
22
+ export interface AccordionSectionSummaryHeadingProps
23
+ extends AccordionSectionSummaryHeadingBaseProps {
24
+ children: React.ReactNode;
25
+ }
26
+
27
+ const AccordionSectionSummaryHeading = React.forwardRef<
28
+ HTMLHeadingElement,
29
+ AccordionSectionSummaryHeadingProps
30
+ >(function AccordionSectionSummaryHeading({ children, ...props }, ref) {
31
+ const toggleExpanded = () => {
32
+ setExpanded(!isExpanded);
33
+ };
34
+ const [isExpanded, setExpanded] = useState(false);
35
+ return (
36
+ <AccordionSectionSummaryHeadingBase
37
+ ref={ref}
38
+ {...props}
39
+ onClick={toggleExpanded}
40
+ aria-expanded={isExpanded}
41
+ >
42
+ {children}
43
+ </AccordionSectionSummaryHeadingBase>
44
+ );
45
+ });
46
+
20
47
  export const AccordionItemSummary = withDeprecation(
21
48
  ({ children, ...props }) => {
49
+ const toggleExpanded = () => {
50
+ setExpanded(!isExpanded);
51
+ };
52
+ const [isExpanded, setExpanded] = useState(false);
22
53
  return (
23
54
  <AccordionSectionSummary {...props}>
24
- <AccordionSectionSummaryHeading>
55
+ <AccordionSectionSummaryHeadingBase
56
+ onClick={toggleExpanded}
57
+ aria-expanded={isExpanded}
58
+ >
25
59
  {children}
26
- </AccordionSectionSummaryHeading>
60
+ </AccordionSectionSummaryHeadingBase>
27
61
  </AccordionSectionSummary>
28
62
  );
29
63
  },
@@ -11,3 +11,4 @@ export const GroupingButtons = () => (
11
11
  <Button color="secondary">Αποθήκευση</Button>
12
12
  </ButtonGroup>
13
13
  );
14
+ export default GroupingButtons;
@@ -13,3 +13,4 @@ export const GroupingButtonsAndLinks = () => (
13
13
  <Link>Ακύρωση</Link>
14
14
  </ButtonGroup>
15
15
  );
16
+ export default GroupingButtonsAndLinks;
@@ -8,3 +8,4 @@ export const Warning = () => {
8
8
  </Button>
9
9
  );
10
10
  };
11
+ export default Warning;