@digigov/ui 1.2.0-a7ffb5dc → 2.0.0-462194bf

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 (445) hide show
  1. package/app/Footer/index.mdx +18 -5
  2. package/app/Header/index.mdx +7 -5
  3. package/app/Masthead/index.mdx +9 -4
  4. package/app/Modal/Modal.stories/index.js +2 -1
  5. package/app/Modal/Modal.stories.d.ts +1 -0
  6. package/app/Modal/__stories__/WithoutModalGaps/index.js +36 -0
  7. package/app/Modal/__stories__/WithoutModalGaps/package.json +6 -0
  8. package/app/Modal/__stories__/WithoutModalGaps.d.ts +3 -0
  9. package/app/Modal/auto.d.ts +2 -2
  10. package/app/Modal/index.d.ts +2 -2
  11. package/app/Modal/index.js +1 -1
  12. package/app/Modal/index.mdx +11 -4
  13. package/app/NotFound/index.mdx +2 -0
  14. package/app/Panel/index.mdx +9 -4
  15. package/app/PhaseBannerHeader/index.mdx +4 -4
  16. package/app/QrCodeViewer/QRCode.stories.d.ts +1 -0
  17. package/app/QrCodeViewer/index.d.ts +1 -0
  18. package/app/QrCodeViewer/index.js +2 -1
  19. package/app/QrCodeViewer/index.mdx +4 -4
  20. package/app/Skeleton/Skeleton.stories/index.js +17 -0
  21. package/{utils/Kitchensink/AllComponents → app/Skeleton/Skeleton.stories}/package.json +1 -1
  22. package/app/Skeleton/Skeleton.stories.d.ts +18 -0
  23. package/app/Skeleton/__stories__/Button/index.js +9 -0
  24. package/{utils/Kitchensink/KitchensinkComponent → app/Skeleton/__stories__/Button}/package.json +1 -1
  25. package/app/Skeleton/__stories__/Button.d.ts +3 -0
  26. package/app/Skeleton/__stories__/Circular/index.js +11 -0
  27. package/app/Skeleton/__stories__/Circular/package.json +6 -0
  28. package/app/Skeleton/__stories__/Circular.d.ts +3 -0
  29. package/app/Skeleton/__stories__/Default/index.js +7 -0
  30. package/app/Skeleton/__stories__/Default/package.json +6 -0
  31. package/app/Skeleton/__stories__/Default.d.ts +3 -0
  32. package/app/Skeleton/__stories__/NoAnimation/index.js +9 -0
  33. package/{utils/Kitchensink/KitchensinkByCategory → app/Skeleton/__stories__/NoAnimation}/package.json +1 -1
  34. package/app/Skeleton/__stories__/NoAnimation.d.ts +3 -0
  35. package/app/Skeleton/__stories__/Rectangular/index.js +10 -0
  36. package/app/Skeleton/__stories__/Rectangular/package.json +6 -0
  37. package/app/Skeleton/__stories__/Rectangular.d.ts +3 -0
  38. package/app/Skeleton/__stories__/SpecificWidthAndHeight/index.js +10 -0
  39. package/app/Skeleton/__stories__/SpecificWidthAndHeight/package.json +6 -0
  40. package/app/Skeleton/__stories__/SpecificWidthAndHeight.d.ts +3 -0
  41. package/app/Skeleton/__stories__/TextSizes/index.js +26 -0
  42. package/{utils/Kitchensink/KitchensinkByLetter → app/Skeleton/__stories__/TextSizes}/package.json +1 -1
  43. package/app/Skeleton/__stories__/TextSizes.d.ts +3 -0
  44. package/app/Skeleton/__stories__/UnderTypography/index.js +10 -0
  45. package/{form/AutoComplete/__stories__/WithInLine → app/Skeleton/__stories__/UnderTypography}/package.json +1 -1
  46. package/app/Skeleton/__stories__/UnderTypography.d.ts +3 -0
  47. package/app/Skeleton/__stories__/WithChildren/index.js +8 -0
  48. package/app/Skeleton/__stories__/WithChildren/package.json +6 -0
  49. package/app/Skeleton/__stories__/WithChildren.d.ts +3 -0
  50. package/app/Skeleton/index.d.ts +3 -0
  51. package/app/Skeleton/index.js +3 -0
  52. package/{misc/KitchenSink → app/Skeleton}/package.json +1 -1
  53. package/app/ThemeOptions/index.d.ts +2 -2
  54. package/cjs/app/Footer/index.mdx +18 -5
  55. package/cjs/app/Header/index.mdx +7 -5
  56. package/cjs/app/Masthead/index.mdx +9 -4
  57. package/cjs/app/Modal/Modal.stories/index.js +12 -0
  58. package/cjs/app/Modal/__stories__/WithoutModalGaps/index.js +46 -0
  59. package/cjs/app/Modal/index.js +1 -1
  60. package/cjs/app/Modal/index.mdx +11 -4
  61. package/cjs/app/NotFound/index.mdx +2 -0
  62. package/cjs/app/Panel/index.mdx +9 -4
  63. package/cjs/app/PhaseBannerHeader/index.mdx +4 -4
  64. package/cjs/app/QrCodeViewer/index.js +3 -2
  65. package/cjs/app/QrCodeViewer/index.mdx +4 -4
  66. package/cjs/app/Skeleton/Skeleton.stories/index.js +123 -0
  67. package/cjs/app/Skeleton/__stories__/Button/index.js +16 -0
  68. package/cjs/app/Skeleton/__stories__/Circular/index.js +18 -0
  69. package/cjs/app/Skeleton/__stories__/Default/index.js +14 -0
  70. package/cjs/app/Skeleton/__stories__/NoAnimation/index.js +16 -0
  71. package/cjs/app/Skeleton/__stories__/Rectangular/index.js +17 -0
  72. package/cjs/app/Skeleton/__stories__/SpecificWidthAndHeight/index.js +17 -0
  73. package/cjs/app/Skeleton/__stories__/TextSizes/index.js +33 -0
  74. package/cjs/app/Skeleton/__stories__/UnderTypography/index.js +17 -0
  75. package/cjs/app/Skeleton/__stories__/WithChildren/index.js +15 -0
  76. package/cjs/app/Skeleton/index.js +23 -0
  77. package/cjs/content/Accordion/__stories__/Auto/index.js +2 -3
  78. package/cjs/content/Accordion/hooks/index.js +0 -1
  79. package/cjs/content/Accordion/index.mdx +9 -5
  80. package/cjs/content/Blockquote/index.mdx +3 -5
  81. package/cjs/content/Card/index.mdx +3 -5
  82. package/cjs/content/Chip/index.mdx +4 -5
  83. package/cjs/content/Details/index.mdx +3 -5
  84. package/cjs/content/List/__stories__/Default/index.js +1 -2
  85. package/cjs/content/List/index.mdx +3 -5
  86. package/cjs/content/SafeHTML/index.js +5 -8
  87. package/cjs/content/StepNav/index.mdx +28 -5
  88. package/cjs/content/SummaryList/index.mdx +10 -5
  89. package/cjs/content/Table/index.js +2 -2
  90. package/cjs/content/Table/index.mdx +13 -14
  91. package/cjs/content/TaskList/index.mdx +9 -5
  92. package/cjs/content/Timeline/index.mdx +10 -5
  93. package/cjs/feedback/CopyToClipboard/index.mdx +3 -5
  94. package/cjs/feedback/ErrorSummary/index.mdx +3 -5
  95. package/cjs/feedback/NotificationBanner/index.mdx +14 -5
  96. package/cjs/feedback/PhaseBanner/index.mdx +8 -5
  97. package/cjs/feedback/WarningText/index.mdx +5 -5
  98. package/cjs/form/AutoComplete/AutoComplete.stories/index.js +44 -8
  99. package/cjs/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  100. package/cjs/form/AutoComplete/Status/index.js +12 -5
  101. package/cjs/form/AutoComplete/__stories__/Multiple/index.js +24 -0
  102. package/cjs/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +7 -6
  103. package/cjs/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +23 -0
  104. package/cjs/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +26 -0
  105. package/cjs/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
  106. package/cjs/form/AutoComplete/index.js +334 -206
  107. package/cjs/form/AutoComplete/index.mdx +13 -20
  108. package/cjs/form/AutoComplete/utils/index.js +2 -1
  109. package/cjs/form/Button/index.mdx +3 -5
  110. package/cjs/form/Checkbox/index.mdx +3 -5
  111. package/cjs/form/DateInputContainer/index.mdx +3 -5
  112. package/cjs/form/ErrorMessage/index.mdx +3 -5
  113. package/cjs/form/FileUpload/index.mdx +3 -5
  114. package/cjs/form/RadioContainer/index.mdx +2 -14
  115. package/cjs/form/SelectContainer/index.mdx +3 -1
  116. package/cjs/form/SingleCharacterInputs/index.mdx +3 -5
  117. package/cjs/form/TextArea/index.mdx +3 -5
  118. package/cjs/form/TextInput/TextInput.stories/index.js +12 -0
  119. package/cjs/form/TextInput/__stories__/DisabledInputWithValue/index.js +31 -0
  120. package/cjs/form/TextInput/index.mdx +3 -5
  121. package/cjs/govgr/Footer/index.mdx +1 -1
  122. package/cjs/i18n/locales/el/index.js +2 -2
  123. package/cjs/i18n/locales/en/index.js +2 -2
  124. package/cjs/layouts/Basic/Bottom/__stories__/Default/index.js +22 -0
  125. package/cjs/layouts/Basic/Bottom/index.mdx +9 -28
  126. package/cjs/layouts/Basic/Container/__stories__/Default/index.js +20 -0
  127. package/cjs/layouts/Basic/Container/index.mdx +23 -0
  128. package/cjs/layouts/Basic/Main/__stories__/Default/index.js +20 -0
  129. package/cjs/layouts/Basic/Main/index.mdx +10 -47
  130. package/cjs/layouts/Basic/Top/__stories__/Default/index.js +20 -0
  131. package/cjs/layouts/Basic/Top/index.mdx +10 -55
  132. package/cjs/layouts/Basic/index.mdx +27 -25
  133. package/cjs/layouts/Grid/index.mdx +39 -0
  134. package/cjs/lazy/index.js +152 -134
  135. package/cjs/navigation/BackLink/index.mdx +4 -5
  136. package/cjs/navigation/Breadcrumbs/index.mdx +6 -5
  137. package/cjs/navigation/Drawer/index.mdx +4 -10
  138. package/cjs/navigation/Dropdown/Dropdown.stories/index.js +12 -0
  139. package/cjs/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  140. package/cjs/navigation/Dropdown/__stories__/ScrollableContent/index.js +68 -0
  141. package/cjs/navigation/Dropdown/index.mdx +3 -5
  142. package/cjs/navigation/Link/index.mdx +5 -15
  143. package/cjs/navigation/NavList/__stories__/Default/index.js +14 -2
  144. package/cjs/navigation/NavList/__stories__/HorizontalWithDrawer/index.js +35 -2
  145. package/cjs/navigation/NavList/__stories__/HorizontalWithoutDrawer/index.js +35 -2
  146. package/cjs/navigation/NavList/__stories__/NavListWithoutNav/index.js +14 -2
  147. package/cjs/navigation/NavList/__stories__/UsingNavListAuto/index.js +37 -4
  148. package/cjs/navigation/NavList/__stories__/Vertical/index.js +14 -2
  149. package/cjs/navigation/NavList/__stories__/VerticalWithoutDrawer/index.js +35 -2
  150. package/cjs/navigation/NavList/index.mdx +23 -7
  151. package/cjs/navigation/Pagination/__stories__/PaginationWithSmallFont/index.js +2 -2
  152. package/cjs/navigation/Pagination/__stories__/WithResultsPerPage/index.js +2 -2
  153. package/cjs/navigation/Pagination/index.mdx +9 -5
  154. package/cjs/navigation/Tabs/index.mdx +9 -5
  155. package/cjs/registry/index.js +6 -12
  156. package/cjs/typography/Heading/index.mdx +3 -5
  157. package/cjs/typography/HeadingCaption/index.mdx +3 -5
  158. package/cjs/typography/Hint/index.mdx +3 -5
  159. package/cjs/typography/NormalText/index.mdx +3 -5
  160. package/cjs/typography/Paragraph/index.mdx +9 -30
  161. package/cjs/typography/Typography/index.js +23 -0
  162. package/cjs/typography/Typography/index.mdx +12 -0
  163. package/cjs/typography/index.js +11 -0
  164. package/cjs/utils/Base/index.mdx +13 -0
  165. package/cjs/utils/VisuallyHidden/index.mdx +10 -5
  166. package/content/Accordion/__stories__/Auto/index.js +2 -3
  167. package/content/Accordion/auto.d.ts +3 -3
  168. package/content/Accordion/hooks/index.js +0 -1
  169. package/content/Accordion/index.mdx +9 -5
  170. package/content/Blockquote/index.mdx +3 -5
  171. package/content/Card/index.mdx +3 -5
  172. package/content/Chip/index.mdx +4 -5
  173. package/content/Details/index.mdx +3 -5
  174. package/content/List/__stories__/Default/index.js +1 -2
  175. package/content/List/index.mdx +3 -5
  176. package/content/SafeHTML/index.d.ts +1 -1
  177. package/content/SafeHTML/index.js +5 -8
  178. package/content/StepNav/auto.d.ts +3 -3
  179. package/content/StepNav/index.mdx +28 -5
  180. package/content/SummaryList/index.mdx +10 -5
  181. package/content/Table/index.d.ts +1 -1
  182. package/content/Table/index.js +2 -2
  183. package/content/Table/index.mdx +13 -14
  184. package/content/TaskList/index.mdx +9 -5
  185. package/content/Timeline/index.mdx +10 -5
  186. package/feedback/CopyToClipboard/index.d.ts +1 -1
  187. package/feedback/CopyToClipboard/index.mdx +3 -5
  188. package/feedback/ErrorSummary/index.mdx +3 -5
  189. package/feedback/NotificationBanner/index.mdx +14 -5
  190. package/feedback/PhaseBanner/index.mdx +8 -5
  191. package/feedback/WarningText/index.mdx +5 -5
  192. package/form/AutoComplete/AutoComplete.stories/index.js +4 -1
  193. package/form/AutoComplete/AutoComplete.stories.d.ts +4 -1
  194. package/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  195. package/form/AutoComplete/Status/index.d.ts +4 -2
  196. package/form/AutoComplete/Status/index.js +11 -4
  197. package/form/AutoComplete/__stories__/Multiple/index.js +17 -0
  198. package/form/AutoComplete/__stories__/Multiple/package.json +6 -0
  199. package/form/AutoComplete/__stories__/Multiple.d.ts +3 -0
  200. package/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +6 -5
  201. package/form/AutoComplete/__stories__/MultipleShowingTwoSelected/package.json +6 -0
  202. package/form/AutoComplete/__stories__/MultipleShowingTwoSelected.d.ts +3 -0
  203. package/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +16 -0
  204. package/form/AutoComplete/__stories__/MultipleWithDefaultValues/package.json +6 -0
  205. package/form/AutoComplete/__stories__/MultipleWithDefaultValues.d.ts +3 -0
  206. package/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +19 -0
  207. package/form/AutoComplete/__stories__/MultipleWithMinLength/package.json +6 -0
  208. package/form/AutoComplete/__stories__/MultipleWithMinLength.d.ts +3 -0
  209. package/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
  210. package/form/AutoComplete/index.d.ts +13 -20
  211. package/form/AutoComplete/index.js +317 -201
  212. package/form/AutoComplete/index.mdx +13 -20
  213. package/form/AutoComplete/utils/index.js +2 -1
  214. package/form/AutoComplete/utils.d.ts +1 -0
  215. package/form/Button/index.mdx +3 -5
  216. package/form/Checkbox/index.mdx +3 -5
  217. package/form/DateInputContainer/index.mdx +3 -5
  218. package/form/ErrorMessage/index.mdx +3 -5
  219. package/form/FileUpload/index.mdx +3 -5
  220. package/form/RadioContainer/index.mdx +2 -14
  221. package/form/SelectContainer/index.mdx +3 -1
  222. package/form/SingleCharacterInputs/index.mdx +3 -5
  223. package/form/TextArea/index.mdx +3 -5
  224. package/form/TextInput/TextInput.stories/index.js +1 -0
  225. package/form/TextInput/TextInput.stories.d.ts +1 -0
  226. package/form/TextInput/__stories__/DisabledInputWithValue/index.js +25 -0
  227. package/form/TextInput/__stories__/DisabledInputWithValue/package.json +6 -0
  228. package/form/TextInput/__stories__/DisabledInputWithValue.d.ts +3 -0
  229. package/form/TextInput/index.mdx +3 -5
  230. package/govgr/Footer/index.mdx +1 -1
  231. package/i18n/locales/el/index.js +2 -2
  232. package/i18n/locales/en/index.js +2 -2
  233. package/index.js +1 -1
  234. package/layouts/Basic/Bottom/__stories__/Default/index.js +15 -0
  235. package/layouts/Basic/Bottom/__stories__/Default/package.json +6 -0
  236. package/layouts/Basic/Bottom/__stories__/Default.d.ts +3 -0
  237. package/layouts/Basic/Bottom/index.mdx +9 -28
  238. package/layouts/Basic/Container/__stories__/Default/index.js +13 -0
  239. package/layouts/Basic/Container/__stories__/Default/package.json +6 -0
  240. package/layouts/Basic/Container/__stories__/Default.d.ts +3 -0
  241. package/layouts/Basic/Container/index.mdx +23 -0
  242. package/layouts/Basic/Main/__stories__/Default/index.js +13 -0
  243. package/layouts/Basic/Main/__stories__/Default/package.json +6 -0
  244. package/layouts/Basic/Main/__stories__/Default.d.ts +3 -0
  245. package/layouts/Basic/Main/index.mdx +10 -47
  246. package/layouts/Basic/Top/__stories__/Default/index.js +13 -0
  247. package/layouts/Basic/Top/__stories__/Default/package.json +6 -0
  248. package/layouts/Basic/Top/__stories__/Default.d.ts +3 -0
  249. package/layouts/Basic/Top/index.mdx +10 -55
  250. package/layouts/Basic/index.mdx +27 -25
  251. package/layouts/Grid/index.mdx +39 -0
  252. package/lazy/index.js +120 -106
  253. package/lazy.d.ts +269 -267
  254. package/navigation/BackLink/index.mdx +4 -5
  255. package/navigation/Breadcrumbs/index.mdx +6 -5
  256. package/navigation/Drawer/auto.d.ts +3 -3
  257. package/navigation/Drawer/index.mdx +4 -10
  258. package/navigation/Dropdown/Dropdown.stories/index.js +1 -0
  259. package/navigation/Dropdown/Dropdown.stories.d.ts +1 -0
  260. package/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  261. package/navigation/Dropdown/__stories__/ScrollableContent/index.js +61 -0
  262. package/navigation/Dropdown/__stories__/ScrollableContent/package.json +6 -0
  263. package/navigation/Dropdown/__stories__/ScrollableContent.d.ts +3 -0
  264. package/navigation/Dropdown/index.d.ts +1 -1
  265. package/navigation/Dropdown/index.mdx +3 -5
  266. package/navigation/Link/index.mdx +5 -15
  267. package/navigation/NavList/__stories__/Default/index.js +13 -1
  268. package/navigation/NavList/__stories__/HorizontalWithDrawer/index.js +34 -1
  269. package/navigation/NavList/__stories__/HorizontalWithoutDrawer/index.js +34 -1
  270. package/navigation/NavList/__stories__/NavListWithoutNav/index.js +13 -1
  271. package/navigation/NavList/__stories__/UsingNavListAuto/index.js +35 -2
  272. package/navigation/NavList/__stories__/Vertical/index.js +13 -1
  273. package/navigation/NavList/__stories__/VerticalWithoutDrawer/index.js +34 -1
  274. package/navigation/NavList/index.mdx +23 -7
  275. package/navigation/NavList/types.d.ts +1 -2
  276. package/navigation/Pagination/__stories__/PaginationWithSmallFont/index.js +1 -1
  277. package/navigation/Pagination/__stories__/WithResultsPerPage/index.js +1 -1
  278. package/navigation/Pagination/auto.d.ts +4 -4
  279. package/navigation/Pagination/index.d.ts +2 -2
  280. package/navigation/Pagination/index.mdx +9 -5
  281. package/navigation/Tabs/auto.d.ts +2 -2
  282. package/navigation/Tabs/index.mdx +9 -5
  283. package/package.json +4 -6
  284. package/registry/index.js +6 -12
  285. package/registry.d.ts +4 -6
  286. package/src/app/Footer/index.mdx +18 -5
  287. package/src/app/Header/index.mdx +7 -5
  288. package/src/app/Masthead/index.mdx +9 -4
  289. package/src/app/Modal/Modal.stories.js +1 -0
  290. package/src/app/Modal/__stories__/WithoutModalGaps.tsx +52 -0
  291. package/src/app/Modal/index.mdx +11 -4
  292. package/src/app/Modal/index.tsx +1 -1
  293. package/src/app/NotFound/index.mdx +2 -0
  294. package/src/app/Panel/index.mdx +9 -4
  295. package/src/app/PhaseBannerHeader/index.mdx +4 -4
  296. package/src/app/QrCodeViewer/index.mdx +4 -4
  297. package/src/app/QrCodeViewer/index.tsx +2 -0
  298. package/src/app/Skeleton/Skeleton.stories.js +19 -0
  299. package/src/app/Skeleton/__stories__/Button.tsx +6 -0
  300. package/src/app/Skeleton/__stories__/Circular.tsx +8 -0
  301. package/src/app/Skeleton/__stories__/Default.tsx +6 -0
  302. package/src/app/Skeleton/__stories__/NoAnimation.tsx +6 -0
  303. package/src/app/Skeleton/__stories__/Rectangular.tsx +8 -0
  304. package/src/app/Skeleton/__stories__/SpecificWidthAndHeight.tsx +8 -0
  305. package/src/app/Skeleton/__stories__/TextSizes.tsx +14 -0
  306. package/src/app/Skeleton/__stories__/UnderTypography.tsx +17 -0
  307. package/src/app/Skeleton/__stories__/WithChildren.tsx +11 -0
  308. package/src/app/Skeleton/index.tsx +4 -0
  309. package/src/app/ThemeOptions/index.tsx +1 -1
  310. package/src/content/Accordion/__stories__/Auto.tsx +2 -2
  311. package/src/content/Accordion/auto.tsx +1 -1
  312. package/src/content/Accordion/hooks.ts +0 -1
  313. package/src/content/Accordion/index.mdx +9 -5
  314. package/src/content/Blockquote/index.mdx +3 -5
  315. package/src/content/Card/index.mdx +3 -5
  316. package/src/content/Chip/index.mdx +4 -5
  317. package/src/content/Details/index.mdx +3 -5
  318. package/src/content/List/__stories__/Default.tsx +3 -4
  319. package/src/content/List/index.mdx +3 -5
  320. package/src/content/SafeHTML/index.tsx +3 -4
  321. package/src/content/StepNav/index.mdx +28 -5
  322. package/src/content/SummaryList/index.mdx +10 -5
  323. package/src/content/Table/index.mdx +13 -14
  324. package/src/content/Table/index.tsx +2 -2
  325. package/src/content/TaskList/index.mdx +9 -5
  326. package/src/content/Timeline/index.mdx +10 -5
  327. package/src/feedback/CopyToClipboard/index.mdx +3 -5
  328. package/src/feedback/ErrorSummary/index.mdx +3 -5
  329. package/src/feedback/NotificationBanner/index.mdx +14 -5
  330. package/src/feedback/PhaseBanner/index.mdx +8 -5
  331. package/src/feedback/WarningText/index.mdx +5 -5
  332. package/src/form/AutoComplete/AutoComplete.stories.js +4 -1
  333. package/src/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  334. package/src/form/AutoComplete/Status/index.tsx +10 -6
  335. package/src/form/AutoComplete/__stories__/Multiple.tsx +18 -0
  336. package/src/form/AutoComplete/__stories__/{WithInLine.tsx → MultipleShowingTwoSelected.tsx} +3 -8
  337. package/src/form/AutoComplete/__stories__/MultipleWithDefaultValues.tsx +16 -0
  338. package/src/form/AutoComplete/__stories__/MultipleWithMinLength.tsx +29 -0
  339. package/src/form/AutoComplete/__stories__/WithShowAllValues.tsx +0 -1
  340. package/src/form/AutoComplete/index.mdx +13 -20
  341. package/src/form/AutoComplete/index.tsx +367 -215
  342. package/src/form/AutoComplete/utils.ts +3 -2
  343. package/src/form/Button/index.mdx +3 -5
  344. package/src/form/Checkbox/index.mdx +3 -5
  345. package/src/form/DateInputContainer/index.mdx +3 -5
  346. package/src/form/ErrorMessage/index.mdx +3 -5
  347. package/src/form/FileUpload/index.mdx +3 -5
  348. package/src/form/RadioContainer/index.mdx +2 -14
  349. package/src/form/SelectContainer/index.mdx +3 -1
  350. package/src/form/SingleCharacterInputs/index.mdx +3 -5
  351. package/src/form/TextArea/index.mdx +3 -5
  352. package/src/form/TextInput/TextInput.stories.js +1 -0
  353. package/src/form/TextInput/__stories__/DisabledInputWithValue.tsx +27 -0
  354. package/src/form/TextInput/index.mdx +3 -5
  355. package/src/govgr/Footer/index.mdx +1 -1
  356. package/src/i18n/locales/el.ts +2 -2
  357. package/src/i18n/locales/en.ts +2 -2
  358. package/src/layouts/Basic/Bottom/__stories__/Default.tsx +35 -0
  359. package/src/layouts/Basic/Bottom/index.mdx +9 -28
  360. package/src/layouts/Basic/Container/__stories__/Default.tsx +30 -0
  361. package/src/layouts/Basic/Container/index.mdx +23 -0
  362. package/src/layouts/Basic/Main/__stories__/Default.tsx +30 -0
  363. package/src/layouts/Basic/Main/index.mdx +10 -47
  364. package/src/layouts/Basic/Top/__stories__/Default.tsx +28 -0
  365. package/src/layouts/Basic/Top/index.mdx +10 -55
  366. package/src/layouts/Basic/index.mdx +27 -25
  367. package/src/layouts/Grid/index.mdx +39 -0
  368. package/src/lazy.js +18 -16
  369. package/src/navigation/BackLink/index.mdx +4 -5
  370. package/src/navigation/Breadcrumbs/index.mdx +6 -5
  371. package/src/navigation/Drawer/index.mdx +4 -10
  372. package/src/navigation/Dropdown/Dropdown.stories.js +1 -0
  373. package/src/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  374. package/src/navigation/Dropdown/__stories__/ScrollableContent.tsx +82 -0
  375. package/src/navigation/Dropdown/index.mdx +3 -5
  376. package/src/navigation/Link/index.mdx +5 -15
  377. package/src/navigation/NavList/__stories__/Default.tsx +18 -1
  378. package/src/navigation/NavList/__stories__/HorizontalWithDrawer.tsx +37 -1
  379. package/src/navigation/NavList/__stories__/HorizontalWithoutDrawer.tsx +37 -1
  380. package/src/navigation/NavList/__stories__/NavListWithoutNav.tsx +18 -1
  381. package/src/navigation/NavList/__stories__/UsingNavListAuto.tsx +39 -2
  382. package/src/navigation/NavList/__stories__/Vertical.tsx +18 -1
  383. package/src/navigation/NavList/__stories__/VerticalWithoutDrawer.tsx +37 -1
  384. package/src/navigation/NavList/index.mdx +23 -7
  385. package/src/navigation/NavList/types.tsx +1 -2
  386. package/src/navigation/Pagination/__stories__/PaginationWithSmallFont.tsx +1 -1
  387. package/src/navigation/Pagination/__stories__/WithResultsPerPage.tsx +1 -1
  388. package/src/navigation/Pagination/index.mdx +9 -5
  389. package/src/navigation/Tabs/index.mdx +9 -5
  390. package/src/registry.js +6 -12
  391. package/src/typography/Heading/index.mdx +3 -5
  392. package/src/typography/HeadingCaption/index.mdx +3 -5
  393. package/src/typography/Hint/index.mdx +3 -5
  394. package/src/typography/NormalText/index.mdx +3 -5
  395. package/src/typography/Paragraph/index.mdx +9 -30
  396. package/src/typography/Typography/index.mdx +12 -0
  397. package/src/typography/Typography/index.tsx +4 -0
  398. package/src/typography/index.ts +1 -0
  399. package/src/utils/Base/index.mdx +13 -0
  400. package/src/utils/VisuallyHidden/index.mdx +10 -5
  401. package/typography/Heading/index.mdx +3 -5
  402. package/typography/HeadingCaption/index.mdx +3 -5
  403. package/typography/Hint/index.mdx +3 -5
  404. package/typography/NormalText/index.mdx +3 -5
  405. package/typography/Paragraph/index.mdx +9 -30
  406. package/typography/Typography/index.d.ts +3 -0
  407. package/typography/Typography/index.js +3 -0
  408. package/typography/Typography/index.mdx +12 -0
  409. package/typography/Typography/package.json +6 -0
  410. package/typography/index.d.ts +1 -0
  411. package/typography/index.js +2 -1
  412. package/utils/Base/index.mdx +13 -0
  413. package/utils/VisuallyHidden/index.mdx +10 -5
  414. package/cjs/content/List/List.stories.playwright.json +0 -27
  415. package/cjs/layouts/Basic/Masthead/index.mdx +0 -65
  416. package/cjs/misc/KitchenSink/index.js +0 -93
  417. package/cjs/utils/Kitchensink/AllComponents/index.js +0 -16
  418. package/cjs/utils/Kitchensink/KitchensinkByCategory/index.js +0 -39
  419. package/cjs/utils/Kitchensink/KitchensinkByLetter/index.js +0 -26
  420. package/cjs/utils/Kitchensink/KitchensinkComponent/index.js +0 -55
  421. package/cjs/utils/Kitchensink/KitchensinkDashboard/index.js +0 -47
  422. package/content/List/List.stories.playwright.json +0 -27
  423. package/form/AutoComplete/__stories__/WithInLine.d.ts +0 -3
  424. package/layouts/Basic/Masthead/index.mdx +0 -65
  425. package/misc/KitchenSink/index.d.ts +0 -8
  426. package/misc/KitchenSink/index.js +0 -8
  427. package/src/content/List/List.stories.playwright.json +0 -27
  428. package/src/layouts/Basic/Masthead/index.mdx +0 -65
  429. package/src/misc/KitchenSink/index.tsx +0 -8
  430. package/src/utils/Kitchensink/AllComponents.tsx +0 -6
  431. package/src/utils/Kitchensink/KitchensinkByCategory.tsx +0 -56
  432. package/src/utils/Kitchensink/KitchensinkByLetter.tsx +0 -35
  433. package/src/utils/Kitchensink/KitchensinkComponent.tsx +0 -70
  434. package/src/utils/Kitchensink/KitchensinkDashboard.tsx +0 -56
  435. package/utils/Kitchensink/AllComponents/index.js +0 -9
  436. package/utils/Kitchensink/AllComponents.d.ts +0 -2
  437. package/utils/Kitchensink/KitchensinkByCategory/index.js +0 -32
  438. package/utils/Kitchensink/KitchensinkByCategory.d.ts +0 -6
  439. package/utils/Kitchensink/KitchensinkByLetter/index.js +0 -19
  440. package/utils/Kitchensink/KitchensinkByLetter.d.ts +0 -6
  441. package/utils/Kitchensink/KitchensinkComponent/index.js +0 -45
  442. package/utils/Kitchensink/KitchensinkComponent.d.ts +0 -10
  443. package/utils/Kitchensink/KitchensinkDashboard/index.js +0 -40
  444. package/utils/Kitchensink/KitchensinkDashboard/package.json +0 -6
  445. package/utils/Kitchensink/KitchensinkDashboard.d.ts +0 -5
@@ -5,7 +5,9 @@ import AutoCompleteInput from '@digigov/react-core/AutoCompleteInput';
5
5
  import AutoCompleteInputTypeahead from '@digigov/react-core/AutoCompleteInputTypeahead';
6
6
  import AutoCompleteResultList from '@digigov/react-core/AutoCompleteResultList';
7
7
  import AutoCompleteResultListItem from '@digigov/react-core/AutoCompleteResultListItem';
8
- import AutoCompleteWrapper from '@digigov/react-core/AutoCompleteWrapper';
8
+ import AutoCompleteContainer from '@digigov/react-core/AutoCompleteContainer';
9
+ import AutoCompleteMultipleInputContainer from '@digigov/react-core/AutoCompleteMultipleInputContainer';
10
+ import AutoCompleteMultipleInput from '@digigov/react-core/AutoCompleteMultipleInput';
9
11
 
10
12
  import { CaretIcon } from '@digigov/react-icons/CaretIcon';
11
13
  import Status from '@digigov/ui/form/AutoComplete/Status';
@@ -14,10 +16,15 @@ import {
14
16
  keyCodes,
15
17
  isPrintableKeyCode,
16
18
  } from '@digigov/ui/form/AutoComplete/utils';
19
+ import Checkbox, { CheckboxItem } from '../Checkbox';
20
+ import { Chip, ChipContainer } from '@digigov/ui/content/Chip';
21
+ import Button from '@digigov/ui/form/Button';
22
+ import { NormalText } from '@digigov/ui/typography/NormalText';
17
23
 
18
24
  export interface AutoCompleteProps {
19
25
  source: (query: string, syncResults: (options: string[]) => void) => void;
20
26
  id: string;
27
+ multiple?: boolean;
21
28
  tStatusResults?: (x: number, y: string) => string;
22
29
  tStatusNoResults?: () => string;
23
30
  tStatusQueryTooShort?: (x: number) => string;
@@ -25,30 +32,28 @@ export interface AutoCompleteProps {
25
32
  tNoResults?: () => string;
26
33
  tAssistiveHint?: () => string;
27
34
  templates?: {
28
- suggestion?: (value: any) => any;
35
+ suggestion?: (value: any, query: string | string[]) => any;
29
36
  inputValue?: (value: any) => string;
30
37
  };
31
38
  width?: '25%' | '33.3%' | '50%' | '66.6%' | '75%' | '100%' | 'full';
32
39
  autoselect?: boolean;
33
- defaultValue?: string;
34
- displayMenu?: 'overlay' | 'inline';
40
+ defaultValue?: string | string[];
35
41
  minLength?: number;
36
42
  name?: string;
37
43
  placeholder?: string;
38
44
  onConfirm?: (x: any) => void;
39
45
  confirmOnBlur?: boolean;
40
- showNoOptionsFound?: boolean;
41
- showAllValues?: boolean;
42
46
  required?: boolean;
43
- dropdownArrow?: React.ElementType;
47
+ numberOfSelected?: 1 | 2 | 3 | 'all';
44
48
  }
45
49
 
46
50
  export type State = {
47
51
  focused: any;
48
52
  hovered: any;
49
53
  menuOpen: boolean;
50
- options: string[];
54
+ options: any[];
51
55
  query: string;
56
+ selectedValues: any[];
52
57
  validChoiceMade: boolean;
53
58
  selected: any;
54
59
  ariaHint: boolean;
@@ -58,10 +63,8 @@ export type NewQueryProps = { menuOpen?: boolean; query?: string };
58
63
 
59
64
  export default class AutoComplete extends Component<AutoCompleteProps, State> {
60
65
  static defaultProps = {
61
- width: '33.3%',
66
+ width: 'full',
62
67
  autoselect: false,
63
- defaultValue: '',
64
- displayMenu: 'overlay',
65
68
  minLength: 0,
66
69
  name: 'ds-input-autocomplete',
67
70
  placeholder: '',
@@ -69,35 +72,37 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
69
72
  return;
70
73
  },
71
74
  confirmOnBlur: false,
72
- showNoOptionsFound: true,
73
- showAllValues: false,
74
75
  required: false,
75
76
  tNoResults: (): string => 'No results found',
76
77
  tAssistiveHint: (): string =>
77
78
  'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.',
78
- dropdownArrow: (props) => (
79
- <CaretIcon direction="down" size="sm" {...props} />
80
- ),
81
79
  };
82
80
 
83
81
  elementReferences = {};
84
- $pollInput: any;
85
82
 
86
83
  constructor(props: AutoCompleteProps) {
87
84
  super(props);
85
+ const customState: any = {};
86
+ if (Array.isArray(props.defaultValue)) {
87
+ customState.selectedValues = props.defaultValue as string[];
88
+ } else if (props.defaultValue) {
89
+ customState.selectedValues = [props.defaultValue as string];
90
+ }
88
91
 
89
92
  this.state = {
90
93
  focused: null,
91
94
  hovered: null,
92
95
  menuOpen: false,
93
- options: props.defaultValue ? [props.defaultValue] : [],
94
- query: props.defaultValue as string,
96
+ options: [],
97
+ query: this.props.multiple ? '' : (props.defaultValue as string) || '',
98
+ selectedValues: [],
95
99
  validChoiceMade: false,
96
100
  selected: null,
97
101
  ariaHint: true,
102
+ ...customState,
98
103
  };
99
-
100
104
  this.handleComponentBlur = this.handleComponentBlur.bind(this);
105
+ this.handleAutoCompleteBlur = this.handleAutoCompleteBlur.bind(this);
101
106
  this.handleKeyDown = this.handleKeyDown.bind(this);
102
107
  this.handleUpArrow = this.handleUpArrow.bind(this);
103
108
  this.handleDownArrow = this.handleDownArrow.bind(this);
@@ -106,17 +111,18 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
106
111
 
107
112
  this.handleListMouseLeave = this.handleListMouseLeave.bind(this);
108
113
 
109
- this.handleOptionBlur = this.handleOptionBlur.bind(this);
110
- this.handleOptionClick = this.handleOptionClick.bind(this);
114
+ if (this.props.multiple) {
115
+ this.handleOptionClick = this.handleOptionClickMultiple.bind(this);
116
+ } else {
117
+ this.handleOptionClick = this.handleOptionClick.bind(this);
118
+ }
111
119
  this.handleOptionFocus = this.handleOptionFocus.bind(this);
112
120
  this.handleOptionMouseDown = this.handleOptionMouseDown.bind(this);
113
121
  this.handleOptionMouseEnter = this.handleOptionMouseEnter.bind(this);
114
122
 
115
- this.handleInputBlur = this.handleInputBlur.bind(this);
116
123
  this.handleInputChange = this.handleInputChange.bind(this);
117
124
  this.handleInputFocus = this.handleInputFocus.bind(this);
118
125
 
119
- this.pollInputElement = this.pollInputElement.bind(this);
120
126
  this.getDirectInputChanges = this.getDirectInputChanges.bind(this);
121
127
  }
122
128
 
@@ -129,29 +135,14 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
129
135
  }
130
136
 
131
137
  componentDidMount(): void {
132
- this.pollInputElement();
133
- }
134
-
135
- componentWillUnmount(): void {
136
- clearTimeout(this.$pollInput);
137
- }
138
-
139
- // Applications like Dragon NaturallySpeaking will modify the
140
- // `input` field by directly changing its `.value`. These events
141
- // don't trigger our JavaScript event listeners, so we need to poll
142
- // to handle when and if they occur.
143
- pollInputElement(): void {
144
138
  this.getDirectInputChanges();
145
- this.$pollInput = setTimeout(() => {
146
- this.pollInputElement();
147
- }, 100);
139
+
148
140
  }
149
141
 
150
142
  getDirectInputChanges(): void {
151
143
  const inputReference = this.elementReferences[-1];
152
144
  const queryHasChanged =
153
- inputReference && inputReference.value !== this.state.query;
154
-
145
+ inputReference && inputReference.value !== (this.state.query ?? '');
155
146
  if (queryHasChanged) {
156
147
  this.handleInputChange({ target: { value: inputReference.value } });
157
148
  }
@@ -191,21 +182,24 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
191
182
  templateSuggestion(value: string): string {
192
183
  const suggestionTemplate =
193
184
  this.props.templates && this.props.templates.suggestion;
194
- return suggestionTemplate ? suggestionTemplate(value) : value;
185
+
186
+ return suggestionTemplate
187
+ ? suggestionTemplate(value, this.state.query)
188
+ : value;
195
189
  }
196
190
 
197
- handleComponentBlur(newState: NewQueryProps): void {
191
+ handleComponentBlur(newState?: NewQueryProps): void {
198
192
  const { options, query, selected } = this.state;
199
193
  let newQuery: string;
200
194
  if (this.props.confirmOnBlur) {
201
- newQuery = newState.query || query;
195
+ newQuery = newState?.query || query;
202
196
  this.props.onConfirm?.(options[selected as number]);
203
197
  } else {
204
198
  newQuery = query;
205
199
  }
206
200
  this.setState({
207
201
  focused: null,
208
- menuOpen: newState.menuOpen || false,
202
+ menuOpen: newState?.menuOpen || false,
209
203
  query: newQuery,
210
204
  selected: null,
211
205
  validChoiceMade: this.isQueryAnOption(newQuery, options),
@@ -218,72 +212,60 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
218
212
  });
219
213
  }
220
214
 
221
- handleOptionBlur(
222
- event: React.FocusEvent<HTMLLIElement>,
223
- index: number
224
- ): void {
225
- const { focused, menuOpen, options, selected } = this.state;
226
- const focusingOutsideComponent = event.relatedTarget === null;
215
+ handleAutoCompleteBlur(event, index?: number): void {
216
+ const { focused, options, query, selected } = this.state;
217
+ let focusingOutsideComponent = false;
218
+ if (event.relatedTarget === null) {
219
+ focusingOutsideComponent = true;
220
+ } else {
221
+ // This affects if we have multiple autocompletes in same page and we click the first button-arrow and then another button-arrow
222
+ focusingOutsideComponent =
223
+ this.elementReferences['button-arrow'] !== event.relatedTarget;
224
+ }
227
225
  const focusingInput = event.relatedTarget === this.elementReferences[-1];
228
- const focusingAnotherOption = focused !== index && focused !== -1;
229
- const blurComponent =
230
- (!focusingAnotherOption && focusingOutsideComponent) ||
231
- !(focusingAnotherOption || focusingInput);
232
- if (blurComponent) {
233
- const keepMenuOpen = menuOpen && isIosDevice();
234
- this.handleComponentBlur({
235
- menuOpen: keepMenuOpen,
236
- query: this.templateInputValue(options[selected as number]),
237
- });
226
+ const focusingButtonArrow =
227
+ this.elementReferences['button-arrow'] === event.relatedTarget || false;
228
+ let focusingAnotherOption = focused !== null && focused !== -1;
229
+ if (index !== undefined) {
230
+ focusingAnotherOption = focused !== index && focused !== -1;
238
231
  }
239
- }
232
+ // Check if the user clicks outside and not either on option, either on input or on button arrow
233
+ const blurComponent =
234
+ focusingOutsideComponent &&
235
+ !(focusingAnotherOption || focusingInput || focusingButtonArrow);
240
236
 
241
- handleInputBlur(): void {
242
- const { focused, menuOpen, options, query, selected } = this.state;
243
- const focusingAnOption = focused !== -1;
244
- if (!focusingAnOption) {
245
- const keepMenuOpen = menuOpen && isIosDevice();
237
+ if (blurComponent) {
238
+ // In handleInputBlur:
246
239
  const newQuery = isIosDevice()
247
240
  ? query
248
241
  : this.templateInputValue(options[selected as number]);
249
242
  this.handleComponentBlur({
250
- menuOpen: keepMenuOpen,
243
+ menuOpen: false,
251
244
  query: newQuery,
252
245
  });
253
246
  }
254
247
  }
255
248
 
256
249
  handleInputChange(event: { target: any }): void {
257
- const { minLength, source, showAllValues } = this.props;
250
+ const { source, minLength } = this.props;
258
251
  const autoselect = this.hasAutoselect();
259
252
  const query = event.target.value;
260
253
  const queryEmpty = query.length === 0;
261
- const queryChanged = this.state.query.length !== query.length;
262
- const queryLongEnough = query.length >= (minLength as number);
263
-
264
254
  this.setState({
265
255
  query,
266
256
  ariaHint: queryEmpty,
267
257
  });
268
-
269
- const searchForOptions =
270
- showAllValues || (!queryEmpty && queryChanged && queryLongEnough);
271
- if (searchForOptions) {
272
- source(query, (options) => {
273
- const optionsAvailable = options.length > 0;
274
- this.setState({
275
- menuOpen: optionsAvailable,
276
- options,
277
- selected: autoselect && optionsAvailable ? 0 : -1,
278
- validChoiceMade: false,
279
- });
280
- });
281
- } else if (queryEmpty || !queryLongEnough) {
258
+ const minLengthQuery =
259
+ minLength != undefined && minLength > query.length ? '' : query;
260
+ source(minLengthQuery, (options) => {
261
+ const optionsAvailable = options.length > 0;
282
262
  this.setState({
283
- menuOpen: false,
284
- options: [],
263
+ menuOpen: optionsAvailable,
264
+ options,
265
+ selected: autoselect && optionsAvailable ? 0 : -1,
266
+ validChoiceMade: false,
285
267
  });
286
- }
268
+ });
287
269
  }
288
270
 
289
271
  handleInputClick(
@@ -293,13 +275,13 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
293
275
  }
294
276
 
295
277
  handleInputFocus(): void {
278
+ const { source } = this.props;
296
279
  const { query, validChoiceMade, options } = this.state;
297
280
  const { minLength } = this.props;
298
281
  const shouldReopenMenu =
299
282
  !validChoiceMade &&
300
283
  query.length >= (minLength as number) &&
301
284
  options.length > 0;
302
-
303
285
  if (shouldReopenMenu) {
304
286
  this.setState(({ menuOpen }) => ({
305
287
  focused: -1,
@@ -307,7 +289,12 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
307
289
  selected: -1,
308
290
  }));
309
291
  } else {
310
- this.setState({ focused: -1 });
292
+ source(query, (options) => {
293
+ this.setState({
294
+ focused: -1,
295
+ options,
296
+ });
297
+ });
311
298
  }
312
299
  }
313
300
 
@@ -329,15 +316,43 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
329
316
  }
330
317
  }
331
318
 
319
+ handleOptionClickMultiple(index: number): void {
320
+ const selectedOption = this.state.options[index];
321
+ let selectedValues = this.state.selectedValues;
322
+ if (this.state.selectedValues.indexOf(selectedOption) === -1) {
323
+ selectedValues = selectedValues.concat([selectedOption]);
324
+ } else {
325
+ selectedValues.splice(
326
+ this.state.selectedValues.indexOf(selectedOption),
327
+ 1
328
+ );
329
+ }
330
+ this.props.onConfirm?.(selectedValues);
331
+ this.setState({
332
+ focused: index,
333
+ hovered: null,
334
+ menuOpen: true,
335
+ query: '',
336
+ selectedValues,
337
+ selected: index,
338
+ validChoiceMade: true,
339
+ });
340
+ this.forceUpdate();
341
+ }
342
+
332
343
  handleOptionClick(index: number): void {
333
344
  const selectedOption = this.state.options[index];
334
345
  const newQuery = this.templateInputValue(selectedOption);
335
346
  this.props.onConfirm?.(selectedOption);
347
+ const selectedValues = this.props.multiple
348
+ ? this.state.selectedValues.concat(selectedOption)
349
+ : [selectedOption];
336
350
  this.setState({
337
351
  focused: -1,
338
352
  hovered: null,
339
353
  menuOpen: false,
340
354
  query: newQuery,
355
+ selectedValues,
341
356
  selected: -1,
342
357
  validChoiceMade: true,
343
358
  });
@@ -367,7 +382,7 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
367
382
  handleDownArrow(event: { preventDefault: () => void }): void {
368
383
  event.preventDefault();
369
384
  // if not open, open
370
- if (this.props.showAllValues && this.state.menuOpen === false) {
385
+ if (this.state.menuOpen === false) {
371
386
  event.preventDefault();
372
387
  this.props.source('', (options) => {
373
388
  this.setState({
@@ -390,11 +405,7 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
390
405
 
391
406
  handleSpace(event: { preventDefault: () => void }): void {
392
407
  // if not open, open
393
- if (
394
- this.props.showAllValues &&
395
- this.state.menuOpen === false &&
396
- this.state.query === ''
397
- ) {
408
+ if (this.state.menuOpen === false && this.state.query === '') {
398
409
  event.preventDefault();
399
410
  this.props.source('', (options) => {
400
411
  this.setState({
@@ -416,6 +427,12 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
416
427
  const hasSelectedOption = this.state.selected >= 0;
417
428
  if (hasSelectedOption) {
418
429
  this.handleOptionClick(this.state.selected);
430
+ if (this.props.multiple) {
431
+ this.setState({
432
+ menuOpen: false,
433
+ focused: -1,
434
+ });
435
+ }
419
436
  }
420
437
  }
421
438
  }
@@ -454,6 +471,23 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
454
471
  query: this.state.query,
455
472
  });
456
473
  break;
474
+ case 'backspace':
475
+ if (this.props.multiple) {
476
+ if (this.state.query.length === 0 && this.state.selectedValues.length > 0) {
477
+ event.preventDefault();
478
+ const updatedSelectedValues = this.state.selectedValues.slice(0, -1);
479
+ this.setState({
480
+ selectedValues: updatedSelectedValues,
481
+ }, () => {
482
+ this.props.onConfirm?.(updatedSelectedValues);
483
+ });
484
+ break;
485
+ }
486
+ }
487
+ else {
488
+ this.props.onConfirm?.('');
489
+ break;
490
+ }
457
491
  default:
458
492
  if (isPrintableKeyCode(event.keyCode)) {
459
493
  this.handlePrintableKey(event);
@@ -466,44 +500,37 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
466
500
  const {
467
501
  id,
468
502
  width,
469
- displayMenu,
470
503
  minLength,
471
504
  name,
472
505
  placeholder,
473
506
  required,
474
- showAllValues,
475
507
  tNoResults,
476
508
  tStatusQueryTooShort,
477
509
  tStatusNoResults,
478
510
  tStatusSelectedOption,
479
511
  tStatusResults,
480
512
  tAssistiveHint,
481
- dropdownArrow: DropdownArrow,
513
+ multiple,
514
+ source,
482
515
  } = this.props;
483
516
  const {
484
517
  focused,
485
518
  hovered,
486
519
  menuOpen,
487
520
  options,
488
- query,
489
521
  selected,
490
522
  ariaHint,
491
523
  validChoiceMade,
492
524
  } = this.state;
493
525
  const autoselect = this.hasAutoselect();
494
-
526
+ const query = this.state.query ?? '';
495
527
  const inputFocused = focused === -1;
496
528
  const noOptionsAvailable = options.length === 0;
497
529
  const queryNotEmpty = query.length !== 0;
498
530
  const queryLongEnough = query.length >= (minLength as number);
499
531
  const showNoOptionsFound =
500
- this.props.showNoOptionsFound &&
501
- inputFocused &&
502
- noOptionsAvailable &&
503
- queryNotEmpty &&
504
- queryLongEnough;
532
+ inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;
505
533
  const componentIsFocused = focused !== null;
506
- const dropdownArrowClassName = `ds-autocomplete__dropdown-arrow-down`;
507
534
  const optionFocused = focused !== -1 && focused !== null;
508
535
  const menuIsVisible = menuOpen || showNoOptionsFound;
509
536
  const selectedOptionText = this.templateInputValue(options[selected]);
@@ -522,8 +549,74 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
522
549
  }
523
550
  : null;
524
551
 
552
+ const showAutoCompleteResultListItems = (
553
+ options: string[],
554
+ multiple: boolean
555
+ ) => {
556
+ {
557
+ return options.map((option, index) => {
558
+ const showFocused =
559
+ focused === -1 ? selected === index : focused === index;
560
+ const iosPosinsetHtml = isIosDevice() ? (
561
+ <span
562
+ id={`${id}__option-suffix--${index}`}
563
+ style={{
564
+ border: '0',
565
+ clip: 'rect(0 0 0 0)',
566
+ height: '1px',
567
+ marginBottom: '-1px',
568
+ marginRight: '-1px',
569
+ overflow: 'hidden',
570
+ padding: '0',
571
+ position: 'absolute',
572
+ whiteSpace: 'nowrap',
573
+ width: '1px',
574
+ }}
575
+ >
576
+ {index + 1} από {options.length}
577
+ </span>
578
+ ) : (
579
+ ''
580
+ );
581
+ return (
582
+ <AutoCompleteResultListItem
583
+ isFocused={showFocused}
584
+ isHovered={hovered}
585
+ index={index}
586
+ aria-selected={focused === index ? 'true' : 'false'}
587
+ key={index}
588
+ onBlur={(event) => this.handleAutoCompleteBlur(event, index)}
589
+ onClick={() => this.handleOptionClick(index)}
590
+ onMouseDown={this.handleOptionMouseDown}
591
+ onMouseEnter={() => this.handleOptionMouseEnter(index)}
592
+ ref={(optionEl) => {
593
+ this.elementReferences[index] = optionEl;
594
+ }}
595
+ role="option"
596
+ tabIndex={-1}
597
+ aria-posinset={index + 1}
598
+ aria-setsize={options.length}
599
+ >
600
+ {multiple ? (
601
+ <CheckboxItem
602
+ value={option}
603
+ checked={this.state.selectedValues.includes(option)}
604
+ onChange={() => { }}
605
+ >
606
+ {this.templateSuggestion(option)}
607
+ </CheckboxItem>
608
+ ) : (
609
+ this.templateSuggestion(option)
610
+ )}
611
+ {iosPosinsetHtml}
612
+ </AutoCompleteResultListItem>
613
+ );
614
+ });
615
+ }
616
+ };
617
+
525
618
  return (
526
- <AutoCompleteWrapper onKeyDown={this.handleKeyDown} width={width}>
619
+ <AutoCompleteContainer onKeyDown={this.handleKeyDown} width={width}>
527
620
  <Status
528
621
  id={id}
529
622
  length={options.length}
@@ -539,114 +632,171 @@ export default class AutoComplete extends Component<AutoCompleteProps, State> {
539
632
  tResults={tStatusResults}
540
633
  />
541
634
 
542
- {hintValue && <AutoCompleteInputTypeahead value={hintValue} />}
543
-
544
- <AutoCompleteInput
545
- aria-expanded={menuOpen ? 'true' : 'false'}
546
- aria-activedescendant={
547
- optionFocused ? `${id}__option--${focused}` : ''
548
- }
549
- aria-owns={`${id}__listbox`}
550
- aria-autocomplete={this.hasAutoselect() ? 'both' : 'list'}
551
- {...ariaDescribedProp}
552
- autoComplete="off"
553
- isFocused={componentIsFocused}
554
- showAllValues={this.props.showAllValues}
555
- id={id}
556
- onClick={(event) => this.handleInputClick(event)}
557
- onBlur={this.handleInputBlur}
558
- onChange={this.handleInputChange}
559
- onFocus={this.handleInputFocus}
560
- name={name}
561
- placeholder={placeholder}
562
- ref={(inputElement) => {
563
- this.elementReferences[-1] = inputElement;
564
- }}
565
- role="combobox"
566
- required={required}
567
- value={query}
568
- />
569
-
570
- {showNoOptionsFound ||
571
- (showAllValues && !menuOpen && DropdownArrow && (
572
- <DropdownArrow
573
- type="button"
635
+ {hintValue && (placeholder === '' || !placeholder) && (
636
+ <AutoCompleteInputTypeahead value={hintValue} />
637
+ )}
638
+
639
+ {multiple ? (
640
+ <AutoCompleteMultipleInputContainer
641
+ isFocused={componentIsFocused}
642
+ numberOfSelected={this.props.numberOfSelected}
643
+ >
644
+ <ChipContainer>
645
+ {this.state.selectedValues.map((value, index) => {
646
+ return (
647
+ <Chip
648
+ key={index}
649
+ onDelete={() => {
650
+ this.setState(prevState => ({
651
+ selectedValues: prevState.selectedValues.filter(
652
+ (v) => {
653
+ if (typeof v === "string") {
654
+ return v !== value;
655
+ } else {
656
+ return v.value !== value.value;
657
+ }
658
+ }
659
+ ),
660
+ }), () => {
661
+ this.props.onConfirm?.(this.state.selectedValues);
662
+ });
663
+ }}
664
+ >
665
+ {typeof value === "string" ? value : value.label.primary}
666
+ </Chip>
667
+ );
668
+ })}
669
+ {!componentIsFocused &&
670
+ typeof this.props.numberOfSelected === 'number' &&
671
+ this.state.selectedValues.length >
672
+ this.props.numberOfSelected && (
673
+ <NormalText fontWeight="bold" margin={0}>
674
+ +
675
+ {this.state.selectedValues.length -
676
+ this.props.numberOfSelected}
677
+ </NormalText>
678
+ )}
679
+ </ChipContainer>
680
+ <AutoCompleteMultipleInput
681
+ aria-expanded={menuOpen ? 'true' : 'false'}
682
+ aria-activedescendant={
683
+ optionFocused ? `${id}__option--${focused}` : ''
684
+ }
685
+ aria-owns={`${id}__listbox`}
686
+ aria-autocomplete={this.hasAutoselect() ? 'both' : 'list'}
687
+ {...ariaDescribedProp}
688
+ autoComplete="off"
689
+ // isFocused={componentIsFocused}
690
+ id={id}
691
+ onClick={(event) => this.handleInputClick(event)}
692
+ onBlur={(event) => this.handleAutoCompleteBlur(event)}
693
+ onChange={this.handleInputChange}
694
+ onFocus={this.handleInputFocus}
695
+ name={name}
696
+ placeholder={placeholder}
697
+ ref={(inputElement) => {
698
+ this.elementReferences[-1] = inputElement;
699
+ }}
700
+ role="combobox"
701
+ required={required}
702
+ value={query}
703
+ />
704
+ <Button
705
+ ref={(buttonElement) => {
706
+ this.elementReferences['button-arrow'] = buttonElement;
707
+ }}
708
+ variant="link"
574
709
  onClick={() => {
575
- this.elementReferences[-1].focus();
576
- this.handleInputChange({
577
- target: { value: query },
578
- });
710
+ if (!this.state.menuOpen) {
711
+ source(query, (options) => {
712
+ const optionsAvailable = options.length > 0;
713
+ this.setState({
714
+ menuOpen: optionsAvailable,
715
+ options,
716
+ selected: autoselect && optionsAvailable ? 0 : -1,
717
+ validChoiceMade: false,
718
+ });
719
+ });
720
+ } else {
721
+ this.setState({
722
+ menuOpen: false,
723
+ focused: null,
724
+ });
725
+ }
726
+ }}
727
+ onBlur={(event) => this.handleAutoCompleteBlur(event)}
728
+ >
729
+ <CaretIcon direction="down" size="md" />
730
+ </Button>
731
+
732
+ <AutoCompleteResultList
733
+ isVisible={menuIsVisible}
734
+ onMouseLeave={() => this.handleListMouseLeave()}
735
+ id={`${id}__listbox`}
736
+ role="listbox"
737
+ >
738
+ <Checkbox>
739
+ {showAutoCompleteResultListItems(options, multiple)}
740
+ </Checkbox>
741
+
742
+ {showNoOptionsFound && (
743
+ <AutoCompleteResultListItem empty>
744
+ {tNoResults?.()}
745
+ </AutoCompleteResultListItem>
746
+ )}
747
+ </AutoCompleteResultList>
748
+
749
+ <AutoCompleteAssistiveHint id={assistiveHintID}>
750
+ {tAssistiveHint?.()}
751
+ </AutoCompleteAssistiveHint>
752
+ </AutoCompleteMultipleInputContainer>
753
+ ) : (
754
+ <>
755
+ <AutoCompleteInput
756
+ aria-expanded={menuOpen ? 'true' : 'false'}
757
+ aria-activedescendant={
758
+ optionFocused ? `${id}__option--${focused}` : ''
759
+ }
760
+ aria-owns={`${id}__listbox`}
761
+ aria-autocomplete={this.hasAutoselect() ? 'both' : 'list'}
762
+ {...ariaDescribedProp}
763
+ autoComplete="off"
764
+ isFocused={componentIsFocused}
765
+ id={id}
766
+ onClick={(event) => this.handleInputClick(event)}
767
+ onBlur={this.handleAutoCompleteBlur}
768
+ onChange={this.handleInputChange}
769
+ onFocus={this.handleInputFocus}
770
+ name={name}
771
+ placeholder={placeholder}
772
+ ref={(inputElement) => {
773
+ this.elementReferences[-1] = inputElement;
579
774
  }}
580
- className={dropdownArrowClassName}
775
+ role="combobox"
776
+ required={required}
777
+ value={query}
581
778
  />
582
- ))}
583
-
584
- <AutoCompleteResultList
585
- displayMenu={displayMenu}
586
- isVisible={menuIsVisible}
587
- onMouseLeave={() => this.handleListMouseLeave()}
588
- id={`${id}__listbox`}
589
- role="listbox"
590
- >
591
- {options.map((option, index) => {
592
- const showFocused =
593
- focused === -1 ? selected === index : focused === index;
594
- const iosPosinsetHtml = isIosDevice() ? (
595
- <span
596
- id={`${id}__option-suffix--${index}`}
597
- style={{
598
- border: '0',
599
- clip: 'rect(0 0 0 0)',
600
- height: '1px',
601
- marginBottom: '-1px',
602
- marginRight: '-1px',
603
- overflow: 'hidden',
604
- padding: '0',
605
- position: 'absolute',
606
- whiteSpace: 'nowrap',
607
- width: '1px',
608
- }}
609
- >
610
- {index + 1} από {options.length}
611
- </span>
612
- ) : (
613
- ''
614
- );
615
-
616
- return (
617
- <AutoCompleteResultListItem
618
- isFocused={showFocused}
619
- isHovered={hovered}
620
- index={index}
621
- aria-selected={focused === index ? 'true' : 'false'}
622
- key={index}
623
- onBlur={(event) => this.handleOptionBlur(event, index)}
624
- onClick={() => this.handleOptionClick(index)}
625
- onMouseDown={this.handleOptionMouseDown}
626
- onMouseEnter={() => this.handleOptionMouseEnter(index)}
627
- ref={(optionEl) => {
628
- this.elementReferences[index] = optionEl;
629
- }}
630
- role="option"
631
- tabIndex={-1}
632
- aria-posinset={index + 1}
633
- aria-setsize={options.length}
634
- >
635
- {this.templateSuggestion(option)} {iosPosinsetHtml}
636
- </AutoCompleteResultListItem>
637
- );
638
- })}
639
- {showNoOptionsFound && (
640
- <AutoCompleteResultListItem empty>
641
- {tNoResults?.()}
642
- </AutoCompleteResultListItem>
643
- )}
644
- </AutoCompleteResultList>
645
-
646
- <AutoCompleteAssistiveHint id={assistiveHintID}>
647
- {tAssistiveHint?.()}
648
- </AutoCompleteAssistiveHint>
649
- </AutoCompleteWrapper>
779
+ <CaretIcon direction="down" size="md" />
780
+
781
+ <AutoCompleteResultList
782
+ isVisible={menuIsVisible}
783
+ onMouseLeave={() => this.handleListMouseLeave()}
784
+ id={`${id}__listbox`}
785
+ role="listbox"
786
+ >
787
+ {showAutoCompleteResultListItems(options, false)}
788
+ {showNoOptionsFound && (
789
+ <AutoCompleteResultListItem empty>
790
+ {tNoResults?.()}
791
+ </AutoCompleteResultListItem>
792
+ )}
793
+ </AutoCompleteResultList>
794
+ <AutoCompleteAssistiveHint id={assistiveHintID}>
795
+ {tAssistiveHint?.()}
796
+ </AutoCompleteAssistiveHint>
797
+ </>
798
+ )}
799
+ </AutoCompleteContainer>
650
800
  );
651
801
  }
652
802
  }
@@ -657,6 +807,8 @@ export {
657
807
  AutoCompleteInputTypeahead,
658
808
  AutoCompleteResultList,
659
809
  AutoCompleteResultListItem,
660
- AutoCompleteWrapper,
810
+ AutoCompleteContainer,
661
811
  AutoCompleteAssistiveHint,
812
+ AutoCompleteMultipleInputContainer,
813
+ AutoCompleteMultipleInput,
662
814
  };