@digigov/ui 1.2.0-a7ffb5dc → 2.0.0-4be8f7cc

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